Decompiled source of BetterExploration v1.0.1

BetterExploration.dll

Decompiled 3 weeks ago
using System;
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.Logging;
using Microsoft.CodeAnalysis;
using On.RoR2;
using RoR2;
using UnityEngine;
using UnityEngine.SceneManagement;

[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("BetterExploration")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("BetterExploration")]
[assembly: AssemblyTitle("BetterExploration")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.0.0")]
[module: UnverifiableCode]
[module: RefSafetyRules(11)]
[module: UnverifiableCode]
namespace Microsoft.CodeAnalysis
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	internal sealed class EmbeddedAttribute : Attribute
	{
	}
}
namespace System.Runtime.CompilerServices
{
	[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 BetterExploration
{
	[BepInPlugin("pseudopulse.BetterExploration", "BetterExploration", "1.0.0")]
	public class Main : BaseUnityPlugin
	{
		public const string PluginGUID = "pseudopulse.BetterExploration";

		public const string PluginAuthor = "pseudopulse";

		public const string PluginName = "BetterExploration";

		public const string PluginVersion = "1.0.0";

		public static ManualLogSource ModLogger;

		public void Awake()
		{
			//IL_0025: Unknown result type (might be due to invalid IL or missing references)
			//IL_002f: Expected O, but got Unknown
			ModLogger = ((BaseUnityPlugin)this).Logger;
			SceneManager.activeSceneChanged += OnSceneChange;
			MapZone.TeleportBody += new hook_TeleportBody(VisitNewCommencement);
		}

		private void VisitNewCommencement(orig_TeleportBody orig, MapZone self, CharacterBody characterBody)
		{
			//IL_0011: Unknown result type (might be due to invalid IL or missing references)
			//IL_0016: Unknown result type (might be due to invalid IL or missing references)
			if (Object.op_Implicit((Object)(object)characterBody) && characterBody.isPlayerControlled)
			{
				Scene activeScene = SceneManager.GetActiveScene();
				if (((Scene)(ref activeScene)).name == "moon2")
				{
					Run.instance.AdvanceStage(SceneCatalog.FindSceneDef("moon2"));
					return;
				}
			}
			orig.Invoke(self, characterBody);
		}

		private void OnSceneChange(Scene arg0, Scene arg1)
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			Scene activeScene = SceneManager.GetActiveScene();
			if (((Scene)(ref activeScene)).name == "moon2" && Util.CheckRoll(66f, 0f, (CharacterMaster)null))
			{
				Transform transform = GameObject.Find("HOLDER: Gameplay Space").transform;
				((Component)transform.Find("HOLDER: Final Arena")).gameObject.SetActive(false);
				((Component)transform.Find("HOLDER: STATIC MESH").Find("Tower")).gameObject.SetActive(false);
				((Component)transform.Find("HOLDER: STATIC MESH").Find("Quadrant 2: Workshop")).gameObject.SetActive(false);
				((Component)transform.Find("HOLDER: STATIC MESH").Find("Quadrant 1: Quarry")).gameObject.SetActive(false);
				((Component)transform.Find("HOLDER: STATIC MESH").Find("Quadrant 3: Greenhouse")).gameObject.SetActive(false);
				((Component)transform.Find("HOLDER: STATIC MESH").Find("Quadrant 5: Blood Arena")).gameObject.SetActive(false);
				GameObject.Find("HOLDER: Pillars").SetActive(false);
			}
		}
	}
}