using System; using System.Collections.Generic; using System.Diagnostics; 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.Text.RegularExpressions; using BepInEx; using BepInEx.Bootstrap; using BepInEx.Configuration; using BepInEx.Logging; using Dawn; using Dawn.Utils; using DunGen.Graph; using Dusk; using Dusk.Weights; using HarmonyLib; using LethalLevelLoader; 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: IgnoresAccessChecksTo("LethalLevelLoader")] [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+e4ce0a883bc5fc7e5d1b9ab81f68885acd679d9f")] [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")] [BepInDependency(/*Could not decode attribute arguments.*/)] public class LunarConfig : BaseUnityPlugin { internal static readonly string EXPORT_DIRECTORY = Path.Combine(Paths.ConfigPath, "LunarConfig"); internal static readonly string ITEM_FILE_NAME = "LunarConfigItems.cfg"; internal static readonly string ITEM_FILE = Path.Combine(EXPORT_DIRECTORY, ITEM_FILE_NAME); internal static readonly string ENEMY_FILE_NAME = "LunarConfigEnemies.cfg"; internal static readonly string ENEMY_FILE = Path.Combine(EXPORT_DIRECTORY, ENEMY_FILE_NAME); internal static readonly string MOON_FILE_NAME = "LunarConfigMoons.cfg"; internal static readonly string MOON_FILE = Path.Combine(EXPORT_DIRECTORY, MOON_FILE_NAME); internal static readonly string MAP_OBJECT_FILE_NAME = "LunarConfigMapObjects.cfg"; internal static readonly string MAP_OBJECT_FILE = Path.Combine(EXPORT_DIRECTORY, MAP_OBJECT_FILE_NAME); internal static readonly string DUNGEON_FILE_NAME = "LunarConfigDungeons.cfg"; internal static readonly string DUNGEON_FILE = Path.Combine(EXPORT_DIRECTORY, DUNGEON_FILE_NAME); internal static readonly string BUYABLE_FILE_NAME = "LunarConfigUnlockables.cfg"; internal static readonly string BUYABLE_FILE = Path.Combine(EXPORT_DIRECTORY, BUYABLE_FILE_NAME); internal static readonly string CENTRAL_FILE_NAME = "LunarConfigCentral.cfg"; internal static readonly string CENTRAL_FILE = Path.Combine(Paths.ConfigPath, CENTRAL_FILE_NAME); internal static readonly string WEATHER_INJECTION_FILE_NAME = "LunarConfigWeatherInjection.cfg"; internal static readonly string WEATHER_INJECTION_FILE = Path.Combine(Paths.ConfigPath, WEATHER_INJECTION_FILE_NAME); internal static readonly string DUNGEON_INJECTION_FILE_NAME = "LunarConfigDungeonInjection.cfg"; internal static readonly string DUNGEON_INJECTION_FILE = Path.Combine(Paths.ConfigPath, DUNGEON_INJECTION_FILE_NAME); internal static readonly string TAG_INJECTION_FILE_NAME = "LunarConfigTagInjection.cfg"; internal static readonly string TAG_INJECTION_FILE = Path.Combine(Paths.ConfigPath, TAG_INJECTION_FILE_NAME); internal static bool LLLPresent { get; private set; } 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)); LLLPresent = Chainloader.PluginInfos.ContainsKey("imabatby.lethallevelloader"); ((Registry)(object)LethalContent.Items).OnFreeze += central.InitItems; ((Registry)(object)LethalContent.Enemies).OnFreeze += central.InitEnemies; ((Registry)(object)LethalContent.Dungeons).OnFreeze += central.InitDungeons; ((Registry)(object)LethalContent.Moons).OnFreeze += central.InitMoons; ((Registry)(object)LethalContent.MapObjects).OnFreeze += central.InitMapObjects; ((Registry)(object)LethalContent.Unlockables).OnFreeze += central.InitUnlockables; ((Registry)(object)LethalContent.Weathers).OnFreeze += central.InitWeatherInjection; ((Registry)(object)LethalContent.Dungeons).OnFreeze += central.InitDungeonInjection; Logger.LogDebug((object)"Finished patching!"); } internal static void Unpatch() { Logger.LogDebug((object)"Unpatching..."); Harmony? harmony = Harmony; if (harmony != null) { harmony.UnpatchSelf(); } Logger.LogDebug((object)"Finished unpatching!"); } } public static class MiniLogger { private static ManualLogSource logger = Logger.CreateLogSource("LunarConfig"); public static void LogInfo(string message) { logger.LogInfo((object)message); } public static void LogWarning(string message) { logger.LogWarning((object)message); } public static void LogError(string message) { logger.LogError((object)message); } } public static class MyPluginInfo { public const string PLUGIN_GUID = "Crafty.LunarConfig"; public const string PLUGIN_NAME = "LunarConfig"; public const string PLUGIN_VERSION = "1.0.0"; } } namespace LunarConfig.Patches { internal class RoundManagerPatch { [HarmonyPatch(typeof(RoundManager), "SpawnScrapInLevel")] [HarmonyPriority(400)] [HarmonyBefore(new string[] { "mrov.WeatherRegistry" })] [HarmonyPrefix] private static void resetScrapMultipliers(RoundManager __instance) { try { __instance.scrapAmountMultiplier = 1f; __instance.scrapValueMultiplier = 0.4f; } catch (Exception arg) { MiniLogger.LogError($"An error occured while setting moon values, please report this!\n{arg}"); } } [HarmonyPatch(typeof(RoundManager), "SpawnScrapInLevel")] [HarmonyPriority(0)] [HarmonyAfter(new string[] { "mrov.WeatherRegistry" })] [HarmonyPrefix] private static void onScrapSpawnPrefix(RoundManager __instance) { LunarCentral central = LunarConfig.central; try { if (!LunarCentral.configureMoons) { return; } LunarConfigFile lunarConfigFile = central.files[LunarConfig.MOON_FILE_NAME]; DawnMoonInfo dawnInfo = SelectableLevelExtensions.GetDawnInfo(__instance.currentLevel); string text = LunarCentral.UUIDify(((object)((DawnBaseInfo)(object)dawnInfo).Key).ToString()); LunarConfigEntry lunarConfigEntry = lunarConfigFile.entries[LunarCentral.NiceifyDawnUUID(((DawnBaseInfo)(object)dawnInfo).Key.Key) + " - " + text]; HashSet enabledMoonSettings = LunarCentral.enabledMoonSettings; if (lunarConfigEntry.GetValue("Configure Content")) { if (enabledMoonSettings.Contains("Amount Multiplier")) { __instance.scrapAmountMultiplier *= lunarConfigEntry.GetValue("Amount Multiplier"); } if (enabledMoonSettings.Contains("Value Multiplier")) { __instance.scrapValueMultiplier *= lunarConfigEntry.GetValue("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 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 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 { internal class LLLTags { public static LunarCentral central = LunarConfig.central; public static void Init() { if (!LunarCentral.configureMoons) { return; } LunarConfigFile lunarConfigFile = central.files[LunarConfig.MOON_FILE_NAME]; lunarConfigFile.file.SaveOnConfigSet = false; ExtendedLevel val = default(ExtendedLevel); foreach (KeyValuePair, DawnMoonInfo> item in (Registry)(object)LethalContent.Moons) { string text = LunarCentral.UUIDify(((object)item.Key).ToString()); try { string text2 = LunarCentral.NiceifyDawnUUID(((NamespacedKey)item.Key).Key); DawnMoonInfo value = item.Value; LunarConfigEntry lunarConfigEntry = lunarConfigFile.AddEntry(text2 + " - " + text); SelectableLevel level = value.Level; LevelManager.TryGetExtendedLevel(level, ref val, (ContentType)2); if (!((Object)(object)val != (Object)null)) { continue; } string text3 = ""; foreach (ContentTag contentTag in ((ExtendedContent)val).ContentTags) { if (text3 != "") { text3 += ", "; } else if (!Utility.IsNullOrWhiteSpace(contentTag.contentTagName)) { text3 += contentTag.contentTagName; } } lunarConfigEntry.TryAddField(LunarCentral.enabledMoonSettings, "LLL Tags", "Tags allocated to the moon by LLL.\nSeparate tags with commas.", text3); if (!lunarConfigEntry.GetValue("Configure Content") || !LunarCentral.enabledMoonSettings.Contains("LLL Tags")) { continue; } List list = new List(); string[] array = LunarCentral.RemoveWhitespace(lunarConfigEntry.GetValue("LLL Tags")).ToLower().Split(","); foreach (string text4 in array) { if (!Utility.IsNullOrWhiteSpace(text4)) { list.Add(ContentTag.Create(text4)); } } ((ExtendedContent)val).ContentTags = list; } catch (Exception arg) { MiniLogger.LogError($"LunarConfig encountered an issue while configuring {text}, please report this!\n{arg}"); } } lunarConfigFile.file.Save(); lunarConfigFile.file.SaveOnConfigSet = true; } } public class LunarCentral { public Dictionary files = new Dictionary(); public static HashSet everyMoonTag = new HashSet(); public static bool mapObjectKeysInitialized = false; public static Dictionary mapObjectKeys = new Dictionary(); public static Dictionary items = new Dictionary(); public static Dictionary enemies = new Dictionary(); public static Dictionary moons = new Dictionary(); public static Dictionary dungeons = new Dictionary(); public static Dictionary mapObjects = new Dictionary(); public static Dictionary> moonKeys = new Dictionary>(); public static Dictionary> weatherKeys = new Dictionary>(); public static Dictionary> dungeonKeys = new Dictionary>(); public static bool clearOrphans = false; public static bool backCompat = true; public static Dictionary definedChallengeMoons = new Dictionary(); public static Dictionary definedChallengeMoonTimes = new Dictionary(); 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 moonItemsInitialized = false; public static bool moonEnemiesInitialized = false; public static bool moonDungeonsInitialized = false; public static bool moonObjectsInitialized = false; public static bool dungeonEnemiesInitialized = false; public static bool itemWeightsInitialized = false; public static bool enemyWeightsInitialized = false; public static bool dungeonWeightsInitialized = false; public static bool mapObjectCurvesInitialized = false; public static bool weatherInjectionInitialized = false; public static bool dungeonInjectionInitialized = false; public static bool tagInjectionInitialized = false; public static bool configureItems = false; public static bool configureEnemies = false; public static bool configureMoons = false; public static bool configureDungeons = false; public static bool configureMapObjects = false; public static bool configureUnlockables = false; public static bool configureWeatherInjection = false; public static bool configureDungeonInjection = false; public static bool configureTagInjection = false; public static bool useZeekScrap = true; public static bool useZeekWeight = false; public static HashSet enabledItemSettings = new HashSet(); public static HashSet enabledEnemySettings = new HashSet(); public static HashSet enabledMoonSettings = new HashSet(); public static HashSet enabledDungeonSettings = new HashSet(); public static HashSet enabledMapObjectSettings = new HashSet(); public static HashSet enabledUnlockableSettings = new HashSet(); public static HashSet enabledWeatherInjectionSettings = new HashSet(); public static HashSet enabledDungeonInjectionSettings = new HashSet(); public static HashSet enabledTagInjectionSettings = new HashSet(); public static HashSet enabledLockingMoons = new HashSet(); public static Dictionary cachedSpawnableScrap = new Dictionary(); public static Dictionary cachedDaytimeEnemies = new Dictionary(); public static Dictionary cachedInteriorEnemies = new Dictionary(); public static Dictionary cachedOutsideEnemies = new Dictionary(); public static Dictionary cachedDungeons = new Dictionary(); public static Dictionary, Dictionary> cachedInsideMapObjects = new Dictionary, Dictionary>(); public static Dictionary, Dictionary> cachedOutsideMapObjects = new Dictionary, Dictionary>(); public static Dictionary cachedWeatherSpawnableScrap = new Dictionary(); public static Dictionary cachedWeatherDaytimeEnemies = new Dictionary(); public static Dictionary cachedWeatherInteriorEnemies = new Dictionary(); public static Dictionary cachedWeatherOutsideEnemies = new Dictionary(); public static Dictionary cachedWeatherDungeons = new Dictionary(); public static Dictionary cachedDungeonSpawnableScrap = new Dictionary(); public static Dictionary cachedDungeonDaytimeEnemies = new Dictionary(); public static Dictionary cachedDungeonInteriorEnemies = new Dictionary(); public static Dictionary cachedDungeonOutsideEnemies = new Dictionary(); public static Dictionary cachedTagSpawnableScrap = new Dictionary(); public static Dictionary cachedTagDaytimeEnemies = new Dictionary(); public static Dictionary cachedTagInteriorEnemies = new Dictionary(); public static Dictionary cachedTagOutsideEnemies = new Dictionary(); public static Dictionary cachedTagDungeons = new Dictionary(); public static Dictionary, AnimationCurve>> defaultInsideMapObjectCurves = new Dictionary, AnimationCurve>>(); public static Dictionary, AnimationCurve>> defaultOutsideMapObjectCurves = new Dictionary, AnimationCurve>>(); public static Dictionary itemWeightString = new Dictionary(); public static Dictionary daytimeEnemyWeightString = new Dictionary(); public static Dictionary interiorEnemyWeightString = new Dictionary(); public static Dictionary outsideEnemyWeightString = new Dictionary(); public static Dictionary dungeonWeightString = new Dictionary(); public static Dictionary itemWeatherString = new Dictionary(); public static Dictionary daytimeEnemyWeatherString = new Dictionary(); public static Dictionary interiorEnemyWeatherString = new Dictionary(); public static Dictionary outsideEnemyWeatherString = new Dictionary(); public static Dictionary dungeonWeatherString = new Dictionary(); public static Dictionary itemDungeonString = new Dictionary(); public static Dictionary daytimeEnemyDungeonString = new Dictionary(); public static Dictionary interiorEnemyDungeonString = new Dictionary(); public static Dictionary outsideEnemyDungeonString = new Dictionary(); public static HashSet notConfiguredScrapMoons = new HashSet(); public static HashSet notConfiguredDaytimeMoons = new HashSet(); public static HashSet notConfiguredInteriorMoons = new HashSet(); public static HashSet notConfiguredOutsideMoons = new HashSet(); public static HashSet notConfiguredDungeonMoons = new HashSet(); public static HashSet notConfiguredInsideMapObjectMoons = new HashSet(); public static HashSet notConfiguredOutsideMapObjectMoons = new HashSet(); public static string UUIDify(string uuid) { return uuid.Replace("=", "").Replace("\n", "").Replace("\t", "") .Replace("\\", "") .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) { return NamespacedKey.NormalizeStringForNamespacedKey(uuid, true); } public static string RemoveWhitespace(string input) { return new string((from c in input.ToCharArray() where !char.IsWhiteSpace(c) select c).ToArray()); } public string CurveToString(AnimationCurve curve) { return ConfigManager.ParseString(curve); } public string? GetDawnUUID(Dictionary 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 dictionary = (Dictionary)propertyInfo.GetValue(config); if (dictionary == null || dictionary.Count == 0) { return; } foreach (KeyValuePair item in dictionary.ToList()) { ConfigDefinition oldDef = item.Key; string value = item.Value; if (oldDef.Section.StartsWith(oldSection)) { ConfigEntryBase val = ((IEnumerable)config.GetConfigEntries()).FirstOrDefault((Func)((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 dictionary = (Dictionary)propertyInfo.GetValue(cfg); dictionary.Clear(); } } public static AnimationCurve StringToCurve(string data) { return ConfigManager.ParseCurve(Regex.Replace(data, "[^0-9,E.;\\-]", "")); } public static void TrySetInsideCurve(string item, AnimationCurve curve, NamespacedKey moon) { if (curve.keys.Length != 0) { if (!defaultInsideMapObjectCurves.TryGetValue(item, out Dictionary, AnimationCurve> value)) { value = new Dictionary, AnimationCurve>(); defaultInsideMapObjectCurves[item] = value; } value[moon] = curve; } } public static void TrySetOutsideCurve(string item, AnimationCurve curve, NamespacedKey moon) { if (curve.keys.Length != 0) { if (!defaultOutsideMapObjectCurves.TryGetValue(item, out Dictionary, AnimationCurve> value)) { value = new Dictionary, AnimationCurve>(); defaultOutsideMapObjectCurves[item] = value; } value[moon] = curve; } } public static string ComprehendWeights(string weightString) { Dictionary dictionary = new Dictionary(); Dictionary dictionary2 = new Dictionary(); string[] array = weightString.Split(","); string[] array2 = array; foreach (string text in array2) { try { string[] array3 = text.Split(":"); string key = array3[0] + ":" + array3[1]; string text2 = array3[2]; if (text2.Contains("*")) { dictionary2[key] = dictionary2.GetValueOrDefault(key, 1f) * float.Parse(CleanNumber(text2)); } else if (text2.Contains("/")) { dictionary2[key] = dictionary2.GetValueOrDefault(key, 1f) / float.Parse(CleanNumber(text2)); } else { dictionary[key] = dictionary.GetValueOrDefault(key, 0) + int.Parse(CleanNumber(text2)); } } catch { } } dictionary = dictionary.Where((KeyValuePair kvp) => kvp.Value != 0).ToDictionary((KeyValuePair kvp) => kvp.Key, (KeyValuePair kvp) => kvp.Value); dictionary2 = dictionary2.Where((KeyValuePair kvp) => kvp.Value != 1f).ToDictionary((KeyValuePair kvp) => kvp.Key, (KeyValuePair kvp) => kvp.Value); return string.Join(", ", dictionary.Select((KeyValuePair kvp) => $"{kvp.Key}={kvp.Value}")) + ((dictionary.Count > 0 && dictionary2.Count > 0) ? ", " : "") + string.Join(", ", dictionary2.Select((KeyValuePair kvp) => $"{kvp.Key}=*{kvp.Value}")); } public void InitObjectKeys() { foreach (KeyValuePair, DawnMapObjectInfo> item in (Registry)(object)LethalContent.MapObjects) { mapObjectKeys[NiceifyDawnUUID(((NamespacedKey)item.Key).Key)] = ((object)item.Key).ToString(); } } public void InitConfig() { LunarConfigEntry lunarConfigEntry = files[LunarConfig.CENTRAL_FILE_NAME].entries["Configuration"]; } public void InitCentral() { MiniLogger.LogInfo("Initializing Central"); LunarConfigFile lunarConfigFile = AddFile(LunarConfig.CENTRAL_FILE, LunarConfig.CENTRAL_FILE_NAME); lunarConfigFile.file.SaveOnConfigSet = false; LunarConfigEntry lunarConfigEntry = lunarConfigFile.AddEntry("Configuration"); lunarConfigEntry.AddField("Configure Items", "Check this to generate and use configuration files for items.", defaultValue: true); lunarConfigEntry.AddField("Configure Enemies", "Check this to generate and use configuration files for enemies.", defaultValue: true); lunarConfigEntry.AddField("Configure Moons", "Check this to generate and use configuration files for moons.", defaultValue: true); lunarConfigEntry.AddField("Configure Dungeons", "Check this to generate and use configuration files for dungeons.", defaultValue: true); lunarConfigEntry.AddField("Configure Map Objects", "Check this to generate and use configuration files for map objects.", defaultValue: true); lunarConfigEntry.AddField("Configure Unlockables", "Check this to generate and use configuration files for unlockables.", defaultValue: true); lunarConfigEntry.AddField("Configure Weather Injection", "Check this to generate and use configuration files for weather injection.", defaultValue: true); lunarConfigEntry.AddField("Configure Dungeon Injection", "Check this to generate and use configuration files for dungeon injection.", defaultValue: true); lunarConfigEntry.AddField("Configure Tag Injection", "Check this to generate and use configuration files for tag injection.", defaultValue: true); lunarConfigEntry.AddField("Enable Backwards Compat", "Allows Lunar to look for config entries that are named using the previous v0.1.x system, I would advise turning this off after you have all your previous values.", defaultValue: false); lunarConfigEntry.AddField("Clear Orphaned Entries", "WARNING: Enabling this will delete any config entries that get disabled when the configuration is refreshed!", defaultValue: false); lunarConfigEntry.AddField("Use Simple Scrap Value", "Checking this will make items have a scrap value that already anticipates the *0.4.", defaultValue: false); lunarConfigEntry.AddField("Use Simple Weight", "Checking this will make items have their weight in pounds, already converting from Zeeker's formula.", defaultValue: false); backCompat = lunarConfigEntry.GetValue("Enable Backwards Compat"); clearOrphans = lunarConfigEntry.GetValue("Clear Orphaned Entries"); configureItems = lunarConfigEntry.GetValue("Configure Items"); configureEnemies = lunarConfigEntry.GetValue("Configure Enemies"); configureMoons = lunarConfigEntry.GetValue("Configure Moons"); configureDungeons = lunarConfigEntry.GetValue("Configure Dungeons"); configureMapObjects = lunarConfigEntry.GetValue("Configure Map Objects"); configureUnlockables = lunarConfigEntry.GetValue("Configure Unlockables"); configureWeatherInjection = lunarConfigEntry.GetValue("Configure Weather Injection"); configureDungeonInjection = lunarConfigEntry.GetValue("Configure Dungeon Injection"); configureTagInjection = lunarConfigEntry.GetValue("Configure Tag Injection"); useZeekScrap = !lunarConfigEntry.GetValue("Use Simple Scrap Value"); useZeekWeight = !lunarConfigEntry.GetValue("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("Can Be Inspected", "Disable this to disable configuring this property in item config entries.", defaultValue: true); lunarConfigEntry2.AddField("Disable Hands On Wall", "Enable this to enable configuring this property in item config entries.", defaultValue: false); lunarConfigEntry2.AddField("Disallow Utility Slot", "Enable this to enable configuring this property in item config entries.", defaultValue: false); lunarConfigEntry2.AddField("Highest Sale Percentage", "Enable this to enable configuring this property in item config entries.", defaultValue: false); lunarConfigEntry2.AddField("Hold Button Use", "Enable this to enable configuring this property in item config entries.", defaultValue: false); lunarConfigEntry2.AddField("Floor Y Offset", "Enable this to enable configuring this property in item config entries.", defaultValue: false); lunarConfigEntry2.AddField("Is Defensive Weapon", "Enable this to enable configuring this property in item config entries.", defaultValue: false); lunarConfigEntry2.AddField("Spawns On Ground", "Enable this to enable configuring this property in item config entries.", defaultValue: false); lunarConfigEntry2.AddField("Tooltips", "Disable this to disable configuring this property in item config entries.", defaultValue: true); lunarConfigEntry2.AddField("Vertical Offset", "Enable this to enable configuring this property in item config entries.", defaultValue: false); lunarConfigEntry2.AddField("Sold In Shop?", "Enable this to enable configuring this property in item config entries.", defaultValue: false); lunarConfigEntry2.AddField("Info Node Text", "Enable this to enable configuring this property in item config entries.", defaultValue: false); lunarConfigEntry2.AddField("Request Node Text", "Enable this to enable configuring this property in item config entries.", defaultValue: false); lunarConfigEntry2.AddField("Receipt Node Text", "Enable this to enable configuring this property in item config entries.", defaultValue: false); lunarConfigEntry2.AddField("Cost", "Disable this to disable configuring this property in item config entries.", defaultValue: true); lunarConfigEntry2.AddField("Tags", "Disable this to disable configuring this property in item config entries.", defaultValue: true); foreach (string key in lunarConfigEntry2.fields.Keys) { if (lunarConfigEntry2.GetValue(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("Diversity 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("Disable Increased Chance Interior", "Enable this to enable configuring this property in enemy config entries.", defaultValue: false); lunarConfigEntry3.AddField("Enemy HP", "Disable this to disable configuring this property in enemy config entries.", defaultValue: true); lunarConfigEntry3.AddField("Can Die?", "Disable this to disable configuring this property in enemy config entries.", defaultValue: true); lunarConfigEntry3.AddField("Destroy On Death?", "Disable this to disable configuring this property in enemy config entries.", defaultValue: true); lunarConfigEntry3.AddField("Can Destroy?", "Disable this to disable configuring this property in enemy config entries.", defaultValue: true); lunarConfigEntry3.AddField("Can Stun?", "Disable this to disable configuring this property in enemy config entries.", defaultValue: true); lunarConfigEntry3.AddField("Stun Difficulty", "Disable this to disable configuring this property in enemy config entries.", defaultValue: true); lunarConfigEntry3.AddField("Stun Time", "Disable this to disable configuring this property in enemy config entries.", defaultValue: true); lunarConfigEntry3.AddField("Bestiary Text", "Enable this to enable configuring this property in enemy config entries.", defaultValue: false); lunarConfigEntry3.AddField("Bestiary Keyword", "Enable this to enable configuring this property in enemy config entries.", defaultValue: false); lunarConfigEntry3.AddField("Tags", "Disable this to disable configuring this property in enemy config entries.", defaultValue: true); foreach (string key2 in lunarConfigEntry3.fields.Keys) { if (lunarConfigEntry3.GetValue(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("Offset Time", "Enable this to enable configuring this property in moon config entries.", defaultValue: false); lunarConfigEntry4.AddField("Can Spawn Shrouds?", "Disable this to disable configuring this property 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("Max Interior Diversity", "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 Probability Range", "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("Max Outside Diversity", "Disable this to disable configuring this property in moon config entries.", defaultValue: true); lunarConfigEntry4.AddField("Spawnable Outside Enemies", "Disable this to disable configuring this property in moon config entries.", defaultValue: true); lunarConfigEntry4.AddField("Min Scrap", "Disable this to disable configuring this property in moon config entries.", defaultValue: true); lunarConfigEntry4.AddField("Max Scrap", "Disable this to disable configuring this property in moon config entries.", defaultValue: true); lunarConfigEntry4.AddField("Min Scrap Total", "Enable this to enable configuring this property in moon config entries.", defaultValue: false); lunarConfigEntry4.AddField("Max Scrap Total", "Enable this to enable configuring this property in moon config entries.", defaultValue: false); lunarConfigEntry4.AddField("Interior Multiplier", "Disable this to disable configuring this property in moon config entries.", defaultValue: true); lunarConfigEntry4.AddField("Value Multiplier", "Disable this to disable configuring this property in moon config entries.", defaultValue: true); lunarConfigEntry4.AddField("Amount Multiplier", "Disable this to disable configuring this property in moon config entries.", defaultValue: true); lunarConfigEntry4.AddField("Spawnable Scrap", "Disable this to disable configuring this property in moon config entries.", defaultValue: true); lunarConfigEntry4.AddField("Possible Interiors", "Disable this to disable configuring this property in moon config entries.", defaultValue: true); lunarConfigEntry4.AddField("Tags", "Disable this to disable configuring this property in moon config entries.", defaultValue: true); lunarConfigEntry4.AddField("LLL Tags", "Disable this to disable configuring this property in moon config entries.", defaultValue: true); lunarConfigEntry4.AddField("Catalogue Index", "Disable this to disable configuring this property in moon config entries.", defaultValue: true); lunarConfigEntry4.AddField("Is Hidden? & Is Locked? Blacklist", "Add moons here that LunarConfig will ignore Is Hidden? and Is Locked? settings for, regardless of whether Configure Content is enabled.\nThis setting uses the Appropriate Aliases of moons!", ""); foreach (string key3 in lunarConfigEntry4.fields.Keys) { if (!key3.Equals("Is Hidden? & Is Locked? Blacklist") && lunarConfigEntry4.GetValue(key3)) { enabledMoonSettings.Add(key3); } } string[] array = lunarConfigEntry4.GetValue("Is Hidden? & Is Locked? Blacklist").Split(","); foreach (string text in array) { if (text != "") { enabledLockingMoons.Add(CleanString(text)); } } } if (configureDungeons) { LunarConfigEntry lunarConfigEntry5 = lunarConfigFile.AddEntry("Enabled Dungeon Settings"); lunarConfigEntry5.AddField("Random Size Min", "Disable this to disable configuring this property in dungeon config entries.", defaultValue: true); lunarConfigEntry5.AddField("Random Size Max", "Disable this to disable configuring this property in dungeon config entries.", defaultValue: true); lunarConfigEntry5.AddField("Map Tile Size", "Disable this to disable configuring this property in dungeon config entries.", defaultValue: true); lunarConfigEntry5.AddField("Clamp Range Min", "Disable this to disable configuring this property in dungeon config entries.", defaultValue: true); lunarConfigEntry5.AddField("Clamp Range Max", "Disable this to disable configuring this property in dungeon config entries.", defaultValue: true); lunarConfigEntry5.AddField("Tags", "Disable this to disable configuring this property in dungeon config entries.", defaultValue: true); foreach (string key4 in lunarConfigEntry5.fields.Keys) { if (lunarConfigEntry5.GetValue(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) Allow In Mineshaft?", "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) Minimum AI Nodes Before Spawning", "Disable this to disable configuring this property in map object config entries.", defaultValue: true); lunarConfigEntry6.AddField("(Outside) Level Curves", "Disable this to disable configuring this property in map object config entries.", defaultValue: true); lunarConfigEntry6.AddField("Tags", "Disable this to disable configuring this property in map object config entries.", defaultValue: true); foreach (string key5 in lunarConfigEntry6.fields.Keys) { if (lunarConfigEntry6.GetValue(key5)) { enabledMapObjectSettings.Add(key5); } } } if (configureUnlockables) { LunarConfigEntry lunarConfigEntry7 = lunarConfigFile.AddEntry("Enabled Unlockable Settings"); lunarConfigEntry7.AddField("Already Unlocked", "Disable this to disable configuring this property in unlockable config entries.", defaultValue: true); lunarConfigEntry7.AddField("Always In Stock", "Disable this to disable configuring this property in unlockable config entries.", defaultValue: true); lunarConfigEntry7.AddField("Can Store?", "Disable this to disable configuring this property in unlockable config entries.", defaultValue: true); lunarConfigEntry7.AddField("Is Placeable?", "Disable this to disable configuring this property in unlockable config entries.", defaultValue: true); lunarConfigEntry7.AddField("Luck Value", "Disable this to disable configuring this property in unlockable config entries.", defaultValue: true); lunarConfigEntry7.AddField("Max Number", "Disable this to disable configuring this property in unlockable config entries.", defaultValue: true); lunarConfigEntry7.AddField("Unlocked In Challenge File", "Disable this to disable configuring this property in unlockable config entries.", defaultValue: true); lunarConfigEntry7.AddField("Buy Keyword", "Enable this to enable configuring this property in unlockable config entries.", defaultValue: false); lunarConfigEntry7.AddField("Confirm Node Text", "Enable this to enable configuring this property in unlockable config entries.", defaultValue: false); lunarConfigEntry7.AddField("Info Node Text", "Enable this to enable configuring this property in unlockable config entries.", defaultValue: false); lunarConfigEntry7.AddField("Request Node Text", "Enable this to enable configuring this property in unlockable config entries.", defaultValue: false); lunarConfigEntry7.AddField("Shop Selection Node Text", "Enable this to enable configuring this property in unlockable config entries.", defaultValue: false); lunarConfigEntry7.AddField("Cost", "Disable this to disable configuring this property in unlockable config entries.", defaultValue: true); lunarConfigEntry7.AddField("Tags", "Disable this to disable configuring this property in unlockable config entries.", defaultValue: true); foreach (string key6 in lunarConfigEntry7.fields.Keys) { if (lunarConfigEntry7.GetValue(key6)) { enabledUnlockableSettings.Add(key6); } } } if (configureWeatherInjection) { LunarConfigEntry lunarConfigEntry8 = lunarConfigFile.AddEntry("Enabled Weather Injection Settings"); lunarConfigEntry8.AddField("Spawnable Scrap", "Disable this to disable configuring this property in weather injection config entries.", defaultValue: true); lunarConfigEntry8.AddField("Spawnable Daytime Enemies", "Disable this to disable configuring this property in weather injection config entries.", defaultValue: true); lunarConfigEntry8.AddField("Spawnable Interior Enemies", "Disable this to disable configuring this property in weather injection config entries.", defaultValue: true); lunarConfigEntry8.AddField("Spawnable Outside Enemies", "Disable this to disable configuring this property in weather injection config entries.", defaultValue: true); lunarConfigEntry8.AddField("Possible Interiors", "Disable this to disable configuring this property in weather injection config entries.", defaultValue: true); foreach (string key7 in lunarConfigEntry8.fields.Keys) { if (lunarConfigEntry8.GetValue(key7)) { enabledWeatherInjectionSettings.Add(key7); } } } if (configureDungeonInjection) { LunarConfigEntry lunarConfigEntry9 = lunarConfigFile.AddEntry("Enabled Dungeon Injection Settings"); lunarConfigEntry9.AddField("Spawnable Scrap", "Disable this to disable configuring this property in dungeon injection config entries.", defaultValue: true); lunarConfigEntry9.AddField("Spawnable Daytime Enemies", "Disable this to disable configuring this property in dungeon injection config entries.", defaultValue: true); lunarConfigEntry9.AddField("Spawnable Interior Enemies", "Disable this to disable configuring this property in dungeon injection config entries.", defaultValue: true); lunarConfigEntry9.AddField("Spawnable Outside Enemies", "Disable this to disable configuring this property in dungeon injection config entries.", defaultValue: true); foreach (string key8 in lunarConfigEntry9.fields.Keys) { if (lunarConfigEntry9.GetValue(key8)) { enabledDungeonInjectionSettings.Add(key8); } } } if (configureTagInjection) { LunarConfigEntry lunarConfigEntry10 = lunarConfigFile.AddEntry("Enabled Tag Injection Settings"); lunarConfigEntry10.AddField("Spawnable Scrap", "Disable this to disable configuring this property in tag injection config entries.", defaultValue: true); lunarConfigEntry10.AddField("Spawnable Daytime Enemies", "Disable this to disable configuring this property in tag injection config entries.", defaultValue: true); lunarConfigEntry10.AddField("Spawnable Interior Enemies", "Disable this to disable configuring this property in tag injection config entries.", defaultValue: true); lunarConfigEntry10.AddField("Spawnable Outside Enemies", "Disable this to disable configuring this property in tag injection config entries.", defaultValue: true); lunarConfigEntry10.AddField("Possible Interiors", "Disable this to disable configuring this property in tag injection config entries.", defaultValue: true); foreach (string key9 in lunarConfigEntry10.fields.Keys) { if (lunarConfigEntry10.GetValue(key9)) { enabledTagInjectionSettings.Add(key9); } } } ClearOrphanedEntries(lunarConfigFile.file); lunarConfigFile.file.Save(); lunarConfigFile.file.SaveOnConfigSet = true; everyMoonTag.Add("all"); everyMoonTag.Add("free"); everyMoonTag.Add("paid"); everyMoonTag.Add("custom"); everyMoonTag.Add("vanilla"); centralInitialized = true; } public void InitItems() { //IL_074d: Unknown result type (might be due to invalid IL or missing references) //IL_0757: Expected O, but got Unknown //IL_0784: Unknown result type (might be due to invalid IL or missing references) //IL_078e: Expected O, but got Unknown //IL_0cae: Unknown result type (might be due to invalid IL or missing references) //IL_0cb5: Expected O, but got Unknown //IL_0cbf: Unknown result type (might be due to invalid IL or missing references) //IL_0cc9: Expected O, but got Unknown //IL_0bf2: Unknown result type (might be due to invalid IL or missing references) //IL_0bfc: 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, DawnItemInfo> item2 in (Registry)(object)LethalContent.Items) { string text = UUIDify(((object)item2.Key).ToString()); try { string text2 = NiceifyDawnUUID(((NamespacedKey)item2.Key).Key); 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(); } 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?", "Affects several different aspects of an item to be scrap or not.", item.isScrap); lunarConfigEntry.TryAddField(enabledItemSettings, "Can Be Inspected", "Specifies whether an item can be inspected.", item.canBeInspected); lunarConfigEntry.TryAddField(enabledItemSettings, "Disable Hands On Wall", "Specifies whether holding the item against a wall will put the hands up.", item.disableHandsOnWall); lunarConfigEntry.TryAddField(enabledItemSettings, "Disallow Utility Slot", "Forces an item to not be allowed in the utility slot.", item.disallowUtilitySlot); lunarConfigEntry.TryAddField(enabledItemSettings, "Highest Sale Percentage", "Specifies the highest shop sales percentage the item can have.", item.highestSalePercentage); lunarConfigEntry.TryAddField(enabledItemSettings, "Hold Button Use", "Specifies whether holding a button triggers the item.", item.holdButtonUse); lunarConfigEntry.TryAddField(enabledItemSettings, "Floor Y Offset", "Specifies y-offset of the item when on the floor.", item.floorYOffset); lunarConfigEntry.TryAddField(enabledItemSettings, "Is Defensive Weapon", "Specifies whether an item is a weapon for certain interactions.", item.isDefensiveWeapon); lunarConfigEntry.TryAddField(enabledItemSettings, "Spawns On Ground", "Specifies whether an item spawns on the ground.", item.itemSpawnsOnGround); lunarConfigEntry.TryAddField(enabledItemSettings, "Tooltips", "Specifies the tooltips of an item.\nA semi-colon denotes a new line.", string.Join(",", item.toolTips)); lunarConfigEntry.TryAddField(enabledItemSettings, "Vertical Offset", "Specifies the vertical offset of an item.", item.verticalOffset); string defaultValue = "This is probably an item."; string defaultValue2 = "You are trying to buy an item."; string defaultValue3 = "You bought an item!"; int defaultValue4 = 15; if ((Object)(object)val4 != (Object)null) { defaultValue = val4.displayText.Replace("\n", ";"); } if ((Object)(object)val5 != (Object)null) { defaultValue2 = val5.displayText.Replace("\n", ";"); } if ((Object)(object)val6 != (Object)null) { defaultValue3 = val6.displayText.Replace("\n", ";"); } if (val3 != null) { defaultValue4 = val3.Cost.Provide(); } lunarConfigEntry.TryAddField(enabledItemSettings, "Sold In Shop?", "Whether or not an item is sold in the shop. If you are enabling this on an item that has it false by default, I advise you change the settings below.", val2 != null); lunarConfigEntry.TryAddField(enabledItemSettings, "Info Node Text", "The text of the terminal when viewing the info of an item. New lines are represented by semi-colons.", defaultValue); lunarConfigEntry.TryAddField(enabledItemSettings, "Request Node Text", "The text of the terminal when requesting an item. New lines are represented by semi-colons.", defaultValue2); lunarConfigEntry.TryAddField(enabledItemSettings, "Receipt Node Text", "The text of the terminal after purchasing an item. New lines are represented by semi-colons.", defaultValue3); lunarConfigEntry.TryAddField(enabledItemSettings, "Cost", "The cost of the item if it is sold in the shop.", defaultValue4); lunarConfigEntry.TryAddField(enabledItemSettings, "Tags", "Tags allocated to the item.\nSeparate tags with commas.", string.Join(", ", from tag in ((DawnBaseInfo)(object)value).AllTags() where tag.Namespace != "dawn_lib" select tag)); if (backCompat) { MigrateSection(lunarConfigFile.file, "LLL - " + item.itemName, text2 + " - " + text); } if (backCompat) { MigrateSection(lunarConfigFile.file, "LL - " + item.itemName, text2 + " - " + text); } if (lunarConfigEntry.GetValue("Configure Content")) { if (enabledItemSettings.Contains("Tags")) { HashSet hashSet = new HashSet(); string[] array = RemoveWhitespace(lunarConfigEntry.GetValue("Tags")).ToLower().Split(","); foreach (string text3 in array) { string[] array2 = text3.Split(":"); if (array2.Length == 1 && !Utility.IsNullOrWhiteSpace(array2[0])) { hashSet.Add(new NamespacedKey("lunarcontenttag", array2[0])); } else if (array2.Length == 2 && array2[0] != "dawn_lib") { hashSet.Add(new NamespacedKey(array2[0], array2[1])); } else if (!Utility.IsNullOrWhiteSpace(text3)) { MiniLogger.LogWarning("Incorrectly formatted tag '" + text3 + "' found on " + text); } } foreach (NamespacedKey tag in ((DawnBaseInfo)(object)value)._tags) { if (tag.Namespace == "dawn_lib") { hashSet.Add(tag); } } ((DawnBaseInfo)(object)value)._tags = hashSet; } ((DawnBaseInfo)(object)value).Internal_AddTag(DawnLibTags.LunarConfig); string[] array3 = lunarConfigEntry.GetValue("Appropriate Aliases").Split(","); foreach (string text4 in array3) { if (!Utility.IsNullOrWhiteSpace(text4)) { items[CleanString(text4)] = text; } } lunarConfigEntry.TrySetValue(enabledItemSettings, "Display Name", ref item.itemName); if ((Object)(object)val != (Object)null) { lunarConfigEntry.TrySetValue(enabledItemSettings, "Scan Name", ref val.headerText); lunarConfigEntry.TrySetValue(enabledItemSettings, "Scan Subtext", ref val.subText); lunarConfigEntry.TrySetValue(enabledItemSettings, "Scan Min Range", ref val.minRange); lunarConfigEntry.TrySetValue(enabledItemSettings, "Scan Max Range", ref val.maxRange); } if (useZeekScrap) { lunarConfigEntry.TrySetValue(enabledItemSettings, "Minimum Value", ref item.minValue); lunarConfigEntry.TrySetValue(enabledItemSettings, "Maximum Value", ref item.maxValue); } else { if (enabledItemSettings.Contains("Minimum Value")) { item.minValue = (int)Math.Round((double)lunarConfigEntry.GetValue("Minimum Value") * 2.5); } if (enabledItemSettings.Contains("Maximum Value")) { item.maxValue = (int)Math.Round((double)lunarConfigEntry.GetValue("Maximum Value") * 2.5); } } if (useZeekWeight) { lunarConfigEntry.TrySetValue(enabledItemSettings, "Weight", ref item.weight); } else if (enabledItemSettings.Contains("Weight")) { item.weight = lunarConfigEntry.GetValue("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); lunarConfigEntry.TrySetValue(enabledItemSettings, "Can Be Inspected", ref item.canBeInspected); lunarConfigEntry.TrySetValue(enabledItemSettings, "Disable Hands On Wall", ref item.disableHandsOnWall); lunarConfigEntry.TrySetValue(enabledItemSettings, "Disallow Utility Slot", ref item.disallowUtilitySlot); lunarConfigEntry.TrySetValue(enabledItemSettings, "Highest Sale Percentage", ref item.highestSalePercentage); lunarConfigEntry.TrySetValue(enabledItemSettings, "Hold Button Use", ref item.holdButtonUse); lunarConfigEntry.TrySetValue(enabledItemSettings, "Floor Y Offset", ref item.floorYOffset); lunarConfigEntry.TrySetValue(enabledItemSettings, "Is Defensive Weapon", ref item.isDefensiveWeapon); lunarConfigEntry.TrySetValue(enabledItemSettings, "Spawns On Ground", ref item.itemSpawnsOnGround); if (enabledItemSettings.Contains("Tooltips")) { item.toolTips = lunarConfigEntry.GetValue("Tooltips").Split(";"); } lunarConfigEntry.TrySetValue(enabledItemSettings, "Vertical Offset", ref item.verticalOffset); if (enabledItemSettings.Contains("Sold In Shop?")) { if (val2 != null) { if (!lunarConfigEntry.GetValue("Sold In Shop?") && val3 != null) { val3.PurchasePredicate = (ITerminalPurchasePredicate)new ConstantTerminalPredicate((TerminalPurchaseResult)(object)TerminalPurchaseResult.Hidden().SetFailure(true)); } } else if (lunarConfigEntry.GetValue("Sold In Shop?")) { TerminalNode val7 = ScriptableObject.CreateInstance(); TerminalNode val8 = ScriptableObject.CreateInstance(); TerminalNode val9 = ScriptableObject.CreateInstance(); ((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)(object)new SimpleProvider(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("Info Node Text").Replace(";", "\n"); } if ((Object)(object)val5 != (Object)null && enabledItemSettings.Contains("Request Node Text")) { val5.displayText = lunarConfigEntry.GetValue("Request Node Text").Replace(";", "\n"); } if ((Object)(object)val6 != (Object)null && enabledItemSettings.Contains("Receipt Node Text")) { val6.displayText = lunarConfigEntry.GetValue("Receipt Node Text").Replace(";", "\n"); } if (val3 != null && enabledItemSettings.Contains("Cost")) { val3.Cost = (IProvider)(object)new SimpleProvider(lunarConfigEntry.GetValue("Cost")); lunarConfigEntry.TrySetValue(enabledItemSettings, "Cost", ref item.creditsWorth); } } 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, DawnItemInfo> item3 in (Registry)(object)LethalContent.Items) { string text5 = UUIDify(((object)item3.Key).ToString()); items[CleanString(item3.Value.Item.itemName)] = text5; items[CleanString(((Object)item3.Value.Item).name)] = text5; items[CleanString(NiceifyDawnUUID(text5))] = text5; } } itemsInitialized = true; if (moonsInitialized && !moonItemsInitialized) { InitMoonItems(); } MiniLogger.LogInfo("Completed Initializing Items"); InitItemWeights(); } public void InitItemWeights() { //IL_05cc: Unknown result type (might be due to invalid IL or missing references) //IL_05d3: Expected O, but got Unknown //IL_0689: Unknown result type (might be due to invalid IL or missing references) //IL_0693: Expected O, but got Unknown if ((!enabledMoonSettings.Contains("Spawnable Scrap") && !enabledWeatherInjectionSettings.Contains("Spawnable Scrap") && !enabledDungeonInjectionSettings.Contains("Spawnable Scrap") && !enabledTagInjectionSettings.Contains("Spawnable Scrap")) || !moonsInitialized || !itemsInitialized || !weatherInjectionInitialized || !dungeonInjectionInitialized || !tagInjectionInitialized || itemWeightsInitialized) { return; } MiniLogger.LogInfo("Initializing Item Weights"); foreach (KeyValuePair 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 item2 in cachedWeatherSpawnableScrap) { string[] array3 = item2.Value.Split(","); foreach (string text2 in array3) { string[] array4 = text2.Split(":"); string uuid2 = array4[0]; string dawnUUID2 = GetDawnUUID(items, uuid2); if (dawnUUID2 != null) { itemWeatherString[dawnUUID2] = itemWeatherString.GetValueOrDefault(dawnUUID2, "") + item2.Key + ":" + CleanString(array4[1]) + ","; } } } foreach (KeyValuePair item3 in cachedDungeonSpawnableScrap) { string[] array5 = item3.Value.Split(","); foreach (string text3 in array5) { string[] array6 = text3.Split(":"); string uuid3 = array6[0]; string dawnUUID3 = GetDawnUUID(items, uuid3); if (dawnUUID3 != null) { itemDungeonString[dawnUUID3] = itemDungeonString.GetValueOrDefault(dawnUUID3, "") + item3.Key + ":" + CleanString(array6[1]) + ","; } } } foreach (KeyValuePair item4 in cachedTagSpawnableScrap) { string[] array7 = item4.Value.Split(","); foreach (string text4 in array7) { string[] array8 = text4.Split(":"); string uuid4 = array8[0]; string dawnUUID4 = GetDawnUUID(items, uuid4); if (dawnUUID4 != null) { itemWeightString[dawnUUID4] = itemWeightString.GetValueOrDefault(dawnUUID4, "") + item4.Key + ":" + CleanString(array8[1]) + ","; } } } SpawnWeightContext val2 = default(SpawnWeightContext); foreach (KeyValuePair, DawnItemInfo> item5 in (Registry)(object)LethalContent.Items) { string arg = UUIDify(((object)item5.Key).ToString()); try { DawnItemInfo value = item5.Value; DawnScrapItemInfo val = null; if (value.ScrapInfo != null) { val = value.ScrapInfo; string key = ((object)item5.Key).ToString(); foreach (DawnMoonInfo notConfiguredScrapMoon in notConfiguredScrapMoons) { ((SpawnWeightContext)(ref val2))..ctor(notConfiguredScrapMoon, (DawnDungeonInfo)null, (DawnWeatherEffectInfo)null); int? @for = val.Weights.GetFor(notConfiguredScrapMoon, ref val2); if (@for.HasValue && @for > 0) { Dictionary dictionary = itemWeightString; string[] obj = new string[5] { itemWeightString.GetValueOrDefault(key, ""), ((object)((DawnBaseInfo)(object)notConfiguredScrapMoon).Key).ToString(), ":", null, null }; int? num = @for; obj[3] = num.ToString(); obj[4] = ","; dictionary[key] = string.Concat(obj); } } } if (!((DawnBaseInfo)(object)value).HasTag(DawnLibTags.LunarConfig)) { ((DawnBaseInfo)(object)value).Internal_AddTag(DawnLibTags.LunarConfig); } WeightTableBuilder val3 = new WeightTableBuilder(); SpawnWeightsPreset val4 = new SpawnWeightsPreset(); List list = NamespacedConfigWeight.ConvertManyFromString(ComprehendWeights(itemWeightString.GetValueOrDefault(((object)item5.Key).ToString(), ""))); List list2 = NamespacedConfigWeight.ConvertManyFromString(ComprehendWeights(itemWeatherString.GetValueOrDefault(((object)item5.Key).ToString(), ""))); List list3 = NamespacedConfigWeight.ConvertManyFromString(ComprehendWeights(itemDungeonString.GetValueOrDefault(((object)item5.Key).ToString(), ""))); val4.SetupSpawnWeightsPreset(list, list3, list2, 0); val3.SetGlobalWeight((IWeighted)(object)val4); if (val != null) { val.Weights = val3.Build(); } else { value.ScrapInfo = new DawnScrapItemInfo(val3.Build()); } } catch (Exception arg2) { MiniLogger.LogError($"LunarConfig encountered an issue while configuring weights for {arg}, please report this!\n{arg2}"); } } itemWeightsInitialized = true; MiniLogger.LogInfo("Completed Initializing Item Weights"); } public void InitEnemies() { //IL_063c: Unknown result type (might be due to invalid IL or missing references) //IL_0646: Expected O, but got Unknown //IL_0673: Unknown result type (might be due to invalid IL or missing references) //IL_067d: Expected O, but got Unknown if (!centralInitialized) { InitCentral(); } MiniLogger.LogInfo("Initializing Enemies"); if (configureEnemies) { LunarConfigFile lunarConfigFile = AddFile(LunarConfig.ENEMY_FILE, LunarConfig.ENEMY_FILE_NAME); lunarConfigFile.file.SaveOnConfigSet = false; foreach (KeyValuePair, DawnEnemyInfo> item in (Registry)(object)LethalContent.Enemies) { string text = UUIDify(((object)item.Key).ToString()); try { string text2 = NiceifyDawnUUID(((NamespacedKey)item.Key).Key); 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(); if ((Object)(object)val != (Object)null) { text3 = val.headerText; } val2 = enemyType.enemyPrefab.GetComponent(); } 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, "Diversity Power Level", "The diversity power level an enemy occupies.", enemyType.DiversityPowerLevel); 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); lunarConfigEntry.TryAddField(enabledEnemySettings, "Disable Increased Chance Interior", "Do not increase the enemies weight on it's increased chance interior.\nAllows use of injection instead.", defaultValue: false); if ((Object)(object)val2 != (Object)null) { lunarConfigEntry.TryAddField(enabledEnemySettings, "Enemy HP", "The amount of HP an enemy has.", val2.enemyHP); } lunarConfigEntry.TryAddField(enabledEnemySettings, "Can Die?", "Whether or not an enemy can die.", enemyType.canDie); lunarConfigEntry.TryAddField(enabledEnemySettings, "Destroy On Death?", "Whether or not an enemy is destroyed on death.", enemyType.destroyOnDeath); lunarConfigEntry.TryAddField(enabledEnemySettings, "Can Destroy?", "Whether or not an enemy can be destroyed.", enemyType.canBeDestroyed); lunarConfigEntry.TryAddField(enabledEnemySettings, "Can Stun?", "Whether or not an enemy can be stunned.\nWARNING: Enabling this for enemies that have it disabled by default will likely cause issues, as the enemy most likely does not have stunning mechanics.", enemyType.canBeStunned); lunarConfigEntry.TryAddField(enabledEnemySettings, "Stun Difficulty", "Modifies the difficulty of using the zap gun on this enemy.", enemyType.stunGameDifficultyMultiplier); lunarConfigEntry.TryAddField(enabledEnemySettings, "Stun Time", "Modifies the duration this enemy stays stunned.", enemyType.stunTimeMultiplier); if ((Object)(object)val3 != (Object)null) { lunarConfigEntry.TryAddField(enabledEnemySettings, "Bestiary Text", "The text of the terminal when viewing the bestiary of an enemy. New lines are represented by semi-colons.", val3.displayText.Replace("\n", ";")); } if ((Object)(object)val4 != (Object)null) { lunarConfigEntry.TryAddField(enabledEnemySettings, "Bestiary Keyword", "The keyword to view the bestiary entry of an enemy.", val4.word); } lunarConfigEntry.TryAddField(enabledEnemySettings, "Tags", "Tags allocated to the enemy.\nSeparate tags with commas.", string.Join(", ", from tag in ((DawnBaseInfo)(object)value).AllTags() where tag.Namespace != "dawn_lib" select tag)); if (backCompat) { MigrateSection(lunarConfigFile.file, "LLL - " + enemyType.enemyName, text2 + " - " + text); } if (backCompat) { MigrateSection(lunarConfigFile.file, "LL - " + enemyType.enemyName, text2 + " - " + text); } if (lunarConfigEntry.GetValue("Configure Content")) { if (enabledEnemySettings.Contains("Tags")) { HashSet hashSet = new HashSet(); string[] array = RemoveWhitespace(lunarConfigEntry.GetValue("Tags")).ToLower().Split(","); foreach (string text4 in array) { string[] array2 = text4.Split(":"); if (array2.Length == 1 && !Utility.IsNullOrWhiteSpace(array2[0])) { hashSet.Add(new NamespacedKey("lunarcontenttag", array2[0])); } else if (array2.Length == 2 && array2[0] != "dawn_lib") { hashSet.Add(new NamespacedKey(array2[0], array2[1])); } else if (!Utility.IsNullOrWhiteSpace(text4)) { MiniLogger.LogWarning("Incorrectly formatted tag '" + text4 + "' found on " + text); } } foreach (NamespacedKey tag in ((DawnBaseInfo)(object)value)._tags) { if (tag.Namespace == "dawn_lib") { hashSet.Add(tag); } } ((DawnBaseInfo)(object)value)._tags = hashSet; } ((DawnBaseInfo)(object)value).Internal_AddTag(DawnLibTags.LunarConfig); string[] array3 = lunarConfigEntry.GetValue("Appropriate Aliases").Split(","); foreach (string text5 in array3) { if (!Utility.IsNullOrWhiteSpace(text5)) { enemies[CleanString(text5)] = text; } } if ((Object)(object)val != (Object)null) { lunarConfigEntry.TrySetValue(enabledEnemySettings, "Scan Name", ref val.headerText); lunarConfigEntry.TrySetValue(enabledEnemySettings, "Scan Subtext", ref val.subText); lunarConfigEntry.TrySetValue(enabledEnemySettings, "Scan Min Range", ref val.minRange); lunarConfigEntry.TrySetValue(enabledEnemySettings, "Scan Max Range", ref val.maxRange); } lunarConfigEntry.TrySetValue(enabledEnemySettings, "Can See Through Fog?", ref enemyType.canSeeThroughFog); lunarConfigEntry.TrySetValue(enabledEnemySettings, "Door Speed Multiplier", ref enemyType.doorSpeedMultiplier); lunarConfigEntry.TrySetValue(enabledEnemySettings, "Loudness Multiplier", ref enemyType.loudnessMultiplier); lunarConfigEntry.TrySetValue(enabledEnemySettings, "Max Count", ref enemyType.MaxCount); lunarConfigEntry.TrySetValue(enabledEnemySettings, "Power Level", ref enemyType.PowerLevel); lunarConfigEntry.TrySetValue(enabledEnemySettings, "Diversity Power Level", ref enemyType.DiversityPowerLevel); if (enabledEnemySettings.Contains("Probability Curve")) { enemyType.probabilityCurve = StringToCurve(lunarConfigEntry.GetValue("Probability Curve")); } lunarConfigEntry.TrySetValue(enabledEnemySettings, "Use Falloff?", ref enemyType.useNumberSpawnedFalloff); if (enabledEnemySettings.Contains("Falloff Curve")) { enemyType.numberSpawnedFalloff = StringToCurve(lunarConfigEntry.GetValue("Falloff Curve")); } lunarConfigEntry.TrySetValue(enabledEnemySettings, "Group Spawn Count", ref enemyType.spawnInGroupsOf); lunarConfigEntry.TrySetValue(enabledEnemySettings, "Normalized Time To Leave", ref enemyType.normalizedTimeInDayToLeave); if (enabledEnemySettings.Contains("Disable Increased Chance Interior") && lunarConfigEntry.GetValue("Disable Increased Chance Interior")) { enemyType.increasedChanceInterior = -1; } 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("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, DawnEnemyInfo> item2 in (Registry)(object)LethalContent.Enemies) { string text6 = UUIDify(((object)item2.Key).ToString()); EnemyType enemyType2 = item2.Value.EnemyType; string text7 = null; if ((Object)(object)enemyType2.enemyPrefab != (Object)null) { ScanNodeProperties componentInChildren = enemyType2.enemyPrefab.GetComponentInChildren(); if ((Object)(object)componentInChildren != (Object)null) { text7 = componentInChildren.headerText; } } enemies[CleanString(enemyType2.enemyName)] = text6; if (!Utility.IsNullOrWhiteSpace(text7)) { enemies[CleanString(text7)] = text6; } enemies[CleanString(NiceifyDawnUUID(text6))] = text6; } } enemiesInitialized = true; if (moonsInitialized && !moonEnemiesInitialized) { InitMoonEnemies(); } MiniLogger.LogInfo("Completed Initializing Enemies"); InitEnemyWeights(); } public void InitEnemyWeights() { //IL_05d1: Unknown result type (might be due to invalid IL or missing references) //IL_05d8: Expected O, but got Unknown //IL_0c93: Unknown result type (might be due to invalid IL or missing references) //IL_0c9a: Expected O, but got Unknown //IL_1355: Unknown result type (might be due to invalid IL or missing references) //IL_135c: Expected O, but got Unknown //IL_068e: Unknown result type (might be due to invalid IL or missing references) //IL_0698: Expected O, but got Unknown //IL_0d50: Unknown result type (might be due to invalid IL or missing references) //IL_0d5a: Expected O, but got Unknown //IL_1412: Unknown result type (might be due to invalid IL or missing references) //IL_141c: Expected O, but got Unknown if (!moonsInitialized || !enemiesInitialized || !weatherInjectionInitialized || !dungeonInjectionInitialized || enemyWeightsInitialized) { return; } if (enabledMoonSettings.Contains("Spawnable Daytime Enemies") || enabledDungeonInjectionSettings.Contains("Spawnable Daytime Enemies") || enabledWeatherInjectionSettings.Contains("Spawnable Daytime Enemies") || enabledTagInjectionSettings.Contains("Spawnable Daytime Enemies")) { MiniLogger.LogInfo("Initializing Daytime Weights"); foreach (KeyValuePair 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 cachedWeatherDaytimeEnemy in cachedWeatherDaytimeEnemies) { string[] array3 = cachedWeatherDaytimeEnemy.Value.Split(","); foreach (string text2 in array3) { string[] array4 = text2.Split(":"); string uuid2 = array4[0]; string dawnUUID2 = GetDawnUUID(enemies, uuid2); if (dawnUUID2 != null) { daytimeEnemyWeatherString[dawnUUID2] = daytimeEnemyWeatherString.GetValueOrDefault(dawnUUID2, "") + cachedWeatherDaytimeEnemy.Key + ":" + CleanString(array4[1]) + ","; } } } foreach (KeyValuePair cachedDungeonDaytimeEnemy in cachedDungeonDaytimeEnemies) { string[] array5 = cachedDungeonDaytimeEnemy.Value.Split(","); foreach (string text3 in array5) { string[] array6 = text3.Split(":"); string uuid3 = array6[0]; string dawnUUID3 = GetDawnUUID(enemies, uuid3); if (dawnUUID3 != null) { daytimeEnemyDungeonString[dawnUUID3] = daytimeEnemyDungeonString.GetValueOrDefault(dawnUUID3, "") + cachedDungeonDaytimeEnemy.Key + ":" + CleanString(array6[1]) + ","; } } } foreach (KeyValuePair cachedTagDaytimeEnemy in cachedTagDaytimeEnemies) { string[] array7 = cachedTagDaytimeEnemy.Value.Split(","); foreach (string text4 in array7) { string[] array8 = text4.Split(":"); string uuid4 = array8[0]; string dawnUUID4 = GetDawnUUID(enemies, uuid4); if (dawnUUID4 != null) { daytimeEnemyWeightString[dawnUUID4] = daytimeEnemyWeightString.GetValueOrDefault(dawnUUID4, "") + cachedTagDaytimeEnemy.Key + ":" + CleanString(array8[1]) + ","; } } } SpawnWeightContext val2 = default(SpawnWeightContext); foreach (KeyValuePair, DawnEnemyInfo> item in (Registry)(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) { ((SpawnWeightContext)(ref val2))..ctor(notConfiguredDaytimeMoon, (DawnDungeonInfo)null, (DawnWeatherEffectInfo)null); int? @for = val.Weights.GetFor(notConfiguredDaytimeMoon, ref val2); if (@for.HasValue && @for > 0) { Dictionary dictionary = daytimeEnemyWeightString; string[] obj = new string[5] { daytimeEnemyWeightString.GetValueOrDefault(key, ""), ((object)((DawnBaseInfo)(object)notConfiguredDaytimeMoon).Key).ToString(), ":", null, null }; int? num = @for; obj[3] = num.ToString(); obj[4] = ","; dictionary[key] = string.Concat(obj); } } } if (!((DawnBaseInfo)(object)value).HasTag(DawnLibTags.LunarConfig)) { ((DawnBaseInfo)(object)value).Internal_AddTag(DawnLibTags.LunarConfig); } WeightTableBuilder val3 = new WeightTableBuilder(); SpawnWeightsPreset val4 = new SpawnWeightsPreset(); List list = NamespacedConfigWeight.ConvertManyFromString(ComprehendWeights(daytimeEnemyWeightString.GetValueOrDefault(((object)item.Key).ToString(), ""))); List list2 = NamespacedConfigWeight.ConvertManyFromString(ComprehendWeights(daytimeEnemyWeatherString.GetValueOrDefault(((object)item.Key).ToString(), ""))); List list3 = NamespacedConfigWeight.ConvertManyFromString(ComprehendWeights(daytimeEnemyDungeonString.GetValueOrDefault(((object)item.Key).ToString(), ""))); val4.SetupSpawnWeightsPreset(list, list3, list2, 0); val3.SetGlobalWeight((IWeighted)(object)val4); if (val != null) { val.Weights = val3.Build(); continue; } value.Daytime = new DawnEnemyLocationInfo(val3.Build()); value.Daytime.ParentInfo = value; } catch (Exception arg2) { MiniLogger.LogError($"LunarConfig encountered an issue while configuring weights for {arg}, please report this!\n{arg2}"); } } MiniLogger.LogInfo("Completed Initializing Daytime Weights"); } if (enabledMoonSettings.Contains("Spawnable Interior Enemies") || enabledDungeonInjectionSettings.Contains("Spawnable Interior Enemies") || enabledWeatherInjectionSettings.Contains("Spawnable Interior Enemies") || enabledTagInjectionSettings.Contains("Spawnable Interior Enemies")) { MiniLogger.LogInfo("Initializing Interior Weights"); foreach (KeyValuePair cachedInteriorEnemy in cachedInteriorEnemies) { string[] array9 = cachedInteriorEnemy.Value.Split(","); foreach (string text5 in array9) { string[] array10 = text5.Split(":"); string uuid5 = array10[0]; string dawnUUID5 = GetDawnUUID(enemies, uuid5); if (dawnUUID5 != null) { interiorEnemyWeightString[dawnUUID5] = interiorEnemyWeightString.GetValueOrDefault(dawnUUID5, "") + cachedInteriorEnemy.Key + ":" + CleanString(array10[1]) + ","; } } } foreach (KeyValuePair cachedWeatherInteriorEnemy in cachedWeatherInteriorEnemies) { string[] array11 = cachedWeatherInteriorEnemy.Value.Split(","); foreach (string text6 in array11) { string[] array12 = text6.Split(":"); string uuid6 = array12[0]; string dawnUUID6 = GetDawnUUID(enemies, uuid6); if (dawnUUID6 != null) { interiorEnemyWeatherString[dawnUUID6] = interiorEnemyWeatherString.GetValueOrDefault(dawnUUID6, "") + cachedWeatherInteriorEnemy.Key + ":" + CleanString(array12[1]) + ","; } } } foreach (KeyValuePair cachedDungeonInteriorEnemy in cachedDungeonInteriorEnemies) { string[] array13 = cachedDungeonInteriorEnemy.Value.Split(","); foreach (string text7 in array13) { string[] array14 = text7.Split(":"); string uuid7 = array14[0]; string dawnUUID7 = GetDawnUUID(enemies, uuid7); if (dawnUUID7 != null) { interiorEnemyDungeonString[dawnUUID7] = interiorEnemyDungeonString.GetValueOrDefault(dawnUUID7, "") + cachedDungeonInteriorEnemy.Key + ":" + CleanString(array14[1]) + ","; } } } foreach (KeyValuePair cachedTagInteriorEnemy in cachedTagInteriorEnemies) { string[] array15 = cachedTagInteriorEnemy.Value.Split(","); foreach (string text8 in array15) { string[] array16 = text8.Split(":"); string uuid8 = array16[0]; string dawnUUID8 = GetDawnUUID(enemies, uuid8); if (dawnUUID8 != null) { interiorEnemyWeightString[dawnUUID8] = interiorEnemyWeightString.GetValueOrDefault(dawnUUID8, "") + cachedTagInteriorEnemy.Key + ":" + CleanString(array16[1]) + ","; } } } SpawnWeightContext val6 = default(SpawnWeightContext); foreach (KeyValuePair, DawnEnemyInfo> item2 in (Registry)(object)LethalContent.Enemies) { string arg3 = UUIDify(((object)item2.Key).ToString()); try { DawnEnemyInfo value2 = item2.Value; DawnEnemyLocationInfo val5 = null; if (value2.Inside != null) { val5 = value2.Inside; string key2 = ((object)item2.Key).ToString(); foreach (DawnMoonInfo notConfiguredInteriorMoon in notConfiguredInteriorMoons) { ((SpawnWeightContext)(ref val6))..ctor(notConfiguredInteriorMoon, (DawnDungeonInfo)null, (DawnWeatherEffectInfo)null); int? for2 = val5.Weights.GetFor(notConfiguredInteriorMoon, ref val6); if (for2.HasValue && for2 > 0) { Dictionary dictionary2 = interiorEnemyWeightString; string[] obj2 = new string[5] { interiorEnemyWeightString.GetValueOrDefault(key2, ""), ((object)((DawnBaseInfo)(object)notConfiguredInteriorMoon).Key).ToString(), ":", null, null }; int? num = for2; obj2[3] = num.ToString(); obj2[4] = ","; dictionary2[key2] = string.Concat(obj2); } } } if (!((DawnBaseInfo)(object)value2).HasTag(DawnLibTags.LunarConfig)) { ((DawnBaseInfo)(object)value2).Internal_AddTag(DawnLibTags.LunarConfig); } WeightTableBuilder val7 = new WeightTableBuilder(); SpawnWeightsPreset val8 = new SpawnWeightsPreset(); List list4 = NamespacedConfigWeight.ConvertManyFromString(ComprehendWeights(interiorEnemyWeightString.GetValueOrDefault(((object)item2.Key).ToString(), ""))); List list5 = NamespacedConfigWeight.ConvertManyFromString(ComprehendWeights(interiorEnemyWeatherString.GetValueOrDefault(((object)item2.Key).ToString(), ""))); List list6 = NamespacedConfigWeight.ConvertManyFromString(ComprehendWeights(interiorEnemyDungeonString.GetValueOrDefault(((object)item2.Key).ToString(), ""))); val8.SetupSpawnWeightsPreset(list4, list6, list5, 0); val7.SetGlobalWeight((IWeighted)(object)val8); if (val5 != null) { val5.Weights = val7.Build(); continue; } value2.Inside = new DawnEnemyLocationInfo(val7.Build()); value2.Inside.ParentInfo = value2; } catch (Exception arg4) { MiniLogger.LogError($"LunarConfig encountered an issue while configuring weights for {arg3}, please report this!\n{arg4}"); } } MiniLogger.LogInfo("Completed Initializing Interior Weights"); } if (enabledMoonSettings.Contains("Spawnable Outside Enemies") || enabledDungeonInjectionSettings.Contains("Spawnable Outside Enemies") || enabledWeatherInjectionSettings.Contains("Spawnable Outside Enemies") || enabledTagInjectionSettings.Contains("Spawnable Outside Enemies")) { MiniLogger.LogInfo("Initializing Outside Weights"); foreach (KeyValuePair cachedOutsideEnemy in cachedOutsideEnemies) { string[] array17 = cachedOutsideEnemy.Value.Split(","); foreach (string text9 in array17) { string[] array18 = text9.Split(":"); string uuid9 = array18[0]; string dawnUUID9 = GetDawnUUID(enemies, uuid9); if (dawnUUID9 != null) { outsideEnemyWeightString[dawnUUID9] = outsideEnemyWeightString.GetValueOrDefault(dawnUUID9, "") + cachedOutsideEnemy.Key + ":" + CleanString(array18[1]) + ","; } } } foreach (KeyValuePair cachedWeatherOutsideEnemy in cachedWeatherOutsideEnemies) { string[] array19 = cachedWeatherOutsideEnemy.Value.Split(","); foreach (string text10 in array19) { string[] array20 = text10.Split(":"); string uuid10 = array20[0]; string dawnUUID10 = GetDawnUUID(enemies, uuid10); if (dawnUUID10 != null) { outsideEnemyWeatherString[dawnUUID10] = outsideEnemyWeatherString.GetValueOrDefault(dawnUUID10, "") + cachedWeatherOutsideEnemy.Key + ":" + CleanString(array20[1]) + ","; } } } foreach (KeyValuePair cachedDungeonOutsideEnemy in cachedDungeonOutsideEnemies) { string[] array21 = cachedDungeonOutsideEnemy.Value.Split(","); foreach (string text11 in array21) { string[] array22 = text11.Split(":"); string uuid11 = array22[0]; string dawnUUID11 = GetDawnUUID(enemies, uuid11); if (dawnUUID11 != null) { outsideEnemyDungeonString[dawnUUID11] = outsideEnemyDungeonString.GetValueOrDefault(dawnUUID11, "") + cachedDungeonOutsideEnemy.Key + ":" + CleanString(array22[1]) + ","; } } } foreach (KeyValuePair cachedTagOutsideEnemy in cachedTagOutsideEnemies) { string[] array23 = cachedTagOutsideEnemy.Value.Split(","); foreach (string text12 in array23) { string[] array24 = text12.Split(":"); string uuid12 = array24[0]; string dawnUUID12 = GetDawnUUID(enemies, uuid12); if (dawnUUID12 != null) { outsideEnemyWeightString[dawnUUID12] = outsideEnemyWeightString.GetValueOrDefault(dawnUUID12, "") + cachedTagOutsideEnemy.Key + ":" + CleanString(array24[1]) + ","; } } } SpawnWeightContext val10 = default(SpawnWeightContext); foreach (KeyValuePair, DawnEnemyInfo> item3 in (Registry)(object)LethalContent.Enemies) { string arg5 = UUIDify(((object)item3.Key).ToString()); try { DawnEnemyInfo value3 = item3.Value; DawnEnemyLocationInfo val9 = null; if (value3.Outside != null) { val9 = value3.Outside; string key3 = ((object)item3.Key).ToString(); foreach (DawnMoonInfo notConfiguredOutsideMoon in notConfiguredOutsideMoons) { ((SpawnWeightContext)(ref val10))..ctor(notConfiguredOutsideMoon, (DawnDungeonInfo)null, (DawnWeatherEffectInfo)null); int? for3 = val9.Weights.GetFor(notConfiguredOutsideMoon, ref val10); if (for3.HasValue && for3 > 0) { Dictionary dictionary3 = outsideEnemyWeightString; string[] obj3 = new string[5] { outsideEnemyWeightString.GetValueOrDefault(key3, ""), ((object)((DawnBaseInfo)(object)notConfiguredOutsideMoon).Key).ToString(), ":", null, null }; int? num = for3; obj3[3] = num.ToString(); obj3[4] = ","; dictionary3[key3] = string.Concat(obj3); } } } if (!((DawnBaseInfo)(object)value3).HasTag(DawnLibTags.LunarConfig)) { ((DawnBaseInfo)(object)value3).Internal_AddTag(DawnLibTags.LunarConfig); } WeightTableBuilder val11 = new WeightTableBuilder(); SpawnWeightsPreset val12 = new SpawnWeightsPreset(); List list7 = NamespacedConfigWeight.ConvertManyFromString(ComprehendWeights(outsideEnemyWeightString.GetValueOrDefault(((object)item3.Key).ToString(), ""))); List list8 = NamespacedConfigWeight.ConvertManyFromString(ComprehendWeights(outsideEnemyWeatherString.GetValueOrDefault(((object)item3.Key).ToString(), ""))); List list9 = NamespacedConfigWeight.ConvertManyFromString(ComprehendWeights(outsideEnemyDungeonString.GetValueOrDefault(((object)item3.Key).ToString(), ""))); val12.SetupSpawnWeightsPreset(list7, list9, list8, 0); val11.SetGlobalWeight((IWeighted)(object)val12); if (val9 != null) { val9.Weights = val11.Build(); continue; } value3.Outside = new DawnEnemyLocationInfo(val11.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_046a: Unknown result type (might be due to invalid IL or missing references) //IL_0474: Expected O, but got Unknown //IL_04a6: Unknown result type (might be due to invalid IL or missing references) //IL_04b0: Expected O, but got Unknown //IL_0284: Unknown result type (might be due to invalid IL or missing references) //IL_028e: Expected O, but got Unknown //IL_02bb: Unknown result type (might be due to invalid IL or missing references) //IL_02c5: 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, DawnDungeonInfo> item in (Registry)(object)LethalContent.Dungeons) { string text = UUIDify(((object)item.Key).ToString()); try { string text2 = NiceifyDawnUUID(((NamespacedKey)item.Key).Key); DawnDungeonInfo value = item.Value; LunarConfigEntry lunarConfigEntry = lunarConfigFile.AddEntry(text2 + " - " + text); DungeonFlow dungeonFlow = value.DungeonFlow; lunarConfigEntry.AddField("Configure Content", "Enable to change any of the settings below.", defaultValue: false); lunarConfigEntry.AddField("Appropriate Aliases", "These are the names which LunarConfig will recognize as this object in other config options.\nThey are case-insensitve and do not regard whitespace.", ((Object)dungeonFlow).name + ", " + text2); lunarConfigEntry.TryAddField(enabledDungeonSettings, "Random Size Min", "The minimum length of dungeon branches.\nHaving a different min and max allows variation between the size of a dungeon on the same moon.", dungeonFlow.Length.Min); lunarConfigEntry.TryAddField(enabledDungeonSettings, "Random Size Max", "The maximum length of dungeon branches.\nHaving a different min and max allows variation between the size of a dungeon on the same moon.", dungeonFlow.Length.Max); lunarConfigEntry.TryAddField(enabledDungeonSettings, "Map Tile Size", "Increase this setting to decrease the size of the dungeon overall.", value.MapTileSize); lunarConfigEntry.TryAddField(enabledDungeonSettings, "Clamp Range Min", "The minimum of the dungeon's clamp range.", value.DungeonClampRange.Min); lunarConfigEntry.TryAddField(enabledDungeonSettings, "Clamp Range Max", "The maximum of the dungeon's clamp range.", value.DungeonClampRange.Max); lunarConfigEntry.TryAddField(enabledDungeonSettings, "Tags", "Tags allocated to the dungeon.\nSeparate tags with commas.", string.Join(", ", from tag in ((DawnBaseInfo)(object)value).AllTags() where tag.Namespace != "dawn_lib" select tag)); if (lunarConfigEntry.GetValue("Configure Content")) { if (enabledDungeonSettings.Contains("Tags")) { HashSet hashSet = new HashSet(); string[] array = RemoveWhitespace(lunarConfigEntry.GetValue("Tags")).ToLower().Split(","); foreach (string text3 in array) { string[] array2 = text3.Split(":"); if (array2.Length == 1 && !Utility.IsNullOrWhiteSpace(array2[0])) { hashSet.Add(new NamespacedKey("lunarcontenttag", array2[0])); } else if (array2.Length == 2 && array2[0] != "dawn_lib") { hashSet.Add(new NamespacedKey(array2[0], array2[1])); } else if (!Utility.IsNullOrWhiteSpace(text3)) { MiniLogger.LogWarning("Incorrectly formatted tag '" + text3 + "' found on " + text); } } foreach (NamespacedKey tag in ((DawnBaseInfo)(object)value)._tags) { if (tag.Namespace == "dawn_lib") { hashSet.Add(tag); } } ((DawnBaseInfo)(object)value)._tags = hashSet; } ((DawnBaseInfo)(object)value).Internal_AddTag(DawnLibTags.LunarConfig); string[] array3 = lunarConfigEntry.GetValue("Appropriate Aliases").Split(","); foreach (string text4 in array3) { if (!Utility.IsNullOrWhiteSpace(text4)) { dungeons[CleanString(text4)] = 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("Map Tile Size"); } if (enabledDungeonSettings.Contains("Clamp Range Min")) { value.DungeonClampRange = new BoundedRange(lunarConfigEntry.GetValue("Clamp Range Min"), value.DungeonClampRange.Max); } if (enabledDungeonSettings.Contains("Clamp Range Max")) { value.DungeonClampRange = new BoundedRange(value.DungeonClampRange.Min, lunarConfigEntry.GetValue("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, DawnDungeonInfo> item2 in (Registry)(object)LethalContent.Dungeons) { string text5 = UUIDify(((object)item2.Key).ToString()); dungeons[CleanString(((Object)item2.Value.DungeonFlow).name)] = text5; dungeons[CleanString(NiceifyDawnUUID(text5))] = text5; } } dungeonsInitialized = true; if (moonsInitialized && !moonDungeonsInitialized) { InitMoonDungeons(); } MiniLogger.LogInfo("Completed Initializing Dungeons"); InitDungeonWeights(); } public void InitDungeonWeights() { //IL_047a: Unknown result type (might be due to invalid IL or missing references) //IL_0481: Expected O, but got Unknown if (!enabledMoonSettings.Contains("Possible Interiors") || !moonsInitialized || !dungeonsInitialized || !weatherInjectionInitialized || dungeonWeightsInitialized) { return; } MiniLogger.LogInfo("Initializing Dungeon Weights"); foreach (KeyValuePair 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 cachedWeatherDungeon in cachedWeatherDungeons) { string[] array3 = cachedWeatherDungeon.Value.Split(","); foreach (string text2 in array3) { string[] array4 = text2.Split(":"); string uuid2 = array4[0]; string dawnUUID2 = GetDawnUUID(dungeons, uuid2); if (dawnUUID2 != null) { dungeonWeatherString[dawnUUID2] = dungeonWeatherString.GetValueOrDefault(dawnUUID2, "") + cachedWeatherDungeon.Key + ":" + CleanString(array4[1]) + ","; } } } foreach (KeyValuePair cachedTagDungeon in cachedTagDungeons) { string[] array5 = cachedTagDungeon.Value.Split(","); foreach (string text3 in array5) { string[] array6 = text3.Split(":"); string uuid3 = array6[0]; string dawnUUID3 = GetDawnUUID(dungeons, uuid3); if (dawnUUID3 != null) { dungeonWeightString[dawnUUID3] = dungeonWeightString.GetValueOrDefault(dawnUUID3, "") + cachedTagDungeon.Key + ":" + CleanString(array6[1]) + ","; } } } SpawnWeightContext val = default(SpawnWeightContext); foreach (KeyValuePair, DawnDungeonInfo> item in (Registry)(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) { ((SpawnWeightContext)(ref val))..ctor(notConfiguredDungeonMoon, (DawnDungeonInfo)null, (DawnWeatherEffectInfo)null); int? @for = item.Value.Weights.GetFor(notConfiguredDungeonMoon, ref val); if (@for.HasValue && @for > 0) { Dictionary dictionary = dungeonWeightString; string[] obj = new string[5] { dungeonWeightString.GetValueOrDefault(key, ""), ((object)((DawnBaseInfo)(object)notConfiguredDungeonMoon).Key).ToString(), ":", null, null }; int? num = @for; obj[3] = num.ToString(); obj[4] = ","; dictionary[key] = string.Concat(obj); } } if (!((DawnBaseInfo)(object)value).HasTag(DawnLibTags.LunarConfig)) { ((DawnBaseInfo)(object)value).Internal_AddTag(DawnLibTags.LunarConfig); } WeightTableBuilder val2 = new WeightTableBuilder(); SpawnWeightsPreset val3 = new SpawnWeightsPreset(); List list = NamespacedConfigWeight.ConvertManyFromString(ComprehendWeights(dungeonWeightString.GetValueOrDefault(key, ""))); List list2 = NamespacedConfigWeight.ConvertManyFromString(ComprehendWeights(dungeonWeatherString.GetValueOrDefault(key, ""))); val3.SetupSpawnWeightsPreset(list, new List(), list2, 0); val2.SetGlobalWeight((IWeighted)(object)val3); value.Weights = val2.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_065a: Unknown result type (might be due to invalid IL or missing references) //IL_066b: Expected O, but got Unknown //IL_0666: Unknown result type (might be due to invalid IL or missing references) //IL_0670: Expected O, but got Unknown //IL_04f3: Unknown result type (might be due to invalid IL or missing references) //IL_04fd: Expected O, but got Unknown //IL_052a: Unknown result type (might be due to invalid IL or missing references) //IL_0534: Expected O, but got Unknown //IL_0812: Unknown result type (might be due to invalid IL or missing references) //IL_0825: Expected O, but got Unknown //IL_0820: Unknown result type (might be due to invalid IL or missing references) //IL_082a: Expected O, but got Unknown //IL_0859: Unknown result type (might be due to invalid IL or missing references) //IL_085e: Unknown result type (might be due to invalid IL or missing references) 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, DawnMapObjectInfo> item in (Registry)(object)LethalContent.MapObjects) { string text = UUIDify(((object)item.Key).ToString()); try { string text2 = NiceifyDawnUUID(((NamespacedKey)item.Key).Key); DawnMapObjectInfo value = item.Value; LunarConfigEntry lunarConfigEntry = lunarConfigFile.AddEntry(text2 + " - " + text); DawnInsideMapObjectInfo val = null; DawnOutsideMapObjectInfo val2 = null; IndoorMapHazardType val3 = null; if (value.InsideInfo != null) { val = value.InsideInfo; if ((Object)(object)val.IndoorMapHazardType != (Object)null) { val3 = val.IndoorMapHazardType; } } 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.", ""); if ((Object)(object)val3 != (Object)null) { lunarConfigEntry.TryAddField(enabledMapObjectSettings, "(Inside) Face Away From Wall?", "Specifies whether the object should spawn facing away from a wall.", val3.spawnFacingAwayFromWall); lunarConfigEntry.TryAddField(enabledMapObjectSettings, "(Inside) Face Towards Wall?", "Specifies whether the object should spawn facing towards a wall.", val3.spawnFacingWall); lunarConfigEntry.TryAddField(enabledMapObjectSettings, "(Inside) Disallow Near Entrance?", "Specifies whether the object should not spawn near an entrance.", val3.disallowSpawningNearEntrances); lunarConfigEntry.TryAddField(enabledMapObjectSettings, "(Inside) Require Distance Between Spawns?", "Specifies whether the object should require distance between its spawns.", val3.requireDistanceBetweenSpawns); lunarConfigEntry.TryAddField(enabledMapObjectSettings, "(Inside) Flush Against Wall?", "Specifies whether the object should spawn flush against a wall.", val3.spawnWithBackFlushAgainstWall); lunarConfigEntry.TryAddField(enabledMapObjectSettings, "(Inside) Spawn Against Wall?", "Specifies whether the object should spawn against a wall.", val3.spawnWithBackToWall); lunarConfigEntry.TryAddField(enabledMapObjectSettings, "(Inside) Allow In Mineshaft?", "Specifies whether the object can spawn in the mineshaft.", val3.allowInMineshaft); } 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); lunarConfigEntry.TryAddField(enabledMapObjectSettings, "(Inside) Allow In Mineshaft?", "Specifies whether the object can spawn in the mineshaft.", defaultValue: true); } 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.SpawnableOutsideObject.objectWidth); lunarConfigEntry.TryAddField(enabledMapObjectSettings, "(Outside) Spawnable Floor Tags", "Specifies the tags of floor an object can spawn on.", string.Join(", ", val2.SpawnableOutsideObject.spawnableFloorTags)); lunarConfigEntry.TryAddField(enabledMapObjectSettings, "(Outside) Face Away From Wall?", "Specifies whether the object should spawn facing away from a wall.", val2.SpawnableOutsideObject.spawnFacingAwayFromWall); lunarConfigEntry.TryAddField(enabledMapObjectSettings, "(Outside) Minimum AI Nodes Before Spawning", "Specifies the amount of AI nodes a moon needs before an outside object can spawn.", val2.MinimumAINodeSpawnRequirement); } 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); lunarConfigEntry.TryAddField(enabledMapObjectSettings, "(Outside) Minimum AI Nodes Before Spawning", "Specifies the amount of AI nodes a moon needs before an outside object can spawn.", 0); } lunarConfigEntry.TryAddField(enabledMapObjectSettings, "Tags", "Tags allocated to the map object.\nSeparate tags with commas.", string.Join(", ", from tag in ((DawnBaseInfo)(object)value).AllTags() where tag.Namespace != "dawn_lib" select tag)); if (lunarConfigEntry.GetValue("Configure Content")) { if (enabledMapObjectSettings.Contains("Tags")) { HashSet hashSet = new HashSet(); string[] array = RemoveWhitespace(lunarConfigEntry.GetValue("Tags")).ToLower().Split(","); foreach (string text3 in array) { string[] array2 = text3.Split(":"); if (array2.Length == 1 && !Utility.IsNullOrWhiteSpace(array2[0])) { hashSet.Add(new NamespacedKey("lunarcontenttag", array2[0])); } else if (array2.Length == 2 && array2[0] != "dawn_lib") { hashSet.Add(new NamespacedKey(array2[0], array2[1])); } else if (!Utility.IsNullOrWhiteSpace(text3)) { MiniLogger.LogWarning("Incorrectly formatted tag '" + text3 + "' found on " + text); } } foreach (NamespacedKey tag in ((DawnBaseInfo)(object)value)._tags) { if (tag.Namespace == "dawn_lib") { hashSet.Add(tag); } } ((DawnBaseInfo)(object)value)._tags = hashSet; } ((DawnBaseInfo)(object)value).Internal_AddTag(DawnLibTags.LunarConfig); string[] array3 = lunarConfigEntry.GetValue("Appropriate Aliases").Split(","); foreach (string text4 in array3) { if (!Utility.IsNullOrWhiteSpace(text4)) { mapObjects[CleanString(text4)] = text; } } if (val == null) { CurveTableBuilder val4 = new CurveTableBuilder(); value.InsideInfo = new DawnInsideMapObjectInfo(new IndoorMapHazardType(), val4.Build()); IndoorMapHazardType indoorMapHazardType = value.InsideInfo.IndoorMapHazardType; indoorMapHazardType.allowInMineshaft = true; indoorMapHazardType.disallowSpawningNearEntrances = false; indoorMapHazardType.requireDistanceBetweenSpawns = false; indoorMapHazardType.spawnFacingAwayFromWall = false; indoorMapHazardType.spawnFacingWall = false; indoorMapHazardType.spawnWithBackFlushAgainstWall = false; indoorMapHazardType.spawnWithBackToWall = false; val = value.InsideInfo; val3 = val.IndoorMapHazardType; val.ParentInfo = value; } if (enabledMapObjectSettings.Contains("(Inside) Face Away From Wall?")) { val3.spawnFacingAwayFromWall = lunarConfigEntry.GetValue("(Inside) Face Away From Wall?"); } if (enabledMapObjectSettings.Contains("(Inside) Face Towards Wall?")) { val3.spawnFacingWall = lunarConfigEntry.GetValue("(Inside) Face Towards Wall?"); } if (enabledMapObjectSettings.Contains("(Inside) Disallow Near Entrance?")) { val3.disallowSpawningNearEntrances = lunarConfigEntry.GetValue("(Inside) Disallow Near Entrance?"); } if (enabledMapObjectSettings.Contains("(Inside) Require Distance Between Spawns?")) { val3.requireDistanceBetweenSpawns = lunarConfigEntry.GetValue("(Inside) Require Distance Between Spawns?"); } if (enabledMapObjectSettings.Contains("(Inside) Flush Against Wall?")) { val3.spawnWithBackFlushAgainstWall = lunarConfigEntry.GetValue("(Inside) Flush Against Wall?"); } if (enabledMapObjectSettings.Contains("(Inside) Spawn Against Wall?")) { val3.spawnWithBackToWall = lunarConfigEntry.GetValue("(Inside) Spawn Against Wall?"); } if (enabledMapObjectSettings.Contains("(Inside) Allow In Mineshaft?")) { val3.allowInMineshaft = lunarConfigEntry.GetValue("(Inside) Allow In Mineshaft?"); } if (val2 == null) { CurveTableBuilder val5 = new CurveTableBuilder(); value.OutsideInfo = new DawnOutsideMapObjectInfo(new SpawnableOutsideObject(), val5.Build(), true, 0); val2 = value.OutsideInfo; val2.SpawnableOutsideObject.objectWidth = 1; val2.SpawnableOutsideObject.spawnableFloorTags = Array.Empty(); val2.SpawnableOutsideObject.rotationOffset = Vector3.zero; val2.SpawnableOutsideObject.spawnFacingAwayFromWall = false; val2.SpawnableOutsideObject.prefabToSpawn = value.GetMapObjectPrefab(); ((Object)val2.SpawnableOutsideObject).name = StringExtensions.ToCapitalized(((DawnBaseInfo)(object)value).Key.Key); val2.ParentInfo = value; } if (enabledMapObjectSettings.Contains("(Outside) Align With Terrain?")) { val2.AlignWithTerrain = lunarConfigEntry.GetValue("(Outside) Align With Terrain?"); } if (enabledMapObjectSettings.Contains("(Outside) Object Width")) { val2.SpawnableOutsideObject.objectWidth = lunarConfigEntry.GetValue("(Outside) Object Width"); } if (enabledMapObjectSettings.Contains("(Outside) Spawnable Floor Tags")) { string[] array4 = lunarConfigEntry.GetValue("(Outside) Spawnable Floor Tags").Split(","); for (int k = 0; k < array4.Length; k++) { array4.SetValue(array4[k].Trim(), k); } val2.SpawnableOutsideObject.spawnableFloorTags = array4; } if (enabledMapObjectSettings.Contains("(Outside) Face Away From Wall?")) { val2.SpawnableOutsideObject.spawnFacingAwayFromWall = lunarConfigEntry.GetValue("(Outside) Face Away From Wall?"); } if (enabledMapObjectSettings.Contains("(Outside) Minimum AI Nodes Before Spawning")) { val2.MinimumAINodeSpawnRequirement = lunarConfigEntry.GetValue("(Outside) Minimum AI Nodes Before Spawning"); } } else { 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, DawnMapObjectInfo> item2 in (Registry)(object)LethalContent.MapObjects) { string text5 = UUIDify(((object)item2.Key).ToString()); mapObjects[CleanString(NiceifyDawnUUID(text5))] = text5; } } mapObjectsInitialized = true; if (moonsInitialized && !moonObjectsInitialized) { InitMoonObjects(); } MiniLogger.LogInfo("Completed Initializing Map Objects"); InitMapObjectCurves(); } public void InitMapObjectCurves() { //IL_027e: Unknown result type (might be due to invalid IL or missing references) //IL_028a: Expected O, but got Unknown //IL_0285: Unknown result type (might be due to invalid IL or missing references) //IL_028f: Expected O, but got Unknown //IL_058e: Unknown result type (might be due to invalid IL or missing references) //IL_059c: Expected O, but got Unknown //IL_0597: Unknown result type (might be due to invalid IL or missing references) //IL_05a1: Expected O, but got Unknown //IL_05da: Unknown result type (might be due to invalid IL or missing references) //IL_05df: Unknown result type (might be due to invalid IL or missing references) if (!moonsInitialized || !mapObjectsInitialized || mapObjectCurvesInitialized) { return; } if (enabledMapObjectSettings.Contains("(Inside) Level Curves")) { MiniLogger.LogInfo("Initializing Inside Object Curves"); foreach (KeyValuePair, Dictionary> cachedInsideMapObject in cachedInsideMapObjects) { NamespacedKey key = cachedInsideMapObject.Key; foreach (KeyValuePair item3 in cachedInsideMapObject.Value) { string key2 = item3.Key; if (!Utility.IsNullOrWhiteSpace(item3.Value)) { AnimationCurve curve = StringToCurve(CleanString(item3.Value)); TrySetInsideCurve(key2, curve, key); } } } SpawnWeightContext val2 = default(SpawnWeightContext); foreach (KeyValuePair, DawnMapObjectInfo> item4 in (Registry)(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) { ((SpawnWeightContext)(ref val2))..ctor(notConfiguredInsideMapObjectMoon, (DawnDungeonInfo)null, (DawnWeatherEffectInfo)null); AnimationCurve @for = val.SpawnWeights.GetFor(notConfiguredInsideMapObjectMoon, ref val2); if (@for != null) { TrySetInsideCurve(item, @for, ((DawnBaseInfo)(object)notConfiguredInsideMapObjectMoon).TypedKey); } } } if (!((DawnBaseInfo)(object)value).HasTag(DawnLibTags.LunarConfig)) { ((DawnBaseInfo)(object)value).Internal_AddTag(DawnLibTags.LunarConfig); } CurveTableBuilder val3 = new CurveTableBuilder(); if (defaultInsideMapObjectCurves.TryGetValue(text, out Dictionary, AnimationCurve> value2)) { foreach (KeyValuePair, AnimationCurve> item5 in value2) { val3.AddCurve(item5.Key, item5.Value); } } ProviderTable val4 = val3.Build(); if (val != null) { val.SpawnWeights = val4; continue; } value.InsideInfo = new DawnInsideMapObjectInfo(new IndoorMapHazardType(), val4); IndoorMapHazardType indoorMapHazardType = value.InsideInfo.IndoorMapHazardType; indoorMapHazardType.allowInMineshaft = true; indoorMapHazardType.disallowSpawningNearEntrances = false; indoorMapHazardType.requireDistanceBetweenSpawns = false; indoorMapHazardType.spawnFacingAwayFromWall = false; indoorMapHazardType.spawnFacingWall = false; indoorMapHazardType.spawnWithBackFlushAgainstWall = false; indoorMapHazardType.spawnWithBackToWall = 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, Dictionary> cachedOutsideMapObject in cachedOutsideMapObjects) { NamespacedKey key3 = cachedOutsideMapObject.Key; foreach (KeyValuePair item6 in cachedOutsideMapObject.Value) { string key4 = item6.Key; if (!Utility.IsNullOrWhiteSpace(item6.Value)) { AnimationCurve curve2 = StringToCurve(CleanString(item6.Value)); TrySetOutsideCurve(key4, curve2, key3); } } } SpawnWeightContext val6 = default(SpawnWeightContext); foreach (KeyValuePair, DawnMapObjectInfo> item7 in (Registry)(object)LethalContent.MapObjects) { string text2 = UUIDify(((object)item7.Key).ToString()); try { DawnMapObjectInfo value3 = item7.Value; DawnOutsideMapObjectInfo val5 = null; if (value3.OutsideInfo != null) { val5 = value3.OutsideInfo; string item2 = ((object)item7.Key).ToString(); foreach (DawnMoonInfo notConfiguredOutsideMapObjectMoon in notConfiguredOutsideMapObjectMoons) { ((SpawnWeightContext)(ref val6))..ctor(notConfiguredOutsideMapObjectMoon, (DawnDungeonInfo)null, (DawnWeatherEffectInfo)null); AnimationCurve for2 = val5.SpawnWeights.GetFor(notConfiguredOutsideMapObjectMoon, ref val6); if (for2 != null) { TrySetOutsideCurve(item2, for2, ((DawnBaseInfo)(object)notConfiguredOutsideMapObjectMoon).TypedKey); } } } if (!((DawnBaseInfo)(object)value3).HasTag(DawnLibTags.LunarConfig)) { ((DawnBaseInfo)(object)value3).Internal_AddTag(DawnLibTags.LunarConfig); } CurveTableBuilder val7 = new CurveTableBuilder(); if (defaultOutsideMapObjectCurves.TryGetValue(text2, out Dictionary, AnimationCurve> value4)) { foreach (KeyValuePair, AnimationCurve> item8 in value4) { val7.AddCurve(item8.Key, item8.Value); } } ProviderTable val8 = val7.Build(); if (val5 != null) { val5.SpawnWeights = val8; continue; } value3.OutsideInfo = new DawnOutsideMapObjectInfo(new SpawnableOutsideObject(), val8, true, 0); DawnOutsideMapObjectInfo outsideInfo = value3.OutsideInfo; outsideInfo = value3.OutsideInfo; outsideInfo.SpawnableOutsideObject.objectWidth = 12; outsideInfo.SpawnableOutsideObject.spawnableFloorTags = Array.Empty(); outsideInfo.SpawnableOutsideObject.rotationOffset = Vector3.zero; outsideInfo.SpawnableOutsideObject.spawnFacingAwayFromWall = false; outsideInfo.SpawnableOutsideObject.prefabToSpawn = value3.GetMapObjectPrefab(); ((Object)outsideInfo.SpawnableOutsideObject).name = StringExtensions.ToCapitalized(((DawnBaseInfo)(object)value3).Key.Key); 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 InitMoonItems() { MiniLogger.LogInfo("Initializing Moon Item Weights"); if (configureMoons) { LunarConfigFile lunarConfigFile = files[LunarConfig.MOON_FILE_NAME]; lunarConfigFile.file.SaveOnConfigSet = false; SpawnWeightContext val = default(SpawnWeightContext); foreach (KeyValuePair, DawnMoonInfo> item in (Registry)(object)LethalContent.Moons) { string text = UUIDify(((object)item.Key).ToString()); try { string text2 = NiceifyDawnUUID(((NamespacedKey)item.Key).Key); DawnMoonInfo value = item.Value; ((SpawnWeightContext)(ref val))..ctor(value, (DawnDungeonInfo)null, (DawnWeatherEffectInfo)null); LunarConfigEntry lunarConfigEntry = lunarConfigFile.AddEntry(text2 + " - " + text); string numberlessPlanetName = value.GetNumberlessPlanetName(); string text3 = ""; foreach (KeyValuePair, DawnItemInfo> item2 in (Registry)(object)LethalContent.Items) { DawnItemInfo value2 = item2.Value; try { if (value2.ScrapInfo == null) { continue; } int? @for = value2.ScrapInfo.Weights.GetFor(value, ref val); if (@for.HasValue && @for > 0) { if (text3 != "") { text3 += ", "; } string text4 = text3; string itemName = value2.Item.itemName; int? num = @for; text3 = text4 + itemName + ":" + num; } } catch (Exception arg) { MiniLogger.LogWarning($"Failed to grab weight for {((object)((DawnBaseInfo)(object)value2).Key).ToString()} on {numberlessPlanetName}\n{arg}"); } } lunarConfigEntry.TryAddField(enabledMoonSettings, "Spawnable Scrap", "The base scrap that can spawn on the moon.\nDenoted with NAME:RARITY, separated with commas.", text3); if (lunarConfigEntry.GetValue("Configure Content") && enabledMoonSettings.Contains("Spawnable Scrap")) { cachedSpawnableScrap[text] = lunarConfigEntry.GetValue("Spawnable Scrap"); } } catch (Exception arg2) { MiniLogger.LogError($"LunarConfig encountered an issue while configuring {text}, please report this!\n{arg2}"); } } lunarConfigFile.file.Save(); lunarConfigFile.file.SaveOnConfigSet = true; moonItemsInitialized = true; if (moonItemsInitialized && moonEnemiesInitialized && moonDungeonsInitialized && moonObjectsInitialized) { ClearOrphanedEntries(lunarConfigFile.file); } } else { moonItemsInitialized = true; } } public void InitMoonEnemies() { MiniLogger.LogInfo("Initializing Moon Enemy Weights"); if (configureMoons) { LunarConfigFile lunarConfigFile = files[LunarConfig.MOON_FILE_NAME]; lunarConfigFile.file.SaveOnConfigSet = false; SpawnWeightContext val = default(SpawnWeightContext); foreach (KeyValuePair, DawnMoonInfo> item in (Registry)(object)LethalContent.Moons) { string text = UUIDify(((object)item.Key).ToString()); try { string text2 = NiceifyDawnUUID(((NamespacedKey)item.Key).Key); DawnMoonInfo value = item.Value; ((SpawnWeightContext)(ref val))..ctor(value, (DawnDungeonInfo)null, (DawnWeatherEffectInfo)null); LunarConfigEntry lunarConfigEntry = lunarConfigFile.AddEntry(text2 + " - " + text); SelectableLevel level = value.Level; string numberlessPlanetName = value.GetNumberlessPlanetName(); string text3 = ""; string text4 = ""; string text5 = ""; foreach (KeyValuePair, DawnEnemyInfo> item2 in (Registry)(object)LethalContent.Enemies) { DawnEnemyInfo value2 = item2.Value; try { if (value2.Daytime != null) { int? @for = value2.Daytime.Weights.GetFor(value, ref val); if (@for.HasValue && @for > 0) { if (text3 != "") { text3 += ", "; } string text6 = text3; string enemyName = value2.EnemyType.enemyName; int? num = @for; text3 = text6 + enemyName + ":" + num; } } if (value2.Inside != null) { int? for2 = value2.Inside.Weights.GetFor(value, ref val); if (for2.HasValue && for2 > 0) { if (text4 != "") { text4 += ", "; } string text7 = text4; string enemyName2 = value2.EnemyType.enemyName; int? num = for2; text4 = text7 + enemyName2 + ":" + num; } } if (value2.Outside == null) { continue; } int? for3 = value2.Outside.Weights.GetFor(value, ref val); if (for3.HasValue && for3 > 0) { if (text5 != "") { text5 += ", "; } string text8 = text5; string enemyName3 = value2.EnemyType.enemyName; int? num = for3; text5 = text8 + enemyName3 + ":" + num; } } catch (Exception arg) { MiniLogger.LogWarning($"Failed to grab weight for {((object)((DawnBaseInfo)(object)value2).Key).ToString()} on {numberlessPlanetName}\n{arg}"); } } lunarConfigEntry.TryAddField(enabledMoonSettings, "Spawnable Daytime Enemies", "The base daytime enemies that can spawn on the moon.\nDenoted with NAME:RARITY, separated with commas.", text3); lunarConfigEntry.TryAddField(enabledMoonSettings, "Spawnable Interior Enemies", "The base interior enemies that can spawn on the moon.\nDenoted with NAME:RARITY, separated with commas.", text4); lunarConfigEntry.TryAddField(enabledMoonSettings, "Spawnable Outside Enemies", "The base outside enemies that can spawn on the moon.\nDenoted with NAME:RARITY, separated with commas.", text5); if (lunarConfigEntry.GetValue("Configure Content")) { if (enabledMoonSettings.Contains("Spawnable Daytime Enemies")) { cachedDaytimeEnemies[text] = lunarConfigEntry.GetValue("Spawnable Daytime Enemies"); } if (enabledMoonSettings.Contains("Spawnable Interior Enemies")) { cachedInteriorEnemies[text] = lunarConfigEntry.GetValue("Spawnable Interior Enemies"); } if (enabledMoonSettings.Contains("Spawnable Outside Enemies")) { cachedOutsideEnemies[text] = lunarConfigEntry.GetValue("Spawnable Outside Enemies"); } } } catch (Exception arg2) { MiniLogger.LogError($"LunarConfig encountered an issue while configuring {text}, please report this!\n{arg2}"); } } lunarConfigFile.file.Save(); lunarConfigFile.file.SaveOnConfigSet = true; moonEnemiesInitialized = true; if (moonItemsInitialized && moonEnemiesInitialized && moonDungeonsInitialized && moonObjectsInitialized) { ClearOrphanedEntries(lunarConfigFile.file); } } else { moonEnemiesInitialized = true; } } public void InitMoonDungeons() { MiniLogger.LogInfo("Initializing Moon Dungeon Weights"); if (configureMoons) { LunarConfigFile lunarConfigFile = files[LunarConfig.MOON_FILE_NAME]; lunarConfigFile.file.SaveOnConfigSet = false; SpawnWeightContext val = default(SpawnWeightContext); foreach (KeyValuePair, DawnMoonInfo> item in (Registry)(object)LethalContent.Moons) { string text = UUIDify(((object)item.Key).ToString()); try { string text2 = NiceifyDawnUUID(((NamespacedKey)item.Key).Key); DawnMoonInfo value = item.Value; ((SpawnWeightContext)(ref val))..ctor(value, (DawnDungeonInfo)null, (DawnWeatherEffectInfo)null); LunarConfigEntry lunarConfigEntry = lunarConfigFile.AddEntry(text2 + " - " + text); string numberlessPlanetName = value.GetNumberlessPlanetName(); string text3 = ""; foreach (KeyValuePair, DawnDungeonInfo> item2 in (Registry)(object)LethalContent.Dungeons) { DawnDungeonInfo value2 = item2.Value; try { int? @for = value2.Weights.GetFor(value, ref val); if (@for.HasValue && @for > 0) { if (text3 != "") { text3 += ", "; } string text4 = text3; string name = ((Object)value2.DungeonFlow).name; int? num = @for; text3 = text4 + name + ":" + num; } } catch (Exception arg) { MiniLogger.LogWarning($"Failed to grab weight for {((object)((DawnBaseInfo)(object)value2).Key).ToString()} on {numberlessPlanetName}\n{arg}"); } } lunarConfigEntry.TryAddField(enabledMoonSettings, "Possible Interiors", "The base interiors that can spawn on the moon.\nDenoted with NAME:RARITY, separated with commas.", text3); if (lunarConfigEntry.GetValue("Configure Content") && enabledMoonSettings.Contains("Possible Interiors")) { cachedDungeons[text] = lunarConfigEntry.GetValue("Possible Interiors"); } } catch (Exception arg2) { MiniLogger.LogError($"LunarConfig encountered an issue while configuring {text}, please report this!\n{arg2}"); } } lunarConfigFile.file.Save(); lunarConfigFile.file.SaveOnConfigSet = true; moonDungeonsInitialized = true; if (moonItemsInitialized && moonEnemiesInitialized && moonDungeonsInitialized && moonObjectsInitialized) { ClearOrphanedEntries(lunarConfigFile.file); } } else { moonDungeonsInitialized = true; } } public void InitMoonObjects() { MiniLogger.LogInfo("Initializing Moon Object Weights"); if (configureMoons) { LunarConfigFile lunarConfigFile = files[LunarConfig.MOON_FILE_NAME]; lunarConfigFile.file.SaveOnConfigSet = false; SpawnWeightContext val = default(SpawnWeightContext); foreach (KeyValuePair, DawnMoonInfo> item in (Registry)(object)LethalContent.Moons) { string text = UUIDify(((object)item.Key).ToString()); try { string text2 = NiceifyDawnUUID(((NamespacedKey)item.Key).Key); DawnMoonInfo value = item.Value; ((SpawnWeightContext)(ref val))..ctor(value, (DawnDungeonInfo)null, (DawnWeatherEffectInfo)null); LunarConfigEntry lunarConfigEntry = lunarConfigFile.AddEntry(text2 + " - " + text); string numberlessPlanetName = value.GetNumberlessPlanetName(); foreach (DawnMapObjectInfo value4 in ((Registry)(object)LethalContent.MapObjects).Values) { if (enabledMapObjectSettings.Contains("(Inside) Level Curves")) { AnimationCurve val2 = null; if (value4.InsideInfo != null) { val2 = value4.InsideInfo.SpawnWeights.GetFor(value, ref val); } string text3 = null; lunarConfigEntry.AddField(defaultValue: (val2 != null) ? CurveToString(val2) : "", key: "Inside Curve - " + UUIDify(((object)((DawnBaseInfo)(object)value4).Key).ToString()), description: "NOTE: Any object that does not have a NetworkObject component, which is typically the Vanilla outside objects, will NOT be able to spawn inside!\nThe animation curve of this object spawning on the interior of this moon."); } if (enabledMapObjectSettings.Contains("(Outside) Level Curves")) { AnimationCurve val3 = null; if (value4.OutsideInfo != null) { val3 = value4.OutsideInfo.SpawnWeights.GetFor(value, ref val); } string text4 = null; lunarConfigEntry.AddField(defaultValue: (val3 != null) ? CurveToString(val3) : "", key: "Outside Curve - " + UUIDify(((object)((DawnBaseInfo)(object)value4).Key).ToString()), description: "The animation curve of this object spawning on the interior of this moon."); } } if (!lunarConfigEntry.GetValue("Configure Content")) { continue; } if (enabledMapObjectSettings.Contains("(Inside) Level Curves")) { foreach (KeyValuePair field in lunarConfigEntry.fields) { if (field.Key.StartsWith("Inside Curve - ")) { if (!cachedInsideMapObjects.TryGetValue(((DawnBaseInfo)(object)value).TypedKey, out Dictionary value2)) { value2 = new Dictionary(); } value2.Add(field.Key.Replace("Inside Curve - ", ""), (string)field.Value.BoxedValue); cachedInsideMapObjects[((DawnBaseInfo)(object)value).TypedKey] = value2; } } } if (!enabledMapObjectSettings.Contains("(Outside) Level Curves")) { continue; } foreach (KeyValuePair field2 in lunarConfigEntry.fields) { if (field2.Key.StartsWith("Outside Curve - ")) { if (!cachedOutsideMapObjects.TryGetValue(((DawnBaseInfo)(object)value).TypedKey, out Dictionary value3)) { value3 = new Dictionary(); } value3.Add(field2.Key.Replace("Outside Curve - ", ""), (string)field2.Value.BoxedValue); cachedOutsideMapObjects[((DawnBaseInfo)(object)value).TypedKey] = value3; } } } catch (Exception arg) { MiniLogger.LogError($"LunarConfig encountered an issue while configuring {text}, please report this!\n{arg}"); } } lunarConfigFile.file.Save(); lunarConfigFile.file.SaveOnConfigSet = true; moonObjectsInitialized = true; if (moonItemsInitialized && moonEnemiesInitialized && moonDungeonsInitialized && moonObjectsInitialized) { ClearOrphanedEntries(lunarConfigFile.file); } } else { moonObjectsInitialized = true; } } public void InitMoons() { //IL_0668: Unknown result type (might be due to invalid IL or missing references) //IL_0672: Expected O, but got Unknown //IL_06ae: Unknown result type (might be due to invalid IL or missing references) //IL_06b8: Expected O, but got Unknown //IL_0c14: Unknown result type (might be due to invalid IL or missing references) //IL_0c1e: Expected O, but got Unknown //IL_0c19: Unknown result type (might be due to invalid IL or missing references) //IL_0c20: Expected O, but got Unknown //IL_0bf2: Unknown result type (might be due to invalid IL or missing references) //IL_0bfd: Unknown result type (might be due to invalid IL or missing references) //IL_0c04: Expected O, but got Unknown //IL_0bd5: Unknown result type (might be due to invalid IL or missing references) //IL_0be7: Unknown result type (might be due to invalid IL or missing references) //IL_0bee: 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; SpawnWeightContext val = default(SpawnWeightContext); foreach (KeyValuePair, DawnMoonInfo> item in (Registry)(object)LethalContent.Moons) { string text = UUIDify(((object)item.Key).ToString()); try { string text2 = NiceifyDawnUUID(((NamespacedKey)item.Key).Key); DawnMoonInfo value = item.Value; ((SpawnWeightContext)(ref val))..ctor(value, (DawnDungeonInfo)null, (DawnWeatherEffectInfo)null); LunarConfigEntry lunarConfigEntry = lunarConfigFile.AddEntry(text2 + " - " + text); SelectableLevel level = value.Level; DawnPurchaseInfo val2 = null; TerminalNode val3 = null; TerminalNode val4 = null; TerminalNode val5 = null; string numberlessPlanetName = value.GetNumberlessPlanetName(); if (value.DawnPurchaseInfo != null) { val2 = value.DawnPurchaseInfo; } moonKeys[text] = ((DawnBaseInfo)(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, "Offset Time", "The offset time that a moon has.", level.OffsetFromGlobalTime); lunarConfigEntry.TryAddField(enabledMoonSettings, "Can Spawn Shrouds?", "Defines whether a moon can spawn vain shrouds.", level.canSpawnMold); 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.", CurveToString(level.daytimeEnemySpawnChanceThroughDay)); lunarConfigEntry.TryAddField(enabledMoonSettings, "Max Daytime Power", "The amount of daytime power capacity that a moon has.", level.maxDaytimeEnemyPowerCount); lunarConfigEntry.TryAddField(enabledMoonSettings, "Interior Probability Range", "The amount of interior enemies spawned that can differ from the curve.\nFor instance, if this value is 3, and at the current time and spawn cycle 2 interior enemies should spawn, anywhere between 0 and 5 can spawn.", level.spawnProbabilityRange); lunarConfigEntry.TryAddField(enabledMoonSettings, "Interior Curve", "Decides the amount of interior enemies that spawn as the day progresses.\nKeyframes represented by x,y and separated by semicolons.", CurveToString(level.enemySpawnChanceThroughoutDay)); lunarConfigEntry.TryAddField(enabledMoonSettings, "Max Interior Power", "The amount of interior power capacity that a moon has.", level.maxEnemyPowerCount); lunarConfigEntry.TryAddField(enabledMoonSettings, "Max Interior Diversity", "The amount of interior diversity capacity that a moon has.", level.maxInsideDiversityPowerCount); lunarConfigEntry.TryAddField(enabledMoonSettings, "Outside Probability Range", "The amount of outside enemies spawned that can differ from the curve.\nFor instance, if this value is 3, and at the current time and spawn cycle 2 interior enemies should spawn, anywhere between 0 and 5 can spawn.", value.OutsideEnemiesProbabilityRange); lunarConfigEntry.TryAddField(enabledMoonSettings, "Outside Curve", "Decides the amount of outside enemies that spawn as the day progresses.\nKeyframes represented by x,y and separated by semicolons.", CurveToString(level.outsideEnemySpawnChanceThroughDay)); lunarConfigEntry.TryAddField(enabledMoonSettings, "Max Outside Power", "The amount of outside power capacity that a moon has.", level.maxOutsideEnemyPowerCount); lunarConfigEntry.TryAddField(enabledMoonSettings, "Max Outside Diversity", "The amount of outside diversity capacity that a moon has.", level.maxOutsideDiversityPowerCount); lunarConfigEntry.TryAddField(enabledMoonSettings, "Min Scrap", "The minimum amount of scrap items that can spawn on a moon.", level.minScrap); lunarConfigEntry.TryAddField(enabledMoonSettings, "Max Scrap", "The maximum amount of scrap items that can spawn on a moon.", level.maxScrap); lunarConfigEntry.TryAddField(enabledMoonSettings, "Min Scrap Total", "NOTE: This setting is essentially unused in the vanilla, Lunar does not implement any new functionality.\nThe minimum amount of scrap value that can spawn on a moon.", level.minTotalScrapValue); lunarConfigEntry.TryAddField(enabledMoonSettings, "Max Scrap Total", "NOTE: This setting is essentially unused in the vanilla, Lunar does not implement any new functionality.\nThe maximum amount of scrap value that can spawn on a moon.", level.maxTotalScrapValue); lunarConfigEntry.TryAddField(enabledMoonSettings, "Interior Multiplier", "Changes the size of the interior generated.", level.factorySizeMultiplier); if (val2 != null) { lunarConfigEntry.TryAddField(enabledMoonSettings, "Route Price", "Changes the price to route to the moon.", val2.Cost.Provide()); if (enabledMoonSettings.Contains("Is Hidden? & Is Locked?")) { TerminalPurchaseResult val6 = val2.PurchasePredicate.CanPurchase(); bool defaultValue = false; bool defaultValue2 = false; HiddenPurchaseResult val7 = (HiddenPurchaseResult)(object)((val6 is HiddenPurchaseResult) ? val6 : null); if (val7 != null) { defaultValue = true; if (val7.IsFailure) { defaultValue2 = true; } } else if (val6 is FailedPurchaseResult) { defaultValue2 = true; } lunarConfigEntry.AddField("Is Hidden?", "Changes if the moon is hidden in the terminal.", defaultValue); lunarConfigEntry.AddField("Is Locked?", "Changes if the moon is locked in the terminal.", defaultValue2); } } lunarConfigEntry.TryAddField(enabledMoonSettings, "Value Multiplier", "The multiplier applied to the value of a moon's scrap.", 1f); lunarConfigEntry.TryAddField(enabledMoonSettings, "Amount Multiplier", "The multiplier applied to the amount of scrap a moon has.", 1f); lunarConfigEntry.TryAddField(enabledMoonSettings, "Tags", "Tags allocated to the moon.\nSeparate tags with commas.", string.Join(", ", from tag in ((DawnBaseInfo)(object)value).AllTags() where tag.Namespace != "dawn_lib" select tag)); if (!mapObjectKeysInitialized) { InitObjectKeys(); mapObjectKeysInitialized = true; } if (backCompat) { MigrateSection(lunarConfigFile.file, "LLL - " + numberlessPlanetName, text2 + " - " + text); } if (lunarConfigEntry.GetValue("Configure Content")) { bool flag = false; if (enabledMoonSettings.Contains("Tags")) { HashSet hashSet = new HashSet(); string[] array = RemoveWhitespace(lunarConfigEntry.GetValue("Tags")).ToLower().Split(","); foreach (string text3 in array) { string[] array2 = text3.Split(":"); if (array2.Length == 1 && !Utility.IsNullOrWhiteSpace(array2[0])) { hashSet.Add(new NamespacedKey("lunarcontenttag", array2[0])); everyMoonTag.Add(array2[0]); } else if (array2.Length == 2 && array2[0] != "dawn_lib") { hashSet.Add(new NamespacedKey(array2[0], array2[1])); everyMoonTag.Add(array2[1]); } else if (!Utility.IsNullOrWhiteSpace(text3)) { MiniLogger.LogWarning("Incorrectly formatted tag '" + text3 + "' found on " + text); } } foreach (NamespacedKey tag in ((DawnBaseInfo)(object)value)._tags) { if (tag.Namespace == "dawn_lib") { hashSet.Add(tag); } } ((DawnBaseInfo)(object)value)._tags = hashSet; } ((DawnBaseInfo)(object)value).Internal_AddTag(DawnLibTags.LunarConfig); string[] array3 = lunarConfigEntry.GetValue("Appropriate Aliases").Split(","); foreach (string text4 in array3) { if (!Utility.IsNullOrWhiteSpace(text4)) { string text5 = CleanString(text4); moons[text5] = text; if (enabledLockingMoons.Contains(text5)) { flag = true; } } } lunarConfigEntry.TrySetValue(enabledMoonSettings, "Display Name", ref level.PlanetName); lunarConfigEntry.TrySetValue(enabledMoonSettings, "Risk Level", ref level.riskLevel); if (enabledMoonSettings.Contains("Description")) { level.LevelDescription = lunarConfigEntry.GetValue("Description").Replace(";", "\n"); } lunarConfigEntry.TrySetValue(enabledMoonSettings, "Has Time?", ref level.planetHasTime); lunarConfigEntry.TrySetValue(enabledMoonSettings, "Offset Time", ref level.OffsetFromGlobalTime); lunarConfigEntry.TrySetValue(enabledMoonSettings, "Can Spawn Shrouds?", ref level.canSpawnMold); lunarConfigEntry.TrySetValue(enabledMoonSettings, "Time Multiplier", ref level.DaySpeedMultiplier); if (enabledMoonSettings.Contains("Can Be Challenge Moon?")) { definedChallengeMoons[level] = lunarConfigEntry.GetValue("Can Be Challenge Moon?"); } if (enabledMoonSettings.Contains("Has Time?")) { definedChallengeMoonTimes[level] = lunarConfigEntry.GetValue("Has Time?"); } lunarConfigEntry.TrySetValue(enabledMoonSettings, "Daytime Probability Range", ref level.daytimeEnemiesProbabilityRange); if (enabledMoonSettings.Contains("Daytime Curve")) { level.daytimeEnemySpawnChanceThroughDay = StringToCurve(lunarConfigEntry.GetValue("Daytime Curve")); } lunarConfigEntry.TrySetValue(enabledMoonSettings, "Max Daytime Power", ref level.maxDaytimeEnemyPowerCount); lunarConfigEntry.TrySetValue(enabledMoonSettings, "Interior Probability Range", ref level.spawnProbabilityRange); if (enabledMoonSettings.Contains("Interior Curve")) { level.enemySpawnChanceThroughoutDay = StringToCurve(lunarConfigEntry.GetValue("Interior Curve")); } lunarConfigEntry.TrySetValue(enabledMoonSettings, "Max Interior Power", ref level.maxEnemyPowerCount); lunarConfigEntry.TrySetValue(enabledMoonSettings, "Max Interior Diversity", ref level.maxInsideDiversityPowerCount); if (enabledMoonSettings.Contains("Outside Probability Range")) { value.OutsideEnemiesProbabilityRange = lunarConfigEntry.GetValue("Outside Probability Range"); } if (enabledMoonSettings.Contains("Outside Curve")) { level.outsideEnemySpawnChanceThroughDay = StringToCurve(lunarConfigEntry.GetValue("Outside Curve")); } lunarConfigEntry.TrySetValue(enabledMoonSettings, "Max Outside Power", ref level.maxOutsideEnemyPowerCount); lunarConfigEntry.TrySetValue(enabledMoonSettings, "Max Outside Diversity", ref level.maxOutsideDiversityPowerCount); lunarConfigEntry.TrySetValue(enabledMoonSettings, "Min Scrap", ref level.minScrap); lunarConfigEntry.TrySetValue(enabledMoonSettings, "Max Scrap", ref level.maxScrap); lunarConfigEntry.TrySetValue(enabledMoonSettings, "Min Scrap Total", ref level.minTotalScrapValue); lunarConfigEntry.TrySetValue(enabledMoonSettings, "Max Scrap Total", ref level.maxTotalScrapValue); lunarConfigEntry.TrySetValue(enabledMoonSettings, "Interior Multiplier", ref level.factorySizeMultiplier); if (!enabledMoonSettings.Contains("Disable Special Enemy") || lunarConfigEntry.GetValue("Disable Special Enemy")) { } if (val2 == null) { continue; } if (enabledMoonSettings.Contains("Route Price")) { val2.Cost = (IProvider)(object)new SimpleProvider(lunarConfigEntry.GetValue("Route Price")); } if (enabledMoonSettings.Contains("Is Hidden? & Is Locked?") && !flag) { ITerminalPurchasePredicate purchasePredicate = ITerminalPurchasePredicate.AlwaysSuccess(); bool value2 = lunarConfigEntry.GetValue("Is Hidden?"); bool value3 = lunarConfigEntry.GetValue("Is Locked?"); TerminalNode val8 = ScriptableObject.CreateInstance(); val8.displayText = "Route Locked!"; if (value2) { purchasePredicate = (ITerminalPurchasePredicate)((!value3) ? new ConstantTerminalPredicate((TerminalPurchaseResult)(object)new HiddenPurchaseResult().SetFailure(false)) : new ConstantTerminalPredicate((TerminalPurchaseResult)(object)new HiddenPurchaseResult().SetFailure(true).SetFailNode(val8))); } else if (value3) { purchasePredicate = (ITerminalPurchasePredicate)new ConstantTerminalPredicate((TerminalPurchaseResult)new FailedPurchaseResult(val8)); } val2.PurchasePredicate = purchasePredicate; } continue; } moons[numberlessPlanetName] = text; moons[text2] = text; if (enabledMoonSettings.Contains("Spawnable Scrap")) { notConfiguredScrapMoons.Add(value); } if (enabledMoonSettings.Contains("Spawnable Daytime Enemies")) { notConfiguredDaytimeMoons.Add(value); } if (enabledMoonSettings.Contains("Spawnable Interior Enemies")) { notConfiguredInteriorMoons.Add(value); } if (enabledMoonSettings.Contains("Spawnable Outside Enemies")) { notConfiguredOutsideMoons.Add(value); } if (enabledMoonSettings.Contains("Possible Interiors")) { notConfiguredDungeonMoons.Add(value); } if (enabledMapObjectSettings.Contains("(Inside) Level Curves")) { notConfiguredInsideMapObjectMoons.Add(value); } if (enabledMapObjectSettings.Contains("(Outside) Level Curves")) { notConfiguredOutsideMapObjectMoons.Add(value); } foreach (NamespacedKey tag2 in ((DawnBaseInfo)(object)value)._tags) { if (tag2.Namespace != "dawn_lib") { everyMoonTag.Add(tag2.Key); } } } catch (Exception arg) { MiniLogger.LogError($"LunarConfig encountered an issue while configuring {text}, please report this!\n{arg}"); } } if (enabledMoonSettings.Contains("Catalogue Index")) { List list = MoonRegistrationHandler.MoonGroupAlgorithm.Group(((Registry)(object)LethalContent.Moons).Values, true).SelectMany((MoonGroup it) => it.Moons).ToList(); Dictionary dictionary = new Dictionary(); foreach (KeyValuePair, DawnMoonInfo> item2 in (Registry)(object)LethalContent.Moons) { string text6 = UUIDify(((object)item2.Key).ToString()); string text7 = NiceifyDawnUUID(((NamespacedKey)item2.Key).Key); DawnMoonInfo value4 = item2.Value; LunarConfigEntry lunarConfigEntry2 = lunarConfigFile.AddEntry(text7 + " - " + text6); lunarConfigEntry2.AddField("Catalogue Index", "Changes the order in the moon catalogue in the terminal. A higher value means first/higher in the list.", list.IndexOf(value4)); if (lunarConfigEntry2.GetValue("Configure Content")) { dictionary[value4] = lunarConfigEntry2.GetValue("Catalogue Index"); } else { dictionary[value4] = list.IndexOf(value4); } } MoonRegistrationHandler.MoonGroupAlgorithm.OrderingSteps = new List(1) { (IMoonOrderingStep)(object)new LunarConfigCustomMoonOrder(dictionary) }; } lunarConfigFile.file.Save(); lunarConfigFile.file.SaveOnConfigSet = true; } else { foreach (KeyValuePair, DawnMoonInfo> item3 in (Registry)(object)LethalContent.Moons) { string text8 = UUIDify(((object)item3.Key).ToString()); moons[item3.Value.GetNumberlessPlanetName()] = text8; moons[CleanString(NiceifyDawnUUID(text8))] = text8; moonKeys[text8] = ((DawnBaseInfo)(object)item3.Value).TypedKey; } } moonsInitialized = true; MiniLogger.LogInfo("Completed Initializing Moons"); if (LunarConfig.LLLPresent) { LLLTags.Init(); } if (itemsInitialized && !moonItemsInitialized) { InitMoonItems(); } if (enemiesInitialized && !moonEnemiesInitialized) { InitMoonEnemies(); } if (dungeonsInitialized && !moonDungeonsInitialized) { InitMoonDungeons(); } if (mapObjectsInitialized && !moonObjectsInitialized) { InitMoonObjects(); } InitTagInjection(); InitMapObjectCurves(); InitItemWeights(); InitEnemyWeights(); InitDungeonWeights(); } public void InitUnlockables() { //IL_0467: Unknown result type (might be due to invalid IL or missing references) //IL_0471: Expected O, but got Unknown //IL_049e: Unknown result type (might be due to invalid IL or missing references) //IL_04a8: Expected O, but got Unknown if (!centralInitialized) { InitCentral(); } MiniLogger.LogInfo("Initializing Unlockables"); if (configureUnlockables) { LunarConfigFile lunarConfigFile = AddFile(LunarConfig.BUYABLE_FILE, LunarConfig.BUYABLE_FILE_NAME); lunarConfigFile.file.SaveOnConfigSet = false; foreach (KeyValuePair, DawnUnlockableItemInfo> item in (Registry)(object)LethalContent.Unlockables) { string text = UUIDify(((object)item.Key).ToString()); try { string text2 = NiceifyDawnUUID(((NamespacedKey)item.Key).Key); DawnUnlockableItemInfo value = item.Value; LunarConfigEntry lunarConfigEntry = lunarConfigFile.AddEntry(text2 + " - " + text); UnlockableItem unlockableItem = value.UnlockableItem; TerminalNode val = null; TerminalNode val2 = null; TerminalNode val3 = null; TerminalKeyword val4 = null; DawnPurchaseInfo dawnPurchaseInfo = value.DawnPurchaseInfo; if ((Object)(object)value.InfoNode != (Object)null) { val = value.InfoNode; } if ((Object)(object)value.RequestNode != (Object)null) { val2 = value.RequestNode; } if ((Object)(object)value.ConfirmNode != (Object)null) { val3 = value.ConfirmNode; } if ((Object)(object)value.BuyKeyword != (Object)null) { val4 = value.BuyKeyword; } lunarConfigEntry.AddField("Configure Content", "Enable to change any of the settings below.", defaultValue: false); lunarConfigEntry.TryAddField(enabledUnlockableSettings, "Already Unlocked", "NOTE: With furniture and ship upgrades, it may only appear after refreshing the save. Whether or not the unlockable has already been unlocked.", unlockableItem.alreadyUnlocked); lunarConfigEntry.TryAddField(enabledUnlockableSettings, "Always In Stock", "Whether or not the unlockable is always in stock.", unlockableItem.alwaysInStock); lunarConfigEntry.TryAddField(enabledUnlockableSettings, "Can Store?", "Whether or not the unlockable can be stored.", unlockableItem.canBeStored); lunarConfigEntry.TryAddField(enabledUnlockableSettings, "Is Placeable", "Whether or not the unlockable is placeable.", unlockableItem.IsPlaceable); lunarConfigEntry.TryAddField(enabledUnlockableSettings, "Luck Value", "The luck value the unlockable.", unlockableItem.luckValue); lunarConfigEntry.TryAddField(enabledUnlockableSettings, "Max Number", "The max number of the unlockable.", unlockableItem.maxNumber); lunarConfigEntry.TryAddField(enabledUnlockableSettings, "Unlocked In Challenge File", "Whether or not the unlockable is unlocked in a challenge file.", unlockableItem.unlockedInChallengeFile); if ((Object)(object)val4 != (Object)null) { lunarConfigEntry.TryAddField(enabledUnlockableSettings, "Buy Keyword", "The keyword used to buy the unlockable.", val4.word); } if ((Object)(object)val != (Object)null && enabledUnlockableSettings.Contains("Info Node Text")) { lunarConfigEntry.AddField("Info Node Text", "The text of the info node of the unlockable", val.displayText.Replace("\n", ";")); } if ((Object)(object)val2 != (Object)null && enabledUnlockableSettings.Contains("Request Node Text")) { lunarConfigEntry.AddField("Request Node Text", "The text of the request node of the unlockable", val2.displayText.Replace("\n", ";")); } if ((Object)(object)val3 != (Object)null && enabledUnlockableSettings.Contains("Confirm Node Text")) { lunarConfigEntry.AddField("Confirm Node Text", "The text of the confirm node of the unlockable", val3.displayText.Replace("\n", ";")); } lunarConfigEntry.TryAddField(enabledUnlockableSettings, "Shop Selection Node Text", "The text of the shop selection node of the unlockable.", unlockableItem.shopSelectionNode); lunarConfigEntry.TryAddField(enabledUnlockableSettings, "Cost", "The cost of the unlockable.", dawnPurchaseInfo.Cost.Provide()); lunarConfigEntry.TryAddField(enabledUnlockableSettings, "Tags", "Tags allocated to the unlockable.\nSeparate tags with commas.", string.Join(", ", from tag in ((DawnBaseInfo)(object)value).AllTags() where tag.Namespace != "dawn_lib" select tag)); if (!lunarConfigEntry.GetValue("Configure Content")) { continue; } if (enabledUnlockableSettings.Contains("Tags")) { HashSet hashSet = new HashSet(); string[] array = RemoveWhitespace(lunarConfigEntry.GetValue("Tags")).ToLower().Split(","); foreach (string text3 in array) { string[] array2 = text3.Split(":"); if (array2.Length == 1 && !Utility.IsNullOrWhiteSpace(array2[0])) { hashSet.Add(new NamespacedKey("lunarcontenttag", array2[0])); } else if (array2.Length == 2 && array2[0] != "dawn_lib") { hashSet.Add(new NamespacedKey(array2[0], array2[1])); } else if (!Utility.IsNullOrWhiteSpace(text3)) { MiniLogger.LogWarning("Incorrectly formatted tag '" + text3 + "' found on " + text); } } foreach (NamespacedKey tag in ((DawnBaseInfo)(object)value)._tags) { if (tag.Namespace == "dawn_lib") { hashSet.Add(tag); } } ((DawnBaseInfo)(object)value)._tags = hashSet; } ((DawnBaseInfo)(object)value).Internal_AddTag(DawnLibTags.LunarConfig); lunarConfigEntry.TrySetValue(enabledUnlockableSettings, "Already Unlocked", ref unlockableItem.alreadyUnlocked); lunarConfigEntry.TrySetValue(enabledUnlockableSettings, "Always In Stock", ref unlockableItem.alwaysInStock); lunarConfigEntry.TrySetValue(enabledUnlockableSettings, "Can Store?", ref unlockableItem.canBeStored); lunarConfigEntry.TrySetValue(enabledUnlockableSettings, "Is Placeable", ref unlockableItem.IsPlaceable); lunarConfigEntry.TrySetValue(enabledUnlockableSettings, "Luck Value", ref unlockableItem.luckValue); lunarConfigEntry.TrySetValue(enabledUnlockableSettings, "Max Number", ref unlockableItem.maxNumber); lunarConfigEntry.TrySetValue(enabledUnlockableSettings, "Unlocked In Challenge File", ref unlockableItem.unlockedInChallengeFile); if ((Object)(object)val4 != (Object)null && enabledUnlockableSettings.Contains("Buy Keyword")) { val4.word = lunarConfigEntry.GetValue("Buy Keyword"); } if ((Object)(object)val != (Object)null && enabledUnlockableSettings.Contains("Info Node Text")) { lunarConfigEntry.SetValue("Info Node Text", ref val.displayText); } if ((Object)(object)val2 != (Object)null && enabledUnlockableSettings.Contains("Request Node Text")) { lunarConfigEntry.SetValue("Request Node Text", ref val2.displayText); } if ((Object)(object)val3 != (Object)null && enabledUnlockableSettings.Contains("Confirm Node Text")) { lunarConfigEntry.SetValue("Confirm Node Text", ref val3.displayText); } lunarConfigEntry.TrySetValue(enabledUnlockableSettings, "Shop Selection Node Text", ref unlockableItem.shopSelectionNode); if (enabledUnlockableSettings.Contains("Cost")) { dawnPurchaseInfo.Cost = (IProvider)(object)new SimpleProvider(lunarConfigEntry.GetValue("Cost")); } } 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; } MiniLogger.LogInfo("Completed Initializing Unlockables"); } public void InitWeatherInjection() { if (!centralInitialized) { InitCentral(); } MiniLogger.LogInfo("Initializing Weather Injection"); if (configureWeatherInjection) { LunarConfigFile lunarConfigFile = AddFile(LunarConfig.WEATHER_INJECTION_FILE, LunarConfig.WEATHER_INJECTION_FILE_NAME); lunarConfigFile.file.SaveOnConfigSet = false; foreach (KeyValuePair, DawnWeatherEffectInfo> item in (Registry)(object)LethalContent.Weathers) { string text = UUIDify(((object)item.Key).ToString()); try { string text2 = NiceifyDawnUUID(((NamespacedKey)item.Key).Key); DawnWeatherEffectInfo value = item.Value; LunarConfigEntry lunarConfigEntry = lunarConfigFile.AddEntry(text2 + " - " + text); weatherKeys[text] = ((DawnBaseInfo)(object)value).TypedKey; lunarConfigEntry.AddField("Configure Content", "Enable to change any of the settings below.", defaultValue: false); string defaultValue = ""; string defaultValue2 = ""; string defaultValue3 = ""; string defaultValue4 = ""; string defaultValue5 = ""; lunarConfigEntry.TryAddField(enabledWeatherInjectionSettings, "Spawnable Scrap", "The scrap injected into the pool with this weather.\nDenoted with NAME:RARITY, separated with commas.", defaultValue); lunarConfigEntry.TryAddField(enabledWeatherInjectionSettings, "Spawnable Daytime Enemies", "The daytime enemies injected into the pool with this weather.\nDenoted with NAME:RARITY, separated with commas.", defaultValue2); lunarConfigEntry.TryAddField(enabledWeatherInjectionSettings, "Spawnable Interior Enemies", "The interior enemies injected into the pool with this weather.\nDenoted with NAME:RARITY, separated with commas.", defaultValue3); lunarConfigEntry.TryAddField(enabledWeatherInjectionSettings, "Spawnable Outside Enemies", "The outside enemies injected into the pool with this weather.\nDenoted with NAME:RARITY, separated with commas.", defaultValue4); lunarConfigEntry.TryAddField(enabledWeatherInjectionSettings, "Possible Interiors", "The interior injected into the pool with this weather.\nDenoted with NAME:RARITY, separated with commas.", defaultValue5); if (lunarConfigEntry.GetValue("Configure Content")) { if (enabledWeatherInjectionSettings.Contains("Spawnable Scrap")) { cachedWeatherSpawnableScrap[text] = lunarConfigEntry.GetValue("Spawnable Scrap"); } if (enabledWeatherInjectionSettings.Contains("Spawnable Daytime Enemies")) { cachedWeatherDaytimeEnemies[text] = lunarConfigEntry.GetValue("Spawnable Daytime Enemies"); } if (enabledWeatherInjectionSettings.Contains("Spawnable Interior Enemies")) { cachedWeatherInteriorEnemies[text] = lunarConfigEntry.GetValue("Spawnable Interior Enemies"); } if (enabledWeatherInjectionSettings.Contains("Spawnable Outside Enemies")) { cachedWeatherOutsideEnemies[text] = lunarConfigEntry.GetValue("Spawnable Outside Enemies"); } if (enabledWeatherInjectionSettings.Contains("Possible Interiors")) { cachedWeatherDungeons[text] = lunarConfigEntry.GetValue("Possible Interiors"); } } } 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; } weatherInjectionInitialized = true; MiniLogger.LogInfo("Completed Initializing Weather Injection"); InitItemWeights(); InitEnemyWeights(); InitDungeonWeights(); } public void InitDungeonInjection() { if (!centralInitialized) { InitCentral(); } MiniLogger.LogInfo("Initializing Dungeon Injection"); if (configureDungeonInjection) { LunarConfigFile lunarConfigFile = AddFile(LunarConfig.DUNGEON_INJECTION_FILE, LunarConfig.DUNGEON_INJECTION_FILE_NAME); lunarConfigFile.file.SaveOnConfigSet = false; foreach (KeyValuePair, DawnDungeonInfo> item in (Registry)(object)LethalContent.Dungeons) { string text = UUIDify(((object)item.Key).ToString()); try { string text2 = NiceifyDawnUUID(((NamespacedKey)item.Key).Key); DawnDungeonInfo value = item.Value; LunarConfigEntry lunarConfigEntry = lunarConfigFile.AddEntry(text2 + " - " + text); dungeonKeys[text] = ((DawnBaseInfo)(object)value).TypedKey; lunarConfigEntry.AddField("Configure Content", "Enable to change any of the settings below.", defaultValue: false); string defaultValue = ""; string defaultValue2 = ""; string defaultValue3 = ""; string defaultValue4 = ""; lunarConfigEntry.TryAddField(enabledDungeonInjectionSettings, "Spawnable Scrap", "The scrap injected into the pool with this dungeon.\nDenoted with NAME:RARITY, separated with commas.", defaultValue); lunarConfigEntry.TryAddField(enabledDungeonInjectionSettings, "Spawnable Daytime Enemies", "The daytime enemies injected into the pool with this dungeon.\nDenoted with NAME:RARITY, separated with commas.", defaultValue2); lunarConfigEntry.TryAddField(enabledDungeonInjectionSettings, "Spawnable Interior Enemies", "The interior enemies injected into the pool with this dungeon.\nDenoted with NAME:RARITY, separated with commas.", defaultValue3); lunarConfigEntry.TryAddField(enabledDungeonInjectionSettings, "Spawnable Outside Enemies", "The outside enemies injected into the pool with this dungeon.\nDenoted with NAME:RARITY, separated with commas.", defaultValue4); if (lunarConfigEntry.GetValue("Configure Content")) { if (enabledDungeonInjectionSettings.Contains("Spawnable Scrap")) { cachedDungeonSpawnableScrap[text] = lunarConfigEntry.GetValue("Spawnable Scrap"); } if (enabledDungeonInjectionSettings.Contains("Spawnable Daytime Enemies")) { cachedDungeonDaytimeEnemies[text] = lunarConfigEntry.GetValue("Spawnable Daytime Enemies"); } if (enabledDungeonInjectionSettings.Contains("Spawnable Interior Enemies")) { cachedDungeonInteriorEnemies[text] = lunarConfigEntry.GetValue("Spawnable Interior Enemies"); } if (enabledDungeonInjectionSettings.Contains("Spawnable Outside Enemies")) { cachedDungeonOutsideEnemies[text] = lunarConfigEntry.GetValue("Spawnable Outside Enemies"); } } } 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; } dungeonInjectionInitialized = true; MiniLogger.LogInfo("Completed Initializing Dungeon Injection"); InitItemWeights(); InitEnemyWeights(); } public void InitTagInjection() { if (!centralInitialized) { InitCentral(); } MiniLogger.LogInfo("Initializing Tag Injection"); if (configureTagInjection) { LunarConfigFile lunarConfigFile = AddFile(LunarConfig.TAG_INJECTION_FILE, LunarConfig.TAG_INJECTION_FILE_NAME); lunarConfigFile.file.SaveOnConfigSet = false; foreach (string item in everyMoonTag) { string text = item; try { string key = "lunartaginjection:" + text; LunarConfigEntry lunarConfigEntry = lunarConfigFile.AddEntry(text ?? ""); lunarConfigEntry.AddField("Configure Content", "Enable to change any of the settings below.", defaultValue: false); string defaultValue = ""; string defaultValue2 = ""; string defaultValue3 = ""; string defaultValue4 = ""; string defaultValue5 = ""; lunarConfigEntry.TryAddField(enabledTagInjectionSettings, "Spawnable Scrap", "The scrap injected into the pool with this tag.\nDenoted with NAME:RARITY, separated with commas.", defaultValue); lunarConfigEntry.TryAddField(enabledTagInjectionSettings, "Spawnable Daytime Enemies", "The daytime enemies injected into the pool with this tag.\nDenoted with NAME:RARITY, separated with commas.", defaultValue2); lunarConfigEntry.TryAddField(enabledTagInjectionSettings, "Spawnable Interior Enemies", "The interior enemies injected into the pool with this tag.\nDenoted with NAME:RARITY, separated with commas.", defaultValue3); lunarConfigEntry.TryAddField(enabledTagInjectionSettings, "Spawnable Outside Enemies", "The outside enemies injected into the pool with this tag.\nDenoted with NAME:RARITY, separated with commas.", defaultValue4); lunarConfigEntry.TryAddField(enabledTagInjectionSettings, "Possible Interiors", "The interior injected into the pool with this tag.\nDenoted with NAME:RARITY, separated with commas.", defaultValue5); if (lunarConfigEntry.GetValue("Configure Content")) { if (enabledTagInjectionSettings.Contains("Spawnable Scrap")) { cachedTagSpawnableScrap[key] = lunarConfigEntry.GetValue("Spawnable Scrap"); } if (enabledTagInjectionSettings.Contains("Spawnable Daytime Enemies")) { cachedTagDaytimeEnemies[key] = lunarConfigEntry.GetValue("Spawnable Daytime Enemies"); } if (enabledTagInjectionSettings.Contains("Spawnable Interior Enemies")) { cachedTagInteriorEnemies[key] = lunarConfigEntry.GetValue("Spawnable Interior Enemies"); } if (enabledTagInjectionSettings.Contains("Spawnable Outside Enemies")) { cachedTagOutsideEnemies[key] = lunarConfigEntry.GetValue("Spawnable Outside Enemies"); } if (enabledTagInjectionSettings.Contains("Possible Interiors")) { cachedTagDungeons[key] = lunarConfigEntry.GetValue("Possible Interiors"); } } } 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; } tagInjectionInitialized = true; MiniLogger.LogInfo("Completed Initializing Tag Injection"); InitItemWeights(); InitEnemyWeights(); InitDungeonWeights(); } public LunarConfigFile AddFile(string path, string name) { LunarConfigFile lunarConfigFile = new LunarConfigFile(path); files[name] = lunarConfigFile; return lunarConfigFile; } } public class LunarConfigEntry { public string name; public ConfigFile file; public Dictionary fields = new Dictionary(); public LunarConfigEntry(ConfigFile file, string name) { this.name = name; this.file = file; } public void AddField(string key, string description, T defaultValue) { fields[key] = (ConfigEntryBase)(object)file.Bind(name, key, defaultValue, description); } public void TryAddField(HashSet enabled, string key, string description, T defaultValue) { if (enabled.Contains(key) && !fields.Keys.Contains(key)) { fields[key] = (ConfigEntryBase)(object)file.Bind(name, key, defaultValue, description); } } public void AddFields(List<(string, string, object)> fieldList) { foreach (var field in fieldList) { fields[field.Item1] = (ConfigEntryBase)(object)file.Bind(name, field.Item1, field.Item3, field.Item2); } } public T GetValue(string key) { return ((ConfigEntry)(object)fields[key]).Value; } public void SetValue(string key, ref T obj, bool over = false) { T value = GetValue(key); if (!EqualityComparer.Default.Equals(obj, value)) { obj = value; } } public void TrySetValue(HashSet enabled, string key, ref T obj) { if (enabled.Contains(key)) { T value = GetValue(key); if (!EqualityComparer.Default.Equals(obj, value)) { obj = value; } } } public void SetCurve(string key, ref AnimationCurve obj, bool over = false) { AnimationCurve val = LunarCentral.StringToCurve(GetValue(key)); if (obj != val) { obj = val; } } } public class LunarConfigFile { public readonly string path; public ConfigFile file; public Dictionary entries = new Dictionary(); public LunarConfigFile(string path) { //IL_001d: Unknown result type (might be due to invalid IL or missing references) //IL_0027: Expected O, but got Unknown this.path = path; file = new ConfigFile(path, true); } public LunarConfigEntry AddEntry(string name) { if (entries.ContainsKey(name)) { return entries[name]; } LunarConfigEntry lunarConfigEntry = new LunarConfigEntry(file, name); entries[name] = lunarConfigEntry; return lunarConfigEntry; } } public class LunarConfigCustomMoonOrder : IMoonOrderingStep { [CompilerGenerated] [DebuggerBrowsable(DebuggerBrowsableState.Never)] private Dictionary P; public LunarConfigCustomMoonOrder(Dictionary newCatalogueIndex) { P = newCatalogueIndex; base..ctor(); } public IOrderedEnumerable ApplyInitial(IEnumerable input, bool reverse = false) { return reverse ? input.OrderBy(GetIndex) : input.OrderByDescending(GetIndex); } public IOrderedEnumerable ApplyNext(IOrderedEnumerable input, bool reverse = false) { return reverse ? input.ThenBy(GetIndex) : input.ThenByDescending(GetIndex); } private int GetIndex(DawnMoonInfo moonInfo) { return P[moonInfo]; } } } namespace System.Runtime.CompilerServices { [AttributeUsage(AttributeTargets.Assembly, AllowMultiple = true)] internal sealed class IgnoresAccessChecksToAttribute : Attribute { public IgnoresAccessChecksToAttribute(string assemblyName) { } } }