Decompiled source of RiskySotS v1.1.0

RiskySotS.dll

Decompiled a day ago
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using BepInEx;
using BepInEx.Bootstrap;
using BepInEx.Configuration;
using EntityStates.Missions.Goldshores;
using HG;
using IL;
using Microsoft.CodeAnalysis;
using Mono.Cecil.Cil;
using MonoMod.Cil;
using On.EntityStates.Missions.Goldshores;
using On.RoR2;
using On.RoR2.Networking;
using ProperSave;
using R2API;
using R2API.Utils;
using RiskySotS.Tweaks.Enemies;
using RiskySotS.Tweaks.Interactables;
using RiskySotS.Tweaks.Progression;
using RoR2;
using RoR2.ExpansionManagement;
using RoR2.Navigation;
using RoR2.Networking;
using RoR2.Projectile;
using RoR2.UI;
using RoR2BepInExPack.GameAssetPathsBetter;
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.1", FrameworkDisplayName = ".NET Standard 2.1")]
[assembly: AssemblyCompany("RiskySotS")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0+f2c5e45c65aab8f35bc1dea9147f5aec01c5d990")]
[assembly: AssemblyProduct("RiskySotS")]
[assembly: AssemblyTitle("RiskySotS")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.0.0")]
[module: UnverifiableCode]
namespace Microsoft.CodeAnalysis
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	internal sealed class EmbeddedAttribute : Attribute
	{
	}
}
namespace System.Runtime.CompilerServices
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	[AttributeUsage(AttributeTargets.Class | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Parameter | AttributeTargets.ReturnValue | AttributeTargets.GenericParameter, AllowMultiple = false, Inherited = false)]
	internal sealed class NullableAttribute : Attribute
	{
		public readonly byte[] NullableFlags;

		public NullableAttribute(byte P_0)
		{
			NullableFlags = new byte[1] { P_0 };
		}

		public NullableAttribute(byte[] P_0)
		{
			NullableFlags = P_0;
		}
	}
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	[AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Method | AttributeTargets.Interface | AttributeTargets.Delegate, AllowMultiple = false, Inherited = false)]
	internal sealed class NullableContextAttribute : Attribute
	{
		public readonly byte Flag;

		public NullableContextAttribute(byte P_0)
		{
			Flag = P_0;
		}
	}
}
namespace RiskySotS
{
	internal static class CommonHooks
	{
		internal static void DisableRemoveBuffGeneric(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);
			if (val.TryGotoNext(new Func<Instruction, bool>[1]
			{
				(Instruction x) => ILPatternMatchingExt.MatchCallvirt(x, typeof(CharacterBody), "RemoveBuff")
			}))
			{
				val.EmitDelegate<Func<BuffIndex, BuffIndex>>((Func<BuffIndex, BuffIndex>)((BuffIndex orig) => (BuffIndex)(-1)));
			}
			else
			{
				Debug.LogError((object)"RiskySotS: DisableRemoveBuffGeneric IL Hook failed");
			}
		}

		internal static void DisableAddBuffGeneric(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);
			if (val.TryGotoNext(new Func<Instruction, bool>[1]
			{
				(Instruction x) => ILPatternMatchingExt.MatchCallvirt(x, typeof(CharacterBody), "AddBuff")
			}))
			{
				val.EmitDelegate<Func<BuffIndex, BuffIndex>>((Func<BuffIndex, BuffIndex>)((BuffIndex orig) => (BuffIndex)(-1)));
			}
			else
			{
				Debug.LogError((object)"RiskySotS: DisableAddBuffGeneric IL Hook failed");
			}
		}
	}
	internal class LanguageTokens
	{
		public LanguageTokens()
		{
			LanguageAPI.Add("SHRINE_COLOSSUS_RISKYSOTS_NAME", "Shrine of the Colossus");
			LanguageAPI.Add("SHRINE_COLOSSUS_RISKYSOTS_CONTEXT", "Pray to Shrine of the Colossus");
			LanguageAPI.Add("SHRINE_COLOSSUS_RISKYSOTS_DESCRIPTION", "A Shrine that marks the path towards the Meridian.\n\nActivate the Shrine on 2 consecutive stages to guarantee a Halcyon Shrine on the 3rd stage.");
			LanguageAPI.Add("SHRINE_COLOSSUS_RISKYSOTS_LORE", "LORE HERE");
			LanguageAPI.Add("SHRINE_COLOSSUS_RISKYSOTS_ACTIVATION_1", "<style=cWorldEvent>Lightning flashes in the distance.</style>");
			LanguageAPI.Add("SHRINE_COLOSSUS_RISKYSOTS_TP_FINISH", "<style=cWorldEvent>The storm draws closer.</style>");
		}
	}
	[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.*/)]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInPlugin("com.RiskyLives.RiskySotS", "RiskySotS", "1.1.0")]
	[NetworkCompatibility(/*Could not decode attribute arguments.*/)]
	public class RiskySotSPlugin : BaseUnityPlugin
	{
		internal static bool loopVariantPluginLoaded;

		public void Awake()
		{
			ReadConfig();
			ModCompat();
			new LanguageTokens();
			new EarlygameSpawnPools();
			new Halcyonite();
			new Child();
			new Scorchling();
			new ProgressionRework();
			new NerfInteractableCredits();
			new RemoveReviveShrine();
			new HalcyonShrine();
		}

		private void ReadConfig()
		{
			//IL_0011: Unknown result type (might be due to invalid IL or missing references)
			//IL_0022: Unknown result type (might be due to invalid IL or missing references)
			//IL_002c: Expected O, but got Unknown
			//IL_002c: Expected O, but got Unknown
			//IL_0046: Unknown result type (might be due to invalid IL or missing references)
			//IL_0057: Unknown result type (might be due to invalid IL or missing references)
			//IL_0061: Expected O, but got Unknown
			//IL_0061: Expected O, but got Unknown
			//IL_007b: 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_009a: Expected O, but got Unknown
			//IL_009a: Expected O, but got Unknown
			//IL_00b4: 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_00cf: Expected O, but got Unknown
			//IL_00cf: Expected O, but got Unknown
			//IL_00e9: 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_0104: Expected O, but got Unknown
			//IL_0104: Expected O, but got Unknown
			//IL_011e: Unknown result type (might be due to invalid IL or missing references)
			//IL_012f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0139: Expected O, but got Unknown
			//IL_0139: Expected O, but got Unknown
			//IL_0153: Unknown result type (might be due to invalid IL or missing references)
			//IL_0164: Unknown result type (might be due to invalid IL or missing references)
			//IL_016e: Expected O, but got Unknown
			//IL_016e: Expected O, but got Unknown
			//IL_0188: Unknown result type (might be due to invalid IL or missing references)
			//IL_0199: Unknown result type (might be due to invalid IL or missing references)
			//IL_01a3: Expected O, but got Unknown
			//IL_01a3: Expected O, but got Unknown
			//IL_01bd: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ce: Unknown result type (might be due to invalid IL or missing references)
			//IL_01d8: Expected O, but got Unknown
			//IL_01d8: Expected O, but got Unknown
			//IL_01f2: Unknown result type (might be due to invalid IL or missing references)
			//IL_0203: Unknown result type (might be due to invalid IL or missing references)
			//IL_020d: Expected O, but got Unknown
			//IL_020d: Expected O, but got Unknown
			//IL_0227: Unknown result type (might be due to invalid IL or missing references)
			//IL_0238: Unknown result type (might be due to invalid IL or missing references)
			//IL_0242: Expected O, but got Unknown
			//IL_0242: Expected O, but got Unknown
			//IL_025c: Unknown result type (might be due to invalid IL or missing references)
			//IL_026d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0277: Expected O, but got Unknown
			//IL_0277: Expected O, but got Unknown
			//IL_0291: Unknown result type (might be due to invalid IL or missing references)
			//IL_02a2: Unknown result type (might be due to invalid IL or missing references)
			//IL_02ac: Expected O, but got Unknown
			//IL_02ac: Expected O, but got Unknown
			ProgressionRework.enabled = ((BaseUnityPlugin)this).Config.Bind<bool>(new ConfigDefinition("Progression", "Progression Rework"), true, new ConfigDescription("SotS stages are mixed into the normal map pool, and Meridian access is changed.", (AcceptableValueBase)null, Array.Empty<object>())).Value;
			ProgressionRework.allowVariantsPreLoop = ((BaseUnityPlugin)this).Config.Bind<bool>(new ConfigDefinition("Progression", "Progression Rework - Allow Variants Pre-Loop"), true, new ConfigDescription("SotS stage variants can show up on the first loop.", (AcceptableValueBase)null, Array.Empty<object>())).Value;
			ProgressionRework.goldShrineChance = ((BaseUnityPlugin)this).Config.Bind<float>(new ConfigDefinition("Progression", "Progression Rework - Altar of Gold Chance"), 50f, new ConfigDescription("Chance for Altar of Gold to spawn on the next stage after hitting a Shrine of the Colossus.", (AcceptableValueBase)null, Array.Empty<object>())).Value;
			HalcyonShrine.fasterCharging = ((BaseUnityPlugin)this).Config.Bind<bool>(new ConfigDefinition("Interactables", "Halcyon Shrine - Faster Charging"), true, new ConfigDescription("Halcyon Shrine charges faster.", (AcceptableValueBase)null, Array.Empty<object>())).Value;
			HalcyonShrine.consistentScaling = ((BaseUnityPlugin)this).Config.Bind<bool>(new ConfigDefinition("Interactables", "Halcyon Shrine - Consistent Scaling"), true, new ConfigDescription("Halcyon Shrine boss scaling remains consistent throughout the run.", (AcceptableValueBase)null, Array.Empty<object>())).Value;
			RemoveReviveShrine.enabled = ((BaseUnityPlugin)this).Config.Bind<bool>(new ConfigDefinition("Interactables", "Remove Shrine of Shaping"), true, new ConfigDescription("Removes Shrine of Shaping.", (AcceptableValueBase)null, Array.Empty<object>())).Value;
			NerfInteractableCredits.enabled = ((BaseUnityPlugin)this).Config.Bind<bool>(new ConfigDefinition("Interactables", "Nerf Interactable Credits"), true, new ConfigDescription("Brings interactable credits in-line with Vanilla stages.", (AcceptableValueBase)null, Array.Empty<object>())).Value;
			EarlygameSpawnPools.enabled = ((BaseUnityPlugin)this).Config.Bind<bool>(new ConfigDefinition("Enemies", "Adjust Earlygame Spawnpools"), true, new ConfigDescription("Removes lategame enemies from earlygame stages.", (AcceptableValueBase)null, Array.Empty<object>())).Value;
			Halcyonite.enabled = ((BaseUnityPlugin)this).Config.Bind<bool>(new ConfigDefinition("Enemies", "Halcyonite - Hitboxes"), true, new ConfigDescription("Adjusts Halcyonite hitboxes, still kinda jank tho.", (AcceptableValueBase)null, Array.Empty<object>())).Value;
			Child.removeIFrames = ((BaseUnityPlugin)this).Config.Bind<bool>(new ConfigDefinition("Enemies", "Child - Remove I-Frames"), true, new ConfigDescription("Removes invulnerability from teleport.", (AcceptableValueBase)null, Array.Empty<object>())).Value;
			Child.nerfDamage = ((BaseUnityPlugin)this).Config.Bind<bool>(new ConfigDefinition("Enemies", "Child - Nerf Damage"), true, new ConfigDescription("Reduces projectile damage to be in line with other enmies.", (AcceptableValueBase)null, Array.Empty<object>())).Value;
			Scorchling.removeIFrames = ((BaseUnityPlugin)this).Config.Bind<bool>(new ConfigDefinition("Enemies", "Scorch Worm - Remove I-Frames"), true, new ConfigDescription("Removes invulnerability from burrow.", (AcceptableValueBase)null, Array.Empty<object>())).Value;
			Scorchling.nerfDamage = ((BaseUnityPlugin)this).Config.Bind<bool>(new ConfigDefinition("Enemies", "Scorch Worm - Nerf Damage"), true, new ConfigDescription("Reduces projectile damage a bit.", (AcceptableValueBase)null, Array.Empty<object>())).Value;
		}

		private void ModCompat()
		{
			bool flag = Chainloader.PluginInfos.ContainsKey("com.Moffein.RiskyTweaks");
			bool flag2 = Chainloader.PluginInfos.ContainsKey("com.RiskyLives.RiskyMod");
			loopVariantPluginLoaded = Chainloader.PluginInfos.ContainsKey("Wolfo.LoopVariantConfig");
			if (Chainloader.PluginInfos.ContainsKey("com.Moffein.RemoveReviveShrine"))
			{
				RemoveReviveShrine.enabled = false;
			}
			if (Chainloader.PluginInfos.ContainsKey("Onyx.HalcyonKnight"))
			{
				Halcyonite.enabled = false;
			}
			if (Chainloader.PluginInfos.ContainsKey("com.Viliger.SpeedUpHalcyoniteShrine"))
			{
				HalcyonShrine.fasterCharging = false;
			}
			if (flag2)
			{
				Child.nerfDamage = false;
				Scorchling.nerfDamage = false;
			}
			if (flag)
			{
				Child.removeIFrames = false;
				Scorchling.removeIFrames = false;
			}
		}
	}
	public static class SneedUtils
	{
		public enum MonsterCategories
		{
			BasicMonsters,
			Minibosses,
			Champions
		}

		private static SceneDef bazaarSceneDef = Addressables.LoadAssetAsync<SceneDef>((object)"RoR2/Base/bazaar/bazaar.asset").WaitForCompletion();

		public static bool IsInBazaar()
		{
			SceneDef sceneDefForCurrentScene = SceneCatalog.GetSceneDefForCurrentScene();
			return Object.op_Implicit((Object)(object)sceneDefForCurrentScene) && (Object)(object)sceneDefForCurrentScene == (Object)(object)bazaarSceneDef;
		}

		public static bool SetAddressableEntityStateField(string fullEntityStatePath, string fieldName, string value)
		{
			//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)
			EntityStateConfiguration val = Addressables.LoadAssetAsync<EntityStateConfiguration>((object)fullEntityStatePath).WaitForCompletion();
			for (int i = 0; i < val.serializedFieldsCollection.serializedFields.Length; i++)
			{
				if (val.serializedFieldsCollection.serializedFields[i].fieldName == fieldName)
				{
					val.serializedFieldsCollection.serializedFields[i].fieldValue.stringValue = value;
					return true;
				}
			}
			return false;
		}

		public static bool SetAddressableEntityStateField(string fullEntityStatePath, string fieldName, Object value)
		{
			//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)
			EntityStateConfiguration val = Addressables.LoadAssetAsync<EntityStateConfiguration>((object)fullEntityStatePath).WaitForCompletion();
			for (int i = 0; i < val.serializedFieldsCollection.serializedFields.Length; i++)
			{
				if (val.serializedFieldsCollection.serializedFields[i].fieldName == fieldName)
				{
					val.serializedFieldsCollection.serializedFields[i].fieldValue.objectValue = value;
					return true;
				}
			}
			return false;
		}

		public static int FindCategoryIndexByName(DirectorCardCategorySelection dcs, MonsterCategories category)
		{
			string categoryName;
			switch (category)
			{
			case MonsterCategories.BasicMonsters:
				categoryName = "Basic Monsters";
				break;
			case MonsterCategories.Minibosses:
				categoryName = "Minibosses";
				break;
			case MonsterCategories.Champions:
				categoryName = "Champions";
				break;
			default:
				return -1;
			}
			return FindCategoryIndexByName(dcs, categoryName);
		}

		public static int FindCategoryIndexByName(DirectorCardCategorySelection dcs, string categoryName)
		{
			for (int i = 0; i < dcs.categories.Length; i++)
			{
				if (string.CompareOrdinal(dcs.categories[i].name, categoryName) == 0)
				{
					return i;
				}
			}
			return -1;
		}
	}
}
namespace RiskySotS.Tweaks.Progression
{
	public class ColossusAccessShrine
	{
		public static GameObject ShrinePrefab;

		public static InspectDef ShrineInspectDef;

		public static InteractableSpawnCard iscColossusAccessShrine;

		public ColossusAccessShrine()
		{
			BuildShrineInspectDef();
			BuildShrinePrefab();
			BuildSpawnCard();
		}

		private void BuildShrineInspectDef()
		{
			//IL_0010: Unknown result type (might be due to invalid IL or missing references)
			//IL_0015: Unknown result type (might be due to invalid IL or missing references)
			//IL_001b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0020: Unknown result type (might be due to invalid IL or missing references)
			//IL_002d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0038: Unknown result type (might be due to invalid IL or missing references)
			//IL_0043: Unknown result type (might be due to invalid IL or missing references)
			//IL_0053: Expected O, but got Unknown
			ShrineInspectDef = ScriptableObject.CreateInstance<InspectDef>();
			ShrineInspectDef.Info = new InspectInfo
			{
				Visual = Addressables.LoadAssetAsync<Sprite>((object)"RoR2/Base/ShrineIcon.png").WaitForCompletion(),
				TitleToken = "SHRINE_COLOSSUS_RISKYSOTS_NAME",
				DescriptionToken = "SHRINE_COLOSSUS_RISKYSOTS_DESCRIPTION",
				FlavorToken = "SHRINE_COLOSSUS_RISKYSOTS_LORE"
			};
		}

		private void BuildShrinePrefab()
		{
			//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_0028: Unknown result type (might be due to invalid IL or missing references)
			GameObject val = PrefabAPI.InstantiateClone(Addressables.LoadAssetAsync<GameObject>((object)"RoR2/DLC2/ShrineColossusAccess.prefab").WaitForCompletion(), "RiskySotS_ShrineColossusAccess", true);
			PurchaseInteraction component = val.GetComponent<PurchaseInteraction>();
			component.costType = (CostTypeIndex)0;
			component.displayNameToken = "SHRINE_COLOSSUS_RISKYSOTS_NAME";
			component.contextToken = "SHRINE_COLOSSUS_RISKYSOTS_CONTEXT";
			component.onPurchase = null;
			component.onDetailedPurchaseServer = null;
			Object.Destroy((Object)(object)val.GetComponent<ShrineColossusAccessBehavior>());
			val.AddComponent<ColossusAccessShrineBehavior>();
			GenericInspectInfoProvider component2 = val.GetComponent<GenericInspectInfoProvider>();
			component2.InspectInfo = ShrineInspectDef;
			ShrinePrefab = val;
		}

		private void BuildSpawnCard()
		{
			//IL_001b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0022: 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)
			//IL_0031: Unknown result type (might be due to invalid IL or missing references)
			InteractableSpawnCard val = ScriptableObject.CreateInstance<InteractableSpawnCard>();
			((SpawnCard)val).prefab = ShrinePrefab;
			((SpawnCard)val).sendOverNetwork = true;
			((SpawnCard)val).hullSize = (HullClassification)1;
			((SpawnCard)val).nodeGraphType = (GraphType)0;
			((SpawnCard)val).requiredFlags = (NodeFlags)0;
			((SpawnCard)val).forbiddenFlags = (NodeFlags)16;
			((SpawnCard)val).occupyPosition = true;
			((SpawnCard)val).directorCreditCost = 0;
			val.slightlyRandomizeOrientation = false;
			iscColossusAccessShrine = val;
		}
	}
	[RequireComponent(typeof(PurchaseInteraction))]
	public class ColossusAccessShrineBehavior : MonoBehaviour
	{
		private PurchaseInteraction purchaseInteraction;

		private void PurchaseInteractionHack(orig_OnInteractionBegin orig, PurchaseInteraction self, Interactor activator)
		{
			bool flag = (Object)(object)self == (Object)(object)purchaseInteraction && (Object)(object)purchaseInteraction != (Object)null;
			orig.Invoke(self, activator);
			if (flag)
			{
				OnPurchaseServer();
			}
		}

		private void Awake()
		{
			purchaseInteraction = ((Component)this).GetComponent<PurchaseInteraction>();
		}

		private void OnEnable()
		{
			//IL_0008: Unknown result type (might be due to invalid IL or missing references)
			//IL_0012: Expected O, but got Unknown
			PurchaseInteraction.OnInteractionBegin += new hook_OnInteractionBegin(PurchaseInteractionHack);
		}

		private void OnDisable()
		{
			//IL_0008: Unknown result type (might be due to invalid IL or missing references)
			//IL_0012: Expected O, but got Unknown
			PurchaseInteraction.OnInteractionBegin -= new hook_OnInteractionBegin(PurchaseInteractionHack);
		}

		public void OnPurchaseServer()
		{
			//IL_0066: Unknown result type (might be due to invalid IL or missing references)
			//IL_006b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0089: Expected O, but got Unknown
			//IL_00fc: Unknown result type (might be due to invalid IL or missing references)
			//IL_0101: Unknown result type (might be due to invalid IL or missing references)
			//IL_0108: Unknown result type (might be due to invalid IL or missing references)
			//IL_0113: Unknown result type (might be due to invalid IL or missing references)
			//IL_0114: 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_011e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0129: 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_013e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0143: Unknown result type (might be due to invalid IL or missing references)
			//IL_014e: Expected O, but got Unknown
			if (!NetworkServer.active || !Object.op_Implicit((Object)(object)purchaseInteraction))
			{
				return;
			}
			purchaseInteraction.SetAvailable(false);
			SceneDef sceneDefForCurrentScene = SceneCatalog.GetSceneDefForCurrentScene();
			if (Object.op_Implicit((Object)(object)sceneDefForCurrentScene))
			{
				if (sceneDefForCurrentScene.stageOrder == 1)
				{
					ProgressionRework.RunVariables.hitShrineStage1 = true;
				}
				else
				{
					ProgressionRework.RunVariables.hitShrineStage1 = true;
					ProgressionRework.RunVariables.hitShrineStage2 = true;
				}
			}
			Chat.SendBroadcastChat((ChatMessageBase)new SimpleChatMessage
			{
				baseToken = (ProgressionRework.RunVariables.hitShrineStage2 ? "PORTAL_STORM_WILL_OPEN" : "SHRINE_COLOSSUS_RISKYSOTS_ACTIVATION_1")
			});
			if (Object.op_Implicit((Object)(object)TeleporterInteraction.instance))
			{
				PortalSpawner[] components = ((Component)TeleporterInteraction.instance).gameObject.GetComponents<PortalSpawner>();
				foreach (PortalSpawner val in components)
				{
					if (val.previewChildName == "StormPortalIndicator")
					{
						((Behaviour)val).enabled = true;
						break;
					}
				}
			}
			EffectManager.SpawnEffect(LegacyResourcesAPI.Load<GameObject>("Prefabs/Effects/ShrineUseEffect"), new EffectData
			{
				origin = ((Component)this).transform.position,
				rotation = Quaternion.identity,
				scale = 1f,
				color = Color32.op_Implicit(new Color(16f / 51f, 0.8392157f, 64f / 85f))
			}, true);
		}
	}
	public class ProgressionRework
	{
		public class RunVariables
		{
			public static bool hitShrineStage1;

			public static bool hitShrineStage2;

			public static bool enteredMeridian;

			public static bool spawnedGoldShrineThisLoop;

			public static bool spawnedGoldShrineThisStage;
		}

		public static bool enabled;

		public static bool allowVariantsPreLoop;

		public static float goldShrineChance = 50f;

		public static ExpansionDef dlc2Expansion = Addressables.LoadAssetAsync<ExpansionDef>((object)"RoR2/DLC2/Common/DLC2.asset").WaitForCompletion();

		private SpawnCard iscShrineHalcyonite = (SpawnCard)(object)Addressables.LoadAssetAsync<InteractableSpawnCard>((object)"RoR2/DLC2/iscShrineHalcyonite.asset").WaitForCompletion();

		private SpawnCard iscShrineHalcyoniteTier1 = (SpawnCard)(object)Addressables.LoadAssetAsync<InteractableSpawnCard>((object)"RoR2/DLC2/iscShrineHalcyoniteTier1.asset").WaitForCompletion();

		private SpawnCard iscShrineGold = (SpawnCard)(object)Addressables.LoadAssetAsync<InteractableSpawnCard>((object)"RoR2/Base/ShrineGoldshoresAccess/iscShrineGoldshoresAccess.asset").WaitForCompletion();

		private static GameObject miniGeode = Addressables.LoadAssetAsync<GameObject>((object)"RoR2/DLC2/MiniGeodeBody.prefab").WaitForCompletion();

		public ProgressionRework()
		{
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			//IL_000b: Unknown result type (might be due to invalid IL or missing references)
			//IL_001e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0023: Unknown result type (might be due to invalid IL or missing references)
			//IL_0036: Unknown result type (might be due to invalid IL or missing references)
			//IL_003b: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b9: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c3: Expected O, but got Unknown
			//IL_00cb: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d5: Expected O, but got Unknown
			if (enabled)
			{
				new ColossusAccessShrine();
				AddStagesToMainline();
				ReworkGreenPortalLogic();
				ReworkHalcyonShrineProgression();
				Run.onRunStartGlobal += Run_onRunStartGlobal;
				SceneDirector.onPrePopulateSceneServer += SceneDirector_onPrePopulateSceneServer;
				SceneDirector.onGenerateInteractableCardSelection += FilterGoldShrineIfForceSpawned;
				GoldshoresMissionController.OnEnable += new hook_OnEnable(GoldshoresMissionController_OnEnable);
				MeridianEventTriggerInteraction.OnEnable += new hook_OnEnable(MeridianEventTriggerInteraction_OnEnable);
				if (Chainloader.PluginInfos.ContainsKey("com.KingEnderBrine.ProperSave"))
				{
					HandleSave();
				}
			}
		}

		private void FilterGoldShrineIfForceSpawned(SceneDirector director, DirectorCardCategorySelection dccs)
		{
			dccs.RemoveCardsThatFailFilter((Predicate<DirectorCard>)((DirectorCard card) => (Object)(object)card.spawnCard != (Object)(object)iscShrineGold || !RunVariables.spawnedGoldShrineThisStage));
		}

		private void MeridianEventTriggerInteraction_OnEnable(orig_OnEnable orig, MeridianEventTriggerInteraction self)
		{
			orig.Invoke(self);
			RunVariables.enteredMeridian = true;
		}

		private void GoldshoresMissionController_OnEnable(orig_OnEnable orig, GoldshoresMissionController self)
		{
			orig.Invoke(self);
			RunVariables.hitShrineStage1 = true;
			RunVariables.hitShrineStage2 = true;
		}

		private void SceneDirector_onPrePopulateSceneServer(SceneDirector director)
		{
			//IL_0057: Unknown result type (might be due to invalid IL or missing references)
			//IL_005d: Invalid comparison between Unknown and I4
			//IL_0134: 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_013b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0142: Expected O, but got Unknown
			//IL_0155: Unknown result type (might be due to invalid IL or missing references)
			//IL_015f: Expected O, but got Unknown
			//IL_01bf: Unknown result type (might be due to invalid IL or missing references)
			//IL_01c4: Unknown result type (might be due to invalid IL or missing references)
			//IL_01c6: Unknown result type (might be due to invalid IL or missing references)
			//IL_01cd: Expected O, but got Unknown
			//IL_01e0: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ea: Expected O, but got Unknown
			//IL_022a: Unknown result type (might be due to invalid IL or missing references)
			//IL_022f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0231: Unknown result type (might be due to invalid IL or missing references)
			//IL_0238: Expected O, but got Unknown
			//IL_024a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0254: Expected O, but got Unknown
			RunVariables.spawnedGoldShrineThisStage = false;
			if (!Object.op_Implicit((Object)(object)Run.instance) || RunVariables.enteredMeridian || !Run.instance.IsExpansionEnabled(dlc2Expansion))
			{
				return;
			}
			bool flag = false;
			bool flag2 = false;
			bool flag3 = false;
			SceneDef sceneDefForCurrentScene = SceneCatalog.GetSceneDefForCurrentScene();
			if (Object.op_Implicit((Object)(object)sceneDefForCurrentScene) && (int)sceneDefForCurrentScene.sceneType == 1 && !sceneDefForCurrentScene.blockOrbitalSkills)
			{
				if (sceneDefForCurrentScene.stageOrder == 1)
				{
					RunVariables.spawnedGoldShrineThisLoop = false;
					flag = true;
				}
				else if (sceneDefForCurrentScene.stageOrder == 2 && RunVariables.hitShrineStage1)
				{
					flag = true;
					if (!RunVariables.spawnedGoldShrineThisLoop)
					{
						flag3 = Util.CheckRoll(goldShrineChance, 0f, (CharacterMaster)null);
					}
				}
				else if (sceneDefForCurrentScene.stageOrder == 3 && RunVariables.hitShrineStage2)
				{
					flag2 = true;
					if (!RunVariables.spawnedGoldShrineThisLoop)
					{
						flag3 = Util.CheckRoll(goldShrineChance, 0f, (CharacterMaster)null);
					}
				}
				else
				{
					RunVariables.hitShrineStage1 = false;
					RunVariables.hitShrineStage2 = false;
				}
			}
			if (flag3)
			{
				RunVariables.spawnedGoldShrineThisStage = true;
				Debug.Log((object)"RiskySotS: Spawning random chance Altar of Gold.");
				DirectorPlacementRule val = new DirectorPlacementRule
				{
					placementMode = (PlacementMode)4
				};
				GameObject val2 = DirectorCore.instance.TrySpawnObject(new DirectorSpawnRequest(iscShrineGold, val, director.rng));
				if (Object.op_Implicit((Object)(object)val2))
				{
					int interactableCredit = director.interactableCredit;
					director.interactableCredit = interactableCredit - 1;
					RunVariables.spawnedGoldShrineThisLoop = true;
				}
			}
			if (flag2)
			{
				Debug.Log((object)"RiskySotS: Spawning Halcyonite Shrine.");
				float num = 1f + 0.5f * ((float)Run.instance.participatingPlayerCount - 1f);
				DirectorPlacementRule val3 = new DirectorPlacementRule
				{
					placementMode = (PlacementMode)4
				};
				GameObject val4 = DirectorCore.instance.TrySpawnObject(new DirectorSpawnRequest(iscShrineHalcyonite, val3, director.rng));
				if (Object.op_Implicit((Object)(object)val4))
				{
					director.interactableCredit -= Mathf.FloorToInt(50f * num);
				}
			}
			if (flag)
			{
				Debug.Log((object)"RiskySotS: Spawning Shrine of the Colossus.");
				DirectorPlacementRule val5 = new DirectorPlacementRule
				{
					placementMode = (PlacementMode)4
				};
				DirectorCore.instance.TrySpawnObject(new DirectorSpawnRequest((SpawnCard)(object)ColossusAccessShrine.iscColossusAccessShrine, val5, director.rng));
			}
		}

		private void Run_onRunStartGlobal(Run obj)
		{
			RunVariables.hitShrineStage1 = false;
			RunVariables.hitShrineStage2 = false;
			RunVariables.enteredMeridian = false;
			RunVariables.spawnedGoldShrineThisStage = false;
			RunVariables.spawnedGoldShrineThisLoop = false;
		}

		private void AddStagesToMainline()
		{
			//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_001a: 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_002e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0033: Unknown result type (might be due to invalid IL or missing references)
			//IL_0042: Unknown result type (might be due to invalid IL or missing references)
			//IL_0047: Unknown result type (might be due to invalid IL or missing references)
			//IL_0056: 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_006b: 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_0080: 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_0095: Unknown result type (might be due to invalid IL or missing references)
			//IL_009a: Unknown result type (might be due to invalid IL or missing references)
			//IL_00aa: Unknown result type (might be due to invalid IL or missing references)
			//IL_00af: 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_00c4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d4: 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)
			//IL_00e9: 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_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)
			SceneDef scene = Addressables.LoadAssetAsync<SceneDef>((object)"RoR2/DLC2/village/village.asset").WaitForCompletion();
			SceneDef scene2 = Addressables.LoadAssetAsync<SceneDef>((object)"RoR2/DLC2/lemuriantemple/lemuriantemple.asset").WaitForCompletion();
			SceneDef scene3 = Addressables.LoadAssetAsync<SceneDef>((object)"RoR2/DLC2/habitat/habitat.asset").WaitForCompletion();
			SceneDef scene4 = Addressables.LoadAssetAsync<SceneDef>((object)"RoR2/DLC2/lakes/lakes.asset").WaitForCompletion();
			SceneDef scene5 = Addressables.LoadAssetAsync<SceneDef>((object)"RoR2/DLC2/lakesnight/lakesnight.asset").WaitForCompletion();
			SceneDef scene6 = Addressables.LoadAssetAsync<SceneDef>((object)"RoR2/DLC2/villagenight/villagenight.asset").WaitForCompletion();
			SceneDef scene7 = Addressables.LoadAssetAsync<SceneDef>((object)"RoR2/DLC2/habitatfall/habitatfall.asset").WaitForCompletion();
			SceneCollection collection = Addressables.LoadAssetAsync<SceneCollection>((object)"RoR2/Base/SceneGroups/sgStage1.asset").WaitForCompletion();
			SceneCollection collection2 = Addressables.LoadAssetAsync<SceneCollection>((object)"RoR2/Base/SceneGroups/sgStage2.asset").WaitForCompletion();
			SceneCollection collection3 = Addressables.LoadAssetAsync<SceneCollection>((object)"RoR2/Base/SceneGroups/sgStage3.asset").WaitForCompletion();
			SceneCollection collection4 = Addressables.LoadAssetAsync<SceneCollection>((object)"RoR2/Base/SceneGroups/loopSgStage1.asset").WaitForCompletion();
			SceneCollection collection5 = Addressables.LoadAssetAsync<SceneCollection>((object)"RoR2/Base/SceneGroups/loopSgStage2.asset").WaitForCompletion();
			SceneCollection collection6 = Addressables.LoadAssetAsync<SceneCollection>((object)"RoR2/Base/SceneGroups/loopSgStage3.asset").WaitForCompletion();
			AddSceneToCollection(scene2, collection2);
			AddSceneToCollection(scene2, collection5);
			if (allowVariantsPreLoop)
			{
				if (!RiskySotSPlugin.loopVariantPluginLoaded)
				{
					Debug.LogWarning((object)"RiskySotS: Progression Rework - Detected LoopVariantConfig. Stage 1 variants will NOT be added to the pool. Check the LoopVariantConfig config file!");
					ModifySceneWeightInCollection(scene4, collection, 0.5f);
					AddSceneToCollection(scene5, collection, 0.5f);
					ModifySceneWeightInCollection(scene5, collection4, 0.5f);
					AddSceneToCollection(scene4, collection4, 0.5f);
					ModifySceneWeightInCollection(scene, collection, 0.5f);
					AddSceneToCollection(scene6, collection, 0.5f);
					AddSceneToCollection(scene, collection4, 0.5f);
					ModifySceneWeightInCollection(scene6, collection4, 0.5f);
				}
				AddSceneToCollection(scene3, collection3, 0.5f);
				AddSceneToCollection(scene7, collection3, 0.5f);
				AddSceneToCollection(scene3, collection6, 0.5f);
				AddSceneToCollection(scene7, collection6, 0.5f);
			}
			else
			{
				AddSceneToCollection(scene3, collection3);
				AddSceneToCollection(scene7, collection6);
			}
		}

		private void ModifySceneWeightInCollection(SceneDef scene, SceneCollection collection, float newWeight)
		{
			//IL_0014: Unknown result type (might be due to invalid IL or missing references)
			//IL_0019: Unknown result type (might be due to invalid IL or missing references)
			//IL_001a: Unknown result type (might be due to invalid IL or missing references)
			List<SceneEntry> list = collection._sceneEntries.ToList();
			for (int i = 0; i < list.Count; i++)
			{
				SceneEntry val = list[i];
				if ((Object)(object)val.sceneDef == (Object)(object)scene)
				{
					((SceneEntry)(ref val)).weight = newWeight;
					break;
				}
			}
			collection._sceneEntries = list.ToArray();
		}

		private void AddSceneToCollection(SceneDef scene, SceneCollection collection, float weight = 1f)
		{
			//IL_0003: 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_000b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0010: Unknown result type (might be due to invalid IL or missing references)
			//IL_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_001c: 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)
			//IL_0071: Unknown result type (might be due to invalid IL or missing references)
			Enumerator<SceneEntry> enumerator = collection.sceneEntries.GetEnumerator();
			try
			{
				while (enumerator.MoveNext())
				{
					SceneEntry current = enumerator.Current;
					if ((Object)(object)current.sceneDef == (Object)(object)scene)
					{
						return;
					}
				}
			}
			finally
			{
				((IDisposable)enumerator).Dispose();
			}
			List<SceneEntry> list = collection._sceneEntries.ToList();
			SceneEntry item = new SceneEntry
			{
				sceneDef = scene
			};
			((SceneEntry)(ref item)).weight = weight;
			list.Add(item);
			collection._sceneEntries = list.ToArray();
		}

		private void ReworkHalcyonShrineProgression()
		{
			//IL_0008: Unknown result type (might be due to invalid IL or missing references)
			//IL_0012: Expected O, but got Unknown
			DCCSBlender.GetBlendedDCCS += new hook_GetBlendedDCCS(DCCSBlender_GetBlendedDCCS);
		}

		private DirectorCardCategorySelection DCCSBlender_GetBlendedDCCS(orig_GetBlendedDCCS orig, Category dccsPoolCategory, ref Xoroshiro128Plus rng, ClassicStageInfo stageInfo, int contentSourceMixLimit, List<ExpansionDef> acceptableExpansionList)
		{
			DirectorCardCategorySelection val = orig.Invoke(dccsPoolCategory, ref rng, stageInfo, contentSourceMixLimit, acceptableExpansionList);
			if ((Object)(object)val != (Object)null && val.categories != null)
			{
				for (int i = 0; i < val.categories.Length; i++)
				{
					if (val.categories[i].cards != null)
					{
						val.categories[i].cards = val.categories[i].cards.Where((DirectorCard card) => card == null || (!((Object)(object)card.spawnCard == (Object)(object)iscShrineHalcyonite) && !((Object)(object)card.spawnCard == (Object)(object)iscShrineHalcyoniteTier1))).ToArray();
						val.categories = val.categories.Where((Category cat) => cat.cards != null && cat.cards.Length != 0).ToArray();
					}
				}
			}
			return val;
		}

		private void ReworkGreenPortalLogic()
		{
			//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_0027: Unknown result type (might be due to invalid IL or missing references)
			//IL_0031: Expected O, but got Unknown
			//IL_0039: Unknown result type (might be due to invalid IL or missing references)
			//IL_0043: Expected O, but got Unknown
			//IL_0049: 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_006e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0078: Expected O, but got Unknown
			GameObject val = Addressables.LoadAssetAsync<GameObject>((object)"RoR2/DLC2/PortalColossus.prefab").WaitForCompletion();
			val.GetComponent<SceneExitController>().isAlternatePath = false;
			Exit.IsValidStormTier += new hook_IsValidStormTier(Exit_IsValidStormTier);
			GenericSceneSpawnPoint.Start += new hook_Start(GenericSceneSpawnPoint_Start);
			InteractableSpawnCard colossusPortal = Addressables.LoadAssetAsync<InteractableSpawnCard>((object)"RoR2/DLC2/iscColossusPortal.asset").WaitForCompletion();
			ReworkGreenOrbs(colossusPortal);
			ReworkHalcyoniteShrinePortals(colossusPortal);
			PortalSpawner.AttemptSpawnPortalServer += new hook_AttemptSpawnPortalServer(PortalSpawner_AttemptSpawnPortalServer);
		}

		private bool PortalSpawner_AttemptSpawnPortalServer(orig_AttemptSpawnPortalServer orig, PortalSpawner self)
		{
			//IL_0027: Unknown result type (might be due to invalid IL or missing references)
			//IL_002c: Unknown result type (might be due to invalid IL or missing references)
			//IL_003d: Expected O, but got Unknown
			if ((Object)(object)self.portalSpawnCard == (Object)null && self.spawnMessageToken == "SHRINE_COLOSSUS_RISKYSOTS_TP_FINISH")
			{
				Chat.SendBroadcastChat((ChatMessageBase)new SimpleChatMessage
				{
					baseToken = self.spawnMessageToken
				});
				return false;
			}
			return orig.Invoke(self);
		}

		private void ReworkHalcyoniteShrinePortals(InteractableSpawnCard colossusPortal)
		{
			//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)
			GameObject val = Addressables.LoadAssetAsync<GameObject>((object)RoR2_DLC2.ShrineHalcyonite_prefab).WaitForCompletion();
			PortalSpawner[] components = val.GetComponents<PortalSpawner>();
			PortalSpawner[] array = components;
			foreach (PortalSpawner val2 in array)
			{
				if ((Object)(object)val2.portalSpawnCard == (Object)(object)colossusPortal)
				{
					val2.invalidStages = new string[0];
					val2.validStageTiers = new int[0];
				}
				else
				{
					((Behaviour)val2).enabled = false;
				}
			}
		}

		private void ReworkGreenOrbs(InteractableSpawnCard colossusPortal)
		{
			//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)
			GameObject val = Addressables.LoadAssetAsync<GameObject>((object)"RoR2/Base/Teleporters/Teleporter1.prefab").WaitForCompletion();
			PortalSpawner[] components = val.GetComponents<PortalSpawner>();
			PortalSpawner[] array = components;
			foreach (PortalSpawner val2 in array)
			{
				if ((Object)(object)val2.portalSpawnCard == (Object)(object)colossusPortal)
				{
					((Behaviour)val2).enabled = false;
					val2.spawnPreviewMessageToken = "";
					val2.spawnMessageToken = "SHRINE_COLOSSUS_RISKYSOTS_TP_FINISH";
					val2.validStages = new string[0];
					val2.portalSpawnCard = null;
					break;
				}
			}
		}

		private void GenericSceneSpawnPoint_Start(orig_Start orig, GenericSceneSpawnPoint self)
		{
			if ((Object)(object)self.networkedObjectPrefab == (Object)(object)miniGeode)
			{
				SceneDef sceneDefForCurrentScene = SceneCatalog.GetSceneDefForCurrentScene();
				if (Object.op_Implicit((Object)(object)sceneDefForCurrentScene) && sceneDefForCurrentScene.baseSceneName == "bazaar")
				{
					Debug.LogWarning((object)"RiskySotS: Intercepted MiniGeodeBody spawn in Bazaar. Spawn will not proceed.");
					((Component)self).gameObject.SetActive(false);
				}
			}
			else
			{
				orig.Invoke(self);
			}
		}

		private bool Exit_IsValidStormTier(orig_IsValidStormTier orig, Exit self)
		{
			return Object.op_Implicit((Object)(object)Run.instance) && Run.instance.IsExpansionEnabled(dlc2Expansion) && Run.instance.nextStageScene.stageOrder == 4 && !RunVariables.enteredMeridian;
		}

		[MethodImpl(MethodImplOptions.NoInlining | MethodImplOptions.NoOptimization)]
		private void HandleSave()
		{
			SaveFile.OnGatherSaveData += Save;
			Loading.OnLoadingEnded += Load;
		}

		public static void Save(Dictionary<string, object> dict)
		{
			dict.Add("riskySots.hitShrineStage1", RunVariables.hitShrineStage1);
			dict.Add("riskySots.hitShrineStage2", RunVariables.hitShrineStage2);
			dict.Add("riskySots.enteredMeridian", RunVariables.enteredMeridian);
			dict.Add("riskySots.spawnedGoldShrineThisLoop", RunVariables.spawnedGoldShrineThisLoop);
			dict.Add("riskySots.spawnedGoldShrineThisStage", RunVariables.spawnedGoldShrineThisStage);
		}

		public void Load(SaveFile save)
		{
			RunVariables.hitShrineStage1 = save.GetModdedData<bool>("riskySots.hitShrineStage1");
			RunVariables.hitShrineStage2 = save.GetModdedData<bool>("riskySots.hitShrineStage2");
			RunVariables.enteredMeridian = save.GetModdedData<bool>("riskySots.enteredMeridian");
			RunVariables.spawnedGoldShrineThisLoop = save.GetModdedData<bool>("riskySots.spawnedGoldShrineThisLoop");
			RunVariables.spawnedGoldShrineThisStage = save.GetModdedData<bool>("riskySots.spawnedGoldShrineThisStage");
		}
	}
}
namespace RiskySotS.Tweaks.Interactables
{
	public class HalcyonShrine
	{
		public static bool fasterCharging;

		public static bool consistentScaling;

		public HalcyonShrine()
		{
			if (fasterCharging)
			{
				ChargeFaster();
			}
			if (consistentScaling)
			{
				ScaleConsistently();
			}
		}

		private void ChargeFaster()
		{
			//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)
			GameObject val = Addressables.LoadAssetAsync<GameObject>((object)RoR2_DLC2.ShrineHalcyonite_prefab).WaitForCompletion();
			HalcyoniteShrineInteractable component = val.GetComponent<HalcyoniteShrineInteractable>();
			component.tickRate = 10f;
		}

		private void ScaleConsistently()
		{
			//IL_0008: Unknown result type (might be due to invalid IL or missing references)
			//IL_0012: Expected O, but got Unknown
			CombatDirector.HalcyoniteShrineActivation += new hook_HalcyoniteShrineActivation(CombatDirector_HalcyoniteShrineActivation);
		}

		private void CombatDirector_HalcyoniteShrineActivation(orig_HalcyoniteShrineActivation orig, CombatDirector self, float monsterCredit, DirectorCard chosenDirectorCard, int difficultyLevel, Transform shrineTransform)
		{
			int num = difficultyLevel;
			if (Object.op_Implicit((Object)(object)((Component)self).gameObject) && Object.op_Implicit((Object)(object)Run.instance))
			{
				HalcyoniteShrineInteractable component = ((Component)self).gameObject.GetComponent<HalcyoniteShrineInteractable>();
				if (Object.op_Implicit((Object)(object)component))
				{
					float num2 = (Object.op_Implicit((Object)(object)Stage.instance) ? Stage.instance.entryDifficultyCoefficient : Run.instance.difficultyCoefficient);
					int difficultyScaledCost = Run.instance.GetDifficultyScaledCost(component.midGoldCost, num2);
					int difficultyScaledCost2 = Run.instance.GetDifficultyScaledCost(component.maxGoldCost, num2);
					float num3 = Mathf.InverseLerp((float)difficultyScaledCost, (float)difficultyScaledCost2, (float)component.goldDrained);
					int num4 = 4;
					int num5 = 10;
					int num6 = Mathf.FloorToInt((float)num4 + (float)(num5 - num4) * num3);
					num = num6;
				}
			}
			orig.Invoke(self, monsterCredit, chosenDirectorCard, num, shrineTransform);
		}
	}
	public class NerfInteractableCredits
	{
		public static bool enabled;

		public NerfInteractableCredits()
		{
			if (enabled)
			{
				SceneDirector.onPrePopulateSceneServer += SceneDirector_onPrePopulateSceneServer;
			}
		}

		private void SceneDirector_onPrePopulateSceneServer(SceneDirector director)
		{
			SceneDef sceneDefForCurrentScene = SceneCatalog.GetSceneDefForCurrentScene();
			if (Object.op_Implicit((Object)(object)sceneDefForCurrentScene))
			{
				switch (sceneDefForCurrentScene.baseSceneName)
				{
				case "village":
					director.interactableCredit = 240;
					break;
				case "villagenight":
					director.interactableCredit = 210;
					break;
				case "lakes":
					director.interactableCredit = 240;
					break;
				case "lakesnight":
					director.interactableCredit = 40;
					break;
				case "lemuriantemple":
					director.interactableCredit = 220;
					break;
				}
			}
		}
	}
	public class RemoveReviveShrine
	{
		public static bool enabled;

		private SpawnCard shrineCard = (SpawnCard)(object)Addressables.LoadAssetAsync<InteractableSpawnCard>((object)"RoR2/DLC2/iscShrineColossusAccess.asset").WaitForCompletion();

		public RemoveReviveShrine()
		{
			//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_0035: Unknown result type (might be due to invalid IL or missing references)
			//IL_003f: Expected O, but got Unknown
			if (enabled)
			{
				DCCSBlender.GetBlendedDCCS += new hook_GetBlendedDCCS(DCCSBlender_GetBlendedDCCS);
			}
		}

		private DirectorCardCategorySelection DCCSBlender_GetBlendedDCCS(orig_GetBlendedDCCS orig, Category dccsPoolCategory, ref Xoroshiro128Plus rng, ClassicStageInfo stageInfo, int contentSourceMixLimit, List<ExpansionDef> acceptableExpansionList)
		{
			DirectorCardCategorySelection val = orig.Invoke(dccsPoolCategory, ref rng, stageInfo, contentSourceMixLimit, acceptableExpansionList);
			if ((Object)(object)val != (Object)null && val.categories != null)
			{
				for (int i = 0; i < val.categories.Length; i++)
				{
					if (val.categories[i].cards != null)
					{
						val.categories[i].cards = val.categories[i].cards.Where((DirectorCard card) => card == null || !((Object)(object)card.spawnCard == (Object)(object)shrineCard)).ToArray();
						val.categories = val.categories.Where((Category cat) => cat.cards != null && cat.cards.Length != 0).ToArray();
					}
				}
			}
			return val;
		}
	}
}
namespace RiskySotS.Tweaks.Enemies
{
	public class Child
	{
		public static bool removeIFrames;

		public static bool nerfDamage;

		public Child()
		{
			NerfDamage();
			RemoveIFrames();
		}

		private void NerfDamage()
		{
			//IL_0029: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Unknown result type (might be due to invalid IL or missing references)
			//IL_004b: Unknown result type (might be due to invalid IL or missing references)
			if (nerfDamage)
			{
				SneedUtils.SetAddressableEntityStateField("RoR2/DLC2/Child/EntityStates.ChildMonster.FireTrackingSparkBall.asset", "bombDamageCoefficient", "4");
				GameObject val = PrefabAPI.InstantiateClone(Addressables.LoadAssetAsync<GameObject>((object)"RoR2/DLC2/Child/ChildTrackingSparkBall.prefab").WaitForCompletion(), "RiskyModChildTrackingSparkball", true);
				ProjectileExplosion component = val.GetComponent<ProjectileExplosion>();
				component.falloffModel = (FalloffModel)3;
				ContentAddition.AddProjectile(val);
				SneedUtils.SetAddressableEntityStateField("RoR2/DLC2/Child/EntityStates.ChildMonster.FireTrackingSparkBall.asset", "projectilePrefab", (Object)(object)val);
			}
		}

		private void RemoveIFrames()
		{
			//IL_0016: Unknown result type (might be due to invalid IL or missing references)
			//IL_0020: Expected O, but got Unknown
			if (removeIFrames)
			{
				ChildMonsterController.RegisterTeleport += new hook_RegisterTeleport(ChildMonsterController_RegisterTeleport);
			}
		}

		private void ChildMonsterController_RegisterTeleport(orig_RegisterTeleport orig, ChildMonsterController self, bool addInvincibility)
		{
			orig.Invoke(self, false);
		}
	}
	public class EarlygameSpawnPools
	{
		public static bool enabled;

		public EarlygameSpawnPools()
		{
			if (enabled)
			{
				ModifyLemurianTemple();
				if (!Chainloader.PluginInfos.ContainsKey("com.RiskyLives.RiskyMod"))
				{
					ModifyLakesNight();
					ModifyVillageNight();
				}
			}
		}

		internal DirectorCard BuildDirectorCard(CharacterSpawnCard spawnCard)
		{
			return BuildDirectorCard(spawnCard, 1, 0, (MonsterSpawnDistance)0);
		}

		internal DirectorCard BuildDirectorCard(CharacterSpawnCard spawnCard, int weight, int minStages, MonsterSpawnDistance spawnDistance)
		{
			//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_000d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0014: Unknown result type (might be due to invalid IL or missing references)
			//IL_001b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0022: Unknown result type (might be due to invalid IL or missing references)
			//IL_0023: Unknown result type (might be due to invalid IL or missing references)
			//IL_0025: 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_0031: Unknown result type (might be due to invalid IL or missing references)
			//IL_0039: Expected O, but got Unknown
			return new DirectorCard
			{
				spawnCard = (SpawnCard)(object)spawnCard,
				selectionWeight = weight,
				preventOverhead = false,
				minimumStageCompletions = minStages,
				spawnDistance = spawnDistance,
				forbiddenUnlockableDef = null,
				requiredUnlockableDef = null
			};
		}

		private void ModifyLakesNight()
		{
			//IL_000d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0012: Unknown result type (might be due to invalid IL or missing references)
			//IL_0026: Unknown result type (might be due to invalid IL or missing references)
			//IL_002b: Unknown result type (might be due to invalid IL or missing references)
			//IL_003f: 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_0058: Unknown result type (might be due to invalid IL or missing references)
			//IL_005d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0071: 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_008a: 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_00a8: 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_00bc: Unknown result type (might be due to invalid IL or missing references)
			List<SpawnCard> cardList2 = new List<SpawnCard>
			{
				(SpawnCard)(object)Addressables.LoadAssetAsync<CharacterSpawnCard>((object)"RoR2/Base/LemurianBruiser/cscLemurianBruiser.asset").WaitForCompletion(),
				(SpawnCard)(object)Addressables.LoadAssetAsync<CharacterSpawnCard>((object)"RoR2/Base/Parent/cscParent.asset").WaitForCompletion(),
				(SpawnCard)(object)Addressables.LoadAssetAsync<CharacterSpawnCard>((object)"RoR2/Base/Nullifier/cscNullifier.asset").WaitForCompletion(),
				(SpawnCard)(object)Addressables.LoadAssetAsync<CharacterSpawnCard>((object)"RoR2/DLC1/Gup/cscGupBody.asset").WaitForCompletion(),
				(SpawnCard)(object)Addressables.LoadAssetAsync<CharacterSpawnCard>((object)"RoR2/Base/Grandparent/cscGrandparent.asset").WaitForCompletion(),
				(SpawnCard)(object)Addressables.LoadAssetAsync<CharacterSpawnCard>((object)"RoR2/Base/ImpBoss/cscImpBoss.asset").WaitForCompletion()
			};
			DirectorCardCategorySelection dccs2 = Addressables.LoadAssetAsync<DirectorCardCategorySelection>((object)"RoR2/DLC2/lakesnight/dccsLakesnightMonsters.asset").WaitForCompletion();
			DirectorCardCategorySelection dccs3 = Addressables.LoadAssetAsync<DirectorCardCategorySelection>((object)"RoR2/DLC2/lakesnight/dccsLakesnightMonsters_DLC1.asset").WaitForCompletion();
			ModifyCards(dccs2, cardList2);
			ModifyCards(dccs3, cardList2);
			static void ModifyCards(DirectorCardCategorySelection dccs, List<SpawnCard> cardList)
			{
				//IL_000f: Unknown result type (might be due to invalid IL or missing references)
				//IL_0014: Unknown result type (might be due to invalid IL or missing references)
				//IL_0017: Unknown result type (might be due to invalid IL or missing references)
				Category[] categories = dccs.categories;
				foreach (Category val in categories)
				{
					DirectorCard[] cards = val.cards;
					foreach (DirectorCard val2 in cards)
					{
						if (val2.minimumStageCompletions < 3 && cardList.Contains(val2.spawnCard))
						{
							val2.minimumStageCompletions = 3;
						}
					}
				}
			}
		}

		private void ModifyVillageNight()
		{
			//IL_000d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0012: Unknown result type (might be due to invalid IL or missing references)
			//IL_0026: Unknown result type (might be due to invalid IL or missing references)
			//IL_002b: Unknown result type (might be due to invalid IL or missing references)
			//IL_003f: 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_0058: Unknown result type (might be due to invalid IL or missing references)
			//IL_005d: Unknown result type (might be due to invalid IL or missing references)
			List<SpawnCard> cardList2 = new List<SpawnCard>
			{
				(SpawnCard)(object)Addressables.LoadAssetAsync<CharacterSpawnCard>((object)"RoR2/Base/LemurianBruiser/cscLemurianBruiser.asset").WaitForCompletion(),
				(SpawnCard)(object)Addressables.LoadAssetAsync<CharacterSpawnCard>((object)"RoR2/Base/Parent/cscParent.asset").WaitForCompletion(),
				(SpawnCard)(object)Addressables.LoadAssetAsync<CharacterSpawnCard>((object)"RoR2/Base/Grandparent/cscGrandparent.asset").WaitForCompletion()
			};
			ModifyCards(Addressables.LoadAssetAsync<DirectorCardCategorySelection>((object)"RoR2/DLC2/villagenight/dccsVillageNightMonsters_Additional.asset").WaitForCompletion(), cardList2);
			static void ModifyCards(DirectorCardCategorySelection dccs, List<SpawnCard> cardList)
			{
				//IL_000f: Unknown result type (might be due to invalid IL or missing references)
				//IL_0014: Unknown result type (might be due to invalid IL or missing references)
				//IL_0017: Unknown result type (might be due to invalid IL or missing references)
				Category[] categories = dccs.categories;
				foreach (Category val in categories)
				{
					DirectorCard[] cards = val.cards;
					foreach (DirectorCard val2 in cards)
					{
						if (val2.minimumStageCompletions < 3 && cardList.Contains(val2.spawnCard))
						{
							val2.minimumStageCompletions = 3;
						}
					}
				}
			}
		}

		private void ModifyLemurianTemple()
		{
			//IL_000d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0012: Unknown result type (might be due to invalid IL or missing references)
			//IL_0026: Unknown result type (might be due to invalid IL or missing references)
			//IL_002b: Unknown result type (might be due to invalid IL or missing references)
			List<SpawnCard> cardList2 = new List<SpawnCard> { (SpawnCard)(object)Addressables.LoadAssetAsync<CharacterSpawnCard>((object)"RoR2/Base/LemurianBruiser/cscLemurianBruiser.asset").WaitForCompletion() };
			ModifyCards(Addressables.LoadAssetAsync<DirectorCardCategorySelection>((object)"RoR2/DLC2/lemuriantemple/dccsLemurianTempleMonsters.asset").WaitForCompletion(), cardList2);
			static void ModifyCards(DirectorCardCategorySelection dccs, List<SpawnCard> cardList)
			{
				//IL_000f: Unknown result type (might be due to invalid IL or missing references)
				//IL_0014: Unknown result type (might be due to invalid IL or missing references)
				//IL_0017: Unknown result type (might be due to invalid IL or missing references)
				Category[] categories = dccs.categories;
				foreach (Category val in categories)
				{
					DirectorCard[] cards = val.cards;
					foreach (DirectorCard val2 in cards)
					{
						if (val2.minimumStageCompletions < 3 && cardList.Contains(val2.spawnCard))
						{
							val2.minimumStageCompletions = 3;
						}
					}
				}
			}
		}
	}
	public class Halcyonite
	{
		public static bool enabled;

		public Halcyonite()
		{
			//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_009f: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c0: Unknown result type (might be due to invalid IL or missing references)
			//IL_0114: Unknown result type (might be due to invalid IL or missing references)
			//IL_0135: Unknown result type (might be due to invalid IL or missing references)
			if (!enabled)
			{
				return;
			}
			GameObject val = Addressables.LoadAssetAsync<GameObject>((object)"RoR2/DLC2/Halcyonite/HalcyoniteBody.prefab").WaitForCompletion();
			GameObject gameObject = ((Component)val.GetComponent<ModelLocator>().modelTransform).gameObject;
			HitBoxGroup[] componentsInChildren = gameObject.GetComponentsInChildren<HitBoxGroup>();
			bool flag = false;
			bool flag2 = false;
			foreach (HitBoxGroup val2 in componentsInChildren)
			{
				if (val2.groupName == "GoldenSword" && !flag)
				{
					flag = true;
					HitBox val3 = val2.hitBoxes[0];
					((Component)val3).transform.localPosition = new Vector3(1f, 3f, 7f);
					((Component)val3).transform.localScale = new Vector3(3f, 3f, 12f);
				}
				else if (val2.groupName == "GoldenSlash" && !flag2)
				{
					flag2 = true;
					HitBox val4 = val2.hitBoxes[0];
					((Component)val4).transform.localPosition = new Vector3(0f, 1.6f, 4f);
					((Component)val4).transform.localScale = new Vector3(12f, 3f, 9f);
				}
			}
		}
	}
	public class Scorchling
	{
		public static bool removeIFrames;

		public static bool nerfDamage;

		public Scorchling()
		{
			NerfDamage();
			RemoveIFrames();
		}

		private void NerfDamage()
		{
			if (nerfDamage)
			{
				SneedUtils.SetAddressableEntityStateField("RoR2/DLC2/Scorchling/EntityStates.Scorchling.LavaBomb.asset", "mortarDamageCoefficient", "0.8");
			}
		}

		private void RemoveIFrames()
		{
			//IL_0016: Unknown result type (might be due to invalid IL or missing references)
			//IL_0020: Expected O, but got Unknown
			//IL_0028: Unknown result type (might be due to invalid IL or missing references)
			//IL_0032: Expected O, but got Unknown
			if (removeIFrames)
			{
				ScorchlingController.Burrow += new Manipulator(CommonHooks.DisableAddBuffGeneric);
				ScorchlingController.Breach += new Manipulator(CommonHooks.DisableRemoveBuffGeneric);
			}
		}
	}
}