Decompiled source of BetterReincarnation v1.1.0

BetterReincarnation.dll

Decompiled 3 hours 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.Configuration;
using BepInEx.Logging;
using Microsoft.CodeAnalysis;
using RoR2;
using UnityEngine;
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: IgnoresAccessChecksTo("RoR2")]
[assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")]
[assembly: AssemblyCompany("BetterReincarnation")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("BetterReincarnation")]
[assembly: AssemblyTitle("BetterReincarnation")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.0.0")]
[module: UnverifiableCode]
[module: RefSafetyRules(11)]
namespace Microsoft.CodeAnalysis
{
	[CompilerGenerated]
	[Embedded]
	internal sealed class EmbeddedAttribute : Attribute
	{
	}
}
namespace System.Runtime.CompilerServices
{
	[CompilerGenerated]
	[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 BetterReincarnation
{
	[BepInPlugin("com.Bloonjitsu7.BetterReincarnation", "BetterReincarnation", "1.1.0")]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	public class BetterReincarnation : BaseUnityPlugin
	{
		public static int trialCount;

		public static ConfigEntry<int> trialRequirement { get; set; }

		public void Awake()
		{
			Log.Init(((BaseUnityPlugin)this).Logger);
			trialRequirement = ((BaseUnityPlugin)this).Config.Bind<int>("Better Reincarnation", "Trial Requirement", 3, "The amount of trials needed to be cleared before the page spawns. The trials do not need to be cleared in a row, they just need to be within the same run.");
			Stage.onStageStartGlobal += OnStageStart;
			Run.onRunStartGlobal += OnRunStart;
		}

		private void OnStageStart(Stage stage)
		{
			//IL_006f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0074: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f3: Unknown result type (might be due to invalid IL or missing references)
			//IL_0100: Unknown result type (might be due to invalid IL or missing references)
			//IL_0105: Unknown result type (might be due to invalid IL or missing references)
			//IL_0112: Unknown result type (might be due to invalid IL or missing references)
			//IL_0117: Unknown result type (might be due to invalid IL or missing references)
			//IL_011c: Unknown result type (might be due to invalid IL or missing references)
			//IL_011e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0120: Unknown result type (might be due to invalid IL or missing references)
			if (!NetworkServer.active)
			{
				return;
			}
			string cachedName = stage.sceneDef.cachedName;
			if (!(cachedName == "sad1") && !(cachedName == "soul1") && !(cachedName == "surv2"))
			{
				return;
			}
			trialCount++;
			if (trialCount == trialRequirement.Value)
			{
				Vector3 zero = Vector3.zero;
				switch (cachedName)
				{
				case "sad1":
					((Vector3)(ref zero))..ctor(-4768.42f, 70.14f, -5173.27f);
					break;
				case "soul1":
					((Vector3)(ref zero))..ctor(4420.31f, -2410.97f, 1230.51f);
					break;
				case "surv2":
					((Vector3)(ref zero))..ctor(3295.17f, -976.83f, -2154.03f);
					break;
				}
				CreatePickupInfo val = default(CreatePickupInfo);
				((CreatePickupInfo)(ref val)).pickupIndex = PickupCatalog.FindPickupIndex(Items.PageDie.itemIndex);
				val.rotation = Quaternion.identity;
				PickupDropletController.CreatePickupDroplet(val, zero, Vector3.zero);
				Log.Message("Page Spawned!");
			}
		}

		private void OnRunStart(Run run)
		{
			trialCount = 0;
		}
	}
	internal static class Log
	{
		private static ManualLogSource _logSource;

		internal static void Init(ManualLogSource logSource)
		{
			_logSource = logSource;
		}

		internal static void Debug(object data)
		{
			_logSource.LogDebug(data);
		}

		internal static void Error(object data)
		{
			_logSource.LogError(data);
		}

		internal static void Fatal(object data)
		{
			_logSource.LogFatal(data);
		}

		internal static void Info(object data)
		{
			_logSource.LogInfo(data);
		}

		internal static void Message(object data)
		{
			_logSource.LogMessage(data);
		}

		internal static void Warning(object data)
		{
			_logSource.LogWarning(data);
		}
	}
}
namespace System.Runtime.CompilerServices
{
	[AttributeUsage(AttributeTargets.Assembly, AllowMultiple = true)]
	internal sealed class IgnoresAccessChecksToAttribute : Attribute
	{
		public IgnoresAccessChecksToAttribute(string assemblyName)
		{
		}
	}
}