/* using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using LethalLevelLoader; using UnityEngine; namespace ScarletMansion { public class ExtendedDungeonMapLoad { public static List GetCustomMoons(string value, int rarity){ var list = new List(); var config = value.ToLowerInvariant(); if (config == "all") { list.Add(new DynamicLevelTags("Vanilla", rarity)); list.Add(new DynamicLevelTags("Custom", rarity)); Plugin.logger.LogInfo("Loading SDM for all moons"); } else if (config == "vanilla") { list.Add(new DynamicLevelTags("Vanilla", rarity)); Plugin.logger.LogInfo("Loading SDM for all vanilla moons"); } else if (config == "modded") { list.Add(new DynamicLevelTags("Custom", rarity)); Plugin.logger.LogInfo("Loading SDM for all modded moons"); } else if (config == "paid") { list.Add(new DynamicRoutePrices(new Vector2(1, 9999), rarity)); Plugin.logger.LogInfo("Loading SDM for all paid moons"); } else if (config == "free") { list.Add(new DynamicRoutePrices(new Vector2(0, 9999), rarity)); Plugin.logger.LogInfo("Loading SDM for all free moons"); } else { Plugin.logger.LogInfo("Loading SDM with predefined moon list"); var moonEntries = config.Split(new[] { ',' }, StringSplitOptions.RemoveEmptyEntries); foreach(var entry in moonEntries){ var moonValues = entry.Split(new[] { '@' }, StringSplitOptions.RemoveEmptyEntries); var len = moonValues.Length; if (len > 2){ Plugin.logger.LogError($"Invalid setup for moon rarity config: {entry}. Skipping"); continue; } if (len == 1){ Plugin.logger.LogInfo($"Loading SDM for moon {entry} at default rarity of {rarity}"); list.Add(new ManualPlanetNameReference(entry, rarity)); } else { var moon = moonValues[0]; var moonRarity = moonValues[1]; if (int.TryParse(moonRarity, out var moonRarityValue)){ Plugin.logger.LogInfo($"Loading SDM for moon {moon} at rarity of {moonRarityValue}"); list.Add(new ManualPlanetNameReference(moon, moonRarityValue)); continue; } Plugin.logger.LogError($"Failed to parse rarity value for moon {moon} rarity {moonRarity}. Skipping"); } } } return list; } public static void ClearLastCustomMoonEntryList(){ Plugin.logger.LogInfo("Clearing previous custom dungeon load"); var dun = Assets.dungeonExtended; var lastList = Assets.customMoonEntryList; if (lastList != null) { foreach(var item in lastList){ item.Remove(dun); } } Assets.rendEntry.Remove(dun); Assets.dineEntry.Remove(dun); Assets.titanEntry.Remove(dun); Assets.customMoonEntryList = null; } public static void AddToExtendedDungeonFlow(List list){ var dun = Assets.dungeonExtended; foreach(var item in list){ item.Add(dun); } Assets.customMoonEntryList = list; } public abstract class CustomMoonEntry { public virtual void Add(ExtendedDungeonFlow flow) { Plugin.logger.LogInfo($"Added {ToString()}"); } public virtual void Remove(ExtendedDungeonFlow flow) { Plugin.logger.LogInfo($"Removed {ToString()}"); } public abstract void SetRarity(int rarity); } public class ManualContentSourceNameReference : CustomMoonEntry { public StringWithRarity value; public ManualContentSourceNameReference(string title, int rarity){ value = new StringWithRarity(title, rarity); } public override void Add(ExtendedDungeonFlow flow){ base.Add(flow); flow.manualContentSourceNameReferenceList.Add(value); } public override void Remove(ExtendedDungeonFlow flow){ if (flow.manualContentSourceNameReferenceList.Remove(value)) base.Remove(flow); else Plugin.logger.LogInfo($"Tried to remove {ToString()} but it's already gone"); } public override void SetRarity(int rarity) { value.Rarity = rarity; } public override string ToString() { return $"ManualContentSourceNameReference: ({value.Name}, {value.Rarity})"; } } public class DynamicLevelTags : CustomMoonEntry { public StringWithRarity value; public DynamicLevelTags(string title, int rarity){ value = new StringWithRarity(title, rarity); } public override void Add(ExtendedDungeonFlow flow){ base.Add(flow); flow.dynamicLevelTagsList.Add(value); } public override void Remove(ExtendedDungeonFlow flow){ if (flow.dynamicLevelTagsList.Remove(value)) base.Remove(flow); else Plugin.logger.LogInfo($"Tried to remove {ToString()} but it's already gone"); } public override void SetRarity(int rarity) { value.Rarity = rarity; } public override string ToString() { return $"DynamicLevelTags: ({value.Name}, {value.Rarity})"; } } public class ManualPlanetNameReference : CustomMoonEntry { public StringWithRarity value; public ManualPlanetNameReference(string title, int rarity){ value = new StringWithRarity(title, rarity); } public override void Add(ExtendedDungeonFlow flow){ base.Add(flow); flow.manualPlanetNameReferenceList.Add(value); } public override void Remove(ExtendedDungeonFlow flow){ if (flow.manualPlanetNameReferenceList.Remove(value)) base.Remove(flow); else Plugin.logger.LogInfo($"Tried to remove {ToString()} but it's already gone"); } public override void SetRarity(int rarity) { value.Rarity = rarity; } public override string ToString() { return $"ManualPlanetNameReference: ({value.Name}, {value.Rarity})"; } } public class DynamicRoutePrices : CustomMoonEntry { public Vector2WithRarity value; public DynamicRoutePrices(Vector2 price, int rarity){ value = new Vector2WithRarity(price, rarity); } public override void Add(ExtendedDungeonFlow flow){ base.Add(flow); flow.dynamicRoutePricesList.Add(value); } public override void Remove(ExtendedDungeonFlow flow){ if (flow.dynamicRoutePricesList.Remove(value)) base.Remove(flow); else Plugin.logger.LogInfo($"Tried to remove {ToString()} but it's already gone"); } public override void SetRarity(int rarity) { value.Rarity = rarity; } public override string ToString() { return $"DynamicRoutePrices: ([{value.Min}, {value.Max}], {value.Rarity})"; } } } } */