Decompiled source of Ash MountainShrineTweaks v1.0.0

plugin/Ash_MountainShrineTweaks.dll

Decompiled a month ago
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
using BepInEx;
using On.RoR2;
using RoR2;
using UnityEngine;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: AssemblyTitle("Ash_MountainShrineTweaks")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("Ash_MountainShrineTweaks")]
[assembly: AssemblyCopyright("Copyright ©  2025")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("ae86c248-6487-41a6-9451-05b5cb4cbff4")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: TargetFramework(".NETFramework,Version=v4.7.2", FrameworkDisplayName = ".NET Framework 4.7.2")]
[assembly: AssemblyVersion("1.0.0.0")]
namespace Ash_MountainShrineTweaks;

[BepInPlugin("Ashen_O.Ash_MountainShrineTweaks", "Ash_MountainShrineTweaks", "1.0.0")]
public class Ash_MountainShrineTweaks : BaseUnityPlugin
{
	private int shrineCount;

	public void Awake()
	{
		//IL_0008: Unknown result type (might be due to invalid IL or missing references)
		//IL_0012: Expected O, but got Unknown
		ShrineBossBehavior.AddShrineStack += new hook_AddShrineStack(ShrineActivated);
		Run.onRunStartGlobal += OnRunStart;
		SceneDirector.onPostPopulateSceneServer += delegate
		{
			Debug.Log((object)$"[Ash][MountainShrineTweaks] Spawned [{Object.FindObjectsOfType<ShrineBossBehavior>().Length}] shrines");
			TeleporterInteraction val = Object.FindObjectOfType<TeleporterInteraction>();
			if (!((Object)(object)val == (Object)null))
			{
				for (int i = 0; i < shrineCount; i++)
				{
					val.AddShrineStack();
				}
				Debug.Log((object)$"[Ash][MountainShrineTweaks] Setting shrine stacks to {shrineCount}");
			}
		};
	}

	private void ShrineActivated(orig_AddShrineStack orig, ShrineBossBehavior self, Interactor interactor)
	{
		shrineCount++;
		Debug.Log((object)"[Ash][MountainShrineTweaks] Added shrine stack");
		orig.Invoke(self, interactor);
	}

	private void OnRunStart(Run run)
	{
		shrineCount = 0;
		Debug.Log((object)$"[Ash][MountainShrineTweaks] Shrine count set to default [{shrineCount}]");
	}
}