Decompiled source of DSPAddPlanet moooooon patch v3.0.15
DSPAddPlanet.dll
Decompiled a day ago
The result has been truncated due to the large size, download it to view full contents!
using System; using System.Collections.Generic; using System.Diagnostics; using System.IO; using System.Linq; using System.Reflection; using System.Reflection.Emit; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; using System.Runtime.Versioning; using System.Security; using System.Text; using System.Xml; using BepInEx; using BepInEx.Logging; using DSPAddPlanet.Extensions; using HarmonyLib; using UnityEngine; using UnityEngine.Events; using UnityEngine.Rendering; using UnityEngine.UI; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: AssemblyTitle("DSPAddPlanet-moon^2-patch")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("Zincon")] [assembly: AssemblyProduct("DSPAddPlanet-moon^2-patch")] [assembly: AssemblyCopyright("Copyright © Zincon 2026")] [assembly: AssemblyTrademark("")] [assembly: ComVisible(false)] [assembly: Guid("67157a1a-8f83-4b4b-a8b1-a279edb9947d")] [assembly: AssemblyFileVersion("3.0.15.0")] [assembly: TargetFramework(".NETFramework,Version=v4.6", FrameworkDisplayName = "")] [assembly: AssemblyVersion("3.0.15.0")] namespace DSPAddPlanet { internal struct AdditionalPlanetConfig { public struct VeinConfig { public struct CustomValue { public enum CustomType { Default, Random, Accurate } public CustomType Type; public int AccurateValue; public int RandomBaseValue; public float RandomCoef; public float RandomMulOffset; public int RandomAddOffset; public int GetRandomResult(DotNet35Random random) { float num = (float)RandomBaseValue * RandomCoef; float num2 = num * RandomMulOffset; float num3 = num - num2; if (num3 < 0f) { num3 = 0f; } float num4 = num + num2; int num5 = random.Next((int)num3, (int)num4); int num6 = num5 - RandomAddOffset; if (num6 < 0) { num6 = 0; } int num7 = num5 + RandomAddOffset; return random.Next(num6, num7); } } public CustomValue VeinGroupCount; public CustomValue VeinSpotCount; public CustomValue VeinAmount; public const int DEFAULT_VEIN_GROUP_COUNT_RANDOM_BASE_VALUE = 8; public const float DEFAULT_VEIN_GROUP_COUNT_RANDOM_COEF = 1f; public const float DEFAULT_VEIN_GROUP_COUNT_RANDOM_MUL_OFFSET = 0f; public const int DEFAULT_VEIN_GROUP_COUNT_RANDOM_ADD_OFFSET = 2; public const int DEFAULT_VEIN_SPOT_COUNT_RANDOM_BASE_VALUE = 15; public const float DEFAULT_VEIN_SPOT_COUNT_RANDOM_COEF = 1f; public const float DEFAULT_VEIN_SPOT_COUNT_RANDOM_MUL_OFFSET = 0f; public const int DEFAULT_VEIN_SPOT_COUNT_RANDOM_ADD_OFFSET = 5; public const int DEFAULT_VEIN_AMOUNT_RANDOM_BASE_VALUE = 100000; public const float DEFAULT_VEIN_AMOUNT_RANDOM_COEF = 1f; public const float DEFAULT_VEIN_AMOUNT_RANDOM_MUL_OFFSET = 0f; public const int DEFAULT_VEIN_AMOUNT_RANDOM_ADD_OFFSET = 50000; } public int Index; public int OrbitAround; public bool _HasOrbitAroundIndex; public int OrbitAroundIndex; public int OrbitIndex; public int Number; public bool GasGiant; public int InfoSeed; public int GenSeed; public float Radius; public float OrbitalPeriod; public float RotationPeriod; public bool IsTidalLocked; public float OrbitInclination; public float Obliquity; public bool DontGenerateVein; public bool _HasThemeId; public int ThemeId; public string ThemeName; public bool _HasOrbitLongitude; public float OrbitLongitude; public bool _HasVeinCustom; public Dictionary<EVeinType, VeinConfig> VeinCustom; public bool _HasReplaceAllVeinsTo; public EVeinType ReplaceAllVeinsTo; public bool IsBirthPoint; public override string ToString() { //IL_08ca: Unknown result type (might be due to invalid IL or missing references) //IL_0418: Unknown result type (might be due to invalid IL or missing references) StringBuilder stringBuilder = new StringBuilder("AdditionalPlanetConfig:\r\n"); stringBuilder.Append(" ").Append("Index: ").Append(Index) .Append("\r\n"); stringBuilder.Append(" ").Append("OrbitAround: ").Append(OrbitAround) .Append("\r\n"); stringBuilder.Append(" ").Append("_HasOrbitAroundIndex: ").Append(_HasOrbitAroundIndex) .Append("\r\n"); stringBuilder.Append(" ").Append("OrbitAroundIndex: ").Append(OrbitAroundIndex) .Append("\r\n"); stringBuilder.Append(" ").Append("OrbitIndex: ").Append(OrbitIndex) .Append("\r\n"); stringBuilder.Append(" ").Append("Number: ").Append(Number) .Append("\r\n"); stringBuilder.Append(" ").Append("GasGiant: ").Append(GasGiant) .Append("\r\n"); stringBuilder.Append(" ").Append("InfoSeed: ").Append(InfoSeed) .Append("\r\n"); stringBuilder.Append(" ").Append("GenSeed: ").Append(GenSeed) .Append("\r\n"); stringBuilder.Append(" ").Append("Radius: ").Append(Radius) .Append("\r\n"); stringBuilder.Append(" ").Append("OrbitalPeriod: ").Append(OrbitalPeriod) .Append("\r\n"); stringBuilder.Append(" ").Append("RotationPeriod: ").Append(RotationPeriod) .Append("\r\n"); stringBuilder.Append(" ").Append("IsTidalLocked: ").Append(IsTidalLocked) .Append("\r\n"); stringBuilder.Append(" ").Append("OrbitInclination: ").Append(OrbitInclination) .Append("\r\n"); stringBuilder.Append(" ").Append("Obliquity: ").Append(Obliquity) .Append("\r\n"); stringBuilder.Append(" ").Append("DontGenerateVein: ").Append(DontGenerateVein) .Append("\r\n"); stringBuilder.Append(" ").Append("_HasThemeId: ").Append(_HasThemeId) .Append("\r\n"); stringBuilder.Append(" ").Append("ThemeId: ").Append(ThemeId) .Append("\r\n"); stringBuilder.Append(" ").Append("ThemeName: ").Append(ThemeName) .Append("\r\n"); stringBuilder.Append(" ").Append("_HasOrbitLongitude: ").Append(_HasOrbitLongitude) .Append("\r\n"); stringBuilder.Append(" ").Append("OrbitLongitude: ").Append(OrbitLongitude) .Append("\r\n"); stringBuilder.Append(" ").Append("_HasVeinCustom: ").Append(_HasVeinCustom) .Append("\r\n"); stringBuilder.Append(" ").Append("VeinCustom: ").Append("\r\n"); if (_HasVeinCustom) { foreach (KeyValuePair<EVeinType, VeinConfig> item in VeinCustom) { stringBuilder.Append(" ").Append("VeinType: ").Append(item.Key) .Append("\r\n"); stringBuilder.Append(" ").Append("VeinGroupCount:").Append("\r\n"); stringBuilder.Append(" ").Append("Type: ").Append(item.Value.VeinGroupCount.Type) .Append("\r\n"); stringBuilder.Append(" ").Append("AccurateValue: ").Append(item.Value.VeinGroupCount.AccurateValue) .Append("\r\n"); stringBuilder.Append(" ").Append("RandomBaseValue: ").Append(item.Value.VeinGroupCount.RandomBaseValue) .Append("\r\n"); stringBuilder.Append(" ").Append("RandomCoef: ").Append(item.Value.VeinGroupCount.RandomCoef) .Append("\r\n"); stringBuilder.Append(" ").Append("RandomMulOffset: ").Append(item.Value.VeinGroupCount.RandomMulOffset) .Append("\r\n"); stringBuilder.Append(" ").Append("RandomAddOffset: ").Append(item.Value.VeinGroupCount.RandomAddOffset) .Append("\r\n"); stringBuilder.Append(" ").Append("VeinSpotCount:").Append("\r\n"); stringBuilder.Append(" ").Append("Type: ").Append(item.Value.VeinSpotCount.Type) .Append("\r\n"); stringBuilder.Append(" ").Append("AccurateValue: ").Append(item.Value.VeinSpotCount.AccurateValue) .Append("\r\n"); stringBuilder.Append(" ").Append("RandomBaseValue: ").Append(item.Value.VeinSpotCount.RandomBaseValue) .Append("\r\n"); stringBuilder.Append(" ").Append("RandomCoef: ").Append(item.Value.VeinSpotCount.RandomCoef) .Append("\r\n"); stringBuilder.Append(" ").Append("RandomMulOffset: ").Append(item.Value.VeinSpotCount.RandomMulOffset) .Append("\r\n"); stringBuilder.Append(" ").Append("RandomAddOffset: ").Append(item.Value.VeinSpotCount.RandomAddOffset) .Append("\r\n"); stringBuilder.Append(" ").Append("VeinAmount:").Append("\r\n"); stringBuilder.Append(" ").Append("Type: ").Append(item.Value.VeinAmount.Type) .Append("\r\n"); stringBuilder.Append(" ").Append("AccurateValue: ").Append(item.Value.VeinAmount.AccurateValue) .Append("\r\n"); stringBuilder.Append(" ").Append("RandomBaseValue: ").Append(item.Value.VeinAmount.RandomBaseValue) .Append("\r\n"); stringBuilder.Append(" ").Append("RandomCoef: ").Append(item.Value.VeinAmount.RandomCoef) .Append("\r\n"); stringBuilder.Append(" ").Append("RandomMulOffset: ").Append(item.Value.VeinAmount.RandomMulOffset) .Append("\r\n"); stringBuilder.Append(" ").Append("RandomAddOffset: ").Append(item.Value.VeinAmount.RandomAddOffset) .Append("\r\n"); } } stringBuilder.Append(" ").Append("_HasReplaceAllVeinsTo: ").Append(_HasReplaceAllVeinsTo) .Append("\r\n"); stringBuilder.Append(" ").Append("ReplaceAllVeinsTo: ").Append(ReplaceAllVeinsTo) .Append("\r\n"); stringBuilder.Append(" ").Append("IsBirthPoint: ").Append(IsBirthPoint) .Append("\r\n"); return stringBuilder.ToString(); } } internal static class ConfigUtility { public const string MOD_DATA_DIR = "modData/IndexOutOfRange.DSPAddPlanet/"; public const string XML_CONFIG_FILE = "config.xml"; public const string TEXT_CONFIG_FILE = "config.txt"; public const bool DEFAULT_IS_BIRTH_POINT = false; public const bool DEFAULT_GAS_GIANT = false; public const int DEFAULT_INFO_SEED = 0; public const int DEFAULT_GEN_SEED = 0; public const bool DEFAULT_FORCE_PLANET_RADIUS = false; public const int DEFAULT_RADIUS = 200; public const int MIN_RADIUS = 50; public const int MAX_RADIUS = 600; public const int DEFAULT_ORBITAL_PERIOD = 3600; public const int DEFAULT_ROTATION_PERIOD = 3600; public const bool DEFAULT_IS_TIDAL_LOCKED = true; public const float DEFAULT_ORBIT_INCLINATION = 0f; public const float DEFAULT_OBLIQUITY = 0f; public const bool DEFAULT_DONT_GENERATE_VEIN = true; public const bool DEFAULT_ENABLE_GALACTIC_SCALE_THEMES_IN_RANDOM_GENERATION = false; public static bool EnableGalacticScaleThemesInRandomGeneration { get; private set; } public static void ReadConfig(Dictionary<string, List<AdditionalPlanetConfig>> globalPlanetConfig, Dictionary<string, List<AdditionalPlanetConfig>> gameNameSpecificConfig) { globalPlanetConfig.Clear(); gameNameSpecificConfig.Clear(); EnableGalacticScaleThemesInRandomGeneration = false; string text = GameConfig.gameSaveFolder + "modData/IndexOutOfRange.DSPAddPlanet/"; if (!Directory.Exists(text)) { Directory.CreateDirectory(text); } string text2 = text + "config.xml"; string text3 = text + "config.txt"; if (File.Exists(text2)) { try { ReadXmlConfig(text2, globalPlanetConfig, gameNameSpecificConfig); } catch (Exception ex) { Plugin.Instance.Logger.LogError((object)ex.Message); Plugin.Instance.Logger.LogError((object)ex.StackTrace); globalPlanetConfig.Clear(); gameNameSpecificConfig.Clear(); } } else if (File.Exists(text3)) { try { ReadTextConfig(text3, gameNameSpecificConfig); } catch (Exception ex2) { Plugin.Instance.Logger.LogError((object)ex2.Message); Plugin.Instance.Logger.LogError((object)ex2.Message); gameNameSpecificConfig.Clear(); } } else { CreateExampleXmlConfigFile(text2); } foreach (KeyValuePair<string, List<AdditionalPlanetConfig>> item in globalPlanetConfig) { item.Value.Sort((AdditionalPlanetConfig a, AdditionalPlanetConfig b) => a.Index - b.Index); } foreach (KeyValuePair<string, List<AdditionalPlanetConfig>> item2 in gameNameSpecificConfig) { item2.Value.Sort((AdditionalPlanetConfig a, AdditionalPlanetConfig b) => a.Index - b.Index); } } private static void ReadXmlConfig(string filePath, Dictionary<string, List<AdditionalPlanetConfig>> globalPlanetConfig, Dictionary<string, List<AdditionalPlanetConfig>> gameNameSpecificConfig) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0005: Unknown result type (might be due to invalid IL or missing references) XmlDocument val = new XmlDocument(); val.Load(filePath); XmlNode val2 = ((XmlNode)val).SelectSingleNode("Config"); if (val2 == null) { return; } EnableGalacticScaleThemesInRandomGeneration = ReadBoolNode(val2, "EnableGalacticScaleThemesInRandomGeneration", required: false, defaultValue: false); GalacticScaleThemeRegistry.SetRandomGenerationEnabled(EnableGalacticScaleThemesInRandomGeneration); XmlNode val3 = val2.SelectSingleNode("Global"); if (val3 != null) { XmlNode val4 = val3.SelectSingleNode("Planets"); if (val4 != null) { Plugin.Instance.Logger.LogInfo((object)"Reading global planet config..."); ReadPlanetNodes(val4, globalPlanetConfig, isGameNameRequired: false); Plugin.Instance.Logger.LogInfo((object)("Global planet config size: " + globalPlanetConfig.Count)); } } XmlNode val5 = val2.SelectSingleNode("GameNameSpecific"); if (val5 != null) { XmlNode val6 = val5.SelectSingleNode("Planets"); if (val6 != null) { Plugin.Instance.Logger.LogInfo((object)"Reading game name specific planet config..."); ReadPlanetNodes(val6, gameNameSpecificConfig, isGameNameRequired: true); Plugin.Instance.Logger.LogInfo((object)("Config size: " + gameNameSpecificConfig.Count)); } } } private static void ReadPlanetNodes(XmlNode parent, Dictionary<string, List<AdditionalPlanetConfig>> planetConfig, bool isGameNameRequired) { //IL_0058: Unknown result type (might be due to invalid IL or missing references) //IL_005e: Invalid comparison between Unknown and I4 //IL_048b: Unknown result type (might be due to invalid IL or missing references) //IL_0490: Unknown result type (might be due to invalid IL or missing references) //IL_04f0: Unknown result type (might be due to invalid IL or missing references) //IL_04f6: Invalid comparison between Unknown and I4 //IL_0659: Unknown result type (might be due to invalid IL or missing references) GalacticScaleThemeRegistry.EnsureRegistered(); List<int> list = new List<int>(); ThemeProto[] dataArray = ((ProtoSet<ThemeProto>)(object)LDB.themes).dataArray; foreach (ThemeProto val in dataArray) { list.Add(((Proto)val).ID); } XmlNodeList childNodes = parent.ChildNodes; for (int j = 0; j < childNodes.Count; j++) { XmlNode val2 = childNodes.Item(j); if ((int)val2.NodeType != 1) { continue; } string text = ReadUniqueStarId(val2, isGameNameRequired); Plugin.Instance.Logger.LogInfo((object)text); AdditionalPlanetConfig config = default(AdditionalPlanetConfig); config.IsBirthPoint = ReadBoolNode(val2, "IsBirthPoint", required: false, defaultValue: false); config.Index = ReadIntNode(val2, "Index", required: true, 0, 0); config.OrbitAround = ReadIntNode(val2, "OrbitAround", required: true, 0, 0); config._HasOrbitAroundIndex = val2.SelectSingleNode("OrbitAroundIndex") != null; if (config._HasOrbitAroundIndex) { config.OrbitAroundIndex = ReadIntNode(val2, "OrbitAroundIndex", required: true, 0, 0); if (config.OrbitAroundIndex == config.Index) { throw new Exception($"Parameter 'OrbitAroundIndex' cannot point to the planet itself, index: {config.Index}"); } } config.OrbitIndex = ReadIntNode(val2, "OrbitIndex", required: true, 0, 0); config.Number = ReadIntNode(val2, "Number", required: true, 0, 1); config.GasGiant = ReadBoolNode(val2, "GasGiant", required: false, defaultValue: false); config.InfoSeed = ReadIntNode(val2, "InfoSeed", required: false, 0); config.GenSeed = ReadIntNode(val2, "GenSeed", required: false, 0); if (ReadBoolNode(val2, "ForcePlanetRadius", required: false, defaultValue: false)) { config.Radius = ReadIntNode(val2, "Radius", required: false, 200, 1); } else { config.Radius = ReadIntNode(val2, "Radius", required: false, 200, 50, 600); } config.OrbitalPeriod = ReadIntNode(val2, "OrbitalPeriod", required: false, 3600, 1); config.RotationPeriod = ReadIntNode(val2, "RotationPeriod", required: false, 3600, 1); config.IsTidalLocked = ReadBoolNode(val2, "IsTidalLocked", required: false, defaultValue: true); config.OrbitInclination = ReadFloatNode(val2, "OrbitInclination", required: false, 0f, 0f, 360f); config.Obliquity = ReadFloatNode(val2, "Obliquity", required: false, 0f, 0f, 360f); config.DontGenerateVein = ReadBoolNode(val2, "DontGenerateVein", required: false, defaultValue: true); XmlNode val3 = val2.SelectSingleNode("ThemeId"); XmlNode val4 = val2.SelectSingleNode("ThemeName"); if (val3 != null && val4 != null) { throw new Exception("Use either 'ThemeId' or 'ThemeName', not both"); } config._HasThemeId = val3 != null || val4 != null; if (val3 != null) { config.ThemeId = ReadIntNode(val2, "ThemeId", required: true, 0, list); } else if (val4 != null) { config.ThemeName = ReadStringNode(val2, "ThemeName", required: true, null); if (!GalacticScaleThemeRegistry.TryResolveThemeName(config.ThemeName, out config.ThemeId)) { throw new Exception("Invalid parameter 'ThemeName', theme '" + config.ThemeName + "' was not found. Known themes: " + GalacticScaleThemeRegistry.GetKnownThemeNames()); } } config._HasOrbitLongitude = val2.SelectSingleNode("OrbitLongitude") != null; if (config._HasOrbitLongitude) { config.OrbitLongitude = ReadFloatNode(val2, "OrbitLongitude", required: true, 0f, 0f, 360f); } config._HasReplaceAllVeinsTo = val2.SelectSingleNode("ReplaceAllVeinsTo") != null; if (config._HasReplaceAllVeinsTo) { config.ReplaceAllVeinsTo = ReadEnumNode<EVeinType>(val2, "ReplaceAllVeinsTo", required: true, (EVeinType)0); } config._HasVeinCustom = val2.SelectSingleNode("VeinCustom") != null; if (config._HasVeinCustom) { Dictionary<EVeinType, AdditionalPlanetConfig.VeinConfig> dictionary = new Dictionary<EVeinType, AdditionalPlanetConfig.VeinConfig>(); XmlNodeList childNodes2 = val2.SelectSingleNode("VeinCustom").ChildNodes; for (int k = 0; k < childNodes2.Count; k++) { XmlNode val5 = childNodes2.Item(k); if ((int)val5.NodeType != 1) { continue; } if (!Enum.TryParse<EVeinType>(val5.Name.Trim(), out EVeinType result)) { throw new Exception("Invalid vein type '" + val5.Name + "' in <VeinCustom>"); } AdditionalPlanetConfig.VeinConfig value = default(AdditionalPlanetConfig.VeinConfig); AdditionalPlanetConfig.VeinConfig.CustomValue veinGroupCount = default(AdditionalPlanetConfig.VeinConfig.CustomValue); XmlNode val6 = val5.SelectSingleNode("VeinGroupCount"); if (val6 == null) { veinGroupCount.Type = AdditionalPlanetConfig.VeinConfig.CustomValue.CustomType.Default; } else { try { veinGroupCount = ReadVeinCustomValue(val6, 8, 1f, 0f, 2); } catch (Exception ex) { throw new Exception("Error in <VeinCustom><VeinGroupCount>: " + ex.Message); } } value.VeinGroupCount = veinGroupCount; AdditionalPlanetConfig.VeinConfig.CustomValue veinSpotCount = default(AdditionalPlanetConfig.VeinConfig.CustomValue); XmlNode val7 = val5.SelectSingleNode("VeinSpotCount"); if (val7 == null) { veinSpotCount.Type = AdditionalPlanetConfig.VeinConfig.CustomValue.CustomType.Default; } else { try { veinSpotCount = ReadVeinCustomValue(val7, 15, 1f, 0f, 5); } catch (Exception ex2) { throw new Exception("Error in <VeinCustom><VeinSpotCount>: " + ex2.Message); } } value.VeinSpotCount = veinSpotCount; AdditionalPlanetConfig.VeinConfig.CustomValue veinAmount = default(AdditionalPlanetConfig.VeinConfig.CustomValue); XmlNode val8 = val5.SelectSingleNode("VeinAmount"); if (val8 == null) { veinAmount.Type = AdditionalPlanetConfig.VeinConfig.CustomValue.CustomType.Default; } else { try { veinAmount = ReadVeinCustomValue(val8, 100000, 1f, 0f, 50000); } catch (Exception ex3) { throw new Exception("Error in <VeinCustom><VeinAmount>: " + ex3.Message); } } value.VeinAmount = veinAmount; dictionary.Add(result, value); } config.VeinCustom = dictionary; } if (planetConfig.ContainsKey(text)) { List<AdditionalPlanetConfig> list2 = planetConfig[text]; if (list2.FindIndex((AdditionalPlanetConfig c) => c.Index == config.Index) != -1) { throw new Exception($"Duplicate index '{config.Index}' in <{text}>"); } list2.Add(config); } else { planetConfig.Add(text, new List<AdditionalPlanetConfig> { config }); } Plugin.Instance.Logger.LogInfo((object)$"Found new planet at {text}\r\n{config}"); } } private static void CreateExampleXmlConfigFile(string filePath) { StringBuilder stringBuilder = new StringBuilder(); stringBuilder.Append("<Config>\r\n").Append(" <EnableGalacticScaleThemesInRandomGeneration>false</EnableGalacticScaleThemesInRandomGeneration>\r\n").Append(" <Global>\r\n") .Append(" <Planets>\r\n") .Append(" <Planet>\r\n") .Append(" <UniqueStarId>\r\n") .Append(" <ClusterString>The cluster string</ClusterString>\r\n") .Append(" <StarId>1</StarId>\r\n") .Append(" </UniqueStarId>\r\n") .Append(" <IsBirthPoint>false</IsBirthPoint>\r\n") .Append(" <Index>4</Index>\r\n") .Append(" <OrbitAround>0</OrbitAround>\r\n") .Append(" <OrbitIndex>2</OrbitIndex>\r\n") .Append(" <Number>3</Number>\r\n") .Append(" <GasGiant>false</GasGiant>\r\n") .Append(" <InfoSeed>0</InfoSeed>\r\n") .Append(" <GenSeed>0</GenSeed>\r\n") .Append(" <ForcePlanetRadius>false</ForcePlanetRadius>\r\n") .Append(" <Radius>200</Radius>\r\n") .Append(" <OrbitalPeriod>3600</OrbitalPeriod>\r\n") .Append(" <RotationPeriod>3600</RotationPeriod>\r\n") .Append(" <IsTidalLocked>true</IsTidalLocked>\r\n") .Append(" <OrbitInclination>0</OrbitInclination>\r\n") .Append(" <Obliquity>0</Obliquity>\r\n") .Append(" <DontGenerateVein>true</DontGenerateVein>\r\n") .Append(" <ThemeId>0</ThemeId>\r\n") .Append(" <OrbitLongitude>0</OrbitLongitude>\r\n") .Append(" <VeinCustom>\r\n") .Append(" <Iron>\r\n") .Append(" <VeinGroupCount>\r\n") .Append(" <Type>Accurate</Type>\r\n") .Append(" <AccurateValue>10</AccurateValue>\r\n") .Append(" </VeinGroupCount>\r\n") .Append(" <VeinSpotCount>\r\n") .Append(" <Type>Random</Type>\r\n") .Append(" <RandomBaseValue>100000</RandomBaseValue>\r\n") .Append(" <RandomCoef>1</RandomCoef>\r\n") .Append(" <RandomMulOffset>0</RandomMulOffset>\r\n") .Append(" <RandomAddOffset>5</RandomAddOffset>\r\n") .Append(" </VeinSpotCount>\r\n") .Append(" <VeinAmount>\r\n") .Append(" <Type>Default</Type>\r\n") .Append(" </VeinAmount>\r\n") .Append(" </Iron>\r\n") .Append(" </VeinCustom>\r\n") .Append(" <ReplaceAllVeinsTo>Copper</ReplaceAllVeinsTo>\r\n") .Append(" </Planet>\r\n") .Append(" </Planets>\r\n") .Append(" </Global>\r\n") .Append(" <GameNameSpecific>\r\n") .Append(" <Planets>\r\n") .Append(" <Planet>\r\n") .Append(" <UniqueStarId>\r\n") .Append(" <GameName>The game name of your save file</GameName>\r\n") .Append(" <ClusterString>The cluster string</ClusterString>\r\n") .Append(" <StarId>1</StarId>\r\n") .Append(" </UniqueStarId>\r\n") .Append(" <IsBirthPoint>false</IsBirthPoint>\r\n") .Append(" <Index>4</Index>\r\n") .Append(" <OrbitAround>0</OrbitAround>\r\n") .Append(" <OrbitIndex>2</OrbitIndex>\r\n") .Append(" <Number>3</Number>\r\n") .Append(" <GasGiant>false</GasGiant>\r\n") .Append(" <InfoSeed>0</InfoSeed>\r\n") .Append(" <GenSeed>0</GenSeed>\r\n") .Append(" <ForcePlanetRadius>false</ForcePlanetRadius>\r\n") .Append(" <Radius>200</Radius>\r\n") .Append(" <OrbitalPeriod>3600</OrbitalPeriod>\r\n") .Append(" <RotationPeriod>3600</RotationPeriod>\r\n") .Append(" <IsTidalLocked>true</IsTidalLocked>\r\n") .Append(" <OrbitInclination>0</OrbitInclination>\r\n") .Append(" <Obliquity>0</Obliquity>\r\n") .Append(" <DontGenerateVein>true</DontGenerateVein>\r\n") .Append(" <ThemeId>0</ThemeId>\r\n") .Append(" <OrbitLongitude>0</OrbitLongitude>\r\n") .Append(" <VeinCustom>\r\n") .Append(" <Iron>\r\n") .Append(" <VeinGroupCount>\r\n") .Append(" <Type>Accurate</Type>\r\n") .Append(" <AccurateValue>10</AccurateValue>\r\n") .Append(" </VeinGroupCount>\r\n") .Append(" <VeinSpotCount>\r\n") .Append(" <Type>Random</Type>\r\n") .Append(" <RandomBaseValue>100000</RandomBaseValue>\r\n") .Append(" <RandomCoef>1</RandomCoef>\r\n") .Append(" <RandomMulOffset>0</RandomMulOffset>\r\n") .Append(" <RandomAddOffset>5</RandomAddOffset>\r\n") .Append(" </VeinSpotCount>\r\n") .Append(" <VeinAmount>\r\n") .Append(" <Type>Default</Type>\r\n") .Append(" </VeinAmount>\r\n") .Append(" </Iron>\r\n") .Append(" </VeinCustom>\r\n") .Append(" <ReplaceAllVeinsTo>Copper</ReplaceAllVeinsTo>\r\n") .Append(" </Planet>\r\n") .Append(" </Planets>\r\n") .Append(" </GameNameSpecific>\r\n") .Append("</Config>\r\n"); StreamWriter streamWriter = File.CreateText(filePath); streamWriter.Write((object?)stringBuilder); streamWriter.Flush(); streamWriter.Dispose(); } private static void ReadTextConfig(string filePath, Dictionary<string, List<AdditionalPlanetConfig>> planetConfig) { //IL_06ef: Unknown result type (might be due to invalid IL or missing references) string[] array = File.ReadAllLines(filePath); for (int i = 0; i < array.Length; i++) { string text = array[i].Trim(); if (Utility.IsNullOrWhiteSpace(text) || text.StartsWith("#") || text.StartsWith("(EXAMPLE)")) { continue; } Dictionary<string, string> dictionary = Utility.ParseQueryString(text); string valueSafe = GeneralExtensions.GetValueSafe<string, string>(dictionary, "uniqueStarId"); valueSafe = valueSafe.Substring(0, valueSafe.IndexOf('-')) + "." + valueSafe.Substring(valueSafe.IndexOf('-') + 1, valueSafe.LastIndexOf('-')) + "." + valueSafe.Substring(valueSafe.LastIndexOf('-') + 1); if (string.IsNullOrWhiteSpace(valueSafe)) { throw new Exception("Missing parameter 'uniqueStarId'"); } if (!int.TryParse(GeneralExtensions.GetValueSafe<string, string>(dictionary, "index"), out var result)) { throw new Exception("Missing parameter 'index'"); } if (!int.TryParse(GeneralExtensions.GetValueSafe<string, string>(dictionary, "orbitAround"), out var result2)) { throw new Exception("Missing parameter 'orbitAround'"); } bool hasOrbitAroundIndex = false; int result3 = 0; if (dictionary.ContainsKey("orbitAroundIndex")) { if (!int.TryParse(GeneralExtensions.GetValueSafe<string, string>(dictionary, "orbitAroundIndex"), out result3)) { throw new Exception("Invalid parameter 'orbitAroundIndex', this parameter must be a non-negative integer"); } if (result3 == result) { throw new Exception($"Parameter 'orbitAroundIndex' cannot point to the planet itself, index: {result}"); } hasOrbitAroundIndex = true; } if (!int.TryParse(GeneralExtensions.GetValueSafe<string, string>(dictionary, "orbitIndex"), out var result4)) { throw new Exception("Missing parameter 'orbitIndex'"); } if (!int.TryParse(GeneralExtensions.GetValueSafe<string, string>(dictionary, "number"), out var result5)) { throw new Exception("Missing parameter 'number'"); } if (!bool.TryParse(GeneralExtensions.GetValueSafe<string, string>(dictionary, "gasGiant"), out var result6)) { Plugin.Instance.Logger.LogInfo((object)$"Missing parameter 'gasGiant', pick default value: {false}"); result6 = false; } if (!int.TryParse(GeneralExtensions.GetValueSafe<string, string>(dictionary, "info_seed"), out var result7)) { Plugin.Instance.Logger.LogInfo((object)$"Missing parameter 'info_seed', pick default value: {0}"); result7 = 0; } if (!int.TryParse(GeneralExtensions.GetValueSafe<string, string>(dictionary, "gen_seed"), out var result8)) { Plugin.Instance.Logger.LogInfo((object)$"Missing parameter 'gen_seed', pick default value: {0}"); result8 = 0; } if (!bool.TryParse(GeneralExtensions.GetValueSafe<string, string>(dictionary, "forcePlanetRadius"), out var result9)) { Plugin.Instance.Logger.LogInfo((object)$"Missing parameter 'forcePlanetRadius', pick default value: {false}"); result9 = false; } if (!float.TryParse(GeneralExtensions.GetValueSafe<string, string>(dictionary, "planetRadius"), out var result10)) { Plugin.Instance.Logger.LogInfo((object)$"Missing parameter 'planetRadius', pick default value: {200}"); result10 = 200f; } if (result10 > 600f) { if (!result9) { throw new Exception($"Current max planet radius is {600}, use 'forcePlanetRadius=true' to override this"); } Plugin.Instance.Logger.LogWarning((object)$"Force planet radius: {result10}"); } if (!float.TryParse(GeneralExtensions.GetValueSafe<string, string>(dictionary, "orbitalPeriod"), out var result11)) { Plugin.Instance.Logger.LogInfo((object)$"Missing parameter 'orbitalPeriod', pick default value: {3600}"); result11 = 3600f; } if (!float.TryParse(GeneralExtensions.GetValueSafe<string, string>(dictionary, "rotationPeriod"), out var result12)) { Plugin.Instance.Logger.LogInfo((object)$"Missing parameter 'rotationPeriod', pick default value: {3600}"); result12 = 3600f; } if (!bool.TryParse(GeneralExtensions.GetValueSafe<string, string>(dictionary, "isTidalLocked"), out var result13)) { Plugin.Instance.Logger.LogInfo((object)$"Missing parameter 'isTidalLocked', pick default value: {true}"); result13 = true; } if (!float.TryParse(GeneralExtensions.GetValueSafe<string, string>(dictionary, "orbitInclination"), out var result14)) { Plugin.Instance.Logger.LogInfo((object)$"Missing parameter 'orbitInclination', pick default value: {0f}"); result14 = 0f; } if (!float.TryParse(GeneralExtensions.GetValueSafe<string, string>(dictionary, "obliquity"), out var result15)) { Plugin.Instance.Logger.LogInfo((object)$"Missing parameter 'obliquity', pick default value: {0f}"); result15 = 0f; } if (!bool.TryParse(GeneralExtensions.GetValueSafe<string, string>(dictionary, "dontGenerateVein"), out var result16)) { Plugin.Instance.Logger.LogInfo((object)$"Missing parameter 'dontGenerateVein', pick default value: {true}"); result16 = true; } int themeId = 0; string text2 = null; bool hasThemeId = false; if (dictionary.ContainsKey("theme") && dictionary.ContainsKey("themeName")) { throw new Exception("Use either 'theme' or 'themeName', not both"); } if (dictionary.ContainsKey("theme")) { if (!int.TryParse(GeneralExtensions.GetValueSafe<string, string>(dictionary, "theme"), out themeId)) { throw new Exception("Invalid parameter 'theme', this parameter must be a positive integer"); } if (!((ProtoSet<ThemeProto>)(object)LDB.themes).Exist(themeId)) { throw new Exception($"Fail to find theme #{themeId} in game data"); } if (((ProtoSet<ThemeProto>)(object)LDB.themes).Select(themeId) == null) { throw new Exception($"Theme exists but is null, theme id: {themeId}"); } hasThemeId = true; } else if (dictionary.ContainsKey("themeName")) { text2 = GeneralExtensions.GetValueSafe<string, string>(dictionary, "themeName"); if (!GalacticScaleThemeRegistry.TryResolveThemeName(text2, out themeId)) { throw new Exception("Invalid parameter 'themeName', theme '" + text2 + "' was not found. Known themes: " + GalacticScaleThemeRegistry.GetKnownThemeNames()); } hasThemeId = true; } float num = 0f; bool hasOrbitLongitude = false; if (dictionary.ContainsKey("orbitLongitude")) { string text3 = dictionary["orbitLongitude"]; if (string.IsNullOrWhiteSpace(text3)) { throw new Exception("Parameter 'orbitLongitude' has invalid value, correct format is 'DEGREE,MINUTE', e.g. '60,60'"); } string[] array2 = text3.Split(','); if (array2.Length != 2) { throw new Exception("Parameter 'orbitLongitude' has invalid value, correct format is 'DEGREE,MINUTE', e.g. '60,60'"); } if (!float.TryParse(array2[0].Trim(), out var result17)) { throw new Exception("Parameter 'orbitLongitude' has invalid value, correct format is 'DEGREE,MINUTE', e.g. '60,60'"); } if (!float.TryParse(array2[1].Trim(), out var result18)) { throw new Exception("Parameter 'orbitLongitude' has invalid value, correct format is 'DEGREE,MINUTE', e.g. '60,60'"); } num = result17 + result18 / 60f; if (num >= 360f) { num = Mathf.Repeat(num, 360f); } else if (num < 0f) { throw new Exception("Parameter 'orbitLongitude' must be positive"); } hasOrbitLongitude = true; } AdditionalPlanetConfig additionalPlanetConfig = new AdditionalPlanetConfig { Index = result, OrbitAround = result2, _HasOrbitAroundIndex = hasOrbitAroundIndex, OrbitAroundIndex = result3, OrbitIndex = result4, Number = result5, GasGiant = result6, InfoSeed = result7, GenSeed = result8, Radius = result10, OrbitalPeriod = result11, RotationPeriod = result12, IsTidalLocked = result13, OrbitInclination = result14, Obliquity = result15, DontGenerateVein = result16, _HasThemeId = hasThemeId, ThemeId = themeId, ThemeName = text2, _HasOrbitLongitude = hasOrbitLongitude, OrbitLongitude = num, _HasVeinCustom = false, VeinCustom = null, _HasReplaceAllVeinsTo = false, ReplaceAllVeinsTo = (EVeinType)0 }; if (!planetConfig.ContainsKey(valueSafe)) { planetConfig[valueSafe] = new List<AdditionalPlanetConfig>(); } planetConfig[valueSafe].Add(additionalPlanetConfig); Plugin.Instance.Logger.LogInfo((object)$"Found new planet at {valueSafe}\r\n{additionalPlanetConfig}"); } } private static string ReadStringNode(XmlNode parent, string childName, bool required, string defaultValue) { XmlNode val = parent.SelectSingleNode(childName); if (val == null) { if (required) { throw new Exception("Missing parameter '" + childName + "'"); } return defaultValue; } return val.InnerText.Trim(); } private static int ReadIntNode(XmlNode parent, string childName, bool required, int defaultValue, int min = int.MinValue, int max = int.MaxValue) { XmlNode val = parent.SelectSingleNode(childName); if (val == null) { if (required) { throw new Exception("Missing parameter '" + childName + "'"); } return defaultValue; } if (!int.TryParse(val.InnerText.Trim(), out var result)) { throw new Exception("Invalid parameter '" + childName + "', '" + childName + "' must be an integer, current value: " + val.InnerText); } if (result < min || result > max) { throw new Exception($"Invalid parameter '{childName}', '{childName}' must be in range [{min}, {max}], current value: {val.InnerText}"); } return result; } private static int ReadIntNode(XmlNode parent, string childName, bool required, int defaultValue, IEnumerable<int> set) { XmlNode val = parent.SelectSingleNode(childName); if (val == null) { if (required) { throw new Exception("Missing parameter '" + childName + "'"); } return defaultValue; } if (!int.TryParse(val.InnerText.Trim(), out var result)) { throw new Exception("Invalid parameter '" + childName + "', '" + childName + "' must be an integer, current value: " + val.InnerText); } if (!set.Contains(result)) { throw new Exception("Invalid parameter '" + childName + "', '" + childName + "' must be in set {" + GeneralExtensions.Join<int>(set, (Func<int, string>)null, ", ") + "}, current value: " + val.InnerText); } return result; } private static float ReadFloatNode(XmlNode parent, string childName, bool required, float defaultValue, float min = float.MinValue, float max = float.MaxValue) { XmlNode val = parent.SelectSingleNode(childName); if (val == null) { if (required) { throw new Exception("Missing parameter '" + childName + "'"); } return defaultValue; } if (!float.TryParse(val.InnerText.Trim(), out var result)) { throw new Exception("Invalid parameter '" + childName + "', '" + childName + "' must be an integer, current value: " + val.InnerText); } if (result < min || result > max) { throw new Exception($"Invalid parameter '{childName}', '{childName}' must be in range [{min}, {max}], current value: {val.InnerText}"); } return result; } private static bool ReadBoolNode(XmlNode parent, string childName, bool required, bool defaultValue) { XmlNode val = parent.SelectSingleNode(childName); if (val == null) { if (required) { throw new Exception("Missing parameter '" + childName + "'"); } return defaultValue; } if (!bool.TryParse(val.InnerText.Trim(), out var result)) { throw new Exception("Invalid parameter '" + childName + "', '" + childName + "' must be 'true' or 'false', current value: " + val.InnerText); } return result; } private static T ReadEnumNode<T>(XmlNode parent, string childName, bool required, T defaultValue) where T : Enum { XmlNode val = parent.SelectSingleNode(childName); if (val == null) { if (required) { throw new Exception("Missing parameter '" + childName + "'"); } return defaultValue; } try { return (T)Enum.Parse(typeof(T), val.InnerText.Trim()); } catch (Exception) { throw new Exception("Invalid parameter '" + childName + "', '" + childName + "' must be in set {" + Utility.EnumValuesJoin<T>() + "}, current value: " + val.InnerText); } } private static AdditionalPlanetConfig.VeinConfig.CustomValue ReadVeinCustomValue(XmlNode parent, int defaultRandomBaseValue, float defaultRandomCoef, float defaultRandomMulOffset, int defaultRandomAddOffset) { if (!Enum.TryParse<AdditionalPlanetConfig.VeinConfig.CustomValue.CustomType>((parent.SelectSingleNode("Type") ?? throw new Exception("Missing parameter 'Type'")).InnerText.Trim(), out var result)) { throw new Exception("'Type' must be in set {" + Utility.EnumValuesJoin<AdditionalPlanetConfig.VeinConfig.CustomValue.CustomType>() + "}"); } AdditionalPlanetConfig.VeinConfig.CustomValue result2 = default(AdditionalPlanetConfig.VeinConfig.CustomValue); switch (result) { case AdditionalPlanetConfig.VeinConfig.CustomValue.CustomType.Default: result2.Type = result; return result2; case AdditionalPlanetConfig.VeinConfig.CustomValue.CustomType.Random: { int randomBaseValue = ReadIntNode(parent, "RandomBaseValue", required: false, defaultRandomBaseValue, 0); float randomCoef = ReadFloatNode(parent, "RandomCoef", required: false, defaultRandomCoef, 0f); float randomMulOffset = ReadFloatNode(parent, "RandomMulOffset", required: false, defaultRandomMulOffset, 0f); int randomAddOffset = ReadIntNode(parent, "RandomAddOffset", required: false, defaultRandomAddOffset, 0); result2.Type = result; result2.RandomBaseValue = randomBaseValue; result2.RandomCoef = randomCoef; result2.RandomMulOffset = randomMulOffset; result2.RandomAddOffset = randomAddOffset; return result2; } case AdditionalPlanetConfig.VeinConfig.CustomValue.CustomType.Accurate: { int accurateValue = ReadIntNode(parent, "AccurateValue", required: true, 0, 0); result2.Type = result; result2.AccurateValue = accurateValue; return result2; } default: throw new Exception("Unrecognizable CustomType: " + result); } } private static string ReadUniqueStarId(XmlNode parent, bool isGameNameRequired) { XmlNode val = parent.SelectSingleNode("UniqueStarId"); if (val == null) { throw new Exception("Missing paremeter 'UniqueStarId'"); } string text = ReadStringNode(val, "ClusterString", required: true, null).Trim(); if (string.IsNullOrWhiteSpace(text)) { throw new Exception("Parameter 'ClusterString' can not be empty"); } bool flag = val.SelectSingleNode("StarId") != null; int starId = 0; string text2 = null; if (flag) { starId = ReadIntNode(val, "StarId", required: true, 0, 1); } else { text2 = ReadStringNode(val, "Star", required: true, null).Trim(); if (string.IsNullOrWhiteSpace(text2)) { throw new Exception("Parameter 'Star' can not be empty"); } } if (!isGameNameRequired) { if (!flag) { return Utility.UniqueStarIdWithoutGameName(text, text2); } return Utility.UniqueStarIdWithoutGameName(text, starId); } string text3 = ReadStringNode(val, "GameName", required: true, null).Trim(); if (string.IsNullOrWhiteSpace(text3)) { throw new Exception("Parameter 'GameName' can not be empty when required"); } if (!flag) { return Utility.UniqueStarIdWithGameName(text3, text, text2); } return Utility.UniqueStarIdWithGameName(text3, text, starId); } } internal static class GalacticScaleThemeRegistry { private enum MaterialRole { Terrain, Ocean, Atmosphere, Thumb, Minimap } private class ThemeSpec { public string Name; public string DisplayName; public int BaseThemeId; public int? TerrainThemeId; public int? OceanThemeId; public int? AtmosphereThemeId; public int? AmbientThemeId; public int? Algo; public EPlanetType? PlanetType; public float? Temperature; public int[] Vegetables0; public int[] Vegetables1; public int[] Vegetables2; public int[] Vegetables3; public int[] Vegetables4; public int[] Vegetables5; public int[] VeinSpot; public float[] VeinCount; public float[] VeinOpacity; public int[] RareVeins; public float[] RareSettings; public int[] GasItems; public float[] GasSpeeds; public float? Wind; public float? IonHeight; public float? WaterHeight; public int? WaterItemId; public string SFXPath; public bool IncludeInRandomGeneration = true; public EThemeDistribute? RandomDistribute; public int RandomWeight = 1; public int[] ExtraRandomThemeIds; public Color? TerrainTint; public Color? OceanTint; public Color? AtmosphereTint; public float? AmbientLutContribution; public Color? AmbientReflectionColor; public Action<AmbientDesc> AmbientOverride; public Dictionary<string, Color> TerrainColors; public Dictionary<string, Color> OceanColors; public Dictionary<string, Color> AtmosphereColors; public Dictionary<string, float> TerrainParams; public Dictionary<string, float> OceanParams; public Dictionary<string, float> AtmosphereParams; public ThemeTerrainSettings TerrainSettings; public ThemeVeinSettings VeinSettings; public bool UseSingleMaterial = true; public ThemeSpec Clone() { return (ThemeSpec)MemberwiseClone(); } } private class ThemeTerrainSettings { public string Algorithm = "Vanilla"; public double BaseHeight; public double BiomeHeightModifier; public double BiomeHeightMulti = 1.0; public double HeightMulti = 1.0; public double LandModifier; public double RandomFactor = 1.0; public double xFactor; public double yFactor; public double zFactor; } private class ThemeVeinSettings { public string Algorithm = "Vanilla"; public float VeinPadding = 1f; public List<ThemeVeinType> VeinTypes = new List<ThemeVeinType>(); } private class ThemeVeinType { public EVeinType Type; public bool Rare; public List<ThemeVein> Veins = new List<ThemeVein>(); public static ThemeVeinType Generate(EVeinType type, int min, int max, float minRichness, float maxRichness, int minPatchSize, int maxPatchSize, bool rare, int seed) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0008: Expected O, but got Unknown //IL_000e: Unknown result type (might be due to invalid IL or missing references) //IL_000f: Unknown result type (might be due to invalid IL or missing references) DotNet35Random val = new DotNet35Random(seed); ThemeVeinType themeVeinType = new ThemeVeinType { Type = type, Rare = rare }; int num = Mathf.RoundToInt((float)Mathf.Clamp(val.Next(min, max + 1), 0, 3000)); for (int i = 0; i < num; i++) { themeVeinType.Veins.Add(new ThemeVein { Count = val.Next(minPatchSize, maxPatchSize + 1), Richness = Mathf.Lerp(minRichness, maxRichness, (float)val.NextDouble()) }); } return themeVeinType; } } private class ThemeVein { public int Count; public float Richness; } private struct VeinDescriptor { public int Count; public EVeinType Type; public Vector3 Position; public bool Rare; public float Richness; } private class RegisteredThemeInfo { public int Id; public bool IncludeInRandomGeneration; public int RandomWeight; public EThemeDistribute RandomDistribute; public int[] ExtraRandomThemeIds; } private const int MEDITERRANEAN = 1; private const int GAS_GIANT = 2; private const int ICE_GIANT = 4; private const int LAVA = 9; private const int ICE_GELISOL = 10; private const int BARREN = 11; private const int GOBI = 12; private const int VOLCANIC_ASH = 13; private const int RED_STONE = 14; private const int SAVANNA = 22; private const int OCEAN_WORLD = 16; private const int OCEANIC_JUNGLE = 8; private const int PANDORA_SWAMP = 25; private static bool registered; private static readonly Dictionary<string, int> themeNameToId = new Dictionary<string, int>(); private static readonly Dictionary<int, ThemeSpec> themeSpecsById = new Dictionary<int, ThemeSpec>(); private static readonly Dictionary<string, ThemeSpec> themeSpecsByName = new Dictionary<string, ThemeSpec>(); private static readonly List<RegisteredThemeInfo> registeredThemeInfos = new List<RegisteredThemeInfo>(); private static readonly HashSet<int> materialReapplyLogged = new HashSet<int>(); private static readonly HashSet<int> materialDiagnosticLogged = new HashSet<int>(); public static IReadOnlyDictionary<string, int> ThemeNameToId => themeNameToId; public static bool IsGiganticForestTheme(int themeId) { EnsureRegistered(); ThemeProto val = ((ProtoSet<ThemeProto>)(object)LDB.themes).Select(themeId); if (val == null) { return false; } string text = NormalizeName(((Proto)val).Name); if (!(text == "giganticforest")) { return text == "giganticforestcold"; } return true; } public static bool IsBeachTheme(int themeId) { EnsureRegistered(); ThemeProto val = ((ProtoSet<ThemeProto>)(object)LDB.themes).Select(themeId); if (val == null) { return false; } string text = NormalizeName(((Proto)val).Name); if (!(text == "beach")) { return text == "beachcold"; } return true; } public static bool TryGenerateGalacticScaleVeins(PlanetData planet) { EnsureRegistered(); if (planet == null || planet.data == null) { return false; } ThemeSpec specForThemeId = GetSpecForThemeId(planet.theme); if (specForThemeId == null || specForThemeId.VeinSettings == null) { return false; } if (!string.Equals(specForThemeId.VeinSettings.Algorithm, "GS2", StringComparison.OrdinalIgnoreCase)) { return false; } GenerateGs2Veins(planet, specForThemeId.VeinSettings); return true; } public static bool UsesGalacticScaleTerrain(int themeId) { EnsureRegistered(); ThemeSpec specForThemeId = GetSpecForThemeId(themeId); if (specForThemeId != null && specForThemeId.TerrainSettings != null && !string.IsNullOrWhiteSpace(specForThemeId.TerrainSettings.Algorithm)) { return !string.Equals(specForThemeId.TerrainSettings.Algorithm, "Vanilla", StringComparison.OrdinalIgnoreCase); } return false; } public static bool TryGenerateGalacticScaleTerrain(PlanetData planet, double modX, double modY) { EnsureRegistered(); if (planet == null || planet.data == null) { return false; } ThemeSpec specForThemeId = GetSpecForThemeId(planet.theme); if (specForThemeId == null || specForThemeId.TerrainSettings == null) { return false; } string a = specForThemeId.TerrainSettings.Algorithm ?? ""; if (string.Equals(a, "GSTA1", StringComparison.OrdinalIgnoreCase)) { GenerateTerrain1(planet, specForThemeId.TerrainSettings); return true; } if (string.Equals(a, "GSTA3", StringComparison.OrdinalIgnoreCase)) { GenerateTerrain3(planet, specForThemeId.TerrainSettings); return true; } if (string.Equals(a, "GSTA6", StringComparison.OrdinalIgnoreCase)) { GenerateTerrain6(planet, specForThemeId.TerrainSettings); return true; } return false; } private static ThemeSpec GetSpecForThemeId(int themeId) { if (themeSpecsById.TryGetValue(themeId, out var value)) { return value; } ThemeProto val = ((ProtoSet<ThemeProto>)(object)LDB.themes).Select(themeId); if (val == null) { return null; } if (themeSpecsByName.TryGetValue(NormalizeName(((Proto)val).Name), out value) || themeSpecsByName.TryGetValue(NormalizeName(((Proto)val).name), out value) || themeSpecsByName.TryGetValue(NormalizeName(val.DisplayName), out value) || themeSpecsByName.TryGetValue(NormalizeName(val.displayName), out value)) { return value; } return null; } private static void GenerateTerrain1(PlanetData planet, ThemeTerrainSettings terrainSettings) { //IL_0029: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Unknown result type (might be due to invalid IL or missing references) //IL_0034: Unknown result type (might be due to invalid IL or missing references) //IL_003a: Expected O, but got Unknown //IL_003f: Unknown result type (might be due to invalid IL or missing references) //IL_0045: Expected O, but got Unknown PlanetRawData data = planet.data; if (data != null && data.vertices != null && data.heightData != null && data.biomoData != null) { DotNet35Random val = new DotNet35Random(planet.seed); SimplexNoise val2 = new SimplexNoise(val.Next()); SimplexNoise val3 = new SimplexNoise(val.Next()); for (int i = 0; i < data.dataLength; i++) { double num = (double)data.vertices[i].x * (double)planet.radius; double num2 = (double)data.vertices[i].y * (double)planet.radius; double num3 = (double)data.vertices[i].z * (double)planet.radius; double num4 = val2.Noise3DFBM(num * (terrainSettings.xFactor + 0.01), num2 * (terrainSettings.yFactor + 0.012), num3 * (terrainSettings.zFactor + 0.01), 6, 0.5, 2.0) * 3.0 * terrainSettings.HeightMulti + (-0.2 + terrainSettings.BaseHeight); double num5 = val3.Noise3DFBM(num * 0.0025, num2 * 0.0025, num3 * 0.0025, 3, 0.5, 2.0) * 3.0 * terrainSettings.HeightMulti * (terrainSettings.RandomFactor + 0.9) + (terrainSettings.LandModifier + 0.5); num5 = ((num5 <= 0.0) ? num5 : (num5 * 0.5)); double num6 = num4 + num5; double num7 = ((num6 <= 0.0) ? (num6 * 1.6) : (num6 * 0.5)); double num8 = ((num7 <= 0.0) ? Maths.Levelize2(num7, 0.5, 0.0) : Maths.Levelize3(num7, 0.7, 0.0)); double num9 = val3.Noise3DFBM(num * (terrainSettings.xFactor + 0.01) * 2.5, num2 * (terrainSettings.yFactor + 0.012) * 8.0, num3 * (terrainSettings.zFactor + 0.01) * 2.5, 2, 0.5, 2.0) * 0.6 - 0.3; double num10 = num7 * terrainSettings.BiomeHeightMulti + num9 + terrainSettings.BiomeHeightModifier * 2.5 + 0.3; double num11 = ((num10 >= 1.0) ? ((num10 - 1.0) * 0.8 + 1.0) : num10); int num12 = (int)(((double)planet.radius + num8 + 0.2) * 100.0); data.heightData[i] = (ushort)Mathf.Clamp(num12, 0, 65535); data.biomoData[i] = (byte)Mathf.Clamp((float)(num11 * 100.0), 0f, 200f); } } } private static void GenerateTerrain3(PlanetData planet, ThemeTerrainSettings terrainSettings) { //IL_0029: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Unknown result type (might be due to invalid IL or missing references) //IL_0034: Unknown result type (might be due to invalid IL or missing references) //IL_003a: Expected O, but got Unknown //IL_003f: Unknown result type (might be due to invalid IL or missing references) //IL_0045: Expected O, but got Unknown PlanetRawData data = planet.data; if (data == null || data.vertices == null || data.heightData == null || data.biomoData == null) { return; } DotNet35Random val = new DotNet35Random(planet.seed); SimplexNoise val2 = new SimplexNoise(val.Next()); SimplexNoise val3 = new SimplexNoise(val.Next()); for (int i = 0; i < data.dataLength; i++) { double num = (double)data.vertices[i].x * (double)planet.radius; double num2 = (double)data.vertices[i].y * (double)planet.radius; double num3 = (double)data.vertices[i].z * (double)planet.radius; double num4 = num + Math.Sin(num2 * 0.15) * 3.0; double num5 = num2 + Math.Sin(num3 * 0.15) * 3.0; double num6 = num3 + Math.Sin(num4 * 0.15) * 3.0; double num7 = val2.Noise3DFBM(num4 * 0.007, num5 * 0.0077, num6 * 0.007, 6, 0.5, 1.8); double num8 = val3.Noise3DFBM(num4 * 0.0091 + 0.5, num5 * 0.0196 + 0.2, num6 * 0.0091 + 0.7, 3, 0.5, 2.0) * 2.0; double num9 = val3.Noise3DFBM(num4 * 0.042, num5 * 0.084, num6 * 0.042, 2, 0.5, 2.0) * 2.0; double num10 = val3.Noise3DFBM(num4 * 0.0056, num5 * 0.0056, num6 * 0.0056, 2, 0.5, 2.0) * 2.0; double num11 = num7 * 2.0 + 0.92 + (double)Mathf.Clamp01((float)(num8 * (double)Mathf.Abs((float)num10 + 0.5f) - 0.35) * 1f); if (num11 < 0.0) { num11 *= 2.0; } double num12 = Maths.Levelize2(num11, 1.0, 0.0); if (num12 > 0.0) { num12 = Maths.Levelize4(Maths.Levelize2(num11, 1.0, 0.0), 1.0, 0.0); } double num13 = ((num12 <= 0.0) ? ((double)Mathf.Lerp(-4f, 0f, (float)num12 + 1f)) : ((num12 <= 1.0) ? ((double)Mathf.Lerp(0f, 0.3f, (float)num12) + num9 * 0.1) : ((num12 <= 2.0) ? ((double)Mathf.Lerp(0.3f, 1.4f, (float)num12 - 1f) + num9 * 0.12) : ((double)Mathf.Lerp(1.4f, 2.7f, (float)num12 - 2f) + num9 * 0.12)))); if (num11 < 0.0) { num11 *= 2.0; } if (num11 < 1.0) { num11 = Maths.Levelize(num11, 1.0, 0.0); } double num14 = Mathf.Abs((float)num11); double num15 = ((num14 <= 0.0) ? 0.0 : ((num14 <= 2.0) ? num14 : 2.0)); double num16 = num15 + ((num15 <= 1.8) ? (num9 * 0.2) : ((0.0 - num9) * 0.8)); int num17 = (int)(((double)planet.radius + num13 * terrainSettings.HeightMulti + 0.2 + terrainSettings.BaseHeight) * 100.0); data.heightData[i] = (ushort)Mathf.Clamp(num17, 0, 65535); data.biomoData[i] = (byte)Mathf.Clamp((float)(num16 * 100.0 * terrainSettings.BiomeHeightMulti + terrainSettings.BiomeHeightModifier), 0f, 200f); } } private static void GenerateTerrain6(PlanetData planet, ThemeTerrainSettings terrainSettings) { //IL_0029: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Unknown result type (might be due to invalid IL or missing references) //IL_0034: Unknown result type (might be due to invalid IL or missing references) //IL_003a: Expected O, but got Unknown //IL_003f: Unknown result type (might be due to invalid IL or missing references) //IL_0045: Expected O, but got Unknown PlanetRawData data = planet.data; if (data == null || data.vertices == null || data.heightData == null || data.biomoData == null) { return; } DotNet35Random val = new DotNet35Random(planet.seed); SimplexNoise val2 = new SimplexNoise(val.Next()); SimplexNoise val3 = new SimplexNoise(val.Next()); for (int i = 0; i < data.dataLength; i++) { double num = (double)data.vertices[i].x * (double)planet.radius; double num2 = (double)data.vertices[i].y * (double)planet.radius; double num3 = (double)data.vertices[i].z * (double)planet.radius; double num4 = Maths.Levelize(num * 0.007, 1.0, 0.0); double num5 = Maths.Levelize(num2 * 0.007, 1.0, 0.0); double num6 = Maths.Levelize(num3 * 0.007, 1.0, 0.0); double num7 = num4 + val2.Noise(num * terrainSettings.xFactor, num2 * terrainSettings.xFactor, num3 * terrainSettings.xFactor) * 0.04 * terrainSettings.RandomFactor; double num8 = num5 + val2.Noise(num2 * terrainSettings.yFactor, num3 * terrainSettings.yFactor, num * terrainSettings.yFactor) * 0.04 * terrainSettings.RandomFactor; double num9 = num6 + val2.Noise(num3 * terrainSettings.zFactor, num * terrainSettings.zFactor, num2 * terrainSettings.zFactor) * 0.04 * terrainSettings.RandomFactor; double num10 = Math.Abs(val3.Noise(num7, num8, num9)); double num11 = (0.16 - num10) * 10.0 * (1.0 + terrainSettings.LandModifier); double num12 = ((num11 <= 0.0) ? 0.0 : ((num11 <= 1.0) ? num11 : 1.0)); double num13 = num12 * num12; double num14 = (val2.Noise3DFBM(num2 * 0.005, num3 * 0.005, num * 0.005, 4, 0.5, 2.0) + 0.22) * 5.0; double num15 = ((num14 <= 0.0) ? 0.0 : ((num14 <= 1.0) ? num14 : 1.0)); double num16 = Math.Abs(val3.Noise3DFBM(num7 * 1.5, num8 * 1.5, num9 * 1.5, 2, 0.5, 2.0)); double num17 = 0.0 - num13 * 1.2 * num15; if (num17 >= 0.0) { num17 += num10 * 0.25 + num16 * 0.6; } double num18 = num17 - 0.1; double num19 = -0.3 - num18; if (num19 > 0.0) { double num20 = ((num19 <= 1.0) ? num19 : 1.0); num18 = -0.3 - (3.0 - num20 - num20) * num20 * num20 * 3.70000004768372; } double num21 = Maths.Levelize((num13 <= 0.300000011920929) ? 0.300000011920929 : num13, 0.7, 0.0); double num22 = ((num18 <= -0.800000011920929) ? ((0.0 - num21 - num10) * 0.899999976158142) : num18); double num23 = ((num22 <= -1.20000004768372) ? (-1.20000004768372) : num22); num23 = num23 * terrainSettings.HeightMulti + terrainSettings.BaseHeight; double num24 = num23 * num13 + (num10 * 2.1 * terrainSettings.BiomeHeightMulti + 0.800000011920929 + terrainSettings.BiomeHeightModifier); if (num24 > 1.70000004768372 && num24 < 2.0) { num24 = 2.0; } int num25 = (int)(((double)planet.radius + num23 + 0.2) * 100.0); data.heightData[i] = (ushort)Mathf.Clamp(num25, 0, 65535); data.biomoData[i] = (byte)Mathf.Clamp((float)(num24 * 100.0), 0f, 200f); } } private static void GenerateGs2Veins(PlanetData planet, ThemeVeinSettings veinSettings) { //IL_000f: Unknown result type (might be due to invalid IL or missing references) //IL_0015: Expected O, but got Unknown //IL_0096: Unknown result type (might be due to invalid IL or missing references) //IL_009b: Unknown result type (might be due to invalid IL or missing references) //IL_00a4: Unknown result type (might be due to invalid IL or missing references) //IL_00c1: Unknown result type (might be due to invalid IL or missing references) //IL_00c6: Unknown result type (might be due to invalid IL or missing references) //IL_00ee: 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_013e: Invalid comparison between Unknown and I4 //IL_0148: Unknown result type (might be due to invalid IL or missing references) //IL_014d: Unknown result type (might be due to invalid IL or missing references) //IL_0155: Unknown result type (might be due to invalid IL or missing references) //IL_015a: Unknown result type (might be due to invalid IL or missing references) //IL_0178: Unknown result type (might be due to invalid IL or missing references) //IL_0160: Unknown result type (might be due to invalid IL or missing references) //IL_0162: Unknown result type (might be due to invalid IL or missing references) //IL_0164: 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_01e4: Unknown result type (might be due to invalid IL or missing references) //IL_0205: Unknown result type (might be due to invalid IL or missing references) //IL_020a: Unknown result type (might be due to invalid IL or missing references) //IL_020d: Unknown result type (might be due to invalid IL or missing references) //IL_0216: Unknown result type (might be due to invalid IL or missing references) //IL_01f4: Unknown result type (might be due to invalid IL or missing references) //IL_0223: Unknown result type (might be due to invalid IL or missing references) //IL_0225: Unknown result type (might be due to invalid IL or missing references) //IL_01ba: Unknown result type (might be due to invalid IL or missing references) if (planet.data == null) { return; } DotNet35Random val = new DotNet35Random(planet.seed); List<VeinDescriptor> list = BuildGs2VeinDescriptors(veinSettings, val); if (list.Count == 0) { planet.data.veinCursor = 1; planet.veinGroups = (VeinGroup[])(object)new VeinGroup[1]; ((VeinGroup)(ref planet.veinGroups[0])).SetNull(); return; } double num = 0.5 + val.NextDouble() / 2.0; float num2 = (float)Math.Pow(2.1 / (double)Math.Max(planet.radius, 0.0001f), 2.0); Vector3 val2 = RandomDirection(val); ((Vector3)(ref val2)).Normalize(); val2 *= (float)(val.NextDouble() * 0.4 + 0.2); Dictionary<EVeinType, int> dictionary = new Dictionary<EVeinType, int>(); for (int i = 0; i < list.Count; i++) { VeinDescriptor value = list[i]; if ((val.NextDouble() > num && dictionary.ContainsKey(value.Type)) || (value.Rare && planet.star != null && (double)planet.star.level + 0.1 < val.NextDouble() * val.NextDouble())) { continue; } bool flag = (int)value.Type != 7; bool flag2 = false; Vector3 val3 = Vector3.zero; for (int j = 0; j < 99; j++) { val3 = RandomDirection(val); if (flag) { val3 += val2; } ((Vector3)(ref val3)).Normalize(); float num3 = planet.data.QueryHeight(val3); if (!(num3 < planet.radius) && (flag || !(num3 < planet.radius + 0.5f))) { float padding = num2 * (flag ? (veinSettings.VeinPadding * 196f) : 100f); if (!SurfaceVectorCollision(val3, list, i, padding)) { flag2 = true; break; } } } if (flag2) { if (!dictionary.ContainsKey(value.Type)) { dictionary.Add(value.Type, 1); } else { dictionary[value.Type]++; } value.Position = val3; list[i] = value; } } List<VeinDescriptor> list2 = list.Where((VeinDescriptor group) => group.Position != Vector3.zero).ToList(); InitializePlanetVeins(planet, list2.Count); for (int num4 = 0; num4 < list2.Count; num4++) { AddGs2VeinGroupToPlanet(planet, list2[num4], (short)num4, val); } } private static List<VeinDescriptor> BuildGs2VeinDescriptors(ThemeVeinSettings veinSettings, DotNet35Random random) { //IL_00c2: Unknown result type (might be due to invalid IL or missing references) //IL_00c7: Unknown result type (might be due to invalid IL or missing references) //IL_00ce: Unknown result type (might be due to invalid IL or missing references) //IL_00d3: Unknown result type (might be due to invalid IL or missing references) List<ThemeVeinType> veinTypes = new List<ThemeVeinType>(veinSettings.VeinTypes ?? new List<ThemeVeinType>()); CutVeinTypes(ref veinTypes, random); int num = ((veinTypes.Count != 0) ? veinTypes.Max((ThemeVeinType type) => type.Veins.Count) : 0); List<VeinDescriptor> list = new List<VeinDescriptor>(); for (int num2 = 0; num2 < num; num2++) { foreach (ThemeVeinType item in veinTypes) { if (item.Veins.Count > num2) { ThemeVein themeVein = item.Veins[num2]; list.Add(new VeinDescriptor { Count = ((themeVein.Count < 0) ? random.Next(5, 25) : themeVein.Count), Type = item.Type, Position = Vector3.zero, Rare = item.Rare, Richness = ((themeVein.Richness < 0f) ? ((float)random.NextDouble()) : themeVein.Richness) }); } } } return list; } private static void AddGs2VeinGroupToPlanet(PlanetData planet, VeinDescriptor veinGroup, short groupIndex, DotNet35Random random) { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Unknown result type (might be due to invalid IL or missing references) //IL_000d: Unknown result type (might be due to invalid IL or missing references) //IL_0012: Unknown result type (might be due to invalid IL or missing references) //IL_0013: Unknown result type (might be due to invalid IL or missing references) //IL_0018: Unknown result type (might be due to invalid IL or missing references) //IL_0019: Unknown result type (might be due to invalid IL or missing references) //IL_001e: Unknown result type (might be due to invalid IL or missing references) //IL_0023: Unknown result type (might be due to invalid IL or missing references) //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_0029: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Unknown result type (might be due to invalid IL or missing references) //IL_0035: Unknown result type (might be due to invalid IL or missing references) //IL_0040: Unknown result type (might be due to invalid IL or missing references) //IL_0046: Invalid comparison between Unknown and I4 //IL_00a2: Unknown result type (might be due to invalid IL or missing references) //IL_00a8: Invalid comparison between Unknown and I4 //IL_00bb: Unknown result type (might be due to invalid IL or missing references) //IL_00c1: Invalid comparison between Unknown and I4 //IL_00fc: Unknown result type (might be due to invalid IL or missing references) //IL_0101: Unknown result type (might be due to invalid IL or missing references) //IL_00ea: Unknown result type (might be due to invalid IL or missing references) //IL_00f0: Invalid comparison between Unknown and I4 //IL_012a: Unknown result type (might be due to invalid IL or missing references) //IL_012f: 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_0132: Unknown result type (might be due to invalid IL or missing references) //IL_0139: Unknown result type (might be due to invalid IL or missing references) //IL_013a: Unknown result type (might be due to invalid IL or missing references) //IL_013f: Unknown result type (might be due to invalid IL or missing references) //IL_0146: Unknown result type (might be due to invalid IL or missing references) //IL_0147: Unknown result type (might be due to invalid IL or missing references) //IL_014c: Unknown result type (might be due to invalid IL or missing references) //IL_0153: Unknown result type (might be due to invalid IL or missing references) //IL_0158: Unknown result type (might be due to invalid IL or missing references) //IL_015d: Unknown result type (might be due to invalid IL or missing references) //IL_0165: Unknown result type (might be due to invalid IL or missing references) //IL_016e: Unknown result type (might be due to invalid IL or missing references) //IL_0179: Unknown result type (might be due to invalid IL or missing references) //IL_0180: Unknown result type (might be due to invalid IL or missing references) //IL_0185: Unknown result type (might be due to invalid IL or missing references) //IL_018b: 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) Vector3 normalized = ((Vector3)(ref veinGroup.Position)).normalized; Quaternion val = Quaternion.FromToRotation(Vector3.up, normalized); Vector3 val2 = val * Vector3.right; Vector3 val3 = val * Vector3.forward; List<Vector2> obj = new List<Vector2> { Vector2.zero }; int maxCount = (((int)veinGroup.Type == 7) ? 1 : Mathf.Max(1, veinGroup.Count)); GenerateNodeVectors(obj, maxCount, random); int num = Mathf.RoundToInt(veinGroup.Richness * 100000f * (planet.star?.resourceCoef ?? 1f)); num = (int)((double)num * (random.NextDouble() + 0.5)); if ((int)veinGroup.Type == 7) { num *= 2; } if (num < 20) { num = 20; } if ((int)veinGroup.Type != 7) { num = Mathf.RoundToInt((float)num * DSPGame.GameDesc.resourceMultiplier); } if (DSPGame.GameDesc.resourceMultiplier >= 99.5f && (int)veinGroup.Type != 7) { num = 1000000000; } InitializeVeinGroup(planet, groupIndex, veinGroup.Type, normalized); float num2 = 2.1f / Math.Max(planet.radius, 0.0001f); foreach (Vector2 item in obj) { Vector3 val4 = normalized + (item.x * val2 + item.y * val3) * num2; planet.data.EraseVegetableAtPoint(val4); val4 = ((Vector3)(ref val4)).normalized * planet.data.QueryHeight(val4); AddVeinToPlanet(planet, num, veinGroup.Type, val4, groupIndex, random); } } private static void InitializePlanetVeins(PlanetData planet, int veinVectorCount) { planet.data.veinCursor = 1; planet.veinGroups = (VeinGroup[])(object)new VeinGroup[veinVectorCount + 1]; ((VeinGroup)(ref planet.veinGroups[0])).SetNull(); } private static void InitializeVeinGroup(PlanetData planet, short groupIndex, EVeinType veinType, Vector3 position) { //IL_0010: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Unknown result type (might be due to invalid IL or missing references) //IL_0022: Unknown result type (might be due to invalid IL or missing references) //IL_0023: Unknown result type (might be due to invalid IL or missing references) int num = groupIndex + 1; planet.veinGroups[num].type = veinType; planet.veinGroups[num].pos = position; planet.veinGroups[num].count = 0; planet.veinGroups[num].amount = 0L; } private static void AddVeinToPlanet(PlanetData planet, int amount, EVeinType veinType, Vector3 position, short groupIndex, DotNet35Random random) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0002: Expected I4, but got Unknown //IL_001a: Unknown result type (might be due to invalid IL or missing references) //IL_002a: Unknown result type (might be due to invalid IL or missing references) //IL_002b: Unknown result type (might be due to invalid IL or missing references) //IL_0032: 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_0069: Unknown result type (might be due to invalid IL or missing references) //IL_006b: Unknown result type (might be due to invalid IL or missing references) //IL_0096: Unknown result type (might be due to invalid IL or missing references) //IL_00a6: Unknown result type (might be due to invalid IL or missing references) int num = (int)veinType; int num2 = PlanetModelingManager.veinModelIndexs[num]; int num3 = PlanetModelingManager.veinModelCounts[num]; short num4 = (short)(groupIndex + 1); VeinData val = new VeinData { amount = amount, pos = position, type = veinType, groupIndex = num4, minerCount = 0, modelIndex = (short)random.Next(num2, num2 + num3), productId = PlanetModelingManager.veinProducts[num] }; planet.veinGroups[num4].count++; planet.veinGroups[num4].amount += val.amount; planet.data.AddVeinData(val); } private static void GenerateNodeVectors(List<Vector2> nodeVectors, int maxCount, DotNet35Random random) { //IL_0029: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Unknown result type (might be due to invalid IL or missing references) //IL_0074: Unknown result type (might be due to invalid IL or missing references) //IL_0078: Unknown result type (might be due to invalid IL or missing references) //IL_0082: Unknown result type (might be due to invalid IL or missing references) //IL_0087: Unknown result type (might be due to invalid IL or missing references) //IL_008c: Unknown result type (might be due to invalid IL or missing references) //IL_0098: Unknown result type (might be due to invalid IL or missing references) //IL_009d: Unknown result type (might be due to invalid IL or missing references) //IL_009f: Unknown result type (might be due to invalid IL or missing references) //IL_00a4: Unknown result type (might be due to invalid IL or missing references) //IL_00bf: Unknown result type (might be due to invalid IL or missing references) int num = 0; Vector2 val2 = default(Vector2); while (num++ < 20) { int count = nodeVectors.Count; for (int i = 0; i < count; i++) { if (nodeVectors.Count >= maxCount) { break; } Vector2 val = nodeVectors[i]; if (!(((Vector2)(ref val)).sqrMagnitude > 36f)) { double num2 = random.NextDouble() * Math.PI * 2.0; ((Vector2)(ref val2))..ctor((float)Math.Cos(num2), (float)Math.Sin(num2)); val2 += nodeVectors[i] * 0.2f; ((Vector2)(ref val2)).Normalize(); Vector2 candidate = nodeVectors[i] + val2; if (!nodeVectors.Any(delegate(Vector2 existing) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Unknown result type (might be due to invalid IL or missing references) Vector2 val3 = existing - candidate; return ((Vector2)(ref val3)).sqrMagnitude < 0.85f; })) { nodeVectors.Add(candidate); } } } if (nodeVectors.Count >= maxCount) { break; } } } private static Vector3 RandomDirection(DotNet35Random random) { //IL_0039: Unknown result type (might be due to invalid IL or missing references) return new Vector3((float)random.NextDouble() * 2f - 1f, (float)random.NextDouble() * 2f - 1f, (float)random.NextDouble() * 2f - 1f); } private static bool SurfaceVectorCollision(Vector3 vector, List<VeinDescriptor> vectors, int processedVectorCount, float padding) { //IL_000b: Unknown result type (might be due to invalid IL or missing references) //IL_0010: Unknown result type (might be due to invalid IL or missing references) //IL_0023: Unknown result type (might be due to invalid IL or missing references) //IL_0028: Unknown result type (might be due to invalid IL or missing references) //IL_0029: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Unknown result type (might be due to invalid IL or missing references) for (int i = 0; i < processedVectorCount; i++) { if (vectors[i].Position != Vector3.zero) { Vector3 val = vectors[i].Position - vector; if (((Vector3)(ref val)).sqrMagnitude < padding) { return true; } } } return false; } private static void CutVeinTypes(ref List<ThemeVeinType> veinTypes, DotNet35Random random) { if (veinTypes.Count >= 1) { int num = random.Next(veinTypes.Count); List<ThemeVeinType> list = new List<ThemeVeinType>(); for (int i = num; i < veinTypes.Count; i++) { list.Add(veinTypes[i]); } for (int j = 0; j < num; j++) { list.Add(veinTypes[j]); } veinTypes = list; } } public static void EnsureRegistered() { if (registered || (Object)(object)LDB.themes == (Object)null || ((ProtoSet<ThemeProto>)(object)LDB.themes).dataArray == null || ((ProtoSet<ThemeProto>)(object)LDB.themes).dataArray.Length == 0) { return; } try { ThemeSpec themeSpec = CreateGiganticForest(); ThemeSpec themeSpec2 = CreateRedForest(); ThemeSpec themeSpec3 = CreateBeach(); ThemeSpec themeSpec4 = CreatePandora(); RegisterTheme(themeSpec); RegisterTheme(themeSpec2); RegisterTheme(CreateSulfurSea()); RegisterTheme(CreateMoltenWorld()); RegisterTheme(themeSpec3); RegisterTheme(themeSpec4); RegisterTheme(CreateObsidian()); RegisterTheme(CreateHotObsidian()); RegisterHiddenTheme(CreateRemovedSmallPlanetSlot("RemovedSmallPlanetTheme34", 11)); RegisterHiddenTheme(CreateRemovedSmallPlanetSlot("RemovedSmallPlanetTheme35", 11)); RegisterHiddenTheme(CreateRemovedSmallPlanetSlot("RemovedSmallPlanetTheme36", 10)); RegisterTheme(CreateInferno()); RegisterTheme(CreateOilGiant()); RegisterTheme(CreateColdVariant(themeSpec, "GiganticForestCold")); RegisterTheme(CreateColdVariant(themeSpec2, "RedForestCold")); RegisterTheme(CreateColdVariant(themeSpec3, "BeachCold")); RegisterTheme(CreateColdVariant(themeSpec4, "PandoraCold")); registered = true; SetRandomGenerationEnabled(ConfigUtility.EnableGalacticScaleThemesInRandomGeneration); Plugin.Instance.Logger.LogInfo((object)$"Registered {themeNameToId.Count} GalacticScale-style themes"); } catch (Exception ex) { Plugin.Instance.Logger.LogError((object)("Failed to register GalacticScale-style themes: " + ex.Message)); Plugin.Instance.Logger.LogError((object)ex.StackTrace); } } public static bool TryResolveThemeName(string name, out int themeId) { EnsureRegistered(); string text = NormalizeName(name); if (themeNameToId.TryGetValue(text, out themeId)) { return true; } ThemeProto[] dataArray = ((ProtoSet<ThemeProto>)(object)LDB.themes).dataArray; foreach (ThemeProto val in dataArray) { if (val != null && (NormalizeName(((Proto)val).Name) == text || NormalizeName(((Proto)val).name) == text || NormalizeName(val.DisplayName) == text || NormalizeName(val.displayName) == text)) { themeId = ((Proto)val).ID; return true; } } themeId = 0; return false; } public static string GetKnownThemeNames() { EnsureRegistered(); List<string> list = new List<string>(); ThemeProto[] dataArray = ((ProtoSet<ThemeProto>)(object)LDB.themes).dataArray; foreach (ThemeProto val in dataArray) { if (val != null && !string.IsNullOrWhiteSpace(((Proto)val).Name) && !((Proto)val).Name.StartsWith("RemovedSmallPlanetTheme", StringComparison.OrdinalIgnoreCase)) { list.Add(((Proto)val).Name); } } list.Sort(StringComparer.OrdinalIgnoreCase); return string.Join(", ", list.ToArray()); } public static void SetRandomGenerationEnabled(bool enabled) { //IL_0043: Unknown result type (might be due to invalid IL or missing references) //IL_003e: Unknown result type (might be due to invalid IL or missing references) EnsureRegistered(); foreach (RegisteredThemeInfo registeredThemeInfo in registeredThemeInfos) { ThemeProto val = ((ProtoSet<ThemeProto>)(object)LDB.themes).Select(registeredThemeInfo.Id); if (val != null) { val.Distribute = (EThemeDistribute)((!enabled || !registeredThemeInfo.IncludeInRandomGeneration) ? 3 : ((int)registeredThemeInfo.RandomDistribute)); } } } public static void ApplyRandomGenerationToGameDesc(GameDesc gameDesc, bool enabled) { EnsureRegistered(); SetRandomGenerationEnabled(enabled); if (gameDesc == null || gameDesc.savedThemeIds == null) { return; } HashSet<int> hashSet = new HashSet<int>(registeredThemeInfos.Select((RegisteredThemeInfo info) => info.Id)); HashSet<int> hashSet2 = new HashSet<int>(registeredThemeInfos.Where((RegisteredThemeInfo info) => info.ExtraRandomThemeIds != null).SelectMany((RegisteredThemeInfo info) => info.ExtraRandomThemeIds)); HashSet<int> hashSet3 = new HashSet<int>(); List<int> list = new List<int>(); int[] savedThemeIds = gameDesc.savedThemeIds; foreach (int item in savedThemeIds) { if (!hashSet.Contains(item) && (!hashSet2.Contains(item) || hashSet3.Add(item))) { list.Add(item); } } if (enabled) { foreach (RegisteredThemeInfo registeredThemeInfo in registeredThemeInfos) { if (registeredThemeInfo.IncludeInRandomGeneration) { if (registeredThemeInfo.ExtraRandomThemeIds != null) { list.AddRange(registeredThemeInfo.ExtraRandomThemeIds); } for (int num2 = 0; num2 < Math.Max(1, registeredThemeInfo.RandomWeight); num2++) { list.Add(registeredThemeInfo.Id); } } } } gameDesc.savedThemeIds = list.ToArray(); } public static bool ReapplyRegisteredThemeMaterials(ThemeProto proto) { if (proto == null || !TryGetRegisteredThemeSpec(proto, out var spec)) { return false; } try { ApplySpecAssets(proto, spec); if (materialReapplyLogged.Add(((Proto)proto).ID)) { Plugin.Instance.Logger.LogInfo((object)$"Applied GalacticScale-style material fix for theme {((Proto)proto).ID}: {((Proto)proto).Name}"); } return true; } catch (Exception ex) { Plugin.Instance.Logger.LogWarning((object)("Failed to reapply GalacticScale-style theme materials for " + ((Proto)proto).Name + ": " + ex.Message)); return false; } } public static bool ApplyRegisteredThemeToPlanet(PlanetData planet) { if (planet == null || !TryGetRegisteredThemeSpec(planet.theme, out var spec)) { return false; } ThemeProto val = ((ProtoSet<ThemeProto>)(object)LDB.themes).Select(planet.theme); if (val == null) { return false; } try { ApplySpecAssets(val, spec); ApplyThemeProtoToPlanetMaterials(planet, val, spec); return true; } catch (Exception ex) { Plugin.Instance.Logger.LogWarning((object)("Failed to apply GalacticScale-style planet materials for " + planet.displayName + ": " + ex.Message)); return false; } } public static bool PrepareRegisteredThemeForPlanet(PlanetData planet) { if (planet == null || !TryGetRegisteredThemeSpec(planet.theme, out var _)) { return false; } return ReapplyRegisteredThemeMaterials(((ProtoSet<ThemeProto>)(object)LDB.themes).Select(planet.theme)); } public static bool ApplyRegisteredThemeToLoadedPlanet(PlanetData planet) { if (!ApplyRegisteredThemeToPlanet(planet)) { return false; } SyncPlanetSimulatorMaterials(planet); return true; } public static void RefreshRegisteredThemeSimulator(PlanetSimulator simulator, Transform lookCamera, StarSimulator star) { //IL_009e: Unknown result type (might be due to invalid IL or missing references) //IL_0096: Unknown result type (might be due to invalid IL or missing references) //IL_00a3: Unknown result type (might be due to invalid IL or missing references) //IL_00a4: Unknown result type (might be due to invalid IL or missing references) //IL_00a5: Unknown result type (might be due to invalid IL or missing references) //IL_00b0: Unknown result type (might be due to invalid IL or missing references) //IL_00b6: Unknown result type (might be due to invalid IL or missing references) //IL_00bb: Unknown result type (might be due to invalid IL or missing references) //IL_00c0: Unknown result type (might be due to invalid IL or missing references) //IL_00c4: Unknown result type (might be due to invalid IL or missing references) //IL_00c9: Unknown result type (might be due to invalid IL or missing references) //IL_00ce: Unknown result type (might be due to invalid IL or missing references) //IL_00d3: Unknown result type (might be due to invalid IL or missing references) //IL_0117: Unknown result type (might be due to invalid IL or missing references) //IL_013f: Unknown result type (might be due to invalid IL or missing references) //IL_0133: 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_0144: Unknown result type (might be due to invalid IL or missing references) //IL_014c: Unknown result type (might be due to invalid IL or missing references) //IL_0151: Unknown result type (might be due to invalid IL or missing references) //IL_01bf: Unknown result type (might be due to invalid IL or missing references) //IL_01ca: Unknown result type (might be due to invalid IL or missing references) //IL_01cf: Unknown result type (might be due to invalid IL or missing references) //IL_01d4: Unknown result type (might be due to invalid IL or missing references) //IL_01ea: Unknown result type (might be due to invalid IL or missing references) //IL_01ef: Unknown result type (might be due to invalid IL or missing references) //IL_0104: Unknown result type (might be due to invalid IL or missing references) //IL_0109: Unknown result type (might be due to invalid IL or missing references) //IL_010e: Unknown result type (might be due to invalid IL or missing references) //IL_01f5: Unknown result type (might be due to invalid IL or missing references) //IL_01fa: Unknown result type (might be due to invalid IL or missing references) //IL_0187: Unknown result type (might be due to invalid IL or missing references) //IL_018f: Unknown result type (might be due to invalid IL or missing references) //IL_0199: Unknown result type (might be due to invalid IL or missing references) //IL_019e: Unknown result type (might be due to invalid IL or missing references) //IL_01a3: Unknown result type (might be due to invalid IL or missing references) //IL_01a8: Unknown result type (might be due to invalid IL or missing references) //IL_01ac: Unknown result type (might be due to invalid IL or missing references) //IL_01b7: Unknown result type (might be due to invalid IL or missing references) //IL_01bc: Unknown result type (might be due to invalid IL or missing references) //IL_023d: Unknown result type (might be due to invalid IL or missing references) //IL_0244: Unknown result type (might be due to invalid IL or missing references) //IL_024b: Unknown result type (might be due to invalid IL or missing references) //IL_0252: Unknown result type (might be due to invalid IL or missing references) //IL_027e: Unknown result type (might be due to invalid IL or missing references) //IL_0281: Unknown result type (might be due to invalid IL or missing references) //IL_02b0: Unknown result type (might be due to invalid IL or missing references) //IL_022a: Unknown result type (might be due to invalid IL or missing references) //IL_0231: Unknown result type (might be due to invalid IL or missing references) //IL_0236: Unknown result type (might be due to invalid IL or missing references) //IL_023b: Unknown result type (might be due to invalid IL or missing references) //IL_0208: Unknown result type (might be due to invalid IL or missing references) //IL_020b: Unknown result type (might be due to invalid IL or missing references) //IL_0210: Unknown result type (might be due to invalid IL or missing references) //IL_0215: Unknown result type (might be due to invalid IL or missing references) //IL_0217: Unknown result type (might be due to invalid IL or missing references) //IL_0218: Unknown result type (might be due to invalid IL or missing references) //IL_021a: Unknown result type (might be due to invalid IL or missing references) //IL_021f: Unknown result type (might be due to invalid IL or missing references) //IL_01ff: Unknown result type (might be due to invalid IL or missing references) //IL_0204: Unknown result type (might be due to invalid IL or missing references) //IL_0179: Unknown result type (might be due to invalid IL or missing references) //IL_017e: Unknown result type (might be due to invalid IL or missing references) //IL_0183: Unknown result type (might be due to invalid IL or missing references) //IL_0335: Unknown result type (might be due to invalid IL or missing references) //IL_02fe: Unknown result type (might be due to invalid IL or missing references) //IL_0323: Unknown result type (might be due to invalid IL or missing references) //IL_03ac: Unknown result type (might be due to invalid IL or missing references) //IL_03b1: Unknown result type (might be due to invalid IL or missing references) //IL_03b5: Unknown result type (might be due to invalid IL or missing references) //IL_03bc: Unknown result type (might be due to invalid IL or missing references) //IL_03c3: 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_03e7: Unknown result type (might be due to invalid IL or missing references) //IL_03ec: Unknown result type (might be due to invalid IL or missing references) //IL_0358: Unknown result type (might be due to invalid IL or missing references) //IL_0369: Unknown result type (might be due to invalid IL or missing references) //IL_041f: Unknown result type (might be due to invalid IL or missing references) //IL_0416: Unknown result type (might be due to invalid IL or missing references) //IL_0424: Unknown result type (might be due to invalid IL or missing references) //IL_0439: Unknown result type (might be due to invalid IL or missing references) //IL_0430: Unknown result type (might be due to invalid IL or missing references) //IL_043e: Unknown result type (might be due to invalid IL or missing references) //IL_0470: Unknown result type (might be due to invalid IL or missing references) //IL_0475: Unknown result type (might be due to invalid IL or missing references) //IL_0477: Unknown result type (might be due to invalid IL or missing references) //IL_0479: Unknown result type (might be due to invalid IL or missing references) //IL_047b: Unknown result type (might be due to invalid IL or missing references) //IL_047d: Unknown result type (might be due to invalid IL or missing references) //IL_0496: Unknown result type (might be due to invalid IL or missing references) //IL_049b: Unknown result type (might be due to invalid IL or missing references) //IL_049d: Unknown result type (might be due to invalid IL or missing references) //IL_049f: Unknown result type (might be due to invalid IL or missing references) //IL_04a1: Unknown result type (might be due to invalid IL or missing references) //IL_04a3: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)simulator == (Object)null || simulator.planetData == null || !IsRegisteredTheme(simulator.planetData.theme)) { return; } PlanetData planetData = simulator.planetData; if (planetData.loading || planetData.factoryLoading || (Object)(object)simulator.atmoTrans0 == (Object)null || (Object)(object)simulator.atmoTrans1 == (Object)null || (Object)(object)simulator.atmoMat == (Object)null || (Object)(object)simulator.atmoMatLate == (Object)null || (Object)(object)lookCamera == (Object)null) { return; } Camera main = GameCamera.main; if ((Object)(object)main == (Object)null) { return; } PlanetData localPlanet = GameMain.localPlanet; Quaternion val = localPlanet?.runtimeRotation ?? Quaternion.identity; Quaternion val2 = Quaternion.Inverse(val); VectorLF3 val3 = planetData.star.uPosition - planetData.uPosition; Vector3 sunDir = val2 * VectorLF3.op_Implicit(((VectorLF3)(ref val3)).normalized); if (FactoryModel.whiteMode0 && (Object)(object)GameCamera.instance?.camLight != (Object)null) { sunDir = -((Component)GameCamera.instance.camLight).transform.forward; } simulator.atmoTrans0.rotation = lookCamera.localRotation; Vector4 localPos = (((Object)(object)GameCamera.generalTarget == (Object)null) ? Vector4.zero : Vector4.op_Implicit(GameCamera.generalTarget.position)); Vector3 position = ((Component)main).transform.position; if (((Vector4)(ref localPos)).sqrMagnitude == 0f) { if (!GameCamera.instance.isPlanetMode && GameMain.mainPlayer != null) { localPos = Vector4.op_Implicit(GameMain.mainPlayer.position); } else { Vector4 val4 = Vector4.op_Implicit(position + ((Component)main).transform.forward * 30f); localPos = ((Vector4)(ref val4)).normalized * planetData.realRadius; } } Vector3 val5 = lookCamera.localPosition - ((Component)simulator).transform.localPosition; float num = Mathf.Max(((Vector3)(ref val5)).magnitude, 0.0001f); VectorLF3 val6 = planetData.uPosition; if (localPlanet != null) { val = localPlanet.runtimeRotation; if (localPlanet == planetData) { val6 = VectorLF3.zero; } else { val6 -= localPlanet.uPosition; val6 = Maths.QInvRotateLF(val, val6); } } else if (GameMain.mainPlayer != null) { val6 -= GameMain.mainPlayer.uPosition; } Vector3 val7 = default(Vector3); float num2 = default(float); UniverseSimulator.VirtualMapping(val6.x, val6.y, val6.z, position, ref val7, ref num2, 10000.0); float planetScaleFactor = GetPlanetScaleFactor(planetData); simulator.atmoTrans1.localPosition = new Vector3(0f, 0f, Mathf.Clamp(Vector3.Dot(val5, lookCamera.forward) + 10f / planetScaleFactor, 0f, Math.Max(320f, 320f * planetScaleFactor))); float fieldOfView = main.fieldOfView; float aspect = main.aspect; float num3 = Mathf.Atan(Mathf.Tan(fieldOfView * 0.5f * ((float)Math.PI / 180f)) * aspect) * 2f * 57.29578f; if (num3 > 90f) { simulator.atmoTrans1.localScale = Vector3.one * (planetData.realRadius * 5f * Mathf.Tan(num3 * 0.5f * ((float)Math.PI / 180f))); } else if (!Mathf.Approximately(simulator.atmoTrans1.localScale.x, planetData.realRadius * 5f)) { simulator.atmoTrans1.localScale = Vector3.one * (planetData.realRadius * 5f); } float intensityControl = Mathf.Clamp01(8000f / num); float num4 = Mathf.Clamp01(4000f / num); float distanceControl = Mathf.Max(0f, num / 6000f - 1f); Vector4 atmoMatRadiusParam = simulator.atmoMatRadiusParam; atmoMatRadiusParam.z = atmoMatRadiusParam.x + (atmoMatRadiusParam.z - atmoMatRadiusParam.x) * (2.7f - num4 * 1.7f); atmoMatRadiusParam *= num2 * planetScaleFactor; object obj = star; if (obj == null) { UniverseSimulator universeSimulator = GameMain.universeSimulator; obj = ((universeSimulator != null) ? universeSimulator.FindStarSimulator(planetData.star) : null); } StarSimulator val8 = (StarSimulator)obj; Color sunAtmosColor = (((Object)(object)val8 != (Object)null) ? val8.sunAtmosColor : Color.white); Color sunriseAtmosColor = (((Object)(object)val8 != (Object)null) ? val8.sunriseAtmosColor : Color.white); float scatterPower = Mathf.Max(60f * planetScaleFactor, (num - planetData.realRadius * 2f) * 0.18f); RefreshAtmosphereMaterial(simulator.atmoMat, ((Component)simulator).transform.localPosition, sunDir, atmoMatRadiusParam, sunAtmosColor, sunriseAtmosColor, localPos, scatterPower, intensityControl, distanceControl); RefreshAtmosphereMaterial(simulator.atmoMatLate, ((Component)simulator).transform.localPosition, sunDir, atmoMatRadiusParam, sunAtmosColor, sunriseAtmosColor, localPos, scatterPower, intensityControl, distanceControl); simulator.atmoMat.renderQueue = ((planetData == localPlanet) ? 2991 : 2989); if (planetData == localPlanet) { simulator.atmoMatLate.renderQueue = 3200; SetIntIfExists(simulator.atmoMatLate, "_StencilRef", 2); SetIntIfExists(simulator.atmoMatLate, "_StencilComp", 3); } else { simulator.atmoMatLate.renderQueue = 2989; SetIntIfExists(simulator.atmoMatLate, "_StencilRef", 0); SetIntIfExists(simulator.atmoMatLate, "_StencilComp", 1); } } public static bool IsRegisteredTheme(int themeId) { EnsureRegistered(); ThemeSpec spec; return TryGetRegisteredThemeSpec(themeId, out spec); } private static ThemeSpec CreateGiganticForest() { ThemeSpec themeSpec = new ThemeSpec(); themeSpec.Name = "GiganticForest"; themeSpec.DisplayName = "Gigantic Forest"; themeSpec.BaseThemeId = 8; themeSpec.OceanThemeId = 1; themeSpec.Algo = 1; themeSpec.Vegetables1 = new int[64] { 42, 42, 42, 46, 101, 101, 101, 101, 101, 101, 102, 102, 102, 102, 102, 102, 103, 103, 103, 103, 103, 103, 104, 104, 104, 104, 104, 104, 125, 125, 125, 125, 125, 125, 601, 601, 601, 601, 601, 601, 602, 602, 602, 602, 602, 602, 603, 603, 603, 603, 603, 603, 604, 604, 604, 604, 604, 604, 605, 605, 605, 605, 605, 605 }; themeSpec.Vegetables2 = new int[6] { 1001, 1002, 1003, 1005, 1006, 1007 }; themeSpec.Vegetables3 = new int[12] { 43, 46, 47, 47, 101, 102, 103, 104, 106, 601, 602, 604 }; themeSpec.Vegetables4 = new int[0]; themeSpec.Vegetables5 = new int[82] { 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 43, 43, 43, 43, 43, 43, 46, 46, 47, 47, 47, 47, 47, 47, 47, 102, 103, 103, 104, 104, 104, 104, 104, 104, 104, 104, 104, 104, 104, 104, 104, 104, 104, 104, 125, 125, 125, 125, 125, 125, 125, 604, 604, 604, 604, 604, 604, 604, 605, 605, 605, 605, 605, 605, 605, 1001, 1001, 1001, 1001, 1001, 1001, 1001, 1002, 1002, 1002, 1002, 1002, 1002, 1002, 1002, 1002 }; themeSpec.Wind = 1.15f; themeSpec.Temperature = 0f; themeSpec.WaterHeight = 0f; themeSpec.WaterItemId = 1000; themeSpec.TerrainSettings = new ThemeTerrainSettings { Algorithm = "GSTA6" }; return themeSpec; } private static ThemeSpec CreateRedForest() { //IL_012e: Unknown result type (might be due to invalid IL or missing references) //IL_0152: Unknown result type (might be due to invalid IL or missing references) //IL_0176: Unknown result type (might be due to invalid IL or missing references) ThemeProto val = ((ProtoSet<ThemeProto>)(object)LDB.themes).Select(14); ThemeSpec themeSpec = new ThemeSpec(); themeSpec.Name = "RedForest"; themeSpec.DisplayName = "Red Forest"; themeSpec.BaseThemeId = 8; themeSpec.Algo = 1; themeSpec.Vegetables0 = new int[5] { 26, 26, 45, 603, 604 }; themeSpec.Vegetables1 = new int[9] { 1001, 1001, 1001, 1001, 1001, 1001, 45, 26, 26 }; themeSpec.Vegetables2 = new int[1] { 1001 }; themeSpec.Vegetables3 = new int[8] { 26, 26, 26, 26, 45, 602, 603, 604 }; themeSpec.Vegetables4 = new int[5] { 1001, 26, 602, 603, 604 }; themeSpec.Vegetables5 = new int[6] { 25, 32, 36, 37, 39, 41 }; themeSpec.VeinSpot = Clone(val.VeinSpot); themeSpec.VeinCount = Clone(val.VeinCount); themeSpec.VeinOpacity = Clone(val.VeinOpacity); theme