Decompiled source of EntropyStages v0.9.9

EntropyStages.dll

Decompiled a year 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 Microsoft.CodeAnalysis;
using On.RoR2;
using On.RoR2.UI;
using R2API;
using RoR2;
using RoR2.Navigation;
using RoR2.Skills;
using RoR2.UI;
using UnityEngine;
using UnityEngine.AddressableAssets;
using UnityEngine.Networking;
using UnityEngine.SceneManagement;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: TargetFramework(".NETStandard,Version=v2.0", FrameworkDisplayName = ".NET Standard 2.0")]
[assembly: AssemblyCompany("EntropyStages")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("EntropyStages")]
[assembly: AssemblyTitle("EntropyStages")]
[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 EntropyStages
{
	public class CrystalController : MonoBehaviour
	{
		public SpawnCard crystalSpawnCard = Addressables.LoadAssetAsync<SpawnCard>((object)"RoR2/Base/WeeklyRun/bscTimeCrystal.asset").WaitForCompletion();

		public uint crystalCount = 3u;

		public uint crystalsRequiredToKill = 3u;

		private List<OnDestroyCallback> crystalActiveList = new List<OnDestroyCallback>();

		public uint crystalsKilled => (uint)(crystalCount - crystalActiveList.Count);

		public static event Action<CrystalController> onBossGroupStartServer;

		public void OnStart()
		{
			if (NetworkServer.active)
			{
				CrystalController.onBossGroupStartServer?.Invoke(this);
			}
		}

		private void OnEnable()
		{
			//IL_0000: Unknown result type (might be due to invalid IL or missing references)
			//IL_0006: Expected O, but got Unknown
			//IL_0008: Unknown result type (might be due to invalid IL or missing references)
			//IL_002d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0037: Expected O, but got Unknown
			DirectorPlacementRule val = new DirectorPlacementRule();
			val.placementMode = (PlacementMode)4;
			for (int i = 0; i < crystalCount; i++)
			{
				crystalActiveList.Add(OnDestroyCallback.AddCallback(DirectorCore.instance.TrySpawnObject(new DirectorSpawnRequest(crystalSpawnCard, val, Run.instance.stageRng)), (Action<OnDestroyCallback>)delegate(OnDestroyCallback component)
				{
					crystalActiveList.Remove(component);
				}));
			}
			InstanceTracker.Add<CrystalController>(this);
			ObjectivePanelController.collectObjectiveSources += ReportObjective;
		}

		private void OnDisable()
		{
			ObjectivePanelController.collectObjectiveSources -= ReportObjective;
			InstanceTracker.Remove<CrystalController>(this);
		}

		public void ReportObjective(CharacterMaster master, List<ObjectiveSourceDescriptor> output)
		{
			//IL_0012: Unknown result type (might be due to invalid IL or missing references)
			//IL_0039: Unknown result type (might be due to invalid IL or missing references)
			if (crystalsKilled != crystalCount)
			{
				output.Add(new ObjectiveSourceDescriptor
				{
					source = (Object)(object)this,
					master = master,
					objectiveType = typeof(DestroyTimeCrystals)
				});
			}
		}

		public void FixedUpdate()
		{
			//IL_0087: Unknown result type (might be due to invalid IL or missing references)
			//IL_008c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0093: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a3: Expected O, but got Unknown
			if (!Object.op_Implicit((Object)(object)TeleporterInteraction.instance))
			{
				return;
			}
			bool flag = crystalsRequiredToKill > crystalsKilled;
			if (flag == TeleporterInteraction.instance.locked)
			{
				return;
			}
			if (flag)
			{
				if (NetworkServer.active)
				{
					TeleporterInteraction.instance.locked = true;
				}
				return;
			}
			if (NetworkServer.active)
			{
				TeleporterInteraction.instance.locked = false;
			}
			ChildLocator component = ((Component)((Component)TeleporterInteraction.instance).GetComponent<ModelLocator>().modelTransform).GetComponent<ChildLocator>();
			if (Object.op_Implicit((Object)(object)component))
			{
				Transform val = component.FindChild("TimeCrystalBeaconBlocker");
				EffectManager.SpawnEffect(LegacyResourcesAPI.Load<GameObject>("Prefabs/Effects/TimeCrystalDeath"), new EffectData
				{
					origin = ((Component)val).transform.position
				}, false);
				((Component)val).gameObject.SetActive(false);
				((Behaviour)this).enabled = false;
			}
		}
	}
	[BepInPlugin("com.Nuxlar.EntropyStages", "EntropyStages", "0.9.9")]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	public class EntropyStages : BaseUnityPlugin
	{
		private SpawnCard teleporterSpawnCard = Addressables.LoadAssetAsync<SpawnCard>((object)"RoR2/Base/Teleporters/iscTeleporter.asset").WaitForCompletion();

		private GameObject tearPortal = PrefabAPI.InstantiateClone(Addressables.LoadAssetAsync<GameObject>((object)"RoR2/Base/PortalArena/PortalArena.prefab").WaitForCompletion(), "NuxVoidTear");

		private InteractableSpawnCard deepVoidSpawnCard = Addressables.LoadAssetAsync<InteractableSpawnCard>((object)"RoR2/DLC1/DeepVoidPortal/iscDeepVoidPortal.asset").WaitForCompletion();

		private GameObject tear = PrefabAPI.InstantiateClone(((Component)Addressables.LoadAssetAsync<GameObject>((object)"RoR2/DLC1/gauntlets/GauntletEntranceOrb.prefab").WaitForCompletion().transform.GetChild(0)).gameObject, "NuxTearVFX");

		private EliteDef voidElite = Addressables.LoadAssetAsync<EliteDef>((object)"RoR2/DLC1/EliteVoid/edVoid.asset").WaitForCompletion();

		private SceneDef voidPlains = Addressables.LoadAssetAsync<SceneDef>((object)"RoR2/DLC1/itgolemplains/itgolemplains.asset").WaitForCompletion();

		private SceneDef voidAphelian = Addressables.LoadAssetAsync<SceneDef>((object)"RoR2/DLC1/itancientloft/itancientloft.asset").WaitForCompletion();

		private SceneDef voidAqueduct = Addressables.LoadAssetAsync<SceneDef>((object)"RoR2/DLC1/itgoolake/itgoolake.asset").WaitForCompletion();

		private SceneDef voidRallypoint = Addressables.LoadAssetAsync<SceneDef>((object)"RoR2/DLC1/itfrozenwall/itfrozenwall.asset").WaitForCompletion();

		private SceneDef voidAbyssal = Addressables.LoadAssetAsync<SceneDef>((object)"RoR2/DLC1/itdampcave/itdampcave.asset").WaitForCompletion();

		private SceneDef voidMeadow = Addressables.LoadAssetAsync<SceneDef>((object)"RoR2/DLC1/itskymeadow/itskymeadow.asset").WaitForCompletion();

		private SceneCollection sc1 = Addressables.LoadAssetAsync<SceneCollection>((object)"RoR2/Base/SceneGroups/sgStage1.asset").WaitForCompletion();

		private SceneCollection sc2 = Addressables.LoadAssetAsync<SceneCollection>((object)"RoR2/Base/SceneGroups/sgStage2.asset").WaitForCompletion();

		private SceneCollection sc3 = Addressables.LoadAssetAsync<SceneCollection>((object)"RoR2/Base/SceneGroups/sgStage3.asset").WaitForCompletion();

		private SceneCollection sc4 = Addressables.LoadAssetAsync<SceneCollection>((object)"RoR2/Base/SceneGroups/sgStage4.asset").WaitForCompletion();

		private SceneCollection sc5 = Addressables.LoadAssetAsync<SceneCollection>((object)"RoR2/Base/SceneGroups/sgStage5.asset").WaitForCompletion();

		private InteractableSpawnCard iscVoidTear = ScriptableObject.CreateInstance<InteractableSpawnCard>();

		private static DirectorCardCategorySelection[] dccsInteractables = (DirectorCardCategorySelection[])(object)new DirectorCardCategorySelection[1] { Addressables.LoadAssetAsync<DirectorCardCategorySelection>((object)"RoR2/DLC1/GameModes/InfiniteTowerRun/InfiniteTowerAssets/dccsInfiniteTowerInteractables.asset").WaitForCompletion() };

		private GameObject voidSeed = PrefabAPI.InstantiateClone(Addressables.LoadAssetAsync<GameObject>((object)"RoR2/DLC1/VoidCamp/VoidCamp.prefab").WaitForCompletion(), "RescueMissionNux");

		private static Material shieldMat = Addressables.LoadAssetAsync<Material>((object)"RoR2/Base/Engi/matDefenseMatrix.mat").WaitForCompletion();

		private static Material shieldMat2 = Addressables.LoadAssetAsync<Material>((object)"RoR2/Base/Engi/matDefenseMatrixCenter.mat").WaitForCompletion();

		private GameObject survivorPod = PrefabAPI.InstantiateClone(Addressables.LoadAssetAsync<GameObject>((object)"RoR2/Base/SurvivorPod/SurvivorPod.prefab").WaitForCompletion(), "EmergencyPodNux");

		private InteractableSpawnCard interactableSpawnCard = ScriptableObject.CreateInstance<InteractableSpawnCard>();

		private static string[] voidStageNames = new string[6] { "itgolemplains", "itgoolake", "itancientloft", "itfrozenwall", "itdampcave", "itskymeadow" };

		public static ConfigEntry<float> riftChance;

		public static ConfigEntry<bool> balanceToggle;

		private static ConfigFile ESConfig { get; set; }

		public void Awake()
		{
			//IL_0010: Unknown result type (might be due to invalid IL or missing references)
			//IL_001a: Expected O, but got Unknown
			//IL_0081: Unknown result type (might be due to invalid IL or missing references)
			//IL_008b: Expected O, but got Unknown
			//IL_0092: Unknown result type (might be due to invalid IL or missing references)
			//IL_009c: Expected O, but got Unknown
			//IL_00a3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ad: Expected O, but got Unknown
			//IL_00b4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00be: Expected O, but got Unknown
			//IL_00c5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00cf: Expected O, but got Unknown
			//IL_00d6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e0: Expected O, but got Unknown
			//IL_00e7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f1: Expected O, but got Unknown
			ESConfig = new ConfigFile(Paths.ConfigPath + "\\com.Nuxlar.EntropyStages.cfg", true);
			riftChance = ESConfig.Bind<float>("General", "Rift Spawn Chance", 0.25f, "How likely is it for a void rift to appear?");
			balanceToggle = ESConfig.Bind<bool>("General", "Toggle Stage Balancer", true, "Enable/Disable vanilla stage balancing tweaks.");
			if (balanceToggle.Value)
			{
				new StageBalancer();
			}
			SetupVoidTear();
			AddVoidStagesToPool();
			Stage.Start += new hook_Start(Stage_Start);
			CombatDirector.Init += new hook_Init(CombatDirector_Init);
			ClassicStageInfo.Start += new hook_Start(ClassicStageInfo_Start);
			VoidSuppressorBehavior.Start += new hook_Start(VoidSuppressorBehavior_Start);
			EliteTierDef.GetRandomAvailableEliteDef += new hook_GetRandomAvailableEliteDef(EliteTierDef_GetRandomAvailableEliteDef);
			DestroyTimeCrystals.GenerateString += new hook_GenerateString(DestroyTimeCrystals_GenerateString);
			TeleporterInteraction.AttemptToSpawnAllEligiblePortals += new hook_AttemptToSpawnAllEligiblePortals(TeleporterInteraction_AttemptToSpawnAllEligiblePortals);
		}

		private void SetupVoidTear()
		{
			//IL_005b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0061: Expected O, but got Unknown
			//IL_00cf: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e9: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f4: Unknown result type (might be due to invalid IL or missing references)
			//IL_010d: Unknown result type (might be due to invalid IL or missing references)
			//IL_015a: Unknown result type (might be due to invalid IL or missing references)
			//IL_015f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0170: Unknown result type (might be due to invalid IL or missing references)
			//IL_0175: Unknown result type (might be due to invalid IL or missing references)
			//IL_0186: Unknown result type (might be due to invalid IL or missing references)
			//IL_018b: Unknown result type (might be due to invalid IL or missing references)
			//IL_019c: Unknown result type (might be due to invalid IL or missing references)
			//IL_01a1: Unknown result type (might be due to invalid IL or missing references)
			tearPortal.GetComponent<GenericInteraction>().contextToken = "Enter ???";
			tearPortal.GetComponent<SceneExitController>().destinationScene = voidPlains;
			tearPortal.GetComponent<SceneExitController>().useRunNextStageScene = false;
			foreach (Transform item in tearPortal.transform.GetChild(0))
			{
				Transform val = item;
				if (((Object)val).name != "Collider")
				{
					Object.Destroy((Object)(object)((Component)val).gameObject);
				}
			}
			Transform transform = Object.Instantiate<GameObject>(tear, tearPortal.transform).transform;
			Object.Destroy((Object)(object)((Component)transform).GetComponent<ObjectScaleCurve>());
			transform.localScale = new Vector3(0.75f, 0.75f, 0.75f);
			transform.localPosition = new Vector3(0f, 5f, 0f);
			transform.localRotation = Quaternion.identity;
			transform.Rotate(new Vector3(0f, 0f, 45f));
			((Object)iscVoidTear).name = "iscVoidTearNux";
			((SpawnCard)iscVoidTear).prefab = tearPortal;
			((SpawnCard)iscVoidTear).sendOverNetwork = ((SpawnCard)deepVoidSpawnCard).sendOverNetwork;
			((SpawnCard)iscVoidTear).hullSize = ((SpawnCard)deepVoidSpawnCard).hullSize;
			((SpawnCard)iscVoidTear).nodeGraphType = ((SpawnCard)deepVoidSpawnCard).nodeGraphType;
			((SpawnCard)iscVoidTear).requiredFlags = ((SpawnCard)deepVoidSpawnCard).requiredFlags;
			((SpawnCard)iscVoidTear).forbiddenFlags = ((SpawnCard)deepVoidSpawnCard).forbiddenFlags;
			PrefabAPI.RegisterNetworkPrefab(tearPortal);
		}

		private void VoidSuppressorBehavior_Start(orig_Start orig, VoidSuppressorBehavior self)
		{
			orig.Invoke(self);
			self.numItemsToReveal = 3;
			self.itemsSuppressedPerPurchase = 3;
		}

		private void AddVoidStagesToPool()
		{
			List<SceneDef> obj = new List<SceneDef> { voidPlains };
			List<SceneDef> list = new List<SceneDef> { voidAphelian, voidAqueduct };
			List<SceneDef> list2 = new List<SceneDef> { voidRallypoint, voidMeadow };
			List<SceneDef> list3 = new List<SceneDef> { voidAbyssal };
			foreach (SceneDef item in obj)
			{
				item.destinationsGroup = sc2;
			}
			foreach (SceneDef item2 in list)
			{
				item2.destinationsGroup = sc3;
			}
			foreach (SceneDef item3 in list2)
			{
				item3.destinationsGroup = sc4;
			}
			foreach (SceneDef item4 in list3)
			{
				item4.destinationsGroup = sc5;
			}
		}

		private string DestroyTimeCrystals_GenerateString(orig_GenerateString orig, ObjectiveTracker self)
		{
			//IL_0000: Unknown result type (might be due to invalid IL or missing references)
			//IL_0005: Unknown result type (might be due to invalid IL or missing references)
			Scene activeScene = SceneManager.GetActiveScene();
			string name = ((Scene)(ref activeScene)).name;
			if (!voidStageNames.Contains(name))
			{
				return orig.Invoke(self);
			}
			CrystalController crystalController = (CrystalController)(object)InstanceTracker.FindInstancesEnumerable(typeof(CrystalController)).First();
			return string.Format(Language.GetString(self.baseToken), crystalController.crystalsKilled, crystalController.crystalsRequiredToKill);
		}

		private void CombatDirector_Init(orig_Init orig)
		{
			orig.Invoke();
			if (EliteAPI.VanillaEliteTiers.Length > 2)
			{
				EliteTierDef obj = EliteAPI.VanillaEliteTiers[2];
				List<EliteDef> list = obj.eliteTypes.ToList();
				list.Add(voidElite);
				obj.eliteTypes = list.ToArray();
			}
			if (EliteAPI.VanillaEliteTiers.Length > 1)
			{
				EliteTierDef obj2 = EliteAPI.VanillaEliteTiers[1];
				List<EliteDef> list2 = obj2.eliteTypes.ToList();
				list2.Add(voidElite);
				obj2.eliteTypes = list2.ToArray();
			}
		}

		private EliteDef EliteTierDef_GetRandomAvailableEliteDef(orig_GetRandomAvailableEliteDef orig, EliteTierDef self, Xoroshiro128Plus rng)
		{
			//IL_0000: Unknown result type (might be due to invalid IL or missing references)
			//IL_0005: Unknown result type (might be due to invalid IL or missing references)
			Scene activeScene = SceneManager.GetActiveScene();
			string name = ((Scene)(ref activeScene)).name;
			EliteDef val = orig.Invoke(self, rng);
			if (!voidStageNames.Contains(name) && (Object)(object)val == (Object)(object)voidElite)
			{
				do
				{
					val = orig.Invoke(self, rng);
				}
				while (!((Object)(object)val != (Object)(object)voidElite));
				return val;
			}
			return val;
		}

		private GameObject SpawnTear(TeleporterInteraction tpInteraction)
		{
			//IL_000b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0010: Unknown result type (might be due to invalid IL or missing references)
			//IL_001b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0026: 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_002d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0034: Unknown result type (might be due to invalid IL or missing references)
			//IL_0039: Unknown result type (might be due to invalid IL or missing references)
			//IL_003e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0055: Expected O, but got Unknown
			//IL_0050: Unknown result type (might be due to invalid IL or missing references)
			//IL_005a: Expected O, but got Unknown
			return DirectorCore.instance.TrySpawnObject(new DirectorSpawnRequest((SpawnCard)(object)iscVoidTear, new DirectorPlacementRule
			{
				minDistance = 10f,
				maxDistance = 40f,
				placementMode = (PlacementMode)1,
				position = ((Component)tpInteraction).transform.position,
				spawnOnTarget = ((Component)tpInteraction).transform
			}, tpInteraction.rng));
		}

		private void TeleporterInteraction_AttemptToSpawnAllEligiblePortals(orig_AttemptToSpawnAllEligiblePortals orig, TeleporterInteraction self)
		{
			//IL_0000: Unknown result type (might be due to invalid IL or missing references)
			//IL_0005: Unknown result type (might be due to invalid IL or missing references)
			Scene activeScene = SceneManager.GetActiveScene();
			string name = ((Scene)(ref activeScene)).name;
			if (Random.value < riftChance.Value)
			{
				switch (name)
				{
				case "golemplains":
				{
					GameObject val = SpawnTear(self);
					if (Object.op_Implicit((Object)(object)val))
					{
						val.GetComponent<SceneExitController>().destinationScene = voidPlains;
					}
					break;
				}
				case "goolake":
				{
					GameObject val = SpawnTear(self);
					if (Object.op_Implicit((Object)(object)val))
					{
						val.GetComponent<SceneExitController>().destinationScene = voidAqueduct;
					}
					break;
				}
				case "ancientloft":
				{
					GameObject val = SpawnTear(self);
					if (Object.op_Implicit((Object)(object)val))
					{
						val.GetComponent<SceneExitController>().destinationScene = voidAphelian;
					}
					break;
				}
				case "frozenwall":
				{
					GameObject val = SpawnTear(self);
					if (Object.op_Implicit((Object)(object)val))
					{
						val.GetComponent<SceneExitController>().destinationScene = voidRallypoint;
					}
					break;
				}
				case "dampcave":
				{
					GameObject val = SpawnTear(self);
					if (Object.op_Implicit((Object)(object)val))
					{
						val.GetComponent<SceneExitController>().destinationScene = voidAbyssal;
					}
					break;
				}
				case "skymeadow":
				{
					GameObject val = SpawnTear(self);
					if (Object.op_Implicit((Object)(object)val))
					{
						val.GetComponent<SceneExitController>().destinationScene = voidMeadow;
					}
					break;
				}
				}
			}
			orig.Invoke(self);
		}

		private void ClassicStageInfo_Start(orig_Start orig, ClassicStageInfo self)
		{
			//IL_0000: Unknown result type (might be due to invalid IL or missing references)
			//IL_0005: Unknown result type (might be due to invalid IL or missing references)
			Scene activeScene = SceneManager.GetActiveScene();
			switch (((Scene)(ref activeScene)).name)
			{
			case "itgolemplains":
				self.sceneDirectorInteractibleCredits /= 4;
				self.sceneDirectorMonsterCredits = 100;
				break;
			case "itgoolake":
				self.sceneDirectorInteractibleCredits /= 4;
				self.sceneDirectorMonsterCredits = 150;
				break;
			case "itancientloft":
				self.sceneDirectorInteractibleCredits /= 4;
				self.sceneDirectorMonsterCredits = 150;
				break;
			case "itfrozenwall":
				self.sceneDirectorInteractibleCredits /= 4;
				self.sceneDirectorMonsterCredits = 175;
				break;
			case "itdampcave":
				self.sceneDirectorInteractibleCredits /= 4;
				self.sceneDirectorMonsterCredits = 200;
				break;
			case "itskymeadow":
				self.sceneDirectorInteractibleCredits /= 4;
				self.sceneDirectorMonsterCredits = 250;
				break;
			}
			orig.Invoke(self);
		}

		private void Stage_Start(orig_Start orig, Stage self)
		{
			//IL_0000: Unknown result type (might be due to invalid IL or missing references)
			//IL_0005: Unknown result type (might be due to invalid IL or missing references)
			//IL_00bc: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c6: Expected O, but got Unknown
			//IL_00d2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f2: Unknown result type (might be due to invalid IL or missing references)
			//IL_012e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0138: Expected O, but got Unknown
			//IL_0144: Unknown result type (might be due to invalid IL or missing references)
			//IL_0162: Unknown result type (might be due to invalid IL or missing references)
			//IL_0164: Unknown result type (might be due to invalid IL or missing references)
			//IL_01be: Unknown result type (might be due to invalid IL or missing references)
			//IL_01c3: Unknown result type (might be due to invalid IL or missing references)
			//IL_01d4: Unknown result type (might be due to invalid IL or missing references)
			//IL_01f4: Unknown result type (might be due to invalid IL or missing references)
			//IL_01f9: Unknown result type (might be due to invalid IL or missing references)
			//IL_01fd: Unknown result type (might be due to invalid IL or missing references)
			//IL_0208: Unknown result type (might be due to invalid IL or missing references)
			//IL_020a: Unknown result type (might be due to invalid IL or missing references)
			//IL_020c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0211: Unknown result type (might be due to invalid IL or missing references)
			//IL_0234: Unknown result type (might be due to invalid IL or missing references)
			//IL_023b: Expected O, but got Unknown
			//IL_023e: Unknown result type (might be due to invalid IL or missing references)
			//IL_024d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0252: Unknown result type (might be due to invalid IL or missing references)
			//IL_0267: Unknown result type (might be due to invalid IL or missing references)
			//IL_0271: Expected O, but got Unknown
			Scene activeScene = SceneManager.GetActiveScene();
			string name = ((Scene)(ref activeScene)).name;
			if (voidStageNames.Contains(name))
			{
				GameObject val = GameObject.Find("InfiniteTowerSceneDirector");
				if (Object.op_Implicit((Object)(object)val))
				{
					if (!Object.op_Implicit((Object)(object)val.GetComponent<DirectorCore>()))
					{
						val.AddComponent<DirectorCore>();
					}
					if (((NetworkBehaviour)self).isServer)
					{
						val.AddComponent<CrystalController>();
						SceneDirector component = val.GetComponent<SceneDirector>();
						if (Object.op_Implicit((Object)(object)component))
						{
							if (val.GetComponents<CombatDirector>().Length == 0)
							{
								CombatDirector val2 = val.AddComponent<CombatDirector>();
								CombatDirector val3 = val.AddComponent<CombatDirector>();
								val2.customName = "Director";
								val2.minRerollSpawnInterval = 4.5f;
								val2.maxRerollSpawnInterval = 9f;
								val2.creditMultiplier = 1.075f;
								val2.onSpawnedServer = new OnSpawnedServer();
								val2.moneyWaveIntervals = (RangeFloat[])(object)new RangeFloat[1]
								{
									new RangeFloat
									{
										min = 1f,
										max = 1f
									}
								};
								val3.customName = "Director";
								val3.minRerollSpawnInterval = 22.5f;
								val3.maxRerollSpawnInterval = 30f;
								val3.creditMultiplier = 1.075f;
								val3.onSpawnedServer = new OnSpawnedServer();
								val3.moneyWaveIntervals = (RangeFloat[])(object)new RangeFloat[1]
								{
									new RangeFloat
									{
										min = 1f,
										max = 1f
									}
								};
								val2.Awake();
								val3.Awake();
								((Behaviour)val2).enabled = true;
								((Behaviour)val3).enabled = true;
								component.PopulateScene();
								component.teleporterSpawnCard = teleporterSpawnCard;
								component.PlaceTeleporter();
							}
							if (!Object.op_Implicit((Object)(object)TeleporterInteraction.instance))
							{
								return;
							}
							Vector3 position = ((Component)TeleporterInteraction.instance).transform.position;
							NodeGraph nodeGraph = SceneInfo.instance.GetNodeGraph((GraphType)0);
							Vector3 val4 = default(Vector3);
							foreach (NodeIndex item in nodeGraph.FindNodesInRangeWithFlagConditions(position, 0f, 50f, (HullMask)1, (NodeFlags)0, (NodeFlags)4, false))
							{
								if (nodeGraph.GetNodePosition(item, ref val4))
								{
									SpawnPoint.AddSpawnPoint(val4, Quaternion.LookRotation(position, Vector3.up));
								}
							}
							DirectorPlacementRule val5 = new DirectorPlacementRule();
							val5.placementMode = (PlacementMode)4;
							DirectorCore.instance.TrySpawnObject(new DirectorSpawnRequest(Addressables.LoadAssetAsync<SpawnCard>((object)"RoR2/DLC1/VoidSuppressor/iscVoidSuppressor.asset").WaitForCompletion(), val5, Run.instance.stageRng));
						}
					}
					if (!Object.op_Implicit((Object)(object)TeleporterInteraction.instance))
					{
						return;
					}
					ChildLocator component2 = ((Component)((Component)TeleporterInteraction.instance).GetComponent<ModelLocator>().modelTransform).GetComponent<ChildLocator>();
					if (!Object.op_Implicit((Object)(object)component2))
					{
						return;
					}
					((Component)component2.FindChild("TimeCrystalProps")).gameObject.SetActive(true);
					((Component)component2.FindChild("TimeCrystalBeaconBlocker")).gameObject.SetActive(true);
				}
			}
			orig.Invoke(self);
		}
	}
	[RequireComponent(typeof(MeshFilter))]
	public class ReverseNormals : MonoBehaviour
	{
		private void Start()
		{
			//IL_0038: Unknown result type (might be due to invalid IL or missing references)
			//IL_003d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0042: Unknown result type (might be due to invalid IL or missing references)
			Component component = ((Component)this).GetComponent(typeof(MeshFilter));
			MeshFilter val = (MeshFilter)(object)((component is MeshFilter) ? component : null);
			if ((Object)(object)val != (Object)null)
			{
				Mesh mesh = val.mesh;
				Vector3[] normals = mesh.normals;
				for (int i = 0; i < normals.Length; i++)
				{
					normals[i] = -normals[i];
				}
				mesh.normals = normals;
				for (int j = 0; j < mesh.subMeshCount; j++)
				{
					int[] triangles = mesh.GetTriangles(j);
					for (int k = 0; k < triangles.Length; k += 3)
					{
						int num = triangles[k];
						triangles[k] = triangles[k + 1];
						triangles[k + 1] = num;
					}
					mesh.SetTriangles(triangles, j);
				}
			}
			((Component)this).GetComponent<MeshCollider>().sharedMesh = val.mesh;
		}
	}
	public class StageBalancer : MonoBehaviour
	{
		private SkillDef AWUUlt = Addressables.LoadAssetAsync<SkillDef>((object)"RoR2/Base/RoboBallBoss/SuperFireDelayKnockup.asset").WaitForCompletion();

		private SpawnCard categoryChest2Healing = Addressables.LoadAssetAsync<SpawnCard>((object)"RoR2/DLC1/CategoryChest2/iscCategoryChest2Healing.asset").WaitForCompletion();

		private SpawnCard categoryChest2Damage = Addressables.LoadAssetAsync<SpawnCard>((object)"RoR2/DLC1/CategoryChest2/iscCategoryChest2Damage.asset").WaitForCompletion();

		private SpawnCard larva = Addressables.LoadAssetAsync<SpawnCard>((object)"RoR2/DLC1/AcidLarva/cscAcidLarva.asset").WaitForCompletion();

		private SpawnCard vulture = Addressables.LoadAssetAsync<SpawnCard>((object)"RoR2/Base/Vulture/cscVulture.asset").WaitForCompletion();

		private SpawnCard probe = Addressables.LoadAssetAsync<SpawnCard>((object)"RoR2/Base/RoboBallBoss/cscRoboBallMini.asset").WaitForCompletion();

		private SpawnCard alphaConstruct = Addressables.LoadAssetAsync<SpawnCard>((object)"RoR2/DLC1/MajorAndMinorConstruct/cscMinorConstruct.asset").WaitForCompletion();

		private SpawnCard apothecary = Addressables.LoadAssetAsync<SpawnCard>((object)"RoR2/DLC1/ClayGrenadier/cscClayGrenadier.asset").WaitForCompletion();

		private SpawnCard templar = Addressables.LoadAssetAsync<SpawnCard>((object)"RoR2/Base/ClayBruiser/cscClayBruiser.asset").WaitForCompletion();

		private SpawnCard lemurian = Addressables.LoadAssetAsync<SpawnCard>((object)"RoR2/Base/Lemurian/cscLemurian.asset").WaitForCompletion();

		private SpawnCard vermin = Addressables.LoadAssetAsync<SpawnCard>((object)"RoR2/DLC1/Vermin/cscVermin.asset").WaitForCompletion();

		private SpawnCard hermitCrab = Addressables.LoadAssetAsync<SpawnCard>((object)"RoR2/Base/HermitCrab/cscHermitCrab.asset").WaitForCompletion();

		private SpawnCard grovetender = Addressables.LoadAssetAsync<SpawnCard>((object)"RoR2/Base/Gravekeeper/cscGravekeeper.asset").WaitForCompletion();

		private SpawnCard xiConstruct = Addressables.LoadAssetAsync<SpawnCard>((object)"RoR2/DLC1/MajorAndMinorConstruct/cscMegaConstruct.asset").WaitForCompletion();

		private SpawnCard magmaWorm = Addressables.LoadAssetAsync<SpawnCard>((object)"RoR2/Base/MagmaWorm/cscMagmaWorm.asset").WaitForCompletion();

		private DirectorCardCategorySelection aqueductMonsters = Addressables.LoadAssetAsync<DirectorCardCategorySelection>((object)"RoR2/Base/goolake/dccsGooLakeMonstersDLC1.asset").WaitForCompletion();

		private DirectorCardCategorySelection rpdMonsters = Addressables.LoadAssetAsync<DirectorCardCategorySelection>((object)"RoR2/Base/frozenwall/dccsFrozenWallMonstersDLC1.asset").WaitForCompletion();

		private DirectorCardCategorySelection poolsMonsters = Addressables.LoadAssetAsync<DirectorCardCategorySelection>((object)"RoR2/DLC1/sulfurpools/dccsSulfurPoolsMonstersDLC1.asset").WaitForCompletion();

		private DirectorCardCategorySelection acresMonsters = Addressables.LoadAssetAsync<DirectorCardCategorySelection>((object)"RoR2/Base/wispgraveyard/dccsWispGraveyardMonstersDLC1.asset").WaitForCompletion();

		private DirectorCardCategorySelection sirensMonsters = Addressables.LoadAssetAsync<DirectorCardCategorySelection>((object)"RoR2/Base/shipgraveyard/dccsShipgraveyardMonstersDLC1.asset").WaitForCompletion();

		private DirectorCardCategorySelection abyssalMonsters = Addressables.LoadAssetAsync<DirectorCardCategorySelection>((object)"RoR2/Base/dampcave/dccsDampCaveMonstersDLC1.asset").WaitForCompletion();

		private DirectorCardCategorySelection groveMonsters = Addressables.LoadAssetAsync<DirectorCardCategorySelection>((object)"RoR2/Base/rootjungle/dccsRootJungleMonstersDLC1.asset").WaitForCompletion();

		private DirectorCardCategorySelection meadowMonsters = Addressables.LoadAssetAsync<DirectorCardCategorySelection>((object)"RoR2/Base/skymeadow/dccsSkyMeadowMonstersDLC1.asset").WaitForCompletion();

		private DirectorCardCategorySelection forestInteractables = Addressables.LoadAssetAsync<DirectorCardCategorySelection>((object)"RoR2/DLC1/snowyforest/dccsSnowyForestInteractablesDLC1.asset").WaitForCompletion();

		private DirectorCardCategorySelection plainsInteractables = Addressables.LoadAssetAsync<DirectorCardCategorySelection>((object)"RoR2/Base/golemplains/dccsGolemplainsInteractablesDLC1.asset").WaitForCompletion();

		private DirectorCardCategorySelection bbInteractables = Addressables.LoadAssetAsync<DirectorCardCategorySelection>((object)"RoR2/Base/blackbeach/dccsBlackBeachInteractablesDLC1.asset").WaitForCompletion();

		private DirectorCardCategorySelection aphelianInteractables = Addressables.LoadAssetAsync<DirectorCardCategorySelection>((object)"RoR2/DLC1/ancientloft/dccsAncientLoftInteractablesDLC1.asset").WaitForCompletion();

		private DirectorCardCategorySelection aqueductInteractables = Addressables.LoadAssetAsync<DirectorCardCategorySelection>((object)"RoR2/Base/goolake/dccsGooLakeInteractablesDLC1.asset").WaitForCompletion();

		private DirectorCardCategorySelection wetlandInteractables = Addressables.LoadAssetAsync<DirectorCardCategorySelection>((object)"RoR2/Base/foggyswamp/dccsFoggySwampInteractablesDLC1.asset").WaitForCompletion();

		private DirectorCardCategorySelection acresInteractables = Addressables.LoadAssetAsync<DirectorCardCategorySelection>((object)"RoR2/Base/wispgraveyard/dccsWispGraveyardInteractablesDLC1.asset").WaitForCompletion();

		private DirectorCardCategorySelection poolsInteractables = Addressables.LoadAssetAsync<DirectorCardCategorySelection>((object)"RoR2/DLC1/sulfurpools/dccsSulfurPoolsInteractablesDLC1.asset").WaitForCompletion();

		private DirectorCardCategorySelection rpdInteractables = Addressables.LoadAssetAsync<DirectorCardCategorySelection>((object)"RoR2/Base/frozenwall/dccsFrozenWallInteractablesDLC1.asset").WaitForCompletion();

		private DirectorCardCategorySelection sirensInteractables = Addressables.LoadAssetAsync<DirectorCardCategorySelection>((object)"RoR2/Base/shipgraveyard/dccsShipgraveyardInteractablesDLC1.asset").WaitForCompletion();

		private DirectorCardCategorySelection groveInteractables = Addressables.LoadAssetAsync<DirectorCardCategorySelection>((object)"RoR2/Base/rootjungle/dccsRootJungleInteractablesDLC1.asset").WaitForCompletion();

		private DirectorCardCategorySelection abyssalInteractables = Addressables.LoadAssetAsync<DirectorCardCategorySelection>((object)"RoR2/Base/dampcave/dccsDampCaveInteractablesDLC1.asset").WaitForCompletion();

		public StageBalancer()
		{
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			//IL_000b: Unknown result type (might be due to invalid IL or missing references)
			//IL_001e: 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_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_004e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0053: Unknown result type (might be due to invalid IL or missing references)
			//IL_0066: Unknown result type (might be due to invalid IL or missing references)
			//IL_006b: Unknown result type (might be due to invalid IL or missing references)
			//IL_007e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0083: Unknown result type (might be due to invalid IL or missing references)
			//IL_0096: Unknown result type (might be due to invalid IL or missing references)
			//IL_009b: 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_00c6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00cb: Unknown result type (might be due to invalid IL or missing references)
			//IL_00de: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00fb: Unknown result type (might be due to invalid IL or missing references)
			//IL_010e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0113: Unknown result type (might be due to invalid IL or missing references)
			//IL_0126: Unknown result type (might be due to invalid IL or missing references)
			//IL_012b: Unknown result type (might be due to invalid IL or missing references)
			//IL_013e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0143: Unknown result type (might be due to invalid IL or missing references)
			//IL_0156: Unknown result type (might be due to invalid IL or missing references)
			//IL_015b: Unknown result type (might be due to invalid IL or missing references)
			//IL_016e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0173: Unknown result type (might be due to invalid IL or missing references)
			//IL_0186: Unknown result type (might be due to invalid IL or missing references)
			//IL_018b: Unknown result type (might be due to invalid IL or missing references)
			//IL_019e: Unknown result type (might be due to invalid IL or missing references)
			//IL_01a3: Unknown result type (might be due to invalid IL or missing references)
			//IL_01b6: Unknown result type (might be due to invalid IL or missing references)
			//IL_01bb: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ce: Unknown result type (might be due to invalid IL or missing references)
			//IL_01d3: Unknown result type (might be due to invalid IL or missing references)
			//IL_01e6: Unknown result type (might be due to invalid IL or missing references)
			//IL_01eb: Unknown result type (might be due to invalid IL or missing references)
			//IL_01fe: Unknown result type (might be due to invalid IL or missing references)
			//IL_0203: Unknown result type (might be due to invalid IL or missing references)
			//IL_0216: Unknown result type (might be due to invalid IL or missing references)
			//IL_021b: Unknown result type (might be due to invalid IL or missing references)
			//IL_022e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0233: Unknown result type (might be due to invalid IL or missing references)
			//IL_0246: Unknown result type (might be due to invalid IL or missing references)
			//IL_024b: Unknown result type (might be due to invalid IL or missing references)
			//IL_025e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0263: Unknown result type (might be due to invalid IL or missing references)
			//IL_0276: Unknown result type (might be due to invalid IL or missing references)
			//IL_027b: Unknown result type (might be due to invalid IL or missing references)
			//IL_028e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0293: Unknown result type (might be due to invalid IL or missing references)
			//IL_02a6: Unknown result type (might be due to invalid IL or missing references)
			//IL_02ab: Unknown result type (might be due to invalid IL or missing references)
			//IL_02be: Unknown result type (might be due to invalid IL or missing references)
			//IL_02c3: Unknown result type (might be due to invalid IL or missing references)
			//IL_02d6: Unknown result type (might be due to invalid IL or missing references)
			//IL_02db: Unknown result type (might be due to invalid IL or missing references)
			//IL_02ee: Unknown result type (might be due to invalid IL or missing references)
			//IL_02f3: Unknown result type (might be due to invalid IL or missing references)
			//IL_0306: Unknown result type (might be due to invalid IL or missing references)
			//IL_030b: Unknown result type (might be due to invalid IL or missing references)
			//IL_031e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0323: Unknown result type (might be due to invalid IL or missing references)
			//IL_0336: Unknown result type (might be due to invalid IL or missing references)
			//IL_033b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0361: Unknown result type (might be due to invalid IL or missing references)
			//IL_036b: Expected O, but got Unknown
			//IL_0372: Unknown result type (might be due to invalid IL or missing references)
			//IL_037c: Expected O, but got Unknown
			//IL_0383: Unknown result type (might be due to invalid IL or missing references)
			//IL_038d: Expected O, but got Unknown
			//IL_0394: Unknown result type (might be due to invalid IL or missing references)
			//IL_039e: Expected O, but got Unknown
			//IL_03a5: Unknown result type (might be due to invalid IL or missing references)
			//IL_03af: Expected O, but got Unknown
			//IL_03b6: Unknown result type (might be due to invalid IL or missing references)
			//IL_03c0: Expected O, but got Unknown
			AWUUlt.beginSkillCooldownOnSkillEnd = true;
			Stage.Start += new hook_Start(Stage_Start);
			ClassicStageInfo.Start += new hook_Start(ClassicStageInfo_Start);
			TimedChestController.OnEnable += new hook_OnEnable(TimedChestController_OnEnable);
			GoldshoresMissionController.Start += new hook_Start(GoldshoresMissionController_Start);
			MoonBatteryMissionController.Awake += new hook_Awake(MoonBatteryMissionController_Awake);
			VoidStageMissionController.Start += new hook_Start(VoidStageMissionController_Start);
			ChangeCatChest(forestInteractables, categoryChest2Healing, "iscCategoryChest2Damage");
			ChangeCatChest(plainsInteractables, categoryChest2Damage, "iscCategoryChest2Healing");
			AddMiniboss(aqueductMonsters, templar);
			ChangeCatChest(aqueductInteractables, categoryChest2Healing, "iscCategoryChest2Damage");
			ChangeCatChest(wetlandInteractables, categoryChest2Damage, "iscCategoryChest2Healing");
			RemoveAphelianChest();
			ChangeEnemy(rpdMonsters, alphaConstruct, "cscVerminSnowy");
			ChangeEnemy(poolsMonsters, hermitCrab, "cscMinorConstruct");
			ChangeEnemy(acresMonsters, lemurian, "cscBeetle");
			ChangeMiniboss(acresMonsters, apothecary, "cscBeetleGuard");
			ChangeBoss(poolsMonsters, magmaWorm, "cscMegaConstruct");
			ChangeBoss(rpdMonsters, xiConstruct, "cscClayBoss");
			ChangeCatChest(acresInteractables, categoryChest2Healing, "iscCategoryChest2Damage");
			ChangeCatChest(poolsInteractables, categoryChest2Damage, "iscCategoryChest2Healing");
			AcresBarrelIncrease();
			PoolsBarrelDecrease();
			ChangeEnemy(sirensMonsters, lemurian, "cscAcidLarva");
			ChangeEnemy(groveMonsters, alphaConstruct, "cscAcidLarva");
			ChangeEnemy(abyssalMonsters, larva, "cscHermitCrab");
			ChangeBoss(groveMonsters, grovetender, "cscClayBoss");
			ChangeBoss(groveMonsters, xiConstruct, "cscVagrant");
			ChangeCatChest(abyssalInteractables, categoryChest2Healing, "iscCategoryChest2Damage");
			ChangeCatChest(sirensInteractables, categoryChest2Damage, "iscCategoryChest2Healing");
			BalanceSirenGrove();
			SirensDroneShrineDecrease();
			ChangeEnemy(meadowMonsters, vulture, "cscMinorConstruct");
			ChangeBoss(meadowMonsters, magmaWorm, "cscMegaConstruct");
		}

		private void InspectMonsters(DirectorCardCategorySelection dccs)
		{
			//IL_000b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0010: Unknown result type (might be due to invalid IL or missing references)
			for (int i = 0; i < dccs.categories.Length; i++)
			{
				Category val = dccs.categories[i];
				Debug.LogWarning((object)val.name);
				Debug.LogWarning((object)"--------------------------------------");
				DirectorCard[] cards = val.cards;
				for (int j = 0; j < cards.Length; j++)
				{
					Debug.LogWarning((object)((Object)cards[j].spawnCard).name);
				}
			}
		}

		private void GoldshoresMissionController_Start(orig_Start orig, GoldshoresMissionController self)
		{
			self.beaconsToSpawnOnMap = 4;
			orig.Invoke(self);
		}

		private void VoidStageMissionController_Start(orig_Start orig, VoidStageMissionController self)
		{
			self.batteryCount = 2;
			orig.Invoke(self);
		}

		private void MoonBatteryMissionController_Awake(orig_Awake orig, MoonBatteryMissionController self)
		{
			orig.Invoke(self);
			self._numRequiredBatteries = 2;
		}

		private void Stage_Start(orig_Start orig, Stage self)
		{
			//IL_0000: Unknown result type (might be due to invalid IL or missing references)
			//IL_0005: Unknown result type (might be due to invalid IL or missing references)
			Scene activeScene = SceneManager.GetActiveScene();
			if (((Scene)(ref activeScene)).name == "blackbeach")
			{
				GameObject val = GameObject.Find("HOLDER: Preplaced Objects");
				if (Object.op_Implicit((Object)(object)val) && !((Component)val.transform.GetChild(0)).gameObject.activeSelf && !((Component)val.transform.GetChild(1)).gameObject.activeSelf && !((Component)val.transform.GetChild(2)).gameObject.activeSelf)
				{
					Debug.Log((object)"StageBalancer: Manually activating random newt altar");
					((Component)val.transform.GetChild(Random.Range(0, 2))).gameObject.SetActive(true);
				}
			}
			orig.Invoke(self);
		}

		private void ClassicStageInfo_Start(orig_Start orig, ClassicStageInfo self)
		{
			//IL_0000: Unknown result type (might be due to invalid IL or missing references)
			//IL_0005: Unknown result type (might be due to invalid IL or missing references)
			Scene activeScene = SceneManager.GetActiveScene();
			string name = ((Scene)(ref activeScene)).name;
			switch (name)
			{
			case "golemplains":
			case "golemplains2":
			case "blackbeach":
			case "blackbeach2":
				self.sceneDirectorInteractibleCredits = 230;
				break;
			}
			if (name == "snowyforest")
			{
				self.sceneDirectorInteractibleCredits = 290;
			}
			if (name == "foggyswamp")
			{
				self.sceneDirectorInteractibleCredits = 320;
			}
			if (name == "shipgraveyard" || name == "rootjungle")
			{
				self.sceneDirectorInteractibleCredits = 430;
			}
			if (name == "dampcavesimple" && self.bonusInteractibleCreditObjects != null)
			{
				Debug.Log((object)"StageBalancer: Adjusting extra abyssal credits");
				for (int i = 0; i < self.bonusInteractibleCreditObjects.Length; i++)
				{
					self.bonusInteractibleCreditObjects[i].points /= 2;
				}
			}
			orig.Invoke(self);
		}

		private void TimedChestController_OnEnable(orig_OnEnable orig, TimedChestController self)
		{
			self.lockTime = 720f;
			orig.Invoke(self);
		}

		private void ChangeCatChest(DirectorCardCategorySelection dccs, SpawnCard newChest, string chestName)
		{
			//IL_000e: 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_0014: Unknown result type (might be due to invalid IL or missing references)
			//IL_002d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0032: Unknown result type (might be due to invalid IL or missing references)
			//IL_0039: Unknown result type (might be due to invalid IL or missing references)
			//IL_0045: Expected O, but got Unknown
			//IL_0045: Unknown result type (might be due to invalid IL or missing references)
			for (int i = 0; i < dccs.categories.Length; i++)
			{
				Category val = dccs.categories[i];
				if (!(val.name == "Chests"))
				{
					continue;
				}
				List<DirectorCard> list = new List<DirectorCard>();
				list.Add(new DirectorCard
				{
					spawnCard = newChest,
					selectionWeight = 3
				});
				DirectorCard[] cards = val.cards;
				foreach (DirectorCard val2 in cards)
				{
					if (((Object)val2.spawnCard).name != chestName)
					{
						list.Add(val2);
					}
				}
				dccs.categories[i].cards = list.ToArray();
			}
		}

		private void ChangeEnemy(DirectorCardCategorySelection dccs, SpawnCard newEnemy, string enemyName)
		{
			//IL_000e: 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_0014: 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_005d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0062: Unknown result type (might be due to invalid IL or missing references)
			//IL_0069: Unknown result type (might be due to invalid IL or missing references)
			//IL_007b: Expected O, but got Unknown
			for (int i = 0; i < dccs.categories.Length; i++)
			{
				Category val = dccs.categories[i];
				if (!(val.name == "Basic Monsters"))
				{
					continue;
				}
				List<DirectorCard> list = new List<DirectorCard>();
				DirectorCard[] cards = val.cards;
				foreach (DirectorCard val2 in cards)
				{
					if (((Object)val2.spawnCard).name != enemyName)
					{
						list.Add(val2);
						continue;
					}
					list.Add(new DirectorCard
					{
						spawnCard = newEnemy,
						selectionWeight = val2.selectionWeight
					});
				}
				dccs.categories[i].cards = list.ToArray();
			}
		}

		private void AddMiniboss(DirectorCardCategorySelection dccs, SpawnCard newEnemy)
		{
			//IL_000e: 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_0014: Unknown result type (might be due to invalid IL or missing references)
			//IL_002d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0032: Unknown result type (might be due to invalid IL or missing references)
			//IL_0039: Unknown result type (might be due to invalid IL or missing references)
			//IL_0045: Expected O, but got Unknown
			//IL_0045: Unknown result type (might be due to invalid IL or missing references)
			for (int i = 0; i < dccs.categories.Length; i++)
			{
				Category val = dccs.categories[i];
				if (val.name == "Minibosses")
				{
					List<DirectorCard> list = new List<DirectorCard>();
					list.Add(new DirectorCard
					{
						spawnCard = newEnemy,
						selectionWeight = 1
					});
					DirectorCard[] cards = val.cards;
					foreach (DirectorCard item in cards)
					{
						list.Add(item);
					}
					dccs.categories[i].cards = list.ToArray();
				}
			}
		}

		private void ChangeMiniboss(DirectorCardCategorySelection dccs, SpawnCard newEnemy, string enemyName)
		{
			//IL_000e: 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_0014: 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_005d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0062: Unknown result type (might be due to invalid IL or missing references)
			//IL_0069: Unknown result type (might be due to invalid IL or missing references)
			//IL_007b: Expected O, but got Unknown
			for (int i = 0; i < dccs.categories.Length; i++)
			{
				Category val = dccs.categories[i];
				if (!(val.name == "Minibosses"))
				{
					continue;
				}
				List<DirectorCard> list = new List<DirectorCard>();
				DirectorCard[] cards = val.cards;
				foreach (DirectorCard val2 in cards)
				{
					if (((Object)val2.spawnCard).name != enemyName)
					{
						list.Add(val2);
						continue;
					}
					list.Add(new DirectorCard
					{
						spawnCard = newEnemy,
						selectionWeight = val2.selectionWeight
					});
				}
				dccs.categories[i].cards = list.ToArray();
			}
		}

		private void ChangeBoss(DirectorCardCategorySelection dccs, SpawnCard newBoss, string bossName)
		{
			//IL_000e: 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_0014: 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_005d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0062: Unknown result type (might be due to invalid IL or missing references)
			//IL_0069: Unknown result type (might be due to invalid IL or missing references)
			//IL_007b: Expected O, but got Unknown
			for (int i = 0; i < dccs.categories.Length; i++)
			{
				Category val = dccs.categories[i];
				if (!(val.name == "Champions"))
				{
					continue;
				}
				List<DirectorCard> list = new List<DirectorCard>();
				DirectorCard[] cards = val.cards;
				foreach (DirectorCard val2 in cards)
				{
					if (((Object)val2.spawnCard).name != bossName)
					{
						list.Add(val2);
						continue;
					}
					list.Add(new DirectorCard
					{
						spawnCard = newBoss,
						selectionWeight = val2.selectionWeight
					});
				}
				dccs.categories[i].cards = list.ToArray();
			}
		}

		private void RemoveAphelianChest()
		{
			//IL_0013: Unknown result type (might be due to invalid IL or missing references)
			//IL_0018: Unknown result type (might be due to invalid IL or missing references)
			//IL_0019: Unknown result type (might be due to invalid IL or missing references)
			//IL_0031: Unknown result type (might be due to invalid IL or missing references)
			for (int i = 0; i < aphelianInteractables.categories.Length; i++)
			{
				Category val = aphelianInteractables.categories[i];
				if (!(val.name == "Chests"))
				{
					continue;
				}
				List<DirectorCard> list = new List<DirectorCard>();
				DirectorCard[] cards = val.cards;
				foreach (DirectorCard val2 in cards)
				{
					if (((Object)val2.spawnCard).name != "iscLunarChest")
					{
						list.Add(val2);
					}
				}
				aphelianInteractables.categories[i].cards = list.ToArray();
			}
		}

		private void AcresBarrelIncrease()
		{
			//IL_0010: Unknown result type (might be due to invalid IL or missing references)
			//IL_0015: Unknown result type (might be due to invalid IL or missing references)
			//IL_0016: Unknown result type (might be due to invalid IL or missing references)
			for (int i = 0; i < acresInteractables.categories.Length; i++)
			{
				Category val = acresInteractables.categories[i];
				if (val.name == "Barrels")
				{
					val.selectionWeight *= 1.2f;
				}
			}
		}

		private void PoolsBarrelDecrease()
		{
			//IL_0010: Unknown result type (might be due to invalid IL or missing references)
			//IL_0015: Unknown result type (might be due to invalid IL or missing references)
			//IL_0016: Unknown result type (might be due to invalid IL or missing references)
			for (int i = 0; i < poolsInteractables.categories.Length; i++)
			{
				Category val = poolsInteractables.categories[i];
				if (val.name == "Barrels")
				{
					val.selectionWeight *= 0.6f;
				}
			}
		}

		private void RPDDroneDecrease()
		{
			//IL_0010: Unknown result type (might be due to invalid IL or missing references)
			//IL_0015: Unknown result type (might be due to invalid IL or missing references)
			//IL_0016: Unknown result type (might be due to invalid IL or missing references)
			for (int i = 0; i < rpdInteractables.categories.Length; i++)
			{
				Category val = rpdInteractables.categories[i];
				if (val.name == "Drones")
				{
					val.selectionWeight /= 2f;
				}
			}
		}

		private void SirensDroneShrineDecrease()
		{
			//IL_0010: Unknown result type (might be due to invalid IL or missing references)
			//IL_0015: Unknown result type (might be due to invalid IL or missing references)
			//IL_0016: 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)
			for (int i = 0; i < sirensInteractables.categories.Length; i++)
			{
				Category val = sirensInteractables.categories[i];
				if (val.name == "Drones" || val.name == "Shrines")
				{
					val.selectionWeight /= 2f;
				}
			}
		}

		private void BalanceSirenGrove()
		{
			//IL_0013: Unknown result type (might be due to invalid IL or missing references)
			//IL_0018: Unknown result type (might be due to invalid IL or missing references)
			//IL_0019: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Unknown result type (might be due to invalid IL or missing references)
			//IL_010e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0113: Unknown result type (might be due to invalid IL or missing references)
			//IL_0115: Unknown result type (might be due to invalid IL or missing references)
			//IL_012b: Unknown result type (might be due to invalid IL or missing references)
			for (int i = 0; i < sirensInteractables.categories.Length; i++)
			{
				Category val = sirensInteractables.categories[i];
				if (!(val.name == "Chests"))
				{
					continue;
				}
				DirectorCard[] cards = val.cards;
				foreach (DirectorCard val2 in cards)
				{
					if (((Object)val2.spawnCard).name == "iscChest1" || ((Object)val2.spawnCard).name == "iscChest2")
					{
						val2.selectionWeight -= (int)Math.Round((double)val2.selectionWeight * 0.1);
					}
					if (((Object)val2.spawnCard).name == "iscTripleShopLarge")
					{
						val2.selectionWeight += (int)Math.Round((double)val2.selectionWeight * 0.2);
					}
				}
			}
			for (int k = 0; k < groveInteractables.categories.Length; k++)
			{
				Category val3 = groveInteractables.categories[k];
				if (!(val3.name == "Chests"))
				{
					continue;
				}
				DirectorCard[] cards = val3.cards;
				foreach (DirectorCard val4 in cards)
				{
					if (((Object)val4.spawnCard).name == "iscChest1" || ((Object)val4.spawnCard).name == "iscChest2")
					{
						val4.selectionWeight -= (int)Math.Round((double)val4.selectionWeight * 0.1);
					}
					if (((Object)val4.spawnCard).name == "iscCasinoChest")
					{
						val4.selectionWeight += (int)Math.Round((double)val4.selectionWeight * 0.3);
					}
				}
			}
		}
	}
}