Decompiled source of ConsistentStageFeatures v1.2.4

ConsistentStageFeatures.dll

Decompiled 3 months ago
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using Aetherium.Interactables;
using BepInEx;
using BepInEx.Bootstrap;
using BepInEx.Configuration;
using BepInEx.Logging;
using BulwarksHaunt;
using BulwarksHaunt.Items;
using FRCSharp;
using HG;
using HarmonyLib;
using IL.RoR2;
using IL.RoR2.CharacterSpeech;
using Microsoft.CodeAnalysis;
using Mono.Cecil.Cil;
using MonoMod.Cil;
using On.RoR2;
using ProperLoop;
using R2API;
using RoR2;
using RoR2.CharacterSpeech;
using RoR2.EntityLogic;
using RoR2.Navigation;
using ShrineOfRepair.Modules;
using ShrineOfRepair.Modules.Interactables;
using UnityEngine;
using UnityEngine.AddressableAssets;
using UnityEngine.Networking;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: TargetFramework(".NETStandard,Version=v2.0", FrameworkDisplayName = ".NET Standard 2.0")]
[assembly: AssemblyCompany("ConsistentStageFeatures")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("ConsistentStageFeatures")]
[assembly: AssemblyTitle("ConsistentStageFeatures")]
[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 ConsistentStageFeatures
{
	[BepInPlugin("prodzpod.ConsistentStageFeatures", "ConsistentStageFeatures", "1.2.3")]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	public class Main : BaseUnityPlugin
	{
		[HarmonyPatch(typeof(BatteryContainerInteraction), "OnInteractionBegin")]
		public class PatchBatteryInteraction
		{
			public static void Postfix(BatteryContainerInteraction __instance)
			{
				//IL_0016: 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)
				NetworkServer.Spawn(Object.Instantiate<GameObject>(LegacyResourcesAPI.Load<GameObject>("Prefabs/NetworkedObjects/ChestScanner"), ((Component)__instance).gameObject.transform.position, Quaternion.identity));
			}
		}

		[Serializable]
		[CompilerGenerated]
		private sealed class <>c
		{
			public static readonly <>c <>9 = new <>c();

			public static hook_Awake <>9__65_0;

			public static hook_SetSwitch <>9__65_2;

			public static Action<Stage> <>9__65_3;

			public static Action<Stage> <>9__65_13;

			public static Action<Stage> <>9__65_14;

			public static Action<Stage> <>9__65_15;

			public static Func<Instruction, bool> <>9__65_23;

			public static Func<CharacterBody, bool> <>9__65_25;

			public static Func<CharacterBody, bool> <>9__65_26;

			public static Func<Instruction, bool> <>9__65_27;

			public static Func<CharacterBody, bool> <>9__65_29;

			public static Func<CharacterBody, bool> <>9__65_30;

			public static Action<Stage> <>9__65_20;

			public static Func<CharacterBody, bool> <>9__65_31;

			public static hook_BeginEncounter <>9__65_21;

			public static Func<Instruction, bool> <>9__65_32;

			public static Func<uint, uint> <>9__65_33;

			public static Manipulator <>9__65_22;

			public static Action<TeleporterInteraction> <>9__65_8;

			public static Func<GameObject, bool> <>9__65_35;

			public static Action<Stage> <>9__65_9;

			public static Action<SceneDirector> <>9__65_12;

			public static Converter<string, string> <>9__66_0;

			public static Converter<string, string> <>9__66_2;

			public static Converter<string, string> <>9__66_3;

			public static Action<Stage> <>9__67_0;

			public static Action<DamageReport> <>9__67_1;

			public static Action<Stage> <>9__68_0;

			public static Func<ItemIndex, ItemDef> <>9__68_2;

			public static Func<EquipmentIndex, EquipmentDef> <>9__68_4;

			public static hook_GrantUnlock <>9__70_0;

			internal void <Awake>b__65_0(orig_Awake orig, SceneObjectToggleGroup self)
			{
				//IL_0023: Unknown result type (might be due to invalid IL or missing references)
				//IL_0028: Unknown result type (might be due to invalid IL or missing references)
				//IL_00df: Unknown result type (might be due to invalid IL or missing references)
				//IL_00e0: Unknown result type (might be due to invalid IL or missing references)
				if (self.toggleGroups.Length != 0)
				{
					GameObjectToggleGroup val = self.toggleGroups[self.toggleGroups.Length - 1];
					if (SceneCatalog.mostRecentSceneDef.cachedName == "frozenwall")
					{
						ref GameObject[] objects = ref val.objects;
						GameObject gameObject = ((Component)GameObject.Find("HOLDER: Preplaced Objects").transform.Find("NewtStatue, Guaranteed")).gameObject;
						ArrayUtils.ArrayAppend<GameObject>(ref objects, ref gameObject);
					}
					if (SceneCatalog.mostRecentSceneDef.cachedName == "blackbeach")
					{
						val.minEnabled = 1;
					}
					if (SceneCatalog.mostRecentSceneDef.cachedName == "goolake")
					{
						val.maxEnabled = AqueductButtonMax.Value;
						val.minEnabled = AqueductButtonMax.Value;
					}
					self.toggleGroups[self.toggleGroups.Length - 1] = val;
				}
				orig.Invoke(self);
			}

			internal void <Awake>b__65_2(orig_SetSwitch orig, PressurePlateController self, bool input)
			{
				if (input)
				{
					orig.Invoke(self, input);
				}
			}

			internal void <Awake>b__65_3(Stage stage)
			{
				if (stage.sceneDef.cachedName == "goolake")
				{
					((Component)GameObject.Find("HOLDER: Secret Ring Area Content").transform.Find("Entrance").Find("GLRuinGate")).GetComponent<Counter>().threshold = AqueductButtonMax.Value;
				}
			}

			internal void <Awake>b__65_13(Stage stage)
			{
				if (stage.sceneDef.cachedName == "slumberingsatellite")
				{
					((Component)GameObject.Find("World").transform.Find("Gated Areas").Find("GateGround0")).gameObject.SetActive(true);
				}
			}

			internal void <Awake>b__65_14(Stage stage)
			{
				if (stage.sceneDef.cachedName == "slumberingsatellite")
				{
					((Component)GameObject.Find("World").transform.Find("Gated Areas").Find("GateGround4")).gameObject.SetActive(true);
					((Component)GameObject.Find("World").transform.Find("Gated Areas").Find("GateGround5")).gameObject.SetActive(true);
				}
			}

			internal void <Awake>b__65_15(Stage stage)
			{
				if (!(stage.sceneDef.cachedName == "moon2"))
				{
					return;
				}
				foreach (NetworkUser instances in NetworkUser.instancesList)
				{
					if (instances.master.inventory.GetItemCount(Items.BulwarksHaunt_Sword) > 0 || instances.master.inventory.GetItemCount(Items.BulwarksHaunt_SwordUnleashed) > 0)
					{
						((Component)GameObject.Find("HOLDER: Gameplay Space").transform.Find("HOLDER: STATIC MESH").Find("Quadrant 5: Blood Arena").Find("Arena Weapons")
							.Find("mdlBrotherSword (3)")).gameObject.SetActive(false);
					}
				}
			}

			internal bool <Awake>b__65_23(Instruction x)
			{
				return ILPatternMatchingExt.MatchCallOrCallvirt<BrotherSpeechDriver>(x, "SendReponseFromPool");
			}

			internal bool <Awake>b__65_25(CharacterBody x)
			{
				//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 x.bodyIndex == BrotherSpeechDriver.hereticBodyIndex;
			}

			internal bool <Awake>b__65_26(CharacterBody x)
			{
				return x.inventory.GetItemCount(Items.BulwarksHaunt_Sword) > 0 || x.inventory.GetItemCount(Items.BulwarksHaunt_SwordUnleashed) > 0;
			}

			internal bool <Awake>b__65_27(Instruction x)
			{
				return ILPatternMatchingExt.MatchCallOrCallvirt<BrotherSpeechDriver>(x, "SendReponseFromPool");
			}

			internal bool <Awake>b__65_29(CharacterBody x)
			{
				//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 x.bodyIndex == BrotherSpeechDriver.hereticBodyIndex;
			}

			internal bool <Awake>b__65_30(CharacterBody x)
			{
				return x.inventory.GetItemCount(Items.BulwarksHaunt_Sword) > 0 || x.inventory.GetItemCount(Items.BulwarksHaunt_SwordUnleashed) > 0;
			}

			internal void <Awake>b__65_20(Stage _)
			{
				pissed = false;
			}

			internal void <Awake>b__65_21(orig_BeginEncounter orig, ScriptedCombatEncounter self)
			{
				orig.Invoke(self);
				if (!SceneCatalog.mostRecentSceneDef.cachedName.StartsWith("moon"))
				{
					return;
				}
				bool flag = CharacterBody.readOnlyInstancesList.Any((CharacterBody x) => x.inventory.GetItemCount(Items.BulwarksHaunt_Sword) > 0 || x.inventory.GetItemCount(Items.BulwarksHaunt_SwordUnleashed) > 0);
				pissed |= flag;
				if (!pissed)
				{
					return;
				}
				foreach (CharacterMaster members in self.combatSquad.membersList)
				{
					CharacterBody body = members.GetBody();
					body.baseMaxHealth *= 1f + SwordHealth.Value;
					body.levelMaxHealth *= 1f + SwordHealth.Value;
					body.baseDamage *= 1f + SwordDamage.Value;
					body.levelDamage *= 1f + SwordDamage.Value;
					body.baseMoveSpeed *= 1f + SwordSpeed.Value;
					body.levelMoveSpeed *= 1f + SwordSpeed.Value;
					body.baseArmor *= 1f + SwordArmor.Value;
					body.levelArmor *= 1f + SwordArmor.Value;
					body.baseAttackSpeed *= 1f + SwordAttackSpeed.Value;
					body.levelAttackSpeed *= 1f + SwordAttackSpeed.Value;
				}
			}

			internal bool <Awake>b__65_31(CharacterBody x)
			{
				return x.inventory.GetItemCount(Items.BulwarksHaunt_Sword) > 0 || x.inventory.GetItemCount(Items.BulwarksHaunt_SwordUnleashed) > 0;
			}

			internal void <Awake>b__65_22(ILContext il)
			{
				//IL_0002: Unknown result type (might be due to invalid IL or missing references)
				//IL_0008: Expected O, but got Unknown
				ILCursor val = new ILCursor(il);
				val.GotoNext(new Func<Instruction, bool>[1]
				{
					(Instruction x) => ILPatternMatchingExt.MatchCallOrCallvirt<NetworkUser>(x, "AwardLunarCoins")
				});
				val.EmitDelegate<Func<uint, uint>>((Func<uint, uint>)((uint orig) => (uint)(orig + (pissed ? SwordExtraLunar.Value : 0))));
			}

			internal bool <Awake>b__65_32(Instruction x)
			{
				return ILPatternMatchingExt.MatchCallOrCallvirt<NetworkUser>(x, "AwardLunarCoins");
			}

			internal uint <Awake>b__65_33(uint orig)
			{
				return (uint)(orig + (pissed ? SwordExtraLunar.Value : 0));
			}

			internal void <Awake>b__65_8(TeleporterInteraction tp)
			{
				//IL_009d: Unknown result type (might be due to invalid IL or missing references)
				//IL_00a2: Unknown result type (might be due to invalid IL or missing references)
				//IL_00ad: Unknown result type (might be due to invalid IL or missing references)
				//IL_00b8: Unknown result type (might be due to invalid IL or missing references)
				//IL_00ba: Unknown result type (might be due to invalid IL or missing references)
				//IL_00bf: 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_00d0: Unknown result type (might be due to invalid IL or missing references)
				//IL_00eb: Expected O, but got Unknown
				//IL_00e6: Unknown result type (might be due to invalid IL or missing references)
				//IL_00f0: Expected O, but got Unknown
				<>c__DisplayClass65_2 CS$<>8__locals0 = new <>c__DisplayClass65_2
				{
					isc = LegacyResourcesAPI.Load<SpawnCard>("SpawnCards/InteractableSpawnCard/iscVoidPortal")
				};
				if (StageCheck(10, loop: true) && !(tp.portalSpawners?.ToList()?.First((PortalSpawner x) => (Object)(object)x.portalSpawnCard == (Object)(object)CS$<>8__locals0.isc)?.willSpawn ?? true))
				{
					DirectorCore.instance.TrySpawnObject(new DirectorSpawnRequest(CS$<>8__locals0.isc, new DirectorPlacementRule
					{
						minDistance = 1f,
						maxDistance = 25f,
						placementMode = (PlacementMode)1,
						position = ((Component)tp).transform.position,
						spawnOnTarget = ((Component)tp).transform
					}, Run.instance.stageRng));
				}
			}

			internal void <Awake>b__65_9(Stage stage)
			{
				<>c__DisplayClass65_3 <>c__DisplayClass65_ = new <>c__DisplayClass65_3();
				if (stage.sceneDef.cachedName != "goldshores")
				{
					return;
				}
				GameObject val = GameObject.Find("HOLDER: Preplaced Goodies");
				if ((Object)(object)val == (Object)null)
				{
					return;
				}
				<>c__DisplayClass65_.chests = new List<GameObject>
				{
					((Component)val.transform.Find("Chest1 - 1")).gameObject,
					((Component)val.transform.Find("Chest1 - 2")).gameObject,
					((Component)val.transform.Find("Chest1 - 3")).gameObject,
					((Component)val.transform.Find("Chest1 - 4")).gameObject
				};
				List<GameObject> list = (from x in Object.FindObjectsOfType<GameObject>()
					where ((Object)x).name == "mdlChest1"
					select x).ToList();
				for (int num = 4; num > GoldenCoastChests.Value; num--)
				{
					<>c__DisplayClass65_4 CS$<>8__locals0 = new <>c__DisplayClass65_4();
					CS$<>8__locals0.CS$<>8__locals1 = <>c__DisplayClass65_;
					CS$<>8__locals0.toRemove = Run.instance.runRNG.RangeInt(0, CS$<>8__locals0.CS$<>8__locals1.chests.Count);
					CS$<>8__locals0.CS$<>8__locals1.chests[CS$<>8__locals0.toRemove].SetActive(false);
					GameObject? obj = list.Find(delegate(GameObject x)
					{
						//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_0029: Unknown result type (might be due to invalid IL or missing references)
						Vector3 position = x.transform.position;
						return ((Vector3)(ref position)).Equals(CS$<>8__locals0.CS$<>8__locals1.chests[CS$<>8__locals0.toRemove].transform.position);
					});
					if (obj != null)
					{
						obj.SetActive(false);
					}
					CS$<>8__locals0.CS$<>8__locals1.chests.RemoveAt(CS$<>8__locals0.toRemove);
				}
			}

			internal bool <Awake>b__65_35(GameObject x)
			{
				return ((Object)x).name == "mdlChest1";
			}

			internal void <Awake>b__65_12(SceneDirector dir)
			{
				if (SceneCatalog.mostRecentSceneDef.cachedName == "arena")
				{
					dir.interactableCredit = 0;
				}
			}

			internal string <PatchStageChances>b__66_0(string x)
			{
				return x.Trim();
			}

			internal string <PatchStageChances>b__66_2(string x)
			{
				return x.Trim();
			}

			internal string <PatchStageChances>b__66_3(string x)
			{
				return x.Trim();
			}

			internal void <HackSkeletonForceSpawn>b__67_0(Stage stage)
			{
				GameObject obj = GameObject.Find("HOLDER: Hidden Altar Stuff");
				object obj2;
				if (obj == null)
				{
					obj2 = null;
				}
				else
				{
					Transform transform = obj.transform;
					if (transform == null)
					{
						obj2 = null;
					}
					else
					{
						Transform obj3 = transform.Find("AltarCenter");
						if (obj3 == null)
						{
							obj2 = null;
						}
						else
						{
							Transform obj4 = obj3.Find("AltarSkeletonBody");
							obj2 = ((obj4 != null) ? ((Component)obj4).gameObject : null);
						}
					}
				}
				GameObject val = (GameObject)obj2;
				if ((Object)(object)val != (Object)null)
				{
					GameObjectUnlockableFilter component = val.GetComponent<GameObjectUnlockableFilter>();
					component.forbiddenUnlockable = "";
					component.forbiddenUnlockableDef = null;
					component.Networkactive = true;
					component.active = true;
					val.SetActive(true);
					Log.LogDebug((object)"*Bad to the Bone Riff*");
				}
			}

			internal void <HackSkeletonForceSpawn>b__67_1(DamageReport report)
			{
				//IL_003b: Unknown result type (might be due to invalid IL or missing references)
				//IL_0046: Unknown result type (might be due to invalid IL or missing references)
				//IL_005a: Unknown result type (might be due to invalid IL or missing references)
				object obj;
				if (report == null)
				{
					obj = null;
				}
				else
				{
					CharacterBody victimBody = report.victimBody;
					obj = ((victimBody != null) ? ((Object)victimBody).name : null);
				}
				if ((string?)obj == "AltarSkeletonBody")
				{
					PickupDropletController.CreatePickupDroplet(Run.instance.treasureRng.NextElementUniform<PickupIndex>(Run.instance.availableVoidTier2DropList), report.victimBody.corePosition, new Vector3(-15f, 13f, -20f));
				}
			}

			internal void <HandleHank>b__68_0(Stage _)
			{
				hanked = false;
			}

			internal ItemDef <HandleHank>b__68_2(ItemIndex x)
			{
				//IL_0000: Unknown result type (might be due to invalid IL or missing references)
				return ItemCatalog.GetItemDef(x);
			}

			internal EquipmentDef <HandleHank>b__68_4(EquipmentIndex x)
			{
				//IL_0000: Unknown result type (might be due to invalid IL or missing references)
				return EquipmentCatalog.GetEquipmentDef(x);
			}

			internal void <FHRadarScannerPatch>b__70_0(orig_GrantUnlock orig, RadiotowerTerminal self, Interactor interactor)
			{
				//IL_0037: Unknown result type (might be due to invalid IL or missing references)
				//IL_003c: Unknown result type (might be due to invalid IL or missing references)
				orig.Invoke(self, interactor);
				if (SceneCatalog.mostRecentSceneDef.cachedName == "forgottenhaven")
				{
					NetworkServer.Spawn(Object.Instantiate<GameObject>(LegacyResourcesAPI.Load<GameObject>("Prefabs/NetworkedObjects/ChestScanner"), ((Component)self).gameObject.transform.position, Quaternion.identity));
				}
			}
		}

		[CompilerGenerated]
		private sealed class <>c__DisplayClass65_2
		{
			public SpawnCard isc;

			internal bool <Awake>b__34(PortalSpawner x)
			{
				return (Object)(object)x.portalSpawnCard == (Object)(object)isc;
			}
		}

		[CompilerGenerated]
		private sealed class <>c__DisplayClass65_3
		{
			public List<GameObject> chests;
		}

		[CompilerGenerated]
		private sealed class <>c__DisplayClass65_4
		{
			public int toRemove;

			public <>c__DisplayClass65_3 CS$<>8__locals1;

			internal bool <Awake>b__36(GameObject x)
			{
				//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_0029: Unknown result type (might be due to invalid IL or missing references)
				Vector3 position = x.transform.position;
				return ((Vector3)(ref position)).Equals(CS$<>8__locals1.chests[toRemove].transform.position);
			}
		}

		public const string PluginGUID = "prodzpod.ConsistentStageFeatures";

		public const string PluginAuthor = "prodzpod";

		public const string PluginName = "ConsistentStageFeatures";

		public const string PluginVersion = "1.2.3";

		public const string softdepAetherium = "com.KomradeSpectre.Aetherium";

		public const string softdepBulwarksHaunt = "com.themysticsword.bulwarkshaunt";

		public const string softdepFogboundLagoon = "JaceDaDorito.FBLStage";

		public const string softdepForgottenRelics = "PlasmaCore.ForgottenRelics";

		public const string softdepShrineOfRepair = "com.Viliger.ShrineOfRepair";

		public const string softdepProperLoop = "prodzpod.ProperLoop";

		public static ManualLogSource Log;

		public static Harmony Harmony;

		public static PluginInfo pluginInfo;

		public static ConfigFile Config;

		public static ConfigEntry<string> TimescaleOverwrite;

		public static ConfigEntry<string> StageChances;

		public static ConfigEntry<int> MaxVoidSeeds;

		public static ConfigEntry<bool> GuaranteedNewt;

		public static ConfigEntry<bool> BuffBrazierOnStage1;

		public static ConfigEntry<int> BuffBrazierCost;

		public static ConfigEntry<bool> RemoveRandomBuffBrazier;

		public static ConfigEntry<bool> RedPrinterOnSiphoned;

		public static ConfigEntry<bool> GreenPrinterOnPlains;

		public static ConfigEntry<bool> YellowPrinterOnRoost;

		public static ConfigEntry<bool> LunarBudOnStage2;

		public static ConfigEntry<bool> RemoveRandomLunarBud;

		public static ConfigEntry<bool> AqueductButtonNoRelease;

		public static ConfigEntry<int> AqueductButtonMax;

		public static ConfigEntry<bool> NKuhanaVoidGreen;

		public static ConfigEntry<bool> GoldShrineOnStage3;

		public static ConfigEntry<bool> RemoveRandomGoldShrine;

		public static ConfigEntry<bool> SpecialChestOnPools;

		public static ConfigEntry<bool> HankOffersDrink;

		public static ConfigEntry<bool> SpicyHank;

		public static ConfigEntry<bool> IllegalHank;

		public static ConfigEntry<bool> REXOnStage4;

		public static ConfigEntry<bool> ShrineRepairOnStage5;

		public static ConfigEntry<bool> ScrapperOnStage5;

		public static ConfigEntry<bool> RemoveRandomShrineRepair;

		public static ConfigEntry<bool> SageShrineOnMeadow;

		public static ConfigEntry<bool> SageShrineOnSatellite;

		public static ConfigEntry<bool> RemoveRandomSageShrine;

		public static ConfigEntry<bool> BulwarkSwordOnSatellite;

		public static ConfigEntry<bool> ScrapperOnMoon;

		public static ConfigEntry<bool> RemoveRandomScrapper;

		public static ConfigEntry<bool> ObeliskOnMoon1;

		public static ConfigEntry<int> SwordExtraLunar;

		public static ConfigEntry<float> SwordHealth;

		public static ConfigEntry<float> SwordDamage;

		public static ConfigEntry<float> SwordSpeed;

		public static ConfigEntry<float> SwordArmor;

		public static ConfigEntry<float> SwordAttackSpeed;

		public static ConfigEntry<bool> FHTeleporterOnStage6;

		public static ConfigEntry<bool> RemoveRandomFHTeleporter;

		public static ConfigEntry<bool> VieldsOnStage7;

		public static ConfigEntry<bool> LocusOnStage10;

		public static ConfigEntry<int> GoldShrineCost;

		public static ConfigEntry<int> GoldenCoastChests;

		public static ConfigEntry<bool> GoldenCoastCombatShrine;

		public static ConfigEntry<bool> FHRadarScannerEffect;

		public static ConfigEntry<bool> HauntedWoodShrine;

		public static ConfigEntry<bool> VieldsNoLoot;

		public static bool hanked;

		public static bool pissed;

		private ConfigEntry<bool> MountainShrinesInSirens;

		public void Awake()
		{
			//IL_0017: Unknown result type (might be due to invalid IL or missing references)
			//IL_0021: Expected O, but got Unknown
			//IL_003c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0046: Expected O, but got Unknown
			//IL_067e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0683: Unknown result type (might be due to invalid IL or missing references)
			//IL_06bc: Unknown result type (might be due to invalid IL or missing references)
			//IL_06c1: Unknown result type (might be due to invalid IL or missing references)
			//IL_06c7: Expected O, but got Unknown
			//IL_0716: Unknown result type (might be due to invalid IL or missing references)
			//IL_072a: Unknown result type (might be due to invalid IL or missing references)
			//IL_075f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0773: Unknown result type (might be due to invalid IL or missing references)
			//IL_0797: Unknown result type (might be due to invalid IL or missing references)
			//IL_07ab: Unknown result type (might be due to invalid IL or missing references)
			//IL_07e1: Unknown result type (might be due to invalid IL or missing references)
			//IL_07f5: Unknown result type (might be due to invalid IL or missing references)
			//IL_0819: Unknown result type (might be due to invalid IL or missing references)
			//IL_082d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0866: Unknown result type (might be due to invalid IL or missing references)
			//IL_086d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0873: Unknown result type (might be due to invalid IL or missing references)
			//IL_0894: Unknown result type (might be due to invalid IL or missing references)
			//IL_089b: Unknown result type (might be due to invalid IL or missing references)
			//IL_08a1: Unknown result type (might be due to invalid IL or missing references)
			//IL_08c2: Unknown result type (might be due to invalid IL or missing references)
			//IL_08c9: Unknown result type (might be due to invalid IL or missing references)
			//IL_08cf: Unknown result type (might be due to invalid IL or missing references)
			//IL_0909: Unknown result type (might be due to invalid IL or missing references)
			//IL_0910: Unknown result type (might be due to invalid IL or missing references)
			//IL_0916: Unknown result type (might be due to invalid IL or missing references)
			//IL_0963: Unknown result type (might be due to invalid IL or missing references)
			//IL_0968: Unknown result type (might be due to invalid IL or missing references)
			//IL_096e: Expected O, but got Unknown
			//IL_0a41: Unknown result type (might be due to invalid IL or missing references)
			//IL_0a55: Unknown result type (might be due to invalid IL or missing references)
			//IL_0a79: Unknown result type (might be due to invalid IL or missing references)
			//IL_0a8d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0ab1: Unknown result type (might be due to invalid IL or missing references)
			//IL_0ac5: Unknown result type (might be due to invalid IL or missing references)
			//IL_0b23: Unknown result type (might be due to invalid IL or missing references)
			//IL_0b37: Unknown result type (might be due to invalid IL or missing references)
			//IL_0b58: Unknown result type (might be due to invalid IL or missing references)
			//IL_0b6c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0ba3: Unknown result type (might be due to invalid IL or missing references)
			//IL_0bb7: Unknown result type (might be due to invalid IL or missing references)
			//IL_0bdb: Unknown result type (might be due to invalid IL or missing references)
			//IL_0bef: Unknown result type (might be due to invalid IL or missing references)
			//IL_0cab: Unknown result type (might be due to invalid IL or missing references)
			//IL_0cbf: Unknown result type (might be due to invalid IL or missing references)
			//IL_0ce3: Unknown result type (might be due to invalid IL or missing references)
			//IL_0cf7: Unknown result type (might be due to invalid IL or missing references)
			//IL_0d7c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0d81: Unknown result type (might be due to invalid IL or missing references)
			//IL_0d92: Unknown result type (might be due to invalid IL or missing references)
			//IL_0d97: Unknown result type (might be due to invalid IL or missing references)
			//IL_0da8: Unknown result type (might be due to invalid IL or missing references)
			//IL_0dad: Unknown result type (might be due to invalid IL or missing references)
			//IL_0dbe: Unknown result type (might be due to invalid IL or missing references)
			//IL_0dc3: Unknown result type (might be due to invalid IL or missing references)
			//IL_0dd4: Unknown result type (might be due to invalid IL or missing references)
			//IL_0dd9: Unknown result type (might be due to invalid IL or missing references)
			//IL_0df7: Unknown result type (might be due to invalid IL or missing references)
			//IL_0dfc: Unknown result type (might be due to invalid IL or missing references)
			//IL_0e0d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0e12: Unknown result type (might be due to invalid IL or missing references)
			//IL_0e23: Unknown result type (might be due to invalid IL or missing references)
			//IL_0e28: Unknown result type (might be due to invalid IL or missing references)
			//IL_0e46: Unknown result type (might be due to invalid IL or missing references)
			//IL_0e4b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0e5c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0e61: Unknown result type (might be due to invalid IL or missing references)
			//IL_0e72: Unknown result type (might be due to invalid IL or missing references)
			//IL_0e77: Unknown result type (might be due to invalid IL or missing references)
			//IL_0e88: Unknown result type (might be due to invalid IL or missing references)
			//IL_0e8d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0e9e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0ea3: Unknown result type (might be due to invalid IL or missing references)
			//IL_0ec1: Unknown result type (might be due to invalid IL or missing references)
			//IL_0ec6: Unknown result type (might be due to invalid IL or missing references)
			//IL_0ed7: Unknown result type (might be due to invalid IL or missing references)
			//IL_0edc: Unknown result type (might be due to invalid IL or missing references)
			//IL_0eed: Unknown result type (might be due to invalid IL or missing references)
			//IL_0ef2: Unknown result type (might be due to invalid IL or missing references)
			//IL_0f03: Unknown result type (might be due to invalid IL or missing references)
			//IL_0f08: Unknown result type (might be due to invalid IL or missing references)
			//IL_0f1c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0f26: Expected O, but got Unknown
			//IL_0f2f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0f39: Expected O, but got Unknown
			//IL_103d: Unknown result type (might be due to invalid IL or missing references)
			//IL_1049: Unknown result type (might be due to invalid IL or missing references)
			//IL_1055: Unknown result type (might be due to invalid IL or missing references)
			//IL_1061: Unknown result type (might be due to invalid IL or missing references)
			//IL_0f73: Unknown result type (might be due to invalid IL or missing references)
			//IL_0f78: Unknown result type (might be due to invalid IL or missing references)
			//IL_0f7e: Expected O, but got Unknown
			//IL_0f98: Unknown result type (might be due to invalid IL or missing references)
			//IL_0f9d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0fa3: Expected O, but got Unknown
			//IL_1192: Unknown result type (might be due to invalid IL or missing references)
			//IL_11a6: Unknown result type (might be due to invalid IL or missing references)
			//IL_11ca: Unknown result type (might be due to invalid IL or missing references)
			//IL_11de: Unknown result type (might be due to invalid IL or missing references)
			//IL_1202: Unknown result type (might be due to invalid IL or missing references)
			//IL_1216: Unknown result type (might be due to invalid IL or missing references)
			//IL_123a: Unknown result type (might be due to invalid IL or missing references)
			//IL_1241: Unknown result type (might be due to invalid IL or missing references)
			//IL_1247: Unknown result type (might be due to invalid IL or missing references)
			pluginInfo = ((BaseUnityPlugin)this).Info;
			Harmony = new Harmony("prodzpod.ConsistentStageFeatures");
			Log = ((BaseUnityPlugin)this).Logger;
			Config = new ConfigFile(Path.Combine(Paths.ConfigPath, "prodzpod.ConsistentStageFeatures.cfg"), true);
			TimescaleOverwrite = Config.Bind<string>("General", "Timescale Unlocks", "forgottenhaven", "List of scenes and run time, separated by commas. By default, disables time stop for FH.");
			StageChances = Config.Bind<string>("General", "Stage Chances", "skymeadow - 3", "List of scenes and chance weight, separated by commas. by default makes sky meadow 3 times as likely so artifact grinding isnt godawful");
			MaxVoidSeeds = Config.Bind<int>("General", "Max Void Seeds", 1, "Number of Void Seeds that can be spawned at a single stage. Default is 3.");
			GuaranteedNewt = Config.Bind<bool>("General", "Guaranteed Newt Altar", true, "Guarantees 1 Newt shrine every stage.");
			BuffBrazierOnStage1 = Config.Bind<bool>("Stage 1", "Buff Brazier on Stage 1", true, "Guaranteed Buff Brazier on stage 1.");
			BuffBrazierCost = Config.Bind<int>("Stage 1", "Buff Brazier Cost", 50, "Buff brazier cost, scales with time.");
			RemoveRandomBuffBrazier = Config.Bind<bool>("Stage 1", "Remove Random Buff Brazier Spawns", true, "only the fixed spawn exists");
			RedPrinterOnSiphoned = Config.Bind<bool>("Stage 1", "Red Printer on Siphoned Forest", false, "make sure to balance printer before this");
			GreenPrinterOnPlains = Config.Bind<bool>("Stage 1", "Green Printer on Golem Plains", false, "make sure to balance printer before this");
			YellowPrinterOnRoost = Config.Bind<bool>("Stage 1", "Yellow Printer on Distant Roost", false, "make sure to balance printer before this");
			LunarBudOnStage2 = Config.Bind<bool>("Stage 2", "Lunar bud on Stage 2", true, "Guaranteed Lunar bud on stage 2.");
			RemoveRandomLunarBud = Config.Bind<bool>("Stage 2", "Remove Random Lunar Bud Spawns", false, "only the fixed spawn exists");
			AqueductButtonNoRelease = Config.Bind<bool>("Stage 2", "Abandoned Aqueduct Pressure Plate Stays Pressed", false, "set to true when you're using difficulty mods, for solo players");
			AqueductButtonMax = Config.Bind<int>("Stage 2", "Abandoned Aqueduct Pressure Plate Max Buttons", 2, "max: 8");
			NKuhanaVoidGreen = Config.Bind<bool>("Stage 2", "N`kuhana Skeleton Drops Void Green", true, "i think you deserve it for going through Wetland Aspect");
			GoldShrineOnStage3 = Config.Bind<bool>("Stage 3", "Altar of Gold on Stage 3", true, "Guaranteed Altar of Gold on stage 3.");
			RemoveRandomGoldShrine = Config.Bind<bool>("Stage 3", "Remove Random Altar of Gold Spawns", false, "only the fixed spawn exists");
			SpecialChestOnPools = Config.Bind<bool>("Stage 3", "Special Chests on Sulfur Pools", true, "Spawns 3 Cloaked Chests and 3 Lockboxes (1 of which will be encrusted if player has void, encrusted nerf kinda)");
			HankOffersDrink = Config.Bind<bool>("Stage 3", "Hank Offers Drink", true, "Talking to Hank will result in a random drink.");
			SpicyHank = Config.Bind<bool>("Stage 3", "GALSONE", false, "Hank offers GALSONE (per multiple requests)");
			IllegalHank = Config.Bind<bool>("Stage 3", "Hank doesnt care for laws", false, "Hank will bypass ContentDisabler and the likes");
			REXOnStage4 = Config.Bind<bool>("Stage 4", "REX on Stage 4", true, "Guaranteed Fuel Array usage");
			MountainShrinesInSirens = Config.Bind<bool>("Stage 4", "Mountain Shrines on Siren`s Call", true, "lol");
			ShrineRepairOnStage5 = Config.Bind<bool>("Stage 5", "Shrine of Repair on Stage 5", true, "Guaranteed Shrine of Repair on stage 5.");
			ScrapperOnStage5 = Config.Bind<bool>("Stage 5", "Scrapper on Stage 5", false, "Guaranteed Scrapper on stage 5.");
			RemoveRandomShrineRepair = Config.Bind<bool>("Stage 5", "Remove Random Shrine of Repair Spawns", false, "only the fixed spawn exists");
			SageShrineOnMeadow = Config.Bind<bool>("Stage 5", "Sage`s Shrine on Sky Meadow", false, "shmrez is weird fr fr");
			SageShrineOnSatellite = Config.Bind<bool>("Stage 5", "Sage`s Shrine on Slumbering Satellite", true, "makes it fixed");
			RemoveRandomSageShrine = Config.Bind<bool>("Stage 5", "Remove Random Sage`s Shrine Spawns", true, "only the fixed spawn exists");
			BulwarkSwordOnSatellite = Config.Bind<bool>("Stage 5", "Bulwark Sword on Slumbering Satellite", true, "haunted is no longer rng");
			ScrapperOnMoon = Config.Bind<bool>("Commencement", "Scrapper on Moon", false, "Scrapper on the Moon. Use it if you have scrappers rebalanced.");
			RemoveRandomScrapper = Config.Bind<bool>("Commencement", "Remove Random Scrapper Spawns", false, "only the fixed spawn exists");
			SwordExtraLunar = Config.Bind<int>("Commencement", "Extra Lunar Coin with Crystalline Blade", 10, "Extra lunar coin reward for winning with the Crystalline Blade.");
			SwordHealth = Config.Bind<float>("Commencement", "Mithrix Health Multiplier with Crystalline Blade", 0f, "Stat buffs for Mithrix with Crystalline Blade. Multiplicative.");
			SwordDamage = Config.Bind<float>("Commencement", "Mithrix Damage Multiplier with Crystalline Blade", 0f, "Stat buffs for Mithrix with Crystalline Blade. Multiplicative.");
			SwordSpeed = Config.Bind<float>("Commencement", "Mithrix Speed Bonus with Crystalline Blade", 0.2f, "Stat buffs for Mithrix with Crystalline Blade. Multiplicative.");
			SwordArmor = Config.Bind<float>("Commencement", "Mithrix Armor Bonus with Crystalline Blade", 0f, "Stat buffs for Mithrix with Crystalline Blade. Multiplicative.");
			SwordAttackSpeed = Config.Bind<float>("Commencement", "Mithrix Attack Speed Multiplier with Crystalline Blade", 0.2f, "Stat buffs for Mithrix with Crystalline Blade. Multiplicative.");
			FHTeleporterOnStage6 = Config.Bind<bool>("Looping", "Shattered Teleporter on Stage 6", true, "Guaranteed Shattered Teleporters on stage 6.");
			RemoveRandomFHTeleporter = Config.Bind<bool>("Looping", "Remove Random Shattered Teleporter Spawns", false, "only the fixed spawn exists");
			VieldsOnStage7 = Config.Bind<bool>("Looping", "Null Portal on Stage 7", false, "Guaranteed Null Portal on stage 7.");
			LocusOnStage10 = Config.Bind<bool>("Looping", "Void Portal on Stage 10", true, "Guaranteed Void Portal on stage 10.");
			GoldShrineCost = Config.Bind<int>("Hidden Realm", "Altar of Gold Cost", 100, "Scales with time, vanilla is 200 (8 chests)");
			GoldenCoastChests = Config.Bind<int>("Hidden Realm", "Altar of Gold Chests", 2, "Max: 4");
			GoldenCoastCombatShrine = Config.Bind<bool>("Hidden Realm", "Guaranteed Combat Shrines in Golden Coast", true, "money printer");
			FHRadarScannerEffect = Config.Bind<bool>("Hidden Realm", "Forgotten Haven Log and Cell Radar Scanner effect", true, "The purchasable logbook entry & putting in cells in the central portal triggers a Radar Scanner effect around it.");
			HauntedWoodShrine = Config.Bind<bool>("Hidden Realm", "Shrine of the Woods on Bulwark`s Haunt", true, "No regen?");
			VieldsNoLoot = Config.Bind<bool>("Hidden Realm", "Void Fields No Chests", true, "It already gives 9 items including a red bruh");
			RoR2Application.onLoad = (Action)Delegate.Combine(RoR2Application.onLoad, new Action(PatchStageChances));
			if (MaxVoidSeeds.Value != 3)
			{
				Addressables.LoadAssetAsync<InteractableSpawnCard>((object)"RoR2/DLC1/VoidCamp/iscVoidCamp.asset").WaitForCompletion().maxSpawnsPerStage = MaxVoidSeeds.Value;
			}
			if (GuaranteedNewt.Value)
			{
				object obj = <>c.<>9__65_0;
				if (obj == null)
				{
					hook_Awake val = delegate(orig_Awake orig, SceneObjectToggleGroup self)
					{
						//IL_0023: Unknown result type (might be due to invalid IL or missing references)
						//IL_0028: Unknown result type (might be due to invalid IL or missing references)
						//IL_00df: Unknown result type (might be due to invalid IL or missing references)
						//IL_00e0: Unknown result type (might be due to invalid IL or missing references)
						if (self.toggleGroups.Length != 0)
						{
							GameObjectToggleGroup val9 = self.toggleGroups[self.toggleGroups.Length - 1];
							if (SceneCatalog.mostRecentSceneDef.cachedName == "frozenwall")
							{
								ref GameObject[] objects = ref val9.objects;
								GameObject gameObject = ((Component)GameObject.Find("HOLDER: Preplaced Objects").transform.Find("NewtStatue, Guaranteed")).gameObject;
								ArrayUtils.ArrayAppend<GameObject>(ref objects, ref gameObject);
							}
							if (SceneCatalog.mostRecentSceneDef.cachedName == "blackbeach")
							{
								val9.minEnabled = 1;
							}
							if (SceneCatalog.mostRecentSceneDef.cachedName == "goolake")
							{
								val9.maxEnabled = AqueductButtonMax.Value;
								val9.minEnabled = AqueductButtonMax.Value;
							}
							self.toggleGroups[self.toggleGroups.Length - 1] = val9;
						}
						orig.Invoke(self);
					};
					<>c.<>9__65_0 = val;
					obj = (object)val;
				}
				SceneObjectToggleGroup.Awake += (hook_Awake)obj;
			}
			if (Mods("com.KomradeSpectre.Aetherium"))
			{
				checkBuffBrazier();
			}
			if (RedPrinterOnSiphoned.Value)
			{
				SpawnGuaranteed("snowyforest", "SpawnCards/InteractableSpawnCard/iscDuplicatorMilitary", new Vector3(-65.7508f, 80.6369f, -186.9797f), new Vector3(5.6833f, 33.3465f, 2.9875f));
			}
			if (GreenPrinterOnPlains.Value)
			{
				SpawnGuaranteed("golemplains", "SpawnCards/InteractableSpawnCard/iscDuplicatorLarge", new Vector3(-196.3943f, -138.4122f, 39.6045f), new Vector3(17.3021f, 93.9709f, 347.3439f));
				SpawnGuaranteed("golemplains2", "SpawnCards/InteractableSpawnCard/iscDuplicatorLarge", new Vector3(-217.0215f, 40.3993f, -29.7606f), new Vector3(25.4828f, 230.3522f, 347.7884f));
			}
			if (YellowPrinterOnRoost.Value)
			{
				SpawnGuaranteed("blackbeach", "SpawnCards/InteractableSpawnCard/iscDuplicatorWild", new Vector3(203.9892f, -122.2774f, -105.9803f), new Vector3(45.3964f, 71.6722f, 7.0832f));
				SpawnGuaranteed("blackbeach2", "SpawnCards/InteractableSpawnCard/iscDuplicatorWild", new Vector3(-137.3705f, 46.7941f, -97.3107f), new Vector3(15.839f, 115.0119f, 10.6805f));
			}
			if (LunarBudOnStage2.Value)
			{
				SpawnGuaranteed("goolake", "SpawnCards/InteractableSpawnCard/iscLunarChest", new Vector3(285.1561f, -62.09442f, -193.2947f));
				SpawnGuaranteed("ancientloft", "SpawnCards/InteractableSpawnCard/iscLunarChest", new Vector3(-70.1913f, 80.87519f, 221.0971f));
				SpawnGuaranteed("foggyswamp", "SpawnCards/InteractableSpawnCard/iscLunarChest", new Vector3(-121.8996f, -126.0044f, -235.4447f));
				if (Mods("PlasmaCore.ForgottenRelics"))
				{
					SpawnGuaranteed("drybasin", "SpawnCards/InteractableSpawnCard/iscLunarChest", new Vector3(-228.2513f, 75.6862f, -86.5036f));
				}
			}
			if (RemoveRandomLunarBud.Value)
			{
				LegacyResourcesAPI.Load<InteractableSpawnCard>("SpawnCards/InteractableSpawnCard/iscLunarChest").maxSpawnsPerStage = 0;
			}
			if (AqueductButtonNoRelease.Value)
			{
				object obj2 = <>c.<>9__65_2;
				if (obj2 == null)
				{
					hook_SetSwitch val2 = delegate(orig_SetSwitch orig, PressurePlateController self, bool input)
					{
						if (input)
						{
							orig.Invoke(self, input);
						}
					};
					<>c.<>9__65_2 = val2;
					obj2 = (object)val2;
				}
				PressurePlateController.SetSwitch += (hook_SetSwitch)obj2;
			}
			if (AqueductButtonMax.Value != 2)
			{
				Stage.onStageStartGlobal += delegate(Stage stage)
				{
					if (stage.sceneDef.cachedName == "goolake")
					{
						((Component)GameObject.Find("HOLDER: Secret Ring Area Content").transform.Find("Entrance").Find("GLRuinGate")).GetComponent<Counter>().threshold = AqueductButtonMax.Value;
					}
				};
			}
			if (NKuhanaVoidGreen.Value)
			{
				HackSkeletonForceSpawn();
			}
			if (GoldShrineOnStage3.Value)
			{
				LegacyResourcesAPI.Load<InteractableSpawnCard>("SpawnCards/InteractableSpawnCard/iscShrineGoldshoresAccess").maxSpawnsPerStage = 1;
				SpawnRandomly(3, "SpawnCards/InteractableSpawnCard/iscShrineGoldshoresAccess", loop: true);
			}
			if (RemoveRandomGoldShrine.Value)
			{
				LegacyResourcesAPI.Load<InteractableSpawnCard>("SpawnCards/InteractableSpawnCard/iscShrineGoldshoresAccess").maxSpawnsPerStage = 0;
			}
			if (SpecialChestOnPools.Value)
			{
				SpawnGuaranteed("sulfurpools", "SpawnCards/InteractableSpawnCard/iscChest1Stealthed", new Vector3(-0.1489f, -11.2628f, -58.985f), new Vector3(332.4133f, 147.7081f, 333.2504f));
				SpawnGuaranteed("sulfurpools", "SpawnCards/InteractableSpawnCard/iscLockbox", new Vector3(22.7433f, -5.3875f, -236.629f), new Vector3(20.4497f, 16.1306f, 5.5421f));
				SpawnGuaranteed("sulfurpools", "SpawnCards/InteractableSpawnCard/iscLockbox", new Vector3(-160.0294f, 7.244f, 122.3465f), new Vector3(27.0561f, 87.8281f, 352.8062f));
			}
			if (Mods("JaceDaDorito.FBLStage"))
			{
				HandleHank();
			}
			if (REXOnStage4.Value)
			{
				GameObject obj3 = LegacyResourcesAPI.Load<GameObject>("Prefabs/NetworkedObjects/TreebotUnlockInteractable");
				SpawnGuaranteed("rootjungle", obj3, new Vector3(-134.6807f, 76.389f, -240.2231f), new Vector3(19.8134f, 35.7062f, 2.9408f));
				SpawnGuaranteed("shipgraveyard", obj3, new Vector3(188.8096f, 95.1875f, -93.8135f), new Vector3(349.2507f, 204.2245f, 8.077f));
			}
			if (MountainShrinesInSirens.Value)
			{
				SpawnGuaranteed("shipgraveyard", "SpawnCards/InteractableSpawnCard/iscShrineBoss", new Vector3(-112.4888f, -28.4255f, -24.0116f), new Vector3(4.9546f, 195.4476f, 5.7509f));
				SpawnGuaranteed("shipgraveyard", "SpawnCards/InteractableSpawnCard/iscShrineBoss", new Vector3(-90.4575f, -30.8145f, -52.1998f), new Vector3(353.2658f, 286.8359f, 352.891f));
			}
			if (Mods("com.Viliger.ShrineOfRepair"))
			{
				HandleShrineOfRepair();
			}
			if (ScrapperOnStage5.Value)
			{
				SpawnRandomly(5, "SpawnCards/InteractableSpawnCard/iscScrapper", loop: true);
			}
			if (Mods("PlasmaCore.ForgottenRelics"))
			{
				checkSageShrine();
			}
			if (Mods("PlasmaCore.ForgottenRelics", "com.themysticsword.bulwarkshaunt"))
			{
				checkBulwark();
			}
			if (ScrapperOnMoon.Value)
			{
				SpawnGuaranteed("moon", "SpawnCards/InteractableSpawnCard/iscScrapper", new Vector3(804.2821f, 287.1601f, 214.5148f), new Vector3(351.5653f, 249.8895f, 10.3f));
				SpawnGuaranteed("moon2", "SpawnCards/InteractableSpawnCard/iscScrapper", new Vector3(17.2254f, -190.6997f, -307.0245f), new Vector3(1.2947f, 87.988f, 16.1012f));
			}
			if (RemoveRandomScrapper.Value)
			{
				LegacyResourcesAPI.Load<InteractableSpawnCard>("SpawnCards/InteractableSpawnCard/iscScrapper").maxSpawnsPerStage = 0;
			}
			if (Chainloader.PluginInfos.ContainsKey("com.themysticsword.bulwarkshaunt"))
			{
				Stage.onStageStartGlobal += delegate(Stage stage)
				{
					if (stage.sceneDef.cachedName == "moon2")
					{
						foreach (NetworkUser instances in NetworkUser.instancesList)
						{
							if (instances.master.inventory.GetItemCount(Items.BulwarksHaunt_Sword) > 0 || instances.master.inventory.GetItemCount(Items.BulwarksHaunt_SwordUnleashed) > 0)
							{
								((Component)GameObject.Find("HOLDER: Gameplay Space").transform.Find("HOLDER: STATIC MESH").Find("Quadrant 5: Blood Arena").Find("Arena Weapons")
									.Find("mdlBrotherSword (3)")).gameObject.SetActive(false);
							}
						}
					}
				};
				SpeechInfo[] seeSword = (SpeechInfo[])(object)new SpeechInfo[5]
				{
					see("sword_1", "The blade..."),
					see("sword_2", "Brother...?"),
					see("sword_3", "You ask for death."),
					see("sword_4", "That was your last mistake."),
					see("sword_5", "You are not him.")
				};
				SpeechInfo[] seeSwordHeretic = (SpeechInfo[])(object)new SpeechInfo[3]
				{
					see("sword_heretic_1", "You survived."),
					see("sword_heretic_2", "The job will be finished."),
					see("sword_heretic_3", "Nowhere to run, Heretic.")
				};
				SpeechInfo[] killSword = (SpeechInfo[])(object)new SpeechInfo[5]
				{
					kill("sword_1", "You are unworthy."),
					kill("sword_2", "You are not him."),
					kill("sword_3", "Arrogant vermin."),
					kill("sword_4", "Nothing but forgery."),
					kill("sword_5", "Your tantrum ends here.")
				};
				SpeechInfo[] killSwordHurt = (SpeechInfo[])(object)new SpeechInfo[4]
				{
					kill("sword_hurt_1", "THIS IS HOW YOU WIELD."),
					kill("sword_hurt_2", "INFERIOR."),
					kill("sword_hurt_3", "THIS IS NOT YOURS."),
					kill("sword_hurt_4", "NEVER DARE AGAIN.")
				};
				BrotherSpeechDriver.DoInitialSightResponse += (Manipulator)delegate(ILContext il)
				{
					//IL_0002: Unknown result type (might be due to invalid IL or missing references)
					//IL_0008: Expected O, but got Unknown
					//IL_0038: Unknown result type (might be due to invalid IL or missing references)
					ILCursor val8 = new ILCursor(il);
					val8.GotoNext(new Func<Instruction, bool>[1]
					{
						(Instruction x) => ILPatternMatchingExt.MatchCallOrCallvirt<BrotherSpeechDriver>(x, "SendReponseFromPool")
					});
					val8.Emit(OpCodes.Ldarg_0);
					val8.EmitDelegate<Func<SpeechInfo[], BrotherSpeechDriver, SpeechInfo[]>>((Func<SpeechInfo[], BrotherSpeechDriver, SpeechInfo[]>)delegate(SpeechInfo[] orig, BrotherSpeechDriver self)
					{
						bool flag4 = CharacterBody.readOnlyInstancesList.Any((CharacterBody x) => x.bodyIndex == BrotherSpeechDriver.hereticBodyIndex);
						return (CharacterBody.readOnlyInstancesList.Any((CharacterBody x) => x.inventory.GetItemCount(Items.BulwarksHaunt_Sword) > 0 || x.inventory.GetItemCount(Items.BulwarksHaunt_SwordUnleashed) > 0) && !((Object)self).name.StartsWith("BrotherHurt")) ? (flag4 ? seeSwordHeretic : seeSword) : orig;
					});
				};
				BrotherSpeechDriver.OnBodyKill += (Manipulator)delegate(ILContext il)
				{
					//IL_0002: Unknown result type (might be due to invalid IL or missing references)
					//IL_0008: Expected O, but got Unknown
					//IL_0038: Unknown result type (might be due to invalid IL or missing references)
					ILCursor val7 = new ILCursor(il);
					val7.GotoNext(new Func<Instruction, bool>[1]
					{
						(Instruction x) => ILPatternMatchingExt.MatchCallOrCallvirt<BrotherSpeechDriver>(x, "SendReponseFromPool")
					});
					val7.Emit(OpCodes.Ldarg_0);
					val7.EmitDelegate<Func<SpeechInfo[], BrotherSpeechDriver, SpeechInfo[]>>((Func<SpeechInfo[], BrotherSpeechDriver, SpeechInfo[]>)delegate(SpeechInfo[] orig, BrotherSpeechDriver self)
					{
						bool flag2 = CharacterBody.readOnlyInstancesList.Any((CharacterBody x) => x.bodyIndex == BrotherSpeechDriver.hereticBodyIndex);
						bool flag3 = CharacterBody.readOnlyInstancesList.Any((CharacterBody x) => x.inventory.GetItemCount(Items.BulwarksHaunt_Sword) > 0 || x.inventory.GetItemCount(Items.BulwarksHaunt_SwordUnleashed) > 0);
						if (flag2)
						{
							return orig;
						}
						return flag3 ? (((Object)self).name.StartsWith("BrotherHurt") ? killSwordHurt : killSword) : orig;
					});
				};
				Stage.onStageStartGlobal += delegate
				{
					pissed = false;
				};
				object obj4 = <>c.<>9__65_21;
				if (obj4 == null)
				{
					hook_BeginEncounter val3 = delegate(orig_BeginEncounter orig, ScriptedCombatEncounter self)
					{
						orig.Invoke(self);
						if (SceneCatalog.mostRecentSceneDef.cachedName.StartsWith("moon"))
						{
							bool flag = CharacterBody.readOnlyInstancesList.Any((CharacterBody x) => x.inventory.GetItemCount(Items.BulwarksHaunt_Sword) > 0 || x.inventory.GetItemCount(Items.BulwarksHaunt_SwordUnleashed) > 0);
							pissed |= flag;
							if (pissed)
							{
								foreach (CharacterMaster members in self.combatSquad.membersList)
								{
									CharacterBody body = members.GetBody();
									body.baseMaxHealth *= 1f + SwordHealth.Value;
									body.levelMaxHealth *= 1f + SwordHealth.Value;
									body.baseDamage *= 1f + SwordDamage.Value;
									body.levelDamage *= 1f + SwordDamage.Value;
									body.baseMoveSpeed *= 1f + SwordSpeed.Value;
									body.levelMoveSpeed *= 1f + SwordSpeed.Value;
									body.baseArmor *= 1f + SwordArmor.Value;
									body.levelArmor *= 1f + SwordArmor.Value;
									body.baseAttackSpeed *= 1f + SwordAttackSpeed.Value;
									body.levelAttackSpeed *= 1f + SwordAttackSpeed.Value;
								}
							}
						}
					};
					<>c.<>9__65_21 = val3;
					obj4 = (object)val3;
				}
				ScriptedCombatEncounter.BeginEncounter += (hook_BeginEncounter)obj4;
				object obj5 = <>c.<>9__65_22;
				if (obj5 == null)
				{
					Manipulator val4 = delegate(ILContext il)
					{
						//IL_0002: Unknown result type (might be due to invalid IL or missing references)
						//IL_0008: Expected O, but got Unknown
						ILCursor val6 = new ILCursor(il);
						val6.GotoNext(new Func<Instruction, bool>[1]
						{
							(Instruction x) => ILPatternMatchingExt.MatchCallOrCallvirt<NetworkUser>(x, "AwardLunarCoins")
						});
						val6.EmitDelegate<Func<uint, uint>>((Func<uint, uint>)((uint orig) => (uint)(orig + (pissed ? SwordExtraLunar.Value : 0))));
					};
					<>c.<>9__65_22 = val4;
					obj5 = (object)val4;
				}
				Run.BeginGameOver += (Manipulator)obj5;
			}
			if (Mods("PlasmaCore.ForgottenRelics"))
			{
				checkTeleporter();
			}
			if (Mods("PlasmaCore.ForgottenRelics"))
			{
				Harmony.PatchAll(typeof(PatchFRInteractables));
			}
			InteractableSpawnCard iscNullPortal = ScriptableObject.CreateInstance<InteractableSpawnCard>();
			((Object)iscNullPortal).name = "iscSpecialVoidFieldPortal";
			((SpawnCard)iscNullPortal).prefab = LegacyResourcesAPI.Load<GameObject>("Prefabs/NetworkedObjects/PortalArena");
			((SpawnCard)iscNullPortal).sendOverNetwork = true;
			((SpawnCard)iscNullPortal).hullSize = (HullClassification)1;
			((SpawnCard)iscNullPortal).nodeGraphType = (GraphType)0;
			((SpawnCard)iscNullPortal).requiredFlags = (NodeFlags)0;
			((SpawnCard)iscNullPortal).forbiddenFlags = (NodeFlags)0;
			((SpawnCard)iscNullPortal).directorCreditCost = 999999;
			((SpawnCard)iscNullPortal).occupyPosition = true;
			iscNullPortal.orientToFloor = false;
			iscNullPortal.skipSpawnWhenSacrificeArtifactEnabled = false;
			iscNullPortal.maxSpawnsPerStage = 0;
			if (VieldsOnStage7.Value)
			{
				TeleporterInteraction.onTeleporterChargedGlobal += delegate(TeleporterInteraction tp)
				{
					//IL_0017: Unknown result type (might be due to invalid IL or missing references)
					//IL_001c: Unknown result type (might be due to invalid IL or missing references)
					//IL_0027: 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_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_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_004a: Unknown result type (might be due to invalid IL or missing references)
					//IL_0065: Expected O, but got Unknown
					//IL_0060: Unknown result type (might be due to invalid IL or missing references)
					//IL_006a: Expected O, but got Unknown
					if (StageCheck(7, loop: true))
					{
						DirectorCore.instance.TrySpawnObject(new DirectorSpawnRequest((SpawnCard)(object)iscNullPortal, new DirectorPlacementRule
						{
							minDistance = 1f,
							maxDistance = 25f,
							placementMode = (PlacementMode)1,
							position = ((Component)tp).transform.position,
							spawnOnTarget = ((Component)tp).transform
						}, Run.instance.stageRng));
					}
				};
			}
			if (LocusOnStage10.Value)
			{
				TeleporterInteraction.onTeleporterChargedGlobal += delegate(TeleporterInteraction tp)
				{
					//IL_009d: Unknown result type (might be due to invalid IL or missing references)
					//IL_00a2: Unknown result type (might be due to invalid IL or missing references)
					//IL_00ad: Unknown result type (might be due to invalid IL or missing references)
					//IL_00b8: Unknown result type (might be due to invalid IL or missing references)
					//IL_00ba: Unknown result type (might be due to invalid IL or missing references)
					//IL_00bf: 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_00d0: Unknown result type (might be due to invalid IL or missing references)
					//IL_00eb: Expected O, but got Unknown
					//IL_00e6: Unknown result type (might be due to invalid IL or missing references)
					//IL_00f0: Expected O, but got Unknown
					SpawnCard isc = LegacyResourcesAPI.Load<SpawnCard>("SpawnCards/InteractableSpawnCard/iscVoidPortal");
					if (StageCheck(10, loop: true) && !(tp.portalSpawners?.ToList()?.First((PortalSpawner x) => (Object)(object)x.portalSpawnCard == (Object)(object)isc)?.willSpawn ?? true))
					{
						DirectorCore.instance.TrySpawnObject(new DirectorSpawnRequest(isc, new DirectorPlacementRule
						{
							minDistance = 1f,
							maxDistance = 25f,
							placementMode = (PlacementMode)1,
							position = ((Component)tp).transform.position,
							spawnOnTarget = ((Component)tp).transform
						}, Run.instance.stageRng));
					}
				};
			}
			if (GoldShrineCost.Value != 200)
			{
				LegacyResourcesAPI.Load<GameObject>("Prefabs/NetworkedObjects/Shrines/ShrineGoldshoresAccess").GetComponent<PurchaseInteraction>().cost = 100;
			}
			if (GoldenCoastChests.Value < 4)
			{
				Stage.onStageStartGlobal += delegate(Stage stage)
				{
					if (!(stage.sceneDef.cachedName != "goldshores"))
					{
						GameObject val5 = GameObject.Find("HOLDER: Preplaced Goodies");
						if (!((Object)(object)val5 == (Object)null))
						{
							List<GameObject> chests = new List<GameObject>
							{
								((Component)val5.transform.Find("Chest1 - 1")).gameObject,
								((Component)val5.transform.Find("Chest1 - 2")).gameObject,
								((Component)val5.transform.Find("Chest1 - 3")).gameObject,
								((Component)val5.transform.Find("Chest1 - 4")).gameObject
							};
							List<GameObject> list = (from x in Object.FindObjectsOfType<GameObject>()
								where ((Object)x).name == "mdlChest1"
								select x).ToList();
							for (int num = 4; num > GoldenCoastChests.Value; num--)
							{
								int toRemove = Run.instance.runRNG.RangeInt(0, chests.Count);
								chests[toRemove].SetActive(false);
								GameObject? obj6 = list.Find(delegate(GameObject x)
								{
									//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_0029: Unknown result type (might be due to invalid IL or missing references)
									Vector3 position = x.transform.position;
									return ((Vector3)(ref position)).Equals(chests[toRemove].transform.position);
								});
								if (obj6 != null)
								{
									obj6.SetActive(false);
								}
								chests.RemoveAt(toRemove);
							}
						}
					}
				};
			}
			if (GoldenCoastCombatShrine.Value)
			{
				SpawnGuaranteed("goldshores", "SpawnCards/InteractableSpawnCard/iscShrineCombat", new Vector3(-73.98104f, -6.325237f, 82.57056f), new Vector3(0f, 200.0384f, 0f));
				SpawnGuaranteed("goldshores", "SpawnCards/InteractableSpawnCard/iscShrineCombat", new Vector3(75.62061f, -8.77954f, 116.1982f), new Vector3(0f, 281.339f, 0f));
				SpawnGuaranteed("goldshores", "SpawnCards/InteractableSpawnCard/iscShrineCombat", new Vector3(-5.5166f, -9.3453f, -60.1567f), new Vector3(0f, 338.058f, 0f));
				SpawnGuaranteed("goldshores", "SpawnCards/InteractableSpawnCard/iscShrineBlood", new Vector3(-9.266755f, 69.01228f, -66.08608f));
			}
			if (Mods("PlasmaCore.ForgottenRelics"))
			{
				checkRadar();
			}
			if (Mods("com.themysticsword.bulwarkshaunt"))
			{
				checkWoods();
			}
			if (!VieldsNoLoot.Value)
			{
				return;
			}
			SceneDirector.onPrePopulateSceneServer += delegate(SceneDirector dir)
			{
				if (SceneCatalog.mostRecentSceneDef.cachedName == "arena")
				{
					dir.interactableCredit = 0;
				}
			};
			static void checkBuffBrazier()
			{
				if (!((Object)(object)BuffBrazier.InteractableSpawnCard == (Object)null))
				{
					if (BuffBrazierCost.Value != 25)
					{
						BuffBrazier.InteractableBodyModelPrefab.GetComponent<PurchaseInteraction>().cost = BuffBrazierCost.Value;
					}
					if (BuffBrazierOnStage1.Value)
					{
						SpawnRandomly(1, (SpawnCard)(object)BuffBrazier.InteractableSpawnCard);
					}
					if (RemoveRandomBuffBrazier.Value)
					{
						BuffBrazier.InteractableSpawnCard.maxSpawnsPerStage = 0;
					}
				}
			}
			static void checkBulwark()
			{
				//IL_0038: Unknown result type (might be due to invalid IL or missing references)
				//IL_004c: Unknown result type (might be due to invalid IL or missing references)
				if (!VF2ConfigManager.disableSlumberingSatellite.Value)
				{
					if (BulwarkSwordOnSatellite.Value)
					{
						SpawnGuaranteed("slumberingsatellite", Sword.swordObjPrefab, new Vector3(-157.3885f, 69.9324f, 154.4549f), new Vector3(344.073f, 60.7323f, 1.596f));
					}
					Stage.onStageStartGlobal += delegate(Stage stage)
					{
						if (stage.sceneDef.cachedName == "slumberingsatellite")
						{
							((Component)GameObject.Find("World").transform.Find("Gated Areas").Find("GateGround4")).gameObject.SetActive(true);
							((Component)GameObject.Find("World").transform.Find("Gated Areas").Find("GateGround5")).gameObject.SetActive(true);
						}
					};
				}
			}
			static void checkRadar()
			{
				if (!VF2ConfigManager.disableForgottenHaven.Value && FHRadarScannerEffect.Value)
				{
					FHRadarScannerPatch();
				}
			}
			static void checkSageShrine()
			{
				//IL_003b: Unknown result type (might be due to invalid IL or missing references)
				//IL_004f: Unknown result type (might be due to invalid IL or missing references)
				//IL_0081: 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 (!VF2ConfigManager.disableSagesShrine.Value)
				{
					if (SageShrineOnMeadow.Value)
					{
						SpawnGuaranteed("skymeadow", (SpawnCard)(object)VF2ContentPackProvider.iscSagesShrine, new Vector3(-146.0359f, 144.0454f, 181.8587f), new Vector3(322.3633f, 139.1794f, 21.4546f));
					}
					if (SageShrineOnSatellite.Value)
					{
						SpawnGuaranteed("slumberingsatellite", (SpawnCard)(object)VF2ContentPackProvider.iscSagesShrine, new Vector3(70.5048f, 108.5265f, -323.2408f), new Vector3(11.9998f, 144.8941f, 337.7272f));
					}
					Stage.onStageStartGlobal += delegate(Stage stage)
					{
						if (stage.sceneDef.cachedName == "slumberingsatellite")
						{
							((Component)GameObject.Find("World").transform.Find("Gated Areas").Find("GateGround0")).gameObject.SetActive(true);
						}
					};
				}
			}
			static void checkTeleporter()
			{
				if (!VF2ConfigManager.disableForgottenHaven.Value && FHTeleporterOnStage6.Value)
				{
					SpawnRandomly(6, (SpawnCard)(object)VF2ContentPackProvider.iscLooseRelic, loop: true);
					SpawnRandomly(6, (SpawnCard)(object)VF2ContentPackProvider.iscShatteredTeleporter, loop: true);
				}
			}
			static void checkWoods()
			{
				//IL_0028: Unknown result type (might be due to invalid IL or missing references)
				//IL_003c: Unknown result type (might be due to invalid IL or missing references)
				if (HauntedWoodShrine.Value)
				{
					SpawnGuaranteed("BulwarksHaunt_GhostWave", "SpawnCards/InteractableSpawnCard/iscShrineHealing", new Vector3(31.1182f, 62.9546f, -29.4124f), new Vector3(350.209f, 1.7844f, 350.0595f));
				}
			}
			static SpeechInfo kill(string id, string txt)
			{
				//IL_001a: Unknown result type (might be due to invalid IL or missing references)
				//IL_0063: Unknown result type (might be due to invalid IL or missing references)
				//IL_0064: Unknown result type (might be due to invalid IL or missing references)
				//IL_0067: Unknown result type (might be due to invalid IL or missing references)
				LanguageAPI.Add("BROTHER_KILL_" + id.ToUpper(), txt);
				SpeechInfo result = default(SpeechInfo);
				result.token = "BROTHER_KILL_" + id.ToUpper();
				result.duration = 1f;
				result.maxWait = 0.1f;
				result.mustPlay = true;
				result.priority = 10f;
				return result;
			}
			static SpeechInfo see(string id, string txt)
			{
				//IL_001a: Unknown result type (might be due to invalid IL or missing references)
				//IL_0063: Unknown result type (might be due to invalid IL or missing references)
				//IL_0064: Unknown result type (might be due to invalid IL or missing references)
				//IL_0067: Unknown result type (might be due to invalid IL or missing references)
				LanguageAPI.Add("BROTHER_SEE_" + id.ToUpper(), txt);
				SpeechInfo result2 = default(SpeechInfo);
				result2.token = "BROTHER_SEE_" + id.ToUpper();
				result2.duration = 2f;
				result2.maxWait = 0.5f;
				result2.mustPlay = true;
				result2.priority = 10000f;
				return result2;
			}
		}

		public static void PatchStageChances()
		{
			//IL_0057: Unknown result type (might be due to invalid IL or missing references)
			//IL_0061: Expected O, but got Unknown
			//IL_0197: 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_01c0: Unknown result type (might be due to invalid IL or missing references)
			//IL_01df: Unknown result type (might be due to invalid IL or missing references)
			//IL_01e4: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ed: Unknown result type (might be due to invalid IL or missing references)
			//IL_020b: Unknown result type (might be due to invalid IL or missing references)
			List<string> timescales = TimescaleOverwrite.Value.Split(new char[1] { ',' }).ToList().ConvertAll((string x) => x.Trim());
			Run.ShouldUpdateRunStopwatch += (hook_ShouldUpdateRunStopwatch)delegate(orig_ShouldUpdateRunStopwatch orig, Run self)
			{
				if (self.livingPlayerCount <= 0)
				{
					return orig.Invoke(self);
				}
				bool flag = orig.Invoke(self);
				return timescales.Contains(SceneCatalog.mostRecentSceneDef.cachedName) ? (!flag) : flag;
			};
			Dictionary<string, float> dictionary = new Dictionary<string, float>();
			foreach (string item in StageChances.Value.Split(new char[1] { ',' }).ToList().ConvertAll((string x) => x.Trim()))
			{
				List<string> list = item.Split(new char[1] { '-' }).ToList().ConvertAll((string x) => x.Trim());
				if (list.Count == 2)
				{
					dictionary.Add(list[0], float.Parse(list[1]));
				}
			}
			string[] array = new string[5] { "sgStage1", "sgStage2", "sgStage3", "sgStage4", "sgStage5" };
			foreach (string text in array)
			{
				SceneCollection val = Addressables.LoadAssetAsync<SceneCollection>((object)("RoR2/Base/SceneGroups/" + text + ".asset")).WaitForCompletion();
				List<SceneEntry> list2 = new List<SceneEntry>(val._sceneEntries);
				for (int j = 0; j < list2.Count; j++)
				{
					if (dictionary.ContainsKey(list2[j].sceneDef.cachedName))
					{
						SceneEntry value = list2[j];
						((SceneEntry)(ref value)).weight = dictionary[list2[j].sceneDef.cachedName];
						list2[j] = value;
					}
				}
				val._sceneEntries = list2.ToArray();
			}
		}

		public static void HackSkeletonForceSpawn()
		{
			Stage.onStageStartGlobal += delegate
			{
				GameObject obj2 = GameObject.Find("HOLDER: Hidden Altar Stuff");
				object obj3;
				if (obj2 == null)
				{
					obj3 = null;
				}
				else
				{
					Transform transform = obj2.transform;
					if (transform == null)
					{
						obj3 = null;
					}
					else
					{
						Transform obj4 = transform.Find("AltarCenter");
						if (obj4 == null)
						{
							obj3 = null;
						}
						else
						{
							Transform obj5 = obj4.Find("AltarSkeletonBody");
							obj3 = ((obj5 != null) ? ((Component)obj5).gameObject : null);
						}
					}
				}
				GameObject val = (GameObject)obj3;
				if ((Object)(object)val != (Object)null)
				{
					GameObjectUnlockableFilter component = val.GetComponent<GameObjectUnlockableFilter>();
					component.forbiddenUnlockable = "";
					component.forbiddenUnlockableDef = null;
					component.Networkactive = true;
					component.active = true;
					val.SetActive(true);
					Log.LogDebug((object)"*Bad to the Bone Riff*");
				}
			};
			GlobalEventManager.onCharacterDeathGlobal += delegate(DamageReport report)
			{
				//IL_003b: Unknown result type (might be due to invalid IL or missing references)
				//IL_0046: Unknown result type (might be due to invalid IL or missing references)
				//IL_005a: Unknown result type (might be due to invalid IL or missing references)
				object obj;
				if (report == null)
				{
					obj = null;
				}
				else
				{
					CharacterBody victimBody = report.victimBody;
					obj = ((victimBody != null) ? ((Object)victimBody).name : null);
				}
				if ((string?)obj == "AltarSkeletonBody")
				{
					PickupDropletController.CreatePickupDroplet(Run.instance.treasureRng.NextElementUniform<PickupIndex>(Run.instance.availableVoidTier2DropList), report.victimBody.corePosition, new Vector3(-15f, 13f, -20f));
				}
			};
		}

		public static void HandleHank()
		{
			//IL_0198: Unknown result type (might be due to invalid IL or missing references)
			//IL_01a2: Expected O, but got Unknown
			string[] items = new string[27]
			{
				"AttackSpeedAndMoveSpeed", "MysteriousVial", "Infusion", "HealingPotion", "SprintBonus", "MysticsItems_CoffeeBoostOnItemPickup", "ITEM_GOTCE_gd2", "ITEM_GOTCE_TubOfBart", "ItemDefSubmergingCistern", "ItemDefSeepingOcean",
				"SiphonOnLowHealth", "DropOfNecrosis", "SpatteredCollection", "Tonic", "Ketchup", "RandomEquipmentTrigger", "VV_ITEM_EHANCE_VIALS_ITEM", "MysticsItems_GateChalice", "EQUIPMENT_JAR_OF_RESHAPING", "VendingMachine",
				"ITEM_GOTCE_BottledCommand", "ITEM_GOTCE_BottledEnigma", "ITEM_GOTCE_BottledMetamorphosis", "ITEM_GOTCE_TubOfLard", "ITEM_GOTCE_DilutedFlask", "ITEM_GOTCE_FortifiedFlask", "ITEM_GOTCE_PaleAle"
			};
			string[] array = new string[7] { "PressurizedCanister", "IgniteOnKill", "ExplodeOnDeath", "EquipmentMagazineVoid", "EquipmentMagazine", "StrengthenBurn", "Molotov" };
			if (SpicyHank.Value)
			{
				items = CollectionExtensions.AddRangeToArray<string>(items, array);
			}
			if (!HankOffersDrink.Value)
			{
				return;
			}
			Stage.onStageStartGlobal += delegate
			{
				hanked = false;
			};
			PurchaseInteraction.OnInteractionBegin += (hook_OnInteractionBegin)delegate(orig_OnInteractionBegin orig, PurchaseInteraction self, Interactor activator)
			{
				//IL_00a4: 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_00f5: 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_00fe: Unknown result type (might be due to invalid IL or missing references)
				//IL_0103: Unknown result type (might be due to invalid IL or missing references)
				//IL_0105: Unknown result type (might be due to invalid IL or missing references)
				//IL_0107: Unknown result type (might be due to invalid IL or missing references)
				//IL_0109: Unknown result type (might be due to invalid IL or missing references)
				//IL_0134: Expected I4, but got Unknown
				//IL_0137: 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)
				//IL_014e: 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_0206: Unknown result type (might be due to invalid IL or missing references)
				//IL_020b: Unknown result type (might be due to invalid IL or missing references)
				//IL_0210: Unknown result type (might be due to invalid IL or missing references)
				//IL_026f: Unknown result type (might be due to invalid IL or missing references)
				//IL_0289: Unknown result type (might be due to invalid IL or missing references)
				//IL_023c: Unknown result type (might be due to invalid IL or missing references)
				//IL_0230: Unknown result type (might be due to invalid IL or missing references)
				//IL_02a3: Unknown result type (might be due to invalid IL or missing references)
				//IL_02bd: 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_02f3: Unknown result type (might be due to invalid IL or missing references)
				//IL_030e: Unknown result type (might be due to invalid IL or missing references)
				//IL_0329: Unknown result type (might be due to invalid IL or missing references)
				//IL_0344: Unknown result type (might be due to invalid IL or missing references)
				//IL_035f: Unknown result type (might be due to invalid IL or missing references)
				//IL_039a: Unknown result type (might be due to invalid IL or missing references)
				//IL_039f: Unknown result type (might be due to invalid IL or missing references)
				//IL_03a1: Unknown result type (might be due to invalid IL or missing references)
				//IL_03ae: Unknown result type (might be due to invalid IL or missing references)
				//IL_03b3: Unknown result type (might be due to invalid IL or missing references)
				//IL_03bd: 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_03c7: Unknown result type (might be due to invalid IL or missing references)
				//IL_03d1: Unknown result type (might be due to invalid IL or missing references)
				//IL_03e1: Unknown result type (might be due to invalid IL or missing references)
				//IL_03eb: Unknown result type (might be due to invalid IL or missing references)
				//IL_03f0: Unknown result type (might be due to invalid IL or missing references)
				orig.Invoke(self, activator);
				if (((Object)((Component)self).gameObject).name == "BadToTheBone" && !hanked)
				{
					hanked = true;
					WeightedSelection<List<PickupIndex>> val = new WeightedSelection<List<PickupIndex>>(8);
					List<PickupIndex> list = new List<PickupIndex>();
					List<PickupIndex> list2 = new List<PickupIndex>();
					List<PickupIndex> list3 = new List<PickupIndex>();
					List<PickupIndex> list4 = new List<PickupIndex>();
					List<PickupIndex> list5 = new List<PickupIndex>();
					IEnumerable<ItemDef> source;
					if (!IllegalHank.Value)
					{
						source = from x in ((IEnumerable<ItemIndex>)Run.instance.availableItems).ToArray()
							select ItemCatalog.GetItemDef(x);
					}
					else
					{
						IEnumerable<ItemDef> enumerable = (IEnumerable<ItemDef>)(object)ItemCatalog.allItemDefs;
						source = enumerable;
					}
					foreach (ItemDef item3 in source.Where((ItemDef x) => items.Contains(((Object)x).name)))
					{
						PickupIndex item = PickupCatalog.FindPickupIndex(item3.itemIndex);
						ItemTier tier = item3.tier;
						ItemTier val2 = tier;
						switch ((int)val2)
						{
						case 0:
						case 6:
							list.Add(item);
							break;
						case 1:
						case 7:
							list2.Add(item);
							break;
						case 2:
						case 8:
							list3.Add(item);
							break;
						default:
							list4.Add(item);
							break;
						}
					}
					IEnumerable<EquipmentDef> source2;
					if (!IllegalHank.Value)
					{
						source2 = from x in ((IEnumerable<EquipmentIndex>)Run.instance.availableEquipment).ToArray()
							select EquipmentCatalog.GetEquipmentDef(x);
					}
					else
					{
						IEnumerable<EquipmentDef> equipmentDefs = EquipmentCatalog.equipmentDefs;
						source2 = equipmentDefs;
					}
					foreach (EquipmentDef item4 in source2.Where((EquipmentDef x) => items.Contains(((Object)x).name)))
					{
						PickupIndex item2 = PickupCatalog.FindPickupIndex(item4.equipmentIndex);
						if (!item4.isBoss && !item4.isLunar)
						{
							list5.Add(item2);
						}
						else
						{
							list4.Add(item2);
						}
					}
					if (list.Count > 0)
					{
						val.AddChoice(new ChoiceInfo<List<PickupIndex>>
						{
							value = list,
							weight = 1f
						});
					}
					if (list2.Count > 0)
					{
						val.AddChoice(new ChoiceInfo<List<PickupIndex>>
						{
							value = list2,
							weight = 0.5f
						});
					}
					if (list3.Count > 0)
					{
						val.AddChoice(new ChoiceInfo<List<PickupIndex>>
						{
							value = list3,
							weight = 0.1f
						});
					}
					if (list4.Count > 0)
					{
						val.AddChoice(new ChoiceInfo<List<PickupIndex>>
						{
							value = list4,
							weight = 0.3f
						});
					}
					if (list5.Count > 0)
					{
						val.AddChoice(new ChoiceInfo<List<PickupIndex>>
						{
							value = list5,
							weight = 0.5f
						});
					}
					if (val.Count != 0)
					{
						PickupIndex val3 = Run.instance.treasureRng.NextElementUniform<PickupIndex>(val.Evaluate(Run.instance.treasureRng.nextNormalizedFloat));
						PickupDropletController.CreatePickupDroplet(val3, ((Component)self).gameObject.transform.position + Vector3.up * 1.5f, Vector3.up * 5f + ((Component)self).gameObject.transform.forward * 20f);
					}
				}
			};
		}

		public static void HandleShrineOfRepair()
		{
			InteractableSpawnCard val = (ShrineOfRepairConfigManager.UsePickupPickerPanel.Value ? ShrineOfRepairBase<ShrineOfRepairPicker>.shrineSpawnCard : ShrineOfRepairBase<ShrineOfRepairPurchase>.shrineSpawnCard);
			if (ShrineRepairOnStage5.Value)
			{
				SpawnRandomly(5, (SpawnCard)(object)val, loop: true);
			}
			if (RemoveRandomShrineRepair.Value)
			{
				val.maxSpawnsPerStage = 0;
			}
		}

		public static void FHRadarScannerPatch()
		{
			//IL_0015: Unknown result type (might be due to invalid IL or missing references)
			//IL_001a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0020: Expected O, but got Unknown
			object obj = <>c.<>9__70_0;
			if (obj == null)
			{
				hook_GrantUnlock val = delegate(orig_GrantUnlock orig, RadiotowerTerminal self, Interactor interactor)
				{
					//IL_0037: Unknown result type (might be due to invalid IL or missing references)
					//IL_003c: Unknown result type (might be due to invalid IL or missing references)
					orig.Invoke(self, interactor);
					if (SceneCatalog.mostRecentSceneDef.cachedName == "forgottenhaven")
					{
						NetworkServer.Spawn(Object.Instantiate<GameObject>(LegacyResourcesAPI.Load<GameObject>("Prefabs/NetworkedObjects/ChestScanner"), ((Component)self).gameObject.transform.position, Quaternion.identity));
					}
				};
				<>c.<>9__70_0 = val;
				obj = (object)val;
			}
			RadiotowerTerminal.GrantUnlock += (hook_GrantUnlock)obj;
			Harmony.PatchAll(typeof(PatchBatteryInteraction));
		}

		public static void SpawnGuaranteed(string scene, string dir, Vector3 pos, Vector3 rot = default(Vector3))
		{
			//IL_0008: Unknown result type (might be due to invalid IL or missing references)
			//IL_0009: Unknown result type (might be due to invalid IL or missing references)
			SpawnGuaranteed(scene, LegacyResourcesAPI.Load<SpawnCard>(dir), pos, rot);
		}

		public static void SpawnGuaranteed(string scene, SpawnCard spawnCard, Vector3 pos, Vector3 rot = default(Vector3))
		{
			//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_001c: Unknown result type (might be due to invalid IL or missing references)
			//IL_001d: Unknown result type (might be due to invalid IL or missing references)
			Stage.onStageStartGlobal += delegate(Stage self)
			{
				//IL_0020: Unknown result type (might be due to invalid IL or missing references)
				//IL_0025: Unknown result type (might be due to invalid IL or missing references)
				//IL_0027: Unknown result type (might be due to invalid IL or missing references)
				//IL_002d: Expected O, but got Unknown
				//IL_0034: Unknown result type (might be due to invalid IL or missing references)
				//IL_003a: 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_0055: Unknown result type (might be due to invalid IL or missing references)
				//IL_005f: Expected O, but got Unknown
				//IL_005a: Unknown result type (might be due to invalid IL or missing references)
				//IL_006c: 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)
				//IL_009b: Invalid comparison between Unknown and I4
				if (!(self.sceneDef.cachedName != scene))
				{
					DirectorPlacementRule val = new DirectorPlacementRule
					{
						placementMode = (PlacementMode)0
					};
					GameObject spawnedInstance = spawnCard.DoSpawn(pos, Quaternion.Euler(rot), new DirectorSpawnRequest(spawnCard, val, Run.instance.runRNG)).spawnedInstance;
					spawnedInstance.transform.eulerAngles = rot;
					if (Object.op_Implicit((Object)(object)spawnedInstance))
					{
						PurchaseInteraction component = spawnedInstance.GetComponent<PurchaseInteraction>();
						if (Object.op_Implicit((Object)(object)component) && (int)component.costType == 1)
						{
							component.Networkcost = Run.instance.GetDifficultyScaledCost(component.cost);
						}
					}
					NetworkServer.Spawn(spawnedInstance);
				}
			};
			Log.LogDebug((object)("Added a Guaranteed Spawn of " + ((Object)spawnCard.prefab).name + " at " + scene));
		}

		public static void SpawnGuaranteed(string scene, GameObject obj, Vector3 pos, Vector3 rot = default(Vector3))
		{
			//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_001c: Unknown result type (might be due to invalid IL or missing references)
			//IL_001d: Unknown result type (might be due to invalid IL or missing references)
			Stage.onStageStartGlobal += delegate(Stage self)
			{
				//IL_0020: Unknown result type (might be due to invalid IL or missing references)
				//IL_0025: Unknown result type (might be due to invalid IL or missing references)
				//IL_0027: Unknown result type (might be due to invalid IL or missing references)
				//IL_002d: Expected O, but got Unknown
				//IL_0034: Unknown result type (might be due to invalid IL or missing references)
				//IL_003a: 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_0051: Unknown result type (might be due to invalid IL or missing references)
				//IL_007a: Unknown result type (might be due to invalid IL or missing references)
				//IL_0080: Invalid comparison between Unknown and I4
				if (!(self.sceneDef.cachedName != scene))
				{
					DirectorPlacementRule val = new DirectorPlacementRule
					{
						placementMode = (PlacementMode)0
					};
					GameObject val2 = Object.Instantiate<GameObject>(obj, pos, Quaternion.Euler(rot));
					val2.transform.eulerAngles = rot;
					if (Object.op_Implicit((Object)(object)val2))
					{
						PurchaseInteraction component = val2.GetComponent<PurchaseInteraction>();
						if (Object.op_Implicit((Object)(object)component) && (int)component.costType == 1)
						{
							component.Networkcost = Run.instance.GetDifficultyScaledCost(component.cost);
						}
					}
					NetworkServer.Spawn(val2);
				}
			};
			Log.LogDebug((object)("Added a Guaranteed Spawn of " + ((Object)obj).name + " at " + scene));
		}

		public static void SpawnRandomly(string scene, string dir)
		{
			SpawnRandomly(scene, LegacyResourcesAPI.Load<SpawnCard>(dir));
		}

		public static void SpawnRandomly(string scene, SpawnCard spawnCard)
		{
			SceneDirector.onPrePopulateSceneServer += delegate
			{
				if (!(SceneCatalog.mostRecentSceneDef.cachedName != scene))
				{
					SpawnRandomlyInternal(spawnCard);
				}
			};
			Log.LogDebug((object)("Added a Random Spawn of " + ((Object)spawnCard).name + " at " + scene));
		}

		public static void SpawnRandomly(int stage, string dir, bool loop = false)
		{
			SpawnRandomly(stage, LegacyResourcesAPI.Load<SpawnCard>(dir), loop);
		}

		public static void SpawnRandomly(int stage, SpawnCard spawnCard, bool loop = false)
		{
			SceneDirector.onPostPopulateSceneServer += delegate
			{
				if (StageCheck(stage, loop) && !((Object)(object)TeleporterInteraction.instance == (Object)null))
				{
					SpawnRandomlyInternal(spawnCard);
				}
			};
			Log.LogDebug((object)$"Added a Random Spawn of {((Object)spawnCard).name} at Stage {stage}");
		}

		private static void SpawnRandomlyInternal(SpawnCard spawnCard)
		{
			//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_0008: Unknown result type (might be due to invalid IL or missing references)
			//IL_000e: Expected O, but got Unknown
			//IL_001f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0029: Expected O, but got Unknown
			//IL_0045: Unknown result type (might be due to invalid IL or missing references)
			//IL_004b: Invalid comparison between Unknown and I4
			DirectorPlacementRule val = new DirectorPlacementRule
			{
				placementMode = (PlacementMode)4
			};
			GameObject val2 = DirectorCore.instance.TrySpawnObject(new DirectorSpawnRequest(spawnCard, val, Run.instance.runRNG));
			if (Object.op_Implicit((Object)(object)val2))
			{
				PurchaseInteraction component = val2.GetComponent<PurchaseInteraction>();
				if (Object.op_Implicit((Object)(object)component) && (int)component.costType == 1)
				{
					component.Networkcost = Run.instance.GetDifficultyScaledCost(component.cost);
				}
			}
		}

		public static bool Mods(params string[] arr)
		{
			for (int i = 0; i < arr.Length; i++)
			{
				if (!Chainloader.PluginInfos.ContainsKey(arr[i]))
				{
					return false;
				}
			}
			return true;
		}

		public static bool StageCheck(int level, bool loop = false)
		{
			if (!loop)
			{
				return Run.instance.stageClearCount == level - 1;
			}
			int loops = (level - 1) / 5;
			int stage = (level - 1) % 5;
			if (Mods("prodzpod.ProperLoop"))
			{
				return checkProperLoop();
			}
			return Run.instance.loopClearCount >= loops && Run.instance.stageClearCount % 5 == stage;
			bool checkProperLoop()
			{
				return Main.loops >= loops && Main.stage == stage;
			}
		}
	}
	[HarmonyPatch(typeof(FRHooks), "SceneDirector_onPostPopulateSceneServer")]
	public class PatchFRInteractables
	{
		public static void ILManipulator(ILContext il)
		{
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			//IL_0008: Expected O, but got Unknown
			//IL_006e: Unknown result type (might be due to invalid IL or missing references)
			//IL_007a: 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_0108: Unknown result type (might be due to invalid IL or missing references)
			ILCursor val = new ILCursor(il);
			if (Main.RemoveRandomFHTeleporter.Value && val.TryGotoNext((MoveType)2, new Func<Instruction, bool>[2]
			{
				(Instruction x) => ILPatternMatchingExt.MatchLdsfld<VF2ContentPackProvider>(x, "iscShatteredTeleporter"),
				(Instruction x) => ILPatternMatchingExt.MatchCallOrCallvirt<Object>(x, "op_Implicit")
			}))
			{
				val.Emit(OpCodes.Pop);
				val.Emit(OpCodes.Ldc_I4_0);
				Main.Log.LogDebug((object)"Removed Shattered Teleporters");
			}
			if (Main.RemoveRandomSageShrine.Value && val.TryGotoNext((MoveType)2, new Func<Instruction, bool>[2]
			{
				(Instruction x) => ILPatternMatchingExt.MatchLdsfld<VF2ContentPackProvider>(x, "iscSagesShrine"),
				(Instruction x) => ILPatternMatchingExt.MatchCallOrCallvirt<Object>(x, "op_Implicit")
			}))
			{
				val.Emit(OpCodes.Pop);
				val.Emit(OpCodes.Ldc_I4_0);
				Main.Log.LogDebug((object)"Removed Sage's Shrines");
			}
		}
	}
}