Decompiled source of SandboxElevatorUnlock v1.0.3

plugins/SandboxElevatorUnlock/SandboxElevatorUnlock.dll

Decompiled 4 days ago
using System;
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using BepInEx;
using BepInEx.Logging;
using EquinoxsModUtils;
using HarmonyLib;
using Microsoft.CodeAnalysis;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")]
[assembly: AssemblyCompany("SandboxElevatorUnlock")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyFileVersion("1.0.3.0")]
[assembly: AssemblyInformationalVersion("1.0.3+e132f61f144fce1978a441ea996aeba25bc1bd67")]
[assembly: AssemblyProduct("SandboxElevatorUnlock")]
[assembly: AssemblyTitle("SandboxElevatorUnlock")]
[assembly: AssemblyVersion("1.0.3.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 SandboxElevatorUnlock
{
	[BepInPlugin("com.jrinker03.SandboxElevatorUnlock", "SandboxElevatorUnlock", "1.0.3")]
	public class SandboxElevatorUnlockPlugin : BaseUnityPlugin
	{
		private const string MyGUID = "com.jrinker03.SandboxElevatorUnlock";

		private const string PluginName = "SandboxElevatorUnlock";

		private const string VersionString = "1.0.3";

		private static readonly Harmony Harmony = new Harmony("com.jrinker03.SandboxElevatorUnlock");

		public static ManualLogSource Log = new ManualLogSource("SandboxElevatorUnlock");

		private void Awake()
		{
			((BaseUnityPlugin)this).Logger.LogInfo((object)"PluginName: SandboxElevatorUnlock, VersionString: 1.0.3 is loading...");
			Harmony.PatchAll();
			Events.GameLoaded += Events_GameLoaded;
			((BaseUnityPlugin)this).Logger.LogInfo((object)"PluginName: SandboxElevatorUnlock, VersionString: 1.0.3 is loaded.");
			Log = ((BaseUnityPlugin)this).Logger;
		}

		private void Events_GameLoaded()
		{
			//IL_0026: 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)
			if (((UniqueIdScriptableObject)FlowManager.instance.CurrentPreset).uniqueId != 3)
			{
				return;
			}
			((BaseUnityPlugin)this).Logger.LogInfo((object)"Checking elevator unlock states.");
			byte b = 0;
			ref ElevatorInstance reference = ref ElevatorInstance.GetElevatorForFloor(ref b).Get();
			int num = FlowManager.instance.curLevel.strataDefinitions.Length;
			if (reference.curDigTier < num - 1)
			{
				((BaseUnityPlugin)this).Logger.LogInfo((object)"Unlocking strata.");
				for (int i = reference.curDigTier + 1; i <= num; i++)
				{
					reference.digPoints = reference.targetDigPoints + 1;
					((ElevatorInstance)(ref reference)).UpdateDigTier(i, false);
				}
			}
		}
	}
}