Decompiled source of MoreShrines v1.5.3

BetterShrines.dll

Decompiled 2 weeks ago
using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using BepInEx;
using BepInEx.Bootstrap;
using BepInEx.Configuration;
using HarmonyLib;
using IL.RoR2;
using Microsoft.CodeAnalysis;
using Mono.Cecil.Cil;
using MonoMod.Cil;
using MonoMod.RuntimeDetour;
using On.RoR2;
using On.RoR2.Artifacts;
using On.RoR2.UI;
using R2API;
using RoR2;
using RoR2.CharacterAI;
using RoR2.Navigation;
using RoR2.UI;
using TMPro;
using UnityEngine;
using UnityEngine.Events;
using UnityEngine.Networking;
using UnityEngine.UI;

[assembly: AssemblyTitle("BetterShrines")]
[assembly: AssemblyProduct("BetterShrines")]
[assembly: AssemblyInformationalVersion("1.0.0+364c7330755885cfd8e361bfc72642ffacb39a2d")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyCompany("BetterShrines")]
[assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: CompilationRelaxations(8)]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.0.0")]
[module: UnverifiableCode]
[module: RefSafetyRules(11)]
namespace Microsoft.CodeAnalysis
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	internal sealed class EmbeddedAttribute : Attribute
	{
	}
}
namespace System.Runtime.CompilerServices
{
	[CompilerGenerated]
	[AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)]
	[Microsoft.CodeAnalysis.Embedded]
	internal sealed class RefSafetyRulesAttribute : Attribute
	{
		public readonly int Version;

		public RefSafetyRulesAttribute(int P_0)
		{
			Version = P_0;
		}
	}
}
namespace Evaisa.MoreShrines
{
	internal class CustomDirector : NetworkBehaviour
	{
		public class CardPool
		{
			public int cost = 0;

			public List<DirectorCard> cards = new List<DirectorCard>();
		}

		private List<CardPool> finalSpawnOrder = new List<CardPool>();

		private bool cardPoolInitialized = false;

		public int countToSpawn = 0;

		private CombatDirector director;

		public void Awake()
		{
			//IL_0008: Unknown result type (might be due to invalid IL or missing references)
			//IL_0012: Expected O, but got Unknown
			CombatDirector.AttemptSpawnOnTarget += new hook_AttemptSpawnOnTarget(AttemptSpawnOnTarget);
			director = ((Component)this).gameObject.GetComponent<CombatDirector>();
		}

		private void OnDestroy()
		{
			//IL_0008: Unknown result type (might be due to invalid IL or missing references)
			//IL_0012: Expected O, but got Unknown
			CombatDirector.AttemptSpawnOnTarget -= new hook_AttemptSpawnOnTarget(AttemptSpawnOnTarget);
		}

		public bool AttemptSpawnOnTarget(orig_AttemptSpawnOnTarget orig, CombatDirector self, Transform spawnTarget, PlacementMode placementMode)
		{
			//IL_040a: Unknown result type (might be due to invalid IL or missing references)
			//IL_031d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0322: Unknown result type (might be due to invalid IL or missing references)
			//IL_0323: Unknown result type (might be due to invalid IL or missing references)
			//IL_0325: Unknown result type (might be due to invalid IL or missing references)
			//IL_032a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0331: Unknown result type (might be due to invalid IL or missing references)
			//IL_0344: Expected O, but got Unknown
			//IL_034a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0381: Unknown result type (might be due to invalid IL or missing references)
			//IL_0388: Expected O, but got Unknown
			//IL_0398: 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_005e: Unknown result type (might be due to invalid IL or missing references)
			if ((Object)(object)((Component)self).gameObject == (Object)(object)((Component)this).gameObject)
			{
				float monsterCredit = self.monsterCredit;
				DirectorCardCategorySelection monsterCards = self.monsterCards;
				if (!cardPoolInitialized)
				{
					List<CardPool> list = new List<CardPool>();
					Category[] categories = monsterCards.categories;
					foreach (Category val in categories)
					{
						DirectorCard[] cards = val.cards;
						foreach (DirectorCard card in cards)
						{
							if (list.Any((CardPool pool) => pool.cost == card.cost))
							{
								list.Find((CardPool pool) => pool.cost == card.cost).cards.Add(card);
								continue;
							}
							CardPool cardPool = new CardPool();
							cardPool.cost = card.cost;
							cardPool.cards.Add(card);
							list.Add(cardPool);
						}
					}
					cardPoolInitialized = true;
					list.Sort((CardPool item1, CardPool item2) => item1.cost.CompareTo(item2.cost));
					int num = 0;
					CardPool cardPool2 = list[0];
					foreach (CardPool item4 in list)
					{
						if ((float)(item4.cost * countToSpawn) < monsterCredit)
						{
							cardPool2 = item4;
							num++;
							continue;
						}
						break;
					}
					MoreShrines.Print("Preparing to spawn " + countToSpawn + " monsters.");
					CardPool item3 = list[0];
					int num2 = 0;
					for (int k = 0; k < countToSpawn; k++)
					{
						int num3 = countToSpawn - k;
						if (list.Count > num + 1 && (float)((countToSpawn - num3) * cardPool2.cost + num3 * list[num + 1].cost) < monsterCredit)
						{
							item3 = list[num + 1];
							num2++;
						}
					}
					for (int l = 0; l < countToSpawn - num2; l++)
					{
						finalSpawnOrder.Add(cardPool2);
					}
					for (int m = 0; m < num2; m++)
					{
						finalSpawnOrder.Add(item3);
					}
				}
				if (finalSpawnOrder.Count > 0)
				{
					self.currentMonsterCard = finalSpawnOrder[0].cards[Random.Range(0, finalSpawnOrder[0].cards.Count - 1)];
					SpawnCard spawnCard = self.currentMonsterCard.spawnCard;
					DirectorPlacementRule val2 = new DirectorPlacementRule
					{
						placementMode = placementMode,
						spawnOnTarget = spawnTarget,
						preventOverhead = self.currentMonsterCard.preventOverhead
					};
					DirectorCore.GetMonsterSpawnDistance(self.currentMonsterCard.spawnDistance, ref val2.minDistance, ref val2.maxDistance);
					val2.minDistance *= self.spawnDistanceMultiplier;
					DirectorSpawnRequest val3 = new DirectorSpawnRequest(spawnCard, val2, self.rng);
					val3.ignoreTeamMemberLimit = self.ignoreTeamSizeLimit;
					val3.teamIndexOverride = self.teamIndex;
					val3.onSpawnedServer = onCardSpawned;
					if (!Object.op_Implicit((Object)(object)DirectorCore.instance.TrySpawnObject(val3)))
					{
						((Behaviour)self).enabled = false;
						return false;
					}
					self.spawnCountInCurrentWave++;
					return true;
				}
				((Behaviour)self).enabled = false;
				return false;
			}
			return orig.Invoke(self, spawnTarget, placementMode);
		}

		internal void onCardSpawned(SpawnResult result)
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_000f: Unknown result type (might be due to invalid IL or missing references)
			//IL_006d: Unknown result type (might be due to invalid IL or missing references)
			//IL_006e: 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_00d0: 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_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_00b4: Expected O, but got Unknown
			//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)
			if (!result.success)
			{
				return;
			}
			CharacterMaster component = result.spawnedInstance.GetComponent<CharacterMaster>();
			GameObject bodyObject = component.GetBodyObject();
			if (Object.op_Implicit((Object)(object)director.combatSquad))
			{
				director.combatSquad.AddMember(component);
			}
			if (Object.op_Implicit((Object)(object)director.spawnEffectPrefab) && NetworkServer.active)
			{
				Vector3 origin = result.position;
				CharacterBody component2 = bodyObject.GetComponent<CharacterBody>();
				if (Object.op_Implicit((Object)(object)component2))
				{
					origin = component2.corePosition;
				}
				EffectManager.SpawnEffect(director.spawnEffectPrefab, new EffectData
				{
					origin = origin
				}, true);
			}
			((UnityEvent<GameObject>)(object)director.onSpawnedServer)?.Invoke(result.spawnedInstance);
		}

		private void UNetVersion()
		{
		}

		public override bool OnSerialize(NetworkWriter writer, bool forceAll)
		{
			bool result = default(bool);
			return result;
		}

		public override void OnDeserialize(NetworkReader reader, bool initialState)
		{
		}
	}
	public class ImpMarkerKiller : MonoBehaviour
	{
		public void Update()
		{
			PositionIndicator component = ((Component)this).GetComponent<PositionIndicator>();
			if (!Object.op_Implicit((Object)(object)component.targetTransform))
			{
				MoreShrines.Print("Destroyed indicator!");
				Object.DestroyImmediate((Object)(object)((Component)this).gameObject);
			}
		}
	}
	internal class InitBuffs
	{
		[CompilerGenerated]
		private static class <>O
		{
			public static StatHookEventHandler <0>__RecalculateHP;

			public static hook_BeginAdvanceStage <1>__Stage_BeginAdvanceStage;

			public static hook_UpdateIcon <2>__BuffIcon_UpdateIcon;
		}

		public static BuffDef maxHPDown;

		public static BuffDef maxHPDownStage;

		public static List<CharacterBody> players = new List<CharacterBody>();

		public static void Add()
		{
			//IL_0045: Unknown result type (might be due to invalid IL or missing references)
			//IL_004a: Unknown result type (might be due to invalid IL or missing references)
			//IL_009e: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c8: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ce: Expected O, but got Unknown
			//IL_00e4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e9: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ef: Expected O, but got Unknown
			//IL_0105: Unknown result type (might be due to invalid IL or missing references)
			//IL_010a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0110: Expected O, but got Unknown
			maxHPDown = ScriptableObject.CreateInstance<BuffDef>();
			((Object)maxHPDown).name = "Max HP Down";
			maxHPDown.isDebuff = true;
			maxHPDown.canStack = true;
			maxHPDown.iconSprite = EvaResources.HPDebuffIcon;
			maxHPDown.buffColor = Color.red;
			ContentAddition.AddBuffDef(maxHPDown);
			maxHPDownStage = ScriptableObject.CreateInstance<BuffDef>();
			((Object)maxHPDownStage).name = "Stage Max HP Down";
			maxHPDownStage.isDebuff = true;
			maxHPDownStage.canStack = true;
			maxHPDownStage.iconSprite = EvaResources.HPDebuffIcon;
			maxHPDownStage.buffColor = Color.red;
			ContentAddition.AddBuffDef(maxHPDownStage);
			object obj = <>O.<0>__RecalculateHP;
			if (obj == null)
			{
				StatHookEventHandler val = RecalculateHP;
				<>O.<0>__RecalculateHP = val;
				obj = (object)val;
			}
			RecalculateStatsAPI.GetStatCoefficients += (StatHookEventHandler)obj;
			object obj2 = <>O.<1>__Stage_BeginAdvanceStage;
			if (obj2 == null)
			{
				hook_BeginAdvanceStage val2 = Stage_BeginAdvanceStage;
				<>O.<1>__Stage_BeginAdvanceStage = val2;
				obj2 = (object)val2;
			}
			Stage.BeginAdvanceStage += (hook_BeginAdvanceStage)obj2;
			object obj3 = <>O.<2>__BuffIcon_UpdateIcon;
			if (obj3 == null)
			{
				hook_UpdateIcon val3 = BuffIcon_UpdateIcon;
				<>O.<2>__BuffIcon_UpdateIcon = val3;
				obj3 = (object)val3;
			}
			BuffIcon.UpdateIcon += (hook_UpdateIcon)obj3;
		}

		private static void RecalculateHP(CharacterBody sender, StatHookEventArgs args)
		{
			if (Object.op_Implicit((Object)(object)sender))
			{
				int buffCount = sender.GetBuffCount(maxHPDownStage);
				int buffCount2 = sender.GetBuffCount(maxHPDown);
				args.healthTotalMult *= 1f - (float)buffCount / 100f;
				args.healthTotalMult *= 1f - (float)buffCount2 / 100f;
			}
		}

		private static void BuffIcon_UpdateIcon(orig_UpdateIcon orig, BuffIcon self)
		{
			//IL_0076: Unknown result type (might be due to invalid IL or missing references)
			if (!Object.op_Implicit((Object)(object)self.buffDef))
			{
				self.iconImage.sprite = null;
			}
			else if ((Object)(object)self.buffDef == (Object)(object)maxHPDown || (Object)(object)self.buffDef == (Object)(object)maxHPDownStage)
			{
				self.iconImage.sprite = self.buffDef.iconSprite;
				((Graphic)self.iconImage).color = self.buffDef.buffColor;
				if (self.buffDef.canStack)
				{
					BuffIcon.sharedStringBuilder.Clear();
					StringBuilderExtensions.AppendInt(BuffIcon.sharedStringBuilder, self.buffCount, 1u, uint.MaxValue);
					BuffIcon.sharedStringBuilder.Append("%");
					((Behaviour)self.stackCount).enabled = true;
					((TMP_Text)self.stackCount).SetText(BuffIcon.sharedStringBuilder);
				}
				else
				{
					((Behaviour)self.stackCount).enabled = false;
				}
			}
			else
			{
				orig.Invoke(self);
			}
		}

		private static void Stage_BeginAdvanceStage(orig_BeginAdvanceStage orig, Stage self, SceneDef destinationStage)
		{
			foreach (CharacterBody player in players)
			{
				for (int i = 0; i < player.GetBuffCount(maxHPDownStage); i++)
				{
					player.RemoveBuff(maxHPDownStage);
				}
			}
			orig.Invoke(self, destinationStage);
		}
	}
	[BepInPlugin("com.evaisa.moreshrines", "More Shrines", "1.1.9")]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	public class MoreShrines : BaseUnityPlugin
	{
		[Serializable]
		[CompilerGenerated]
		private sealed class <>c
		{
			public static readonly <>c <>9 = new <>c();

			public static Action<List<CostTypeDef>> <>9__33_0;

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

			public static Func<int, int> <>9__33_3;

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

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

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

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

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

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

			public static Func<MonoBehaviour, bool> <>9__33_11;

			public static Manipulator <>9__33_4;

			public static IsAffordableDelegate <>9__35_0;

			public static PayCostDelegate <>9__35_1;

			public static IsAffordableDelegate <>9__36_0;

			public static PayCostDelegate <>9__36_1;

			public static IsAffordableDelegate <>9__37_0;

			public static PayCostDelegate <>9__37_1;

			public static IsAffordableDelegate <>9__38_0;

			public static PayCostDelegate <>9__38_1;

			public static IsAffordableDelegate <>9__39_0;

			public static PayCostDelegate <>9__39_1;

			public static IsAffordableDelegate <>9__40_0;

			public static PayCostDelegate <>9__40_1;

			public static IsAffordableDelegate <>9__41_0;

			public static PayCostDelegate <>9__41_1;

			internal void <.ctor>b__33_0(List<CostTypeDef> list)
			{
				if (costTypeDefShrineDisorder != null)
				{
					list.Add(costTypeDefShrineDisorder);
				}
				if (costTypeDefShrineFallen != null)
				{
					list.Add(costTypeDefShrineFallen);
				}
				if (costTypeDefShrineHeresy != null)
				{
					list.Add(costTypeDefShrineHeresy);
				}
				if (costTypeDefWispGreen != null)
				{
					list.Add(costTypeDefWispGreen);
				}
				if (costTypeDefWispRed != null)
				{
					list.Add(costTypeDefWispRed);
				}
				if (costTypeDefWispWhite != null)
				{
					list.Add(costTypeDefWispWhite);
				}
			}

			internal bool <.ctor>b__33_2(Instruction x)
			{
				int num = default(int);
				return ILPatternMatchingExt.MatchLdcI4(x, ref num);
			}

			internal int <.ctor>b__33_3(int c)
			{
				return c + 10;
			}

			internal void <.ctor>b__33_4(ILContext il)
			{
				//IL_0002: Unknown result type (might be due to invalid IL or missing references)
				//IL_0008: Expected O, but got Unknown
				//IL_0111: Unknown result type (might be due to invalid IL or missing references)
				//IL_0144: Unknown result type (might be due to invalid IL or missing references)
				ILCursor val = new ILCursor(il);
				ILLabel val2 = val.DefineLabel();
				val.TryGotoNext((MoveType)0, new Func<Instruction, bool>[3]
				{
					(Instruction x) => ILPatternMatchingExt.MatchStloc(x, 3),
					(Instruction x) => ILPatternMatchingExt.MatchNop(x),
					(Instruction x) => ILPatternMatchingExt.MatchLdloc(x, 3)
				});
				int index = val.Index + 2;
				val.TryGotoNext((MoveType)2, new Func<Instruction, bool>[3]
				{
					(Instruction x) => ILPatternMatchingExt.MatchNop(x),
					(Instruction x) => ILPatternMatchingExt.MatchNop(x),
					(Instruction x) => ILPatternMatchingExt.MatchNop(x)
				});
				val.MarkLabel(val2);
				val.Index = index;
				val.Emit(OpCodes.Ldloc, 3);
				val.EmitDelegate<Func<MonoBehaviour, bool>>((Func<MonoBehaviour, bool>)((MonoBehaviour x) => (Object)(object)x == (Object)null));
				val.Emit(OpCodes.Brtrue, (object)val2);
			}

			internal bool <.ctor>b__33_5(Instruction x)
			{
				return ILPatternMatchingExt.MatchStloc(x, 3);
			}

			internal bool <.ctor>b__33_6(Instruction x)
			{
				return ILPatternMatchingExt.MatchNop(x);
			}

			internal bool <.ctor>b__33_7(Instruction x)
			{
				return ILPatternMatchingExt.MatchLdloc(x, 3);
			}

			internal bool <.ctor>b__33_8(Instruction x)
			{
				return ILPatternMatchingExt.MatchNop(x);
			}

			internal bool <.ctor>b__33_9(Instruction x)
			{
				return ILPatternMatchingExt.MatchNop(x);
			}

			internal bool <.ctor>b__33_10(Instruction x)
			{
				return ILPatternMatchingExt.MatchNop(x);
			}

			internal bool <.ctor>b__33_11(MonoBehaviour x)
			{
				return (Object)(object)x == (Object)null;
			}

			internal bool <CreateCostDefWispWhite>b__35_0(CostTypeDef costTypeDef, IsAffordableContext context)
			{
				//IL_0001: Unknown result type (might be due to invalid IL or missing references)
				CharacterBody component = ((Component)context.activator).GetComponent<CharacterBody>();
				if (Object.op_Implicit((Object)(object)component))
				{
					Inventory inventory = component.inventory;
					if (Object.op_Implicit((Object)(object)inventory))
					{
						return inventory.GetTotalItemCountOfTier((ItemTier)0) > 0;
					}
				}
				return false;
			}

			internal void <CreateCostDefWispWhite>b__35_1(PayCostContext context, PayCostResults results)
			{
				//IL_003a: Unknown result type (might be due to invalid IL or missing references)
				//IL_003f: Unknown result type (might be due to invalid IL or missing references)
				//IL_0042: Unknown result type (might be due to invalid IL or missing references)
				//IL_0049: Unknown result type (might be due to invalid IL or missing references)
				//IL_004f: Invalid comparison between Unknown and I4
				//IL_0059: Unknown result type (might be due to invalid IL or missing references)
				CharacterBody component = ((Component)context.activator).GetComponent<CharacterBody>();
				if (!Object.op_Implicit((Object)(object)component))
				{
					return;
				}
				Inventory inventory = component.inventory;
				List<ItemDef> list = new List<ItemDef>();
				foreach (ItemIndex item in inventory.itemAcquisitionOrder)
				{
					if ((int)ItemCatalog.GetItemDef(item).tier == 0)
					{
						list.Add(ItemCatalog.GetItemDef(item));
					}
				}
				ItemDef val = list[Random.Range(0, list.Count)];
				context.purchasedObject.GetComponent<ShrineWispBehaviour>().wispItem = val;
				inventory.RemoveItem(val, 1);
			}

			internal bool <CreateCostDefWispGreen>b__36_0(CostTypeDef costTypeDef, IsAffordableContext context)
			{
				//IL_0001: Unknown result type (might be due to invalid IL or missing references)
				CharacterBody component = ((Component)context.activator).GetComponent<CharacterBody>();
				if (Object.op_Implicit((Object)(object)component))
				{
					Inventory inventory = component.inventory;
					if (Object.op_Implicit((Object)(object)inventory))
					{
						return inventory.GetTotalItemCountOfTier((ItemTier)1) > 0;
					}
				}
				return false;
			}

			internal void <CreateCostDefWispGreen>b__36_1(PayCostContext context, PayCostResults results)
			{
				//IL_003a: Unknown result type (might be due to invalid IL or missing references)
				//IL_003f: Unknown result type (might be due to invalid IL or missing references)
				//IL_0042: Unknown result type (might be due to invalid IL or missing references)
				//IL_0049: Unknown result type (might be due to invalid IL or missing references)
				//IL_004f: Invalid comparison between Unknown and I4
				//IL_0059: Unknown result type (might be due to invalid IL or missing references)
				CharacterBody component = ((Component)context.activator).GetComponent<CharacterBody>();
				if (!Object.op_Implicit((Object)(object)component))
				{
					return;
				}
				Inventory inventory = component.inventory;
				List<ItemDef> list = new List<ItemDef>();
				foreach (ItemIndex item in inventory.itemAcquisitionOrder)
				{
					if ((int)ItemCatalog.GetItemDef(item).tier == 1)
					{
						list.Add(ItemCatalog.GetItemDef(item));
					}
				}
				ItemDef val = list[Random.Range(0, list.Count)];
				context.purchasedObject.GetComponent<ShrineWispBehaviour>().wispItem = val;
				inventory.RemoveItem(val, 1);
			}

			internal bool <CreateCostDefWispRed>b__37_0(CostTypeDef costTypeDef, IsAffordableContext context)
			{
				//IL_0001: Unknown result type (might be due to invalid IL or missing references)
				CharacterBody component = ((Component)context.activator).GetComponent<CharacterBody>();
				if (Object.op_Implicit((Object)(object)component))
				{
					Inventory inventory = component.inventory;
					if (Object.op_Implicit((Object)(object)inventory))
					{
						return inventory.GetTotalItemCountOfTier((ItemTier)2) > 0;
					}
				}
				return false;
			}

			internal void <CreateCostDefWispRed>b__37_1(PayCostContext context, PayCostResults results)
			{
				//IL_003a: Unknown result type (might be due to invalid IL or missing references)
				//IL_003f: Unknown result type (might be due to invalid IL or missing references)
				//IL_0042: Unknown result type (might be due to invalid IL or missing references)
				//IL_0049: Unknown result type (might be due to invalid IL or missing references)
				//IL_004f: Invalid comparison between Unknown and I4
				//IL_0059: Unknown result type (might be due to invalid IL or missing references)
				CharacterBody component = ((Component)context.activator).GetComponent<CharacterBody>();
				if (!Object.op_Implicit((Object)(object)component))
				{
					return;
				}
				Inventory inventory = component.inventory;
				List<ItemDef> list = new List<ItemDef>();
				foreach (ItemIndex item in inventory.itemAcquisitionOrder)
				{
					if ((int)ItemCatalog.GetItemDef(item).tier == 2)
					{
						list.Add(ItemCatalog.GetItemDef(item));
					}
				}
				ItemDef val = list[Random.Range(0, list.Count)];
				context.purchasedObject.GetComponent<ShrineWispBehaviour>().wispItem = val;
				inventory.RemoveItem(val, 1);
			}

			internal bool <CreateCostDefShrineFallen>b__38_0(CostTypeDef costTypeDef, IsAffordableContext context)
			{
				//IL_0001: Unknown result type (might be due to invalid IL or missing references)
				//IL_003c: Unknown result type (might be due to invalid IL or missing references)
				CharacterBody component = ((Component)context.activator).GetComponent<CharacterBody>();
				if (Object.op_Implicit((Object)(object)component))
				{
					int buffCount = component.GetBuffCount(InitBuffs.maxHPDownStage);
					int num = (int)Mathf.Ceil((100f - (float)component.GetBuffCount(InitBuffs.maxHPDownStage)) / 100f * (float)context.cost);
					return buffCount + num < 100 && ShrineFallenBehaviour.IsAnyoneDead();
				}
				return false;
			}

			internal void <CreateCostDefShrineFallen>b__38_1(PayCostContext context, PayCostResults results)
			{
				CharacterBody component = ((Component)context.activator).GetComponent<CharacterBody>();
				if (Object.op_Implicit((Object)(object)component))
				{
					int buffCount = component.GetBuffCount(InitBuffs.maxHPDownStage);
					int num = (int)Mathf.Ceil((100f - (float)component.GetBuffCount(InitBuffs.maxHPDownStage)) / 100f * (float)context.cost);
					for (int i = 0; i < num; i++)
					{
						component.AddBuff(InitBuffs.maxHPDownStage);
					}
				}
			}

			internal bool <CreateCostDefShrineFallenAlt>b__39_0(CostTypeDef costTypeDef, IsAffordableContext context)
			{
				//IL_0001: Unknown result type (might be due to invalid IL or missing references)
				//IL_0031: Unknown result type (might be due to invalid IL or missing references)
				CharacterBody component = ((Component)context.activator).GetComponent<CharacterBody>();
				if (Object.op_Implicit((Object)(object)component))
				{
					CharacterMaster master = component.master;
					if (Object.op_Implicit((Object)(object)master))
					{
						return (ulong)master.money >= (ulong)context.cost && ShrineFallenBehaviour.IsAnyoneDead();
					}
				}
				return false;
			}

			internal void <CreateCostDefShrineFallenAlt>b__39_1(PayCostContext context, PayCostResults results)
			{
				if (Object.op_Implicit((Object)(object)context.activatorMaster))
				{
					CharacterMaster activatorMaster = context.activatorMaster;
					activatorMaster.money -= (uint)context.cost;
				}
			}

			internal bool <CreateCostDefShrineDisorder>b__40_0(CostTypeDef costTypeDef, IsAffordableContext context)
			{
				//IL_0001: 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_0062: Unknown result type (might be due to invalid IL or missing references)
				//IL_00fb: Unknown result type (might be due to invalid IL or missing references)
				//IL_011e: Unknown result type (might be due to invalid IL or missing references)
				CharacterBody component = ((Component)context.activator).GetComponent<CharacterBody>();
				if (Object.op_Implicit((Object)(object)component))
				{
					bool flag = false;
					Inventory inventory = component.inventory;
					{
						IEnumerator enumerator = Enum.GetValues(typeof(ItemTier)).GetEnumerator();
						try
						{
							while (enumerator.MoveNext())
							{
								<>c__DisplayClass40_0 CS$<>8__locals0 = new <>c__DisplayClass40_0
								{
									tier = (ItemTier)enumerator.Current
								};
								int num = int.MaxValue;
								IEnumerable<ItemDef> enumerable = ((IEnumerable<ItemDef>)(object)ItemCatalog.allItemDefs).Where((ItemDef x) => x.tier == CS$<>8__locals0.tier);
								foreach (ItemDef item in enumerable)
								{
									int itemCount = inventory.GetItemCount(item);
									num = Math.Min(num, itemCount);
									if (itemCount - num > 1)
									{
										flag = true;
									}
								}
							}
						}
						finally
						{
							IDisposable disposable = enumerator as IDisposable;
							if (disposable != null)
							{
								disposable.Dispose();
							}
						}
					}
					NetworkUser val = Util.LookUpBodyNetworkUser(((Component)context.activator).gameObject);
					return Object.op_Implicit((Object)(object)val) && (ulong)val.lunarCoins >= (ulong)context.cost && flag;
				}
				return false;
			}

			internal void <CreateCostDefShrineDisorder>b__40_1(PayCostContext context, PayCostResults results)
			{
				NetworkUser val = Util.LookUpBodyNetworkUser(((Component)context.activator).gameObject);
				if (Object.op_Implicit((Object)(object)val))
				{
					val.DeductLunarCoins((uint)context.cost);
				}
			}

			internal bool <CreateCostDefShrineHeresy>b__41_0(CostTypeDef costTypeDef, IsAffordableContext context)
			{
				//IL_0001: Unknown result type (might be due to invalid IL or missing references)
				//IL_002f: Unknown result type (might be due to invalid IL or missing references)
				//IL_0047: 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_0094: Unknown result type (might be due to invalid IL or missing references)
				//IL_0077: 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)
				CharacterBody component = ((Component)context.activator).GetComponent<CharacterBody>();
				if (Object.op_Implicit((Object)(object)component))
				{
					bool flag = false;
					Inventory inventory = component.inventory;
					if (component.inventory.GetItemCount(Items.LunarPrimaryReplacement.itemIndex) <= 0 || component.inventory.GetItemCount(Items.LunarSecondaryReplacement.itemIndex) <= 0 || component.inventory.GetItemCount(Items.LunarUtilityReplacement.itemIndex) <= 0 || component.inventory.GetItemCount(Items.LunarSpecialReplacement.itemIndex) <= 0)
					{
						flag = true;
					}
					NetworkUser val = Util.LookUpBodyNetworkUser(((Component)context.activator).gameObject);
					return Object.op_Implicit((Object)(object)val) && (ulong)val.lunarCoins >= (ulong)context.cost && flag;
				}
				return false;
			}

			internal void <CreateCostDefShrineHeresy>b__41_1(PayCostContext context, PayCostResults results)
			{
				NetworkUser val = Util.LookUpBodyNetworkUser(((Component)context.activator).gameObject);
				if (Object.op_Implicit((Object)(object)val))
				{
					val.DeductLunarCoins((uint)context.cost);
				}
			}
		}

		[CompilerGenerated]
		private sealed class <>c__DisplayClass40_0
		{
			public ItemTier tier;

			internal bool <CreateCostDefShrineDisorder>b__2(ItemDef x)
			{
				//IL_0001: Unknown result type (might be due to invalid IL or missing references)
				//IL_0007: Unknown result type (might be due to invalid IL or missing references)
				return x.tier == tier;
			}
		}

		private const string ModVer = "1.1.9";

		private const string ModName = "More Shrines";

		private const string ModGuid = "com.evaisa.moreshrines";

		public static MoreShrines instance;

		public static Xoroshiro128Plus EvaRng;

		public static CharacterSpawnCard impSpawnCard;

		public static ConfigEntry<bool> impShrineEnabled;

		public static ConfigEntry<int> impShrineWeight;

		public static ConfigEntry<bool> impCountScale;

		public static ConfigEntry<int> impShrineTime;

		public static ConfigEntry<bool> itemRarityBasedOnSpeed;

		public static ConfigEntry<bool> dropItemForEveryPlayer;

		public static ConfigEntry<int> extraItemCount;

		public static ConfigEntry<bool> fallenShrineEnabled;

		public static ConfigEntry<int> fallenShrineWeight;

		public static ConfigEntry<int> fallenShrineHPPenalty;

		public static ConfigEntry<bool> fallenShrineMoney;

		public static ConfigEntry<int> fallenShrineMoneyCost;

		public static ConfigEntry<bool> disorderShrineEnabled;

		public static ConfigEntry<int> disorderShrineWeight;

		public static ConfigEntry<bool> heresyShrineEnabled;

		public static ConfigEntry<int> heresyShrineWeight;

		public static ConfigEntry<bool> wispShrineEnabled;

		public static ConfigEntry<bool> wispShrineScaleDifficulty;

		public static ConfigEntry<int> wispShrineWeight;

		public static CostTypeDef costTypeDefShrineFallen;

		public static CostTypeDef costTypeDefShrineDisorder;

		public static CostTypeDef costTypeDefShrineHeresy;

		public static CostTypeDef costTypeDefWispWhite;

		public static CostTypeDef costTypeDefWispGreen;

		public static CostTypeDef costTypeDefWispRed;

		public static GameObject debugPrefab;

		public static bool debugMode;

		public MoreShrines()
		{
			//IL_003d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0047: Expected O, but got Unknown
			//IL_012b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0135: Expected O, but got Unknown
			//IL_0167: Unknown result type (might be due to invalid IL or missing references)
			//IL_0171: Expected O, but got Unknown
			//IL_0207: Unknown result type (might be due to invalid IL or missing references)
			//IL_020e: Expected O, but got Unknown
			//IL_01fc: Unknown result type (might be due to invalid IL or missing references)
			//IL_0201: Unknown result type (might be due to invalid IL or missing references)
			//IL_0207: Expected O, but got Unknown
			instance = this;
			DateTime dateTime = new DateTime(1970, 1, 1, 0, 0, 0, DateTimeKind.Utc);
			int num = (int)(DateTime.UtcNow - dateTime).TotalSeconds;
			EvaResources.Init();
			EvaRng = new Xoroshiro128Plus((ulong)num);
			RegisterConfig();
			RegisterLanguageTokens();
			InitBuffs.Add();
			if (fallenShrineMoney.Value)
			{
				CreateCostDefShrineFallenAlt();
			}
			else
			{
				CreateCostDefShrineFallen();
			}
			CreateCostDefShrineDisorder();
			CreateCostDefShrineHeresy();
			CreateCostDefWispWhite();
			CreateCostDefWispGreen();
			CreateCostDefWispRed();
			GenerateTinyImp();
			if (fallenShrineEnabled.Value)
			{
				GenerateFallenShrine();
			}
			if (disorderShrineEnabled.Value)
			{
				GenerateDisorderShrine();
			}
			if (heresyShrineEnabled.Value)
			{
				GenerateHeresyShrine();
			}
			if (impShrineEnabled.Value)
			{
				GenerateImpShrine();
			}
			if (wispShrineEnabled.Value)
			{
				GenerateWispShrine();
			}
			SwarmsArtifactManager.OnSpawnCardOnSpawnedServerGlobal += new hook_OnSpawnCardOnSpawnedServerGlobal(SwarmsArtifactManager_OnSpawnCardOnSpawnedServerGlobal);
			CostTypeCatalog.modHelper.getAdditionalEntries += delegate(List<CostTypeDef> list)
			{
				if (costTypeDefShrineDisorder != null)
				{
					list.Add(costTypeDefShrineDisorder);
				}
				if (costTypeDefShrineFallen != null)
				{
					list.Add(costTypeDefShrineFallen);
				}
				if (costTypeDefShrineHeresy != null)
				{
					list.Add(costTypeDefShrineHeresy);
				}
				if (costTypeDefWispGreen != null)
				{
					list.Add(costTypeDefWispGreen);
				}
				if (costTypeDefWispRed != null)
				{
					list.Add(costTypeDefWispRed);
				}
				if (costTypeDefWispWhite != null)
				{
					list.Add(costTypeDefWispWhite);
				}
			};
			CostTypeCatalog.Init += (Manipulator)delegate(ILContext il)
			{
				//IL_0002: Unknown result type (might be due to invalid IL or missing references)
				//IL_0008: Expected O, but got Unknown
				ILCursor val6 = new ILCursor(il);
				int num2 = default(int);
				if (val6.TryGotoNext((MoveType)0, new Func<Instruction, bool>[1]
				{
					(Instruction x) => ILPatternMatchingExt.MatchLdcI4(x, ref num2)
				}))
				{
					int index2 = val6.Index;
					val6.Index = index2 + 1;
					val6.EmitDelegate<Func<int, int>>((Func<int, int>)((int c) => c + 10));
				}
				else
				{
					((BaseUnityPlugin)this).Logger.LogError((object)"Failed to apply CostTypeCatalog IL hook");
				}
			};
			if (!Chainloader.PluginInfos.ContainsKey("com.themysticsword.mysticsitems"))
			{
				return;
			}
			PluginInfo val = Chainloader.PluginInfos["com.themysticsword.mysticsitems"];
			Assembly assembly = ((object)val.Instance).GetType().Assembly;
			MethodInfo methodInfo = AccessTools.Method(assembly.GetType("MysticsItems.Items.ExtraShrineUse"), "UpdateShrine", new Type[2]
			{
				assembly.GetType("MysticsItems.Items.ExtraShrineUse/MysticsItemsExtraShrineUseBehaviour"),
				typeof(int)
			}, (Type[])null);
			object obj = <>c.<>9__33_4;
			if (obj == null)
			{
				Manipulator val2 = delegate(ILContext il)
				{
					//IL_0002: Unknown result type (might be due to invalid IL or missing references)
					//IL_0008: Expected O, but got Unknown
					//IL_0111: Unknown result type (might be due to invalid IL or missing references)
					//IL_0144: Unknown result type (might be due to invalid IL or missing references)
					ILCursor val4 = new ILCursor(il);
					ILLabel val5 = val4.DefineLabel();
					val4.TryGotoNext((MoveType)0, new Func<Instruction, bool>[3]
					{
						(Instruction x) => ILPatternMatchingExt.MatchStloc(x, 3),
						(Instruction x) => ILPatternMatchingExt.MatchNop(x),
						(Instruction x) => ILPatternMatchingExt.MatchLdloc(x, 3)
					});
					int index = val4.Index + 2;
					val4.TryGotoNext((MoveType)2, new Func<Instruction, bool>[3]
					{
						(Instruction x) => ILPatternMatchingExt.MatchNop(x),
						(Instruction x) => ILPatternMatchingExt.MatchNop(x),
						(Instruction x) => ILPatternMatchingExt.MatchNop(x)
					});
					val4.MarkLabel(val5);
					val4.Index = index;
					val4.Emit(OpCodes.Ldloc, 3);
					val4.EmitDelegate<Func<MonoBehaviour, bool>>((Func<MonoBehaviour, bool>)((MonoBehaviour x) => (Object)(object)x == (Object)null));
					val4.Emit(OpCodes.Brtrue, (object)val5);
				};
				<>c.<>9__33_4 = val2;
				obj = (object)val2;
			}
			ILHook val3 = new ILHook((MethodBase)methodInfo, (Manipulator)obj);
		}

		private void Update()
		{
		}

		public void CreateCostDefWispWhite()
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_000b: Expected O, but got Unknown
			//IL_0033: Unknown result type (might be due to invalid IL or missing references)
			//IL_0038: Unknown result type (might be due to invalid IL or missing references)
			//IL_003e: Expected O, but got Unknown
			//IL_0074: Unknown result type (might be due to invalid IL or missing references)
			//IL_005d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0062: Unknown result type (might be due to invalid IL or missing references)
			//IL_0068: Expected O, but got Unknown
			costTypeDefWispWhite = new CostTypeDef();
			costTypeDefWispWhite.costStringFormatToken = "COST_ITEM_FORMAT";
			CostTypeDef obj = costTypeDefWispWhite;
			object obj2 = <>c.<>9__35_0;
			if (obj2 == null)
			{
				IsAffordableDelegate val = delegate(CostTypeDef costTypeDef, IsAffordableContext context)
				{
					//IL_0001: Unknown result type (might be due to invalid IL or missing references)
					CharacterBody component2 = ((Component)context.activator).GetComponent<CharacterBody>();
					if (Object.op_Implicit((Object)(object)component2))
					{
						Inventory inventory2 = component2.inventory;
						if (Object.op_Implicit((Object)(object)inventory2))
						{
							return inventory2.GetTotalItemCountOfTier((ItemTier)0) > 0;
						}
					}
					return false;
				};
				<>c.<>9__35_0 = val;
				obj2 = (object)val;
			}
			obj.isAffordable = (IsAffordableDelegate)obj2;
			CostTypeDef obj3 = costTypeDefWispWhite;
			object obj4 = <>c.<>9__35_1;
			if (obj4 == null)
			{
				PayCostDelegate val2 = delegate(PayCostContext context, PayCostResults results)
				{
					//IL_003a: Unknown result type (might be due to invalid IL or missing references)
					//IL_003f: Unknown result type (might be due to invalid IL or missing references)
					//IL_0042: Unknown result type (might be due to invalid IL or missing references)
					//IL_0049: Unknown result type (might be due to invalid IL or missing references)
					//IL_004f: Invalid comparison between Unknown and I4
					//IL_0059: Unknown result type (might be due to invalid IL or missing references)
					CharacterBody component = ((Component)context.activator).GetComponent<CharacterBody>();
					if (Object.op_Implicit((Object)(object)component))
					{
						Inventory inventory = component.inventory;
						List<ItemDef> list = new List<ItemDef>();
						foreach (ItemIndex item in inventory.itemAcquisitionOrder)
						{
							if ((int)ItemCatalog.GetItemDef(item).tier == 0)
							{
								list.Add(ItemCatalog.GetItemDef(item));
							}
						}
						ItemDef val3 = list[Random.Range(0, list.Count)];
						context.purchasedObject.GetComponent<ShrineWispBehaviour>().wispItem = val3;
						inventory.RemoveItem(val3, 1);
					}
				};
				<>c.<>9__35_1 = val2;
				obj4 = (object)val2;
			}
			obj3.payCost = (PayCostDelegate)obj4;
			costTypeDefWispWhite.colorIndex = (ColorIndex)1;
		}

		public void CreateCostDefWispGreen()
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_000b: Expected O, but got Unknown
			//IL_003e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0043: Unknown result type (might be due to invalid IL or missing references)
			//IL_0049: Expected O, but got Unknown
			//IL_007f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0068: Unknown result type (might be due to invalid IL or missing references)
			//IL_006d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0073: Expected O, but got Unknown
			costTypeDefWispGreen = new CostTypeDef();
			costTypeDefWispGreen.costStringFormatToken = "COST_ITEM_FORMAT";
			costTypeDefWispGreen.saturateWorldStyledCostString = true;
			CostTypeDef obj = costTypeDefWispGreen;
			object obj2 = <>c.<>9__36_0;
			if (obj2 == null)
			{
				IsAffordableDelegate val = delegate(CostTypeDef costTypeDef, IsAffordableContext context)
				{
					//IL_0001: Unknown result type (might be due to invalid IL or missing references)
					CharacterBody component2 = ((Component)context.activator).GetComponent<CharacterBody>();
					if (Object.op_Implicit((Object)(object)component2))
					{
						Inventory inventory2 = component2.inventory;
						if (Object.op_Implicit((Object)(object)inventory2))
						{
							return inventory2.GetTotalItemCountOfTier((ItemTier)1) > 0;
						}
					}
					return false;
				};
				<>c.<>9__36_0 = val;
				obj2 = (object)val;
			}
			obj.isAffordable = (IsAffordableDelegate)obj2;
			CostTypeDef obj3 = costTypeDefWispGreen;
			object obj4 = <>c.<>9__36_1;
			if (obj4 == null)
			{
				PayCostDelegate val2 = delegate(PayCostContext context, PayCostResults results)
				{
					//IL_003a: Unknown result type (might be due to invalid IL or missing references)
					//IL_003f: Unknown result type (might be due to invalid IL or missing references)
					//IL_0042: Unknown result type (might be due to invalid IL or missing references)
					//IL_0049: Unknown result type (might be due to invalid IL or missing references)
					//IL_004f: Invalid comparison between Unknown and I4
					//IL_0059: Unknown result type (might be due to invalid IL or missing references)
					CharacterBody component = ((Component)context.activator).GetComponent<CharacterBody>();
					if (Object.op_Implicit((Object)(object)component))
					{
						Inventory inventory = component.inventory;
						List<ItemDef> list = new List<ItemDef>();
						foreach (ItemIndex item in inventory.itemAcquisitionOrder)
						{
							if ((int)ItemCatalog.GetItemDef(item).tier == 1)
							{
								list.Add(ItemCatalog.GetItemDef(item));
							}
						}
						ItemDef val3 = list[Random.Range(0, list.Count)];
						context.purchasedObject.GetComponent<ShrineWispBehaviour>().wispItem = val3;
						inventory.RemoveItem(val3, 1);
					}
				};
				<>c.<>9__36_1 = val2;
				obj4 = (object)val2;
			}
			obj3.payCost = (PayCostDelegate)obj4;
			costTypeDefWispGreen.colorIndex = (ColorIndex)2;
		}

		public void CreateCostDefWispRed()
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_000b: Expected O, but got Unknown
			//IL_003e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0043: Unknown result type (might be due to invalid IL or missing references)
			//IL_0049: Expected O, but got Unknown
			//IL_007f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0068: Unknown result type (might be due to invalid IL or missing references)
			//IL_006d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0073: Expected O, but got Unknown
			costTypeDefWispRed = new CostTypeDef();
			costTypeDefWispRed.costStringFormatToken = "COST_ITEM_FORMAT";
			costTypeDefWispRed.saturateWorldStyledCostString = true;
			CostTypeDef obj = costTypeDefWispRed;
			object obj2 = <>c.<>9__37_0;
			if (obj2 == null)
			{
				IsAffordableDelegate val = delegate(CostTypeDef costTypeDef, IsAffordableContext context)
				{
					//IL_0001: Unknown result type (might be due to invalid IL or missing references)
					CharacterBody component2 = ((Component)context.activator).GetComponent<CharacterBody>();
					if (Object.op_Implicit((Object)(object)component2))
					{
						Inventory inventory2 = component2.inventory;
						if (Object.op_Implicit((Object)(object)inventory2))
						{
							return inventory2.GetTotalItemCountOfTier((ItemTier)2) > 0;
						}
					}
					return false;
				};
				<>c.<>9__37_0 = val;
				obj2 = (object)val;
			}
			obj.isAffordable = (IsAffordableDelegate)obj2;
			CostTypeDef obj3 = costTypeDefWispRed;
			object obj4 = <>c.<>9__37_1;
			if (obj4 == null)
			{
				PayCostDelegate val2 = delegate(PayCostContext context, PayCostResults results)
				{
					//IL_003a: Unknown result type (might be due to invalid IL or missing references)
					//IL_003f: Unknown result type (might be due to invalid IL or missing references)
					//IL_0042: Unknown result type (might be due to invalid IL or missing references)
					//IL_0049: Unknown result type (might be due to invalid IL or missing references)
					//IL_004f: Invalid comparison between Unknown and I4
					//IL_0059: Unknown result type (might be due to invalid IL or missing references)
					CharacterBody component = ((Component)context.activator).GetComponent<CharacterBody>();
					if (Object.op_Implicit((Object)(object)component))
					{
						Inventory inventory = component.inventory;
						List<ItemDef> list = new List<ItemDef>();
						foreach (ItemIndex item in inventory.itemAcquisitionOrder)
						{
							if ((int)ItemCatalog.GetItemDef(item).tier == 2)
							{
								list.Add(ItemCatalog.GetItemDef(item));
							}
						}
						ItemDef val3 = list[Random.Range(0, list.Count)];
						context.purchasedObject.GetComponent<ShrineWispBehaviour>().wispItem = val3;
						inventory.RemoveItem(val3, 1);
					}
				};
				<>c.<>9__37_1 = val2;
				obj4 = (object)val2;
			}
			obj3.payCost = (PayCostDelegate)obj4;
			costTypeDefWispRed.colorIndex = (ColorIndex)3;
		}

		public void CreateCostDefShrineFallen()
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_000b: Expected O, but got Unknown
			//IL_0049: Unknown result type (might be due to invalid IL or missing references)
			//IL_004e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0054: Expected O, but got Unknown
			//IL_008b: 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_0078: Unknown result type (might be due to invalid IL or missing references)
			//IL_007e: Expected O, but got Unknown
			costTypeDefShrineFallen = new CostTypeDef();
			costTypeDefShrineFallen.costStringFormatToken = "COST_PERCENTMAXHEALTH_ROUND_FORMAT";
			costTypeDefShrineFallen.saturateWorldStyledCostString = false;
			costTypeDefShrineFallen.darkenWorldStyledCostString = true;
			CostTypeDef obj = costTypeDefShrineFallen;
			object obj2 = <>c.<>9__38_0;
			if (obj2 == null)
			{
				IsAffordableDelegate val = delegate(CostTypeDef costTypeDef, IsAffordableContext context)
				{
					//IL_0001: Unknown result type (might be due to invalid IL or missing references)
					//IL_003c: Unknown result type (might be due to invalid IL or missing references)
					CharacterBody component2 = ((Component)context.activator).GetComponent<CharacterBody>();
					if (Object.op_Implicit((Object)(object)component2))
					{
						int buffCount2 = component2.GetBuffCount(InitBuffs.maxHPDownStage);
						int num2 = (int)Mathf.Ceil((100f - (float)component2.GetBuffCount(InitBuffs.maxHPDownStage)) / 100f * (float)context.cost);
						return buffCount2 + num2 < 100 && ShrineFallenBehaviour.IsAnyoneDead();
					}
					return false;
				};
				<>c.<>9__38_0 = val;
				obj2 = (object)val;
			}
			obj.isAffordable = (IsAffordableDelegate)obj2;
			CostTypeDef obj3 = costTypeDefShrineFallen;
			object obj4 = <>c.<>9__38_1;
			if (obj4 == null)
			{
				PayCostDelegate val2 = delegate(PayCostContext context, PayCostResults results)
				{
					CharacterBody component = ((Component)context.activator).GetComponent<CharacterBody>();
					if (Object.op_Implicit((Object)(object)component))
					{
						int buffCount = component.GetBuffCount(InitBuffs.maxHPDownStage);
						int num = (int)Mathf.Ceil((100f - (float)component.GetBuffCount(InitBuffs.maxHPDownStage)) / 100f * (float)context.cost);
						for (int i = 0; i < num; i++)
						{
							component.AddBuff(InitBuffs.maxHPDownStage);
						}
					}
				};
				<>c.<>9__38_1 = val2;
				obj4 = (object)val2;
			}
			obj3.payCost = (PayCostDelegate)obj4;
			costTypeDefShrineFallen.colorIndex = (ColorIndex)9;
		}

		public void CreateCostDefShrineFallenAlt()
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_000b: Expected O, but got Unknown
			//IL_0049: Unknown result type (might be due to invalid IL or missing references)
			//IL_004e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0054: Expected O, but got Unknown
			//IL_008a: 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_0078: Unknown result type (might be due to invalid IL or missing references)
			//IL_007e: Expected O, but got Unknown
			costTypeDefShrineFallen = new CostTypeDef();
			costTypeDefShrineFallen.costStringFormatToken = "COST_MONEY_FORMAT";
			costTypeDefShrineFallen.saturateWorldStyledCostString = true;
			costTypeDefShrineFallen.darkenWorldStyledCostString = false;
			CostTypeDef obj = costTypeDefShrineFallen;
			object obj2 = <>c.<>9__39_0;
			if (obj2 == null)
			{
				IsAffordableDelegate val = delegate(CostTypeDef costTypeDef, IsAffordableContext context)
				{
					//IL_0001: Unknown result type (might be due to invalid IL or missing references)
					//IL_0031: Unknown result type (might be due to invalid IL or missing references)
					CharacterBody component = ((Component)context.activator).GetComponent<CharacterBody>();
					if (Object.op_Implicit((Object)(object)component))
					{
						CharacterMaster master = component.master;
						if (Object.op_Implicit((Object)(object)master))
						{
							return (ulong)master.money >= (ulong)context.cost && ShrineFallenBehaviour.IsAnyoneDead();
						}
					}
					return false;
				};
				<>c.<>9__39_0 = val;
				obj2 = (object)val;
			}
			obj.isAffordable = (IsAffordableDelegate)obj2;
			CostTypeDef obj3 = costTypeDefShrineFallen;
			object obj4 = <>c.<>9__39_1;
			if (obj4 == null)
			{
				PayCostDelegate val2 = delegate(PayCostContext context, PayCostResults results)
				{
					if (Object.op_Implicit((Object)(object)context.activatorMaster))
					{
						CharacterMaster activatorMaster = context.activatorMaster;
						activatorMaster.money -= (uint)context.cost;
					}
				};
				<>c.<>9__39_1 = val2;
				obj4 = (object)val2;
			}
			obj3.payCost = (PayCostDelegate)obj4;
			costTypeDefShrineFallen.colorIndex = (ColorIndex)8;
		}

		public void CreateCostDefShrineDisorder()
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_000b: Expected O, but got Unknown
			//IL_0049: Unknown result type (might be due to invalid IL or missing references)
			//IL_004e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0054: Expected O, but got Unknown
			//IL_008b: 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_0078: Unknown result type (might be due to invalid IL or missing references)
			//IL_007e: Expected O, but got Unknown
			costTypeDefShrineDisorder = new CostTypeDef();
			costTypeDefShrineDisorder.costStringFormatToken = "COST_LUNARCOIN_FORMAT";
			costTypeDefShrineDisorder.saturateWorldStyledCostString = false;
			costTypeDefShrineDisorder.darkenWorldStyledCostString = true;
			CostTypeDef obj = costTypeDefShrineDisorder;
			object obj2 = <>c.<>9__40_0;
			if (obj2 == null)
			{
				IsAffordableDelegate val = delegate(CostTypeDef costTypeDef, IsAffordableContext context)
				{
					//IL_0001: 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_0062: Unknown result type (might be due to invalid IL or missing references)
					//IL_00fb: Unknown result type (might be due to invalid IL or missing references)
					//IL_011e: Unknown result type (might be due to invalid IL or missing references)
					CharacterBody component = ((Component)context.activator).GetComponent<CharacterBody>();
					if (Object.op_Implicit((Object)(object)component))
					{
						bool flag = false;
						Inventory inventory = component.inventory;
						foreach (ItemTier tier in Enum.GetValues(typeof(ItemTier)))
						{
							int num = int.MaxValue;
							IEnumerable<ItemDef> enumerable = ((IEnumerable<ItemDef>)(object)ItemCatalog.allItemDefs).Where((ItemDef x) => x.tier == tier);
							foreach (ItemDef item in enumerable)
							{
								int itemCount = inventory.GetItemCount(item);
								num = Math.Min(num, itemCount);
								if (itemCount - num > 1)
								{
									flag = true;
								}
							}
						}
						NetworkUser val4 = Util.LookUpBodyNetworkUser(((Component)context.activator).gameObject);
						return Object.op_Implicit((Object)(object)val4) && (ulong)val4.lunarCoins >= (ulong)context.cost && flag;
					}
					return false;
				};
				<>c.<>9__40_0 = val;
				obj2 = (object)val;
			}
			obj.isAffordable = (IsAffordableDelegate)obj2;
			CostTypeDef obj3 = costTypeDefShrineDisorder;
			object obj4 = <>c.<>9__40_1;
			if (obj4 == null)
			{
				PayCostDelegate val2 = delegate(PayCostContext context, PayCostResults results)
				{
					NetworkUser val3 = Util.LookUpBodyNetworkUser(((Component)context.activator).gameObject);
					if (Object.op_Implicit((Object)(object)val3))
					{
						val3.DeductLunarCoins((uint)context.cost);
					}
				};
				<>c.<>9__40_1 = val2;
				obj4 = (object)val2;
			}
			obj3.payCost = (PayCostDelegate)obj4;
			costTypeDefShrineDisorder.colorIndex = (ColorIndex)12;
		}

		public void CreateCostDefShrineHeresy()
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_000b: Expected O, but got Unknown
			//IL_0049: Unknown result type (might be due to invalid IL or missing references)
			//IL_004e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0054: Expected O, but got Unknown
			//IL_008b: 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_0078: Unknown result type (might be due to invalid IL or missing references)
			//IL_007e: Expected O, but got Unknown
			costTypeDefShrineHeresy = new CostTypeDef();
			costTypeDefShrineHeresy.costStringFormatToken = "COST_LUNARCOIN_FORMAT";
			costTypeDefShrineHeresy.saturateWorldStyledCostString = false;
			costTypeDefShrineHeresy.darkenWorldStyledCostString = true;
			CostTypeDef obj = costTypeDefShrineHeresy;
			object obj2 = <>c.<>9__41_0;
			if (obj2 == null)
			{
				IsAffordableDelegate val = delegate(CostTypeDef costTypeDef, IsAffordableContext context)
				{
					//IL_0001: Unknown result type (might be due to invalid IL or missing references)
					//IL_002f: Unknown result type (might be due to invalid IL or missing references)
					//IL_0047: 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_0094: Unknown result type (might be due to invalid IL or missing references)
					//IL_0077: 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)
					CharacterBody component = ((Component)context.activator).GetComponent<CharacterBody>();
					if (Object.op_Implicit((Object)(object)component))
					{
						bool flag = false;
						Inventory inventory = component.inventory;
						if (component.inventory.GetItemCount(Items.LunarPrimaryReplacement.itemIndex) <= 0 || component.inventory.GetItemCount(Items.LunarSecondaryReplacement.itemIndex) <= 0 || component.inventory.GetItemCount(Items.LunarUtilityReplacement.itemIndex) <= 0 || component.inventory.GetItemCount(Items.LunarSpecialReplacement.itemIndex) <= 0)
						{
							flag = true;
						}
						NetworkUser val4 = Util.LookUpBodyNetworkUser(((Component)context.activator).gameObject);
						return Object.op_Implicit((Object)(object)val4) && (ulong)val4.lunarCoins >= (ulong)context.cost && flag;
					}
					return false;
				};
				<>c.<>9__41_0 = val;
				obj2 = (object)val;
			}
			obj.isAffordable = (IsAffordableDelegate)obj2;
			CostTypeDef obj3 = costTypeDefShrineHeresy;
			object obj4 = <>c.<>9__41_1;
			if (obj4 == null)
			{
				PayCostDelegate val2 = delegate(PayCostContext context, PayCostResults results)
				{
					NetworkUser val3 = Util.LookUpBodyNetworkUser(((Component)context.activator).gameObject);
					if (Object.op_Implicit((Object)(object)val3))
					{
						val3.DeductLunarCoins((uint)context.cost);
					}
				};
				<>c.<>9__41_1 = val2;
				obj4 = (object)val2;
			}
			obj3.payCost = (PayCostDelegate)obj4;
			costTypeDefShrineHeresy.colorIndex = (ColorIndex)12;
		}

		public void RegisterLanguageTokens()
		{
			LanguageAPI.Add("SHRINE_IMP_USE_MESSAGE", "<style=cShrine>{0} inspected the vase and tiny imps appeared!</style>");
			LanguageAPI.Add("SHRINE_IMP_USE_MESSAGE_2P", "<style=cShrine>You inspected the vase and tiny imps appeared!</style>");
			LanguageAPI.Add("SHRINE_IMP_COMPLETED", "<style=cIsHealing>You killed all the imps and found some items!</style>");
			LanguageAPI.Add("SHRINE_IMP_COMPLETED_2P", "<style=cIsHealing>{0} killed all the imps and found some items!</style>");
			LanguageAPI.Add("SHRINE_IMP_FAILED", "<style=cIsHealth>You failed to kill all the imps in time!</style>");
			LanguageAPI.Add("SHRINE_IMP_FAILED_2P", "<style=cIsHealth>{0} failed to kill all the imps in time!</style>");
			LanguageAPI.Add("SHRINE_IMP_NAME", "Shrine of Imps");
			LanguageAPI.Add("SHRINE_IMP_CONTEXT", "Inspect the vase.");
			LanguageAPI.Add("SHRINE_FALLEN_NAME", "Shrine of the Fallen");
			LanguageAPI.Add("SHRINE_FALLEN_CONTEXT", "Offer to Shrine of the Fallen");
			LanguageAPI.Add("SHRINE_FALLEN_USED", "<style=cIsHealing>{0} offered to the Shrine of the Fallen and revived {1}!</style>");
			LanguageAPI.Add("SHRINE_FALLEN_USED_2P", "<style=cIsHealing>You offer to the Shrine of the Fallen and revived {1}!</style>");
			LanguageAPI.Add("OBJECTIVE_KILL_TINY_IMPS", "Kill the <color={0}>tiny imps</color> ({1}/{2}) in {3} seconds!");
			LanguageAPI.Add("COST_PERCENTMAXHEALTH_FORMAT", "{0}% MAX HP");
			LanguageAPI.Add("COST_PERCENTMAXHEALTH_ROUND_FORMAT", "{0}% STAGE MAX HP");
			LanguageAPI.Add("SHRINE_DISORDER_NAME", "Shrine of Disorder");
			LanguageAPI.Add("SHRINE_DISORDER_CONTEXT", "Offer to Shrine of Disorder");
			LanguageAPI.Add("SHRINE_DISORDER_USE_MESSAGE_2P", "<style=cShrine>Your order has been disturbed.</style>");
			LanguageAPI.Add("SHRINE_DISORDER_USE_MESSAGE", "<style=cShrine>{0}'s order has been disturbed.</style>");
			LanguageAPI.Add("SHRINE_HERESY_NAME", "Shrine of Heresy");
			LanguageAPI.Add("SHRINE_HERESY_CONTEXT", "Offer to Shrine of Heresy");
			LanguageAPI.Add("SHRINE_HERESY_USE_MESSAGE_2P", "<style=cShrine>You have taken a step towards heresy.</style>");
			LanguageAPI.Add("SHRINE_HERESY_USE_MESSAGE", "<style=cShrine>{0} has taken a step towards heresy.</style>");
			LanguageAPI.Add("SHRINE_WISP_NAME", "Shrine of Wisps");
			LanguageAPI.Add("SHRINE_WISP_CONTEXT", "Offer to the tree");
			LanguageAPI.Add("SHRINE_WISP_ACCEPT_MESSAGE_2P", "<style=cShrine>The tree accepted your <color=#{1}>{2}</color> and ghostly Wisps appeared.</style>");
			LanguageAPI.Add("SHRINE_WISP_ACCEPT_MESSAGE", "<style=cShrine>The tree accepted {0}'s <color=#{1}>{2}</color> and ghostly Wisps appeared.</style>");
			LanguageAPI.Add("SHRINE_WISP_DENY_MESSAGE_2P", "<style=cIsDamage>The tree rejected your <color=#{1}>{2}</color> and angry Wisps appeared..</style>");
			LanguageAPI.Add("SHRINE_WISP_DENY_MESSAGE", "<style=cIsDamage>The tree rejected {0}'s <color=#{1}>{2}</color> and angry Wisps appeared..</style>");
			LanguageAPI.Add("SHRINE_SHIELDING_NAME", "Shrine of Hardening");
			LanguageAPI.Add("SHRINE_SHIELDING_CONTEXT", "Touch the shield.");
			LanguageAPI.Add("SHRINE_SHIELDING_USE_MESSAGE_2P", "<style=cShrine>You feel protected.</style>");
			LanguageAPI.Add("SHRINE_SHIELDING_USE_MESSAGE", "<style=cShrine>{0} feels protected.</style>");
		}

		public void RegisterConfig()
		{
			impShrineEnabled = ((BaseUnityPlugin)this).Config.Bind<bool>("Shrine of Imps", "Enable", true, "Enable the Shrine of Imps.");
			impShrineWeight = ((BaseUnityPlugin)this).Config.Bind<int>("Shrine of Imps", "Weight", 2, "The spawn weight of this shrine, lower is more rare.");
			impCountScale = ((BaseUnityPlugin)this).Config.Bind<bool>("Shrine of Imps", "Count Scale", true, "Scale the maximum amount of imps with stage difficulty.");
			impShrineTime = ((BaseUnityPlugin)this).Config.Bind<int>("Shrine of Imps", "Time", 30, "The amount of time you get to finish a Shrine of Imps.");
			itemRarityBasedOnSpeed = ((BaseUnityPlugin)this).Config.Bind<bool>("Shrine of Imps", "Item Rarity Based On Speed", true, "Increase item rarity based on how fast you killed all the imps.");
			dropItemForEveryPlayer = ((BaseUnityPlugin)this).Config.Bind<bool>("Shrine of Imps", "Drop for every player", true, "Drop a item for every player in the session.");
			extraItemCount = ((BaseUnityPlugin)this).Config.Bind<int>("Shrine of Imps", "Extra Item Count", 0, "Drop X extra items along with the base amount when a Shrine of Imps is beaten.");
			fallenShrineEnabled = ((BaseUnityPlugin)this).Config.Bind<bool>("Shrine of the Fallen", "Enable", false, "Enable the Shrine of the Fallen.");
			fallenShrineWeight = ((BaseUnityPlugin)this).Config.Bind<int>("Shrine of the Fallen", "Weight", 2, "The spawn weight of this shrine, lower is more rare.");
			fallenShrineHPPenalty = ((BaseUnityPlugin)this).Config.Bind<int>("Shrine of the Fallen", "HP Penalty", 40, "The max HP penalty the user takes for the rest of the stage when this shrine is used.");
			fallenShrineMoney = ((BaseUnityPlugin)this).Config.Bind<bool>("Shrine of the Fallen", "Use Money", false, "Shrine of the Fallen costs money rather than a HP penalty.");
			fallenShrineMoneyCost = ((BaseUnityPlugin)this).Config.Bind<int>("Shrine of the Fallen", "Money Base Cost", 300, "The base cost for the shrine. (only applicable if 'Use Money' is enabled)");
			disorderShrineEnabled = ((BaseUnityPlugin)this).Config.Bind<bool>("Shrine of Disorder", "Enable", true, "Enable the Shrine of Disorder.");
			disorderShrineWeight = ((BaseUnityPlugin)this).Config.Bind<int>("Shrine of Disorder", "Weight", 1, "The spawn weight of this shrine, lower is more rare.");
			heresyShrineEnabled = ((BaseUnityPlugin)this).Config.Bind<bool>("Shrine of Heresy", "Enable", true, "Enable the Shrine of Heresy.");
			heresyShrineWeight = ((BaseUnityPlugin)this).Config.Bind<int>("Shrine of Heresy", "Weight", 1, "The spawn weight of this shrine, lower is more rare.");
			wispShrineEnabled = ((BaseUnityPlugin)this).Config.Bind<bool>("Shrine of Wisps", "Enable", true, "Enable the Shrine of Wisps.");
			wispShrineScaleDifficulty = ((BaseUnityPlugin)this).Config.Bind<bool>("Shrine of Wisps", "Scale Count With Difficulty", true, "Scale the number of wisps spawned with difficulty.");
			wispShrineWeight = ((BaseUnityPlugin)this).Config.Bind<int>("Shrine of Wisps", "Weight", 2, "The spawn weight of this shrine, lower is more rare.");
		}

		public void GenerateTinyImp()
		{
			//IL_001c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0023: Unknown result type (might be due to invalid IL or missing references)
			//IL_002a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0038: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ae: Unknown result type (might be due to invalid IL or missing references)
			//IL_0169: Unknown result type (might be due to invalid IL or missing references)
			//IL_0179: Unknown result type (might be due to invalid IL or missing references)
			//IL_0189: Unknown result type (might be due to invalid IL or missing references)
			//IL_01a9: Unknown result type (might be due to invalid IL or missing references)
			//IL_01eb: Unknown result type (might be due to invalid IL or missing references)
			//IL_01f5: Expected O, but got Unknown
			CharacterSpawnCard val = ScriptableObject.CreateInstance<CharacterSpawnCard>();
			CharacterSpawnCard val2 = Resources.Load<CharacterSpawnCard>("SpawnCards/CharacterSpawnCards/cscImp");
			((SpawnCard)val).directorCreditCost = 10;
			((SpawnCard)val).forbiddenFlags = (NodeFlags)0;
			((SpawnCard)val).hullSize = (HullClassification)0;
			((SpawnCard)val).nodeGraphType = (GraphType)0;
			((SpawnCard)val).occupyPosition = false;
			((SpawnCard)val).requiredFlags = (NodeFlags)0;
			((SpawnCard)val).sendOverNetwork = true;
			val.forbiddenAsBoss = true;
			GameObject val3 = PrefabAPI.InstantiateClone(((SpawnCard)val2).prefab, "TinyImpMaster");
			CharacterMaster component = val3.GetComponent<CharacterMaster>();
			GameObject val4 = (component.bodyPrefab = PrefabAPI.InstantiateClone(component.bodyPrefab, "TinyImpBody"));
			CharacterBody component2 = val4.GetComponent<CharacterBody>();
			component2.baseNameToken = "IMP_TINY_BODY_NAME";
			Transform modelTransform = val4.GetComponent<ModelLocator>().modelTransform;
			modelTransform.localScale /= 2f;
			AISkillDriver[] components = val3.GetComponents<AISkillDriver>();
			component2.baseMaxHealth /= 2f;
			component2.levelMaxHealth /= 2f;
			component2.baseJumpPower /= 5f;
			component2.levelJumpPower = 0f;
			component2.baseMoveSpeed *= 1.5f;
			AISkillDriver[] array = components;
			foreach (AISkillDriver val5 in array)
			{
				Object.Destroy((Object)(object)val5);
			}
			AISkillDriver val6 = val3.AddComponent<AISkillDriver>();
			val6.minDistance = 0f;
			val6.maxDistance = 500f;
			val6.aimType = (AimType)4;
			val6.ignoreNodeGraph = false;
			val6.moveTargetType = (TargetType)0;
			val6.shouldSprint = true;
			val6.movementType = (MovementType)3;
			val6.moveInputScale = 1f;
			val6.driverUpdateTimerOverride = -1f;
			val6.skillSlot = (SkillSlot)(-1);
			val3.AddComponent<TinyImp>();
			val3.GetComponent<BaseAI>().localNavigator.allowWalkOffCliff = false;
			ContentAddition.AddMaster(val3);
			ContentAddition.AddBody(val4);
			ContentAddition.AddNetworkedObject(val4);
			ContentAddition.AddNetworkedObject(val3);
			LocalNavigator.Update += new hook_Update(LocalNavigator_Update);
			((SpawnCard)val).prefab = val3;
			impSpawnCard = val;
		}

		private void LocalNavigator_Update(orig_Update orig, LocalNavigator self, float deltaTime)
		{
			if (Object.op_Implicit((Object)(object)self.bodyComponents.body) && Object.op_Implicit((Object)(object)self.bodyComponents.body.master) && Object.op_Implicit((Object)(object)((Component)self.bodyComponents.body.master).gameObject) && Object.op_Implicit((Object)(object)((Component)self.bodyComponents.body.master).gameObject.GetComponent<TinyImp>()))
			{
				self.allowWalkOffCliff = false;
			}
			orig.Invoke(self, deltaTime);
		}

		private void SwarmsArtifactManager_OnSpawnCardOnSpawnedServerGlobal(orig_OnSpawnCardOnSpawnedServerGlobal orig, SpawnResult result)
		{
			//IL_0003: Unknown result type (might be due to invalid IL or missing references)
			//IL_0013: Unknown result type (might be due to invalid IL or missing references)
			//IL_0033: Unknown result type (might be due to invalid IL or missing references)
			bool flag = true;
			if (Object.op_Implicit((Object)(object)result.spawnedInstance) && Object.op_Implicit((Object)(object)result.spawnedInstance.GetComponent<TinyImp>()))
			{
				flag = false;
			}
			if (flag)
			{
				orig.Invoke(result);
			}
		}

		private WeightedSelection<DirectorCard> SceneDirector_GenerateInteractableCardSelection(orig_GenerateInteractableCardSelection orig, SceneDirector self)
		{
			//IL_001a: Unknown result type (might be due to invalid IL or missing references)
			//IL_001f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0026: Unknown result type (might be due to invalid IL or missing references)
			//IL_004d: Unknown result type (might be due to invalid IL or missing references)
			WeightedSelection<DirectorCard> val = orig.Invoke(self);
			ChoiceInfo<DirectorCard>[] choices = val.choices;
			for (int i = 0; i < choices.Length; i++)
			{
				ChoiceInfo<DirectorCard> val2 = choices[i];
				DirectorCard value = val2.value;
				Print("Card Name: " + ((value != null) ? ((Object)value.spawnCard).name : null));
				DirectorCard value2 = val2.value;
				object obj;
				if (value2 == null)
				{
					obj = null;
				}
				else
				{
					SpawnCard spawnCard = value2.spawnCard;
					if (spawnCard == null)
					{
						obj = null;
					}
					else
					{
						GameObject prefab = spawnCard.prefab;
						obj = ((prefab != null) ? ((Object)prefab).name : null);
					}
				}
				Print("Name: " + (string?)obj);
				Print("Weight: " + val2.weight);
			}
			return val;
		}

		public static void Print(string printString)
		{
			Debug.Log((object)("[Better Shrines] " + printString));
		}

		public void GenerateFallenShrine()
		{
			//IL_0021: Unknown result type (might be due to invalid IL or missing references)
			//IL_002b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0035: Expected O, but got Unknown
			//IL_0128: Unknown result type (might be due to invalid IL or missing references)
			//IL_012d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0149: Unknown result type (might be due to invalid IL or missing references)
			//IL_0150: Expected O, but got Unknown
			SpawnCard val = Resources.Load<SpawnCard>("SpawnCards/InteractableSpawnCard/iscShrineHealing");
			ShrineAPI.ShrineInfo shrineInfo = new ShrineAPI.ShrineInfo(ShrineAPI.ShrineBaseType.Order, new Color(1f, 0.8549f, 0.7647f, 1f), (GameObject)EvaResources.ShrineFallenPrefab);
			Transform symbolTransform = shrineInfo.shrinePrefab.transform.Find("Symbol");
			Transform modelTransform = shrineInfo.modelTransform;
			GameObject shrinePrefab = shrineInfo.shrinePrefab;
			PurchaseInteraction component = shrinePrefab.GetComponent<PurchaseInteraction>();
			int num = fallenShrineHPPenalty.Value;
			if (num > 99)
			{
				num = 99;
			}
			else if (num < 0)
			{
				num = 0;
			}
			if (fallenShrineMoney.Value)
			{
				component.Networkcost = fallenShrineMoneyCost.Value;
				component.cost = fallenShrineMoneyCost.Value;
			}
			else
			{
				component.Networkcost = num;
				component.cost = num;
			}
			component.setUnavailableOnTeleporterActivated = false;
			if (fallenShrineMoney.Value)
			{
				component.automaticallyScaleCostWithDifficulty = true;
			}
			else
			{
				component.automaticallyScaleCostWithDifficulty = false;
			}
			ShrineFallenBehaviour shrineFallenBehaviour = shrinePrefab.AddComponent<ShrineFallenBehaviour>();
			shrineFallenBehaviour.shrineEffectColor = new Color(0.384f, 0.874f, 0.435f);
			shrineFallenBehaviour.symbolTransform = symbolTransform;
			shrineFallenBehaviour.maxUses = 1;
			InteractableSpawnCard val2 = ScriptableObject.CreateInstance<InteractableSpawnCard>();
			DirectorCard val3 = new DirectorCard();
			((SpawnCard)val2).prefab = shrinePrefab;
			val2.slightlyRandomizeOrientation = false;
			val3.selectionWeight = fallenShrineWeight.Value;
			val3.spawnCard = (SpawnCard)(object)val2;
			Helpers.AddNewInteractable(val3, (InteractableCategory)4);
		}

		public void GenerateHeresyShrine()
		{
			//IL_0021: Unknown result type (might be due to invalid IL or missing references)
			//IL_002b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0035: Expected O, but got Unknown
			//IL_0075: Unknown result type (might be due to invalid IL or missing references)
			//IL_007a: Unknown result type (might be due to invalid IL or missing references)
			//IL_008e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0095: Expected O, but got Unknown
			SpawnCard val = Resources.Load<SpawnCard>("SpawnCards/InteractableSpawnCard/iscShrineRestack");
			ShrineAPI.ShrineInfo shrineInfo = new ShrineAPI.ShrineInfo(ShrineAPI.ShrineBaseType.Order, new Color(1f, 0.8549f, 0.7647f, 1f), (GameObject)EvaResources.ShrineHeresyPrefab);
			Transform symbolTransform = shrineInfo.shrinePrefab.transform.Find("Symbol");
			Transform modelTransform = shrineInfo.modelTransform;
			GameObject shrinePrefab = shrineInfo.shrinePrefab;
			ShrineHeresyBehaviour shrineHeresyBehaviour = shrinePrefab.AddComponent<ShrineHeresyBehaviour>();
			shrineHeresyBehaviour.shrineEffectColor = new Color(1f, 0.23f, 0.6337214f);
			shrineHeresyBehaviour.symbolTransform = symbolTransform;
			InteractableSpawnCard val2 = ScriptableObject.CreateInstance<InteractableSpawnCard>();
			DirectorCard val3 = new DirectorCard();
			((SpawnCard)val2).prefab = shrinePrefab;
			val2.slightlyRandomizeOrientation = false;
			val3.selectionWeight = heresyShrineWeight.Value;
			val3.spawnCard = (SpawnCard)(object)val2;
			((SpawnCard)val2).directorCreditCost = 30;
			val2.maxSpawnsPerStage = 1;
			Helpers.AddNewInteractable(val3, (InteractableCategory)4);
		}

		public void GenerateDisorderShrine()
		{
			//IL_0021: Unknown result type (might be due to invalid IL or missing references)
			//IL_002b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0035: Expected O, but got Unknown
			//IL_0075: Unknown result type (might be due to invalid IL or missing references)
			//IL_007a: Unknown result type (might be due to invalid IL or missing references)
			//IL_009b: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a2: Expected O, but got Unknown
			SpawnCard val = Resources.Load<SpawnCard>("SpawnCards/InteractableSpawnCard/iscShrineRestack");
			ShrineAPI.ShrineInfo shrineInfo = new ShrineAPI.ShrineInfo(ShrineAPI.ShrineBaseType.Order, new Color(1f, 0.8549f, 0.7647f, 1f), (GameObject)EvaResources.ShrineDisorderPrefab);
			Transform symbolTransform = shrineInfo.shrinePrefab.transform.Find("Symbol");
			Transform modelTransform = shrineInfo.modelTransform;
			GameObject shrinePrefab = shrineInfo.shrinePrefab;
			ShrineDisorderBehaviour shrineDisorderBehaviour = shrinePrefab.AddComponent<ShrineDisorderBehaviour>();
			shrineDisorderBehaviour.shrineEffectColor = new Color(1f, 0.23f, 0.6337214f);
			shrineDisorderBehaviour.symbolTransform = symbolTransform;
			shrineDisorderBehaviour.modelBase = ((Component)modelTransform).transform;
			InteractableSpawnCard val2 = ScriptableObject.CreateInstance<InteractableSpawnCard>();
			DirectorCard val3 = new DirectorCard();
			((SpawnCard)val2).prefab = shrinePrefab;
			val2.slightlyRandomizeOrientation = false;
			val3.selectionWeight = disorderShrineWeight.Value;
			val3.spawnCard = (SpawnCard)(object)val2;
			((SpawnCard)val2).directorCreditCost = 30;
			val2.maxSpawnsPerStage = 1;
			Helpers.AddNewInteractable(val3, (InteractableCategory)4);
		}

		public void GenerateImpShrine()
		{
			//IL_0021: Unknown result type (might be due to invalid IL or missing references)
			//IL_002b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0035: Expected O, but got Unknown
			//IL_0053: Unknown result type (might be due to invalid IL or missing references)
			//IL_005a: Expected O, but got Unknown
			//IL_0072: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00db: Unknown result type (might be due to invalid IL or missing references)
			//IL_0100: Unknown result type (might be due to invalid IL or missing references)
			//IL_0107: Expected O, but got Unknown
			SpawnCard val = Resources.Load<SpawnCard>("SpawnCards/InteractableSpawnCard/iscShrineHealing");
			ShrineAPI.ShrineInfo shrineInfo = new ShrineAPI.ShrineInfo(ShrineAPI.ShrineBaseType.Healing, new Color(1f, 0.8549f, 0.7647f, 1f), (GameObject)EvaResources.ShrineImpPrefab);
			Transform symbolTransform = shrineInfo.shrinePrefab.transform.Find("Symbol");
			GameObject shrinePrefab = shrineInfo.shrinePrefab;
			DirectorCard val2 = new DirectorCard();
			val2.spawnCard = (SpawnCard)(object)impSpawnCard;
			val2.selectionWeight = 10;
			val2.spawnDistance = (MonsterSpawnDistance)0;
			val2.preventOverhead = false;
			val2.minimumStageCompletions = 0;
			CombatDirector component = shrinePrefab.GetComponent<CombatDirector>();
			DirectorCardCategorySelection val3 = ScriptableObject.CreateInstance<DirectorCardCategorySelection>();
			val3.AddCategory("Imps", 10f);
			val3.AddCard(0, val2);
			component.monsterCards = val3;
			ShrineImpBehaviour shrineImpBehaviour = shrinePrefab.AddComponent<ShrineImpBehaviour>();
			shrineImpBehaviour.shrineEffectColor = new Color(0.6661001f, 0.5333304f, 85f / 106f);
			shrineImpBehaviour.symbolTransform = symbolTransform;
			shrineImpBehaviour.directorCard = val2;
			CustomDirector customDirector = shrinePrefab.AddComponent<CustomDirector>();
			InteractableSpawnCard val4 = ScriptableObject.CreateInstance<InteractableSpawnCard>();
			DirectorCard val5 = new DirectorCard();
			((SpawnCard)val4).prefab = shrinePrefab;
			val4.slightlyRandomizeOrientation = false;
			((SpawnCard)val4).directorCreditCost = 20;
			val4.maxSpawnsPerStage = 2;
			val5.selectionWeight = impShrineWeight.Value;
			val5.spawnCard = (SpawnCard)(object)val4;
			Helpers.AddNewInteractable(val5, (InteractableCategory)4);
		}

		public void GenerateWispShrine()
		{
			//IL_0028: 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_003c: Expected O, but got Unknown
			//IL_0063: Unknown result type (might be due to invalid IL or missing references)
			//IL_006a: Expected O, but got Unknown
			//IL_0087: Unknown result type (might be due to invalid IL or missing references)
			//IL_009c: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a3: Expected O, but got Unknown
			//IL_00bf: Unknown result type (might be due to invalid IL or missing references)
			//IL_0130: Unknown result type (might be due to invalid IL or missing references)
			//IL_0135: Unknown result type (might be due to invalid IL or missing references)
			//IL_0149: Unknown result type (might be due to invalid IL or missing references)
			//IL_0150: Expected O, but got Unknown
			//IL_01b2: Unknown result type (might be due to invalid IL or missing references)
			//IL_01b8: Unknown result type (might be due to invalid IL or missing references)
			SpawnCard val = Resources.Load<SpawnCard>("SpawnCards/InteractableSpawnCard/iscShrineBlood");
			GameObject prefab = val.prefab;
			ShrineAPI.ShrineInfo shrineInfo = new ShrineAPI.ShrineInfo(ShrineAPI.ShrineBaseType.Blood, new Color(1f, 0.8549f, 0.7647f, 1f), (GameObject)EvaResources.ShrineWispPrefab);
			Transform symbolTransform = shrineInfo.shrinePrefab.transform.Find("Symbol");
			Transform modelTransform = shrineInfo.modelTransform;
			GameObject shrinePrefab = shrineInfo.shrinePrefab;
			DirectorCard val2 = new DirectorCard();
			val2.spawnCard = (SpawnCard)(object)Resources.Load<CharacterSpawnCard>("spawncards/characterspawncards/cscLesserWisp");
			val2.selectionWeight = 10;
			val2.spawnDistance = (MonsterSpawnDistance)0;
			val2.preventOverhead = false;
			val2.minimumStageCompletions = 0;
			DirectorCard val3 = new DirectorCard();
			val3.spawnCard = (SpawnCard)(object)Resources.Load<CharacterSpawnCard>("spawncards/characterspawncards/cscGreaterWisp");
			val3.selectionWeight = 3;
			val3.spawnDistance = (MonsterSpawnDistance)0;
			val3.preventOverhead = false;
			val3.minimumStageCompletions = 0;
			CombatDirector component = shrinePrefab.GetComponent<CombatDirector>();
			DirectorCardCategorySelection val4 = ScriptableObject.CreateInstance<DirectorCardCategorySelection>();
			val4.AddCategory("Imps", 13f);
			val4.AddCard(0, val2);
			val4.AddCard(0, val3);
			component.monsterCards = val4;
			ShrineWispBehaviour shrineWispBehaviour = shrinePrefab.AddComponent<ShrineWispBehaviour>();
			shrineWispBehaviour.shrineEffectColor = new Color(0.6661001f, 0.5333304f, 85f / 106f);
			shrineWispBehaviour.symbolTransform = symbolTransform;
			InteractableSpawnCard val5 = ScriptableObject.CreateInstance<InteractableSpawnCard>();
			DirectorCard val6 = new DirectorCard();
			((SpawnCard)val5).prefab = shrinePrefab;
			val5.slightlyRandomizeOrientation = false;
			val6.selectionWeight = wispShrineWeight.Value;
			val6.spawnCard = (SpawnCard)(object)val5;
			((SpawnCard)val5).directorCreditCost = 15;
			val5.maxSpawnsPerStage = 2;
			Stage[] array = (Stage[])(object)new Stage[2]
			{
				(Stage)256,
				(Stage)64
			};
			Stage[] array2 = array;
			foreach (Stage val7 in array2)
			{
				Helpers.AddNewInteractableToStage(val6, (InteractableCategory)4, val7, "");
			}
		}
	}
	public static class EvaResources
	{
		public static bool Loaded { get; private set; }

		public static Object ShrineFallenPrefab { get; private set; }

		public static Object ShrineImpPrefab { get; private set; }

		public static Object ShrineDisorderPrefab { get; private set; }

		public static Object ShrineWispPrefab { get; private set; }

		public static Object ShrineHeresyPrefab { get; private set; }

		public static Object ShrineShieldPrefab { get; private set; }

		public static Sprite HPDebuffIcon { get; private set; }

		public static Sprite ShieldBar { get; private set; }

		public static void Init()
		{
			//IL_011b: Unknown result type (might be due to invalid IL or missing references)
			//IL_012a: Unknown result type (might be due to invalid IL or missing references)
			if (!Loaded)
			{
				Loaded = true;
				AssetBundle val = AssetBundle.LoadFromFile(Assembly.GetExecutingAssembly().Location.Replace("BetterShrines.dll", "bettershrines"));
				val.LoadAllAssets();
				if ((Object)(object)val != (Object)null)
				{
					MoreShrines.Print("Bundle data: " + (object)val);
					MoreShrines.Print("Asset bundle loaded.");
					ShrineFallenPrefab = val.LoadAsset<Object>("Assets/BetterShrines/ShrineOfTheFallen/ShrineFallen.prefab");
					ShrineImpPrefab = val.LoadAsset<Object>("Assets/BetterShrines/ImpShrine/ShrineImp.prefab");
					ShrineDisorderPrefab = val.LoadAsset<Object>("Assets/BetterShrines/ShrineOfDisorder/ShrineDisorder.prefab");
					ShrineHeresyPrefab = val.LoadAsset<Object>("Assets/BetterShrines/ShrineOfHeresy/ShrineHeresy.prefab");
					ShrineWispPrefab = val.LoadAsset<Object>("Assets/BetterShrines/WispShrine/ShrineWisp.prefab");
					ShrineShieldPrefab = val.LoadAsset<Object>("Assets/BetterShrines/ShrineOfShielding/ShrineShielding.prefab");
					ShieldBar = val.LoadAsset<Sprite>("Assets/BetterShrines/textures/texUINonsegmentedHealthbar.png");
					Texture2D val2 = val.LoadAsset<Texture2D>("Assets/BetterShrines/Buffs/texBuffHealthDownIcon.png");
					MoreShrines.Print("Bundle assets loaded.");
					HPDebuffIcon = Sprite.Create(val2, new Rect(0f, 0f, (float)((Texture)val2).width, (float)((Texture)val2).height), new Vector2(0.5f, 0.5f));
				}
			}
		}
	}
	internal class ShrineAPI
	{
		public enum ShrineBaseType
		{
			Chance,
			Healing,
			Order,
			Blood,
			Combat,
			Gold,
			None
		}

		public class ShrineInfo
		{
			public GameObject shrinePrefab;

			public CombatDirector combatDirector;

			public Transform modelTransform;

			public Transform symbolTransform;

			public void Create(ShrineBaseType baseShrine, GameObject shrinePrefab, Color? symbolColor = null, Shader overrideShader = null, Color? materialColor = null)
			{
				//IL_01bb: Unknown result type (might be due to invalid IL or missing references)
				//IL_01c5: Expected O, but got Unknown
				//IL_0200: Unknown result type (might be due to invalid IL or missing references)
				//IL_010b: Unknown result type (might be due to invalid IL or missing references)
				//IL_00f5: Unknown result type (might be due to invalid IL or missing references)
				SpawnCard val = Resources.Load<SpawnCard>(shrineDict[baseShrine]);
				GameObject prefab = val.prefab;
				Transform val2 = prefab.transform.Find("Symbol");
				MeshRenderer component = ((Component)val2).GetComponent<MeshRenderer>();
				Material material = ((Renderer)component).material;
				if (Object.op_Implicit((Object)(object)shrinePrefab.GetComponent<ModelLocator>()))
				{
					modelTransform = shrinePrefab.GetComponent<ModelLocator>().modelTransform;
					MeshRenderer[] componentsInChildren = ((Component)modelTransform).GetComponentsInChildren<MeshRenderer>();
					foreach (MeshRenderer val3 in componentsInChildren)
					{
						if ((Object)(object)overrideShader != (Object)null)
						{
							((Renderer)val3).material.shader = overrideShader;
						}
						else
						{
							((Renderer)val3).material.shader = Shader.Find("Hopoo Games/Deferred/Standard");
						}
					}
					MeshRenderer[] componentsInChildren2 = ((Component)modelTransform).GetComponentsInChildren<MeshRenderer>();
					foreach (MeshRenderer val4 in componentsInChildren2)
					{
						if (materialColor.HasValue)
						{
							((Renderer)val4).material.color = materialColor.Value;
						}
						else
						{
							((Renderer)val4).material.color = Color.white;
						}
					}
				}
				if (Object.op_Implicit((Object)(object)shrinePrefab.GetComponent<CombatDirector>()))
				{
					combatDirector = shrinePrefab.GetComponent<CombatDirector>();
				}
				if (Object.op_Implicit((Object)(object)shrinePrefab.transform.Find("Symbol")))
				{
					symbolTransform = shrinePrefab.transform.Find("Symbol");
					if (Object.op_Implicit((Object)(object)((Component)symbolTransform).GetComponent<MeshRenderer>()))
					{
						MeshRenderer component2 = ((Component)symbolTransform).gameObject.GetComponent<MeshRenderer>();
						Texture mainTexture = ((Renderer)component2).material.mainTexture;
						((Renderer)component2).material = new Material(material.shader);
						((Renderer)component2).material.CopyPropertiesFromMaterial(material);
						((Renderer)component2).material.mainTexture = mainTexture;
						if (symbolColor.HasValue)
						{
							((Renderer)component2).material.SetColor("_TintColor", symbolColor.Value);
						}
					}
				}
				this.shrinePrefab = shrinePrefab;
				ContentAddition.AddNetworkedObject(shrinePrefab);
				PrefabAPI.RegisterNetworkPrefab(shrinePrefab);
			}

			public ShrineInfo(ShrineBaseType baseShrine, GameObject shrinePrefab, Color symbolColor, Shader overrideShader, Color materialColor)
			{
				//IL_000b: Unknown result type (might be due to invalid IL or missing references)
				//IL_0013: Unknown result type (might be due to invalid IL or missing references)
				Create(baseShrine, shrinePrefab, symbolColor, overrideShader, materialColor);
			}

			public ShrineInfo(ShrineBaseType baseShrine, GameObject shrinePrefab, Shader overrideShader, Color materialColor)
			{
				//IL_0015: Unknown result type (might be due to invalid IL or missing references)
				Create(baseShrine, shrinePrefab, null, overrideShader, materialColor);
			}

			public ShrineInfo(ShrineBaseType baseShrine, Color materialColor, GameObject shrinePrefab)
			{
				//IL_0015: Unknown result type (might be due to invalid IL or missing references)
				Create(baseShrine, shrinePrefab, null, null, materialColor);
			}

			public ShrineInfo(ShrineBaseType baseShrine, GameObject shrinePrefab, Color symbolColor, Shader overrideShader)
			{
				//IL_000b: Unknown result type (might be due to invalid IL or missing references)
				Create(baseShrine, shrinePrefab, symbolColor, overrideShader);
			}

			public ShrineInfo(ShrineBaseType baseShrine, GameObject shrinePrefab, Color symbolColor)
			{
				//IL_000b: Unknown result type (might be due to invalid IL or missing references)
				Create(baseShrine, shrinePrefab, symbolColor);
			}

			public ShrineInfo(ShrineBaseType baseShrine, GameObject shrinePrefab)
			{
				Create(baseShrine, shrinePrefab);
			}
		}

		private static Dictionary<ShrineBaseType, string> shrineDict = new Dictionary<ShrineBaseType, string>
		{
			{
				ShrineBaseType.Chance,
				"spawncards/interactablespawncard/iscShrineChance"
			},
			{
				ShrineBaseType.Healing,
				"spawncards/interactablespawncard/iscShrineHealing"
			},
			{
				ShrineBaseType.Order,
				"spawncards/interactablespawncard/iscShrineRestack"
			},
			{
				ShrineBaseType.Blood,
				"spawncards/interactablespawncard/iscShrineBlood"
			},
			{
				ShrineBaseType.Combat,
				"spawncards/interactablespawncard/iscShrineCombat"
			},
			{
				ShrineBaseType.Gold,
				"spawncards/interactablespawncard/iscShrineGoldshoresAccess"
			},
			{
				ShrineBaseType.None,
				"spawncards/interactablespawncard/iscShrineChance"
			}
		};
	}
	[RequireComponent(typeof(PurchaseInteraction))]
	public class ShrineDisorderBehaviour : NetworkBehaviour
	{
		public Transform symbolTransform;

		public Transform modelBase;

		public Color shrineEffectColor;

		public PurchaseInteraction purchaseInteraction;

		private ItemTier[] tiersToCheck;

		private static int kRpcRpcAddShrineStackClient;

		public void Awake()
		{
			//IL_0022: Unknown result type (might be due to invalid IL or missing references)
			purchaseInteraction = ((Component)this).GetComponent<PurchaseInteraction>();
			purchaseInteraction.costType = (CostTypeIndex)Array.IndexOf(CostTypeCatalog.costTypeDefs, MoreShrines.costTypeDefShrineDisorder);
			purchaseInteraction.cost = 1;
			purchaseInteraction.Networkcost = 1;
			((UnityEvent<Interactor>)(object)purchaseInteraction.onPurchase).AddListener((UnityAction<Interactor>)delegate(Interactor interactor)
			{
				AddShrineStack(interactor);
			});
		}

		[ClientRpc]
		public void RpcAddShrineStackClient()
		{
			((Component)symbolTransform).gameObject.SetActive(false);
			Rigidbody[] componentsInChildren = ((Component)((Component)modelBase).transform).GetComponentsInChildren<Rigidbody>();
			foreach (Rigidbody val in componentsInChildren)
			{
				val.isKinematic = false;
			}
		}

		public void AddShrineStack(Interactor interactor)
		{
			//IL_00a1: 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_00ad: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b8: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b9: Unknown result type (might be due to invalid IL or missing references)
			//IL_00be: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ce: 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_00da: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e5: Expected O, but got Unknown
			//IL_0058: Unknown result type (might be due to invalid IL or missing references)
			//IL_0062: Unknown result type (might be due to invalid IL or missing references)
			//IL_0078: Unknown result type (might be due to invalid IL or missing references)
			//IL_007d: 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
			CallRpcAddShrineStackClient();
			if (!NetworkServer.active)
			{
				Debug.LogWarning((object)"[Server] function 'System.Void RoR2.TeleporterInteraction::AddShrineStack()' called on client");
				return;
			}
			CharacterBody component = ((Component)interactor).GetComponent<CharacterBody>();
			if (Object.op_Implicit((Object)(object)component) && Object.op_Implicit((Object)(object)component.inventory))
			{
				ItemTier[] array = tiersToCheck;
				foreach (ItemTier itemTier in array)
				{
					FlattenInventory(component.inventory, itemTier);
				}
				Chat.SendBroadcastChat((ChatMessageBase)new SubjectFormatChatMessage
				{
					subjectAsCharacterBody = component,
					baseToken = "SHRINE_DISORDER_USE_MESSAGE"
				});
			}
			EffectManager.SpawnEffect(Resources.Load<GameObject>("Prefabs/Effects/ShrineUseEffect"), new EffectData
			{
				origin = ((Component)this).transform.position,
				rotation = Quaternion.identity,
				scale = 1f,
				color = Color32.op_Implicit(shrineEffectColor)
			}, true);
		}

		public void FlattenInventory(Inventory inventory, ItemTier itemTier)
		{
			//IL_0007: Unknown result type (might be due to invalid IL or missing references)
			//IL_0008: Unknown result type (might be due to invalid IL or missing references)
			//IL_000e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0121: Unknown result type (might be due to invalid IL or missing references)
			ItemDef[] array = ((IEnumerable<ItemDef>)(object)ItemCatalog.allItemDefs).Where((ItemDef x) => x.tier == itemTier && Run.instance.IsItemAvailable(x.itemIndex)).ToArray();
			int[] array2 = new int[array.Length];
			int num = int.MaxValue;
			ItemDef[] array3 = array;
			foreach (ItemDef val in array3)
			{
				num = Math.Min(inventory.GetItemCount(val), num);
				if (num == 0)
				{
					break;
				}
			}
			int num2 = num + 1;
			int num3 = 0;
			WeightedSelection<ItemDef> val2 = new WeightedSelection<ItemDef>(8);
			ItemDef[] array4 = array;
			foreach (ItemDef val3 in array4)
			{
				int itemCount = inventory.GetItemCount(val3);
				if (itemCount > num2)
				{
					int num4 = itemCount - num2;
					num3 += num4;
					inventory.RemoveItem(val3, num4);
				}
				else
				{
					val2.AddChoice(val3, 1f);
				}
			}
			int num5 = 0;
			while (num3 > 0)
			{
				if (val2.Count > 0)
				{
					num3--;
					int num6 = val2.EvaluateToChoiceIndex(Random.value);
					array2[Array.IndexOf(array, val2.GetChoice(num6).value)]++;
					val2.RemoveChoice(num6);
					continue;
				}
				num5 = num3 / array.Length;
				num3 -= num5 * array.Length;
				ItemDef[] array5 = array;
				foreach (ItemDef val4 in array5)
				{
					val2.AddChoice(val4, 1f);
				}
			}
			for (int l = 0; l < array.Length; l++)
			{
				int num7 = num5 + array2[l];
				if (num7 > 0)
				{
					inventory.GiveItem(array[l], num7);
				}
			}
		}

		public ShrineDisorderBehaviour()
		{
			ItemTier[] array = new ItemTier[5];
			RuntimeHelpers.InitializeArray(array, (RuntimeFieldHandle)/*OpCode not supported: LdMemberToken*/);
			tiersToCheck = (ItemTier[])(object)array;
			((NetworkBehaviour)this)..ctor();
		}

		private void UNetVersion()
		{
		}

		protected static void InvokeRpcRpcAddShrineStackClient(NetworkBehaviour obj, NetworkReader reader)
		{
			if (!NetworkClient.active)
			{
				Debug.LogError((object)"RPC RpcAddShrineStackClient called on server.");
			}
			else
			{
				((ShrineDisorderBehaviour)(object)obj).RpcAddShrineStackClient();
			}
		}

		public void CallRpcAddShrineStackClient()
		{
			//IL_0016: Unknown result type (might be due to invalid IL or missing references)
			//IL_001c: Expected O, but got Unknown
			//IL_0041: Unknown result type (might be due to invalid IL or missing references)
			if (!NetworkServer.active)
			{
				Debug.LogError((object)"RPC Function RpcAddShrineStackClient called on client.");
				return;
			}
			NetworkWriter val = new NetworkWriter();
			val.Write((short)0);
			val.Write((short)2);
			val.WritePackedUInt32((uint)kRpcRpcAddShrineStackClient);
			val.Write(((Component)this).GetComponent<NetworkIdentity>().netId);
			((NetworkBehaviour)this).SendRPCInternal(val, 0, "RpcAddShrineStackClient");
		}

		static ShrineDisorderBehaviour()
		{
			//IL_0020: Unknown result type (might be due to invalid IL or missing references)
			//IL_002a: Expected O, but got Unknown
			kRpcRpcAddShrineStackClient = 2035029055;
			NetworkBehaviour.RegisterRpcDelegate(typeof(ShrineDisorderBehaviour), kRpcRpcAddShrineStackClient, new CmdDelegate(InvokeRpcRpcAddShrineStackClient));
			NetworkCRC.RegisterBehaviour("ShrineDisorderBehaviour", 0);
		}

		public override bool OnSerialize(NetworkWriter writer, bool forceAll)
		{
			bool result = default(bool);
			return result;
		}

		public override void OnDeserialize(NetworkReader reader, bool initialState)
		{
		}
	}
	[RequireComponent(typeof(PurchaseInteraction))]
	public class ShrineFallenBehaviour : NetworkBehaviour
	{
		public Interactor whoInteracted;

		public Transform symbolTransform;

		public Color shrineEffectColor;

		public int maxUses = 1;

		public List<CharacterMaster> playersToRespawn = new List<CharacterMaster>();

		[SyncVar]
		public int timesUsed = 0;

		public float wait = 2f;

		[SyncVar]
		public float stopwatch;

		public PurchaseInteraction purchaseInteraction;

		[SyncVar]
		public bool inUse = false;

		[SyncVar]
		public bool isAvailable = true;

		private static int kRpcRpcAddShrineStackClient;

		public int NetworktimesUsed
		{
			get
			{
				return timesUsed;
			}
			[param: In]
			set
			{
				((NetworkBehaviour)this).SetSyncVar<int>(value, ref timesUsed, 1u);
			}
		}

		public float Networkstopwatch
		{
			get
			{
				return stopwatch;
			}
			[param: In]
			set
			{
				((NetworkBehaviour)this).SetSyncVar<float>(value, ref stopwatch, 2u);
			}
		}

		public bool NetworkinUse
		{
			get
			{
				return inUse;
			}
			[param: In]
			set
			{
				((NetworkBehaviour)this).SetSyncVar<bool>(value, ref inUse, 4u);
			}
		}

		public bool NetworkisAvailable
		{
			get
			{
				return isAvailable;
			}
			[param: In]
			set
			{
				((NetworkBehaviour)this).SetSyncVar<bool>(value, ref isAvailable, 8u);
			}
		}

		public void Awake()
		{
			//IL_0022: 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_0055: Expected O, but got Unknown
			purchaseInteraction = ((Component)this).GetComponent<PurchaseInteraction>();
			purchaseInteraction.costType = (CostTypeIndex)Array.IndexOf(CostTypeCatalog.costTypeDefs, MoreShrines.costTypeDefShrineFallen);
			((UnityEvent<Interactor>)(object)purchaseInteraction.onPurchase).AddListener((UnityAction<Interactor>)delegate(Interactor interactor)
			{
				AddShrineStack(interactor);
			});
			CharacterMaster.RespawnExtraLife += new hook_RespawnExtraLife(CharacterMaster_RespawnExtraLife);
		}

		private void CharacterMaster_RespawnExtraLife(orig_RespawnExtraLife orig, CharacterMaster self)
		{
			orig.Invoke(self);
			if (!playersToRespawn.Contains(self))
			{
				return;
			}
			playersToRespawn.Remove(self);
			CharacterBody body = self.GetBody();
			CharacterBody val = body;
			if (!Object.op_Implicit((Object)(object)val))
			{
				return;
			}
			int buffCount = val.GetBuffCount(InitBuffs.maxHPDownStage);
			int num = (int)Mathf.Ceil((100f - (float)val.GetBuffCount(InitBuffs.maxHPDownStage)) / 100f * (float)purchaseInteraction.cost);
			if (buffCount + num < 100)
			{
				for (int i = 0; i < num; i++)
				{
					val.AddBuff(InitBuffs.maxHPDownStage);
				}
			}
		}

		public void Update()
		{
			if (timesUsed < maxUses)
			{
				if (inUse)
				{
					Networkstopwatch = stopwatch - Time.deltaTime;
					if (stopwatch < 0f)
					{
						NetworkinUse = false;
					}
				}
				else if (IsAnyoneDead())
				{
					((Component)symbolTransform).gameObject.SetActive(true);
					NetworkisAvailable = true;
				}
				else
				{
					((Component)symbolTransform).gameObject.SetActive(false);
					NetworkisAvailable = false;
				}
			}
			else
			{
				((Component)symbolTransform).gameObject.SetActive(false);
				NetworkisAvailable = false;
				if (NetworkServer.active)
				{
					purchaseInteraction.SetAvailable(false);
				}
			}
		}

		[ClientRpc]
		public void RpcAddShrineStackClient()
		{
			((Component)symbolTransform).gameObject.SetActive(false);
		}

		public void AddShrineStack(Interactor interactor)
		{
			//IL_007a: Unknown result type (might be due to invalid IL or missing references)
			//IL_007f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0086: Unknown result type (might be due to invalid IL or missing references)
			//IL_0091: Unknown resu