Decompiled source of CentralConfig v0.15.6
CentralConfig/CentralConfig.dll
Decompiled 2 weeks ago
The result has been truncated due to the large size, download it to view full contents!
using System; using System.Collections; using System.Collections.Generic; using System.Diagnostics; using System.Linq; using System.Reflection; using System.Reflection.Emit; using System.Runtime.CompilerServices; using System.Runtime.Serialization; using System.Runtime.Versioning; using System.Security; using System.Security.Permissions; using System.Threading; using BepInEx; using BepInEx.Bootstrap; using BepInEx.Configuration; using BepInEx.Logging; using CSync.Extensions; using CSync.Lib; using DiversityRemastered; using DunGen; using GameNetcodeStuff; using HarmonyLib; using Imperium; using Kittenji.FootballEntity; using LethalBestiary.Modules; using LethalLevelLoader; using LethalLevelLoader.Tools; using LethalLib.Modules; using LethalUtilities; using Loadstone.Config; using PintoMod; using RollingGiant; using TMPro; using Unity.Collections; using Unity.Netcode; using UnityEngine; using UnityEngine.UI; using WeatherRegistry; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)] [assembly: IgnoresAccessChecksTo("Diversity Remastered")] [assembly: IgnoresAccessChecksTo("giosuel.Imperium")] [assembly: IgnoresAccessChecksTo("LethalUtilities")] [assembly: IgnoresAccessChecksTo("WeatherRegistry")] [assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")] [assembly: AssemblyCompany("CentralConfig")] [assembly: AssemblyConfiguration("Debug")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0+93f4f8e5b08b42beabbf4bbc3b47527c94de53f2")] [assembly: AssemblyProduct("CentralConfig")] [assembly: AssemblyTitle("CentralConfig")] [assembly: AssemblyMetadata("RepositoryUrl", "https://github.com/ImpulsiveLad/CentralConfig/")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.0.0.0")] [module: UnverifiableCode] namespace CentralConfig { public static class WRCompatibility { private static bool? _enabled; public static bool enabled { get { if (!_enabled.HasValue) { _enabled = Chainloader.PluginInfos.ContainsKey("mrov.WeatherRegistry"); } return _enabled.Value; } } [MethodImpl(MethodImplOptions.NoInlining | MethodImplOptions.NoOptimization)] public static List<string> GetAllWeathersWithWR() { List<string> list = (from Weather w in WeatherManager.RegisteredWeathers select ((object)w).ToString()).ToList(); for (int i = 0; i < list.Count; i++) { list[i] = list[i].Replace(" (WeatherRegistry.Weather)", ""); } return list; } [MethodImpl(MethodImplOptions.NoInlining | MethodImplOptions.NoOptimization)] public static float GetWRWeatherMultiplier(SelectableLevel level) { //IL_0017: Unknown result type (might be due to invalid IL or missing references) if (WeatherManager.currentWeathers._currentWeathers.ContainsKey(level)) { Weather weather = WeatherManager.GetWeather(level.currentWeather); return weather.ScrapAmountMultiplier; } return 1f; } [MethodImpl(MethodImplOptions.NoInlining | MethodImplOptions.NoOptimization)] public static void RemoveWRScrapMultiplierHardSet() { ConfigManager.UseScrapMultipliers.Value = false; } } public static class ImperiumCompatibility { private static bool? _enabled; public static bool enabled { get { if (!_enabled.HasValue) { _enabled = Chainloader.PluginInfos.ContainsKey("giosuel.Imperium"); } return _enabled.Value; } } [MethodImpl(MethodImplOptions.NoInlining | MethodImplOptions.NoOptimization)] public static bool ImperiumTimePaused() { return Imperium.MoonManager.TimeIsPaused.Value; } } public static class LoadstoneCompatibility { private static bool? _enabled; public static bool enabled { get { if (!_enabled.HasValue) { _enabled = Chainloader.PluginInfos.ContainsKey("com.adibtw.loadstone"); } return _enabled.Value; } } [MethodImpl(MethodImplOptions.NoInlining | MethodImplOptions.NoOptimization)] public static bool IsLoadStoneAsyncing() { return LoadstoneConfig.AsyncDungeon.Value; } } public static class LoadstoneNCompatibility { private static bool? _enabled; public static bool enabled { get { if (!_enabled.HasValue) { _enabled = Chainloader.PluginInfos.ContainsKey("com.adibtw.loadstone.Nightly"); } return _enabled.Value; } } [MethodImpl(MethodImplOptions.NoInlining | MethodImplOptions.NoOptimization)] public static bool IsLoadStoneNAsyncing() { return LoadstoneConfig.AsyncDungeon.Value; } } public static class NPLCompatibility { private static bool? _enabled; public static bool enabled { get { if (!_enabled.HasValue) { _enabled = Chainloader.PluginInfos.ContainsKey("LCNoPropsLost"); } return _enabled.Value; } } } public static class KirSSIODCompatibility { private static bool? _enabled; public static bool enabled { get { if (!_enabled.HasValue) { _enabled = Chainloader.PluginInfos.ContainsKey("Kirpichyov.SaveShipItemsOnDeath"); } return _enabled.Value; } } } public static class BobKSCompatibility { private static bool? _enabled; public static bool enabled { get { if (!_enabled.HasValue) { _enabled = Chainloader.PluginInfos.ContainsKey("Bob123.LCM_KeepScrap"); } return _enabled.Value; } } } public static class NDDCompatibility { private static bool? _enabled; public static bool enabled { get { if (!_enabled.HasValue) { _enabled = Chainloader.PluginInfos.ContainsKey("NoDeathDespawn"); } return _enabled.Value; } } } public static class KSCompatibility { private static bool? _enabled; public static bool enabled { get { if (!_enabled.HasValue) { _enabled = Chainloader.PluginInfos.ContainsKey("KeepScrap"); } return _enabled.Value; } } } public static class LUCompatibility { private static bool? _enabled; public static bool enabled { get { if (!_enabled.HasValue) { _enabled = Chainloader.PluginInfos.ContainsKey("Kyxino.LethalUtils"); } return _enabled.Value; } } public static bool ReturnLUScrapKeeper() { //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Invalid comparison between Unknown and I4 if ((int)RoundSettings.LoseUponDeath.Value == 0) { return true; } return false; } } public static class FMCompatibility { private static bool? _enabled; public static bool enabled { get { if (!_enabled.HasValue) { _enabled = Chainloader.PluginInfos.ContainsKey("me.loaforc.facilitymeltdown"); } return _enabled.Value; } } } public static class LBCompatability { private static bool? _enabled; public static bool enabled { get { if (!_enabled.HasValue) { _enabled = Chainloader.PluginInfos.ContainsKey("Xilef.LethalBestiary"); } return _enabled.Value; } } [MethodImpl(MethodImplOptions.NoInlining | MethodImplOptions.NoOptimization)] public static List<EnemyType> AddLBEnemies(List<EnemyType> enemies) { foreach (SpawnableEnemy spawnableEnemy in Enemies.spawnableEnemies) { if (!enemies.Contains(spawnableEnemy.enemy)) { enemies.Add(spawnableEnemy.enemy); } } return enemies; } } public static class DiversityCompat { private static bool? _enabled; public static bool enabled { get { if (!_enabled.HasValue) { _enabled = Chainloader.PluginInfos.ContainsKey("Chaos.Diversity"); } return _enabled.Value; } } [MethodImpl(MethodImplOptions.NoInlining | MethodImplOptions.NoOptimization)] public static List<EnemyType> AddWalker(List<EnemyType> enemies) { EnemyType item = ContentLoader.MainAssets.LoadAsset<EnemyType>("Assets/custom/diversity/walker/WalkerType.asset"); if (!enemies.Contains(item)) { enemies.Add(item); } return enemies; } } public static class PintoBoyCompat { private static bool? _enabled; public static bool enabled { get { if (!_enabled.HasValue) { _enabled = Chainloader.PluginInfos.ContainsKey("Pinta.PintoBoy"); } return _enabled.Value; } } [MethodImpl(MethodImplOptions.NoInlining | MethodImplOptions.NoOptimization)] public static void RenamePintoBois() { Pinto_ModBase.itemPintoBoyLJ.itemName = "PintoBoyLJ"; Pinto_ModBase.itemPintoBoyFD.itemName = "PintoBoyFD"; } [MethodImpl(MethodImplOptions.NoInlining | MethodImplOptions.NoOptimization)] public static string PBSIWRTS(SpawnableItemWithRarity item) { string result = string.Empty; if ((Object)(object)item.spawnableItem == (Object)(object)Pinto_ModBase.itemPintoBoyLJ && item.rarity > 0) { result = "PintoBoyLJ:" + item.rarity + ","; } else if ((Object)(object)item.spawnableItem == (Object)(object)Pinto_ModBase.itemPintoBoyFD && item.rarity > 0) { result = "PintoBoyFD:" + item.rarity + ","; } else if (item.rarity > 0) { result = ConfigAider.LightlyToastString(item.spawnableItem.itemName) + ":" + item.rarity + ","; } return result; } } public static class FootBallCompat { private static bool? _enabled; public static bool enabled { get { if (!_enabled.HasValue) { _enabled = Chainloader.PluginInfos.ContainsKey("Kittenji.FootballEntity"); } return _enabled.Value; } } [MethodImpl(MethodImplOptions.NoInlining | MethodImplOptions.NoOptimization)] public static List<EnemyType> AddFootball(List<EnemyType> enemies) { EnemyType enemyDef = Plugin.EnemyDef; if (!enemies.Contains(enemyDef)) { enemies.Add(enemyDef); } return enemies; } } public static class RollingGiantCompat { private static bool? _enabled; public static bool enabled { get { if (!_enabled.HasValue) { _enabled = Chainloader.PluginInfos.ContainsKey("nomnomab.rollinggiant"); } return _enabled.Value; } } [MethodImpl(MethodImplOptions.NoInlining | MethodImplOptions.NoOptimization)] public static List<EnemyType> AddRollingGiant(List<EnemyType> enemies) { EnemyType enemyTypeInside = Plugin.EnemyTypeInside; enemyTypeInside.enemyName = "Rolling Giant Inside"; EnemyType enemyTypeOutsideDaytime = Plugin.EnemyTypeOutsideDaytime; enemyTypeOutsideDaytime.enemyName = "Rolling Giant Day"; EnemyType enemyTypeOutside = Plugin.EnemyTypeOutside; enemyTypeOutside.enemyName = "Rolling Giant Night"; if (!enemies.Contains(enemyTypeInside)) { enemies.Add(enemyTypeInside); } if (!enemies.Contains(enemyTypeOutsideDaytime)) { enemies.Add(enemyTypeOutsideDaytime); } if (!enemies.Contains(enemyTypeOutside)) { enemies.Add(enemyTypeOutside); } return enemies; } [MethodImpl(MethodImplOptions.NoInlining | MethodImplOptions.NoOptimization)] public static string RGSEWRTS(SpawnableEnemyWithRarity enemy) { string result = string.Empty; if ((Object)(object)enemy.enemyType == (Object)(object)Plugin.EnemyTypeInside && enemy.rarity > 0) { result = "Rolling Giant Inside:" + enemy.rarity + ","; } else if ((Object)(object)enemy.enemyType == (Object)(object)Plugin.EnemyTypeOutsideDaytime && enemy.rarity > 0) { result = "Rolling Giant Day:" + enemy.rarity + ","; } else if ((Object)(object)enemy.enemyType == (Object)(object)Plugin.EnemyTypeOutside && enemy.rarity > 0) { result = "Rolling Giant Night:" + enemy.rarity + ","; } else if (enemy.enemyType.enemyName != "Lasso" && enemy.rarity > 0) { result = ConfigAider.LightlyToastString(enemy.enemyType.enemyName) + ":" + enemy.rarity + ","; } return result; } } [HarmonyPatch(typeof(StartOfRound), "ShipLeave")] public class ShipleaveCalc { public static int RemainingScrapInLevel; [HarmonyPostfix] public static void Postfix() { RemainingScrapInLevel = CalculateRemainingScrapInLevel(); } public static int CalculateRemainingScrapInLevel() { GrabbableObject[] array = Object.FindObjectsByType<GrabbableObject>((FindObjectsSortMode)0); int num = 0; for (int i = 0; i < array.Length; i++) { if (array[i].itemProperties.isScrap && !array[i].isInShipRoom && !array[i].isInElevator && !array[i].scrapPersistedThroughRounds) { num += array[i].scrapValue; } } return num; } } [HarmonyPatch(typeof(HUDManager), "FillEndGameStats")] public class HUDManagerPatch { [HarmonyPostfix] public static void FillEndGameStatsPostfix(HUDManager __instance, int scrapCollected) { float num = scrapCollected + ShipleaveCalc.RemainingScrapInLevel; ((TMP_Text)__instance.statsUIElements.quotaDenominator).text = num.ToString(); } [HarmonyPrefix] public static void UpdateTotalScrap(HUDManager __instance, int scrapCollected) { float totalScrapValueInLevel = scrapCollected + ShipleaveCalc.RemainingScrapInLevel; RoundManager.Instance.totalScrapValueInLevel = totalScrapValueInLevel; } } public class ConfigAider : MonoBehaviour { [HarmonyPatch(typeof(HangarShipDoor), "Start")] public static class FlattenCurves { private static void Postfix() { //IL_002c: Unknown result type (might be due to invalid IL or missing references) //IL_0032: Expected O, but got Unknown if (!NetworkManager.Singleton.IsHost || !SyncedEntry<bool>.op_Implicit(CentralConfig.SyncConfig.FlattenCurves)) { return; } AnimationCurve val = new AnimationCurve(); val.AddKey(0f, 1f); val.AddKey(1f, 1f); ((Keyframe)(ref val.keys[0])).inTangent = 0f; ((Keyframe)(ref val.keys[0])).outTangent = 0f; ((Keyframe)(ref val.keys[1])).inTangent = 0f; ((Keyframe)(ref val.keys[1])).outTangent = 0f; foreach (EnemyType allEnemy in allEnemies) { allEnemy.probabilityCurve = val; } } } private static ConfigAider _instance; public static Color MagentaColor = Color.magenta; public static List<EnemyType> allEnemies; public List<ContentTag> allContentTagsList; public static ConfigAider Instance { get { //IL_0016: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)_instance == (Object)null) { _instance = new GameObject("ConfigAider").AddComponent<ConfigAider>(); } return _instance; } } public static string CauterizeString(string inputString) { string text = new string(inputString.Where((char c) => char.IsLetterOrDigit(c)).ToArray()); return text.ToLower(); } public static string LightlyToastString(string inputString) { return new string(inputString.Where((char c) => c != ':' && c != '-' && c != ',' && c != '~').ToArray()); } public static List<Item> GrabFullItemList() { if (PintoBoyCompat.enabled) { PintoBoyCompat.RenamePintoBois(); } return StartOfRound.Instance.allItemsList.itemsList; } public static List<EnemyType> GrabFullEnemyList() { if (allEnemies == null) { allEnemies = new List<EnemyType>(); foreach (EnemyType enemy in OriginalContent.Enemies) { if (!allEnemies.Contains(enemy)) { allEnemies.Add(enemy); } } foreach (ExtendedEnemyType extendedEnemyType in PatchedContent.ExtendedEnemyTypes) { if (!allEnemies.Contains(extendedEnemyType.EnemyType)) { allEnemies.Add(extendedEnemyType.EnemyType); } } foreach (SpawnableEnemy spawnableEnemy in Enemies.spawnableEnemies) { if (!allEnemies.Contains(spawnableEnemy.enemy)) { allEnemies.Add(spawnableEnemy.enemy); } } if (LBCompatability.enabled) { allEnemies = LBCompatability.AddLBEnemies(allEnemies); } if (DiversityCompat.enabled) { allEnemies = DiversityCompat.AddWalker(allEnemies); } if (FootBallCompat.enabled) { allEnemies = FootBallCompat.AddFootball(allEnemies); } if (RollingGiantCompat.enabled) { allEnemies = RollingGiantCompat.AddRollingGiant(allEnemies); } } return allEnemies; } public List<ContentTag> GrabFullTagList() { //IL_0109: Unknown result type (might be due to invalid IL or missing references) if (allContentTagsList == null) { allContentTagsList = new List<ContentTag>(); foreach (ExtendedLevel extendedLevel in PatchedContent.ExtendedLevels) { foreach (ContentTag contentTag in ((ExtendedContent)extendedLevel).ContentTags) { if (!allContentTagsList.Contains(contentTag)) { allContentTagsList.Add(contentTag); } } } List<string> list = SplitStringsByDaComma(SyncedEntry<string>.op_Implicit(CentralConfig.SyncConfig.NewTags)); foreach (string tag in list) { if (!allContentTagsList.Any((ContentTag ct) => ct.contentTagName == tag)) { ContentTag item = ContentTag.Create(tag, MagentaColor); allContentTagsList.Add(item); } } } return allContentTagsList; } public static List<string> SplitStringsByDaComma(string newInputString) { return newInputString.Split(new string[1] { "," }, StringSplitOptions.RemoveEmptyEntries).ToList(); } public static string ConvertEnemyListToString(List<SpawnableEnemyWithRarity> spawnableEnemiesList) { string text = string.Empty; List<SpawnableEnemyWithRarity> list = spawnableEnemiesList.OrderBy((SpawnableEnemyWithRarity spawnableEnemyWithRarity) => spawnableEnemyWithRarity.enemyType.enemyName).ToList(); foreach (SpawnableEnemyWithRarity item in list) { if (RollingGiantCompat.enabled) { text += RollingGiantCompat.RGSEWRTS(item); } else if (item.enemyType.enemyName != "Lasso" && item.rarity > 0) { text = text + LightlyToastString(item.enemyType.enemyName) + ":" + item.rarity + ","; } } if (text.Contains(",") && text.LastIndexOf(",") == text.Length - 1) { text = text.Remove(text.LastIndexOf(","), 1); } if (text == string.Empty) { text = "Default Values Were Empty"; } return text; } public static List<SpawnableEnemyWithRarity> ConvertStringToEnemyList(string newInputString, Vector2 clampRarity) { //IL_00ce: Unknown result type (might be due to invalid IL or missing references) //IL_00cf: Unknown result type (might be due to invalid IL or missing references) //IL_00e1: Unknown result type (might be due to invalid IL or missing references) //IL_00ec: Unknown result type (might be due to invalid IL or missing references) //IL_0131: Unknown result type (might be due to invalid IL or missing references) //IL_0138: Expected O, but got Unknown //IL_01eb: Unknown result type (might be due to invalid IL or missing references) //IL_01f2: Expected O, but got Unknown if (string.IsNullOrEmpty(newInputString) || newInputString == "Default Values Were Empty") { return new List<SpawnableEnemyWithRarity>(); } List<SpawnableEnemyWithRarity> list = new List<SpawnableEnemyWithRarity>(); List<EnemyType> list2 = GrabFullEnemyList(); string[] array = newInputString.Split(','); string[] array2 = array; foreach (string text in array2) { string[] array3 = text.Split(':'); if (array3.Length != 2) { continue; } string inputString = array3[0].Trim(); inputString = CauterizeString(inputString); bool flag = false; if (!int.TryParse(array3[1].Trim(), out var result)) { CentralConfig.instance.mls.LogInfo((object)("Cannot Parse Rarity: " + array3[1].Trim() + " after EnemyName entry " + inputString)); result = 0; } if (clampRarity != Vector2.zero) { result = Mathf.Clamp(result, Mathf.RoundToInt(clampRarity.x), Mathf.RoundToInt(clampRarity.y)); } foreach (EnemyType item in list2) { string text2 = CauterizeString(item.enemyName); if (text2 == inputString) { SpawnableEnemyWithRarity val = new SpawnableEnemyWithRarity(); val.enemyType = item; val.rarity = result; list.Add(val); flag = true; break; } } if (flag) { continue; } foreach (EnemyType item2 in list2) { if (!((Object)(object)item2.enemyPrefab != (Object)null)) { continue; } ScanNodeProperties componentInChildren = item2.enemyPrefab.GetComponentInChildren<ScanNodeProperties>(); if ((Object)(object)componentInChildren != (Object)null) { string text3 = CauterizeString(componentInChildren.headerText); if (text3 == inputString) { SpawnableEnemyWithRarity val2 = new SpawnableEnemyWithRarity(); val2.enemyType = item2; val2.rarity = result; list.Add(val2); flag = true; break; } } } } return list; } public static List<SpawnableEnemyWithRarity> RemoveDuplicateEnemies(List<SpawnableEnemyWithRarity> enemies) { List<SpawnableEnemyWithRarity> list = new List<SpawnableEnemyWithRarity>(); if (SyncedEntry<bool>.op_Implicit(CentralConfig.SyncConfig.AlwaysKeepZeros)) { IEnumerable<IGrouping<string, SpawnableEnemyWithRarity>> enumerable = from e in enemies group e by e.enemyType.enemyName; foreach (IGrouping<string, SpawnableEnemyWithRarity> item in enumerable) { if (item.Any((SpawnableEnemyWithRarity e) => e.rarity == 0)) { list.Add(item.First((SpawnableEnemyWithRarity e) => e.rarity <= 0)); } else { list.AddRange(item); } } } else { IEnumerable<IGrouping<string, SpawnableEnemyWithRarity>> enumerable2 = from e in enemies group e by e.enemyType.enemyName; foreach (IGrouping<string, SpawnableEnemyWithRarity> item2 in enumerable2) { list.AddRange(item2); } } if (!SyncedEntry<bool>.op_Implicit(CentralConfig.SyncConfig.KeepSmallerDupes)) { return (from e in list group e by e.enemyType.enemyName into g select g.OrderByDescending((SpawnableEnemyWithRarity e) => e.rarity).First()).ToList(); } return (from e in list group e by e.enemyType.enemyName into g select g.OrderByDescending((SpawnableEnemyWithRarity e) => e.rarity).Last()).ToList(); } public static List<SpawnableEnemyWithRarity> IncreaseEnemyRarities(List<SpawnableEnemyWithRarity> enemies) { //IL_0259: Unknown result type (might be due to invalid IL or missing references) //IL_0260: Expected O, but got Unknown //IL_0226: Unknown result type (might be due to invalid IL or missing references) //IL_022d: Expected O, but got Unknown List<SpawnableEnemyWithRarity> list = new List<SpawnableEnemyWithRarity>(); List<string> ignoreListEntries = (from entry in SplitStringsByDaComma(MiscConfig.CreateMiscConfig.EnemyShuffleBlacklist.Value) select CauterizeString(entry)).ToList(); List<SpawnableEnemyWithRarity> list2 = enemies.Where((SpawnableEnemyWithRarity e) => !ignoreListEntries.Any((string b) => CauterizeString(e.enemyType.enemyName).Equals(b))).ToList(); List<SpawnableEnemyWithRarity> list3 = enemies.Where((SpawnableEnemyWithRarity e) => ignoreListEntries.Any((string b) => CauterizeString(e.enemyType.enemyName).Equals(b))).ToList(); foreach (SpawnableEnemyWithRarity item in list3) { list.Add(item); } foreach (SpawnableEnemyWithRarity item2 in list2) { if (!EnemyShuffler.EnemyAppearances.ContainsKey(item2.enemyType)) { if (ShuffleSaver.EnemyAppearanceString.ContainsKey(item2.enemyType.enemyName)) { EnemyShuffler.EnemyAppearances.Add(item2.enemyType, ShuffleSaver.EnemyAppearanceString[item2.enemyType.enemyName]); CentralConfig.instance.mls.LogInfo((object)$"Remembered saved Enemy Key: {item2.enemyType.enemyName}, Days: {EnemyShuffler.EnemyAppearances[item2.enemyType]}"); } else { EnemyShuffler.EnemyAppearances.Add(item2.enemyType, 0); ShuffleSaver.EnemyAppearanceString.Add(item2.enemyType.enemyName, 0); } } if (!ShuffleSaver.EnemyAppearanceString.ContainsKey(item2.enemyType.enemyName)) { ShuffleSaver.EnemyAppearanceString.Add(item2.enemyType.enemyName, EnemyShuffler.EnemyAppearances[item2.enemyType]); } int num = EnemyShuffler.EnemyAppearances[item2.enemyType]; int num2 = ShuffleSaver.enemyrandom.Next(SyncedEntry<int>.op_Implicit(MiscConfig.CreateMiscConfig.EnemyShuffleRandomMin), SyncedEntry<int>.op_Implicit(MiscConfig.CreateMiscConfig.EnemyShuffleRandomMax) + 1); if (num == 0) { SpawnableEnemyWithRarity val = new SpawnableEnemyWithRarity(); val.enemyType = item2.enemyType; val.rarity = item2.rarity; list.Add(val); continue; } SpawnableEnemyWithRarity val2 = new SpawnableEnemyWithRarity(); val2.enemyType = item2.enemyType; if (SyncedEntry<bool>.op_Implicit(MiscConfig.CreateMiscConfig.EnemyShufflerPercent) && (item2.rarity >= 0 || !SyncedEntry<bool>.op_Implicit(MiscConfig.CreateMiscConfig.RolloverNegatives))) { val2.rarity = (int)Math.Round((float)num * ((float)item2.rarity * ((float)num2 / 100f)) + (float)item2.rarity); val2.rarity = Mathf.Clamp(val2.rarity, 0, 99999); } else { if (item2.rarity < 0 && SyncedEntry<bool>.op_Implicit(MiscConfig.CreateMiscConfig.RolloverNegatives)) { item2.rarity = num; } val2.rarity = item2.rarity + num * num2; val2.rarity = Mathf.Clamp(val2.rarity, -99999, 99999); } list.Add(val2); } return list; } public static List<SpawnableEnemyWithRarity> ReplaceEnemies(List<SpawnableEnemyWithRarity> EnemyList, string ReplaceConfig) { //IL_0315: Unknown result type (might be due to invalid IL or missing references) //IL_031c: Expected O, but got Unknown //IL_01a8: Unknown result type (might be due to invalid IL or missing references) //IL_01af: Expected O, but got Unknown if (string.IsNullOrEmpty(ReplaceConfig) || ReplaceConfig == "Default Values Were Empty") { return EnemyList; } List<SpawnableEnemyWithRarity> list = new List<SpawnableEnemyWithRarity>(); List<string> list2 = new List<string>(); List<SpawnableEnemyWithRarity> source = new List<SpawnableEnemyWithRarity>(EnemyList); Random random = new Random(StartOfRound.Instance.randomMapSeed); string[] array = ReplaceConfig.Split(','); string[] array2 = array; foreach (string text in array2) { int result = -1; int result2 = 100; string[] array3 = text.Split(':'); if (array3.Length != 2) { continue; } string text2 = array3[0].Trim(); string text3 = array3[1].Trim(); string[] array4 = text2.Split('-'); string text4; if (array4.Length == 2) { text4 = array4[0].Trim(); int.TryParse(array4[1].Trim(), out result); } else { text4 = text2; } string[] array5 = text3.Split('~'); string text5; if (array5.Length == 2) { text5 = array5[0].Trim(); int.TryParse(array5[1].Trim(), out result2); } else { text5 = text3; } bool flag = false; EnemyList = EnemyList.OrderBy((SpawnableEnemyWithRarity e) => e.enemyType.enemyName).ToList(); for (int j = 0; j < EnemyList.Count; j++) { SpawnableEnemyWithRarity val = EnemyList[j]; string text6 = CauterizeString(val.enemyType.enemyName); string text7 = CauterizeString(text4); if (text6 == text7 && random.Next(100) < result2) { SpawnableEnemyWithRarity val2 = new SpawnableEnemyWithRarity(); val2.enemyType = GetEnemyTypeByName(text5); string text8 = "Replaced enemy: " + text4 + " with " + text5; if (result != -1) { val2.rarity = result; text8 += $", using rarity override of {result}."; } else { val2.rarity = val.rarity; text8 += $", using the original enemy rarity of {val.rarity}."; } list.Add(val2); list2.Add(CauterizeString(text4)); text8 += $"\nChance to replace was: {result2}%"; flag = true; EnemyList.Remove(val); break; } } if (!flag) { } } source = source.OrderBy((SpawnableEnemyWithRarity e) => e.enemyType.enemyName).ToList(); foreach (SpawnableEnemyWithRarity item in source) { if (!list2.Contains(CauterizeString(item.enemyType.enemyName))) { SpawnableEnemyWithRarity val3 = new SpawnableEnemyWithRarity(); val3.enemyType = item.enemyType; val3.rarity = item.rarity; list.Add(val3); } } return list; } public static EnemyType GetEnemyTypeByName(string enemyName) { foreach (EnemyType item in GrabFullEnemyList()) { if (CauterizeString(item.enemyName) == CauterizeString(enemyName)) { return item; } } return null; } public static List<SpawnableEnemyWithRarity> MultiplyEnemyRarities(List<SpawnableEnemyWithRarity> enemies, string ConfigString) { //IL_021f: Unknown result type (might be due to invalid IL or missing references) //IL_0226: Expected O, but got Unknown //IL_0139: Unknown result type (might be due to invalid IL or missing references) //IL_0140: Expected O, but got Unknown if (string.IsNullOrEmpty(ConfigString) || ConfigString == "Default Values Were Empty") { return enemies; } List<SpawnableEnemyWithRarity> list = new List<SpawnableEnemyWithRarity>(); List<string> list2 = new List<string>(); List<SpawnableEnemyWithRarity> source = new List<SpawnableEnemyWithRarity>(enemies); string[] array = ConfigString.Split(','); string[] array2 = array; foreach (string text in array2) { string[] array3 = text.Split(':'); if (array3.Length != 2) { continue; } string text2 = array3[0].Trim(); if (!float.TryParse(array3[1].Trim(), out var result)) { CentralConfig.instance.mls.LogInfo((object)("Cannot Parse Multiplier: " + array3[1].Trim() + " after EnemyName entry " + text2)); result = 1f; } bool flag = false; enemies = enemies.OrderBy((SpawnableEnemyWithRarity e) => e.enemyType.enemyName).ToList(); for (int j = 0; j < enemies.Count; j++) { SpawnableEnemyWithRarity val = enemies[j]; string text3 = CauterizeString(val.enemyType.enemyName); string text4 = CauterizeString(text2); if (text3 == text4) { SpawnableEnemyWithRarity val2 = new SpawnableEnemyWithRarity(); val2.enemyType = GetEnemyTypeByName(text2); val2.rarity = (int)((float)val.rarity * result); list.Add(val2); list2.Add(CauterizeString(text2)); flag = true; enemies.Remove(val); break; } } if (!flag) { } } source = source.OrderBy((SpawnableEnemyWithRarity e) => e.enemyType.enemyName).ToList(); foreach (SpawnableEnemyWithRarity item in source) { if (!list2.Contains(CauterizeString(item.enemyType.enemyName))) { SpawnableEnemyWithRarity val3 = new SpawnableEnemyWithRarity(); val3.enemyType = item.enemyType; val3.rarity = item.rarity; list.Add(val3); } } return list; } public static string GetBigList(int Type) { string text = string.Empty; List<ExtendedLevel> extendedLevels = PatchedContent.ExtendedLevels; List<ExtendedLevel> list = extendedLevels.OrderBy((ExtendedLevel level) => level.NumberlessPlanetName).ToList(); foreach (ExtendedLevel item in list) { if (item.NumberlessPlanetName != "Gordion" && item.NumberlessPlanetName != "Liquidation") { switch (Type) { case 0: { string text4 = ConvertEnemyListToString(item.SelectableLevel.Enemies); text = text + LightlyToastString(item.NumberlessPlanetName) + "-" + text4 + "~"; break; } case 1: { string text3 = ConvertEnemyListToString(item.SelectableLevel.DaytimeEnemies); text = text + LightlyToastString(item.NumberlessPlanetName) + "-" + text3 + "~"; break; } case 2: { string text2 = ConvertEnemyListToString(item.SelectableLevel.OutsideEnemies); text = text + LightlyToastString(item.NumberlessPlanetName) + "-" + text2 + "~"; break; } } } } if (text.Contains("~") && text.LastIndexOf("~") == text.Length - 1) { text = text.Remove(text.LastIndexOf("~"), 1); } if (text == string.Empty) { text = "Default Values Were Empty"; } return text; } public static void SetBigList(int Type, string BigString) { //IL_0127: Unknown result type (might be due to invalid IL or missing references) //IL_0190: Unknown result type (might be due to invalid IL or missing references) //IL_01f6: Unknown result type (might be due to invalid IL or missing references) List<ExtendedLevel> extendedLevels = PatchedContent.ExtendedLevels; List<ExtendedLevel> list = extendedLevels.OrderBy((ExtendedLevel level) => level.NumberlessPlanetName).ToList(); Vector2 clampRarity = default(Vector2); Vector2 clampRarity2 = default(Vector2); Vector2 clampRarity3 = default(Vector2); foreach (ExtendedLevel item in list) { if (!(item.NumberlessPlanetName != "Gordion") || !(item.NumberlessPlanetName != "Liquidation")) { continue; } string text = LightlyToastString(item.NumberlessPlanetName) + "-"; int num = BigString.IndexOf(text); if (num == -1) { continue; } int num2 = BigString.IndexOf("~", num); if (num2 == -1) { num2 = BigString.Length; } string text2 = BigString.Substring(num + text.Length, num2 - num - text.Length); if (Type == 0 && text2 != "Default Values Were Empty" && text2 != "") { ((Vector2)(ref clampRarity))..ctor(-99999f, 99999f); List<SpawnableEnemyWithRarity> list2 = ConvertStringToEnemyList(text2, clampRarity); if (list2.Count > 0) { item.SelectableLevel.Enemies = list2; } } else if (Type == 1 && text2 != "Default Values Were Empty" && text2 != "") { ((Vector2)(ref clampRarity2))..ctor(-99999f, 99999f); List<SpawnableEnemyWithRarity> list3 = ConvertStringToEnemyList(text2, clampRarity2); if (list3.Count > 0) { item.SelectableLevel.DaytimeEnemies = list3; } } else if (Type == 2 && text2 != "Default Values Were Empty" && text2 != "") { ((Vector2)(ref clampRarity3))..ctor(-99999f, 99999f); List<SpawnableEnemyWithRarity> list4 = ConvertStringToEnemyList(text2, clampRarity3); if (list4.Count > 0) { item.SelectableLevel.OutsideEnemies = list4; } } } } public static List<SpawnableEnemyWithRarity> RemoveZeroRarityEnemies(List<SpawnableEnemyWithRarity> enemylist) { List<SpawnableEnemyWithRarity> list = new List<SpawnableEnemyWithRarity>(); foreach (SpawnableEnemyWithRarity item in enemylist) { if (item.rarity != 0) { list.Add(item); } } return list; } public static string ConvertItemListToString(List<SpawnableItemWithRarity> spawnableItemsList) { string text = string.Empty; List<SpawnableItemWithRarity> list = spawnableItemsList.OrderBy((SpawnableItemWithRarity spawnableItemWithRarity) => spawnableItemWithRarity.spawnableItem.itemName).ToList(); foreach (SpawnableItemWithRarity item in list) { if (PintoBoyCompat.enabled) { text += PintoBoyCompat.PBSIWRTS(item); } else if (item.rarity > 0) { text = text + LightlyToastString(item.spawnableItem.itemName) + ":" + item.rarity + ","; } } if (text.Contains(",") && text.LastIndexOf(",") == text.Length - 1) { text = text.Remove(text.LastIndexOf(","), 1); } if (text == string.Empty) { text = "Default Values Were Empty"; } return text; } public static List<SpawnableItemWithRarity> ConvertStringToItemList(string newInputString, Vector2 clampRarity) { //IL_00cb: Unknown result type (might be due to invalid IL or missing references) //IL_00cc: Unknown result type (might be due to invalid IL or missing references) //IL_00de: Unknown result type (might be due to invalid IL or missing references) //IL_00e9: Unknown result type (might be due to invalid IL or missing references) //IL_012e: Unknown result type (might be due to invalid IL or missing references) //IL_0135: Expected O, but got Unknown if (string.IsNullOrEmpty(newInputString) || newInputString == "Default Values Were Empty") { return new List<SpawnableItemWithRarity>(); } List<SpawnableItemWithRarity> list = new List<SpawnableItemWithRarity>(); List<Item> list2 = GrabFullItemList(); string[] array = newInputString.Split(','); string[] array2 = array; foreach (string text in array2) { string[] array3 = text.Split(':'); if (array3.Length != 2) { continue; } string inputString = array3[0].Trim(); inputString = CauterizeString(inputString); if (!int.TryParse(array3[1].Trim(), out var result)) { CentralConfig.instance.mls.LogInfo((object)("Cannot Parse Rarity: " + array3[1].Trim() + " after ItemName entry " + inputString)); result = 0; } if (clampRarity != Vector2.zero) { result = Mathf.Clamp(result, Mathf.RoundToInt(clampRarity.x), Mathf.RoundToInt(clampRarity.y)); } foreach (Item item in list2) { string text2 = CauterizeString(item.itemName); if (text2 == inputString) { SpawnableItemWithRarity val = new SpawnableItemWithRarity(); val.spawnableItem = item; val.rarity = result; list.Add(val); break; } } } return list; } public static List<SpawnableItemWithRarity> RemoveLowerRarityDuplicateItems(List<SpawnableItemWithRarity> items) { return (from e in items group e by e.spawnableItem.itemName into g select g.OrderByDescending((SpawnableItemWithRarity e) => e.rarity).First()).ToList(); } public static List<SpawnableItemWithRarity> IncreaseScrapRarities(List<SpawnableItemWithRarity> items) { //IL_0259: Unknown result type (might be due to invalid IL or missing references) //IL_0260: Expected O, but got Unknown //IL_0226: Unknown result type (might be due to invalid IL or missing references) //IL_022d: Expected O, but got Unknown List<SpawnableItemWithRarity> list = new List<SpawnableItemWithRarity>(); List<string> ignoreListEntries = (from entry in SplitStringsByDaComma(MiscConfig.CreateMiscConfig.ScrapShuffleBlacklist.Value) select CauterizeString(entry)).ToList(); List<SpawnableItemWithRarity> list2 = items.Where((SpawnableItemWithRarity i) => !ignoreListEntries.Any((string b) => CauterizeString(i.spawnableItem.itemName).Equals(b))).ToList(); List<SpawnableItemWithRarity> list3 = items.Where((SpawnableItemWithRarity i) => ignoreListEntries.Any((string b) => CauterizeString(i.spawnableItem.itemName).Equals(b))).ToList(); foreach (SpawnableItemWithRarity item in list3) { list.Add(item); } foreach (SpawnableItemWithRarity item2 in list2) { if (!ScrapShuffler.ScrapAppearances.ContainsKey(item2.spawnableItem)) { if (ShuffleSaver.ScrapAppearanceString.ContainsKey(item2.spawnableItem.itemName)) { ScrapShuffler.ScrapAppearances.Add(item2.spawnableItem, ShuffleSaver.ScrapAppearanceString[item2.spawnableItem.itemName]); CentralConfig.instance.mls.LogInfo((object)$"Remembered saved Item Key: {item2.spawnableItem.itemName}, Days: {ScrapShuffler.ScrapAppearances[item2.spawnableItem]}"); } else { ScrapShuffler.ScrapAppearances.Add(item2.spawnableItem, 0); ShuffleSaver.ScrapAppearanceString.Add(item2.spawnableItem.itemName, 0); } } if (!ShuffleSaver.ScrapAppearanceString.ContainsKey(item2.spawnableItem.itemName)) { ShuffleSaver.ScrapAppearanceString.Add(item2.spawnableItem.itemName, ScrapShuffler.ScrapAppearances[item2.spawnableItem]); } int num = ScrapShuffler.ScrapAppearances[item2.spawnableItem]; int num2 = ShuffleSaver.scraprandom.Next(SyncedEntry<int>.op_Implicit(MiscConfig.CreateMiscConfig.ScrapShuffleRandomMin), SyncedEntry<int>.op_Implicit(MiscConfig.CreateMiscConfig.ScrapShuffleRandomMax) + 1); if (num == 0) { SpawnableItemWithRarity val = new SpawnableItemWithRarity(); val.spawnableItem = item2.spawnableItem; val.rarity = item2.rarity; list.Add(val); continue; } SpawnableItemWithRarity val2 = new SpawnableItemWithRarity(); val2.spawnableItem = item2.spawnableItem; if (SyncedEntry<bool>.op_Implicit(MiscConfig.CreateMiscConfig.ScrapShufflerPercent) && (item2.rarity >= 0 || !SyncedEntry<bool>.op_Implicit(MiscConfig.CreateMiscConfig.RolloverNegatives))) { val2.rarity = (int)Math.Round((float)num * ((float)item2.rarity * ((float)num2 / 100f)) + (float)item2.rarity); val2.rarity = Mathf.Clamp(val2.rarity, 0, 99999); } else { if (item2.rarity < 0 && SyncedEntry<bool>.op_Implicit(MiscConfig.CreateMiscConfig.RolloverNegatives)) { item2.rarity = num; } val2.rarity = item2.rarity + num * num2; val2.rarity = Mathf.Clamp(val2.rarity, -99999, 99999); } list.Add(val2); } return list; } public static List<SpawnableItemWithRarity> RemoveZeroRarityItems(List<SpawnableItemWithRarity> itemList) { List<SpawnableItemWithRarity> list = new List<SpawnableItemWithRarity>(); foreach (SpawnableItemWithRarity item in itemList) { if (item.rarity != 0) { list.Add(item); } } return list; } public static string ConvertTagsToString(List<ContentTag> contentTags) { string text = string.Empty; List<ContentTag> list = contentTags.OrderBy((ContentTag contentTag) => contentTag.contentTagName).ToList(); HashSet<string> hashSet = new HashSet<string>(); foreach (ContentTag item in list) { string text2 = CauterizeString(item.contentTagName); if (hashSet.Add(text2)) { text = text + text2 + ","; } } if (text.EndsWith(",")) { text = text.Remove(text.LastIndexOf(","), 1); } if (string.IsNullOrEmpty(text)) { text = "Default Values Were Empty"; } return text; } public static List<ContentTag> ConvertStringToTagList(string newInputString) { if (string.IsNullOrEmpty(newInputString) || newInputString == "Default Values Were Empty") { return new List<ContentTag>(); } List<ContentTag> list = new List<ContentTag>(); List<ContentTag> list2 = Instance.GrabFullTagList(); string[] array = newInputString.Split(','); string[] array2 = array; foreach (string inputString in array2) { string text = CauterizeString(inputString); foreach (ContentTag item in list2) { string text2 = CauterizeString(item.contentTagName); if (text2 == text) { list.Add(item); break; } } } return list; } public static string GetMoonsWithTag(ContentTag contentTag) { int num = 0; string text = string.Empty; List<ExtendedLevel> extendedLevels = PatchedContent.ExtendedLevels; List<ExtendedLevel> list = extendedLevels.OrderBy((ExtendedLevel level) => level.NumberlessPlanetName).ToList(); foreach (ExtendedLevel item in list) { string text2 = ConvertTagsToString(((ExtendedContent)item).ContentTags); if (text2.Contains(CauterizeString(contentTag.contentTagName))) { text = text + item.NumberlessPlanetName + ","; num++; } } if (text.EndsWith(",")) { text = text.Remove(text.LastIndexOf(","), 1); } if (string.IsNullOrEmpty(text)) { text = "Default Values Were Empty"; } return text; } public static void RemoveDuplicateTags(List<ContentTag> tags) { List<string> list = new List<string>(); foreach (ContentTag tag in tags) { if (!list.Contains(tag.contentTagName)) { list.Add(tag.contentTagName); } else { ((ExtendedContent)LevelManager.CurrentExtendedLevel).ContentTags.Remove(tag); } } } public static List<StringWithRarity> IncreaseDungeonRarities(List<StringWithRarity> strings, ExtendedDungeonFlow dungeonflow, string flowName) { //IL_0131: Unknown result type (might be due to invalid IL or missing references) //IL_0138: Expected O, but got Unknown //IL_0118: Unknown result type (might be due to invalid IL or missing references) //IL_011f: Expected O, but got Unknown List<StringWithRarity> list = new List<StringWithRarity>(); if (!DungeonShuffler.DungeonAppearances.ContainsKey(dungeonflow)) { if (ShuffleSaver.DungeonAppearanceString.ContainsKey(flowName)) { DungeonShuffler.DungeonAppearances.Add(dungeonflow, ShuffleSaver.DungeonAppearanceString[flowName]); CentralConfig.instance.mls.LogInfo((object)$"Remembered saved Dungeon Key: {flowName}, Days: {DungeonShuffler.DungeonAppearances[dungeonflow]}"); } else { DungeonShuffler.DungeonAppearances.Add(dungeonflow, 0); ShuffleSaver.DungeonAppearanceString.Add(flowName, 0); } } if (!ShuffleSaver.DungeonAppearanceString.ContainsKey(flowName)) { ShuffleSaver.DungeonAppearanceString.Add(flowName, DungeonShuffler.DungeonAppearances[dungeonflow]); } int num = DungeonShuffler.DungeonAppearances[dungeonflow]; foreach (StringWithRarity @string in strings) { int num2 = ShuffleSaver.dungeonrandom.Next(SyncedEntry<int>.op_Implicit(MiscConfig.CreateMiscConfig.DungeonShuffleRandomMin), SyncedEntry<int>.op_Implicit(MiscConfig.CreateMiscConfig.DungeonShuffleRandomMax) + 1); if (num == 0) { StringWithRarity item = new StringWithRarity(@string.Name, @string.Rarity); list.Add(item); continue; } StringWithRarity val = new StringWithRarity((string)null, 0); val.Name = @string.Name; if (SyncedEntry<bool>.op_Implicit(MiscConfig.CreateMiscConfig.DungeonShufflerPercent) && (@string.Rarity >= 0 || !SyncedEntry<bool>.op_Implicit(MiscConfig.CreateMiscConfig.RolloverNegatives))) { val.Rarity = (int)Math.Round((float)num * ((float)@string.Rarity * ((float)num2 / 100f)) + (float)@string.Rarity); val.Rarity = Mathf.Clamp(val.Rarity, 0, 99999); } else { if (@string.Rarity < 0 && SyncedEntry<bool>.op_Implicit(MiscConfig.CreateMiscConfig.RolloverNegatives)) { @string.Rarity = num; } val.Rarity = @string.Rarity + num * num2; val.Rarity = Mathf.Clamp(val.Rarity, -99999, 99999); } list.Add(val); } return list; } public static List<Vector2WithRarity> IncreaseDungeonRaritiesVector2(List<Vector2WithRarity> vectors, ExtendedDungeonFlow dungeonflow, string flowName) { //IL_0141: Unknown result type (might be due to invalid IL or missing references) //IL_0148: Expected O, but got Unknown //IL_011f: Unknown result type (might be due to invalid IL or missing references) //IL_0126: Expected O, but got Unknown List<Vector2WithRarity> list = new List<Vector2WithRarity>(); if (!DungeonShuffler.DungeonAppearances.ContainsKey(dungeonflow)) { if (ShuffleSaver.DungeonAppearanceString.ContainsKey(flowName)) { DungeonShuffler.DungeonAppearances.Add(dungeonflow, ShuffleSaver.DungeonAppearanceString[flowName]); CentralConfig.instance.mls.LogInfo((object)$"Remembered saved Dungeon Key: {flowName}, Days: {DungeonShuffler.DungeonAppearances[dungeonflow]}"); } else { DungeonShuffler.DungeonAppearances.Add(dungeonflow, 0); ShuffleSaver.DungeonAppearanceString.Add(flowName, 0); } } if (!ShuffleSaver.DungeonAppearanceString.ContainsKey(flowName)) { ShuffleSaver.DungeonAppearanceString.Add(flowName, DungeonShuffler.DungeonAppearances[dungeonflow]); } int num = DungeonShuffler.DungeonAppearances[dungeonflow]; foreach (Vector2WithRarity vector in vectors) { int num2 = ShuffleSaver.dungeonrandom.Next(SyncedEntry<int>.op_Implicit(MiscConfig.CreateMiscConfig.DungeonShuffleRandomMin), SyncedEntry<int>.op_Implicit(MiscConfig.CreateMiscConfig.DungeonShuffleRandomMax) + 1); if (num == 0) { Vector2WithRarity item = new Vector2WithRarity(vector.Min, vector.Max, vector.Rarity); list.Add(item); continue; } Vector2WithRarity val = new Vector2WithRarity(0f, 0f, 0); val.Min = vector.Min; val.Max = vector.Max; if (SyncedEntry<bool>.op_Implicit(MiscConfig.CreateMiscConfig.DungeonShufflerPercent) && (vector.Rarity >= 0 || !SyncedEntry<bool>.op_Implicit(MiscConfig.CreateMiscConfig.RolloverNegatives))) { val.Rarity = (int)Math.Round((float)num * ((float)vector.Rarity * ((float)num2 / 100f)) + (float)vector.Rarity); val.Rarity = Mathf.Clamp(val.Rarity, 0, 99999); } else { if (vector.Rarity < 0 && SyncedEntry<bool>.op_Implicit(MiscConfig.CreateMiscConfig.RolloverNegatives)) { vector.Rarity = num; } val.Rarity = vector.Rarity + num * num2; val.Rarity = Mathf.Clamp(val.Rarity, -99999, 99999); } list.Add(val); } return list; } public static string ConvertStringWithRarityToString(List<StringWithRarity> names) { string text = string.Empty; List<StringWithRarity> list = names.OrderBy((StringWithRarity name) => name.Name).ToList(); foreach (StringWithRarity item in list) { if (item.Rarity > 0) { text = text + item.Name + ":" + item.Rarity + ","; } } if (text.Contains(",") && text.LastIndexOf(",") == text.Length - 1) { text = text.Remove(text.LastIndexOf(","), 1); } if (text == string.Empty) { text = "Default Values Were Empty"; } return text; } public static List<StringWithRarity> ConvertModStringToStringWithRarityList(string newInputString, Vector2 clampRarity) { //IL_00d5: Unknown result type (might be due to invalid IL or missing references) //IL_00d6: Unknown result type (might be due to invalid IL or missing references) //IL_010a: Unknown result type (might be due to invalid IL or missing references) //IL_0114: Expected O, but got Unknown //IL_00e8: Unknown result type (might be due to invalid IL or missing references) //IL_00f3: Unknown result type (might be due to invalid IL or missing references) if (string.IsNullOrEmpty(newInputString) || newInputString == "Default Values Were Empty" || newInputString == "Default Values Were Empty:0" || newInputString == ":0") { return new List<StringWithRarity>(); } List<StringWithRarity> list = new List<StringWithRarity>(); string[] array = newInputString.Split(','); string[] array2 = array; foreach (string text in array2) { string[] array3 = text.Split(':'); if (array3.Length == 2) { string text2 = array3[0].Trim(); if (!int.TryParse(array3[1].Trim(), out var result)) { CentralConfig.instance.mls.LogInfo((object)("Cannot Parse Rarity: " + array3[1].Trim() + " after ModName entry " + text2)); result = 0; } if (clampRarity != Vector2.zero) { result = Mathf.Clamp(result, Mathf.RoundToInt(clampRarity.x), Mathf.RoundToInt(clampRarity.y)); } list.Add(new StringWithRarity(text2, result)); } } return list; } public static List<StringWithRarity> ConvertTagStringToStringWithRarityList(string newInputString, Vector2 clampRarity) { //IL_00d5: Unknown result type (might be due to invalid IL or missing references) //IL_00d6: Unknown result type (might be due to invalid IL or missing references) //IL_010a: Unknown result type (might be due to invalid IL or missing references) //IL_0114: Expected O, but got Unknown //IL_00e8: Unknown result type (might be due to invalid IL or missing references) //IL_00f3: Unknown result type (might be due to invalid IL or missing references) if (string.IsNullOrEmpty(newInputString) || newInputString == "Default Values Were Empty" || newInputString == "Default Values Were Empty:0" || newInputString == ":0") { return new List<StringWithRarity>(); } List<StringWithRarity> list = new List<StringWithRarity>(); string[] array = newInputString.Split(','); string[] array2 = array; foreach (string text in array2) { string[] array3 = text.Split(':'); if (array3.Length == 2) { string text2 = array3[0].Trim(); if (!int.TryParse(array3[1].Trim(), out var result)) { CentralConfig.instance.mls.LogInfo((object)("Cannot Parse Rarity: " + array3[1].Trim() + " after TagName entry " + text2)); result = 0; } if (clampRarity != Vector2.zero) { result = Mathf.Clamp(result, Mathf.RoundToInt(clampRarity.x), Mathf.RoundToInt(clampRarity.y)); } list.Add(new StringWithRarity(text2, result)); } } return list; } public static List<StringWithRarity> ConvertPlanetNameStringToStringWithRarityList(string newInputString, Vector2 clampRarity) { //IL_00d5: Unknown result type (might be due to invalid IL or missing references) //IL_00d6: Unknown result type (might be due to invalid IL or missing references) //IL_00e8: Unknown result type (might be due to invalid IL or missing references) //IL_00f3: Unknown result type (might be due to invalid IL or missing references) //IL_0138: Unknown result type (might be due to invalid IL or missing references) //IL_0142: Expected O, but got Unknown if (string.IsNullOrEmpty(newInputString) || newInputString == "Default Values Were Empty" || newInputString == "Default Values Were Empty:0" || newInputString == ":0") { return new List<StringWithRarity>(); } List<StringWithRarity> list = new List<StringWithRarity>(); string[] array = newInputString.Split(','); string[] array2 = array; foreach (string text in array2) { string[] array3 = text.Split(':'); if (array3.Length != 2) { continue; } string text2 = array3[0].Trim(); if (!int.TryParse(array3[1].Trim(), out var result)) { CentralConfig.instance.mls.LogInfo((object)("Cannot Parse Rarity: " + array3[1].Trim() + " after PlanetName entry " + text2)); result = 0; } if (clampRarity != Vector2.zero) { result = Mathf.Clamp(result, Mathf.RoundToInt(clampRarity.x), Mathf.RoundToInt(clampRarity.y)); } foreach (ExtendedLevel extendedLevel in PatchedContent.ExtendedLevels) { if (extendedLevel.NumberlessPlanetName == text2) { list.Add(new StringWithRarity(text2, result)); break; } } } return list; } public static string ConvertVector2WithRaritiesToString(List<Vector2WithRarity> values) { string text = string.Empty; foreach (Vector2WithRarity value in values) { text = text + value.Min + "-" + value.Max + ":" + value.Rarity + ","; } if (text.Contains(",") && text.LastIndexOf(",") == text.Length - 1) { text = text.Remove(text.LastIndexOf(","), 1); } if (text == string.Empty) { text = "Default Values Were Empty"; } return text; } public static List<Vector2WithRarity> ConvertStringToVector2WithRarityList(string newInputString, Vector2 clampRarity) { //IL_018f: Unknown result type (might be due to invalid IL or missing references) //IL_0190: Unknown result type (might be due to invalid IL or missing references) //IL_01c6: Unknown result type (might be due to invalid IL or missing references) //IL_01cd: Unknown result type (might be due to invalid IL or missing references) //IL_01d7: Expected O, but got Unknown //IL_01a2: Unknown result type (might be due to invalid IL or missing references) //IL_01ad: Unknown result type (might be due to invalid IL or missing references) if (!string.IsNullOrEmpty(newInputString)) { switch (newInputString) { default: { if (newInputString == "0-0:0") { break; } List<Vector2WithRarity> list = new List<Vector2WithRarity>(); string[] array = newInputString.Split(','); string[] array2 = array; foreach (string text in array2) { string[] array3 = text.Split(':'); if (array3.Length != 2) { continue; } string text2 = array3[0].Trim(); if (!int.TryParse(array3[1].Trim(), out var result)) { CentralConfig.instance.mls.LogInfo((object)("Cannot Parse Rarity: " + array3[1].Trim() + " after RouteRange entry " + text2)); result = 0; } string[] array4 = text2.Split('-'); if (array4.Length == 2) { if (!int.TryParse(array4[0].Trim(), out var result2)) { CentralConfig.instance.mls.LogInfo((object)("Cannot Parse LowerRange: " + array3[1].Trim() + " after RouteRange entry " + text2)); result2 = 0; } if (!int.TryParse(array4[1].Trim(), out var result3)) { CentralConfig.instance.mls.LogInfo((object)("Cannot Parse UpperRange: " + array3[1].Trim() + " after RouteRange entry " + text2)); result3 = 0; } if (clampRarity != Vector2.zero) { result = Mathf.Clamp(result, Mathf.RoundToInt(clampRarity.x), Mathf.RoundToInt(clampRarity.y)); } list.Add(new Vector2WithRarity(new Vector2((float)result2, (float)result3), result)); } } return list; } case "Default Values Were Empty": case "Default Values Were Empty:0": case ":0": break; } } return new List<Vector2WithRarity>(); } public static AnimationCurve MultiplyYValues(AnimationCurve curve, float multiplier, string LevelName, string TypeOf, int minKeyframes = 10) { //IL_0036: Unknown result type (might be due to invalid IL or missing references) //IL_003b: Unknown result type (might be due to invalid IL or missing references) //IL_0059: Unknown result type (might be due to invalid IL or missing references) //IL_005b: Unknown result type (might be due to invalid IL or missing references) //IL_0075: Unknown result type (might be due to invalid IL or missing references) //IL_007b: Expected O, but got Unknown if (curve == null || curve.length == 0) { return null; } curve = AddKeyframes(curve, minKeyframes); Keyframe[] array = (Keyframe[])(object)new Keyframe[curve.length]; for (int i = 0; i < curve.length; i++) { Keyframe val = curve[i]; float value = ((Keyframe)(ref val)).value; ((Keyframe)(ref val)).value = ((Keyframe)(ref val)).value * multiplier; array[i] = val; } return new AnimationCurve(array); } public static AnimationCurve AddKeyframes(AnimationCurve curve, int minKeyframes) { //IL_00b5: Unknown result type (might be due to invalid IL or missing references) //IL_00bc: Expected O, but got Unknown //IL_002e: Unknown result type (might be due to invalid IL or missing references) //IL_0033: Unknown result type (might be due to invalid IL or missing references) //IL_0038: Unknown result type (might be due to invalid IL or missing references) //IL_003d: Unknown result type (might be due to invalid IL or missing references) //IL_007b: Unknown result type (might be due to invalid IL or missing references) List<Keyframe> list = new List<Keyframe>(curve.keys); Keyframe item = default(Keyframe); while (list.Count < minKeyframes) { for (int i = 0; i < list.Count - 1; i++) { if (list.Count >= minKeyframes) { break; } Keyframe val = list[i]; Keyframe val2 = list[i + 1]; float num = (((Keyframe)(ref val)).time + ((Keyframe)(ref val2)).time) / 2f; float num2 = (((Keyframe)(ref val)).value + ((Keyframe)(ref val2)).value) / 2f; ((Keyframe)(ref item))..ctor(num, num2); list.Insert(i + 1, item); } } return new AnimationCurve(list.ToArray()); } public static AnimationCurve ScaleXValues(AnimationCurve curve, float scaleFactor, string LevelName, string TypeOf, int minKeyframes = 10) { //IL_0036: Unknown result type (might be due to invalid IL or missing references) //IL_003b: Unknown result type (might be due to invalid IL or missing references) //IL_0059: Unknown result type (might be due to invalid IL or missing references) //IL_005b: Unknown result type (might be due to invalid IL or missing references) //IL_0075: Unknown result type (might be due to invalid IL or missing references) //IL_007b: Expected O, but got Unknown if (curve == null || curve.length == 0) { return null; } curve = AddKeyframes(curve, minKeyframes); Keyframe[] array = (Keyframe[])(object)new Keyframe[curve.length]; for (int i = 0; i < curve.length; i++) { Keyframe val = curve[i]; float time = ((Keyframe)(ref val)).time; ((Keyframe)(ref val)).time = ((Keyframe)(ref val)).time / scaleFactor; array[i] = val; } return new AnimationCurve(array); } public static void LogCurve(AnimationCurve curve, EnemyType enemy) { //IL_000f: Unknown result type (might be due to invalid IL or missing references) //IL_0014: Unknown result type (might be due to invalid IL or missing references) Keyframe[] keys = curve.keys; for (int i = 0; i < keys.Length; i++) { Keyframe val = keys[i]; CentralConfig.instance.mls.LogInfo((object)$"Enemy: {enemy.enemyName}, Time: {((Keyframe)(ref val)).time}, Value: {((Keyframe)(ref val)).value}"); } } public void CleanConfig(ConfigFile cfg) { ((MonoBehaviour)this).StartCoroutine(CQueen(cfg)); } private IEnumerator CQueen(ConfigFile cfg) { while (!ApplyMoonConfig.Ready || !ApplyDungeonConfig.Ready || !ApplyTagConfig.Ready || !ApplyWeatherConfig.Ready) { yield return null; } ConfigCleaner(cfg); } private void ConfigCleaner(ConfigFile cfg) { if (!SyncedEntry<bool>.op_Implicit(CentralConfig.SyncConfig.KeepOrphans)) { PropertyInfo property = ((object)cfg).GetType().GetProperty("OrphanedEntries", BindingFlags.Instance | BindingFlags.NonPublic); Dictionary<ConfigDefinition, string> dictionary = (Dictionary<ConfigDefinition, string>)property.GetValue(cfg, null); dictionary.Clear(); cfg.Save(); CentralConfig.instance.mls.LogInfo((object)"Config Cleaned"); } else { CentralConfig.instance.mls.LogInfo((object)"Orphaned Entries were kept."); } } } [HarmonyPatch(typeof(RoundManager), "GenerateNewFloor")] [HarmonyPriority(777)] public class ResetEnemyAndScrapLists { private static void Prefix() { string numberlessPlanetName = LevelManager.CurrentExtendedLevel.NumberlessPlanetName; if (NetworkManager.Singleton.IsHost && (SyncedEntry<bool>.op_Implicit(CentralConfig.SyncConfig.EnemyShuffle) || SyncedEntry<bool>.op_Implicit(CentralConfig.SyncConfig.DoEnemyWeatherInjections) || SyncedEntry<bool>.op_Implicit(CentralConfig.SyncConfig.DoEnemyTagInjections) || SyncedEntry<bool>.op_Implicit(CentralConfig.SyncConfig.DoEnemyInjectionsByDungeon)) && OriginalEnemyAndScrapLists.OriginalIntLists.ContainsKey(numberlessPlanetName) && OriginalEnemyAndScrapLists.OriginalDayLists.ContainsKey(numberlessPlanetName) && OriginalEnemyAndScrapLists.OriginalNoxLists.ContainsKey(numberlessPlanetName)) { LevelManager.CurrentExtendedLevel.SelectableLevel.Enemies = OriginalEnemyAndScrapLists.OriginalIntLists[numberlessPlanetName]; LevelManager.CurrentExtendedLevel.SelectableLevel.DaytimeEnemies = OriginalEnemyAndScrapLists.OriginalDayLists[numberlessPlanetName]; LevelManager.CurrentExtendedLevel.SelectableLevel.OutsideEnemies = OriginalEnemyAndScrapLists.OriginalNoxLists[numberlessPlanetName]; CentralConfig.instance.mls.LogInfo((object)("Reverted Enemy lists for: " + numberlessPlanetName)); } if (NetworkManager.Singleton.IsHost && (SyncedEntry<bool>.op_Implicit(CentralConfig.SyncConfig.ScrapShuffle) || SyncedEntry<bool>.op_Implicit(CentralConfig.SyncConfig.DoScrapWeatherInjections) || SyncedEntry<bool>.op_Implicit(CentralConfig.SyncConfig.DoScrapTagInjections) || SyncedEntry<bool>.op_Implicit(CentralConfig.SyncConfig.DoScrapInjectionsByDungeon)) && OriginalEnemyAndScrapLists.OriginalItemLists.ContainsKey(numberlessPlanetName)) { LevelManager.CurrentExtendedLevel.SelectableLevel.spawnableScrap = OriginalEnemyAndScrapLists.OriginalItemLists[numberlessPlanetName]; CentralConfig.instance.mls.LogInfo((object)("Reverted Scrap list for: " + numberlessPlanetName)); } } } [HarmonyPatch(typeof(RoundManager), "GenerateNewFloor")] [HarmonyPriority(676)] public class FetchEnemyAndScrapLists { private static void Prefix() { string numberlessPlanetName = LevelManager.CurrentExtendedLevel.NumberlessPlanetName; if (NetworkManager.Singleton.IsHost && (SyncedEntry<bool>.op_Implicit(CentralConfig.SyncConfig.EnemyShuffle) || SyncedEntry<bool>.op_Implicit(CentralConfig.SyncConfig.DoEnemyWeatherInjections) || SyncedEntry<bool>.op_Implicit(CentralConfig.SyncConfig.DoEnemyTagInjections) || SyncedEntry<bool>.op_Implicit(CentralConfig.SyncConfig.DoEnemyInjectionsByDungeon)) && (!OriginalEnemyAndScrapLists.OriginalIntLists.ContainsKey(numberlessPlanetName) || !OriginalEnemyAndScrapLists.OriginalDayLists.ContainsKey(numberlessPlanetName) || !OriginalEnemyAndScrapLists.OriginalNoxLists.ContainsKey(numberlessPlanetName))) { OriginalEnemyAndScrapLists.OriginalIntLists[numberlessPlanetName] = new List<SpawnableEnemyWithRarity>(LevelManager.CurrentExtendedLevel.SelectableLevel.Enemies); OriginalEnemyAndScrapLists.OriginalDayLists[numberlessPlanetName] = new List<SpawnableEnemyWithRarity>(LevelManager.CurrentExtendedLevel.SelectableLevel.DaytimeEnemies); OriginalEnemyAndScrapLists.OriginalNoxLists[numberlessPlanetName] = new List<SpawnableEnemyWithRarity>(LevelManager.CurrentExtendedLevel.SelectableLevel.OutsideEnemies); CentralConfig.instance.mls.LogInfo((object)("Saved Enemy lists for: " + numberlessPlanetName)); } if (NetworkManager.Singleton.IsHost && (SyncedEntry<bool>.op_Implicit(CentralConfig.SyncConfig.ScrapShuffle) || SyncedEntry<bool>.op_Implicit(CentralConfig.SyncConfig.DoScrapWeatherInjections) || SyncedEntry<bool>.op_Implicit(CentralConfig.SyncConfig.DoScrapTagInjections) || SyncedEntry<bool>.op_Implicit(CentralConfig.SyncConfig.DoScrapInjectionsByDungeon)) && !OriginalEnemyAndScrapLists.OriginalItemLists.ContainsKey(numberlessPlanetName)) { OriginalEnemyAndScrapLists.OriginalItemLists[numberlessPlanetName] = new List<SpawnableItemWithRarity>(LevelManager.CurrentExtendedLevel.SelectableLevel.spawnableScrap); CentralConfig.instance.mls.LogInfo((object)("Saved Scrap list for: " + numberlessPlanetName)); } } } public static class OriginalEnemyAndScrapLists { public static Dictionary<string, List<SpawnableEnemyWithRarity>> OriginalIntLists = new Dictionary<string, List<SpawnableEnemyWithRarity>>(); public static Dictionary<string, List<SpawnableEnemyWithRarity>> OriginalDayLists = new Dictionary<string, List<SpawnableEnemyWithRarity>>(); public static Dictionary<string, List<SpawnableEnemyWithRarity>> OriginalNoxLists = new Dictionary<string, List<SpawnableEnemyWithRarity>>(); public static Dictionary<string, List<SpawnableItemWithRarity>> OriginalItemLists = new Dictionary<string, List<SpawnableItemWithRarity>>(); } [HarmonyPatch(typeof(HangarShipDoor), "Start")] public class WaitForDungeonsToRegister { [DataContract] public class CreateDungeonConfig : ConfigTemplate { [DataMember] public static Dictionary<ExtendedDungeonFlow, SyncedEntry<float>> MinDungeonSize; [DataMember] public static Dictionary<ExtendedDungeonFlow, SyncedEntry<float>> MaxDungeonSize; [DataMember] public static Dictionary<ExtendedDungeonFlow, SyncedEntry<float>> DungeonSizeScaler; [DataMember] public static Dictionary<ExtendedDungeonFlow, SyncedEntry<float>> MapTileSize; [DataMember] public static Dictionary<ExtendedDungeonFlow, SyncedEntry<int>> RandomSizeMin; [DataMember] public static Dictionary<ExtendedDungeonFlow, SyncedEntry<int>> RandomSizeMax; [DataMember] public static Dictionary<ExtendedDungeonFlow, SyncedEntry<string>> DungeonPlanetNameList; [DataMember] public static Dictionary<ExtendedDungeonFlow, SyncedEntry<string>> DungeonTagList; [DataMember] public static Dictionary<ExtendedDungeonFlow, SyncedEntry<string>> DungeonRoutePriceList; [DataMember] public static Dictionary<ExtendedDungeonFlow, SyncedEntry<string>> DungeonModNameList; [DataMember] public static Dictionary<ExtendedDungeonFlow, SyncedEntry<string>> InteriorEnemyByDungeon; [DataMember] public static Dictionary<ExtendedDungeonFlow, List<SpawnableEnemyWithRarity>> InteriorEnemiesD; [DataMember] public static Dictionary<ExtendedDungeonFlow, SyncedEntry<string>> InteriorEnemyReplacementD; [DataMember] public static Dictionary<ExtendedDungeonFlow, SyncedEntry<string>> InteriorEnemyMultiplierD; [DataMember] public static Dictionary<ExtendedDungeonFlow, SyncedEntry<string>> DayTimeEnemyByDungeon; [DataMember] public static Dictionary<ExtendedDungeonFlow, List<SpawnableEnemyWithRarity>> DayEnemiesD; [DataMember] public static Dictionary<ExtendedDungeonFlow, SyncedEntry<string>> DayEnemyReplacementD; [DataMember] public static Dictionary<ExtendedDungeonFlow, SyncedEntry<string>> DayEnemyMultiplierD; [DataMember] public static Dictionary<ExtendedDungeonFlow, SyncedEntry<string>> NightTimeEnemyByDungeon; [DataMember] public static Dictionary<ExtendedDungeonFlow, List<SpawnableEnemyWithRarity>> NightEnemiesD; [DataMember] public static Dictionary<ExtendedDungeonFlow, SyncedEntry<string>> NightEnemyReplacementD; [DataMember] public static Dictionary<ExtendedDungeonFlow, SyncedEntry<string>> NightEnemyMultiplierD; [DataMember] public static Dictionary<ExtendedDungeonFlow, SyncedEntry<string>> ScrapByDungeon; [DataMember] public static Dictionary<ExtendedDungeonFlow, List<SpawnableItemWithRarity>> ScrapD; public CreateDungeonConfig(ConfigFile cfg) : base(cfg, "CentralConfig", 0) { //IL_026d: Unknown result type (might be due to invalid IL or missing references) //IL_0295: Unknown result type (might be due to invalid IL or missing references) //IL_02a4: Unknown result type (might be due to invalid IL or missing references) //IL_02cc: Unknown result type (might be due to invalid IL or missing references) MinDungeonSize = new Dictionary<ExtendedDungeonFlow, SyncedEntry<float>>(); MaxDungeonSize = new Dictionary<ExtendedDungeonFlow, SyncedEntry<float>>(); DungeonSizeScaler = new Dictionary<ExtendedDungeonFlow, SyncedEntry<float>>(); MapTileSize = new Dictionary<ExtendedDungeonFlow, SyncedEntry<float>>(); RandomSizeMin = new Dictionary<ExtendedDungeonFlow, SyncedEntry<int>>(); RandomSizeMax = new Dictionary<ExtendedDungeonFlow, SyncedEntry<int>>(); DungeonPlanetNameList = new Dictionary<ExtendedDungeonFlow, SyncedEntry<string>>(); DungeonTagList = new Dictionary<ExtendedDungeonFlow, SyncedEntry<string>>(); DungeonRoutePriceList = new Dictionary<ExtendedDungeonFlow, SyncedEntry<string>>(); DungeonModNameList = new Dictionary<ExtendedDungeonFlow, SyncedEntry<string>>(); InteriorEnemyByDungeon = new Dictionary<ExtendedDungeonFlow, SyncedEntry<string>>(); InteriorEnemiesD = new Dictionary<ExtendedDungeonFlow, List<SpawnableEnemyWithRarity>>(); InteriorEnemyReplacementD = new Dictionary<ExtendedDungeonFlow, SyncedEntry<string>>(); InteriorEnemyMultiplierD = new Dictionary<ExtendedDungeonFlow, SyncedEntry<string>>(); DayTimeEnemyByDungeon = new Dictionary<ExtendedDungeonFlow, SyncedEntry<string>>(); DayEnemiesD = new Dictionary<ExtendedDungeonFlow, List<SpawnableEnemyWithRarity>>(); DayEnemyReplacementD = new Dictionary<ExtendedDungeonFlow, SyncedEntry<string>>(); DayEnemyMultiplierD = new Dictionary<ExtendedDungeonFlow, SyncedEntry<string>>(); NightTimeEnemyByDungeon = new Dictionary<ExtendedDungeonFlow, SyncedEntry<string>>(); NightEnemiesD = new Dictionary<ExtendedDungeonFlow, List<SpawnableEnemyWithRarity>>(); NightEnemyReplacementD = new Dictionary<ExtendedDungeonFlow, SyncedEntry<string>>(); NightEnemyMultiplierD = new Dictionary<ExtendedDungeonFlow, SyncedEntry<string>>(); ScrapByDungeon = new Dictionary<ExtendedDungeonFlow, SyncedEntry<string>>(); ScrapD = new Dictionary<ExtendedDungeonFlow, List<SpawnableItemWithRarity>>(); List<string> ignoreListEntries = (from entry in ConfigAider.SplitStringsByDaComma(CentralConfig.SyncConfig.BlackListDungeons.Value) select ConfigAider.CauterizeString(entry)).ToList(); List<ExtendedDungeonFlow> list = ((!SyncedEntry<bool>.op_Implicit(CentralConfig.SyncConfig.IsDunWhiteList)) ? PatchedContent.ExtendedDungeonFlows.Where((ExtendedDungeonFlow dungeon) => !ignoreListEntries.Any((string b) => ConfigAider.CauterizeString(dungeon.DungeonName).Equals(b))).ToList() : PatchedContent.ExtendedDungeonFlows.Where((ExtendedDungeonFlow dungeon) => ignoreListEntries.Any((string b) => ConfigAider.CauterizeString(dungeon.DungeonName).Equals(b))).ToList()); foreach (ExtendedDungeonFlow item in list) { string text = item.DungeonName + " (" + ((Object)item).name + ")"; text = text.Replace("13Exits", "3Exits").Replace("1ExtraLarge", "ExtraLarge"); string text2 = text.Replace("ExtendedDungeonFlow", "").Replace("Level", ""); if (text2 == "Facility (1)") { DefaultFacility = item; CentralConfig.instance.mls.LogInfo((object)("Saved Default dungeon" + DefaultFacility.DungeonName)); } if (SyncedEntry<bool>.op_Implicit(CentralConfig.SyncConfig.DoDunSizeOverrides)) { float num = ((!(item.DynamicDungeonSizeMinMax.x <= 0f)) ? item.DynamicDungeonSizeMinMax.x : 1f); float num2 = ((!(item.DynamicDungeonSizeMinMax.y <= 0f)) ? item.DynamicDungeonSizeMinMax.y : 2f); if (text2 == "Haunted Mansion (2)") { item.MapTileSize = 1.5f; } MinDungeonSize[item] = SyncedBindingExtensions.BindSyncedEntry<float>(cfg, "Dungeon: " + text2, text2 + " - Minimum Size Multiplier", num, "Sets the min size multiplier this dungeon can have."); MaxDungeonSize[item] = SyncedBindingExtensions.BindSyncedEntry<float>(cfg, "Dungeon: " + text2, text2 + " - Maximum Size Multiplier", num2, "Sets the max size multiplier this dungeon can have."); DungeonSizeScaler[item] = SyncedBindingExtensions.BindSyncedEntry<float>(cfg, "Dungeon: " + text2, text2 + " - Dungeon Size Scaler", 100f - item.DynamicDungeonSizeLerpRate * 100f, "This setting controls the strictness of the clamp. At 0%, the clamp is inactive. At 100%, the clamp is fully enforced, pulling any out-of-bounds values back to the nearest boundary. For percentages in between, out-of-bounds values are partially pulled back towards the nearest boundary. For example given a value of 50%, a value exceeding the max would be adjusted halfway back to the max."); MapTileSize[item] = SyncedBindingExtensions.BindSyncedEntry<float>(cfg, "Dungeon: " + text2, text2 + " - Map Tile Size", item.MapTileSize, "The size multiplier from the moon is divided by this value before clamps are applied. It ensures that interiors with different '1x' tile counts and room sizes are comparable in total size.\nThe Facility is 1x and the Mansion is 1.5x in Vanilla."); RandomSizeMin[item] = SyncedBindingExtensions.BindSyncedEntry<int>(cfg, "Dungeon: " + text2, text2 + " - Random Size Multiplier Min", item.DungeonFlow.Length.Min, "The minimum random size multiplier applied to this dungeon's overall size AFTER all previous settings (inclusive)."); RandomSizeMax[item] = SyncedBindingExtensions.BindSyncedEntry<int>(cfg, "Dungeon: " + text2, text2 + " - Random Size Multiplier Max", item.DungeonFlow.Length.Max, "The maximum random size multiplier applied to this dungeon's overall size AFTER all previous settings (inclusive)."); } if (SyncedEntry<bool>.op_Implicit(CentralConfig.SyncConfig.DoDungeonSelectionOverrides)) { string text3 = ConfigAider.ConvertStringWithRarityToString(item.LevelMatchingProperties.planetNames); DungeonPlanetNameList[item] = SyncedBindingExtensions.BindSyncedEntry<string>(cfg, "Dungeon: " + text2, text2 + " - Add Dungeon by Planet Name", text3, "The dungeon will be added to any moons listed here. This must be the exact numberless name. \"Experimentatio\" =/= \"Experimentation\""); string text4 = ConfigAider.ConvertStringWithRarityToString(item.LevelMatchingProperties.levelTags); DungeonTagList[item] = SyncedBindingExtensions.BindSyncedEntry<string>(cfg, "Dungeon: " + text2, text2 + " - Add Dungeon by Planet Tags", text4, "The dungeon will be added to all moons with a matching tag"); string text5 = ConfigAider.ConvertVector2WithRaritiesToString(item.LevelMatchingProperties.currentRoutePrice); DungeonRoutePriceList[item] = SyncedBindingExtensions.BindSyncedEntry<string>(cfg, "Dungeon: " + text2, text2 + " - Add Dungeon by Route Price", text5, "This dungeon will be added to all moons that have a route price between the first two values with a rarity of the final value."); string text6 = ConfigAider.ConvertStringWithRarityToString(((MatchingProperties)item.LevelMatchingProperties).modNames); DungeonModNameList[item] = SyncedBindingExtensions.BindSyncedEntry<string>(cfg, "Dungeon: " + text2, text2 + " - Add Dungeon By Mod Name", text6, "The dungeon will be added to all moons of any mod listed here. This doesn't have to be an exact match, \"Rosie\" works for \"Rosie's Moons\"."); } if (SyncedEntry<bool>.op_Implicit(CentralConfig.SyncConfig.DoEnemyInjectionsByDungeon)) { InteriorEnemyByDungeon[item] = SyncedBindingExtensions.BindSyncedEntry<string>(cfg, "Dungeon: " + text2, text2 + " - Add Interior Enemies", "Default Values Were Empty", "Enemies listed here in the EnemyName:rarity,EnemyName:rarity format will be added to the interior enemy list on any moons currently featuring this dungeon."); InteriorEnemyReplacementD[item] = SyncedBindingExtensions.BindSyncedEntry<string>(cfg, "Dungeon: " + text2, text2 + " - Replace Interior Enemies", "Default Values Were Empty", "In the example, \"Flowerman:Plantman,Crawler:Mauler\",\nOn any moons currently featuring this dungeon, Brackens will be replaced with hypothetical Plantmen, and Crawlers with hypothetical Maulers.\nYou could also use inputs such as \"Flowerman-15:Plantman~50\", this will give the Plantman a rarity of 15 instead of using the Bracken's and it will only have a 50% chance to replace.\nThis runs before the above entry adds new enemies, and after the weather and tag adds enemies."); InteriorEnemyMultiplierD[item] = SyncedBindingExtensions.BindSyncedEntry<string>(cfg, "Dungeon: " + text2, text2 + " - Multiply Interior Enemies", "Default Values Were Empty", "Enemies listed here will be multiplied by the assigned value while this is the current dungeon. \"Maneater:1.7,Jester:0.4\" will multiply the Maneater's rarity by 1.7 and the Jester's rarity by 0.4 when this dungeon is selected."); DayTimeEnemyByDungeon[item] = SyncedBindingExtensions.BindSyncedEntry<string>(cfg, "Dungeon: " + text2, text2 + " - Add Day Enemies", "Default Values Were Empty", "Enemies listed here in the EnemyName:rarity,EnemyName:rarity format will be added to the day enemy list on any moons currently featuring this dungeon."); DayEnemyReplacementD[item] = SyncedBindingExtensions.BindSyncedEntry<string>(cfg, "Dungeon: " + text2, text2 + " - Replace Day Enemies", "Default Values Were Empty", "In the example, \"Manticoil:Mantisoil,Docile Locust Bees:Angry Moth Wasps\",\nOn any moons currently featuring this dungeon, Manticoils will be replaced with hypothetical Mantisoils, and docile locust bees with hypothetical angry moth wasps.\nYou could also use inputs such as \"Manticoil-90:Mantisoil\", this will give the Mantisoil a rarity of 90 instead of using the Manticoil's and it will still have a 100% chance to replace.\nThis runs before the above entry adds new enemies, and after the weather and tag adds enemies."); DayEnemyMultiplierD[item] = SyncedBindingExtensions.BindSyncedEntry<string>(cfg, "Dungeon: " + text2, text2 + " - Multiply Day Enemies", "Default Values Were Empty", "Enemies listed here will be multiplied by the assigned value while this is the current dungeon. \"Red Locust Bees:2.4,Docile Locust Bees:0.8\" will multiply the Bee's rarity by 2.4 and the locust's rarity by 0.8 when this dungeon is selected."); NightTimeEnemyByDungeon[item] = SyncedBindingExtensions.BindSyncedEntry<string>(cfg, "Dungeon: " + text2, text2 + " - Add Night Enemies", "Default Values Were Empty", "Enemies listed here in the EnemyName:rarity,EnemyName:rarity format will be added to the night enemy list on any moons currently featuring this dungeon."); NightEnemyReplacementD[item] = SyncedBindingExtensions.BindSyncedEntry<string>(cfg, "Dungeon: " + text2, text2 + " - Replace Night Enemies", "Default Values Were Empty", "In the example, \"MouthDog:OceanDog,ForestGiant:FireGiant\",\nOn any moons currently featuring this dungeon, Mouthdogs will be replaced with hypothetical Oceandogs, and Forest giants with hypothetical Fire giants.\nYou could also use inputs such as \"MouthDog:OceanDog~75\", the OceanDog will still inherit the rarity from the MouthDog but it will only have a 75% chance to replace.\nThis runs before the above entry adds new enemies, and after the weather and tag adds enemies."); NightEnemyMultiplierD[item] = SyncedBindingExtensions.BindSyncedEntry<string>(cfg, "Dungeon: " + text2, text2 + " - Multiply Night Enemies", "Default Values Were Empty", "Enemies listed here will be multiplied by the assigned value while this is the current dungeon. \"MouthDog:0.33,ForestGiant:1.1\" will multiply the Dog's rarity by 0.33 and the giant's rarity by 1.1 when this dungeon is selected."); } if (SyncedEntry<bool>.op_Implicit(CentralConfig.SyncConfig.DoScrapInjectionsByDungeon)) { ScrapByDungeon[item] = SyncedBindingExtensions.BindSyncedEntry<string>(cfg, "Dungeon: " + text2, text2 + " - Add Scrap", "Default Values Were Empty", "Scrap listed here in the ScrapName:rarity,ScrapName,rarity format will be added to the scrap list any moons currently featuring this dungeon"); } } if (CentralConfig.HarmonyTouch2 && NetworkManager.Singleton.IsHost && (SyncedEntry<bool>.op_Implicit(CentralConfig.SyncConfig.DoScrapInjectionsByDungeon) || SyncedEntry<bool>.op_Implicit(CentralConfig.SyncConfig.DoEnemyInjectionsByDungeon) || SyncedEntry<bool>.op_Implicit(CentralConfig.SyncConfig.DoDungeonSelectionOverrides) || SyncedEntry<bool>.op_Implicit(CentralConfig.SyncConfig.DoDunSizeOverrides))) { CentralConfig.instance.mls.LogInfo((object)"Dungeon config has been registered."); } CentralConfig.HarmonyTouch2 = true; } } public static CreateDungeonConfig Config; public static ExtendedDungeonFlow DefaultFacility; private static void Prefix() { CentralConfig.ConfigFile2 = new CreateDungeonConfig(((BaseUnityPlugin)CentralConfig.instance).Config); } } public class ApplyDungeonConfig { public static bool Ready; public void UpdateDungeonValues() { //IL_0130: Unknown result type (might be due to invalid IL or missing references) //IL_0135: Unknown result type (might be due to invalid IL or missing references) //IL_0169: Unknown result type (might be due to invalid IL or missing references) //IL_0265: Unknown result type (might be due to invalid IL or missing references) //IL_02b4: Unknown result type (might be due to invalid IL or missing references) //IL_0303: Unknown result type (might be due to invalid IL or missing references) //IL_0352: Unknown result type (might be due to invalid IL or missing references) //IL_03e0: Unknown result type (might be due to invalid IL or missing references) //IL_041e: Unknown result type (might be due to invalid IL or missing references) //IL_045c: Unknown result type (might be due to invalid IL or missing references) //IL_04d4: Unknown result type (might be due to invalid IL or missing references) List<string> ignoreListEntries = (from entry in ConfigAider.SplitStringsByDaComma(CentralConfig.SyncConfig.BlackListDungeons.Value) select ConfigAider.CauterizeString(entry)).ToList(); List<ExtendedDungeonFlow> list = ((!SyncedEntry<bool>.op_Implicit(CentralConfig.SyncConfig.IsDunWhiteList)) ? PatchedContent.ExtendedDungeonFlows.Where((ExtendedDungeonFlow dungeon) => !ignoreListEntries.Any((string b) => ConfigAider.CauterizeString(dungeon.DungeonName).Equals(b))).ToList() : PatchedContent.ExtendedDungeonFlows.Where((ExtendedDungeonFlow dungeon) => ignoreListEntries.Any((string b) => ConfigAider.CauterizeString(dungeon.DungeonName).Equals(b))).ToList()); Vector2 clampRarity = default(Vector2); Vector2 clampRarity2 = default(Vector2); Vector2 clampRarity3 = default(Vector2); Vector2 clampRarity4 = default(Vector2); Vector2 clampRarity5 = default(Vector2); Vector2 clampRarity6 = default(Vector2); Vector2 clampRarity7 = default(Vector2); Vector2 clampRarity8 = default(Vector2); foreach (ExtendedDungeonFlow item in list) { string text = item.DungeonName + " (" + ((Object)item).name + ")"; text = text.Replace("13Exits", "3Exits").Replace("1ExtraLarge", "ExtraLarge"); string text2 = text.Replace("ExtendedDungeonFlow", "").Replace("Level", ""); if (SyncedEntry<bool>.op_Implicit(CentralConfig.SyncConfig.DoDunSizeOverrides)) { Vector2 dynamicDungeonSizeMinMax = item.DynamicDungeonSizeMinMax; dynamicDungeonSizeMinMax.x = SyncedEntry<float>.op_Implicit(WaitForDungeonsToRegister.CreateDungeonConfig.MinDungeonSize[item]); dynamicDungeonSizeMinMax.y = SyncedEntry<float>.op_Implicit(WaitForDungeonsToRegister.CreateDungeonConfig.MaxDungeonSize[item]); item.DynamicDungeonSizeMinMax = dynamicDungeonSizeMinMax; item.DynamicDungeonSizeLerpRate = SyncedEntry<float>.op_Implicit(WaitForDungeonsToRegister.CreateDungeonConfig.DungeonSizeScaler[item]); item.DungeonFlow.Length.Min = SyncedEntry<int>.op_Implicit(WaitForDungeonsToRegister.CreateDungeonConfig.RandomSizeMin[item]); item.DungeonFlow.Length.Max = SyncedEntry<int>.op_Implicit(WaitForDungeonsToRegister.CreateDungeonConfig.RandomSizeMax[item]); } if (SyncedEntry<bool>.op_Implicit(CentralConfig.SyncConfig.DoDungeonSelectionOverrides) && NetworkManager.Singleton.IsHost) { item.LevelMatchingProperties.planetNames.Clear(); item.LevelMatchingProperties.levelTags.Clear(); ((MatchingProperties)item.LevelMatchingProperties).modNames.Clear(); item.LevelMatchingProperties.currentRoutePrice.Clear(); string newInputString = SyncedEntry<string>.op_Implicit(WaitForDungeonsToRegister.CreateDungeonConfig.DungeonPlanetNameList[item]); ((Vector2)(ref clampRarity))..ctor(-99999f, 99999f); List<StringWithRarity> list2 = ConfigAider.ConvertPlanetNameStringToStringWithRarityList(newInputString, clampRarity); if (list2.Count > 0) { item.LevelMatchingProperties.planetNames = list2; } string newInputString2 = SyncedEntry<string>.op_Implicit(WaitForDungeonsToRegister.CreateDungeonConfig.DungeonTagList[item]); ((Vector2)(ref clampRarity2))..ctor(-99999f, 99999f); List<StringWithRarity> list3 = ConfigAider.ConvertTagStringToStringWithRarityList(newInputString2, clampRarity2); if (list3.Count > 0) { item.LevelMatchingProperties.levelTags = list3; } string newInputString3 = SyncedEntry<string>.op_Implicit(WaitForDungeonsToRegister.CreateDungeonConfig.DungeonModNameList[item]); ((Vector2)(ref clampRarity3))..ctor(-99999f, 99999f); List<StringWithRarity> list4 = ConfigAider.ConvertModStringToStringWithRarityList(newInputString3, clampRarity3); if (list4.Count > 0) { ((MatchingProperties)item.LevelMatchingProperties).modNames = list4; } string newInputString4 = SyncedEntry<string>.op_Implicit(WaitForDungeonsToRegister.CreateDungeonConfig.DungeonRoutePriceList[item]); ((Vector2)(ref clampRarity4))..ctor(-99999f, 99999f); List<Vector2WithRarity> list5 = ConfigAider.ConvertStringToVector2WithRarityList(newInputString4, clampRarity4); if (list5.Count > 0) { item.LevelMatchingProperties.currentRoutePrice = list5; } } if (SyncedEntry<bool>.op_Implicit(CentralConfig.SyncConfig.DoEnemyInjectionsByDungeon) && NetworkManager.Singleton.IsHost && WaitForDungeonsToRegister.CreateDungeonConfig.InteriorEnemyByDungeon.ContainsKey(item)) { string newInputString5 = SyncedEntry<string>.op_Implicit(WaitForDungeonsToRegister.CreateDungeonConfig.InteriorEnemyByDungeon[item]); ((Vector2)(ref clampRarity5))..ctor(-99999f, 99999f); List<SpawnableEnemyWithRarity> value = ConfigAider.ConvertStringToEnemyList(newInputString5, clampRarity5); WaitForDungeonsToRegister.CreateDungeonConfig.InteriorEnemiesD[item] = value; string newInputString6 = SyncedEntry<string>.op_Implicit(WaitForDungeonsToRegister.CreateDungeonConfig.DayTimeEnemyByDungeon[item]); ((Vector2)(ref clampRarity6))..ctor(-99999f, 99999f); List<SpawnableEnemyWithRarity> value2 = ConfigAider.ConvertStringToEnemyList(newInputString6, clampRarity6); WaitForDungeonsToRegister.CreateDungeonConfig.DayEnemiesD[item] = value2; string newInputString7 = SyncedEntry<string>.op_Implicit(WaitForDungeonsToRegister.CreateDungeonConfig.NightTimeEnemyByDungeon[item]); ((Vector2)(ref clampRarity7))..ctor(-99999f, 99999f); List<SpawnableEnemyWithRarity> value3 = ConfigAider.ConvertStringToEnemyList(newInputString7, clampRarity7); WaitForDungeonsToRegister.CreateDungeonConfig.NightEnemiesD[item] = value3; } if (SyncedEntry<bool>.op_Implicit(CentralConfig.SyncConfig.DoScrapInjectionsByDungeon) && NetworkManager.Singleton.IsHost && WaitForDungeonsToRegister.CreateDungeonConfig.ScrapByDungeon.ContainsKey(item)) { string newInputString8 = SyncedEntry<string>.op_Implicit(WaitForDungeonsToRegister.CreateDungeonConfig.ScrapByDungeon[item]); ((Vector2)(ref clampRarity8))..ctor(-99999f, 99999f); List<SpawnableItemWithRarity> value4 = ConfigAider.ConvertStringToItemList(newInputString8, clampRarity8); WaitForDungeonsToRegister.CreateDungeonConfig.ScrapD[item] = value4; } } if (NetworkManager.Singleton.IsHost && (SyncedEntry<bool>.op_Implicit(CentralConfig.SyncConfig.DoScrapInjectionsByDungeon) || SyncedEntry<bool>.op_Implicit(CentralConfig.SyncConfig.DoEnemyInjectionsByDungeon) || SyncedEntry<bool>.op_Implicit(CentralConfig.SyncConfig.DoDungeonSelectionOverrides) || SyncedEntry<bool>.op_Implicit(CentralConfig.SyncConfig.DoDunSizeOverrides))) { CentralConfig.instance.mls.LogInfo((object)"Dungeon config Values Applied."); } if (SyncedEntry<bool>.op_Implicit(CentralConfig.SyncConfig.DungeonShuffler) && NetworkManager.Singleton.IsHost) { int num; if (ES3.KeyExists("LastGlorp", GameNetworkManager.Instance.currentSaveFileName)) { num = ES3.Load<int>("LastGlorp", GameNetworkManager.Instance.currentSaveFileName); ShuffleSaver.dungeonrandom = new Random(num); } else { num = StartOfRound.Instance.randomMapSeed; ShuffleSaver.dungeonrandom = new Random(StartOfRound.Instance.randomMapSeed); } foreach (ExtendedDungeonFlow extendedDungeonFlow in PatchedContent.ExtendedDungeonFlows) { ResetChanger.ResetOnDisconnect.AllDungeons.Add(extendedDungeonFlow); ShuffleSaver.DungeonMoonMatches[extendedDungeonFlow] = extendedDungeonFlow.LevelMatchingProperties.planetNames; ShuffleSaver.DungeonModMatches[extendedDungeonFlow] = ((MatchingProperties)extendedDungeonFlow.LevelMatchingProperties).modNames; ShuffleSaver.DungeonTagMatches[extendedDungeonFlow] = extendedDungeonFlow.LevelMatchingProperties.levelTags; ShuffleSaver.DungeonRouteMatches[extendedDungeonFlow] = extendedDungeonFlow.LevelMatchingProperties.currentRoutePrice; string text3 = extendedDungeonFlow.DungeonName + " (" + ((Object)extendedDungeonFlow).name + ")"; text3 = text3.Replace("13Exits", "3Exits").Replace("1ExtraLarge", "ExtraLarge"); string flowName = text3.Replace("ExtendedDungeonFlow", "").Replace("Level", ""); extendedDungeonFlow.LevelMatchingProperties.planetNames = ConfigAider.IncreaseDungeonRarities(extendedDungeonFlow.LevelMatchingProperties.planetNames, extendedDungeonFlow, flowName); ((MatchingProperties)extendedDungeonFlow.LevelMatchingProperties).modNames = ConfigAider.IncreaseDungeonRarities(((MatchingProperties)extendedDungeonFlow.LevelMatchingProperties).modNames, extendedDungeonFlow, flowName); extendedDungeonFlow.LevelMatchingProperties.levelTags = ConfigAider.IncreaseDungeonRarities(extendedDungeonFlow.LevelMatchingProperties.levelTags, extendedDungeonFlow, flowName); extendedDungeonFlow.LevelMatchingProperties.currentRoutePrice = ConfigAider.IncreaseDungeonRaritiesVector2(extendedDungeonFlow.LevelMatchingProperties.currentRoutePrice, extendedDungeonFlow, flowName); } ShuffleSaver.LastGlorp = num; } Ready = true; } } [HarmonyPatch(typeof(HangarShipDoor), "Start")] public class FrApplyDungeon { private static void Postfix() { ApplyDungeonConfig applyDungeonConfig = new ApplyDungeonConfig(); applyDungeonConfig.UpdateDungeonValues(); } } [HarmonyPatch(typeof(RoundManager), "GenerateNewFloor")] public static class NewDungeonGenerator { private static float PreClampValue; private static bool Prefix(RoundManager __instance) { if (LevelManager.CurrentExtendedLevel.SelectableLevel.dungeonFlowTypes != null && LevelManager.CurrentExtendedLevel.SelectableLevel.dungeonFlowTypes.Length != 0) { List<int> list = new List<int>(); for (int i = 0; i < LevelManager.CurrentExtendedLevel.SelectableLevel.dungeonFlowTypes.Length; i++) { list.Add(LevelManager.CurrentExtendedLevel.SelectableLevel.dungeonFlowTypes[i].rarity); } Random random = new Random(StartOfRound.Instance.randomMapSeed - 69); int randomWeightedIndex = __instance.GetRandomWeightedIndex(list.ToArray(), random); __instance.dungeonGenerator.Generator.DungeonFlow = __instance.dungeonFlowTypes[LevelManager.CurrentExtendedLevel.SelectableLevel.dungeonFlowTypes[randomWeightedIndex].id].dungeonFlow; __instance.currentDungeonType = LevelManager.CurrentExtendedLevel.SelectableLevel.dungeonFlowTypes[randomWeightedIndex].id; if ((Object)(object)LevelManager.CurrentExtendedLevel.SelectableLevel.dungeonFlowTypes[randomWeightedIndex].overrideLevelAmbience != (Object)null) { SoundManager.Instance.currentLevelAmbience = LevelManager.CurrentExtendedLevel.SelectableLevel.dungeonFlowTypes[randomWeightedIndex].overrideLevelAmbience; } else if ((Object)(object)LevelManager.CurrentExtendedLevel.SelectableLevel.levelAmbienceClips != (Object)null) { SoundManager.Instance.currentLevelAmbience = LevelManager.CurrentExtendedLevel.SelectableLevel.levelAmbienceClips; } } ExtendedDungeonFlow currentExtendedDungeonFlow = DungeonManager.CurrentExtendedDungeonFlow; string text = currentExtendedDungeonFlow.DungeonName + " (" + ((Object)currentExtendedDungeonFlow).name + ")"; text = text.Replace("13Exits", "3Exits").Replace("1ExtraLarge", "ExtraLarge"); string text2 = text.Replace("ExtendedDungeonFlow", "").Replace("Level", ""); if (NetworkManager.Singleton.IsHost) { CentralConfig.instance.mls.LogInfo((object)("Dungeon Selected: " + text2)); } if (SyncedEntry<bool>.op_Implicit(CentralConfig.SyncConfig.DungeonShuffler) && NetworkManager.Singleton.IsHost) { DungeonShuffler.lastpossibledungeons = DungeonManager.GetValidExtendedDungeonFlows(LevelManager.CurrentExtendedLevel, false); DungeonShuffler.lastdungeon = currentExtendedDungeonFlow; } __instance.dungeonGenerator.Generator.ShouldRandomizeSeed = false; __instance.dungeonGenerator.Generator.Seed = StartOfRound.Instance.randomMapSeed + 420; float factorySizeMultiplier = LevelManager.CurrentExtendedLevel.SelectableLevel.factorySizeMultiplier; if (SyncedEntry<bool>.op_Implicit(CentralConfig.SyncConfig.DoDunSizeOverrides)) { if (WaitForDungeonsToRegister.CreateDungeonConfig.MapTileSize.ContainsKey(DungeonManager.CurrentExtendedDungeonFlow)) { factorySizeMultiplier /= SyncedEntry<float>.op_Implicit(WaitForDungeonsToRegister.CreateDungeonConfig.MapTileSize[DungeonManager.CurrentExtendedDungeonFlow]); factorySizeMultiplier *= __instance.mapSizeMultiplier; factorySizeMultiplier = (PreClampValue = (float)((double)Mathf.Round(factorySizeMultiplier * 100f) / 100.0)); if (factorySizeMultiplier < SyncedEntry<float>.op_Implicit(WaitForDungeonsToRegister.CreateDungeonConfig.MinDungeonSize[DungeonManager.CurrentExtendedDungeonFlow])) { factorySizeMultiplier = Mathf.Lerp(factorySizeMultiplier, SyncedEntry<float>.op_Implicit(WaitForDungeonsToRegister.CreateDungeonConfig.MinDungeonSize[DungeonManager.CurrentExtendedDungeonFlow]), SyncedEntry<float>.op_Implicit(WaitForDungeonsToRegister.CreateDungeonConfig.DungeonSizeScaler[DungeonManager.CurrentExtendedDungeonFlow]) / 100f); } else if (factorySizeMultiplier > SyncedEntry<float>.op_Implicit(WaitForDungeonsToRegister.CreateDungeonConfig.MaxDungeonSize[DungeonManager.CurrentExtendedDungeonFlow])) { factorySizeMultiplier = Mathf.Lerp(factorySizeMultiplier, SyncedEntry<float>.op_Implicit(WaitForDungeonsToRegister.CreateDungeonConfig.MaxDungeonSize[DungeonManager.CurrentExtendedDungeonFlow]), SyncedEntry<float>.op_Implicit(WaitForDungeonsToRegister.CreateDungeonConfig.DungeonSizeScaler[DungeonManager.CurrentExtendedDungeonFlow]) / 100f); } factorySizeMultiplier = (float)((double)Mathf.Round(factorySizeMultiplier * 100f) / 100.0); if (PreClampValue != factorySizeMultiplier) { if (NetworkManager.Singleton.IsHost) { CentralConfig.instance.mls.LogInfo((object)("Clamps for the dungeon have been applied. Original value: " + PreClampValue + " New value: " + factorySizeMultiplier)); } } else if (NetworkManager.Singleton.IsHost) { CentralConfig.instance.mls.LogInfo((object)("The size was within the clamp range. The size value is: " + factorySizeMultiplier)); } } else { factorySizeMultiplier /= DungeonManager.CurrentExtendedDungeonFlow.MapTileSize; factorySizeMultiplier *= __instance.mapSizeMultiplier; factorySizeMultiplier = (float)((double)Mathf.Round(factorySizeMultiplier * 100f) / 100.0); if (NetworkManager.Singleton.IsHost) { CentralConfig.instance.mls.LogInfo((object)("The current dungeon is blacklisted. No clamping will be applied. The size value is: " + factorySizeMultiplier)); } } } else { factorySizeMultiplier /= DungeonManager.CurrentExtendedDungeonFlow.MapTileSize; factorySizeMultiplier *= __instance.mapSizeMultiplier; factorySizeMultiplier = (float)((double)Mathf.Round(factorySizeMultiplier * 100f) / 100.0); if (NetworkManager.Singleton.IsHost) { CentralConfig.instance.mls.LogInfo((object)("Size overrides are false. The size value is: " + factorySizeMultiplier)); } } if (factorySizeMultiplier < 0f) { factorySizeMultiplier = 1f; if (NetworkManager.Singleton.IsHost) { CentralConfig.instance.mls.LogInfo((object)"Dungeon size is in the negatives, go fix your size settings. It is now 1x"); } } __instance.dungeonGenerator.Generator.LengthMultiplier = factorySizeMultiplier; if (!SyncedEntry<bool>.op_Implicit(CentralConfig.SyncConfig.UseNewGen)) { if (NetworkManager.Singleton.IsHost) { CentralConfig.instance.mls.LogInfo((object)"Generation safeguards are disabled, generating without them:"); } __instance.dungeonGenerator.Generate(); return false; } if (text2 == "Black Mesa (Black Mesa)") { __instance.dungeonGenerator.Generator.GenerateAsynchronously = false; } else if (LoadstoneCompatibility.enabled) { if (LoadstoneCompatibility.IsLoadStoneAsyncing()) { __instance.dungeonGenerator.Generator.GenerateAsynchronously = true; } } else if (LoadstoneNCompatibility.enabled && LoadstoneNCompatibility.IsLoadStoneNAsyncing()) { __instance.dungeonGenerator.Generator.GenerateAsynchronously = true; } try { __instance.dungeonGenerator.Generate(); } catch (Exception ex) { if (ex.Message == "Dungeon Generation failed.") { if (NetworkManager.Singleton.IsHost) { CentralConfig.instance.mls.LogInfo((object)"Dungeon Generation has failed. Defaulting interior"); } __instance.dungeonGenerator.Generator.DungeonFlow = WaitForDungeonsToRegister.DefaultFacility.DungeonFlow; __instance.currentDungeonType = 0; float num = ((!(LevelManager.CurrentExtendedLevel.SelectableLevel.factorySizeMultiplier >= 1f)) ? 1f : LevelManager.CurrentExtendedLevel.SelectableLevel.factorySizeMultiplier); __instance.dungeonGenerator.Generator.LengthMultiplier = Mathf.Clamp(num, 1f, 2.2f); if ((Object)(object)LevelManager.CurrentExtendedLevel.SelectableLevel.dungeonFlowTypes[0].overrideLevelAmbience != (Object)null) { SoundManager.Instance.currentLevelAmbience = LevelManager.CurrentExtendedLevel.SelectableLevel.dungeonFlowTypes[0].overrideLevelAmbience; } else if ((Object)(object)LevelManager.CurrentExtendedLevel.SelectableLevel.levelAmbienceClips != (Object)null) { SoundManager.Instance.currentLevelAmbience = LevelManager.CurrentExtendedLevel.SelectableLevel.levelAmbienceClips; } __instance.dungeonGenerator.Generator.ShouldRandomizeSeed = false; __instance.dungeonGenerator.Generator.Seed = StartOfRound.Instance.randomMapSeed - 420; if (NetworkManager.Singleton.IsHost) { CentralConfig.instance.mls.LogInfo((object)DungeonManager.CurrentExten