Decompiled source of Universal Radar v1.2.3
ScienceBird.UniversalRadar.dll
Decompiled 2 months 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.Runtime.CompilerServices; using System.Runtime.Versioning; using System.Security; using System.Security.Permissions; using System.Text; using System.Text.RegularExpressions; using BepInEx; using BepInEx.Bootstrap; using BepInEx.Configuration; using BepInEx.Logging; using DunGen; using EasyTextEffects.Editor.MyBoxCopy.Extensions; using HarmonyLib; using LethalLevelLoader; using Microsoft.CodeAnalysis; using TerraMesh; using TerraMesh.Utils; using Unity.AI.Navigation; using Unity.Netcode; using UnityEngine; using UnityEngine.AI; using UnityEngine.Rendering.HighDefinition; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)] [assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")] [assembly: AssemblyCompany("ScienceBird.UniversalRadar")] [assembly: AssemblyConfiguration("Debug")] [assembly: AssemblyFileVersion("1.2.3.0")] [assembly: AssemblyInformationalVersion("1.2.3+fa8e6cff880ecf12cc3cc9d23b739fb460b7b0b5")] [assembly: AssemblyProduct("UniversalRadar")] [assembly: AssemblyTitle("ScienceBird.UniversalRadar")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.2.3.0")] [module: UnverifiableCode] [module: RefSafetyRules(11)] namespace Microsoft.CodeAnalysis { [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] internal sealed class EmbeddedAttribute : Attribute { } } namespace System.Runtime.CompilerServices { [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] [AttributeUsage(AttributeTargets.Class | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Parameter | AttributeTargets.ReturnValue | AttributeTargets.GenericParameter, AllowMultiple = false, Inherited = false)] internal sealed class NullableAttribute : Attribute { public readonly byte[] NullableFlags; public NullableAttribute(byte P_0) { NullableFlags = new byte[1] { P_0 }; } public NullableAttribute(byte[] P_0) { NullableFlags = P_0; } } [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] [AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Method | AttributeTargets.Interface | AttributeTargets.Delegate, AllowMultiple = false, Inherited = false)] internal sealed class NullableContextAttribute : Attribute { public readonly byte Flag; public NullableContextAttribute(byte P_0) { Flag = P_0; } } [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] [AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)] internal sealed class RefSafetyRulesAttribute : Attribute { public readonly int Version; public RefSafetyRulesAttribute(int P_0) { Version = P_0; } } } namespace UniversalRadar { [BepInPlugin("ScienceBird.UniversalRadar", "UniversalRadar", "1.2.3")] [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInDependency(/*Could not decode attribute arguments.*/)] public class UniversalRadar : BaseUnityPlugin { public static AssetBundle URAssets; public static ConfigEntry<float> AutoLineWidth; public static ConfigEntry<float> AutoSpacing; public static ConfigEntry<float> AutoOpacity; public static ConfigEntry<bool> LogValues; public static ConfigEntry<bool> OldRadarFallback; public static ConfigEntry<bool> UseDefaultLayer; public static ConfigEntry<bool> UseTerrainLayer; public static ConfigEntry<bool> UseFoliageLayer; public static ConfigEntry<bool> UseTerraMesh; public static ConfigEntry<bool> HideRadarObjects; public static ConfigEntry<bool> RadarWater; public static ConfigEntry<bool> ShowTerrain; public static ConfigEntry<bool> ShowFoliage; public static ConfigEntry<float> RadarObjectSize; public static ConfigEntry<float> CameraClipExtension; public static ConfigEntry<bool> ExperimentationSprites; public static ConfigEntry<bool> AssuranceSprites; public static ConfigEntry<bool> VowSprites; public static ConfigEntry<bool> MarchSprites; public static ConfigEntry<bool> RendSprites; public static ConfigEntry<bool> DineSprites; public static ConfigEntry<bool> OffenseSprites; public static ConfigEntry<bool> TitanSprites; public static ConfigEntry<bool> ArtificeSprites; public static ConfigEntry<bool> AdamanceSprites; public static ConfigEntry<bool> EmbrionSprites; public static ConfigEntry<bool> GordionSprites; public static ConfigEntry<bool> ShipInheritColour; public static ConfigEntry<string> ExperimentationSpriteColour; public static ConfigEntry<string> AssuranceSpriteColour; public static ConfigEntry<string> VowSpriteColour; public static ConfigEntry<string> MarchSpriteColour; public static ConfigEntry<string> RendSpriteColour; public static ConfigEntry<string> DineSpriteColour; public static ConfigEntry<string> OffenseSpriteColour; public static ConfigEntry<string> TitanSpriteColour; public static ConfigEntry<string> ArtificeSpriteColour; public static ConfigEntry<string> AdamanceSpriteColour; public static ConfigEntry<string> EmbrionSpriteColour; public static ConfigEntry<string> GordionSpriteColour; public static ConfigEntry<string> ShipColour; public static ConfigEntry<bool> ClearOrphans; public static ConfigEntry<string> ConfigVersion; public static Material contourMaterial; public static Material radarFillMat0; public static Material radarFillMat1; public static Material radarWaterMat; public static bool batbyPresent = false; public static bool zaggyPresent = false; public static bool dopaPresent = false; public static bool spookyPresent = false; public static bool terraformerPresent = false; public static int[] configVersionArray = new int[3] { -1, -1, -1 }; private static float storedTime = 0f; public static UniversalRadar Instance { get; private set; } = null; internal static ManualLogSource Logger { get; private set; } = null; internal static Harmony? Harmony { get; set; } private void Awake() { //IL_0082: Unknown result type (might be due to invalid IL or missing references) //IL_008c: Expected O, but got Unknown //IL_00bf: Unknown result type (might be due to invalid IL or missing references) //IL_00c9: Expected O, but got Unknown //IL_013c: Unknown result type (might be due to invalid IL or missing references) //IL_0146: Expected O, but got Unknown //IL_0179: Unknown result type (might be due to invalid IL or missing references) //IL_0183: Expected O, but got Unknown //IL_01b6: Unknown result type (might be due to invalid IL or missing references) //IL_01c0: Expected O, but got Unknown //IL_0419: Unknown result type (might be due to invalid IL or missing references) //IL_041f: Expected O, but got Unknown //IL_05e9: Unknown result type (might be due to invalid IL or missing references) //IL_05f3: Expected O, but got Unknown //IL_0602: Unknown result type (might be due to invalid IL or missing references) //IL_060c: Expected O, but got Unknown //IL_061b: Unknown result type (might be due to invalid IL or missing references) //IL_0625: Expected O, but got Unknown //IL_0634: Unknown result type (might be due to invalid IL or missing references) //IL_063e: Expected O, but got Unknown Logger = ((BaseUnityPlugin)this).Logger; Instance = this; UseTerraMesh = ((BaseUnityPlugin)this).Config.Bind<bool>("!General", "Convert Terrains To Mesh", true, "When a moon has non-mesh terrain, it will be converted in order to generate the contour map. This will mean a long initial load on maps with non-mesh terrain (this includes most of Wesley's moons), but after the first time, it will store the generated mesh for the rest of the session. If this ends up taking way too long or even causing timeouts/crashes, you can disable it here (though any moons with non-mesh terrain will no longer have contour maps)."); HideRadarObjects = ((BaseUnityPlugin)this).Config.Bind<bool>("!General", "Master Disable Radar Objects", false, "Overrides all individual configs and will never attempt to create radar images for non-terrain objects."); RadarObjectSize = ((BaseUnityPlugin)this).Config.Bind<float>("!General", "Radar Object Display Threshold", 90f, new ConfigDescription("How big objects need to be to render as an object on the radar screen (if that config is enabled on the moon). Make this bigger to display less small objects.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(50f, 1000f), Array.Empty<object>())); CameraClipExtension = ((BaseUnityPlugin)this).Config.Bind<float>("!General", "Increased Radar Vertical Render Distance", 20f, new ConfigDescription("When outside, the region of space captured by the camera needs to be extended for the 3D contours generated by this mod to be captured. Increasing this means more objects/scenery above and below a player will be picked up on the radar screen (set this to 0 for vanilla clipping distance).", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0f, 150f), Array.Empty<object>())); RadarWater = ((BaseUnityPlugin)this).Config.Bind<bool>("!General", "Show Water On Radar", true, "Generates a special mesh for water objects on vanilla and modded moons."); ShowFoliage = ((BaseUnityPlugin)this).Config.Bind<bool>("!General", "Show Foliage Radar Objects", false, "Includes meshes on the foliage layer when generating radar objects."); AutoSpacing = ((BaseUnityPlugin)this).Config.Bind<float>("Automatic Settings", "Line Spacing", 2.5f, new ConfigDescription("Spacing between lines in automatically generated contour maps.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0.5f, 6f), Array.Empty<object>())); AutoLineWidth = ((BaseUnityPlugin)this).Config.Bind<float>("Automatic Settings", "Line Thickness", 6f, new ConfigDescription("Thickness of lines in automatically generated contour maps.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0.5f, 10f), Array.Empty<object>())); AutoOpacity = ((BaseUnityPlugin)this).Config.Bind<float>("Automatic Settings", "Maximum Opacity", 0.9f, new ConfigDescription("Maximum opacity of the shading on automatically generated contour maps (how light the tallest parts of the contour map will be).", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0.1f, 1f), Array.Empty<object>())); LogValues = ((BaseUnityPlugin)this).Config.Bind<bool>("Automatic Settings", "Log Automatic Values", false, "Logs all contour map values (notably the minimum and maximum height) upon generating on a moon. Use this if you want to know the normally calculated values before manually customizing them yourself (or for other debugging purposes)."); OldRadarFallback = ((BaseUnityPlugin)this).Config.Bind<bool>("Interior Radar Fallback", "Automatic Fallback To Old Radar", true, "If an interior is detected to lack radar sprites, the old pre-v70 radar will be used when a player is inside that interior."); UseDefaultLayer = ((BaseUnityPlugin)this).Config.Bind<bool>("Interior Radar Fallback", "Include Default Layer", false, "Prior to v70, only objects on the Room (and MapRadar) layers would appear on the radar. Enabling this allows objects on the Default layer (objects not assigned to any layer) to appear as well."); ShipInheritColour = ((BaseUnityPlugin)this).Config.Bind<bool>("Vanilla Radar Sprites", "Match Ship Sprite Colour To Radar", true, "Change the colour of the ship's sprite to match the radar object/sprite colour of whatever moon it's landed on."); ShipColour = ((BaseUnityPlugin)this).Config.Bind<string>("Vanilla Radar Sprites", "Ship Sprite Colour", "63FF5A", "The colour of the ship sprite at all times (will not work if the above option is enabled)."); ExperimentationSprites = ((BaseUnityPlugin)this).Config.Bind<bool>("Vanilla Radar Sprites", "Experimentation", true, "Adds new radar sprites for Experimentation, showing buildings, obstacles, catwalks, and more (will replace any vanilla radar objects)."); AssuranceSprites = ((BaseUnityPlugin)this).Config.Bind<bool>("Vanilla Radar Sprites", "Assurance", true, "Adds new radar sprites for Assurance, showing buildings, obstacles, catwalks, and more (will replace any vanilla radar objects)."); VowSprites = ((BaseUnityPlugin)this).Config.Bind<bool>("Vanilla Radar Sprites", "Vow", true, "Adds new radar sprites for Vow, showing buildings, obstacles, catwalks, and more (will replace any vanilla radar objects)."); MarchSprites = ((BaseUnityPlugin)this).Config.Bind<bool>("Vanilla Radar Sprites", "March", true, "Adds new radar sprites for March, showing buildings, obstacles, catwalks, and more (will replace any vanilla radar objects)."); RendSprites = ((BaseUnityPlugin)this).Config.Bind<bool>("Vanilla Radar Sprites", "Rend", true, "Adds new radar sprites for Rend, showing buildings, obstacles, catwalks, and more (will replace any vanilla radar objects)."); DineSprites = ((BaseUnityPlugin)this).Config.Bind<bool>("Vanilla Radar Sprites", "Dine", true, "Adds new radar sprites for Dine, showing buildings, obstacles, catwalks, and more (will replace any vanilla radar objects)."); OffenseSprites = ((BaseUnityPlugin)this).Config.Bind<bool>("Vanilla Radar Sprites", "Offense", true, "Adds new radar sprites for Offense, showing buildings, obstacles, catwalks, and more (will replace any vanilla radar objects)."); TitanSprites = ((BaseUnityPlugin)this).Config.Bind<bool>("Vanilla Radar Sprites", "Titan", true, "Adds new radar sprites for Titan, showing buildings, obstacles, catwalks, and more (will replace any vanilla radar objects)."); ArtificeSprites = ((BaseUnityPlugin)this).Config.Bind<bool>("Vanilla Radar Sprites", "Artifice", true, "Adds new radar sprites for Artifice, showing buildings, obstacles, catwalks, and more (will replace any vanilla radar objects)."); AdamanceSprites = ((BaseUnityPlugin)this).Config.Bind<bool>("Vanilla Radar Sprites", "Adamance", true, "Adds new radar sprites for Adamance, showing buildings, obstacles, catwalks, and more (will replace any vanilla radar objects)."); EmbrionSprites = ((BaseUnityPlugin)this).Config.Bind<bool>("Vanilla Radar Sprites", "Embrion", true, "Adds new radar sprites for Embrion, showing buildings, obstacles, catwalks, and more (will replace any vanilla radar objects)."); GordionSprites = ((BaseUnityPlugin)this).Config.Bind<bool>("Vanilla Radar Sprites", "Gordion", true, "Adds new radar sprites for Gordion, showing buildings, obstacles, catwalks, and more (will replace any vanilla radar objects)."); ClearOrphans = ((BaseUnityPlugin)this).Config.Bind<bool>("!Config Management", "Clear Orphaned Entries On Next Join", false, "This check box acts like a button which will only activate once then go back to being unchecked: after starting a game, all unused config data will be cleared. This means config entries associated with moons that are no longer installed or entries for modes which are no longer active for a given moon (e.g. if you switch a moon's mode from Manual to Automatic, the manual options will still be leftover in the file)."); string text = "-1.-1.-1"; ConfigDefinition key = new ConfigDefinition("!Config Management", "Config Version"); PropertyInfo property = ((object)((BaseUnityPlugin)this).Config).GetType().GetProperty("OrphanedEntries", BindingFlags.Instance | BindingFlags.NonPublic); Dictionary<ConfigDefinition, string> dictionary = (Dictionary<ConfigDefinition, string>)property.GetValue(((BaseUnityPlugin)this).Config, null); if (dictionary.TryGetValue(key, out var value)) { Logger.LogDebug((object)("Found config version: " + value + " > 1.2.3")); text = value; } ConfigVersion = ((BaseUnityPlugin)this).Config.Bind<string>("!Config Management", "Config Version", "-1.-1.-1", "Used for internal config tracking, please ignore."); string[] array = text.Split("."); if (array.Length != 3 || array.Any((string x) => !int.TryParse(x, out var _))) { Logger.LogWarning((object)"Invalid config version detected!"); array = new string[3] { "-1", "-1", "-1" }; ConfigVersion.Value = "-1.-1.-1"; } configVersionArray = Array.ConvertAll(array, (string x) => int.Parse(x)); batbyPresent = Chainloader.PluginInfos.ContainsKey("imabatby.lethallevelloader"); zaggyPresent = Chainloader.PluginInfos.ContainsKey("Zaggy1024.TwoRadarMaps"); dopaPresent = Chainloader.PluginInfos.ContainsKey("dopadream.lethalcompany.rebalancedmoons"); spookyPresent = Chainloader.PluginInfos.ContainsKey("MapImprovements"); terraformerPresent = Chainloader.PluginInfos.ContainsKey("TonightWeDine"); string directoryName = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location); URAssets = AssetBundle.LoadFromFile(Path.Combine(directoryName, "sburassets")); contourMaterial = (Material)URAssets.LoadAsset("ContourMat"); radarFillMat0 = (Material)URAssets.LoadAsset("RadarGreen0"); radarFillMat1 = (Material)URAssets.LoadAsset("RadarGreen1"); radarWaterMat = (Material)URAssets.LoadAsset("RadarBlue"); radarWaterMat.renderQueue = 1000; Patch(); Logger.LogInfo((object)"ScienceBird.UniversalRadar v1.2.3 has loaded!"); } public static void SetTime() { storedTime = Time.realtimeSinceStartup; } public static float GetTime() { return Time.realtimeSinceStartup - storedTime; } internal static void Patch() { //IL_000d: Unknown result type (might be due to invalid IL or missing references) //IL_0012: Unknown result type (might be due to invalid IL or missing references) //IL_0018: Expected O, but got Unknown if (Harmony == null) { Harmony = new Harmony("ScienceBird.UniversalRadar"); } Logger.LogDebug((object)"Patching..."); Harmony.PatchAll(); Logger.LogDebug((object)"Finished patching!"); } internal static void Unpatch() { Logger.LogDebug((object)"Unpatching..."); Harmony? harmony = Harmony; if (harmony != null) { harmony.UnpatchSelf(); } Logger.LogDebug((object)"Finished unpatching!"); } } public static class MyPluginInfo { public const string PLUGIN_GUID = "ScienceBird.UniversalRadar"; public const string PLUGIN_NAME = "UniversalRadar"; public const string PLUGIN_VERSION = "1.2.3"; } } namespace UniversalRadar.Patches { [HarmonyPatch] public class ConfigPatch { public static List<(MaterialPropertiesConfig, (string, string))> vanillaConfigs = new List<(MaterialPropertiesConfig, (string, string))>(); public static List<(string, string)> moonBlacklist = new List<(string, string)>(); public static Dictionary<string, string> vanillaSceneDict = new Dictionary<string, string>(); public static readonly Vector4 defaultContourGreen = new Vector4(0.3019608f, 0.4156863f, 0.2745098f, 1f); public static readonly Vector4 defaultRadarGreen = new Vector4(33f / 85f, 1f, 0.3529412f, 1f); public static readonly Vector4 defaultCameraGreen = new Vector4(0f, 0.02745098f, 0.003921569f, 0f); public static readonly Vector4 defaultSpriteGreenDark = new Vector4(0.1941176f, 0.5f, 0.1764706f, 1f); public static readonly Vector4 defaultSpriteGreenDarker = new Vector4(0.1530435f, 0.4f, 0.1391305f, 1f); public static Dictionary<string, (GameObject, string)> radarSpritePrefabs = new Dictionary<string, (GameObject, string)>(); public static Dictionary<string, (GameObject, string)> fixedRadarSpritePrefabs = new Dictionary<string, (GameObject, string)>(); [HarmonyPatch(typeof(QuickMenuManager), "Start")] [HarmonyPostfix] [HarmonyAfter(new string[] { "imabatby.lethallevelloader", "dopadream.lethalcompany.rebalancedmoons" })] public static void OnStartInitialize() { UniversalRadar.SetTime(); RadarContourPatches.loaded = false; vanillaSceneDict.Clear(); vanillaSceneDict.Add("41 Experimentation", "Level1Experimentation"); vanillaSceneDict.Add("220 Assurance", "Level2Assurance"); vanillaSceneDict.Add("56 Vow", "Level3Vow"); vanillaSceneDict.Add("61 March", "Level4March"); vanillaSceneDict.Add("85 Rend", "Level5Rend"); vanillaSceneDict.Add("7 Dine", "Level6Dine"); vanillaSceneDict.Add("21 Offense", "Level7Offense"); vanillaSceneDict.Add("8 Titan", "Level8Titan"); vanillaSceneDict.Add("68 Artifice", "Level9Artifice"); vanillaSceneDict.Add("20 Adamance", "Level10Adamance"); vanillaSceneDict.Add("5 Embrion", "Level11Embrion"); vanillaSceneDict.Add("71 Gordion", "CompanyBuilding"); if (UniversalRadar.batbyPresent) { LLLConfigPatch.SceneNamePatch(); } vanillaConfigs.Clear(); UniversalRadar.ExperimentationSpriteColour = ((BaseUnityPlugin)UniversalRadar.Instance).Config.Bind<string>("Moon Overrides (Colour) - Vanilla", "41 Experimentation - Sprite Colour Hex Code", "63FF5A", "The colour of the radar sprites on Experimentation."); vanillaConfigs.Add((new MaterialPropertiesConfig("41 Experimentation", "Vanilla", "Auto", show: false, lowOpacity: false, extend: false, 2f, 2.5f, 6f, -10f, 30f, 0.9f, new ColourProperties("41 Experimentation", "Vanilla", "4D6A46", "4D6A46", "63FF5A", "000701")), ("41 Experimentation", vanillaSceneDict["41 Experimentation"]))); UniversalRadar.AssuranceSpriteColour = ((BaseUnityPlugin)UniversalRadar.Instance).Config.Bind<string>("Moon Overrides (Colour) - Vanilla", "220 Assurance - Sprite Colour Hex Code", "63FF5A", "The colour of the radar sprites on Assurance."); vanillaConfigs.Add((new MaterialPropertiesConfig("220 Assurance", "Vanilla", "Auto", show: false, lowOpacity: false, extend: false, 2f, 2.5f, 6f, -10f, 30f, 0.9f, new ColourProperties("220 Assurance", "Vanilla", "4D6A46", "4D6A46", "63FF5A", "000701")), ("220 Assurance", vanillaSceneDict["220 Assurance"]))); UniversalRadar.VowSpriteColour = ((BaseUnityPlugin)UniversalRadar.Instance).Config.Bind<string>("Moon Overrides (Colour) - Vanilla", "56 Vow - Sprite Colour Hex Code", "63FF5A", "The colour of the radar sprites on Vow."); vanillaConfigs.Add((new MaterialPropertiesConfig("56 Vow", "Vanilla", "Manual", show: false, lowOpacity: false, extend: false, 2f, 2.5f, 6f, -20f, 20f, 0.9f, new ColourProperties("56 Vow", "Vanilla", "4D6A46", "4D6A46", "63FF5A", "000701")), ("56 Vow", vanillaSceneDict["56 Vow"]))); UniversalRadar.MarchSpriteColour = ((BaseUnityPlugin)UniversalRadar.Instance).Config.Bind<string>("Moon Overrides (Colour) - Vanilla", "61 March - Sprite Colour Hex Code", "63FF5A", "The colour of the radar sprites on March."); vanillaConfigs.Add((new MaterialPropertiesConfig("61 March", "Vanilla", "Auto", show: false, lowOpacity: false, extend: false, 2f, 2.5f, 6f, -10f, 30f, 0.9f, new ColourProperties("61 March", "Vanilla", "4D6A46", "4D6A46", "63FF5A", "000701")), ("61 March", vanillaSceneDict["61 March"]))); UniversalRadar.RendSpriteColour = ((BaseUnityPlugin)UniversalRadar.Instance).Config.Bind<string>("Moon Overrides (Colour) - Vanilla", "85 Rend - Sprite Colour Hex Code", "63FF5A", "The colour of the radar sprites on Rend."); vanillaConfigs.Add((new MaterialPropertiesConfig("85 Rend", "Vanilla", "Auto", show: false, lowOpacity: false, extend: false, 2f, 2.5f, 6f, -10f, 30f, 0.9f, new ColourProperties("85 Rend", "Vanilla", "4D6A46", "4D6A46", "63FF5A", "000701")), ("85 Rend", vanillaSceneDict["85 Rend"]))); UniversalRadar.DineSpriteColour = ((BaseUnityPlugin)UniversalRadar.Instance).Config.Bind<string>("Moon Overrides (Colour) - Vanilla", "7 Dine - Sprite Colour Hex Code", "63FF5A", "The colour of the radar sprites on Dine."); vanillaConfigs.Add((new MaterialPropertiesConfig("7 Dine", "Vanilla", "Manual", show: false, lowOpacity: false, extend: false, 2f, 2.5f, 6f, -27f, 17f, 0.9f, new ColourProperties("7 Dine", "Vanilla", "4D6A46", "4D6A46", "63FF5A", "000701")), ("7 Dine", vanillaSceneDict["7 Dine"]))); UniversalRadar.OffenseSpriteColour = ((BaseUnityPlugin)UniversalRadar.Instance).Config.Bind<string>("Moon Overrides (Colour) - Vanilla", "21 Offense - Sprite Colour Hex Code", "63FF5A", "The colour of the radar sprites on Offense."); vanillaConfigs.Add((new MaterialPropertiesConfig("21 Offense", "Vanilla", "Auto", show: false, lowOpacity: false, extend: false, 2f, 2.5f, 6f, -10f, 30f, 0.9f, new ColourProperties("21 Offense", "Vanilla", "4D6A46", "4D6A46", "63FF5A", "000701")), ("21 Offense", vanillaSceneDict["21 Offense"]))); UniversalRadar.TitanSpriteColour = ((BaseUnityPlugin)UniversalRadar.Instance).Config.Bind<string>("Moon Overrides (Colour) - Vanilla", "8 Titan - Sprite Colour Hex Code", "63FF5A", "The colour of the radar sprites on Titan."); vanillaConfigs.Add((new MaterialPropertiesConfig("8 Titan", "Vanilla", "Auto", show: false, lowOpacity: false, extend: true, 0.75f, 2.5f, 6f, -10f, 30f, 0.9f, new ColourProperties("8 Titan", "Vanilla", "4D6A46", "4D6A46", "63FF5A", "000701")), ("8 Titan", vanillaSceneDict["8 Titan"]))); UniversalRadar.ArtificeSpriteColour = ((BaseUnityPlugin)UniversalRadar.Instance).Config.Bind<string>("Moon Overrides (Colour) - Vanilla", "68 Artifice - Sprite Colour Hex Code", "63FF5A", "The colour of the radar sprites on Artifice."); vanillaConfigs.Add((new MaterialPropertiesConfig("68 Artifice", "Vanilla", "Auto", show: false, lowOpacity: false, extend: false, 2f, 2.5f, 6f, -10f, 30f, 0.9f, new ColourProperties("68 Artifice", "Vanilla", "4D6A46", "4D6A46", "63FF5A", "000701")), ("68 Artifice", vanillaSceneDict["68 Artifice"]))); UniversalRadar.AdamanceSpriteColour = ((BaseUnityPlugin)UniversalRadar.Instance).Config.Bind<string>("Moon Overrides (Colour) - Vanilla", "20 Adamance - Sprite Colour Hex Code", "63FF5A", "The colour of the radar sprites on Adamance."); vanillaConfigs.Add((new MaterialPropertiesConfig("20 Adamance", "Vanilla", "Manual", show: false, lowOpacity: false, extend: false, 2f, 2.5f, 6f, -30f, 23f, 0.9f, new ColourProperties("20 Adamance", "Vanilla", "4D6A46", "4D6A46", "63FF5A", "000701")), ("20 Adamance", vanillaSceneDict["20 Adamance"]))); UniversalRadar.EmbrionSpriteColour = ((BaseUnityPlugin)UniversalRadar.Instance).Config.Bind<string>("Moon Overrides (Colour) - Vanilla", "5 Embrion - Sprite Colour Hex Code", "63FF5A", "The colour of the radar sprites on Embrion."); vanillaConfigs.Add((new MaterialPropertiesConfig("5 Embrion", "Vanilla", "Auto", show: false, lowOpacity: false, extend: false, 2f, 2.5f, 6f, -10f, 30f, 0.9f, new ColourProperties("5 Embrion", "Vanilla", "4D6A46", "4D6A46", "63FF5A", "000701")), ("5 Embrion", vanillaSceneDict["5 Embrion"]))); UniversalRadar.GordionSpriteColour = ((BaseUnityPlugin)UniversalRadar.Instance).Config.Bind<string>("Moon Overrides (Colour) - Vanilla", "71 Gordion - Sprite Colour Hex Code", "63FF5A", "The colour of the radar sprites on Gordion."); vanillaConfigs.Add((new MaterialPropertiesConfig("71 Gordion", "Vanilla", "Ignore", show: false, lowOpacity: false, extend: false, 2f, 2.5f, 6f, -10f, 30f, 0.9f, new ColourProperties("71 Gordion", "Vanilla", "4D6A46", "4D6A46", "63FF5A", "000701")), ("71 Gordion", vanillaSceneDict["71 Gordion"]))); radarSpritePrefabs.Clear(); if (UniversalRadar.ExperimentationSprites.Value) { RegisterSprites("41 Experimentation", "ExperimentationRadarSprites", UniversalRadar.ExperimentationSpriteColour.Value, hasStatic: true); } if (UniversalRadar.AssuranceSprites.Value) { RegisterSprites("220 Assurance", "AssuranceRadarSprites", UniversalRadar.AssuranceSpriteColour.Value, hasStatic: true); } if (UniversalRadar.VowSprites.Value) { RegisterSprites("56 Vow", "VowRadarSprites", UniversalRadar.VowSpriteColour.Value); } if (UniversalRadar.MarchSprites.Value) { RegisterSprites("61 March", "MarchRadarSprites", UniversalRadar.MarchSpriteColour.Value, hasStatic: true); } if (UniversalRadar.RendSprites.Value) { RegisterSprites("85 Rend", "RendRadarSprites", UniversalRadar.RendSpriteColour.Value, hasStatic: true); } if (UniversalRadar.DineSprites.Value) { RegisterSprites("7 Dine", "DineRadarSprites", UniversalRadar.DineSpriteColour.Value); } if (UniversalRadar.OffenseSprites.Value) { RegisterSprites("21 Offense", "OffenseRadarSprites", UniversalRadar.OffenseSpriteColour.Value, hasStatic: true); } if (UniversalRadar.TitanSprites.Value) { RegisterSprites("8 Titan", "TitanRadarSprites", UniversalRadar.TitanSpriteColour.Value, hasStatic: true); } if (UniversalRadar.ArtificeSprites.Value) { RegisterSprites("68 Artifice", "ArtificeRadarSprites", UniversalRadar.ArtificeSpriteColour.Value); } if (UniversalRadar.AdamanceSprites.Value) { RegisterSprites("20 Adamance", "AdamanceRadarSprites", UniversalRadar.AdamanceSpriteColour.Value); } if (UniversalRadar.EmbrionSprites.Value) { RegisterSprites("5 Embrion", "EmbrionRadarSprites", UniversalRadar.EmbrionSpriteColour.Value); } if (UniversalRadar.GordionSprites.Value) { RegisterSprites("71 Gordion", "GordionRadarSprites", UniversalRadar.GordionSpriteColour.Value, hasStatic: true, staticOnly: true); } foreach (var vanillaConfig in vanillaConfigs) { if (!RadarContourPatches.contourDataDict.ContainsKey(vanillaConfig.Item2)) { RadarContourPatches.contourDataDict.Add(vanillaConfig.Item2, new MaterialProperties(vanillaConfig.Item1)); } } if (UniversalRadar.batbyPresent) { LLLConfigPatch.OnStartInitialize(); } ConfigReassignmentPatch.CheckOrphans(); if (UniversalRadar.ClearOrphans.Value) { PropertyInfo property = ((object)((BaseUnityPlugin)UniversalRadar.Instance).Config).GetType().GetProperty("OrphanedEntries", BindingFlags.Instance | BindingFlags.NonPublic); Dictionary<ConfigDefinition, string> dictionary = (Dictionary<ConfigDefinition, string>)property.GetValue(((BaseUnityPlugin)UniversalRadar.Instance).Config, null); dictionary.Clear(); UniversalRadar.ClearOrphans.Value = false; } UniversalRadar.ConfigVersion.Value = "1.2.3"; ((BaseUnityPlugin)UniversalRadar.Instance).Config.Save(); UniversalRadar.Logger.LogDebug((object)$"Config processing complete ({UniversalRadar.GetTime()}s)"); } private static void RegisterSprites(string moon, string assetName, string colourHex, bool hasStatic = false, bool staticOnly = false) { //IL_0016: Unknown result type (might be due to invalid IL or missing references) //IL_001b: Unknown result type (might be due to invalid IL or missing references) //IL_001c: Unknown result type (might be due to invalid IL or missing references) //IL_030a: Unknown result type (might be due to invalid IL or missing references) //IL_0319: Expected O, but got Unknown //IL_0074: Unknown result type (might be due to invalid IL or missing references) //IL_007f: Expected O, but got Unknown //IL_0368: Unknown result type (might be due to invalid IL or missing references) //IL_0377: Expected O, but got Unknown //IL_00df: Unknown result type (might be due to invalid IL or missing references) //IL_00e0: Unknown result type (might be due to invalid IL or missing references) //IL_00e5: Unknown result type (might be due to invalid IL or missing references) //IL_00ed: Unknown result type (might be due to invalid IL or missing references) //IL_00f2: Unknown result type (might be due to invalid IL or missing references) //IL_00fb: Unknown result type (might be due to invalid IL or missing references) //IL_0100: 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_00d9: Expected O, but got Unknown //IL_0144: Unknown result type (might be due to invalid IL or missing references) //IL_0149: Unknown result type (might be due to invalid IL or missing references) //IL_014e: 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_0228: Unknown result type (might be due to invalid IL or missing references) //IL_022d: Unknown result type (might be due to invalid IL or missing references) //IL_0173: 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_017d: 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_0252: Unknown result type (might be due to invalid IL or missing references) //IL_0257: Unknown result type (might be due to invalid IL or missing references) //IL_025c: Unknown result type (might be due to invalid IL or missing references) //IL_0243: 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_01ad: Unknown result type (might be due to invalid IL or missing references) //IL_0193: Unknown result type (might be due to invalid IL or missing references) //IL_0282: Unknown result type (might be due to invalid IL or missing references) //IL_0287: Unknown result type (might be due to invalid IL or missing references) //IL_028c: Unknown result type (might be due to invalid IL or missing references) //IL_0272: Unknown result type (might be due to invalid IL or missing references) //IL_01c3: Unknown result type (might be due to invalid IL or missing references) //IL_02a2: Unknown result type (might be due to invalid IL or missing references) if (colourHex != "63FF5A") { Vector4 val = ColourProperties.ColourFromHex(colourHex); if (val.x >= 0f) { if (!staticOnly && !radarSpritePrefabs.ContainsKey(vanillaSceneDict[moon])) { radarSpritePrefabs.Add(vanillaSceneDict[moon], ((GameObject)UniversalRadar.URAssets.LoadAsset(assetName), colourHex)); } if (hasStatic && !fixedRadarSpritePrefabs.ContainsKey(vanillaSceneDict[moon])) { fixedRadarSpritePrefabs.Add(vanillaSceneDict[moon], ((GameObject)UniversalRadar.URAssets.LoadAsset(assetName + "Static"), colourHex)); } Color color = Color.op_Implicit(val); Color color2 = ((Color)(ref color)).RGBMultiplied(0.5f); Color color3 = ((Color)(ref color)).RGBMultiplied(0.4f); if (!staticOnly) { GameObject item = radarSpritePrefabs[vanillaSceneDict[moon]].Item1; SpriteRenderer[] componentsInChildren = item.GetComponentsInChildren<SpriteRenderer>(); for (int i = 0; i < componentsInChildren.Length; i++) { if (componentsInChildren[i].color == Color.op_Implicit(defaultRadarGreen)) { componentsInChildren[i].color = color; } else if (componentsInChildren[i].color == Color.op_Implicit(defaultSpriteGreenDark)) { componentsInChildren[i].color = color2; } else if (componentsInChildren[i].color == Color.op_Implicit(defaultSpriteGreenDarker)) { componentsInChildren[i].color = color3; } } } if (!hasStatic) { return; } GameObject item2 = fixedRadarSpritePrefabs[vanillaSceneDict[moon]].Item1; SpriteRenderer[] componentsInChildren2 = item2.GetComponentsInChildren<SpriteRenderer>(); for (int j = 0; j < componentsInChildren2.Length; j++) { if (componentsInChildren2[j].color == Color.op_Implicit(defaultRadarGreen)) { componentsInChildren2[j].color = color; } else if (componentsInChildren2[j].color == Color.op_Implicit(defaultSpriteGreenDark)) { componentsInChildren2[j].color = color2; } else if (componentsInChildren2[j].color == Color.op_Implicit(defaultSpriteGreenDarker)) { componentsInChildren2[j].color = color3; } } return; } } if (!staticOnly && !radarSpritePrefabs.ContainsKey(vanillaSceneDict[moon])) { radarSpritePrefabs.Add(vanillaSceneDict[moon], ((GameObject)UniversalRadar.URAssets.LoadAsset(assetName), "63FF5A")); } if (hasStatic && !fixedRadarSpritePrefabs.ContainsKey(vanillaSceneDict[moon])) { fixedRadarSpritePrefabs.Add(vanillaSceneDict[moon], ((GameObject)UniversalRadar.URAssets.LoadAsset(assetName + "Static"), "63FF5A")); } } public static bool OlderConfigVersion(int[] targetVersion) { if (UniversalRadar.configVersionArray.Length == 3 && targetVersion.Length == 3) { for (int i = 0; i < 3; i++) { if (UniversalRadar.configVersionArray[i] != targetVersion[i]) { if (UniversalRadar.configVersionArray[i] < targetVersion[i]) { return true; } return false; } } } return false; } } public class MaterialPropertiesConfig { public ConfigEntry<string> mode; public ConfigEntry<bool> showObjects; public ConfigEntry<bool> lowObjectOpacity; public ConfigEntry<bool> extendHeight; public ConfigEntry<float> lineSpacing; public ConfigEntry<float> lineThickness; public ConfigEntry<float> minHeight; public ConfigEntry<float> maxHeight; public ConfigEntry<float> opacityCap; public ConfigEntry<float> opacityMult; public ColourProperties colours; public MaterialPropertiesConfig(string moon, string vanilla, string defaultMode, bool show, bool lowOpacity, bool extend, float multiplier, float spacing, float thickness, float min, float max, float opacity, ColourProperties colourProps) { //IL_00b8: Unknown result type (might be due to invalid IL or missing references) //IL_00c2: Expected O, but got Unknown //IL_0181: Unknown result type (might be due to invalid IL or missing references) //IL_018b: Expected O, but got Unknown //IL_023c: Unknown result type (might be due to invalid IL or missing references) //IL_0246: Expected O, but got Unknown //IL_0287: Unknown result type (might be due to invalid IL or missing references) //IL_0291: Expected O, but got Unknown //IL_02d2: Unknown result type (might be due to invalid IL or missing references) //IL_02dc: Expected O, but got Unknown //IL_031d: Unknown result type (might be due to invalid IL or missing references) //IL_0327: Expected O, but got Unknown //IL_0368: Unknown result type (might be due to invalid IL or missing references) //IL_0372: Expected O, but got Unknown string text = moon.Replace("\n", "").Replace("\t", "").Replace("\\", "") .Replace("\"", "") .Replace("'", "") .Replace("[", "") .Replace("]", ""); mode = ((BaseUnityPlugin)UniversalRadar.Instance).Config.Bind<string>("Moon Overrides - " + vanilla, text, defaultMode, new ConfigDescription("'Auto' - Automatically generate a contour map at runtime. 'Manual' - Set values yourself for generating the contour map (after setting this, create a new lobby to refresh config). 'Ignore' - Do not change this moon in any way.", (AcceptableValueBase)(object)new AcceptableValueList<string>(new string[3] { "Auto", "Manual", "Ignore" }), Array.Empty<object>())); showObjects = ((BaseUnityPlugin)UniversalRadar.Instance).Config.Bind<bool>("Moon Overrides - " + vanilla, text + " - Show Radar Objects", show, "Some objects on the map will be rendered on the radar screen as well."); lowObjectOpacity = ((BaseUnityPlugin)UniversalRadar.Instance).Config.Bind<bool>("Moon Overrides - " + vanilla, text + " - More Translucent Radar Objects", lowOpacity, "Automatically generated radar objects from the above option will display with more transparency. This is recommended when a moon features extensive navigable structures that might normally make excessively bright layered radar sprites."); if (mode.Value != "Ignore") { opacityMult = ((BaseUnityPlugin)UniversalRadar.Instance).Config.Bind<float>("Moon Overrides - " + vanilla, text + " - Opacity Multiplier", multiplier, new ConfigDescription("Opacity multiplier of the shading on this moon's contour map (all shading levels will be multiplied by this number, set higher to make shading generally lighter/higher contrast).", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0.1f, 5f), Array.Empty<object>())); } if (mode.Value == "Auto") { extendHeight = ((BaseUnityPlugin)UniversalRadar.Instance).Config.Bind<bool>("Moon Overrides - " + vanilla, text + " - Broader Height Range", extend, "When automatically determining this moon's height range for shading, it will cover a large range of heights than normal (try enabling this if contour shading on a moon becomes too bright too quickly)."); } else if (mode.Value == "Manual") { lineSpacing = ((BaseUnityPlugin)UniversalRadar.Instance).Config.Bind<float>("Moon Overrides - " + vanilla, text + " - Line Spacing", spacing, new ConfigDescription("Spacing between lines on the contour map for this moon.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0.5f, 6f), Array.Empty<object>())); lineThickness = ((BaseUnityPlugin)UniversalRadar.Instance).Config.Bind<float>("Moon Overrides - " + vanilla, text + " - Line Thickness", thickness, new ConfigDescription("Thickness of lines on the contour map for this moon.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0.5f, 8f), Array.Empty<object>())); minHeight = ((BaseUnityPlugin)UniversalRadar.Instance).Config.Bind<float>("Moon Overrides - " + vanilla, text + " - Shading Minimum", min, new ConfigDescription("Minimum height for contour shading (height where darkest shade starts).", (AcceptableValueBase)(object)new AcceptableValueRange<float>(-500f, 500f), Array.Empty<object>())); maxHeight = ((BaseUnityPlugin)UniversalRadar.Instance).Config.Bind<float>("Moon Overrides - " + vanilla, text + " - Shading Maximum", max, new ConfigDescription("Maximum height for contour shading (height where the shade becomes lightest).", (AcceptableValueBase)(object)new AcceptableValueRange<float>(-500f, 500f), Array.Empty<object>())); opacityCap = ((BaseUnityPlugin)UniversalRadar.Instance).Config.Bind<float>("Moon Overrides - " + vanilla, text + " - Maximum Opacity", opacity, new ConfigDescription("Maximum opacity of contour shading for this moon (how light the tallest parts of the contour map will be).", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0.1f, 1f), Array.Empty<object>())); } colours = colourProps; } public MaterialPropertiesConfig(string moon, string vanilla, LLLConfigPatch.MaterialPropertiesValues propertyValues) { //IL_00bd: Unknown result type (might be due to invalid IL or missing references) //IL_00c7: Expected O, but got Unknown //IL_0192: Unknown result type (might be due to invalid IL or missing references) //IL_019c: Expected O, but got Unknown //IL_0255: Unknown result type (might be due to invalid IL or missing references) //IL_025f: Expected O, but got Unknown //IL_02a4: Unknown result type (might be due to invalid IL or missing references) //IL_02ae: Expected O, but got Unknown //IL_02f3: Unknown result type (might be due to invalid IL or missing references) //IL_02fd: Expected O, but got Unknown //IL_0342: Unknown result type (might be due to invalid IL or missing references) //IL_034c: Expected O, but got Unknown //IL_0391: Unknown result type (might be due to invalid IL or missing references) //IL_039b: Expected O, but got Unknown string text = moon.Replace("\n", "").Replace("\t", "").Replace("\\", "") .Replace("\"", "") .Replace("'", "") .Replace("[", "") .Replace("]", ""); mode = ((BaseUnityPlugin)UniversalRadar.Instance).Config.Bind<string>("Moon Overrides - " + vanilla, text, propertyValues.mode, new ConfigDescription("'Auto' - Automatically generate a contour map at runtime. 'Manual' - Set values yourself for generating the contour map (after setting this, create a new lobby to refresh config). 'Ignore' - Do not change this moon in any way.", (AcceptableValueBase)(object)new AcceptableValueList<string>(new string[3] { "Auto", "Manual", "Ignore" }), Array.Empty<object>())); showObjects = ((BaseUnityPlugin)UniversalRadar.Instance).Config.Bind<bool>("Moon Overrides - " + vanilla, text + " - Show Radar Objects", propertyValues.showObjects, "Some objects on the map will be rendered on the radar screen as well."); lowObjectOpacity = ((BaseUnityPlugin)UniversalRadar.Instance).Config.Bind<bool>("Moon Overrides - " + vanilla, text + " - More Translucent Radar Objects", propertyValues.lowObjectOpacity, "Automatically generated radar objects from the above option will display with more transparency. This is recommended when a moon features extensive navigable structures that might normally make excessively bright layered radar sprites."); if (mode.Value != "Ignore") { opacityMult = ((BaseUnityPlugin)UniversalRadar.Instance).Config.Bind<float>("Moon Overrides - " + vanilla, text + " - Opacity Multiplier", propertyValues.opacityMult, new ConfigDescription("Opacity multiplier of the shading on this moon's contour map (all shading levels will be multiplied by this number, set higher to make shading generally lighter/higher contrast).", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0.1f, 5f), Array.Empty<object>())); } if (mode.Value == "Auto") { extendHeight = ((BaseUnityPlugin)UniversalRadar.Instance).Config.Bind<bool>("Moon Overrides - " + vanilla, text + " - Broader Height Range", propertyValues.extendHeight, "When automatically determining this moon's height range for shading, it will cover a large range of heights than normal (try enabling this if contour shading on a moon becomes too bright too quickly)."); } else if (mode.Value == "Manual") { lineSpacing = ((BaseUnityPlugin)UniversalRadar.Instance).Config.Bind<float>("Moon Overrides - " + vanilla, text + " - Line Spacing", propertyValues.lineSpacing, new ConfigDescription("Spacing between lines on the contour map for this moon.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0.5f, 6f), Array.Empty<object>())); lineThickness = ((BaseUnityPlugin)UniversalRadar.Instance).Config.Bind<float>("Moon Overrides - " + vanilla, text + " - Line Thickness", propertyValues.lineThickness, new ConfigDescription("Thickness of lines on the contour map for this moon.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0.5f, 8f), Array.Empty<object>())); minHeight = ((BaseUnityPlugin)UniversalRadar.Instance).Config.Bind<float>("Moon Overrides - " + vanilla, text + " - Shading Minimum", propertyValues.minHeight, new ConfigDescription("Minimum height for contour shading (height where darkest shade starts).", (AcceptableValueBase)(object)new AcceptableValueRange<float>(-500f, 500f), Array.Empty<object>())); maxHeight = ((BaseUnityPlugin)UniversalRadar.Instance).Config.Bind<float>("Moon Overrides - " + vanilla, text + " - Shading Maximum", propertyValues.maxHeight, new ConfigDescription("Maximum height for contour shading (height where the shade becomes lightest).", (AcceptableValueBase)(object)new AcceptableValueRange<float>(-500f, 500f), Array.Empty<object>())); opacityCap = ((BaseUnityPlugin)UniversalRadar.Instance).Config.Bind<float>("Moon Overrides - " + vanilla, text + " - Maximum Opacity", propertyValues.opacityCap, new ConfigDescription("Maximum opacity of contour shading for this moon (how light the tallest parts of the contour map will be).", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0.1f, 1f), Array.Empty<object>())); } colours = new ColourProperties(moon, vanilla, propertyValues.baseColourHex, propertyValues.lineColourHex, propertyValues.radarColourHex, propertyValues.bgColourHex); } public void SetValues(string moon, string vanilla, LLLConfigPatch.MaterialPropertiesValues propertyValues) { //IL_01b6: Unknown result type (might be due to invalid IL or missing references) //IL_01c0: Expected O, but got Unknown //IL_0171: Unknown result type (might be due to invalid IL or missing references) //IL_017b: Expected O, but got Unknown //IL_0257: Unknown result type (might be due to invalid IL or missing references) //IL_0261: Expected O, but got Unknown //IL_04c7: Unknown result type (might be due to invalid IL or missing references) //IL_04d1: Expected O, but got Unknown //IL_04f2: Unknown result type (might be due to invalid IL or missing references) //IL_04fc: Expected O, but got Unknown //IL_051d: Unknown result type (might be due to invalid IL or missing references) //IL_0527: Expected O, but got Unknown //IL_0548: Unknown result type (might be due to invalid IL or missing references) //IL_0552: Expected O, but got Unknown //IL_0573: Unknown result type (might be due to invalid IL or missing references) //IL_057d: Expected O, but got Unknown //IL_02d1: Unknown result type (might be due to invalid IL or missing references) //IL_02db: Expected O, but got Unknown //IL_032f: Unknown result type (might be due to invalid IL or missing references) //IL_0339: Expected O, but got Unknown //IL_038d: Unknown result type (might be due to invalid IL or missing references) //IL_0397: Expected O, but got Unknown //IL_03eb: Unknown result type (might be due to invalid IL or missing references) //IL_03f5: Expected O, but got Unknown //IL_0449: Unknown result type (might be due to invalid IL or missing references) //IL_0453: Expected O, but got Unknown string text = moon.Replace("\n", "").Replace("\t", "").Replace("\\", "") .Replace("\"", "") .Replace("'", "") .Replace("[", "") .Replace("]", ""); mode.Value = propertyValues.mode; showObjects.Value = propertyValues.showObjects; lowObjectOpacity.Value = propertyValues.lowObjectOpacity; colours.baseColourHex.Value = propertyValues.baseColourHex; colours.lineColourHex.Value = propertyValues.lineColourHex; colours.radarColourHex.Value = propertyValues.radarColourHex; colours.bgColourHex.Value = propertyValues.bgColourHex; colours.SetColours(); if (mode.Value != "Ignore") { if (opacityMult == null) { opacityMult = ((BaseUnityPlugin)UniversalRadar.Instance).Config.Bind<float>("Moon Overrides - " + vanilla, text + " - Opacity Multiplier", propertyValues.opacityMult, new ConfigDescription("Opacity multiplier of the shading on this moon's contour map (all shading levels will be multiplied by this number, set higher to make shading generally lighter/higher contrast).", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0.1f, 5f), Array.Empty<object>())); } opacityMult.Value = propertyValues.opacityMult; } else { ((BaseUnityPlugin)UniversalRadar.Instance).Config.Remove(new ConfigDefinition("Moon Overrides - " + vanilla, text + " - Opacity Multiplier")); } if (mode.Value == "Auto") { if (extendHeight == null) { extendHeight = ((BaseUnityPlugin)UniversalRadar.Instance).Config.Bind<bool>("Moon Overrides - " + vanilla, text + " - Broader Height Range", propertyValues.extendHeight, "When automatically determining this moon's height range for shading, it will cover a large range of heights than normal (try enabling this if contour shading on a moon becomes too bright too quickly)."); } extendHeight.Value = propertyValues.extendHeight; } else { ((BaseUnityPlugin)UniversalRadar.Instance).Config.Remove(new ConfigDefinition("Moon Overrides - " + vanilla, text + " - Broader Height Range")); } if (mode.Value == "Manual") { if (lineSpacing == null) { lineSpacing = ((BaseUnityPlugin)UniversalRadar.Instance).Config.Bind<float>("Moon Overrides - " + vanilla, text + " - Line Spacing", propertyValues.lineSpacing, new ConfigDescription("Spacing between lines on the contour map for this moon.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0.5f, 6f), Array.Empty<object>())); } if (lineThickness == null) { lineThickness = ((BaseUnityPlugin)UniversalRadar.Instance).Config.Bind<float>("Moon Overrides - " + vanilla, text + " - Line Thickness", propertyValues.lineThickness, new ConfigDescription("Thickness of lines on the contour map for this moon.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0.5f, 8f), Array.Empty<object>())); } if (minHeight == null) { minHeight = ((BaseUnityPlugin)UniversalRadar.Instance).Config.Bind<float>("Moon Overrides - " + vanilla, text + " - Shading Minimum", propertyValues.minHeight, new ConfigDescription("Minimum height for contour shading (height where darkest shade starts).", (AcceptableValueBase)(object)new AcceptableValueRange<float>(-500f, 500f), Array.Empty<object>())); } if (maxHeight == null) { maxHeight = ((BaseUnityPlugin)UniversalRadar.Instance).Config.Bind<float>("Moon Overrides - " + vanilla, text + " - Shading Maximum", propertyValues.maxHeight, new ConfigDescription("Maximum height for contour shading (height where the shade becomes lightest).", (AcceptableValueBase)(object)new AcceptableValueRange<float>(-500f, 500f), Array.Empty<object>())); } if (opacityCap == null) { opacityCap = ((BaseUnityPlugin)UniversalRadar.Instance).Config.Bind<float>("Moon Overrides - " + vanilla, text + " - Maximum Opacity", propertyValues.opacityCap, new ConfigDescription("Maximum opacity of contour shading for this moon (how light the tallest parts of the contour map will be).", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0.1f, 1f), Array.Empty<object>())); } lineSpacing.Value = propertyValues.lineSpacing; lineThickness.Value = propertyValues.lineThickness; minHeight.Value = propertyValues.minHeight; maxHeight.Value = propertyValues.maxHeight; } else { ((BaseUnityPlugin)UniversalRadar.Instance).Config.Remove(new ConfigDefinition("Moon Overrides - " + vanilla, text + " - Line Spacing")); ((BaseUnityPlugin)UniversalRadar.Instance).Config.Remove(new ConfigDefinition("Moon Overrides - " + vanilla, text + " - Line Thickness")); ((BaseUnityPlugin)UniversalRadar.Instance).Config.Remove(new ConfigDefinition("Moon Overrides - " + vanilla, text + " - Shading Minimum")); ((BaseUnityPlugin)UniversalRadar.Instance).Config.Remove(new ConfigDefinition("Moon Overrides - " + vanilla, text + " - Shading Maximum")); ((BaseUnityPlugin)UniversalRadar.Instance).Config.Remove(new ConfigDefinition("Moon Overrides - " + vanilla, text + " - Maximum Opacity")); } } } public class ColourProperties { public ConfigEntry<string> baseColourHex; public ConfigEntry<string> lineColourHex; public ConfigEntry<string> radarColourHex; public ConfigEntry<string> bgColourHex; public Vector4 baseColour; public Vector4 lineColour; public Vector4 radarColour; public Vector4 bgColour; public ColourProperties(string moon, string vanilla, string colourHexBase, string colourHexLine, string colourHexRadar, string colourHexBG) { string text = moon.Replace("\n", "").Replace("\t", "").Replace("\\", "") .Replace("\"", "") .Replace("'", "") .Replace("[", "") .Replace("]", ""); baseColourHex = ((BaseUnityPlugin)UniversalRadar.Instance).Config.Bind<string>("Moon Overrides (Colour) - " + vanilla, text + " - Shading Colour Hex Code", colourHexBase, "Colour of the contour shading for this moon (hexadecimal colour code)."); lineColourHex = ((BaseUnityPlugin)UniversalRadar.Instance).Config.Bind<string>("Moon Overrides (Colour) - " + vanilla, text + " - Line Colour Hex Code", colourHexLine, "Colour of the contour lines for this moon (hexadecimal colour code)."); radarColourHex = ((BaseUnityPlugin)UniversalRadar.Instance).Config.Bind<string>("Moon Overrides (Colour) - " + vanilla, text + " - Object Colour Hex Code", colourHexRadar, "Colour of the radar objects generated on this moon (hexadecimal colour code)."); bgColourHex = ((BaseUnityPlugin)UniversalRadar.Instance).Config.Bind<string>("Moon Overrides (Colour) - " + vanilla, text + " - Background Colour Hex Code", colourHexBG, "Colour tint of radar background for this moon (hexadecimal colour code)."); SetColours(); } public void SetColours() { //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_0018: Unknown result type (might be due to invalid IL or missing references) //IL_001d: 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_003e: Unknown result type (might be due to invalid IL or missing references) //IL_0043: Unknown result type (might be due to invalid IL or missing references) //IL_0054: Unknown result type (might be due to invalid IL or missing references) //IL_0059: Unknown result type (might be due to invalid IL or missing references) //IL_005a: Unknown result type (might be due to invalid IL or missing references) //IL_0036: Unknown result type (might be due to invalid IL or missing references) //IL_0037: Unknown result type (might be due to invalid IL or missing references) //IL_007a: Unknown result type (might be due to invalid IL or missing references) //IL_007f: Unknown result type (might be due to invalid IL or missing references) //IL_0090: Unknown result type (might be due to invalid IL or missing references) //IL_0095: 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_0072: Unknown result type (might be due to invalid IL or missing references) //IL_0073: 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_00cc: Unknown result type (might be due to invalid IL or missing references) //IL_00d1: Unknown result type (might be due to invalid IL or missing references) //IL_00d2: Unknown result type (might be due to invalid IL or missing references) //IL_00ae: Unknown result type (might be due to invalid IL or missing references) //IL_00af: 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_00eb: Unknown result type (might be due to invalid IL or missing references) baseColour = ConfigPatch.defaultContourGreen; Vector4 val = ColourFromHex(baseColourHex.Value); if (val.x >= 0f) { baseColour = val; } lineColour = ConfigPatch.defaultContourGreen; Vector4 val2 = ColourFromHex(lineColourHex.Value); if (val2.x >= 0f) { lineColour = val2; } radarColour = ConfigPatch.defaultRadarGreen; Vector4 val3 = ColourFromHex(radarColourHex.Value); if (val3.x >= 0f) { radarColour = val3; } bgColour = ConfigPatch.defaultCameraGreen; Vector4 val4 = ColourFromHex(bgColourHex.Value, zeroAlpha: true); if (val4.x >= 0f) { bgColour = val4; } } public static Vector4 ColourFromHex(string hexCode, bool zeroAlpha = false) { //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_00cb: 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_00aa: Unknown result type (might be due to invalid IL or missing references) //IL_0092: Unknown result type (might be due to invalid IL or missing references) //IL_0097: Unknown result type (might be due to invalid IL or missing references) string text = hexCode.Replace("#", "").ToUpper(); if (text.Length == 6 && Regex.Match(text, "^[A-F0-9]{6}$").Success) { float num = (float)Convert.ToInt32(text.Substring(0, 2), 16) / 255f; float num2 = (float)Convert.ToInt32(text.Substring(2, 2), 16) / 255f; float num3 = (float)Convert.ToInt32(text.Substring(4, 2), 16) / 255f; if (!zeroAlpha) { return new Vector4(num, num2, num3, 1f); } return new Vector4(num, num2, num3, 0f); } return new Vector4(-1f, -1f, -1f, -1f); } public static string HexFromColour(Color colour) { string text = colour.r.ToString("X2"); string text2 = colour.g.ToString("X2"); string text3 = colour.b.ToString("X2"); return "#" + text + text2 + text3; } } [HarmonyPatch] public class ConfigReassignmentPatch { public static void CheckOrphans() { //IL_00bb: Unknown result type (might be due to invalid IL or missing references) //IL_00c7: Expected O, but got Unknown //IL_020d: Unknown result type (might be due to invalid IL or missing references) //IL_0217: Expected O, but got Unknown //IL_027d: Unknown result type (might be due to invalid IL or missing references) //IL_0287: Expected O, but got Unknown ConfigEntryBase[] configEntries = ((BaseUnityPlugin)UniversalRadar.Instance).Config.GetConfigEntries(); PropertyInfo property = ((object)((BaseUnityPlugin)UniversalRadar.Instance).Config).GetType().GetProperty("OrphanedEntries", BindingFlags.Instance | BindingFlags.NonPublic); Dictionary<ConfigDefinition, string> dictionary = (Dictionary<ConfigDefinition, string>)property.GetValue(((BaseUnityPlugin)UniversalRadar.Instance).Config, null); List<ConfigDefinition> list = new List<ConfigDefinition>(dictionary.Keys); ConfigEntry<float> val = default(ConfigEntry<float>); ConfigEntry<string> val2 = default(ConfigEntry<string>); ConfigEntry<bool> val3 = default(ConfigEntry<bool>); foreach (ConfigDefinition item in list) { if (item.Section == "Camera" && item.Key == "Increased Render Distance") { if (float.TryParse(dictionary[item], out var result) && ((BaseUnityPlugin)UniversalRadar.Instance).Config.TryGetEntry<float>(new ConfigDefinition("!General", "Increased Radar Vertical Render Distance"), ref val)) { val.Value = result; dictionary.Remove(item); } } else { if (!(item.Section == "Moon Overrides - Vanilla") && !(item.Section == "Moon Overrides - LLL")) { continue; } if (RelocateConfig(item, "Shading Colour Hex Code", "Moon Overrides (Colour)", "Shading Colour Hex Code", GeneralExtensions.GetValueSafe<ConfigDefinition, string>(dictionary, item))) { dictionary.Remove(item); } else if (RelocateConfig(item, "Line Colour Hex Code", "Moon Overrides (Colour)", "Line Colour Hex Code", GeneralExtensions.GetValueSafe<ConfigDefinition, string>(dictionary, item))) { dictionary.Remove(item); } else if (RelocateConfig(item, "Colour Hex Code", "Moon Overrides (Colour)", "Shading Colour Hex Code", GeneralExtensions.GetValueSafe<ConfigDefinition, string>(dictionary, item)) && RelocateConfig(item, "Colour Hex Code", "Moon Overrides (Colour)", "Line Colour Hex Code", GeneralExtensions.GetValueSafe<ConfigDefinition, string>(dictionary, item))) { dictionary.Remove(item); } if (!item.Key.EndsWith("Opacity Multiplier")) { continue; } string text = item.Key.Split(" - ")[0]; ConfigDefinition configDef = new ConfigDefinition(item.Section, text); if (configEntries.Any((ConfigEntryBase x) => x.Definition == configDef) && ((BaseUnityPlugin)UniversalRadar.Instance).Config.TryGetEntry<string>(configDef, ref val2) && val2.Value == "Ignore") { ConfigDefinition nextConfigDef = new ConfigDefinition(item.Section, text + " - Show Radar Objects"); if (configEntries.Any((ConfigEntryBase x) => x.Definition == nextConfigDef) && ((BaseUnityPlugin)UniversalRadar.Instance).Config.TryGetEntry<bool>(nextConfigDef, ref val3)) { val3.Value = false; dictionary.Remove(item); } } } } ((BaseUnityPlugin)UniversalRadar.Instance).Config.Save(); } private static bool RelocateConfig(ConfigDefinition configDef, string name, string newSectionName, string newName, string value) { //IL_006d: Unknown result type (might be due to invalid IL or missing references) //IL_0079: Expected O, but got Unknown string key = configDef.Key; string section = configDef.Section; if (key.Contains(" - ") && key.EndsWith(name)) { string text = key.Split(" - ")[0]; string text2 = section.Split(" - ")[1]; ConfigEntry<string> val = default(ConfigEntry<string>); if (((BaseUnityPlugin)UniversalRadar.Instance).Config.TryGetEntry<string>(new ConfigDefinition(newSectionName + " - " + text2, text + " - " + newName), ref val)) { val.Value = value; return true; } } return false; } } public class LLLConfigPatch { public class MaterialPropertiesValues { public string mode; public bool showObjects; public bool lowObjectOpacity; public bool extendHeight; public float opacityMult; public float lineSpacing; public float lineThickness; public float minHeight; public float maxHeight; public float opacityCap; public string baseColourHex; public string lineColourHex; public string radarColourHex; public string bgColourHex; public MaterialPropertiesValues(string defaultMode = "Auto", bool show = true, bool lowOpacity = false, bool extend = false, float multiplier = 2f, string colourHexBase = "4D6A46", string colourHexLine = "4D6A46", string colourHexRadar = "63FF5A", string colourHexBG = "000701", float spacing = 2.5f, float thickness = 6f, float min = -10f, float max = 30f, float opacity = 0.9f) { mode = defaultMode; showObjects = show; lowObjectOpacity = lowOpacity; extendHeight = extend; lineSpacing = spacing; lineThickness = thickness; minHeight = min; maxHeight = max; opacityCap = opacity; opacityMult = multiplier; baseColourHex = colourHexBase; lineColourHex = colourHexLine; radarColourHex = colourHexRadar; bgColourHex = colourHexBG; } } public static List<(MaterialPropertiesConfig, (string, string))> moddedConfigs = new List<(MaterialPropertiesConfig, (string, string))>(); public static readonly Dictionary<(string, string), MaterialPropertiesValues> changeToIgnore1 = new Dictionary<(string, string), MaterialPropertiesValues> { { ("115 Wither", "WitherScene"), new MaterialPropertiesValues("Ignore", show: false) }, { ("58 Hyve", "Asteroid14Scene"), new MaterialPropertiesValues("Ignore", show: false, lowOpacity: false, extend: true, 1f) }, { ("48 Desolation", "DesolationScene"), new MaterialPropertiesValues("Ignore", show: false, lowOpacity: false, extend: true, 1f) }, { ("354 Demetrica", "DemetricaScene"), new MaterialPropertiesValues("Ignore", show: false, lowOpacity: true, extend: true) }, { ("141 Filitrios", "FilitriosScene"), new MaterialPropertiesValues("Ignore", show: false, lowOpacity: true) }, { ("76 Acidir", "AcidirScene"), new MaterialPropertiesValues("Ignore", show: false, lowOpacity: true) }, { ("-42 Hyx", "HyxScene"), new MaterialPropertiesValues("Ignore", show: false, lowOpacity: true) }, { ("46 Infernis", "InfernisScene"), new MaterialPropertiesValues("Ignore", show: false, lowOpacity: true) }, { ("84 Junic", "JunicScene"), new MaterialPropertiesValues("Ignore", show: false, lowOpacity: true) }, { ("234 Motra", "MotraScene"), new MaterialPropertiesValues("Ignore", show: false, lowOpacity: true) }, { ("134 Oldred", "OldredScene"), new MaterialPropertiesValues("Ignore", show: false, lowOpacity: true) }, { ("132 Trite", "TriteScene"), new MaterialPropertiesValues("Ignore", show: false, lowOpacity: true) }, { ("67 Utril", "UtrilScene"), new MaterialPropertiesValues("Ignore", show: false, lowOpacity: true) }, { ("135 Duckstroid-14", "Level135Duckstroid14"), new MaterialPropertiesValues("Ignore", show: false) }, { ("240 Alcatras", "AlcatrasScene"), new MaterialPropertiesValues("Ignore", show: false) }, { ("98 Galetry", "MusemaScene"), new MaterialPropertiesValues("Ignore", show: false) }, { ("57 Asteroid-13", "Asteroid13Scene"), new MaterialPropertiesValues("Ignore", show: false) }, { ("44 Atlantica", "AtlanticaScene"), new MaterialPropertiesValues("Ignore", show: false) }, { ("288 Berunah", "BerunahScene"), new MaterialPropertiesValues("Ignore", show: false) }, { ("235 Calist", "CalistScene"), new MaterialPropertiesValues("Ignore", show: false) }, { ("842 Core", "CoreScene"), new MaterialPropertiesValues("Ignore", show: false) }, { ("537 Cubatres", "CubatresScene"), new MaterialPropertiesValues("Ignore", show: false) }, { ("164 Dreck", "KryteScene"), new MaterialPropertiesValues("Ignore", show: false) }, { ("555 Empra", "EmpraScene"), new MaterialPropertiesValues("Ignore", show: false) }, { ("End", "EndScene"), new MaterialPropertiesValues("Ignore", show: false) }, { ("154 Etern", "EternScene"), new MaterialPropertiesValues("Ignore", show: false) }, { ("29 Faith", "FaithScene"), new MaterialPropertiesValues("Ignore", show: false) }, { ("25 Fission-C", "FissionCScene"), new MaterialPropertiesValues("Ignore", show: false) }, { ("36 Gloom", "GloomScene"), new MaterialPropertiesValues("Ignore", show: false) }, { ("147 Gratar", "GratarScene"), new MaterialPropertiesValues("Ignore", show: false) }, { ("4 Thalasso", "HydreneScene"), new MaterialPropertiesValues("Ignore", show: false) }, { ("35 Lecaro", "LecaroScene"), new MaterialPropertiesValues("Ignore", show: false) }, { ("94 Polarus", "PolarusScene"), new MaterialPropertiesValues("Ignore", show: false) }, { ("648 Repress", "RepressScene"), new MaterialPropertiesValues("Ignore", show: false) }, { ("398 Roart", "RoartScene"), new MaterialPropertiesValues("Ignore", show: false) } }; public static MaterialPropertiesValues GetDefaults((string, string) identifier, bool extend, bool hide, bool lowOpacity, bool ignore, string baseHex, string lineHex, string radarHex, string bgHex) { string colourHexBase = ((baseHex != "N/A") ? baseHex : "4D6A46"); string colourHexLine = ((lineHex != "N/A") ? lineHex : "4D6A46"); string colourHexRadar = ((radarHex != "N/A") ? radarHex : "63FF5A"); string colourHexBG = ((bgHex != "N/A") ? bgHex : "000701"); (string, string) tuple = identifier; switch (tuple.Item1) { case "72 Collateral": { string item = tuple.Item2; if (!(item == "CollateralScene")) { break; } return new MaterialPropertiesValues("Manual", show: true, lowOpacity: true, extend: false, 2f, "4D6A46", "4D6A46", "63FF5A", "000701", 2.5f, 6f, -25f, 10f); } case "58 Hyve": { string item = tuple.Item2; if (!(item == "Asteroid14Scene")) { break; } goto IL_0e0d; } case "48 Desolation": { string item = tuple.Item2; if (!(item == "DesolationScene")) { break; } goto IL_0e0d; } case "354 Demetrica": { string item = tuple.Item2; if (!(item == "DemetricaScene")) { break; } return new MaterialPropertiesValues("Ignore", show: false, lowOpacity: true, extend: true); } case "141 Filitrios": { string item = tuple.Item2; if (!(item == "FilitriosScene")) { break; } return new MaterialPropertiesValues("Ignore", show: false, lowOpacity: true); } case "76 Acidir": { string item = tuple.Item2; if (!(item == "AcidirScene")) { break; } goto IL_0edf; } case "-42 Hyx": { string item = tuple.Item2; if (!(item == "HyxScene")) { break; } goto IL_0edf; } case "46 Infernis": { string item = tuple.Item2; if (!(item == "InfernisScene")) { break; } goto IL_0edf; } case "84 Junic": { string item = tuple.Item2; if (!(item == "JunicScene")) { break; } goto IL_0edf; } case "234 Motra": { string item = tuple.Item2; if (!(item == "MotraScene")) { break; } goto IL_0edf; } case "134 Oldred": { string item = tuple.Item2; if (!(item == "OldredScene")) { break; } goto IL_0edf; } case "132 Trite": { string item = tuple.Item2; if (!(item == "TriteScene")) { break; } goto IL_0edf; } case "67 Utril": { string item = tuple.Item2; if (!(item == "UtrilScene")) { break; } goto IL_0edf; } case "115 Wither": { string item = tuple.Item2; if (!(item == "WitherScene")) { break; } goto IL_0f25; } case "135 Duckstroid-14": { string item = tuple.Item2; if (!(item == "Level135Duckstroid14")) { break; } goto IL_0f25; } case "240 Alcatras": { string item = tuple.Item2; if (!(item == "AlcatrasScene")) { break; } goto IL_0f25; } case "98 Galetry": { string item = tuple.Item2; if (!(item == "MusemaScene")) { break; } goto IL_0f25; } case "57 Asteroid-13": { string item = tuple.Item2; if (!(item == "Asteroid13Scene")) { break; } goto IL_0f25; } case "44 Atlantica": { string item = tuple.Item2; if (!(item == "AtlanticaScene")) { break; } goto IL_0f25; } case "288 Berunah": { string item = tuple.Item2; if (!(item == "BerunahScene")) { break; } goto IL_0f25; } case "235 Calist": { string item = tuple.Item2; if (!(item == "CalistScene")) { break; } goto IL_0f25; } case "842 Core": { string item = tuple.Item2; if (!(item == "CoreScene")) { break; } goto IL_0f25; } case "42 Cosmocos": { string item = tuple.Item2; if (!(item == "CosmocosScene")) { break; } goto IL_0f25; } case "537 Cubatres": { string item = tuple.Item2; if (!(item == "CubatresScene")) { break; } goto IL_0f25; } case "164 Dreck": { string item = tuple.Item2; if (!(item == "KryteScene")) { break; } goto IL_0f25; } case "555 Empra": { string item = tuple.Item2; if (!(item == "EmpraScene")) { break; } goto IL_0f25; } case "End": { string item = tuple.Item2; if (!(item == "EndScene")) { break; } goto IL_0f25; } case "154 Etern": { string item = tuple.Item2; if (!(item == "EternScene")) { break; } goto IL_0f25; } case "29 Faith": { string item = tuple.Item2; if (!(item == "FaithScene")) { break; } goto IL_0f25; } case "25 Fission-C": { string item = tuple.Item2; if (!(item == "FissionCScene")) { break; } goto IL_0f25; } case "36 Gloom": { string item = tuple.Item2; if (!(item == "GloomScene")) { break; } goto IL_0f25; } case "147 Gratar": { string item = tuple.Item2; if (!(item == "GratarScene")) { break; } goto IL_0f25; } case "4 Thalasso": { string item = tuple.Item2; if (!(item == "HydreneScene")) { break; } goto IL_0f25; } case "35 Lecaro": { string item = tuple.Item2; if (!(item == "LecaroScene")) { break; } goto IL_0f25; } case "94 Polarus": { string item = tuple.Item2; if (!(item == "PolarusScene")) { break; } goto IL_0f25; } case "648 Repress": { string item = tuple.Item2; if (!(item == "RepressScene")) { break; } goto IL_0f25; } case "398 Roart": { string item = tuple.Item2; if (!(item == "RoartScene")) { break; } goto IL_0f25; } case "120 Corrosion": { string item = tuple.Item2; if (!(item == "ZenithScene")) { break; } return new MaterialPropertiesValues("Auto", show: true, lowOpacity: true, extend: true); } case "32-Rampart": { string item = tuple.Item2; if (!(item == "RampartScene")) { break; } goto IL_0fb1; } case "89 Submersion": { string item = tuple.Item2; if (!(item == "SubmersionScene")) { break; } goto IL_0fb1; } case "81 Icebound": { string item = tuple.Item2; if (!(item == "FrozenLakeScene")) { break; } goto IL_0ff7; } case "19 Hydro": { string item = tuple.Item2; if (!(item == "HydroScene")) { break; } goto IL_0ff7; } case "27-Calamitous": { string item = tuple.Item2; if (!(item == "CalamitousScene")) { break; } goto IL_0ff7; } case "33 Pinnacle": { string item = tuple.Item2; if (!(item == "PinnacleLevel")) { break; } goto IL_0ff7; } case "103-Precipice": { string item = tuple.Item2; if (!(item == "Precipice Scene")) { break; } goto IL_0ff7; } case "51-Verdance": { string item = tuple.Item2; if (!(item == "VerdanceScene")) { break; } goto IL_0ff7; } case "28 Celest": { string item = tuple.Item2; if (!(item == "CelestPlanetScene")) { break; } goto IL_103d; } case "12-Boreal": { string item = tuple.Item2; if (!(item == "BorealScene")) { break; } goto IL_103d; } IL_103d: return new MaterialPropertiesValues("Auto", show: true, lowOpacity: false, extend: false, 1f); IL_0ff7: return new MaterialPropertiesValues("Auto", show: true, lowOpacity: false, extend: true); IL_0fb1: return new MaterialPropertiesValues("Auto", show: true, lowOpacity: true); IL_0f25: return new MaterialPropertiesValues("Ignore", show: false); IL_0edf: return new MaterialPropertiesValues("Ignore", show: false, lowOpacity: false, extend: true); IL_0e0d: return new MaterialPropertiesValues("Ignore", show: false, lowOpacity: false, extend: true, 1f); } if (ignore) { return new MaterialPropertiesValues("Ignore"); } if (extend || hide || lowOpacity) { bool extend2 = extend; bool lowOpacity2 = lowOpacity; return new MaterialPropertiesValues("Auto", !hide, lowOpacity2, extend2, 2f, colourHexBase, colourHexLine, colourHexRadar, colourHexBG); } if (baseHex != "N/A" || lineHex != "N/A" || radarHex != "N/A" || bgHex != "N/A") { return new MaterialPropertiesValues("Auto", show: true, lowOpacity: false, extend: false, 2f, colourHexBase, colourHexLine, colourHexRadar, colourHexBG); } return new MaterialPropertiesValues(); } public static void OnStartInitialize() { //IL_0027: Unknown result type (might be due to invalid IL or missing references) //IL_002d: Invalid comparison between Unknown and I4 //IL_01e0: Unknown result type (might be due to invalid IL or missing references) //IL_01fe: Unknown result type (might be due to invalid IL or missing references) //IL_021c: Unknown result type (might be due to invalid IL or missing references) //IL_023a: Unknown result type (might be due to invalid IL or missing references) moddedConfigs.Clear(); foreach (ExtendedLevel extendedLevel in PatchedContent.ExtendedLevels) { if ((int)((ExtendedContent)extendedLevel).ContentType > 0) { (string, string) tuple = (extendedLevel.SelectableLevel.PlanetName, extendedLevel.SelectableLevel.sceneName); bool extend = ((ExtendedContent)extendedLevel).ContentTags.Exists((ContentTag x) => x.contentTagName == "UniversalRadarExtendHeight"); bool hide = ((ExtendedContent)extendedLevel).ContentTags.Exists((ContentTag x) => x.contentTagName == "UniversalRadarHideObjects"); bool lowOpacity = ((ExtendedContent)extendedLevel).ContentTags.Exists((ContentTag x) => x.contentTagName == "UniversalRadarLowOpacityObjects"); bool ignore = ((ExtendedContent)extendedLevel).ContentTags.Exists((ContentTag x) => x.contentTagName == "UniversalRadarIgnore"); string baseHex = "N/A"; string lineHex = "N/A"; string radarHex = "N/A"; string bgHex = "N/A"; ContentTag val = ((ExtendedContent)extendedLevel).ContentTags.Find((ContentTag x) => x.contentTagName == "UniversalRadarBaseColor"); ContentTag val2 = ((ExtendedContent)extendedLevel).ContentTags.Find((ContentTag x) => x.contentTagName == "UniversalRadarLineColor"); ContentTag val3 = ((ExtendedContent)extendedLevel).ContentTags.Find((ContentTag x) => x.contentTagName == "UniversalRadarObjectColor"); ContentTag val4 = ((ExtendedContent)extendedLevel).ContentTags.Find((ContentTag x) => x.contentTagName == "UniversalRadarBackgroundColor"); if ((Object)(object)val != (Object)null) { baseHex = ColourProperties.HexFromColour(val.contentTagColor); } if ((Object)(object)val2 != (Object)null) { lineHex = ColourProperties.HexFromColour(val2.contentTagColor); } if ((Object)(object)val3 != (Object)null) { radarHex = ColourProperties.HexFromColour(val3.contentTagColor); } if ((Object)(object)val4 != (Object)null) { bgHex = ColourProperties.HexFromColour(val4.contentTagColor); } MaterialPropertiesValues defaults = GetDefaults(tuple, extend, hide, lowOpacity, ignore, baseHex, lineHex, radarHex, bgHex); moddedConfigs.Add((new MaterialPropertiesConfig(extendedLevel.SelectableLevel.PlanetName, "LLL", defaults), tuple)); } } foreach (var moddedConfig in moddedConfigs) { if (ConfigPatch.OlderConfigVersion(new int[3] { 1, 2, 0 }) && changeToIgnore1.TryGetValue(moddedConfig.Item2, out MaterialPropertiesValues value)) { moddedConfig.Item1.SetValues(moddedConfig.Item2.Item1, "LLL", value); } if (moddedConfig.Item1.mode.Value == "Ignore" && !moddedConfig.Item1.showObjects.Value && !ConfigPatch.moonBlacklist.Contains(moddedConfig.Item2)) { ConfigPatch.moonBlacklist.Add(moddedConfig.Item2); } else if (!RadarContourPatches.contourDataDict.ContainsKey(moddedConfig.Item2)) { RadarContourPatches.contourDataDict.Add(moddedConfig.Item2, new MaterialProperties(moddedConfig.Item1)); } } } public static void SceneNamePatch() { //IL_0019: Unknown result type (might be due to invalid IL or missing references) foreach (ExtendedLevel extendedLevel in PatchedContent.ExtendedLevels) { if ((int)((ExtendedContent)extendedLevel).ContentType == 0 && ConfigPatch.vanillaSceneDict.ContainsKey(extendedLevel.SelectableLevel.PlanetName)) { ConfigPatch.vanillaSceneDict[extendedLevel.SelectableLevel.PlanetName] = extendedLevel.SelectableLevel.sceneName; } } } } [HarmonyPatch] public class RadarContourPatches { public static Material contourMaterial = UniversalRadar.contourMaterial; public static Material radarFillMat0 = UniversalRadar.radarFillMat0; public static Material radarFillMat1 = UniversalRadar.radarFillMat1; public static Material radarWaterMat = UniversalRadar.radarWaterMat; public static List<GameObject> terrainObjects = new List<GameObject>(); public static List<GameObject> mapGeometry = new List<GameObject>(); public static List<GameObject> unityMeshTerrains = new List<GameObject>(); public static List<GameObject> waterObjects = new List<GameObject>(); public static Dictionary<(string, string), MaterialProperties> contourDataDict = new Dictionary<(string, string), MaterialProperties>(); public static Dictionary<(string, string), List<string>> terrainMemoryDict = new Dictionary<(string, string), List<string>>(); public static Dictionary<(string, string), List<string>> geometryMemoryDict = new Dictionary<(string, string), List<string>>(); public static Dictionary<(string, string), List<MeshTerrainInfo>> meshTerrainDict = new Dictionary<(string, string), List<MeshTerrainInfo>>(); public static float terrainMax; public static float terrainMin; private static float stroke = UniversalRadar.AutoLineWidth.Value; private static float lineSpace = UniversalRadar.AutoSpacing.Value; private static float maxOpacity = UniversalRadar.AutoOpacity.Value; public static readonly Vector3 verticalOffset = new Vector3(0f, 0.05f, 0f); public static readonly Vector3 shipPos = new Vector3(3f, 0f, -15f); public static bool loaded = false; private static readonly HashSet<Type> keepTypes = new HashSet<Type> { typeof(Transform), typeof(MeshFilter), typeof(MeshRenderer) }; private static readonly HashSet<Type> blacklistTypes = new HashSet<Type> { typeof(NetworkObject), typeof(Animator), typeof(SkinnedMeshRenderer), typeof(NavMeshSurface) }; private static readonly HashSet<Type> disableTypes = new HashSet<Type> { typeof(AudioSource), typeof(Light), typeof(HDAdditionalLightData) }; private static readonly bool showFoliage = UniversalRadar.ShowFoliage.Value; public static bool disableMoon = false; [HarmonyPatch(typeof(StartOfRound), "SceneManager_OnLoadComplete1")] [HarmonyPrefix] private static void OnLoadLevel(StartOfRound __instance, string sceneName) { //IL_0186: 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_011a: Unknown result type (might be due to invalid IL or missing references) //IL_0124: Expected O, but got Unknown //IL_0133: Unknown result type (might be due to invalid IL or missing references) //IL_013d: Expected O, but got Unknown //IL_014c: Unknown result type (might be due to invalid IL or missing references) //IL_0156: Expected O, but got Unknown //IL_0165: Unknown result type (might be due to invalid IL or missing references) //IL_016f: Expected O, but got Unknown //IL_01a4: Unknown result type (might be due to invalid IL or missing references) //IL_019c: Unknown result type (might be due to invalid IL or missing references) //IL_01a9: 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) //IL_01bf: Unknown result type (might be due to invalid IL or missing references) //IL_01d8: Unknown result type (might be due to invalid IL or missing references) //IL_01d0: Unknown result type (might be due to invalid IL or missing references) //IL_01dd: Unknown result type (might be due to invalid IL or missing references) //IL_01e9: Unknown result type (might be due to invalid IL or missing references) //IL_01ee: Unknown result type (might be due to invalid IL or missing references) //IL_0207: 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_020c: Unknown result type (might be due to invalid IL or missing references) //IL_0212: 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_0230: Unknown result type (might be due to invalid IL or missing references) //IL_0228: Unknown result type (might be due to invalid IL or missing references) //IL_0235: Unknown result type (might be due to invalid IL or missing references) //IL_023c: Unknown result type (might be due to invalid IL or missing references) //IL_0241: Unknown result type (might be due to invalid IL or missing references) //IL_0274: Unknown result type (might be due to invalid IL or missing references) //IL_0342: Unknown result type (might be due to invalid IL or missing references) //IL_0289: Unknown result type (might be due to invalid IL or missing references) //IL_028e: Unknown result type (might be due to invalid IL or missing references) //IL_0293: Unknown result type (might be due to invalid IL or missing references) //IL_02b6: Unknown result type (might be due to invalid IL or missing references) //IL_02c7: Unknown result type (might be due to invalid IL or missing references) //IL_02e3: Unknown result type (might be due to invalid IL or missing references) //IL_02e8: Unknown result type (might be due to invalid IL or missing references) //IL_0373: Unknown result type (might be due to invalid IL or missing references) if (loaded || !(sceneName == __instance.currentLevel.sceneName)) { return; } disableMoon = false; (string, string) tuple = (__instance.currentLevel.PlanetName, sceneName); disableMoon = ConfigPatch.moonBlacklist.Contains(tuple); if (disableMoon) { ClearRadarAddWater(disableMoon); } loaded = true; if (disableMoon || !contourDataDict.TryGetValue(tuple, out MaterialProperties value)) { return; } UniversalRadar.SetTime(); RadarExtraPatches.AddNewRadarSprites(tuple); ClearRadarAddWater(value.skipContour); if (value.skipContour && !value.showObjects) { disableMoon = true; return; } if ((Object)(object)contourMaterial == (Object)null || (Object)(object)radarFillMat0 == (Object)null || (Object)(object)radarFillMat1 == (Object)null || (Object)(object)radarWaterMat == (Object)null) { contourMaterial = (Material)UniversalRadar.URAssets.LoadAsset("ContourMat"); radarFillMat0 = (Material)UniversalRadar.URAssets.LoadAsset("RadarGreen0"); radarFillMat1 = (Material)UniversalRadar.URAssets.LoadAsset("RadarGreen1"); radarWaterMat = (Material)UniversalRadar.URAssets.LoadAsset("RadarBlue"); radarWaterMat.renderQueue = 1000; } radarFillMat0.color = Color.op_Implicit((Vector4.Distance(value.radarColour, ConfigPatch.defaultRadarGreen) > 0.01f) ? value.radarColour : ConfigPatch.defaultRadarGreen); radarFillMat1.color = Color.op_Implicit((Vector4.Distance(value.radarColour, ConfigPatch.defaultRadarGreen) > 0.01f) ? value.radarColour : ConfigPatch.defaultRadarGreen); RadarExtraPatches.camColour = ((Vector4.Distance(value.bgColour, ConfigPatch.defaultCameraGreen) > 0.01f) ? value.bgColour : ConfigPatch.defaultCameraGreen); RadarExtraPatches.shipColour = ((Vector4.Distance(value.radarColour, ConfigPatch.defaultRadarGreen) > 0.01f) ? value.radarColour : ConfigPatch.defaultRadarGreen); Bounds navMeshBounds = default(Bounds); ((Bounds)(ref navMeshBounds))..ctor(Vector3.zero, Vector3.zero); if (!terrainMemoryDict.ContainsKey(tuple) && !meshTerrainDict.ContainsKey(tuple)) { Vector3[] vertices = NavMesh.CalculateTriangulation().vertices; foreach (Vector3 val in vertices) { ((Bounds)(ref navMeshBounds)).Encapsulate(val); } UniversalRadar.Logger.LogDebug((object)$"NAV MAX: {((Bounds)(ref navMeshBounds)).max.y}, NAV MIN: {((Bounds)(ref navMeshBounds)).min.y}"); if (((Bounds)(ref navMeshBounds)).size == Vector3.zero) { UniversalRadar.Logger.LogError((object)"Unable to find nav mesh!"); return; } } if (UniversalRadar.HideRadarObjects.Value) { value.showObjects = false; } if (!value.skipContour) { FetchTerrainObjects(!value.auto, tuple, navMeshBounds); } else { terrainObjects.Clear(); unityMeshTerrains.Clear(); } if (value.showObjects) { FetchMapGeometry(tuple, navMeshBounds); } else { mapGeometry.Clear(); } if (terrainObjects.Count == 0 && unityMeshTerrains.Count == 0 && mapGeometry.Count == 0 && waterObjects.Count == 0) { return; } if (!value.auto) { value.LogAllProperties(); value.SetProperties(contourMaterial); CreateMeshes(value.lowObjectOpacity); UniversalRadar.Logger.LogDebug((object)$"Radar generation complete ({UniversalRadar.GetTime()}s)"); } else { float min = -10f; float max = 30f; if (!value.skipContour) { min = ((terrainMin < 0f) ? (terrainMin / 2f) : 0f); max = (value.extendHeight ? terrainMax : ((terrainMax > 100f) ? (terrainMax / (float)(Mathf.RoundToInt(terrainMax / 100f) + 2)) : (terrainMax / 2f))); } MaterialProperties materialProperties = new MaterialProperties(value, lineSpace, stroke, min, max, maxOpacity); materialProperties.LogAllProperties(); if (contourDataDict.ContainsKey(tuple)) { contourDataDict.Remove(tuple); } contourDataDict.Add(tuple, materialProperties); materialProperties.SetProperties(contourMaterial); CreateMeshes(materialProperties.lowObjectOpacity); UniversalRadar.Logger.LogDebug((object)$"First time radar generation complete ({UniversalRadar.GetTime()}s)"); } GameObject val2 = GameObject.FindGameObjectWithTag("TerrainContourMap"); if ((Object)(object)val2 == (Object)null) { val2 = GameObject.Find("Systems/Radar/RadarSquare"); } if (!value.skipContour && (Object)(object)val2 != (Object)null && Object.op_Implicit((Object)(object)val2.GetComponent<SpriteRenderer>())) { UniversalRadar.Logger.LogDebug((object)"Disabling existing contour map!"); ((Renderer)val2.GetComponent<SpriteRenderer>()).enabled = false; } } [HarmonyPatch(typeof(StartOfRound), "ReviveDeadPlayers")] [HarmonyPostfix] public static void ResetLoadedFlag() { loaded = false; } public static void FetchTerrainObjects(bool hasMatInfo, (string, string) identifier, Bounds navMeshBounds) { //IL_0161: Unknown result type (might be due to invalid IL or missing references) //IL_04cc: Unknown result type (might be due to invalid IL or missing references) //IL_04e7: Unknown result type (might be due to invalid IL or missing references) //IL_04a6: Unknown result type (might be due to invalid IL or missing references) //IL_04b7: Unknown result type (might be due to invalid IL or missing references) //IL_0478: Unknown result type (might be due to invalid IL or missing references) //IL_052f: Unknown result type (might be due to invalid IL or missing references) //IL_0543: 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_0240: 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_026b: Unknown result type (might be due to invalid IL or missing references) //IL_0270: Unknown result type (might be due to invalid IL or missing references) //IL_0274: Unknown result type (might be due to invalid IL or missing references) //IL_0362: Unknown result type (might be due to invalid IL or missing references) //IL_0369: Expected O, but got Unknown //IL_0405: Unknown result type (might be due to invalid IL or missing references) //IL_0420: Unknown result type (might be due to invalid IL or missing references) //IL_043b: Unknown result type (might be due to invalid IL or missing references) terrainObjects.Clear(); unityMeshTerrains.Clear(); List<Terrain> list = (from x in Object.FindObjectsOfType<Terrain>() where ((Component)x).gameObject.activeInHierarchy && ((Behaviour)x).enabled && x.drawHeightmap && Object.op_Implicit((Object)(object)((Component)x).GetComponent<TerrainCollider>()) && ((Collider)((Component)x).GetComponent<TerrainCollider>()).enabled select x).ToList(); if (terrainMemoryDict.TryGetValue(identifier, out List<string> value)) { for (int i = 0; i < value.Count; i++) { GameObject val = GameObject.Find(value[i]); if ((Object)(object)val != (Object)null && !terrainObjects.Contains(val) && Object.op_Implicit((Object)(object)val.GetComponent<MeshRenderer>())) { terrainObjects.Add(val); } } } else { MeshCollider[] array = Object.FindObjectsOfType<MeshCollider>(); List<MeshRenderer> terrainRenderers = new List<MeshRenderer>(); MyCollections.ForEach<MeshCollider>((IEnumerable<MeshCollider>)array, (Action<MeshCollider>)delegate(MeshCollider x) { CollectRenderers((Collider)(object)x, terrainRenderers, 90000f, terrain: true, 1); }); if (terrainRenderers.Count == 0 && list.Count == 0) { UniversalRadar.Logger.LogWarning((object)"Unable to find any terrain objects on this moon!"); return; } UniversalRadar.Logger.LogDebug((object)$"First time load: Fetched {terrainRenderers.Count} terrain renderers"); terrainMax = -10000f; terrainMin = 10000f; List<int> list2 = NavMeshBest(navMeshBounds, terrainRenderers.ConvertAll((MeshRenderer x) => ((Renderer)x).bounds).ToArray(), list.Count <= 0, 10); List<string> list3 = new List<string>(); for (int j = 0; j < terrainRenderers.Count; j++) { if (list2.Contains(j) && !terrainObjects.Contains(((Component)terrainRenderers[j]).gameObject)) { terrainObjects.Add(((Component)terrainRenderers[j]).gameObject); list3.Add(GetObjectPath(((Component)terrainRenderers[j]).gameObject)); Bounds bounds = ((Renderer)terrainRenderers[j]).bounds; terrainMax = Mathf.Max(((Bounds)(ref bounds)).max.y, terrainMax); bounds = ((Renderer)terrainRenderers[j]).bounds; terrainMin = Mathf.Min(((Bounds)(ref bounds)).min.y, terrainMin); } } if (list3.Count > 0) { UniversalRadar.Logger.LogDebug((object)("Adding terrain paths to dictionary under identifier (" + identifier.Item1 + ", " + identifier.Item2 + ")")); terrainMemoryDict.Add(identifier, list3); } } if (UniversalRadar.UseTerraMesh.Value && list.Count > 0) { if (meshTerrainDict.TryGetValue(identifier, out List<MeshTerrainInfo> value2)) { for (int k = 0; k < value2.Count; k++) { GameObject val2 = new GameObject($"NewMeshTerrain{k}"); if (!MyString.IsNullOrEmpty(value2[k].parentPath)) { GameObject val3 = GameObject.Find(value2[k].parentPath); if ((Object)(object)val3 != (Object)null) { val2.transform.SetParent(val3.transform); } } MeshFilter val4 = val2.AddComponent<MeshFilter>(); val4.sharedMesh = value2[k].mesh; MeshRenderer val5 = val2.AddComponent<MeshRenderer>(); ((Renderer)val5).material = contourMaterial; val2.transform.localPosition = value2[k].position; val2.transform.localRotation = value2[k].rotation; val2.transform.localScale = value2[k].scale; unityMeshTerrains.Add(val2); } } else { MeshifyTerrains(list, !hasMatInfo, identifier, navMeshBounds, terrainObjects.Count <= 0); } } if (terrainMin > terrainMax) { terrainMax = ((Bounds)(ref navMeshBounds)).max.y; terrainMin = ((Bounds)(ref navMeshBounds)).min.y; } else { terrainMax = Mathf.Min(((Bounds)(ref navMeshBounds)).max.y, terrainMax); terrainMin = Mathf.Max(((Bounds)(ref navMeshBounds)).min.y, terrainMin); } UniversalRadar.Logger.LogDebug((object)$"Terrain max: {terrainMax}, terrain min: {terrainMin} ({((Bounds)(ref navMeshBounds)).max.y}, {((Bounds)(ref navMeshBounds)).min.y})"); } public static void FetchMapGeometry((string, string) identifier, Bounds navMeshBounds) { //IL_0160: Unknown result type (might be due to invalid IL or missing references) //IL_016f: Unknown result type (might be due to invalid IL or missing references) mapGeometry.Clear(); if (geometryMemoryDict.TryGetValue(identifier, out List<string> value)) { for (int i = 0; i < value.Count; i++) { GameObject val = GameObject.Find(value[i]); if ((Object)(object)val != (Object)null && !mapGeometry.Contains(val) && Object.op_Implicit((Object)(object)val.GetComponent<MeshRenderer>())) { mapGeometry.Add(val); } } return; } Collider[] array = Object.FindObjectsOfType<Collider>(); List<MeshRenderer> geometryRenderers = new List<MeshRenderer>(); MyCollections.ForEach<Collider>((IEnumerable<Collider>)array, (Action<Collider>)delegate(Collider x) { CollectRenderers(x, geometryRenderers, UniversalRadar.RadarObjectSize.Value, terrain: false, 2, 90000f); }); UniversalRadar.Logger.LogDebug((object)$"First time load: Fetched {geometryRenderers.Count} object renderers"); List<string> list = new List<string>(); for (int j = 0; j < geometryRenderers.Count; j++) { if ((Object)(object)((Component)geometryRenderers[j]).gameObject != (Object)null && !mapGeometry.Contains(((Component)geometryRenderers[j]).gameObject) && !terrainObjects.Contains(((Component)geometryRenderers[j]).gameObject) && !unityMeshTerrains.Contains(((Component)geometryRenderers[j]).gameObject) && WithinNavMesh(navMeshBounds, ((Renderer)geometryRenderers[j]).bounds)) { mapGeometry.Add(((Component)geometryRenderers[j]).gameObject); list.Add(GetObjectPath(((Component)geometryRenderers[j]).gameObject)); } } if (list.Count > 0) { UniversalRadar.Logger.LogDebug((object)("Adding object paths to dictionary under identifier (" + identifier.Item1 + ", " + identifier.Item2 + ")")); geometryMemoryDict.Add(