Decompiled source of Universal Radar v1.0.9

ScienceBird.UniversalRadar.dll

Decompiled 2 weeks ago
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 EasyTextEffects.Editor.MyBoxCopy.Extensions;
using HarmonyLib;
using LethalLevelLoader;
using Microsoft.CodeAnalysis;
using TerraMesh;
using TerraMesh.Utils;
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.0.9.0")]
[assembly: AssemblyInformationalVersion("1.0.9+eba88f534a6735d8a762f68c50d25af72f54c8ab")]
[assembly: AssemblyProduct("UniversalRadar")]
[assembly: AssemblyTitle("ScienceBird.UniversalRadar")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.9.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.0.9")]
	[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> UseTerraMesh;

		public static ConfigEntry<bool> HideRadarObjects;

		public static ConfigEntry<bool> RadarWater;

		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 Dictionary<string, GameObject> radarSpritePrefabs = new Dictionary<string, GameObject>();

		public static Material contourMaterial;

		public static Material radarFillMat0;

		public static Material radarFillMat1;

		public static Material radarWaterMat;

		public static bool batbyPresent = false;

		public static bool dopaPresent = false;

		public static bool spookyPresent = false;

		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_00ff: Unknown result type (might be due to invalid IL or missing references)
			//IL_0109: 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_0336: Unknown result type (might be due to invalid IL or missing references)
			//IL_0340: Expected O, but got Unknown
			//IL_03c5: Unknown result type (might be due to invalid IL or missing references)
			//IL_03cf: Expected O, but got Unknown
			//IL_03de: Unknown result type (might be due to invalid IL or missing references)
			//IL_03e8: Expected O, but got Unknown
			//IL_03f7: Unknown result type (might be due to invalid IL or missing references)
			//IL_0401: Expected O, but got Unknown
			//IL_0410: Unknown result type (might be due to invalid IL or missing references)
			//IL_041a: 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>()));
			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).");
			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 existing extra 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 existing extra 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 existing extra 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 existing extra 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 existing extra 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 existing extra 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 existing extra 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 existing extra 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 existing extra 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 existing extra 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 existing extra radar objects).");
			CameraClipExtension = ((BaseUnityPlugin)this).Config.Bind<float>("Camera", "Increased 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>()));
			batbyPresent = Chainloader.PluginInfos.ContainsKey("imabatby.lethallevelloader");
			Chainloader.PluginInfos.ContainsKey("dopadream.lethalcompany.rebalancedmoons");
			dopaPresent = Chainloader.PluginInfos.ContainsKey("dopadream.lethalcompany.rebalancedmoons");
			spookyPresent = Chainloader.PluginInfos.ContainsKey("MapImprovements");
			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.0.9 has loaded!");
		}

		internal static void Patch()
		{
			//IL_000d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0012: Unknown result type (might be due to invalid IL or missing references)
			//IL_0018: Expected O, but got Unknown
			if (Harmony == null)
			{
				Harmony = new Harmony("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.0.9";
	}
}
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>();

		[HarmonyPatch(typeof(StartOfRound), "Start")]
		[HarmonyPrefix]
		[HarmonyAfter(new string[] { "imabatby.lethallevelloader", "dopadream.lethalcompany.rebalancedmoons" })]
		public static void OnStartInitialize()
		{
			//IL_0146: Unknown result type (might be due to invalid IL or missing references)
			//IL_0150: Expected O, but got Unknown
			//IL_0182: Unknown result type (might be due to invalid IL or missing references)
			//IL_018c: Expected O, but got Unknown
			//IL_01be: Unknown result type (might be due to invalid IL or missing references)
			//IL_01c8: Expected O, but got Unknown
			//IL_01fc: Unknown result type (might be due to invalid IL or missing references)
			//IL_0206: Expected O, but got Unknown
			//IL_023a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0244: Expected O, but got Unknown
			//IL_0278: Unknown result type (might be due to invalid IL or missing references)
			//IL_0282: Expected O, but got Unknown
			//IL_02b6: Unknown result type (might be due to invalid IL or missing references)
			//IL_02c0: Expected O, but got Unknown
			//IL_02f4: Unknown result type (might be due to invalid IL or missing references)
			//IL_02fe: Expected O, but got Unknown
			//IL_0332: Unknown result type (might be due to invalid IL or missing references)
			//IL_033c: Expected O, but got Unknown
			//IL_0370: Unknown result type (might be due to invalid IL or missing references)
			//IL_037a: Expected O, but got Unknown
			//IL_03ae: Unknown result type (might be due to invalid IL or missing references)
			//IL_03b8: Expected O, but got Unknown
			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");
			if (UniversalRadar.dopaPresent)
			{
				LLLConfigPatch.RebalancedMoonsPatch();
			}
			UniversalRadar.radarSpritePrefabs.Clear();
			if (UniversalRadar.ExperimentationSprites.Value)
			{
				UniversalRadar.radarSpritePrefabs.Add(vanillaSceneDict["41 Experimentation"], (GameObject)UniversalRadar.URAssets.LoadAsset("ExperimentationRadarSprites"));
			}
			if (UniversalRadar.AssuranceSprites.Value)
			{
				UniversalRadar.radarSpritePrefabs.Add(vanillaSceneDict["220 Assurance"], (GameObject)UniversalRadar.URAssets.LoadAsset("AssuranceRadarSprites"));
			}
			if (UniversalRadar.VowSprites.Value)
			{
				UniversalRadar.radarSpritePrefabs.Add(vanillaSceneDict["56 Vow"], (GameObject)UniversalRadar.URAssets.LoadAsset("VowRadarSprites"));
			}
			if (UniversalRadar.MarchSprites.Value)
			{
				UniversalRadar.radarSpritePrefabs.Add(vanillaSceneDict["61 March"], (GameObject)UniversalRadar.URAssets.LoadAsset("MarchRadarSprites"));
			}
			if (UniversalRadar.RendSprites.Value)
			{
				UniversalRadar.radarSpritePrefabs.Add(vanillaSceneDict["85 Rend"], (GameObject)UniversalRadar.URAssets.LoadAsset("RendRadarSprites"));
			}
			if (UniversalRadar.DineSprites.Value)
			{
				UniversalRadar.radarSpritePrefabs.Add(vanillaSceneDict["7 Dine"], (GameObject)UniversalRadar.URAssets.LoadAsset("DineRadarSprites"));
			}
			if (UniversalRadar.OffenseSprites.Value)
			{
				UniversalRadar.radarSpritePrefabs.Add(vanillaSceneDict["21 Offense"], (GameObject)UniversalRadar.URAssets.LoadAsset("OffenseRadarSprites"));
			}
			if (UniversalRadar.TitanSprites.Value)
			{
				UniversalRadar.radarSpritePrefabs.Add(vanillaSceneDict["8 Titan"], (GameObject)UniversalRadar.URAssets.LoadAsset("TitanRadarSprites"));
			}
			if (UniversalRadar.ArtificeSprites.Value)
			{
				UniversalRadar.radarSpritePrefabs.Add(vanillaSceneDict["68 Artifice"], (GameObject)UniversalRadar.URAssets.LoadAsset("ArtificeRadarSprites"));
			}
			if (UniversalRadar.AdamanceSprites.Value)
			{
				UniversalRadar.radarSpritePrefabs.Add(vanillaSceneDict["20 Adamance"], (GameObject)UniversalRadar.URAssets.LoadAsset("AdamanceRadarSprites"));
			}
			if (UniversalRadar.EmbrionSprites.Value)
			{
				UniversalRadar.radarSpritePrefabs.Add(vanillaSceneDict["5 Embrion"], (GameObject)UniversalRadar.URAssets.LoadAsset("EmbrionRadarSprites"));
			}
			vanillaConfigs.Clear();
			vanillaConfigs.Add((new MaterialPropertiesConfig("41 Experimentation", "Vanilla", "Auto", show: false, lowOpacity: false, extend: false, 2f, "4D6A46", "4D6A46", 2.5f, 6f, -10f, 30f, 0.9f), ("41 Experimentation", vanillaSceneDict["41 Experimentation"])));
			vanillaConfigs.Add((new MaterialPropertiesConfig("220 Assurance", "Vanilla", "Auto", show: false, lowOpacity: false, extend: false, 2f, "4D6A46", "4D6A46", 2.5f, 6f, -10f, 30f, 0.9f), ("220 Assurance", vanillaSceneDict["220 Assurance"])));
			vanillaConfigs.Add((new MaterialPropertiesConfig("56 Vow", "Vanilla", "Manual", show: false, lowOpacity: false, extend: false, 2f, "4D6A46", "4D6A46", 2.5f, 6f, -20f, 20f, 0.9f), ("56 Vow", vanillaSceneDict["56 Vow"])));
			vanillaConfigs.Add((new MaterialPropertiesConfig("61 March", "Vanilla", "Auto", show: false, lowOpacity: false, extend: false, 2f, "4D6A46", "4D6A46", 2.5f, 6f, -10f, 30f, 0.9f), ("61 March", vanillaSceneDict["61 March"])));
			vanillaConfigs.Add((new MaterialPropertiesConfig("85 Rend", "Vanilla", "Auto", show: false, lowOpacity: false, extend: false, 2f, "4D6A46", "4D6A46", 2.5f, 6f, -10f, 30f, 0.9f), ("85 Rend", vanillaSceneDict["85 Rend"])));
			vanillaConfigs.Add((new MaterialPropertiesConfig("7 Dine", "Vanilla", "Manual", show: false, lowOpacity: false, extend: false, 2f, "4D6A46", "4D6A46", 2.5f, 6f, -27f, 17f, 0.9f), ("7 Dine", vanillaSceneDict["7 Dine"])));
			vanillaConfigs.Add((new MaterialPropertiesConfig("21 Offense", "Vanilla", "Auto", show: false, lowOpacity: false, extend: false, 2f, "4D6A46", "4D6A46", 2.5f, 6f, -10f, 30f, 0.9f), ("21 Offense", vanillaSceneDict["21 Offense"])));
			vanillaConfigs.Add((new MaterialPropertiesConfig("8 Titan", "Vanilla", "Auto", show: false, lowOpacity: false, extend: true, 0.75f, "4D6A46", "4D6A46", 2.5f, 6f, -10f, 30f, 0.9f), ("8 Titan", vanillaSceneDict["8 Titan"])));
			vanillaConfigs.Add((new MaterialPropertiesConfig("68 Artifice", "Vanilla", "Auto", show: false, lowOpacity: false, extend: false, 2f, "4D6A46", "4D6A46", 2.5f, 6f, -10f, 30f, 0.9f), ("68 Artifice", vanillaSceneDict["68 Artifice"])));
			vanillaConfigs.Add((new MaterialPropertiesConfig("20 Adamance", "Vanilla", "Manual", show: false, lowOpacity: false, extend: false, 2f, "4D6A46", "4D6A46", 2.5f, 6f, -30f, 23f, 0.9f), ("20 Adamance", vanillaSceneDict["20 Adamance"])));
			vanillaConfigs.Add((new MaterialPropertiesConfig("5 Embrion", "Vanilla", "Auto", show: false, lowOpacity: false, extend: false, 2f, "4D6A46", "4D6A46", 2.5f, 6f, -10f, 30f, 0.9f), ("5 Embrion", vanillaSceneDict["5 Embrion"])));
			foreach (var vanillaConfig in vanillaConfigs)
			{
				if (vanillaConfig.Item1.mode.Value == "Manual" || (vanillaConfig.Item1.mode.Value == "Auto" && (vanillaConfig.Item1.extendHeight.Value || !vanillaConfig.Item1.showObjects.Value || vanillaConfig.Item1.lowObjectOpacity.Value || vanillaConfig.Item1.baseColourHex.Value != "4D6A46" || vanillaConfig.Item1.opacityMult.Value != 2f)))
				{
					if (!RadarContourPatches.contourDataDict.ContainsKey(vanillaConfig.Item2))
					{
						RadarContourPatches.contourDataDict.Add(vanillaConfig.Item2, new MaterialProperties(vanillaConfig.Item1));
					}
				}
				else if (vanillaConfig.Item1.mode.Value == "Ignore" && !moonBlacklist.Contains(vanillaConfig.Item2))
				{
					moonBlacklist.Add(vanillaConfig.Item2);
				}
			}
			if (UniversalRadar.batbyPresent)
			{
				LLLConfigPatch.OnStartInitialize();
			}
		}
	}
	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 ConfigEntry<string> baseColourHex;

		public ConfigEntry<string> lineColourHex;

		public MaterialPropertiesConfig(string moon, string vanilla, string defaultMode, bool show, bool lowOpacity, bool extend, float multiplier, string colourHexBG, string colourHexLine, float spacing, float thickness, float min, float max, float opacity)
		{
			//IL_00b8: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c2: 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_02ba: Unknown result type (might be due to invalid IL or missing references)
			//IL_02c4: Expected O, but got Unknown
			//IL_0305: Unknown result type (might be due to invalid IL or missing references)
			//IL_030f: Expected O, but got Unknown
			//IL_0350: Unknown result type (might be due to invalid IL or missing references)
			//IL_035a: Expected O, but got Unknown
			//IL_039b: Unknown result type (might be due to invalid IL or missing references)
			//IL_03a5: Expected O, but got Unknown
			//IL_03e6: Unknown result type (might be due to invalid IL or missing references)
			//IL_03f0: Expected O, but got Unknown
			//IL_0431: Unknown result type (might be due to invalid IL or missing references)
			//IL_043b: 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>()));
			if (mode.Value == "Auto")
			{
				showObjects = ((BaseUnityPlugin)UniversalRadar.Instance).Config.Bind<bool>("Moon Overrides - " + vanilla, text + " - Show Radar Objects", show, "In addition to creating a terrain contour map, 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.");
				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).");
				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>()));
				baseColourHex = ((BaseUnityPlugin)UniversalRadar.Instance).Config.Bind<string>("Moon Overrides - " + vanilla, text + " - Colour Hex Code", colourHexBG, "Colour of the contour lines and shading for this moon (hexadecimal colour code).");
			}
			else if (mode.Value == "Manual")
			{
				showObjects = ((BaseUnityPlugin)UniversalRadar.Instance).Config.Bind<bool>("Moon Overrides - " + vanilla, text + " - Show Radar Objects", show, "In addition to creating a terrain contour map, 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.");
				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>()));
				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>()));
				baseColourHex = ((BaseUnityPlugin)UniversalRadar.Instance).Config.Bind<string>("Moon Overrides - " + vanilla, text + " - Shading Colour Hex Code", colourHexBG, "Colour of the contour shading for this moon (hexadecimal colour code).");
				lineColourHex = ((BaseUnityPlugin)UniversalRadar.Instance).Config.Bind<string>("Moon Overrides - " + vanilla, text + " - Line Colour Hex Code", colourHexLine, "Colour of the contour lines for this moon (hexadecimal colour code).");
			}
		}
	}
	public class LLLConfigPatch
	{
		public class MaterialPropertiesValues
		{
			public (string, string) moonIdentifier;

			public string mode;

			public bool showObjects;

			public bool lowObjectOpacity;

			public bool extendHeight;

			public float opacityMult;

			public string baseColourHex;

			public string lineColourHex;

			public float lineSpacing;

			public float lineThickness;

			public float minHeight;

			public float maxHeight;

			public float opacityCap;

			public MaterialPropertiesValues((string, string) identifier, string defaultMode = "Auto", bool show = true, bool lowOpacity = false, bool extend = false, float multiplier = 2f, string colourHexBG = "4D6A46", string colourHexLine = "4D6A46", float spacing = 2.5f, float thickness = 6f, float min = -10f, float max = 30f, float opacity = 0.9f)
			{
				moonIdentifier = identifier;
				mode = defaultMode;
				showObjects = show;
				lowObjectOpacity = lowOpacity;
				extendHeight = extend;
				lineSpacing = spacing;
				lineThickness = thickness;
				minHeight = min;
				maxHeight = max;
				opacityCap = opacity;
				opacityMult = multiplier;
				baseColourHex = colourHexBG;
				lineColourHex = colourHexLine;
			}
		}

		public static List<(MaterialPropertiesConfig, (string, string))> moddedConfigs = new List<(MaterialPropertiesConfig, (string, string))>();

		public static MaterialPropertiesValues GetDefaults((string, string) identifier, bool extend, bool hide, bool lowOpacity, bool ignore, string baseHex, string lineHex)
		{
			if (ignore)
			{
				return new MaterialPropertiesValues(identifier, "Ignore");
			}
			if (extend || hide || lowOpacity)
			{
				bool extend2 = extend;
				bool lowOpacity2 = lowOpacity;
				return new MaterialPropertiesValues(identifier, "Auto", !hide, lowOpacity2, extend2);
			}
			(string, string) tuple = identifier;
			switch (tuple.Item1)
			{
			case "115 Wither":
			{
				string item = tuple.Item2;
				if (!(item == "WitherScene"))
				{
					break;
				}
				return new MaterialPropertiesValues(identifier, "Manual", show: true, lowOpacity: false, extend: false, 2f, "4D6A46", "4D6A46", 2.5f, 6f, -15f, 75f);
			}
			case "72 Collateral":
			{
				string item = tuple.Item2;
				if (!(item == "CollateralScene"))
				{
					break;
				}
				return new MaterialPropertiesValues(identifier, "Manual", show: true, lowOpacity: true, extend: false, 2f, "4D6A46", "4D6A46", 2.5f, 6f, -25f, 10f);
			}
			case "58 Hyve":
			{
				string item = tuple.Item2;
				if (!(item == "Asteroid14Scene"))
				{
					break;
				}
				goto IL_085e;
			}
			case "48 Desolation":
			{
				string item = tuple.Item2;
				if (!(item == "DesolationScene"))
				{
					break;
				}
				goto IL_085e;
			}
			case "42 Cosmocos":
			{
				string item = tuple.Item2;
				if (!(item == "CosmocosScene"))
				{
					break;
				}
				return new MaterialPropertiesValues(identifier, "Ignore");
			}
			case "354 Demetrica":
			{
				string item = tuple.Item2;
				if (!(item == "DemetricaScene"))
				{
					break;
				}
				goto IL_08d6;
			}
			case "120 Corrosion":
			{
				string item = tuple.Item2;
				if (!(item == "ZenithScene"))
				{
					break;
				}
				goto IL_08d6;
			}
			case "141 Filitrios":
			{
				string item = tuple.Item2;
				if (!(item == "FilitriosScene"))
				{
					break;
				}
				goto IL_0912;
			}
			case "32-Rampart":
			{
				string item = tuple.Item2;
				if (!(item == "RampartScene"))
				{
					break;
				}
				goto IL_0912;
			}
			case "89 Submersion":
			{
				string item = tuple.Item2;
				if (!(item == "SubmersionScene"))
				{
					break;
				}
				goto IL_0912;
			}
			case "-42 Hyx":
			{
				string item = tuple.Item2;
				if (!(item == "HyxScene"))
				{
					break;
				}
				goto IL_094e;
			}
			case "46 Infernis":
			{
				string item = tuple.Item2;
				if (!(item == "InfernisScene"))
				{
					break;
				}
				goto IL_094e;
			}
			case "76 Acidir":
			{
				string item = tuple.Item2;
				if (!(item == "AcidirScene"))
				{
					break;
				}
				goto IL_094e;
			}
			case "84 Junic":
			{
				string item = tuple.Item2;
				if (!(item == "JunicScene"))
				{
					break;
				}
				goto IL_094e;
			}
			case "234 Motra":
			{
				string item = tuple.Item2;
				if (!(item == "MotraScene"))
				{
					break;
				}
				goto IL_094e;
			}
			case "134 Oldred":
			{
				string item = tuple.Item2;
				if (!(item == "OldredScene"))
				{
					break;
				}
				goto IL_094e;
			}
			case "132 Trite":
			{
				string item = tuple.Item2;
				if (!(item == "TriteScene"))
				{
					break;
				}
				goto IL_094e;
			}
			case "67 Utril":
			{
				string item = tuple.Item2;
				if (!(item == "UtrilScene"))
				{
					break;
				}
				goto IL_094e;
			}
			case "81 Icebound":
			{
				string item = tuple.Item2;
				if (!(item == "FrozenLakeScene"))
				{
					break;
				}
				goto IL_094e;
			}
			case "19 Hydro":
			{
				string item = tuple.Item2;
				if (!(item == "HydroScene"))
				{
					break;
				}
				goto IL_094e;
			}
			case "27-Calamitous":
			{
				string item = tuple.Item2;
				if (!(item == "CalamitousScene"))
				{
					break;
				}
				goto IL_094e;
			}
			case "33 Pinnacle":
			{
				string item = tuple.Item2;
				if (!(item == "PinnacleLevel"))
				{
					break;
				}
				goto IL_094e;
			}
			case "103-Precipice":
			{
				string item = tuple.Item2;
				if (!(item == "Precipice Scene"))
				{
					break;
				}
				goto IL_094e;
			}
			case "51-Verdance":
			{
				string item = tuple.Item2;
				if (!(item == "VerdanceScene"))
				{
					break;
				}
				goto IL_094e;
			}
			case "28 Celest":
			{
				string item = tuple.Item2;
				if (!(item == "CelestPlanetScene"))
				{
					break;
				}
				goto IL_098a;
			}
			case "12-Boreal":
				{
					string item = tuple.Item2;
					if (!(item == "BorealScene"))
					{
						break;
					}
					goto IL_098a;
				}
				IL_098a:
				return new MaterialPropertiesValues(identifier, "Auto", show: true, lowOpacity: false, extend: false, 1f);
				IL_094e:
				return new MaterialPropertiesValues(identifier, "Auto", show: true, lowOpacity: false, extend: true);
				IL_0912:
				return new MaterialPropertiesValues(identifier, "Auto", show: true, lowOpacity: true);
				IL_08d6:
				return new MaterialPropertiesValues(identifier, "Auto", show: true, lowOpacity: true, extend: true);
				IL_085e:
				return new MaterialPropertiesValues(identifier, "Auto", show: true, lowOpacity: false, extend: true, 1f);
			}
			if (baseHex != "N/A" || lineHex != "N/A")
			{
				return new MaterialPropertiesValues(identifier, "Auto", show: true, lowOpacity: false, extend: false, 2f, (baseHex != "N/A") ? baseHex : "4D6A46", (lineHex != "N/A") ? lineHex : "4D6A46");
			}
			return new MaterialPropertiesValues(identifier);
		}

		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_015d: Unknown result type (might be due to invalid IL or missing references)
			//IL_017b: 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)
				{
					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 lineHex = "N/A";
					string baseHex = "N/A";
					ContentTag val = ((ExtendedContent)extendedLevel).ContentTags.Find((ContentTag x) => x.contentTagName == "UniversalRadarLineColor");
					ContentTag val2 = ((ExtendedContent)extendedLevel).ContentTags.Find((ContentTag x) => x.contentTagName == "UniversalRadarBaseColor");
					if ((Object)(object)val != (Object)null)
					{
						lineHex = RadarContourPatches.HexFromColour(val.contentTagColor);
					}
					if ((Object)(object)val2 != (Object)null)
					{
						baseHex = RadarContourPatches.HexFromColour(val2.contentTagColor);
					}
					MaterialPropertiesValues defaults = GetDefaults((extendedLevel.SelectableLevel.PlanetName, extendedLevel.SelectableLevel.sceneName), extend, hide, lowOpacity, ignore, baseHex, lineHex);
					moddedConfigs.Add((new MaterialPropertiesConfig(extendedLevel.SelectableLevel.PlanetName, "LLL", defaults.mode, defaults.showObjects, defaults.lowObjectOpacity, defaults.extendHeight, defaults.opacityMult, defaults.baseColourHex, defaults.lineColourHex, defaults.lineSpacing, defaults.lineThickness, defaults.minHeight, defaults.maxHeight, defaults.opacityCap), (extendedLevel.SelectableLevel.PlanetName, extendedLevel.SelectableLevel.sceneName)));
				}
			}
			foreach (var moddedConfig in moddedConfigs)
			{
				if (moddedConfig.Item1.mode.Value == "Manual" || (moddedConfig.Item1.mode.Value == "Auto" && (moddedConfig.Item1.extendHeight.Value || moddedConfig.Item1.showObjects.Value || moddedConfig.Item1.lowObjectOpacity.Value || moddedConfig.Item1.baseColourHex.Value != "4D6A46" || moddedConfig.Item1.opacityMult.Value != 2f)))
				{
					if (!RadarContourPatches.contourDataDict.ContainsKey(moddedConfig.Item2))
					{
						RadarContourPatches.contourDataDict.Add(moddedConfig.Item2, new MaterialProperties(moddedConfig.Item1));
					}
				}
				else if (moddedConfig.Item1.mode.Value == "Ignore" && !ConfigPatch.moonBlacklist.Contains(moddedConfig.Item2))
				{
					ConfigPatch.moonBlacklist.Add(moddedConfig.Item2);
				}
			}
		}

		public static void RebalancedMoonsPatch()
		{
			//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 Vector4 defaultGreen = new Vector4(0.3019608f, 0.4156863f, 0.2745098f, 1f);

		public static readonly Vector4 radarFillGreen = new Vector4(33f / 85f, 1f, 0.3529412f, 1f);

		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)
		};

		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 fullHeight;

		[HarmonyPatch(typeof(StartOfRound), "SceneManager_OnLoadComplete1")]
		[HarmonyPrefix]
		private static void OnLoadLevel(StartOfRound __instance, string sceneName)
		{
			//IL_011e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0123: 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_00c0: Expected O, but got Unknown
			//IL_00cf: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d9: Expected O, but got Unknown
			//IL_00e8: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f2: Expected O, but got Unknown
			//IL_0101: Unknown result type (might be due to invalid IL or missing references)
			//IL_010b: Expected O, but got Unknown
			//IL_0156: Unknown result type (might be due to invalid IL or missing references)
			//IL_016b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0170: Unknown result type (might be due to invalid IL or missing references)
			//IL_0175: Unknown result type (might be due to invalid IL or missing references)
			//IL_0198: 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_01c5: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ca: Unknown result type (might be due to invalid IL or missing references)
			//IL_02f1: Unknown result type (might be due to invalid IL or missing references)
			//IL_02f6: Unknown result type (might be due to invalid IL or missing references)
			//IL_0218: Unknown result type (might be due to invalid IL or missing references)
			//IL_032f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0334: Unknown result type (might be due to invalid IL or missing references)
			//IL_0261: Unknown result type (might be due to invalid IL or missing references)
			//IL_034e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0393: Unknown result type (might be due to invalid IL or missing references)
			//IL_0465: Unknown result type (might be due to invalid IL or missing references)
			//IL_0467: Unknown result type (might be due to invalid IL or missing references)
			if (loaded || !(sceneName == __instance.currentLevel.sceneName))
			{
				return;
			}
			(string, string) tuple = (__instance.currentLevel.PlanetName, sceneName);
			ClearRadarAddWater(ConfigPatch.moonBlacklist.Contains(tuple));
			loaded = true;
			if (ConfigPatch.moonBlacklist.Contains(tuple))
			{
				return;
			}
			ExtraRadarPatches.AddNewRadarSprites(sceneName);
			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;
			}
			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 (contourDataDict.TryGetValue(tuple, out MaterialProperties value) && !value.auto)
			{
				FetchTerrainObjects(hasMatInfo: true, tuple, navMeshBounds);
				if (value.showObjects || (UniversalRadar.dopaPresent && sceneName.StartsWith("Re") && !sceneName.Contains("Level") && UniversalRadar.radarSpritePrefabs.ContainsKey(sceneName)))
				{
					FetchMapGeometry(tuple, navMeshBounds);
				}
				else
				{
					mapGeometry.Clear();
				}
				if (terrainObjects.Count == 0 && unityMeshTerrains.Count == 0 && mapGeometry.Count == 0 && waterObjects.Count == 0)
				{
					return;
				}
				value.LogAllProperties();
				value.SetProperties(contourMaterial);
				SetupMeshes(value.lowObjectOpacity);
			}
			else
			{
				bool flag = true;
				bool flag2 = false;
				fullHeight = false;
				float multiplier = 2f;
				Vector4 baseColour = defaultGreen;
				if (value != null && value.auto)
				{
					flag = value.showObjects;
					flag2 = value.lowObjectOpacity;
					fullHeight = value.extendHeight;
					multiplier = value.opacityMult;
					baseColour = value.baseColour;
				}
				if (UniversalRadar.HideRadarObjects.Value)
				{
					flag = false;
				}
				FetchTerrainObjects(hasMatInfo: false, tuple, navMeshBounds);
				if (flag || (UniversalRadar.dopaPresent && sceneName.StartsWith("Re") && !sceneName.Contains("Level") && UniversalRadar.radarSpritePrefabs.ContainsKey(sceneName)))
				{
					FetchMapGeometry(tuple, navMeshBounds);
				}
				else
				{
					mapGeometry.Clear();
				}
				if (terrainObjects.Count == 0 && unityMeshTerrains.Count == 0 && mapGeometry.Count == 0 && waterObjects.Count == 0)
				{
					return;
				}
				float min = ((terrainMin < 0f) ? (terrainMin / 2f) : 0f);
				float max = (fullHeight ? terrainMax : ((terrainMax > 100f) ? (terrainMax / (float)(Mathf.RoundToInt(terrainMax / 100f) + 2)) : (terrainMax / 2f)));
				MaterialProperties materialProperties = new MaterialProperties(flag, flag2, lineSpace, stroke, min, max, maxOpacity, multiplier, baseColour, baseColour);
				materialProperties.LogAllProperties();
				if (contourDataDict.ContainsKey(tuple))
				{
					contourDataDict.Remove(tuple);
				}
				contourDataDict.Add(tuple, materialProperties);
				materialProperties.SetProperties(contourMaterial);
				SetupMeshes(flag2);
			}
			GameObject val2 = GameObject.FindGameObjectWithTag("TerrainContourMap");
			if ((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_0156: Unknown result type (might be due to invalid IL or missing references)
			//IL_04e2: Unknown result type (might be due to invalid IL or missing references)
			//IL_04fd: Unknown result type (might be due to invalid IL or missing references)
			//IL_04bc: Unknown result type (might be due to invalid IL or missing references)
			//IL_04cd: Unknown result type (might be due to invalid IL or missing references)
			//IL_048e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0545: Unknown result type (might be due to invalid IL or missing references)
			//IL_0559: Unknown result type (might be due to invalid IL or missing references)
			//IL_0251: Unknown result type (might be due to invalid IL or missing references)
			//IL_0256: Unknown result type (might be due to invalid IL or missing references)
			//IL_025a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0281: Unknown result type (might be due to invalid IL or missing references)
			//IL_0286: Unknown result type (might be due to invalid IL or missing references)
			//IL_028a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0378: Unknown result type (might be due to invalid IL or missing references)
			//IL_037f: Expected O, but got Unknown
			//IL_041b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0436: Unknown result type (might be due to invalid IL or missing references)
			//IL_0451: 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))
					{
						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);
				UniversalRadar.Logger.LogDebug((object)$"{list2.Count} valid mesh terrains");
				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_0156: Unknown result type (might be due to invalid IL or missing references)
			//IL_0165: Unknown result type (might be due to invalid IL or missing references)
			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))
					{
						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);
			});
			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(identifier, list);
			}
		}

		public static void ClearRadarAddWater(bool skipWater)
		{
			bool findWater = UniversalRadar.RadarWater.Value;
			waterObjects.Clear();
			MeshRenderer[] array = (from x in Object.FindObjectsOfType<MeshRenderer>()
				where ((Object)((Component)x).gameObject).name.EndsWith("_URRadarFill", StringComparison.Ordinal) || ((Object)((Component)x).gameObject).name.EndsWith("_URContourMesh", StringComparison.Ordinal) || (!skipWater && findWater && (Object)(object)((Renderer)x).sharedMaterial != (Object)null && ((Object)((Renderer)x).sharedMaterial).name.ToLower().Contains("water", StringComparison.Ordinal))
				select x).ToArray();
			for (int i = 0; i < array.Length; i++)
			{
				if (((Object)((Component)array[i]).gameObject).name.EndsWith("_URRadarFill", StringComparison.Ordinal) || ((Object)((Component)array[i]).gameObject).name.EndsWith("_URContourMesh", StringComparison.Ordinal))
				{
					Object.DestroyImmediate((Object)(object)((Component)array[i]).gameObject);
				}
				else if ((Object)(object)((Renderer)array[i]).sharedMaterial != (Object)null && ((Object)((Renderer)array[i]).sharedMaterial).name.ToLower().Contains("water", StringComparison.Ordinal) && (Object)(object)((Renderer)array[i]).sharedMaterial.shader != (Object)null && ((Object)((Renderer)array[i]).sharedMaterial.shader).name.ToLower().Contains("water", StringComparison.Ordinal))
				{
					waterObjects.Add(((Component)array[i]).gameObject);
				}
			}
		}

		public static void MeshifyTerrains(List<Terrain> terrains, bool findBounds, (string, string) identifier, Bounds navMeshBounds, bool findAnyTerrain)
		{
			//IL_003c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0041: Unknown result type (might be due to invalid IL or missing references)
			//IL_0048: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e9: Unknown result type (might be due to invalid IL or missing references)
			//IL_0139: Unknown result type (might be due to invalid IL or missing references)
			//IL_013e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0142: Unknown result type (might be due to invalid IL or missing references)
			//IL_015d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0162: Unknown result type (might be due to invalid IL or missing references)
			//IL_0166: Unknown result type (might be due to invalid IL or missing references)
			Shader val = Shader.Find("HDRP/Lit");
			Shader val2 = val;
			TerraMeshConfig val3 = new TerraMeshConfig((Bounds?)null, false, true, true, 5f, true, 1, false, false, 0u, 1, 32, 3f, -1, true, true, false, false, false, false, 1023, val2);
			List<MeshTerrainInfo> list = new List<MeshTerrainInfo>();
			List<int> list2 = NavMeshBest(navMeshBounds, terrains.ConvertAll((Terrain x) => ((Collider)((Component)x).GetComponent<TerrainCollider>()).bounds).ToArray(), findAnyTerrain, 3);
			UniversalRadar.Logger.LogDebug((object)$"{list2.Count} valid unity terrains");
			for (int i = 0; i < terrains.Count; i++)
			{
				if (!list2.Contains(i) || (Object)(object)terrains[i] == (Object)null || (Object)(object)terrains[i].terrainData == (Object)null)
				{
					continue;
				}
				GameObject val4 = TerraMeshExtensions.Meshify(terrains[i], val3);
				if ((Object)(object)val4 != (Object)null)
				{
					MeshRenderer component = val4.GetComponent<MeshRenderer>();
					if ((Object)(object)component != (Object)null && !unityMeshTerrains.Contains(val4))
					{
						if (findBounds)
						{
							Bounds bounds = ((Renderer)component).bounds;
							terrainMax = Mathf.Max(((Bounds)(ref bounds)).max.y, terrainMax);
							bounds = ((Renderer)component).bounds;
							terrainMin = Mathf.Min(((Bounds)(ref bounds)).min.y, terrainMin);
						}
						unityMeshTerrains.Add(val4);
						list.Add(new MeshTerrainInfo(val4));
					}
					else
					{
						val4.SetActive(false);
					}
				}
				((Component)terrains[i]).gameObject.SetActive(true);
				((Behaviour)terrains[i]).enabled = true;
				terrains[i].drawHeightmap = true;
				((Collider)((Component)terrains[i]).GetComponent<TerrainCollider>()).enabled = true;
			}
			if (list.Count > 0)
			{
				meshTerrainDict.Add(identifier, list);
			}
		}

		public static void CollectRenderers(Collider collider, List<MeshRenderer> renderers, float minSize, bool terrain, int searchDepth)
		{
			if (IsValidMesh(collider, minSize, terrain) && !renderers.Contains(((Component)collider).GetComponent<MeshRenderer>()))
			{
				renderers.Add(((Component)collider).GetComponent<MeshRenderer>());
			}
			else if (searchDepth >= 1 && IsValidMesh(collider, minSize, terrain, 1) && !renderers.Contains(((Component)((Component)collider).transform.parent).GetComponent<MeshRenderer>()))
			{
				renderers.Add(((Component)((Component)collider).transform.parent).GetComponent<MeshRenderer>());
			}
			else if (searchDepth >= 2 && IsValidMesh(collider, minSize, terrain, 2) && !renderers.Contains(((Component)((Component)collider).transform.parent.parent).GetComponent<MeshRenderer>()))
			{
				renderers.Add(((Component)((Component)collider).transform.parent.parent).GetComponent<MeshRenderer>());
			}
		}

		public static bool IsValidMesh(Collider collider, float minSize, bool terrain = true, int searchParents = 0)
		{
			//IL_03ff: Unknown result type (might be due to invalid IL or missing references)
			//IL_0404: Unknown result type (might be due to invalid IL or missing references)
			//IL_0408: Unknown result type (might be due to invalid IL or missing references)
			//IL_0413: Unknown result type (might be due to invalid IL or missing references)
			//IL_0418: Unknown result type (might be due to invalid IL or missing references)
			//IL_041c: Unknown result type (might be due to invalid IL or missing references)
			//IL_042c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0431: Unknown result type (might be due to invalid IL or missing references)
			//IL_0435: Unknown result type (might be due to invalid IL or missing references)
			//IL_0441: Unknown result type (might be due to invalid IL or missing references)
			//IL_0446: Unknown result type (might be due to invalid IL or missing references)
			//IL_044a: Unknown result type (might be due to invalid IL or missing references)
			GameObject gameObject = ((Component)collider).gameObject;
			bool flag = false;
			Transform val = gameObject.transform;
			for (int i = 0; i <= searchParents; i++)
			{
				if (Object.op_Implicit((Object)(object)((Component)val).gameObject.GetComponent<MeshRenderer>()) && i == searchParents)
				{
					flag = true;
					break;
				}
				if ((Object)(object)val.parent != (Object)null)
				{
					val = ((Component)val).transform.parent;
					continue;
				}
				break;
			}
			if (!flag)
			{
				return false;
			}
			GameObject gameObject2 = ((Component)val).gameObject;
			MeshRenderer component = gameObject2.GetComponent<MeshRenderer>();
			if (!((Renderer)component).enabled)
			{
				return false;
			}
			if (collider.isTrigger)
			{
				return false;
			}
			if (gameObject2.layer != 8 && (gameObject2.layer != 10 || !showFoliage) && gameObject2.layer != 0 && (gameObject2.layer != 25 || !showFoliage) && (gameObject2.layer != 11 || terrain))
			{
				return false;
			}
			if (waterObjects.Contains(gameObject2))
			{
				return false;
			}
			if (((Object)gameObject2).name.Contains("_URContourMesh", StringComparison.Ordinal) || ((Object)gameObject2).name.Contains("_URRadarFill", StringComparison.Ordinal))
			{
				return false;
			}
			if (((Object)gameObject2).name.ToLower().Contains("scannode", StringComparison.Ordinal) || Object.op_Implicit((Object)(object)gameObject2.GetComponent<ScanNodeProperties>()))
			{
				return false;
			}
			if (GetObjectPath(gameObject).Contains("Environment/HangarShip/", StringComparison.Ordinal))
			{
				return false;
			}
			if (GetObjectPath(gameObject).ToLower().Contains("outofbounds", StringComparison.Ordinal))
			{
				return false;
			}
			if (!terrain && (((Object)gameObject2).name.Contains("LOD", StringComparison.Ordinal) || ((Object)gameObject2).name.ToLower().Contains("lowdetail", StringComparison.Ordinal)) && (Object)(object)gameObject2.transform.parent != (Object)null && Object.op_Implicit((Object)(object)((Component)gameObject2.transform.parent).GetComponent<LODGroup>()) && Object.op_Implicit((Object)(object)((Component)gameObject2.transform.parent).GetComponent<MeshRenderer>()))
			{
				return false;
			}
			if (!Object.op_Implicit((Object)(object)gameObject2.GetComponent<MeshFilter>()))
			{
				return false;
			}
			if (terrain)
			{
				if (!Object.op_Implicit((Object)(object)gameObject2.GetComponent<MeshFilter>()) || !((Object)(object)gameObject2.GetComponent<MeshFilter>().sharedMesh != (Object)null) || !((Object)gameObject2.GetComponent<MeshFilter>().sharedMesh).name.ToLower().Contains("cube", StringComparison.Ordinal))
				{
					MeshCollider val2 = (MeshCollider)(object)((collider is MeshCollider) ? collider : null);
					if (val2 == null || !((Object)(object)val2.sharedMesh != (Object)null) || !((Object)val2.sharedMesh).name.ToLower().Contains("cube", StringComparison.Ordinal))
					{
						goto IL_0323;
					}
				}
				return false;
			}
			goto IL_0323;
			IL_0323:
			if (gameObject2.GetComponentsInChildren<Component>(true).Any((Component x) => (Object)(object)x != (Object)null && blacklistTypes.Contains(((object)x).GetType())))
			{
				return false;
			}
			if (!terrain && (GetObjectPath(gameObject).ToLower().Contains("catwalk", StringComparison.Ordinal) || GetObjectPath(gameObject).ToLower().Contains("bridge", StringComparison.Ordinal) || ((Object)gameObject2).name.ToLower().Contains("floor", StringComparison.Ordinal)))
			{
				return true;
			}
			if (terrain && (((Object)gameObject).name.ToLower().Contains("terrain", StringComparison.Ordinal) || ((Object)gameObject2).name.ToLower().Contains("terrain", StringComparison.Ordinal)))
			{
				return true;
			}
			Bounds bounds = collider.bounds;
			float x2 = ((Bounds)(ref bounds)).size.x;
			bounds = collider.bounds;
			if (!(x2 * ((Bounds)(ref bounds)).size.z > minSize))
			{
				bounds = ((Renderer)component).bounds;
				float x3 = ((Bounds)(ref bounds)).size.x;
				bounds = ((Renderer)component).bounds;
				if (!(x3 * ((Bounds)(ref bounds)).size.z > minSize))
				{
					return false;
				}
			}
			return true;
		}

		public static bool WithinNavMesh(Bounds navBounds, Bounds objectBounds)
		{
			//IL_0003: Unknown result type (might be due to invalid IL or missing references)
			//IL_000f: Unknown result type (might be due to invalid IL or missing references)
			//IL_001d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0029: Unknown result type (might be due to invalid IL or missing references)
			//IL_0037: 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_0077: Unknown result type (might be due to invalid IL or missing references)
			//IL_0051: Unknown result type (might be due to invalid IL or missing references)
			//IL_005d: Unknown result type (might be due to invalid IL or missing references)
			if (((Bounds)(ref navBounds)).max.x > ((Bounds)(ref objectBounds)).center.x && ((Bounds)(ref navBounds)).min.x < ((Bounds)(ref objectBounds)).center.x && ((Bounds)(ref navBounds)).max.z > ((Bounds)(ref objectBounds)).center.z && ((Bounds)(ref navBounds)).min.z < ((Bounds)(ref objectBounds)).center.z)
			{
				return true;
			}
			if (((Bounds)(ref navBounds)).Intersects(objectBounds))
			{
				return true;
			}
			return false;
		}

		public static List<int> NavMeshBest(Bounds navBounds, Bounds[] boundsObjects, bool useBest, int sizeLimit)
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_0029: Unknown result type (might be due to invalid IL or missing references)
			//IL_0030: Unknown result type (might be due to invalid IL or missing references)
			//IL_008d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0099: Unknown result type (might be due to invalid IL or missing references)
			//IL_0044: Unknown result type (might be due to invalid IL or missing references)
			//IL_004b: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00cd: Unknown result type (might be due to invalid IL or missing references)
			//IL_00da: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b3: Unknown result type (might be due to invalid IL or missing references)
			//IL_013d: 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_00fb: Unknown result type (might be due to invalid IL or missing references)
			//IL_0107: Unknown result type (might be due to invalid IL or missing references)
			//IL_0171: 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_018a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0157: Unknown result type (might be due to invalid IL or missing references)
			//IL_0163: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ab: Unknown result type (might be due to invalid IL or missing references)
			//IL_01b7: Unknown result type (might be due to invalid IL or missing references)
			//IL_01f7: 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)
			(int, float) value = (0, 1000000f);
			List<int> list = new List<int>();
			Dictionary<int, (int, float)> dictionary = new Dictionary<int, (int, float)>();
			for (int i = 0; i < boundsObjects.Length; i++)
			{
				Bounds val = boundsObjects[i];
				bool flag = true;
				if (!((Bounds)(ref navBounds)).Intersects(val))
				{
					flag = false;
					float num = Vector3.Distance(shipPos, ((Bounds)(ref val)).center);
					if (value.Item1 == 0 && num < value.Item2)
					{
						value = (0, num);
						dictionary.Add(i, value);
					}
					continue;
				}
				if ((((Bounds)(ref val)).max.x > ((Bounds)(ref navBounds)).max.x || ((Bounds)(ref val)).min.x < ((Bounds)(ref navBounds)).min.x) && ((Bounds)(ref val)).size.x - ((Bounds)(ref navBounds)).size.x > ((Bounds)(ref navBounds)).size.x * 15f)
				{
					flag = false;
					float num2 = ((Bounds)(ref val)).size.x - ((Bounds)(ref navBounds)).size.x;
					if (value.Item1 == 0 || num2 < value.Item2)
					{
						value = (1, num2);
					}
				}
				if ((((Bounds)(ref val)).max.z > ((Bounds)(ref navBounds)).max.z || ((Bounds)(ref val)).min.z < ((Bounds)(ref navBounds)).min.z) && ((Bounds)(ref val)).size.z - ((Bounds)(ref navBounds)).size.z > ((Bounds)(ref navBounds)).size.z * 15f)
				{
					flag = false;
					float num3 = ((Bounds)(ref val)).size.z - ((Bounds)(ref navBounds)).size.z;
					if (value.Item1 == 0 || num3 < value.Item2)
					{
						value = (1, num3);
					}
				}
				if (flag)
				{
					dictionary.Add(i, (2, Vector3.Distance(shipPos, ((Bounds)(ref val)).center)));
				}
				else
				{
					dictionary.Add(i, value);
				}
			}
			dictionary = (from x in dictionary
				orderby x.Value.Item1 descending, x.Value.Item2
				select x).ToDictionary((KeyValuePair<int, (int, float)> x) => x.Key, (KeyValuePair<int, (int, float)> x) => (x.Value.Item1, x.Value.Item2));
			foreach (KeyValuePair<int, (int, float)> item in dictionary)
			{
				if (item.Value.Item1 == 2 && list.Count < sizeLimit)
				{
					list.Add(item.Key);
				}
			}
			if (useBest && list.Count <= 0 && dictionary.Count > 0)
			{
				list.Add(dictionary.First().Key);
			}
			return list;
		}

		public static void SetupMeshes(bool altMat)
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_0039: Unknown result type (might be due to invalid IL or missing references)
			//IL_00bb: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c5: Unknown result type (might be due to invalid IL or missing references)
			//IL_025b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0271: Unknown result type (might be due to invalid IL or missing references)
			//IL_01cb: 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_01d5: Unknown result type (might be due to invalid IL or missing references)
			//IL_0378: Unknown result type (might be due to invalid IL or missing references)
			//IL_038e: 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_0425: Unknown result type (might be due to invalid IL or missing references)
			//IL_042a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0315: Unknown result type (might be due to invalid IL or missing references)
			//IL_031a: Unknown result type (might be due to invalid IL or missing references)
			//IL_031f: Unknown result type (might be due to invalid IL or missing references)
			for (int i = 0; i < terrainObjects.Count; i++)
			{
				GameObject val = Object.Instantiate<GameObject>(terrainObjects[i], terrainObjects[i].transform.position, terrainObjects[i].transform.rotation, terrainObjects[i].transform.parent);
				((Object)val).name = ((Object)terrainObjects[i]).name + "_URContourMesh";
				val.layer = 14;
				CleanComponents(val);
				Material[] materials = ((Renderer)val.GetComponent<MeshRenderer>()).materials;
				for (int j = 0; j < materials.Length; j++)
				{
					materials[j] = contourMaterial;
				}
				Transform transform = val.transform;
				transform.position += verticalOffset;
				((Renderer)val.GetComponent<MeshRenderer>()).materials = materials;
			}
			for (int k = 0; k < unityMeshTerrains.Count; k++)
			{
				((Object)unityMeshTerrains[k]).name = ((Object)unityMeshTerrains[k]).name + "_URContourMesh";
				unityMeshTerrains[k].layer = 14;
				Collider[] componentsInChildren = unityMeshTerrains[k].GetComponentsInChildren<Collider>();
				for (int l = 0; l < componentsInChildren.Length; l++)
				{
					componentsInChildren[l].enabled = false;
				}
				Material[] materials2 = ((Renderer)unityMeshTerrains[k].GetComponent<MeshRenderer>()).materials;
				for (int m = 0; m < materials2.Length; m++)
				{
					materials2[m] = contourMaterial;
				}
				Transform transform2 = unityMeshTerrains[k].transform;
				transform2.position += verticalOffset;
				((Renderer)unityMeshTerrains[k].GetComponent<MeshRenderer>()).materials = materials2;
			}
			for (int n = 0; n < mapGeometry.Count; n++)
			{
				if (!((Object)(object)mapGeometry[n] == (Object)null))
				{
					GameObject val2 = Object.Instantiate<GameObject>(mapGeometry[n], mapGeometry[n].transform.position, mapGeometry[n].transform.rotation, mapGeometry[n].transform.parent);
					((Object)val2).name = ((Object)mapGeometry[n]).name + "_URRadarFill";
					val2.layer = 14;
					CleanComponents(val2);
					MeshRenderer component = val2.GetComponent<MeshRenderer>();
					Material[] materials3 = ((Renderer)component).materials;
					Material val3 = (altMat ? radarFillMat1 : radarFillMat0);
					for (int num = 0; num < materials3.Length; num++)
					{
						materials3[num] = val3;
					}
					Transform transform3 = val2.transform;
					transform3.position += verticalOffset;
					((Renderer)component).materials = materials3;
				}
			}
			for (int num2 = 0; num2 < waterObjects.Count; num2++)
			{
				GameObject val4 = Object.Instantiate<GameObject>(waterObjects[num2], waterObjects[num2].transform.position, waterObjects[num2].transform.rotation, waterObjects[num2].transform.parent);
				((Object)val4).name = ((Object)waterObjects[num2]).name + "_URRadarFill";
				val4.layer = 14;
				CleanComponents(val4);
				Material[] materials4 = ((Renderer)val4.GetComponent<MeshRenderer>()).materials;
				for (int num3 = 0; num3 < materials4.Length; num3++)
				{
					materials4[num3] = radarWaterMat;
				}
				Transform transform4 = val4.transform;
				transform4.position += verticalOffset;
				((Renderer)val4.GetComponent<MeshRenderer>()).materials = materials4;
			}
		}

		public static void CleanComponents(GameObject obj)
		{
			if ((Object)(object)obj == (Object)null)
			{
				return;
			}
			GameObject[] componentsInChildren = obj.GetComponentsInChildren<GameObject>();
			GameObject[] array = componentsInChildren;
			foreach (GameObject val in array)
			{
				if ((Object)(object)val != (Object)(object)obj)
				{
					Object.Destroy((Object)(object)val);
					continue;
				}
				Component[] components = val.GetComponents<Component>();
				foreach (Component val2 in components)
				{
					if ((Object)(object)val2 != (Object)null && disableTypes.Contains(((object)val2).GetType()))
					{
						Behaviour val3 = (Behaviour)(object)((val2 is Behaviour) ? val2 : null);
						if (val3 != null)
						{
							val3.enabled = false;
						}
					}
					if ((Object)(object)val2 != (Object)null)
					{
						LODGroup val4 = (LODGroup)(object)((val2 is LODGroup) ? val2 : null);
						if (val4 != null)
						{
							val4.enabled = false;
						}
					}
				}
			}
		}

		public static string GetObjectPath(GameObject obj)
		{
			if ((Object)(object)obj == (Object)null)
			{
				return "";
			}
			StringBuilder stringBuilder = new StringBuilder(((Object)obj).name);
			Transform parent = obj.transform.parent;
			while ((Object)(object)parent != (Object)null)
			{
				stringBuilder.Insert(0, ((Object)parent).name + "/");
				parent = parent.parent;
			}
			return stringBuilder.ToString();
		}

		public static Vector4 ColourFromHex(string hexCode)
		{
			//IL_00a4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a9: Unknown result type (might be due to invalid IL or missing references)
			//IL_0087: Unknown result type (might be due to invalid IL or missing references)
			//IL_008c: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ad: 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;
				return new Vector4(num, num2, num3, 1f);
			}
			return new Vector4(-1f, -1f, -1f, -1f);
		}

		public static string HexFromColour(Color color)
		{
			string text = color.r.ToString("X2");
			string text2 = color.g.ToString("X2");
			string text3 = color.b.ToString("X2");
			return "#" + text + text2 + text3;
		}
	}
	[HarmonyPatch]
	public class ExtraRadarPatches
	{
		[HarmonyPatch(typeof(ManualCameraRenderer), "Start")]
		[HarmonyPostfix]
		private static void HideShipIcon(ManualCameraRenderer __instance)
		{
			if ((Object)(object)__instance.shipArrowUI != (Object)null)
			{
				Transform val = __instance.shipArrowUI.transform.Find("ShipIcon");
				if ((Object)(object)val != (Object)null)
				{
					((Component)val).gameObject.SetActive(false);
				}
			}
		}

		[HarmonyPatch(typeof(ManualCameraRenderer), "MapCameraFocusOnPosition")]
		[HarmonyPostfix]
		private static void CameraPatch(ManualCameraRenderer __instance)
		{
			if ((Object)(object)__instance.cam == (Object)(object)__instance.mapCamera && !((Object)(object)GameNetworkManager.Instance.localPlayerController == (Object)null) && ((!__instance.radarTargets[__instance.targetTransformIndex].isNonPlayer && (Object)(object)__instance.targetedPlayer != (Object)null && !__instance.targetedPlayer.isInsideFactory) || (__instance.radarTargets[__instance.targetTransformIndex].isNonPlayer && Object.op_Implicit((Object)(object)((Component)__instance.radarTargets[__instance.targetTransformIndex].transform).GetComponent<RadarBoosterItem>()) && ((GrabbableObject)((Component)__instance.radarTargets[__instance.targetTransformIndex].transform).GetComponent<RadarBoosterItem>()).isInFactory)) && RoundManager.Instance.currentLevel.PlanetName != "71 Gordion")
			{
				Camera mapCamera = __instance.mapCamera;
				mapCamera.nearClipPlane -= UniversalRadar.CameraClipExtension.Value;
				Camera mapCamera2 = __instance.mapCamera;
				mapCamera2.farClipPlane += UniversalRadar.CameraClipExtension.Value;
			}
		}

		[HarmonyPatch(typeof(StartOfRound), "SwitchMapMonitorPurpose")]
		[HarmonyPostfix]
		private static void OnRadarEnable(StartOfRound __instance, bool displayInfo)
		{
			if (!displayInfo)
			{
				FieldInfo fieldInfo = AccessTools.Field(typeof(ManualCameraRenderer), "checkedForContourMap");
				if (fieldInfo != null)
				{
					fieldInfo.SetValue(__instance.mapScreen, false);
				}
			}
		}

		public static void AddNewRadarSprites(string sceneName)
		{
			//IL_0062: Unknown result type (might be due to invalid IL or missing references)
			//IL_0068: Expected O, but got Unknown
			//IL_0088: Unknown result type (might be due to invalid IL or missing references)
			//IL_008f: Expected O, but got Unknown
			//IL_00a8: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b9: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ca: 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)
			//IL_00fd: Unknown result type (might be due to invalid IL or missing references)
			//IL_010f: Unknown result type (might be due to invalid IL or missing references)
			//IL_01a7: Unknown result type (might be due to invalid IL or missing references)
			//IL_01b9: Unknown result type (might be due to invalid IL or missing references)
			//IL_01cb: Unknown result type (might be due to invalid IL or missing references)
			if (!ConfigPatch.vanillaSceneDict.ContainsValue(sceneName) || (sceneName.StartsWith("Re") && !sceneName.Contains("Level")) || UniversalRadar.spookyPresent)
			{
				return;
			}
			if (sceneName == "Level4March" || sceneName == "Level8Titan")
			{
				GameObject val = new GameObject("ContourMap");
				val.transform.SetParent(GameObject.Find("Environment").transform);
				GameObject val2 = new GameObject("ContourMapTerrain");
				val2.transform.SetParent(val.transform);
				val.transform.localPosition = Vector3.zero;
				val.transform.localRotation = Quaternion.identity;
				val.transform.localScale = Vector3.one;
				val2.transform.localPosition = new Vector3(0f, 77.7f, 0f);
				val2.transform.localRotation = Quaternion.identity;
				val2.transform.localScale = Vector3.one;
				val2.tag = "TerrainContourMap";
				val2.layer = 14;
			}
			GameObject val3 = GameObject.FindGameObjectWithTag("TerrainContourMap");
			if ((Object)(object)val3 != (Object)null && UniversalRadar.radarSpritePrefabs.TryGetValue(sceneName, out GameObject value))
			{
				SpriteRenderer[] componentsInChildren = val3.GetComponentsInChildren<SpriteRenderer>();
				for (int i = 0; i < componentsInChildren.Length; i++)
				{
					((Renderer)componentsInChildren[i]).enabled = false;
				}
				GameObject val4 = Object.Instantiate<GameObject>(value, val3.transform);
				val4.transform.localPosition = Vector3.zero;
				val4.transform.localRotation = Quaternion.identity;
				val4.transform.localScale = Vector3.one;
			}
		}
	}
	public class MeshTerrainInfo
	{
		public Mesh mesh;

		public string parentPath;

		public Vector3 position;

		public Quaternion rotation;

		public Vector3 scale;

		public MeshTerrainInfo(GameObject gameObject)
		{
			//IL_005d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0062: Unknown result type (might be due to invalid IL or missing references)
			//IL_006e: 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_007f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0084: Unknown result type (might be due to invalid IL or missing references)
			mesh = gameObject.GetComponent<MeshFilter>().sharedMesh;
			parentPath = "";
			if ((Object)(object)gameObject.transform.parent != (Object)null)
			{
				parentPath = RadarContourPatches.GetObjectPath(((Component)gameObject.transform.parent).gameObject);
			}
			position = gameObject.transform.localPosition;
			rotation = gameObject.transform.localRotation;
			scale = gameObject.transform.localScale;
		}
	}
	public class MaterialProperties
	{
		public bool auto;

		public bool showObjects;

		public bool lowObjectOpacity;

		public bool extendHeight;

		public float lineSpacing;

		public float lineThickness;

		public float minHeight;

		public float maxHeight;

		public float opacityCap;

		public float opacityMult;

		public Vector4 baseColour;

		public Vector4 lineColour;

		public MaterialProperties(bool show, bool lowOpacity, float spacing, float thickness, float min, float max, float opacity, float multiplier, Vector4 colourBG, Vector4 colourLine)
		{
			//IL_0054: Unknown result type (might be due to invalid IL or missing references)
			//IL_0056: Unknown result type (might be due to invalid IL or missing references)
			//IL_005c: Unknown result type (might be due to invalid IL or missing references)
			//IL_005e: Unknown result type (might be due to invalid IL or missing references)
			auto = false;
			showObjects = show;
			lowObjectOpacity = lowOpacity;
			extendHeight = false;
			lineSpacing = spacing;
			lineThickness = thickness;
			minHeight = min;
			maxHeight = max;
			opacityCap = opacity;
			opacityMult = multiplier;
			baseColour = colourBG;
			lineColour = colourLine;
			if (min > max)
			{
				minHeight = max;
				maxHeight = min;
			}
		}

		public MaterialProperties(MaterialPropertiesConfig propertiesConfig)
		{
			//IL_0151: Unknown result type (might be due to invalid IL or missing references)
			//IL_0156: Unknown result type (might be due to invalid IL or missing references)
			//IL_0158: Unknown result type (might be due to invalid IL or missing references)
			//IL_015d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0162: Unknown result type (might be due to invalid IL or missing references)
			//IL_007b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0080: Unknown result type (might be due to invalid IL or missing references)
			//IL_0082: Unknown result type (might be due to invalid IL or missing references)
			//IL_0087: Unknown result type (might be due to invalid IL or missing references)
			//IL_008c: Unknown result type (might be due to invalid IL or missing references)
			//IL_018c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0191: Unknown result type (might be due to invalid IL or missing references)
			//IL_0194: Unknown result type (might be due to invalid IL or missing references)
			//IL_0199: Unknown result type (might be due to invalid IL or missing references)
			//IL_019e: Unknown result type (might be due to invalid IL or missing references)
			//IL_017a: Unknown result type (might be due to invalid IL or missing references)
			//IL_017b: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a3: Unknown result type (might be due to invalid IL or missing references)
			//IL_01b7: Unknown result type (might be due to invalid IL or missing references)
			//IL_01b9: Unknown result type (might be due to invalid IL or missing references)
			if (propertiesConfig.mode.Value == "Auto")
			{
				auto = true;
				showObjects = propertiesConfig.showObjects.Value;
				lowObjectOpacity = propertiesConfig.lowObjectOpacity.Value;
				extendHeight = propertiesConfig.extendHeight.Value;
				opacityMult = propertiesConfig.opacityMult.Value;
				Vector4 val = RadarContourPatches.ColourFromHex(propertiesConfig.baseColourHex.Value);
				baseColour = RadarContourPatches.defaultGreen;
				if (val.x >= 0f)
				{
					baseColour = val;
				}
				return;
			}
			auto = false;
			showObjects = propertiesConfig.showObjects.Value;
			lowObjectOpacity = propertiesConfig.lowObjectOpacity.Value;
			extendHeight = false;
			lineSpacing = propertiesConfig.lineSpacing.Value;
			lineThickness = propertiesConfig.lineThickness.Value;
			minHeight = propertiesConfig.minHeight.Value;
			maxHeight = propertiesConfig.maxHeight.Value;
			opacityCap = propertiesConfig.opacityCap.Value;
			opacityMult = propertiesConfig.opacityMult.Value;
			Vector4 val2 = RadarContourPatches.ColourFromHex(propertiesConfig.baseColourHex.Value);
			baseColour = RadarContourPatches.defaultGreen;
			if (val2.x >= 0f)
			{
				baseColour = val2;
			}
			Vector4 val3 = RadarContourPatches.ColourFromHex(propertiesConfig.lineColourHex.Value);
			lineColour = RadarContourPatches.defaultGreen;
			if (val3.x >= 0f)
			{
				lineColour = val3;
			}
			if (propertiesConfig.minHeight.Value > propertiesConfig.maxHeight.Value)
			{
				minHeight = propertiesConfig.maxHeight.Value;
				maxHeight = propertiesConfig.minHeight.Value;
			}
		}

		public void LogAllProperties()
		{
			if (UniversalRadar.LogValues.Value)
			{
				UniversalRadar.Logger.LogInfo((object)$"SPACING: {lineSpacing}");
				UniversalRadar.Logger.LogInfo((object)$"THICKNESS: {lineThickness}");
				UniversalRadar.Logger.LogInfo((object)$"MIN: {minHeight}");
				UniversalRadar.Logger.LogInfo((object)$"MAX: {maxHeight}");
				UniversalRadar.Logger.LogInfo((object)$"MAX OPACITY: {opacityCap}");
				UniversalRadar.Logger.LogInfo((object)$"OPACITY MULT: {opacityMult}");
			}
		}

		public void SetProperties(Material contourMat)
		{
			//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_0156: Unknown result type (might be due to invalid IL or missing references)
			//IL_015b: Unknown result type (might be due to invalid IL or missing references)
			//IL_016b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0170: Unknown result type (might be due to invalid IL or missing references)
			//IL_0183: Unknown result type (might be due to invalid IL or missing references)
			//IL_0188: Unknown result type (might be due to invalid IL or missing references)
			//IL_019a: Unknown result type (might be due to invalid IL or missing references)
			//IL_019f: Unknown result type (might be due to invalid IL or missing references)
			//IL_011c: Unknown result type (might be due to invalid IL or missing references)
			//IL_011e: Unknown result type (might be due to invalid IL or missing references)
			//IL_012e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0130: Unknown result type (might be due to invalid IL or missing references)
			contourMat.renderQueue = 1000;
			contourMat.SetFloat("_ContourSpacing", lineSpacing);
			contourMat.SetFloat("_LineWidth", lineThickness);
			contourMat.SetFloat("_HeightMin", minHeight);
			contourMat.SetFloat("_HeightMax", maxHeight);
			contourMat.SetFloat("_MaxOpacity", opacityCap);
			contourMat.SetFloat("_OpacityMultiplier", opacityMult);
			if (Vector4.Distance(lineColour, RadarContourPatches.defaultGreen) > 0.01f)
			{
				Vector4 val = default(Vector4);
				for (int i = 0; i < 4; i++)
				{
					float num = Mathf.Clamp(((Vector4)(ref lineColour))[0] * 2.5f, 0f, 1f);
					float num2 = Mathf.Clamp(((Vector4)(ref lineColour))[1] * 2.5f, 0f, 1f);
					float num3 = Mathf.Clamp(((Vector4)(ref lineColour))[2] * 2.5f, 0f, 1f);
					((Vector4)(ref val))..ctor(num, num2, num3, 1f);
					RadarContourPatches.radarFillMat0.color = Color.op_Implicit(val);
					RadarContourPatches.radarFillMat1.color = Color.op_Implicit(val);
				}
			}
			else
			{
				RadarContourPatches.radarFillMat0.color = Color.op_Implicit(RadarContourPatches.radarFillGreen);
				RadarContourPatches.radarFillMat1.color = Color.op_Implicit(RadarContourPatches.radarFillGreen);
			}
			contourMat.SetColor("_BaseColor", Color.op_Implicit(baseColour));
			contourMat.SetColor("_LineColor", Color.op_Implicit(lineColour));
		}
	}
}