Decompiled source of ParentsOnTheHRDiagram v1.0.6

plugins/ParentsOnTheHRDiagram.dll

Decompiled 3 weeks ago
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using BepInEx;
using R2API.Utils;
using UnityEngine;
using UnityEngine.AddressableAssets;

[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("MoreDevastators")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0+4e8fa4c474ac486aea2bc09d1666eb16fe1960e8")]
[assembly: AssemblyProduct("MoreDevastators")]
[assembly: AssemblyTitle("MoreDevastators")]
[assembly: AssemblyVersion("1.0.0.0")]
namespace ActualStellarClassifications;

[BepInDependency(/*Could not decode attribute arguments.*/)]
[NetworkCompatibility(/*Could not decode attribute arguments.*/)]
[BepInPlugin("com.Synodii.ActualStellarClassifications", "ActualStellarClassifications", "1.0.6")]
public class Main : BaseUnityPlugin
{
	public static GameObject grandparentBodyPrefab;

	public static GameObject childBodyPrefab;

	public static Material grandparentMaterial;

	public static Material childMaterial;

	public static Transform gpLowMeshTransform;

	private static Light gpCoreLight;

	private static Light gpHeadLight;

	private static Light cCoreLight;

	public void Start()
	{
	}

	public void Awake()
	{
		//IL_0006: Unknown result type (might be due to invalid IL or missing references)
		//IL_000b: 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_0022: Unknown result type (might be due to invalid IL or missing references)
		//IL_0034: Unknown result type (might be due to invalid IL or missing references)
		//IL_0039: 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_0050: Unknown result type (might be due to invalid IL or missing references)
		//IL_0111: Unknown result type (might be due to invalid IL or missing references)
		//IL_0151: Unknown result type (might be due to invalid IL or missing references)
		//IL_0156: Unknown result type (might be due to invalid IL or missing references)
		//IL_0168: 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_0232: Unknown result type (might be due to invalid IL or missing references)
		//IL_0272: Unknown result type (might be due to invalid IL or missing references)
		//IL_0277: Unknown result type (might be due to invalid IL or missing references)
		//IL_0289: Unknown result type (might be due to invalid IL or missing references)
		//IL_029b: Unknown result type (might be due to invalid IL or missing references)
		//IL_03a0: Unknown result type (might be due to invalid IL or missing references)
		//IL_03e5: Unknown result type (might be due to invalid IL or missing references)
		//IL_03ea: Unknown result type (might be due to invalid IL or missing references)
		//IL_03fc: Unknown result type (might be due to invalid IL or missing references)
		//IL_040e: Unknown result type (might be due to invalid IL or missing references)
		//IL_049d: Unknown result type (might be due to invalid IL or missing references)
		//IL_04f0: Unknown result type (might be due to invalid IL or missing references)
		grandparentBodyPrefab = Addressables.LoadAssetAsync<GameObject>((object)"RoR2/Base/Grandparent/GrandParentBody.prefab").WaitForCompletion();
		childBodyPrefab = Addressables.LoadAssetAsync<GameObject>((object)"RoR2/DLC2/Child/ChildBody.prefab").WaitForCompletion();
		grandparentMaterial = Addressables.LoadAssetAsync<Material>((object)"RoR2/Base/Grandparent/matGrandparent.mat").WaitForCompletion();
		childMaterial = Addressables.LoadAssetAsync<Material>((object)"RoR2/DLC2/Child/matChild.mat").WaitForCompletion();
		Light[] componentsInChildren = grandparentBodyPrefab.GetComponentsInChildren<Light>(true);
		foreach (Light val in componentsInChildren)
		{
			if (((Object)((Component)val).gameObject).name == "CoreLight ")
			{
				gpCoreLight = val;
			}
			if (((Object)((Component)val).gameObject).name == "HeadLight")
			{
				gpHeadLight = val;
			}
		}
		if ((Object)(object)gpCoreLight != (Object)null)
		{
			((Behaviour)gpCoreLight).enabled = false;
			GameObject gameObject = ((Component)((Component)gpCoreLight).transform.parent).gameObject;
			Light val2 = gameObject.AddComponent<Light>();
			val2.type = gpCoreLight.type;
			val2.range = gpCoreLight.range;
			val2.intensity = 20f;
			val2.color = Color.op_Implicit(new Vector4(1f, 0.3019608f, 0.050980393f, 1f));
			val2.shadows = gpCoreLight.shadows;
			val2.renderMode = gpCoreLight.renderMode;
			val2.cullingMask = gpCoreLight.cullingMask;
			val2.cookie = gpCoreLight.cookie;
			val2.flare = gpCoreLight.flare;
			((Behaviour)val2).enabled = true;
			Debug.Log((object)("[ASC] Replaced gpCoreLight on parent: " + GetGameObjectPath(gameObject)));
		}
		else
		{
			Debug.LogError((object)"[ASC] gpCoreLight not found!");
		}
		if ((Object)(object)gpHeadLight != (Object)null)
		{
			((Behaviour)gpHeadLight).enabled = false;
			GameObject gameObject2 = ((Component)((Component)gpHeadLight).transform.parent).gameObject;
			Light val3 = gameObject2.AddComponent<Light>();
			val3.type = gpHeadLight.type;
			val3.range = gpHeadLight.range;
			val3.intensity = 20f;
			val3.color = Color.op_Implicit(new Vector4(1f, 0.3019608f, 0.050980393f, 1f));
			val3.shadows = gpHeadLight.shadows;
			val3.renderMode = gpHeadLight.renderMode;
			val3.cullingMask = gpHeadLight.cullingMask;
			val3.cookie = gpHeadLight.cookie;
			val3.flare = gpHeadLight.flare;
			((Behaviour)val3).enabled = true;
			Debug.Log((object)("[ASC] Replaced gpHeadLight on parent: " + GetGameObjectPath(gameObject2)));
		}
		else
		{
			Debug.LogError((object)"[ASC] gpHeadLight not found!");
		}
		Light[] componentsInChildren2 = childBodyPrefab.GetComponentsInChildren<Light>(true);
		foreach (Light val4 in componentsInChildren2)
		{
			if (((Object)((Component)val4).gameObject).name == "CoreLight")
			{
				cCoreLight = val4;
			}
		}
		if ((Object)(object)cCoreLight != (Object)null)
		{
			((Behaviour)cCoreLight).enabled = false;
			GameObject gameObject3 = ((Component)((Component)cCoreLight).transform.parent).gameObject;
			Light val5 = gameObject3.AddComponent<Light>();
			val5.type = cCoreLight.type;
			val5.range = cCoreLight.range;
			val5.intensity = cCoreLight.intensity;
			val5.color = Color.op_Implicit(new Vector4(1f, 0.9098039f, 1f, 1f));
			val5.shadows = cCoreLight.shadows;
			val5.renderMode = cCoreLight.renderMode;
			val5.cullingMask = cCoreLight.cullingMask;
			val5.cookie = cCoreLight.cookie;
			val5.flare = cCoreLight.flare;
			((Behaviour)val5).enabled = true;
			Debug.Log((object)("[ASC] Replaced cCoreLight on parent: " + GetGameObjectPath(gameObject3)));
		}
		else
		{
			Debug.LogError((object)"[ASC] cCoreLight not found!");
		}
		grandparentMaterial.SetVector("_Color", new Vector4(1f, 0.57254905f, 0.1254902f, 1f));
		grandparentMaterial.SetFloat("_EliteBrightnessMin", -0.4314f);
		grandparentMaterial.SetFloat("_EliteBrightnessMax", 1.6842f);
		childMaterial.SetVector("_Color", new Vector4(0.7921569f, 0.75686276f, 1f, 1f));
		Transform val6 = null;
		Transform[] componentsInChildren3 = grandparentBodyPrefab.GetComponentsInChildren<Transform>(true);
		foreach (Transform val7 in componentsInChildren3)
		{
			if (((Object)((Component)val7).gameObject).name == "GrandparentLowMesh")
			{
				val6 = val7;
				break;
			}
		}
		if ((Object)(object)val6 == (Object)null)
		{
			Debug.LogError((object)"[ASC] GrandparentLowMesh not found!");
		}
		else
		{
			((Component)val6).gameObject.SetActive(false);
		}
	}

	private static string GetGameObjectPath(GameObject obj)
	{
		string text = ((Object)obj).name;
		Transform parent = obj.transform.parent;
		while ((Object)(object)parent != (Object)null)
		{
			text = ((Object)parent).name + "/" + text;
			parent = parent.parent;
		}
		return text;
	}
}