Decompiled source of LocationsOfPrecipitation v1.2.2

LocationsOfPrecipitation.dll

Decompiled 2 weeks ago
using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Security.Permissions;
using System.Threading.Tasks;
using BepInEx;
using BepInEx.Logging;
using HG.Reflection;
using R2API;
using RoR2;
using RoR2.ContentManagement;
using RoR2.ExpansionManagement;
using RoR2.Navigation;
using RoR2BepInExPack.GameAssetPaths.Version_1_39_0;
using RoR2BepInExPack.GameAssetPathsBetter;
using UnityEngine;
using UnityEngine.AddressableAssets;
using UnityEngine.Networking;
using UnityEngine.ResourceManagement.AsyncOperations;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: OptIn]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("0.0.0.0")]
namespace LOP;

[ExecuteAlways]
public class AddressableInjector : MonoBehaviour
{
	[Tooltip("The address used for injecting")]
	public string address;

	[NonSerialized]
	private Object _asset;

	[Tooltip("The component that will be injected")]
	[SerializeField]
	private Component targetComponent;

	[Tooltip("The member info that'll be injected")]
	[SerializeField]
	private string targetMemberInfoName;

	private MemberInfo cachedMemberInfo;

	public Object Asset
	{
		get
		{
			return _asset;
		}
		private set
		{
			_asset = value;
		}
	}

	private void OnEnable()
	{
		Refresh();
	}

	public void Refresh()
	{
		//IL_005b: Unknown result type (might be due to invalid IL or missing references)
		//IL_0060: Unknown result type (might be due to invalid IL or missing references)
		if (string.IsNullOrWhiteSpace(address) || string.IsNullOrEmpty(address) || !Object.op_Implicit((Object)(object)targetComponent) || string.IsNullOrEmpty(targetMemberInfoName) || string.IsNullOrWhiteSpace(targetMemberInfoName))
		{
			return;
		}
		MemberInfo memberInfo = GetMemberInfo();
		if (!(memberInfo == null))
		{
			Object val = Addressables.LoadAssetAsync<Object>((object)address).WaitForCompletion();
			if (Object.op_Implicit(val))
			{
				Asset = val;
				Asset.hideFlags = (HideFlags)28;
				Inject(memberInfo);
			}
		}
	}

	private void Inject(MemberInfo memberInfo)
	{
		if (!(memberInfo is PropertyInfo propertyInfo2))
		{
			if (memberInfo is FieldInfo fieldInfo2)
			{
				InjectFieldInfo(fieldInfo2);
			}
		}
		else
		{
			InjectPropertyInfo(propertyInfo2);
		}
		void InjectFieldInfo(FieldInfo fieldInfo)
		{
			try
			{
				fieldInfo.SetValue(targetComponent, Asset);
			}
			catch (Exception data2)
			{
				LOPLog.Error(data2);
			}
		}
		void InjectPropertyInfo(PropertyInfo propertyInfo)
		{
			try
			{
				propertyInfo.SetValue(targetComponent, Asset);
			}
			catch (Exception data)
			{
				LOPLog.Error(data);
			}
		}
	}

	private MemberInfo GetMemberInfo()
	{
		if ((cachedMemberInfo == null || "(" + cachedMemberInfo.DeclaringType.Name + ") " + cachedMemberInfo.Name != targetMemberInfoName) && Object.op_Implicit((Object)(object)targetComponent))
		{
			cachedMemberInfo = ((object)targetComponent).GetType().GetMembers(BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.FlattenHierarchy).Where(delegate(MemberInfo m)
			{
				string name = m.GetType().Name;
				return name.Contains("Property") || name.Contains("Field");
			})
				.FirstOrDefault((MemberInfo m) => "(" + m.DeclaringType.Name + ") " + m.Name == targetMemberInfoName);
		}
		return cachedMemberInfo;
	}
}
[ExecuteAlways]
public class CameraInstantiator : MonoBehaviour
{
	public const string CAMERA_ADDRESS = "RoR2/Base/Core/Main Camera.prefab";

	[NonSerialized]
	private GameObject _cameraInstance;

	public GameObject CameraInstance
	{
		get
		{
			return _cameraInstance;
		}
		private set
		{
			_cameraInstance = value;
		}
	}

	private void OnEnable()
	{
		Refresh();
	}

	private void OnDisable()
	{
		LOPUtil.DestroyImmediateSafe((Object)(object)CameraInstance, allowDestroyingAssets: true);
	}

	public void Refresh()
	{
		//IL_004d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0052: Unknown result type (might be due to invalid IL or missing references)
		//IL_0094: Unknown result type (might be due to invalid IL or missing references)
		//IL_009b: Unknown result type (might be due to invalid IL or missing references)
		//IL_00bf: 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_00dc: Unknown result type (might be due to invalid IL or missing references)
		//IL_00e3: Unknown result type (might be due to invalid IL or missing references)
		if (Application.isPlaying && !Application.isEditor)
		{
			LOPLog.Fatal($"Lingering camera injector in {((Component)this).gameObject}, Ensure that these scripts are NOT present on finalized builds!!!");
			Object.Destroy((Object)(object)((Component)this).gameObject);
			return;
		}
		if (Object.op_Implicit((Object)(object)CameraInstance))
		{
			LOPUtil.DestroyImmediateSafe((Object)(object)CameraInstance, allowDestroyingAssets: true);
		}
		GameObject val = Addressables.LoadAssetAsync<GameObject>((object)"RoR2/Base/Core/Main Camera.prefab").WaitForCompletion();
		CameraInstance = Object.Instantiate<GameObject>(val, ((Component)this).transform);
		((Object)CameraInstance).name = "[EDITOR ONLY] " + ((Object)CameraInstance).name;
		GameObject cameraInstance = CameraInstance;
		((Object)cameraInstance).hideFlags = (HideFlags)(((Object)cameraInstance).hideFlags | 0x1C);
		Transform[] componentsInChildren = CameraInstance.GetComponentsInChildren<Transform>();
		for (int i = 0; i < componentsInChildren.Length; i++)
		{
			((Object)((Component)componentsInChildren[i]).gameObject).hideFlags = (HideFlags)(((Object)CameraInstance).hideFlags | 1);
		}
		GameObject cameraInstance2 = CameraInstance;
		((Object)cameraInstance2).hideFlags = (HideFlags)(((Object)cameraInstance2).hideFlags & -2);
	}
}
public static class Constants
{
	public static class AssetGUIDS
	{
		public enum Expansion
		{
			DLC1 = 1,
			DLC2,
			DLC3
		}

		public static string accessNodeGUID = "383d1a1eefe41db4eb8708719f86fc03";

		public static string iscHardwareProgPortalGUID = "c4e7a9ed6153edf488cf434d843311f5";

		public static string iscHardwareProgPortalHauntGUID = "7c01731f4ba8cb548af2a35bce9105d3";

		public static string iscSolusShopPortalGUID = "07fc379a8d5d3c44c9211730bf4e1572";

		public static string cscSolusAmalgamator = "14bf22df446f37549aa65eb724c1ddda";

		public static string dlc1ExpansionGUID = "d4f30c23b971a9b428e2796dc04ae099";

		public static string dlc2ExpansionGUID = "851f234056d389b42822523d1be6a167";

		public static string dlc3ExpansionGUID = "234e83997deed274291470be69e7662e";

		public static string GetVanillaExpansion(Expansion expansion)
		{
			switch (expansion)
			{
			case Expansion.DLC1:
				return dlc1ExpansionGUID;
			case Expansion.DLC2:
				return dlc1ExpansionGUID;
			case Expansion.DLC3:
				return dlc3ExpansionGUID;
			default:
				LOPLog.Error("Invalid Expansion provided.");
				return null;
			}
		}
	}
}
public class ContentProvider : IContentPackProvider
{
	private readonly ContentPack _contentPack = new ContentPack();

	public string identifier => "JaceDaDorito.LocationsOfPrecipitation.ContentProvider";

	public IEnumerator FinalizeAsync(FinalizeAsyncArgs args)
	{
		args.ReportProgress(1f);
		yield break;
	}

	public IEnumerator GenerateContentPackAsync(GetContentPackAsyncArgs args)
	{
		ContentPack.Copy(_contentPack, args.output);
		args.ReportProgress(1f);
		yield break;
	}

	public IEnumerator LoadStaticContentAsync(LoadStaticContentAsyncArgs args)
	{
		_contentPack.identifier = identifier;
		InstantiateArtifactPortal.CreateAndRegisterLaptop(_contentPack);
		yield break;
	}
}
[ExecuteAlways]
public class InstantiateAddressablePrefab : MonoBehaviour
{
	[Tooltip("The address to use to load the prefab")]
	[SerializeField]
	private string address;

	[Tooltip("When the prefab is instantiated, and this is true, the prefab's position and rotation will be set to 0")]
	[SerializeField]
	private bool setPositionAndRotationToZero = true;

	[Tooltip("setPositionAndRotationToZero would work relative to it's parent")]
	[SerializeField]
	private bool useLocalPositionAndRotation = true;

	[Tooltip("Wether the Refresh method will be called in the editor")]
	[SerializeField]
	private bool refreshInEditor = true;

	[SerializeField]
	[HideInInspector]
	private bool hasNetworkIdentity;

	[NonSerialized]
	private GameObject instance;

	public GameObject Instance => instance;

	private void OnEnable()
	{
		Refresh();
	}

	private void OnDisable()
	{
		if (Object.op_Implicit((Object)(object)instance))
		{
			LOPUtil.DestroyImmediateSafe((Object)(object)instance, allowDestroyingAssets: true);
		}
	}

	public void Refresh()
	{
		//IL_005a: Unknown result type (might be due to invalid IL or missing references)
		//IL_005f: Unknown result type (might be due to invalid IL or missing references)
		//IL_00d7: Unknown result type (might be due to invalid IL or missing references)
		//IL_00de: Unknown result type (might be due to invalid IL or missing references)
		//IL_0102: Unknown result type (might be due to invalid IL or missing references)
		//IL_014e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0153: Unknown result type (might be due to invalid IL or missing references)
		//IL_0135: 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)
		if (Application.isEditor && !refreshInEditor)
		{
			return;
		}
		if (Object.op_Implicit((Object)(object)instance))
		{
			LOPUtil.DestroyImmediateSafe((Object)(object)instance, allowDestroyingAssets: true);
		}
		if (string.IsNullOrWhiteSpace(address) || string.IsNullOrEmpty(address))
		{
			LOPLog.Warning($"Invalid address in {this}, address is null, empty, or white space");
			return;
		}
		GameObject val = Addressables.LoadAssetAsync<GameObject>((object)address).WaitForCompletion();
		hasNetworkIdentity = Object.op_Implicit((Object)(object)val.GetComponent<NetworkIdentity>());
		if (hasNetworkIdentity && !Application.isEditor)
		{
			if (NetworkServer.active)
			{
				instance = Object.Instantiate<GameObject>(val, ((Component)this).transform);
				NetworkServer.Spawn(instance);
			}
		}
		else
		{
			instance = Object.Instantiate<GameObject>(val, ((Component)this).transform);
		}
		if (!Object.op_Implicit((Object)(object)instance))
		{
			return;
		}
		GameObject obj = instance;
		((Object)obj).hideFlags = (HideFlags)(((Object)obj).hideFlags | 0x1C);
		Transform[] componentsInChildren = instance.GetComponentsInChildren<Transform>();
		for (int i = 0; i < componentsInChildren.Length; i++)
		{
			((Object)((Component)componentsInChildren[i]).gameObject).hideFlags = ((Object)instance).hideFlags;
		}
		if (setPositionAndRotationToZero)
		{
			Transform transform = instance.transform;
			if (useLocalPositionAndRotation)
			{
				transform.localPosition = Vector3.zero;
				transform.localRotation = Quaternion.identity;
			}
			else
			{
				transform.SetPositionAndRotation(Vector3.zero, Quaternion.identity);
			}
		}
	}
}
public class InstantiateArtifactFormulaDisplay : MonoBehaviour
{
	public enum Codes
	{
		Circle,
		Diamond,
		Square,
		Triangle
	}

	[Tooltip("Location of artifact code slab. It will respect position and rotation, but not scale.")]
	public Transform position;

	[Tooltip("Codes to show. Codes start in top left corner, 3 per row. You need exactly 9, otherwise slab will not spawn.")]
	public Codes[] code;

	private void Awake()
	{
		//IL_001c: Unknown result type (might be due to invalid IL or missing references)
		//IL_0021: Unknown result type (might be due to invalid IL or missing references)
		//IL_002f: Unknown result type (might be due to invalid IL or missing references)
		//IL_003a: Unknown result type (might be due to invalid IL or missing references)
		if (code.Length != 9)
		{
			LOPLog.Warning("Slab's code length is not equal to 9, doing nothing...");
			return;
		}
		ArtifactFormulaDisplay component = Object.Instantiate<GameObject>(Addressables.LoadAssetAsync<GameObject>((object)RoR2_Base_artifactworld.ArtifactFormulaDisplay_prefab).WaitForCompletion(), position.position, position.rotation).GetComponent<ArtifactFormulaDisplay>();
		for (int i = 0; i < code.Length; i++)
		{
			component.artifactCompoundDisplayInfos[i].artifactCompoundDef = GetACD(code[i]);
		}
		static ArtifactCompoundDef GetACD(Codes code)
		{
			//IL_001d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0022: Unknown result type (might be due to invalid IL or missing references)
			//IL_0030: Unknown result type (might be due to invalid IL or missing references)
			//IL_0035: Unknown result type (might be due to invalid IL or missing references)
			//IL_0043: 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_0056: Unknown result type (might be due to invalid IL or missing references)
			//IL_005b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0069: Unknown result type (might be due to invalid IL or missing references)
			//IL_006e: Unknown result type (might be due to invalid IL or missing references)
			return (ArtifactCompoundDef)(code switch
			{
				Codes.Circle => Addressables.LoadAssetAsync<ArtifactCompoundDef>((object)RoR2_Base_ArtifactCompounds.acdCircle_asset).WaitForCompletion(), 
				Codes.Diamond => Addressables.LoadAssetAsync<ArtifactCompoundDef>((object)RoR2_Base_ArtifactCompounds.acdDiamond_asset).WaitForCompletion(), 
				Codes.Square => Addressables.LoadAssetAsync<ArtifactCompoundDef>((object)RoR2_Base_ArtifactCompounds.acdSquare_asset).WaitForCompletion(), 
				Codes.Triangle => Addressables.LoadAssetAsync<ArtifactCompoundDef>((object)RoR2_Base_ArtifactCompounds.acdTriangle_asset).WaitForCompletion(), 
				_ => Addressables.LoadAssetAsync<ArtifactCompoundDef>((object)RoR2_Base_ArtifactCompounds.acdEmpty_asset).WaitForCompletion(), 
			});
		}
	}

	public void OnDrawGizmos()
	{
		//IL_000d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0027: Unknown result type (might be due to invalid IL or missing references)
		//IL_0032: Unknown result type (might be due to invalid IL or missing references)
		//IL_0046: Unknown result type (might be due to invalid IL or missing references)
		//IL_0050: Unknown result type (might be due to invalid IL or missing references)
		if (Object.op_Implicit((Object)(object)position))
		{
			Gizmos.color = Color.yellow;
			Gizmos.DrawWireMesh(Resources.GetBuiltinResource<Mesh>("Cube.fbx"), position.position, position.rotation, new Vector3(4.0284877f, 6.4461765f, 1.6496983f));
			GUI.color = Color.yellow;
		}
	}

	private void OnValidate()
	{
	}
}
public class InstantiateArtifactPortal : NetworkBehaviour
{
	[Tooltip("Location of artifact portal buttons. You need exactly 9 buttons and first button should be top left, 3 per row, left to right.")]
	public Transform[] artifactButtons;

	[Tooltip("Location of the portal that spawns on successful code. Forward indicates direction of portal particles flow.")]
	public Transform portalLocation;

	[Tooltip("Location of the table and laptop. Forward indicates the direction of laptop screen.")]
	public Transform laptopLocation;

	private GameObject laptopInstance;

	private static GameObject laptopPrefab;

	private static Dictionary<int, int> buttonsPositions = new Dictionary<int, int>
	{
		{ 0, 6 },
		{ 1, 3 },
		{ 2, 0 },
		{ 3, 7 },
		{ 4, 5 },
		{ 5, 1 },
		{ 6, 8 },
		{ 7, 4 },
		{ 8, 2 }
	};

	private const uint NET_ID_DIRTY_BIT = 1u;

	private void Awake()
	{
		//IL_0052: 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)
		//IL_00ae: 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_00c9: Unknown result type (might be due to invalid IL or missing references)
		//IL_00d6: Unknown result type (might be due to invalid IL or missing references)
		if (!NetworkServer.active)
		{
			return;
		}
		if (artifactButtons.Length != 9)
		{
			LOPLog.Warning("There are more or less than 9 artifact buttons. Doing nothing...");
		}
		else if (Object.op_Implicit((Object)(object)laptopPrefab) && Object.op_Implicit((Object)(object)portalLocation) && Object.op_Implicit((Object)(object)laptopLocation))
		{
			laptopInstance = Object.Instantiate<GameObject>(laptopPrefab, laptopLocation.position, laptopLocation.rotation);
			PortalDialerController component = laptopInstance.GetComponent<PortalDialerController>();
			component.buttons = (PortalDialerButtonController[])(object)new PortalDialerButtonController[9];
			component.dialingOrder = (PortalDialerButtonController[])(object)new PortalDialerButtonController[9];
			component.portalSpawnLocation = portalLocation;
			NetworkServer.Spawn(laptopInstance);
			GameObject val = Addressables.LoadAssetAsync<GameObject>((object)RoR2_Base_skymeadow.PortalDialerButton_prefab).WaitForCompletion();
			for (int i = 0; i < artifactButtons.Length; i++)
			{
				GameObject obj = Object.Instantiate<GameObject>(val, artifactButtons[i].position, artifactButtons[i].rotation);
				PortalDialerButtonController component2 = obj.GetComponent<PortalDialerButtonController>();
				component.buttons[buttonsPositions[i]] = component2;
				component.dialingOrder[i] = component2;
				NetworkServer.Spawn(obj);
			}
			((NetworkBehaviour)this).SetDirtyBit(1u);
		}
	}

	public override bool OnSerialize(NetworkWriter writer, bool initialState)
	{
		//IL_0031: Unknown result type (might be due to invalid IL or missing references)
		uint num = ((NetworkBehaviour)this).syncVarDirtyBits;
		if (initialState)
		{
			num = 1u;
		}
		if (Object.op_Implicit((Object)(object)laptopInstance))
		{
			writer.WritePackedUInt32(num);
			if ((num & (true ? 1u : 0u)) != 0)
			{
				writer.Write(laptopInstance.GetComponent<NetworkIdentity>().netId);
			}
		}
		return num != 0;
	}

	public override void OnDeserialize(NetworkReader reader, bool initialState)
	{
		//IL_000b: Unknown result type (might be due to invalid IL or missing references)
		if ((reader.ReadPackedUInt32() & 1) == 0)
		{
			return;
		}
		GameObject val = Util.FindNetworkObject(reader.ReadNetworkId());
		if (Object.op_Implicit((Object)(object)val))
		{
			PortalDialerController component = val.GetComponent<PortalDialerController>();
			if (Object.op_Implicit((Object)(object)component))
			{
				component.portalSpawnLocation = portalLocation;
			}
		}
	}

	public void OnDrawGizmos()
	{
		//IL_0018: Unknown result type (might be due to invalid IL or missing references)
		//IL_0028: Unknown result type (might be due to invalid IL or missing references)
		//IL_003e: Unknown result type (might be due to invalid IL or missing references)
		//IL_004d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0061: Unknown result type (might be due to invalid IL or missing references)
		//IL_0068: Unknown result type (might be due to invalid IL or missing references)
		//IL_007c: Unknown result type (might be due to invalid IL or missing references)
		//IL_0086: 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_00bc: Unknown result type (might be due to invalid IL or missing references)
		//IL_00c2: Unknown result type (might be due to invalid IL or missing references)
		//IL_00d6: Unknown result type (might be due to invalid IL or missing references)
		//IL_00e0: Unknown result type (might be due to invalid IL or missing references)
		if (Object.op_Implicit((Object)(object)laptopLocation))
		{
			Vector3 val = default(Vector3);
			((Vector3)(ref val))..ctor(laptopLocation.position.x, laptopLocation.position.y + 0.4f, laptopLocation.position.z);
			Gizmos.color = Color.gray;
			Gizmos.DrawWireMesh(Resources.GetBuiltinResource<Mesh>("Cube.fbx"), val, laptopLocation.rotation, new Vector3(5.1596975f, 1.8985313f, 1.9524249f));
			GUI.color = Color.gray;
		}
		Transform[] array = artifactButtons;
		foreach (Transform val2 in array)
		{
			if (Object.op_Implicit((Object)(object)val2))
			{
				Gizmos.color = Color.red;
				Gizmos.DrawWireMesh(Resources.GetBuiltinResource<Mesh>("Cylinder.fbx"), val2.position, val2.rotation, new Vector3(1.5128947f, 0.5232223f, 1.5475767f));
				GUI.color = Color.red;
			}
		}
	}

	private void OnValidate()
	{
	}

	public static void CreateAndRegisterLaptop(ContentPack contentPack)
	{
		//IL_0005: Unknown result type (might be due to invalid IL or missing references)
		//IL_000a: Unknown result type (might be due to invalid IL or missing references)
		GameObject val = Addressables.LoadAssetAsync<GameObject>((object)RoR2_Base_skymeadow.PortalDialerEvent_prefab).WaitForCompletion();
		Transform val2 = val.transform.Find("Final Zone/ButtonContainer/PortalDialer");
		if (!Object.op_Implicit((Object)(object)val2))
		{
			LOPLog.Warning($"Couldn't find PortalDialer in {val}. Not registering laptop to NetworkedObjects catalog...");
			return;
		}
		Object.DestroyImmediate((Object)(object)((Component)val2.Find("spmSMGrassSmallCluster (3)")).gameObject);
		Object.DestroyImmediate((Object)(object)((Component)val2.Find("spmSMGrassSmallCluster (4)")).gameObject);
		Object.DestroyImmediate((Object)(object)((Component)val2.Find("SM_PowerLine")).gameObject);
		laptopPrefab = PrefabAPI.InstantiateClone(((Component)val2).gameObject, "LOP_ArtifactLaptop", true);
		contentPack.networkedObjectPrefabs.Add((GameObject[])(object)new GameObject[1] { laptopPrefab });
	}

	private void UNetVersion()
	{
	}

	public override void PreStartClient()
	{
	}
}
[ExecuteAlways]
[RequireComponent(typeof(JumpVolume))]
public class InstantiateGeyserPrefab : MonoBehaviour
{
	public enum GeyserType
	{
		Default,
		Ambry,
		Moon,
		Aphelian,
		Siphoned,
		Void,
		Fan,
		Shroom,
		Meridian
	}

	[Tooltip("The prefab used for the geyser")]
	[SerializeField]
	public GeyserType geyserType;

	[Tooltip("When the prefab is instantiated, and this is true, the prefab's position and rotation will be set to 0")]
	[SerializeField]
	private bool setPositionAndRotationToZero = true;

	[Tooltip("setPositionAndRotationToZero would work relative to it's parent")]
	[SerializeField]
	private bool useLocalPositionAndRotation = true;

	[Tooltip("Wether the Refresh method will be called in the editor")]
	[SerializeField]
	private bool refreshInEditor = true;

	[Tooltip("Wether the sound string remains the same as the original instance")]
	[SerializeField]
	private bool conserveSoundString;

	[HideInInspector]
	public bool gateToggleOnPurchase;

	[HideInInspector]
	public string gateToEnableWhenPurchased;

	[HideInInspector]
	public string gateToDisableWhenPurchased;

	[SerializeField]
	[HideInInspector]
	private bool hasNetworkIdentity;

	private string address;

	[NonSerialized]
	private GameObject instance;

	public GameObject Instance => instance;

	private void OnEnable()
	{
		Refresh();
	}

	private void OnDisable()
	{
		if (Object.op_Implicit((Object)(object)instance))
		{
			LOPUtil.DestroyImmediateSafe((Object)(object)instance);
		}
	}

	public void Refresh()
	{
		//IL_0113: Unknown result type (might be due to invalid IL or missing references)
		//IL_0118: 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_017f: Unknown result type (might be due to invalid IL or missing references)
		//IL_020e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0215: Unknown result type (might be due to invalid IL or missing references)
		//IL_023b: Unknown result type (might be due to invalid IL or missing references)
		//IL_0288: Unknown result type (might be due to invalid IL or missing references)
		//IL_028d: Unknown result type (might be due to invalid IL or missing references)
		//IL_026f: Unknown result type (might be due to invalid IL or missing references)
		//IL_027b: Unknown result type (might be due to invalid IL or missing references)
		if (Application.isEditor && !refreshInEditor)
		{
			return;
		}
		if (Object.op_Implicit((Object)(object)instance))
		{
			LOPUtil.DestroyImmediateSafe((Object)(object)instance);
		}
		switch ((int)geyserType)
		{
		case 0:
			address = "RoR2/Base/Common/Props/Geyser.prefab";
			break;
		case 1:
			address = "RoR2/Base/artifactworld/AWGeyser.prefab";
			break;
		case 2:
			address = "RoR2/Base/moon/MoonGeyser.prefab";
			break;
		case 3:
			address = "RoR2/DLC1/ancientloft/AL_Geyser.prefab";
			break;
		case 4:
			address = "RoR2/DLC1/snowyforest/SFGeyser.prefab";
			break;
		case 5:
			address = "RoR2/DLC1/voidstage/mdlVoidGravityGeyser.prefab";
			break;
		case 6:
			address = "RoR2/Base/frozenwall/FW_HumanFan.prefab";
			break;
		case 7:
			address = "RoR2/Base/rootjungle/RJ_BounceShroom.prefab";
			break;
		case 8:
			address = "RoR2/DLC2/meridian/PMLaunchPad.prefab";
			break;
		case 9:
			address = "RoR2/DLC2/lakes/Assets/TLJumpPad.prefab";
			break;
		case 10:
			address = "RoR2/DLC2/helminthroost/Assets/HRLaunchPad.prefab";
			break;
		default:
			LOPLog.Error($"This isn't supposed to print in {this}. Geyser Type is invalid.");
			return;
		}
		GameObject val = Addressables.LoadAssetAsync<GameObject>((object)address).WaitForCompletion();
		instance = Object.Instantiate<GameObject>(val, ((Component)this).transform);
		JumpVolume component = ((Component)this).gameObject.GetComponent<JumpVolume>();
		JumpVolume componentInChildren = instance.GetComponentInChildren<JumpVolume>(true);
		if (Object.op_Implicit((Object)(object)component.targetElevationTransform))
		{
			componentInChildren.targetElevationTransform = component.targetElevationTransform;
		}
		else
		{
			LOPLog.Warning($"Target elevation transform on {this} is invalid.");
		}
		componentInChildren.jumpVelocity = component.jumpVelocity;
		componentInChildren.time = component.time;
		if (!conserveSoundString)
		{
			if (string.IsNullOrEmpty(component.jumpSoundString))
			{
				LOPLog.Warning($"Jump sound string is empty on {this}. This will result in silence for your geyser.");
			}
			componentInChildren.jumpSoundString = component.jumpSoundString;
		}
		componentInChildren.onJump = component.onJump;
		if (geyserType == GeyserType.Fan && gateToggleOnPurchase)
		{
			GateStateSetter obj = ((Component)componentInChildren).gameObject.AddComponent<GateStateSetter>();
			obj.gateToEnableWhenEnabled = gateToEnableWhenPurchased;
			obj.gateToDisableWhenEnabled = gateToDisableWhenPurchased;
		}
		((Behaviour)component).enabled = false;
		GameObject obj2 = instance;
		((Object)obj2).hideFlags = (HideFlags)(((Object)obj2).hideFlags | 0x1C);
		Transform[] componentsInChildren = instance.GetComponentsInChildren<Transform>();
		for (int i = 0; i < componentsInChildren.Length; i++)
		{
			((Object)((Component)componentsInChildren[i]).gameObject).hideFlags = ((Object)instance).hideFlags;
		}
		if (setPositionAndRotationToZero)
		{
			Transform transform = instance.transform;
			if (useLocalPositionAndRotation)
			{
				transform.localPosition = Vector3.zero;
				transform.localRotation = Quaternion.identity;
			}
			else
			{
				transform.SetPositionAndRotation(Vector3.zero, Quaternion.identity);
			}
		}
	}
}
[RequireComponent(typeof(VelocityRandomOnStart))]
public class InstantiateLogbookPrefab : MonoBehaviour
{
	[Tooltip("The unlock that triggers when the prefab is picked up.")]
	[SerializeField]
	private UnlockableDef unlockableDef;

	[Tooltip("The token for the text that appears when the prefab is picked up.")]
	[SerializeField]
	private string displayNameToken;

	[Tooltip("Turns on gravity for the pickup.")]
	[SerializeField]
	private bool enableGravity;

	private static Mesh cubeMesh;

	[NonSerialized]
	private GameObject instance;

	public GameObject Instance => instance;

	private void OnEnable()
	{
		Refresh();
	}

	private void OnDisable()
	{
		if (Object.op_Implicit((Object)(object)instance))
		{
			Object.Destroy((Object)(object)instance);
		}
	}

	public void OnDrawGizmos()
	{
		//IL_0040: Unknown result type (might be due to invalid IL or missing references)
		//IL_0045: 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_0057: 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)
		cubeMesh = Resources.GetBuiltinResource<Mesh>("Cube.fbx");
		Transform transform = ((Component)this).gameObject.transform;
		Vector3 val = default(Vector3);
		((Vector3)(ref val))..ctor(1.16f, 0.43f, 1.39f);
		Color color = (Gizmos.color = new Color(0.7255f, 0.4314f, 1f));
		Gizmos.DrawWireMesh(cubeMesh, transform.position, transform.rotation, val);
		GUI.color = color;
	}

	public void Refresh()
	{
		//IL_0066: Unknown result type (might be due to invalid IL or missing references)
		//IL_006b: Unknown result type (might be due to invalid IL or missing references)
		//IL_00a4: Unknown result type (might be due to invalid IL or missing references)
		//IL_00ae: Unknown result type (might be due to invalid IL or missing references)
		//IL_00e9: Unknown result type (might be due to invalid IL or missing references)
		//IL_00ee: Unknown result type (might be due to invalid IL or missing references)
		//IL_0101: Unknown result type (might be due to invalid IL or missing references)
		//IL_0106: Unknown result type (might be due to invalid IL or missing references)
		if (Object.op_Implicit((Object)(object)instance))
		{
			Object.Destroy((Object)(object)instance);
		}
		if (!Object.op_Implicit((Object)(object)unlockableDef))
		{
			LOPLog.Warning($"No unlockableDef in {this}. Cancelling instantiation.");
			return;
		}
		if (string.IsNullOrEmpty(displayNameToken) || string.IsNullOrWhiteSpace(displayNameToken))
		{
			LOPLog.Warning($"Invalid displayNameToken in {this}, displayNameToken is null, empty, or white space. Cancelling instantiation.");
			return;
		}
		GameObject val = Addressables.LoadAssetAsync<GameObject>((object)"RoR2/Base/Common/LogPickup.prefab").WaitForCompletion();
		if (NetworkServer.active)
		{
			instance = Object.Instantiate<GameObject>(val, ((Component)this).transform);
			NetworkServer.Spawn(instance);
		}
		Transform transform = instance.transform;
		transform.localPosition = Vector3.zero;
		transform.localRotation = Quaternion.identity;
		VelocityRandomOnStart component = ((Component)this).gameObject.GetComponent<VelocityRandomOnStart>();
		VelocityRandomOnStart component2 = instance.GetComponent<VelocityRandomOnStart>();
		component2.minSpeed = component.minSpeed;
		component2.maxSpeed = component.maxSpeed;
		component2.baseDirection = component.baseDirection;
		component2.localDirection = component.localDirection;
		component2.directionMode = component.directionMode;
		component2.coneAngle = component.coneAngle;
		component2.minAngularSpeed = component.minAngularSpeed;
		component2.maxAngularSpeed = component.maxAngularSpeed;
		((Behaviour)component).enabled = false;
		instance.GetComponent<Rigidbody>().useGravity = enableGravity;
		UnlockPickup componentInChildren = instance.GetComponentInChildren<UnlockPickup>();
		componentInChildren.displayNameToken = displayNameToken;
		componentInChildren.unlockableDef = unlockableDef;
	}
}
[BepInPlugin("JaceDaDorito.LocationsOfPrecipitation", "LocationsOfPrecipitation", "1.2.2")]
public class LocationsOfPrecipitation : BaseUnityPlugin
{
	public const string Author = "JaceDaDorito";

	public const string Name = "LocationsOfPrecipitation";

	public const string Version = "1.2.2";

	public const string GUID = "JaceDaDorito.LocationsOfPrecipitation";

	public static LocationsOfPrecipitation Instance { get; private set; }

	public static PluginInfo PluginInfo { get; private set; }

	internal static ManualLogSource Logger { get; set; }

	private static string AssemblyDir => Path.GetDirectoryName(PluginInfo.Location);

	public static AssetBundle lopAssetBundle { get; private set; }

	private void Awake()
	{
		//IL_0047: Unknown result type (might be due to invalid IL or missing references)
		//IL_0051: Expected O, but got Unknown
		Instance = this;
		PluginInfo = ((BaseUnityPlugin)this).Info;
		Logger = ((BaseUnityPlugin)this).Logger;
		new LOPLog(Logger);
		lopAssetBundle = AssetBundle.LoadFromFile(Path.Combine(AssemblyDir, "runtimelopassetbundle"));
		ContentManager.collectContentPackProviders += new CollectContentPackProvidersDelegate(ContentManager_collectContentPackProviders);
	}

	private void ContentManager_collectContentPackProviders(AddContentPackProviderDelegate addContentPackProvider)
	{
		addContentPackProvider.Invoke((IContentPackProvider)(object)new ContentProvider());
	}
}
internal class LOPLog
{
	private static ManualLogSource logger;

	internal LOPLog(ManualLogSource logger_)
	{
		logger = logger_;
	}

	internal static void Debug(object data)
	{
		logger.LogDebug(data);
	}

	internal static void Error(object data)
	{
		logger.LogError(data);
	}

	internal static void Fatal(object data)
	{
		logger.LogFatal(data);
	}

	internal static void Info(object data)
	{
		logger.LogInfo(data);
	}

	internal static void Message(object data)
	{
		logger.LogMessage(data);
	}

	internal static void Warning(object data)
	{
		logger.LogWarning(data);
	}
}
public static class LOPUtil
{
	public static void DestroyImmediateSafe(Object obj, bool allowDestroyingAssets = false)
	{
		Object.Destroy(obj);
	}

	public static void Shuffle<T>(this Xoroshiro128Plus rng, T[] array)
	{
		int num = array.Length;
		while (num > 1)
		{
			int num2 = rng.RangeInt(0, num--);
			T val = array[num];
			array[num] = array[num2];
			array[num2] = val;
		}
	}
}
public class PlayerSpawnPointController : MonoBehaviour
{
	public enum SpawnPointMode
	{
		WithinRange,
		NearestNode,
		Static
	}

	public enum SpawnPointOrder
	{
		LinearWrap,
		PingPong,
		ClusterOnFirstValidPOI,
		Random
	}

	[Tooltip("List of referenced Transforms to create player spawn points.")]
	[SerializeField]
	public Transform[] spawnPointPOIs;

	[Tooltip("Mode of creating player spawn points. WithinRange creates spawn points at ground nodes around a POI within a range between minDistance and maxDistance. NearestNode creates a spawn point at the nearest ground node to the POI. Static creates a spawn point at the POI.")]
	[SerializeField]
	public SpawnPointMode spawnPointMode;

	[SerializeField]
	public float minDistance = 10f;

	[SerializeField]
	public float maxDistance = 40f;

	[Tooltip("Shuffle the POIs at the start of creating spawn points")]
	[SerializeField]
	public bool initialRandomization = true;

	[SerializeField]
	public bool createPointPerPlayer;

	[SerializeField]
	public SpawnPointOrder order;

	private NodeGraph groundNodes;

	private void OnEnable()
	{
		//IL_0007: Unknown result type (might be due to invalid IL or missing references)
		//IL_0011: Expected O, but got Unknown
		SceneDirector.onPreGeneratePlayerSpawnPointsServer += new GenerateSpawnPointsDelegate(SceneDirector_onPreGeneratePlayerSpawnPointsServer);
	}

	private void OnDisable()
	{
		//IL_0007: Unknown result type (might be due to invalid IL or missing references)
		//IL_0011: Expected O, but got Unknown
		SceneDirector.onPreGeneratePlayerSpawnPointsServer -= new GenerateSpawnPointsDelegate(SceneDirector_onPreGeneratePlayerSpawnPointsServer);
	}

	private void SceneDirector_onPreGeneratePlayerSpawnPointsServer(SceneDirector sceneDirector, ref Action generationMethod)
	{
		generationMethod = GeneratePlayerSpawnPointsServer;
	}

	private void GeneratePlayerSpawnPointsServer()
	{
		if (!Object.op_Implicit((Object)(object)SceneInfo.instance))
		{
			LOPLog.Error("There is no SceneInfo instance, spawn points cannot be generated.");
			return;
		}
		if (spawnPointPOIs.Length == 0)
		{
			LOPLog.Error($"No spawn point POIs populated in {this}, spawn points cannot be generated.");
			return;
		}
		groundNodes = SceneInfo.instance.groundNodes;
		if (!Object.op_Implicit((Object)(object)groundNodes) && spawnPointMode != SpawnPointMode.Static)
		{
			LOPLog.Error("There are no ground nodes in this scene. Make sure there is a ground node asset or spawnPointMode is set to Static.");
			return;
		}
		if (initialRandomization)
		{
			RoR2Application.rng.Shuffle(spawnPointPOIs);
		}
		if (createPointPerPlayer)
		{
			if (spawnPointMode != 0)
			{
				LOPLog.Warning("Creating Spawn points per player is incompatible with any SpawnPointMode that isn't WithinRange. This is to prevent players from spawning on top of each other.");
				GenerateSpawnPointsPerTransform();
			}
			GenerateSpawnPointsPerPlayer();
		}
		else
		{
			GenerateSpawnPointsPerTransform();
		}
	}

	private void GenerateSpawnPointsPerTransform()
	{
		//IL_0049: Unknown result type (might be due to invalid IL or missing references)
		//IL_004e: Unknown result type (might be due to invalid IL or missing references)
		//IL_002d: Unknown result type (might be due to invalid IL or missing references)
		//IL_003a: 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_0066: Unknown result type (might be due to invalid IL or missing references)
		//IL_0071: Unknown result type (might be due to invalid IL or missing references)
		//IL_0076: 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_00bc: Unknown result type (might be due to invalid IL or missing references)
		//IL_00b5: Unknown result type (might be due to invalid IL or missing references)
		//IL_00ba: Unknown result type (might be due to invalid IL or missing references)
		//IL_00ce: Unknown result type (might be due to invalid IL or missing references)
		//IL_00d8: Unknown result type (might be due to invalid IL or missing references)
		//IL_00e1: Unknown result type (might be due to invalid IL or missing references)
		Vector3 val2 = default(Vector3);
		for (int i = 0; i < spawnPointPOIs.Length && ((Component)spawnPointPOIs[i]).gameObject.activeSelf; i++)
		{
			if (spawnPointMode == SpawnPointMode.Static)
			{
				SpawnPoint.AddSpawnPoint(spawnPointPOIs[i].position, spawnPointPOIs[i].rotation);
				continue;
			}
			NodeIndex val = NodeIndex.invalid;
			if (spawnPointMode == SpawnPointMode.NearestNode)
			{
				val = groundNodes.FindClosestNode(spawnPointPOIs[i].position, (HullClassification)0, float.PositiveInfinity);
			}
			else
			{
				List<NodeIndex> list = groundNodes.FindNodesInRange(spawnPointPOIs[i].position, minDistance, maxDistance, (HullMask)1);
				if (list.Count > 0)
				{
					val = list[Random.Range(0, list.Count)];
				}
			}
			if (!(val == NodeIndex.invalid) && groundNodes.GetNodePosition(val, ref val2))
			{
				SpawnPoint.AddSpawnPoint(val2, spawnPointPOIs[i].rotation);
			}
		}
	}

	private void GenerateSpawnPointsPerPlayer()
	{
		if (order == SpawnPointOrder.ClusterOnFirstValidPOI)
		{
			GenerateSpawnPointCluster();
		}
		else
		{
			GeneratePlayerSpawnPointsInteration();
		}
	}

	private void GenerateSpawnPointCluster()
	{
		//IL_000b: Unknown result type (might be due to invalid IL or missing references)
		//IL_0010: Unknown result type (might be due to invalid IL or missing references)
		//IL_002b: Unknown result type (might be due to invalid IL or missing references)
		//IL_009d: Unknown result type (might be due to invalid IL or missing references)
		//IL_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_00a4: 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: 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)
		int participatingPlayerCount = Run.instance.participatingPlayerCount;
		NodeIndex invalid = NodeIndex.invalid;
		int num = 0;
		List<NodeIndex> list = new List<NodeIndex>();
		for (num = 0; num < spawnPointPOIs.Length; num++)
		{
			list = groundNodes.FindNodesInRange(spawnPointPOIs[num].position, minDistance, maxDistance, (HullMask)1);
			if (list.Count >= 1)
			{
				break;
			}
			LOPLog.Warning("Cannot find a valid node to create a spawn point cluster around POI: " + ((Object)spawnPointPOIs[num]).name);
		}
		if (list.Count < 1)
		{
			LOPLog.Error("Cannot create any valid spawn point clusters. No spawn points generated.");
			return;
		}
		Vector3 val = default(Vector3);
		for (int i = 0; i < participatingPlayerCount; i++)
		{
			invalid = list[Random.Range(0, list.Count)];
			if (!(invalid == NodeIndex.invalid) && groundNodes.GetNodePosition(invalid, ref val))
			{
				SpawnPoint.AddSpawnPoint(val, spawnPointPOIs[num].rotation);
			}
		}
	}

	private void GeneratePlayerSpawnPointsInteration()
	{
		//IL_000b: Unknown result type (might be due to invalid IL or missing references)
		//IL_0010: Unknown result type (might be due to invalid IL or missing references)
		//IL_002b: Unknown result type (might be due to invalid IL or missing references)
		//IL_006d: 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_0067: Unknown result type (might be due to invalid IL or missing references)
		//IL_006c: Unknown result type (might be due to invalid IL or missing references)
		//IL_00a1: Unknown result type (might be due to invalid IL or missing references)
		//IL_00ab: Unknown result type (might be due to invalid IL or missing references)
		//IL_00b5: Unknown result type (might be due to invalid IL or missing references)
		int participatingPlayerCount = Run.instance.participatingPlayerCount;
		NodeIndex val = NodeIndex.invalid;
		int num = 0;
		int num2 = 1;
		Vector3 val2 = default(Vector3);
		for (int i = 0; i < participatingPlayerCount; i++)
		{
			List<NodeIndex> list = groundNodes.FindNodesInRange(spawnPointPOIs[num].position, minDistance, maxDistance, (HullMask)1);
			if (list.Count > 0)
			{
				val = list[Run.instance.stageRng.RangeInt(0, list.Count)];
			}
			if (val == NodeIndex.invalid)
			{
				LOPLog.Warning("Cannot find a valid node to create a spawn point around POI: " + ((Object)spawnPointPOIs[num]).name);
				continue;
			}
			if (groundNodes.GetNodePosition(val, ref val2))
			{
				SpawnPoint.AddSpawnPoint(val2, spawnPointPOIs[num].rotation);
			}
			switch (order)
			{
			case SpawnPointOrder.LinearWrap:
				num++;
				num %= spawnPointPOIs.Length;
				break;
			case SpawnPointOrder.PingPong:
			{
				int num3 = num + num2;
				if (num3 == -1 || num3 == spawnPointPOIs.Length)
				{
					num2 *= -1;
				}
				num += num2;
				break;
			}
			case SpawnPointOrder.Random:
				num = Run.instance.stageRng.RangeInt(0, list.Count);
				break;
			}
		}
	}
}
public class SetupDLC3AccessNode : MonoBehaviour
{
	public static GameObject accessNodeMissionController;

	[SerializeField]
	[Tooltip("Allows boss fight override. Solus Amalgamator by default.")]
	private bool overrideBossFight;

	[SerializeField]
	[Tooltip("Overrides the spawn card of the Access Node encounter.")]
	private DirectorCard spawnCard;

	[SerializeField]
	[Tooltip("Ignore Solus Wing defeat.")]
	private bool ignoreSolusWing;

	[SystemInitializer(new Type[] { })]
	private static IEnumerator SystemInit()
	{
		LOPLog.Info("Initializing DLC3 Access Node Assets...");
		AssetBundleRequest request = LocationsOfPrecipitation.lopAssetBundle.LoadAssetAsync<GameObject>("AccessNodeMissionController");
		while (!((AsyncOperation)request).isDone)
		{
			yield return null;
		}
		Object asset = request.asset;
		accessNodeMissionController = (GameObject)(object)((asset is GameObject) ? asset : null);
		AccessCodesMissionController acMissionControllerComp = accessNodeMissionController.GetComponent<AccessCodesMissionController>();
		SolusFight solusFight = accessNodeMissionController.GetComponent<SolusFight>();
		PortalSpawner ccPortalSpawner = solusFight.conduitCanyonPortalSpawner;
		PortalSpawner cePortalSpawner = solusFight.computationalExchangePortalSpawner;
		PortalSpawner shPortalSpawner = solusFight.solutionalHauntPortalSpawner;
		AsyncOperationHandle<ExpansionDef> dlc3Request = Addressables.LoadAssetAsync<ExpansionDef>((object)Constants.AssetGUIDS.dlc3ExpansionGUID);
		while (!dlc3Request.IsDone)
		{
			yield return null;
		}
		acMissionControllerComp.requiredExpansion = dlc3Request.Result;
		solusFight.requiredExpansion = dlc3Request.Result;
		ccPortalSpawner.requiredExpansion = dlc3Request.Result;
		cePortalSpawner.requiredExpansion = dlc3Request.Result;
		shPortalSpawner.requiredExpansion = dlc3Request.Result;
		AsyncOperationHandle<InteractableSpawnCard> ccPortalCardRequest = Addressables.LoadAssetAsync<InteractableSpawnCard>((object)Constants.AssetGUIDS.iscHardwareProgPortalGUID);
		while (!ccPortalCardRequest.IsDone)
		{
			yield return null;
		}
		ccPortalSpawner.portalSpawnCard = ccPortalCardRequest.Result;
		AsyncOperationHandle<InteractableSpawnCard> cePortalCardRequest = Addressables.LoadAssetAsync<InteractableSpawnCard>((object)Constants.AssetGUIDS.iscSolusShopPortalGUID);
		while (!cePortalCardRequest.IsDone)
		{
			yield return null;
		}
		cePortalSpawner.portalSpawnCard = cePortalCardRequest.Result;
		AsyncOperationHandle<InteractableSpawnCard> shPortalCardRequest = Addressables.LoadAssetAsync<InteractableSpawnCard>((object)Constants.AssetGUIDS.iscHardwareProgPortalHauntGUID);
		while (!shPortalCardRequest.IsDone)
		{
			yield return null;
		}
		shPortalSpawner.portalSpawnCard = shPortalCardRequest.Result;
	}

	public void Start()
	{
		//IL_0005: Unknown result type (might be due to invalid IL or missing references)
		//IL_000a: Unknown result type (might be due to invalid IL or missing references)
		//IL_0069: Unknown result type (might be due to invalid IL or missing references)
		//IL_007f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0081: Unknown result type (might be due to invalid IL or missing references)
		GameObject val = Object.Instantiate<GameObject>(Addressables.LoadAssetAsync<GameObject>((object)Constants.AssetGUIDS.accessNodeGUID).WaitForCompletion(), ((Component)this).transform);
		NetworkServer.Spawn(val);
		GameObject val2 = Object.Instantiate<GameObject>(accessNodeMissionController);
		AccessCodesMissionController component = val2.GetComponent<AccessCodesMissionController>();
		component.ignoreSolusWingDeath = ignoreSolusWing;
		SolusFight component2 = val2.GetComponent<SolusFight>();
		if (overrideBossFight)
		{
			component2.ForcedBossFight = spawnCard;
		}
		component.nodes = (AccessCodesNodeData[])(object)new AccessCodesNodeData[1]
		{
			new AccessCodesNodeData
			{
				node = val,
				id = 0
			}
		};
		NetworkServer.Spawn(val2);
	}
}
public static class ShaderSwap
{
	public static List<Material> MaterialsWithSwappedShaders { get; } = new List<Material>();


	public static async Task ConvertShader(Material material)
	{
		if (!((Object)material.shader).name.StartsWith("Stubbed"))
		{
			LOPLog.Warning($"The material {material} has a shader which's name doesnt start with \"Stubbed\". Skipping material.");
			return;
		}
		try
		{
			material.shader = await Addressables.LoadAssetAsync<Shader>((object)(((Object)material.shader).name.Substring(7) + ".shader")).Task;
			MaterialsWithSwappedShaders.Add(material);
		}
		catch (Exception arg)
		{
			LOPLog.Error($"Failed to swap shader of material {material}: {arg}");
		}
	}
}
[ExecuteAlways]
public class SurfaceDefInjector : MonoBehaviour
{
	[Tooltip("The surfaceDef address to load")]
	public string surfaceDefAddress;

	[NonSerialized]
	private SurfaceDef loadedSurfaceDef;

	private void OnEnable()
	{
		Refresh();
	}

	private void OnDisable()
	{
		RemoveReferencesEditor();
	}

	public void Refresh()
	{
		//IL_0032: 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_0059: Unknown result type (might be due to invalid IL or missing references)
		//IL_0060: Unknown result type (might be due to invalid IL or missing references)
		if (string.IsNullOrWhiteSpace(surfaceDefAddress) || string.IsNullOrEmpty(surfaceDefAddress))
		{
			LOPLog.Warning($"Invalid address in {this}, address is null, empty, or white space");
			return;
		}
		loadedSurfaceDef = Addressables.LoadAssetAsync<SurfaceDef>((object)surfaceDefAddress).WaitForCompletion();
		if (Object.op_Implicit((Object)(object)loadedSurfaceDef))
		{
			SurfaceDef obj = loadedSurfaceDef;
			((Object)obj).hideFlags = (HideFlags)(((Object)obj).hideFlags | 0x1C);
			SurfaceDefProvider[] componentsInChildren = ((Component)this).GetComponentsInChildren<SurfaceDefProvider>();
			for (int i = 0; i < componentsInChildren.Length; i++)
			{
				componentsInChildren[i].surfaceDef = loadedSurfaceDef;
			}
		}
	}

	private void RemoveReferencesEditor()
	{
		if (Application.isEditor)
		{
			SurfaceDefProvider[] componentsInChildren = ((Component)this).GetComponentsInChildren<SurfaceDefProvider>();
			for (int i = 0; i < componentsInChildren.Length; i++)
			{
				componentsInChildren[i].surfaceDef = null;
			}
		}
	}
}