Decompiled source of RealerExtraChallengeShrines v1.0.3

ExtraChallengeShrines.dll

Decompiled 3 months ago
using System;
using System.Collections;
using System.Collections.Generic;
using System.Collections.ObjectModel;
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 BepInEx;
using BepInEx.Configuration;
using EntityStates;
using ExtraChallengeShrines.Interactables;
using MysticsRisky2Utils;
using MysticsRisky2Utils.BaseAssetTypes;
using MysticsRisky2Utils.ContentManagement;
using On.RoR2;
using R2API;
using R2API.Networking;
using R2API.Networking.Interfaces;
using R2API.Utils;
using RoR2;
using RoR2.ContentManagement;
using RoR2.Navigation;
using RoR2.Networking;
using RoR2.Skills;
using RoR2.UI;
using UnityEngine;
using UnityEngine.AddressableAssets;
using UnityEngine.Events;
using UnityEngine.Networking;
using UnityEngine.UI;

[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("ExtraChallengeShrines")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0+78f5fa52662bd161b5097f75dbdc54559f7c750b")]
[assembly: AssemblyProduct("ExtraChallengeShrines")]
[assembly: AssemblyTitle("ExtraChallengeShrines")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.0.0")]
[module: UnverifiableCode]
namespace ExtraChallengeShrines
{
	public class BlankLoadableAsset : BaseLoadableAsset
	{
	}
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInPlugin("com.themysticsword.extrachallengeshrines", "Extra Challenge Shrines", "1.0.2")]
	[NetworkCompatibility(/*Could not decode attribute arguments.*/)]
	public class ExtraChallengeShrinesPlugin : BaseUnityPlugin
	{
		[Serializable]
		[CompilerGenerated]
		private sealed class <>c
		{
			public static readonly <>c <>9 = new <>c();

			public static CollectContentPackProvidersDelegate <>9__10_1;

			public static Action <>9__10_2;

			internal void <Awake>b__10_1(AddContentPackProviderDelegate addContentPackProvider)
			{
				addContentPackProvider.Invoke((IContentPackProvider)(object)new ExtraChallengeShrinesContent());
			}

			internal void <Awake>b__10_2()
			{
				//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)
				ExtraChallengeShrinesTeleporterComponent.rockShrineDropTable = Addressables.LoadAssetAsync<PickupDropTable>((object)"RoR2/Base/Common/dtTier1Item.asset").WaitForCompletion();
			}
		}

		public const string PluginGUID = "com.themysticsword.extrachallengeshrines";

		public const string PluginName = "Extra Challenge Shrines";

		public const string PluginVersion = "1.0.2";

		public static Assembly executingAssembly;

		public static string pluginLocation;

		private static AssetBundle _assetBundle;

		public static ConfigFile config;

		public static ConfigEntry<bool> ignoreBalanceChanges;

		public static AssetBundle AssetBundle
		{
			get
			{
				if ((Object)(object)_assetBundle == (Object)null)
				{
					_assetBundle = AssetBundle.LoadFromFile(Path.Combine(Path.GetDirectoryName(pluginLocation), "extrachallengeshrinesassetbundle"));
				}
				return _assetBundle;
			}
		}

		public void Awake()
		{
			//IL_010b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0115: Expected O, but got Unknown
			//IL_012f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0139: Expected O, but got Unknown
			//IL_0141: Unknown result type (might be due to invalid IL or missing references)
			//IL_014b: Expected O, but got Unknown
			//IL_0153: Unknown result type (might be due to invalid IL or missing references)
			//IL_015d: Expected O, but got Unknown
			//IL_0165: Unknown result type (might be due to invalid IL or missing references)
			//IL_016f: Expected O, but got Unknown
			//IL_00f3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f8: Unknown result type (might be due to invalid IL or missing references)
			//IL_00fe: Expected O, but got Unknown
			pluginLocation = ((BaseUnityPlugin)this).Info.Location;
			executingAssembly = Assembly.GetExecutingAssembly();
			config = ((BaseUnityPlugin)this).Config;
			NetworkingAPI.RegisterMessageType<ExtraChallengeShrinesTeleporterComponent.SyncShrineStacks>();
			ConfigurableValue.CreateBool("com.themysticsword.extrachallengeshrines", "Extra Challenge Shrines", config, "General", "Debug", false, "Make all challenge shrines spawn on each stage", (List<string>)null, (ConfigEntry<bool>)null, false, (Action<bool>)delegate(bool x)
			{
				//IL_0021: Unknown result type (might be due to invalid IL or missing references)
				//IL_002b: Expected O, but got Unknown
				//IL_000d: Unknown result type (might be due to invalid IL or missing references)
				//IL_0017: Expected O, but got Unknown
				if (x)
				{
					GenericGameEvents.OnPopulateScene += new SceneRNGEventHandler(DebugGuaranteeAllShrines);
				}
				else
				{
					GenericGameEvents.OnPopulateScene -= new SceneRNGEventHandler(DebugGuaranteeAllShrines);
				}
			});
			ignoreBalanceChanges = ConfigurableValue.CreateBool("com.themysticsword.extrachallengeshrines", "Extra Challenge Shrines", config, "General", "Ignore Balance Changes", true, "If true, most of the values in the config will be ignored and will use default values. Set to false if you want to fully customize your mod experience.", (List<string>)null, (ConfigEntry<bool>)null, false, (Action<bool>)null).bepinexConfigEntry;
			ContentLoadHelper.PluginAwakeLoad<BaseItem>(executingAssembly);
			ContentLoadHelper.PluginAwakeLoad<BaseEquipment>(executingAssembly);
			ContentLoadHelper.PluginAwakeLoad<BaseBuff>(executingAssembly);
			ContentLoadHelper.PluginAwakeLoad<BaseInteractable>(executingAssembly);
			ContentLoadHelper.PluginAwakeLoad<BaseCharacterBody>(executingAssembly);
			ContentLoadHelper.PluginAwakeLoad<BaseCharacterMaster>(executingAssembly);
			ContentLoadHelper.PluginAwakeLoad<BlankLoadableAsset>(executingAssembly);
			object obj = <>c.<>9__10_1;
			if (obj == null)
			{
				CollectContentPackProvidersDelegate val = delegate(AddContentPackProviderDelegate addContentPackProvider)
				{
					addContentPackProvider.Invoke((IContentPackProvider)(object)new ExtraChallengeShrinesContent());
				};
				<>c.<>9__10_1 = val;
				obj = (object)val;
			}
			ContentManager.collectContentPackProviders += (CollectContentPackProvidersDelegate)obj;
			TeleporterInteraction.Start += new hook_Start(TeleporterInteraction_Start);
			TeleporterInteraction.onTeleporterBeginChargingGlobal += TeleporterInteraction_onTeleporterBeginChargingGlobal;
			IdleState.OnInteractionBegin += new hook_OnInteractionBegin(IdleState_OnInteractionBegin);
			BossGroup.OnMemberAddedServer += new hook_OnMemberAddedServer(BossGroup_OnMemberAddedServer);
			BossGroup.DropRewards += new hook_DropRewards(BossGroup_DropRewards);
			CombatDirector.SetNextSpawnAsBoss += new hook_SetNextSpawnAsBoss(CombatDirector_SetNextSpawnAsBoss);
			RoR2Application.onLoad = (Action)Delegate.Combine(RoR2Application.onLoad, (Action)delegate
			{
				//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)
				ExtraChallengeShrinesTeleporterComponent.rockShrineDropTable = Addressables.LoadAssetAsync<PickupDropTable>((object)"RoR2/Base/Common/dtTier1Item.asset").WaitForCompletion();
			});
		}

		private void DebugGuaranteeAllShrines(Xoroshiro128Plus rng)
		{
			//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_0012: Unknown result type (might be due to invalid IL or missing references)
			//IL_001d: Expected O, but got Unknown
			//IL_0018: Unknown result type (might be due to invalid IL or missing references)
			//IL_0022: Expected O, but got Unknown
			//IL_002d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0032: Unknown result type (might be due to invalid IL or missing references)
			//IL_0034: Unknown result type (might be due to invalid IL or missing references)
			//IL_003f: Expected O, but got Unknown
			//IL_003a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0044: Expected O, but got Unknown
			//IL_004f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0054: 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_0061: Expected O, but got Unknown
			//IL_005c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0066: Expected O, but got Unknown
			//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_007e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0083: Unknown result type (might be due to invalid IL or missing references)
			//IL_0085: Unknown result type (might be due to invalid IL or missing references)
			//IL_0090: Expected O, but got Unknown
			//IL_008b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0095: Expected O, but got Unknown
			DirectorCore.instance.TrySpawnObject(new DirectorSpawnRequest((SpawnCard)(object)ShrineCrown.spawnCard, new DirectorPlacementRule
			{
				placementMode = (PlacementMode)4
			}, rng));
			DirectorCore.instance.TrySpawnObject(new DirectorSpawnRequest((SpawnCard)(object)ShrineRock.spawnCard, new DirectorPlacementRule
			{
				placementMode = (PlacementMode)4
			}, rng));
			DirectorCore.instance.TrySpawnObject(new DirectorSpawnRequest((SpawnCard)(object)ShrineEye.spawnCard, new DirectorPlacementRule
			{
				placementMode = (PlacementMode)4
			}, rng));
			DirectorCore.instance.TrySpawnObject(new DirectorSpawnRequest((SpawnCard)(object)Addressables.LoadAssetAsync<InteractableSpawnCard>((object)"RoR2/Base/ShrineBoss/iscShrineBoss.asset").WaitForCompletion(), new DirectorPlacementRule
			{
				placementMode = (PlacementMode)4
			}, rng));
		}

		private void TeleporterInteraction_Start(orig_Start orig, TeleporterInteraction self)
		{
			//IL_0046: Unknown result type (might be due to invalid IL or missing references)
			//IL_0050: 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_005a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0083: Unknown result type (might be due to invalid IL or missing references)
			//IL_008d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0092: Unknown result type (might be due to invalid IL or missing references)
			//IL_0097: 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_00ca: Unknown result type (might be due to invalid IL or missing references)
			//IL_00cf: 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)
			orig.Invoke(self);
			ExtraChallengeShrinesTeleporterComponent extraChallengeShrinesTeleporterComponent = ((Component)self).gameObject.AddComponent<ExtraChallengeShrinesTeleporterComponent>();
			extraChallengeShrinesTeleporterComponent.crownShrineIndicator = MakeNewIndicator(ExtraChallengeShrinesTeleporterComponent.crownShrineIndicatorMaterial);
			Transform transform = extraChallengeShrinesTeleporterComponent.crownShrineIndicator.transform;
			transform.position += 4f * Vector3.up;
			extraChallengeShrinesTeleporterComponent.rockShrineIndicator = MakeNewIndicator(ExtraChallengeShrinesTeleporterComponent.rockShrineIndicatorMaterial);
			Transform transform2 = extraChallengeShrinesTeleporterComponent.rockShrineIndicator.transform;
			transform2.position -= 2f * Vector3.up;
			extraChallengeShrinesTeleporterComponent.eyeShrineIndicator = MakeNewIndicator(ExtraChallengeShrinesTeleporterComponent.eyeShrineIndicatorMaterial);
			Transform transform3 = extraChallengeShrinesTeleporterComponent.eyeShrineIndicator.transform;
			transform3.position += 2f * Vector3.up;
			GameObject MakeNewIndicator(Material material)
			{
				GameObject val = Object.Instantiate<GameObject>(self.bossShrineIndicator, self.bossShrineIndicator.transform.parent);
				val.GetComponentInChildren<Renderer>().material = material;
				val.SetActive(false);
				return val;
			}
		}

		private void TeleporterInteraction_onTeleporterBeginChargingGlobal(TeleporterInteraction self)
		{
			if (NetworkServer.active)
			{
				ExtraChallengeShrinesTeleporterComponent component = ((Component)self).GetComponent<ExtraChallengeShrinesTeleporterComponent>();
				if (Object.op_Implicit((Object)(object)component) && Object.op_Implicit((Object)(object)self.bossDirector))
				{
					TryAddCredits(component.crownShrineStacks, ConfigurableValue<float>.op_Implicit(ShrineCrown.bossCredits), ConfigurableValue<float>.op_Implicit(ShrineCrown.bossCreditsPerStack));
					TryAddCredits(component.rockShrineStacks, ConfigurableValue<float>.op_Implicit(ShrineRock.bossCredits), ConfigurableValue<float>.op_Implicit(ShrineRock.bossCreditsPerStack));
					TryAddCredits(component.eyeShrineStacks, ConfigurableValue<float>.op_Implicit(ShrineEye.bossCredits), ConfigurableValue<float>.op_Implicit(ShrineEye.bossCreditsPerStack));
				}
			}
			void TryAddCredits(int stackCount, float onFirstStack, float onExtraStacks)
			{
				if (stackCount > 0)
				{
					float num = onFirstStack + onExtraStacks * (float)(stackCount - 1);
					CombatDirector bossDirector = self.bossDirector;
					bossDirector.monsterCredit += (float)(int)(num * Mathf.Pow(Run.instance.compensatedDifficultyCoefficient, 0.5f));
				}
			}
		}

		private void IdleState_OnInteractionBegin(orig_OnInteractionBegin orig, BaseState self, Interactor activator)
		{
			//IL_000b: 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_0049: Expected O, but got Unknown
			//IL_0059: Unknown result type (might be due to invalid IL or missing references)
			//IL_005e: Unknown result type (might be due to invalid IL or missing references)
			//IL_006e: Expected O, but got Unknown
			//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: Expected O, but got Unknown
			orig.Invoke(self, activator);
			ExtraChallengeShrinesTeleporterComponent component = ((Component)((BaseTeleporterState)(IdleState)self).teleporterInteraction).GetComponent<ExtraChallengeShrinesTeleporterComponent>();
			if (Object.op_Implicit((Object)(object)component))
			{
				if (component.crownShrineStacks > 0)
				{
					Chat.SendBroadcastChat((ChatMessageBase)new SimpleChatMessage
					{
						baseToken = "EXTRACHALLENGESHRINES_SHRINE_CROWN_BEGIN_TRIAL"
					});
				}
				if (component.rockShrineStacks > 0)
				{
					Chat.SendBroadcastChat((ChatMessageBase)new SimpleChatMessage
					{
						baseToken = "EXTRACHALLENGESHRINES_SHRINE_ROCK_BEGIN_TRIAL"
					});
				}
				if (component.eyeShrineStacks > 0)
				{
					Chat.SendBroadcastChat((ChatMessageBase)new SimpleChatMessage
					{
						baseToken = "EXTRACHALLENGESHRINES_SHRINE_EYE_BEGIN_TRIAL"
					});
				}
			}
		}

		private void BossGroup_OnMemberAddedServer(orig_OnMemberAddedServer orig, BossGroup self, CharacterMaster memberMaster)
		{
			//IL_0063: Unknown result type (might be due to invalid IL or missing references)
			//IL_0069: Invalid comparison between Unknown and I4
			//IL_0096: Unknown result type (might be due to invalid IL or missing references)
			orig.Invoke(self, memberMaster);
			ExtraChallengeShrinesTeleporterComponent component = ((Component)self).GetComponent<ExtraChallengeShrinesTeleporterComponent>();
			if (!Object.op_Implicit((Object)(object)component) || component.crownShrineStacks <= 0)
			{
				return;
			}
			if ((Object)(object)component.crownSelectedElite == (Object)null)
			{
				component.RollCrownElite();
			}
			if ((Object)(object)component.crownSelectedElite != (Object)null)
			{
				if ((int)memberMaster.inventory.GetEquipmentIndex() == -1 && Object.op_Implicit((Object)(object)component.crownSelectedElite.eliteEquipmentDef))
				{
					memberMaster.inventory.SetEquipmentIndex(component.crownSelectedElite.eliteEquipmentDef.equipmentIndex);
				}
				memberMaster.inventory.GiveItem(Items.BoostHp, Mathf.RoundToInt((component.crownSelectedElite.healthBoostCoefficient - 1f) * 10f));
				memberMaster.inventory.GiveItem(Items.BoostDamage, Mathf.RoundToInt((component.crownSelectedElite.damageBoostCoefficient - 1f) * 10f));
			}
		}

		private void BossGroup_DropRewards(orig_DropRewards orig, BossGroup self)
		{
			//IL_00a4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a9: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ea: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ef: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f4: Unknown result type (might be due to invalid IL or missing references)
			//IL_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_010d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0112: Unknown result type (might be due to invalid IL or missing references)
			//IL_0117: Unknown result type (might be due to invalid IL or missing references)
			//IL_011c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0127: Unknown result type (might be due to invalid IL or missing references)
			//IL_012c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0131: 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_0141: Unknown result type (might be due to invalid IL or missing references)
			//IL_0146: Unknown result type (might be due to invalid IL or missing references)
			//IL_014e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0150: Unknown result type (might be due to invalid IL or missing references)
			//IL_0152: Unknown result type (might be due to invalid IL or missing references)
			//IL_0157: Unknown result type (might be due to invalid IL or missing references)
			ExtraChallengeShrinesTeleporterComponent component = ((Component)self).GetComponent<ExtraChallengeShrinesTeleporterComponent>();
			if (Object.op_Implicit((Object)(object)component) && component.rockShrineStacks > 0)
			{
				self.dropTable = ExtraChallengeShrinesTeleporterComponent.rockShrineDropTable;
			}
			orig.Invoke(self);
			if (!Object.op_Implicit((Object)(object)component) || component.crownShrineStacks <= 0 || !Object.op_Implicit((Object)(object)Run.instance) || self.rng == null || !Object.op_Implicit((Object)(object)self.dropPosition))
			{
				return;
			}
			int participatingPlayerCount = Run.instance.participatingPlayerCount;
			if (participatingPlayerCount != 0)
			{
				PickupIndex val = self.rng.NextElementUniform<PickupIndex>(Run.instance.availableTier3DropList);
				int num = ConfigurableValue<int>.op_Implicit(ShrineCrown.redDrops) + ConfigurableValue<int>.op_Implicit(ShrineCrown.redDropsPerStack) * (component.crownShrineStacks - 1);
				if (self.scaleRewardsByPlayerCount)
				{
					num *= participatingPlayerCount;
				}
				Vector3 val2 = Quaternion.AngleAxis((float)Random.Range(0, 360), Vector3.up) * (Vector3.up * 40f + Vector3.forward * 2.5f);
				Quaternion val3 = Quaternion.AngleAxis(360f / (float)num, Vector3.up);
				for (int i = 0; i < num; i++)
				{
					PickupDropletController.CreatePickupDroplet(val, self.dropPosition.position, val2);
					val2 = val3 * val2;
				}
			}
		}

		private void CombatDirector_SetNextSpawnAsBoss(orig_SetNextSpawnAsBoss orig, CombatDirector self)
		{
			//IL_02e0: Unknown result type (might be due to invalid IL or missing references)
			//IL_02e6: Invalid comparison between Unknown and I4
			//IL_0099: Unknown result type (might be due to invalid IL or missing references)
			//IL_009e: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00cf: Unknown result type (might be due to invalid IL or missing references)
			//IL_025f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0265: Invalid comparison between Unknown and I4
			//IL_00e6: 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_0146: Unknown result type (might be due to invalid IL or missing references)
			//IL_0159: Unknown result type (might be due to invalid IL or missing references)
			//IL_01bd: Unknown result type (might be due to invalid IL or missing references)
			//IL_01c2: Unknown result type (might be due to invalid IL or missing references)
			//IL_02be: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ce: Unknown result type (might be due to invalid IL or missing references)
			//IL_01d3: Unknown result type (might be due to invalid IL or missing references)
			//IL_01d5: Unknown result type (might be due to invalid IL or missing references)
			//IL_01e1: Unknown result type (might be due to invalid IL or missing references)
			//IL_0214: Unknown result type (might be due to invalid IL or missing references)
			//IL_01f6: Unknown result type (might be due to invalid IL or missing references)
			//IL_01f8: Unknown result type (might be due to invalid IL or missing references)
			orig.Invoke(self);
			ExtraChallengeShrinesTeleporterComponent tpComponent = ((Component)self).GetComponent<ExtraChallengeShrinesTeleporterComponent>();
			if (!Object.op_Implicit((Object)(object)tpComponent) || !((Object)(object)tpComponent.teleporterInteraction.bossDirector == (Object)(object)self))
			{
				return;
			}
			if (tpComponent.rockShrineStacks > 0)
			{
				WeightedSelection<DirectorCard> val = new WeightedSelection<DirectorCard>(8);
				WeightedSelection<DirectorCard> val2 = new WeightedSelection<DirectorCard>(8);
				for (int i = 0; i < self.finalMonsterCardsSelection.Count; i++)
				{
					ChoiceInfo<DirectorCard> choice = self.finalMonsterCardsSelection.GetChoice(i);
					SpawnCard spawnCard = choice.value.spawnCard;
					if (!spawnCard.prefab.GetComponent<CharacterMaster>().bodyPrefab.GetComponent<CharacterBody>().isChampion && choice.value.IsAvailable())
					{
						val.AddChoice(choice);
						val2.AddChoice(choice);
					}
				}
				if (val.Count > 0)
				{
					float monsterCredit = self.monsterCredit;
					int num = 0;
					while (num < val.Count)
					{
						DirectorCard value = val.GetChoice(num).value;
						float num2 = CombatDirector.CalcHighestEliteCostMultiplier(value.spawnCard.eliteRules);
						if ((float)value.cost * num2 * (float)self.maximumNumberToSpawnBeforeSkipping < monsterCredit)
						{
							val.RemoveChoice(num);
						}
						else
						{
							num++;
						}
					}
					if (val.Count == 0)
					{
						ChoiceInfo<DirectorCard> val3 = val2.GetChoice(0);
						for (num = 0; num < val2.Count; num++)
						{
							ChoiceInfo<DirectorCard> choice2 = val2.GetChoice(num);
							if (choice2.value.cost > val3.value.cost)
							{
								val3 = choice2;
							}
						}
						val.AddChoice(val3);
					}
					DirectorCard val4 = val.Evaluate(tpComponent.rng.nextNormalizedFloat);
					self.OverrideCurrentMonsterCard(val4);
					PreventCheapSpawnSkippingBandaid();
				}
				if (tpComponent.eyeShrineStacks <= 0 || (int)tpComponent.eyeSelectedBody == -1)
				{
					return;
				}
				DirectorCard directorCard = GetEyeShrineDirectorCard();
				if (directorCard == null)
				{
					return;
				}
				RoR2Application.fixedTimeTimers.CreateTimer(0.5f, (Action)delegate
				{
					//IL_0062: Unknown result type (might be due to invalid IL or missing references)
					if (Object.op_Implicit((Object)(object)self))
					{
						self.Spawn(directorCard.spawnCard, (EliteDef)null, Object.op_Implicit((Object)(object)self.currentSpawnTarget) ? self.currentSpawnTarget.transform : null, directorCard.spawnDistance, directorCard.preventOverhead, 0f, (PlacementMode)1);
					}
				});
			}
			else
			{
				if (tpComponent.eyeShrineStacks <= 0 || (int)tpComponent.eyeSelectedBody == -1)
				{
					return;
				}
				DirectorCard val5 = GetEyeShrineDirectorCard();
				if (val5 != null)
				{
					self.OverrideCurrentMonsterCard(val5);
					if (self.monsterCredit < (float)val5.cost)
					{
						self.monsterCredit = val5.cost;
					}
					PreventCheapSpawnSkippingBandaid();
				}
			}
			DirectorCard GetEyeShrineDirectorCard()
			{
				//IL_0012: 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)
				//IL_0018: Unknown result type (might be due to invalid IL or missing references)
				//IL_0039: Unknown result type (might be due to invalid IL or missing references)
				//IL_003e: Unknown result type (might be due to invalid IL or missing references)
				//IL_003f: 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_0054: Unknown result type (might be due to invalid IL or missing references)
				for (int j = 0; j < self.finalMonsterCardsSelection.Count; j++)
				{
					ChoiceInfo<DirectorCard> choice3 = self.finalMonsterCardsSelection.GetChoice(j);
					SpawnCard spawnCard2 = choice3.value.spawnCard;
					BodyIndex bodyIndex = spawnCard2.prefab.GetComponent<CharacterMaster>().bodyPrefab.GetComponent<CharacterBody>().bodyIndex;
					if (bodyIndex == tpComponent.eyeSelectedBody)
					{
						return choice3.value;
					}
				}
				return null;
			}
			void PreventCheapSpawnSkippingBandaid()
			{
				//IL_0041: Unknown result type (might be due to invalid IL or missing references)
				bool skipSpawnIfTooCheap = self.skipSpawnIfTooCheap;
				self.skipSpawnIfTooCheap = false;
				RoR2Application.fixedTimeTimers.CreateTimer(1f, (Action)delegate
				{
					if (Object.op_Implicit((Object)(object)self))
					{
						self.skipSpawnIfTooCheap = skipSpawnIfTooCheap;
					}
				});
			}
		}
	}
	public class ExtraChallengeShrinesTeleporterComponent : MonoBehaviour
	{
		public class SyncShrineStacks : INetMessage, ISerializableObject
		{
			private NetworkInstanceId objID;

			private int crownShrineStacks;

			private int rockShrineStacks;

			private int eyeShrineStacks;

			public SyncShrineStacks()
			{
			}

			public SyncShrineStacks(NetworkInstanceId objID, int crownShrineStacks, int rockShrineStacks, int eyeShrineStacks)
			{
				//IL_0009: Unknown result type (might be due to invalid IL or missing references)
				//IL_000a: Unknown result type (might be due to invalid IL or missing references)
				this.objID = objID;
				this.crownShrineStacks = crownShrineStacks;
				this.rockShrineStacks = rockShrineStacks;
				this.eyeShrineStacks = eyeShrineStacks;
			}

			public void Deserialize(NetworkReader reader)
			{
				//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)
				objID = reader.ReadNetworkId();
				crownShrineStacks = reader.ReadInt32();
				rockShrineStacks = reader.ReadInt32();
				eyeShrineStacks = reader.ReadInt32();
			}

			public void OnReceived()
			{
				//IL_000d: Unknown result type (might be due to invalid IL or missing references)
				if (NetworkServer.active)
				{
					return;
				}
				GameObject val = Util.FindNetworkObject(objID);
				if (Object.op_Implicit((Object)(object)val))
				{
					ExtraChallengeShrinesTeleporterComponent component = val.GetComponent<ExtraChallengeShrinesTeleporterComponent>();
					if (Object.op_Implicit((Object)(object)component))
					{
						component.crownShrineStacks = crownShrineStacks;
						component.rockShrineStacks = rockShrineStacks;
						component.eyeShrineStacks = eyeShrineStacks;
					}
				}
			}

			public void Serialize(NetworkWriter writer)
			{
				//IL_0003: Unknown result type (might be due to invalid IL or missing references)
				writer.Write(objID);
				writer.Write(crownShrineStacks);
				writer.Write(rockShrineStacks);
				writer.Write(eyeShrineStacks);
			}
		}

		public TeleporterInteraction teleporterInteraction;

		public BossGroup bossGroup;

		public NetworkIdentity networkIdentity;

		public int crownShrineStacks = 0;

		public int rockShrineStacks = 0;

		public int eyeShrineStacks = 0;

		public GameObject crownShrineIndicator;

		public GameObject rockShrineIndicator;

		public GameObject eyeShrineIndicator;

		public Xoroshiro128Plus rng;

		public EliteDef crownSelectedElite;

		public BodyIndex eyeSelectedBody = (BodyIndex)(-1);

		public static Material crownShrineIndicatorMaterial;

		public static Material rockShrineIndicatorMaterial;

		public static Material eyeShrineIndicatorMaterial;

		public static PickupDropTable rockShrineDropTable;

		public void Awake()
		{
			teleporterInteraction = ((Component)this).GetComponent<TeleporterInteraction>();
			bossGroup = ((Component)this).GetComponent<BossGroup>();
			networkIdentity = ((Component)this).GetComponent<NetworkIdentity>();
		}

		public void Start()
		{
			//IL_000c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0016: Expected O, but got Unknown
			rng = new Xoroshiro128Plus(Run.instance.stageRng);
		}

		public void FixedUpdate()
		{
			crownShrineIndicator.SetActive(crownShrineStacks > 0 && !teleporterInteraction.isCharged);
			rockShrineIndicator.SetActive(rockShrineStacks > 0 && !teleporterInteraction.isCharged);
			eyeShrineIndicator.SetActive(eyeShrineStacks > 0 && !teleporterInteraction.isCharged);
		}

		public void ServerSendSyncShrineStacks()
		{
			//IL_0015: Unknown result type (might be due to invalid IL or missing references)
			if (NetworkServer.active)
			{
				NetMessageExtensions.Send((INetMessage)(object)new SyncShrineStacks(networkIdentity.netId, crownShrineStacks, rockShrineStacks, eyeShrineStacks), (NetworkDestination)1);
			}
		}

		public void RollCrownElite()
		{
			WeightedSelection<EliteTierDef> val = new WeightedSelection<EliteTierDef>(8);
			float num = (Object.op_Implicit((Object)(object)Run.instance) ? Run.instance.stageClearCount : 0);
			for (int i = 1; i < CombatDirector.eliteTiers.Length; i++)
			{
				EliteTierDef val2 = CombatDirector.eliteTiers[i];
				if (val2.CanSelect((EliteRules)0))
				{
					val.AddChoice(val2, 1f / val2.costMultiplier + 0.04f * val2.costMultiplier * num);
				}
			}
			if (val.Count <= 0)
			{
				val.AddChoice(EliteAPI.VanillaFirstTierDef, 1f);
			}
			if (val.Count > 0)
			{
				EliteTierDef val3 = val.Evaluate(rng.nextNormalizedFloat);
				crownSelectedElite = val3.GetRandomAvailableEliteDef(rng);
			}
		}
	}
	public class ExtraChallengeShrinesContent : IContentPackProvider
	{
		public static class Resources
		{
			public static List<GameObject> bodyPrefabs = new List<GameObject>();

			public static List<GameObject> masterPrefabs = new List<GameObject>();

			public static List<GameObject> projectilePrefabs = new List<GameObject>();

			public static List<GameObject> effectPrefabs = new List<GameObject>();

			public static List<NetworkSoundEventDef> networkSoundEventDefs = new List<NetworkSoundEventDef>();

			public static List<UnlockableDef> unlockableDefs = new List<UnlockableDef>();

			public static List<Type> entityStateTypes = new List<Type>();

			public static List<EntityStateConfiguration> entityStateConfigurations = new List<EntityStateConfiguration>();

			public static List<SkillDef> skillDefs = new List<SkillDef>();

			public static List<SkillFamily> skillFamilies = new List<SkillFamily>();

			public static List<GameObject> networkedObjectPrefabs = new List<GameObject>();
		}

		public static class Items
		{
		}

		public static class Equipment
		{
		}

		public static class Buffs
		{
			public static BuffDef MysticsBadItems_RhythmCombo;
		}

		private ContentPack contentPack = new ContentPack();

		public string identifier => "Extra Challenge Shrines";

		public IEnumerator LoadStaticContentAsync(LoadStaticContentAsyncArgs args)
		{
			contentPack.identifier = identifier;
			ContentLoadHelper contentLoadHelper = new ContentLoadHelper();
			Action[] loadDispatchers = new Action[7]
			{
				delegate
				{
					contentLoadHelper.DispatchLoad<ItemDef>(ExtraChallengeShrinesPlugin.executingAssembly, typeof(BaseItem), (Action<ItemDef[]>)delegate(ItemDef[] x)
					{
						contentPack.itemDefs.Add(x);
					});
				},
				delegate
				{
					contentLoadHelper.DispatchLoad<EquipmentDef>(ExtraChallengeShrinesPlugin.executingAssembly, typeof(BaseEquipment), (Action<EquipmentDef[]>)delegate(EquipmentDef[] x)
					{
						contentPack.equipmentDefs.Add(x);
					});
				},
				delegate
				{
					contentLoadHelper.DispatchLoad<BuffDef>(ExtraChallengeShrinesPlugin.executingAssembly, typeof(BaseBuff), (Action<BuffDef[]>)delegate(BuffDef[] x)
					{
						contentPack.buffDefs.Add(x);
					});
				},
				delegate
				{
					contentLoadHelper.DispatchLoad<GameObject>(ExtraChallengeShrinesPlugin.executingAssembly, typeof(BaseInteractable), (Action<GameObject[]>)null);
				},
				delegate
				{
					contentLoadHelper.DispatchLoad<GameObject>(ExtraChallengeShrinesPlugin.executingAssembly, typeof(BaseCharacterBody), (Action<GameObject[]>)delegate(GameObject[] x)
					{
						contentPack.bodyPrefabs.Add(x);
					});
				},
				delegate
				{
					contentLoadHelper.DispatchLoad<GameObject>(ExtraChallengeShrinesPlugin.executingAssembly, typeof(BaseCharacterMaster), (Action<GameObject[]>)delegate(GameObject[] x)
					{
						contentPack.masterPrefabs.Add(x);
					});
				},
				delegate
				{
					contentLoadHelper.DispatchLoad<object>(ExtraChallengeShrinesPlugin.executingAssembly, typeof(BlankLoadableAsset), (Action<object[]>)null);
				}
			};
			int i = 0;
			while (i < loadDispatchers.Length)
			{
				loadDispatchers[i]();
				args.ReportProgress(Util.Remap((float)(i + 1), 0f, (float)loadDispatchers.Length, 0f, 0.05f));
				yield return null;
				int num = i + 1;
				i = num;
			}
			while (contentLoadHelper.coroutine.MoveNext())
			{
				args.ReportProgress(Util.Remap(contentLoadHelper.progress.value, 0f, 1f, 0.05f, 0.9f));
				yield return contentLoadHelper.coroutine.Current;
			}
			loadDispatchers = new Action[14]
			{
				delegate
				{
					ContentLoadHelper.PopulateTypeFields<ItemDef>(typeof(Items), contentPack.itemDefs, (Func<string, string>)null);
				},
				delegate
				{
					ContentLoadHelper.PopulateTypeFields<EquipmentDef>(typeof(Equipment), contentPack.equipmentDefs, (Func<string, string>)null);
				},
				delegate
				{
					ContentLoadHelper.PopulateTypeFields<BuffDef>(typeof(Buffs), contentPack.buffDefs, (Func<string, string>)null);
				},
				delegate
				{
					contentPack.bodyPrefabs.Add(Resources.bodyPrefabs.ToArray());
				},
				delegate
				{
					contentPack.masterPrefabs.Add(Resources.masterPrefabs.ToArray());
				},
				delegate
				{
					contentPack.projectilePrefabs.Add(Resources.projectilePrefabs.ToArray());
				},
				delegate
				{
					contentPack.effectDefs.Add(Resources.effectPrefabs.ConvertAll((Converter<GameObject, EffectDef>)((GameObject x) => new EffectDef(x))).ToArray());
				},
				delegate
				{
					contentPack.networkSoundEventDefs.Add(Resources.networkSoundEventDefs.ToArray());
				},
				delegate
				{
					contentPack.unlockableDefs.Add(Resources.unlockableDefs.ToArray());
				},
				delegate
				{
					contentPack.entityStateTypes.Add(Resources.entityStateTypes.ToArray());
				},
				delegate
				{
					contentPack.entityStateConfigurations.Add(Resources.entityStateConfigurations.ToArray());
				},
				delegate
				{
					contentPack.skillDefs.Add(Resources.skillDefs.ToArray());
				},
				delegate
				{
					contentPack.skillFamilies.Add(Resources.skillFamilies.ToArray());
				},
				delegate
				{
					contentPack.networkedObjectPrefabs.Add(Resources.networkedObjectPrefabs.ToArray());
				}
			};
			int j = 0;
			while (j < loadDispatchers.Length)
			{
				loadDispatchers[j]();
				args.ReportProgress(Util.Remap((float)(j + 1), 0f, (float)loadDispatchers.Length, 0.9f, 0.95f));
				yield return null;
				int num = j + 1;
				j = num;
			}
			loadDispatchers = new Action[6]
			{
				delegate
				{
					ContentLoadHelper.InvokeAfterContentPackLoaded<BaseItem>(ExtraChallengeShrinesPlugin.executingAssembly);
				},
				delegate
				{
					ContentLoadHelper.InvokeAfterContentPackLoaded<BaseEquipment>(ExtraChallengeShrinesPlugin.executingAssembly);
				},
				delegate
				{
					ContentLoadHelper.InvokeAfterContentPackLoaded<BaseBuff>(ExtraChallengeShrinesPlugin.executingAssembly);
				},
				delegate
				{
					ContentLoadHelper.InvokeAfterContentPackLoaded<BaseInteractable>(ExtraChallengeShrinesPlugin.executingAssembly);
				},
				delegate
				{
					ContentLoadHelper.InvokeAfterContentPackLoaded<BaseCharacterBody>(ExtraChallengeShrinesPlugin.executingAssembly);
				},
				delegate
				{
					ContentLoadHelper.InvokeAfterContentPackLoaded<BaseCharacterMaster>(ExtraChallengeShrinesPlugin.executingAssembly);
				}
			};
			int k = 0;
			while (k < loadDispatchers.Length)
			{
				loadDispatchers[k]();
				args.ReportProgress(Util.Remap((float)(k + 1), 0f, (float)loadDispatchers.Length, 0.95f, 0.99f));
				yield return null;
				int num = k + 1;
				k = num;
			}
		}

		public IEnumerator GenerateContentPackAsync(GetContentPackAsyncArgs args)
		{
			ContentPack.Copy(contentPack, args.output);
			args.ReportProgress(1f);
			yield break;
		}

		public IEnumerator FinalizeAsync(FinalizeAsyncArgs args)
		{
			args.ReportProgress(1f);
			yield break;
		}
	}
}
namespace ExtraChallengeShrines.Interactables
{
	public class ShrineCrown : BlankLoadableAsset
	{
		public static GameObject shrinePrefab;

		public static InteractableSpawnCard spawnCard;

		public static ConfigurableValue<float> bossCredits = ConfigurableValue.CreateFloat("com.themysticsword.extrachallengeshrines", "Extra Challenge Shrines", ExtraChallengeShrinesPlugin.config, "Shrine of the Sky", "Boss Credits", 0f, 0f, 100000f, "How many director credits to add when this shrine is first used?", (List<string>)null, ExtraChallengeShrinesPlugin.ignoreBalanceChanges, false, (Action<float>)null);

		public static ConfigurableValue<float> bossCreditsPerStack = ConfigurableValue.CreateFloat("com.themysticsword.extrachallengeshrines", "Extra Challenge Shrines", ExtraChallengeShrinesPlugin.config, "Shrine of the Sky", "Boss Credits Per Stack", 600f, 0f, 100000f, "How many director credits to add for each time this shrine is used more than once?", (List<string>)null, ExtraChallengeShrinesPlugin.ignoreBalanceChanges, false, (Action<float>)null);

		public static ConfigurableValue<int> redDrops = ConfigurableValue.CreateInt("com.themysticsword.extrachallengeshrines", "Extra Challenge Shrines", ExtraChallengeShrinesPlugin.config, "Shrine of the Sky", "Red Drops", 1, 0, 100, "How many extra red items to drop for completing the TP event?", (List<string>)null, ExtraChallengeShrinesPlugin.ignoreBalanceChanges, false, (Action<int>)null);

		public static ConfigurableValue<int> redDropsPerStack = ConfigurableValue.CreateInt("com.themysticsword.extrachallengeshrines", "Extra Challenge Shrines", ExtraChallengeShrinesPlugin.config, "Shrine of the Sky", "Red Drops Per Stack", 1, 0, 100, "How many extra red items to drop for completing the TP event for each additional use of this shrine?", (List<string>)null, ExtraChallengeShrinesPlugin.ignoreBalanceChanges, false, (Action<int>)null);

		public override void OnPluginAwake()
		{
			((BaseLoadableAsset)this).OnPluginAwake();
		}

		public override void OnLoad()
		{
			//IL_0168: Unknown result type (might be due to invalid IL or missing references)
			//IL_016d: Unknown result type (might be due to invalid IL or missing references)
			//IL_01e1: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ec: Unknown result type (might be due to invalid IL or missing references)
			//IL_01f7: 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_0302: Unknown result type (might be due to invalid IL or missing references)
			//IL_0307: Unknown result type (might be due to invalid IL or missing references)
			//IL_0312: Unknown result type (might be due to invalid IL or missing references)
			//IL_0319: Unknown result type (might be due to invalid IL or missing references)
			//IL_031b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0320: Unknown result type (might be due to invalid IL or missing references)
			//IL_0327: Unknown result type (might be due to invalid IL or missing references)
			//IL_032e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0335: Unknown result type (might be due to invalid IL or missing references)
			//IL_0341: Expected O, but got Unknown
			//IL_0342: Unknown result type (might be due to invalid IL or missing references)
			//IL_0347: Unknown result type (might be due to invalid IL or missing references)
			//IL_0352: Unknown result type (might be due to invalid IL or missing references)
			//IL_035a: Unknown result type (might be due to invalid IL or missing references)
			//IL_035c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0361: Unknown result type (might be due to invalid IL or missing references)
			//IL_0368: Unknown result type (might be due to invalid IL or missing references)
			//IL_036f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0376: Unknown result type (might be due to invalid IL or missing references)
			//IL_0382: Expected O, but got Unknown
			((BaseLoadableAsset)this).OnLoad();
			shrinePrefab = ExtraChallengeShrinesPlugin.AssetBundle.LoadAsset<GameObject>("Assets/Mods/ExtraChallengeShrines/ShrineCrown/ShrineCrown.prefab");
			Renderer[] componentsInChildren = shrinePrefab.GetComponentsInChildren<Renderer>();
			foreach (Renderer val in componentsInChildren)
			{
				Material[] sharedMaterials = val.sharedMaterials;
				foreach (Material val2 in sharedMaterials)
				{
					if ((Object)(object)val2 != (Object)null && ((Object)val2.shader).name == "Standard" && (Object)(object)val2.shader != (Object)(object)Standard.shader)
					{
						Standard.Apply(val2, (Properties)null);
						Standard.Dither(val2);
					}
				}
			}
			GameObject gameObject = ((Component)LegacyResourcesAPI.Load<GameObject>("Prefabs/NetworkedObjects/Shrines/ShrineBoss").transform.Find("Symbol")).gameObject;
			GameObject gameObject2 = ((Component)shrinePrefab.transform.Find("Symbol")).gameObject;
			gameObject2.GetComponent<MeshFilter>().mesh = Object.Instantiate<Mesh>(gameObject.GetComponent<MeshFilter>().mesh);
			Material val3 = Object.Instantiate<Material>(((Renderer)gameObject.GetComponent<MeshRenderer>()).material);
			((Renderer)gameObject2.GetComponent<MeshRenderer>()).material = val3;
			val3.SetTexture("_MainTex", ExtraChallengeShrinesPlugin.AssetBundle.LoadAsset<Texture>("Assets/Mods/ExtraChallengeShrines/ShrineCrown/Symbol.png"));
			val3.SetColor("_TintColor", Color32.op_Implicit(new Color32(byte.MaxValue, (byte)57, (byte)35, byte.MaxValue)));
			ExtraChallengeShrinesTeleporterComponent.crownShrineIndicatorMaterial = val3;
			ExtraChallengeShrinesShrineCrownBehaviour extraChallengeShrinesShrineCrownBehaviour = shrinePrefab.AddComponent<ExtraChallengeShrinesShrineCrownBehaviour>();
			extraChallengeShrinesShrineCrownBehaviour.symbolTransform = gameObject2.transform;
			ExtraChallengeShrinesContent.Resources.networkedObjectPrefabs.Add(shrinePrefab);
			spawnCard = ScriptableObject.CreateInstance<InteractableSpawnCard>();
			((Object)spawnCard).name = "iscExtraChallengeShrines_ShrineCrown";
			((SpawnCard)spawnCard).prefab = shrinePrefab;
			((SpawnCard)spawnCard).sendOverNetwork = true;
			((SpawnCard)spawnCard).hullSize = (HullClassification)1;
			((SpawnCard)spawnCard).nodeGraphType = (GraphType)0;
			((SpawnCard)spawnCard).requiredFlags = (NodeFlags)0;
			((SpawnCard)spawnCard).forbiddenFlags = (NodeFlags)16;
			((SpawnCard)spawnCard).directorCreditCost = 20;
			((SpawnCard)spawnCard).occupyPosition = true;
			spawnCard.orientToFloor = true;
			spawnCard.slightlyRandomizeOrientation = true;
			spawnCard.skipSpawnWhenSacrificeArtifactEnabled = false;
			MysticsRisky2UtilsPlugin.logger.LogInfo((object)("name: " + (object)spawnCard));
			ConfigurableValue.CreateInt("com.themysticsword.extrachallengeshrines", "Extra Challenge Shrines", ExtraChallengeShrinesPlugin.config, "Shrine of the Sky", "Director Credit Cost", 20, 0, 1000, "", (List<string>)null, (ConfigEntry<bool>)null, false, (Action<int>)delegate(int x)
			{
				((SpawnCard)spawnCard).directorCreditCost = x;
			});
			ConfigurableValue.CreateInt("com.themysticsword.extrachallengeshrines", "Extra Challenge Shrines", ExtraChallengeShrinesPlugin.config, "Shrine of the Sky", "Max Spawns Per Stage", -1, -1, 1000, "-1 means no limit", (List<string>)null, (ConfigEntry<bool>)null, false, (Action<int>)delegate(int x)
			{
				spawnCard.maxSpawnsPerStage = x;
			});
			DirectorCard directorCardRare = new DirectorCard
			{
				spawnCard = (SpawnCard)(object)spawnCard,
				selectionWeight = 1,
				spawnDistance = (MonsterSpawnDistance)0,
				preventOverhead = false,
				minimumStageCompletions = 0,
				requiredUnlockableDef = null,
				forbiddenUnlockableDef = null
			};
			DirectorCard directorCardCommon = new DirectorCard
			{
				spawnCard = (SpawnCard)(object)spawnCard,
				selectionWeight = 10,
				spawnDistance = (MonsterSpawnDistance)0,
				preventOverhead = false,
				minimumStageCompletions = 0,
				requiredUnlockableDef = null,
				forbiddenUnlockableDef = null
			};
			ConfigurableValue<string> val4 = ConfigurableValue.CreateString("com.themysticsword.extrachallengeshrines", "Extra Challenge Shrines", ExtraChallengeShrinesPlugin.config, "Shrine of the Sky", "Stages", "goolake,shipgraveyard", "", (List<string>)null, (ConfigEntry<bool>)null, true, (Action<string>)null);
			string[] array = val4.Value.Split(',');
			foreach (string text in array)
			{
				BaseInteractable.AddDirectorCardTo(text, "Shrines", directorCardCommon);
			}
			val4 = ConfigurableValue.CreateString("com.themysticsword.extrachallengeshrines", "Extra Challenge Shrines", ExtraChallengeShrinesPlugin.config, "Shrine of the Sky", "Stages (Rare)", "blackbeach,golemplains,skymeadow,wispgraveyard,ancientloft", "", (List<string>)null, (ConfigEntry<bool>)null, true, (Action<string>)null);
			string[] array2 = val4.Value.Split(',');
			foreach (string text2 in array2)
			{
				BaseInteractable.AddDirectorCardTo(text2, "Shrines", directorCardRare);
			}
			ConfigurableValue.CreateInt("com.themysticsword.extrachallengeshrines", "Extra Challenge Shrines", ExtraChallengeShrinesPlugin.config, "Shrine of the Sky", "Selection Weight", 10, 0, 1000, "", (List<string>)null, (ConfigEntry<bool>)null, false, (Action<int>)delegate(int x)
			{
				directorCardCommon.selectionWeight = x;
			});
			ConfigurableValue.CreateInt("com.themysticsword.extrachallengeshrines", "Extra Challenge Shrines", ExtraChallengeShrinesPlugin.config, "Shrine of the Sky", "Selection Weight (Rare)", 1, 0, 1000, "", (List<string>)null, (ConfigEntry<bool>)null, false, (Action<int>)delegate(int x)
			{
				directorCardRare.selectionWeight = x;
			});
			ConfigurableValue.CreateInt("com.themysticsword.extrachallengeshrines", "Extra Challenge Shrines", ExtraChallengeShrinesPlugin.config, "Shrine of the Sky", "Minimum Stage Completions", 0, 0, 99, "Need to clear this many stages before it can spawn", (List<string>)null, (ConfigEntry<bool>)null, false, (Action<int>)delegate(int x)
			{
				directorCardCommon.minimumStageCompletions = x;
				directorCardRare.minimumStageCompletions = x;
			});
		}
	}
	public class ExtraChallengeShrinesShrineCrownBehaviour : NetworkBehaviour
	{
		public int maxPurchaseCount = 1;

		public float costMultiplierPerPurchase = 2f;

		public Transform symbolTransform;

		public PurchaseInteraction purchaseInteraction;

		public int purchaseCount;

		public float refreshTimer;

		public const float refreshDuration = 0.5f;

		public bool waitingForRefresh;

		public void Start()
		{
			purchaseInteraction = ((Component)this).GetComponent<PurchaseInteraction>();
			((UnityEvent<Interactor>)(object)purchaseInteraction.onPurchase).AddListener((UnityAction<Interactor>)delegate(Interactor interactor)
			{
				purchaseInteraction.SetAvailable(false);
				AddShrineStack(interactor);
			});
		}

		public void FixedUpdate()
		{
			if (waitingForRefresh)
			{
				refreshTimer -= Time.fixedDeltaTime;
				if (refreshTimer <= 0f && purchaseCount < maxPurchaseCount)
				{
					purchaseInteraction.SetAvailable(true);
					purchaseInteraction.Networkcost = (int)(100f * (1f - Mathf.Pow(1f - (float)purchaseInteraction.cost / 100f, costMultiplierPerPurchase)));
					waitingForRefresh = false;
				}
			}
		}

		[Server]
		public void AddShrineStack(Interactor interactor)
		{
			//IL_0019: Unknown result type (might be due to invalid IL or missing references)
			//IL_001f: Invalid comparison between Unknown and I4
			//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_0073: Unknown result type (might be due to invalid IL or missing references)
			//IL_0083: Expected O, but got Unknown
			//IL_008e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0093: Unknown result type (might be due to invalid IL or missing references)
			//IL_009a: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ab: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00bb: 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_00d5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e0: Expected O, but got Unknown
			waitingForRefresh = true;
			if (Object.op_Implicit((Object)(object)TeleporterInteraction.instance) && (int)TeleporterInteraction.instance.activationState <= 1)
			{
				ExtraChallengeShrinesTeleporterComponent component = ((Component)TeleporterInteraction.instance).GetComponent<ExtraChallengeShrinesTeleporterComponent>();
				if (!Object.op_Implicit((Object)(object)component))
				{
					return;
				}
				component.crownShrineStacks++;
				component.ServerSendSyncShrineStacks();
			}
			CharacterBody component2 = ((Component)interactor).GetComponent<CharacterBody>();
			Chat.SendBroadcastChat((ChatMessageBase)new SubjectFormatChatMessage
			{
				subjectAsCharacterBody = component2,
				baseToken = "EXTRACHALLENGESHRINES_SHRINE_CROWN_USE_MESSAGE"
			});
			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(0.7372549f, 77f / 85f, 0.94509804f))
			}, true);
			purchaseCount++;
			refreshTimer = 2f;
			if (purchaseCount >= maxPurchaseCount)
			{
				((Component)symbolTransform).gameObject.SetActive(false);
			}
		}

		public override int GetNetworkChannel()
		{
			return QosChannelIndex.defaultReliable.intVal;
		}
	}
	public class ShrineEye : BlankLoadableAsset
	{
		public static GameObject shrinePrefab;

		public static InteractableSpawnCard spawnCard;

		public static ConfigurableValue<float> bossCredits = ConfigurableValue.CreateFloat("com.themysticsword.extrachallengeshrines", "Extra Challenge Shrines", ExtraChallengeShrinesPlugin.config, "Shrine of the Wind", "Boss Credits", 300f, 0f, 100000f, "How many director credits to add when this shrine is first used?", (List<string>)null, ExtraChallengeShrinesPlugin.ignoreBalanceChanges, false, (Action<float>)null);

		public static ConfigurableValue<float> bossCreditsPerStack = ConfigurableValue.CreateFloat("com.themysticsword.extrachallengeshrines", "Extra Challenge Shrines", ExtraChallengeShrinesPlugin.config, "Shrine of the Wind", "Boss Credits Per Stack", 600f, 0f, 100000f, "How many director credits to add for each time this shrine is used more than once?", (List<string>)null, ExtraChallengeShrinesPlugin.ignoreBalanceChanges, false, (Action<float>)null);

		public static ConfigurableValue<float> yellowChance = ConfigurableValue.CreateFloat("com.themysticsword.extrachallengeshrines", "Extra Challenge Shrines", ExtraChallengeShrinesPlugin.config, "Shrine of the Wind", "Yellow Chance", 25f, 0f, 100f, "How much to increase the yellow item drop chance?", (List<string>)null, ExtraChallengeShrinesPlugin.ignoreBalanceChanges, false, (Action<float>)null);

		public static ConfigurableValue<bool> yellowChanceStackingReduction = ConfigurableValue.CreateBool("com.themysticsword.extrachallengeshrines", "Extra Challenge Shrines", ExtraChallengeShrinesPlugin.config, "Shrine of the Wind", "Yellow Chance Stacking Reduction", true, "Should each additional use of this shrine add less yellow item drop chance than the previous use? For example, the first shrine will add +25%, the next one - +25%/2, the next one - +25%/3 and so on.", (List<string>)null, ExtraChallengeShrinesPlugin.ignoreBalanceChanges, false, (Action<bool>)null);

		public override void OnPluginAwake()
		{
			((BaseLoadableAsset)this).OnPluginAwake();
			NetworkingAPI.RegisterMessageType<ExtraChallengeShrinesShrineEyeBehaviour.SyncBodyOptions>();
		}

		public override void OnLoad()
		{
			//IL_016b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0170: Unknown result type (might be due to invalid IL or missing references)
			//IL_01b0: Unknown result type (might be due to invalid IL or missing references)
			//IL_01b5: Unknown result type (might be due to invalid IL or missing references)
			//IL_029f: Unknown result type (might be due to invalid IL or missing references)
			//IL_02aa: Unknown result type (might be due to invalid IL or missing references)
			//IL_02b5: Unknown result type (might be due to invalid IL or missing references)
			//IL_02c1: 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_03aa: Unknown result type (might be due to invalid IL or missing references)
			//IL_03b1: 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_03b8: Unknown result type (might be due to invalid IL or missing references)
			//IL_03bf: Unknown result type (might be due to invalid IL or missing references)
			//IL_03c6: Unknown result type (might be due to invalid IL or missing references)
			//IL_03cd: Unknown result type (might be due to invalid IL or missing references)
			//IL_03d9: Expected O, but got Unknown
			//IL_03da: Unknown result type (might be due to invalid IL or missing references)
			//IL_03df: Unknown result type (might be due to invalid IL or missing references)
			//IL_03ea: Unknown result type (might be due to invalid IL or missing references)
			//IL_03f1: Unknown result type (might be due to invalid IL or missing references)
			//IL_03f3: Unknown result type (might be due to invalid IL or missing references)
			//IL_03f8: Unknown result type (might be due to invalid IL or missing references)
			//IL_03ff: Unknown result type (might be due to invalid IL or missing references)
			//IL_0406: Unknown result type (might be due to invalid IL or missing references)
			//IL_040d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0419: Expected O, but got Unknown
			((BaseLoadableAsset)this).OnLoad();
			shrinePrefab = ExtraChallengeShrinesPlugin.AssetBundle.LoadAsset<GameObject>("Assets/Mods/ExtraChallengeShrines/ShrineEye/ShrineEye.prefab");
			Renderer[] componentsInChildren = shrinePrefab.GetComponentsInChildren<Renderer>();
			foreach (Renderer val in componentsInChildren)
			{
				Material[] sharedMaterials = val.sharedMaterials;
				foreach (Material val2 in sharedMaterials)
				{
					if ((Object)(object)val2 != (Object)null && ((Object)val2.shader).name == "Standard" && (Object)(object)val2.shader != (Object)(object)Standard.shader)
					{
						Standard.Apply(val2, (Properties)null);
						Standard.Dither(val2);
					}
				}
			}
			GameObject gameObject = ((Component)LegacyResourcesAPI.Load<GameObject>("Prefabs/NetworkedObjects/Shrines/ShrineBoss").transform.Find("Symbol")).gameObject;
			GameObject gameObject2 = ((Component)shrinePrefab.transform.Find("Symbol")).gameObject;
			gameObject2.GetComponent<MeshFilter>().mesh = Object.Instantiate<Mesh>(gameObject.GetComponent<MeshFilter>().mesh);
			Material val3 = Object.Instantiate<Material>(((Renderer)gameObject.GetComponent<MeshRenderer>()).material);
			((Renderer)gameObject2.GetComponent<MeshRenderer>()).material = val3;
			val3.SetTexture("_MainTex", ExtraChallengeShrinesPlugin.AssetBundle.LoadAsset<Texture>("Assets/Mods/ExtraChallengeShrines/ShrineEye/Symbol.png"));
			val3.SetColor("_TintColor", Color32.op_Implicit(new Color32((byte)249, byte.MaxValue, (byte)96, byte.MaxValue)));
			ExtraChallengeShrinesTeleporterComponent.eyeShrineIndicatorMaterial = val3;
			ExtraChallengeShrinesShrineEyeBehaviour extraChallengeShrinesShrineEyeBehaviour = shrinePrefab.AddComponent<ExtraChallengeShrinesShrineEyeBehaviour>();
			extraChallengeShrinesShrineEyeBehaviour.symbolTransform = gameObject2.transform;
			extraChallengeShrinesShrineEyeBehaviour.networkUIPromptController = shrinePrefab.AddComponent<NetworkUIPromptController>();
			GameObject val4 = PrefabAPI.InstantiateClone(Addressables.LoadAssetAsync<GameObject>((object)"RoR2/Base/Command/CommandPickerPanel.prefab").WaitForCompletion(), "ShrineEyePickerPanel", true);
			PickupPickerPanel component = val4.GetComponent<PickupPickerPanel>();
			BodyPickerPanel bodyPickerPanel = val4.AddComponent<BodyPickerPanel>();
			bodyPickerPanel.buttonContainer = component.buttonContainer;
			bodyPickerPanel.buttonPrefab = component.buttonPrefab;
			bodyPickerPanel.coloredImages = component.coloredImages;
			bodyPickerPanel.darkColoredImages = component.darkColoredImages;
			bodyPickerPanel.gridlayoutGroup = component.gridlayoutGroup;
			bodyPickerPanel.maxColumnCount = component.maxColumnCount;
			Object.Destroy((Object)(object)component);
			val4.GetComponentsInChildren<LanguageTextMeshController>()[0]._token = "EXTRACHALLENGESHRINES_SHRINE_EYE_INTERACTION_HEADER";
			extraChallengeShrinesShrineEyeBehaviour.pickerPanelPrefab = val4;
			ExtraChallengeShrinesContent.Resources.networkedObjectPrefabs.Add(shrinePrefab);
			spawnCard = ScriptableObject.CreateInstance<InteractableSpawnCard>();
			((Object)spawnCard).name = "iscExtraChallengeShrines_ShrineEye";
			((SpawnCard)spawnCard).prefab = shrinePrefab;
			((SpawnCard)spawnCard).sendOverNetwork = true;
			((SpawnCard)spawnCard).hullSize = (HullClassification)1;
			((SpawnCard)spawnCard).nodeGraphType = (GraphType)0;
			((SpawnCard)spawnCard).requiredFlags = (NodeFlags)0;
			((SpawnCard)spawnCard).forbiddenFlags = (NodeFlags)16;
			((SpawnCard)spawnCard).directorCreditCost = 20;
			((SpawnCard)spawnCard).occupyPosition = true;
			spawnCard.orientToFloor = true;
			spawnCard.slightlyRandomizeOrientation = true;
			spawnCard.skipSpawnWhenSacrificeArtifactEnabled = false;
			ConfigurableValue.CreateInt("com.themysticsword.extrachallengeshrines", "Extra Challenge Shrines", ExtraChallengeShrinesPlugin.config, "Shrine of the Wind", "Director Credit Cost", 20, 0, 1000, "", (List<string>)null, (ConfigEntry<bool>)null, false, (Action<int>)delegate(int x)
			{
				((SpawnCard)spawnCard).directorCreditCost = x;
			});
			ConfigurableValue.CreateInt("com.themysticsword.extrachallengeshrines", "Extra Challenge Shrines", ExtraChallengeShrinesPlugin.config, "Shrine of the Wind", "Max Spawns Per Stage", 1, -1, 1000, "-1 means no limit", (List<string>)null, (ConfigEntry<bool>)null, false, (Action<int>)delegate(int x)
			{
				spawnCard.maxSpawnsPerStage = x;
			});
			DirectorCard directorCardRare = new DirectorCard
			{
				spawnCard = (SpawnCard)(object)spawnCard,
				selectionWeight = 1,
				spawnDistance = (MonsterSpawnDistance)0,
				preventOverhead = false,
				minimumStageCompletions = 0,
				requiredUnlockableDef = null,
				forbiddenUnlockableDef = null
			};
			DirectorCard directorCardCommon = new DirectorCard
			{
				spawnCard = (SpawnCard)(object)spawnCard,
				selectionWeight = 5,
				spawnDistance = (MonsterSpawnDistance)0,
				preventOverhead = false,
				minimumStageCompletions = 0,
				requiredUnlockableDef = null,
				forbiddenUnlockableDef = null
			};
			ConfigurableValue<string> val5 = ConfigurableValue.CreateString("com.themysticsword.extrachallengeshrines", "Extra Challenge Shrines", ExtraChallengeShrinesPlugin.config, "Shrine of the Wind", "Stages", "frozenwall,wispgraveyard,rootjungle", "", (List<string>)null, (ConfigEntry<bool>)null, true, (Action<string>)null);
			string[] array = val5.Value.Split(',');
			foreach (string text in array)
			{
				BaseInteractable.AddDirectorCardTo(text, "Shrines", directorCardCommon);
			}
			val5 = ConfigurableValue.CreateString("com.themysticsword.extrachallengeshrines", "Extra Challenge Shrines", ExtraChallengeShrinesPlugin.config, "Shrine of the Wind", "Stages (Rare)", "shipgraveyard,skymeadow,snowyforest", "", (List<string>)null, (ConfigEntry<bool>)null, true, (Action<string>)null);
			string[] array2 = val5.Value.Split(',');
			foreach (string text2 in array2)
			{
				BaseInteractable.AddDirectorCardTo(text2, "Shrines", directorCardRare);
			}
			ConfigurableValue.CreateInt("com.themysticsword.extrachallengeshrines", "Extra Challenge Shrines", ExtraChallengeShrinesPlugin.config, "Shrine of the Wind", "Selection Weight", 5, 0, 1000, "", (List<string>)null, (ConfigEntry<bool>)null, false, (Action<int>)delegate(int x)
			{
				directorCardCommon.selectionWeight = x;
			});
			ConfigurableValue.CreateInt("com.themysticsword.extrachallengeshrines", "Extra Challenge Shrines", ExtraChallengeShrinesPlugin.config, "Shrine of the Wind", "Selection Weight (Rare)", 1, 0, 1000, "", (List<string>)null, (ConfigEntry<bool>)null, false, (Action<int>)delegate(int x)
			{
				directorCardRare.selectionWeight = x;
			});
			ConfigurableValue.CreateInt("com.themysticsword.extrachallengeshrines", "Extra Challenge Shrines", ExtraChallengeShrinesPlugin.config, "Shrine of the Wind", "Minimum Stage Completions", 0, 0, 99, "Need to clear this many stages before it can spawn", (List<string>)null, (ConfigEntry<bool>)null, false, (Action<int>)delegate(int x)
			{
				directorCardCommon.minimumStageCompletions = x;
				directorCardRare.minimumStageCompletions = x;
			});
			SceneDirector.onGenerateInteractableCardSelection += SceneDirector_onGenerateInteractableCardSelection;
		}

		private void SceneDirector_onGenerateInteractableCardSelection(SceneDirector sceneDirector, DirectorCardCategorySelection dccs)
		{
			if (Object.op_Implicit((Object)(object)RunArtifactManager.instance) && RunArtifactManager.instance.IsArtifactEnabled(Artifacts.singleMonsterTypeArtifactDef))
			{
				dccs.RemoveCardsThatFailFilter((Predicate<DirectorCard>)delegate(DirectorCard x)
				{
					GameObject prefab = x.spawnCard.prefab;
					return !Object.op_Implicit((Object)(object)prefab.GetComponent<ExtraChallengeShrinesShrineEyeBehaviour>());
				});
			}
		}
	}
	public class ExtraChallengeShrinesShrineEyeBehaviour : NetworkBehaviour, IBodyPickerPanelSignalReceiver
	{
		public class SyncBodyOptions : INetMessage, ISerializableObject
		{
			private NetworkInstanceId objID;

			private List<BodyIndex> bodyOptions;

			public SyncBodyOptions()
			{
			}

			public SyncBodyOptions(NetworkInstanceId objID, List<BodyIndex> bodyOptions)
			{
				//IL_0009: Unknown result type (might be due to invalid IL or missing references)
				//IL_000a: Unknown result type (might be due to invalid IL or missing references)
				this.objID = objID;
				this.bodyOptions = bodyOptions;
			}

			public void Deserialize(NetworkReader reader)
			{
				//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)
				objID = reader.ReadNetworkId();
				int num = reader.ReadInt32();
				bodyOptions = new List<BodyIndex>();
				for (int i = 0; i < num; i++)
				{
					bodyOptions.Add((BodyIndex)reader.ReadInt32());
				}
			}

			public void OnReceived()
			{
				//IL_000d: Unknown result type (might be due to invalid IL or missing references)
				if (NetworkServer.active)
				{
					return;
				}
				GameObject val = Util.FindNetworkObject(objID);
				if (Object.op_Implicit((Object)(object)val))
				{
					ExtraChallengeShrinesShrineEyeBehaviour component = val.GetComponent<ExtraChallengeShrinesShrineEyeBehaviour>();
					if (Object.op_Implicit((Object)(object)component))
					{
						component.bodyOptions = bodyOptions;
					}
				}
			}

			public void Serialize(NetworkWriter writer)
			{
				//IL_0003: Unknown result type (might be due to invalid IL or missing references)
				//IL_002d: Unknown result type (might be due to invalid IL or missing references)
				//IL_0037: Expected I4, but got Unknown
				writer.Write(objID);
				writer.Write(bodyOptions.Count);
				for (int i = 0; i < bodyOptions.Count; i++)
				{
					writer.Write((int)bodyOptions[i]);
				}
			}
		}

		public int maxPurchaseCount = 1;

		public float costMultiplierPerPurchase = 2f;

		public Transform symbolTransform;

		public PurchaseInteraction purchaseInteraction;

		public int purchaseCount;

		public float refreshTimer;

		public const float refreshDuration = 0.5f;

		public bool waitingForRefresh;

		public NetworkIdentity networkIdentity;

		public NetworkUIPromptController networkUIPromptController;

		public GameObject pickerPanelPrefab;

		private GameObject panelInstance;

		private BodyPickerPanel panelInstanceController;

		public List<BodyIndex> bodyOptions = new List<BodyIndex>();

		public float buildBodyOptionsAttemptTimer = 2f;

		public BodyIndex selectedBody = (BodyIndex)(-1);

		public void Start()
		{
			networkIdentity = ((Component)this).GetComponent<NetworkIdentity>();
			purchaseInteraction = ((Component)this).GetComponent<PurchaseInteraction>();
			((UnityEvent<Interactor>)(object)purchaseInteraction.onPurchase).AddListener((UnityAction<Interactor>)delegate(Interactor interactor)
			{
				//IL_0044: Unknown result type (might be due to invalid IL or missing references)
				//IL_004a: Invalid comparison between Unknown and I4
				if (bodyOptions.Count > 0)
				{
					purchaseInteraction.SetAvailable(false);
					if (Object.op_Implicit((Object)(object)TeleporterInteraction.instance))
					{
						ExtraChallengeShrinesTeleporterComponent component = ((Component)TeleporterInteraction.instance).GetComponent<ExtraChallengeShrinesTeleporterComponent>();
						if (Object.op_Implicit((Object)(object)component) && (int)component.eyeSelectedBody == -1)
						{
							networkUIPromptController.SetParticipantMasterFromInteractor(interactor);
							return;
						}
					}
					AddShrineStack(interactor);
				}
			});
			if (NetworkClient.active)
			{
				networkUIPromptController.onDisplayBegin += OnDisplayBegin;
				networkUIPromptController.onDisplayEnd += OnDisplayEnd;
			}
			if (NetworkServer.active)
			{
				networkUIPromptController.messageFromClientHandler = HandleNetworkUIPromptControllerClientMessage;
			}
		}

		private void HandleNetworkUIPromptControllerClientMessage(NetworkReader reader)
		{
			//IL_0046: Unknown result type (might be due to invalid IL or missing references)
			//IL_004c: Invalid comparison between Unknown and I4
			switch (reader.ReadByte())
			{
			case 0:
			{
				int choiceIndex = reader.ReadInt32();
				HandleBodySelected(choiceIndex);
				networkUIPromptController.SetParticipantMaster((CharacterMaster)null);
				break;
			}
			case 1:
				networkUIPromptController.SetParticipantMaster((CharacterMaster)null);
				if ((int)selectedBody == -1 && purchaseCount < maxPurchaseCount)
				{
					purchaseInteraction.SetAvailable(true);
				}
				break;
			}
		}

		private void OnDisplayBegin(NetworkUIPromptController networkUIPromptController, LocalUser localUser, CameraRigController cameraRigController)
		{
			panelInstance = Object.Instantiate<GameObject>(pickerPanelPrefab, cameraRigController.hud.mainContainer.transform);
			panelInstanceController = panelInstance.GetComponent<BodyPickerPanel>();
			panelInstanceController.signalReceiver = this;
			panelInstanceController.SetPickupOptions(bodyOptions);
			OnDestroyCallback.AddCallback(panelInstance, (Action<OnDestroyCallback>)OnPanelDestroyed);
		}

		private void OnDisplayEnd(NetworkUIPromptController networkUIPromptController, LocalUser localUser, CameraRigController cameraRigController)
		{
			Object.Destroy((Object)(object)panelInstance);
			panelInstance = null;
			panelInstanceController = null;
		}

		public void SubmitBodyPickerChoice(int choiceIndex)
		{
			if (!NetworkServer.active)
			{
				NetworkWriter val = networkUIPromptController.BeginMessageToServer();
				val.Write((byte)0);
				val.Write(choiceIndex);
				networkUIPromptController.FinishMessageToServer(val);
			}
			else
			{
				networkUIPromptController.SetParticipantMaster((CharacterMaster)null);
				HandleBodySelected(choiceIndex);
			}
		}

		private void OnPanelDestroyed(OnDestroyCallback onDestroyCallback)
		{
			//IL_002a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0030: Invalid comparison between Unknown and I4
			NetworkWriter val = networkUIPromptController.BeginMessageToServer();
			val.Write((byte)1);
			networkUIPromptController.FinishMessageToServer(val);
			if (NetworkServer.active && (int)selectedBody == -1 && purchaseCount < maxPurchaseCount)
			{
				purchaseInteraction.SetAvailable(true);
			}
		}

		private void RebuildBodyOptions()
		{
			//IL_0108: 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_005f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0061: 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_00d5: Unknown result type (might be due to invalid IL or missing references)
			if (!NetworkServer.active)
			{
				return;
			}
			bodyOptions.Clear();
			if (Object.op_Implicit((Object)(object)TeleporterInteraction.instance))
			{
				CombatDirector bossDirector = TeleporterInteraction.instance.bossDirector;
				if (Object.op_Implicit((Object)(object)bossDirector))
				{
					for (int i = 0; i < bossDirector.finalMonsterCardsSelection.Count; i++)
					{
						ChoiceInfo<DirectorCard> choice = bossDirector.finalMonsterCardsSelection.GetChoice(i);
						SpawnCard spawnCard = choice.value.spawnCard;
						CharacterBody component = spawnCard.prefab.GetComponent<CharacterMaster>().bodyPrefab.GetComponent<CharacterBody>();
						bool isChampion = component.isChampion;
						CharacterSpawnCard val = (CharacterSpawnCard)(object)((spawnCard is CharacterSpawnCard) ? spawnCard : null);
						bool flag = (Object)(object)val != (Object)null && val.forbiddenAsBoss;
						if (isChampion && !flag && choice.value.IsAvailable())
						{
							bodyOptions.Add(component.bodyIndex);
						}
					}
				}
			}
			NetMessageExtensions.Send((INetMessage)(object)new SyncBodyOptions(networkIdentity.netId, bodyOptions), (NetworkDestination)1);
		}

		private void HandleBodySelected(int choiceIndex)
		{
			//IL_0030: 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)
			if (NetworkServer.active && (ulong)choiceIndex < (ulong)bodyOptions.Count)
			{
				selectedBody = bodyOptions[choiceIndex];
				AddShrineStack(purchaseInteraction.lastActivator);
			}
		}

		public void FixedUpdate()
		{
			if (waitingForRefresh)
			{
				refreshTimer -= Time.fixedDeltaTime;
				if (refreshTimer <= 0f && purchaseCount < maxPurchaseCount)
				{
					purchaseInteraction.SetAvailable(true);
					purchaseInteraction.Networkcost = (int)(100f * (1f - Mathf.Pow(1f - (float)purchaseInteraction.cost / 100f, costMultiplierPerPurchase)));
					waitingForRefresh = false;
				}
			}
			if (bodyOptions.Count <= 0 && NetworkServer.active)
			{
				buildBodyOptionsAttemptTimer -= Time.fixedDeltaTime;
				if (buildBodyOptionsAttemptTimer <= 0f)
				{
					buildBodyOptionsAttemptTimer = 2f;
					RebuildBodyOptions();
				}
			}
		}

		[Server]
		public void AddShrineStack(Interactor interactor)
		{
			//IL_0019: Unknown result type (might be due to invalid IL or missing references)
			//IL_001f: Invalid comparison between Unknown and I4
			//IL_00cd: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00da: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ea: Expected O, but got Unknown
			//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_0101: Unknown result type (might be due to invalid IL or missing references)
			//IL_010c: Unknown result type (might be due to invalid IL or missing references)
			//IL_010d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0112: Unknown result type (might be due to invalid IL or missing references)
			//IL_0117: Unknown result type (might be due to invalid IL or missing references)
			//IL_0122: Unknown result type (might be due to invalid IL or missing references)
			//IL_0132: Unknown result type (might be due to invalid IL or missing references)
			//IL_0137: Unknown result type (might be due to invalid IL or missing references)
			//IL_013c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0147: Expected O, but got Unknown
			//IL_00a1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a7: Invalid comparison between Unknown and I4
			//IL_00b4: 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)
			waitingForRefresh = true;
			if (Object.op_Implicit((Object)(object)TeleporterInteraction.instance) && (int)TeleporterInteraction.instance.activationState <= 1)
			{
				ExtraChallengeShrinesTeleporterComponent component = ((Component)TeleporterInteraction.instance).GetComponent<ExtraChallengeShrinesTeleporterComponent>();
				if (!Object.op_Implicit((Object)(object)component))
				{
					return;
				}
				component.eyeShrineStacks++;
				float num = ConfigurableValue<float>.op_Implicit(ShrineEye.yellowChance) / 100f;
				if (ConfigurableValue<bool>.op_Implicit(ShrineEye.yellowChanceStackingReduction))
				{
					num /= (float)Mathf.Max(component.eyeShrineStacks, 1);
				}
				BossGroup bossGroup = component.bossGroup;
				bossGroup.bossDropChance += num;
				if ((int)selectedBody != -1)
				{
					component.eyeSelectedBody = selectedBody;
				}
				component.ServerSendSyncShrineStacks();
			}
			CharacterBody component2 = ((Component)interactor).GetComponent<CharacterBody>();
			Chat.SendBroadcastChat((ChatMessageBase)new SubjectFormatChatMessage
			{
				subjectAsCharacterBody = component2,
				baseToken = "EXTRACHALLENGESHRINES_SHRINE_EYE_USE_MESSAGE"
			});
			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(0.7372549f, 77f / 85f, 0.94509804f))
			}, true);
			purchaseCount++;
			refreshTimer = 2f;
			if (purchaseCount >= maxPurchaseCount)
			{
				((Component)symbolTransform).gameObject.SetActive(false);
			}
		}

		public override int GetNetworkChannel()
		{
			return QosChannelIndex.defaultReliable.intVal;
		}
	}
	public interface IBodyPickerPanelSignalReceiver
	{
		void SubmitBodyPickerChoice(int choiceIndex);
	}
	public class BodyPickerPanel : MonoBehaviour
	{
		public GridLayoutGroup gridlayoutGroup;

		public RectTransform buttonContainer;

		public GameObject buttonPrefab;

		public Image[] coloredImages;

		public Image[] darkColoredImages;

		public int maxColumnCount;

		private UIElementAllocator<MPButton> buttonAllocator;

		public IBodyPickerPanelSignalReceiver signalReceiver;

		public void Awake()
		{
			buttonAllocator = new UIElementAllocator<MPButton>(buttonContainer, buttonPrefab, true, false);
			buttonAllocator.onCreateElement = OnCreateButton;
			gridlayoutGroup.constraint = (Constraint)1;
			gridlayoutGroup.constraintCount = maxColumnCount;
		}

		public void OnCreateButton(int index, MPButton button)
		{
			//IL_0022: Unknown result type (might be due to invalid IL or missing references)
			//IL_002c: Expected O, but got Unknown
			((UnityEvent)((Button)button).onClick).AddListener((UnityAction)delegate
			{
				signalReceiver.SubmitBodyPickerChoice(index);
			});
		}

		public void SetPickupOptions(List<BodyIndex> options)
		{
			//IL_00ce: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d4: Expected O, but got Unknown
			//IL_003d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0042: Unknown result type (might be due to invalid IL or missing references)
			//IL_0047: 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)
			//IL_0050: 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_0124: 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_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_0072: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ab: 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_01ec: Unknown result type (might be due to invalid IL or missing references)
			//IL_01f7: Unknown result type (might be due to invalid IL or missing references)
			//IL_0272: Unknown result type (might be due to invalid IL or missing references)
			buttonAllocator.AllocateElements(options.Count);
			ReadOnlyCollection<MPButton> elements = buttonAllocator.elements;
			Sprite val = LegacyResourcesAPI.Load<Sprite>("Textures/MiscIcons/texUnlockIcon");
			if (options.Count != 0)
			{
				Color val2 = Color32.op_Implicit(ColorCatalog.GetColor((ColorIndex)13));
				Color val3 = Color32.op_Implicit(ColorCatalog.GetColor((ColorIndex)22));
				Image[] array = coloredImages;
				foreach (Image obj in array)
				{
					((Graphic)obj).color = ((Graphic)obj).color * val2;
				}
				array = darkColoredImages;
				foreach (Image obj2 in array)
				{
					((Graphic)obj2).color = ((Graphic)obj2).color * val3;
				}
			}
			MaterialPropertyBlock val4 = new MaterialPropertyBlock();
			for (int k = 0; k < options.Count; k++)
			{
				MPButton val5 = elements[k];
				int num = k - k % maxColumnCount;
				int num2 = k % maxColumnCount;
				int num3 = num2 - maxColumnCount;
				int num4 = num2 - 1;
				int num5 = num2 + 1;
				int num6 = num2 + maxColumnCount;
				Navigation navigation = ((Selectable)val5).navigation;
				((Navigation)(ref navigation)).mode = (Mode)4;
				if (num4 >= 0)
				{
					MPButton selectOnLeft = elements[num + num4];
					((Navigation)(ref navigation)).selectOnLeft = (Selectable)(object)selectOnLeft;
				}
				if (num5 < maxColumnCount && num + num5 < options.Count)
				{
					MPButton selectOnRight = elements[num + num5];
					((Navigation)(ref navigation)).selectOnRight = (Selectable)(object)selectOnRight;
				}
				if (num + num3 >= 0)
				{
					MPButton selectOnUp = elements[num + num3];
					((Navigation)(ref navigation)).selectOnUp = (Selectable)(object)selectOnUp;
				}
				if (num + num6 < options.Count)
				{
					MPButton selectOnDown = elements[num + num6];
					((Navigation)(ref navigation)).selectOnDown = (Selectable)(object)selectOnDown;
				}
				((Selectable)val5).navigation = navigation;
				CharacterBody bodyPrefabBodyComponent = BodyCatalog.GetBodyPrefabBodyComponent(options[k]);
				Image component = ((Component)((Component)val5).GetComponent<ChildLocator>().FindChild("Icon")).GetComponent<Image>();
				GameObject gameObject = ((Component)component).gameObject;
				foreach (Image item in ((Component)component).GetComponents<Image>().ToList())
				{
					Object.DestroyImmediate((Object)(object)item);
				}
				RawImage val6 = gameObject.AddComponent<RawImage>();
				((Graphic)val6).color = Color.white;
				val6.texture = (Texture)(((Object)(object)bodyPrefabBodyComponent != (Object)null) ? ((object)bodyPrefabBodyComponent.portraitIcon) : ((object)val.texture));
				((Selectable)val5).interactable = true;
			}
		}
	}
	public class ShrineRock : BlankLoadableAsset
	{
		public static GameObject shrinePrefab;

		public static InteractableSpawnCard spawnCard;

		public static ConfigurableValue<float> bossCredits = ConfigurableValue.CreateFloat("com.themysticsword.extrachallengeshrines", "Extra Challenge Shrines", ExtraChallengeShrinesPlugin.config, "Shrine of the Earth", "Boss Credits", 300f, 0f, 100000f, "How many director credits to add when this shrine is first used?", (List<string>)null, ExtraChallengeShrinesPlugin.ignoreBalanceChanges, false, (Action<float>)null);

		public static ConfigurableValue<float> bossCreditsPerStack = ConfigurableValue.CreateFloat("com.themysticsword.extrachallengeshrines", "Extra Challenge Shrines", ExtraChallengeShrinesPlugin.config, "Shrine of the Earth", "Boss Credits Per Stack", 600f, 0f, 100000f, "How many director credits to add for each time this shrine is used more than once?", (List<string>)null, ExtraChallengeShrinesPlugin.ignoreBalanceChanges, false, (Action<float>)null);

		public static ConfigurableValue<int> extraDrops = ConfigurableValue.CreateInt("com.themysticsword.extrachallengeshrines", "Extra Challenge Shrines", ExtraChallengeShrinesPlugin.config, "Shrine of the Earth", "Extra Drops", 2, 0, 100, "How many extra items to drop for completing the TP event?", (List<string>)null, ExtraChallengeShrinesPlugin.ignoreBalanceChanges, false, (Action<int>)null);

		public static ConfigurableValue<int> extraDropsPerStack = ConfigurableValue.CreateInt("com.themysticsword.extrachallengeshrines", "Extra Challenge Shrines", ExtraChallengeShrinesPlugin.config, "Shrine of the Earth", "Extra Drops Per Stack", 3, 0, 100, "How many extra items to drop for completing the TP event per additional use of this shrine?", (List<string>)null, ExtraChallengeShrinesPlugin.ignoreBalanceChanges, false, (Action<int>)null);

		public override void OnPluginAwake()
		{
			((BaseLoadableAsset)this).OnPluginAwake();
		}

		public override void OnLoad()
		{
			//IL_016e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0173: Unknown result type (might be due to invalid IL or missing references)
			//IL_01e7: Unknown result type (might be due to invalid IL or missing references)
			//IL_01f2: Unknown result type (might be due to invalid IL or missing references)
			//IL_01fd: Unknown result type (might be due to invalid IL or missing references)
			//IL_0209: Unknown result type (might be due to invalid IL or missing references)
			//IL_02e2: Unknown result type (might be due to invalid IL or missing references)
			//IL_02e7: Unknown result type (might be due to invalid IL or missing references)
			//IL_02f2: Unknown result type (might be due to invalid IL or missing references)
			//IL_02f9: Unknown result type (might be due to invalid IL or missing references)
			//IL_02fb: Unknown result type (might be due to invalid IL or missing references)
			//IL_0300: Unknown result type (might be due to invalid IL or missing references)
			//IL_0307: 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_0315: Unknown result type (might be due to invalid IL or missing references)
			//IL_0321: Expected O, but got Unknown
			//IL_0322: Unknown result type (might be due to invalid IL or missing references)
			//IL_0327: Unknown result type (might be due to invalid IL or missing references)
			//IL_0332: Unknown result type (might be due to invalid IL or missing references)
			//IL_0339: Unknown result type (might be due to invalid IL or missing references)
			//IL_033b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0340: Unknown result type (might be due to invalid IL or missing references)
			//IL_0347: Unknown result type (might be due to invalid IL or missing references)
			//IL_034e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0355: Unknown result type (might be due to invalid IL or missing references)
			//IL_0361: Expected O, but got Unknown
			((BaseLoadableAsset)this).OnLoad();
			shrinePrefab = ExtraChallengeShrinesPlugin.AssetBundle.LoadAsset<GameObject>("Assets/Mods/ExtraChallengeShrines/ShrineRock/ShrineRock.prefab");
			Renderer[] componentsInChildren = shrinePrefab.GetComponentsInChildren<Renderer>();
			foreach (Renderer val in componentsInChildren)
			{
				Material[] sharedMaterials = val.sharedMaterials;
				foreach (Material val2 in sharedMaterials)
				{
					if ((Object)(object)val2 != (Object)null && ((Object)val2.shader).name == "Standard" && (Object)(object)val2.shader != (Object)(object)Standard.shader)
					{
						Standard.Apply(val2, (Properties)null);
						Standard.Dither(val2);
					}
				}
			}
			GameObject gameObject = ((Component)LegacyResourcesAPI.Load<GameObject>("Prefabs/NetworkedObjects/Shrines/ShrineBoss").transform.Find("Symbol")).gameObject;
			GameObject gameObject2 = ((Component)shrinePrefab.transform.Find("Symbol")).gameObject;
			gameObject2.GetComponent<MeshFilter>().mesh = Object.Instantiate<Mesh>(gameObject.GetComponent<MeshFilter>().mesh);
			Material val3 = Object.Instantiate<Material>(((Renderer)gameObject.GetComponent<MeshRenderer>()).material);
			((Renderer)gameObject2.GetComponent<MeshRenderer>()).material = val3;
			val3.SetTexture("_MainTex", ExtraChallengeShrinesPlugin.AssetBundle.LoadAsset<Texture>("Assets/Mods/ExtraChallengeShrines/ShrineRock/Symbol.png"));
			val3.SetColor("_TintColor", Color32.op_Implicit(new Color32((byte)238, byte.MaxValue, (byte)226, byte.MaxValue)));
			ExtraChallengeShrinesTeleporterComponent.rockShrineIndicatorMaterial = val3;
			ExtraChallengeShrinesShrineRockBehaviour extraChallengeShrinesShrineRockBehaviour = shrinePrefab.AddComponent<ExtraChallengeShrinesShrineRockBehaviour>();
			extraChallengeShrinesShrineRockBehaviour.symbolTransform = gameObject2.transform;
			ExtraChallengeShrinesContent.Resources.networkedObjectPrefabs.Add(shrinePrefab);
			spawnCard = ScriptableObject.CreateInstance<InteractableSpawnCard>();
			((Object)spawnCard).name = "iscExtraChallengeShrines_ShrineRock";
			((SpawnCard)spawnCard).prefab = shrinePrefab;
			((SpawnCard)spawnCard).sendOverNetwork = true;
			((SpawnCard)spawnCard).hullSize = (HullClassification)1;
			((SpawnCard)spawnCard).nodeGraphType = (GraphType)0;
			((SpawnCard)spawnCard).requiredFlags = (NodeFlags)0;
			((SpawnCard)spawnCard).forbiddenFlags = (NodeFlags)16;
			((SpawnCard)spawnCard).directorCreditCost = 20;
			((SpawnCard)spawnCard).occupyPosition = true;
			spawnCard.orientToFloor = true;
			spawnCard.slightlyRandomizeOrientation = true;
			spawnCard.skipSpawnWhenSacrificeArtifactEnabled = false;
			ConfigurableValue.CreateInt("com.themysticsword.extrachallengeshrines", "Extra Challenge Shrines", ExtraChallengeShrinesPlugin.config, "Shrine of the Earth", "Director Credit Cost", 20, 0, 1000, "", (List<string>)null, (ConfigEntry<bool>)null, false, (Action<int>)delegate(int x)
			{
				((SpawnCard)spawnCard).directorCreditCost = x;
			});
			ConfigurableValue.CreateInt("com.themysticsword.extrachallengeshrines", "Extra Challenge Shrines", ExtraChallengeShrinesPlugin.config, "Shrine of the Earth", "Max Spawns Per Stage", -1, -1, 1000, "-1 means no limit", (List<string>)null, (ConfigEntry<bool>)null, false, (Action<int>)delegate(int x)
			{
				spawnCard.maxSpawnsPerStage = x;
			});
			DirectorCard directorCardRare = new DirectorCard
			{
				spawnCard = (SpawnCard)(object)spawnCard,
				selectionWeight = 1,
				spawnDistance = (MonsterSpawnDistance)0,
				preventOverhead = false,
				minimumStageCompletions = 0,
				requiredUnlockableDef = null,
				forbiddenUnlockableDef = null
			};
			DirectorCard directorCardCommon = new DirectorCard
			{
				spawnCard = (SpawnCard)(object)spawnCard,
				selectionWeight = 5,
				spawnDistance = (MonsterSpawnDistance)0,
				preventOverhead = false,
				minimumStageCompletions = 0,
				requiredUnlockableDef = null,
				forbiddenUnlockableDef = null
			};
			ConfigurableValue<string> val4 = ConfigurableValue.CreateString("com.themysticsword.extrachallengeshrines", "Extra Challenge Shrines", ExtraChallengeShrinesPlugin.config, "Shrine of the Earth", "Stages", "dampcavesimple,wispgraveyard", "", (List<string>)null, (ConfigEntry<bool>)null, true, (Action<string>)null);
			string[] array = val4.Value.Split(',');
			foreach (string text in array)
			{
				BaseInteractable.AddDirectorCardTo(text, "Shrines", directorCardCommon);
			}
			val4 = ConfigurableValue.CreateString("com.themysticsword.extrachallengeshrines", "Extra Challenge Shrines", ExtraChallengeShrinesPlugin.config, "Shrine of the Earth", "Stages (Rare)", "blackbeach,foggyswamp,golemplains,rootjungle,shipgraveyard,skymeadow,ancientloft,snowyforest", "", (List<string>)null, (ConfigEntry<bool>)null, true, (Action<string>)null);
			string[] array2 = val4.Value.Split(',');
			foreach (string text2 in array2)
			{
				BaseInteractable.AddDirectorCardTo(text2, "Shrines", directorCardRare);
			}
			ConfigurableValue.CreateInt("com.themysticsword.extrachallengeshrines", "Extra Challenge Shrines", ExtraChallengeShrinesPlugin.config, "Shrine of the Earth", "Selection Weight", 5, 0, 1000, "", (List<string>)null, (ConfigEntry<bool>)null, false, (Action<int>)delegate(int x)
			{
				directorCardCommon.selectionWeight = x;
			});
			ConfigurableValue.CreateInt("com.themysticsword.extrachallengeshrines", "Extra Challenge Shrines", ExtraChallengeShrinesPlugin.config, "Shrine of the Earth", "Selection Weight (Rare)", 1, 0, 1000, "", (List<string>)null, (ConfigEntry<bool>)null, false, (Action<int>)delegate(int x)
			{
				directorCardRare.selectionWeight = x;
			});
			ConfigurableValue.CreateInt("com.themysticsword.extrachallengeshrines", "Extra Challenge Shrines", ExtraChallengeShrinesPlugin.config, "Shrine of the Earth", "Minimum Stage Completions", 1, 0, 99, "Need to clear this many stages before it can spawn", (List<string>)null, (ConfigEntry<bool>)null, false, (Action<int>)delegate(int x)
			{
				directorCardCommon.minimumStageCompletions = x;
				directorCardRare.minimumStageCompletions = x;
			});
			SceneDirector.onGenerateInteractableCardSelection += SceneDirector_onGenerateInteractableCardSelection;
		}

		private void SceneDirector_onGenerateInteractableCardSelection(SceneDirector sceneDirector, DirectorCardCategorySelection dccs)
		{
			if (Object.op_Implicit((Object)(object)RunArtifactManager.instance) && RunArtifactManager.instance.IsArtifactEnabled(Artifacts.singleMonsterTypeArtifactDef))
			{
				dccs.RemoveCardsThatFailFilter((Predicate<DirectorCard>)delegate(DirectorCard x)
				{
					GameObject prefab = x.spawnCard.prefab;
					return !Object.op_Implicit((Object)(object)prefab.GetComponent<ExtraChallengeShrinesShrineRockBehaviour>());
				});
			}
		}
	}
	public class ExtraChallengeShrinesShrineRockBehaviour : NetworkBehaviour
	{
		public int maxPurchaseCount = 1;

		public float costMultiplierPerPurchase = 2f;

		public Transform symbolTransform;

		public PurchaseInteraction purchaseInteraction;

		public int purchaseCount;

		public float refreshTimer;

		public const float refreshDuration = 0.5f;

		public bool waitingForRefresh;

		public void Start()
		{
			purchaseInteraction = ((Component)this).GetComponent<PurchaseInteraction>();
			((UnityEvent<Interactor>)(object)purchaseInteraction.onPurchase).AddListener((UnityAction<Interactor>)delegate(Interactor interactor)
			{
				purchaseInteraction.SetAvailable(false);
				AddShrineStack(interactor);
			});
		}

		public void FixedUpdate()
		{
			if (waitingForRefresh)
			{
				refreshTimer -= Time.fixedDeltaTime;
				if (refreshTimer <= 0f && purchaseCount < maxPurchaseCount)
				{
					purchaseInteraction.SetAvailable(true);
					purchaseInteraction.Networkcost = (int)(100f * (1f - Mathf.Pow(1f - (float)purchaseInteraction.cost / 100f, costMultiplierPerPurchase)));
					waitingForRefresh = false;
				}
			}
		}

		[Server]
		public void AddShrineStack(Interactor interactor)
		{
			//IL_0019: Unknown result type (might be due to invalid IL or missing references)
			//IL_001f: Invalid comparison between Unknown and I4
			//IL_00b8: Unknown result type (might be due to invalid IL or missing references)
			//IL_00bd: 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_00d5: Expected O, but got Unknown
			//IL_00e0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ec: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f8: Unknown result type (might be due to invalid IL or missing references)
			//IL_00fd: Unknown result type (might be due to invalid IL or missing references)
			//IL_0102: Unknown result type (might be due to invalid IL or missing references)
			//IL_010d: Unknown result type (might be due to invalid IL or missing references)
			//IL_011d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0122: Unknown result type (might be due to invalid IL or missing references)
			//IL_0127: Unknown result type (might be due to invalid IL or missing references)
			//IL_0132: Expected O, but got Unknown
			waitingForRefresh = true;
			if (Object.op_Implicit((Object)(object)TeleporterInteraction.instance) && (int)TeleporterInteraction.instance.activationState <= 1)
			{
				ExtraChallengeShrinesTeleporterComponent component = ((Component)TeleporterInteraction.instance).GetComponent<ExtraChallengeShrinesTeleporterComponent>();
				if (!Object.op_Implicit((Object)(object)component))
				{
					return;
				}
				component.rockShrineStacks++;
				if (component.rockShrineStacks == 1)
				{
					BossGroup bossGroup = component.bossGroup;
					bossGroup.bonusRewardCount += ConfigurableValue<int>.op_Implicit(ShrineRock.extraDrops);
				}
				else
				{
					BossGroup bossGroup2 = component.bossGroup;
					bossGroup2.bonusRewardCount += ConfigurableValue<int>.op_Implicit(ShrineRock.extraDropsPerStack);
				}
				component.ServerSendSyncShrineStacks();
			}
			CharacterBody component2 = ((Component)interactor).GetComponent<CharacterBody>();
			Chat.SendBroadcastChat((ChatMessageBase)new SubjectFormatChatMessage
			{
				subjectAsCharacterBody = component2,
				baseToken = "EXTRACHALLENGESHRINES_SHRINE_ROCK_USE_MESSAGE"
			});
			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(0.7372549f, 77f / 85f, 0.94509804f))
			}, true);
			purchaseCount++;
			refreshTimer = 2f;
			if (purchaseCount >= maxPurchaseCount)
			{
				((Component)symbolTransform).gameObject.SetActive(false);
			}
		}

		public override int GetNetworkChannel()
		{
			return QosChannelIndex.defaultReliable.intVal;
		}
	}
}