Decompiled source of DesertMarkerFix v0.0.2

DesertMarkerFix.dll

Decompiled 2 months ago
using System;
using System.CodeDom.Compiler;
using System.Collections.Generic;
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using BepInEx;
using BepInEx.Core.Logging.Interpolation;
using BepInEx.Logging;
using BepInEx.Unity.IL2CPP;
using Expedition;
using GTFO.API;
using GameData;
using Il2CppSystem;
using LevelGeneration;
using Microsoft.CodeAnalysis;
using UnityEngine;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: TargetFramework(".NETCoreApp,Version=v6.0", FrameworkDisplayName = ".NET 6.0")]
[assembly: AssemblyCompany("DesertMarkerFix")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyFileVersion("1.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("DesertMarkerFix")]
[assembly: AssemblyTitle("DesertMarkerFix")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.0.0")]
[module: UnverifiableCode]
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;
		}
	}
}
namespace DesertMarkerFix
{
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInPlugin("DesertMarkerFix", "DesertMarkerFix", "0.0.2")]
	public class Plugin : BasePlugin
	{
		public class DesertMarkerFix : MonoBehaviour
		{
			public static void Initialize()
			{
				//IL_0119: 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_013a: Unknown result type (might be due to invalid IL or missing references)
				//IL_013f: Unknown result type (might be due to invalid IL or missing references)
				//IL_0141: Unknown result type (might be due to invalid IL or missing references)
				//IL_0150: Unknown result type (might be due to invalid IL or missing references)
				//IL_0153: Invalid comparison between Unknown and I4
				//IL_0160: Unknown result type (might be due to invalid IL or missing references)
				//IL_0163: Invalid comparison between Unknown and I4
				//IL_018f: Unknown result type (might be due to invalid IL or missing references)
				//IL_0196: Expected O, but got Unknown
				//IL_04c1: Unknown result type (might be due to invalid IL or missing references)
				//IL_04c8: Expected O, but got Unknown
				//IL_01fc: Unknown result type (might be due to invalid IL or missing references)
				//IL_0203: Unknown result type (might be due to invalid IL or missing references)
				//IL_0212: Unknown result type (might be due to invalid IL or missing references)
				//IL_0218: Invalid comparison between Unknown and I4
				//IL_020b: Unknown result type (might be due to invalid IL or missing references)
				//IL_0222: Unknown result type (might be due to invalid IL or missing references)
				//IL_0228: Invalid comparison between Unknown and I4
				//IL_021b: Unknown result type (might be due to invalid IL or missing references)
				//IL_022b: Unknown result type (might be due to invalid IL or missing references)
				//IL_0237: Unknown result type (might be due to invalid IL or missing references)
				//IL_0239: Unknown result type (might be due to invalid IL or missing references)
				//IL_0248: Unknown result type (might be due to invalid IL or missing references)
				//IL_0263: Unknown result type (might be due to invalid IL or missing references)
				//IL_0252: Unknown result type (might be due to invalid IL or missing references)
				//IL_026d: Unknown result type (might be due to invalid IL or missing references)
				//IL_0287: Unknown result type (might be due to invalid IL or missing references)
				//IL_028e: Expected O, but got Unknown
				//IL_02b4: Unknown result type (might be due to invalid IL or missing references)
				//IL_02cc: Unknown result type (might be due to invalid IL or missing references)
				//IL_02d6: Unknown result type (might be due to invalid IL or missing references)
				//IL_02fc: Unknown result type (might be due to invalid IL or missing references)
				//IL_02ff: Invalid comparison between Unknown and I4
				//IL_0323: Unknown result type (might be due to invalid IL or missing references)
				//IL_0326: Invalid comparison between Unknown and I4
				//IL_034a: Unknown result type (might be due to invalid IL or missing references)
				//IL_034d: Invalid comparison between Unknown and I4
				//IL_0371: Unknown result type (might be due to invalid IL or missing references)
				//IL_0374: Invalid comparison between Unknown and I4
				//IL_0398: Unknown result type (might be due to invalid IL or missing references)
				//IL_039b: Invalid comparison between Unknown and I4
				//IL_03bf: Unknown result type (might be due to invalid IL or missing references)
				//IL_03c3: Invalid comparison between Unknown and I4
				//IL_03f1: Unknown result type (might be due to invalid IL or missing references)
				//IL_03f8: Expected O, but got Unknown
				//IL_0445: 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)
				uint num = 0u;
				MarkerGroupDataBlock groupData = null;
				Dictionary<Complex, uint> dictionary = new Dictionary<Complex, uint>();
				Dictionary<Complex, uint> dictionary2 = new Dictionary<Complex, uint>();
				dictionary[(Complex)0] = 126u;
				dictionary[(Complex)2] = 77u;
				dictionary[(Complex)1] = 90u;
				dictionary2[(Complex)0] = 66u;
				dictionary2[(Complex)2] = 13u;
				dictionary[(Complex)1] = 3u;
				List<string> obj = new List<string>
				{
					"Assets/AssetPrefabs/Complex/Dimensions/Desert/Dimension_Desert_Boss_Arena.prefab", "Assets/AssetPrefabs/Complex/Dimensions/Desert/Dimension_Desert_Static_01.prefab", "Assets/AssetPrefabs/Complex/Dimensions/PouncerArena/Dimension_Flyer_Arena_01.prefab", "Assets/AssetPrefabs/Complex/Dimensions/Desert/Dimension_Desert_Static_02.prefab", "Assets/AssetPrefabs/Complex/Dimensions/Desert/Dimension_Desert_Boss_flash.prefab", "Assets/AssetPrefabs/Complex/Dimensions/Desert/Dimension_Desert_Mining_Shaft.prefab", "Assets/AssetPrefabs/Complex/Dimensions/Desert/Dimension_Desert_R6A2.prefab", "Assets/AssetPrefabs/Complex/Dimensions/PouncerArena/Dimension_Pouncer_Arena_01.prefab", "Assets/AssetPrefabs/Complex/Dimensions/Desert/Dimension_Desert_Static_01_R7E1.prefab", "Assets/AssetPrefabs/Complex/Dimensions/Desert/Dimension_Desert_R7B3.prefab",
					"Assets/AssetPrefabs/Complex/Dimensions/Desert/Dimension_Desert_Dune_camp_03.prefab", "Assets/AssetPrefabs/Complex/Mining/Geomorphs/Refinery/geo_64x64_mining_refinery_X_VS_01_v2.prefab", "Assets/AssetPrefabs/Complex/Dimensions/Desert/Dimension_Desert_R8B1_Flash_01.prefab", "Assets/AssetPrefabs/Complex/Dimensions/Desert/Dimension_Desert_R8B1_Arena_01.prefab", "Assets/AssetPrefabs/Complex/Dimensions/Desert/Dimension_Desert_R8_Cave_01.prefab", "Assets/AssetPrefabs/Complex/Dimensions/PouncerArena/Dimension_R8A1_Complex_Flash.prefab", "Assets/AssetPrefabs/Complex/Dimensions/Desert/Dimension_Jungle_E2.prefab"
				};
				Complex complexType = GameDataBlockBase<ComplexResourceSetDataBlock>.GetBlock(RundownManager.ActiveExpedition.Expedition.ComplexResourceData).ComplexType;
				SubComplex subComplex = GameDataBlockBase<LevelLayoutDataBlock>.GetBlock(RundownManager.ActiveExpedition.LevelLayoutData).Zones[0].SubComplex;
				if ((int)complexType == 0)
				{
					groupData = GameDataBlockBase<MarkerGroupDataBlock>.GetBlock("Mining_Expedition");
				}
				if ((int)complexType == 2)
				{
					groupData = GameDataBlockBase<MarkerGroupDataBlock>.GetBlock("Tech_Expedition");
				}
				if ((int)complexType == 1)
				{
					groupData = GameDataBlockBase<MarkerGroupDataBlock>.GetBlock("Service_Expedition");
				}
				bool flag = default(bool);
				BepInExInfoLogInterpolatedStringHandler val;
				foreach (string item in obj)
				{
					ManualLogSource l = L;
					val = new BepInExInfoLogInterpolatedStringHandler(9, 1, ref flag);
					if (flag)
					{
						((BepInExLogInterpolatedStringHandler)val).AppendLiteral("doing ");
						((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>(item);
						((BepInExLogInterpolatedStringHandler)val).AppendLiteral(" ..");
					}
					l.LogInfo(val);
					GameObject loadedAsset = AssetAPI.GetLoadedAsset<GameObject>(item);
					if ((Object)(object)loadedAsset == (Object)null)
					{
						continue;
					}
					foreach (LG_MarkerProducer componentsInChild in loadedAsset.GetComponentsInChildren<LG_MarkerProducer>())
					{
						uint num2 = 987654321u;
						Complex val2 = (Complex)0;
						bool flag2 = false;
						if ((int)componentsInChild.MarkerDataBlockType == 0)
						{
							val2 = (Complex)0;
							flag2 = true;
						}
						if ((int)componentsInChild.MarkerDataBlockType == 2)
						{
							val2 = (Complex)2;
							flag2 = true;
						}
						if ((int)componentsInChild.MarkerDataBlockType == 1)
						{
							val2 = (Complex)1;
							flag2 = true;
						}
						if (!flag2 || complexType == val2)
						{
							continue;
						}
						if (componentsInChild.MarkerDataBlockID == dictionary[val2])
						{
							num2 = dictionary[complexType];
						}
						if (componentsInChild.MarkerDataBlockID == dictionary2[val2])
						{
							num2 = dictionary2[complexType];
						}
						if (num2 != 987654321)
						{
							GameObject val3 = new GameObject("HirnuMarker");
							val3.transform.parent = ((Component)componentsInChild).transform.parent;
							val3.transform.position = ((Component)componentsInChild).transform.position;
							val3.transform.localEulerAngles = ((Component)componentsInChild).transform.localEulerAngles;
							if ((int)subComplex == 0)
							{
								MiningDigSiteMarkerProducer obj2 = val3.AddComponent<MiningDigSiteMarkerProducer>();
								((LG_MarkerProducer)obj2).m_groupData = groupData;
								obj2.m_markerDataBlockID = num2;
								((LG_MarkerProducer)obj2).m_allowFunction = componentsInChild.m_allowFunction;
							}
							if ((int)subComplex == 2)
							{
								MiningStorageMarkerProducer obj3 = val3.AddComponent<MiningStorageMarkerProducer>();
								((LG_MarkerProducer)obj3).m_groupData = groupData;
								obj3.m_markerDataBlockID = num2;
								((LG_MarkerProducer)obj3).m_allowFunction = componentsInChild.m_allowFunction;
							}
							if ((int)subComplex == 1)
							{
								MiningRefineryMarkerProducer obj4 = val3.AddComponent<MiningRefineryMarkerProducer>();
								((LG_MarkerProducer)obj4).m_groupData = groupData;
								obj4.m_markerDataBlockID = num2;
								((LG_MarkerProducer)obj4).m_allowFunction = componentsInChild.m_allowFunction;
							}
							if ((int)subComplex == 4)
							{
								TechLabMarkerProducer obj5 = val3.AddComponent<TechLabMarkerProducer>();
								((LG_MarkerProducer)obj5).m_groupData = groupData;
								obj5.m_markerDataBlockID = num2;
								((LG_MarkerProducer)obj5).m_allowFunction = componentsInChild.m_allowFunction;
							}
							if ((int)subComplex == 3)
							{
								TechDataCenterMarkerProducer obj6 = val3.AddComponent<TechDataCenterMarkerProducer>();
								((LG_MarkerProducer)obj6).m_groupData = groupData;
								obj6.m_markerDataBlockID = num2;
								((LG_MarkerProducer)obj6).m_allowFunction = componentsInChild.m_allowFunction;
							}
							if ((int)subComplex == 6)
							{
								ServiceFloodwaysMarkerProducer obj7 = val3.AddComponent<ServiceFloodwaysMarkerProducer>();
								((LG_MarkerProducer)obj7).m_groupData = groupData;
								obj7.m_markerDataBlockID = num2;
								((LG_MarkerProducer)obj7).m_allowFunction = componentsInChild.m_allowFunction;
							}
							if ((int)subComplex == 11)
							{
								ServiceGardensMarkerProducer obj8 = val3.AddComponent<ServiceGardensMarkerProducer>();
								((LG_MarkerProducer)obj8).m_groupData = groupData;
								obj8.m_markerDataBlockID = num2;
								((LG_MarkerProducer)obj8).m_allowFunction = componentsInChild.m_allowFunction;
							}
							ManualLogSource l2 = L;
							val = new BepInExInfoLogInterpolatedStringHandler(27, 3, ref flag);
							if (flag)
							{
								((BepInExLogInterpolatedStringHandler)val).AppendLiteral("handling marker ");
								((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>(((Object)((Component)componentsInChild).gameObject).name);
								((BepInExLogInterpolatedStringHandler)val).AppendLiteral(" id ");
								((BepInExLogInterpolatedStringHandler)val).AppendFormatted<uint>(componentsInChild.MarkerDataBlockID);
								((BepInExLogInterpolatedStringHandler)val).AppendLiteral(" of ");
								BepInExInfoLogInterpolatedStringHandler obj9 = val;
								LG_MarkerDataBlockType markerDataBlockType = componentsInChild.MarkerDataBlockType;
								((BepInExLogInterpolatedStringHandler)obj9).AppendFormatted<string>(((object)(LG_MarkerDataBlockType)(ref markerDataBlockType)).ToString());
								((BepInExLogInterpolatedStringHandler)val).AppendLiteral(" ..");
							}
							l2.LogInfo(val);
							Object.Destroy((Object)(object)((Component)componentsInChild).gameObject);
							num++;
						}
					}
				}
				ManualLogSource l3 = L;
				val = new BepInExInfoLogInterpolatedStringHandler(39, 1, ref flag);
				if (flag)
				{
					((BepInExLogInterpolatedStringHandler)val).AppendLiteral("modified ");
					((BepInExLogInterpolatedStringHandler)val).AppendFormatted<uint>(num);
					((BepInExLogInterpolatedStringHandler)val).AppendLiteral(" markers in desert dimensions.");
				}
				l3.LogInfo(val);
			}
		}

		public static ManualLogSource L;

		public override void Load()
		{
			L = ((BasePlugin)this).Log;
			LG_Factory.OnFactoryBuildStart += Action.op_Implicit((Action)DesertMarkerFix.Initialize);
		}
	}
	[GeneratedCode("VersionInfoGenerator", "2.0.0+git50a4b1a-master")]
	[CompilerGenerated]
	internal static class VersionInfo
	{
		public const string RootNamespace = "DesertMarkerFix";

		public const string Version = "1.0.0";

		public const string VersionPrerelease = null;

		public const string VersionMetadata = null;

		public const string SemVer = "1.0.0";

		public const string GitRevShort = null;

		public const string GitRevLong = null;

		public const string GitBranch = null;

		public const string GitTag = null;

		public const bool GitIsDirty = false;
	}
}