Decompiled source of GladiatorArena v1.0.0

EmpressArenaAPI.dll

Decompiled 3 hours ago
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using BepInEx;
using BepInEx.Configuration;
using HarmonyLib;
using Microsoft.CodeAnalysis;
using Photon.Pun;
using UnityEngine;

[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("Omniscye")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0+7caf00520587bc4705fdf22c05a4ce546279ff19")]
[assembly: AssemblyProduct("EmpressArenaAPI")]
[assembly: AssemblyTitle("EmpressArenaAPI")]
[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.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;
		}
	}
	[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 Empress_ArenaLoaderAPI
{
	[BepInPlugin("com.Empress.ArenaAPI", "Empress Arena Loader API", "1.0.2")]
	public class ArenaLoaderPlugin : BaseUnityPlugin
	{
		internal class ArenaEntry
		{
			public GameObject Prefab;

			public string ResourcePath;

			public ConfigEntry<bool> EnabledConfig;
		}

		internal static ArenaLoaderPlugin Instance;

		internal static List<ArenaEntry> RegisteredArenas = new List<ArenaEntry>();

		private void Awake()
		{
			Instance = this;
			Harmony.CreateAndPatchAll(typeof(LevelGeneratorPatch), (string)null);
			Harmony.CreateAndPatchAll(typeof(ArenaPatch), (string)null);
		}
	}
	public static class ArenaAPI
	{
		public static void RegisterArena(GameObject arenaPrefab, string uniqueResourcePath)
		{
			if ((Object)(object)arenaPrefab == (Object)null || (Object)(object)ArenaLoaderPlugin.Instance == (Object)null)
			{
				return;
			}
			ItemVolume[] componentsInChildren = arenaPrefab.GetComponentsInChildren<ItemVolume>(true);
			ItemVolume[] array = componentsInChildren;
			foreach (ItemVolume val in array)
			{
				if ((Object)(object)((Component)val).GetComponentInParent<ItemAttributes>() == (Object)null)
				{
					Object.DestroyImmediate((Object)(object)val, true);
				}
			}
			Object.DontDestroyOnLoad((Object)(object)arenaPrefab);
			((Object)arenaPrefab).hideFlags = (HideFlags)32;
			ConfigEntry<bool> enabledConfig = ((BaseUnityPlugin)ArenaLoaderPlugin.Instance).Config.Bind<bool>("Registered Arenas", uniqueResourcePath, true, "Enable the " + uniqueResourcePath + " arena.");
			ArenaLoaderPlugin.RegisteredArenas.Add(new ArenaLoaderPlugin.ArenaEntry
			{
				Prefab = arenaPrefab,
				ResourcePath = uniqueResourcePath,
				EnabledConfig = enabledConfig
			});
		}
	}
	[HarmonyPatch(typeof(LevelGenerator), "Start")]
	public static class LevelGeneratorPatch
	{
		private static void Postfix(LevelGenerator __instance)
		{
			//IL_0103: Unknown result type (might be due to invalid IL or missing references)
			//IL_0108: Unknown result type (might be due to invalid IL or missing references)
			//IL_0146: Unknown result type (might be due to invalid IL or missing references)
			//IL_014d: Expected O, but got Unknown
			if (!SemiFunc.RunIsArena())
			{
				return;
			}
			List<ArenaLoaderPlugin.ArenaEntry> list = ArenaLoaderPlugin.RegisteredArenas.Where((ArenaLoaderPlugin.ArenaEntry x) => x.EnabledConfig.Value).ToList();
			if (list.Count != 0)
			{
				ArenaLoaderPlugin.ArenaEntry arenaEntry = list[Random.Range(0, list.Count)];
				RunManager instance = RunManager.instance;
				if (instance.singleplayerPool != null && !instance.singleplayerPool.ContainsKey(arenaEntry.ResourcePath))
				{
					instance.singleplayerPool.Add(arenaEntry.ResourcePath, arenaEntry.Prefab);
				}
				DefaultPool multiplayerPool = instance.multiplayerPool;
				if (multiplayerPool?.ResourceCache != null && !multiplayerPool.ResourceCache.ContainsKey(arenaEntry.ResourcePath))
				{
					multiplayerPool.ResourceCache.Add(arenaEntry.ResourcePath, arenaEntry.Prefab);
				}
				Vector3[] value = (Vector3[])(object)new Vector3[1] { Vector3.zero };
				AccessTools.Field(typeof(LevelGenerator), "ModuleRotations").SetValue(__instance, value);
				Level levelCurrent = instance.levelCurrent;
				if ((Object)(object)levelCurrent != (Object)null)
				{
					PrefabRef val = new PrefabRef();
					AccessTools.Field(typeof(PrefabRef), "prefabName").SetValue(val, ((Object)arenaEntry.Prefab).name);
					AccessTools.Field(typeof(PrefabRef), "resourcePath").SetValue(val, arenaEntry.ResourcePath);
					levelCurrent.StartRooms.Clear();
					levelCurrent.StartRooms.Add(val);
					levelCurrent.ModulesNormal1.Clear();
					levelCurrent.ModulesNormal2.Clear();
					levelCurrent.ModulesNormal3.Clear();
				}
			}
		}
	}
	[HarmonyPatch(typeof(Arena))]
	public static class ArenaPatch
	{
		[HarmonyPatch("MusicLogic")]
		[HarmonyPrefix]
		private static bool Prefix()
		{
			return false;
		}
	}
}

EmptyChildMod.dll

Decompiled 3 hours ago
using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
using BepInEx;
using BepInEx.Logging;
using Empress_ArenaLoaderAPI;
using UnityEngine;
using UnityEngine.AI;
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: AssemblyTitle("EmptyChildMod")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("EmptyChildMod")]
[assembly: AssemblyCopyright("Copyright ©  2026")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("eb22faed-b405-4d38-9eb8-cae6b316dbed")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: TargetFramework(".NETFramework,Version=v4.8", FrameworkDisplayName = ".NET Framework 4.8")]
[assembly: AssemblyVersion("1.0.0.0")]
public class ArenaEnemyTrigger : MonoBehaviour
{
	[CompilerGenerated]
	private sealed class <CooldownRoutine>d__5 : IEnumerator<object>, IDisposable, IEnumerator
	{
		private int <>1__state;

		private object <>2__current;

		public ArenaEnemyTrigger <>4__this;

		object IEnumerator<object>.Current
		{
			[DebuggerHidden]
			get
			{
				return <>2__current;
			}
		}

		object IEnumerator.Current
		{
			[DebuggerHidden]
			get
			{
				return <>2__current;
			}
		}

		[DebuggerHidden]
		public <CooldownRoutine>d__5(int <>1__state)
		{
			this.<>1__state = <>1__state;
		}

		[DebuggerHidden]
		void IDisposable.Dispose()
		{
			<>1__state = -2;
		}

		private bool MoveNext()
		{
			//IL_002c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0036: Expected O, but got Unknown
			switch (<>1__state)
			{
			default:
				return false;
			case 0:
				<>1__state = -1;
				<>2__current = (object)new WaitForSeconds(<>4__this.cooldownTime);
				<>1__state = 1;
				return true;
			case 1:
				<>1__state = -1;
				<>4__this._isOnCooldown = false;
				return false;
			}
		}

		bool IEnumerator.MoveNext()
		{
			//ILSpy generated this explicit interface implementation from .override directive in MoveNext
			return this.MoveNext();
		}

		[DebuggerHidden]
		void IEnumerator.Reset()
		{
			throw new NotSupportedException();
		}
	}

	[CompilerGenerated]
	private sealed class <SpawnRandomEnemies>d__6 : IEnumerator<object>, IDisposable, IEnumerator
	{
		private int <>1__state;

		private object <>2__current;

		public ArenaEnemyTrigger <>4__this;

		private EnemySetup[] <allSetups>5__1;

		private List<EnemySetup> <validSetups>5__2;

		private int <i>5__3;

		private EnemySetup <randomSetup>5__4;

		private Vector3 <spawnPos>5__5;

		object IEnumerator<object>.Current
		{
			[DebuggerHidden]
			get
			{
				return <>2__current;
			}
		}

		object IEnumerator.Current
		{
			[DebuggerHidden]
			get
			{
				return <>2__current;
			}
		}

		[DebuggerHidden]
		public <SpawnRandomEnemies>d__6(int <>1__state)
		{
			this.<>1__state = <>1__state;
		}

		[DebuggerHidden]
		void IDisposable.Dispose()
		{
			<allSetups>5__1 = null;
			<validSetups>5__2 = null;
			<randomSetup>5__4 = null;
			<>1__state = -2;
		}

		private bool MoveNext()
		{
			//IL_00a4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ae: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f0: Expected O, but got Unknown
			//IL_00d4: Unknown result type (might be due to invalid IL or missing references)
			switch (<>1__state)
			{
			default:
				return false;
			case 0:
				<>1__state = -1;
				<allSetups>5__1 = Resources.FindObjectsOfTypeAll<EnemySetup>();
				<validSetups>5__2 = <allSetups>5__1.Where((EnemySetup s) => (Object)(object)s != (Object)null && s.spawnObjects.Count > 0).ToList();
				<i>5__3 = 0;
				break;
			case 1:
				<>1__state = -1;
				<randomSetup>5__4 = null;
				<i>5__3++;
				break;
			}
			if (<i>5__3 < <>4__this.spawnCount)
			{
				<randomSetup>5__4 = <validSetups>5__2[Random.Range(0, <validSetups>5__2.Count)];
				<spawnPos>5__5 = <>4__this.GetRandomNavMeshPosition(((Component)<>4__this).transform.position, 15f);
				if ((Object)(object)LevelGenerator.Instance != (Object)null)
				{
					LevelGenerator.Instance.EnemySpawn(<randomSetup>5__4, <spawnPos>5__5);
				}
				<>2__current = (object)new WaitForSeconds(0.2f);
				<>1__state = 1;
				return true;
			}
			return false;
		}

		bool IEnumerator.MoveNext()
		{
			//ILSpy generated this explicit interface implementation from .override directive in MoveNext
			return this.MoveNext();
		}

		[DebuggerHidden]
		void IEnumerator.Reset()
		{
			throw new NotSupportedException();
		}
	}

	public int spawnCount = 8;

	public float cooldownTime = 120f;

	public ManualLogSource logger;

	private bool _isOnCooldown = false;

	private void OnTriggerEnter(Collider other)
	{
		if (!_isOnCooldown && !((Object)(object)RunManager.instance == (Object)null) && !SemiFunc.RunIsLobbyMenu() && (((Component)other).CompareTag("Player") || (Object)(object)((Component)other).GetComponent<PlayerController>() != (Object)null) && SemiFunc.IsMasterClientOrSingleplayer())
		{
			logger.LogInfo((object)"Arena Trigger tripped! Spawning reinforcement wave.");
			((MonoBehaviour)this).StartCoroutine(SpawnRandomEnemies());
			_isOnCooldown = true;
			((MonoBehaviour)this).StartCoroutine(CooldownRoutine());
		}
	}

	[IteratorStateMachine(typeof(<CooldownRoutine>d__5))]
	private IEnumerator CooldownRoutine()
	{
		//yield-return decompiler failed: Unexpected instruction in Iterator.Dispose()
		return new <CooldownRoutine>d__5(0)
		{
			<>4__this = this
		};
	}

	[IteratorStateMachine(typeof(<SpawnRandomEnemies>d__6))]
	private IEnumerator SpawnRandomEnemies()
	{
		//yield-return decompiler failed: Unexpected instruction in Iterator.Dispose()
		return new <SpawnRandomEnemies>d__6(0)
		{
			<>4__this = this
		};
	}

	private Vector3 GetRandomNavMeshPosition(Vector3 center, float radius)
	{
		//IL_0001: Unknown result type (might be due to invalid IL or missing references)
		//IL_0007: Unknown result type (might be due to invalid IL or missing references)
		//IL_000c: Unknown result type (might be due to invalid IL or missing references)
		//IL_000d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0012: Unknown result type (might be due to invalid IL or missing references)
		//IL_0013: 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)
		//IL_002c: Unknown result type (might be due to invalid IL or missing references)
		//IL_0036: Unknown result type (might be due to invalid IL or missing references)
		//IL_003b: Unknown result type (might be due to invalid IL or missing references)
		//IL_0040: Unknown result type (might be due to invalid IL or missing references)
		//IL_0023: Unknown result type (might be due to invalid IL or missing references)
		//IL_0028: Unknown result type (might be due to invalid IL or missing references)
		//IL_0043: Unknown result type (might be due to invalid IL or missing references)
		Vector3 val = Random.insideUnitSphere * radius + center;
		NavMeshHit val2 = default(NavMeshHit);
		if (NavMesh.SamplePosition(val, ref val2, radius, -1))
		{
			return ((NavMeshHit)(ref val2)).position;
		}
		return center + Vector3.up * 1f;
	}
}
namespace CustomArenaMod;

[BepInPlugin("com.feralelf.feralarena", "Feral Arena", "1.0.0")]
[BepInDependency(/*Could not decode attribute arguments.*/)]
public class CustomArenaMod : BaseUnityPlugin
{
	[CompilerGenerated]
	private sealed class <CheckAndRunArenaLogic>d__13 : IEnumerator<object>, IDisposable, IEnumerator
	{
		private int <>1__state;

		private object <>2__current;

		public CustomArenaMod <>4__this;

		private bool <isArena>5__1;

		private string <sceneName>5__2;

		private string <levelName>5__3;

		private string <levelPath>5__4;

		private GameObject <arenaInstance>5__5;

		private ArenaEnemyTrigger <trigger>5__6;

		object IEnumerator<object>.Current
		{
			[DebuggerHidden]
			get
			{
				return <>2__current;
			}
		}

		object IEnumerator.Current
		{
			[DebuggerHidden]
			get
			{
				return <>2__current;
			}
		}

		[DebuggerHidden]
		public <CheckAndRunArenaLogic>d__13(int <>1__state)
		{
			this.<>1__state = <>1__state;
		}

		[DebuggerHidden]
		void IDisposable.Dispose()
		{
			<sceneName>5__2 = null;
			<levelName>5__3 = null;
			<levelPath>5__4 = null;
			<arenaInstance>5__5 = null;
			<trigger>5__6 = null;
			<>1__state = -2;
		}

		private bool MoveNext()
		{
			//IL_0045: Unknown result type (might be due to invalid IL or missing references)
			//IL_004f: Expected O, but got Unknown
			//IL_0076: Unknown result type (might be due to invalid IL or missing references)
			//IL_0080: Expected O, but got Unknown
			//IL_00b9: Unknown result type (might be due to invalid IL or missing references)
			//IL_00be: Unknown result type (might be due to invalid IL or missing references)
			//IL_0262: Unknown result type (might be due to invalid IL or missing references)
			//IL_026c: Expected O, but got Unknown
			//IL_01d6: Unknown result type (might be due to invalid IL or missing references)
			//IL_01db: Unknown result type (might be due to invalid IL or missing references)
			Scene activeScene;
			Level levelCurrent;
			switch (<>1__state)
			{
			default:
				return false;
			case 0:
				<>1__state = -1;
				goto IL_005f;
			case 1:
				<>1__state = -1;
				goto IL_005f;
			case 2:
				<>1__state = -1;
				goto IL_0090;
			case 3:
				<>1__state = -1;
				<arenaInstance>5__5 = GameObject.Find("Start Room - Arena(Clone)");
				if ((Object)(object)<arenaInstance>5__5 != (Object)null)
				{
					<>2__current = ((MonoBehaviour)<>4__this).StartCoroutine(<>4__this.SilentSanitize(<arenaInstance>5__5));
					<>1__state = 4;
					return true;
				}
				break;
			case 4:
				{
					<>1__state = -1;
					if ((Object)(object)<arenaInstance>5__5.GetComponent<ArenaEnemyTrigger>() == (Object)null)
					{
						<trigger>5__6 = <arenaInstance>5__5.AddComponent<ArenaEnemyTrigger>();
						<trigger>5__6.spawnCount = 8;
						<trigger>5__6.logger = ((BaseUnityPlugin)<>4__this).Logger;
						<trigger>5__6 = null;
					}
					if (SemiFunc.IsMasterClientOrSingleplayer())
					{
						((MonoBehaviour)<>4__this).StartCoroutine(<>4__this.RoundStartRunnerSpawn(4));
					}
					break;
				}
				IL_005f:
				if ((Object)(object)RunManager.instance == (Object)null)
				{
					<>2__current = (object)new WaitForSeconds(0.5f);
					<>1__state = 1;
					return true;
				}
				goto IL_0090;
				IL_0090:
				if ((Object)(object)LevelGenerator.Instance == (Object)null || !LevelGenerator.Instance.Generated)
				{
					<>2__current = (object)new WaitForSeconds(0.5f);
					<>1__state = 2;
					return true;
				}
				<isArena>5__1 = false;
				activeScene = SceneManager.GetActiveScene();
				<sceneName>5__2 = ((Scene)(ref activeScene)).name.ToLower();
				levelCurrent = RunManager.instance.levelCurrent;
				<levelName>5__3 = ((levelCurrent != null) ? ((Object)levelCurrent).name.ToLower() : null) ?? "";
				<levelPath>5__4 = RunManager.instance.levelCurrent?.ResourcePath?.ToLower() ?? "";
				if (<sceneName>5__2.Contains("arena") || <levelName>5__3.Contains("arena") || <levelPath>5__4.Contains("arena"))
				{
					<isArena>5__1 = true;
				}
				if (!<isArena>5__1)
				{
					return false;
				}
				<>4__this.floorDoor = GameObject.Find("Floor Door") ?? GameObject.Find("Floor Door(Clone)");
				if ((Object)(object)<>4__this.floorDoor != (Object)null)
				{
					<>4__this.doorStartPos = <>4__this.floorDoor.transform.position;
					((BaseUnityPlugin)<>4__this).Logger.LogInfo((object)"Floor Door tracked. Waiting for movement...");
					if ((Object)(object)<>4__this.arenaMusic == (Object)null && (Object)(object)<>4__this.loadedBundle != (Object)null)
					{
						<>4__this.arenaMusic = <>4__this.loadedBundle.LoadAsset<AudioClip>("Arena");
					}
				}
				((BaseUnityPlugin)<>4__this).Logger.LogInfo((object)"Arena Level confirmed. Waiting 4s for settlement...");
				<>2__current = (object)new WaitForSeconds(4f);
				<>1__state = 3;
				return true;
			}
			return false;
		}

		bool IEnumerator.MoveNext()
		{
			//ILSpy generated this explicit interface implementation from .override directive in MoveNext
			return this.MoveNext();
		}

		[DebuggerHidden]
		void IEnumerator.Reset()
		{
			throw new NotSupportedException();
		}
	}

	[CompilerGenerated]
	private sealed class <DoorMovementWatchdog>d__14 : IEnumerator<object>, IDisposable, IEnumerator
	{
		private int <>1__state;

		private object <>2__current;

		public CustomArenaMod <>4__this;

		object IEnumerator<object>.Current
		{
			[DebuggerHidden]
			get
			{
				return <>2__current;
			}
		}

		object IEnumerator.Current
		{
			[DebuggerHidden]
			get
			{
				return <>2__current;
			}
		}

		[DebuggerHidden]
		public <DoorMovementWatchdog>d__14(int <>1__state)
		{
			this.<>1__state = <>1__state;
		}

		[DebuggerHidden]
		void IDisposable.Dispose()
		{
			<>1__state = -2;
		}

		private bool MoveNext()
		{
			//IL_0050: Unknown result type (might be due to invalid IL or missing references)
			//IL_005b: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b0: Expected O, but got Unknown
			switch (<>1__state)
			{
			default:
				return false;
			case 0:
				<>1__state = -1;
				break;
			case 1:
				<>1__state = -1;
				break;
			}
			if (!<>4__this.musicTriggered)
			{
				if ((Object)(object)<>4__this.floorDoor == (Object)null)
				{
					return false;
				}
				if (Vector3.Distance(<>4__this.floorDoor.transform.position, <>4__this.doorStartPos) > 0.5f)
				{
					((BaseUnityPlugin)<>4__this).Logger.LogInfo((object)"Door moved! Starting Arena music.");
					<>4__this.PlayArenaMusic();
					<>4__this.musicTriggered = true;
				}
				<>2__current = (object)new WaitForSeconds(0.1f);
				<>1__state = 1;
				return true;
			}
			return false;
		}

		bool IEnumerator.MoveNext()
		{
			//ILSpy generated this explicit interface implementation from .override directive in MoveNext
			return this.MoveNext();
		}

		[DebuggerHidden]
		void IEnumerator.Reset()
		{
			throw new NotSupportedException();
		}
	}

	[CompilerGenerated]
	private sealed class <RoundStartRunnerSpawn>d__17 : IEnumerator<object>, IDisposable, IEnumerator
	{
		private int <>1__state;

		private object <>2__current;

		public int count;

		public CustomArenaMod <>4__this;

		private List<LevelPoint> <allPoints>5__1;

		private EnemySetup[] <allSetups>5__2;

		private List<EnemySetup> <validEnemies>5__3;

		private int <i>5__4;

		private LevelPoint <spawnPoint>5__5;

		private Vector3 <spawnPos>5__6;

		private EnemySetup <randomEnemy>5__7;

		object IEnumerator<object>.Current
		{
			[DebuggerHidden]
			get
			{
				return <>2__current;
			}
		}

		object IEnumerator.Current
		{
			[DebuggerHidden]
			get
			{
				return <>2__current;
			}
		}

		[DebuggerHidden]
		public <RoundStartRunnerSpawn>d__17(int <>1__state)
		{
			this.<>1__state = <>1__state;
		}

		[DebuggerHidden]
		void IDisposable.Dispose()
		{
			<allPoints>5__1 = null;
			<allSetups>5__2 = null;
			<validEnemies>5__3 = null;
			<spawnPoint>5__5 = null;
			<randomEnemy>5__7 = null;
			<>1__state = -2;
		}

		private bool MoveNext()
		{
			//IL_0036: Unknown result type (might be due to invalid IL or missing references)
			//IL_0040: Expected O, but got Unknown
			//IL_0177: Unknown result type (might be due to invalid IL or missing references)
			//IL_017c: Unknown result type (might be due to invalid IL or missing references)
			//IL_01af: Unknown result type (might be due to invalid IL or missing references)
			//IL_01f6: Unknown result type (might be due to invalid IL or missing references)
			//IL_0200: Expected O, but got Unknown
			switch (<>1__state)
			{
			default:
				return false;
			case 0:
				<>1__state = -1;
				goto IL_0050;
			case 1:
				<>1__state = -1;
				goto IL_0050;
			case 2:
				{
					<>1__state = -1;
					<spawnPoint>5__5 = null;
					<randomEnemy>5__7 = null;
					<i>5__4++;
					break;
				}
				IL_0050:
				if ((Object)(object)RunManager.instance == (Object)null || (Object)(object)LevelGenerator.Instance == (Object)null || !LevelGenerator.Instance.Generated)
				{
					<>2__current = (object)new WaitForSeconds(0.5f);
					<>1__state = 1;
					return true;
				}
				if (!SemiFunc.IsMasterClientOrSingleplayer())
				{
					return false;
				}
				<allPoints>5__1 = Object.FindObjectsOfType<LevelPoint>().ToList();
				<allSetups>5__2 = Resources.FindObjectsOfTypeAll<EnemySetup>();
				<validEnemies>5__3 = <allSetups>5__2.Where((EnemySetup s) => (Object)(object)s != (Object)null && s.spawnObjects.Count > 0).ToList();
				if (<validEnemies>5__3.Count == 0 || <allPoints>5__1.Count == 0)
				{
					return false;
				}
				<i>5__4 = 0;
				break;
			}
			if (<i>5__4 < count)
			{
				<spawnPoint>5__5 = <allPoints>5__1.OrderByDescending((LevelPoint p) => Vector3.Distance(((Component)p).transform.position, ((Component)PlayerController.instance).transform.position)).FirstOrDefault();
				if (!((Object)(object)<spawnPoint>5__5 == (Object)null))
				{
					<allPoints>5__1.Remove(<spawnPoint>5__5);
					<spawnPos>5__6 = ((Component)<spawnPoint>5__5).transform.position;
					<randomEnemy>5__7 = <validEnemies>5__3[Random.Range(0, <validEnemies>5__3.Count)];
					LevelGenerator.Instance.EnemySpawn(<randomEnemy>5__7, <spawnPos>5__6);
					((BaseUnityPlugin)<>4__this).Logger.LogInfo((object)("Spawned " + ((Object)<randomEnemy>5__7).name + " using Empress logic at point " + ((Object)<spawnPoint>5__5).name));
					<>2__current = (object)new WaitForSeconds(0.1f);
					<>1__state = 2;
					return true;
				}
			}
			return false;
		}

		bool IEnumerator.MoveNext()
		{
			//ILSpy generated this explicit interface implementation from .override directive in MoveNext
			return this.MoveNext();
		}

		[DebuggerHidden]
		void IEnumerator.Reset()
		{
			throw new NotSupportedException();
		}
	}

	[CompilerGenerated]
	private sealed class <SilentSanitize>d__16 : IEnumerator<object>, IDisposable, IEnumerator
	{
		private int <>1__state;

		private object <>2__current;

		public GameObject arenaRoot;

		public CustomArenaMod <>4__this;

		private int <killed>5__1;

		private MonoBehaviour[] <allScripts>5__2;

		private MonoBehaviour[] <>s__3;

		private int <>s__4;

		private MonoBehaviour <script>5__5;

		private bool <isBroken>5__6;

		private bool <test>5__7;

		object IEnumerator<object>.Current
		{
			[DebuggerHidden]
			get
			{
				return <>2__current;
			}
		}

		object IEnumerator.Current
		{
			[DebuggerHidden]
			get
			{
				return <>2__current;
			}
		}

		[DebuggerHidden]
		public <SilentSanitize>d__16(int <>1__state)
		{
			this.<>1__state = <>1__state;
		}

		[DebuggerHidden]
		void IDisposable.Dispose()
		{
			<allScripts>5__2 = null;
			<>s__3 = null;
			<script>5__5 = null;
			<>1__state = -2;
		}

		private bool MoveNext()
		{
			switch (<>1__state)
			{
			default:
				return false;
			case 0:
				<>1__state = -1;
				<killed>5__1 = 0;
				<allScripts>5__2 = arenaRoot.GetComponentsInChildren<MonoBehaviour>(true);
				<>s__3 = <allScripts>5__2;
				for (<>s__4 = 0; <>s__4 < <>s__3.Length; <>s__4++)
				{
					<script>5__5 = <>s__3[<>s__4];
					if (!((Object)(object)<script>5__5 == (Object)null) && !(((object)<script>5__5).GetType().Namespace == "CustomArenaMod"))
					{
						<isBroken>5__6 = false;
						if (((object)<script>5__5).GetType().Name == "PlayerDeathHead")
						{
							<isBroken>5__6 = true;
						}
						else
						{
							try
							{
								<test>5__7 = ((Behaviour)<script>5__5).enabled;
							}
							catch (Exception)
							{
								<isBroken>5__6 = true;
							}
						}
						if (<isBroken>5__6)
						{
							Object.Destroy((Object)(object)<script>5__5);
							<killed>5__1++;
						}
						<script>5__5 = null;
					}
				}
				<>s__3 = null;
				((BaseUnityPlugin)<>4__this).Logger.LogInfo((object)$"Sanitization complete. Removed {<killed>5__1} broken scripts.");
				<>2__current = null;
				<>1__state = 1;
				return true;
			case 1:
				<>1__state = -1;
				return false;
			}
		}

		bool IEnumerator.MoveNext()
		{
			//ILSpy generated this explicit interface implementation from .override directive in MoveNext
			return this.MoveNext();
		}

		[DebuggerHidden]
		void IEnumerator.Reset()
		{
			throw new NotSupportedException();
		}
	}

	private const string AssetBundleFileName = "arena";

	private const string PrefabName = "Start Room - Arena";

	private const string ArenaDisplayName = "Disposal Arena";

	private GameObject floorDoor;

	private Vector3 doorStartPos;

	private AudioClip arenaMusic;

	private AudioSource musicSource;

	private bool musicTriggered = false;

	private AssetBundle loadedBundle;

	private GameObject arenaPrefab;

	private void Awake()
	{
		SceneManager.sceneLoaded += OnSceneLoaded;
		string[] files = Directory.GetFiles(Paths.PluginPath, "arena", SearchOption.AllDirectories);
		if (files.Length != 0)
		{
			string text = files[0];
			((BaseUnityPlugin)this).Logger.LogInfo((object)("Found AssetBundle at: " + text));
			loadedBundle = AssetBundle.LoadFromFile(text);
			if ((Object)(object)loadedBundle != (Object)null)
			{
				arenaPrefab = loadedBundle.LoadAsset<GameObject>("Start Room - Arena");
				arenaMusic = loadedBundle.LoadAsset<AudioClip>("Arena");
				if ((Object)(object)arenaPrefab != (Object)null)
				{
					ArenaAPI.RegisterArena(arenaPrefab, "FeralElf/FeralArena");
					((BaseUnityPlugin)this).Logger.LogInfo((object)"Successfully registered arena: Disposal Arena");
				}
			}
		}
		else
		{
			((BaseUnityPlugin)this).Logger.LogError((object)("CRITICAL: AssetBundle 'arena' not found anywhere in " + Paths.PluginPath + "!"));
		}
	}

	private void Update()
	{
		//IL_00fa: 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_00d1: Unknown result type (might be due to invalid IL or missing references)
		//IL_00d6: Unknown result type (might be due to invalid IL or missing references)
		if (musicTriggered && ((Object)(object)LevelGenerator.Instance == (Object)null || !LevelGenerator.Instance.Generated || (Object)(object)RunManager.instance?.levelCurrent == (Object)null))
		{
			if ((Object)(object)musicSource != (Object)null)
			{
				musicSource.Stop();
			}
			musicTriggered = false;
			floorDoor = null;
		}
		else
		{
			if (musicTriggered)
			{
				return;
			}
			if ((Object)(object)floorDoor == (Object)null)
			{
				floorDoor = GameObject.Find("Floor Door") ?? GameObject.Find("Floor Door(Clone)");
				if ((Object)(object)floorDoor != (Object)null)
				{
					doorStartPos = floorDoor.transform.position;
				}
			}
			if ((Object)(object)floorDoor != (Object)null && Vector3.Distance(floorDoor.transform.position, doorStartPos) > 0.5f)
			{
				((BaseUnityPlugin)this).Logger.LogInfo((object)"Door movement detected in Update! Starting music.");
				PlayArenaMusic();
				musicTriggered = true;
			}
		}
	}

	private void OnSceneLoaded(Scene scene, LoadSceneMode mode)
	{
		((MonoBehaviour)this).StartCoroutine(CheckAndRunArenaLogic());
	}

	[IteratorStateMachine(typeof(<CheckAndRunArenaLogic>d__13))]
	private IEnumerator CheckAndRunArenaLogic()
	{
		//yield-return decompiler failed: Unexpected instruction in Iterator.Dispose()
		return new <CheckAndRunArenaLogic>d__13(0)
		{
			<>4__this = this
		};
	}

	[IteratorStateMachine(typeof(<DoorMovementWatchdog>d__14))]
	private IEnumerator DoorMovementWatchdog()
	{
		//yield-return decompiler failed: Unexpected instruction in Iterator.Dispose()
		return new <DoorMovementWatchdog>d__14(0)
		{
			<>4__this = this
		};
	}

	private void PlayArenaMusic()
	{
		if ((Object)(object)arenaMusic == (Object)null)
		{
			((BaseUnityPlugin)this).Logger.LogWarning((object)"Arena music clip not found in AssetBundle!");
			return;
		}
		if ((Object)(object)musicSource == (Object)null)
		{
			musicSource = ((Component)this).gameObject.AddComponent<AudioSource>();
			musicSource.playOnAwake = false;
			musicSource.spatialBlend = 0f;
			musicSource.loop = false;
		}
		musicSource.clip = arenaMusic;
		musicSource.Play();
	}

	[IteratorStateMachine(typeof(<SilentSanitize>d__16))]
	private IEnumerator SilentSanitize(GameObject arenaRoot)
	{
		//yield-return decompiler failed: Unexpected instruction in Iterator.Dispose()
		return new <SilentSanitize>d__16(0)
		{
			<>4__this = this,
			arenaRoot = arenaRoot
		};
	}

	[IteratorStateMachine(typeof(<RoundStartRunnerSpawn>d__17))]
	private IEnumerator RoundStartRunnerSpawn(int count)
	{
		//yield-return decompiler failed: Unexpected instruction in Iterator.Dispose()
		return new <RoundStartRunnerSpawn>d__17(0)
		{
			<>4__this = this,
			count = count
		};
	}
}