Decompiled source of LevelSkipper v1.0.20

plugins/LevelSkipper/LevelSkipper.dll

Decompiled a year 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 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("LevelSkipper")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("Level Skipper")]
[assembly: AssemblyTitle("LevelSkipper")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.0.0")]
[module: UnverifiableCode]
[module: RefSafetyRules(11)]
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 SegmentLoader
{
	[BepInPlugin("LevelSkipper", "Level Skipper", "1.0.0")]
	public class Plugin : BaseUnityPlugin
	{
		internal ManualLogSource logger;

		private Segment currentSegment = (Segment)0;

		private void Awake()
		{
			logger = ((BaseUnityPlugin)this).Logger;
			logger.LogInfo((object)"LevelSkipper loaded");
		}

		private void Update()
		{
			if (IsLevelLoaded())
			{
				if (Input.GetKeyDown((KeyCode)273))
				{
					CycleSegment(forward: true);
				}
				if (Input.GetKeyDown((KeyCode)274))
				{
					CycleSegment(forward: false);
				}
			}
		}

		private bool IsLevelLoaded()
		{
			//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();
			string name = ((Scene)(ref activeScene)).name;
			return name.StartsWith("Level_");
		}

		private void CycleSegment(bool forward)
		{
			//IL_0017: Unknown result type (might be due to invalid IL or missing references)
			//IL_001d: Expected I4, but got Unknown
			//IL_004c: 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_0073: Unknown result type (might be due to invalid IL or missing references)
			int length = Enum.GetValues(typeof(Segment)).Length;
			int num = (int)currentSegment;
			num = ((!forward) ? (num - 1) : (num + 1));
			if (num >= length)
			{
				num = 0;
			}
			else if (num < 0)
			{
				num = length - 1;
			}
			currentSegment = (Segment)(byte)num;
			((BaseUnityPlugin)this).Logger.LogInfo((object)$"Current segment: {currentSegment}");
			MapHandler.JumpToSegment(currentSegment);
		}
	}
	public static class MyPluginInfo
	{
		public const string PLUGIN_GUID = "LevelSkipper";

		public const string PLUGIN_NAME = "Level Skipper";

		public const string PLUGIN_VERSION = "1.0.0";
	}
}