Decompiled source of ConduitCanyonNewtAltar v1.0.0

ConduitCanyonNewtAltar.dll

Decompiled 5 hours ago
using System;
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using BepInEx;
using Microsoft.CodeAnalysis;
using RoR2;
using UnityEngine;
using UnityEngine.AddressableAssets;
using UnityEngine.Networking;

[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("ConduitCanyonNewtAltar")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("ConduitCanyonNewtAltar")]
[assembly: AssemblyTitle("ConduitCanyonNewtAltar")]
[assembly: AssemblyVersion("1.0.0.0")]
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 R2API.Utils
{
	[AttributeUsage(AttributeTargets.Assembly)]
	public class ManualNetworkRegistrationAttribute : Attribute
	{
	}
}
namespace ConduitCanyonNewtAltar
{
	[BepInPlugin("com.Moffein.ConduitCanyonNewtAltar", "ConduitCanyonNewtAltar", "1.0.0")]
	public class ConduitCanyonNewtAltarPlugin : BaseUnityPlugin
	{
		public struct NewtPosition
		{
			public Vector3 position;

			public Vector3 rotation;
		}

		public static NewtPosition[] newtPositions = new NewtPosition[6]
		{
			new NewtPosition
			{
				position = new Vector3(-402.96f, 46.5f, -327f),
				rotation = new Vector3(0f, -120f, 0f)
			},
			new NewtPosition
			{
				position = new Vector3(116.3f, 109.2f, 610.8f),
				rotation = new Vector3(0f, -57f, 0f)
			},
			new NewtPosition
			{
				position = new Vector3(49.25f, 2.35f, 186.1f),
				rotation = new Vector3(0f, 25f, 0f)
			},
			new NewtPosition
			{
				position = new Vector3(160.6f, 84.5f, -129.4f),
				rotation = new Vector3(27f, 120f, 0f)
			},
			new NewtPosition
			{
				position = new Vector3(37.838f, 34.261f, 116.812f),
				rotation = new Vector3(0f, -150f, 0f)
			},
			new NewtPosition
			{
				position = new Vector3(-0.57f, 135.07f, 437.33f),
				rotation = new Vector3(0f, -77.596f, 0f)
			}
		};

		private void Awake()
		{
			SceneDirector.onPrePopulateSceneServer += SceneDirector_onPrePopulateSceneServer;
		}

		private void SceneDirector_onPrePopulateSceneServer(SceneDirector director)
		{
			//IL_0041: 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_00a0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b4: 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)
			SceneDef sceneDefForCurrentScene = SceneCatalog.GetSceneDefForCurrentScene();
			if (!Object.op_Implicit((Object)(object)sceneDefForCurrentScene) || !(sceneDefForCurrentScene.baseSceneName == "conduitcanyon") || newtPositions == null || newtPositions.Length == 0)
			{
				return;
			}
			GameObject val = Addressables.LoadAssetAsync<GameObject>((object)"RoR2/Base/NewtStatue/NewtStatue.prefab").WaitForCompletion();
			if (Object.op_Implicit((Object)(object)val))
			{
				int num = Random.Range(0, newtPositions.Length);
				NewtPosition newtPosition = newtPositions[num];
				GameObject val2 = Object.Instantiate<GameObject>(val);
				if (Object.op_Implicit((Object)(object)val2))
				{
					NetworkServer.Spawn(val2);
					val2.transform.position = newtPosition.position;
					val2.transform.rotation = Quaternion.Euler(newtPosition.rotation);
				}
			}
		}
	}
}