Decompiled source of StageVariety v1.1.0

plugins/StagePermutations.dll

Decompiled a week ago
using System;
using System.Collections;
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 HG;
using HG.Reflection;
using Microsoft.CodeAnalysis;
using On.RoR2;
using RoR2;
using RoR2.Navigation;
using UnityEngine;
using UnityEngine.AddressableAssets;
using UnityEngine.Networking;
using UnityEngine.ResourceManagement.AsyncOperations;
using UnityEngine.SceneManagement;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: OptIn]
[assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")]
[assembly: AssemblyCompany("StagePermutations")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0+0302f7c5aebc79c28969574a684563fff96970f0")]
[assembly: AssemblyProduct("StagePermutations")]
[assembly: AssemblyTitle("StagePermutations")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.0.0")]
[module: RefSafetyRules(11)]
[module: UnverifiableCode]
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 StagePermutations
{
	public class DisableOcclusionNearby : MonoBehaviour
	{
		public List<CameraRigController> cameraRigControllers = new List<CameraRigController>();

		public HashSet<CameraRigController> affectedCameraRigControllers = new HashSet<CameraRigController>();

		public float radius;

		public void OnEnable()
		{
			foreach (CameraRigController readOnlyInstances in CameraRigController.readOnlyInstancesList)
			{
				OnCameraEnableGlobal(readOnlyInstances);
			}
			CameraRigController.onCameraEnableGlobal += OnCameraEnableGlobal;
			CameraRigController.onCameraDisableGlobal += OnCameraDisableGlobal;
		}

		public void OnDisable()
		{
			CameraRigController.onCameraEnableGlobal -= OnCameraEnableGlobal;
			CameraRigController.onCameraDisableGlobal -= OnCameraDisableGlobal;
			cameraRigControllers.Clear();
			affectedCameraRigControllers.Clear();
		}

		public void Update()
		{
			//IL_001f: Unknown result type (might be due to invalid IL or missing references)
			//IL_002a: Unknown result type (might be due to invalid IL or missing references)
			//IL_002f: 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)
			foreach (CameraRigController cameraRigController in cameraRigControllers)
			{
				Vector3 val = ((Component)cameraRigController).transform.position - ((Component)this).transform.position;
				if (((Vector3)(ref val)).sqrMagnitude <= radius * radius)
				{
					if (affectedCameraRigControllers.Add(cameraRigController) && Object.op_Implicit((Object)(object)cameraRigController.sceneCam))
					{
						cameraRigController.sceneCam.useOcclusionCulling = false;
					}
				}
				else if (affectedCameraRigControllers.Remove(cameraRigController) && Object.op_Implicit((Object)(object)cameraRigController.sceneCam))
				{
					cameraRigController.sceneCam.useOcclusionCulling = true;
				}
			}
		}

		private void OnCameraEnableGlobal(CameraRigController cameraRigController)
		{
			if (Object.op_Implicit((Object)(object)cameraRigController.sceneCam) && cameraRigController.sceneCam.useOcclusionCulling)
			{
				cameraRigControllers.Add(cameraRigController);
			}
		}

		private void OnCameraDisableGlobal(CameraRigController cameraRigController)
		{
			cameraRigControllers.Remove(cameraRigController);
		}
	}
	public abstract class PermutationBehaviour
	{
		public virtual SceneObjectToggleGroup FindToggleGroupController(Scene scene, IDictionary<string, GameObject> rootObjects)
		{
			if (rootObjects.TryGetValue("SceneInfo", out var value))
			{
				Transform val = value.transform.Find("ToggleGroupController");
				if (Object.op_Implicit((Object)(object)val))
				{
					return ((Component)val).GetComponent<SceneObjectToggleGroup>();
				}
			}
			return null;
		}

		public abstract void Apply(Scene scene, IDictionary<string, GameObject> rootObjects, SceneObjectToggleGroup toggleGroupController);

		protected static void Addressable<TObject>(object key, out TObject asset)
		{
			//IL_0002: 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)
			asset = Addressables.LoadAssetAsync<TObject>(key).WaitForCompletion();
		}

		protected static TObject Addressable<TObject>(object key)
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			return Addressables.LoadAssetAsync<TObject>(key).WaitForCompletion();
		}

		protected static void AssignNodesToGate(NodeGraph nodeGraph, List<NodeIndex> nodes, string gateName)
		{
			//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_001f: 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)
			//IL_0040: Unknown result type (might be due to invalid IL or missing references)
			//IL_0045: Unknown result type (might be due to invalid IL or missing references)
			//IL_004d: Unknown result type (might be due to invalid IL or missing references)
			byte gateIndex = nodeGraph.RegisterGateName(gateName);
			foreach (NodeIndex node in nodes)
			{
				nodeGraph.nodes[node.nodeIndex].gateIndex = gateIndex;
				LinkIndex[] activeNodeLinks = nodeGraph.GetActiveNodeLinks(node);
				foreach (LinkIndex val in activeNodeLinks)
				{
					nodeGraph.links[val.linkIndex].gateIndex = gateIndex;
				}
			}
		}

		protected static void EnsureNodesInBounds(NodeGraph nodeGraph, List<NodeIndex> nodes, Bounds bounds)
		{
			//IL_000e: 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)
			Vector3 val = default(Vector3);
			for (int num = nodes.Count - 1; num >= 0; num--)
			{
				if (!nodeGraph.GetNodePosition(nodes[num], ref val) || !((Bounds)(ref bounds)).Contains(val))
				{
					nodes.RemoveAt(num);
				}
			}
		}
	}
	internal static class Prefab
	{
		private static readonly Transform _prefabParent;

		static Prefab()
		{
			//IL_0005: 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_0048: Expected O, but got Unknown
			_prefabParent = new GameObject("groovesalad.StageVariety_Prefabs").transform;
			((Component)_prefabParent).gameObject.SetActive(false);
			Object.DontDestroyOnLoad((Object)(object)((Component)_prefabParent).gameObject);
			Util.IsPrefab += (hook_IsPrefab)((orig_IsPrefab orig, GameObject gameObject) => orig.Invoke(gameObject) || (Object)(object)gameObject.transform.parent == (Object)(object)_prefabParent);
		}

		public static GameObject Create(string name)
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			//IL_0017: Expected O, but got Unknown
			GameObject val = new GameObject(name);
			val.transform.SetParent(_prefabParent);
			return val;
		}

		public static GameObject Create(string name, params Type[] components)
		{
			//IL_0002: 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_0018: Expected O, but got Unknown
			GameObject val = new GameObject(name, components);
			val.transform.SetParent(_prefabParent);
			return val;
		}

		public static GameObject Clone(GameObject original, string name)
		{
			GameObject obj = Object.Instantiate<GameObject>(original, _prefabParent);
			((Object)obj).name = name;
			NetworkIdentity val = default(NetworkIdentity);
			if (obj.TryGetComponent<NetworkIdentity>(ref val))
			{
				((NetworkHash128)(ref val.m_AssetId)).Reset();
			}
			return obj;
		}
	}
	public class RegisterPermutationAttribute : SearchableAttribute
	{
		public string targetSceneName;

		public string configSection;

		public string name;

		public string description;

		public RegisterPermutationAttribute(string targetSceneName, string configSection, string name)
		{
			this.targetSceneName = targetSceneName;
			this.configSection = configSection;
			this.name = name;
		}
	}
	public class SetSceneObjectsActive : MonoBehaviour
	{
		public List<GameObject> objectsToActivate = new List<GameObject>();

		public List<GameObject> objectsToDeactivate = new List<GameObject>();

		public void OnEnable()
		{
			foreach (GameObject item in objectsToActivate)
			{
				if (Object.op_Implicit((Object)(object)item))
				{
					item.SetActive(true);
				}
			}
			foreach (GameObject item2 in objectsToDeactivate)
			{
				if (Object.op_Implicit((Object)(object)item2))
				{
					item2.SetActive(false);
				}
			}
		}
	}
	public static class SharedExtensions
	{
		[MethodImpl(MethodImplOptions.AggressiveInlining)]
		public static bool TryFind(this Transform transform, string n, out Transform child)
		{
			return Object.op_Implicit((Object)(object)(child = transform.Find(n)));
		}

		[MethodImpl(MethodImplOptions.AggressiveInlining)]
		public static GameObject FindGameObject(this Transform transform, string n)
		{
			Transform val = transform.Find(n);
			if (!Object.op_Implicit((Object)(object)val))
			{
				return null;
			}
			return ((Component)val).gameObject;
		}

		public static IEnumerable<Transform> AllChildren(this Transform transform)
		{
			for (int i = 0; i < transform.childCount; i++)
			{
				yield return transform.GetChild(i);
			}
		}

		[MethodImpl(MethodImplOptions.AggressiveInlining)]
		public static void AddComponent<T>(this GameObject gameObject, out T component) where T : Component
		{
			component = gameObject.AddComponent<T>();
		}
	}
	[BepInPlugin("groovesalad.StageVariety", "StageVariety", "1.1.0")]
	public class StagePermutationsPlugin : BaseUnityPlugin
	{
		public interface IAsyncInit
		{
			IEnumerator Init();
		}

		public const string GUID = "groovesalad.StageVariety";

		public const string NAME = "StageVariety";

		public const string VERSION = "1.1.0";

		public ILookup<string, PermutationBehaviour> permutationsLookup;

		public static Dictionary<PermutationBehaviour, RegisterPermutationAttribute> Permutations { get; private set; }

		public void Awake()
		{
			List<RegisterPermutationAttribute> list = new List<RegisterPermutationAttribute>();
			SearchableAttribute.GetInstances<RegisterPermutationAttribute>(list);
			Permutations = list.Where(delegate(RegisterPermutationAttribute x)
			{
				//IL_0034: Unknown result type (might be due to invalid IL or missing references)
				//IL_003e: Expected I4, but got O
				//IL_003e: Expected O, but got I4
				//IL_0039->IL0039: Incompatible stack types: I4 vs O
				//IL_0039->IL0039: Incompatible stack types: O vs I4
				//IL_0028->IL0039: Incompatible stack types: I4 vs O
				//IL_0028->IL0039: Incompatible stack types: O vs I4
				object obj = ((BaseUnityPlugin)this).Config;
				object obj2 = x.configSection;
				string text = "Enable " + x.name;
				int num = 1;
				if (x.description != null)
				{
					obj = (object)new ConfigDescription(x.description, (AcceptableValueBase)null, Array.Empty<object>());
					obj2 = num;
					num = (int)obj2;
				}
				else
				{
					obj = null;
					obj2 = num;
					num = (int)obj2;
				}
				return ((ConfigFile)obj).Bind<bool>((string)num, text, (byte)(int)obj2 != 0, (ConfigDescription)obj).Value;
			}).ToDictionary((RegisterPermutationAttribute x) => (PermutationBehaviour)Activator.CreateInstance((Type)((SearchableAttribute)x).target));
			permutationsLookup = Permutations.ToLookup((KeyValuePair<PermutationBehaviour, RegisterPermutationAttribute> x) => x.Value.targetSceneName, (KeyValuePair<PermutationBehaviour, RegisterPermutationAttribute> x) => x.Key);
			SceneManager.sceneLoaded += OnSceneLoaded;
		}

		private void OnSceneLoaded(Scene newScene, LoadSceneMode loadSceneMode)
		{
			//IL_0064: Unknown result type (might be due to invalid IL or missing references)
			//IL_006d: Unknown result type (might be due to invalid IL or missing references)
			if (!permutationsLookup.Contains(((Scene)(ref newScene)).name))
			{
				return;
			}
			Dictionary<string, GameObject> dictionary = new Dictionary<string, GameObject>();
			GameObject[] rootGameObjects = ((Scene)(ref newScene)).GetRootGameObjects();
			foreach (GameObject val in rootGameObjects)
			{
				dictionary[((Object)val).name] = val;
			}
			foreach (PermutationBehaviour item in permutationsLookup[((Scene)(ref newScene)).name])
			{
				item.Apply(toggleGroupController: item.FindToggleGroupController(newScene, dictionary), scene: newScene, rootObjects: dictionary);
			}
		}

		[SystemInitializer(new Type[] { })]
		private static IEnumerator Init()
		{
			List<IEnumerator> initAsyncCoroutines = (from x in Permutations.Keys.OfType<IAsyncInit>()
				select SafeCoroutineWrapper(x.Init())).ToList();
			while (initAsyncCoroutines.Count > 0)
			{
				for (int i = initAsyncCoroutines.Count - 1; i >= 0; i--)
				{
					IEnumerator enumerator = initAsyncCoroutines[i];
					if (enumerator.MoveNext())
					{
						yield return enumerator.Current;
					}
					else
					{
						initAsyncCoroutines.RemoveAt(i);
					}
				}
			}
			static IEnumerator SafeCoroutineWrapper(IEnumerator coroutine)
			{
				while (coroutine.MoveNext())
				{
					object current = coroutine.Current;
					if (!(current is IEnumerator inner))
					{
						AsyncOperation asyncOperation = (AsyncOperation)((current is AsyncOperation) ? current : null);
						if (asyncOperation != null)
						{
							while (!asyncOperation.isDone)
							{
								yield return null;
							}
						}
						else
						{
							yield return coroutine.Current;
						}
					}
					else
					{
						while (inner.MoveNext())
						{
							yield return inner.Current;
						}
					}
				}
			}
		}
	}
}
namespace StagePermutations.wispgraveyard
{
	[RegisterPermutation("wispgraveyard", "Scorched Acres", "Lower Staircase Variation", description = "A lower staircase walkway on the top Scorched Acres platform will sometimes not appear")]
	public class LowerStaircase : PermutationBehaviour, StagePermutationsPlugin.IAsyncInit
	{
		private const string GATE_NAME = "LowerSpiralStaircase";

		public IEnumerator Init()
		{
			AsyncOperationHandle<NodeGraph> wispgraveyardGroundNodesNodegraph = Addressables.LoadAssetAsync<NodeGraph>((object)"RoR2/Base/wispgraveyard/wispgraveyardGroundNodesNodegraph.asset");
			AsyncOperationHandle<NodeGraph> wispgraveyardAirNodesNodegraph = Addressables.LoadAssetAsync<NodeGraph>((object)"RoR2/Base/wispgraveyard/wispgraveyardAirNodesNodegraph.asset");
			List<NodeIndex> dest = new List<NodeIndex>();
			Bounds[] array = new Bounds[2];
			Bounds val = default(Bounds);
			((Bounds)(ref val)).min = new Vector3(-91f, 42f, 186f);
			((Bounds)(ref val)).max = new Vector3(-63f, 75f, 261f);
			array[0] = val;
			val = default(Bounds);
			((Bounds)(ref val)).min = new Vector3(126f, 31f, 190f);
			((Bounds)(ref val)).max = new Vector3(158f, 75f, 291f);
			array[1] = val;
			Bounds[] array2 = (Bounds[])(object)array;
			Bounds val2 = default(Bounds);
			((Bounds)(ref val2)).min = new Vector3(-128f, 10f, 208f);
			((Bounds)(ref val2)).max = new Vector3(158f, 46f, 340f);
			val = val2;
			Bounds[] array3 = array2;
			int num = 0;
			Bounds[] array4 = (Bounds[])(object)new Bounds[1 + array3.Length];
			array4[num] = val;
			num++;
			ReadOnlySpan<Bounds> readOnlySpan = new ReadOnlySpan<Bounds>(array3);
			readOnlySpan.CopyTo(new Span<Bounds>(array4).Slice(num, readOnlySpan.Length));
			_ = num + readOnlySpan.Length;
			Bounds[] groundBounds = array4;
			val2 = default(Bounds);
			((Bounds)(ref val2)).min = new Vector3(-128f, 20f, 208f);
			((Bounds)(ref val2)).max = new Vector3(158f, 56f, 340f);
			val = val2;
			array4 = array2;
			num = 0;
			array3 = (Bounds[])(object)new Bounds[1 + array4.Length];
			array3[num] = val;
			num++;
			readOnlySpan = new ReadOnlySpan<Bounds>(array4);
			readOnlySpan.CopyTo(new Span<Bounds>(array3).Slice(num, readOnlySpan.Length));
			_ = num + readOnlySpan.Length;
			Bounds[] airBounds = array3;
			yield return wispgraveyardGroundNodesNodegraph;
			NodeGraph result = wispgraveyardGroundNodesNodegraph.Result;
			array3 = groundBounds;
			for (num = 0; num < array3.Length; num++)
			{
				Bounds bounds = array3[num];
				result.blockMap.GetItemsInBounds(ref bounds, dest);
				PermutationBehaviour.EnsureNodesInBounds(result, dest, bounds);
				PermutationBehaviour.AssignNodesToGate(result, dest, "LowerSpiralStaircase");
				dest.Clear();
			}
			yield return wispgraveyardAirNodesNodegraph;
			NodeGraph result2 = wispgraveyardAirNodesNodegraph.Result;
			array3 = airBounds;
			for (num = 0; num < array3.Length; num++)
			{
				Bounds bounds2 = array3[num];
				result2.blockMap.GetItemsInBounds(ref bounds2, dest);
				PermutationBehaviour.EnsureNodesInBounds(result2, dest, bounds2);
				PermutationBehaviour.AssignNodesToGate(result2, dest, "LowerSpiralStaircase");
				dest.Clear();
			}
		}

		public override void Apply(Scene scene, IDictionary<string, GameObject> rootObjects, SceneObjectToggleGroup toggleGroupController)
		{
			//IL_003b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0041: Expected O, but got Unknown
			//IL_0056: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ea: 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_0234: 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_0286: Unknown result type (might be due to invalid IL or missing references)
			//IL_02a4: Unknown result type (might be due to invalid IL or missing references)
			//IL_02d8: Unknown result type (might be due to invalid IL or missing references)
			//IL_02f6: Unknown result type (might be due to invalid IL or missing references)
			//IL_0305: Unknown result type (might be due to invalid IL or missing references)
			//IL_030a: Unknown result type (might be due to invalid IL or missing references)
			//IL_031b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0330: Unknown result type (might be due to invalid IL or missing references)
			//IL_0351: Unknown result type (might be due to invalid IL or missing references)
			if (!rootObjects.TryGetValue("ENTIRE SCENE HOLDER", out var value) || !value.transform.TryFind("HOLDER: Temple Pieces", out var child))
			{
				return;
			}
			Transform child2 = child.GetChild(3);
			if (Object.op_Implicit((Object)(object)child2))
			{
				GameObject val = new GameObject("FSGiantRuinFrameCollisionDisabled");
				val.transform.position = new Vector3(12f, 61f, 230f);
				val.AddComponent<GateStateSetter>().gateToDisableWhenEnabled = "LowerSpiralStaircase";
				val.SetActive(false);
				val.AddComponent<SetSceneObjectsActive>(out SetSceneObjectsActive component);
				component.objectsToDeactivate.Add(child2.FindGameObject("WPPlatform2SpiralStairsCW"));
				component.objectsToDeactivate.Add(child2.FindGameObject("WPPlatform2SpiralStairsCCW"));
				component.objectsToDeactivate.Add(child2.FindGameObject("WPPlanter1Long (4)"));
				component.objectsToDeactivate.Add(child2.FindGameObject("WPPlanter1Long (3)"));
				component.objectsToDeactivate.Add(child2.FindGameObject("WPPlanter1KnockedOver"));
				component.objectsToDeactivate.Add(child2.FindGameObject("WPPlanter1LongKnockedOver"));
				component.objectsToDeactivate.Add(child2.FindGameObject("WPPlanter1WithBonsaiTree (9)"));
				Transform val2 = (from Transform x in (IEnumerable)child2
					where ((Object)x).name == "WPPlatform2BarrierHigh"
					select x).ElementAtOrDefault(2);
				if (Object.op_Implicit((Object)(object)val2))
				{
					component.objectsToDeactivate.Add(((Component)val2).gameObject);
				}
				Transform val3 = (from Transform x in (IEnumerable)child2
					where ((Object)x).name == "WPPlatform2BarrierHigh (1)"
					select x).ElementAtOrDefault(2);
				if (Object.op_Implicit((Object)(object)val3))
				{
					component.objectsToDeactivate.Add(((Component)val3).gameObject);
				}
				PermutationBehaviour.Addressable<GameObject>("RoR2/Base/wispgraveyard/WPPlatform2BarrierHigh.prefab", out var asset);
				GameObject obj = Object.Instantiate<GameObject>(asset, val.transform);
				obj.transform.localPosition = new Vector3(-8.7f, -36.5f, -11f);
				obj.transform.localEulerAngles = new Vector3(270f, 267f, 0f);
				GameObject obj2 = Object.Instantiate<GameObject>(asset, val.transform);
				obj2.transform.localPosition = new Vector3(-8f, -36.5f, -5f);
				obj2.transform.localEulerAngles = new Vector3(270f, 280f, 0f);
				GameObject obj3 = Object.Instantiate<GameObject>(PermutationBehaviour.Addressable<GameObject>("RoR2/Base/wispgraveyard/WPPlanter1WithBonsaiTree.prefab"), val.transform);
				obj3.transform.localPosition = new Vector3(-75f, -14.4f, -26f);
				obj3.transform.localEulerAngles = new Vector3(0f, 200f, 0f);
				GameObject obj4 = Object.Instantiate<GameObject>(PermutationBehaviour.Addressable<GameObject>("RoR2/Base/wispgraveyard/WPPlanter1LongKnockedOver.prefab"), val.transform);
				obj4.transform.localPosition = new Vector3(-76f, -14.9f, -32f);
				obj4.transform.localEulerAngles = new Vector3(0f, 25f, 0f);
				GameObject val4 = new GameObject("DisableOcclusionCulling");
				val4.transform.SetParent(val.transform);
				val4.transform.localPosition = new Vector3(0f, 0f, 0f);
				val4.AddComponent<DisableOcclusionNearby>().radius = 120f;
				ref GameObjectToggleGroup[] toggleGroups = ref toggleGroupController.toggleGroups;
				GameObjectToggleGroup val5 = new GameObjectToggleGroup
				{
					objects = (GameObject[])(object)new GameObject[1] { val },
					minEnabled = 0,
					maxEnabled = 1
				};
				ArrayUtils.ArrayAppend<GameObjectToggleGroup>(ref toggleGroups, ref val5);
			}
		}
	}
}
namespace StagePermutations.village
{
	[RegisterPermutation("village", "Shattered Abodes", "Arch Paths Variation", description = "A set of smaller temple arches will sometimes appear")]
	public class ArchPaths : PermutationBehaviour
	{
		public override void Apply(Scene scene, IDictionary<string, GameObject> rootObjects, SceneObjectToggleGroup toggleGroupController)
		{
			//IL_0032: Unknown result type (might be due to invalid IL or missing references)
			if (rootObjects.TryGetValue("TOGGLE: ArchPaths", out var value))
			{
				Transform val = value.transform.Find("LVArc_ArchToggle");
				if (Object.op_Implicit((Object)(object)val))
				{
					ref GameObjectToggleGroup[] toggleGroups = ref toggleGroupController.toggleGroups;
					GameObjectToggleGroup val2 = new GameObjectToggleGroup
					{
						objects = (GameObject[])(object)new GameObject[1] { ((Component)val).gameObject },
						minEnabled = 0,
						maxEnabled = 1
					};
					ArrayUtils.ArrayAppend<GameObjectToggleGroup>(ref toggleGroups, ref val2);
				}
			}
		}
	}
}
namespace StagePermutations.villagenight
{
	[RegisterPermutation("villagenight", "Disturbed Impact", "Arch Paths Variation", description = "A set of smaller temple arches will sometimes appear")]
	public class ArchPaths : PermutationBehaviour
	{
		public override void Apply(Scene scene, IDictionary<string, GameObject> rootObjects, SceneObjectToggleGroup toggleGroupController)
		{
			//IL_0055: 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_0085: Unknown result type (might be due to invalid IL or missing references)
			//IL_0099: 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)
			Transform LVArc_ArchToggle;
			GameObject LVNBrazierNoChain;
			if (rootObjects.TryGetValue("TOGGLE: ArchPaths", out var value))
			{
				LVArc_ArchToggle = value.transform.Find("LVArc_ArchToggle");
				if (Object.op_Implicit((Object)(object)LVArc_ArchToggle))
				{
					PermutationBehaviour.Addressable<GameObject>("RoR2/DLC2/villagenight/Assets/LVNBrazierNoChain.prefab", out LVNBrazierNoChain);
					InstantiateBrazier(new Vector3(148.8f, 23.4f, -51.5f), Quaternion.Euler(0f, 5f, 6f));
					InstantiateBrazier(new Vector3(118.3f, 11.2f, -64.7f), Quaternion.Euler(0f, 0f, 6f));
					ref GameObjectToggleGroup[] toggleGroups = ref toggleGroupController.toggleGroups;
					GameObjectToggleGroup val = new GameObjectToggleGroup
					{
						objects = (GameObject[])(object)new GameObject[1] { ((Component)LVArc_ArchToggle).gameObject },
						minEnabled = 0,
						maxEnabled = 1
					};
					ArrayUtils.ArrayAppend<GameObjectToggleGroup>(ref toggleGroups, ref val);
				}
			}
			GameObject InstantiateBrazier(Vector3 position, Quaternion rotation)
			{
				//IL_0006: 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_0038: Unknown result type (might be due to invalid IL or missing references)
				GameObject obj = Object.Instantiate<GameObject>(LVNBrazierNoChain, position, rotation, LVArc_ArchToggle);
				obj.layer = LayerIndex.world.intVal;
				obj.transform.localScale = new Vector3(1.5f, 2f, 1.5f);
				return obj;
			}
		}
	}
}
namespace StagePermutations.skymeadow
{
	[RegisterPermutation("skymeadow", "Sky Meadow", "Mauling Rocks Direction Variation", description = "The mauling rocks on Sky Meadow will sometimes fly the opposite direction")]
	public class MaulingRocks : PermutationBehaviour
	{
		public override void Apply(Scene scene, IDictionary<string, GameObject> rootObjects, SceneObjectToggleGroup toggleGroupController)
		{
			//IL_008d: Unknown result type (might be due to invalid IL or missing references)
			if (rootObjects.TryGetValue("HOLDER: Mauling Rocks", out var value))
			{
				GameObject val = Object.Instantiate<GameObject>(value);
				val.SetActive(false);
				MaulingRockZoneManager[] componentsInChildren = val.GetComponentsInChildren<MaulingRockZoneManager>();
				for (int i = 0; i < componentsInChildren.Length; i++)
				{
					MaulingRockZoneManager val3;
					MaulingRockZoneManager val2;
					MaulingRockZoneManager obj = (val3 = (val2 = componentsInChildren[i]));
					Transform endZonePoint = obj.endZonePoint1;
					Transform startZonePoint = obj.startZonePoint1;
					val2.startZonePoint1 = endZonePoint;
					val3.endZonePoint1 = startZonePoint;
					val3 = obj;
					val2 = obj;
					startZonePoint = obj.endZonePoint2;
					endZonePoint = obj.startZonePoint2;
					val3.startZonePoint2 = startZonePoint;
					val2.endZonePoint2 = endZonePoint;
				}
				ref GameObjectToggleGroup[] toggleGroups = ref toggleGroupController.toggleGroups;
				GameObjectToggleGroup val4 = new GameObjectToggleGroup
				{
					objects = (GameObject[])(object)new GameObject[2] { value, val },
					minEnabled = 1,
					maxEnabled = 1
				};
				ArrayUtils.ArrayAppend<GameObjectToggleGroup>(ref toggleGroups, ref val4);
			}
		}
	}
}
namespace StagePermutations.shipgraveyard
{
	[RegisterPermutation("shipgraveyard", "Siren`s Call", "New Donut Ship", description = "A new crashed ship will sometimes appear in the middle of Siren`s Call")]
	public class NewTorusShip : PermutationBehaviour, StagePermutationsPlugin.IAsyncInit
	{
		private const string GATE_NAME = "BlockedByTorusShip";

		public IEnumerator Init()
		{
			AsyncOperationHandle<NodeGraph> shipgraveyardGroundNodeNodegraph = Addressables.LoadAssetAsync<NodeGraph>((object)"RoR2/Base/shipgraveyard/shipgraveyardGroundNodeNodegraph.asset");
			AsyncOperationHandle<NodeGraph> shipgraveyardAirNodeNodegraph = Addressables.LoadAssetAsync<NodeGraph>((object)"RoR2/Base/shipgraveyard/shipgraveyardAirNodeNodegraph.asset");
			List<NodeIndex> dest = new List<NodeIndex>();
			yield return shipgraveyardGroundNodeNodegraph;
			NodeGraph result = shipgraveyardGroundNodeNodegraph.Result;
			result.blockMap.GetItemsInSphere(new Vector3(-15f, 3f, 14f), 10f, dest);
			PermutationBehaviour.AssignNodesToGate(result, dest, "BlockedByTorusShip");
			dest.Clear();
			yield return shipgraveyardAirNodeNodegraph;
			NodeGraph result2 = shipgraveyardAirNodeNodegraph.Result;
			result2.blockMap.GetItemsInSphere(new Vector3(-15f, 15f, 11f), 15f, dest);
			result2.blockMap.GetItemsInSphere(new Vector3(18f, 15f, 59f), 15f, dest);
			PermutationBehaviour.AssignNodesToGate(result2, dest, "BlockedByTorusShip");
		}

		public override void Apply(Scene scene, IDictionary<string, GameObject> rootObjects, SceneObjectToggleGroup toggleGroupController)
		{
			//IL_003c: 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_00b0: Unknown result type (might be due to invalid IL or missing references)
			GameObject val = Object.Instantiate<GameObject>(PermutationBehaviour.Addressable<GameObject>("RoR2/Base/shipgraveyard/TorusShip Round.prefab"));
			val.AddComponent<GateStateSetter>().gateToDisableWhenEnabled = "BlockedByTorusShip";
			val.SetActive(false);
			val.transform.localPosition = new Vector3(2f, 5f, 41f);
			val.transform.localEulerAngles = new Vector3(340f, 300f, 230f);
			if (rootObjects.TryGetValue("HOLDER: Environment", out var value) && value.transform.TryFind("HOLDER: Main Rocks", out var child))
			{
				val.AddComponent<SetSceneObjectsActive>(out SetSceneObjectsActive component);
				component.objectsToDeactivate.Add(((Component)child.GetChild(27)).gameObject);
			}
			ref GameObjectToggleGroup[] toggleGroups = ref toggleGroupController.toggleGroups;
			GameObjectToggleGroup val2 = new GameObjectToggleGroup
			{
				objects = (GameObject[])(object)new GameObject[1] { val },
				minEnabled = 0,
				maxEnabled = 1
			};
			ArrayUtils.ArrayAppend<GameObjectToggleGroup>(ref toggleGroups, ref val2);
		}
	}
	[RegisterPermutation("shipgraveyard", "Siren`s Call", "Crashed Ship Middle Section Variation", description = "The middle section of the long rectangular crashed ship on Siren`s Call will sometimes appear in a different orientation")]
	public class RectShipMid : PermutationBehaviour, StagePermutationsPlugin.IAsyncInit
	{
		private const string GATE_NAME = "RectShipMid";

		public IEnumerator Init()
		{
			AsyncOperationHandle<NodeGraph> shipgraveyardGroundNodeNodegraph = Addressables.LoadAssetAsync<NodeGraph>((object)"RoR2/Base/shipgraveyard/shipgraveyardGroundNodeNodegraph.asset");
			AsyncOperationHandle<NodeGraph> shipgraveyardAirNodeNodegraph = Addressables.LoadAssetAsync<NodeGraph>((object)"RoR2/Base/shipgraveyard/shipgraveyardAirNodeNodegraph.asset");
			List<NodeIndex> dest = new List<NodeIndex>();
			Bounds bounds = new Bounds(new Vector3(-3.5f, 39f, 71f), new Vector3(25f, 30f, 41f));
			yield return shipgraveyardGroundNodeNodegraph;
			NodeGraph result = shipgraveyardGroundNodeNodegraph.Result;
			result.blockMap.GetItemsInBounds(ref bounds, dest);
			PermutationBehaviour.AssignNodesToGate(result, dest, "RectShipMid");
			dest.Clear();
			yield return shipgraveyardAirNodeNodegraph;
			NodeGraph result2 = shipgraveyardAirNodeNodegraph.Result;
			result2.blockMap.GetItemsInBounds(ref bounds, dest);
			PermutationBehaviour.EnsureNodesInBounds(result2, dest, bounds);
			PermutationBehaviour.AssignNodesToGate(result2, dest, "RectShipMid");
		}

		public override void Apply(Scene scene, IDictionary<string, GameObject> rootObjects, SceneObjectToggleGroup toggleGroupController)
		{
			//IL_0071: Unknown result type (might be due to invalid IL or missing references)
			//IL_0090: Unknown result type (might be due to invalid IL or missing references)
			//IL_0163: Unknown result type (might be due to invalid IL or missing references)
			//IL_011c: Unknown result type (might be due to invalid IL or missing references)
			//IL_013c: Unknown result type (might be due to invalid IL or missing references)
			if (!rootObjects.TryGetValue("HOLDER: Environment", out var value) || !value.transform.TryFind("HOLDER: Ship Chunks/RectShipMid", out var child))
			{
				return;
			}
			GameObject val = Object.Instantiate<GameObject>(PermutationBehaviour.Addressable<GameObject>("RoR2/Base/shipgraveyard/RectShipMid.prefab"));
			val.AddComponent<GateStateSetter>().gateToDisableWhenEnabled = "RectShipMid";
			val.SetActive(false);
			val.AddComponent<DisableOcclusionNearby>().radius = 200f;
			val.transform.localPosition = new Vector3(0f, 47f, 110f);
			val.transform.localEulerAngles = new Vector3(10f, 40f, 0f);
			val.AddComponent<SetSceneObjectsActive>(out SetSceneObjectsActive component);
			if (value.transform.TryFind("HOLDER: Main Spikes", out var child2))
			{
				Transform child3 = child2.GetChild(6);
				if (Object.op_Implicit((Object)(object)child3))
				{
					component.objectsToDeactivate.Add(((Component)child3).gameObject);
				}
				Transform child4 = child2.GetChild(2);
				if (Object.op_Implicit((Object)(object)child4))
				{
					GameObject val2 = Object.Instantiate<GameObject>(((Component)child4).gameObject, child4.parent);
					val2.transform.localPosition = new Vector3(-40f, 10f, 94f);
					val2.transform.localScale = new Vector3(903.583f, 903.586f, 3921.5f);
					val2.SetActive(false);
					component.objectsToActivate.Add(val2);
				}
			}
			ref GameObjectToggleGroup[] toggleGroups = ref toggleGroupController.toggleGroups;
			GameObjectToggleGroup val3 = new GameObjectToggleGroup
			{
				objects = (GameObject[])(object)new GameObject[2]
				{
					((Component)child).gameObject,
					val
				},
				minEnabled = 1,
				maxEnabled = 1
			};
			ArrayUtils.ArrayAppend<GameObjectToggleGroup>(ref toggleGroups, ref val3);
		}
	}
}
namespace StagePermutations.rootjungle
{
	[RegisterPermutation("rootjungle", "Sundered Grove", "Mushroom Platform Variation", description = "A mushroom platform on Sundered Grove will sometimes disappear")]
	public class ShroomShelf : PermutationBehaviour, StagePermutationsPlugin.IAsyncInit
	{
		private const string GATE_NAME = "OnShroomShelf";

		public IEnumerator Init()
		{
			AsyncOperationHandle<NodeGraph> rootjungleGroundNodesNodegraph = Addressables.LoadAssetAsync<NodeGraph>((object)"RoR2/Base/rootjungle/rootjungleGroundNodesNodegraph.asset");
			AsyncOperationHandle<NodeGraph> rootjungleGroundNodesNodegraph2 = Addressables.LoadAssetAsync<NodeGraph>((object)"RoR2/rootjungleGroundNodesNodegraph.asset");
			AsyncOperationHandle<NodeGraph> rootjungleAirNodesNodegraph = Addressables.LoadAssetAsync<NodeGraph>((object)"RoR2/Base/rootjungle/rootjungleAirNodesNodegraph.asset");
			List<NodeIndex> dest = new List<NodeIndex>();
			yield return rootjungleGroundNodesNodegraph;
			ModifyRootjungleGroundNodesNodegraph(rootjungleGroundNodesNodegraph.Result);
			yield return rootjungleGroundNodesNodegraph2;
			ModifyRootjungleGroundNodesNodegraph(rootjungleGroundNodesNodegraph2.Result);
			yield return rootjungleAirNodesNodegraph;
			NodeGraph result = rootjungleAirNodesNodegraph.Result;
			result.blockMap.GetItemsInSphere(new Vector3(63f, 30f, 90f), 30f, dest);
			PermutationBehaviour.AssignNodesToGate(result, dest, "OnShroomShelf");
			void ModifyRootjungleGroundNodesNodegraph(NodeGraph groundNodegraph)
			{
				//IL_0015: Unknown result type (might be due to invalid IL or missing references)
				groundNodegraph.blockMap.GetItemsInSphere(new Vector3(63f, 30f, 90f), 30f, dest);
				PermutationBehaviour.AssignNodesToGate(groundNodegraph, dest, "OnShroomShelf");
				dest.Clear();
			}
		}

		public override SceneObjectToggleGroup FindToggleGroupController(Scene scene, IDictionary<string, GameObject> rootObjects)
		{
			if (rootObjects.TryGetValue("SceneInfo", out var value))
			{
				Transform val = value.transform.Find("SceneObjectToggleGroup");
				if (Object.op_Implicit((Object)(object)val))
				{
					return ((Component)val).GetComponent<SceneObjectToggleGroup>();
				}
			}
			return null;
		}

		public override void Apply(Scene scene, IDictionary<string, GameObject> rootObjects, SceneObjectToggleGroup toggleGroupController)
		{
			//IL_0064: Unknown result type (might be due to invalid IL or missing references)
			//IL_006a: Expected O, but got Unknown
			//IL_0137: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00cc: Expected O, but got Unknown
			//IL_00ce: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ec: Unknown result type (might be due to invalid IL or missing references)
			if (!rootObjects.TryGetValue("HOLDER: Props", out var value) || !value.transform.TryFind("GROUP: Mushrooms", out var child))
			{
				return;
			}
			Transform val = (from Transform x in (IEnumerable)child
				where ((Object)x).name == "RJ_ShroomBig"
				select x).ElementAtOrDefault(1);
			if (!Object.op_Implicit((Object)(object)val))
			{
				return;
			}
			GameObject val2 = new GameObject("RJShroomBigDisabled");
			val2.AddComponent<GateStateSetter>().gateToDisableWhenEnabled = "OnShroomShelf";
			val2.SetActive(false);
			if (rootObjects.TryGetValue("HOLDER: Foliage", out var value2) && value2.transform.TryFind("GROUP: ShroomFoliage", out var child2))
			{
				val2.AddComponent<SetSceneObjectsActive>(out SetSceneObjectsActive component);
				foreach (Transform item in child2)
				{
					Transform val3 = item;
					Vector3 val4 = val3.position - new Vector3(63f, 30f, 90f);
					if (((Vector3)(ref val4)).sqrMagnitude <= 1600f)
					{
						component.objectsToDeactivate.Add(((Component)val3).gameObject);
					}
				}
			}
			ref GameObjectToggleGroup[] toggleGroups = ref toggleGroupController.toggleGroups;
			GameObjectToggleGroup val5 = new GameObjectToggleGroup
			{
				objects = (GameObject[])(object)new GameObject[2]
				{
					((Component)val).gameObject,
					val2
				},
				minEnabled = 1,
				maxEnabled = 1
			};
			ArrayUtils.ArrayAppend<GameObjectToggleGroup>(ref toggleGroups, ref val5);
		}
	}
}
namespace StagePermutations.goolake
{
	[RegisterPermutation("goolake", "Abandoned Aqueduct", "Receded Aqueduct", description = "The main aqueduct on Abandoned Aqueduct will sometimes move towards the wall to make room for a new eel skeleton")]
	public class RecededAqueduct : PermutationBehaviour, StagePermutationsPlugin.IAsyncInit
	{
		private const string GATE_NAME = "BlockedByEel";

		public GameObject goolakeBoulderPrefab;

		public IEnumerator Init()
		{
			AsyncOperationHandle<NodeGraph> goolakeAirNodegraph = Addressables.LoadAssetAsync<NodeGraph>((object)"RoR2/Base/goolake/goolakeAirNodegraph.asset");
			yield return goolakeAirNodegraph;
			NodeGraph result = goolakeAirNodegraph.Result;
			List<NodeIndex> list = new List<NodeIndex>();
			result.blockMap.GetItemsInSphere(new Vector3(151f, -102f, 98f), 10f, list);
			PermutationBehaviour.AssignNodesToGate(result, list, "BlockedByEel");
			result.SetGateState("BlockedByEel", true);
		}

		public override void Apply(Scene scene, IDictionary<string, GameObject> rootObjects, SceneObjectToggleGroup toggleGroupController)
		{
			//IL_0069: 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_009d: 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_0272: Unknown result type (might be due to invalid IL or missing references)
			//IL_0294: Unknown result type (might be due to invalid IL or missing references)
			//IL_02a8: Unknown result type (might be due to invalid IL or missing references)
			//IL_02c6: Unknown result type (might be due to invalid IL or missing references)
			//IL_02da: Unknown result type (might be due to invalid IL or missing references)
			//IL_02f8: Unknown result type (might be due to invalid IL or missing references)
			//IL_030c: Unknown result type (might be due to invalid IL or missing references)
			//IL_032a: Unknown result type (might be due to invalid IL or missing references)
			//IL_033e: Unknown result type (might be due to invalid IL or missing references)
			//IL_035c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0370: Unknown result type (might be due to invalid IL or missing references)
			//IL_038e: Unknown result type (might be due to invalid IL or missing references)
			//IL_03a2: Unknown result type (might be due to invalid IL or missing references)
			//IL_03b8: Unknown result type (might be due to invalid IL or missing references)
			//IL_03c2: Unknown result type (might be due to invalid IL or missing references)
			//IL_03d5: Unknown result type (might be due to invalid IL or missing references)
			//IL_03df: Unknown result type (might be due to invalid IL or missing references)
			//IL_03f2: Unknown result type (might be due to invalid IL or missing references)
			//IL_03fc: Unknown result type (might be due to invalid IL or missing references)
			//IL_040f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0419: Unknown result type (might be due to invalid IL or missing references)
			//IL_043b: Unknown result type (might be due to invalid IL or missing references)
			//IL_044e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0458: Unknown result type (might be due to invalid IL or missing references)
			//IL_046b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0475: Unknown result type (might be due to invalid IL or missing references)
			//IL_0148: Unknown result type (might be due to invalid IL or missing references)
			//IL_0163: Unknown result type (might be due to invalid IL or missing references)
			//IL_016f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0179: 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_01de: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ea: 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_04b6: Unknown result type (might be due to invalid IL or missing references)
			if (!Object.op_Implicit((Object)(object)goolakeBoulderPrefab))
			{
				goolakeBoulderPrefab = PermutationBehaviour.Addressable<GameObject>("RoR2/Base/goolake/GL_BBBoulder.prefab");
			}
			if (rootObjects.TryGetValue("HOLDER: GameplaySpace", out var value) && value.transform.TryFind("mdlGlDam/GL_AqueductPartial", out var child))
			{
				Transform transform = Object.Instantiate<GameObject>(((Component)child).gameObject, child.parent).transform;
				transform.localPosition = new Vector3(-0.89f, 1.2f, -0.53f);
				transform.localEulerAngles = new Vector3(0f, 2f, 0f);
				transform.localScale = new Vector3(1.225f, 1.263564f, 0.9f);
				((Component)transform).gameObject.AddComponent<GateStateSetter>().gateToDisableWhenEnabled = "BlockedByEel";
				((Component)transform).gameObject.SetActive(false);
				((Component)transform).gameObject.AddComponent<SetSceneObjectsActive>(out SetSceneObjectsActive component);
				if (transform.TryFind("GL_Waterfall", out var child2))
				{
					((Component)child2).gameObject.SetActive(false);
				}
				if (rootObjects.TryGetValue("HOLDER: Misc Props", out var value2) && value2.transform.TryFind("Props", out var child3))
				{
					PermutationBehaviour.Addressable<GameObject>("RoR2/Base/goolake/GL_EelSkeleton.prefab", out var asset);
					Transform transform2 = Object.Instantiate<GameObject>(asset, child3).transform;
					transform2.localPosition = new Vector3(19.4f, -27.32f, -78f);
					transform2.localEulerAngles = new Vector3(53f, 78f, 339f);
					transform2.localScale = Vector3.one * 14.4f;
					((Component)transform2).gameObject.SetActive(false);
					component.objectsToActivate.Add(((Component)transform2).gameObject);
					Transform transform3 = Object.Instantiate<GameObject>(asset, child3).transform;
					transform3.localPosition = new Vector3(-79f, -87f, -128f);
					transform3.localEulerAngles = new Vector3(25f, 226f, 173f);
					transform3.localScale = Vector3.one * 9f;
					((Component)transform3).gameObject.SetActive(false);
					component.objectsToActivate.Add(((Component)transform3).gameObject);
				}
				PermutationBehaviour.Addressable<GameObject>("RoR2/Base/goolake/spmGlBamboo1Large.spm", out var asset2);
				PermutationBehaviour.Addressable<GameObject>("RoR2/Base/goolake/spmGlBamboo1.spm", out var asset3);
				PermutationBehaviour.Addressable<GameObject>("RoR2/Base/goolake/spmGlCactusBush1.spm", out var asset4);
				GameObject[] array = (GameObject[])(object)new GameObject[7]
				{
					Object.Instantiate<GameObject>(goolakeBoulderPrefab, new Vector3(171f, -115f, 96f), Quaternion.Euler(340f, 0f, 0f)),
					Object.Instantiate<GameObject>(goolakeBoulderPrefab, new Vector3(155f, -112f, 117f), Quaternion.Euler(340f, 40f, 0f)),
					Object.Instantiate<GameObject>(asset2, new Vector3(163f, -114f, 127f), Quaternion.Euler(5f, 20f, 0f)),
					Object.Instantiate<GameObject>(asset3, new Vector3(169f, -114f, 124f), Quaternion.Euler(0f, 0f, 350f)),
					Object.Instantiate<GameObject>(asset3, new Vector3(180f, -117f, 107f), Quaternion.Euler(5f, 30f, 340f)),
					Object.Instantiate<GameObject>(asset4, new Vector3(177f, -114f, 116f), Quaternion.Euler(0f, 0f, 330f)),
					Object.Instantiate<GameObject>(asset4, new Vector3(180.5f, -116f, 112f), Quaternion.Euler(30f, 80f, 5f))
				};
				array[0].transform.localScale = Vector3.one * 5.5f;
				array[1].transform.localScale = Vector3.one * 2.5f;
				array[2].transform.localScale = Vector3.one * 1.5f;
				array[3].transform.localScale = Vector3.one * 1.5f;
				array[4].transform.localScale = new Vector3(1.2f, 1.6f, 1.2f);
				array[5].transform.localScale = Vector3.one * 1.5f;
				array[6].transform.localScale = Vector3.one * 0.8f;
				GameObject[] array2 = array;
				for (int i = 0; i < array2.Length; i++)
				{
					array2[i].SetActive(false);
				}
				component.objectsToActivate.AddRange(array);
				ref GameObjectToggleGroup[] toggleGroups = ref toggleGroupController.toggleGroups;
				GameObjectToggleGroup val = new GameObjectToggleGroup
				{
					objects = (GameObject[])(object)new GameObject[2]
					{
						((Component)child).gameObject,
						((Component)transform).gameObject
					},
					minEnabled = 1,
					maxEnabled = 1
				};
				ArrayUtils.ArrayAppend<GameObjectToggleGroup>(ref toggleGroups, ref val);
			}
		}
	}
	[RegisterPermutation("goolake", "Abandoned Aqueduct", "Second Aqueduct", description = "A second aqueduct structure will sometimes appear on Abandoned Aqueduct")]
	public class SecondAqueduct : PermutationBehaviour, StagePermutationsPlugin.IAsyncInit
	{
		private const string GATE_NAME = "SecondaryAqueduct";

		public IEnumerator Init()
		{
			AsyncOperationHandle<NodeGraph> goolakeGroundNodegraph = Addressables.LoadAssetAsync<NodeGraph>((object)"RoR2/Base/goolake/goolakeGroundNodegraph.asset");
			AsyncOperationHandle<NodeGraph> goolakeAirNodegraph = Addressables.LoadAssetAsync<NodeGraph>((object)"RoR2/Base/goolake/goolakeAirNodegraph.asset");
			yield return goolakeGroundNodegraph;
			NodeGraph result = goolakeGroundNodegraph.Result;
			List<NodeIndex> dest = new List<NodeIndex>();
			Bounds val = default(Bounds);
			((Bounds)(ref val)).min = new Vector3(210f, -95f, -260f);
			((Bounds)(ref val)).max = new Vector3(230f, -30f, -224f);
			Bounds bounds = val;
			result.blockMap.GetItemsInBounds(ref bounds, dest);
			PermutationBehaviour.AssignNodesToGate(result, dest, "SecondaryAqueduct");
			yield return goolakeAirNodegraph;
			NodeGraph result2 = goolakeAirNodegraph.Result;
			dest.Clear();
			result2.blockMap.GetItemsInBounds(ref bounds, dest);
			PermutationBehaviour.AssignNodesToGate(result2, dest, "SecondaryAqueduct");
		}

		public override void Apply(Scene scene, IDictionary<string, GameObject> rootObjects, SceneObjectToggleGroup toggleGroupController)
		{
			//IL_002a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0030: Expected O, but got Unknown
			//IL_0064: Unknown result type (might be due to invalid IL or missing references)
			//IL_0094: 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_00d8: 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_00f9: Unknown result type (might be due to invalid IL or missing references)
			//IL_0107: Unknown result type (might be due to invalid IL or missing references)
			if (rootObjects.TryGetValue("HOLDER: GameplaySpace", out var value) && value.transform.TryFind("mdlGlDam/GL_AqueductPartial", out var child))
			{
				GameObject val = new GameObject("SecondaryAqueductToggle");
				val.AddComponent<GateStateSetter>().gateToDisableWhenEnabled = "SecondaryAqueduct";
				val.SetActive(false);
				val.AddComponent<SetSceneObjectsActive>(out SetSceneObjectsActive component);
				val.transform.localEulerAngles = new Vector3(0f, 18.7f, 180f);
				Transform transform = Object.Instantiate<GameObject>(((Component)child).gameObject, val.transform).transform;
				transform.localPosition = new Vector3(-264.7861f, 94.7f, -158.4718f);
				transform.localScale = new Vector3(10f, 14.29f, 8f);
				if (transform.TryFind("GL_Waterfall/FoamOverParticles", out var child2))
				{
					child2.localScale = new Vector3(0.8f, 1f, 0.5f);
				}
				if (transform.TryFind("GL_Waterfall/SplashZone, Directional", out var child3))
				{
					Transform obj = child3;
					Vector3 localPosition = child3.localPosition;
					localPosition.y = 2.5f;
					obj.localPosition = localPosition;
				}
				if (rootObjects.TryGetValue("HOLDER: Warning Flags", out var value2))
				{
					component.objectsToDeactivate.Add(value2.transform.FindGameObject("GLWarningFlag"));
					component.objectsToDeactivate.Add(value2.transform.FindGameObject("GLWarningFlag (2)"));
				}
				if (value.transform.TryFind("Gates/BridgeOverGooOff", out var child4))
				{
					component.objectsToActivate.Add(((Component)child4).gameObject);
				}
				ArrayUtils.ArrayAppend<GameObject>(ref toggleGroupController.toggleGroups[0].objects, ref val);
			}
		}
	}
}
namespace StagePermutations.golemplains
{
	[RegisterPermutation("golemplains2", "Titanic Plains", "Colossus Heads", description = "Two Colossus heads will sometimes appear on the alternate Titanic Plains variant")]
	public class ColossusHead : PermutationBehaviour, StagePermutationsPlugin.IAsyncInit
	{
		private const string GATE_NAME_RUINED = "BlockedByRuinedColossusHead";

		private const string GATE_NAME_FULL = "BlockedByFullColossusHead";

		public Material matColossusHeadMossy;

		public IEnumerator Init()
		{
			AsyncOperationHandle<NodeGraph> golemplains2GroundNodesNodegraph = Addressables.LoadAssetAsync<NodeGraph>((object)"RoR2/Base/golemplains2/golemplains2GroundNodesNodegraph.asset");
			AsyncOperationHandle<NodeGraph> golemplains2GroundNodesNodegraph2 = Addressables.LoadAssetAsync<NodeGraph>((object)"RoR2/golemplains2GroundNodesNodegraph.asset");
			AsyncOperationHandle<NodeGraph> golemplains2AirNodesNodegraph = Addressables.LoadAssetAsync<NodeGraph>((object)"RoR2/Base/golemplains2/golemplains2AirNodesNodegraph.asset");
			List<NodeIndex> dest = new List<NodeIndex>();
			yield return golemplains2GroundNodesNodegraph;
			ModifyGolemplains2GroundNodesNodegraph(golemplains2GroundNodesNodegraph.Result);
			yield return golemplains2GroundNodesNodegraph2;
			ModifyGolemplains2GroundNodesNodegraph(golemplains2GroundNodesNodegraph2.Result);
			yield return golemplains2AirNodesNodegraph;
			NodeGraph result = golemplains2AirNodesNodegraph.Result;
			result.blockMap.GetItemsInSphere(new Vector3(235f, 60f, 33f), 20f, dest);
			PermutationBehaviour.AssignNodesToGate(result, dest, "BlockedByRuinedColossusHead");
			dest.Clear();
			result.blockMap.GetItemsInSphere(new Vector3(-23f, 70f, -155f), 30f, dest);
			PermutationBehaviour.AssignNodesToGate(result, dest, "BlockedByFullColossusHead");
			void ModifyGolemplains2GroundNodesNodegraph(NodeGraph groundNodegraph)
			{
				//IL_0015: Unknown result type (might be due to invalid IL or missing references)
				//IL_003f: 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_0093: Unknown result type (might be due to invalid IL or missing references)
				//IL_00d9: Unknown result type (might be due to invalid IL or missing references)
				groundNodegraph.blockMap.GetItemsInSphere(new Vector3(236.6f, 43.9f, 45.2f), 5f, dest);
				groundNodegraph.blockMap.GetItemsInSphere(new Vector3(245.7f, 45f, 45f), 5f, dest);
				groundNodegraph.blockMap.GetItemsInSphere(new Vector3(251f, 45f, 35f), 5f, dest);
				groundNodegraph.blockMap.GetItemsInSphere(new Vector3(250f, 43f, 25.6f), 5f, dest);
				PermutationBehaviour.AssignNodesToGate(groundNodegraph, dest, "BlockedByRuinedColossusHead");
				dest.Clear();
				groundNodegraph.blockMap.GetItemsInSphere(new Vector3(-28.8f, 47.6f, -154f), 30f, dest);
				PermutationBehaviour.AssignNodesToGate(groundNodegraph, dest, "BlockedByFullColossusHead");
				dest.Clear();
			}
		}

		public override void Apply(Scene scene, IDictionary<string, GameObject> rootObjects, SceneObjectToggleGroup toggleGroupController)
		{
			//IL_001e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0028: Expected O, but got Unknown
			//IL_0057: Unknown result type (might be due to invalid IL or missing references)
			//IL_0076: Unknown result type (might be due to invalid IL or missing references)
			//IL_0095: Unknown result type (might be due to invalid IL or missing references)
			if (!Object.op_Implicit((Object)(object)matColossusHeadMossy))
			{
				PermutationBehaviour.Addressable<Material>("RoR2/Base/golemplains/matGPBoulderHeavyMoss.mat", out var asset);
				matColossusHeadMossy = new Material(asset);
				matColossusHeadMossy.SetTexture("_NormalTex", PermutationBehaviour.Addressable<Texture>("RoR2/Junk/slice2/texColossusHead1Normal.png"));
				matColossusHeadMossy.SetTextureScale("_NormalTex", new Vector2(1f, 1f));
				matColossusHeadMossy.SetTextureScale("_MainTex", new Vector2(3f, 8f));
				matColossusHeadMossy.SetTextureScale("_SnowTex", new Vector2(10f, 10f));
				matColossusHeadMossy.SetFloat("_SnowBias", 0.14f);
				matColossusHeadMossy.SetFloat("_Depth", 0.3f);
				matColossusHeadMossy.SetInt("_RampInfo", 3);
			}
			ApplyRuinedHead(rootObjects, toggleGroupController);
			ApplyFullHead(rootObjects, toggleGroupController);
		}

		public void ApplyRuinedHead(IDictionary<string, GameObject> rootObjects, SceneObjectToggleGroup toggleGroupController)
		{
			//IL_0070: Unknown result type (might be due to invalid IL or missing references)
			//IL_007b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0086: Unknown result type (might be due to invalid IL or missing references)
			//IL_0090: Unknown result type (might be due to invalid IL or missing references)
			//IL_00fa: Unknown result type (might be due to invalid IL or missing references)
			//IL_0119: Unknown result type (might be due to invalid IL or missing references)
			//IL_0142: Unknown result type (might be due to invalid IL or missing references)
			if (rootObjects.TryGetValue("HOLDER: Ruins", out var value))
			{
				Transform val = (from Transform x in (IEnumerable)value.transform
					where ((Object)((Component)x).gameObject).name == "GPRuinedRing1"
					select x).ElementAtOrDefault(1);
				if (Object.op_Implicit((Object)(object)val))
				{
					GameObject val2 = Object.Instantiate<GameObject>(PermutationBehaviour.Addressable<GameObject>("RoR2/DLC1/voidraid/mdlRaidColossusHeadDestroyed.fbx"));
					Transform obj = val2.transform.Find("mdlRaidColossusHeadDestroyed");
					obj.localPosition = Vector3.zero;
					obj.localEulerAngles = Vector3.zero;
					obj.localScale = Vector3.one * 5f;
					((Renderer)((Component)obj).GetComponent<MeshRenderer>()).sharedMaterial = matColossusHeadMossy;
					((Component)obj).gameObject.layer = LayerIndex.world.intVal;
					((Component)obj).gameObject.AddComponent<MeshCollider>();
					((Component)obj).gameObject.AddComponent<SurfaceDefProvider>().surfaceDef = PermutationBehaviour.Addressable<SurfaceDef>("RoR2/Base/Common/sdStone.asset");
					val2.transform.localPosition = new Vector3(235f, 65.1f, 30f);
					val2.transform.localEulerAngles = new Vector3(270f, 300f, 0f);
					val2.AddComponent<GateStateSetter>().gateToDisableWhenEnabled = "BlockedByRuinedColossusHead";
					val2.SetActive(false);
					ref GameObjectToggleGroup[] toggleGroups = ref toggleGroupController.toggleGroups;
					GameObjectToggleGroup val3 = new GameObjectToggleGroup
					{
						objects = (GameObject[])(object)new GameObject[2]
						{
							((Component)val).gameObject,
							val2
						},
						minEnabled = 1,
						maxEnabled = 1
					};
					ArrayUtils.ArrayAppend<GameObjectToggleGroup>(ref toggleGroups, ref val3);
				}
			}
		}

		public void ApplyFullHead(IDictionary<string, GameObject> rootObjects, SceneObjectToggleGroup toggleGroupController)
		{
			//IL_006d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0072: Unknown result type (might be due to invalid IL or missing references)
			//IL_0080: 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_00f1: 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_0119: Unknown result type (might be due to invalid IL or missing references)
			//IL_0133: Unknown result type (might be due to invalid IL or missing references)
			//IL_014d: Unknown result type (might be due to invalid IL or missing references)
			if (rootObjects.TryGetValue("HOLDER: Columns", out var value))
			{
				Transform val = (from x in value.transform.AllChildren()
					where ((Object)x).name == "GP_TerrainColumn"
					select x).ElementAtOrDefault(2);
				if (Object.op_Implicit((Object)(object)val))
				{
					GameObject val2 = Object.Instantiate<GameObject>(((Component)val).gameObject, val.parent);
					Transform transform = val2.transform;
					Vector3 localPosition = ((Component)val).transform.localPosition;
					localPosition.y = 0f;
					transform.localPosition = localPosition;
					val2.SetActive(false);
					Transform transform2 = new GameObject("colossusHead1Parent").transform;
					GameObject obj = Object.Instantiate<GameObject>(PermutationBehaviour.Addressable<GameObject>("RoR2/Base/Common/Props/mdlColossusHead1.fbx"), transform2);
					((Renderer)obj.GetComponent<MeshRenderer>()).sharedMaterial = matColossusHeadMossy;
					obj.layer = LayerIndex.world.intVal;
					obj.AddComponent<MeshCollider>();
					obj.AddComponent<SurfaceDefProvider>().surfaceDef = PermutationBehaviour.Addressable<SurfaceDef>("RoR2/Base/Common/sdStone.asset");
					obj.transform.localScale = Vector3.one * 5f;
					obj.transform.localEulerAngles = new Vector3(270f, 0f, 0f);
					transform2.localPosition = new Vector3(-35f, 38f, -152f);
					transform2.localEulerAngles = new Vector3(355f, 75f, 350f);
					((Component)transform2).gameObject.AddComponent<GateStateSetter>().gateToDisableWhenEnabled = "BlockedByFullColossusHead";
					((Component)transform2).gameObject.SetActive(false);
					SetSceneObjectsActive setSceneObjectsActive = ((Component)transform2).gameObject.AddComponent<SetSceneObjectsActive>();
					setSceneObjectsActive.objectsToDeactivate = new List<GameObject>(1) { ((Component)val).gameObject };
					setSceneObjectsActive.objectsToActivate = new List<GameObject>(1) { val2 };
					ref GameObject[] objects = ref toggleGroupController.toggleGroups[3].objects;
					GameObject gameObject = ((Component)transform2).gameObject;
					ArrayUtils.ArrayAppend<GameObject>(ref objects, ref gameObject);
				}
			}
		}
	}
	[RegisterPermutation("golemplains", "Titanic Plains", "Longer Backwall", description = "The backwall on the original Titanic Plains variant will sometimes extend to the edge of the stage")]
	public class MoreBackwall : PermutationBehaviour, StagePermutationsPlugin.IAsyncInit
	{
		private const string GATE_NAME = "BlockedByLongerBackwall";

		public IEnumerator Init()
		{
			AsyncOperationHandle<NodeGraph> golemplainsGroundNodesNodegraph = Addressables.LoadAssetAsync<NodeGraph>((object)"RoR2/Base/golemplains/golemplainsGroundNodesNodegraph.asset");
			AsyncOperationHandle<NodeGraph> golemplainsAirNodesNodegraph = Addressables.LoadAssetAsync<NodeGraph>((object)"RoR2/Base/golemplains/golemplainsAirNodesNodegraph.asset");
			List<NodeIndex> dest = new List<NodeIndex>();
			yield return golemplainsGroundNodesNodegraph;
			NodeGraph result = golemplainsGroundNodesNodegraph.Result;
			BlockMap<NodeIndex, NodePositionGetter> blockMap = result.blockMap;
			Bounds val = new Bounds(new Vector3(-70f, -140f, -362f), new Vector3(100f, 40f, 55f));
			blockMap.GetItemsInBounds(ref val, dest);
			result.blockMap.GetItemsInSphere(new Vector3(50f, -120f, -380f), 100f, dest);
			result.blockMap.GetItemsInSphere(new Vector3(-33.5f, -152.7f, -332.2f), 3f, dest);
			PermutationBehaviour.AssignNodesToGate(result, dest, "BlockedByLongerBackwall");
			dest.Clear();
			yield return golemplainsAirNodesNodegraph;
			NodeGraph result2 = golemplainsAirNodesNodegraph.Result;
			BlockMap<NodeIndex, NodePositionGetter> blockMap2 = result2.blockMap;
			val = new Bounds(new Vector3(-70f, -140f, -362f), new Vector3(100f, 40f, 60f));
			blockMap2.GetItemsInBounds(ref val, dest);
			result2.blockMap.GetItemsInSphere(new Vector3(50f, -120f, -380f), 100f, dest);
			result2.blockMap.GetItemsInSphere(new Vector3(-96f, -122f, -397f), 20f, dest);
			PermutationBehaviour.AssignNodesToGate(result2, dest, "BlockedByLongerBackwall");
		}

		public override void Apply(Scene scene, IDictionary<string, GameObject> rootObjects, SceneObjectToggleGroup toggleGroupController)
		{
			//IL_0025: Unknown result type (might be due to invalid IL or missing references)
			//IL_0044: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c2: Unknown result type (might be due to invalid IL or missing references)
			GameObject val = Object.Instantiate<GameObject>(PermutationBehaviour.Addressable<GameObject>("RoR2/Base/dampcave/DCTerrainBackwall.prefab"));
			val.transform.localPosition = new Vector3(253f, -42f, -310f);
			val.transform.localEulerAngles = new Vector3(270f, 112f, 0f);
			((Renderer)val.GetComponent<MeshRenderer>()).sharedMaterial = PermutationBehaviour.Addressable<Material>("RoR2/Base/golemplains/matGPTerrain.mat");
			val.AddComponent<GateStateSetter>().gateToDisableWhenEnabled = "BlockedByLongerBackwall";
			val.SetActive(false);
			if (rootObjects.TryGetValue("HOLDER: Ruined Pieces", out var value) && value.transform.TryFind("GPRuinedRing1 (3)", out var child))
			{
				val.AddComponent<SetSceneObjectsActive>().objectsToDeactivate = new List<GameObject>(1) { ((Component)child).gameObject };
			}
			ref GameObjectToggleGroup[] toggleGroups = ref toggleGroupController.toggleGroups;
			GameObjectToggleGroup val2 = new GameObjectToggleGroup
			{
				objects = (GameObject[])(object)new GameObject[1] { val },
				minEnabled = 0,
				maxEnabled = 1
			};
			ArrayUtils.ArrayAppend<GameObjectToggleGroup>(ref toggleGroups, ref val2);
		}
	}
}
namespace StagePermutations.foggyswamp
{
	[RegisterPermutation("foggyswamp", "Wetland Aspect", "Ruin Platform Variation", description = "Sometimes the ruin platform near the edge of Wetland Aspect will disappear")]
	public class FramePlatform : PermutationBehaviour, StagePermutationsPlugin.IAsyncInit
	{
		private const string GATE_NAME = "RuinFramePlatform";

		public IEnumerator Init()
		{
			AsyncOperationHandle<NodeGraph> foggyswampGroundNodesNodegraph = Addressables.LoadAssetAsync<NodeGraph>((object)"RoR2/Base/foggyswamp/foggyswampGroundNodesNodegraph.asset");
			AsyncOperationHandle<NodeGraph> foggyswampAirNodesNodegraph = Addressables.LoadAssetAsync<NodeGraph>((object)"RoR2/Base/foggyswamp/foggyswampAirNodesNodegraph.asset");
			List<NodeIndex> dest = new List<NodeIndex>();
			Bounds[] array = new Bounds[2];
			Bounds val = default(Bounds);
			((Bounds)(ref val)).min = new Vector3(84f, -155f, -341f);
			((Bounds)(ref val)).max = new Vector3(149f, -111f, -301f);
			array[0] = val;
			val = default(Bounds);
			((Bounds)(ref val)).min = new Vector3(128f, -142f, -340f);
			((Bounds)(ref val)).max = new Vector3(209f, -89f, -284f);
			array[1] = val;
			Bounds[] bounds = (Bounds[])(object)array;
			yield return foggyswampGroundNodesNodegraph;
			NodeGraph result = foggyswampGroundNodesNodegraph.Result;
			Bounds[] array2 = bounds;
			for (int i = 0; i < array2.Length; i++)
			{
				Bounds bounds2 = array2[i];
				result.blockMap.GetItemsInBounds(ref bounds2, dest);
				PermutationBehaviour.EnsureNodesInBounds(result, dest, bounds2);
				PermutationBehaviour.AssignNodesToGate(result, dest, "RuinFramePlatform");
				dest.Clear();
			}
			yield return foggyswampAirNodesNodegraph;
			NodeGraph result2 = foggyswampAirNodesNodegraph.Result;
			array2 = bounds;
			for (int i = 0; i < array2.Length; i++)
			{
				Bounds bounds3 = array2[i];
				result2.blockMap.GetItemsInBounds(ref bounds3, dest);
				PermutationBehaviour.EnsureNodesInBounds(result2, dest, bounds3);
				PermutationBehaviour.AssignNodesToGate(result2, dest, "RuinFramePlatform");
				dest.Clear();
			}
		}

		public override void Apply(Scene scene, IDictionary<string, GameObject> rootObjects, SceneObjectToggleGroup toggleGroupController)
		{
			//IL_002a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0030: Expected O, but got Unknown
			//IL_01be: 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_0082: Unknown result type (might be due to invalid IL or missing references)
			//IL_009d: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a9: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c9: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ee: 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_0110: Unknown result type (might be due to invalid IL or missing references)
			//IL_0125: Unknown result type (might be due to invalid IL or missing references)
			//IL_012c: Expected O, but got Unknown
			//IL_0139: 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_0144: Unknown result type (might be due to invalid IL or missing references)
			if (!rootObjects.TryGetValue("HOLDER: Ruin Pieces", out var value) || !value.transform.TryFind("FSGiantRuinFrameCollision", out var child))
			{
				return;
			}
			GameObject val = new GameObject("FSGiantRuinFrameCollisionDisabled");
			val.AddComponent<GateStateSetter>().gateToDisableWhenEnabled = "RuinFramePlatform";
			val.SetActive(false);
			if (rootObjects.TryGetValue("HOLDER: Foliage", out var value2))
			{
				val.AddComponent<SetSceneObjectsActive>(out SetSceneObjectsActive component);
				Bounds[] array = new Bounds[2];
				Bounds val2 = default(Bounds);
				((Bounds)(ref val2)).min = new Vector3(84f, -160f, -341f);
				((Bounds)(ref val2)).max = new Vector3(149f, -111f, -301f);
				array[0] = val2;
				val2 = default(Bounds);
				((Bounds)(ref val2)).min = new Vector3(128f, -160f, -340f);
				((Bounds)(ref val2)).max = new Vector3(209f, -89f, -284f);
				array[1] = val2;
				Bounds[] array2 = (Bounds[])(object)array;
				foreach (Transform item in value2.transform)
				{
					foreach (Transform item2 in item)
					{
						Transform val3 = item2;
						Bounds[] array3 = array2;
						for (int i = 0; i < array3.Length; i++)
						{
							Bounds val4 = array3[i];
							if (((Bounds)(ref val4)).Contains(val3.position))
							{
								component.objectsToDeactivate.Add(((Component)val3).gameObject);
								break;
							}
						}
					}
				}
			}
			ref GameObjectToggleGroup[] toggleGroups = ref toggleGroupController.toggleGroups;
			GameObjectToggleGroup val5 = new GameObjectToggleGroup
			{
				objects = (GameObject[])(object)new GameObject[2]
				{
					((Component)child).gameObject,
					val
				},
				minEnabled = 1,
				maxEnabled = 1
			};
			ArrayUtils.ArrayAppend<GameObjectToggleGroup>(ref toggleGroups, ref val5);
		}
	}
	[RegisterPermutation("foggyswamp", "Wetland Aspect", "More Ruin Rings", description = "Two more floating ruin rings will sometimes appear on Wetland Aspect")]
	public class MoreRings : PermutationBehaviour
	{
		public override void Apply(Scene scene, IDictionary<string, GameObject> rootObjects, SceneObjectToggleGroup toggleGroupController)
		{
			//IL_003a: 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_0066: Unknown result type (might be due to invalid IL or missing references)
			//IL_0070: Unknown result type (might be due to invalid IL or missing references)
			//IL_008f: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00bb: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d7: Unknown result type (might be due to invalid IL or missing references)
			if (rootObjects.TryGetValue("HOLDER: Tree Trunks w Collision", out var value) && value.transform.TryFind("FSTreeTrunkLongCollision (1)/FSRuinRingCollision", out var child))
			{
				GameObject val = Object.Instantiate<GameObject>(((Component)child).gameObject, new Vector3(-5f, 0f, 26f), Quaternion.Euler(5f, 0f, 90f));
				val.SetActive(false);
				val.transform.localScale = Vector3.one * 22f;
				GameObject val2 = Object.Instantiate<GameObject>(((Component)child).gameObject, new Vector3(-39f, 65f, -82f), Quaternion.Euler(0f, 0f, 90f));
				val2.SetActive(false);
				val2.transform.localScale = Vector3.one * 22f;
				ref GameObjectToggleGroup[] toggleGroups = ref toggleGroupController.toggleGroups;
				GameObjectToggleGroup val3 = new GameObjectToggleGroup
				{
					objects = (GameObject[])(object)new GameObject[2] { val, val2 },
					minEnabled = 0,
					maxEnabled = 2
				};
				ArrayUtils.ArrayAppend<GameObjectToggleGroup>(ref toggleGroups, ref val3);
			}
		}
	}
	[RegisterPermutation("foggyswamp", "Wetland Aspect", "Stump to Tree", description = "Sometimes the large tree stump on Wetland Aspect will be replaced by a full tree")]
	public class StumpToTree : PermutationBehaviour
	{
		public override void Apply(Scene scene, IDictionary<string, GameObject> rootObjects, SceneObjectToggleGroup toggleGroupController)
		{
			//IL_0067: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d2: 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_00e8: Unknown result type (might be due to invalid IL or missing references)
			//IL_0117: Unknown result type (might be due to invalid IL or missing references)
			//IL_0132: Unknown result type (might be due to invalid IL or missing references)
			//IL_0161: 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_01cd: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ab: Unknown result type (might be due to invalid IL or missing references)
			if (rootObjects.TryGetValue("HOLDER: Tree Trunks w Collision", out var value) && value.transform.TryFind("CompositeTreeTrunk", out var child) && value.transform.TryFind("FSTreeTrunkStumpLarge", out var child2))
			{
				GameObject val = Object.Instantiate<GameObject>(((Component)child).gameObject, child.parent);
				val.SetActive(false);
				val.transform.localPosition = new Vector3(-117f, -151f, -241f);
				if (val.transform.TryFind("FSTreeTrunkEnormousCollision (2)", out var child3))
				{
					((Component)child3).gameObject.SetActive(false);
				}
				if (val.transform.TryFind("FSTreeTrunkEnormousCollision", out var child4))
				{
					child4.localPosition = new Vector3(0f, -5f, 0f);
					child4.localEulerAngles = new Vector3(5f, 340f, 7f);
					child4.localScale = Vector3.one * 4.3f;
				}
				if (val.transform.TryFind("FSRootBundleLargeCollision (1)", out var child5))
				{
					child5.localPosition = new Vector3(-3f, -8f, 6f);
					child5.localEulerAngles = new Vector3(80f, 69f, 3f);
				}
				if (val.transform.TryFind("FSTreeTrunkEnormousNoCollisionSkybox", out var child6))
				{
					child6.localPosition = new Vector3(-15f, 0f, 0f);
					child6.localEulerAngles = new Vector3(0f, 10f, 357f);
				}
				if (val.transform.TryFind("FSRootBundleSmallNoCollision", out var child7))
				{
					child7.localPosition = new Vector3(2f, 2f, -17f);
				}
				val.AddComponent<DisableOcclusionNearby>().radius = 50f;
				ref GameObjectToggleGroup[] toggleGroups = ref toggleGroupController.toggleGroups;
				GameObjectToggleGroup val2 = new GameObjectToggleGroup
				{
					objects = (GameObject[])(object)new GameObject[2]
					{
						((Component)child2).gameObject,
						val
					},
					minEnabled = 1,
					maxEnabled = 1
				};
				ArrayUtils.ArrayAppend<GameObjectToggleGroup>(ref toggleGroups, ref val2);
			}
		}
	}
}
namespace StagePermutations.blackbeach
{
	[RegisterPermutation("blackbeach", "Distant Roost", "New Ruin Gate", description = "Sometimes a new ruin gate will appear on the upper walkway of the original Distant Roost variant")]
	public class MoreRuins : PermutationBehaviour, StagePermutationsPlugin.IAsyncInit
	{
		private const string GATE_NAME = "BlockedByRuinsPath";

		public IEnumerator Init()
		{
			AsyncOperationHandle<NodeGraph> blackbeachGroundNodes = Addressables.LoadAssetAsync<NodeGraph>((object)"RoR2/Base/blackbeach/blackbeachGroundNodes.asset");
			AsyncOperationHandle<NodeGraph> blackbeachAirNodes = Addressables.LoadAssetAsync<NodeGraph>((object)"RoR2/Base/blackbeach/blackbeachAirNodes.asset");
			List<NodeIndex> dest = new List<NodeIndex>();
			yield return blackbeachGroundNodes;
			NodeGraph result = blackbeachGroundNodes.Result;
			result.blockMap.GetItemsInSphere(new Vector3(103f, -159f, -78f), 5f, dest);
			PermutationBehaviour.AssignNodesToGate(result, dest, "BlockedByRuinsPath");
			dest.Clear();
			yield return blackbeachAirNodes;
			NodeGraph result2 = blackbeachAirNodes.Result;
			result2.blockMap.GetItemsInSphere(new Vector3(123f, -135f, -75f), 10f, dest);
			PermutationBehaviour.AssignNodesToGate(result2, dest, "BlockedByRuinsPath");
		}

		public override void Apply(Scene scene, IDictionary<string, GameObject> rootObjects, SceneObjectToggleGroup toggleGroupController)
		{
			//IL_002a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0030: Expected O, but got Unknown
			//IL_007e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0169: 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_00fc: Unknown result type (might be due to invalid IL or missing references)
			//IL_0139: Unknown result type (might be due to invalid IL or missing references)
			//IL_0157: Unknown result type (might be due to invalid IL or missing references)
			if (rootObjects.TryGetValue("GAMEPLAY SPACE", out var value) && value.transform.TryFind("Ruins/BbRuinArch_LOD0 (2)", out var child))
			{
				GameObject val = new GameObject("ToggleableRuins");
				val.AddComponent<GateStateSetter>().gateToDisableWhenEnabled = "BlockedByRuinsPath";
				val.SetActive(false);
				val.transform.SetParent(value.transform, false);
				Object.Instantiate<GameObject>(((Component)child).gameObject, val.transform).transform.localPosition = new Vector3(120f, -143f, -74.5f);
				PermutationBehaviour.Addressable<Mesh>("RoR2/Base/blackbeach/BbRuinStep1_LOD0.fbx", out var asset);
				if (value.transform.TryFind("Ruins/BbRuinStep1_LOD0 (1)", out var child2))
				{
					GameObject obj = Object.Instantiate<GameObject>(((Component)child2).gameObject, val.transform);
					obj.GetComponent<MeshFilter>().sharedMesh = asset;
					obj.transform.localPosition = new Vector3(96f, -155.5f, -64f);
					obj.transform.localEulerAngles = new Vector3(270f, 240f, 0f);
					GameObject obj2 = Object.Instantiate<GameObject>(((Component)child2).gameObject, val.transform);
					obj2.GetComponent<MeshFilter>().sharedMesh = asset;
					obj2.transform.localPosition = new Vector3(108f, -151.5f, -63f);
					obj2.transform.localEulerAngles = new Vector3(270f, 255f, 0f);
				}
				ref GameObjectToggleGroup[] toggleGroups = ref toggleGroupController.toggleGroups;
				GameObjectToggleGroup val2 = new GameObjectToggleGroup
				{
					objects = (GameObject[])(object)new GameObject[1] { val },
					minEnabled = 0,
					maxEnabled = 1
				};
				ArrayUtils.ArrayAppend<GameObjectToggleGroup>(ref toggleGroups, ref val2);
			}
		}
	}
	[RegisterPermutation("blackbeach2", "Distant Roost", "Ruin Gate Door", description = "Sometimes the door of the large ruin gate on the alternate Distant Roost variant will be closed")]
	public class RuinGateDoor : PermutationBehaviour, StagePermutationsPlugin.IAsyncInit
	{
		private const string GATE_NAME = "BlockedByRuinGateDoor";

		public IEnumerator Init()
		{
			AsyncOperationHandle<NodeGraph> blackbeach2GroundNodesNodegraph = Addressables.LoadAssetAsync<NodeGraph>((object)"RoR2/Base/blackbeach2/blackbeach2GroundNodesNodegraph.asset");
			AsyncOperationHandle<NodeGraph> blackbeach2AirNodesNodegraph = Addressables.LoadAssetAsync<NodeGraph>((object)"RoR2/Base/blackbeach2/blackbeach2AirNodesNodegraph.asset");
			List<NodeIndex> dest = new List<NodeIndex>();
			yield return blackbeach2GroundNodesNodegraph;
			NodeGraph result = blackbeach2GroundNodesNodegraph.Result;
			result.blockMap.GetItemsInSphere(new Vector3(-8f, 33f, -156f), 10f, dest);
			PermutationBehaviour.AssignNodesToGate(result, dest, "BlockedByRuinGateDoor");
			dest.Clear();
			yield return blackbeach2AirNodesNodegraph;
			NodeGraph result2 = blackbeach2AirNodesNodegraph.Result;
			result2.blockMap.GetItemsInSphere(new Vector3(-5f, 44f, -163f), 15f, dest);
			PermutationBehaviour.AssignNodesToGate(result2, dest, "BlockedByRuinGateDoor");
		}

		public override void Apply(Scene scene, IDictionary<string, GameObject> rootObjects, SceneObjectToggleGroup toggleGroupController)
		{
			//IL_002a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0030: Expected O, but got Unknown
			//IL_0063: Unknown result type (might be due to invalid IL or missing references)
			//IL_0073: Unknown result type (might be due to invalid IL or missing references)
			//IL_0092: Unknown result type (might be due to invalid IL or missing references)
			//IL_00cd: Unknown result type (might be due to invalid IL or missing references)
			//IL_00dd: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f8: Unknown result type (might be due to invalid IL or missing references)
			//IL_0102: Unknown result type (might be due to invalid IL or missing references)
			//IL_0112: Unknown result type (might be due to invalid IL or missing references)
			//IL_014c: Unknown result type (might be due to invalid IL or missing references)
			//IL_015d: 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_017a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0185: Unknown result type (might be due to invalid IL or missing references)
			//IL_0195: Unknown result type (might be due to invalid IL or missing references)
			//IL_01a4: Unknown result type (might be due to invalid IL or missing references)
			if (rootObjects.TryGetValue("HOLDER: Ruins", out var value) && value.transform.TryFind("GROUP: Gates", out var child))
			{
				GameObject val = new GameObject("RuinGateDoor");
				val.AddComponent<GateStateSetter>().gateToDisableWhenEnabled = "BlockedByRuinGateDoor";
				val.SetActive(false);
				val.transform.parent = child.Find("BbRuinArch_LOD0");
				val.transform.localPosition = Vector3.zero;
				val.transform.localEulerAngles = Vector3.zero;
				val.transform.localScale = new Vector3(0.09f, 0.17f, 0.17f);
				GameObject val2 = Object.Instantiate<GameObject>(((Component)child.Find("DownstairsGate, Open/BbRuinGateDoor1_LOD0")).gameObject, val.transform);
				val2.transform.localPosition = new Vector3(0f, 0.75f, 0f);
				val2.transform.localEulerAngles = Vector3.zero;
				Transform transform = val2.transform;
				Vector3 localScale = val2.transform.localScale;
				localScale.z = 0f - val2.transform.localScale.z;
				transform.localScale = localScale;
				GameObject val3 = Object.Instantiate<GameObject>(((Component)child.Find("DownstairsGate, Open/BbRuinGateDoor2_LOD0")).gameObject, val.transform);
				val3.transform.localPosition = new Vector3(0f, -0.75f, 0f);
				val3.transform.localEulerAngles = Vector3.zero;
				Transform transform2 = val3.transform;
				localScale = val3.transform.localScale;
				localScale.z = 0f - val3.transform.localScale.z;
				transform2.localScale = localScale;
				ref GameObjectToggleGroup[] toggleGroups = ref toggleGroupController.toggleGroups;
				GameObjectToggleGroup val4 = new GameObjectToggleGroup
				{
					objects = (GameObject[])(object)new GameObject[1] { val },
					minEnabled = 0,
					maxEnabled = 1
				};
				ArrayUtils.ArrayAppend<GameObjectToggleGroup>(ref toggleGroups, ref val4);
			}
		}
	}
}