Decompiled source of Godly Beast Gaming v1.2.0

plugins/AllTheSigils-All_The_Sigils/plugins/AllTheSigils.dll

Decompiled 5 months ago
using System;
using System.CodeDom.Compiler;
using System.Collections;
using System.Collections.Generic;
using System.ComponentModel;
using System.Diagnostics;
using System.Globalization;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Resources;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using AllTheSigils.Artwork;
using AllTheSigils.Voids_work.Cards;
using BepInEx;
using BepInEx.Bootstrap;
using BepInEx.Configuration;
using BepInEx.Logging;
using DigitalRuby.LightningBolt;
using DiskCardGame;
using GBC;
using HarmonyLib;
using InscryptionAPI.Card;
using InscryptionAPI.CardCosts;
using InscryptionAPI.Guid;
using InscryptionAPI.Saves;
using InscryptionAPI.Triggers;
using Pixelplacement;
using UnityEngine;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: TargetFramework(".NETStandard,Version=v2.0", FrameworkDisplayName = "")]
[assembly: AssemblyCompany("AllTheSigils")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyDescription("A giant custom sigil library.")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("AllTheSigils")]
[assembly: AssemblyTitle("AllTheSigils")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.0.0")]
[module: UnverifiableCode]
namespace AllTheSigils
{
	[BepInPlugin("ATS", "AllTheSigils", "3.0.1")]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	public class Plugin : BaseUnityPlugin
	{
		public class TurnIntoChickenOpp : AbilityBehaviour
		{
			public static Ability ability;

			private int lastShotTurn = -1;

			private PlayableCard lastShotCard;

			public override Ability Ability => ((AbilityBehaviour)this).Ability;

			public override int Priority => -1;

			public override bool RespondsToOtherCardResolve(PlayableCard otherCard)
			{
				return RespondsToTrigger(otherCard);
			}

			public override IEnumerator OnOtherCardResolve(PlayableCard otherCard)
			{
				yield return FireAtOpposingSlot(otherCard);
			}

			public override bool RespondsToOtherCardAssignedToSlot(PlayableCard otherCard)
			{
				return RespondsToTrigger(otherCard);
			}

			public override IEnumerator OnOtherCardAssignedToSlot(PlayableCard otherCard)
			{
				yield return FireAtOpposingSlot(otherCard);
			}

			private bool RespondsToTrigger(PlayableCard otherCard)
			{
				return !((AbilityBehaviour)this).Card.Dead && !otherCard.Dead && (Object)(object)otherCard.Slot == (Object)(object)((AbilityBehaviour)this).Card.Slot.opposingSlot;
			}

			private IEnumerator FireAtOpposingSlot(PlayableCard otherCard)
			{
				if ((Object)(object)otherCard != (Object)(object)lastShotCard || Singleton<TurnManager>.Instance.TurnNumber != lastShotTurn)
				{
					lastShotCard = otherCard;
					lastShotTurn = Singleton<TurnManager>.Instance.TurnNumber;
					Singleton<ViewManager>.Instance.SwitchToView((View)4, false, true);
					yield return (object)new WaitForSeconds(0.25f);
					if ((Object)(object)otherCard != (Object)null && !otherCard.Dead)
					{
						CardInfo cardByName = CardLoader.GetCardByName("AP_Chicken");
						yield return otherCard.TransformIntoCard(cardByName, (Action)null, (Action)null);
					}
					yield return ((AbilityBehaviour)this).LearnAbility(0.5f);
					Singleton<ViewManager>.Instance.Controller.LockState = (ViewLockState)0;
				}
			}
		}

		public class TurnIntoChickenLooseCannon : AbilityBehaviour
		{
			public static Ability ability;

			public override Ability Ability => ability;

			public override bool RespondsToTurnEnd(bool playerTurnEnd)
			{
				//IL_0007: Unknown result type (might be due to invalid IL or missing references)
				return ((AbilityBehaviour)this).Card.HasAbility(ability);
			}

			public override IEnumerator OnTurnEnd(bool playerTurnEnd)
			{
				PlayableCard card = ((AbilityBehaviour)this).Card;
				List<CardSlot> allSlots = Singleton<BoardManager>.Instance.AllSlots;
				List<PlayableCard> list = new List<PlayableCard>();
				for (int i = 0; i < allSlots.Count; i++)
				{
					if ((Object)(object)allSlots[i].Card != (Object)null)
					{
						list.Add(allSlots[i].Card);
					}
				}
				PlayableCard target = list[Random.Range(0, list.Count)];
				Singleton<ViewManager>.Instance.SwitchToView((View)4, false, true);
				((Card)card).Anim.LightNegationEffect();
				yield return ((AbilityBehaviour)this).PreSuccessfulTriggerSequence();
				CardInfo cardByName = CardLoader.GetCardByName("AP_Chicken");
				yield return target.TransformIntoCard(cardByName, (Action)null, (Action)null);
				yield return ((AbilityBehaviour)this).LearnAbility(0.25f);
				Singleton<ViewManager>.Instance.Controller.LockState = (ViewLockState)0;
			}
		}

		public class TurnIntoChickenEnemyOnly : AbilityBehaviour
		{
			public static Ability ability;

			public override Ability Ability => ability;

			public override bool RespondsToTurnEnd(bool playerTurnEnd)
			{
				//IL_0007: Unknown result type (might be due to invalid IL or missing references)
				return ((AbilityBehaviour)this).Card.HasAbility(ability);
			}

			public override IEnumerator OnTurnEnd(bool playerTurnEnd)
			{
				PlayableCard card = ((AbilityBehaviour)this).Card;
				List<CardSlot> opponentSlots = Singleton<BoardManager>.Instance.opponentSlots;
				List<PlayableCard> list = new List<PlayableCard>();
				for (int i = 0; i < opponentSlots.Count; i++)
				{
					if ((Object)(object)opponentSlots[i].Card != (Object)null)
					{
						list.Add(opponentSlots[i].Card);
					}
				}
				PlayableCard target = list[Random.Range(0, list.Count)];
				if ((Object)(object)target != (Object)null)
				{
					Singleton<ViewManager>.Instance.SwitchToView((View)4, false, true);
					((Card)card).Anim.LightNegationEffect();
					yield return ((AbilityBehaviour)this).PreSuccessfulTriggerSequence();
					CardInfo cardByName = CardLoader.GetCardByName("AP_Chicken");
					yield return target.TransformIntoCard(cardByName, (Action)null, (Action)null);
					yield return ((AbilityBehaviour)this).LearnAbility(0.25f);
					Singleton<ViewManager>.Instance.Controller.LockState = (ViewLockState)0;
				}
			}
		}

		public class EatChickens : AbilityBehaviour
		{
			public static Ability ability;

			private CardModificationInfo mod;

			public override Ability Ability => ability;

			private void Start()
			{
				//IL_0002: Unknown result type (might be due to invalid IL or missing references)
				//IL_000c: Expected O, but got Unknown
				mod = new CardModificationInfo();
				mod.nonCopyable = true;
				mod.singletonId = "increaseATKincreaseHealth";
				mod.attackAdjustment = 0;
				mod.healthAdjustment = 0;
				((AbilityBehaviour)this).Card.AddTemporaryMod(mod);
			}

			public override bool RespondsToTurnEnd(bool playerTurnEnd)
			{
				//IL_0007: Unknown result type (might be due to invalid IL or missing references)
				return ((AbilityBehaviour)this).Card.HasAbility(ability);
			}

			public override IEnumerator OnTurnEnd(bool playerTurnEnd)
			{
				PlayableCard card = ((AbilityBehaviour)this).Card;
				List<CardSlot> allSlots = Singleton<BoardManager>.Instance.AllSlots;
				List<PlayableCard> list = new List<PlayableCard>();
				for (int i = 0; i < allSlots.Count; i++)
				{
					if ((Object)(object)allSlots[i].Card != (Object)null && allSlots[i].Card.HasAbility(JustChicken.ability))
					{
						list.Add(allSlots[i].Card);
					}
				}
				PlayableCard target = list[Random.Range(0, list.Count)];
				if ((Object)(object)target != (Object)null)
				{
					Singleton<ViewManager>.Instance.SwitchToView((View)4, false, true);
					((Card)card).Anim.LightNegationEffect();
					yield return ((AbilityBehaviour)this).PreSuccessfulTriggerSequence();
					CardModificationInfo obj = mod;
					obj.attackAdjustment += ((Card)target).Info.Health;
					CardModificationInfo obj2 = mod;
					obj2.healthAdjustment += ((Card)target).Info.Attack;
					((AbilityBehaviour)this).Card.OnStatsChanged();
					target.TakeDamage(1024, card);
					target.Die(false, card, false);
					yield return ((AbilityBehaviour)this).LearnAbility(0.25f);
					Singleton<ViewManager>.Instance.Controller.LockState = (ViewLockState)0;
				}
			}
		}

		public class JustChicken : AbilityBehaviour
		{
			public static Ability ability;

			public override Ability Ability => ability;
		}

		public abstract class ActivatedLatch : ActivatedAbilityBehaviour
		{
			public static Ability ability;

			public override Ability Ability => ability;

			protected abstract Ability LatchAbility { get; }

			public override IEnumerator Activate()
			{
				if (SceneLoader.ActiveSceneName == "Part1_Cabin")
				{
					List<CardSlot> validTargets2 = Singleton<BoardManager>.Instance.AllSlotsCopy;
					validTargets2.RemoveAll((CardSlot x) => (Object)(object)x.Card == (Object)null || x.Card.Dead || CardHasLatchMod(x.Card) || (Object)(object)x.Card == (Object)(object)((AbilityBehaviour)this).Card);
					if (validTargets2.Count <= 0)
					{
						yield break;
					}
					Singleton<ViewManager>.Instance.SwitchToView((View)4, false, false);
					((Card)((AbilityBehaviour)this).Card).Anim.PlayHitAnimation();
					yield return (object)new WaitForSeconds(0.1f);
					CardAnimationController cardAnim2 = ((Card)((AbilityBehaviour)this).Card).Anim;
					GameObject LatchPreParent = new GameObject();
					((Object)LatchPreParent).name = "LatchParent";
					LatchPreParent.transform.position = ((Component)cardAnim2).transform.position;
					LatchPreParent.gameObject.transform.parent = ((Component)cardAnim2).transform;
					Transform Latchparent = LatchPreParent.transform;
					GameObject claw2 = Object.Instantiate<GameObject>(anthonyClawPrefab, Latchparent);
					CardSlot selectedSlot2 = null;
					if (((AbilityBehaviour)this).Card.OpponentCard)
					{
						yield return (object)new WaitForSeconds(0.3f);
						yield return AISelectTarget(validTargets2, delegate(CardSlot s)
						{
							selectedSlot2 = s;
						});
						if ((Object)(object)selectedSlot2 != (Object)null && (Object)(object)selectedSlot2.Card != (Object)null)
						{
							AimWeaponAnim(((Component)Latchparent).gameObject, ((Component)selectedSlot2).transform.position);
							yield return (object)new WaitForSeconds(0.3f);
						}
					}
					else
					{
						List<CardSlot> allSlotsCopy2 = Singleton<BoardManager>.Instance.AllSlotsCopy;
						allSlotsCopy2.Remove(((AbilityBehaviour)this).Card.Slot);
						yield return Singleton<BoardManager>.Instance.ChooseTarget(allSlotsCopy2, validTargets2, (Action<CardSlot>)delegate(CardSlot s)
						{
							selectedSlot2 = s;
						}, (Action<CardSlot>)OnInvalidTarget, (Action<CardSlot>)delegate(CardSlot s)
						{
							//IL_0023: Unknown result type (might be due to invalid IL or missing references)
							if ((Object)(object)s.Card != (Object)null)
							{
								AimWeaponAnim(((Component)Latchparent).gameObject, ((Component)s).transform.position);
							}
						}, (Func<bool>)null, (CursorType)16);
					}
					claw2.SetActive(true);
					CustomCoroutine.FlickerSequence((Action)delegate
					{
						claw2.SetActive(true);
					}, (Action)delegate
					{
						claw2.SetActive(false);
					}, true, false, 0.05f, 2, (Action)null);
					if ((Object)(object)selectedSlot2 != (Object)null && (Object)(object)selectedSlot2.Card != (Object)null)
					{
						CardModificationInfo cardModificationInfo2 = new CardModificationInfo(LatchAbility);
						cardModificationInfo2.fromCardMerge = true;
						cardModificationInfo2.fromLatch = true;
						if (((Object)((Card)selectedSlot2.Card).Info).name == "!DEATHCARD_BASE")
						{
							selectedSlot2.Card.AddTemporaryMod(cardModificationInfo2);
						}
						else
						{
							object obj = ((Card)selectedSlot2.Card).Info.Clone();
							CardInfo targetCardInfo = (CardInfo)((obj is CardInfo) ? obj : null);
							targetCardInfo.Mods.Add(cardModificationInfo2);
							((Card)selectedSlot2.Card).SetInfo(targetCardInfo);
						}
						((Card)selectedSlot2.Card).Anim.PlayTransformAnimation();
						OnSuccessfullyLatched(selectedSlot2.Card);
						yield return (object)new WaitForSeconds(0.75f);
						yield return ((AbilityBehaviour)this).LearnAbility(0f);
					}
					yield break;
				}
				List<CardSlot> validTargets = Singleton<BoardManager>.Instance.AllSlotsCopy;
				validTargets.RemoveAll((CardSlot x) => (Object)(object)x.Card == (Object)null || x.Card.Dead || CardHasLatchMod(x.Card) || (Object)(object)x.Card == (Object)(object)((AbilityBehaviour)this).Card);
				if (validTargets.Count <= 0)
				{
					yield break;
				}
				Singleton<ViewManager>.Instance.SwitchToView((View)4, false, false);
				((Card)((AbilityBehaviour)this).Card).Anim.PlayHitAnimation();
				yield return (object)new WaitForSeconds(0.1f);
				DiskCardAnimationController cardAnim = default(DiskCardAnimationController);
				ref DiskCardAnimationController reference = ref cardAnim;
				CardAnimationController anim = ((Card)((AbilityBehaviour)this).Card).Anim;
				reference = (DiskCardAnimationController)(object)((anim is DiskCardAnimationController) ? anim : null);
				GameObject claw = Object.Instantiate<GameObject>(anthonyClawPrefab, ((Component)cardAnim.WeaponParent).transform);
				CardSlot selectedSlot = null;
				if (((AbilityBehaviour)this).Card.OpponentCard)
				{
					yield return (object)new WaitForSeconds(0.3f);
					yield return AISelectTarget(validTargets, delegate(CardSlot s)
					{
						selectedSlot = s;
					});
					if ((Object)(object)selectedSlot != (Object)null && (Object)(object)selectedSlot.Card != (Object)null)
					{
						cardAnim.AimWeaponAnim(((Component)selectedSlot).transform.position);
						yield return (object)new WaitForSeconds(0.3f);
					}
				}
				else
				{
					List<CardSlot> allSlotsCopy = Singleton<BoardManager>.Instance.AllSlotsCopy;
					allSlotsCopy.Remove(((AbilityBehaviour)this).Card.Slot);
					yield return Singleton<BoardManager>.Instance.ChooseTarget(allSlotsCopy, validTargets, (Action<CardSlot>)delegate(CardSlot s)
					{
						selectedSlot = s;
					}, (Action<CardSlot>)OnInvalidTarget, (Action<CardSlot>)delegate(CardSlot s)
					{
						//IL_001e: Unknown result type (might be due to invalid IL or missing references)
						if ((Object)(object)s.Card != (Object)null)
						{
							cardAnim.AimWeaponAnim(((Component)s).transform.position);
						}
					}, (Func<bool>)null, (CursorType)16);
				}
				CustomCoroutine.FlickerSequence((Action)delegate
				{
					claw.SetActive(true);
				}, (Action)delegate
				{
					claw.SetActive(false);
				}, true, false, 0.05f, 2, (Action)null);
				if ((Object)(object)selectedSlot != (Object)null && (Object)(object)selectedSlot.Card != (Object)null)
				{
					CardModificationInfo cardModificationInfo = new CardModificationInfo(LatchAbility);
					cardModificationInfo.fromLatch = true;
					((Card)selectedSlot.Card).Anim.ShowLatchAbility();
					selectedSlot.Card.AddTemporaryMod(cardModificationInfo);
					OnSuccessfullyLatched(selectedSlot.Card);
					yield return (object)new WaitForSeconds(0.75f);
					yield return ((AbilityBehaviour)this).LearnAbility(0f);
				}
			}

			protected virtual void OnSuccessfullyLatched(PlayableCard target)
			{
			}

			private IEnumerator AISelectTarget(List<CardSlot> validTargets, Action<CardSlot> chosenCallback)
			{
				if (validTargets.Count > 0)
				{
					bool positiveAbility = AbilitiesUtil.GetInfo(LatchAbility).PositiveEffect;
					validTargets.Sort((CardSlot a, CardSlot b) => AIEvaluateTarget(b.Card, positiveAbility) - AIEvaluateTarget(a.Card, positiveAbility));
					chosenCallback(validTargets[0]);
					yield return (object)new WaitForSeconds(0.1f);
				}
				else
				{
					((Card)((AbilityBehaviour)this).Card).Anim.LightNegationEffect();
					yield return (object)new WaitForSeconds(0.2f);
				}
			}

			private int AIEvaluateTarget(PlayableCard card, bool positiveEffect)
			{
				int num = card.PowerLevel;
				if (((Card)card).Info.HasTrait((Trait)12))
				{
					num = 10 * ((!positiveEffect) ? 1 : (-1));
				}
				if (card.OpponentCard == positiveEffect)
				{
					num += 1000;
				}
				return num;
			}

			private void OnInvalidTarget(CardSlot slot)
			{
				if ((Object)(object)slot.Card != (Object)null && CardHasLatchMod(slot.Card) && !Singleton<TextDisplayer>.Instance.Displaying)
				{
					((MonoBehaviour)this).StartCoroutine(Singleton<TextDisplayer>.Instance.ShowThenClear("It's already latched...", 2.5f, 0f, (Emotion)2, (LetterAnimation)0, (Speaker)0, (string[])null));
				}
			}

			private bool CardHasLatchMod(PlayableCard card)
			{
				return card.TemporaryMods.Exists((CardModificationInfo m) => m.fromLatch);
			}
		}

		public class ActivatedLatchNanoShield : ActivatedLatch
		{
			public new static Ability ability;

			public override Ability Ability => ability;

			public override int EnergyCost => 1;

			public override int BonesCost => 2;

			protected override Ability LatchAbility => (Ability)54;

			protected override void OnSuccessfullyLatched(PlayableCard target)
			{
				target.ResetShield();
				((Card)((AbilityBehaviour)this).Card).SetCardbackSubmerged();
				((Card)((AbilityBehaviour)this).Card).SetFaceDown(true, false);
			}

			public override bool RespondsToUpkeep(bool playerUpkeep)
			{
				return ((AbilityBehaviour)this).Card.OpponentCard != playerUpkeep;
			}

			public override IEnumerator OnUpkeep(bool playerUpkeep)
			{
				Singleton<ViewManager>.Instance.SwitchToView((View)4, false, true);
				yield return (object)new WaitForSeconds(0.15f);
				yield return ((AbilityBehaviour)this).PreSuccessfulTriggerSequence();
				((Card)((AbilityBehaviour)this).Card).SetFaceDown(false, false);
				((AbilityBehaviour)this).Card.UpdateFaceUpOnBoardEffects();
				yield return (object)new WaitForSeconds(0.3f);
			}
		}

		public class ActivatedLatchReach : ActivatedLatch
		{
			public new static Ability ability;

			public override Ability Ability => ability;

			public override int EnergyCost => 2;

			protected override Ability LatchAbility => (Ability)23;

			protected override void OnSuccessfullyLatched(PlayableCard target)
			{
				((Card)((AbilityBehaviour)this).Card).SetCardbackSubmerged();
				((Card)((AbilityBehaviour)this).Card).SetFaceDown(true, false);
			}

			public override bool RespondsToUpkeep(bool playerUpkeep)
			{
				return ((AbilityBehaviour)this).Card.OpponentCard != playerUpkeep;
			}

			public override IEnumerator OnUpkeep(bool playerUpkeep)
			{
				Singleton<ViewManager>.Instance.SwitchToView((View)4, false, true);
				yield return (object)new WaitForSeconds(0.15f);
				yield return ((AbilityBehaviour)this).PreSuccessfulTriggerSequence();
				((Card)((AbilityBehaviour)this).Card).SetFaceDown(false, false);
				((AbilityBehaviour)this).Card.UpdateFaceUpOnBoardEffects();
				yield return (object)new WaitForSeconds(0.3f);
			}
		}

		public class ActivatedLatchBrittle : ActivatedLatch
		{
			public new static Ability ability;

			public override Ability Ability => ability;

			public override int EnergyCost => 1;

			protected override Ability LatchAbility => (Ability)35;

			protected override void OnSuccessfullyLatched(PlayableCard target)
			{
				((Card)((AbilityBehaviour)this).Card).SetCardbackSubmerged();
				((Card)((AbilityBehaviour)this).Card).SetFaceDown(true, false);
			}

			public override bool RespondsToUpkeep(bool playerUpkeep)
			{
				return ((AbilityBehaviour)this).Card.OpponentCard != playerUpkeep;
			}

			public override IEnumerator OnUpkeep(bool playerUpkeep)
			{
				Singleton<ViewManager>.Instance.SwitchToView((View)4, false, true);
				yield return (object)new WaitForSeconds(0.15f);
				yield return ((AbilityBehaviour)this).PreSuccessfulTriggerSequence();
				((Card)((AbilityBehaviour)this).Card).SetFaceDown(false, false);
				((AbilityBehaviour)this).Card.UpdateFaceUpOnBoardEffects();
				yield return (object)new WaitForSeconds(0.3f);
			}
		}

		public class ActivatedLatchExplodeOnDeath : ActivatedLatch
		{
			public new static Ability ability;

			public override Ability Ability => ability;

			public override int EnergyCost => 2;

			protected override Ability LatchAbility => (Ability)52;

			protected override void OnSuccessfullyLatched(PlayableCard target)
			{
				((Card)((AbilityBehaviour)this).Card).SetCardbackSubmerged();
				((Card)((AbilityBehaviour)this).Card).SetFaceDown(true, false);
			}

			public override bool RespondsToUpkeep(bool playerUpkeep)
			{
				return ((AbilityBehaviour)this).Card.OpponentCard != playerUpkeep;
			}

			public override IEnumerator OnUpkeep(bool playerUpkeep)
			{
				Singleton<ViewManager>.Instance.SwitchToView((View)4, false, true);
				yield return (object)new WaitForSeconds(0.15f);
				yield return ((AbilityBehaviour)this).PreSuccessfulTriggerSequence();
				((Card)((AbilityBehaviour)this).Card).SetFaceDown(false, false);
				((AbilityBehaviour)this).Card.UpdateFaceUpOnBoardEffects();
				yield return (object)new WaitForSeconds(0.3f);
			}
		}

		public class IncreasePowerDecreaseHealth : AbilityBehaviour
		{
			public static Ability ability;

			private CardModificationInfo mod;

			public override Ability Ability => ability;

			public override bool RespondsToUpkeep(bool playerUpkeep)
			{
				return ((AbilityBehaviour)this).Card.OpponentCard != playerUpkeep;
			}

			private void Start()
			{
				//IL_0013: Unknown result type (might be due to invalid IL or missing references)
				//IL_001d: Expected O, but got Unknown
				int health = ((Card)((AbilityBehaviour)this).Card).Info.Health;
				mod = new CardModificationInfo();
				mod.nonCopyable = true;
				mod.singletonId = "increaseATKtakeDamage";
				mod.attackAdjustment = 0;
				((AbilityBehaviour)this).Card.AddTemporaryMod(mod);
			}

			public override IEnumerator OnUpkeep(bool playerUpkeep)
			{
				Singleton<ViewManager>.Instance.SwitchToView((View)4, false, true);
				yield return (object)new WaitForSeconds(0.15f);
				yield return ((AbilityBehaviour)this).PreSuccessfulTriggerSequence();
				((AbilityBehaviour)this).Card.TakeDamage(1, (PlayableCard)null);
				((Card)((AbilityBehaviour)this).Card).Anim.StrongNegationEffect();
				CardModificationInfo obj = mod;
				obj.attackAdjustment++;
				((AbilityBehaviour)this).Card.OnStatsChanged();
				yield return (object)new WaitForSeconds(0.25f);
				yield return ((AbilityBehaviour)this).LearnAbility(0.25f);
			}
		}

		public class DecreasePowerIncreaseHealth : AbilityBehaviour
		{
			public static Ability ability;

			private CardModificationInfo mod;

			public override Ability Ability => ability;

			public override bool RespondsToUpkeep(bool playerUpkeep)
			{
				return ((AbilityBehaviour)this).Card.OpponentCard != playerUpkeep;
			}

			private void Start()
			{
				//IL_0013: Unknown result type (might be due to invalid IL or missing references)
				//IL_001d: Expected O, but got Unknown
				int health = ((Card)((AbilityBehaviour)this).Card).Info.Health;
				mod = new CardModificationInfo();
				mod.nonCopyable = true;
				mod.singletonId = "increaseHPdecreaseATK";
				mod.healthAdjustment = 0;
				mod.attackAdjustment = 0;
				((AbilityBehaviour)this).Card.AddTemporaryMod(mod);
			}

			public override IEnumerator OnUpkeep(bool playerUpkeep)
			{
				Singleton<ViewManager>.Instance.SwitchToView((View)4, false, true);
				yield return (object)new WaitForSeconds(0.15f);
				yield return ((AbilityBehaviour)this).PreSuccessfulTriggerSequence();
				((Card)((AbilityBehaviour)this).Card).Anim.StrongNegationEffect();
				CardModificationInfo obj = mod;
				obj.healthAdjustment++;
				CardModificationInfo obj2 = mod;
				obj2.attackAdjustment--;
				((AbilityBehaviour)this).Card.OnStatsChanged();
				yield return (object)new WaitForSeconds(0.25f);
				yield return ((AbilityBehaviour)this).LearnAbility(0.25f);
			}
		}

		public class ChangePortraitWhenMerged : SpecialCardBehaviour
		{
			public static SpecialTriggeredAbility ability;

			public void Update()
			{
				if (((SpecialCardBehaviour)this).Card.Info.HasModFromCardMerge() && (Object)(object)((SpecialCardBehaviour)this).Card.RenderInfo.portraitOverride != (Object)(object)((SpecialCardBehaviour)this).Card.Info.alternatePortrait)
				{
					((SpecialCardBehaviour)this).Card.RenderInfo.portraitOverride = ((SpecialCardBehaviour)this).Card.Info.alternatePortrait;
					((SpecialCardBehaviour)this).Card.RenderCard();
				}
			}
		}

		internal static ConfigEntry<bool> configAcidTrail;

		internal static ConfigEntry<bool> configAgile;

		internal static ConfigEntry<bool> configAppetizing;

		internal static ConfigEntry<bool> configBloodGuzzler;

		internal static ConfigEntry<bool> configBombardier;

		internal static ConfigEntry<bool> configBurning;

		internal static ConfigEntry<bool> configConsumer;

		internal static ConfigEntry<bool> configCowardly;

		internal static ConfigEntry<bool> configDeathburst;

		internal static ConfigEntry<bool> configMultiStrike;

		internal static ConfigEntry<bool> configDying;

		internal static ConfigEntry<bool> configRecoil;

		internal static ConfigEntry<bool> configParalysis;

		internal static ConfigEntry<bool> configElectric;

		internal static ConfigEntry<bool> configFamiliar;

		internal static ConfigEntry<bool> configLeech;

		internal static ConfigEntry<bool> configPossessor;

		internal static ConfigEntry<bool> configPrideful;

		internal static ConfigEntry<bool> configRegen;

		internal static ConfigEntry<bool> configResistant;

		internal static ConfigEntry<bool> configSickness;

		internal static ConfigEntry<bool> configThickShell;

		internal static ConfigEntry<bool> configThief;

		internal static ConfigEntry<bool> configToxin;

		internal static ConfigEntry<bool> configTrample;

		internal static ConfigEntry<bool> configVicious;

		internal static ConfigEntry<bool> configHammerBlock;

		public const string PluginGuid = "ATS";

		public const string OldLilyPluginGuid = "org.memez4life.inscryption.customsigils";

		public const string OldVoidPluginGuid = "extraVoid.inscryption.voidSigils";

		public const string OldAnthonyPluginGuid = "AnthonyPython.inscryption.AnthonysSigils";

		public static List<string> OldPluginGuids = new List<string> { "org.memez4life.inscryption.customsigils", "extraVoid.inscryption.voidSigils", "AnthonyPython.inscryption.AnthonysSigils" };

		private const string PluginName = "AllTheSigils";

		private const string PluginVersion = "3.0.1";

		public static string Directory;

		internal static ManualLogSource Log;

		public static Dictionary<Ability, Tuple<string, string>> SigilWikiInfos = new Dictionary<Ability, Tuple<string, string>>();

		public static Dictionary<Ability, string> NewSigilVersions = new Dictionary<Ability, string>();

		public const bool GenerateWiki = false;

		public static GameObject anthonyClawPrefab;

		public void AddConfigs()
		{
			configAcidTrail = ((BaseUnityPlugin)this).Config.Bind<bool>("Good Sigil", "Acid Trail", true, "Should Leshy have this?");
			configAgile = ((BaseUnityPlugin)this).Config.Bind<bool>("Good Sigil", "Agile", true, "Should Leshy have this?");
			configBloodGuzzler = ((BaseUnityPlugin)this).Config.Bind<bool>("Good Sigil", "BloodGuzzler", true, "Should Leshy have this?");
			configConsumer = ((BaseUnityPlugin)this).Config.Bind<bool>("Good Sigil", "Consumer", true, "Should Leshy have this?");
			configDeathburst = ((BaseUnityPlugin)this).Config.Bind<bool>("Good Sigil", "Deathburst", true, "Should Leshy have this?");
			configElectric = ((BaseUnityPlugin)this).Config.Bind<bool>("Good Sigil", "Electric", true, "Should Leshy have this?");
			configMultiStrike = ((BaseUnityPlugin)this).Config.Bind<bool>("Good Sigil", "MultiStrike", true, "Should Leshy have this?");
			configFamiliar = ((BaseUnityPlugin)this).Config.Bind<bool>("Good Sigil", "Familiar", true, "Should Leshy have this?");
			configLeech = ((BaseUnityPlugin)this).Config.Bind<bool>("Good Sigil", "Leech", true, "Should Leshy have this?");
			configPossessor = ((BaseUnityPlugin)this).Config.Bind<bool>("Good Sigil", "Possessor", true, "Should Leshy have this?");
			configRegen = ((BaseUnityPlugin)this).Config.Bind<bool>("Good Sigil", "Regen 1", true, "Should Leshy have this?");
			configResistant = ((BaseUnityPlugin)this).Config.Bind<bool>("Good Sigil", "Resistant", true, "Should Leshy have this?");
			configThickShell = ((BaseUnityPlugin)this).Config.Bind<bool>("Good Sigil", "Thick Shell", true, "Should Leshy have this?");
			configThief = ((BaseUnityPlugin)this).Config.Bind<bool>("Good Sigil", "Thief", true, "Should Leshy have this?");
			configToxin = ((BaseUnityPlugin)this).Config.Bind<bool>("Good Sigil", "Toxins (all of them)", true, "Should Leshy have this?");
			configTrample = ((BaseUnityPlugin)this).Config.Bind<bool>("Good Sigil", "Trample", true, "Should Leshy have this?");
			configVicious = ((BaseUnityPlugin)this).Config.Bind<bool>("Good Sigil", "Vicious", true, "Should Leshy have this?");
			configAppetizing = ((BaseUnityPlugin)this).Config.Bind<bool>("Bad Sigil", "Appetizing", true, "Should Leshy have this?");
			configBurning = ((BaseUnityPlugin)this).Config.Bind<bool>("Bad Sigil", "Burning", true, "Should Leshy have this?");
			configCowardly = ((BaseUnityPlugin)this).Config.Bind<bool>("Bad Sigil", "Cowardly", true, "Should Leshy have this?");
			configDying = ((BaseUnityPlugin)this).Config.Bind<bool>("Bad Sigil", "Dying", true, "Should Leshy have this?");
			configParalysis = ((BaseUnityPlugin)this).Config.Bind<bool>("Bad Sigil", "Paralysis", true, "Should Leshy have this?");
			configRecoil = ((BaseUnityPlugin)this).Config.Bind<bool>("Bad Sigil", "Recoil", true, "Should Leshy have this?");
			configPrideful = ((BaseUnityPlugin)this).Config.Bind<bool>("Bad Sigil", "Prideful", true, "Should Leshy have this?");
			configSickness = ((BaseUnityPlugin)this).Config.Bind<bool>("Bad Sigil", "Sickness", true, "Should Leshy have this?");
			configBombardier = ((BaseUnityPlugin)this).Config.Bind<bool>("Chaos Sigil", "Bombardier", true, "Should Leshy have this?");
			configHammerBlock = ((BaseUnityPlugin)this).Config.Bind<bool>("Hammer Block", "Pathetic Sacrifice", true, "Should the sigil pathetic sacrifice be invalid for hammering? Due to the intent being it is stuck on your board. default is true.");
		}

		private void Awake()
		{
			//IL_0029: Unknown result type (might be due to invalid IL or missing references)
			//IL_002f: Expected O, but got Unknown
			((BaseUnityPlugin)this).Logger.LogInfo((object)"Loaded AllTheSigils!");
			Log = ((BaseUnityPlugin)this).Logger;
			AddConfigs();
			Harmony val = new Harmony("ATS");
			val.PatchAll();
			Directory = ((BaseUnityPlugin)this).Info.Location;
			AddBond();
			AddShort();
			AddTribe_Attack();
			AddTribe_Health();
			AddBi_Blood();
			AddQuadra_Blood();
			AddImbuing();
			AddHydra();
			AddFight_Activated();
			AddPicky();
			AddFearful();
			AddTwoDeathBones();
			AddThreeDeathBones();
			AddFiveDeathBones();
			AddSixDeathBones();
			AddOneSummonBones();
			AddTwoSummonBones();
			AddThreeSummonBones();
			AddHost();
			AddSpawner();
			AddLauncher();
			AddShape_Shifter();
			AddDraw_Side_Deck_OnSummon();
			AddBait();
			AddLinguist();
			AddAll_Seeing();
			AddBlood_Shifter();
			AddAsleep();
			AddSong_Of_Sleep();
			AddWarper();
			AddRushing_March();
			AddWild_Hunger();
			AddRight_Slash();
			AddLeft_Slash();
			AddDouble_Slash();
			AddPuppets_Gift();
			AddInstakill();
			Acid_Puddle.AddCard();
			Jackalope.AddCard();
			AddAbundance();
			AddAcidTrail();
			AddAntler();
			AddAgile();
			AddAmbush();
			AddBlight();
			AddBlindingStrike();
			AddBloodGrowth();
			AddBloodGuzzler();
			AddBodyguard();
			AddBombardier();
			AddBonePicker();
			AddBoneless();
			AddBoneShard();
			AddBox();
			AddBroken();
			AddBurning();
			AddCaustic();
			addCoinFinder();
			AddConsumer();
			AddCoward();
			AddDeadlyWaters();
			AddDeathburst();
			AddDesperation();
			AddDiseaseAbsorbtion();
			AddDiveBones();
			AddDiveEnergy();
			AddDrawBlood();
			AddDrawBone();
			AddDrawIce();
			AddDrawJack();
			AddDrawStrafe();
			AddDwarf();
			AddDying();
			AddEletric();
			AddEnforcer();
			AddEnrage();
			AddEntomophage();
			AddFamiliar();
			AddFireStarter();
			AddFishHook();
			AddFrightful();
			AddGiant();
			AddGrazing();
			AddGripper();
			AddHaste();
			AddHasteful();
			AddHerd();
			AddHighTide();
			AddInjured();
			AddHourglass();
			AddLeech();
			AddLeadBones();
			AddLeadEnergy();
			AddLifeStatsUp();
			AddLowTide();
			AddFisher();
			AddManeuver();
			AddMedic();
			AddMidas();
			AddDoubleAttack();
			AddNutritious();
			AddOpportunist();
			AddParalise();
			AddPathetic();
			AddPierce();
			AddPoisonous();
			AddPossessor();
			AddPossessorPowerful();
			AddMovingPowerUp();
			AddPredator();
			AddPrideful();
			AddProtector();
			AddRam();
			AddRandomStrafe();
			AddBlind();
			AddRecoil();
			AddRegenFull();
			AddRegen1();
			AddRegen2();
			AddRegen3();
			AddRepellant();
			AddResistant();
			AddRetaliate();
			AddSchooling();
			AddScissors();
			AddSickness();
			AddSluggish();
			AddStampede();
			AddStrongWind();
			AddSubmergedAmbush();
			AddSwallower();
			AddTakeOffBones();
			AddTakeOffEnergy();
			AddThickShell();
			AddThief();
			AddToothBargain();
			AddToothPuller();
			AddToothShard();
			AddToxin();
			AddToxinStrength();
			AddToxinVigor();
			AddToxinDeadly();
			AddToxinSickly();
			AddTrample();
			AddTransient();
			AddTribalAlly();
			AddTribalTutor();
			addTurbulentWaters();
			AddStrafePowerUp();
			AddVicious();
			AddWithering();
			AddZapper();
			AddSticky();
			anthonyClawPrefab = ResourceBank.Get<GameObject>("Prefabs/Cards/SpecificCardModels/LatchClaw");
			AddActivactedNanoShield();
			AddActivactedBrittle();
			AddActivactedExplodeOnDeath();
			AddActivactedReach();
			AddDecreasePowerIncreaseHealth();
			AddTransformChickenLooseCannon();
			AddTransformChickenEnemyOnly();
			AddEatChicken();
			AddChicken();
			AddChickenCard();
			AddMount();
			AddParasite();
			AddHermit();
			AddDraw_Energy();
			AddDraw_Mox();
			AddDraw_Cost();
			AddHyped();
			AddResourceful();
			AddHoodini();
			AddInaccurate();
			AddDrunk();
			AddUnderdog();
			AddHoming();
			AddLullaby();
			AddNurse();
			AddMedical_Aid();
			AddSympathetic();
			AddArmoured();
			AddFrightened();
			AddTerrified();
			AddAlternating_Scratch();
			AddChoreography();
			AddChangePortraitWhenMerged();
			bool flag = false;
			AddTemporarySigils();
		}

		public void Start()
		{
			ReplaceNewSigilsOnCards();
		}

		public void WriteSigilPartOfTheWikiToFileInPluginDirectory()
		{
			//IL_006c: Unknown result type (might be due to invalid IL or missing references)
			//IL_011a: Unknown result type (might be due to invalid IL or missing references)
			string text = Path.Combine(Path.GetDirectoryName(((BaseUnityPlugin)this).Info.Location), "Wiki/");
			if (!System.IO.Directory.Exists(text))
			{
				System.IO.Directory.CreateDirectory(text);
			}
			string text2 = "## Sigils\n\n<details>\n<summary>List of Sigils (Click to Expand)</summary>\n\n|Icon|Sigil Name|Power Level|Description|Notes|\n|-|:-:|:-:|:-:|:-:|";
			string text3 = "\n</details>";
			string text4 = "";
			string text5 = "https://raw.githubusercontent.com/Memez4Life7/AllTheSigils/master/Artwork";
			foreach (AbilityInfo allAbilityInfo in AbilityManager.AllAbilityInfos)
			{
				string sigilGuid = GetSigilGuid(allAbilityInfo.ability);
				if (OldPluginGuids.Contains(sigilGuid) || sigilGuid == "ATS")
				{
					string text6 = "";
					switch (sigilGuid)
					{
					case "org.memez4life.inscryption.customsigils":
						text6 = "Lily/Act1";
						break;
					case "extraVoid.inscryption.voidSigils":
						text6 = "Void_Merged";
						break;
					case "AnthonyPython.inscryption.AnthonysSigils":
						text6 = "Anthony";
						break;
					case "ATS":
						text6 = "ATS/Act1";
						break;
					}
					string text7 = "";
					text7 = ((!SigilWikiInfos.TryGetValue(allAbilityInfo.ability, out var value)) ? (text5 + "/Lily/Act1/placeholder.png") : (text5 + "/" + text6 + "/" + value.Item1 + ".png"));
					string rulebookName = allAbilityInfo.rulebookName;
					string text8 = allAbilityInfo.powerLevel.ToString();
					string rulebookDescription = allAbilityInfo.rulebookDescription;
					text4 = text4 + "\n|<img align=\"center\" src=\"" + text7 + "\">|**" + rulebookName + "**|" + text8 + "|" + rulebookDescription + "|" + value.Item2 + "|";
				}
			}
			string contents = text2 + text4 + "\n" + text3;
			File.WriteAllText(Path.Combine(text, "wiki.txt"), contents);
			Log.LogWarning((object)("FINISHED WRITING WIKI TEXT TO:\n" + text + "wiki.txt"));
		}

		public void AddTemporarySigils()
		{
			//IL_001a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0069: Unknown result type (might be due to invalid IL or missing references)
			foreach (AbilityInfo allAbilityInfo in AbilityManager.AllAbilityInfos)
			{
				string sigilGuid = GetSigilGuid(allAbilityInfo.ability);
				if (OldPluginGuids.Contains(sigilGuid))
				{
					AbilityInfo val = AbilityManager.New("ATS", allAbilityInfo.rulebookName, allAbilityInfo.rulebookDescription, typeof(EmptySigil), (Texture)(object)GetTextureLily("placeholder"));
					NewSigilVersions.Add(val.ability, sigilGuid);
				}
			}
		}

		public void ReplaceNewSigilsOnCards()
		{
			//IL_0020: Unknown result type (might be due to invalid IL or missing references)
			//IL_0025: Unknown result type (might be due to invalid IL or missing references)
			//IL_002c: Unknown result type (might be due to invalid IL or missing references)
			//IL_004c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0053: 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)
			List<CardInfo> allData = ScriptableObjectLoader<CardInfo>.AllData;
			for (int i = 0; i < allData.Count; i++)
			{
				CardInfo val = allData[i];
				for (int j = 0; j < val.Abilities.Count; j++)
				{
					Ability val2 = val.Abilities[j];
					if (NewSigilVersions.ContainsKey(val2))
					{
						allData[i].abilities[j] = GetCustomAbility(NewSigilVersions[val2], AbilitiesUtil.GetInfo(val2).rulebookName);
					}
				}
			}
			NewSigilVersions.Keys.ToList().ForEach(delegate(Ability x)
			{
				//IL_0000: Unknown result type (might be due to invalid IL or missing references)
				AbilityManager.Remove(x);
			});
		}

		public string GetSigilGuid(Ability ability)
		{
			Dictionary<string, Dictionary<string, object>> dictionary = (Dictionary<string, Dictionary<string, object>>)AccessTools.Field(typeof(ModdedSaveData), "SaveData").GetValue(ModdedSaveManager.SaveData);
			foreach (KeyValuePair<string, object> item in dictionary["cyantist.inscryption.api"])
			{
				List<string> list = item.Key.Split(new char[1] { '_' }).ToList();
				if (list[0] == "Ability" && int.TryParse(((object)(Ability)(ref ability)).ToString(), out var result))
				{
					int num = int.Parse((string)item.Value);
					if (num == result)
					{
						return list[1];
					}
				}
			}
			return null;
		}

		private void AddDevStuff()
		{
			//IL_001f: 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)
			//IL_0074: Unknown result type (might be due to invalid IL or missing references)
			AddDev_Activated();
			CardInfo val = CardExtensions.CardByName((IEnumerable<CardInfo>)CardManager.BaseGameCards, "Squirrel");
			val.abilities = new List<Ability> { Draw_Cost.ability };
			val.baseAttack = 1;
			CardInfo val2 = CardExtensions.CardByName((IEnumerable<CardInfo>)CardManager.BaseGameCards, "Wolf");
			val2.abilities = new List<Ability> { Draw_Mox.ability };
			CardInfo val3 = CardExtensions.CardByName((IEnumerable<CardInfo>)CardManager.BaseGameCards, "Mole");
			val3.abilities = new List<Ability> { Draw_Energy.ability };
			val3.baseAttack = 1;
			CardInfo val4 = CardExtensions.CardByName((IEnumerable<CardInfo>)CardManager.BaseGameCards, "Wolf_Talking");
			val4.abilities = new List<Ability>();
			CardInfo val5 = CardExtensions.CardByName((IEnumerable<CardInfo>)CardManager.BaseGameCards, "Grizzly");
			val5.abilities = new List<Ability>();
			val5.baseAttack = 1;
			CardInfo val6 = CardExtensions.CardByName((IEnumerable<CardInfo>)CardManager.BaseGameCards, "Stoat");
			val6.abilities = new List<Ability>();
		}

		public static Texture2D GetTexture(string path, bool Act2 = false)
		{
			//IL_005d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0063: Expected O, but got Unknown
			string text = (Act2 ? "Act2" : "Act1");
			byte[] array = File.ReadAllBytes(Path.Combine(Path.GetDirectoryName(Directory), "Artwork/", "ATS", text + "/", path + ".png"));
			Texture2D val = new Texture2D(2, 2);
			ImageConversion.LoadImage(val, array);
			((Texture)val).filterMode = (FilterMode)0;
			return val;
		}

		public static Texture2D GetTextureLily(string path, bool Act2 = false)
		{
			//IL_005d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0063: Expected O, but got Unknown
			string text = (Act2 ? "Act2" : "Act1");
			byte[] array = File.ReadAllBytes(Path.Combine(Path.GetDirectoryName(Directory), "Artwork/", "Lily", text + "/", path + ".png"));
			Texture2D val = new Texture2D(2, 2);
			ImageConversion.LoadImage(val, array);
			((Texture)val).filterMode = (FilterMode)0;
			return val;
		}

		public static Texture2D GetTextureAnthony(string path)
		{
			//IL_002d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0033: Expected O, but got Unknown
			byte[] array = File.ReadAllBytes(Path.Combine(Path.GetDirectoryName(Directory), "Artwork/", "Anthony", path + ".png"));
			Texture2D val = new Texture2D(2, 2);
			ImageConversion.LoadImage(val, array);
			((Texture)val).filterMode = (FilterMode)0;
			return val;
		}

		public static Ability GetCustomAbility(string GUID, string rulebookname)
		{
			//IL_0003: Unknown result type (might be due to invalid IL or missing references)
			//IL_0008: Unknown result type (might be due to invalid IL or missing references)
			//IL_000b: Unknown result type (might be due to invalid IL or missing references)
			return GuidManager.GetEnumValue<Ability>(GUID, rulebookname);
		}

		public static void AimWeaponAnim(GameObject TweenObj, Vector3 target)
		{
			//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)
			Tween.LookAt(TweenObj.transform, target, Vector3.up, 0.075f, 0f, Tween.EaseInOut, (LoopType)0, (Action)null, (Action)null, true);
		}

		private void AddActivactedNanoShield()
		{
			//IL_006d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0072: Unknown result type (might be due to invalid IL or missing references)
			AbilityInfo val = AbilityManager.New("AnthonyPython.inscryption.AnthonysSigils", "Activated Latch Nano Shield", "When activated for a cost of 1 energy / 2 bones will allow the owner to give a creature Nano Shield.", typeof(Bi_Blood), (Texture)(object)GetTextureAnthony("activatedlatch-deathshield"));
			AbilityExtensions.SetPixelAbilityIcon(val, GetTextureAnthony("placeholder_act2"), (FilterMode?)null);
			val.metaCategories = new List<AbilityMetaCategory> { (AbilityMetaCategory)0 };
			val.canStack = false;
			val.activated = true;
			val.opponentUsable = false;
			ActivatedLatchNanoShield.ability = val.ability;
			bool flag = false;
		}

		private void AddActivactedBrittle()
		{
			//IL_006d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0072: Unknown result type (might be due to invalid IL or missing references)
			AbilityInfo val = AbilityManager.New("AnthonyPython.inscryption.AnthonysSigils", "Activated Latch Brittle", "When activated for a cost of 1 energy will allow the owner to give a creature Brittle.", typeof(ActivatedLatchBrittle), (Texture)(object)GetTextureAnthony("activatedlatch-brittle"));
			AbilityExtensions.SetPixelAbilityIcon(val, GetTextureAnthony("placeholder_act2"), (FilterMode?)null);
			val.metaCategories = new List<AbilityMetaCategory> { (AbilityMetaCategory)0 };
			val.canStack = false;
			val.activated = true;
			val.opponentUsable = false;
			ActivatedLatchBrittle.ability = val.ability;
			bool flag = false;
		}

		private void AddActivactedExplodeOnDeath()
		{
			//IL_006d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0072: Unknown result type (might be due to invalid IL or missing references)
			AbilityInfo val = AbilityManager.New("AnthonyPython.inscryption.AnthonysSigils", "Activated Latch Explode On Death", "When activated for a cost of 1 energy will allow the owner to give a creature Explode On Death.", typeof(ActivatedLatchExplodeOnDeath), (Texture)(object)GetTextureAnthony("activatedlatch-explodeondeath"));
			AbilityExtensions.SetPixelAbilityIcon(val, GetTextureAnthony("placeholder_act2"), (FilterMode?)null);
			val.metaCategories = new List<AbilityMetaCategory> { (AbilityMetaCategory)0 };
			val.canStack = false;
			val.activated = true;
			val.opponentUsable = false;
			ActivatedLatchExplodeOnDeath.ability = val.ability;
			bool flag = false;
		}

		private void AddActivactedReach()
		{
			//IL_006d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0072: Unknown result type (might be due to invalid IL or missing references)
			AbilityInfo val = AbilityManager.New("AnthonyPython.inscryption.AnthonysSigils", "Activated Latch Reach", "When activated for a cost of 2 energy will allow the owner to give a creature Reach.", typeof(ActivatedLatchReach), (Texture)(object)GetTextureAnthony("acticatedlatch-Reach"));
			AbilityExtensions.SetPixelAbilityIcon(val, GetTextureAnthony("placeholder_act2"), (FilterMode?)null);
			val.metaCategories = new List<AbilityMetaCategory> { (AbilityMetaCategory)0 };
			val.canStack = false;
			val.activated = true;
			val.opponentUsable = false;
			ActivatedLatchReach.ability = val.ability;
			bool flag = false;
		}

		private void AddIncreasePowerDecreaseHealth()
		{
			//IL_0066: Unknown result type (might be due to invalid IL or missing references)
			//IL_006b: Unknown result type (might be due to invalid IL or missing references)
			AbilityInfo val = AbilityManager.New("AnthonyPython.inscryption.AnthonysSigils", "Old Timer", "At the Start of its owner's turn [creature] will gain +1 attack and will take 1 damage.", typeof(IncreasePowerDecreaseHealth), (Texture)(object)GetTextureAnthony("old-timer"));
			AbilityExtensions.SetPixelAbilityIcon(val, GetTextureAnthony("placeholder_act2"), (FilterMode?)null);
			val.metaCategories = new List<AbilityMetaCategory> { (AbilityMetaCategory)0 };
			val.canStack = false;
			val.opponentUsable = true;
			IncreasePowerDecreaseHealth.ability = val.ability;
			bool flag = false;
		}

		private void AddDecreasePowerIncreaseHealth()
		{
			//IL_0066: Unknown result type (might be due to invalid IL or missing references)
			//IL_006b: Unknown result type (might be due to invalid IL or missing references)
			AbilityInfo val = AbilityManager.New("AnthonyPython.inscryption.AnthonysSigils", "Docile", "At the Start of its owner's turn [creature] will lose -1 attack and will gain +1 health.", typeof(DecreasePowerIncreaseHealth), (Texture)(object)GetTextureAnthony("docile"));
			AbilityExtensions.SetPixelAbilityIcon(val, GetTextureAnthony("placeholder_act2"), (FilterMode?)null);
			val.metaCategories = new List<AbilityMetaCategory> { (AbilityMetaCategory)0 };
			val.canStack = false;
			val.opponentUsable = true;
			DecreasePowerIncreaseHealth.ability = val.ability;
			bool flag = false;
		}

		private void AddEatChicken()
		{
			//IL_0066: Unknown result type (might be due to invalid IL or missing references)
			//IL_006b: Unknown result type (might be due to invalid IL or missing references)
			AbilityInfo val = AbilityManager.New("AnthonyPython.inscryption.AnthonysSigils", "To The Slaughter", "At the end of each turn [creature] will eat a random Chicken gaining the same amount of attack as the eaten chicken's health, and gaining the same amount of health as the eaten chicken's attack.", typeof(EatChickens), (Texture)(object)GetTextureAnthony("eatchicken"));
			AbilityExtensions.SetPixelAbilityIcon(val, GetTextureAnthony("placeholder_act2"), (FilterMode?)null);
			val.metaCategories = new List<AbilityMetaCategory> { (AbilityMetaCategory)0 };
			val.canStack = false;
			val.opponentUsable = true;
			EatChickens.ability = val.ability;
			bool flag = false;
		}

		private void AddChickenCard()
		{
			//IL_001b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0084: 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)
			List<CardMetaCategory> metaCategories = new List<CardMetaCategory>();
			List<Appearance> list = new List<Appearance>();
			list.Add((Appearance)6);
			List<Ability> abilities = new List<Ability> { JustChicken.ability };
			CardInfo val = ScriptableObject.CreateInstance<CardInfo>();
			((Object)val).name = "Chicken";
			val.displayedName = "Chicken";
			val.baseAttack = 1;
			val.baseHealth = 1;
			val.cost = 0;
			CardExtensions.SetPortrait(val, GetTextureAnthony("YisusChickenPortrait"), (FilterMode?)null);
			val.metaCategories = metaCategories;
			val.appearanceBehaviour = list;
			val.cardComplexity = (CardComplexity)1;
			val.abilities = abilities;
			val.temple = (CardTemple)0;
			CardManager.Add("AP", val);
		}

		private void AddChicken()
		{
			//IL_0066: Unknown result type (might be due to invalid IL or missing references)
			//IL_006b: Unknown result type (might be due to invalid IL or missing references)
			AbilityInfo val = AbilityManager.New("AnthonyPython.inscryption.AnthonysSigils", "Chicken", "[creature] counts as a Chicken.", typeof(JustChicken), (Texture)(object)GetTextureAnthony("chicken"));
			AbilityExtensions.SetPixelAbilityIcon(val, GetTextureAnthony("placeholder_act2"), (FilterMode?)null);
			val.metaCategories = new List<AbilityMetaCategory> { (AbilityMetaCategory)0 };
			val.canStack = false;
			val.opponentUsable = true;
			JustChicken.ability = val.ability;
			bool flag = false;
		}

		private void AddTransformChickenOpp()
		{
			//IL_0066: Unknown result type (might be due to invalid IL or missing references)
			//IL_006b: Unknown result type (might be due to invalid IL or missing references)
			AbilityInfo val = AbilityManager.New("AnthonyPython.inscryption.AnthonysSigils", "Transform Chicken (Opposing)", "When a creature is played opposing [creature] it will turn into a Chicken. A Chicken is defined as 1 Attack, 1 Health.", typeof(TurnIntoChickenOpp), (Texture)(object)GetTextureAnthony("TransformChick_Sigil"));
			AbilityExtensions.SetPixelAbilityIcon(val, GetTextureAnthony("placeholder_act2"), (FilterMode?)null);
			val.metaCategories = new List<AbilityMetaCategory> { (AbilityMetaCategory)0 };
			val.canStack = false;
			val.opponentUsable = true;
			TurnIntoChickenOpp.ability = val.ability;
			bool flag = false;
		}

		private void AddTransformChickenLooseCannon()
		{
			//IL_0066: Unknown result type (might be due to invalid IL or missing references)
			//IL_006b: Unknown result type (might be due to invalid IL or missing references)
			AbilityInfo val = AbilityManager.New("AnthonyPython.inscryption.AnthonysSigils", "Transform Chicken (Loose Cannon)", "[creature] will transform a random creature on the board into a Chicken. A Chicken is defined as 1 Attack, 1 Health.", typeof(TurnIntoChickenLooseCannon), (Texture)(object)GetTextureAnthony("TransformChick_Sigil"));
			AbilityExtensions.SetPixelAbilityIcon(val, GetTextureAnthony("placeholder_act2"), (FilterMode?)null);
			val.metaCategories = new List<AbilityMetaCategory> { (AbilityMetaCategory)0 };
			val.canStack = false;
			val.opponentUsable = true;
			TurnIntoChickenLooseCannon.ability = val.ability;
			bool flag = false;
		}

		private void AddTransformChickenEnemyOnly()
		{
			//IL_0066: Unknown result type (might be due to invalid IL or missing references)
			//IL_006b: Unknown result type (might be due to invalid IL or missing references)
			AbilityInfo val = AbilityManager.New("AnthonyPython.inscryption.AnthonysSigils", "Transform Chicken (Enemy Only)", "[creature] will transform a random creature on the board on the opponent's side into a Chicken. A Chicken is defined as 1 Attack, 1 Health.", typeof(TurnIntoChickenEnemyOnly), (Texture)(object)GetTextureAnthony("TransformChick_Sigil"));
			AbilityExtensions.SetPixelAbilityIcon(val, GetTextureAnthony("placeholder_act2"), (FilterMode?)null);
			val.metaCategories = new List<AbilityMetaCategory> { (AbilityMetaCategory)0 };
			val.canStack = false;
			val.opponentUsable = true;
			TurnIntoChickenEnemyOnly.ability = val.ability;
			bool flag = false;
		}

		public void AddAlternating_Scratch()
		{
			//IL_0077: Unknown result type (might be due to invalid IL or missing references)
			//IL_007c: Unknown result type (might be due to invalid IL or missing references)
			AbilityInfo val = AbilityManager.New("ATS", "Alternating Scratch", "When [creature] attacks it will also attack a space adjacent to the attacked slot, the adjacent slot that it will attack will change between left or right at the end of each opponent's turn.", typeof(Alternating_Scratch), (Texture)(object)GetTexture("alternating_scratch"));
			AbilityExtensions.SetPixelAbilityIcon(val, GetTexture("alternating_scratch", Act2: true), (FilterMode?)null);
			val.powerLevel = 4;
			val.metaCategories = new List<AbilityMetaCategory>
			{
				(AbilityMetaCategory)0,
				(AbilityMetaCategory)1
			};
			val.canStack = true;
			val.opponentUsable = true;
			Alternating_Scratch.ability = val.ability;
			bool flag = false;
		}

		public void AddArmoured()
		{
			//IL_0077: Unknown result type (might be due to invalid IL or missing references)
			//IL_007c: Unknown result type (might be due to invalid IL or missing references)
			AbilityInfo val = AbilityManager.New("ATS", "Shielded", "When [creature] is dealt damage, the damage dealt is halved, rounded down.", typeof(Armoured), (Texture)(object)GetTexture("shielded"));
			AbilityExtensions.SetPixelAbilityIcon(val, GetTexture("shielded", Act2: true), (FilterMode?)null);
			val.powerLevel = 3;
			val.metaCategories = new List<AbilityMetaCategory>
			{
				(AbilityMetaCategory)0,
				(AbilityMetaCategory)1
			};
			val.canStack = false;
			val.opponentUsable = true;
			Armoured.ability = val.ability;
			bool flag = false;
		}

		public void AddChoreography()
		{
			//IL_007e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0083: Unknown result type (might be due to invalid IL or missing references)
			AbilityInfo val = AbilityManager.New("ATS", "Choreography", "On activation [creature] will cycle through: don't move, move left and move right. At the end of the owner's turn [creature] will move in the chosen way.", typeof(Choreography), (Texture)(object)GetTexture("choreo_right"));
			AbilityExtensions.SetPixelAbilityIcon(val, GetTexture("choreo_right", Act2: true), (FilterMode?)null);
			val.powerLevel = 2;
			val.metaCategories = new List<AbilityMetaCategory>
			{
				(AbilityMetaCategory)0,
				(AbilityMetaCategory)1
			};
			val.canStack = false;
			val.opponentUsable = false;
			val.activated = true;
			Choreography.ability = val.ability;
			bool flag = false;
		}

		public void AddDraw_Cost()
		{
			//IL_0077: Unknown result type (might be due to invalid IL or missing references)
			//IL_007c: Unknown result type (might be due to invalid IL or missing references)
			AbilityInfo val = AbilityManager.New("ATS", "Draw Cost", "When [creature] is played, a random card that has the same cost type as [creature] is created in your hand.", typeof(Draw_Cost), (Texture)(object)GetTexture("draw_cost"));
			AbilityExtensions.SetPixelAbilityIcon(val, GetTexture("draw_cost", Act2: true), (FilterMode?)null);
			val.powerLevel = 4;
			val.metaCategories = new List<AbilityMetaCategory>
			{
				(AbilityMetaCategory)0,
				(AbilityMetaCategory)1
			};
			val.canStack = true;
			val.opponentUsable = true;
			Draw_Cost.ability = val.ability;
			bool flag = false;
		}

		public void AddDraw_Energy()
		{
			//IL_0077: Unknown result type (might be due to invalid IL or missing references)
			//IL_007c: Unknown result type (might be due to invalid IL or missing references)
			AbilityInfo val = AbilityManager.New("ATS", "Draw Energy", "When [creature] is played, a random card costing energy is created in your hand.", typeof(Draw_Energy), (Texture)(object)GetTexture("draw_energy"));
			AbilityExtensions.SetPixelAbilityIcon(val, GetTexture("draw_energy", Act2: true), (FilterMode?)null);
			val.powerLevel = 3;
			val.metaCategories = new List<AbilityMetaCategory>
			{
				(AbilityMetaCategory)0,
				(AbilityMetaCategory)1
			};
			val.canStack = true;
			val.opponentUsable = true;
			Draw_Energy.ability = val.ability;
			bool flag = false;
		}

		public void AddDraw_Mox()
		{
			//IL_0077: Unknown result type (might be due to invalid IL or missing references)
			//IL_007c: Unknown result type (might be due to invalid IL or missing references)
			AbilityInfo val = AbilityManager.New("ATS", "Draw Mox", "When [creature] is played, a random card costing mox is created in your hand.", typeof(Draw_Mox), (Texture)(object)GetTexture("draw_mox"));
			AbilityExtensions.SetPixelAbilityIcon(val, GetTexture("draw_mox", Act2: true), (FilterMode?)null);
			val.powerLevel = 3;
			val.metaCategories = new List<AbilityMetaCategory>
			{
				(AbilityMetaCategory)0,
				(AbilityMetaCategory)1
			};
			val.canStack = true;
			val.opponentUsable = true;
			Draw_Mox.ability = val.ability;
			bool flag = false;
		}

		public void AddDrunk()
		{
			//IL_0077: Unknown result type (might be due to invalid IL or missing references)
			//IL_007c: Unknown result type (might be due to invalid IL or missing references)
			AbilityInfo val = AbilityManager.New("ATS", "Drunk", "[creature] will strike a random one of the opposing spaces to the left and right of the space across from it.", typeof(Drunk), (Texture)(object)GetTexture("drunk"));
			AbilityExtensions.SetPixelAbilityIcon(val, GetTexture("drunk", Act2: true), (FilterMode?)null);
			val.powerLevel = 0;
			val.metaCategories = new List<AbilityMetaCategory>
			{
				(AbilityMetaCategory)0,
				(AbilityMetaCategory)1
			};
			val.canStack = true;
			val.opponentUsable = true;
			Drunk.ability = val.ability;
			bool flag = false;
		}

		public void AddFrightened()
		{
			//IL_0077: Unknown result type (might be due to invalid IL or missing references)
			//IL_007c: Unknown result type (might be due to invalid IL or missing references)
			AbilityInfo val = AbilityManager.New("ATS", "Frightened", "When a creature moves into the space opposing [creature], [creature] will move away from that card to a random free adjacent spot, while prioritizing slots without any opposing creatures.", typeof(Frightened), (Texture)(object)GetTexture("frightened"));
			AbilityExtensions.SetPixelAbilityIcon(val, GetTexture("frightened", Act2: true), (FilterMode?)null);
			val.powerLevel = -1;
			val.metaCategories = new List<AbilityMetaCategory>
			{
				(AbilityMetaCategory)0,
				(AbilityMetaCategory)1
			};
			val.canStack = false;
			val.opponentUsable = true;
			Frightened.ability = val.ability;
			bool flag = false;
		}

		public void AddHermit()
		{
			//IL_0077: Unknown result type (might be due to invalid IL or missing references)
			//IL_007c: Unknown result type (might be due to invalid IL or missing references)
			AbilityInfo val = AbilityManager.New("ATS", "Hermit", "[creature] may be placed on any terrain card. If it is their sigils and stats will be combined, and a name combination will be created.", typeof(Hermit), (Texture)(object)GetTexture("hermit"));
			AbilityExtensions.SetPixelAbilityIcon(val, GetTexture("hermit", Act2: true), (FilterMode?)null);
			val.powerLevel = 1;
			val.metaCategories = new List<AbilityMetaCategory>
			{
				(AbilityMetaCategory)0,
				(AbilityMetaCategory)1
			};
			val.canStack = false;
			val.opponentUsable = false;
			Hermit.ability = val.ability;
			bool flag = false;
		}

		public void AddHoming()
		{
			//IL_0077: Unknown result type (might be due to invalid IL or missing references)
			//IL_007c: Unknown result type (might be due to invalid IL or missing references)
			AbilityInfo val = AbilityManager.New("ATS", "Homing", "If the opposing slot is empty, and there is a creature in a neighbouring lane, [creature] will attack that creature instead of attacking the opposing slot.", typeof(Homing), (Texture)(object)GetTexture("homing"));
			AbilityExtensions.SetPixelAbilityIcon(val, GetTexture("homing", Act2: true), (FilterMode?)null);
			val.powerLevel = 2;
			val.metaCategories = new List<AbilityMetaCategory>
			{
				(AbilityMetaCategory)0,
				(AbilityMetaCategory)1
			};
			val.canStack = true;
			val.opponentUsable = true;
			Homing.ability = val.ability;
			bool flag = false;
		}

		public void AddHoodini()
		{
			//IL_0077: Unknown result type (might be due to invalid IL or missing references)
			//IL_007c: Unknown result type (might be due to invalid IL or missing references)
			AbilityInfo val = AbilityManager.New("ATS", "Hoodini", "When [creature] is played, it will swap places with the opposing creature.", typeof(Hoodini), (Texture)(object)GetTexture("hoodini"));
			AbilityExtensions.SetPixelAbilityIcon(val, GetTexture("hoodini", Act2: true), (FilterMode?)null);
			val.powerLevel = 1;
			val.metaCategories = new List<AbilityMetaCategory>
			{
				(AbilityMetaCategory)0,
				(AbilityMetaCategory)1
			};
			val.canStack = false;
			val.opponentUsable = true;
			Hoodini.ability = val.ability;
			bool flag = false;
		}

		public void AddHyped()
		{
			//IL_0077: Unknown result type (might be due to invalid IL or missing references)
			//IL_007c: Unknown result type (might be due to invalid IL or missing references)
			AbilityInfo val = AbilityManager.New("ATS", "Hyped", "[creature] will attack at the start of the owner's turn in addition to during normal combat.", typeof(Hyped), (Texture)(object)GetTexture("hyped"));
			AbilityExtensions.SetPixelAbilityIcon(val, GetTexture("hyped", Act2: true), (FilterMode?)null);
			val.powerLevel = 0;
			val.metaCategories = new List<AbilityMetaCategory>
			{
				(AbilityMetaCategory)0,
				(AbilityMetaCategory)1
			};
			val.canStack = false;
			val.opponentUsable = true;
			Hyped.ability = val.ability;
			bool flag = false;
		}

		public void AddInaccurate()
		{
			//IL_0077: Unknown result type (might be due to invalid IL or missing references)
			//IL_007c: Unknown result type (might be due to invalid IL or missing references)
			AbilityInfo val = AbilityManager.New("ATS", "Inaccurate", "[creature] will strike a random one of the opposing spaces to the left and right of the spaces across from it as well as the space in front of it.", typeof(Inaccurate), (Texture)(object)GetTexture("inaccurate"));
			AbilityExtensions.SetPixelAbilityIcon(val, GetTexture("inaccurate", Act2: true), (FilterMode?)null);
			val.powerLevel = 0;
			val.metaCategories = new List<AbilityMetaCategory>
			{
				(AbilityMetaCategory)0,
				(AbilityMetaCategory)1
			};
			val.canStack = true;
			val.opponentUsable = true;
			Inaccurate.ability = val.ability;
			bool flag = false;
		}

		public void AddLullaby()
		{
			//IL_0077: Unknown result type (might be due to invalid IL or missing references)
			//IL_007c: Unknown result type (might be due to invalid IL or missing references)
			AbilityInfo val = AbilityManager.New("ATS", "Lullaby", "When [creature] dies, all opposing creatures gain the asleep sigil.", typeof(Lullaby), (Texture)(object)GetTexture("lullaby"));
			AbilityExtensions.SetPixelAbilityIcon(val, GetTexture("lullaby", Act2: true), (FilterMode?)null);
			val.powerLevel = 2;
			val.metaCategories = new List<AbilityMetaCategory>
			{
				(AbilityMetaCategory)0,
				(AbilityMetaCategory)1
			};
			val.canStack = true;
			val.opponentUsable = true;
			Lullaby.ability = val.ability;
			bool flag = false;
		}

		public void AddMedical_Aid()
		{
			//IL_0077: Unknown result type (might be due to invalid IL or missing references)
			//IL_007c: Unknown result type (might be due to invalid IL or missing references)
			AbilityInfo val = AbilityManager.New("ATS", "Medical Aid", "At the end of the opponent's turn, choose a hurt creature on the owner's side to heal for 1.", typeof(Medical_Aid), (Texture)(object)GetTexture("medical_aid"));
			AbilityExtensions.SetPixelAbilityIcon(val, GetTexture("medical_aid", Act2: true), (FilterMode?)null);
			val.powerLevel = 2;
			val.metaCategories = new List<AbilityMetaCategory>
			{
				(AbilityMetaCategory)0,
				(AbilityMetaCategory)1
			};
			val.canStack = true;
			val.opponentUsable = false;
			Medical_Aid.ability = val.ability;
			bool flag = false;
		}

		public void AddMount()
		{
			//IL_0077: Unknown result type (might be due to invalid IL or missing references)
			//IL_007c: Unknown result type (might be due to invalid IL or missing references)
			AbilityInfo val = AbilityManager.New("ATS", "Mount", "Cards may be played on top of [creature]. If they are their sigils and stats will be combined, and a name combination will be created.", typeof(Mount), (Texture)(object)GetTexture("mount"));
			AbilityExtensions.SetPixelAbilityIcon(val, GetTexture("mount", Act2: true), (FilterMode?)null);
			val.powerLevel = 2;
			val.metaCategories = new List<AbilityMetaCategory>
			{
				(AbilityMetaCategory)0,
				(AbilityMetaCategory)1
			};
			val.canStack = false;
			val.opponentUsable = false;
			Mount.ability = val.ability;
			bool flag = false;
		}

		public void AddNurse()
		{
			//IL_0077: Unknown result type (might be due to invalid IL or missing references)
			//IL_007c: Unknown result type (might be due to invalid IL or missing references)
			AbilityInfo val = AbilityManager.New("ATS", "Nurse", "At the end of the opponent's turn, [creature] will heal any adjacent friendly cards.", typeof(Nurse), (Texture)(object)GetTexture("nurse"));
			AbilityExtensions.SetPixelAbilityIcon(val, GetTexture("nurse", Act2: true), (FilterMode?)null);
			val.powerLevel = 2;
			val.metaCategories = new List<AbilityMetaCategory>
			{
				(AbilityMetaCategory)0,
				(AbilityMetaCategory)1
			};
			val.canStack = true;
			val.opponentUsable = true;
			Nurse.ability = val.ability;
			bool flag = false;
		}

		public void AddParasite()
		{
			//IL_0077: Unknown result type (might be due to invalid IL or missing references)
			//IL_007c: Unknown result type (might be due to invalid IL or missing references)
			AbilityInfo val = AbilityManager.New("ATS", "Parasite", "[creature] may be placed on top of any card. If it is their sigils and stats will be combined, and a name combination will be created.", typeof(Parasite), (Texture)(object)GetTexture("parasite"));
			AbilityExtensions.SetPixelAbilityIcon(val, GetTexture("parasite", Act2: true), (FilterMode?)null);
			val.powerLevel = 2;
			val.metaCategories = new List<AbilityMetaCategory>
			{
				(AbilityMetaCategory)0,
				(AbilityMetaCategory)1
			};
			val.canStack = false;
			val.opponentUsable = false;
			Parasite.ability = val.ability;
			bool flag = false;
		}

		public void AddResourceful()
		{
			//IL_0077: Unknown result type (might be due to invalid IL or missing references)
			//IL_007c: Unknown result type (might be due to invalid IL or missing references)
			AbilityInfo val = AbilityManager.New("ATS", "Resourceful", "When [creature] is sacrificed, instead of dying, it loses a random sigil. Resourceful will only remove itself when there are no other sigils on the card.", typeof(Resourceful), (Texture)(object)GetTexture("resourceful"));
			AbilityExtensions.SetPixelAbilityIcon(val, GetTexture("resourceful", Act2: true), (FilterMode?)null);
			val.powerLevel = 3;
			val.metaCategories = new List<AbilityMetaCategory>
			{
				(AbilityMetaCategory)0,
				(AbilityMetaCategory)1
			};
			val.canStack = false;
			val.opponentUsable = false;
			Resourceful.ability = val.ability;
			bool flag = false;
		}

		public void AddChangePortraitWhenMerged()
		{
			//IL_001c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0021: Unknown result type (might be due to invalid IL or missing references)
			FullSpecialTriggeredAbility val = SpecialTriggeredAbilityManager.Add("ATS", "ChangePortraitWhenMerged", typeof(ChangePortraitWhenMerged));
			ChangePortraitWhenMerged.ability = val.Id;
		}

		public void AddSympathetic()
		{
			//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)
			AbilityInfo val = AbilityManager.New("ATS", "Sympathetic", "[creature] will only attack if the opposing creature has more or equal health to it.", typeof(Sympathetic), (Texture)(object)GetTexture("sympathetic"));
			AbilityExtensions.SetPixelAbilityIcon(val, GetTexture("sympathetic", Act2: true), (FilterMode?)null);
			val.powerLevel = -2;
			val.metaCategories = new List<AbilityMetaCategory>
			{
				(AbilityMetaCategory)0,
				(AbilityMetaCategory)1
			};
			val.canStack = false;
			val.opponentUsable = true;
			Sympathetic.ability = val.ability;
			bool flag = false;
		}

		public void AddTerrified()
		{
			//IL_0077: Unknown result type (might be due to invalid IL or missing references)
			//IL_007c: Unknown result type (might be due to invalid IL or missing references)
			AbilityInfo val = AbilityManager.New("ATS", "Terrified", "When a creature moves into the space opposing [creature], [creature] will move away from that card to a random free adjacent spot while pushing any creatures in it's way, while prioritizing slots without any opposing creatures.", typeof(Terrified), (Texture)(object)GetTexture("terrified"));
			AbilityExtensions.SetPixelAbilityIcon(val, GetTexture("terrified", Act2: true), (FilterMode?)null);
			val.powerLevel = 0;
			val.metaCategories = new List<AbilityMetaCategory>
			{
				(AbilityMetaCategory)0,
				(AbilityMetaCategory)1
			};
			val.canStack = false;
			val.opponentUsable = true;
			Terrified.ability = val.ability;
			bool flag = false;
		}

		public void AddUnderdog()
		{
			//IL_0077: Unknown result type (might be due to invalid IL or missing references)
			//IL_007c: Unknown result type (might be due to invalid IL or missing references)
			AbilityInfo val = AbilityManager.New("ATS", "Underdog", "[creature] can only be played when you are losing.", typeof(Underdog), (Texture)(object)GetTexture("underdog"));
			AbilityExtensions.SetPixelAbilityIcon(val, GetTexture("underdog", Act2: true), (FilterMode?)null);
			val.powerLevel = -1;
			val.metaCategories = new List<AbilityMetaCategory>
			{
				(AbilityMetaCategory)0,
				(AbilityMetaCategory)1
			};
			val.canStack = false;
			val.opponentUsable = false;
			Underdog.ability = val.ability;
			bool flag = false;
		}

		public void AddFight_Activated()
		{
			//IL_007e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0083: Unknown result type (might be due to invalid IL or missing references)
			AbilityInfo val = AbilityManager.New("org.memez4life.inscryption.customsigils", "Charge", "Pay 3 bones to choose an enemy creature that [creature] will strike.", typeof(Fight_Activated), (Texture)(object)GetTextureLily("charge"));
			AbilityExtensions.SetPixelAbilityIcon(val, GetTextureLily("placeholder", Act2: true), (FilterMode?)null);
			val.powerLevel = 5;
			val.metaCategories = new List<AbilityMetaCategory>
			{
				(AbilityMetaCategory)0,
				(AbilityMetaCategory)1
			};
			val.canStack = false;
			val.opponentUsable = false;
			val.activated = true;
			Fight_Activated.ability = val.ability;
			bool flag = false;
		}

		public void AddAsleep()
		{
			//IL_0077: Unknown result type (might be due to invalid IL or missing references)
			//IL_007c: Unknown result type (might be due to invalid IL or missing references)
			AbilityInfo val = AbilityManager.New("org.memez4life.inscryption.customsigils", "Asleep", "[creature] has 0 attack for as long as it has this sigil, at the start of the player's turn this sigil will be removed from [creature].", typeof(Asleep), (Texture)(object)GetTextureLily("asleep"));
			AbilityExtensions.SetPixelAbilityIcon(val, GetTextureLily("asleep", Act2: true), (FilterMode?)null);
			val.powerLevel = -1;
			val.metaCategories = new List<AbilityMetaCategory>
			{
				(AbilityMetaCategory)0,
				(AbilityMetaCategory)1
			};
			val.canStack = true;
			val.opponentUsable = false;
			Asleep.ability = val.ability;
			bool flag = false;
			bool flag2 = false;
		}

		public void AddDouble_Slash()
		{
			//IL_0077: Unknown result type (might be due to invalid IL or missing references)
			//IL_007c: Unknown result type (might be due to invalid IL or missing references)
			AbilityInfo val = AbilityManager.New("org.memez4life.inscryption.customsigils", "Double scratch", "When [creature] attacks it attacks twice and the space right and left of the attacked slot.", typeof(Double_Slash), (Texture)(object)GetTextureLily("double_scratch"));
			AbilityExtensions.SetPixelAbilityIcon(val, GetTextureLily("double_scratch", Act2: true), (FilterMode?)null);
			val.powerLevel = 6;
			val.metaCategories = new List<AbilityMetaCategory>
			{
				(AbilityMetaCategory)0,
				(AbilityMetaCategory)1
			};
			val.canStack = true;
			val.opponentUsable = true;
			Double_Slash.ability = val.ability;
			bool flag = false;
		}

		public void AddLeft_Slash()
		{
			//IL_0077: Unknown result type (might be due to invalid IL or missing references)
			//IL_007c: Unknown result type (might be due to invalid IL or missing references)
			AbilityInfo val = AbilityManager.New("org.memez4life.inscryption.customsigils", "Left scratch", "When [creature] attacks it will also attack the space on the left of the attacked slot.", typeof(Left_Slash), (Texture)(object)GetTextureLily("left_scratch"));
			AbilityExtensions.SetPixelAbilityIcon(val, GetTextureLily("left_scratch", Act2: true), (FilterMode?)null);
			val.powerLevel = 4;
			val.metaCategories = new List<AbilityMetaCategory>
			{
				(AbilityMetaCategory)0,
				(AbilityMetaCategory)1
			};
			val.canStack = true;
			val.opponentUsable = true;
			Left_Slash.ability = val.ability;
			bool flag = false;
		}

		public void AddRight_Slash()
		{
			//IL_0077: Unknown result type (might be due to invalid IL or missing references)
			//IL_007c: Unknown result type (might be due to invalid IL or missing references)
			AbilityInfo val = AbilityManager.New("org.memez4life.inscryption.customsigils", "Right scratch", "When [creature] attacks it will also attack the space on the right of the attacked slot.", typeof(Right_Slash), (Texture)(object)GetTextureLily("right_scratch"));
			AbilityExtensions.SetPixelAbilityIcon(val, GetTextureLily("right_scratch", Act2: true), (FilterMode?)null);
			val.powerLevel = 4;
			val.metaCategories = new List<AbilityMetaCategory>
			{
				(AbilityMetaCategory)0,
				(AbilityMetaCategory)1
			};
			val.canStack = true;
			val.opponentUsable = true;
			Right_Slash.ability = val.ability;
			bool flag = false;
		}

		public void AddBait()
		{
			//IL_0077: Unknown result type (might be due to invalid IL or missing references)
			//IL_007c: Unknown result type (might be due to invalid IL or missing references)
			AbilityInfo val = AbilityManager.New("org.memez4life.inscryption.customsigils", "Bait", "When an opposing creature is played and there is no card opposite of [creature], the opposing creature will move to that spot.", typeof(Bait), (Texture)(object)GetTextureLily("bait"));
			AbilityExtensions.SetPixelAbilityIcon(val, GetTextureLily("bait", Act2: true), (FilterMode?)null);
			val.powerLevel = 1;
			val.metaCategories = new List<AbilityMetaCategory>
			{
				(AbilityMetaCategory)0,
				(AbilityMetaCategory)1
			};
			val.canStack = false;
			val.opponentUsable = true;
			Bait.ability = val.ability;
			bool flag = false;
		}

		public void AddBi_Blood()
		{
			//IL_0077: Unknown result type (might be due to invalid IL or missing references)
			//IL_007c: Unknown result type (might be due to invalid IL or missing references)
			AbilityInfo val = AbilityManager.New("org.memez4life.inscryption.customsigils", "Noble Sacrifice", "[creature] is counted as 2 blood rather than 1 blood when sacrificed.", typeof(Bi_Blood), (Texture)(object)GetTextureLily("bi_blood"));
			AbilityExtensions.SetPixelAbilityIcon(val, GetTextureLily("bi_blood", Act2: true), (FilterMode?)null);
			val.powerLevel = 1;
			val.metaCategories = new List<AbilityMetaCategory>
			{
				(AbilityMetaCategory)0,
				(AbilityMetaCategory)1
			};
			val.canStack = true;
			val.opponentUsable = false;
			Bi_Blood.ability = val.ability;
			bool flag = false;
		}

		public void AddQuadra_Blood()
		{
			//IL_0077: Unknown result type (might be due to invalid IL or missing references)
			//IL_007c: Unknown result type (might be due to invalid IL or missing references)
			AbilityInfo val = AbilityManager.New("org.memez4life.inscryption.customsigils", "Superior Sacrifice", "[creature] is counted as 4 blood rather than 1 blood when sacrificed.", typeof(Quadra_Blood), (Texture)(object)GetTextureLily("quadra_blood"));
			AbilityExtensions.SetPixelAbilityIcon(val, GetTextureLily("quadra_blood", Act2: true), (FilterMode?)null);
			val.powerLevel = 3;
			val.metaCategories = new List<AbilityMetaCategory>
			{
				(AbilityMetaCategory)0,
				(AbilityMetaCategory)1
			};
			val.canStack = true;
			val.opponentUsable = false;
			Quadra_Blood.ability = val.ability;
			bool flag = false;
		}

		public void AddBlood_Shifter()
		{
			//IL_0077: Unknown result type (might be due to invalid IL or missing references)
			//IL_007c: Unknown result type (might be due to invalid IL or missing references)
			AbilityInfo val = AbilityManager.New("org.memez4life.inscryption.customsigils", "Blood shifter", "When [creature] kills another card, it will turn into that card.", typeof(Blood_Shifter), (Texture)(object)GetTextureLily("blood_shifter"));
			AbilityExtensions.SetPixelAbilityIcon(val, GetTextureLily("blood_shifter", Act2: true), (FilterMode?)null);
			val.powerLevel = 3;
			val.metaCategories = new List<AbilityMetaCategory>
			{
				(AbilityMetaCategory)0,
				(AbilityMetaCategory)1
			};
			val.canStack = false;
			val.opponentUsable = true;
			Blood_Shifter.ability = val.ability;
			bool flag = false;
		}

		public void AddFiveDeathBones()
		{
			//IL_0077: Unknown result type (might be due to invalid IL or missing references)
			//IL_007c: Unknown result type (might be due to invalid IL or missing references)
			AbilityInfo val = AbilityManager.New("org.memez4life.inscryption.customsigils", "Bone lord 5", "When [creature] dies, 5 bones are rewarded instead of 1.", typeof(FiveDeathBones), (Texture)(object)GetTextureLily("fivedeathbones"));
			AbilityExtensions.SetPixelAbilityIcon(val, GetTextureLily("fivedeathbones", Act2: true), (FilterMode?)null);
			val.powerLevel = 3;
			val.metaCategories = new List<AbilityMetaCategory>
			{
				(AbilityMetaCategory)0,
				(AbilityMetaCategory)1
			};
			val.canStack = true;
			val.opponentUsable = false;
			FiveDeathBones.ability = val.ability;
			bool flag = false;
		}

		public void AddOneSummonBones()
		{
			//IL_0077: Unknown result type (might be due to invalid IL or missing references)
			//IL_007c: Unknown result type (might be due to invalid IL or missing references)
			AbilityInfo val = AbilityManager.New("org.memez4life.inscryption.customsigils", "Bone hoarder 1", "When [creature] is played, 1 bone is rewarded.", typeof(OneSummonBones), (Texture)(object)GetTextureLily("onesummonbone"));
			AbilityExtensions.SetPixelAbilityIcon(val, GetTextureLily("onesummonbone", Act2: true), (FilterMode?)null);
			val.powerLevel = 1;
			val.metaCategories = new List<AbilityMetaCategory>
			{
				(AbilityMetaCategory)0,
				(AbilityMetaCategory)1
			};
			val.canStack = true;
			val.opponentUsable = false;
			OneSummonBones.ability = val.ability;
			bool flag = false;
		}

		public void AddSixDeathBones()
		{
			//IL_0077: Unknown result type (might be due to invalid IL or missing references)
			//IL_007c: Unknown result type (might be due to invalid IL or missing references)
			AbilityInfo val = AbilityManager.New("org.memez4life.inscryption.customsigils", "Bone lord 6", "When [creature] dies, 6 bones are rewarded instead of 1.", typeof(SixDeathBones), (Texture)(object)GetTextureLily("sixdeathbones"));
			AbilityExtensions.SetPixelAbilityIcon(val, GetTextureLily("sixdeathbones", Act2: true), (FilterMode?)null);
			val.powerLevel = 3;
			val.metaCategories = new List<AbilityMetaCategory>
			{
				(AbilityMetaCategory)0,
				(AbilityMetaCategory)1
			};
			val.canStack = true;
			val.opponentUsable = false;
			SixDeathBones.ability = val.ability;
			bool flag = false;
		}

		public void AddThreeDeathBones()
		{
			//IL_0077: Unknown result type (might be due to invalid IL or missing references)
			//IL_007c: Unknown result type (might be due to invalid IL or missing references)
			AbilityInfo val = AbilityManager.New("org.memez4life.inscryption.customsigils", "Bone prince 3", "When [creature] dies, 3 bones are rewarded instead of 1.", typeof(ThreeDeathBones), (Texture)(object)GetTextureLily("threedeathbones"));
			AbilityExtensions.SetPixelAbilityIcon(val, GetTextureLily("threedeathbones", Act2: true), (FilterMode?)null);
			val.powerLevel = 1;
			val.metaCategories = new List<AbilityMetaCategory>
			{
				(AbilityMetaCategory)0,
				(AbilityMetaCategory)1
			};
			val.canStack = true;
			val.opponentUsable = false;
			ThreeDeathBones.ability = val.ability;
			bool flag = false;
		}

		public void AddThreeSummonBones()
		{
			//IL_0077: Unknown result type (might be due to invalid IL or missing references)
			//IL_007c: Unknown result type (might be due to invalid IL or missing references)
			AbilityInfo val = AbilityManager.New("org.memez4life.inscryption.customsigils", "Bone hoarder 3", "When [creature] is played, 3 bones are rewarded.", typeof(ThreeSummonBones), (Texture)(object)GetTextureLily("threesummonbones"));
			AbilityExtensions.SetPixelAbilityIcon(val, GetTextureLily("threesummonbones", Act2: true), (FilterMode?)null);
			val.powerLevel = 2;
			val.metaCategories = new List<AbilityMetaCategory>
			{
				(AbilityMetaCategory)0,
				(AbilityMetaCategory)1
			};
			val.canStack = true;
			val.opponentUsable = false;
			ThreeSummonBones.ability = val.ability;
			bool flag = false;
		}

		public void AddTwoDeathBones()
		{
			//IL_0077: Unknown result type (might be due to invalid IL or missing references)
			//IL_007c: Unknown result type (might be due to invalid IL or missing references)
			AbilityInfo val = AbilityManager.New("org.memez4life.inscryption.customsigils", "Bone prince 2", "When [creature] dies, 2 bones are rewarded instead of 1.", typeof(TwoDeathBones), (Texture)(object)GetTextureLily("twodeathbones"));
			AbilityExtensions.SetPixelAbilityIcon(val, GetTextureLily("twodeathbones", Act2: true), (FilterMode?)null);
			val.powerLevel = 1;
			val.metaCategories = new List<AbilityMetaCategory>
			{
				(AbilityMetaCategory)0,
				(AbilityMetaCategory)1
			};
			val.canStack = true;
			val.opponentUsable = false;
			TwoDeathBones.ability = val.ability;
			bool flag = false;
		}

		public void AddTwoSummonBones()
		{
			//IL_0077: Unknown result type (might be due to invalid IL or missing references)
			//IL_007c: Unknown result type (might be due to invalid IL or missing references)
			AbilityInfo val = AbilityManager.New("org.memez4life.inscryption.customsigils", "Bone hoarder 2", "When [creature] is played, 2 bones are rewarded.", typeof(TwoSummonBones), (Texture)(object)GetTextureLily("twosummonbones"));
			AbilityExtensions.SetPixelAbilityIcon(val, GetTextureLily("twosummonbones", Act2: true), (FilterMode?)null);
			val.powerLevel = 1;
			val.metaCategories = new List<AbilityMetaCategory>
			{
				(AbilityMetaCategory)0,
				(AbilityMetaCategory)1
			};
			val.canStack = true;
			val.opponentUsable = false;
			TwoSummonBones.ability = val.ability;
			bool flag = false;
		}

		public void AddHost()
		{
			//IL_0077: Unknown result type (might be due to invalid IL or missing references)
			//IL_007c: Unknown result type (might be due to invalid IL or missing references)
			AbilityInfo val = AbilityManager.New("org.memez4life.inscryption.customsigils", "Host", "[creature] is the host of other creatures. It will give you such creature when struck.", typeof(Host), (Texture)(object)GetTextureLily("host"));
			AbilityExtensions.SetPixelAbilityIcon(val, GetTextureLily("host", Act2: true), (FilterMode?)null);
			val.powerLevel = 5;
			val.metaCategories = new List<AbilityMetaCategory>
			{
				(AbilityMetaCategory)0,
				(AbilityMetaCategory)1
			};
			val.canStack = true;
			val.opponentUsable = false;
			Host.ability = val.ability;
			bool flag = false;
		}

		public void AddLauncher()
		{
			//IL_0077: Unknown result type (might be due to invalid IL or missing references)
			//IL_007c: Unknown result type (might be due to invalid IL or missing references)
			AbilityInfo val = AbilityManager.New("org.memez4life.inscryption.customsigils", "Launcher", "At the end of its owner's turn, [creature] will create another creature on a random empty space on the owner's side of the table.", typeof(Launcher), (Texture)(object)GetTextureLily("launcher"));
			AbilityExtensions.SetPixelAbilityIcon(val, GetTextureLily("launcher", Act2: true), (FilterMode?)null);
			val.powerLevel = 5;
			val.metaCategories = new List<AbilityMetaCategory>
			{
				(AbilityMetaCategory)0,
				(AbilityMetaCategory)1
			};
			val.canStack = true;
			val.opponentUsable = false;
			Launcher.ability = val.ability;
			bool flag = false;
		}

		public void AddShape_Shifter()
		{
			//IL_0077: Unknown result type (might be due to invalid IL or missing references)
			//IL_007c: Unknown result type (might be due to invalid IL or missing references)
			AbilityInfo val = AbilityManager.New("org.memez4life.inscryption.customsigils", "Shapeshifter", "[creature] is ever changing. It will change its form once it's struck.", typeof(Shape_Shifter), (Texture)(object)GetTextureLily("shape_shifter"));
			AbilityExtensions.SetPixelAbilityIcon(val, GetTextureLily("shape_shifter", Act2: true), (FilterMode?)null);
			val.powerLevel = 5;
			val.metaCategories = new List<AbilityMetaCategory>
			{
				(AbilityMetaCategory)0,
				(AbilityMetaCategory)1
			};
			val.canStack = true;
			val.opponentUsable = false;
			Shape_Shifter.ability = val.ability;
			bool flag = false;
		}

		public void AddSpawner()
		{
			//IL_0077: Unknown result type (might be due to invalid IL or missing references)
			//IL_007c: Unknown result type (might be due to invalid IL or missing references)
			AbilityInfo val = AbilityManager.New("org.memez4life.inscryption.customsigils", "Spawner", "At the end of its owner's turn, [creature] will move in the direction inscribed on the sigil and will create another creature in its old space.", typeof(Spawner), (Texture)(object)GetTextureLily("spawner"));
			AbilityExtensions.SetPixelAbilityIcon(val, GetTextureLily("spawner", Act2: true), (FilterMode?)null);
			val.powerLevel = 5;
			val.metaCategories = new List<AbilityMetaCategory>
			{
				(AbilityMetaCategory)0,
				(AbilityMetaCategory)1
			};
			val.canStack = true;
			val.opponentUsable = false;
			Spawner.ability = val.ability;
			bool flag = false;
		}

		public void AddDev_Activated()
		{
			//IL_0082: Unknown result type (might be due to invalid IL or missing references)
			//IL_0087: Unknown result type (might be due to invalid IL or missing references)
			AbilityInfo val = AbilityManager.New("org.memez4life.inscryption.customsigils", "Wharrgarbl", "Wharrgarbl.", typeof(Dev_Activated), (Texture)(object)GetTextureLily("placeholder"));
			AbilityExtensions.SetPixelAbilityIcon(val, GetTextureLily("placeholder", Act2: true), (FilterMode?)null);
			val.powerLevel = 69420;
			val.metaCategories = new List<AbilityMetaCategory>
			{
				(AbilityMetaCategory)0,
				(AbilityMetaCategory)1
			};
			val.canStack = true;
			val.opponentUsable = false;
			val.activated = true;
			Dev_Activated.ability = val.ability;
		}

		public void AddDraw_Side_Deck_OnSummon()
		{
			//IL_0077: Unknown result type (might be due to invalid IL or missing references)
			//IL_007c: Unknown result type (might be due to invalid IL or missing references)
			AbilityInfo val = AbilityManager.New("org.memez4life.inscryption.customsigils", "Support call", "When [creature] is played, a card from your sidedeck is created in your hand.", typeof(Draw_Side_Deck_OnSummon), (Texture)(object)GetTextureLily("support_call"));
			AbilityExtensions.SetPixelAbilityIcon(val, GetTextureLily("placeholder", Act2: true), (FilterMode?)null);
			val.powerLevel = 3;
			val.metaCategories = new List<AbilityMetaCategory>
			{
				(AbilityMetaCategory)0,
				(AbilityMetaCategory)1
			};
			val.canStack = true;
			val.opponentUsable = false;
			Draw_Side_Deck_OnSummon.ability = val.ability;
			bool flag = false;
		}

		public void AddFearful()
		{
			//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)
			AbilityInfo val = AbilityManager.New("org.memez4life.inscryption.customsigils", "Fearful", "When [creature] is struck without it resulting in death, it will be returned to its owner's hand.", typeof(Fearful), (Texture)(object)GetTextureLily("fearful"));
			AbilityExtensions.SetPixelAbilityIcon(val, GetTextureLily("fearful", Act2: true), (FilterMode?)null);
			val.powerLevel = -2;
			val.metaCategories = new List<AbilityMetaCategory>
			{
				(AbilityMetaCategory)0,
				(AbilityMetaCategory)1
			};
			val.canStack = false;
			val.opponentUsable = false;
			Fearful.ability = val.ability;
			bool flag = false;
		}

		public void AddHydra()
		{
			//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)
			AbilityInfo val = AbilityManager.New("org.memez4life.inscryption.customsigils", "Exhaustion", "The attack of [creature] will be decreased by the same amount as its lost health.", typeof(Hydra), (Texture)(object)GetTextureLily("exhaustion"));
			AbilityExtensions.SetPixelAbilityIcon(val, GetTextureLily("exhaustion", Act2: true), (FilterMode?)null);
			val.powerLevel = -2;
			val.metaCategories = new List<AbilityMetaCategory>
			{
				(AbilityMetaCategory)0,
				(AbilityMetaCategory)1
			};
			val.canStack = true;
			val.opponentUsable = true;
			Hydra.ability = val.ability;
			bool flag = false;
		}

		public void AddImbuing()
		{
			//IL_0077: Unknown result type (might be due to invalid IL or missing references)
			//IL_007c: Unknown result type (might be due to invalid IL or missing references)
			AbilityInfo val = AbilityManager.New("org.memez4life.inscryption.customsigils", "Imbuing", "[creature] will get specific buffs depending on which tribe is most promenent in the sacrifices that were used to summon it.", typeof(Imbuing), (Texture)(object)GetTextureLily("imbuing"));
			AbilityExtensions.SetPixelAbilityIcon(val, GetTextureLily("placeholder", Act2: true), (FilterMode?)null);
			val.powerLevel = 3;
			val.metaCategories = new List<AbilityMetaCategory>
			{
				(AbilityMetaCategory)0,
				(AbilityMetaCategory)1
			};
			val.canStack = false;
			val.opponentUsable = false;
			Imbuing.ability = val.ability;
			bool flag = false;
		}

		public void AddInstakill()
		{
			//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)
			AbilityInfo val = AbilityManager.New("org.memez4life.inscryption.customsigils", "Instant", "[creature] will perish immediately after its played.", typeof(Instakill), (Texture)(object)GetTextureLily("instant"));
			AbilityExtensions.SetPixelAbilityIcon(val, GetTextureLily("instant", Act2: true), (FilterMode?)null);
			val.powerLevel = -3;
			val.metaCategories = new List<AbilityMetaCategory>
			{
				(AbilityMetaCategory)0,
				(AbilityMetaCategory)1
			};
			val.canStack = false;
			val.opponentUsable = false;
			Instakill.ability = val.ability;
			bool flag = false;
		}

		public void AddRushing_March()
		{
			//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)
			AbilityInfo val = AbilityManager.New("org.memez4life.inscryption.customsigils", "Rushing march", "At the end of its owner's turn, [creature] will move in the direction inscribed on the sigil, however if it hits a card whilst moving, [creature] will stop and the card it hit will perish.", typeof(Rushing_March), (Texture)(object)GetTextureLily("rushing_march"));
			AbilityExtensions.SetPixelAbilityIcon(val, GetTextureLily("rushing_march", Act2: true), (FilterMode?)null);
			val.powerLevel = -2;
			val.metaCategories = new List<AbilityMetaCategory>
			{
				(AbilityMetaCategory)0,
				(AbilityMetaCategory)1
			};
			val.canStack = true;
			val.opponentUsable = true;
			Rushing_March.ability = val.ability;
			bool flag = false;
		}

		public void AddWarper()
		{
			//IL_0077: Unknown result type (might be due to invalid IL or missing references)
			//IL_007c: Unknown result type (might be due to invalid IL or missing references)
			AbilityInfo val = AbilityManager.New("org.memez4life.inscryption.customsigils", "Warper", "At the end of its owner's turn, [creature] will move to the right, jumping over any creatures in its path, if it encounters the edge of the board, it will loop over to the other side.", typeof(Warper), (Texture)(object)GetTextureLily("warper"));
			AbilityExtensions.SetPixelAbilityIcon(val, GetTextureLily("warper", Act2: true), (FilterMode?)null);
			val.powerLevel = 1;
			val.metaCategories = new List<AbilityMetaCategory>
			{
				(AbilityMetaCategory)0,
				(AbilityMetaCategory)1
			};
			val.canStack = true;
			val.opponentUsable = true;
			Warper.ability = val.ability;
			bool flag = false;
		}

		public void AddWild_Hunger()
		{
			//IL_0077: Unknown result type (might be due to invalid IL or missing references)
			//IL_007c: Unknown result type (might be due to invalid IL or missing references)
			AbilityInfo val = AbilityManager.New("org.memez4life.inscryption.customsigils", "Wild hunger", "At the end of its owner's turn, [creature] will move in the direction inscribed on the sigil, however if it hits a card whilst moving, [creature] will stop, the card it hit will perish and [creature] will gain 1+/1+.", typeof(Wild_Hunger), (Texture)(object)GetTextureLily("wild_hunger"));
			AbilityExtensions.SetPixelAbilityIcon(val, GetTextureLily("wild_hunger", Act2: true), (FilterMode?)null);
			val.powerLevel = 4;
			val.metaCategories = new List<AbilityMetaCategory>
			{
				(AbilityMetaCategory)0,
				(AbilityMetaCategory)1
			};
			val.canStack = true;
			val.opponentUsable = true;
			Wild_Hunger.ability = val.ability;
			bool flag = false;
		}

		public void AddAll_Seeing()
		{
			//IL_0077: Unknown result type (might be due to invalid IL or missing references)
			//IL_007c: Unknown result type (might be due to invalid IL or missing references)
			AbilityInfo val = AbilityManager.New("org.memez4life.inscryption.customsigils", "All seeing", "While [creature] is on the board, all talking cards on your side of the board get +2 health.", typeof(All_Seeing), (Texture)(object)GetTextureLily("all_seeing"));
			AbilityExtensions.SetPixelAbilityIcon(val, GetTextureLily("placeholder", Act2: true), (FilterMode?)null);
			val.powerLevel = 3;
			val.metaCategories = new List<AbilityMetaCategory>
			{
				(AbilityMetaCategory)0,
				(AbilityMetaCategory)1
			};
			val.canStack = true;
			val.opponentUsable = false;
			All_Seeing.ability = val.ability;
			bool flag = false;
		}

		public void AddBond()
		{
			//IL_0077: Unknown result type (might be due to invalid IL or missing references)
			//IL_007c: Unknown result type (might be due to invalid IL or missing references)
			AbilityInfo val = AbilityManager.New("org.memez4life.inscryption.customsigils", "Bond", "Any creatures adjacent to [creature] will gain either +1 attack or +1 health, depending on which stat it is closest to.", typeof(Bond), (Texture)(object)GetTextureLily("Bond"));
			AbilityExtensions.SetPixelAbilityIcon(val, GetTextureLily("bond", Act2: true), (FilterMode?)null);
			val.powerLevel = 2;
			val.metaCategories = new List<AbilityMetaCategory>
			{
				(AbilityMetaCategory)0,
				(AbilityMetaCategory)1
			};
			val.canStack = true;
			val.opponentUsable = true;
			Bond.ability = val.ability;
			bool flag = false;
		}

		public void AddLinguist()
		{
			//IL_0077: Unknown result type (might be due to invalid IL or missing references)
			//IL_007c: Unknown result type (might be due to invalid IL or missing references)
			AbilityInfo val = AbilityManager.New("org.memez4life.inscryption.customsigils", "Linguist", "While [creature] is on the board, all talking cards on your side of the board get +1 attack.", typeof(Linguist), (Texture)(object)GetTextureLily("linguist"));
			AbilityExtensions.SetPixelAbilityIcon(val, GetTextureLily("placeholder", Act2: true), (FilterMode?)null);
			val.powerLevel = 3;
			val.metaCategories = new List<AbilityMetaCategory>
			{
				(AbilityMetaCategory)0,
				(AbilityMetaCategory)1
			};
			val.canStack = true;
			val.opponentUsable = true;
			Linguist.ability = val.ability;
			bool flag = false;
		}

		public void AddPuppets_Gift()
		{
			//IL_0077: Unknown result type (might be due to invalid IL or missing references)
			//IL_007c: Unknown result type (might be due to invalid IL or missing references)
			AbilityInfo val = AbilityManager.New("org.memez4life.inscryption.customsigils", "Puppets gift", "As long as [creature] is on the board any cards with brittle won't die because of brittle.", typeof(Puppets_Gift), (Texture)(object)GetTextureLily("puppets_gift"));
			AbilityExtensions.SetPixelAbilityIcon(val, GetTextureLily("puppets_gift", Act2: true), (FilterMode?)null);
			val.powerLevel = 2;
			val.metaCategories = new List<AbilityMetaCategory>
			{
				(AbilityMetaCategory)0,
				(AbilityMetaCategory)1
			};
			val.canStack = false;
			val.opponentUsable = false;
			Puppets_Gift.ability = val.ability;
			bool flag = false;
		}

		public void AddTribe_Attack()
		{
			//IL_0077: Unknown result type (might be due to invalid IL or missing references)
			//IL_007c: Unknown result type (might be due to invalid IL or missing references)
			AbilityInfo val = AbilityManager.New("org.memez4life.inscryption.customsigils", "Tribe Attack", "While [creature] is on the board, all other cards on your side of the board of the same tribe will gain +1 attack.", typeof(Tribe_Attack), (Texture)(object)GetTextureLily("tribe_attack"));
			AbilityExtensions.SetPixelAbilityIcon(val, GetTextureLily("placeholder", Act2: true), (FilterMode?)null);
			val.powerLevel = 3;
			val.metaCategories = new List<AbilityMetaCategory>
			{
				(AbilityMetaCategory)0,
				(AbilityMetaCategory)1
			};
			val.canStack = true;
			val.opponentUsable = true;
			Tribe_Attack.ability = val.ability;
			bool flag = false;
		}

		public void AddTribe_Health()
		{
			//IL_0077: Unknown result type (might be due to invalid IL or missing references)
			//IL_007c: Unknown result type (might be due to invalid IL or missing references)
			AbilityInfo val = AbilityManager.New("org.memez4life.inscryption.customsigils", "Tribe Health", "While [creature] is on the board, all other cards on your side of the board of the same tribe will gain +1 health.", typeof(Tribe_Health), (Texture)(object)GetTextureLily("tribe_health"));
			AbilityExtensions.SetPixelAbilityIcon(val, GetTextureLily("placeholder", Act2: true), (FilterMode?)null);
			val.powerLevel = 2;
			val.metaCategories = new List<AbilityMetaCategory>
			{
				(AbilityMetaCategory)0,
				(AbilityMetaCategory)1
			};
			val.canStack = true;
			val.opponentUsable = true;
			Tribe_Health.ability = val.ability;
			bool flag = false;
		}

		public void AddPicky()
		{
			//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)
			AbilityInfo val = AbilityManager.New("org.memez4life.inscryption.customsigils", "Picky", "[creature] cannnot be summoned by using any free cards as sacrifice.", typeof(Picky), (Texture)(object)GetTextureLily("picky"));
			AbilityExtensions.SetPixelAbilityIcon(val, GetTextureLily("picky", Act2: true), (FilterMode?)null);
			val.powerLevel = -2;
			val.metaCategories = new List<AbilityMetaCategory>
			{
				(AbilityMetaCategory)0,
				(AbilityMetaCategory)1
			};
			val.canStack = false;
			val.opponentUsable = false;
			Picky.ability = val.ability;
			bool flag = false;
		}

		public void AddShort()
		{
			//IL_0077: Unknown result type (might be due to invalid IL or missing references)
			//IL_007c: Unknown result type (might be due to invalid IL or missing references)
			AbilityInfo val = AbilityManager.New("org.memez4life.inscryption.customsigils", "Short", "[creature] will not be blocked by an opposing creature bearing the airborn sigil.", typeof(Short), (Texture)(object)GetTextureLily("short"));
			AbilityExtensions.SetPixelAbilityIcon(val, G

plugins/bitty45-BittysChallenges/plugins/BittysChallenges.dll

Decompiled 5 months ago
using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using BepInEx;
using BepInEx.Bootstrap;
using BepInEx.Configuration;
using BepInEx.Logging;
using BittysChallenges;
using BittysChallenges.Encounters;
using BittysSigils;
using Dialogue;
using DiskCardGame;
using Division.Helpers;
using HarmonyLib;
using InscryptionAPI.Ascension;
using InscryptionAPI.Boons;
using InscryptionAPI.Card;
using InscryptionAPI.Helpers;
using InscryptionAPI.Helpers.Extensions;
using InscryptionAPI.Saves;
using InscryptionAPI.Triggers;
using InscryptionMod.Abilities;
using Microsoft.CodeAnalysis;
using Pixelplacement;
using RulebookExpander;
using UnityEngine;

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

		public RefSafetyRulesAttribute(int P_0)
		{
			Version = P_0;
		}
	}
}
namespace Dialogue
{
	public class Dialogue
	{
		public static void Register(Harmony harmony)
		{
			harmony.PatchAll(typeof(Dialogue));
		}

		public static LineSet SetAbilityInfoDialogue(string dialogue)
		{
			//IL_0007: Unknown result type (might be due to invalid IL or missing references)
			//IL_000c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0018: Expected O, but got Unknown
			//IL_0019: Unknown result type (might be due to invalid IL or missing references)
			//IL_001f: Expected O, but got Unknown
			return new LineSet(new List<Line>
			{
				new Line
				{
					text = dialogue
				}
			});
		}

		public static void P03HappyCloseUp(Line line)
		{
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			//IL_0008: Invalid comparison between Unknown and I4
			if ((int)line.p03Face == 4)
			{
				Singleton<ViewManager>.Instance.SwitchToView((View)33, true, false);
			}
			else
			{
				Singleton<ViewManager>.Instance.SwitchToView((View)1, true, false);
			}
		}

		[HarmonyPatch(typeof(DialogueDataUtil), "ReadDialogueData")]
		[HarmonyPostfix]
		public static void ModDialogue()
		{
			DialogueHelper.AddOrModifySimpleDialogEvent("RedrawHandIntro", new string[2] { "Is that a clover?", "I see." });
			DialogueHelper.AddOrModifySimpleDialogEvent("UnfairHandIntro", new string[4] { "Oh?", "Did you not like having a stacked deck?", "That's fine with me.", "It will be more fair this way anyways." });
			DialogueHelper.AddOrModifySimpleDialogEvent("OuroIntro", new string[3] { "oh?", "my very own ouroboros.", "i will be sure to put it to good use." });
			DialogueHelper.AddOrModifySimpleDialogEvent("OuroZoom1", new string[2] { "the ouroboros has followed you.", "it's fangs are beared, and it's ready for another fight." });
			DialogueHelper.AddOrModifySimpleDialogEvent("OuroZoom3", new string[2] { "the unyielding ouroboros has returned,", "growing stronger every death." });
			DialogueHelper.AddOrModifySimpleDialogEvent("OuroZoom4", new string[2] { "as inevitable as death,", "the ouroboros has returned." });
			DialogueHelper.AddOrModifySimpleDialogEvent("OuroZoom2", new string[2] { "a serpent slithers out from the undergrowth.", "perhaps you have seen it before?" });
			DialogueHelper.AddOrModifySimpleDialogEvent("OuroDies1", new string[2] { "the ouroboros has died.", "and yet, it will return." });
			DialogueHelper.AddOrModifySimpleDialogEvent("OuroDies2", new string[2] { "the serpent's wrath has been delayed.", "for now." });
			DialogueHelper.AddOrModifySimpleDialogEvent("OuroDies3", new string[2] { "the ouroboros only grows stronger from death.", "it will be back." });
			DialogueHelper.AddOrModifySimpleDialogEvent("MycoFailSigils", new string[1] { "a-ah, the sigils..." }, null, null, null, "DoctorIntro");
			DialogueHelper.AddOrModifySimpleDialogEvent("MycoFailAttack", new string[1] { "o-oh, the power..." }, null, null, null, "DoctorIntro");
			DialogueHelper.AddOrModifySimpleDialogEvent("MycoFailHealth", new string[1] { "a-ah, the health..." }, null, null, null, "DoctorIntro");
			DialogueHelper.AddOrModifySimpleDialogEvent("GoldenSheepIntro", new string[3] { "ah...", "Chrysomallos, the golden ram.", "what a glorious pelt...." });
			DialogueHelper.AddOrModifySimpleDialogEvent("GoldenSheepZoom1", new string[2] { "The golden ram.", "catch it before it escapes." });
			DialogueHelper.AddOrModifySimpleDialogEvent("GoldenSheepZoom3", new string[2] { "a rare sight.", "it will not stay for long." });
			DialogueHelper.AddOrModifySimpleDialogEvent("GoldenSheepZoom4", new string[2] { "what glittering wool,", "attached to such a rare creature." });
			DialogueHelper.AddOrModifySimpleDialogEvent("GoldenSheepZoom2", new string[3] { "oh?", "a rare chance to get a rare pelt.", "best make the most of it." });
			DialogueHelper.AddOrModifySimpleDialogEvent("SheepDies1", new string[1] { "You slay the glimmering creature, stealing its pelt." });
			DialogueHelper.AddOrModifySimpleDialogEvent("SheepDies2", new string[2] { "The end of such a glorious creature.", "And what a glorious pelt you have obtained." });
			DialogueHelper.AddOrModifySimpleDialogEvent("SheepDies3", new string[3] { "Chrysomallos...", "How tragic your tale is...", "To be killed for your pelt..." });
			DialogueHelper.AddOrModifySimpleDialogEvent("SheepEscapes1", new string[1] { "The Golden Ram lives another day." });
			DialogueHelper.AddOrModifySimpleDialogEvent("SheepEscapes2", new string[2] { "Time's up.", "The Golden Ram has found an escape route." });
			DialogueHelper.AddOrModifySimpleDialogEvent("SheepEscapes3", new string[2] { "The glimmer of the Golden Ram's fur blinds you,", "giving it the opportunity to escape." });
			DialogueHelper.AddOrModifySimpleDialogEvent("FragileEnemy", new string[3] { "Ah...", "Your [v:0] has taken a devastating blow from the [v:1].", "You will not be able to take it with your caravan." });
			DialogueHelper.AddOrModifySimpleDialogEvent("FragileDies", new string[3] { "Ah...", "You won't be seeing your [v:0] again,", "It has taken too much damage." });
			DialogueHelper.AddOrModifySimpleDialogEvent("FragileSacrifice", new string[3] { "Ah...", "Did you permanently kill your [v:0] on purpose?", "A shame..." });
			DialogueHelper.AddOrModifySimpleDialogEvent("RoyalFirstMate", new string[1] { "Ha! There be my first mate!" }, null, null, (Emotion)1, "PirateSkullPreCharge");
			DialogueHelper.AddOrModifySimpleDialogEvent("RoyalOuro", new string[1] { "Argh! There be snakes on me ship as well!" }, null, null, (Emotion)2, "PirateSkullPreCharge");
			DialogueHelper.AddOrModifySimpleDialogEvent("RoyalOuroDiesPlayer", new string[2] { "Ha!", "I should hire ye to get rid of the rest of them!" }, null, null, (Emotion)0, "PirateSkullPreCharge");
			DialogueHelper.AddOrModifySimpleDialogEvent("RoyalOuroDies", new string[1] { "Ha! It's dead!" }, null, null, (Emotion)1, "PirateSkullPreCharge");
			DialogueHelper.AddOrModifySimpleDialogEvent("PirateIntro", new string[4] { "what?", "Pirates?", "...", "I'll allow it." }, null, null, (Emotion)4);
			DialogueHelper.AddOrModifySimpleDialogEvent("InfiniteLivesIntro", new string[5] { "what?", "cheating?", "how dissapointing...", "...", "the game will be soured from a pitifully easy ascent." }, null, null, (Emotion)2);
			DialogueHelper.AddOrModifySimpleDialogEvent("InfiniteLivesRepeat", new string[1] { "cheater..." }, new string[6][]
			{
				new string[1] { "Have you no shame?" },
				new string[1] { "To cheat so blatantly..." },
				new string[1] { "you should be dead." },
				new string[1] { "and yet..." },
				new string[1] { "how dissapointing..." },
				new string[1] { "..." }
			}, null, (Emotion)2);
			DialogueHelper.AddOrModifySimpleDialogEvent("InfiniteLivesLoop", new string[1] { "I won't tolerate this for much longer..." }, null, null, (Emotion)2);
			DialogueHelper.AddOrModifySimpleDialogEvent("InfiniteLivesLoopBreak", new string[1] { "Enough of this." }, null, null, (Emotion)2);
			DialogueHelper.AddOrModifySimpleDialogEvent("InfiniteLivesRoyal", new string[1] { "Yer not dead?" }, null, null, (Emotion)5, "PirateSkullPreCharge");
			DialogueHelper.AddOrModifySimpleDialogEvent("FecundityUnNerfIntro", new string[3] { "ah...", "back to normal then?", "I'll admit, I had gotten used to the changes..." }, null, null, (Emotion)4);
			DialogueHelper.AddOrModifySimpleDialogEvent("WeakStart", new string[4] { "Weak Cards?", "This is hard to explain...", "Perhaps they are sick? Yes.", "A crippling disease afflicted your meager troupe of creatures." }, null, null, (Emotion)4);
			DialogueHelper.AddOrModifySimpleDialogEvent("WaterborneStart", new string[5] { "Waterborne Cards?", "This is hard to explain...", "Perhaps a mutation? Yes.", "Your caravan of creatures had a startling mutation,", "They could only survive in the water." }, null, null, (Emotion)4);
			DialogueHelper.AddOrModifySimpleDialogEvent("ShockedStart", new string[4] { "Paralyzed Cards?", "Hmm...", "Your group of creatures were fatigued from the long journey,", "but there would be a long way to go yet." }, null, null, (Emotion)4);
			DialogueHelper.AddOrModifySimpleDialogEvent("WeakSoulStart", new string[4] { "Weak Souled Cards?", "Hmm...", "You will not be able to extract their souls into new creatures,", "For better or worse..." }, null, null, (Emotion)4);
			DialogueHelper.AddOrModifySimpleDialogEvent("AscenderBaneStart", new string[1] { "The lives of past challengers weighed down on you..." }, null, null, (Emotion)4);
			DialogueHelper.AddOrModifySimpleDialogEvent("FamineIntro", new string[4] { "Hm?", "How to explain this...", "You were running low on supplies that day...", "You'll have fewer [c:G][v:0]s[c:] to work with." }, null, null, (Emotion)4);
			DialogueHelper.AddOrModifySimpleDialogEvent("AbundanceIntro", new string[3] { "Hm?", "An abundance of [c:G][v:0]s[c:]...", "Must be mating season..." }, null, null, (Emotion)4);
			DialogueHelper.AddOrModifySimpleDialogEvent("EnvironmentsIntro", new string[3] { "Hm?", "Environmental effects?", "how interesting..." }, null, null, (Emotion)4);
			DialogueHelper.AddOrModifySimpleDialogEvent("MudBoonIntro", new string[3] { "In order to proceed,", "you had to slog through the wetter parts of the swamp.", "The thick [c:G]mud[c:] stuck to your boots, and hindered your movements..." }, null, null, (Emotion)0);
			DialogueHelper.AddOrModifySimpleDialogEvent("HailBoonIntro", new string[4] { "The frigid air was not the only obstacle in your way,", "the harsh ice and unforgiving snow also stood in your path.", "before long you found yourself in...", "a [c:B]hailstorm.[c:]" }, null, null, (Emotion)0);
			DialogueHelper.AddOrModifySimpleDialogEvent("CliffsBoonIntro", new string[3] { "You found yourself cornered against a sheer rock wall,", "the [c:G]cliffside.[c:]", "Against the cold stone, there would be less space to fight." }, null, null, (Emotion)0);
			DialogueHelper.AddOrModifySimpleDialogEvent("MushroomsBoonIntro", new string[3] { "The mycologists had left one of their experiments behind,", "unbeknownst to them, it began to fester and grow.", "even the creatures fighting you would not be safe from the [c:G]fungal mass.[c:]" }, null, null, (Emotion)0);
			DialogueHelper.AddOrModifySimpleDialogEvent("DynamiteBoonIntro", new string[4] { "You stumbled across one of the Prospector's Camps.", "The camp was filled with prospecting tools.", "pickaxes, headlamps...", "and [c:bR]dynamite.[c:]" }, null, null, (Emotion)0);
			DialogueHelper.AddOrModifySimpleDialogEvent("BaitBoonIntro", new string[3] { "You came across one of the Angler's Ponds.", "the area stank of rotting fish,", "emanating from the nearby abandoned buckets of [c:dB]bait.[c:]" }, null, null, (Emotion)0);
			DialogueHelper.AddOrModifySimpleDialogEvent("TrapBoonIntro", new string[3] { "You came across one of the Trapper's Hunting Grounds.", "the stench of blood hung in the air...", "you noticed the numerous [c:G]traps[c:] lying in wait." }, null, null, (Emotion)0);
			DialogueHelper.AddOrModifySimpleDialogEvent("TotemBoonIntro", new string[3] { "You came upon a strange [c:bR]totem.[c:]", "a mysterious energy swirled around it,", "the creatures nearby seem more agressive than usual..." }, null, null, (Emotion)0);
			DialogueHelper.AddOrModifySimpleDialogEvent("BloodMoonBoonIntro", new string[2] { "Ah...", "a [c:bR]Blood Moon.[c:]" }, null, null, (Emotion)0);
			DialogueHelper.AddOrModifySimpleDialogEvent("CarrotBoonIntro", new string[4] { "Er...", "You...", "...", "...What?" }, null, null, (Emotion)4);
			DialogueHelper.AddOrModifySimpleDialogEvent("CarrotBoonIntro2", new string[1] { "I am at a loss for words." }, null, null, (Emotion)0);
			DialogueHelper.AddOrModifySimpleDialogEvent("BlizzardBoonIntro", new string[5] { "The wind was howling around you.", "Stuck in the middle of a blizzard,", "You heard rumbling from the mountains above.", "Here it comes...", "an [c:B]avalanche.[c:]" }, null, null, (Emotion)0);
			DialogueHelper.AddOrModifySimpleDialogEvent("ObeliskBoonIntro", new string[3] { "You stumble across a strange black stone.", "A stone tablet sits in front of it, clearly made for sacrifices.", "Perhaps a certain creature may cause a reaction?" }, null, null, (Emotion)0);
			DialogueHelper.AddOrModifySimpleDialogEvent("GoatSacrifice", new string[3] { "The obelisk trembles in delight.", "A goat is truly a worthy sacrifice.", "You won't be seeing it again." }, null, null, (Emotion)0);
			DialogueHelper.AddOrModifySimpleDialogEvent("PeltSacrifice", new string[2] { "The obelisk rumbles with anger.", "A pelt is a truly pitiful sacrifice." }, null, null, (Emotion)0);
			DialogueHelper.AddOrModifySimpleDialogEvent("SquirrelSacrifice", new string[2] { "...", "...That is not a proper sacrifice." }, new string[4][]
			{
				new string[1] { "Stop this." },
				new string[1] { "You..." },
				new string[1] { "This is bloodshed without meaning." },
				new string[1] { "[v:0]..." }
			}, null, (Emotion)0);
			DialogueHelper.AddOrModifySimpleDialogEvent("MinicelloBoonIntro", new string[2] { "Hmm?", "What is this?" }, null, null, (Emotion)4);
			DialogueHelper.AddOrModifySimpleDialogEvent("MinicelloBoonIntro2", new string[3] { "Heh heh heh...", "Ye walked into th' pirate's cove!", "Me crew will get rid of ye quick!" }, null, null, (Emotion)1, "PirateSkullPreCharge");
			DialogueHelper.AddOrModifySimpleDialogEvent("DarkForestBoonIntro", new string[4] { "You carve through the thick underbrush and foilage.", "The trees blotting out the sun...", "As you travel, you hear the woods start to creak around you.", "You should know better than to walk in the darkness..." });
			DialogueHelper.AddOrModifySimpleDialogEvent("FloodBoonIntro", new string[4] { "As your caravan of creatures travels, you hear a rushing sound.", "You climb to a higher place as water flows around you.", "You are caught in a [c:B]flood.[c:]", "Only the terrain and flying creatures will be able to avoid the waters." });
			DialogueHelper.AddOrModifySimpleDialogEvent("BreezeBoonIntro", new string[4] { "As your caravan of creatures moves across a clearing, the winds blow stronger.", "A strong breeze greets your face, and you grasp onto the surroundings for dear life.", "Your creatures are blown [c:G]airborne.[c:]", "Only burrowing and submerged creatures will be able to avoid the gusts." });
			DialogueHelper.AddOrModifySimpleDialogEvent("BreezeActivation", new string[1] { "The Breeze blows..." });
			DialogueHelper.AddOrModifySimpleDialogEvent("GraveyardBoonIntro", new string[4] { "You come across a pile of corpses.", "A strange energy swirls around them as you approach.", "Then...", "[c:R]The dead walk.[c:]" }, null, null, (Emotion)0);
			DialogueHelper.AddOrModifySimpleDialogEvent("GraveyardBoonIntro2", new string[1] { "[c:R]The dead walk.[c:]" }, null, null, (Emotion)0);
			DialogueHelper.AddOrModifySimpleDialogEvent("FlashGrowthBoonIntro", new string[4] { "You came across an overgrown glade.", "The trees seemed taller, and stronger than usual.", "Your creatures grew faster as well.", "<color=#25C102>Flash Growth.</color>" }, null, null, (Emotion)0);
			DialogueHelper.AddOrModifySimpleDialogEvent("FlashGrowthBoonIntro2", new string[1] { "<color=#25C102>Flash Growth.</color>" }, null, null, (Emotion)0);
			DialogueHelper.AddDialogue("P03FamineIntro", new List<string> { "Hm?", "You're decreasing the number of vessels you have?", "Surely a player as bad as you needs the extra chump blockers?", "You'll see." }, new List<string> { "Default", "", "Happy", "Default" }, new List<string> { "", "", "y", "" });
			DialogueHelper.AddDialogue("P03AbundanceIntro", new List<string> { "Hm?", "You're increasing the number of vessels you have?", "Makes sense.", "After all, a player as bad as you needs the extra chump blockers.", "[v:0] vessels..." }, new List<string> { "Default", "", "", "Happy", "Default" }, new List<string> { "", "", "", "y", "" });
			DialogueHelper.AddDialogue("P03FecundityUnNerfIntro", new List<string> { "Oh?", "You couldn't even stick to the changes?", "Pathetic." }, new List<string> { "Default", "Happy", "Default" }, new List<string> { "", "", "" });
			DialogueHelper.AddDialogue("P03OuroIntro", new List<string> { "Oh?", "My own Ourobot?", "You must be masochistic if you thought this was a good idea.", "Your funeral." }, new List<string> { "Thinking", "Default", "Happy", "Default" }, new List<string> { "", "", "", "" });
			DialogueHelper.AddDialogue("P03OuroDies1", new List<string> { "There it goes." }, new List<string> { "Default" }, new List<string> { "" });
			DialogueHelper.AddDialogue("P03OuroDies2", new List<string> { "You just made it stronger.", "Of course, you knew that already." }, new List<string> { "Default", "Happy" }, new List<string> { "", "" });
			DialogueHelper.AddDialogue("P03OuroDies3", new List<string> { "I'm not worried.", "It'll come back to crush you later." }, new List<string> { "Default", "Happy" }, new List<string> { "", "" });
			DialogueHelper.AddDialogue("P03WeakStart", new List<string> { "Hm?", "Weaker starting cards?", "As if one health will make a difference." }, new List<string> { "Default", "", "" }, new List<string> { "", "", "" });
			DialogueHelper.AddDialogue("P03EnvironmentsIntro", new List<string> { "Hm?", "Were my environments not good enough for you?", "Fine." }, new List<string> { "Default", "", "" }, new List<string> { "", "", "" });
			DialogueHelper.AddDialogue("P03GraveyardBoonIntro", new List<string> { "Hm...", "You have found a...", "Robot scrapyard.", "There's broken down robots everywhere.", "Every robot in this area dies twice." }, new List<string> { "Thinking", "Default", "", "", "" }, new List<string> { "", "", "", "", "" });
			DialogueHelper.AddDialogue("P03GraveyardBoonIntro2", new List<string> { "It's the scrapyard again.", "You know the drill." }, new List<string> { "Default", "" }, new List<string> { "", "" });
			DialogueHelper.AddDialogue("P03FlashGrowthBoonIntro", new List<string> { "Eugh.", "This is one of [c:O]HIS.[c:]", "Your... transformer bots will be more effective here.", "They'll transform when played.", "You'll see." }, new List<string> { "Angry", "", "Default", "", "" }, new List<string> { "", "", "", "", "" });
			DialogueHelper.AddDialogue("P03FlashGrowthBoonIntro2", new List<string> { "Your transformer bots will be more effective here.", "They'll tranform when played." }, new List<string> { "Default", "" }, new List<string> { "", "" });
			DialogueHelper.AddDialogue("P03ConveyorBoonIntro", new List<string> { "Ah...", "A favorite of mine.", "At the start of each of your turns all cards will be moved clockwise.", "I'm sure you've seen it before." }, new List<string> { "Happy", "", "", "Default" }, new List<string> { "", "", "", "" });
			DialogueHelper.AddDialogue("P03ConveyorBoonIntro2", new List<string> { "At the start of each of your turns all cards will be moved clockwise.", "You've seen it before." }, new List<string> { "Default", "" }, new List<string> { "", "" });
			DialogueHelper.AddDialogue("P03GemSanctuaryBoonIntro", new List<string> { "Ah...", "Your <color=#25C102>G</color>[c:O]E[c:][c:B]M[c:]s will be more useful.", "More useful than [c:R]he[c:] ever was able to make them...", "...As long as you keep that one alive." }, new List<string> { "Thinking", "Default", "Angry", "Default" }, new List<string> { "", "", "", "" });
			DialogueHelper.AddDialogue("P03GemSanctuaryBoonIntro2", new List<string> { "Your <color=#25C102>G</color>[c:O]E[c:][c:B]M[c:]s will be more useful.", "...As long as you keep that one alive." }, new List<string> { "Default", "Default" }, new List<string> { "", "" });
			DialogueHelper.AddDialogue("P03ElectricStormBoonIntro", new List<string> { "Heh.", "This one will be quite...", "Shocking.", "You find yourself in an electrical storm.", "When a card is played, it will take 1 damage.", "If it survives, it'll be stronger for a bit." }, new List<string> { "Happy", "", "Happy", "", "", "Default" }, new List<string> { "", "", "", "", "", "" });
			DialogueHelper.AddDialogue("P03ElectricStormBoonIntro2", new List<string> { "I think you'll find this one quite...", "Shocking." }, new List<string> { "Default", "Happy" }, new List<string> { "", "" });
		}
	}
}
namespace Division.Helpers
{
	public static class DialogueHelper
	{
		public static LineSet CreateLineSet(string[] lineString, Emotion emotion = 0, LetterAnimation animation = 2, Face p03Face = 0, int speakerIndex = 0)
		{
			//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_000f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0015: Unknown result type (might be due to invalid IL or missing references)
			//IL_0016: Unknown result type (might be due to invalid IL or missing references)
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_0029: Unknown result type (might be due to invalid IL or missing references)
			//IL_0047: Expected O, but got Unknown
			return new LineSet
			{
				lines = ((IEnumerable<string>)lineString).Select((Func<string, Line>)((string s) => new Line
				{
					text = s,
					emotion = emotion,
					letterAnimation = animation,
					p03Face = p03Face,
					speakerIndex = speakerIndex
				})).ToList()
			};
		}

		public static void AddDialogue(string id, List<string> lines, List<string> faces, List<string> dialogueWavies)
		{
			//IL_0008: 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_01d1: Unknown result type (might be due to invalid IL or missing references)
			//IL_01d3: Invalid comparison between Unknown and I4
			//IL_0072: Unknown result type (might be due to invalid IL or missing references)
			//IL_01d5: Unknown result type (might be due to invalid IL or missing references)
			//IL_01d7: Invalid comparison between Unknown and I4
			//IL_00ac: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e6: Unknown result type (might be due to invalid IL or missing references)
			//IL_020d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0233: Unknown result type (might be due to invalid IL or missing references)
			//IL_023a: Expected O, but got Unknown
			//IL_0252: Unknown result type (might be due to invalid IL or missing references)
			//IL_0120: Unknown result type (might be due to invalid IL or missing references)
			//IL_029d: Unknown result type (might be due to invalid IL or missing references)
			//IL_02a7: Expected O, but got Unknown
			//IL_0159: Unknown result type (might be due to invalid IL or missing references)
			//IL_0190: Unknown result type (might be due to invalid IL or missing references)
			//IL_01c7: Unknown result type (might be due to invalid IL or missing references)
			Speaker val = (Speaker)6;
			if (faces.Exists((string s) => s.ToLowerInvariant().Contains("leshy")))
			{
				val = (Speaker)1;
			}
			else if (faces.Exists((string s) => s.ToLowerInvariant().Contains("telegrapher")))
			{
				val = (Speaker)11;
			}
			else if (faces.Exists((string s) => s.ToLowerInvariant().Contains("archivist")))
			{
				val = (Speaker)9;
			}
			else if (faces.Exists((string s) => s.ToLowerInvariant().Contains("photographer")))
			{
				val = (Speaker)10;
			}
			else if (faces.Exists((string s) => s.ToLowerInvariant().Contains("canvas")))
			{
				val = (Speaker)12;
			}
			else if (faces.Exists((string s) => s.ToLowerInvariant().Contains("goo")))
			{
				val = (Speaker)7;
			}
			else if (faces.Exists((string s) => s.ToLowerInvariant().Contains("side")))
			{
				val = (Speaker)20;
			}
			else if (faces.Exists((string s) => s.ToLowerInvariant().Contains("mycolo")))
			{
				val = (Speaker)19;
			}
			bool leshy = (int)val == 1 || (int)val == 7;
			Emotion leshyEmotion = (Emotion)(faces.Exists((string s) => s.ToLowerInvariant().Contains("goocurious")) ? 5 : 0);
			if (string.IsNullOrEmpty(id))
			{
				return;
			}
			List<DialogueEvent> events = DialogueDataUtil.Data.events;
			DialogueEvent val2 = new DialogueEvent();
			val2.id = id;
			val2.speakers = new List<Speaker>
			{
				(Speaker)0,
				val
			};
			val2.mainLines = new LineSet(((IEnumerable<string>)faces).Zip((IEnumerable<string>)lines, (Func<string, string, Line>)((string face, string line) => new Line
			{
				text = line,
				specialInstruction = "",
				p03Face = (Face)(leshy ? 17 : ((int)face.ParseFace())),
				speakerIndex = 1,
				emotion = (leshy ? leshyEmotion : face.ParseFace().FaceEmotion())
			})).Zip(dialogueWavies, delegate(Line line, string wavy)
			{
				//IL_0025: Unknown result type (might be due to invalid IL or missing references)
				if (!string.IsNullOrEmpty(wavy) && wavy.ToLowerInvariant() == "y")
				{
					line.letterAnimation = (LetterAnimation)1;
				}
				return line;
			}).ToList());
			events.Add(val2);
		}

		private static Face ParseFace(this string face)
		{
			//IL_0025: Unknown result type (might be due to invalid IL or missing references)
			//IL_002a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0010: Unknown result type (might be due to invalid IL or missing references)
			//IL_002c: Unknown result type (might be due to invalid IL or missing references)
			//IL_002d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0030: Unknown result type (might be due to invalid IL or missing references)
			if (string.IsNullOrEmpty(face))
			{
				return (Face)17;
			}
			return (Face)Enum.Parse(typeof(Face), face);
		}

		private static Emotion FaceEmotion(this Face face)
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_0003: Invalid comparison between Unknown and I4
			//IL_0012: Unknown result type (might be due to invalid IL or missing references)
			//IL_0014: Invalid comparison between Unknown and I4
			//IL_000d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0025: Unknown result type (might be due to invalid IL or missing references)
			//IL_0028: Invalid comparison between Unknown and I4
			//IL_0020: Unknown result type (might be due to invalid IL or missing references)
			//IL_0057: Unknown result type (might be due to invalid IL or missing references)
			//IL_0058: Unknown result type (might be due to invalid IL or missing references)
			//IL_003b: Unknown result type (might be due to invalid IL or missing references)
			//IL_003e: Invalid comparison between Unknown and I4
			//IL_0036: Unknown result type (might be due to invalid IL or missing references)
			//IL_005c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0052: Unknown result type (might be due to invalid IL or missing references)
			//IL_004c: Unknown result type (might be due to invalid IL or missing references)
			if ((int)face == 3)
			{
				return (Emotion)2;
			}
			if ((int)face == 1)
			{
				return (Emotion)5;
			}
			if ((int)face == 49)
			{
				return (Emotion)2;
			}
			if ((int)face == 46)
			{
				return (Emotion)1;
			}
			return (Emotion)0;
		}

		public static void AddOrModifySimpleDialogEvent(string eventId, string line, LetterAnimation? animation = null, Emotion? emotion = null)
		{
			string[] lines = new string[1] { line };
			AddOrModifySimpleDialogEvent(eventId, lines, null, animation, emotion);
		}

		private static void SyncLineCollection(List<Line> curLines, string[] newLines, LetterAnimation? animation, Emotion? emotion)
		{
			//IL_0081: 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_00a2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a7: Unknown result type (might be due to invalid IL or missing references)
			while (curLines.Count > newLines.Length)
			{
				curLines.RemoveAt(curLines.Count - 1);
			}
			for (int i = 0; i < curLines.Count; i++)
			{
				curLines[i].text = newLines[i];
			}
			for (int j = curLines.Count; j < newLines.Length; j++)
			{
				Line val = CloneLine(curLines[0]);
				val.text = newLines[j];
				if (animation.HasValue)
				{
					val.letterAnimation = animation.Value;
				}
				if (emotion.HasValue)
				{
					val.emotion = emotion.Value;
				}
				curLines.Add(val);
			}
		}

		public static void AddOrModifySimpleDialogEvent(string eventId, string[] lines, string[][] repeatLines = null, LetterAnimation? animation = null, Emotion? emotion = null, string template = "NewRunDealtDeckDefault")
		{
			bool flag = false;
			DialogueEvent val = DialogueDataUtil.Data.GetEvent(eventId);
			if (val == null)
			{
				flag = true;
				val = CloneDialogueEvent(DialogueDataUtil.Data.GetEvent(template), eventId);
				while (val.mainLines.lines.Count > lines.Length)
				{
					val.mainLines.lines.RemoveAt(lines.Length);
				}
			}
			SyncLineCollection(val.mainLines.lines, lines, animation, emotion);
			if (repeatLines == null)
			{
				val.repeatLines.Clear();
			}
			else
			{
				while (val.repeatLines.Count > repeatLines.Length)
				{
					val.repeatLines.RemoveAt(val.repeatLines.Count - 1);
				}
				for (int i = 0; i < val.repeatLines.Count; i++)
				{
					SyncLineCollection(val.repeatLines[i].lines, repeatLines[i], animation, emotion);
				}
			}
			if (flag)
			{
				DialogueDataUtil.Data.events.Add(val);
			}
		}

		public static Line CloneLine(Line line)
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			//IL_0008: Unknown result type (might be due to invalid IL or missing references)
			//IL_000d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0012: Unknown result type (might be due to invalid IL or missing references)
			//IL_0014: Unknown result type (might be due to invalid IL or missing references)
			//IL_0019: Unknown result type (might be due to invalid IL or missing references)
			//IL_001e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0020: Unknown result type (might be due to invalid IL or missing references)
			//IL_0025: Unknown result type (might be due to invalid IL or missing references)
			//IL_002a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0036: 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_004e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0050: Unknown result type (might be due to invalid IL or missing references)
			//IL_0055: Unknown result type (might be due to invalid IL or missing references)
			//IL_005a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0067: Expected O, but got Unknown
			return new Line
			{
				p03Face = line.p03Face,
				emotion = line.emotion,
				letterAnimation = line.letterAnimation,
				speakerIndex = line.speakerIndex,
				text = line.text,
				specialInstruction = line.specialInstruction,
				storyCondition = line.storyCondition,
				storyConditionMustBeMet = line.storyConditionMustBeMet
			};
		}

		public static DialogueEvent CloneDialogueEvent(DialogueEvent dialogueEvent, string newId, bool includeRepeat = false)
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			//IL_000d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0019: Unknown result type (might be due to invalid IL or missing references)
			//IL_001a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0024: Expected O, but got Unknown
			//IL_0024: 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_003b: Expected O, but got Unknown
			//IL_013a: Unknown result type (might be due to invalid IL or missing references)
			//IL_013f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0148: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ad: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b4: Expected O, but got Unknown
			DialogueEvent val = new DialogueEvent
			{
				id = newId,
				groupId = dialogueEvent.groupId,
				mainLines = new LineSet(),
				speakers = new List<Speaker>(),
				repeatLines = new List<LineSet>()
			};
			foreach (Line line in dialogueEvent.mainLines.lines)
			{
				val.mainLines.lines.Add(CloneLine(line));
			}
			if (includeRepeat)
			{
				foreach (LineSet repeatLine in dialogueEvent.repeatLines)
				{
					LineSet val2 = new LineSet();
					foreach (Line line2 in repeatLine.lines)
					{
						val2.lines.Add(CloneLine(line2));
					}
					val.repeatLines.Add(val2);
				}
			}
			foreach (Speaker speaker in dialogueEvent.speakers)
			{
				val.speakers.Add(speaker);
			}
			return val;
		}
	}
}
namespace RulebookExpander
{
	public class RulebookExpansion
	{
		public static void Register(Harmony harmony)
		{
			harmony.PatchAll(typeof(RulebookExpansion));
		}

		[HarmonyPatch(typeof(RuleBookInfo), "AbilityShouldBeAdded")]
		[HarmonyPostfix]
		private static void Postfix(ref bool __result, ref int abilityIndex)
		{
			//IL_000a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0011: Invalid comparison between Unknown and I4
			//IL_0017: Unknown result type (might be due to invalid IL or missing references)
			//IL_001e: Invalid comparison between Unknown and I4
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002b: Invalid comparison between Unknown and I4
			//IL_002e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0035: Invalid comparison between Unknown and I4
			//IL_0038: Unknown result type (might be due to invalid IL or missing references)
			//IL_003d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0045: Unknown result type (might be due to invalid IL or missing references)
			//IL_004a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0052: Unknown result type (might be due to invalid IL or missing references)
			//IL_0059: Invalid comparison between Unknown and I4
			//IL_005c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0061: Unknown result type (might be due to invalid IL or missing references)
			//IL_0069: 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_0076: Unknown result type (might be due to invalid IL or missing references)
			//IL_007b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0083: Unknown result type (might be due to invalid IL or missing references)
			//IL_0088: Unknown result type (might be due to invalid IL or missing references)
			//IL_0090: Unknown result type (might be due to invalid IL or missing references)
			//IL_0095: Unknown result type (might be due to invalid IL or missing references)
			//IL_009d: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a2: Unknown result type (might be due to invalid IL or missing references)
			AbilityInfo info = AbilitiesUtil.GetInfo((Ability)abilityIndex);
			if ((int)info.ability == 88 || (int)info.ability == 52 || (int)info.ability == 36 || (int)info.ability == 62 || info.ability == GiveNoTransfer.ability || info.ability == Plugin.GiveParalysis.ability || (int)info.ability == 47 || info.ability == GiveFleeting.ability || info.ability == GiveCantAttack.ability || info.ability == GiveStrafePull.ability || info.ability == GiveStrafeSticky.ability || info.ability == GiveStrafeSuper.ability || info.ability == Plugin.GiveWarper.ability)
			{
				__result = true;
			}
		}
	}
}
namespace BittysChallenges
{
	[BepInPlugin("bitty45.inscryption.challenges", "Bitty's Challenges", "5.3.0")]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	public class Plugin : BaseUnityPlugin
	{
		public class RandomPiratesPatch
		{
			public static void Register(Harmony harmony)
			{
				harmony.PatchAll(typeof(RandomPiratesPatch));
			}

			[HarmonyPostfix]
			[HarmonyPatch(typeof(TurnManager), "SetupPhase")]
			public static void ChallengeActivations()
			{
				//IL_0012: 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_004c: 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_0035: Invalid comparison between Unknown and I4
				if (SaveFile.IsAscension && AscensionSaveData.Data.ChallengeIsActive(harderFinalBossChallenge.challengeType) && (int)Singleton<Opponent>.Instance.OpponentType != 0 && (int)Singleton<Opponent>.Instance.OpponentType != 2)
				{
					Singleton<ChallengeActivationUI>.Instance.ShowActivation(harderFinalBossChallenge.challengeType);
				}
			}

			[HarmonyPostfix]
			[HarmonyPatch(typeof(Opponent), "SpawnOpponent")]
			public static void AddToEncounter(ref Opponent __result)
			{
				//IL_0012: Unknown result type (might be due to invalid IL or missing references)
				//IL_0020: Unknown result type (might be due to invalid IL or missing references)
				//IL_0029: Unknown result type (might be due to invalid IL or missing references)
				//IL_002f: Invalid comparison between Unknown and I4
				//IL_0127: Unknown result type (might be due to invalid IL or missing references)
				//IL_012d: Invalid comparison between Unknown and I4
				//IL_0131: Unknown result type (might be due to invalid IL or missing references)
				//IL_0138: Invalid comparison between Unknown and I4
				if (!SaveFile.IsAscension || !AscensionSaveData.Data.ChallengeIsActive(harderFinalBossChallenge.challengeType) || (int)__result.OpponentType == 0 || (int)__result.OpponentType == 2)
				{
					return;
				}
				List<List<CardInfo>> turnPlan = __result.TurnPlan;
				int count = Singleton<BoardManager>.Instance.PlayerSlotsCopy.Count;
				if (turnPlan.Count <= 0)
				{
					return;
				}
				CardInfo cardByName = CardLoader.GetCardByName("SkeletonPirate");
				int num = ((turnPlan[0].Count >= 2) ? 1 : 0);
				Log.LogInfo((object)num);
				if (turnPlan[num].Count < count)
				{
					Log.LogInfo((object)"Adding Skeleton to turn plan...");
					turnPlan[num].Add(cardByName);
				}
				num++;
				if (turnPlan[num].Count < count)
				{
					Log.LogInfo((object)"Adding Undead Parrot to turn plan...");
					turnPlan[num].Add(CardLoader.GetCardByName("SkeletonParrot"));
				}
				if ((int)__result.OpponentType == 4 || (int)__result.OpponentType == 20)
				{
					num = ((turnPlan[0].Count >= count) ? 1 : 0);
					if (turnPlan[num].Count < count)
					{
						turnPlan[num].Add(CardLoader.GetCardByName("MoleSeaman"));
						Log.LogInfo((object)"Adding Mole Seaman to turn plan...");
					}
				}
			}

			[HarmonyPrefix]
			[HarmonyPatch(typeof(GiantShip), "MutinySequence")]
			public static bool MutinyChangePre()
			{
				//IL_000b: Unknown result type (might be due to invalid IL or missing references)
				if (AscensionSaveData.Data.ChallengeIsActive(harderFinalBossChallenge.challengeType))
				{
					return false;
				}
				return true;
			}

			[HarmonyPostfix]
			[HarmonyPatch(typeof(GiantShip), "MutinySequence")]
			public static IEnumerator MutinyChangePost(IEnumerator values)
			{
				if (!AscensionSaveData.Data.ChallengeIsActive(harderFinalBossChallenge.challengeType))
				{
					yield break;
				}
				int numSkeles = (Singleton<GiantShip>.Instance.nextHealthThreshold - ((SpecialCardBehaviour)Singleton<GiantShip>.Instance).PlayableCard.Health) / 5 + 1;
				for (int i = 0; i < Math.Min(numSkeles, 3); i++)
				{
					List<CardSlot> validSlots = Singleton<BoardManager>.Instance.PlayerSlotsCopy;
					validSlots.RemoveAll((CardSlot x) => (Object)(object)x.Card != (Object)null);
					if (validSlots.Count > 0)
					{
						Singleton<ViewManager>.Instance.SwitchToView((View)6, false, true);
						yield return (object)new WaitForSeconds(0.5f);
						? val = Singleton<CardRenderCamera>.Instance;
						RenderStatsLayer statsLayer = ((SpecialCardBehaviour)Singleton<GiantShip>.Instance).Card.StatsLayer;
						((Component)((CardRenderCamera)val).GetLiveRenderCamera((statsLayer is RenderLiveStatsLayer) ? statsLayer : null)).GetComponentInChildren<PirateShipAnimatedPortrait>().NextSkeletonJumpOverboard();
						yield return (object)new WaitForSeconds(1f);
						Singleton<ViewManager>.Instance.SwitchToView((View)4, false, false);
						CardSlot slot = validSlots[Random.Range(0, validSlots.Count)];
						yield return Singleton<BoardManager>.Instance.CreateCardInSlot(CardLoader.GetCardByName("bitty_WoodenBoard"), slot, 0.1f, true);
						yield return (object)new WaitForSeconds(0.2f);
						GiantShip instance = Singleton<GiantShip>.Instance;
						instance.skelesSpawned++;
					}
				}
				if (Singleton<GiantShip>.Instance.mutineesSinceDialogue > 1)
				{
					yield return (object)new WaitForSeconds(0.3f);
					yield return Singleton<TextDisplayer>.Instance.PlayDialogueEvent("PirateSkullShipMutinee", (MessageAdvanceMode)1, (EventIntersectMode)0, (string[])null, (Action<Line>)null);
					Singleton<GiantShip>.Instance.mutineesSinceDialogue = 0;
				}
				GiantShip instance2 = Singleton<GiantShip>.Instance;
				instance2.mutineesSinceDialogue++;
			}

			[HarmonyPostfix]
			[HarmonyPatch(typeof(PirateSkullBossOpponent), "StartPhase2")]
			public static IEnumerator RoyalPhase2(IEnumerator values)
			{
				yield return values;
				if (!AscensionSaveData.Data.ChallengeIsActive(harderFinalBossChallenge.challengeType))
				{
					yield break;
				}
				Singleton<ChallengeActivationUI>.Instance.ShowActivation(harderFinalBossChallenge.challengeType);
				_ = Singleton<BoardManager>.Instance.OpponentSlotsCopy;
				if (AscensionSaveData.Data.ChallengeIsActive(travelingOuroChallenge.challengeType))
				{
					Log.LogInfo((object)"Creating an Ouroboros...");
					CardInfo ouro = CardLoader.GetCardByName("bitty_TravelingOuroboros");
					CardModificationInfo mod = new CardModificationInfo();
					mod.fromCardMerge = true;
					mod.abilities.Add((Ability)8);
					for (int i = 1; i <= AscensionStatsData.GetStatValue((Type)2, false); i++)
					{
						Log.LogInfo((object)i);
						mod.abilities.Add(MiscEncounters.ValidAbilities(i).ability);
					}
					mod.attackAdjustment = MiscEncounters.TravelingOuroborosBuffs();
					mod.healthAdjustment = MiscEncounters.TravelingOuroborosBuffs();
					if (MiscEncounters.TravelingOuroborosBuffs() < AscensionStatsData.GetStatValue((Type)2, false))
					{
						mod.attackAdjustment = AscensionStatsData.GetStatValue((Type)2, false);
						mod.healthAdjustment = AscensionStatsData.GetStatValue((Type)2, false);
					}
					ouro.mods.Add(mod);
					List<CardSlot> opponentSlotsCopy2 = Singleton<BoardManager>.Instance.OpponentSlotsCopy;
					opponentSlotsCopy2.RemoveAll((CardSlot x) => Object.op_Implicit((Object)(object)Singleton<Opponent>.Instance.queuedCards.Find((PlayableCard y) => (Object)(object)y.QueuedSlot == (Object)(object)x)));
					if (opponentSlotsCopy2.Count >= 1)
					{
						yield return Singleton<Opponent>.Instance.QueueCard(ouro, opponentSlotsCopy2[0], true, true, true);
						yield return Singleton<TextDisplayer>.Instance.PlayDialogueEvent("RoyalOuro", (MessageAdvanceMode)1, (EventIntersectMode)0, (string[])null, (Action<Line>)null);
						Log.LogInfo((object)"Ouro Sequence Finished");
					}
				}
				else
				{
					yield return (object)new WaitForSeconds(0.4f);
					CardInfo mole = CardLoader.GetCardByName("MoleSeaman");
					CardModificationInfo mod2 = new CardModificationInfo();
					mod2.attackAdjustment = 1;
					mod2.healthAdjustment = 4;
					mod2.abilities.Add((Ability)34);
					mod2.nameReplacement = "Mole Firstmate";
					CardExtensions.AddAppearances(mole, (Appearance[])(object)new Appearance[1] { (Appearance)6 });
					mole.mods.Add(mod2);
					List<CardSlot> opponentSlotsCopy = Singleton<BoardManager>.Instance.OpponentSlotsCopy;
					opponentSlotsCopy.RemoveAll((CardSlot x) => Object.op_Implicit((Object)(object)Singleton<Opponent>.Instance.queuedCards.Find((PlayableCard y) => (Object)(object)y.QueuedSlot == (Object)(object)x)));
					if (opponentSlotsCopy.Count >= 1)
					{
						yield return Singleton<Opponent>.Instance.QueueCard(mole, opponentSlotsCopy[0], true, true, true);
						Log.LogInfo((object)"Playing animation");
						View oldView = Singleton<ViewManager>.Instance.CurrentView;
						Singleton<ViewManager>.Instance.SwitchToView((View)6, false, false);
						yield return Singleton<TextDisplayer>.Instance.PlayDialogueEvent("RoyalFirstMate", (MessageAdvanceMode)1, (EventIntersectMode)0, (string[])null, (Action<Line>)null);
						yield return (object)new WaitForSeconds(0.5f);
						Singleton<ViewManager>.Instance.SwitchToView(oldView, false, false);
					}
				}
				Log.LogInfo((object)"Phase 2 additions complete");
			}

			[HarmonyPostfix]
			[HarmonyPatch(typeof(Part1Opponent), "TryModifyCardWithTotem")]
			public static void RoyalTotem(PlayableCard card)
			{
				//IL_000b: Unknown result type (might be due to invalid IL or missing references)
				//IL_0034: Unknown result type (might be due to invalid IL or missing references)
				//IL_003b: Invalid comparison between Unknown and I4
				//IL_0053: Unknown result type (might be due to invalid IL or missing references)
				//IL_00a3: Unknown result type (might be due to invalid IL or missing references)
				//IL_00a8: Unknown result type (might be due to invalid IL or missing references)
				//IL_00c7: Unknown result type (might be due to invalid IL or missing references)
				//IL_00d2: Unknown result type (might be due to invalid IL or missing references)
				//IL_00de: Expected O, but got Unknown
				if (AscensionSaveData.Data.ChallengeIsActive(harderFinalBossChallenge.challengeType) && (Object)(object)Singleton<Part1Opponent>.Instance.totem != (Object)null && (int)((Opponent)Singleton<Part1Opponent>.Instance).OpponentType == 20)
				{
					((Card)card).StatsLayer.SetEmissionColor(Singleton<Part1Opponent>.Instance.InteractablesGlowColor);
					if (!card.TemporaryMods.Exists((CardModificationInfo x) => x.fromTotem) && !((Card)card).Info.HasTrait((Trait)16))
					{
						card.AddTemporaryMod(new CardModificationInfo
						{
							abilities = { ((Totem)Singleton<Part1Opponent>.Instance.totem).TotemItemData.bottom.effectParams.ability },
							fromTotem = true
						});
					}
				}
			}
		}

		public class StarterChallengesPatch
		{
			public static void Register(Harmony harmony)
			{
				harmony.PatchAll(typeof(StarterChallengesPatch));
			}

			[HarmonyPatch(typeof(RunIntroSequencer), "TryModifyStarterCards")]
			[HarmonyPostfix]
			public static void StartersPatch()
			{
				//IL_000b: Unknown result type (might be due to invalid IL or missing references)
				//IL_00b4: Unknown result type (might be due to invalid IL or missing references)
				//IL_016c: Unknown result type (might be due to invalid IL or missing references)
				//IL_023d: Unknown result type (might be due to invalid IL or missing references)
				//IL_02f5: Unknown result type (might be due to invalid IL or missing references)
				//IL_0060: Unknown result type (might be due to invalid IL or missing references)
				//IL_0067: Expected O, but got Unknown
				//IL_010e: Unknown result type (might be due to invalid IL or missing references)
				//IL_0113: Unknown result type (might be due to invalid IL or missing references)
				//IL_011a: Expected O, but got Unknown
				//IL_011c: Unknown result type (might be due to invalid IL or missing references)
				//IL_01c6: Unknown result type (might be due to invalid IL or missing references)
				//IL_01cd: Expected O, but got Unknown
				//IL_0297: Unknown result type (might be due to invalid IL or missing references)
				//IL_029c: Unknown result type (might be due to invalid IL or missing references)
				//IL_02a3: Expected O, but got Unknown
				//IL_02a5: Unknown result type (might be due to invalid IL or missing references)
				if (AscensionSaveData.Data.ChallengeIsActive(waterborneStarterChallenge.challengeType))
				{
					foreach (CardInfo card in ((CardCollectionInfo)RunState.Run.playerDeck).Cards)
					{
						if (!card.HasTrait((Trait)13))
						{
							Log.LogInfo((object)"Waterborne Check");
							CardModificationInfo val = new CardModificationInfo((Ability)13);
							if (!card.HasAbility((Ability)13))
							{
								RunState.Run.playerDeck.ModifyCard(card, val);
							}
						}
					}
				}
				if (AscensionSaveData.Data.ChallengeIsActive(shockedStarterChallenge.challengeType))
				{
					foreach (CardInfo card2 in ((CardCollectionInfo)RunState.Run.playerDeck).Cards)
					{
						if (!card2.HasTrait((Trait)13))
						{
							Log.LogInfo((object)"Paralysis Check");
							CardModificationInfo val2 = new CardModificationInfo(GiveParalysis.ability);
							if (!card2.HasAbility(GiveParalysis.ability))
							{
								RunState.Run.playerDeck.ModifyCard(card2, val2);
							}
						}
					}
				}
				if (AscensionSaveData.Data.ChallengeIsActive(weakStartersChallenge.challengeType))
				{
					foreach (CardInfo card3 in ((CardCollectionInfo)RunState.Run.playerDeck).Cards)
					{
						if (!card3.HasTrait((Trait)13))
						{
							Log.LogInfo((object)"Weak Check");
							CardModificationInfo val3 = new CardModificationInfo();
							val3.healthAdjustment = -1;
							if (card3.Health > 1)
							{
								val3.nameReplacement = "Weak " + card3.displayedName;
								RunState.Run.playerDeck.ModifyCard(card3, val3);
							}
						}
					}
				}
				if (AscensionSaveData.Data.ChallengeIsActive(weakSoulStarterChallenge.challengeType))
				{
					foreach (CardInfo card4 in ((CardCollectionInfo)RunState.Run.playerDeck).Cards)
					{
						if (!card4.HasTrait((Trait)13))
						{
							Log.LogInfo((object)"Weak Soul Check");
							CardModificationInfo val4 = new CardModificationInfo(GiveNoTransfer.ability);
							if (!card4.HasAbility(GiveNoTransfer.ability))
							{
								RunState.Run.playerDeck.ModifyCard(card4, val4);
							}
						}
					}
				}
				if (AscensionSaveData.Data.ChallengeIsActive(ascenderBaneChallenge.challengeType))
				{
					Log.LogInfo((object)"Ascender's Bane Check");
					((CardCollectionInfo)RunState.Run.playerDeck).AddCard(CardLoader.GetCardByName("bitty_Ascender's Bane"));
				}
			}

			[HarmonyPatch(typeof(RunIntroSequencer), "RunIntroSequence")]
			[HarmonyPostfix]
			public static IEnumerator StartersAnnouncer(IEnumerator values)
			{
				yield return values;
				bool dialoguePlayed = false;
				if (AscensionSaveData.Data.ChallengeIsActive(waterborneStarterChallenge.challengeType))
				{
					yield return (object)new WaitForSeconds(0.5f);
					Singleton<ChallengeActivationUI>.Instance.ShowActivation(waterborneStarterChallenge.challengeType);
					if (!dialoguePlayed && SaveFile.IsAscension && !DialogueEventsData.EventIsPlayed("WaterborneStart"))
					{
						dialoguePlayed = true;
						yield return (object)new WaitForSeconds(0.5f);
						yield return Singleton<TextDisplayer>.Instance.PlayDialogueEvent("WaterborneStart", (MessageAdvanceMode)1, (EventIntersectMode)0, (string[])null, (Action<Line>)null);
					}
				}
				if (AscensionSaveData.Data.ChallengeIsActive(shockedStarterChallenge.challengeType))
				{
					yield return (object)new WaitForSeconds(0.5f);
					Singleton<ChallengeActivationUI>.Instance.ShowActivation(shockedStarterChallenge.challengeType);
					if (!dialoguePlayed && SaveFile.IsAscension && !DialogueEventsData.EventIsPlayed("ShockedStart"))
					{
						dialoguePlayed = true;
						yield return (object)new WaitForSeconds(0.5f);
						yield return Singleton<TextDisplayer>.Instance.PlayDialogueEvent("ShockedStart", (MessageAdvanceMode)1, (EventIntersectMode)0, (string[])null, (Action<Line>)null);
					}
				}
				if (AscensionSaveData.Data.ChallengeIsActive(weakStartersChallenge.challengeType))
				{
					yield return (object)new WaitForSeconds(0.5f);
					Singleton<ChallengeActivationUI>.Instance.ShowActivation(weakStartersChallenge.challengeType);
					bool weakenedCards = false;
					foreach (CardInfo cardInfo in ((CardCollectionInfo)RunState.Run.playerDeck).Cards)
					{
						if (!cardInfo.HasTrait((Trait)13) && cardInfo.Health != cardInfo.baseHealth)
						{
							weakenedCards = true;
						}
					}
					if (!dialoguePlayed && !IsP03Run && SaveFile.IsAscension && !DialogueEventsData.EventIsPlayed("WeakStart") && weakenedCards)
					{
						dialoguePlayed = true;
						yield return (object)new WaitForSeconds(0.5f);
						yield return Singleton<TextDisplayer>.Instance.PlayDialogueEvent("WeakStart", (MessageAdvanceMode)1, (EventIntersectMode)0, (string[])null, (Action<Line>)null);
					}
					else if (!dialoguePlayed && IsP03Run && SaveFile.IsAscension && !DialogueEventsData.EventIsPlayed("P03WeakStart") && weakenedCards)
					{
						dialoguePlayed = true;
						yield return (object)new WaitForSeconds(0.5f);
						yield return Singleton<TextDisplayer>.Instance.PlayDialogueEvent("P03WeakStart", (MessageAdvanceMode)1, (EventIntersectMode)0, (string[])null, (Action<Line>)null);
					}
				}
				if (AscensionSaveData.Data.ChallengeIsActive(weakSoulStarterChallenge.challengeType))
				{
					yield return (object)new WaitForSeconds(0.5f);
					Singleton<ChallengeActivationUI>.Instance.ShowActivation(weakSoulStarterChallenge.challengeType);
					if (!dialoguePlayed && SaveFile.IsAscension && !DialogueEventsData.EventIsPlayed("WeakSoulStart"))
					{
						dialoguePlayed = true;
						yield return (object)new WaitForSeconds(0.5f);
						yield return Singleton<TextDisplayer>.Instance.PlayDialogueEvent("WeakSoulStart", (MessageAdvanceMode)1, (EventIntersectMode)0, (string[])null, (Action<Line>)null);
					}
				}
				if (AscensionSaveData.Data.ChallengeIsActive(ascenderBaneChallenge.challengeType))
				{
					yield return (object)new WaitForSeconds(0.5f);
					Singleton<ChallengeActivationUI>.Instance.ShowActivation(ascenderBaneChallenge.challengeType);
					if (!dialoguePlayed && SaveFile.IsAscension && !DialogueEventsData.EventIsPlayed("AscenderBaneStart"))
					{
						yield return (object)new WaitForSeconds(0.5f);
						yield return Singleton<TextDisplayer>.Instance.PlayDialogueEvent("AscenderBaneStart", (MessageAdvanceMode)1, (EventIntersectMode)0, (string[])null, (Action<Line>)null);
					}
				}
			}
		}

		public class EncounterAddPatches
		{
			public static void Register(Harmony harmony)
			{
				harmony.PatchAll(typeof(EncounterAddPatches));
			}

			[HarmonyPostfix]
			[HarmonyPatch(typeof(EncounterBuilder), "Build")]
			public static void AddToEncounter(ref EncounterData __result, CardBattleNodeData nodeData)
			{
				//IL_0013: Unknown result type (might be due to invalid IL or missing references)
				//IL_0253: Unknown result type (might be due to invalid IL or missing references)
				//IL_005e: Unknown result type (might be due to invalid IL or missing references)
				//IL_0065: Expected O, but got Unknown
				//IL_02fb: Unknown result type (might be due to invalid IL or missing references)
				//IL_0302: Expected O, but got Unknown
				//IL_00da: Unknown result type (might be due to invalid IL or missing references)
				List<List<CardInfo>> opponentTurnPlan = __result.opponentTurnPlan;
				if (AscensionSaveData.Data.ChallengeIsActive(travelingOuroChallenge.challengeType))
				{
					Log.LogInfo((object)"Checking to see if we should add Ouroboros...");
					if (MiscEncounters.RollForOuro(nodeData))
					{
						Log.LogInfo((object)"Creating an Ouroboros...");
						CardInfo cardByName = CardLoader.GetCardByName("bitty_TravelingOuroboros");
						CardModificationInfo val = new CardModificationInfo();
						if (IsP03Run)
						{
							cardByName.portraitTex = Tools.LoadSprite("portrait_ourobot.png");
							val.nameReplacement = "Ourobot";
						}
						val.abilities.Add((Ability)18);
						if (!IsP03Run)
						{
							val.fromCardMerge = true;
							for (int i = 1; i <= AscensionStatsData.GetStatValue((Type)2, false); i++)
							{
								Log.LogInfo((object)i);
								val.abilities.Add(MiscEncounters.ValidAbilities(i).ability);
							}
						}
						val.attackAdjustment = MiscEncounters.TravelingOuroborosBuffs();
						val.healthAdjustment = MiscEncounters.TravelingOuroborosBuffs();
						if (!IsP03Run && MiscEncounters.TravelingOuroborosBuffs() < AscensionStatsData.GetStatValue((Type)2, false))
						{
							val.attackAdjustment = AscensionStatsData.GetStatValue((Type)2, false);
							val.healthAdjustment = AscensionStatsData.GetStatValue((Type)2, false);
						}
						cardByName.mods.Add(val);
						Log.LogInfo((object)"Finding Ouro placement...");
						int num = ((IsP03Run && opponentTurnPlan[3].Count <= 1) ? 3 : (IsP03Run ? 4 : ((opponentTurnPlan[0].Count > 1) ? 1 : 0)));
						if (opponentTurnPlan[num].Count < Singleton<BoardManager>.Instance.PlayerSlotsCopy.Count)
						{
							Log.LogInfo((object)"Adding Ouro to turn plan...");
							opponentTurnPlan[num].Add(cardByName);
							Log.LogInfo((object)$"Added Ouroboros in turn {num}");
						}
					}
					else
					{
						Log.LogInfo((object)"Failed Ouro Roll...");
					}
				}
				if (!AscensionSaveData.Data.ChallengeIsActive(goldenSheepChallenge.challengeType))
				{
					return;
				}
				Log.LogInfo((object)"Golden Ram Challenge on...");
				Log.LogInfo((object)"Checking to see if we should add Golden Ram...");
				int currentRandomSeed = SaveManager.SaveFile.GetCurrentRandomSeed();
				bool flag = SeededRandom.Range(0, 3, currentRandomSeed) == 0;
				flag = true;
				Log.LogInfo((object)("Sheep Roll: " + flag));
				if (flag && MiscEncounters.TimesGoldenSheepKilled() < AscensionStatsData.GetStatValue((Type)2, false))
				{
					Log.LogInfo((object)"Creating a Golden Ram...");
					CardInfo cardByName2 = CardLoader.GetCardByName("bitty_GoldenSheep");
					CardModificationInfo val2 = new CardModificationInfo();
					val2.healthAdjustment += AscensionStatsData.GetStatValue((Type)2, false);
					cardByName2.mods.Add(val2);
					Log.LogInfo((object)"Finding Golden Ram placement...");
					int index = ((opponentTurnPlan[0].Count > 1) ? 1 : 0);
					if (opponentTurnPlan[index].Count < Singleton<BoardManager>.Instance.PlayerSlotsCopy.Count)
					{
						Log.LogInfo((object)"Adding Gold Ram to turn plan...");
						opponentTurnPlan[index].Add(cardByName2);
						Log.LogInfo((object)("added gold ram to " + index));
					}
				}
				else
				{
					Log.LogInfo((object)"Failed Roll...");
				}
			}
		}

		public class BotchedPatch
		{
			public static void Register(Harmony harmony)
			{
				harmony.PatchAll(typeof(BotchedPatch));
			}

			[HarmonyPatch(typeof(DuplicateMergeSequencer), "MergeCards")]
			[HarmonyPostfix]
			public static CardInfo MycoPatch(CardInfo card1)
			{
				//IL_000b: 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_0025: Expected O, but got Unknown
				//IL_00d4: Unknown result type (might be due to invalid IL or missing references)
				//IL_01c0: Unknown result type (might be due to invalid IL or missing references)
				if (AscensionSaveData.Data.ChallengeIsActive(mycoChallenge.challengeType))
				{
					bool flag = false;
					CardModificationInfo val = new CardModificationInfo();
					int currentRandomSeed = SaveManager.SaveFile.GetCurrentRandomSeed();
					float num = SeededRandom.Value(currentRandomSeed++);
					if (num < 0.33f && card1.Mods.Exists((CardModificationInfo x) => x.abilities.Count > 0))
					{
						List<CardModificationInfo> list = card1.Mods.FindAll((CardModificationInfo x) => x.abilities.Count > 0);
						list[SeededRandom.Range(0, list.Count, currentRandomSeed++)].abilities[0] = ValidMycoAbilities(1).ability;
						flag = true;
						((MonoBehaviour)Singleton<TextDisplayer>.Instance).StartCoroutine(Singleton<TextDisplayer>.Instance.PlayDialogueEvent("MycoFailSigils", (MessageAdvanceMode)1, (EventIntersectMode)0, (string[])null, (Action<Line>)null));
					}
					else if (num < 0.66f && card1.Attack > 0)
					{
						int num2 = card1.Attack / 2;
						val.attackAdjustment = -num2;
						flag = true;
						((MonoBehaviour)Singleton<TextDisplayer>.Instance).StartCoroutine(Singleton<TextDisplayer>.Instance.PlayDialogueEvent("MycoFailAttack", (MessageAdvanceMode)1, (EventIntersectMode)0, (string[])null, (Action<Line>)null));
					}
					else if (card1.Health > 1)
					{
						int num3 = card1.Health / 2;
						val.healthAdjustment = -num3;
						flag = true;
						((MonoBehaviour)Singleton<TextDisplayer>.Instance).StartCoroutine(Singleton<TextDisplayer>.Instance.PlayDialogueEvent("MycoFailHealth", (MessageAdvanceMode)1, (EventIntersectMode)0, (string[])null, (Action<Line>)null));
					}
					RunState.Run.playerDeck.ModifyCard(card1, val);
					if (flag)
					{
						Singleton<ChallengeActivationUI>.Instance.ShowActivation(mycoChallenge.challengeType);
						flag = false;
					}
				}
				return card1;
			}

			public static AbilityInfo ValidMycoAbilities(int plus)
			{
				//IL_0052: Unknown result type (might be due to invalid IL or missing references)
				List<AbilityInfo> list = ScriptableObjectLoader<AbilityInfo>.AllData.FindAll((AbilityInfo x) => (int)x.ability == 102 || (int)x.ability == 16 || x.ability == GiveStrafePull.ability || x.ability == GiveStrafeSticky.ability || (int)x.ability == 104 || (int)x.ability == 8 || (int)x.ability == 12 || (int)x.ability == 13 || (int)x.ability == 18 || (int)x.ability == 23 || (int)x.ability == 19 || (int)x.ability == 31 || x.ability == GiveFragile.ability || (int)x.ability == 105 || (int)x.ability == 76 || (int)x.ability == 101 || (int)x.ability == 28 || (int)x.ability == 35);
				int currentRandomSeed = SaveManager.SaveFile.GetCurrentRandomSeed();
				AbilityInfo val = list[SeededRandom.Range(0, list.Count, currentRandomSeed + plus)];
				Log.LogInfo((object)val.ability);
				return val;
			}
		}

		public class SideDeckPatch
		{
			public static void Register(Harmony harmony)
			{
				harmony.PatchAll(typeof(SideDeckPatch));
			}

			[HarmonyPatch(typeof(CardDrawPiles3D), "InitializePiles")]
			[HarmonyPostfix]
			public static void AbundanceFaminePatch()
			{
				//IL_000b: Unknown result type (might be due to invalid IL or missing references)
				//IL_0021: Unknown result type (might be due to invalid IL or missing references)
				//IL_0057: Unknown result type (might be due to invalid IL or missing references)
				//IL_0086: Unknown result type (might be due to invalid IL or missing references)
				//IL_00f1: Unknown result type (might be due to invalid IL or missing references)
				//IL_0195: Unknown result type (might be due to invalid IL or missing references)
				//IL_0221: Unknown result type (might be due to invalid IL or missing references)
				//IL_028f: Unknown result type (might be due to invalid IL or missing references)
				//IL_02ee: Unknown result type (might be due to invalid IL or missing references)
				//IL_0368: Unknown result type (might be due to invalid IL or missing references)
				if (AscensionSaveData.Data.ChallengeIsActive(famineChallenge.challengeType) || AscensionSaveData.Data.ChallengeIsActive(abundanceChallenge.challengeType))
				{
					int num = 0;
					int num2 = 0;
					for (int i = 0; i < AscensionSaveData.Data.GetNumChallengesOfTypeActive(famineChallenge.challengeType); i++)
					{
						num++;
					}
					for (int j = 0; j < AscensionSaveData.Data.GetNumChallengesOfTypeActive(abundanceChallenge.challengeType); j++)
					{
						num2++;
					}
					Log.LogInfo((object)("Famine Severity: " + num * famineRemoval.Value));
					Log.LogInfo((object)("Abundance Quality: " + num2 * abundanceQuality.Value));
					ChallengeActivationUI.TryShowActivation(abundanceChallenge.challengeType);
					CardInfo val = ((Singleton<CardDrawPiles3D>.Instance.SideDeck.cards.Count > 0) ? Singleton<CardDrawPiles3D>.Instance.SideDeck.cards[0] : CardLoader.GetCardByName("Bee"));
					Log.LogInfo((object)val.displayedName);
					for (int k = 0; k < num2 * abundanceQuality.Value; k++)
					{
						Singleton<CardDrawPiles3D>.Instance.sidePile.CreateCards(1, 15f);
						Singleton<CardDrawPiles3D>.Instance.SideDeck.AddCard(val);
					}
					ChallengeActivationUI.TryShowActivation(famineChallenge.challengeType);
					for (int l = 0; l < Math.Min(10, num * famineRemoval.Value); l++)
					{
						CardDrawPiles3D.Instance.SidePile.Draw();
						CardDrawPiles3D.Instance.SideDeck.Draw();
					}
					Log.LogInfo((object)("Total cards in side deck: " + CardDrawPiles3D.Instance.SideDeck.CardsInDeck));
					if (AscensionSaveData.Data.ChallengeIsActive(famineChallenge.challengeType) && !DialogueEventsData.EventIsPlayed("P03FamineIntro") && IsP03Run)
					{
						((MonoBehaviour)Singleton<CardDrawPiles3D>.Instance).StartCoroutine(Singleton<TextDisplayer>.Instance.PlayDialogueEvent("P03FamineIntro", (MessageAdvanceMode)1, (EventIntersectMode)0, new string[1] { val.displayedName }, (Action<Line>)global::Dialogue.Dialogue.P03HappyCloseUp));
					}
					else if (AscensionSaveData.Data.ChallengeIsActive(famineChallenge.challengeType) && !DialogueEventsData.EventIsPlayed("FamineIntro"))
					{
						((MonoBehaviour)Singleton<CardDrawPiles3D>.Instance).StartCoroutine(Singleton<TextDisplayer>.Instance.PlayDialogueEvent("FamineIntro", (MessageAdvanceMode)1, (EventIntersectMode)0, new string[1] { val.displayedName }, (Action<Line>)null));
					}
					else if (AscensionSaveData.Data.ChallengeIsActive(abundanceChallenge.challengeType) && !DialogueEventsData.EventIsPlayed("P03AbundanceIntro") && IsP03Run)
					{
						((MonoBehaviour)Singleton<CardDrawPiles3D>.Instance).StartCoroutine(Singleton<TextDisplayer>.Instance.PlayDialogueEvent("P03AbundanceIntro", (MessageAdvanceMode)1, (EventIntersectMode)0, new string[1] { (num2 * abundanceQuality.Value).ToString() }, (Action<Line>)global::Dialogue.Dialogue.P03HappyCloseUp));
					}
					else if (AscensionSaveData.Data.ChallengeIsActive(abundanceChallenge.challengeType) && !DialogueEventsData.EventIsPlayed("AbundanceIntro"))
					{
						((MonoBehaviour)Singleton<CardDrawPiles3D>.Instance).StartCoroutine(Singleton<TextDisplayer>.Instance.PlayDialogueEvent("AbundanceIntro", (MessageAdvanceMode)1, (EventIntersectMode)0, new string[1] { val.displayedName }, (Action<Line>)null));
					}
				}
			}
		}

		public class SprinterDraw
		{
			public static void Register(Harmony harmony)
			{
				harmony.PatchAll(typeof(SprinterDraw));
			}

			[HarmonyPatch(typeof(PlayerHand), "AddCardToHand")]
			[HarmonyPostfix]
			public static void SprinterHandPatch(ref PlayableCard card)
			{
				//IL_000b: Unknown result type (might be due to invalid IL or missing references)
				//IL_0027: Unknown result type (might be due to invalid IL or missing references)
				//IL_0032: Unknown result type (might be due to invalid IL or missing references)
				//IL_0038: Expected O, but got Unknown
				//IL_0056: Unknown result type (might be due to invalid IL or missing references)
				//IL_00c7: Unknown result type (might be due to invalid IL or missing references)
				if (AscensionSaveData.Data.ChallengeIsActive(sprinterChallenge.challengeType))
				{
					Singleton<ChallengeActivationUI>.Instance.ShowActivation(sprinterChallenge.challengeType);
					CardModificationInfo val = new CardModificationInfo();
					if (!IsP03Run)
					{
						val.fromCardMerge = true;
					}
					val.abilities.Add(GetRandomStrafe().ability);
					if (!IsP03Run || CardExtensions.AllAbilities(card).Count() <= 4)
					{
						card.AddTemporaryMod(val);
					}
					if (!IsP03Run && !CardDisplayer3D.EmissionEnabledForCard(((Card)card).renderInfo, card))
					{
						((Card)card).RenderInfo.forceEmissivePortrait = true;
						((Card)card).StatsLayer.SetEmissionColor(GameColors.Instance.lightPurple);
					}
					((Card)card).RenderCard();
				}
			}

			public static AbilityInfo GetRandomStrafe()
			{
				List<AbilityInfo> list = ScriptableObjectLoader<AbilityInfo>.AllData.FindAll((AbilityInfo x) => (int)x.ability == 102 || (int)x.ability == 16 || (int)x.ability == 3 || (int)x.ability == 88 || x.ability == GiveStrafeSticky.ability || x.ability == GiveWarper.ability || x.ability == GiveStrafePull.ability || x.ability == GiveStrafeSuper.ability);
				return list[Random.Range(0, list.Count)];
			}
		}

		public class NoFecundityNerf
		{
			public static void Register(Harmony harmony)
			{
				harmony.PatchAll(typeof(NoFecundityNerf));
			}

			[HarmonyPatch(typeof(DrawCopy))]
			[HarmonyPatch(/*Could not decode attribute arguments.*/)]
			[HarmonyPostfix]
			private static void Postfix(ref List<CardModificationInfo> __result)
			{
				//IL_0012: Unknown result type (might be due to invalid IL or missing references)
				if (SaveFile.IsAscension && AscensionSaveData.Data.ChallengeIsActive(oldFecundChallenge.challengeType))
				{
					__result = null;
				}
			}

			[HarmonyPostfix]
			[HarmonyPatch(typeof(DrawCopy), "OnResolveOnBoard")]
			public static IEnumerator UnNerfDialogue(IEnumerator values)
			{
				yield return values;
				if (SaveFile.IsAscension && AscensionSaveData.Data.ChallengeIsActive(oldFecundChallenge.challengeType) && (!DialogueEventsData.EventIsPlayed("P03FecundityUnNerfIntro") || !DialogueEventsData.EventIsPlayed("FecundityUnNerfIntro")))
				{
					Singleton<ChallengeActivationUI>.Instance.ShowTextLines(new string[3]
					{
						Localization.Translate("DEPLOY SIGIL UNNERF: FECUNDITY"),
						Localization.Translate("AddSigilToCopy()"),
						Localization.Translate("// It was asked for.")
					});
					yield return (object)new WaitForSeconds(0.5f);
					if (IsP03Run && !DialogueEventsData.EventIsPlayed("P03FecundityUnNerfIntro"))
					{
						yield return Singleton<TextDisplayer>.Instance.PlayDialogueEvent("P03FecundityUnNerfIntro", (MessageAdvanceMode)1, (EventIntersectMode)0, (string[])null, (Action<Line>)global::Dialogue.Dialogue.P03HappyCloseUp);
					}
					else if (!IsP03Run && !DialogueEventsData.EventIsPlayed("FecundityUnNerfIntro"))
					{
						yield return Singleton<TextDisplayer>.Instance.PlayDialogueEvent("FecundityUnNerfIntro", (MessageAdvanceMode)1, (EventIntersectMode)0, (string[])null, (Action<Line>)null);
					}
				}
			}
		}

		public class HarderBosses
		{
			public static void Register(Harmony harmony)
			{
				harmony.PatchAll(typeof(HarderBosses));
			}

			[HarmonyPostfix]
			[HarmonyPatch(typeof(TurnManager), "SetupPhase")]
			public static void ChallengeActivations()
			{
				//IL_0012: 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_004c: 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_0035: Invalid comparison between Unknown and I4
				if (SaveFile.IsAscension && AscensionSaveData.Data.ChallengeIsActive(harderBossesChallenge.challengeType) && (int)Singleton<Opponent>.Instance.OpponentType != 0 && (int)Singleton<Opponent>.Instance.OpponentType != 2)
				{
					Singleton<ChallengeActivationUI>.Instance.ShowActivation(harderBossesChallenge.challengeType);
				}
			}

			[HarmonyPostfix]
			[HarmonyPatch(typeof(TradeCardsForPelts), "TradePhase")]
			public static IEnumerator PostTradePlayQueueCards(IEnumerator values)
			{
				yield return values;
				if (SaveFile.IsAscension && AscensionSaveData.Data.ChallengeIsActive(harderBossesChallenge.challengeType))
				{
					Singleton<ChallengeActivationUI>.Instance.ShowActivation(harderBossesChallenge.challengeType);
					yield return Singleton<TurnManager>.Instance.opponent.PlayCardsInQueue(0.1f);
				}
			}

			[HarmonyPostfix]
			[HarmonyPatch(typeof(Part1Opponent), "TryModifyCardWithTotem")]
			public static void AddToSignatures(PlayableCard card)
			{
				//IL_0006: Unknown result type (might be due to invalid IL or missing references)
				//IL_000b: Unknown result type (might be due to invalid IL or missing references)
				//IL_0016: Unknown result type (might be due to invalid IL or missing references)
				//IL_0022: Unknown result type (might be due to invalid IL or missing references)
				//IL_0025: Unknown result type (might be due to invalid IL or missing references)
				//IL_0027: Invalid comparison between Unknown and I4
				//IL_0037: Unknown result type (might be due to invalid IL or missing references)
				//IL_0039: Invalid comparison between Unknown and I4
				//IL_0129: Unknown result type (might be due to invalid IL or missing references)
				//IL_012b: Invalid comparison between Unknown and I4
				//IL_01d5: Unknown result type (might be due to invalid IL or missing references)
				//IL_01d7: Invalid comparison between Unknown and I4
				//IL_006d: Unknown result type (might be due to invalid IL or missing references)
				//IL_0074: Expected O, but got Unknown
				//IL_02cc: Unknown result type (might be due to invalid IL or missing references)
				//IL_02ce: Invalid comparison between Unknown and I4
				//IL_0163: Unknown result type (might be due to invalid IL or missing references)
				//IL_016a: Expected O, but got Unknown
				//IL_00b9: Unknown result type (might be due to invalid IL or missing references)
				//IL_00c0: Expected O, but got Unknown
				//IL_03c4: Unknown result type (might be due to invalid IL or missing references)
				//IL_03c7: Invalid comparison between Unknown and I4
				//IL_020f: Unknown result type (might be due to invalid IL or missing references)
				//IL_0216: Expected O, but got Unknown
				//IL_01af: Unknown result type (might be due to invalid IL or missing references)
				//IL_01b6: Expected O, but got Unknown
				//IL_0104: Unknown result type (might be due to invalid IL or missing references)
				//IL_010b: Expected O, but got Unknown
				//IL_0306: Unknown result type (might be due to invalid IL or missing references)
				//IL_030d: Expected O, but got Unknown
				//IL_025b: Unknown result type (might be due to invalid IL or missing references)
				//IL_0262: Expected O, but got Unknown
				//IL_03ff: Unknown result type (might be due to invalid IL or missing references)
				//IL_0406: Expected O, but got Unknown
				//IL_0352: Unknown result type (might be due to invalid IL or missing references)
				//IL_0359: Expected O, but got Unknown
				//IL_02a6: Unknown result type (might be due to invalid IL or missing references)
				//IL_02ad: Expected O, but got Unknown
				//IL_044b: Unknown result type (might be due to invalid IL or missing references)
				//IL_0452: Expected O, but got Unknown
				//IL_039e: Unknown result type (might be due to invalid IL or missing references)
				//IL_03a5: Expected O, but got Unknown
				//IL_0496: Unknown result type (might be due to invalid IL or missing references)
				//IL_049d: Expected O, but got Unknown
				//IL_04f9: Unknown result type (might be due to invalid IL or missing references)
				//IL_0500: Expected O, but got Unknown
				Type opponentType = ((Opponent)Singleton<Part1Opponent>.Instance).OpponentType;
				if (!AscensionSaveData.Data.ChallengeIsActive(harderBossesChallenge.challengeType) || (int)opponentType == 0 || (int)opponentType == 2)
				{
					return;
				}
				if ((int)opponentType == 3)
				{
					if (((Object)((Card)card).Info).name == "Mule")
					{
						Log.LogInfo((object)"Mule Check");
						CardModificationInfo val = new CardModificationInfo();
						val.abilities.Add((Ability)62);
						ApplyMods(val, card);
					}
					if (((Object)((Card)card).Info).name == "Bloodhound")
					{
						Log.LogInfo((object)"Bloodhound Check");
						CardModificationInfo val2 = new CardModificationInfo();
						val2.abilities.Add((Ability)4);
						ApplyMods(val2, card);
					}
					if (((Object)((Card)card).Info).name == "Coyote")
					{
						Log.LogInfo((object)"Coyote Check");
						CardModificationInfo val3 = new CardModificationInfo();
						val3.abilities.Add((Ability)4);
						ApplyMods(val3, card);
					}
				}
				else if ((int)opponentType == 4)
				{
					if (((Object)((Card)card).Info).name == "Kingfisher")
					{
						Log.LogInfo((object)"Kingfisher Check");
						CardModificationInfo val4 = new CardModificationInfo();
						val4.abilities.Add((Ability)34);
						ApplyMods(val4, card);
					}
					if (((Object)((Card)card).Info).name == "BaitBucket")
					{
						Log.LogInfo((object)"BaitBucket Check");
						CardModificationInfo val5 = new CardModificationInfo();
						val5.abilities.Add((Ability)23);
						ApplyMods(val5, card);
					}
				}
				else if ((int)opponentType == 6)
				{
					if (((Object)((Card)card).Info).name == "Bullfrog")
					{
						Log.LogInfo((object)"Bullfrog Check");
						CardModificationInfo val6 = new CardModificationInfo();
						val6.abilities.Add((Ability)30);
						ApplyMods(val6, card);
					}
					if (((Object)((Card)card).Info).name == "Rabbit")
					{
						Log.LogInfo((object)"Rabbit Check");
						CardModificationInfo val7 = new CardModificationInfo();
						val7.abilities.Add((Ability)8);
						ApplyMods(val7, card);
					}
					if (((Object)((Card)card).Info).name == "TrapFrog")
					{
						Log.LogInfo((object)"TrapFrog Check");
						CardModificationInfo val8 = new CardModificationInfo();
						val8.abilities.Add((Ability)18);
						ApplyMods(val8, card);
					}
				}
				else if ((int)opponentType == 7)
				{
					if (((Object)((Card)card).Info).name == "Amalgam")
					{
						Log.LogInfo((object)"Amalgam Check");
						CardModificationInfo val9 = new CardModificationInfo();
						val9.abilities.Add((Ability)15);
						ApplyMods(val9, card);
					}
					if (((Object)((Card)card).Info).name == "MantisGod")
					{
						Log.LogInfo((object)"MantisGod Check");
						CardModificationInfo val10 = new CardModificationInfo();
						val10.abilities.Add((Ability)24);
						ApplyMods(val10, card);
					}
					if (((Object)((Card)card).Info).name == "Mantis")
					{
						Log.LogInfo((object)"Mantis Check");
						CardModificationInfo val11 = new CardModificationInfo();
						val11.abilities.Add((Ability)100);
						ApplyMods(val11, card);
					}
				}
				else if ((int)opponentType == 20)
				{
					if (((Object)((Card)card).Info).name == "MoleSeaman")
					{
						Log.LogInfo((object)"MoleSeaman Check");
						CardModificationInfo val12 = new CardModificationInfo();
						val12.abilities.Add((Ability)47);
						ApplyMods(val12, card);
					}
					if (((Object)((Card)card).Info).name == "SkeletonPirate")
					{
						Log.LogInfo((object)"SkeletonPirate Check");
						CardModificationInfo val13 = new CardModificationInfo();
						val13.abilities.Add((Ability)4);
						ApplyMods(val13, card);
					}
					if (((Object)((Card)card).Info).name == "SkeletonParrot")
					{
						Log.LogInfo((object)"SkeletonParrot Check");
						CardModificationInfo val14 = new CardModificationInfo();
						val14.abilities.Add((Ability)26);
						CardExtensions.SetIceCube(((Card)card).Info, CardLoader.GetCardByName("Maggots"), (IEnumerable<CardModificationInfo>)null);
						ApplyMods(val14, card);
					}
					if (((Object)((Card)card).Info).name == "Maggots")
					{
						Log.LogInfo((object)"Maggots Check");
						CardModificationInfo val15 = new CardModificationInfo();
						val15.abilities.Add((Ability)35);
						ApplyMods(val15, card);
					}
				}
			}

			public static void ApplyMods(CardModificationInfo mod, PlayableCard card)
			{
				//IL_004b: Unknown result type (might be due to invalid IL or missing references)
				Log.LogInfo((object)"Adding Mods...");
				mod.fromCardMerge = true;
				card.AddTemporaryMod(mod);
				if (!CardDisplayer3D.EmissionEnabledForCard(((Card)card).renderInfo, card))
				{
					((Card)card).RenderInfo.forceEmissivePortrait = true;
					((Card)card).StatsLayer.SetEmissionColor(GameColors.Instance.nearWhite);
				}
				((Card)card).RenderCard();
			}
		}

		public class InfiniteLives
		{
			public static void Register(Harmony harmony)
			{
				harmony.PatchAll(typeof(InfiniteLives));
			}

			[HarmonyPostfix]
			[HarmonyPatch(typeof(LifeManager), "ShowDamageSequence")]
			public static IEnumerator GiveLife(IEnumerator values)
			{
				yield return values;
				if (!SaveFile.IsAscension || !AscensionSaveData.Data.ChallengeIsActive(infiniteLivesChallenge.challengeType) || Singleton<LifeManager>.Instance.Balance > -5)
				{
					yield break;
				}
				Singleton<ChallengeActivationUI>.Instance.ShowActivation(infiniteLivesChallenge.challengeType);
				LifeRepeatsIncrease();
				yield return Singleton<LifeManager>.Instance.ShowResetSequence();
				if (LifeRepeats() < Math.Max(0, allowedResets.Value))
				{
					if (!DialogueEventsData.EventIsPlayed("InfiniteLivesIntro"))
					{
						yield return Singleton<TextDisplayer>.Instance.PlayDialogueEvent("InfiniteLivesIntro", (MessageAdvanceMode)1, (EventIntersectMode)0, (string[])null, (Action<Line>)null);
					}
					else if ((int)Singleton<Opponent>.Instance.OpponentType == 20)
					{
						yield return Singleton<TextDisplayer>.Instance.PlayDialogueEvent("InfiniteLivesRoyal", (MessageAdvanceMode)1, (EventIntersectMode)0, (string[])null, (Action<Line>)null);
					}
					else
					{
						yield return Singleton<TextDisplayer>.Instance.PlayDialogueEvent("InfiniteLivesRepeat", (MessageAdvanceMode)1, (EventIntersectMode)0, (string[])null, (Action<Line>)null);
					}
				}
				else if (LifeRepeats() == Math.Max(0, allowedResets.Value))
				{
					yield return Singleton<TextDisplayer>.Instance.PlayDialogueEvent("InfiniteLivesLoop", (MessageAdvanceMode)1, (EventIntersectMode)0, (string[])null, (Action<Line>)null);
				}
				else
				{
					yield return Singleton<TextDisplayer>.Instance.PlayDialogueEvent("InfiniteLivesLoopBreak", (MessageAdvanceMode)1, (EventIntersectMode)0, (string[])null, (Action<Line>)null);
					Singleton<LifeManager>.Instance.SetNumWeightsImmediate(5, 0);
					LifeRepeatsReset();
				}
			}

			public static int LifeRepeats()
			{
				return ModdedSaveManager.RunState.GetValueAsInt("bitty45.inscryption.challenges", "BittysChallenges.LifeRepeats");
			}

			public static void LifeRepeatsIncrease(int by = 1)
			{
				int num = ModdedSaveManager.RunState.GetValueAsInt("bitty45.inscryption.challenges", "BittysChallenges.LifeRepeats") + by;
				Log.LogInfo((object)$"Increasing LifeResets by {by} to {num}");
				ModdedSaveManager.RunState.SetValue("bitty45.inscryption.challenges", "BittysChallenges.LifeRepeats", (object)num.ToString());
			}

			public static void LifeRepeatsReset(int num = 0)
			{
				Log.LogInfo((object)string.Format("Setting LifeResets to ", num));
				ModdedSaveManager.RunState.SetValue("bitty45.inscryption.challenges", "BittysChallenges.LifeRepeats", (object)num.ToString());
			}
		}

		public class ReverseScales
		{
			public static void Register(Harmony harmony)
			{
				harmony.PatchAll(typeof(ReverseScales));
			}

			[HarmonyPostfix]
			[HarmonyPatch(typeof(TurnManager), "SetupPhase")]
			public static IEnumerator TipScale(IEnumerator values)
			{
				yield return values;
				if (AscensionSaveData.Data.ChallengeIsActive(reverseScalesChallenge.challengeType))
				{
					Singleton<ChallengeActivationUI>.Instance.ShowActivation(reverseScalesChallenge.challengeType);
					yield return Singleton<LifeManager>.Instance.ShowDamageSequence(1, 1, false, 0.125f, (GameObject)null, 0f, false);
				}
			}
		}

		public class Environment
		{
			public static List<Type> allEnvironmentBoons = new List<Type>
			{
				ChallengeBoonCliffs.boo,
				ChallengeBoonFlashGrowth.boo,
				ChallengeBoonTotem.boo,
				ChallengeBoonMud.boo,
				ChallengeBoonHail.boo,
				ChallengeBoonBreeze.boo,
				ChallengeBoonGraveyard.boo,
				ChallengeBoonDynamite.boo,
				ChallengeBoonBait.boo,
				ChallengeBoonTrap.boo,
				ChallengeBoonObelisk.boo,
				ChallengeBoonMushrooms.boo,
				ChallengeBoonBloodMoon.boo,
				ChallengeBoonMinicello.boo,
				ChallengeBoonCarrotPatch.boo,
				ChallengeBoonDarkForest.boo,
				ChallengeBoonFlood.boo,
				ChallengeBoonBlizzard.boo,
				ChallengeBoonConveyor.boo,
				ChallengeBoonGemSanctuary.boo,
				ChallengeBoonElectricStorm.boo
			};

			public static void Register(Harmony harmony)
			{
				harmony.PatchAll(typeof(Environment));
			}

			public static int EnvironmentNumber()
			{
				Log.LogInfo((object)ModdedSaveManager.RunState.GetValueAsInt("bitty45.inscryption.challenges", "BittysChallenges.EnvironmentNumber"));
				return ModdedSaveManager.RunState.GetValueAsInt("bitty45.inscryption.challenges", "BittysChallenges.EnvironmentNumber");
			}

			public static void ResetEnviroNumber(int value = 0)
			{
				Log.LogInfo((object)$"Resetting Environment Number to {value}");
				ModdedSaveManager.RunState.SetValue("bitty45.inscryption.challenges", "BittysChallenges.EnvironmentNumber", (object)value);
			}

			public static void IncreaseEnviroNumber(int by = 1)
			{
				int num = ModdedSaveManager.RunState.GetValueAsInt("bitty45.inscryption.challenges", "BittysChallenges.EnvironmentNumber") + by;
				Log.LogInfo((object)$"Increasing Environment Number by {by} to {num}");
				ModdedSaveManager.RunState.SetValue("bitty45.inscryption.challenges", "BittysChallenges.EnvironmentNumber", (object)num.ToString());
				Log.LogInfo((object)EnvironmentNumber());
			}

			[HarmonyPatch(/*Could not decode attribute arguments.*/)]
			[HarmonyPostfix]
			public static void OverrideBoonsEnabled(BoonsHandler __instance, ref bool __result)
			{
				//IL_000b: Unknown result type (might be due to invalid IL or missing references)
				if (AscensionSaveData.Data.ChallengeIsActive(environmentChallenge.challengeType))
				{
					__result = true;
				}
			}

			[HarmonyPatch(typeof(TurnManager), "SetupPhase")]
			[HarmonyPrefix]
			public static bool EnvironmentBoonGiver(ref IEnumerator __result)
			{
				//IL_0006: Unknown result type (might be due to invalid IL or missing references)
				//IL_000b: Unknown result type (might be due to invalid IL or missing references)
				//IL_0016: Unknown result type (might be due to invalid IL or missing references)
				//IL_0022: Unknown result type (might be due to invalid IL or missing references)
				//IL_0025: Unknown result type (might be due to invalid IL or missing references)
				//IL_0027: Invalid comparison between Unknown and I4
				//IL_05b6: Unknown result type (might be due to invalid IL or missing references)
				//IL_05e7: Unknown result type (might be due to invalid IL or missing references)
				//IL_0618: Unknown result type (might be due to invalid IL or missing references)
				//IL_0649: Unknown result type (might be due to invalid IL or missing references)
				//IL_067a: Unknown result type (might be due to invalid IL or missing references)
				//IL_0095: Unknown result type (might be due to invalid IL or missing references)
				//IL_01e6: Unknown result type (might be due to invalid IL or missing references)
				//IL_0217: Unknown result type (might be due to invalid IL or missing references)
				//IL_0248: 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_0367: Unknown result type (might be due to invalid IL or missing references)
				//IL_0398: Unknown result type (might be due to invalid IL or missing references)
				//IL_02b8: Unknown result type (might be due to invalid IL or missing references)
				//IL_0168: Unknown result type (might be due to invalid IL or missing references)
				//IL_06e9: Unknown result type (might be due to invalid IL or missing references)
				//IL_0700: Unknown result type (might be due to invalid IL or missing references)
				//IL_0705: Unknown result type (might be due to invalid IL or missing references)
				//IL_03dc: Unknown result type (might be due to invalid IL or missing references)
				//IL_02eb: Unknown result type (might be due to invalid IL or missing references)
				//IL_019b: Unknown result type (might be due to invalid IL or missing references)
				//IL_031e: Unknown result type (might be due to invalid IL or missing references)
				//IL_0481: Unknown result type (might be due to invalid IL or missing references)
				//IL_0446: Unknown result type (might be due to invalid IL or missing references)
				//IL_04a4: Unknown result type (might be due to invalid IL or missing references)
				//IL_0515: Unknown result type (might be due to invalid IL or missing references)
				//IL_0548: Unknown result type (might be due to invalid IL or missing references)
				//IL_057b: Unknown result type (might be due to invalid IL or missing references)
				Type opponentType = Singleton<Opponent>.Instance.OpponentType;
				if (AscensionSaveData.Data.ChallengeIsActive(environmentChallenge.challengeType) && ((int)opponentType == 0 || (int)opponentType == 2))
				{
					ClearEnvironmentBoons();
					IncreaseEnviroNumber();
					List<Type> list = new List<Type>();
					if (!IsP03Run)
					{
						Log.LogInfo((object)("Region Tier: " + RunState.CurrentRegionTier));
						if (RunState.CurrentRegionTier >= 0)
						{
							list.Add(ChallengeBoonCliffs.boo);
							Log.LogInfo((object)("Added Cliffs to boons pool: " + ((object)(Type)(ref ChallengeBoonCliffs.boo)).ToString()));
							Log.LogInfo((object)("Region: " + ((Object)RunState.CurrentMapRegion).name));
							switch (((Object)RunState.CurrentMapRegion).name)
							{
							case "Forest":
								list.Add(ChallengeBoonTotem.boo);
								Log.LogInfo((object)("Added Totem to boons pool: " + ((object)(Type)(ref ChallengeBoonTotem.boo)).ToString()));
								break;
							case "Wetlands":
								list.Add(ChallengeBoonMud.boo);
								Log.LogInfo((object)("Added Mud to boons pool: " + ((object)(Type)(ref ChallengeBoonMud.boo)).ToString()));
								break;
							case "Alpine":
								list.Add(ChallengeBoonHail.boo);
								Log.LogInfo((object)("Added Hail to boons pool: " + ((object)(Type)(ref ChallengeBoonHail.boo)).ToString()));
								break;
							}
						}
						if (RunState.CurrentRegionTier >= 1)
						{
							list.Add(ChallengeBoonBreeze.boo);
							Log.LogInfo((object)("Added Breeze to boons pool: " + ((object)(Type)(ref ChallengeBoonBreeze.boo)).ToString()));
							list.Add(ChallengeBoonFlashGrowth.boo);
							Log.LogInfo((object)("Added Flash Growth to boons pool: " + ((object)(Type)(ref ChallengeBoonFlashGrowth.boo)).ToString()));
							list.Add(ChallengeBoonGraveyard.boo);
							Log.LogInfo((object)("Added Graveyard to boons pool: " + ((object)(Type)(ref ChallengeBoonGraveyard.boo)).ToString()));
							switch (((Object)RunState.CurrentMapRegion).name)
							{
							case "Forest":
								list.Add(ChallengeBoonDynamite.boo);
								Log.LogInfo((object)("Added Prospector's Camp to boons pool: " + ((object)(Type)(ref ChallengeBoonDynamite.boo)).ToString()));
								break;
							case "Wetlands":
								list.Add(ChallengeBoonBait.boo);
								Log.LogInfo((object)("Added Angler's Pool to boons pool: " + ((object)(Type)(ref ChallengeBoonBait.boo)).ToString()));
								break;
							case "Alpine":
								list.Add(ChallengeBoonTrap.boo);
								Log.LogInfo((object)("Added Trapper's Hunting Grounds to boons pool: " + ((object)(Type)(ref ChallengeBoonTrap.boo)).ToString()));
								break;
							}
						}
						if (RunState.CurrentRegionTier >= 2)
						{
							list.Add(ChallengeBoonObelisk.boo);
							Log.LogInfo((object)("Added Obelisk to boons pool: " + ((object)(Type)(ref ChallengeBoonObelisk.boo)).ToString()));
							list.Add(ChallengeBoonMushrooms.boo);
							Log.LogInfo((object)("Added Mushrooms to boons pool: " + ((object)(Type)(ref ChallengeBoonMushrooms.boo)).ToString()));
							if (AscensionSaveData.Data.ChallengeIsActive((AscensionChallenge)13))
							{
								list.Add(ChallengeBoonBloodMoon.boo);
								Log.LogInfo((object)("Added Blood Moon to boons pool: " + ((object)(Type)(ref ChallengeBoonBloodMoon.boo)).ToString()));
							}
							if (AscensionSaveData.Data.ChallengeIsActive((AscensionChallenge)13) && SeededRandom.Bool(SaveManager.SaveFile.GetCurrentRandomSeed() + 1) && !DialogueEventsData.EventIsPlayed("CarrotBoonIntro"))
							{
								list.Add(ChallengeBoonCarrotPatch.boo);
								Log.LogInfo((object)("Added Blood Moon(?) to boons pool: " + ((object)(Type)(ref ChallengeBoonCarrotPatch.boo)).ToString()));
							}
							if (AscensionSaveData.Data.ChallengeIsActive(harderFinalBossChallenge.challengeType) || AscensionSaveData.Data.ChallengeIsActive((AscensionChallenge)15))
							{
								list.Add(ChallengeBoonMinicello.boo);
								Log.LogInfo((object)("Added Minicello to boons pool: " + ((object)(Type)(ref ChallengeBoonMinicello.boo)).ToString()));
							}
							switch (((Object)RunState.CurrentMapRegion).name)
							{
							case "Forest":
								list.Add(ChallengeBoonDarkForest.boo);
								Log.LogInfo((object)("Added Dark Forest to boons pool: " + ((object)(Type)(ref ChallengeBoonDarkForest.boo)).ToString()));
								break;
							case "Wetlands":
								list.Add(ChallengeBoonFlood.boo);
								Log.LogInfo((object)("Added Flood to boons pool: " + ((object)(Type)(ref ChallengeBoonFlood.boo)).ToString()));
								break;
							case "Alpine":
								list.Add(ChallengeBoonBlizzard.boo);
								Log.LogInfo((object)("Added Blizzard to boons pool: " + ((object)(Type)(ref ChallengeBoonBlizzard.boo)).ToString()));
								break;
							}
						}
					}
					else
					{
						list.Add(ChallengeBoonGraveyard.boo);
						Log.LogInfo((object)("Added Graveyard to boons pool: " + ((object)(Type)(ref ChallengeBoonGraveyard.boo)).ToString()));
						list.Add(ChallengeBoonFlashGrowth.boo);
						Log.LogInfo((object)("Added Flash Growth to boons pool: " + ((object)(Type)(ref ChallengeBoonFlashGrowth.boo)).ToString()));
						list.Add(ChallengeBoonConveyor.boo);
						Log.LogInfo((object)("Added Conveyor to boons pool: " + ((object)(Type)(ref ChallengeBoonConveyor.boo)).ToString()));
						list.Add(ChallengeBoonGemSanctuary.boo);
						Log.LogInfo((object)("Added Gem Sanctuary to boons pool: " + ((object)(Type)(ref ChallengeBoonGemSanctuary.boo)).ToString()));
						list.Add(ChallengeBoonElectricStorm.boo);
						Log.LogInfo((object)("Added Electrical Storm to boons pool: " + ((object)(Type)(ref ChallengeBoonElectricStorm.boo)).ToString()));
					}
					int index = EnvironmentNumber() % list.Count;
					if (SeededRandom.Bool(SaveManager.SaveFile.GetCurrentRandomSeed() + 2) && list != null)
					{
						RunState.Run.playerDeck.AddBoon(list[index]);
						ManualLogSource log = Log;
						Type val = list[index];
						log.LogInfo((object)("Using boon: " + ((object)(Type)(ref val)).ToString()));
					}
				}
				return true;
			}

			[HarmonyPatch(typeof(TurnManager), "CleanupPhase")]
			[HarmonyPostfix]
			public static void EnvironmentBoonCleanup()
			{
				foreach (CardSlot item in Singleton<BoardManager>.Instance.AllSlotsCopy)
				{
					if (SaveManager.SaveFile.IsPart1)
					{
						item.SetTexture(ResourceBank.Get<Texture>("Art/Cards/card_slot"));
					}
					if (SaveManager.SaveFile.IsPart3)
					{
						item.SetTexture(ResourceBank.Get<Texture>("Art/Cards/card_slot_tech"));
					}
					if (SaveManager.SaveFile.IsGrimora)
					{
						item.SetTexture(ResourceBank.Get<Texture>("Art/Cards/card_slot_undead"));
					}
					if (SaveManager.SaveFile.IsMagnificus)
					{
						item.SetTexture(ResourceBank.Get<Texture>("Art/Cards/card_slot_wizard"));
					}
				}
				Singleton<TableVisualEffectsManager>.Instance.ResetTableColors();
				ClearEnvironmentBoons();
			}

			[HarmonyPatch(typeof(BoardManager), "SacrificesCreateRoomForCard")]
			[HarmonyPostfix]
			public static void MergeSigilPatch(ref bool __result)
			{
				foreach (CardSlot item in Singleton<BoardManager>.Instance.PlayerSlotsCopy)
				{
					if ((Object)(object)item.Card != (Object)null)
					{
						CardModificationInfo val = item.Card.TemporaryMods.Find((CardModificationInfo x) => x.singletonId == "bitty_mergeSigil");
						if (val != null)
						{
							__result = true;
						}
					}
				}
			}

			public static void ClearEnvironmentBoons()
			{
				//IL_0044: 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 (RunState.Run.playerDeck.Boons.Count <= 0)
				{
					return;
				}
				foreach (BoonData boon in RunState.Run.playerDeck.Boons)
				{
					if (allEnvironmentBoons.Contains(boon.type))
					{
						DeckInfoExtensions.RemoveAllBoonsOfType(RunState.Run.playerDeck, boon.type);
					}
				}
				Log.LogInfo((object)"Resetting Environment Boons...");
			}
		}

		public class VineBoomDeath : ChallengeBehaviour
		{
			public override bool RespondsToOtherCardDie(PlayableCard card, CardSlot deathSlot, bool fromCombat, PlayableCard killer)
			{
				return true;
			}

			public override IEnumerator OnOtherCardDie(PlayableCard card, CardSlot deathSlot, bool fromCombat, PlayableCard killer)
			{
				AudioController.Instance.PlaySound2D("vine-boom", (MixerGroup)0, 4f, CustomRandom.RandomBetween(0f, 0.2f), new Pitch((Variation)2), (Repetition)null, (Randomization)null, (Distortion)null, false);
				yield break;
			}

			public override bool RespondsToOtherCardAssignedToSlot(PlayableCard otherCard)
			{
				return true;
			}

			public override IEnumerator OnOtherCardAssignedToSlot(PlayableCard otherCard)
			{
				otherCard.Status.hiddenAbilities.Add((Ability)52);
				otherCard.AddTemporaryMod(new CardModificationInfo((Ability)52));
				yield break;
			}
		}

		public class FleetingSquirrels : ChallengeBehaviour
		{
			public string sideDeckName;

			public override bool RespondsToUpkeep(bool playerUpkeep)
			{
				return Singleton<CardDrawPiles3D>.Instance.SideDeck.CardsInDeck > 0;
			}

			public override IEnumerator OnUpkeep(bool playerUpkeep)
			{
				sideDeckName = ((Object)Singleton<CardDrawPiles3D>.Instance.SideDeck.Cards[0]).name;
				yield break;
			}

			public override bool RespondsToOtherCardDrawn(PlayableCard card)
			{
				return ((Object)((Card)card).Info).name == sideDeckName || ((Object)((Card)card).Info).name.ToLower().Contains("emptyvessel");
			}

			public override IEnumerator OnOtherCardDrawn(PlayableCard card)
			{
				card.AddTemporaryMod(new CardModificationInfo(GiveFleeting.ability));
				yield break;
			}
		}

		public class RedrawHand
		{
			[HarmonyPatch(typeof(TurnManager), "SetupPhase")]
			private class CloverGiverPatch
			{
				[HarmonyPostfix]
				public static IEnumerator CloverGiver(IEnumerator __result)
				{
					yield return __result;
					if (AscensionSaveData.Data.ChallengeIsActive(redrawHandChallenge.challengeType))
					{
						ChallengeActivationUI.TryShowActivation(redrawHandChallenge.challengeType);
						yield return Singleton<CardSpawner>.Instance.SpawnCardToHand(CardLoader.GetCardByName("bitty_Clover"), (List<CardModificationInfo>)null, 0.25f, (Action<PlayableCard>)null);
						if (!DialogueEventsData.EventIsPlayed("RedrawHandIntro"))
						{
							yield return Singleton<TextDisplayer>.Instance.P

plugins/bitty45-BittysRegions/plugins/Bittys Regions.dll

Decompiled 5 months ago
using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using BepInEx;
using BepInEx.Bootstrap;
using BepInEx.Logging;
using BittysSigils;
using BittysSigils.Triggers;
using DiskCardGame;
using HarmonyLib;
using Infiniscryption.PackManagement;
using InscryptionAPI.Card;
using InscryptionAPI.Encounters;
using InscryptionAPI.Helpers;
using InscryptionAPI.Helpers.Extensions;
using InscryptionAPI.Items;
using InscryptionAPI.Masks;
using InscryptionAPI.Regions;
using InscryptionAPI.Sound;
using InscryptionAPI.Triggers;
using InscryptionMod.Abilities;
using Microsoft.CodeAnalysis;
using NevernamedsSigils;
using Pixelplacement;
using Sirenix.Serialization.Utilities;
using Sirenix.Utilities;
using TalkingCardUtility;
using UnityEngine;

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

		public RefSafetyRulesAttribute(int P_0)
		{
			Version = P_0;
		}
	}
}
namespace TalkingCardUtility
{
	public static class TextureLoadUtility
	{
		public static Sprite ConvertTexToSprite(Texture2D tex, Vector2? pivot = null)
		{
			//IL_005f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0064: Unknown result type (might be due to invalid IL or missing references)
			//IL_0022: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Unknown result type (might be due to invalid IL or missing references)
			Vector2 val = default(Vector2);
			((Vector2)(ref val))..ctor(0.5f, 0.5f);
			if (pivot.HasValue)
			{
				((Vector2)(ref val))..ctor(pivot.Value.x, pivot.Value.y);
			}
			((Texture)tex).filterMode = (FilterMode)0;
			return Sprite.Create(tex, new Rect(0f, 0f, (float)((Texture)tex).width, (float)((Texture)tex).height), val, 100f);
		}

		public static Texture2D LoadTex(string path)
		{
			//IL_000a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0010: Expected O, but got Unknown
			byte[] array = ExtractEmbeddedResource(path);
			Texture2D val = new Texture2D(2, 2);
			ImageConversion.LoadImage(val, array);
			((Texture)val).filterMode = (FilterMode)0;
			return val;
		}

		public static byte[] ExtractEmbeddedResource(string filePath)
		{
			filePath = filePath.Replace("/", ".");
			filePath = filePath.Replace("\\", ".");
			Assembly callingAssembly = Assembly.GetCallingAssembly();
			using Stream stream = callingAssembly.GetManifestResourceStream(filePath);
			if (stream == null)
			{
				return null;
			}
			byte[] array = new byte[stream.Length];
			stream.Read(array, 0, array.Length);
			return array;
		}
	}
	public static class DialogueEventGenerator
	{
		public static DialogueEvent GenerateEvent(string name, List<CustomLine> mainLines, List<List<CustomLine>> repeatLines, MaxRepeatsBehaviour afterMaxRepeats, Emotion emotion = 0)
		{
			//IL_0007: Unknown result type (might be due to invalid IL or missing references)
			//IL_0009: Unknown result type (might be due to invalid IL or missing references)
			//IL_000f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0015: Expected O, but got Unknown
			//IL_0042: Unknown result type (might be due to invalid IL or missing references)
			//IL_004c: Expected O, but got Unknown
			//IL_0065: Unknown result type (might be due to invalid IL or missing references)
			//IL_0066: Unknown result type (might be due to invalid IL or missing references)
			DialogueEvent val = new DialogueEvent();
			List<Speaker> speakers = new List<Speaker> { (Speaker)0 };
			val.id = name;
			val.mainLines = new LineSet(mainLines.ConvertAll((CustomLine x) => x.ToLine(speakers, emotion)));
			val.repeatLines = repeatLines.ConvertAll((Converter<List<CustomLine>, LineSet>)((List<CustomLine> x) => new LineSet(x.ConvertAll((CustomLine x2) => x2.ToLine(speakers, emotion)))));
			val.maxRepeatsBehaviour = afterMaxRepeats;
			val.speakers = new List<Speaker>(speakers);
			DialogueDataUtil.Data?.events?.Add(val);
			return val;
		}
	}
	public class CustomLine
	{
		public Face p03Face;

		public Emotion emotion;

		public LetterAnimation letterAnimation;

		public Speaker speaker;

		public string text;

		public string specialInstruction;

		public StoryEvent storyCondition = (StoryEvent)0;

		public bool storyConditionMustBeMet;

		public Line ToLine(List<Speaker> speakers, Emotion emotion)
		{
			//IL_0003: 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_0028: Unknown result type (might be due to invalid IL or missing references)
			//IL_002a: Unknown result type (might be due to invalid IL or missing references)
			//IL_002f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0034: Unknown result type (might be due to invalid IL or missing references)
			//IL_0035: Unknown result type (might be due to invalid IL or missing references)
			//IL_0036: Unknown result type (might be due to invalid IL or missing references)
			//IL_003b: Unknown result type (might be due to invalid IL or missing references)
			//IL_003d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0042: Unknown result type (might be due to invalid IL or missing references)
			//IL_0047: Unknown result type (might be due to invalid IL or missing references)
			//IL_004a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0059: Unknown result type (might be due to invalid IL or missing references)
			//IL_0017: Unknown result type (might be due to invalid IL or missing references)
			//IL_006e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0083: Unknown result type (might be due to invalid IL or missing references)
			//IL_0085: Unknown result type (might be due to invalid IL or missing references)
			//IL_008a: Unknown result type (might be due to invalid IL or missing references)
			//IL_008f: Unknown result type (might be due to invalid IL or missing references)
			//IL_009c: Expected O, but got Unknown
			if (!speakers.Contains(speaker))
			{
				speakers.Add(speaker);
			}
			return new Line
			{
				p03Face = p03Face,
				emotion = emotion,
				letterAnimation = letterAnimation,
				speakerIndex = speakers.IndexOf(speaker),
				text = (text ?? ""),
				specialInstruction = (specialInstruction ?? ""),
				storyCondition = storyCondition,
				storyConditionMustBeMet = storyConditionMustBeMet
			};
		}

		public static implicit operator CustomLine(string str)
		{
			return new CustomLine
			{
				text = str
			};
		}

		public static implicit operator CustomLine((string, LetterAnimation, Emotion) param)
		{
			//IL_0014: Unknown result type (might be due to invalid IL or missing references)
			//IL_0019: Unknown result type (might be due to invalid IL or missing references)
			//IL_0020: Unknown result type (might be due to invalid IL or missing references)
			//IL_0025: Unknown result type (might be due to invalid IL or missing references)
			return new CustomLine
			{
				text = param.Item1,
				emotion = param.Item3,
				letterAnimation = param.Item2
			};
		}

		public static implicit operator CustomLine((string, LetterAnimation) param)
		{
			//IL_0014: Unknown result type (might be due to invalid IL or missing references)
			//IL_0019: Unknown result type (might be due to invalid IL or missing references)
			CustomLine customLine = new CustomLine();
			(customLine.text, customLine.letterAnimation) = param;
			return customLine;
		}

		public static implicit operator CustomLine((string, LetterAnimation, Speaker) param)
		{
			//IL_0014: Unknown result type (might be due to invalid IL or missing references)
			//IL_0019: Unknown result type (might be due to invalid IL or missing references)
			//IL_0020: Unknown result type (might be due to invalid IL or missing references)
			//IL_0025: Unknown result type (might be due to invalid IL or missing references)
			return new CustomLine
			{
				text = param.Item1,
				speaker = param.Item3,
				letterAnimation = param.Item2
			};
		}

		public static implicit operator CustomLine((string, LetterAnimation, Speaker, Emotion) param)
		{
			//IL_0014: Unknown result type (might be due to invalid IL or missing references)
			//IL_0019: Unknown result type (might be due to invalid IL or missing references)
			//IL_0020: Unknown result type (might be due to invalid IL or missing references)
			//IL_0025: Unknown result type (might be due to invalid IL or missing references)
			//IL_002c: 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)
			return new CustomLine
			{
				text = param.Item1,
				speaker = param.Item3,
				letterAnimation = param.Item2,
				emotion = param.Item4
			};
		}

		public static implicit operator CustomLine((string, Emotion) param)
		{
			//IL_0014: Unknown result type (might be due to invalid IL or missing references)
			//IL_0019: Unknown result type (might be due to invalid IL or missing references)
			CustomLine customLine = new CustomLine();
			(customLine.text, customLine.emotion) = param;
			return customLine;
		}

		public static implicit operator CustomLine((string, Emotion, Speaker) param)
		{
			//IL_0014: Unknown result type (might be due to invalid IL or missing references)
			//IL_0019: Unknown result type (might be due to invalid IL or missing references)
			//IL_0020: Unknown result type (might be due to invalid IL or missing references)
			//IL_0025: Unknown result type (might be due to invalid IL or missing references)
			return new CustomLine
			{
				text = param.Item1,
				speaker = param.Item3,
				emotion = param.Item2
			};
		}

		public static implicit operator CustomLine((string, Speaker) param)
		{
			//IL_0014: Unknown result type (might be due to invalid IL or missing references)
			//IL_0019: Unknown result type (might be due to invalid IL or missing references)
			CustomLine customLine = new CustomLine();
			(customLine.text, customLine.speaker) = param;
			return customLine;
		}
	}
}
namespace Bittys_Regions
{
	public class Bosses
	{
		public class MagmaBossMask : MaskBehaviour
		{
			public static Mask ID;

			public static void Setup()
			{
				//IL_0001: Unknown result type (might be due to invalid IL or missing references)
				//IL_0007: Expected O, but got Unknown
				//IL_0023: Unknown result type (might be due to invalid IL or missing references)
				//IL_0028: Unknown result type (might be due to invalid IL or missing references)
				//IL_003b: 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_0048: Unknown result type (might be due to invalid IL or missing references)
				ResourceLookup val = new ResourceLookup();
				val.FromAssetBundle(Plugin.regionMasksBundle, "magmask");
				ModelType modelType = MaskManager.RegisterPrefab("bitty45.inscryption.regions", "magmask", val);
				CustomMask val2 = MaskManager.Add("bitty45.inscryption.regions", "Magma", (string)null);
				val2.SetModelType(modelType);
				ID = val2.ID;
			}
		}

		public class MagmaBossOpponent : Part1BossOpponent
		{
			public static readonly FullOpponent FullOpponent = OpponentManager.Add("bitty45.inscryption.regions", "MagmaBoss", MagmaBossSpecialBattleSequencer.FullSequencer.Id, typeof(MagmaBossOpponent));

			private MagmaHammerSlam hammerSlam;

			public override string DefeatedPlayerDialogue => "Into the molten rock...";

			public override bool GiveCurrencyOnDefeat => true;

			public override Color InteractablesGlowColor => GameColors.Instance.brightBlue;

			public override IEnumerator IntroSequence(EncounterData encounter)
			{
				AudioController.Instance.FadeOutLoop(0.75f, Array.Empty<int>());
				yield return <>n__0(encounter);
				yield return (object)new WaitForSeconds(0.75f);
				Singleton<ViewManager>.Instance.SwitchToView((View)1, false, true);
				yield return (object)new WaitForSeconds(0.25f);
				yield return Singleton<TextDisplayer>.Instance.PlayDialogueEvent("MagmaBossPreIntro_bitty", (MessageAdvanceMode)1, (EventIntersectMode)0, (string[])null, (Action<Line>)null);
				yield return (object)new WaitForSeconds(0.15f);
				LeshyAnimationController.Instance.PutOnMask(MagmaBossMask.ID, false);
				LeshyAnimationController.Instance.SetEyesAnimated(true);
				AudioController.Instance.SetLoopAndPlay("bitty45.inscryption.regions_forgeboss_loop.ogg", 0, true, true);
				AudioController.Instance.SetLoopVolume(0f, 4f, 1, true);
				yield return (object)new WaitForSeconds(1.5f);
				Singleton<OpponentAnimationController>.Instance.SetHeadTilt(5f, 1.5f, 0.1f);
				yield return ((Part1BossOpponent)this).FaceZoomSequence();
				hammerSlam = ((Part1BossOpponent)this).InstantiateBossBehaviour<MagmaHammerSlam>();
				yield return Singleton<TextDisplayer>.Instance.PlayDialogueEvent("MagmaBossIntro_bitty", (MessageAdvanceMode)1, (EventIntersectMode)0, (string[])null, (Action<Line>)null);
				Singleton<ViewManager>.Instance.SwitchToView((View)1, false, false);
				Singleton<ViewManager>.Instance.Controller.LockState = (ViewLockState)0;
				yield return (object)new WaitForSeconds(0.25f);
				yield return (object)new WaitForSeconds(0.5f);
				LeshyAnimationController.Instance.SetEyesAnimated(true);
			}

			public override IEnumerator StartNewPhaseSequence()
			{
				if (((Part1BossOpponent)this).HasGrizzlyGlitchPhase(0))
				{
					yield return ((Part1BossOpponent)this).GrizzlyGlitchSequence();
					yield break;
				}
				Singleton<ViewManager>.Instance.Controller.LockState = (ViewLockState)1;
				yield return ForgeMetalSequence();
				((Opponent)this).Blueprint = EncounterHelper.GetBlueprintData("bit_MartelP2");
				int difficulty = 0;
				if (Singleton<TurnManager>.Instance.BattleNodeData != null)
				{
					difficulty = Singleton<TurnManager>.Instance.BattleNodeData.difficulty + RunState.Run.DifficultyModifier;
				}
				List<List<CardInfo>> plan = EncounterBuilder.BuildOpponentTurnPlan(((Opponent)this).Blueprint, difficulty, false);
				((Opponent)this).ReplaceAndAppendTurnPlan(plan);
				yield return ((Opponent)this).QueueNewCards(true, true);
				Singleton<ViewManager>.Instance.Controller.LockState = (ViewLockState)0;
			}

			private IEnumerator ForgeMetalSequence()
			{
				int opponentCardNumber = Singleton<BoardManager>.Instance.OpponentSlotsCopy.Count();
				if (opponentCardNumber > 0)
				{
					LeshyAnimationController.Instance.SetEyesAnimated(true);
					yield return Singleton<TextDisplayer>.Instance.ShowUntilInput("TIME TO FORGE METAL!", -0.65f, 0.4f, (Emotion)0, (LetterAnimation)0, (Speaker)0, (string[])null, true);
					LeshyAnimationController.Instance.SetEyesAnimated(true);
					LeshyAnimationController.Instance.RightArm.PlayAnimation("prospector_intro");
					foreach (PlayableCard opponentCard in BoardManagerExtensions.GetOpponentCards(Singleton<BoardManager>.Instance, (Predicate<PlayableCard>)null))
					{
						yield return hammerSlam.StrikeCardSlot(opponentCard.slot);
						Singleton<ViewManager>.Instance.Controller.LockState = (ViewLockState)1;
					}
					LeshyAnimationController.Instance.RightArm.SetTrigger("prospector_hide");
					yield return (object)new WaitForSeconds(0.1f);
					LeshyAnimationController.Instance.SetEyesAnimated(true);
					yield return Singleton<TextDisplayer>.Instance.ShowUntilInput("GO MY KNIGHTS!", -0.65f, 0.4f, (Emotion)0, (LetterAnimation)0, (Speaker)0, (string[])null, true);
					LeshyAnimationController.Instance.SetEyesAnimated(true);
				}
				else
				{
					yield return (object)new WaitForSeconds(0.5f);
					LeshyAnimationController.Instance.SetEyesAnimated(true);
					yield return Singleton<TextDisplayer>.Instance.ShowUntilInput("Ah... no materials...", -0.65f, 0.4f, (Emotion)0, (LetterAnimation)0, (Speaker)0, (string[])null, true);
					LeshyAnimationController.Instance.SetEyesAnimated(true);
				}
				foreach (CardSlot emptyOpponentSlot in BoardManagerExtensions.GetOpponentOpenSlots(Singleton<BoardManager>.Instance, (Predicate<CardSlot>)null))
				{
					yield return Singleton<BoardManager>.Instance.CreateCardInSlot(CardLoader.GetCardByName("bittyRegions_Coal Pile"), emptyOpponentSlot, 0.1f, true);
				}
			}

			public override void SetSceneEffectsShown(bool showEffects)
			{
				//IL_000f: Unknown result type (might be due to invalid IL or missing references)
				//IL_0044: Unknown result type (might be due to invalid IL or missing references)
				//IL_008d: Unknown result type (might be due to invalid IL or missing references)
				//IL_0092: Unknown result type (might be due to invalid IL or missing references)
				//IL_00a9: Unknown result type (might be due to invalid IL or missing references)
				//IL_00b3: 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_00c4: Unknown result type (might be due to invalid IL or missing references)
				//IL_00ca: Unknown result type (might be due to invalid IL or missing references)
				//IL_00d4: Unknown result type (might be due to invalid IL or missing references)
				//IL_00de: Unknown result type (might be due to invalid IL or missing references)
				//IL_00e8: Unknown result type (might be due to invalid IL or missing references)
				if (showEffects)
				{
					LeshyAnimationController.Instance.SetHairColor(Color.black);
					LeshyAnimationController.Instance.SetEyesAnimated(true);
					Tween.Rotate(((Component)Singleton<ExplorableAreaManager>.Instance.HangingLight).transform, new Vector3(150f, 0f, 0f), (Space)0, 25f, 0f, Tween.EaseInOut, (LoopType)2, (Action)null, (Action)null, true);
					Singleton<ExplorableAreaManager>.Instance.SetHangingLightIntensity(10f);
					Singleton<ExplorableAreaManager>.Instance.SetHangingLightCookie(ResourceBank.Get<Texture>("Art/Effects/WavesTextureCube"));
					Color orange = GameColors.Instance.orange;
					orange.a = 0.5f;
					Singleton<TableVisualEffectsManager>.Instance.ChangeTableColors(GameColors.Instance.orange, GameColors.Instance.marigold, ((Part1Opponent)this).InteractablesGlowColor, orange, GameColors.Instance.red, ((Part1Opponent)this).InteractablesGlowColor, GameColors.Instance.gray, GameColors.Instance.gray, GameColors.Instance.lightGray);
				}
				else
				{
					LeshyAnimationController.Instance.ResetHairColor();
					Tween.Cancel(((Object)((Component)Singleton<ExplorableAreaManager>.Instance.HangingLight).transform).GetInstanceID());
					Singleton<ExplorableAreaManager>.Instance.ResetHangingLightIntensity();
					Singleton<ExplorableAreaManager>.Instance.ClearHangingLightCookie();
					Singleton<TableVisualEffectsManager>.Instance.ResetTableColors();
					Singleton<OpponentAnimationController>.Instance.ResetHeadTilt(0.2f);
				}
			}

			[CompilerGenerated]
			[DebuggerHidden]
			private IEnumerator <>n__0(EncounterData encounter)
			{
				return ((Part1BossOpponent)this).IntroSequence(encounter);
			}
		}

		public class MagmaBossSpecialBattleSequencer : BossBattleSequencer
		{
			public static readonly FullSpecialSequencer FullSequencer = SpecialSequenceManager.Add("bitty45.inscryption.regions", "MagmaBossSpecialBattleSequencer", typeof(MagmaBossSpecialBattleSequencer));

			public override Type BossType => Plugin.MagmaBoss;

			public override StoryEvent DefeatedStoryEvent => Plugin.MagmaDefated;

			public override EncounterData BuildCustomEncounter(CardBattleNodeData nodeData)
			{
				//IL_004f: Unknown result type (might be due to invalid IL or missing references)
				//IL_0055: Expected O, but got Unknown
				EncounterData val = ((BossBattleSequencer)this).BuildCustomEncounter(nodeData);
				val.Blueprint = EncounterHelper.GetBlueprintData("bit_MartelP1");
				val.opponentTurnPlan = EncounterBuilder.BuildOpponentTurnPlan(val.Blueprint, nodeData.difficulty + RunState.Run.DifficultyModifier, true);
				if (nodeData.difficulty >= 15)
				{
					StartCondition val2 = new StartCondition();
					Plugin.Log.LogInfo((object)"Placing Fire Tree");
					val2.cardsInOpponentSlots[0] = CardLoader.GetCardByName("bittyRegions_Fire Tree");
					Plugin.Log.LogInfo((object)"Placing Coal Piles");
					val2.cardsInOpponentSlots[val2.cardsInOpponentSlots.Length - 1] = CardLoader.GetCardByName("bittyRegions_Coal Pile");
					Plugin.Log.LogInfo((object)"Piles placed.");
					val.startConditions.Add(val2);
				}
				return val;
			}

			public override IEnumerator OpponentCombatEnd()
			{
				yield break;
			}

			public override IEnumerator OpponentLifeLost()
			{
				yield break;
			}

			public override IEnumerator PlayerUpkeep()
			{
				LeshyAnimationController.Instance.SetEyesAnimated(true);
				if (Singleton<TurnManager>.Instance.Opponent.NumLives > 1)
				{
					if ((int)Singleton<ViewManager>.Instance.CurrentView != 1)
					{
						yield return (object)new WaitForSeconds(0.2f);
						Singleton<ViewManager>.Instance.SwitchToView((View)1, false, false);
						yield return (object)new WaitForSeconds(0.2f);
					}
					yield return Singleton<CardSpawner>.Instance.SpawnCardToHand(CardLoader.GetCardByName("bittyRegions_Shackle"), (List<CardModificationInfo>)null, 0.25f, (Action<PlayableCard>)null);
					yield return (object)new WaitForSeconds(0.45f);
				}
				else
				{
					if ((int)Singleton<ViewManager>.Instance.CurrentView != 1)
					{
						yield return (object)new WaitForSeconds(0.2f);
						Singleton<ViewManager>.Instance.SwitchToView((View)1, false, false);
						yield return (object)new WaitForSeconds(0.2f);
					}
					yield return Singleton<CardSpawner>.Instance.SpawnCardToHand(CardLoader.GetCardByName("bittyRegions_Coal Pile"), (List<CardModificationInfo>)null, 0.25f, (Action<PlayableCard>)null);
					yield return (object)new WaitForSeconds(0.45f);
				}
			}
		}

		public class MagmaHammerSlam : BossBehaviour
		{
			public override IEnumerator Initialize()
			{
				yield break;
			}

			public override IEnumerator CleanUp()
			{
				yield break;
			}

			public IEnumerator StrikeCardSlot(CardSlot slot)
			{
				Singleton<ViewManager>.Instance.SwitchToView((View)1, false, false);
				yield return (object)new WaitForSeconds(0.1f);
				LeshyAnimationController.Instance.RightArm.SetTrigger("prospector_strike");
				yield return (object)new WaitForSeconds(0.5f);
				Singleton<ViewManager>.Instance.SwitchToView((View)4, false, true);
				Vector3 offset = new Vector3((float)(3 - slot.Index) * -1.4f, 0f, slot.IsPlayerSlot ? 0f : 2f);
				LeshyAnimationController.Instance.RightArm.OffsetPosition(offset, 0.2f);
				yield return (object)new WaitForSeconds(0.25f);
				AudioController.Instance.PlaySound3D("metal_object_hit#1", (MixerGroup)4, ((Component)slot).transform.position, 1f, 0f, new Pitch((Variation)1), (Repetition)null, (Randomization)null, (Distortion)null, false);
				CustomCoroutine.WaitThenExecute(0.35f, (Action)delegate
				{
					LeshyAnimationController.Instance.RightArm.ResetPosition(0.2f, false);
				}, false);
				if ((Object)(object)slot.Card != (Object)null)
				{
					yield return slot.Card.Die(false, (PlayableCard)null, true);
					if ((Object)(object)slot.Card == (Object)null)
					{
						yield return (object)new WaitForSeconds(0.25f);
						yield return Singleton<BoardManager>.Instance.CreateCardInSlot(CardLoader.GetCardByName("bittyRegions_Knight"), slot, 0.1f, true);
					}
				}
				yield return (object)new WaitForSeconds(0.35f);
				Singleton<ViewManager>.Instance.SwitchToView((View)1, false, false);
				Singleton<ViewManager>.Instance.Controller.LockState = (ViewLockState)0;
			}
		}

		public class SpiderBossOpponent : Part1BossOpponent
		{
			public static readonly FullOpponent FullOpponent = OpponentManager.Add("bitty45.inscryption.regions", "SpiderBoss", SpiderBossSpecialBattleSequencer.FullSequencer.Id, typeof(SpiderBossOpponent));

			public override string DefeatedPlayerDialogue => "<color=#32CD32>Sleep tight...</color>";

			public override bool GiveCurrencyOnDefeat => true;

			public override Color InteractablesGlowColor => GameColors.Instance.brightBlue;

			public override IEnumerator IntroSequence(EncounterData encounter)
			{
				AudioController.Instance.FadeOutLoop(0.75f, Array.Empty<int>());
				yield return <>n__0(encounter);
				yield return (object)new WaitForSeconds(0.75f);
				Singleton<ViewManager>.Instance.SwitchToView((View)1, false, true);
				yield return (object)new WaitForSeconds(0.25f);
				yield return Singleton<TextDisplayer>.Instance.PlayDialogueEvent("SpiderBossPreIntro_bitty", (MessageAdvanceMode)1, (EventIntersectMode)0, (string[])null, (Action<Line>)null);
				yield return (object)new WaitForSeconds(0.15f);
				AudioController.Instance.SetLoopAndPlay("bitty45.inscryption.regions_spiderboss_loop.ogg", 0, true, true);
				AudioController.Instance.SetLoopVolume(0f, 4f, 1, true);
				yield return (object)new WaitForSeconds(1.5f);
				Singleton<OpponentAnimationController>.Instance.SetHeadTilt(5f, 1.5f, 0.1f);
				yield return ((Part1BossOpponent)this).FaceZoomSequence();
				yield return Singleton<TextDisplayer>.Instance.PlayDialogueEvent("SpiderBossIntro_bitty", (MessageAdvanceMode)1, (EventIntersectMode)0, (string[])null, (Action<Line>)null);
				Singleton<ViewManager>.Instance.SwitchToView((View)1, false, false);
				Singleton<ViewManager>.Instance.Controller.LockState = (ViewLockState)0;
				yield return (object)new WaitForSeconds(0.25f);
			}

			public override IEnumerator StartNewPhaseSequence()
			{
				if (((Part1BossOpponent)this).HasGrizzlyGlitchPhase(0))
				{
					yield return ((Part1BossOpponent)this).GrizzlyGlitchSequence();
					yield break;
				}
				Singleton<ViewManager>.Instance.Controller.LockState = (ViewLockState)1;
				yield return ParasiteStealSequence();
				((Opponent)this).Blueprint = EncounterHelper.GetBlueprintData("bit_SpiderP2");
				int difficulty = 0;
				if (Singleton<TurnManager>.Instance.BattleNodeData != null)
				{
					difficulty = Singleton<TurnManager>.Instance.BattleNodeData.difficulty + RunState.Run.DifficultyModifier;
				}
				List<List<CardInfo>> plan = EncounterBuilder.BuildOpponentTurnPlan(((Opponent)this).Blueprint, difficulty, false);
				((Opponent)this).ReplaceAndAppendTurnPlan(plan);
				yield return ((Opponent)this).QueueNewCards(true, true);
				Singleton<ViewManager>.Instance.Controller.LockState = (ViewLockState)0;
			}

			private IEnumerator ParasiteStealSequence()
			{
				List<PlayableCard> parasitedCards = new List<PlayableCard>(from x in BoardManagerExtensions.GetPlayerCards(Singleton<BoardManager>.Instance, (Predicate<PlayableCard>)null)
					where x.HasAbility(Sigils.GiveSpiderInside.ability) || ((Object)x).name == "bittyRegions_Spiderling"
					select x);
				if (parasitedCards.Count > 0)
				{
					yield return Singleton<TextDisplayer>.Instance.ShowUntilInput("<color=#32CD32>You may claim those are your cards...</color>", -0.65f, 0.4f, (Emotion)0, (LetterAnimation)0, (Speaker)0, (string[])null, true);
					yield return Singleton<TextDisplayer>.Instance.ShowUntilInput("<color=#32CD32>But the spiders inside them are MINE!</color>", -0.65f, 0.4f, (Emotion)0, (LetterAnimation)0, (Speaker)0, (string[])null, true);
					foreach (PlayableCard card in parasitedCards)
					{
						yield return StealCard(card);
					}
				}
				else
				{
					yield return Singleton<TextDisplayer>.Instance.ShowUntilInput("<color=#32CD32>A shame... There's none of my spiders on your side...</color>", -0.65f, 0.4f, (Emotion)0, (LetterAnimation)0, (Speaker)0, (string[])null, true);
				}
			}

			public IEnumerator StealCard(PlayableCard playableCard)
			{
				if ((Object)(object)playableCard != (Object)null)
				{
					Singleton<ViewManager>.Instance.SwitchToView((View)1, false, false);
					yield return (object)new WaitForSeconds(0.2f);
					if ((Object)(object)CardExtensions.OpposingCard(playableCard) != (Object)null)
					{
						yield return Singleton<TurnManager>.Instance.Opponent.ReturnCardToQueue(CardExtensions.OpposingCard(playableCard), 0.1f);
					}
					if (playableCard.Status != null)
					{
						playableCard.Status.anglerHooked = true;
					}
					playableCard.SetIsOpponentCard(true);
					Transform transform = ((Component)playableCard).transform;
					transform.eulerAngles += new Vector3(0f, 0f, -180f);
					CardSlot cardSlot = playableCard.slot;
					yield return Singleton<BoardManager>.Instance.AssignCardToSlot(cardSlot.Card, cardSlot.opposingSlot, 0.1f, (Action)null, true);
					yield return (object)new WaitForSeconds(0.25f);
				}
			}

			public override void SetSceneEffectsShown(bool showEffects)
			{
				//IL_000f: Unknown result type (might be due to invalid IL or missing references)
				//IL_0044: Unknown result type (might be due to invalid IL or missing references)
				//IL_008d: Unknown result type (might be due to invalid IL or missing references)
				//IL_0092: Unknown result type (might be due to invalid IL or missing references)
				//IL_00a9: Unknown result type (might be due to invalid IL or missing references)
				//IL_00b3: 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_00c4: Unknown result type (might be due to invalid IL or missing references)
				//IL_00ca: Unknown result type (might be due to invalid IL or missing references)
				//IL_00d4: Unknown result type (might be due to invalid IL or missing references)
				//IL_00de: Unknown result type (might be due to invalid IL or missing references)
				//IL_00e8: Unknown result type (might be due to invalid IL or missing references)
				if (showEffects)
				{
					LeshyAnimationController.Instance.SetHairColor(Color.black);
					LeshyAnimationController.Instance.SetEyesAnimated(true);
					Tween.Rotate(((Component)Singleton<ExplorableAreaManager>.Instance.HangingLight).transform, new Vector3(150f, 0f, 0f), (Space)0, 25f, 0f, Tween.EaseInOut, (LoopType)2, (Action)null, (Action)null, true);
					Singleton<ExplorableAreaManager>.Instance.SetHangingLightIntensity(10f);
					Singleton<ExplorableAreaManager>.Instance.SetHangingLightCookie(ResourceBank.Get<Texture>("Art/Effects/WavesTextureCube"));
					Color purple = GameColors.Instance.purple;
					purple.a = 0.5f;
					Singleton<TableVisualEffectsManager>.Instance.ChangeTableColors(GameColors.Instance.purple, GameColors.Instance.fuschia, ((Part1Opponent)this).InteractablesGlowColor, purple, GameColors.Instance.darkPurple, ((Part1Opponent)this).InteractablesGlowColor, GameColors.Instance.gray, GameColors.Instance.gray, GameColors.Instance.lightGray);
				}
				else
				{
					LeshyAnimationController.Instance.ResetHairColor();
					Tween.Cancel(((Object)((Component)Singleton<ExplorableAreaManager>.Instance.HangingLight).transform).GetInstanceID());
					Singleton<ExplorableAreaManager>.Instance.ResetHangingLightIntensity();
					Singleton<ExplorableAreaManager>.Instance.ClearHangingLightCookie();
					Singleton<TableVisualEffectsManager>.Instance.ResetTableColors();
					Singleton<OpponentAnimationController>.Instance.ResetHeadTilt(0.2f);
				}
			}

			[CompilerGenerated]
			[DebuggerHidden]
			private IEnumerator <>n__0(EncounterData encounter)
			{
				return ((Part1BossOpponent)this).IntroSequence(encounter);
			}
		}

		public class SpiderBossSpecialBattleSequencer : BossBattleSequencer
		{
			public static readonly FullSpecialSequencer FullSequencer = SpecialSequenceManager.Add("bitty45.inscryption.regions", "SpiderBossSpecialBattleSequencer", typeof(SpiderBossSpecialBattleSequencer));

			private bool bittenOnce = false;

			public override Type BossType => Plugin.SpiderBoss;

			public override StoryEvent DefeatedStoryEvent => Plugin.SpiderDefated;

			public override EncounterData BuildCustomEncounter(CardBattleNodeData nodeData)
			{
				//IL_004f: Unknown result type (might be due to invalid IL or missing references)
				//IL_0055: Expected O, but got Unknown
				EncounterData val = ((BossBattleSequencer)this).BuildCustomEncounter(nodeData);
				val.Blueprint = EncounterHelper.GetBlueprintData("bit_SpiderP1");
				val.opponentTurnPlan = EncounterBuilder.BuildOpponentTurnPlan(val.Blueprint, nodeData.difficulty + RunState.Run.DifficultyModifier, true);
				if (nodeData.difficulty >= 15)
				{
					StartCondition val2 = new StartCondition();
					val2.cardsInOpponentSlots[0] = CardLoader.GetCardByName("bittyRegions_Egg Sack");
					val2.cardsInOpponentSlots[val2.cardsInOpponentSlots.Length - 1] = CardLoader.GetCardByName("bittyRegions_Pillar");
					val.startConditions.Add(val2);
				}
				return val;
			}

			public override IEnumerator OpponentCombatEnd()
			{
				yield break;
			}

			public override IEnumerator OpponentLifeLost()
			{
				yield break;
			}

			public override IEnumerator PlayerUpkeep()
			{
				if (!bittenOnce)
				{
					bittenOnce = true;
					yield return Singleton<TextDisplayer>.Instance.ShowUntilInput("<color=#32CD32>A spider's bite always strikes when least expected...</color>", -0.65f, 0.4f, (Emotion)0, (LetterAnimation)0, (Speaker)0, (string[])null, true);
				}
				int randomSeed = SaveManager.SaveFile.GetCurrentRandomSeed() + Singleton<TurnManager>.Instance.TurnNumber;
				List<CardSlot> slotsWithCards = Singleton<BoardManager>.Instance.PlayerSlotsCopy.FindAll((CardSlot x) => (Object)(object)x.Card != (Object)null && !x.Card.HasAbility(Sigils.GiveSpiderInside.ability));
				if (slotsWithCards.Count <= 0)
				{
					yield break;
				}
				CardSlot target = slotsWithCards[SeededRandom.Range(0, slotsWithCards.Count, randomSeed)];
				((Card)target.Card).Anim.PlayTransformAnimation();
				CardModificationInfo cardModificationInfo = new CardModificationInfo();
				cardModificationInfo.negateAbilities = new List<Ability>();
				foreach (CardModificationInfo cardModificationInfo2 in target.Card.TemporaryMods)
				{
					cardModificationInfo.negateAbilities.AddRange(cardModificationInfo2.abilities);
				}
				cardModificationInfo.negateAbilities.AddRange(((Card)target.Card).Info.Abilities);
				cardModificationInfo.negateAbilities.Remove(Sigils.GiveSpiderInside.ability);
				cardModificationInfo.abilities.Add(Sigils.GiveSpiderInside.ability);
				cardModificationInfo.fromCardMerge = true;
				cardModificationInfo.singletonId = "bitty_parasitized";
				target.Card.AddTemporaryMod(cardModificationInfo);
				if (!CardDisplayer3D.EmissionEnabledForCard(((Card)target.Card).renderInfo, target.Card))
				{
					((Card)target.Card).RenderInfo.forceEmissivePortrait = true;
					((Card)target.Card).StatsLayer.SetEmissionColor(GameColors.Instance.brightLimeGreen);
				}
				target.Card.OnStatsChanged();
			}
		}

		public static void AddBossBlueprints(bool arachnid = false)
		{
			//IL_001c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0023: Expected O, but got Unknown
			//IL_004f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0054: Unknown result type (might be due to invalid IL or missing references)
			//IL_0064: Unknown result type (might be due to invalid IL or missing references)
			//IL_006b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0073: Unknown result type (might be due to invalid IL or missing references)
			//IL_0088: Expected O, but got Unknown
			//IL_008a: Unknown result type (might be due to invalid IL or missing references)
			//IL_008f: Unknown result type (might be due to invalid IL or missing references)
			//IL_009f: 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_00ae: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c3: Expected O, but got Unknown
			//IL_00d1: 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_00e6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f2: Expected O, but got Unknown
			//IL_0100: Unknown result type (might be due to invalid IL or missing references)
			//IL_0105: Unknown result type (might be due to invalid IL or missing references)
			//IL_0115: Unknown result type (might be due to invalid IL or missing references)
			//IL_011c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0123: Unknown result type (might be due to invalid IL or missing references)
			//IL_012b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0140: Expected O, but got Unknown
			//IL_0142: Unknown result type (might be due to invalid IL or missing references)
			//IL_0147: Unknown result type (might be due to invalid IL or missing references)
			//IL_0157: Unknown result type (might be due to invalid IL or missing references)
			//IL_015e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0165: Unknown result type (might be due to invalid IL or missing references)
			//IL_016c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0181: Expected O, but got Unknown
			//IL_018f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0194: Unknown result type (might be due to invalid IL or missing references)
			//IL_01a4: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ab: Unknown result type (might be due to invalid IL or missing references)
			//IL_01b2: Unknown result type (might be due to invalid IL or missing references)
			//IL_01c7: Expected O, but got Unknown
			//IL_01c9: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ce: Unknown result type (might be due to invalid IL or missing references)
			//IL_01e3: Expected O, but got Unknown
			//IL_01fd: Unknown result type (might be due to invalid IL or missing references)
			//IL_0202: Unknown result type (might be due to invalid IL or missing references)
			//IL_0212: Unknown result type (might be due to invalid IL or missing references)
			//IL_0219: Unknown result type (might be due to invalid IL or missing references)
			//IL_0221: Unknown result type (might be due to invalid IL or missing references)
			//IL_0236: Expected O, but got Unknown
			//IL_0250: Unknown result type (might be due to invalid IL or missing references)
			//IL_0255: Unknown result type (might be due to invalid IL or missing references)
			//IL_026a: Expected O, but got Unknown
			//IL_02cd: Unknown result type (might be due to invalid IL or missing references)
			//IL_02d2: Unknown result type (might be due to invalid IL or missing references)
			//IL_02e7: Expected O, but got Unknown
			//IL_02f5: Unknown result type (might be due to invalid IL or missing references)
			//IL_02fa: Unknown result type (might be due to invalid IL or missing references)
			//IL_030a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0311: Unknown result type (might be due to invalid IL or missing references)
			//IL_0319: Unknown result type (might be due to invalid IL or missing references)
			//IL_032e: Expected O, but got Unknown
			//IL_033c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0341: Unknown result type (might be due to invalid IL or missing references)
			//IL_0356: Expected O, but got Unknown
			//IL_0358: Unknown result type (might be due to invalid IL or missing references)
			//IL_035d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0372: Expected O, but got Unknown
			//IL_038c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0391: Unknown result type (might be due to invalid IL or missing references)
			//IL_03a6: Expected O, but got Unknown
			//IL_03c0: Unknown result type (might be due to invalid IL or missing references)
			//IL_03c5: Unknown result type (might be due to invalid IL or missing references)
			//IL_03da: Expected O, but got Unknown
			//IL_03f4: Unknown result type (might be due to invalid IL or missing references)
			//IL_03f9: Unknown result type (might be due to invalid IL or missing references)
			//IL_040e: Expected O, but got Unknown
			//IL_0460: Unknown result type (might be due to invalid IL or missing references)
			//IL_0467: Expected O, but got Unknown
			//IL_0482: Unknown result type (might be due to invalid IL or missing references)
			//IL_0505: Unknown result type (might be due to invalid IL or missing references)
			//IL_050a: Unknown result type (might be due to invalid IL or missing references)
			//IL_051f: Expected O, but got Unknown
			//IL_0521: Unknown result type (might be due to invalid IL or missing references)
			//IL_0526: Unknown result type (might be due to invalid IL or missing references)
			//IL_0536: Unknown result type (might be due to invalid IL or missing references)
			//IL_053d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0545: Unknown result type (might be due to invalid IL or missing references)
			//IL_055a: Expected O, but got Unknown
			//IL_0568: Unknown result type (might be due to invalid IL or missing references)
			//IL_056d: Unknown result type (might be due to invalid IL or missing references)
			//IL_057d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0589: Expected O, but got Unknown
			//IL_0597: Unknown result type (might be due to invalid IL or missing references)
			//IL_059c: Unknown result type (might be due to invalid IL or missing references)
			//IL_05ac: Unknown result type (might be due to invalid IL or missing references)
			//IL_05b3: Unknown result type (might be due to invalid IL or missing references)
			//IL_05ba: Unknown result type (might be due to invalid IL or missing references)
			//IL_05c2: Unknown result type (might be due to invalid IL or missing references)
			//IL_05d7: Expected O, but got Unknown
			//IL_05d9: Unknown result type (might be due to invalid IL or missing references)
			//IL_05de: Unknown result type (might be due to invalid IL or missing references)
			//IL_05ee: Unknown result type (might be due to invalid IL or missing references)
			//IL_05f5: Unknown result type (might be due to invalid IL or missing references)
			//IL_05fc: Unknown result type (might be due to invalid IL or missing references)
			//IL_0603: Unknown result type (might be due to invalid IL or missing references)
			//IL_0618: Expected O, but got Unknown
			//IL_0626: Unknown result type (might be due to invalid IL or missing references)
			//IL_062b: Unknown result type (might be due to invalid IL or missing references)
			//IL_063b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0642: Unknown result type (might be due to invalid IL or missing references)
			//IL_0649: Unknown result type (might be due to invalid IL or missing references)
			//IL_065e: Expected O, but got Unknown
			//IL_0660: Unknown result type (might be due to invalid IL or missing references)
			//IL_0665: Unknown result type (might be due to invalid IL or missing references)
			//IL_067a: Expected O, but got Unknown
			//IL_0694: Unknown result type (might be due to invalid IL or missing references)
			//IL_0699: Unknown result type (might be due to invalid IL or missing references)
			//IL_06a9: Unknown result type (might be due to invalid IL or missing references)
			//IL_06b0: Unknown result type (might be due to invalid IL or missing references)
			//IL_06b8: Unknown result type (might be due to invalid IL or missing references)
			//IL_06cd: Expected O, but got Unknown
			//IL_06e7: Unknown result type (might be due to invalid IL or missing references)
			//IL_06ec: Unknown result type (might be due to invalid IL or missing references)
			//IL_0701: Expected O, but got Unknown
			//IL_0753: Unknown result type (might be due to invalid IL or missing references)
			//IL_07d6: Unknown result type (might be due to invalid IL or missing references)
			//IL_07db: Unknown result type (might be due to invalid IL or missing references)
			//IL_07f0: Expected O, but got Unknown
			//IL_07fe: Unknown result type (might be due to invalid IL or missing references)
			//IL_0803: Unknown result type (might be due to invalid IL or missing references)
			//IL_0813: Unknown result type (might be due to invalid IL or missing references)
			//IL_081a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0822: Unknown result type (might be due to invalid IL or missing references)
			//IL_0837: Expected O, but got Unknown
			//IL_0845: Unknown result type (might be due to invalid IL or missing references)
			//IL_084a: Unknown result type (might be due to invalid IL or missing references)
			//IL_085f: Expected O, but got Unknown
			//IL_0861: Unknown result type (might be due to invalid IL or missing references)
			//IL_0866: Unknown result type (might be due to invalid IL or missing references)
			//IL_087b: Expected O, but got Unknown
			//IL_0895: Unknown result type (might be due to invalid IL or missing references)
			//IL_089a: Unknown result type (might be due to invalid IL or missing references)
			//IL_08af: Expected O, but got Unknown
			//IL_08c9: Unknown result type (might be due to invalid IL or missing references)
			//IL_08ce: Unknown result type (might be due to invalid IL or missing references)
			//IL_08e3: Expected O, but got Unknown
			//IL_08fd: Unknown result type (might be due to invalid IL or missing references)
			//IL_0902: Unknown result type (might be due to invalid IL or missing references)
			//IL_0917: Expected O, but got Unknown
			List<Tribe> list = new List<Tribe>();
			List<CardInfo> list2 = new List<CardInfo>();
			List<List<CardBlueprint>> list3 = new List<List<CardBlueprint>>();
			List<Ability> list4 = new List<Ability>();
			bool flag = true;
			EncounterBlueprintData val = new EncounterBlueprintData();
			list = new List<Tribe> { (Tribe)5 };
			list2 = new List<CardInfo>();
			list2.AddRange(Cards.GetAllMagmaCards());
			list3 = new List<List<CardBlueprint>>
			{
				new List<CardBlueprint>
				{
					new CardBlueprint
					{
						card = CardLoader.GetCardByName("bittyRegions_Drake"),
						difficultyReplace = true,
						difficultyReq = 14,
						replacement = CardLoader.GetCardByName("bittyRegions_Hellhound")
					},
					new CardBlueprint
					{
						card = CardLoader.GetCardByName("Trap"),
						difficultyReplace = true,
						difficultyReq = 14,
						replacement = CardLoader.GetCardByName("TrapFrog")
					}
				},
				new List<CardBlueprint>
				{
					new CardBlueprint
					{
						card = CardLoader.GetCardByName("bittyRegions_Salamander"),
						minDifficulty = 8
					}
				},
				new List<CardBlueprint>
				{
					new CardBlueprint
					{
						card = CardLoader.GetCardByName("bittyRegions_Salamander"),
						difficultyReplace = true,
						minDifficulty = 8,
						difficultyReq = 14,
						replacement = CardLoader.GetCardByName("bittyRegions_Hellhound")
					},
					new CardBlueprint
					{
						card = CardLoader.GetCardByName("Trap"),
						difficultyReplace = true,
						minDifficulty = 4,
						difficultyReq = 8,
						replacement = CardLoader.GetCardByName("TrapFrog")
					}
				},
				new List<CardBlueprint>
				{
					new CardBlueprint
					{
						card = CardLoader.GetCardByName("bittyRegions_Salamander"),
						difficultyReplace = true,
						difficultyReq = 8,
						replacement = CardLoader.GetCardByName("bittyRegions_Drake")
					},
					new CardBlueprint
					{
						card = CardLoader.GetCardByName("bittyRegions_Shackle")
					}
				},
				new List<CardBlueprint>(),
				new List<CardBlueprint>
				{
					new CardBlueprint
					{
						card = CardLoader.GetCardByName("bittyRegions_Salamander"),
						difficultyReplace = true,
						difficultyReq = 14,
						replacement = CardLoader.GetCardByName("bittyRegions_Drake")
					}
				},
				new List<CardBlueprint>(),
				new List<CardBlueprint>
				{
					new CardBlueprint
					{
						card = CardLoader.GetCardByName("bittyRegions_Salamander")
					}
				}
			};
			list4 = new List<Ability> { (Ability)18 };
			flag = true;
			val = EncounterHelper.BuildBlueprint("bit_MartelP1", list, list4, flag, 0, 20, list2, list3);
			EncounterManager.Add(val);
			list = new List<Tribe> { (Tribe)5 };
			list2 = new List<CardInfo>();
			list2.AddRange(Cards.GetAllMagmaCards());
			list3 = new List<List<CardBlueprint>>
			{
				new List<CardBlueprint>
				{
					new CardBlueprint
					{
						card = CardLoader.GetCardByName("SquidCards")
					}
				},
				new List<CardBlueprint>
				{
					new CardBlueprint
					{
						card = CardLoader.GetCardByName("bittyRegions_Hellhound"),
						difficultyReplace = true,
						difficultyReq = 14,
						replacement = CardLoader.GetCardByName("bittyRegions_Turtle Rock")
					}
				},
				new List<CardBlueprint>
				{
					new CardBlueprint
					{
						card = CardLoader.GetCardByName("TrapFrog")
					},
					new CardBlueprint
					{
						card = CardLoader.GetCardByName("SquidCards")
					}
				},
				new List<CardBlueprint>(),
				new List<CardBlueprint>
				{
					new CardBlueprint
					{
						card = CardLoader.GetCardByName("bittyRegions_Salamander")
					}
				},
				new List<CardBlueprint>(),
				new List<CardBlueprint>
				{
					new CardBlueprint
					{
						card = CardLoader.GetCardByName("Trap")
					}
				},
				new List<CardBlueprint>(),
				new List<CardBlueprint>
				{
					new CardBlueprint
					{
						card = CardLoader.GetCardByName("bittyRegions_Salamander")
					}
				}
			};
			list4 = new List<Ability> { (Ability)18 };
			flag = true;
			val = EncounterHelper.BuildBlueprint("bit_MartelP2", list, list4, flag, 0, 20, list2, list3);
			EncounterManager.Add(val);
			list = new List<Tribe>();
			list2 = new List<CardInfo>();
			list3 = new List<List<CardBlueprint>>();
			list4 = new List<Ability>();
			flag = true;
			val = new EncounterBlueprintData();
			list = new List<Tribe> { (Tribe)6 };
			if (arachnid)
			{
				list = new List<Tribe> { NevernamedsTribes.Arachnid };
			}
			list2 = new List<CardInfo>
			{
				CardLoader.GetCardByName("Maggots"),
				CardLoader.GetCardByName("Mantis"),
				CardLoader.GetCardByName("Bullfrog")
			};
			list2.AddRange(Cards.GetAllInfestedCards());
			list2.RemoveAll((CardInfo x) => x.PowerLevel > 2);
			list3 = new List<List<CardBlueprint>>
			{
				new List<CardBlueprint>
				{
					new CardBlueprint
					{
						card = CardLoader.GetCardByName("bittyRegions_Mother Spider")
					},
					new CardBlueprint
					{
						card = CardLoader.GetCardByName("bittyRegions_Spiderling"),
						difficultyReplace = true,
						difficultyReq = 14,
						replacement = CardLoader.GetCardByName("bittyRegions_Parasitic Spider")
					}
				},
				new List<CardBlueprint>
				{
					new CardBlueprint
					{
						card = CardLoader.GetCardByName("bittyRegions_Parasitic Spider"),
						minDifficulty = 8
					}
				},
				new List<CardBlueprint>
				{
					new CardBlueprint
					{
						card = CardLoader.GetCardByName("bittyRegions_Parasitic Spider"),
						difficultyReplace = true,
						minDifficulty = 8,
						difficultyReq = 14,
						replacement = CardLoader.GetCardByName("bittyRegions_Mother Spider")
					},
					new CardBlueprint
					{
						card = CardLoader.GetCardByName("bittyRegions_Parasitic Spider"),
						difficultyReplace = true,
						minDifficulty = 4,
						difficultyReq = 8,
						replacement = CardLoader.GetCardByName("bittyRegions_Night Mare")
					}
				},
				new List<CardBlueprint>
				{
					new CardBlueprint
					{
						card = CardLoader.GetCardByName("bittyRegions_Parasitic Spider"),
						difficultyReplace = true,
						difficultyReq = 8,
						replacement = CardLoader.GetCardByName("bittyRegions_Mother Spider")
					},
					new CardBlueprint
					{
						card = CardLoader.GetCardByName("bittyRegions_Parasitic Spider")
					}
				},
				new List<CardBlueprint>(),
				new List<CardBlueprint>
				{
					new CardBlueprint
					{
						card = CardLoader.GetCardByName("bittyRegions_Parasitic Spider"),
						difficultyReplace = true,
						difficultyReq = 14,
						replacement = CardLoader.GetCardByName("bittyRegions_Mother Spider")
					}
				},
				new List<CardBlueprint>(),
				new List<CardBlueprint>
				{
					new CardBlueprint
					{
						card = CardLoader.GetCardByName("bittyRegions_Parasitic Spider")
					}
				}
			};
			list4 = new List<Ability> { (Ability)18 };
			flag = true;
			val = EncounterHelper.BuildBlueprint("bit_SpiderP1", list, list4, flag, 0, 20, list2, list3);
			EncounterManager.Add(val);
			list = new List<Tribe> { (Tribe)6 };
			if (arachnid)
			{
				list = new List<Tribe> { NevernamedsTribes.Arachnid };
			}
			list2 = new List<CardInfo>
			{
				CardLoader.GetCardByName("Maggots"),
				CardLoader.GetCardByName("Mantis"),
				CardLoader.GetCardByName("Bullfrog")
			};
			list2.AddRange(Cards.GetAllInfestedCards());
			list2.RemoveAll((CardInfo x) => x.PowerLevel > 2);
			list3 = new List<List<CardBlueprint>>
			{
				new List<CardBlueprint>
				{
					new CardBlueprint
					{
						card = CardLoader.GetCardByName("bittyRegions_Mother Spider")
					}
				},
				new List<CardBlueprint>
				{
					new CardBlueprint
					{
						card = CardLoader.GetCardByName("bittyRegions_Wolf Spider"),
						difficultyReplace = true,
						difficultyReq = 14,
						replacement = CardLoader.GetCardByName("bittyRegions_Giant Centipede")
					}
				},
				new List<CardBlueprint>
				{
					new CardBlueprint
					{
						card = CardLoader.GetCardByName("bittyRegions_Night Mare")
					},
					new CardBlueprint
					{
						card = CardLoader.GetCardByName("bittyRegions_Mother Spider")
					}
				},
				new List<CardBlueprint>(),
				new List<CardBlueprint>
				{
					new CardBlueprint
					{
						card = CardLoader.GetCardByName("bittyRegions_Parasitic Spider")
					}
				},
				new List<CardBlueprint>(),
				new List<CardBlueprint>
				{
					new CardBlueprint
					{
						card = CardLoader.GetCardByName("bittyRegions_Night Mare")
					}
				},
				new List<CardBlueprint>(),
				new List<CardBlueprint>
				{
					new CardBlueprint
					{
						card = CardLoader.GetCardByName("bittyRegions_Parasitic Spider")
					}
				}
			};
			list4 = new List<Ability> { (Ability)18 };
			flag = true;
			val = EncounterHelper.BuildBlueprint("bit_SpiderP2", list, list4, flag, 0, 20, list2, list3);
			EncounterManager.Add(val);
		}

		public static void AddBossNodes()
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			//IL_000c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0011: Unknown result type (might be due to invalid IL or missing references)
			//IL_0016: Unknown result type (might be due to invalid IL or missing references)
			//IL_0026: Unknown result type (might be due to invalid IL or missing references)
			//IL_0031: Unknown result type (might be due to invalid IL or missing references)
			//IL_0036: Unknown result type (might be due to invalid IL or missing references)
			//IL_0040: Expected O, but got Unknown
			//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_00df: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ea: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ef: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ff: 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_010f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0119: Expected O, but got Unknown
			//IL_01a9: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ae: Unknown result type (might be due to invalid IL or missing references)
			Plugin.magmaBossNode = new BossBattleNodeData
			{
				bossType = MagmaBossOpponent.FullOpponent.Id,
				specialBattleId = MagmaBossSpecialBattleSequencer.FullSequencer.Id,
				position = new Vector2(0.5f, 0.86f)
			};
			Type typeFromHandle = typeof(MagmaBossSpecialBattleSequencer);
			Type typeFromHandle2 = typeof(MagmaBossOpponent);
			Plugin.MagmaBossBattleSequencer = SpecialSequenceManager.Add("bitty45.inscryption.regions", typeFromHandle.Name, typeFromHandle).Id;
			Plugin.MagmaBoss = OpponentManager.Add("bitty45.inscryption.regions", typeFromHandle2.Name, Plugin.MagmaBossBattleSequencer, typeFromHandle2, new List<Texture2D>
			{
				Tools.LoadTexture("animated_bossnode_magma_1"),
				Tools.LoadTexture("animated_bossnode_magma_2"),
				Tools.LoadTexture("animated_bossnode_magma_3"),
				Tools.LoadTexture("animated_bossnode_magma_4")
			}).Id;
			Plugin.spiderBossNode = new BossBattleNodeData
			{
				bossType = SpiderBossOpponent.FullOpponent.Id,
				specialBattleId = SpiderBossSpecialBattleSequencer.FullSequencer.Id,
				position = new Vector2(0.5f, 0.86f)
			};
			Type typeFromHandle3 = typeof(SpiderBossSpecialBattleSequencer);
			Type typeFromHandle4 = typeof(SpiderBossOpponent);
			Plugin.SpiderBossBattleSequencer = SpecialSequenceManager.Add("bitty45.inscryption.regions", typeFromHandle3.Name, typeFromHandle3).Id;
			Plugin.SpiderBoss = OpponentManager.Add("bitty45.inscryption.regions", typeFromHandle4.Name, Plugin.SpiderBossBattleSequencer, typeFromHandle4, new List<Texture2D>
			{
				Tools.LoadTexture("animated_bossnode_magma_1"),
				Tools.LoadTexture("animated_bossnode_magma_2"),
				Tools.LoadTexture("animated_bossnode_magma_3"),
				Tools.LoadTexture("animated_bossnode_magma_4")
			}).Id;
		}
	}
	internal class Cards
	{
		public class TowerAppearanceBehaviour : CardAppearanceBehaviour
		{
			private Texture2D CardBG = Tools.LoadTexture("card_towerV2");

			public override void ApplyAppearance()
			{
				//IL_0045: Unknown result type (might be due to invalid IL or missing references)
				((Texture)CardBG).filterMode = (FilterMode)0;
				((CardAppearanceBehaviour)this).Card.RenderInfo.baseTextureOverride = (Texture)(object)CardBG;
				((CardAppearanceBehaviour)this).Card.renderInfo.forceEmissivePortrait = true;
				((CardAppearanceBehaviour)this).Card.StatsLayer.SetEmissionColor(GameColors.Instance.brightNearWhite);
				DoTweenToLightBlue();
			}

			public void DoTweenToWhite()
			{
				//IL_001b: Unknown result type (might be due to invalid IL or missing references)
				Tween.ShaderColor(((CardAppearanceBehaviour)this).Card.StatsLayer.Material, "_EmissionColor", GameColors.Instance.brightNearWhite, 1f, 0f, Tween.EaseInOut, (LoopType)0, (Action)null, (Action)DoTweenToLightBlue, true);
			}

			public void DoTweenToLightBlue()
			{
				//IL_001b: Unknown result type (might be due to invalid IL or missing references)
				Tween.ShaderColor(((CardAppearanceBehaviour)this).Card.StatsLayer.Material, "_EmissionColor", GameColors.Instance.glowSeafoam, 1f, 0f, Tween.EaseInOut, (LoopType)0, (Action)null, (Action)DoTweenToWhite, true);
			}

			public override void ResetAppearance()
			{
				//IL_0022: Unknown result type (might be due to invalid IL or missing references)
				((CardAppearanceBehaviour)this).Card.RenderInfo.forceEmissivePortrait = false;
				((CardAppearanceBehaviour)this).Card.StatsLayer.SetEmissionColor(GameColors.instance.glowSeafoam);
				Tween.Stop(((Object)((CardAppearanceBehaviour)this).Card.StatsLayer.Material).GetInstanceID());
			}
		}

		public class TowerGlowAppearanceBehaviour : CardAppearanceBehaviour
		{
			public override void ApplyAppearance()
			{
				//IL_0022: Unknown result type (might be due to invalid IL or missing references)
				((CardAppearanceBehaviour)this).Card.renderInfo.forceEmissivePortrait = true;
				((CardAppearanceBehaviour)this).Card.StatsLayer.SetEmissionColor(GameColors.Instance.brightNearWhite);
				DoTweenToLightBlue();
			}

			public void DoTweenToWhite()
			{
				//IL_001b: Unknown result type (might be due to invalid IL or missing references)
				Tween.ShaderColor(((CardAppearanceBehaviour)this).Card.StatsLayer.Material, "_EmissionColor", GameColors.Instance.brightNearWhite, 1f, 0f, Tween.EaseInOut, (LoopType)0, (Action)null, (Action)DoTweenToLightBlue, true);
			}

			public void DoTweenToLightBlue()
			{
				//IL_001b: Unknown result type (might be due to invalid IL or missing references)
				Tween.ShaderColor(((CardAppearanceBehaviour)this).Card.StatsLayer.Material, "_EmissionColor", GameColors.Instance.glowSeafoam, 1f, 0f, Tween.EaseInOut, (LoopType)0, (Action)null, (Action)DoTweenToWhite, true);
			}

			public override void ResetAppearance()
			{
				//IL_0022: Unknown result type (might be due to invalid IL or missing references)
				((CardAppearanceBehaviour)this).Card.RenderInfo.forceEmissivePortrait = false;
				((CardAppearanceBehaviour)this).Card.StatsLayer.SetEmissionColor(GameColors.instance.glowSeafoam);
				Tween.Stop(((Object)((CardAppearanceBehaviour)this).Card.StatsLayer.Material).GetInstanceID());
			}
		}

		public class MagmaAppearanceBehaviour : CardAppearanceBehaviour
		{
			private Texture2D CardBG = Tools.LoadTexture("card_magmaV7");

			public override void ApplyAppearance()
			{
				//IL_0045: Unknown result type (might be due to invalid IL or missing references)
				((Texture)CardBG).filterMode = (FilterMode)0;
				((CardAppearanceBehaviour)this).Card.RenderInfo.baseTextureOverride = (Texture)(object)CardBG;
				((CardAppearanceBehaviour)this).Card.renderInfo.forceEmissivePortrait = true;
				((CardAppearanceBehaviour)this).Card.StatsLayer.SetEmissionColor(GameColors.Instance.orange);
				DoTweenToYellow();
			}

			public void DoTweenToOrange()
			{
				//IL_001b: Unknown result type (might be due to invalid IL or missing references)
				Tween.ShaderColor(((CardAppearanceBehaviour)this).Card.StatsLayer.Material, "_EmissionColor", GameColors.Instance.orange, 0.5f, 0f, Tween.EaseInOut, (LoopType)0, (Action)null, (Action)DoTweenToYellow, true);
			}

			public void DoTweenToYellow()
			{
				//IL_001b: Unknown result type (might be due to invalid IL or missing references)
				Tween.ShaderColor(((CardAppearanceBehaviour)this).Card.StatsLayer.Material, "_EmissionColor", GameColors.Instance.yellow, 0.5f, 0f, Tween.EaseInOut, (LoopType)0, (Action)null, (Action)DoTweenToOrange, true);
			}

			public override void ResetAppearance()
			{
				//IL_0022: Unknown result type (might be due to invalid IL or missing references)
				((CardAppearanceBehaviour)this).Card.RenderInfo.forceEmissivePortrait = false;
				((CardAppearanceBehaviour)this).Card.StatsLayer.SetEmissionColor(GameColors.instance.glowSeafoam);
				Tween.Stop(((Object)((CardAppearanceBehaviour)this).Card.StatsLayer.Material).GetInstanceID());
			}
		}

		public class MagmaGlowAppearanceBehaviour : CardAppearanceBehaviour
		{
			public override void ApplyAppearance()
			{
				//IL_0022: Unknown result type (might be due to invalid IL or missing references)
				((CardAppearanceBehaviour)this).Card.renderInfo.forceEmissivePortrait = true;
				((CardAppearanceBehaviour)this).Card.StatsLayer.SetEmissionColor(GameColors.Instance.orange);
				DoTweenToYellow();
			}

			public void DoTweenToOrange()
			{
				//IL_001b: Unknown result type (might be due to invalid IL or missing references)
				Tween.ShaderColor(((CardAppearanceBehaviour)this).Card.StatsLayer.Material, "_EmissionColor", GameColors.Instance.orange, 0.5f, 0f, Tween.EaseInOut, (LoopType)0, (Action)null, (Action)DoTweenToYellow, true);
			}

			public void DoTweenToYellow()
			{
				//IL_001b: Unknown result type (might be due to invalid IL or missing references)
				Tween.ShaderColor(((CardAppearanceBehaviour)this).Card.StatsLayer.Material, "_EmissionColor", GameColors.Instance.yellow, 0.5f, 0f, Tween.EaseInOut, (LoopType)0, (Action)null, (Action)DoTweenToOrange, true);
			}

			public override void ResetAppearance()
			{
				//IL_0022: Unknown result type (might be due to invalid IL or missing references)
				((CardAppearanceBehaviour)this).Card.RenderInfo.forceEmissivePortrait = false;
				((CardAppearanceBehaviour)this).Card.StatsLayer.SetEmissionColor(GameColors.instance.glowSeafoam);
				Tween.Stop(((Object)((CardAppearanceBehaviour)this).Card.StatsLayer.Material).GetInstanceID());
			}
		}

		public class InfestedAppearanceBehaviour : CardAppearanceBehaviour
		{
			private Texture2D CardBG = Tools.LoadTexture("card_chaosV5");

			public override void ApplyAppearance()
			{
				//IL_0045: Unknown result type (might be due to invalid IL or missing references)
				((Texture)CardBG).filterMode = (FilterMode)0;
				((CardAppearanceBehaviour)this).Card.RenderInfo.baseTextureOverride = (Texture)(object)CardBG;
				((CardAppearanceBehaviour)this).Card.renderInfo.forceEmissivePortrait = true;
				((CardAppearanceBehaviour)this).Card.StatsLayer.SetEmissionColor(GameColors.Instance.lightPurple);
				DoTweenToDarkGreen();
			}

			public void DoTweenToLightGreen()
			{
				//IL_001b: Unknown result type (might be due to invalid IL or missing references)
				Tween.ShaderColor(((CardAppearanceBehaviour)this).Card.StatsLayer.Material, "_EmissionColor", GameColors.Instance.brightLimeGreen, 0.5f, 0f, Tween.EaseInOut, (LoopType)0, (Action)null, (Action)DoTweenToDarkGreen, true);
			}

			public void DoTweenToDarkGreen()
			{
				//IL_001b: Unknown result type (might be due to invalid IL or missing references)
				Tween.ShaderColor(((CardAppearanceBehaviour)this).Card.StatsLayer.Material, "_EmissionColor", GameColors.Instance.darkLimeGreen, 0.5f, 0f, Tween.EaseInOut, (LoopType)0, (Action)null, (Action)DoTweenToLightGreen, true);
			}

			public override void ResetAppearance()
			{
				//IL_0022: Unknown result type (might be due to invalid IL or missing references)
				((CardAppearanceBehaviour)this).Card.RenderInfo.forceEmissivePortrait = false;
				((CardAppearanceBehaviour)this).Card.StatsLayer.SetEmissionColor(GameColors.instance.glowSeafoam);
				Tween.Stop(((Object)((CardAppearanceBehaviour)this).Card.StatsLayer.Material).GetInstanceID());
			}
		}

		public class InfestedGlowAppearanceBehaviour : CardAppearanceBehaviour
		{
			public override void ApplyAppearance()
			{
				//IL_0022: Unknown result type (might be due to invalid IL or missing references)
				((CardAppearanceBehaviour)this).Card.renderInfo.forceEmissivePortrait = true;
				((CardAppearanceBehaviour)this).Card.StatsLayer.SetEmissionColor(GameColors.Instance.lightPurple);
				DoTweenToDarkGreen();
			}

			public void DoTweenToLightGreen()
			{
				//IL_001b: Unknown result type (might be due to invalid IL or missing references)
				Tween.ShaderColor(((CardAppearanceBehaviour)this).Card.StatsLayer.Material, "_EmissionColor", GameColors.Instance.brightLimeGreen, 0.5f, 0f, Tween.EaseInOut, (LoopType)0, (Action)null, (Action)DoTweenToDarkGreen, true);
			}

			public void DoTweenToDarkGreen()
			{
				//IL_001b: Unknown result type (might be due to invalid IL or missing references)
				Tween.ShaderColor(((CardAppearanceBehaviour)this).Card.StatsLayer.Material, "_EmissionColor", GameColors.Instance.darkLimeGreen, 0.5f, 0f, Tween.EaseInOut, (LoopType)0, (Action)null, (Action)DoTweenToLightGreen, true);
			}

			public override void ResetAppearance()
			{
				//IL_0022: Unknown result type (might be due to invalid IL or missing references)
				((CardAppearanceBehaviour)this).Card.RenderInfo.forceEmissivePortrait = false;
				((CardAppearanceBehaviour)this).Card.StatsLayer.SetEmissionColor(GameColors.instance.glowSeafoam);
				Tween.Stop(((Object)((CardAppearanceBehaviour)this).Card.StatsLayer.Material).GetInstanceID());
			}
		}

		internal const string CardPrefix = "bittyRegions";

		internal const string CardPrefixPack = "bittyRegionsPack";

		public static readonly Appearance TowerAppearance = CardAppearanceBehaviourManager.Add("bitty45.inscryption.regions", "TowerAppearance", typeof(TowerAppearanceBehaviour)).Id;

		public static readonly Appearance TowerGlowAppearance = CardAppearanceBehaviourManager.Add("bitty45.inscryption.regions", "TowerGlowAppearance", typeof(TowerGlowAppearanceBehaviour)).Id;

		public static readonly Appearance MagmaAppearance = CardAppearanceBehaviourManager.Add("bitty45.inscryption.regions", "MagmaAppearance", typeof(MagmaAppearanceBehaviour)).Id;

		public static readonly Appearance MagmaGlowAppearance = CardAppearanceBehaviourManager.Add("bitty45.inscryption.regions", "MagmaGlowAppearance", typeof(MagmaGlowAppearanceBehaviour)).Id;

		public static readonly Appearance InfestedAppearance = CardAppearanceBehaviourManager.Add("bitty45.inscryption.regions", "InfestedAppearance", typeof(InfestedAppearanceBehaviour)).Id;

		public static readonly Appearance InfestedGlowAppearance = CardAppearanceBehaviourManager.Add("bitty45.inscryption.regions", "InfestedGlowAppearance", typeof(InfestedGlowAppearanceBehaviour)).Id;

		public static int magmaId = 1;

		public static int infestedId = 2;

		public static int towerId = 3;

		public static void AddCards()
		{
			//IL_04dd: Unknown result type (might be due to invalid IL or missing references)
			//IL_0526: Unknown result type (might be due to invalid IL or missing references)
			//IL_052c: Expected I4, but got Unknown
			//IL_053e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0544: Expected I4, but got Unknown
			//IL_056e: Unknown result type (might be due to invalid IL or missing references)
			//IL_05a7: Unknown result type (might be due to invalid IL or missing references)
			//IL_05ad: Expected I4, but got Unknown
			//IL_05bf: Unknown result type (might be due to invalid IL or missing references)
			//IL_05c5: Expected I4, but got Unknown
			//IL_05ef: Unknown result type (might be due to invalid IL or missing references)
			//IL_0623: Unknown result type (might be due to invalid IL or missing references)
			//IL_0629: Expected I4, but got Unknown
			//IL_063b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0641: Expected I4, but got Unknown
			//IL_066b: Unknown result type (might be due to invalid IL or missing references)
			//IL_06aa: Unknown result type (might be due to invalid IL or missing references)
			//IL_06b0: Expected I4, but got Unknown
			//IL_06dd: Unknown result type (might be due to invalid IL or missing references)
			//IL_06e3: Expected I4, but got Unknown
			//IL_070d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0769: Unknown result type (might be due to invalid IL or missing references)
			//IL_076f: Expected I4, but got Unknown
			//IL_07bc: Unknown result type (might be due to invalid IL or missing references)
			//IL_0808: Unknown result type (might be due to invalid IL or missing references)
			//IL_080e: Expected I4, but got Unknown
			//IL_0820: Unknown result type (might be due to invalid IL or missing references)
			//IL_0826: Expected I4, but got Unknown
			//IL_0873: Unknown result type (might be due to invalid IL or missing references)
			//IL_08d4: Unknown result type (might be due to invalid IL or missing references)
			//IL_08da: Expected I4, but got Unknown
			//IL_0927: Unknown result type (might be due to invalid IL or missing references)
			//IL_0973: Unknown result type (might be due to invalid IL or missing references)
			//IL_0979: Expected I4, but got Unknown
			//IL_0986: Unknown result type (might be due to invalid IL or missing references)
			//IL_098c: Expected I4, but got Unknown
			//IL_09d9: Unknown result type (might be due to invalid IL or missing references)
			//IL_0a25: Unknown result type (might be due to invalid IL or missing references)
			//IL_0a2b: Expected I4, but got Unknown
			//IL_0a38: Unknown result type (might be due to invalid IL or missing references)
			//IL_0a3e: Expected I4, but got Unknown
			//IL_0a9c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0ae8: Unknown result type (might be due to invalid IL or missing references)
			//IL_0aee: Expected I4, but got Unknown
			//IL_0b00: Unknown result type (might be due to invalid IL or missing references)
			//IL_0b06: Expected I4, but got Unknown
			//IL_0b44: Unknown result type (might be due to invalid IL or missing references)
			//IL_0b90: Unknown result type (might be due to invalid IL or missing references)
			//IL_0b96: Expected I4, but got Unknown
			//IL_0ba8: Unknown result type (might be due to invalid IL or missing references)
			//IL_0bae: Expected I4, but got Unknown
			//IL_0bfb: Unknown result type (might be due to invalid IL or missing references)
			//IL_0c47: Unknown result type (might be due to invalid IL or missing references)
			//IL_0c4d: Expected I4, but got Unknown
			//IL_0c5a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0c60: Expected I4, but got Unknown
			//IL_0cd2: Unknown result type (might be due to invalid IL or missing references)
			//IL_0d11: Unknown result type (might be due to invalid IL or missing references)
			//IL_0d17: Expected I4, but got Unknown
			//IL_0d24: Unknown result type (might be due to invalid IL or missing references)
			//IL_0d2a: Expected I4, but got Unknown
			//IL_0d37: Unknown result type (might be due to invalid IL or missing references)
			//IL_0d3d: Expected I4, but got Unknown
			//IL_0d5d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0dae: Unknown result type (might be due to invalid IL or missing references)
			//IL_0db4: Expected I4, but got Unknown
			//IL_0de1: Unknown result type (might be due to invalid IL or missing references)
			//IL_0de7: Expected I4, but got Unknown
			//IL_0df3: Unknown result type (might be due to invalid IL or missing references)
			//IL_0e61: Unknown result type (might be due to invalid IL or missing references)
			//IL_0e67: Expected I4, but got Unknown
			//IL_0e74: Unknown result type (might be due to invalid IL or missing references)
			//IL_0e7a: Expected I4, but got Unknown
			//IL_0ed7: Unknown result type (might be due to invalid IL or missing references)
			//IL_0f26: Unknown result type (might be due to invalid IL or missing references)
			//IL_0f2c: Expected I4, but got Unknown
			//IL_0f89: Unknown result type (might be due to invalid IL or missing references)
			//IL_0fd8: Unknown result type (might be due to invalid IL or missing references)
			//IL_0fde: Expected I4, but got Unknown
			//IL_0feb: Unknown result type (might be due to invalid IL or missing references)
			//IL_0ff1: Expected I4, but got Unknown
			//IL_104e: Unknown result type (might be due to invalid IL or missing references)
			//IL_1082: Unknown result type (might be due to invalid IL or missing references)
			//IL_1088: Expected I4, but got Unknown
			//IL_109a: Unknown result type (might be due to invalid IL or missing references)
			//IL_10a0: Expected I4, but got Unknown
			//IL_10da: Unknown result type (might be due to invalid IL or missing references)
			//IL_1126: Unknown result type (might be due to invalid IL or missing references)
			//IL_112c: Expected I4, but got Unknown
			//IL_114e: Unknown result type (might be due to invalid IL or missing references)
			//IL_1154: Expected I4, but got Unknown
			//IL_11b1: Unknown result type (might be due to invalid IL or missing references)
			//IL_11e5: Unknown result type (might be due to invalid IL or missing references)
			//IL_11eb: Expected I4, but got Unknown
			//IL_122a: Unknown result type (might be due to invalid IL or missing references)
			//IL_1276: Unknown result type (might be due to invalid IL or missing references)
			//IL_127c: Expected I4, but got Unknown
			//IL_1289: Unknown result type (might be due to invalid IL or missing references)
			//IL_128f: Expected I4, but got Unknown
			//IL_12f0: Unknown result type (might be due to invalid IL or missing references)
			//IL_133c: Unknown result type (might be due to invalid IL or missing references)
			//IL_1342: Expected I4, but got Unknown
			//IL_134f: Unknown result type (might be due to invalid IL or missing references)
			//IL_1355: Expected I4, but got Unknown
			//IL_13a2: Unknown result type (might be due to invalid IL or missing references)
			//IL_1403: Unknown result type (might be due to invalid IL or missing references)
			//IL_1409: Expected I4, but got Unknown
			//IL_1456: Unknown result type (might be due to invalid IL or missing references)
			//IL_14af: Unknown result type (might be due to invalid IL or missing references)
			//IL_14b5: Expected I4, but got Unknown
			//IL_14c7: Unknown result type (might be due to invalid IL or missing references)
			//IL_14cd: Expected I4, but got Unknown
			//IL_1507: Unknown result type (might be due to invalid IL or missing references)
			//IL_155d: Unknown result type (might be due to invalid IL or missing references)
			//IL_15bb: Unknown result type (might be due to invalid IL or missing references)
			//IL_15c1: Expected I4, but got Unknown
			//IL_15eb: Unknown result type (might be due to invalid IL or missing references)
			//IL_1646: Unknown result type (might be due to invalid IL or missing references)
			//IL_164c: Expected I4, but got Unknown
			//IL_1659: Unknown result type (might be due to invalid IL or missing references)
			//IL_165f: Expected I4, but got Unknown
			//IL_16cf: Unknown result type (might be due to invalid IL or missing references)
			//IL_1723: Unknown result type (might be due to invalid IL or missing references)
			//IL_1729: Expected I4, but got Unknown
			//IL_1736: Unknown result type (might be due to invalid IL or missing references)
			//IL_173c: Expected I4, but got Unknown
			//IL_1789: Unknown result type (might be due to invalid IL or missing references)
			//IL_17da: Unknown result type (might be due to invalid IL or missing references)
			//IL_17e0: Expected I4, but got Unknown
			//IL_17ed: Unknown result type (might be due to invalid IL or missing references)
			//IL_17f3: Expected I4, but got Unknown
			//IL_1840: Unknown result type (might be due to invalid IL or missing references)
			//IL_1879: Unknown result type (might be due to invalid IL or missing references)
			//IL_187f: Expected I4, but got Unknown
			//IL_188c: Unknown result type (might be due to invalid IL or missing references)
			//IL_1892: Expected I4, but got Unknown
			//IL_18d0: Unknown result type (might be due to invalid IL or missing references)
			//IL_0053: Unknown result type (might be due to invalid IL or missing references)
			//IL_0059: Expected I4, but got Unknown
			//IL_00a1: Unknown result type (might be due to invalid IL or missing references)
			//IL_013b: Unknown result type (might be due to invalid IL or missing references)
			//IL_01d7: Unknown result type (might be due to invalid IL or missing references)
			//IL_0223: Unknown result type (might be due to invalid IL or missing references)
			//IL_0229: Expected I4, but got Unknown
			//IL_0280: Unknown result type (might be due to invalid IL or missing references)
			//IL_02d1: Unknown result type (might be due to invalid IL or missing references)
			//IL_02d7: Expected I4, but got Unknown
			//IL_031f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0370: Unknown result type (might be due to invalid IL or missing references)
			//IL_0376: Expected I4, but got Unknown
			//IL_03be: Unknown result type (might be due to invalid IL or missing references)
			//IL_040a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0410: Expected I4, but got Unknown
			//IL_0461: Unknown result type (might be due to invalid IL or missing references)
			int? num;
			CardInfo val;
			if (Chainloader.PluginInfos.ContainsKey("zorro.inscryption.infiniscryption.packmanager"))
			{
				val = CardExtensions.SetPortraitAndEmission(CardExtensions.AddMetaCategories(CardExtensions.AddTribes(CardExtensions.AddAbilities(CardExtensions.SetCost(CardManager.New("bittyRegionsPack", "Hyena", "Hyena", 1, 2, "The mad laughter of a wild dog."), (int?)1, (int?)0, (int?)0, (List<GemType>)null), (Ability[])(object)new Ability[1] { (Ability)(int)Sigils.GiveBoneStock.ability }), (Tribe[])(object)new Tribe[1] { (Tribe)3 }), (CardMetaCategory[])(object)new CardMetaCategory[2]
				{
					default(CardMetaCategory),
					(CardMetaCategory)1
				}), Tools.LoadTexture("portrait_hyena_v2"), Tools.LoadTexture("portrait_hyena_v2_emission"), (FilterMode?)null);
				val.temple = (CardTemple)0;
				CardManager.Add("bittyRegionsPack", val);
				CardInfo obj = CardManager.New("bittyRegionsPack", "Chihuahua", "Chihuahua", 1, 1, "Savage and vicious, all wrapped up in a tiny package.");
				num = 3;
				val = CardExtensions.SetPortraitAndEmission(CardExtensions.AddMetaCategories(CardExtensions.AddTribes(CardExtensions.AddAbilities(CardExtensions.SetCost(obj, (int?)0, num, (int?)0, (List<GemType>)null), (Ability[])(object)new Ability[1] { (Ability)104 }), (Tribe[])(object)new Tribe[1] { (Tribe)3 }), (CardMetaCategory[])(object)new CardMetaCategory[2]
				{
					default(CardMetaCategory),
					(CardMetaCategory)1
				}), Tools.LoadTexture("portrait_chihuahua"), Tools.LoadTexture("portrait_chihuahua_emission"), (FilterMode?)null);
				val.temple = (CardTemple)0;
				CardManager.Add("bittyRegionsPack", val);
				val = CardExtensions.SetPortraitAndEmission(CardExtensions.AddMetaCategories(CardExtensions.AddTribes(CardExtensions.AddAbilities(CardExtensions.SetCost(CardManager.New("bittyRegionsPack", "Woodpecker", "Woodpecker", 1, 2, "The persistent Woodpecker, it strikes endlessly."), (int?)2, (int?)0, (int?)0, (List<GemType>)null), (Ability[])(object)new Ability[2]
				{
					(Ability)19,
					(Ability)100
				}), (Tribe[])(object)new Tribe[1] { (Tribe)2 }), (CardMetaCategory[])(object)new CardMetaCategory[2]
				{
					default(CardMetaCategory),
					(CardMetaCategory)1
				}), Tools.LoadTexture("portrait_woodpecker"), Tools.LoadTexture("portrait_woodpecker_emission"), (FilterMode?)null);
				val.temple = (CardTemple)0;
				CardManager.Add("bittyRegionsPack", val);
				val = CardExtensions.SetPixelPortrait(CardExtensions.SetPortraitAndEmission(CardExtensions.AddMetaCategories(CardExtensions.SetTribes(CardExtensions.AddAbilities(CardExtensions.SetCost(CardManager.New("bittyRegionsPack", "Squirrel Ball", "Squirrel Ball", 0, 2, "The ever-rolling squirrel ball, a strange and bizzare phenomenon."), (int?)1, (int?)0, (int?)0, (List<GemType>)null), (Ability[])(object)new Ability[1] { (Ability)(int)Sigils.GiveStrafePushSquirrel.ability }), (Tribe[])(object)new Tribe[1] { (Tribe)1 }), (CardMetaCategory[])(object)new CardMetaCategory[2]
				{
					default(CardMetaCategory),
					(CardMetaCategory)1
				}), Tools.LoadTexture("portrait_squirrelball_zepavil"), Tools.LoadTexture("portrait_squirrelball_emission_zepavil"), (FilterMode?)null), Tools.LoadSprite("pixelportrait_squirrelball"));
				val.temple = (CardTemple)0;
				CardManager.Add("bittyRegionsPack", val);
				val = CardExtensions.SetPortraitAndEmission(CardExtensions.AddMetaCategories(CardExtensions.SetTribes(CardExtensions.AddAbilities(CardExtensions.SetCost(CardManager.New("bittyRegionsPack", "Hawk", "Hawk", 3, 1, "the mighty hawk, champion of the skies."), (int?)2, (int?)0, (int?)0, (List<GemType>)null), (Ability[])(object)new Ability[2]
				{
					(Ability)19,
					(Ability)(int)Sigils.GiveFirstStrike.ability
				}), (Tribe[])(object)new Tribe[1] { (Tribe)2 }), (CardMetaCategory[])(object)new CardMetaCategory[2]
				{
					default(CardMetaCategory),
					(CardMetaCategory)1
				}), Tools.LoadTexture("portrait_hawk"), Tools.LoadTexture("portrait_hawk_emission"), (FilterMode?)null);
				val.temple = (CardTemple)0;
				CardManager.Add("bittyRegionsPack", val);
				val = CardExtensions.SetPortraitAndEmission(CardExtensions.AddMetaCategories(CardExtensions.AddTribes(CardExtensions.AddAbilities(CardExtensions.SetCost(CardManager.New("bittyRegionsPack", "Seagull", "Seagull", 1, 2, "Known as rats of the skies... Or was that another bird?"), (int?)1, (int?)1, (int?)0, (List<GemType>)null), (Ability[])(object)new Ability[2]
				{
					(Ability)19,
					(Ability)(int)Sigils.GiveFlipAttack.ability
				}), (Tribe[])(object)new Tribe[1] { (Tribe)2 }), (CardMetaCategory[])(object)new CardMetaCategory[2]
				{
					default(CardMetaCategory),
					(CardMetaCategory)1
				}), Tools.LoadTexture("portrait_seagull_v2"), Tools.LoadTexture("portrait_seagull_emission"), (FilterMode?)null);
				val.temple = (CardTemple)0;
				CardManager.Add("bittyRegionsPack", val);
				val = CardExtensions.SetPixelPortrait(CardExtensions.SetPortraitAndEmission(CardExtensions.AddMetaCategories(CardExtensions.AddAbilities(CardExtensions.SetCost(CardManager.New("bittyRegionsPack", "Hermit Crab", "Hermit Crab", 1, 2, "The humble hermit crab. Always seeking a new home."), (int?)1, (int?)0, (int?)0, (List<GemType>)null), (Ability[])(object)new Ability[1] { (Ability)(int)Sigils.GiveTerrainDweller.ability }), (CardMetaCategory[])(object)new CardMetaCategory[2]
				{
					default(CardMetaCategory),
					(CardMetaCategory)1
				}), Tools.LoadTexture("portrait_hermitcrab"), Tools.LoadTexture("portrait_hermitcrab_emission"), (FilterMode?)null), Tools.LoadTexture("pixelportrait_syntax_hermitcrab"), (FilterMode?)null);
				val.temple = (CardTemple)0;
				CardManager.Add("bittyRegionsPack", val);
				Plugin.Log.LogInfo((object)"Card Pack Cards Loaded!");
			}
			val = CardExtensions.SetPortraitAndEmission(CardExtensions.SetTerrain(CardExtensions.AddAbilities(CardManager.New("bittyRegions", "Rock Wall", "Rock Wall", 0, 5, "A sheer wall of rock."), (Ability[])(object)new Ability[2]
			{
				(Ability)23,
				(Ability)105
			})), Tools.LoadTexture("portrait_test"), Tools.LoadTexture("portrait_test"), (FilterMode?)null);
			val.temple = (CardTemple)0;
			CardManager.Add("bittyRegions", val);
			Plugin.Log.LogInfo((object)"Misc Cards Loaded!");
			val = CardExtensions.SetPortraitAndEmission(CardExtensions.AddAppearances(CardExtensions.SetTerrain(CardExtensions.AddAbilities(CardManager.New("bittyRegions", "Fire Tree", "Flaming Tree", 0, 3, "A world on fire."), (Ability[])(object)new Ability[2]
			{
				(Ability)23,
				(Ability)(int)Sigils.GiveInflamed.ability
			})), (Appearance[])(object)new Appearance[1] { (Appearance)(int)MagmaGlowAppearance }), Tools.LoadTexture("portrait_flamingtree"), Tools.LoadTexture("portrait_flamingtree_emission"), (FilterMode?)null);
			val.temple = (CardTemple)0;
			CardManager.Add("bittyRegions", val);
			val = CardExtensions.SetPortraitAndEmission(CardExtensions.AddAppearances(CardExtensions.SetTerrain(CardExtensions.AddAbilities(CardManager.New("bittyRegions", "Coal Pile", "Coal Pile", 0, 2, "Fuel for the flames."), (Ability[])(object)new Ability[2]
			{
				(Ability)23,
				(Ability)(int)Sigils.GiveBellows.ability
			})), (Appearance[])(object)new Appearance[1] { (Appearance)(int)MagmaGlowAppearance }), Tools.LoadTexture("portrait_coalpile"), Tools.LoadTexture("portrait_coalpile_emission"), (FilterMode?)null);
			val.temple = (CardTemple)0;
			CardManager.Add("bittyRegions", val);
			val = CardExtensions.SetPortraitAndEmission(CardExtensions.AddAppearances(CardExtensions.SetTerrain(CardExtensions.AddAbilities(CardManager.New("bittyRegions", "Shackle", "Shackle", 0, 1, "Bindings forged in flames."), (Ability[])(object)new Ability[1] { (Ability)(int)Sigils.GiveHandLimit.ability })), (Appearance[])(object)new Appearance[1] { (Appearance)(int)MagmaGlowAppearance }), Tools.LoadTexture("portrait_shackle"), Tools.LoadTexture("portrait_shackle_emission"), (FilterMode?)null);
			val.temple = (CardTemple)0;
			CardManager.Add("bittyRegions", val);
			val = CardExtensions.SetPortraitAndEmission(CardExtensions.AddAppearances(CardExtensions.SetTerrain(CardExtensions.SetStatIcon(CardExtensions.AddSpecialAbilities(CardExtensions.AddAbilities(CardExtensions.SetBloodCost(CardManager.New("bittyRegions", "Knight", "Knight", 0, 3, "Creations of steel and fire."), (int?)2), (Ability[])(object)new Ability[2]
			{
				(Ability)(int)Sigils.GiveDiscardShield.ability,
				(Ability)23
			}), (SpecialTriggeredAbility[])(object)new SpecialTriggeredAbility[1] { (SpecialTriggeredAbility)23 }), (SpecialStatIcon)6)), (Appearance[])(object)new Appearance[1] { (Appearance)(int)MagmaGlowAppearance }), Tools.LoadTexture("portrait_knight"), Tools.LoadTexture("portrait_knight_emission"), (FilterMode?)null);
			val.temple = (CardTemple)0;
			CardManager.Add("bittyRegions", val);
			val = CardExtensions.SetExtendedProperty(CardExtensions.SetPortraitAndEmission(CardExtensions.AddTribes(CardExtensions.AddAppearances(CardExtensions.AddAbilities(CardExtensions.SetCost(CardManager.New("bittyRegions", "Turtle Rock", "Turtle Rock", 4, 4, "Covered in rocks, with strength to reflect it."), (int?)3, (int?)0, (int?)0, (List<GemType>)null), (Ability[])(object)new Ability[1] { (Ability)105 }), (Appearance[])(object)new Appearance[1] { (Appearance)(int)MagmaAppearance }), (Tribe[])(object)new Tribe[1] { (Tribe)5 }), Tools.LoadTexture("portrait_rockturtle"), Tools.LoadTexture("portrait_rockturtle_emission"), (FilterMode?)null), "bitty_region", (object)magmaId);
			val.temple = (CardTemple)0;
			CardManager.Add("bittyRegions", val);
			val = CardExtensions.SetExtendedProperty(CardExtensions.SetPortraitAndEmission(CardExtensions.AddTribes(CardExtensions.AddAppearances(CardExtensions.AddAbilities(CardExtensions.SetCost(CardManager.New("bittyRegions", "Phoenix", "Phoenix", 3, 2, "The majestic Phoenix. Always comes back."), (int?)2, (int?)0, (int?)0, (List<GemType>)null), (Ability[])(object)new Ability[2]
			{
				(Ability)(int)Sigils.GiveRecursive.ability,
				(Ability)19
			}), (Appearance[])(object)new Appearance[1] { (Appearance)(int)MagmaAppearance }), (Tribe[])(object)new Tribe[1] { (Tribe)2 }), Tools.LoadTexture("portrait_firebird"), Tools.LoadTexture("portrait_firebird_emission"), (FilterMode?)null), "bitty_region", (object)magmaId);
			val.temple = (CardTemple)0;
			CardManager.Add("bittyRegions", val);
			val = CardExtensions.SetExtendedProperty(CardExtensions.SetPortraitAndEmission(CardExtensions.AddTribes(CardExtensions.AddAppearances(CardExtensions.AddAbilities(CardExtensions.SetCost(CardManager.New("bittyRegions", "Fire Flamingo", "Flamemingo", 2, 1, "A flamingo in terrible pain. Not to be mistaken with the majestic Phoenix."), (int?)1, (int?)0, (int?)0, (List<GemType>)null), (Ability[])(object)new Ability[2]
			{
				(Ability)19,
				(Ability)35
			}), (Appearance[])(object)new Appearance[1] { (Appearance)(int)MagmaAppearance }), (Tribe[])(object)new Tribe[1] { (Tribe)2 }), Tools.LoadTexture("portrait_flamingo"), Tools.LoadTexture("portrait_flamingo_emission"), (FilterMode?)null), "bitty_region", (object)magmaId);
			val.temple = (CardTemple)0;
			CardManager.Add("bittyRegions", val);
			val = CardExtensions.SetExtendedProperty(CardExtensions.SetPortraitAndEmission(CardExtensions.AddTribes(CardExtensions.AddAppearances(CardExtensions.AddAbilities(CardExtensions.SetCost(CardManager.New("bittyRegions", "Drake", "Drake", 3, 1, "Dwellers of volcanos and other infernal places."), (int?)2, (int?)0, (int?)0, (List<GemType>)null), (Ability[])(object)new Ability[1] { (Ability)(int)Sigils.GiveBlazingDeck.ability }), (Appearance[])(object)new Appearance[1] { (Appearance)(int)MagmaAppearance }), (Tribe[])(object)new Tribe[1] { (Tribe)5 }), Tools.LoadTexture("portrait_dragon"), Tools.LoadTexture("portrait_dragon_emission"), (FilterMode?)null), "bitty_region", (object)magmaId);
			val.temple = (CardTemple)0;
			CardManager.Add("bittyRegions", val);
			val = CardExtensions.SetExtendedProperty(CardExtensions.SetPortraitAndEmission(CardExtensions.SetEvolve(CardExtensions.AddTribes(CardExtensions.AddAppearances(CardExtensions.AddAbilities(CardExtensions.SetCost(CardManager.New("bittyRegions", "Salamander", "Salamander", 1, 2, "A slippery little creature."), (int?)1, (int?)0, (int?)0, (List<GemType>)null), (Ability[])(object)new Ability[1] { (Ability)(int)GiveFleetingDraw.ability }), (Appearance[])(object)new Appearance[1] { (Appearance)(int)MagmaAppearance }), (Tribe[])(object)new Tribe[1] { (Tribe)5 }), CardLoader.GetCardByName("bittyRegions_Drake"), 1, (IEnumerable<CardModificationInfo>)null), Tools.LoadTexture("portrait_salamander_v2"), Tools.LoadTexture("portrait_salamander_emission_v2"), (FilterMode?)null), "bitty_region", (object)magmaId);
			val.temple = (CardTemple)0;
			CardManager.Add("bittyRegions", val);
			val = CardExtensions.SetExtendedProperty(CardExtensions.SetPortraitAndEmission(CardExtensions.AddAppearances(CardExtensions.AddAbilities(CardExtensions.SetCost(CardManager.New("bittyRegions", "Flaming Salmon", "Flaming Salmon", 2, 2, "A Salmon scarred by searing flames. Native to lava pools."), (int?)2, (int?)0, (int?)0, (List<GemType>)null), (Ability[])(object)new Ability[2]
			{
				(Ability)(int)GiveStrafeJump.ability,
				(Ability)13
			}), (Appearance[])(object)new Appearance[1] { (Appearance)(int)MagmaAppearance }), Tools.LoadTexture("portrait_flamingsalmon"), Tools.LoadTexture("portrait_flamingsalmon_emission"), (FilterMode?)null), "bitty_region", (object)magmaId);
			val.temple = (CardTemple)0;
			CardManager.Add("bittyRegions", val);
			val = CardExtensions.SetExtendedProperty(CardExtensions.SetPortraitAndEmission(CardExtensions.AddTribes(CardExtensions.AddAppearances(CardExtensions.AddAbilities(CardExtensions.SetCost(CardManager.New("bittyRegions", "Hellhound", "Hellhound", 2, 3, "A savage beast of the depths."), (int?)2, (int?)0, (int?)0, (List<GemType>)null), (Ability[])(object)new Ability[2]
			{
				(Ability)(int)GiveFleetingDraw.ability,
				(Ability)18
			}), (Appearance[])(object)new Appearance[1] { (Appearance)(int)MagmaAppearance }), (Tribe[])(object)new Tribe[1] { (Tribe)3 }), Tools.LoadTexture("portrait_hellhound"), Tools.LoadTexture("portrait_hellhound_emission"), (FilterMode?)null), "bitty_region", (object)magmaId);
			val.temple = (CardTemple)0;
			CardManager.Add("bittyRegions", val);
			val = CardExtensions.SetExtendedProperty(CardExtensions.SetPortraitAndEmission(CardExtensions.SetStatIcon(CardExtensions.AddSpecialAbilities(CardExtensions.AddTraits(CardExtensions.AddTribes(CardExtensions.AddAppearances(CardExtensions.AddAbilities(CardExtensions.SetCost(CardManager.New("bittyRegions", "Fire Ant", "Fire Ant", 0, 1, "Hundreds scurry from their anthill."), (int?)1, (int?)0, (int?)0, (List<GemType>)null), (Ability[])(object)new Ability[1] { (Ability)(int)Sigils.GiveAnthill.ability }), (Appearance[])(object)new Appearance[1] { (Appearance)(int)MagmaAppearance }), (Tribe[])(object)new Tribe[1] { (Tribe)6 }), (Trait[])(object)new Trait[1] { (Trait)11 }), (SpecialTriggeredAbility[])(object)new SpecialTriggeredAbility[1] { (SpecialTriggeredAbility)6 }), (SpecialStatIcon)1), Tools.LoadTexture("portrait_fireant"), Tools.LoadTexture("portrait_fireant_emission"), (FilterMode?)null), "bitty_region", (object)magmaId);
			val.temple = (CardTemple)0;
			CardManager.Add("bittyRegions", val);
			val = CardExtensions.SetExtendedProperty(CardExtensions.AddAppearances(CardExtensions.AddSpecialAbilities(CardExtensions.AddAbilities(CardExtensions.SetBonesCost(CardManager.New("bittyRegions", "TalkingCoal", "Coal Boy", 0, 1, "A freakish creation. It bites."), (int?)2), (Ability[])(object)new Ability[1] { (Ability)(int)Sigils.GiveBellows.ability }), (SpecialTriggeredAbility[])(object)new SpecialTriggeredAbility[1] { (SpecialTriggeredAbility)(int)TalkingCardCoal.ability }), (Appearance[])(object)new Appearance[2]
			{
				(Appearance)(int)MagmaAppearance,
				(Appearance)5
			}), "bitty_region", (object)magmaId);
			val.temple = (CardTemple)0;
			val.animatedPortrait = TalkingCardCoal.Face;
			val.onePerDeck = true;
			CardManager.Add("bittyRegions", val);
			val = CardExtensions.AddAppearances(CardExtensions.SetTerrain(CardExtensions.SetStatIcon(CardExtensions.AddSpecialAbilities(CardExtensions.AddAbilities(CardExtensions.SetBloodCost(CardManager.New("bittyRegions", "TalkingKnight", "Knight", 0, 5, "Creations of steel and fire."), (int?)2), (Ability[])(object)new Ability[2]
			{
				(Ability)(int)Sigils.GiveDiscardShield.ability,
				(Ability)23
			}), (SpecialTriggeredAbility[])(object)new SpecialTriggeredAbility[1] { (SpecialTriggeredAbility)23 }), (SpecialStatIcon)6)), (Appearance[])(object)new Appearance[2]
			{
				(Appearance)(int)MagmaGlowAppearance,
				(Appearance)5
			});
			val.temple = (CardTemple)0;
			val.animatedPortrait = TalkingCardKnight.Face;
			val.onePerDeck = true;
			CardManager.Add("bittyRegions", val);
			Plugin.Log.LogInfo((object)"Magma Cards Loaded!");
			val = CardExtensions.SetExtendedProperty(CardExtensions.SetExtendedProperty(CardExtensions.SetPortraitAndEmission(CardExtensions.AddTribes(CardExtensions.AddAppearances(CardExtensions.AddAbilities(CardExtensions.SetCost(CardManager.New("bittyRegions", "Mother Spider", "Brood Mother", 2, 1, "Mother of many, stored inside her own body."), (int?)2, (int?)0, (int?)0, (List<GemType>)null), (Ability[])(object)new Ability[1] { (Ability)(int)Sigils.GiveEggSacks.ability }), (Appearance[])(object)new Appearance[1] { (Appearance)(int)InfestedAppearance }), (Tribe[])(object)new Tribe[1] { (Tribe)6 }), Tools.LoadTexture("portrait_broodmother"), Tools.LoadTexture("portrait_broodmother_emission"), (FilterMode?)null), "bitty_region", (object)infestedId), "bitty_spider", (object)true);
			val.temple = (CardTemple)0;
			CardManager.Add("bittyRegions", val);
			CardInfo obj2 = CardManager.New("bittyRegions", "Spiderling", "Spiderling", 1, 1, "Childlike wonder, monsterous body.");
			num = 2;
			val = CardExtensions.SetExtendedProperty(CardExtensions.SetExtendedProperty(CardExtensions.SetPortraitAndEmission(CardExtensions.AddTribes(CardExtensions.AddAppearances(CardExtensions.SetCost(obj2, (int?)0, num, (int?)0, (List<GemType>)null), (Appearance[])(object)new Appearance[1] { (Appearance)(int)InfestedAppearance }), (Tribe[])(object)new Tribe[1] { (Tribe)6 }), Tools.LoadTexture("portrait_spiderling"), Tools.LoadTexture("portrait_spiderling_emission"), (FilterMode?)null), "bitty_region", (object)infestedId), "bitty_spider", (object)true);
			val.temple = (CardTemple)0;
			CardManager.Add("bittyRegions", val);
			CardInfo obj3 = CardManager.New("bittyRegions", "Parasitic Spider", "Parasitic Spider", 1, 1, "Infesting everything it touches.");
			num = 3;
			val = CardExtensions.SetExtendedProperty(CardExtensions.SetExtendedProperty(CardExtensions.SetPortraitAndEmission(CardExtensions.AddTribes(CardExtensions.AddAppearances(CardExtensions.AddAbilities(CardExtensions.SetCost(obj3, (int?)0, num, (int?)0, (List<GemType>)null), (Ability[])(object)new Ability[1] { (Ability)(int)Sigils.GiveParasiticBite.ability }), (Appearance[])(object)new Appearance[1] { (Appearance)(int)InfestedAppearance }), (Tribe[])(object)new Tribe[1] { (Tribe)6 }), Tools.LoadTexture("portrait_parasiticspider"), Tools.LoadTexture("portrait_parasiticspider_emission"), (FilterMode?)null), "bitty_region", (object)infestedId), "bitty_spider", (object)true);
			val.temple = (CardTemple)0;
			CardManager.Add("bittyRegions", val);
			val = CardExtensions.SetPortraitAndEmission(CardExtensions.SetIceCube(CardExtensions.AddAppearances(CardExtensions.SetTerrain(CardExtensions.AddAbilities(CardManager.New("bittyRegions", "Egg Sack", "Egg Sack", 0, 3, "A sac of eggs."), (Ability[])(object)new Ability[1] { (Ability)(int)Sigils.GiveSpiderInside.ability })), (Appearance[])(object)new Appearance[1] { (Appearance)(int)InfestedGlowAppearance }), CardLoader.GetCardByName("bittyRegions_Spiderling"), (IEnumerable<CardModificationInfo>)null), Tools.LoadTexture("portrait_eggsack"), Tools.LoadTexture("portrait_eggsack_emission"), (FilterMode?)null);
			val.temple = (CardTemple)0;
			CardManager.Add("bittyRegions", val);
			val = CardExtensions.SetExtendedProperty(CardExtensions.SetExtendedProperty(CardExtensions.SetPortraitAndEmission(CardExtensions.AddTribes(CardExtensions.AddAppearances(CardExtensions.SetTerrain(CardExtensions.AddAbilities(CardExtensions.AddAbilities(CardExtensions.SetCost(CardManager.New("bittyRegions", "Daddy Lo

plugins/bitty45-BittysSigils/plugins/BittysSigils.dll

Decompiled 5 months ago
using System;
using System.Collections;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Diagnostics;
using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using BepInEx;
using BepInEx.Logging;
using BittysSigils.Triggers;
using DiskCardGame;
using HarmonyLib;
using InscryptionAPI.Card;
using InscryptionAPI.Helpers;
using InscryptionAPI.Triggers;
using Microsoft.CodeAnalysis;
using Pixelplacement;
using UnityEngine;

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

		public RefSafetyRulesAttribute(int P_0)
		{
			Version = P_0;
		}
	}
}
namespace BittysSigils
{
	[BepInPlugin("bitty45.inscryption.sigils", "Bitty45's Sigils", "2.1.1")]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	public class Plugin : BaseUnityPlugin
	{
		public class UndeadAppearanceBehaviour : CardAppearanceBehaviour
		{
			private Texture2D UndeadBG = Tools.LoadTexture("card_undead");

			public override void ApplyAppearance()
			{
				//IL_0045: Unknown result type (might be due to invalid IL or missing references)
				((Texture)UndeadBG).filterMode = (FilterMode)0;
				((CardAppearanceBehaviour)this).Card.RenderInfo.baseTextureOverride = (Texture)(object)UndeadBG;
				((CardAppearanceBehaviour)this).Card.renderInfo.forceEmissivePortrait = true;
				((CardAppearanceBehaviour)this).Card.StatsLayer.SetEmissionColor(GameColors.Instance.brightGold);
			}
		}

		internal const string PluginGuid = "bitty45.inscryption.sigils";

		internal const string PluginName = "Bitty45's Sigils";

		internal const string PluginVersion = "2.1.1";

		internal const string CardPrefix = "bitty";

		internal static ManualLogSource Log;

		public static readonly Appearance UndeadAppearance = CardAppearanceBehaviourManager.Add("bitty45.inscryption.sigils", "UndeadAppearance", typeof(UndeadAppearanceBehaviour)).Id;

		private void Awake()
		{
			//IL_0011: Unknown result type (might be due to invalid IL or missing references)
			//IL_0017: Expected O, but got Unknown
			Log = ((BaseUnityPlugin)this).Logger;
			Harmony val = new Harmony("bitty45.inscryption.sigils");
			Sigils.AddAllSigils();
			Patches.ReplaceSwapper();
			Add_Card_TestCard();
			Add_Card_Corpse();
			val.PatchAll(typeof(Patches));
			((BaseUnityPlugin)this).Logger.LogInfo((object)"Bitty45's Sigils loaded!");
		}

		private void Add_Card_TestCard()
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002a: Expected I4, but got Unknown
			//IL_002c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0032: Expected I4, but got Unknown
			//IL_0034: Unknown result type (might be due to invalid IL or missing references)
			//IL_003a: Expected I4, but got Unknown
			CardInfo val = CardExtensions.SetPortraitAndEmission(CardExtensions.AddAbilities(CardManager.New("bitty", "TestCard", "TestCard", 1, 3, "Hmm."), (Ability[])(object)new Ability[3]
			{
				(Ability)(int)Sigils.GiveCounterAttack.ability,
				(Ability)(int)Sigils.GiveMushrooms.ability,
				(Ability)(int)Sigils.GiveFleeting.ability
			}), Tools.LoadTexture("portrait_test"), Tools.LoadTexture("portrait_test"), (FilterMode?)null);
			CardManager.Add("bitty", val);
		}

		private void Add_Card_Corpse()
		{
			//IL_0046: Unknown result type (might be due to invalid IL or missing references)
			//IL_004c: Expected I4, but got Unknown
			CardInfo val = CardExtensions.AddAppearances(CardExtensions.SetPortraitAndEmission(CardManager.New("bitty", "Corpse", "Corpse", 0, 1, "Hmm."), Tools.LoadTexture("portrait_test"), Tools.LoadTexture("portrait_test"), (FilterMode?)null), (Appearance[])(object)new Appearance[1] { (Appearance)(int)UndeadAppearance });
			val.defaultEvolutionName = "Zombie";
			CardManager.Add("bitty", val);
		}
	}
	public class Sigils
	{
		public abstract class SigilEffectsBase : AbilityBehaviour
		{
			protected virtual Ability DrawAbility { get; }

			protected virtual CardModificationInfo DrawMods => null;

			public IEnumerator SwapStats(PlayableCard card)
			{
				int baseAttack = ((Card)card).Info.Attack;
				int baseHealth = ((Card)card).Info.Health;
				CardModificationInfo cardModificationInfo = card.TemporaryMods.Find((CardModificationInfo x) => x.singletonId == "zeroout");
				if (cardModificationInfo == null)
				{
					CardModificationInfo zeroMod2 = new CardModificationInfo();
					zeroMod2.nonCopyable = true;
					zeroMod2.singletonId = "zeroout";
					zeroMod2.attackAdjustment = -baseAttack;
					zeroMod2.healthAdjustment = -baseHealth;
					card.AddTemporaryMod(zeroMod2);
					zeroMod2 = new CardModificationInfo();
					zeroMod2.nonCopyable = true;
					zeroMod2.singletonId = "statswap";
					zeroMod2.attackAdjustment = baseAttack;
					zeroMod2.healthAdjustment = baseHealth;
					card.AddTemporaryMod(zeroMod2);
				}
				int attack = card.Attack;
				int health = card.Health;
				CardModificationInfo swapMod = card.TemporaryMods.Find((CardModificationInfo x) => x.singletonId == "statswap");
				if (swapMod != null)
				{
					card.HealDamage(card.Status.damageTaken);
					swapMod.attackAdjustment = health;
					swapMod.healthAdjustment = attack;
					card.OnStatsChanged();
					((Card)card).Anim.StrongNegationEffect();
					yield return (object)new WaitForSeconds(0.25f);
				}
				yield return CustomTriggerFinder.Trigger<IOnStatSwap>(card.TriggerHandler, (Func<IOnStatSwap, bool>)((IOnStatSwap x) => x.RespondsToStatSwap(card)), (Func<IOnStatSwap, IEnumerator>)((IOnStatSwap x) => x.OnStatSwap(card)));
				yield return CustomTriggerFinder.TriggerAll<IOnOtherStatSwap>(false, (Func<IOnOtherStatSwap, bool>)((IOnOtherStatSwap x) => x.RespondsToOtherStatSwap(card)), (Func<IOnOtherStatSwap, IEnumerator>)((IOnOtherStatSwap x) => x.OnOtherStatSwap(card)));
				if (card.Health <= 0)
				{
					yield return card.Die(false, (PlayableCard)null, true);
				}
			}

			public IEnumerator DiscardCard(PlayableCard card)
			{
				yield return CustomTriggerFinder.Trigger<IOnDiscard>(card.TriggerHandler, (Func<IOnDiscard, bool>)((IOnDiscard x) => x.RespondsToThisDiscard(card)), (Func<IOnDiscard, IEnumerator>)((IOnDiscard x) => x.OnThisDiscard(card)));
				yield return CustomTriggerFinder.TriggerAll<IOnOtherDiscard>(false, (Func<IOnOtherDiscard, bool>)((IOnOtherDiscard x) => x.RespondsToOtherDiscard(card)), (Func<IOnOtherDiscard, IEnumerator>)((IOnOtherDiscard x) => x.OnOtherDiscard(card)));
				if ((int)Singleton<ViewManager>.Instance.CurrentView > 0)
				{
					yield return (object)new WaitForSeconds(0.2f);
					Singleton<ViewManager>.Instance.SwitchToView((View)0, false, false);
					yield return (object)new WaitForSeconds(0.2f);
				}
				((Card)card).SetInteractionEnabled(false);
				((Card)card).Anim.PlayDeathAnimation(false);
				AudioController.Instance.PlaySound3D("wizard_projectileimpact", (MixerGroup)4, ((Component)((AbilityBehaviour)this).Card).transform.position, 1f, 0f, (Pitch)null, (Repetition)null, (Randomization)null, (Distortion)null, false);
				Singleton<PlayerHand>.Instance.RemoveCardFromHand(card);
				Object.Destroy((Object)(object)((Component)card).gameObject, 1f);
				yield return (object)new WaitForSeconds(0.4f);
			}

			public IEnumerator MoveCardIntoDeck(PlayableCard card, bool toSideDeck = false)
			{
				bool is3D = Singleton<BoardManager>.Instance is BoardManager3D;
				if (card.OnBoard && (int)Singleton<ViewManager>.Instance.CurrentView != 4)
				{
					yield return (object)new WaitForSeconds(0.2f);
					Singleton<ViewManager>.Instance.SwitchToView((View)4, false, false);
					yield return (object)new WaitForSeconds(0.2f);
				}
				card.UnassignFromSlot();
				if (Singleton<PlayerHand>.Instance.CardsInHand.Contains(card) && (int)Singleton<ViewManager>.Instance.CurrentView > 0)
				{
					yield return (object)new WaitForSeconds(0.2f);
					Singleton<ViewManager>.Instance.SwitchToView((View)0, false, false);
					yield return (object)new WaitForSeconds(0.2f);
				}
				if (Singleton<PlayerHand>.Instance.CardsInHand.Contains(card))
				{
					Singleton<PlayerHand>.Instance.RemoveCardFromHand(card);
				}
				if (is3D && toSideDeck)
				{
					Singleton<CardDrawPiles3D>.Instance.sidePile.MoveCardToPile((Card)(object)card, true, 0f, 0.7f);
					Object.Destroy((Object)(object)((Component)card).gameObject, 1f);
				}
				else if (is3D)
				{
					Singleton<CardDrawPiles3D>.Instance.pile.MoveCardToPile((Card)(object)card, true, 0f, 0.7f);
					Object.Destroy((Object)(object)((Component)card).gameObject, 1f);
				}
				CreateCardInDeck(((Card)card).Info, toSideDeck);
			}

			public void CreateCardInDeck(CardInfo info, bool toSideDeck = false)
			{
				bool flag = Singleton<BoardManager>.Instance is BoardManager3D;
				if (flag && toSideDeck)
				{
					Singleton<CardDrawPiles3D>.Instance.sidePile.CreateCards(1, 15f);
					Singleton<CardDrawPiles3D>.Instance.SideDeck.AddCard(info);
					return;
				}
				if (flag)
				{
					Singleton<CardDrawPiles3D>.Instance.pile.CreateCards(1, 15f);
				}
				Singleton<CardDrawPiles>.Instance.Deck.AddCard(info);
			}

			public IEnumerator DrawCard(bool mods = false)
			{
				bool is3D = Singleton<BoardManager>.Instance is BoardManager3D;
				if (Singleton<CardDrawPiles>.Instance.Deck.cards.Count > 0)
				{
					yield return (object)new WaitForSeconds(0.4f);
					if ((int)Singleton<ViewManager>.Instance.CurrentView != 1)
					{
						yield return (object)new WaitForSeconds(0.2f);
						Singleton<ViewManager>.Instance.SwitchToView((View)1, false, false);
						yield return (object)new WaitForSeconds(0.2f);
					}
					if (is3D)
					{
						CardDrawPiles3D.Instance.Pile.Draw();
						CardInfo info = ((CardDrawPiles)Singleton<CardDrawPiles3D>.Instance).Deck.Draw();
						yield return Singleton<CardSpawner>.Instance.SpawnCardToHand(info, new List<CardModificationInfo>(), Vector2.op_Implicit(((CardDrawPiles)Singleton<CardDrawPiles3D>.Instance).drawFromPilesSpawnOffset), 0.15f, (Action<PlayableCard>)null);
					}
					else
					{
						yield return Singleton<CardDrawPiles>.Instance.DrawCardFromDeck((CardInfo)null, (Action<PlayableCard>)null);
					}
					if (mods)
					{
						PlayableCard card = Singleton<PlayerHand>.Instance.CardsInHand[Singleton<PlayerHand>.Instance.CardsInHand.Count - 1];
						yield return card.FlipInHand((Action)AddMod);
						yield return (object)new WaitForSeconds(0.4f);
					}
				}
			}

			private void AddMod()
			{
				//IL_002e: Unknown result type (might be due to invalid IL or missing references)
				//IL_003a: Unknown result type (might be due to invalid IL or missing references)
				//IL_003f: Unknown result type (might be due to invalid IL or missing references)
				//IL_0045: Expected O, but got Unknown
				PlayableCard val = Singleton<PlayerHand>.Instance.CardsInHand[Singleton<PlayerHand>.Instance.CardsInHand.Count - 1];
				val.Status.hiddenAbilities.Add(((AbilityBehaviour)this).Ability);
				CardModificationInfo val2 = new CardModificationInfo(DrawAbility);
				CardModificationInfo val3 = val.TemporaryMods.Find((CardModificationInfo x) => x.HasAbility(((AbilityBehaviour)this).Ability));
				if (val3 == null)
				{
					val3 = ((Card)val).Info.Mods.Find((CardModificationInfo x) => x.HasAbility(((AbilityBehaviour)this).Ability));
				}
				if (val3 != null)
				{
					val2.fromTotem = val3.fromTotem;
					val2.fromCardMerge = val3.fromCardMerge;
				}
				val.AddTemporaryMod(val2);
				if (DrawMods != null)
				{
					val.AddTemporaryMod(DrawMods);
				}
			}
		}

		public abstract class TargetSlotBase : SigilEffectsBase
		{
			public IEnumerator TargetSlot(List<CardSlot> allSlots, List<CardSlot> validSlots)
			{
				BoardManager instance = Singleton<BoardManager>.Instance;
				yield return instance.ChooseTarget(allSlots, validSlots, (Action<CardSlot>)delegate(CardSlot slot)
				{
					((MonoBehaviour)CustomCoroutine.Instance).StartCoroutine(TargetSelectedCallback(slot));
				}, (Action<CardSlot>)delegate(CardSlot slot)
				{
					((MonoBehaviour)CustomCoroutine.Instance).StartCoroutine(InvalidTargetCallback(slot));
				}, (Action<CardSlot>)delegate(CardSlot slot)
				{
					((MonoBehaviour)CustomCoroutine.Instance).StartCoroutine(SlotCursorCallback(slot));
				}, (Func<bool>)(() => CancelCondition()), (CursorType)16);
			}

			public virtual IEnumerator TargetSelectedCallback(CardSlot slot)
			{
				yield break;
			}

			public virtual IEnumerator InvalidTargetCallback(CardSlot slot)
			{
				yield break;
			}

			public virtual IEnumerator SlotCursorCallback(CardSlot slot)
			{
				yield break;
			}

			public virtual bool CancelCondition()
			{
				return false;
			}
		}

		public class GiveAllStatsSwap : SigilEffectsBase
		{
			public static Ability ability;

			public override Ability Ability => ability;

			public override bool RespondsToResolveOnBoard()
			{
				return true;
			}

			public override IEnumerator OnResolveOnBoard()
			{
				yield return ((AbilityBehaviour)this).PreSuccessfulTriggerSequence();
				foreach (CardSlot slot in Singleton<BoardManager>.Instance.AllSlotsCopy)
				{
					if ((Object)(object)slot.Card != (Object)null)
					{
						yield return SwapStats(slot.Card);
					}
				}
				yield return ((AbilityBehaviour)this).LearnAbility(0.2f);
			}
		}

		public class GiveOpposingCopy : AbilityBehaviour
		{
			public static Ability ability;

			public override Ability Ability => ability;

			public override bool RespondsToResolveOnBoard()
			{
				return true;
			}

			public override IEnumerator OnResolveOnBoard()
			{
				Singleton<ViewManager>.Instance.SwitchToView((View)4, false, false);
				yield return (object)new WaitForSeconds(0.1f);
				CardSlot opposingSlot = ((AbilityBehaviour)this).Card.Slot.opposingSlot;
				if ((Object)(object)opposingSlot.Card == (Object)null)
				{
					yield return ((AbilityBehaviour)this).PreSuccessfulTriggerSequence();
					yield return Singleton<BoardManager>.Instance.CreateCardInSlot(((Card)((AbilityBehaviour)this).Card).Info, opposingSlot, 0.15f, true);
					yield return (object)new WaitForSeconds(0.2f);
					yield return ((AbilityBehaviour)this).LearnAbility(0f);
				}
				else
				{
					((Card)((AbilityBehaviour)this).Card).Anim.StrongNegationEffect();
				}
			}
		}

		public class GiveActivatedBuffPlayerPower : ActivatedAbilityBehaviour
		{
			public static Ability ability;

			public override Ability Ability => ability;

			public override bool CanActivate()
			{
				return Singleton<LifeManager>.Instance.Balance >= 0;
			}

			public override IEnumerator Activate()
			{
				yield return ((AbilityBehaviour)this).PreSuccessfulTriggerSequence();
				((Card)((AbilityBehaviour)this).Card).Anim.StrongNegationEffect();
				yield return (object)new WaitForSeconds(0.2f);
				yield return Singleton<LifeManager>.Instance.ShowDamageSequence(4, 4, true, 0.125f, (GameObject)null, 0f, true);
				Singleton<ViewManager>.Instance.SwitchToView((View)4, false, false);
				yield return (object)new WaitForSeconds(0.1f);
				AudioController.Instance.PlaySound3D("beastcage_end", (MixerGroup)4, ((Component)((AbilityBehaviour)this).Card).transform.position, 1f, 0f, (Pitch)null, (Repetition)null, (Randomization)null, (Distortion)null, false);
				foreach (CardSlot slot in Singleton<BoardManager>.Instance.PlayerSlotsCopy)
				{
					if ((Object)(object)slot.Card != (Object)null)
					{
						((Card)slot.Card).Anim.StrongNegationEffect();
						slot.Card.AddTemporaryMod(new CardModificationInfo(1, 0));
						yield return (object)new WaitForSeconds(0.2f);
					}
				}
				yield return ((AbilityBehaviour)this).LearnAbility(0f);
			}
		}

		public class GiveActivatedHealthRoll : ActivatedAbilityBehaviour
		{
			public static Ability ability;

			public override Ability Ability => ability;

			public override int EnergyCost => 1;

			public override IEnumerator Activate()
			{
				CardModificationInfo cardModificationInfo = ((AbilityBehaviour)this).Card.TemporaryMods.Find((CardModificationInfo x) => x.singletonId == "bitty_randomHealth");
				if (cardModificationInfo != null || ((AbilityBehaviour)this).Card.Health <= 1)
				{
					yield return HealthRoll(0, cardModificationInfo);
				}
				else
				{
					yield return HealthRoll(((AbilityBehaviour)this).Card.Health - 1, cardModificationInfo);
				}
			}

			public IEnumerator HealthRoll(int healthReduction, CardModificationInfo cardModificationInfo)
			{
				yield return ((AbilityBehaviour)this).PreSuccessfulTriggerSequence();
				if (healthReduction > 0)
				{
					((AbilityBehaviour)this).Card.AddTemporaryMod(new CardModificationInfo(0, -healthReduction));
				}
				if (cardModificationInfo == null)
				{
					cardModificationInfo = new CardModificationInfo();
					cardModificationInfo.singletonId = "bitty_randomHealth";
					((AbilityBehaviour)this).Card.AddTemporaryMod(cardModificationInfo);
				}
				int healthAdjustment = cardModificationInfo.healthAdjustment;
				while (cardModificationInfo.healthAdjustment == healthAdjustment)
				{
					cardModificationInfo.healthAdjustment = Random.Range(0, 6);
				}
				AudioController.Instance.PlaySound3D("bones_scales_scuttle", (MixerGroup)4, ((Component)((AbilityBehaviour)this).Card).transform.position, 1f, 0f, (Pitch)null, (Repetition)null, (Randomization)null, (Distortion)null, false);
				((Card)((AbilityBehaviour)this).Card).Anim.StrongNegationEffect();
				((AbilityBehaviour)this).Card.OnStatsChanged();
				yield return (object)new WaitForSeconds(0.25f);
				yield return ((AbilityBehaviour)this).LearnAbility(0f);
			}
		}

		public class GiveActivatedSigilRoll : ActivatedAbilityBehaviour
		{
			public static Ability ability;

			public override Ability Ability => ability;

			public override bool CanActivate()
			{
				return Singleton<LifeManager>.Instance.Balance >= 0;
			}

			public override IEnumerator Activate()
			{
				yield return ((AbilityBehaviour)this).PreSuccessfulTriggerSequence();
				((Card)((AbilityBehaviour)this).Card).Anim.StrongNegationEffect();
				yield return (object)new WaitForSeconds(0.2f);
				yield return Singleton<LifeManager>.Instance.ShowDamageSequence(4, 4, true, 0.125f, (GameObject)null, 0f, true);
				Singleton<ViewManager>.Instance.SwitchToView((View)4, false, false);
				yield return (object)new WaitForSeconds(0.1f);
				int currentRandomSeed = ((TriggerReceiver)this).GetRandomSeed();
				CardModificationInfo mod = new CardModificationInfo(AbilitiesUtil.GetRandomLearnedAbility(currentRandomSeed, false, 0, 5, (AbilityMetaCategory)1));
				mod.fromCardMerge = true;
				((AbilityBehaviour)this).Card.AddTemporaryMod(mod);
				if (!CardDisplayer3D.EmissionEnabledForCard(((Card)((AbilityBehaviour)this).Card).renderInfo, ((AbilityBehaviour)this).Card))
				{
					((Card)((AbilityBehaviour)this).Card).RenderInfo.forceEmissivePortrait = true;
					((Card)((AbilityBehaviour)this).Card).StatsLayer.SetEmissionColor(GameColors.Instance.brightLimeGreen);
				}
				AudioController.Instance.PlaySound3D("bones_scales_scuttle", (MixerGroup)4, ((Component)((AbilityBehaviour)this).Card).transform.position, 1f, 0f, (Pitch)null, (Repetition)null, (Randomization)null, (Distortion)null, false);
				((Card)((AbilityBehaviour)this).Card).Anim.StrongNegationEffect();
				((AbilityBehaviour)this).Card.OnStatsChanged();
				yield return (object)new WaitForSeconds(0.25f);
				yield return ((AbilityBehaviour)this).LearnAbility(0f);
			}
		}

		public class GiveOpponentCopyOnKill : DrawCreatedCard
		{
			public CardInfo opponentCard;

			public static Ability ability;

			public override Ability Ability => ability;

			public override CardInfo CardToDraw => opponentCard;

			public override bool RespondsToOtherCardDie(PlayableCard card, CardSlot deathSlot, bool fromCombat, PlayableCard killer)
			{
				return (Object)(object)killer == (Object)(object)((AbilityBehaviour)this).Card && !CardExtensions.HasTrait(card, (Trait)16);
			}

			public override IEnumerator OnOtherCardDie(PlayableCard card, CardSlot deathSlot, bool fromCombat, PlayableCard killer)
			{
				yield return ((AbilityBehaviour)this).PreSuccessfulTriggerSequence();
				AudioController.Instance.PlaySound3D("camera_flash_shorter", (MixerGroup)4, ((Component)((AbilityBehaviour)this).Card).transform.position, 1f, 0f, (Pitch)null, (Repetition)null, (Randomization)null, (Distortion)null, false);
				opponentCard = ((Card)card).Info;
				yield return ((DrawCreatedCard)this).CreateDrawnCard();
				yield return ((AbilityBehaviour)this).LearnAbility(0f);
			}
		}

		public class GiveCorpseSpawner : AbilityBehaviour
		{
			public static Ability ability;

			public override Ability Ability => ability;

			public override bool RespondsToOtherCardDie(PlayableCard card, CardSlot deathSlot, bool fromCombat, PlayableCard killer)
			{
				return ((AbilityBehaviour)this).Card.OnBoard && ((Object)((Card)card).Info).name != "bitty_Corpse" && !CardExtensions.HasTrait(card, (Trait)12) && fromCombat && (Object)(object)card != (Object)(object)((AbilityBehaviour)this).Card && !card.InOpponentQueue;
			}

			public override IEnumerator OnOtherCardDie(PlayableCard card, CardSlot deathSlot, bool fromCombat, PlayableCard killer)
			{
				yield return ((AbilityBehaviour)this).PreSuccessfulTriggerSequence();
				CardInfo corpse2 = CardLoader.GetCardByName("bitty_Corpse");
				corpse2 = AdjustedCost(corpse2, ((Card)card).Info);
				corpse2.portraitTex = ((Card)card).Info.portraitTex;
				CardModificationInfo mod2 = new CardModificationInfo();
				mod2.abilities.AddRange(((Card)card).Info.Abilities);
				corpse2.mods.Add(mod2);
				mod2 = new CardModificationInfo();
				mod2.abilities.AddRange(((Card)card).Info.ModAbilities);
				mod2.fromCardMerge = true;
				corpse2.mods.Add(mod2);
				yield return Singleton<BoardManager>.Instance.CreateCardInSlot(corpse2, deathSlot, 0.15f, true);
				yield return ((AbilityBehaviour)this).LearnAbility(0f);
			}

			private CardInfo AdjustedCost(CardInfo info, CardInfo deadCard)
			{
				//IL_000e: 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_001f: 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_0037: Unknown result type (might be due to invalid IL or missing references)
				//IL_0048: Expected O, but got Unknown
				CardInfo val = CardLoader.Clone(info);
				val.mods.Add(new CardModificationInfo
				{
					bloodCostAdjustment = deadCard.BloodCost,
					bonesCostAdjustment = deadCard.BonesCost,
					energyCostAdjustment = deadCard.EnergyCost,
					addGemCost = deadCard.gemsCost
				});
				return val;
			}
		}

		public class GiveBleach : AbilityBehaviour
		{
			public static Ability ability;

			public override Ability Ability => ability;

			public override bool RespondsToResolveOnBoard()
			{
				return true;
			}

			public override IEnumerator OnResolveOnBoard()
			{
				yield return ((AbilityBehaviour)this).PreSuccessfulTriggerSequence();
				Singleton<ViewManager>.Instance.SwitchToView((View)4, false, true);
				PlayableCard card = CardExtensions.OpposingCard(((AbilityBehaviour)this).Card);
				if ((Object)(object)card != (Object)null && !CardHasNoAbilities(card))
				{
					SpawnSplatter(((AbilityBehaviour)this).Card);
					if (((Card)card).FaceDown)
					{
						((Card)card).SetFaceDown(false, true);
					}
					((Card)card).Anim.PlayTransformAnimation();
					CustomCoroutine.WaitThenExecute(0.15f, (Action)delegate
					{
						RemoveCardAbilities(card);
					}, false);
					AudioController.Instance.PlaySound2D("magnificus_brush_splatter_bleach", (MixerGroup)0, 0.5f, 0f, (Pitch)null, (Repetition)null, (Randomization)null, (Distortion)null, false);
				}
				yield return (object)new WaitForSeconds(0.7f);
				Singleton<ViewManager>.Instance.Controller.LockState = (ViewLockState)0;
				Singleton<ViewManager>.Instance.SwitchToView((View)1, false, false);
				yield return ((AbilityBehaviour)this).LearnAbility(0f);
			}

			private void RemoveCardAbilities(PlayableCard card)
			{
				//IL_0001: Unknown result type (might be due to invalid IL or missing references)
				//IL_0007: Expected O, but got Unknown
				CardModificationInfo val = new CardModificationInfo();
				val.negateAbilities = new List<Ability>();
				foreach (CardModificationInfo temporaryMod in card.TemporaryMods)
				{
					val.negateAbilities.AddRange(temporaryMod.abilities);
				}
				val.negateAbilities.AddRange(((Card)card).Info.Abilities);
				card.AddTemporaryMod(val);
			}

			private bool CardHasNoAbilities(PlayableCard card)
			{
				return !card.TemporaryMods.Exists((CardModificationInfo t) => t.abilities.Count > 0) && ((Card)card).Info.Abilities.Count <= 0;
			}

			private void SpawnSplatter(PlayableCard card)
			{
				//IL_001d: Unknown result type (might be due to invalid IL or missing references)
				//IL_0031: Unknown result type (might be due to invalid IL or missing references)
				//IL_0036: Unknown result type (might be due to invalid IL or missing references)
				GameObject val = Object.Instantiate<GameObject>(Resources.Load<GameObject>("Prefabs/Items/BleachSplatter"));
				val.transform.position = ((Component)card).transform.position + new Vector3(0f, 0.1f, -0.25f);
				Object.Destroy((Object)(object)val, 5f);
			}
		}

		public class GiveOnlyTransfer : AbilityBehaviour
		{
			public static Ability ability;

			public override Ability Ability => ability;
		}

		public class GiveNoTransfer : AbilityBehaviour
		{
			public static Ability ability;

			public override Ability Ability => ability;
		}

		public class GiveNoStones : AbilityBehaviour
		{
			public static Ability ability;

			public override Ability Ability => ability;
		}

		public class GiveNoCampfire : AbilityBehaviour
		{
			public static Ability ability;

			public override Ability Ability => ability;
		}

		public class GiveNoCampfireAttack : AbilityBehaviour
		{
			public static Ability ability;

			public override Ability Ability => ability;
		}

		public class GiveNoCampfireHealth : AbilityBehaviour
		{
			public static Ability ability;

			public override Ability Ability => ability;
		}

		public class GiveCantAttack : AbilityBehaviour
		{
			public static Ability ability;

			public override Ability Ability => ability;
		}

		public class GiveMushrooms : AbilityBehaviour
		{
			public static bool is3D = Singleton<BoardManager>.Instance is BoardManager3D;

			public static Ability ability;

			public override Ability Ability => ability;

			public override int Priority => 0;

			public override bool RespondsToTurnEnd(bool playerTurnEnd)
			{
				return ((AbilityBehaviour)this).Card.OpponentCard != playerTurnEnd;
			}

			public override IEnumerator OnTurnEnd(bool playerTurnEnd)
			{
				Plugin.Log.LogInfo((object)"Mushrooms Activation");
				yield return ((AbilityBehaviour)this).PreSuccessfulTriggerSequence();
				CardSlot toLeft = Singleton<BoardManager>.Instance.GetAdjacent(((AbilityBehaviour)this).Card.slot, true);
				CardSlot toRight = Singleton<BoardManager>.Instance.GetAdjacent(((AbilityBehaviour)this).Card.slot, false);
				bool toLeftValid = (Object)(object)toLeft != (Object)null && (Object)(object)toLeft.Card != (Object)null;
				bool toRightValid = (Object)(object)toRight != (Object)null && (Object)(object)toRight.Card != (Object)null;
				if (toLeftValid)
				{
					yield return (object)new WaitForSeconds(0.5f);
					Singleton<ViewManager>.Instance.SwitchToView((View)4, false, false);
					yield return (object)new WaitForSeconds(0.75f);
					yield return MoveFromSlotToCenterSlot(toLeft);
				}
				if (toRightValid)
				{
					yield return (object)new WaitForSeconds(0.5f);
					Singleton<ViewManager>.Instance.SwitchToView((View)4, false, false);
					yield return (object)new WaitForSeconds(0.75f);
					yield return MoveFromSlotToCenterSlot(toRight);
				}
				yield return (object)new WaitForSeconds(0.5f);
				yield return ((AbilityBehaviour)this).LearnAbility(0f);
			}

			private CardModificationInfo CreateMergeMod(PlayableCard existingCard, PlayableCard cardToMerge)
			{
				//IL_0001: Unknown result type (might be due to invalid IL or missing references)
				//IL_0007: Expected O, but got Unknown
				//IL_002f: Unknown result type (might be due to invalid IL or missing references)
				CardModificationInfo val = new CardModificationInfo();
				int count = ((Card)cardToMerge).Info.Abilities.Count;
				for (int i = 0; i < count; i++)
				{
					val.abilities.Add(((Card)cardToMerge).Info.Abilities[i]);
				}
				return GetDuplicateMod(((Card)cardToMerge).Info.Attack, ((Card)cardToMerge).Info.Health, val);
			}

			public static CardModificationInfo GetDuplicateMod(int attackBuff, int healthBuff, CardModificationInfo mods)
			{
				//IL_0001: Unknown result type (might be due to invalid IL or missing references)
				//IL_0006: Unknown result type (might be due to invalid IL or missing references)
				//IL_000d: Unknown result type (might be due to invalid IL or missing references)
				//IL_0014: Unknown result type (might be due to invalid IL or missing references)
				//IL_001b: Unknown result type (might be due to invalid IL or missing references)
				//IL_0027: 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_0049: Unknown result type (might be due to invalid IL or missing references)
				//IL_005b: Expected O, but got Unknown
				return new CardModificationInfo
				{
					fromDuplicateMerge = true,
					attackAdjustment = attackBuff,
					healthAdjustment = healthBuff,
					abilities = mods.abilities,
					DecalIds = { AlternatingBloodDecal.GetBloodDecalId() },
					DecalIds = { "decal_fungus" },
					DecalIds = { "decal_stitches" }
				};
			}

			private IEnumerator MoveFromSlotToCenterSlot(CardSlot originSlot)
			{
				if (!((Object)(object)originSlot.Card != (Object)null))
				{
					yield break;
				}
				CardSlot centerSlot = Singleton<BoardManager>.Instance.GetSlots(originSlot.IsPlayerSlot)[((AbilityBehaviour)this).Card.Slot.Index];
				if ((Object)(object)centerSlot.Card != (Object)null)
				{
					Sprite portraitSprite = Tools.LoadSprite("portrait_carnage");
					if (is3D)
					{
						((Card)centerSlot.Card).RenderInfo.portraitOverride = portraitSprite;
					}
					Tween.Position(((Component)centerSlot.Card).transform, ((Component)centerSlot).transform.position + Vector3.up * 0.2f, 0.1f, 0f, Tween.EaseInOut, (LoopType)0, (Action)null, (Action)null, true);
					Tween.Position(((Component)originSlot.Card).transform, ((Component)centerSlot).transform.position + Vector3.up * 0.05f, 0.1f, 0f, Tween.EaseInOut, (LoopType)0, (Action)null, (Action)null, true);
					yield return (object)new WaitForSeconds(0.1f);
					centerSlot.Card.AddTemporaryMod(CreateMergeMod(centerSlot.Card, originSlot.Card));
					if (CardExtensions.HasTrait(originSlot.Card, (Trait)11) && !CardExtensions.HasTrait(centerSlot.Card, (Trait)11))
					{
						CardExtensions.AddTraits(((Card)centerSlot.Card).Info, (Trait[])(object)new Trait[1] { (Trait)11 });
					}
					Object.Destroy((Object)(object)((Component)originSlot.Card).gameObject);
					originSlot.Card = null;
					if (is3D)
					{
						ApplyAppearance(centerSlot);
					}
					centerSlot.Card.OnStatsChanged();
					if (is3D)
					{
						Singleton<TableVisualEffectsManager>.Instance.ThumpTable(0.3f);
					}
					AudioController.Instance.PlaySound3D("mycologist_carnage", (MixerGroup)4, ((Component)centerSlot).transform.position, 1f, 0f, (Pitch)null, (Repetition)null, (Randomization)null, (Distortion)null, false);
					((Card)centerSlot.Card).Anim.StrongNegationEffect();
					yield return (object)new WaitForSeconds(0.25f);
					yield return Singleton<BoardManager>.Instance.AssignCardToSlot(centerSlot.Card, centerSlot, 0.1f, (Action)null, true);
					yield return (object)new WaitForSeconds(0.25f);
				}
				else
				{
					yield return Singleton<BoardManager>.Instance.AssignCardToSlot(originSlot.Card, centerSlot, 0.1f, (Action)null, true);
				}
			}

			public void ApplyAppearance(CardSlot slot)
			{
				if (slot.Card != null)
				{
					((Card)slot.Card).Info.TempDecals.Clear();
					((Card)slot.Card).Info.TempDecals.Add(ResourceBank.Get<Texture>("Art/Cards/Decals/" + AlternatingBloodDecal.GetBloodDecalId()));
					((Card)slot.Card).Info.TempDecals.Add(ResourceBank.Get<Texture>("Art/Cards/Decals/decal_fungus"));
					((Card)slot.Card).Info.TempDecals.Add(ResourceBank.Get<Texture>("Art/Cards/Decals/decal_stitches"));
				}
			}
		}

		public class GiveStrafeSticky : Strafe
		{
			public static Ability ability;

			public override Ability Ability => ability;

			public override IEnumerator DoStrafe(CardSlot toLeft, CardSlot toRight)
			{
				bool oppExists = CardExtensions.HasOpposingCard(((AbilityBehaviour)this).Card);
				bool oppLeftValid = (Object)(object)toLeft != (Object)null && (Object)(object)toLeft.opposingSlot.Card == (Object)null;
				bool oppRightValid = (Object)(object)toRight != (Object)null && (Object)(object)toRight.opposingSlot.Card == (Object)null;
				bool leftValid = (Object)(object)toLeft != (Object)null && (Object)(object)toLeft.Card == (Object)null;
				bool rightValid = (Object)(object)toRight != (Object)null && (Object)(object)toRight.Card == (Object)null;
				if (base.movingLeft && (!leftValid || (oppExists && !oppLeftValid)))
				{
					base.movingLeft = false;
				}
				if (!base.movingLeft && (!rightValid || (oppExists && !oppRightValid)))
				{
					base.movingLeft = true;
				}
				Plugin.Log.LogInfo((object)base.movingLeft);
				CardSlot destination = (base.movingLeft ? toLeft : toRight);
				bool destinationValid = (base.movingLeft ? leftValid : rightValid);
				if (oppExists)
				{
					destinationValid = (base.movingLeft ? (leftValid && oppLeftValid) : (rightValid && oppRightValid));
				}
				Plugin.Log.LogInfo((object)destination);
				Plugin.Log.LogInfo((object)destinationValid);
				if (oppExists)
				{
					yield return OppMoveToSlot(destination, destinationValid);
				}
				yield return ((Strafe)this).MoveToSlot(destination, destinationValid);
				if ((Object)(object)destination != (Object)null && destinationValid)
				{
					yield return ((AbilityBehaviour)this).PreSuccessfulTriggerSequence();
					yield return ((AbilityBehaviour)this).LearnAbility(0f);
				}
			}

			protected IEnumerator OppMoveToSlot(CardSlot destination, bool destinationValid)
			{
				PlayableCard oppCard = CardExtensions.OpposingCard(((AbilityBehaviour)this).Card);
				if ((Object)(object)destination != (Object)null && destinationValid)
				{
					destination = destination.opposingSlot;
					CardSlot oldSlot = oppCard.Slot;
					yield return Singleton<BoardManager>.Instance.AssignCardToSlot(oppCard, destination, 0.01f, (Action)null, true);
					yield return ((Strafe)this).PostSuccessfulMoveSequence(oldSlot);
					yield return (object)new WaitForSeconds(0f);
				}
				else
				{
					((Card)oppCard).Anim.StrongNegationEffect();
					yield return (object)new WaitForSeconds(0.15f);
				}
			}
		}

		public class GiveStrafePull : Strafe
		{
			public static Ability ability;

			public override Ability Ability => ability;

			static GiveStrafePull()
			{
				//IL_0059: Unknown result type (might be due to invalid IL or missing references)
				//IL_005e: Unknown result type (might be due to invalid IL or missing references)
				AbilityInfo val = AbilityExtensions.SetPixelAbilityIcon(AbilityExtensions.AddMetaCategories(AbilityManager.New("bitty45.inscryption.sigils", "Hauler", "At the end of the owner's turn, [creature] will move in the direction inscribed in the sigil. Adjacent friendly creatures will be pulled in the same direction.", typeof(GiveStrafePull), (Texture)(object)Tools.LoadTexture("ability_pull")), (AbilityMetaCategory[])(object)new AbilityMetaCategory[2]
				{
					default(AbilityMetaCategory),
					(AbilityMetaCategory)2
				}), Tools.LoadTexture("ability_pull_a2"), (FilterMode?)null);
				val.powerLevel = 0;
				ability = val.ability;
			}

			protected IEnumerator MovePulled(CardSlot destination, CardSlot pulledSlot)
			{
				if (!((Object)(object)pulledSlot != (Object)null))
				{
					yield break;
				}
				PlayableCard pulled = pulledSlot.Card;
				if ((Object)(object)pulled != (Object)null)
				{
					CardSlot toLeft = Singleton<BoardManager>.Instance.GetAdjacent(pulled.Slot, true);
					CardSlot toRight = Singleton<BoardManager>.Instance.GetAdjacent(pulled.Slot, false);
					bool flag = (Object)(object)toLeft != (Object)null && (Object)(object)toLeft.Card == (Object)null;
					bool flag2 = (Object)(object)toRight != (Object)null && (Object)(object)toRight.Card == (Object)null;
					if (base.movingLeft && !flag)
					{
						base.movingLeft = false;
					}
					if (!base.movingLeft && !flag2)
					{
						base.movingLeft = true;
					}
					bool destinationValid = (Object)(object)destination.Card == (Object)null;
					((Card)pulled).RenderInfo.flippedPortrait = base.movingLeft && ((Card)pulled).Info.flipPortraitForStrafe;
					((Card)pulled).RenderCard();
					if ((Object)(object)destination != (Object)null && destinationValid)
					{
						_ = pulled.Slot;
						yield return Singleton<BoardManager>.Instance.AssignCardToSlot(pulled, destination, 0.1f, (Action)null, true);
						yield return (object)new WaitForSeconds(0.25f);
					}
					else
					{
						((Card)pulled).Anim.StrongNegationEffect();
						yield return (object)new WaitForSeconds(0.15f);
					}
				}
			}

			public override IEnumerator PostSuccessfulMoveSequence(CardSlot oldSlot)
			{
				CardSlot pulledSlot = (base.movingLeft ? Singleton<BoardManager>.Instance.GetAdjacent(oldSlot, false) : Singleton<BoardManager>.Instance.GetAdjacent(oldSlot, true));
				yield return MovePulled(oldSlot, pulledSlot);
			}
		}

		public class GiveCounterAttack : AbilityBehaviour
		{
			public static Ability ability;

			public override Ability Ability => ability;

			public override bool RespondsToTakeDamage(PlayableCard source)
			{
				return (Object)(object)source != (Object)null && source.Health > 0;
			}

			public override IEnumerator OnTakeDamage(PlayableCard source)
			{
				yield return ((AbilityBehaviour)this).PreSuccessfulTriggerSequence();
				((Card)((AbilityBehaviour)this).Card).Anim.StrongNegationEffect();
				yield return (object)new WaitForSeconds(0.55f);
				yield return source.TakeDamage(((AbilityBehaviour)this).Card.Attack, ((AbilityBehaviour)this).Card);
				yield return ((AbilityBehaviour)this).LearnAbility(0.4f);
			}
		}

		public class GiveMirrorCounter : AbilityBehaviour
		{
			public static Ability ability;

			public override Ability Ability => ability;

			public override bool RespondsToTakeDamage(PlayableCard source)
			{
				return (Object)(object)source != (Object)null && source.Health > 0;
			}

			public override IEnumerator OnTakeDamage(PlayableCard source)
			{
				yield return ((AbilityBehaviour)this).PreSuccessfulTriggerSequence();
				((Card)((AbilityBehaviour)this).Card).Anim.StrongNegationEffect();
				yield return (object)new WaitForSeconds(0.55f);
				yield return source.TakeDamage(source.Attack, ((AbilityBehaviour)this).Card);
				yield return ((AbilityBehaviour)this).LearnAbility(0.4f);
			}
		}

		public abstract class GiveStrafeBoard : Strafe
		{
			public override IEnumerator DoStrafe(CardSlot toLeft, CardSlot toRight)
			{
				bool slotsContainsBaseCard = GetCardSlots().Contains(((AbilityBehaviour)this).Card.slot);
				List<CardSlot> baseSideSlots = (((AbilityBehaviour)this).Card.OpponentCard ? Singleton<BoardManager>.Instance.OpponentSlotsCopy : Singleton<BoardManager>.Instance.PlayerSlotsCopy);
				bool leftValid = (Object)(object)toLeft != (Object)null && ((Object)(object)toLeft.Card == (Object)null || slotsContainsBaseCard);
				bool rightValid = (Object)(object)toRight != (Object)null && ((Object)(object)toRight.Card == (Object)null || slotsContainsBaseCard);
				if (BaseCardWarps() && (Object)(object)toLeft == (Object)null && (Object)(object)baseSideSlots.Last().Card == (Object)null)
				{
					leftValid = true;
				}
				if (BaseCardWarps() && (Object)(object)toRight == (Object)null && (Object)(object)baseSideSlots.First().Card == (Object)null)
				{
					rightValid = true;
				}
				if (base.movingLeft && !leftValid)
				{
					base.movingLeft = false;
				}
				if (!base.movingLeft && !rightValid)
				{
					base.movingLeft = true;
				}
				CardSlot destination = (base.movingLeft ? toLeft : toRight);
				if (BaseCardWarps() && (Object)(object)destination == (Object)null && base.movingLeft)
				{
					destination = baseSideSlots.Last();
				}
				if (BaseCardWarps() && (Object)(object)destination == (Object)null && !base.movingLeft)
				{
					destination = baseSideSlots.First();
				}
				bool destinationValid = (base.movingLeft ? leftValid : rightValid);
				yield return ShiftAllCards(destinationValid, slotsContainsBaseCard);
				yield return ((Strafe)this).MoveToSlot(destination, destinationValid);
				if ((Object)(object)destination != (Object)null && destinationValid)
				{
					yield return ((AbilityBehaviour)this).PreSuccessfulTriggerSequence();
					yield return ((AbilityBehaviour)this).LearnAbility(0f);
				}
			}

			public IEnumerator ShiftAllCards(bool destinationValid, bool slotsContainsBaseCard)
			{
				if (!destinationValid)
				{
					yield break;
				}
				List<CardSlot> affectedSlots = GetCardSlots();
				if (slotsContainsBaseCard)
				{
					affectedSlots.Remove(((AbilityBehaviour)this).Card.slot);
				}
				if (!affectedSlots.Exists((CardSlot x) => (Object)(object)x.Card != (Object)null))
				{
					yield break;
				}
				Dictionary<PlayableCard, CardSlot> dictionary = new Dictionary<PlayableCard, CardSlot>();
				List<CardSlot> slots = Singleton<BoardManager>.Instance.GetSlots(true);
				List<CardSlot> slots2 = Singleton<BoardManager>.Instance.GetSlots(false);
				int slotAdjustment = ((!base.movingLeft) ? 1 : (-1));
				if (slots.Contains(affectedSlots[0]))
				{
					for (int i = 0; i < slots.Count; i++)
					{
						if ((Object)(object)slots[i].Card != (Object)null)
						{
							dictionary.Add(value: (i == 0 && base.movingLeft) ? slots[slots.Count - 1] : ((i != slots.Count - 1 || base.movingLeft) ? slots[i + slotAdjustment] : slots[0]), key: slots[i].Card);
						}
					}
				}
				if (slots2.Contains(affectedSlots[affectedSlots.Count - 1]))
				{
					for (int j = 0; j < slots2.Count; j++)
					{
						if ((Object)(object)slots2[j].Card != (Object)null)
						{
							dictionary.Add(value: (j == 0 && base.movingLeft) ? slots2[slots2.Count - 1] : ((j != slots2.Count - 1 || base.movingLeft) ? slots2[j + slotAdjustment] : slots2[0]), key: slots2[j].Card);
						}
					}
				}
				foreach (CardSlot cardSlot in affectedSlots)
				{
					if ((Object)(object)cardSlot.Card != (Object)null)
					{
						cardSlot.Card.Slot = null;
						cardSlot.Card = null;
					}
				}
				foreach (KeyValuePair<PlayableCard, CardSlot> assignment in dictionary)
				{
					PlayableCard card = assignment.Key;
					assignment.Key.SetIsOpponentCard(!assignment.Value.IsPlayerSlot);
					yield return Singleton<BoardManager>.Instance.AssignCardToSlot(card, assignment.Value, 0.1f, (Action)null, true);
					if (((Card)card).FaceDown)
					{
						bool flag = assignment.Value.Index == 0 && !assignment.Value.IsPlayerSlot;
						bool flag2 = assignment.Value.Index == Singleton<BoardManager>.Instance.GetSlots(false).Count - 1 && assignment.Value.IsPlayerSlot;
						if (flag || flag2)
						{
							((Card)card).SetFaceDown(false, false);
							card.UpdateFaceUpOnBoardEffects();
						}
					}
				}
			}

			public virtual List<CardSlot> GetCardSlots()
			{
				return Singleton<BoardManager>.Instance.AllSlotsCopy;
			}

			public virtual bool BaseCardWarps()
			{
				return false;
			}
		}

		public class GiveStrafeAllBoard : GiveStrafeBoard
		{
			public static Ability ability;

			public override Ability Ability => ability;

			public override List<CardSlot> GetCardSlots()
			{
				return Singleton<BoardManager>.Instance.AllSlotsCopy;
			}
		}

		public class GiveStrafeCardBoard : GiveStrafeBoard
		{
			public static Ability ability;

			public override Ability Ability => ability;

			public override List<CardSlot> GetCardSlots()
			{
				return CardExtensions.IsPlayerCard(((AbilityBehaviour)this).Card) ? Singleton<BoardManager>.Instance.PlayerSlotsCopy : Singleton<BoardManager>.Instance.OpponentSlotsCopy;
			}
		}

		public class GiveStrafeCardOppBoard : GiveStrafeBoard
		{
			public static Ability ability;

			public override Ability Ability => ability;

			public override List<CardSlot> GetCardSlots()
			{
				return ((AbilityBehaviour)this).Card.OpponentCard ? Singleton<BoardManager>.Instance.PlayerSlotsCopy : Singleton<BoardManager>.Instance.OpponentSlotsCopy;
			}
		}

		public class GiveDeathBell : AbilityBehaviour, IOnBellRung
		{
			public static Ability ability;

			public override Ability Ability => ability;

			public bool RespondsToBellRung(bool playerCombatPhase)
			{
				return ((AbilityBehaviour)this).Card.OnBoard && playerCombatPhase != ((AbilityBehaviour)this).Card.OpponentCard;
			}

			public IEnumerator OnBellRung(bool playerCombatPhase)
			{
				yield return ((AbilityBehaviour)this).PreSuccessfulTriggerSequence();
				yield return ((AbilityBehaviour)this).Card.Die(false, (PlayableCard)null, true);
				yield return ((AbilityBehaviour)this).LearnAbility(0f);
			}
		}

		public class GiveClockwise : AbilityBehaviour
		{
			public static Ability ability;

			public override Ability Ability => ability;

			public override bool RespondsToResolveOnBoard()
			{
				return true;
			}

			public override IEnumerator OnResolveOnBoard()
			{
				bool is3D = Singleton<BoardManager>.Instance is BoardManager3D;
				yield return ((AbilityBehaviour)this).PreSuccessfulTriggerSequence();
				yield return (object)new WaitForSeconds(0.1f);
				if (is3D)
				{
					Singleton<ViewManager>.Instance.SwitchToView((View)4, false, true);
				}
				yield return (object)new WaitForSeconds(0.1f);
				AudioController.Instance.PlaySound2D("consumable_pocketwatch_use", (MixerGroup)4, 0.8f, 0f, (Pitch)null, (Repetition)null, (Randomization)null, (Distortion)null, false);
				yield return (object)new WaitForSeconds(0.75f);
				yield return Singleton<BoardManager>.Instance.MoveAllCardsClockwise();
				yield return (object)new WaitForSeconds(1f);
				if (is3D)
				{
					Singleton<ViewManager>.Instance.Controller.LockState = (ViewLockState)0;
				}
				if (is3D)
				{
					Singleton<ViewManager>.Instance.SwitchToView((View)1, false, false);
				}
				yield return ((AbilityBehaviour)this).LearnAbility(0f);
			}
		}

		public class GiveStatsSwapImmune : AbilityBehaviour, IOnStatSwap
		{
			public static Ability ability;

			public override Ability Ability => ability;

			public bool RespondsToStatSwap(PlayableCard card)
			{
				return ((AbilityBehaviour)this).Card.OnBoard;
			}

			public IEnumerator OnStatSwap(PlayableCard card)
			{
				CardModificationInfo cardModificationInfo = card.TemporaryMods.Find((CardModificationInfo x) => x.singletonId == "statswap");
				if (cardModificationInfo != null)
				{
					int attack = card.Attack;
					int health = card.Health;
					cardModificationInfo.attackAdjustment = health;
					cardModificationInfo.healthAdjustment = attack;
					card.OnStatsChanged();
					((Card)card).Anim.StrongNegationEffect();
				}
				yield break;
			}
		}

		public class GiveTornado : AbilityBehaviour
		{
			public static Ability ability;

			public override Ability Ability => ability;

			public override bool RespondsToTurnEnd(bool playerTurnEnd)
			{
				return playerTurnEnd;
			}

			public override IEnumerator OnTurnEnd(bool playerTurnEnd)
			{
				bool is3D = Singleton<BoardManager>.Instance is BoardManager3D;
				yield return ((AbilityBehaviour)this).PreSuccessfulTriggerSequence();
				yield return (object)new WaitForSeconds(0.1f);
				if (is3D)
				{
					Singleton<ViewManager>.Instance.SwitchToView((View)4, false, true);
				}
				yield return (object)new WaitForSeconds(0.1f);
				AudioController.Instance.PlaySound2D("wardrobe_door_open", (MixerGroup)4, 0.8f, 0f, (Pitch)null, (Repetition)null, (Randomization)null, (Distortion)null, false);
				yield return (object)new WaitForSeconds(0.75f);
				yield return Singleton<BoardManager>.Instance.MoveAllCardsClockwise();
				yield return (object)new WaitForSeconds(1f);
				if (is3D)
				{
					Singleton<ViewManager>.Instance.Controller.LockState = (ViewLockState)0;
				}
				if (is3D)
				{
					Singleton<ViewManager>.Instance.SwitchToView((View)1, false, false);
				}
				yield return ((AbilityBehaviour)this).LearnAbility(0f);
			}
		}

		public class GiveFleeting : SigilEffectsBase, IOnTurnEndInHand
		{
			public static Ability ability;

			public override Ability Ability => ability;

			public override int Priority => 99;

			public bool RespondsToTurnEndInHand(bool playerTurn)
			{
				return playerTurn;
			}

			public IEnumerator OnTurnEndInHand(bool playerTurn)
			{
				yield return ((AbilityBehaviour)this).PreSuccessfulTriggerSequence();
				yield return (object)new WaitForSeconds(0.1f);
				yield return ((AbilityBehaviour)this).LearnAbility(0f);
				yield return DiscardCard(((AbilityBehaviour)this).Card);
			}
		}

		public class GiveSwapStats : SigilEffectsBase
		{
			private bool swapped;

			public static Ability ability;

			public override Ability Ability => ability;

			public override bool RespondsToTakeDamage(PlayableCard source)
			{
				return ((AbilityBehaviour)this).Card.Health > 0;
			}

			public override IEnumerator OnTakeDamage(PlayableCard source)
			{
				yield return ((AbilityBehaviour)this).PreSuccessfulTriggerSequence();
				yield return (object)new WaitForSeconds(0.5f);
				swapped = !swapped;
				if (swapped && (Object)(object)((Card)((AbilityBehaviour)this).Card).Info.alternatePortrait != (Object)null && Singleton<BoardManager>.Instance is BoardManager3D)
				{
					((AbilityBehaviour)this).Card.SwitchToAlternatePortrait();
				}
				else
				{
					((AbilityBehaviour)this).Card.SwitchToDefaultPortrait();
				}
				yield return SwapStats(((AbilityBehaviour)this).Card);
				yield return ((AbilityBehaviour)this).LearnAbility(0.25f);
			}
		}

		public class GiveSoulLinked : AbilityBehaviour
		{
			private bool isOpponentCard;

			public static Ability ability;

			public override Ability Ability => ability;

			public override bool RespondsToPreDeathAnimation(bool wasSacrifice)
			{
				return true;
			}

			public override IEnumerator OnPreDeathAnimation(bool wasSacrifice)
			{
				isOpponentCard = ((AbilityBehaviour)this).Card.OpponentCard;
				yield break;
			}

			public override bool RespondsToDie(bool wasSacrifice, PlayableCard killer)
			{
				//IL_000b: Unknown result type (might be due to invalid IL or missing references)
				return ((Object)(object)killer != (Object)null && !killer.HasAbility(ability)) || (Object)(object)killer == (Object)null;
			}

			public override IEnumerator OnDie(bool wasSacrifice, PlayableCard killer)
			{
				yield return ((AbilityBehaviour)this).PreSuccessfulTriggerSequence();
				foreach (CardSlot slot in Singleton<BoardManager>.Instance.AllSlotsCopy)
				{
					if ((Object)(object)slot.Card != (Object)null && slot.Card.OpponentCard == isOpponentCard && slot.Card.HasAbility(ability))
					{
						yield return (object)new WaitForSeconds(0.5f);
						yield return slot.Card.Die(false, ((AbilityBehaviour)this).Card, true);
					}
				}
				yield return ((AbilityBehaviour)this).LearnAbility(0.25f);
			}
		}

		public class GiveVibesharkDraw : SigilEffectsBase
		{
			public static Ability ability;

			public override Ability Ability => ability;

			public override bool RespondsToResolveOnBoard()
			{
				return true;
			}

			public override IEnumerator OnResolveOnBoard()
			{
				yield return ((AbilityBehaviour)this).PreSuccessfulTriggerSequence();
				yield return DiscardDraw();
				yield return ((AbilityBehaviour)this).LearnAbility(0.25f);
			}

			public IEnumerator DiscardDraw()
			{
				if (Singleton<PlayerHand>.Instance.CardsInHand.Count > 0)
				{
					yield return DiscardCard(Singleton<PlayerHand>.Instance.CardsInHand[0]);
				}
				yield return DrawCard();
			}
		}

		public class GiveVibesharkBarrage : AbilityBehaviour
		{
			public static Ability ability;

			public override Ability Ability => ability;

			public override bool RespondsToResolveOnBoard()
			{
				return true;
			}

			public override IEnumerator OnResolveOnBoard()
			{
				yield return ((AbilityBehaviour)this).PreSuccessfulTriggerSequence();
				yield return Barrage();
				yield return ((AbilityBehaviour)this).LearnAbility(0.25f);
			}

			public IEnumerator Barrage()
			{
				yield return (object)new WaitForSeconds(0.4f);
				if ((int)Singleton<ViewManager>.Instance.CurrentView != 4)
				{
					yield return (object)new WaitForSeconds(0.2f);
					Singleton<ViewManager>.Instance.SwitchToView((View)4, false, false);
					yield return (object)new WaitForSeconds(0.2f);
				}
				foreach (CardSlot slot in Singleton<BoardManager>.Instance.AllSlotsCopy)
				{
					if ((int)Singleton<ViewManager>.Instance.CurrentView != 4)
					{
						yield return (object)new WaitForSeconds(0.2f);
						Singleton<ViewManager>.Instance.SwitchToView((View)4, false, false);
						yield return (object)new WaitForSeconds(0.2f);
					}
					if ((Object)(object)slot.Card != (Object)null)
					{
						yield return slot.Card.TakeDamage(1, ((AbilityBehaviour)this).Card);
						yield return (object)new WaitForSeconds(0.2f);
					}
				}
			}
		}

		public class GiveMoxPhobic : AbilityBehaviour, IOnGemGain, IOnBellRung
		{
			public static Ability ability;

			public override Ability Ability => ability;

			public override bool RespondsToResolveOnBoard()
			{
				return (Object)(object)((AbilityBehaviour)this).Card != (Object)null && !((AbilityBehaviour)this).Card.Dead && HasGems(onResolve: true);
			}

			public override IEnumerator OnResolveOnBoard()
			{
				yield return ((AbilityBehaviour)this).PreSuccessfulTriggerSequence();
				yield return ((AbilityBehaviour)this).Card.Die(false, (PlayableCard)null, true);
				yield return ((AbilityBehaviour)this).LearnAbility(0.25f);
			}

			public bool RespondsToBellRung(bool playerCombatPhase)
			{
				return (Object)(object)((AbilityBehaviour)this).Card != (Object)null && ((AbilityBehaviour)this).Card.OnBoard && playerCombatPhase != ((AbilityBehaviour)this).Card.OpponentCard && !((AbilityBehaviour)this).Card.Dead && HasGems(onResolve: false);
			}

			public IEnumerator OnBellRung(bool playerCombatPhase)
			{
				yield return ((AbilityBehaviour)this).PreSuccessfulTriggerSequence();
				yield return ((AbilityBehaviour)this).Card.Die(false, (PlayableCard)null, true);
				yield return ((AbilityBehaviour)this).LearnAbility(0.25f);
			}

			public override bool RespondsToUpkeep(bool playerUpkeep)
			{
				return (Object)(object)((AbilityBehaviour)this).Card != (Object)null && ((AbilityBehaviour)this).Card.OpponentCard != playerUpkeep && !((AbilityBehaviour)this).Card.Dead && HasGems(onResolve: false);
			}

			public override IEnumerator OnUpkeep(bool playerUpkeep)
			{
				yield return ((AbilityBehaviour)this).PreSuccessfulTriggerSequence();
				yield return ((AbilityBehaviour)this).Card.Die(false, (PlayableCard)null, true);
				yield return ((AbilityBehaviour)this).LearnAbility(0.25f);
			}

			public bool RespondsToGemGain()
			{
				return (Object)(object)((AbilityBehaviour)this).Card != (Object)null && !((AbilityBehaviour)this).Card.Dead && ((AbilityBehaviour)this).Card.OnBoard;
			}

			public IEnumerator OnGemGain()
			{
				yield return ((AbilityBehaviour)this).PreSuccessfulTriggerSequence();
				yield return ((AbilityBehaviour)this).Card.Die(false, (PlayableCard)null, true);
				yield return ((AbilityBehaviour)this).LearnAbility(0.25f);
			}

			public bool HasGems(bool onResolve)
			{
				if (((AbilityBehaviour)this).Card.OpponentCard)
				{
					if (onResolve && Singleton<TurnManager>.Instance.Opponent.Queue.Exists((PlayableCard x) => (Object)(object)x != (Object)null && ((Card)x).Info.HasTrait((Trait)17) && (Object)(object)x.Slot.Card == (Object)null))
					{
						return true;
					}
					return Singleton<BoardManager>.Instance.OpponentSlotsCopy.Exists((CardSlot x) => (Object)(object)x.Card != (Object)null && ((Card)x.Card).Info.HasTrait((Trait)17));
				}
				return Singleton<ResourcesManager>.Instance.HasGem((GemType)1) || Singleton<ResourcesManager>.Instance.HasGem((GemType)0) || Singleton<ResourcesManager>.Instance.HasGem((GemType)2);
			}
		}

		public class GiveNoModifications : AbilityBehaviour, IOnBellRung
		{
			public static Ability ability;

			public override Ability Ability => ability;

			private void Start()
			{
				//IL_0001: Unknown result type (might be due to invalid IL or missing references)
				//IL_0007: Expected O, but got Unknown
				//IL_0031: Unknown result type (might be due to invalid IL or missing references)
				//IL_0036: Unknown result type (might be due to invalid IL or missing references)
				//IL_004c: Unknown result type (might be due to invalid IL or missing references)
				CardModificationInfo val = new CardModificationInfo();
				val.nonCopyable = true;
				val.singletonId = "bitty_noAbilities";
				foreach (AbilityInfo allAbilityInfo in AbilityManager.AllAbilityInfos)
				{
					if (allAbilityInfo.ability != ability)
					{
						val.negateAbilities.Add(allAbilityInfo.ability);
					}
				}
				((AbilityBehaviour)this).Card.AddTemporaryMod(val);
			}

			public override bool RespondsToTurnEnd(bool playerTurnEnd)
			{
				return ((AbilityBehaviour)this).Card.TemporaryMods.Count > 0;
			}

			public override IEnumerator OnTurnEnd(bool playerTurnEnd)
			{
				yield return ClearMods();
			}

			public bool RespondsToBellRung(bool playerCombatPhase)
			{
				return ((AbilityBehaviour)this).Card.TemporaryMods.Count > 0;
			}

			public IEnumerator OnBellRung(bool playerCombatPhase)
			{
				yield return ClearMods();
			}

			public IEnumerator ClearMods()
			{
				((AbilityBehaviour)this).Card.TemporaryMods.RemoveAll((CardModificationInfo x) => x.singletonId != "bitty_noAbilities");
				((Card)((AbilityBehaviour)this).Card).Anim.StrongNegationEffect();
				((AbilityBehaviour)this).Card.OnStatsChanged();
				if (((AbilityBehaviour)this).Card.Health <= 0)
				{
					yield return ((AbilityBehaviour)this).Card.Die(false, (PlayableCard)null, true);
				}
			}
		}

		public class GiveStrafeJump : Strafe
		{
			public bool didMove;

			public static Ability ability;

			public override Ability Ability => ability;

			public override IEnumerator DoStrafe(CardSlot toLeft, CardSlot toRight)
			{
				bool leftHasSpace = SlotHasSpace(((AbilityBehaviour)this).Card.Slot, toLeft: true);
				bool rightHasSpace = SlotHasSpace(((AbilityBehaviour)this).Card.Slot, toLeft: false);
				if (base.movingLeft && !leftHasSpace)
				{
					base.movingLeft = false;
				}
				if (!base.movingLeft && !rightHasSpace)
				{
					base.movingLeft = true;
				}
				CardSlot destination = (base.movingLeft ? toLeft : toRight);
				bool destinationValid = (base.movingLeft ? leftHasSpace : rightHasSpace);
				if ((Object)(object)destination != (Object)null && (Object)(object)destination.Card != (Object)null)
				{
					didMove = false;
					yield return RecursiveMove(destination, base.movingLeft);
				}
				else
				{
					yield return ((Strafe)this).MoveToSlot(destination, destinationValid);
					didMove = true;
				}
				if (didMove)
				{
					yield return ((AbilityBehaviour)this).PreSuccessfulTriggerSequence();
					yield return ((AbilityBehaviour)this).LearnAbility(0f);
				}
				else
				{
					((Card)((AbilityBehaviour)this).Card).Anim.StrongNegationEffect();
				}
			}

			public virtual IEnumerator RecursiveMove(CardSlot slot, bool toLeft)
			{
				CardSlot adjacent = Singleton<BoardManager>.Instance.GetAdjacent(slot, toLeft);
				if ((Object)(object)adjacent != (Object)null && (Object)(object)adjacent.Card == (Object)null)
				{
					yield return JumpToSlot(adjacent, destinationValid: true, toLeft);
					didMove = true;
				}
				else if ((Object)(object)adjacent != (Object)null)
				{
					yield return RecursiveMove(adjacent, toLeft);
				}
			}

			private bool SlotHasSpace(CardSlot slot, bool toLeft)
			{
				CardSlot adjacent = Singleton<BoardManager>.Instance.GetAdjacent(slot, toLeft);
				return (Object)(object)adjacent != (Object)null && ((Object)(object)adjacent.Card == (Object)null || SlotHasSpace(adjacent, toLeft));
			}

			public IEnumerator JumpToSlot(CardSlot destination, bool destinationValid, bool toLeft)
			{
				((Card)((AbilityBehaviour)this).Card).RenderInfo.SetAbilityFlipped(((AbilityBehaviour)this).Ability, base.movingLeft);
				((Card)((AbilityBehaviour)this).Card).RenderInfo.flippedPortrait = base.movingLeft && ((Card)((AbilityBehaviour)this).Card).Info.flipPortraitForStrafe;
				((Card)((AbilityBehaviour)this).Card).RenderCard();
				if ((Object)(object)destination != (Object)null && destinationValid)
				{
					CardSlot oldSlot = ((AbilityBehaviour)this).Card.Slot;
					Singleton<ViewManager>.Instance.SwitchToView((View)4, false, false);
					yield return (object)new WaitForSeconds(0.05f);
					Vector3 a = (toLeft ? Vector3.left : Vector3.right);
					((Card)((AbilityBehaviour)this).Card).Anim.StrongNegationEffect();
					Tween.Position(((Component)((AbilityBehaviour)this).Card).transform, ((Component)((AbilityBehaviour)this).Card).transform.position + Vector3.up * 0.75f + a * 0.5f, 0.15f, 0f, Tween.EaseOut, (LoopType)0, (Action)null, (Action)null, true);
					yield return (object)new WaitForSeconds(0.15f);
					Tween.Position(((Component)((AbilityBehaviour)this).Card).transform, new Vector3(((Component)destination).transform.position.x, ((Component)((AbilityBehaviour)this).Card).transform.position.y, ((Component)((AbilityBehaviour)this).Card).transform.position.z), 0.1f, 0f, (AnimationCurve)null, (LoopType)0, (Action)null, (Action)null, true);
					yield return (object)new WaitForSeconds(0.1f);
					yield return Singleton<BoardManager>.Instance.AssignCardToSlot(((AbilityBehaviour)this).Card, destination, 0.1f, (Action)null, true);
					yield return ((Strafe)this).PostSuccessfulMoveSequence(oldSlot);
					yield return (object)new WaitForSeconds(0.25f);
				}
				else
				{
					((Card)((AbilityBehaviour)this).Card).Anim.StrongNegationEffect();
					yield return (object)new WaitForSeconds(0.15f);
				}
			}
		}

		public class GiveStrafeSuper : Strafe
		{
			public static Ability ability;

			public override Ability Ability => ability;

			public override IEnumerator DoStrafe(CardSlot toLeft, CardSlot toRight)
			{
				bool leftHasSpace = (Object)(object)toLeft != (Object)null && (Object)(object)toLeft.Card == (Object)null;
				bool rightHasSpace = (Object)(object)toRight != (Object)null && (Object)(object)toRight.Card == (Object)null;
				if (base.movingLeft && !leftHasSpace)
				{
					base.movingLeft = false;
				}
				if (!base.movingLeft && !rightHasSpace)
				{
					base.movingLeft = true;
				}
				CardSlot destination = (base.movingLeft ? EndSlot(((AbilityBehaviour)this).Card.slot, toLeft: true) : EndSlot(((AbilityBehaviour)this).Card.slot, toLeft: false));
				Plugin.Log.LogInfo((object)("Destination: " + (object)destination));
				bool destinationValid = ((!base.movingLeft) ? (rightHasSpace && (Object)(object)destination != (Object)(object)((AbilityBehaviour)this).Card.slot) : (leftHasSpace && (Object)(object)destination != (Object)(object)((AbilityBehaviour)this).Card.slot));
				yield return ((Strafe)this).MoveToSlot(destination, destinationValid);
				if ((Object)(object)destination != (Object)null && (Object)(object)destination != (Object)(object)((AbilityBehaviour)this).Card.slot && destinationValid)
				{
					yield return ((AbilityBehaviour)this).PreSuccessfulTriggerSequence();
					yield return ((AbilityBehaviour)this).LearnAbility(0f);
				}
			}

			private CardSlot EndSlot(CardSlot slot, bool toLeft)
			{
				CardSlot adjacent = Singleton<BoardManager>.Instance.GetAdjacent(slot, toLeft);
				if ((Object)(object)adjacent != (Object)null && (Object)(object)adjacent.Card == (Object)null)
				{
					return EndSlot(adjacent, toLeft);
				}
				return slot;
			}
		}

		public class GiveCreateEggs : CreateCardsAdjacent
		{
			public static Ability ability;

			public override Ability Ability => ability;

			public override string SpawnedCardId => (SeededRandom.Value(((TriggerReceiver)this).GetRandomSeed()) < 0.1f && ProgressionData.LearnedAbility(((AbilityBehaviour)this).Ability)) ? "RavenEgg" : "BrokenEgg";

			public override string CannotSpawnDialogue => "Blocked on both sides. No Eggs for you.";
		}

		public abstract class CreateCardsOnSlots : AbilityBehaviour
		{
			private bool ranOnce;

			private const int MAX_ABILITIES_FOR_SPAWNED_CARD = 4;

			protected abstract string SpawnedCardId { get; }

			protected abstract string CannotSpawnDialogue { get; }

			protected abstract List<CardSlot> CardSlots { get; }

			public override bool RespondsToResolveOnBoard()
			{
				return true;
			}

			public override IEnumerator OnResolveOnBoard()
			{
				Singleton<ViewManager>.Instance.SwitchToView((View)4, false, false);
				ranOnce = false;
				foreach (CardSlot cardSlot in CardSlots)
				{
					if ((Object)(object)cardSlot.Card == (Object)null)
					{
						yield return (object)new WaitForSeconds(0.1f);
						yield return SpawnCardOnSlot(cardSlot);
						ranOnce = true;
					}
				}
				yield return ((AbilityBehaviour)this).PreSuccessfulTriggerSequence();
				if (ranOnce)
				{
					yield return ((AbilityBehaviour)this).LearnAbility(0f);
				}
				else if (!((AbilityBehaviour)this).HasLearned)
				{
					yield return Singleton<TextDisplayer>.Instance.ShowUntilInput(CannotSpawnDialogue, -0.65f, 0.4f, (Emotion)0, (LetterAnimation)0, (Speaker)0, (string[])null, true);
				}
			}

			private IEnumerator SpawnCardOnSlot(CardSlot slot)
			{
				CardInfo cardByName = CardLoader.GetCardByName(SpawnedCardId);
				ModifySpawnedCard(cardByName);
				yield return Singleton<BoardManager>.Instance.CreateCardInSlot(cardByName, slot, 0.15f, true);
			}

			private void ModifySpawnedCard(CardInfo card)
			{
				//IL_008b: Unknown result type (might be due to invalid IL or missing references)
				//IL_0091: Expected O, but got Unknown
				List<Ability> abilities = ((Card)((AbilityBehaviour)this).Card).Info.Abilities;
				foreach (CardModificationInfo temporaryMod in ((AbilityBehaviour)this).Card.TemporaryMods)
				{
					abilities.AddRange(temporaryMod.abilities);
				}
				abilities.RemoveAll((Ability x) => x == ((AbilityBehaviour)this).Ability);
				if (abilities.Count > 4)
				{
					abilities.RemoveRange(3, abilities.Count - 4);
				}
				CardModificationInfo val = new CardModificationInfo();
				val.fromCardMerge = true;
				val.abilities = abilities;
				card.Mods.Add(val);
			}
		}

		public class GiveCreateFirsOnPlayer : CreateCardsOnSlots
		{
			public static Ability ability;

			public override Ability Ability => ability;

			protected override string SpawnedCardId
			{
				get
				{
					if (((Object)RunState.CurrentMapRegion).name == "Snowline")
					{
						return "Tree_SnowCovered";
					}
					return "Tree";
				}
			}

			protected override string CannotSpawnDialogue => "No empty spaces. No firs for you.";

			protected override List<CardSlot> CardSlots => CardExtensions.IsPlayerCard(((AbilityBehaviour)this).Card) ? Singleton<BoardManager>.Instance.PlayerSlotsCopy : Singleton<BoardManager>.Instance.OpponentSlotsCopy;
		}

		public class GiveSwapStatsTurnEnd : SigilEffectsBase
		{
			private bool swapped;

			public static Ability ability;

			public override Ability Ability => ability;

			public override bool RespondsToTurnEnd(bool playerTurnEnd)
			{
				return playerTurnEnd != ((AbilityBehaviour)this).Card.OpponentCard;
			}

			public override IEnumerator OnTurnEnd(bool playerTurnEnd)
			{
				yield return ((AbilityBehaviour)this).PreSuccessfulTriggerSequence();
				yield return (object)new WaitForSeconds(0.5f);
				swapped = !swapped;
				if (swapped && (Object)(object)((Card)((AbilityBehaviour)this).Card).Info.alternatePortrait != (Object)null && Singleton<BoardManager>.Instance is BoardManager3D)
				{
					((AbilityBehaviour)this).Card.SwitchToAlternatePortrait();
				}
				else
				{
					((AbilityBehaviour)this).Card.SwitchToDefaultPortrait();
				}
				yield return SwapStats(((AbilityBehaviour)this).Card);
				yield return ((AbilityBehaviour)this).LearnAbility(0.25f);
			}
		}

		public class GiveFleetingDraw : SigilEffectsBase
		{
			public static Ability ability;

			public override Ability Ability => ability;

			protected override Ability DrawAbility => GiveFleeting.ability;

			public override bool RespondsToResolveOnBoard()
			{
				return true;
			}

			public override IEnumerator OnResolveOnBoard()
			{
				yield return ((AbilityBehaviour)this).PreSuccessfulTriggerSequence();
				yield return DrawCard(mods: true);
				yield return ((AbilityBehaviour)this).LearnAbility(0.25f);
			}
		}

		public class GiveOutcast : SigilEffectsBase
		{
			public static Ability ability;

			public override Ability Ability => ability;

			public override bool RespondsToTurnEnd(bool playerTurnEnd)
			{
				return playerTurnEnd != ((AbilityBehaviour)this).Card.OpponentCard;
			}

			public override IEnumerator OnTurnEnd(bool playerTurnEnd)
			{
				yield return ((AbilityBehaviour)this).PreSuccessfulTriggerSequence();
				yield return MoveCardIntoDeck(((AbilityBehaviour)this).Card);
				yield return ((AbilityBehaviour)this).LearnAbility(0.25f);
			}
		}

		public class GiveHallowedRepeater : SigilEffectsBase
		{
			public static Ability ability;

			public override Ability Ability => ability;

			public override bool RespondsToPreDeathAnimation(bool wasSacrifice)
			{
				return true;
			}

			public override IEnumerator OnPreDeathAnimation(bool wasSacrifice)
			{
				if (((AbilityBehaviour)this).Card.TriggerHandler.RespondsToTrigger((Trigger)3, Array.Empty<object>()))
				{
					yield return ((AbilityBehaviour)this).Card.TriggerHandler.OnTrigger((Trigger)3, Array.Empty<object>());
				}
			}
		}

		public class GiveSquirrelDeck : SigilEffectsBase
		{
			public static Ability ability;

			public override Ability Ability => ability;

			static GiveSquirrelDeck()
			{
				//IL_0059: Unknown result type (might be due to invalid IL or missing references)
				//IL_005e: Unknown result type (might be due to invalid IL or missing references)
				AbilityInfo val = AbilityExtensions.SetPixelAbilityIcon(AbilityExtensions.AddMetaCategories(AbilityManager.New("bitty45.inscryption.sigils", "Explosive Squirrel Reproduction", "When [creature] is played, fill your side deck with squirrels.", typeof(GiveSquirrelDeck), (Texture)(object)Tools.LoadTexture("ability_squirreldeck")), (AbilityMetaCategory[])(object)new AbilityMetaCategory[2]
				{
					default(AbilityMetaCategory),
					(AbilityMetaCategory)2
				}), Tools.LoadTexture("ability_squirreldeck_a2"), (FilterMode?)null);
				val.powerLevel = 3;
				ability = val.ability;
			}

			public override bool RespondsToResolveOnBoard()
			{
				return true;
			}

			public override IEnumerator OnResolveOnBoard()
			{
				yield return ((AbilityBehaviour)this).PreSuccessfulTriggerSequence();
				for (int i = 0; i < 200; i++)
				{
					CreateCardInDeck(CardLoader.GetCardByName("Squirrel"), toSideDeck: true);
				}
				yield return ((AbilityBehaviour)this).LearnAbility(0.25f);
			}
		}

		public class GiveReplenish : SigilEffectsBase
		{
			public static Ability ability;

			public override Ability Ability => ability;

			public override bool RespondsToDrawn()
			{
				return true;
			}

			public override IEnumerator OnDrawn()
			{
				yield return ((AbilityBehaviour)this).PreSuccessfulTriggerSequence();
				yield return DrawCard();
				yield return ((AbilityBehaviour)this).LearnAbility(0.25f);
			}
		}

		public class GiveTargetedStatSwap : TargetSlotBase
		{
			public static Ability ability;

			public override Ability Ability => ability;

			public override bool RespondsToResolveOnBoard()
			{
				return true;
			}

			public override IEnumerator OnResolveOnBoard()
			{
				List<CardSlot> slots = Singleton<BoardManager>.Instance.AllSlotsCopy;
				slots.RemoveAll((CardSlot x) => (Object)(object)x.Card == (Object)null);
				if (slots.Count > 0)
				{
					if ((int)Singleton<ViewManager>.Instance.CurrentView != 4)
					{
						yield return (object)new WaitForSeconds(0.2f);
						Singleton<ViewManager>.Instance.SwitchToView((View)4, false, false);
						yield return (object)new WaitForSeconds(0.2f);
					}
					yield return TargetSlot(slots, slots);
				}
			}

			public override IEnumerator TargetSelectedCallback(CardSlot slot)
			{
				yield return SwapStats(slot.Card);
			}
		}

		public class GiveSacrificialGrowth : AbilityBehaviour
		{
			public static Ability ability;

			public override Ability Ability => ability;

			protected virtual bool EvolveInheritsInfoMods => true;

			protected virtual float PostTransformWait => 0.5f;

			public void Start()
			{
				//IL_0009: Unknown result type (might be due to invalid IL or missing references)
				//IL_0013: Expected O, but got Unknown
				((AbilityBehaviour)this).Card.AddTemporaryMod(new CardModificationInfo((Ability)20));
				((AbilityBehaviour)this).Card.Status.hiddenAbilities.Add((Ability)20);
			}

			public override bool RespondsToSacrifice()
			{
				return true;
			}

			public override IEnumerator OnSacrifice()
			{
				CardInfo evolution = GetTransformCardInfo();
				if (EvolveInheritsInfoMods)
				{
					foreach (CardModificationInfo cardModificationInfo in ((Card)((AbilityBehaviour)this).Card).Info.Mods.FindAll((CardModificationInfo x) => !x.nonCopyable))
					{
						CardModificationInfo cardModificationInfo2 = (CardModificationInfo)cardModificationInfo.Clone();
						if (cardModificationInfo2.HasAbility(ability))
						{
							cardModificationInfo2.abilities.Remove(ability);
						}
						evolution.Mods.Add(cardModificationInfo2);
					}
				}
				yield return ((AbilityBehaviour)this).PreSuccessfulTriggerSequence();
				yield return ((AbilityBehaviour)this).Card.TransformIntoCard(evolution, (Action)RemoveTemporaryModsWithEvolve, (Action)null);
				yield return (object)new WaitForSeconds(PostTransformWait);
				yield return ((AbilityBehaviour)this).LearnAbility(0.5f);
			}

			protected virtual CardInfo GetTransformCardInfo()
			{
				if (((Card)((AbilityBehaviour)this).Card).Info.evolveParams == null)
				{
					return GetDefaultEvolution(((Card)((AbilityBehaviour)this).Card).Info);
				}
				object obj = ((Card)((AbilityBehaviour)this).Card).Info.evolveParams.evolution.Clone();
				return (CardInfo)((obj is CardInfo) ? obj : null);
			}

			private void RemoveTemporaryModsWithEvolve()
			{
				//IL_0011: Unknown result type (might be due to invalid IL or missing references)
				if (!((Card)((AbilityBehaviour)this).Card).Info.Abilities.Contains(ability))
				{
					for (CardModificationInfo temporaryEvolveMod = GetTemporaryEvolveMod(); temporaryEvolveMod != null; temporaryEvolveMod = GetTemporaryEvolveMod())
					{
						((AbilityBehaviour)this).Card.RemoveTemporaryMod(temporaryEvolveMod, true);
					}
				}
			}

			private CardModificationInfo GetTemporaryEvolveMod()
			{
				return ((AbilityBehaviour)this).Card.TemporaryMods.Find((CardModificationInfo x) => x.abilities.Contains(ability));
			}

			public static CardInfo GetDefaultEvolution(CardInfo info)
			{
				//IL_000f: Unknown result type (might be due to invalid IL or missing references)
				//IL_0015: Expected O, but got Unknown
				//IL_0069: Unknown result type (might be due to invalid IL or missing references)
				object obj = info.Clone();
				CardInfo val = (CardInfo)((obj is CardInfo) ? obj : null);
				CardModificationInfo val2 = new CardModificationInfo(1, 2);
				val2.fromEvolve = true;
				if (!string.IsNullOrEmpty(info.defaultEvolutionName))
				{
					val2.nameReplacement = info.defaultEvolutionName;
				}
				else
				{
					val2.nameReplacement = string.Format(Localization.Translate("Elder {0}"), val.DisplayedNameLocalized);
				}
				val.Mods.Add(val2);
				val.RemoveBaseAbility(ability);
				return val;
			}
		}

		public class GiveOrangeTransform : Evolve, IOnGemChange
		{
			public static Ability ability;

			public override Ability Ability => ability;

			public override bool RespondsToUpkeep(bool playerUpkeep)
			{
				CardModificationInfo val = ((Card)((AbilityBehaviour)this).Card).Info.Mods.Find((CardModificationInfo m) => m.singletonId == "bitty_transform");
				return ((AbilityBehaviour)this).Card.OpponentCard != playerUpkeep && Singleton<ResourcesManager>.Instance.HasGem((GemType)1) != (val != null);
			}

			public static CardModificationInfo GetBeastModeStatsMod(CardInfo beastModeCard, CardInfo botModeCard)
			{
				//IL_0001: Unknown result type (might be due to invalid IL or missing references)
				//IL_0006: Unknown result type (might be due to invalid IL or missing references)
				//IL_0019: Unknown result type (might be due to invalid IL or missing references)
				//IL_002c: Unknown result type (might be due to invalid IL or missing references)
				//IL_003f: Unknown result type (might be due to invalid IL or missing references)
				//IL_0052: Unknown result type (might be due to invalid IL or missing references)
				//IL_005a: Expected O, but got Unknown
				return new CardModificationInfo
				{
					energyCostAdjustment = botModeCard.EnergyCost - beastModeCard.EnergyCost,
					bloodCostAdjustment = botModeCard.BloodCost - beastModeCard.BloodCost,
					bonesCostAdjustment = botModeCard.BonesCost - beastModeCard.BonesCost,
					healthAdjustment = botModeCard.Health - beastModeCard.Health,
					nonCopyable = true
				};
			}

			public override CardInfo GetTransformCardInfo()
			{
				//IL_00ae: Unknown result type (might be due to invalid IL or missing references)
				//IL_00b3: Unknown result type (might be due to invalid IL or missing references)
				//IL_00ba: Expected O, but got Unknown
				//IL_00d1: Unknown result type (might be due to invalid IL or missing references)
				//IL_00db: Expected O, but got Unknown
				//IL_0145: Unknown result type (might be due to invalid IL or missing references)
				//IL_014a: Unknown result type (might be due to invalid IL or missing references)
				//IL_015a: Expected O, but got Unknown
				CardModificationInfo val = ((Card)((AbilityBehaviour)this).Card).Info.Mods.Find((CardModificationInfo m) => !string.IsNullOrEmpty(m.transformerBeastCardId));
				bool flag = !((Object)((Card)((AbilityBehaviour)this).Card).Info).name.StartsWith("CXformer");
				if (val != null && flag)
				{
					CardInfo cardByName = CardLoader.GetCardByName(val.transformerBeastCardId);
					CardModificationInfo beastModeStatsMod = GetBeastModeStatsMod(cardByName, ((Card)((AbilityBehaviour)this).Card).Info);
					beastModeStatsMod.nameReplacement = ((Card)((AbilityBehaviour)this).Card).Info.DisplayedNameEnglish;
					beastModeStatsMod.nonCopyable = true;
					cardByName.Mods.Add(beastModeStatsMod);
					CardModificationInfo val2 = new CardModificationInfo(ability);
					val2.nonCopyable = true;
					cardByName.Mods.Add(val2);
					cardByName.evolveParams = new EvolveParams();
					cardByName.evolveParams.evolution = ((Card)((AbilityBehaviour)this).Card).Info;
					cardByName.evolveParams.turnsToEvolve = 1;
					CardModificationInfo val3 = ((Card)((AbilityBehaviour)this).Card).Info.Mods.Find((CardModificationInfo m) => m.singletonId == "bitty_transform");
					if (val3 == null)
					{
						cardByName.Mods.Add(new CardModificationInfo
						{
							singletonId = "bitty_transform"
						});
					}
					if (((Card)((AbilityBehaviour)this).Card).Info.SpecialAbilities.Contains((SpecialTriggeredAbility)9))
					{
						((Card)((AbilityBehaviour)this).Card).RenderInfo.prefabPortrait = null;
						((Card)((AbilityBehaviour)this).Card).RenderInfo.hidePortrait = false;
						((Card)((AbilityBehaviour)this).Card).ClearAppearanceBehaviours();
						Singleton<CardRenderCamera>.Instance.StopLiveRenderCard(((Card)((AbilityBehaviour)this).Card).StatsLayer);
					}
					return cardByName;
				}
				if (((Card)((AbilityBehaviour)this).Card).Info.evolveParams == null || (Object)(object)((Card)((AbilityBehaviour)this).Card).Info.evolveParams.evolution == (Object)null)
				{
					return CardLoader.GetCardByName("CXformerAdder");
				}
				object obj = ((Card)((AbilityBehaviour)this).Card).Info.evolveParams.evolution.Clone();
				return (CardInfo)((obj is CardInfo) ? obj : null);
			}

			public bool RespondsToGemChange()
			{
				return true;
			}

			public IEnumerator OnGemChange()
			{
				CardModificationInfo cardModificationInfo = ((Card)((AbilityBehaviour)this).Card).Info.Mods.Find((CardModificationInfo m) => m.singletonId == "bitty_transform");
				if (Singleton<ResourcesManager>.Instance.HasGem((GemType)1) != (cardModificationInfo != null))
				{
					yield return ((AbilityBehaviour)this).Card.TriggerHandler.OnTrigger((Trigger)0, new object[1] { CardExtensions.IsPlayerCard(((AbilityBehaviour)this).Card) });
				}
			}
		}

		public class GiveGemify : AbilityBehaviour, IOnGemChange
		{
			public CardModificationInfo modHealth = new CardModificationInfo();

			public CardModificationInfo modAttack = new CardModificationInfo();

			public CardModificationInfo modCost = new CardModificationInfo();

			public static Ability ability;

			public override Ability Ability => ability;

			private void Start()
			{
				modHealth.healthAdjustment = 2;
				modHealth.singletonId = "bitty_gemHealth";
				modHealth.nonCopyable = true;
				modAttack.attackAdjustment = 1;
				modAttack.singletonId = "bitty_gemAttack";
				modAttack.nonCopyable = true;
				modCost.energyCostAdjustment = -1;
				modCost.bonesCostAdjustment = -1;
				modCost.bloodCostAdjustment = -1;
				modCost.nullifyGemsCost = true;
				modCost.singletonId = "bitty_gemCost";
				modCost.nonCopyable = true;
			}

			public override bool RespondsToDrawn()
			{
				return true;
			}

			public override IEnumerator OnDrawn()
			{
				UpdateGemify();
				yield break;
			}

			public override bool RespondsToResolveOnBoard()
			{
				return true;
			}

			public override IEnumerator OnResolveOnBoard()
			{
				UpdateGemify();
				yield break;
			}

			public bool RespondsToGemChange()
			{
				return true;
			}

			public IEnumerator OnGemChange()
			{
				UpdateGemify();
				if (((AbilityBehaviour)this).Card.OnBoard && ((AbilityBehaviour)this).Card.Health <= 0)
				{
					yield return ((AbilityBehaviour)this).Card.Die(false, (PlayableCard)null, true);
				}
			}

			public void UpdateGemify()
			{
				Plugin.Log.LogInfo((object)"UpdateStart");
				CardModificationInfo cardMod = ((AbilityBehaviour)this).Card.TemporaryMods.Find((CardModificationInfo x) => x.singletonId == "bitty_gemAttack");
				CardModificationInfo cardMod2 = ((AbilityBehaviour)this).Card.TemporaryMods.Find((CardModificationInfo x) => x.singletonId == "bitty_gemHealth");
				CardModificationInfo cardMod3 = ((AbilityBehaviour)this).Card.TemporaryMods.Find((CardModificationInfo x) => x.singletonId == "bitty_gemCost");
				Plugin.Log.LogInfo((object)"GemAttack");
				GemAddRemove(HasOrange(), cardMod, modAttack);
				Plugin.Log.LogInfo((object)"GemHealth");
				GemAddRemove(HasGreen(), cardMod2, modHealth);
				Plugin.Log.LogInfo((object)"GemCost");
				GemAddRemove(HasBlue(), cardMod3, modCost);
				Plugin.Log.LogInfo((object)"Render");
				((Card)((AbilityBehaviour)this).Card).RenderCard();
				((Card)((AbilityBehaviour)this).Card).Anim.StrongNegationEffect();
			}

			private void GemAddRemove(bool hasGem, CardModificationInfo cardMod, CardModificationInfo modToAdd)
			{
				if (hasGem && cardMod == null)
				{
					((AbilityBehaviour)this).Card.AddTemporaryMod(modToAdd);
				}
				else if (!hasGem && cardMod != null)
				{
					((AbilityBehaviour)this).Card.RemoveTemporaryMod(cardMod, true);
				}
			}

			public virtual bool HasOrange()
			{
				return Singleton<ResourcesManager>.Instance.HasGem((GemType)1);
			}

			public virtual bool HasGreen()
			{
				return Singleton<ResourcesManager>.Instance.HasGem((GemType)0);
			}

			public virtual bool HasBlue()
			{
				return Singleton<ResourcesManager>.Instance.HasGem((GemType)2);
			}
		}

		public static Ability CreateSigilInfo(string name, string description, Type type, int powerLevel, string act1TextureName = null, string act2TextureName = null, bool activated = false, bool stackable = false, bool flipYIfEnemy = false, bool customFlippedIcon = false, string act1CustomFlippedTexture = "ability_test", string act2CustomFlippedTexture = "ability_test_a2")
		{
			//IL_008b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0090: Unknown result type (might be due to invalid IL or missing references)
			//IL_0093: Unknown result type (might be due to invalid IL or missing references)
			AbilityInfo val = AbilityExtensions.AddMetaCategories(AbilityManager.New("bitty45.inscryption.sigils", name, description, type, (Texture)(object)Tools.LoadTexture((act1TextureName != null) ? act1TextureName : "ability_test")), (AbilityMetaCategory[])(object)new AbilityMetaCategory[2]
			{
				default(AbilityMetaCategory),
				(AbilityMetaCategory)2
			});
			val.pixelIcon = Tools.LoadSprite((act2TextureName != null) ? act2TextureName : "ability_test_a2");
			val.powerLevel = powerLevel;
			val.activated = activated;
			val.flipYIfOpponent = flipYIfEnemy;
			val.canStack = stackable;
			val.customFlippedIcon = customFlippedIcon;
			AbilityExtensions.SetCustomFlippedTexture(val, Tools.LoadTexture(act1CustomFlippedTexture));
			val.customFlippedPixelIcon = Tools.LoadSprite(act2CustomFlippedTexture);
			return val.ability;
		}

		public static void AddAllSigils()
		{
			//IL_002e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0033: Unknown result type (might be due to invalid IL or missing references)
			//IL_0065: Unknown result type (might be due to invalid IL or missing references)
			//IL_006a: 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_00a1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d8: Unknown result type (might be due to invalid IL or missing references)
			//IL_010a: Unknown result type (might be due to invalid IL or missing references)
			//IL_010f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0141: Unknown result type (might be due to invalid IL or missing references)
			//IL_0146: Unknown result type (might be due to invalid IL or missing references)
			//IL_0178: Unknown result type (might be due to invalid IL or missing references)
			//IL_017d: Unknown result type (might be due to invalid IL or missing references)
			//IL_01af: Unknown result type (might be due to invalid IL or missing references)
			//IL_01b4: Unknown result type (might be due to invalid IL or missing references)
			//IL_01e6: 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_021d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0222: Unknown result type (might be due to invalid IL or missing references)
			//IL_0255: Unknown result type (might be due to invalid IL or missing references)
			//IL_025a: Unknown result type (might be due to invalid IL or missing references)
			//IL_028d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0292: Unknown result type (might be due to invalid IL or missing references)
			//IL_02c5: Unknown result type (might be due to invalid IL or missing references)
			//IL_02ca: Unknown result type (might be due to invalid IL or missing references)
			//IL_02fc: Unknown result type (might be due to invalid IL or missing references)
			//IL_0301: Unknown result type (might be due to invalid IL or missing references)
			//IL_0334: Unknown result type (might be due to invalid IL or missing references)
			//IL_0339: Unknown result type (might be due to invalid IL or missing references)
			//IL_036b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0370: Unknown result type (might be due to invalid IL or missing references)
			//IL_03a2: Unknown result type (might be due to invalid IL or missing references)
			//IL_03a7: Unknown result type (might be due to invalid IL or missing references)
			//IL_03d9: Unknown result type (might be due to invalid IL or missing references)
			//IL_03de: Unknown result type (might be due to invalid IL or missing references)
			//IL_0410: Unknown result type (might be due to invalid IL or missing references)
			//IL_0415: Unknown result type (might be due to invalid IL or missing references)
			//IL_0447: Unknown result type (might be due to invalid IL or missing references)
			//IL_044c: Unknown result type (might be due to invalid IL or missing references)
			//IL_047e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0483: Unknown result type (might be due to invalid IL or missing references)
			//IL_04b5: Unknown result type (might be due to invalid IL or missing references)
			//IL_04ba: Unknown result type (might be due to invalid IL or missing references)
			//IL_04ec: Unknown result type (might be due to invalid IL or missing references)
			//IL_04f1: Unknown result type (might be due to invalid IL or missing references)
			//IL_0524: Unknown result type (might be due to invalid IL or missing references)
			//IL_0529: Unknown result type (might be due to invalid IL or missing references)
			//IL_055b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0560: Unknown result type (might be due to invalid IL or missing references)
			//IL_0592: Unknown result type (might be due to invalid IL or missing references)
			//IL_0597: Unknown result type (might be due to invalid IL or missing references)
			//IL_05c9: Unknown result type (might be due to invalid IL or missing references)
			//IL_05ce: Unknown result type (might be due to invalid IL or missing references)
			//IL_0601: Unknown result type (might be due to invalid IL or missing references)
			//IL_0606: Unknown result type (might be due to invalid IL or missing references)
			//IL_066f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0674: Unknown result type (might be due to invalid IL or missing references)
			//IL_06a7: Unknown result type (might be due to invalid IL or missing references)
			//IL_06ac: Unknown result type (might be due to invalid IL or missing references)
			//IL_06de: Unknown result type (might be due to invalid IL or missing references)
			//IL_06e3: Unknown result type (might be due to invalid IL or missing references)
			//IL_0715: Unknown result type (might be due to invalid IL or missing references)
			//IL_071a: Unknown result type (might be due to invalid IL or missing references)
			//IL_074c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0751: Unknown result type (might be due to invalid IL or missing references)
			//IL_0784: Unknown result type (might be due to invalid IL or missing references)
			//IL_0789: Unknown result type (might be due to invalid IL or missing references)
			//IL_07bb: Unknown result type (might be due to invalid IL or missing references)
			//IL_07c0: Unknown result type (might be due to invalid IL or missing references)
			//IL_07f2: Unknown result type (might be due to invalid IL or missing references)
			//IL_07f7: Unknown result type (might be due to invalid IL or missing references)
			//IL_0829: Unknown result type (might be due to invalid IL or missing references)
			//IL_082e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0860: Unknown result type (might be due to invalid IL or missing references)
			//IL_0865: Unknown result type (might be due to invalid IL or missing references)
			//IL_0897: Unknown result type (might be due to invalid IL or missing references)
			//IL_089c: Unknown result type (might be due to invalid IL or missing references)
			//IL_08ce: Unknown result type (might be due to invalid IL or missing references)
			//IL_08d3: Unknown result type (might be due to invalid IL or missing references)
			//IL_0906: Unknown result type (might be due to invalid IL or missing references)
			//IL_090b: Unknown result type (might be due to invalid IL or missing references)
			//IL_093d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0942: Unknown result type (might be due to invalid IL or missing references)
			//IL_0974: Unknown result type (might be due to invalid IL or missing references)
			//IL_0979: Unknown result type (might be due to invalid IL or missing references)
			//IL_09ab: Unknown result type (might be due to invalid IL or missing references)
			//IL_09b0: Unknown result type (might be due to invalid IL or missing references)
			//IL_09de: Unknown result type (might be due to invalid IL or missing references)
			//IL_09e3: Unknown result type (might be due to invalid IL or missing references)
			//IL_0a0d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0a12: Unknown result type (might be due to invalid IL or missing references)
			//IL_0a3c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0a41: Unknown result type (might be due to invalid IL or missing references)
			//IL_0aad: Unknown result type (might be due to invalid IL or missing references)
			//IL_0ab2: Unknown result type (might be due to invalid IL or missing references)
			//IL_0ab8: Unknown result type (might be due to invalid IL or missing references)
			//IL_0abd: Unknown result type (might be due to invalid IL or missing references)
			GiveAllStatsSwap.ability = CreateSigilInfo("Heart Swap", "When [creature] is played, all cards on the board swap their power and health.", typeof(GiveAllStatsSwap), 4, "ability_allStatsSwap", "ability_allStatsSwap_a2");
			GiveOpposingCopy.ability = CreateSigilInfo("Mutual Hire", "When [creature] is played, a copy of it is created in the opposing space.", typeof(GiveOpposingCopy), 2, "ability_opposingCopy", "ability_opposingCopy_a2");
			GiveActivatedBuffPlayerPower.ability = CreateSigilInfo("Charged Barrage", "Pay 4 life to increase the power of all cards on your side of the board by 1.", typeof(GiveActivatedBuffPlayerPower), 5, "ability_activatedBuffPlayerPower", "ability_activatedBuffPlayerPower_a2", activated: true);
			GiveActivatedHealthRoll.ability = CreateSigilInfo("Health Roll", "Pay 1 Energy to set the health of [creature] randomly between 1 and 6.", typeof(GiveActivatedHealthRoll), 1, "ability_activatedHealthRoll", "ability_activatedHealthRoll_a2", activated: true);
			GiveActivatedSigilRoll.ability = CreateSigilInfo("Sigil Roll", "Pay 4 Life to add a random sigil to [creature].", typeof(GiveActivatedSigilRoll), 5, "ability_activatedSigilRoll", "ability_activatedSigilRoll_a2", activated: true);
			GiveOpponentCopyOnKill.ability = CreateSigilInfo("Wildlife Camera", "When [creature] kills another card, a copy of the killed card is created in your hand.", typeof(GiveOpponentCopyOnKill), 3, "ability_opponentCopyOnKill", "ability_opponentCopyOnKill_a2");
			GiveCorpseSpawner.ability = CreateSigilInfo("Dusty Quill", "Whenever a creature dies while [creature] is on the board, a corpse is raised in it's place. Corpses are defined as: 0/1.", typeof(GiveCorpseSpawner), 4, "ability_corpseSpawner", "ability_corpseSpawner_a2");
			GiveBleach.ability = CreateSigilInfo("Bleached Brush", "When [creature] is played, the opposing card will lose all its sigils.", typeof(GiveBleach), 3, "ability_bleach", "ability_bleach_a2");
			GiveOnlyTransfer.ability = CreateSigilInfo("Strong Soul", "[creature] may not recieve sigils from another card.", typeof(GiveOnlyTransfer), -1, "ability_onlyTransfer", "ability_onlyTransfer_a2");
			GiveNoTransfer.ability = CreateSigilInfo("Weak Soul", "[creature] may not have its sigils transferred to another card.", typeof(GiveNoTransfer), -1, "ability_noTransfer", "ability_noTransfer_a2");
			GiveNoStones.ability = CreateSigilInfo("Nonexistent Soul", "[creature] may not have sigils transferred to, or from this card.", typeof(GiveNoStones), -2, "ability_noStones", "ability_noStones_a2");
			GiveNoCampfire.ability = CreateSigilInfo("Pyrophobia", "[creature] may not be buffed at campsites.", typeof(GiveNoCampfire), -3, "ability_noCampfire", "ability_noCampfire_a2");
			GiveNoCampfireAttack.ability = CreateSigilInfo("Pyrophobia (Attack)", "[creature] may not recieve power buffs from campsites.", typeof(GiveNoCampfireAttack), -2, "ability_noCampfireAttack", "ability_noCampfireAttack_a2");
			GiveNoCampfireHealth.ability = CreateSigilInfo("Pyrophobia (Health)", "[creature] may not recieve health buffs from campsites.", typeof(GiveNoCampfireHealth), -1, "ability_noCampfireHealth", "ability_noCampfireHealth_a2");
			GiveCantAttack.ability = CreateSigilInfo("Repulsion", "[creature] may not attack.", typeof(GiveCantAttack), -5, "ability_repulsion", "ability_repulsion_a2");
			GiveMushrooms.ability = CreateSigilInfo("Mysterious Mushrooms", "At the end of the turn, if there is a card on either side of [creature], they are fused together.", typeof(GiveMushrooms), 5, "ability_mushrooms", "ability_mushrooms_a2");
			GiveStrafeSticky.ability = CreateSigilInfo("Sticky", "At the end of the owner's turn, [creature] will move the opposing card and itself in the direction inscribed in the sigil.", typeof(GiveStrafeSticky), 0, "ability_sticky", "ability_sticky_a2");
			GiveStrafePull.ability = CreateSigilInfo("Hauler", "At the end of the owner's turn, [creature] will move in the direction inscribed in the sigil. Adjacent friendly creatures will be pulled in the same direction.", typeof(GiveStrafePull), 0, "ability_pull", "ability_pull_a2");
			GiveCounterAttack.ability = CreateSigilInfo("Counter Attack", "Once [creature] is struck, the striker is then dealt damage equal to this card's attack.", typeof(GiveCounterAttack), 4, "ability_counterAttack", "ability_counterAttack_a2");
			GiveMirrorCounter.ability = CreateSigilInfo("Mirror Counter", "Once [creature] is struck, the striker is then dealt damage equal to the striker's attack.", typeof(GiveMirrorCounter), 5, "ability_mirrorCounter", "ability_mirrorCounter_a2");
			GiveStrafeAllBoard.ability = CreateSigilInfo("Board Shifter", "At the end of the owner's turn, [creature] will move in the direction inscribed in the sigil. All cards will shift in the same direction, looping to the other edge of the board.", typeof(GiveStrafeAllBoard), 0, "ability_boardShifter", "ability_boardShifter_a2");
			GiveStrafeCardBoard.ability = CreateSigilInfo("Board Shifter (Owner)", "At the end of the owner's turn, [creature] will move in the direction inscribed in the sigil. Friendly cards will shift in the same direction, looping to the other edge of the board.", typeof(GiveStrafeCardBoard), 0, "ability_boardShifter(Player)", "ability_boardShifter(Player)_a2", activated: false, stackable: false, flipYIfEnemy: true, customFlippedIcon: true, "ability_boardShifter(Opponent)", "ability_boardShifter(Opponent)_a2");
			GiveStrafeCardOppBoard.ability = CreateSigilInfo("Board Shifter (Opposing)", "At the end of the owner's turn, [creature] will move in the direction inscribed in the sigil. The opposing cards will shift in the same direction, looping to the other edge of the board.", typeof(GiveStrafeCardOppBoard), 0, "ability_boardShifter(Opponent)", "ability_boardShifter(Opponent)_a2", activated: false, stackable: false, flipYIfEnemy: true, customFlippedIcon: true, "ability_boardShifter(Player)", "ability_boardShifter(Player)_a2");
			GiveDeathBell.ability = CreateSigilInfo("Deathbell", "At the start of the battle phase, [creature] perishes.", typeof(GiveDeathBell), -5, "ability_deathbell", "ability_deathbell_a2");
			GiveClockwise.ability = CreateSigilInfo("Clockwise", "When [creature] is played, move all cards on the board clockwise.", typeof(GiveClockwise), 5, "ability_clockwise", "ability_clockwise_a2");
			GiveStatsSwapImmune.ability = CreateSigilInfo("Stubborn", "[creature] may not have its stats swapped.", typeof(GiveStatsSwapImmune), 1, "ability_stubborn", "ability_stubborn_a2");
			GiveTornado.ability = CreateSig

plugins/creator-Inscryption_Gramophone_Expansion/plugins/ExpandedGramaphoneMod.dll

Decompiled 5 months ago
using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using BepInEx;
using BepInEx.Configuration;
using DiskCardGame;
using HarmonyLib;
using InscryptionAPI.Helpers;
using InscryptionAPI.Nodes;
using InscryptionAPI.Sound;
using UnityEngine;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: TargetFramework(".NETStandard,Version=v2.0", FrameworkDisplayName = "")]
[assembly: AssemblyCompany("ExpandedGramaphoneMod")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyDescription("Adds All inscryption Tracks to the Gramaphone")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("ExpandedGramaphoneMod")]
[assembly: AssemblyTitle("ExpandedGramaphoneMod")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.0.0")]
[module: UnverifiableCode]
namespace ExampleMod;

[BepInPlugin("creator.inscryption.gramophone.add.tracks", "InscryptionGramaphoneMod", "1.0.0")]
[BepInDependency(/*Could not decode attribute arguments.*/)]
[BepInDependency(/*Could not decode attribute arguments.*/)]
public class Plugin : BaseUnityPlugin
{
	private Harmony harmony = new Harmony("creator.inscryption.gramophone.add.tracks");

	private const string PluginGuid = "creator.inscryption.gramophone.add.tracks";

	private const string PluginName = "InscryptionGramaphoneMod";

	private const string PluginVersion = "1.0.0";

	public ConfigEntry<bool> configEnableTitleTheme;

	public ConfigEntry<bool> configEnableSFXTheAngler;

	public ConfigEntry<bool> configEnableTheAngler;

	public ConfigEntry<bool> configEnableSFXTheProspector;

	public ConfigEntry<bool> configEnableTheProspector;

	public ConfigEntry<bool> configEnableSFXTheTrapper;

	public ConfigEntry<bool> configEnableTheTrapper;

	public ConfigEntry<bool> configEnableAWalkInTheWoods;

	public ConfigEntry<bool> configEnableLeshysTheme;

	public ConfigEntry<bool> configEnableLeshysThemeAngler;

	public ConfigEntry<bool> configEnableLeshysThemeAnglerSFX;

	public ConfigEntry<bool> configEnableLeshysThemeProspector;

	public ConfigEntry<bool> configEnableLeshysThemeProspectorSFX;

	public ConfigEntry<bool> configEnableLeshysThemeTrapper;

	public ConfigEntry<bool> configEnableLeshysThemeTrapperSFX;

	public ConfigEntry<bool> configEnableTheMoon;

	public ConfigEntry<bool> configEnableLongForgottenMonuments;

	public ConfigEntry<bool> configEnableTheFourScrybes;

	public ConfigEntry<bool> configEnableTempleOfTheDead;

	public ConfigEntry<bool> configEnableTempleOfTechnology;

	public ConfigEntry<bool> configEnableCardplay;

	public ConfigEntry<bool> configEnableCardplayUndead;

	public ConfigEntry<bool> configEnableCardPlayBeast;

	public ConfigEntry<bool> configEnableCardPlayMagiks;

	public ConfigEntry<bool> configEnableCardplayTechnology;

	public ConfigEntry<bool> configEnableScrybeofTheUndead;

	public ConfigEntry<bool> configEnableScrybeofTheBeasts;

	public ConfigEntry<bool> configEnableScrybeofTheMagiks;

	public ConfigEntry<bool> configEnableScrybeofTheTechnology;

	public ConfigEntry<bool> configEnableDamageRace;

	public ConfigEntry<bool> configEnableBountyHunters;

	public ConfigEntry<bool> configEnableUberBotActivated;

	public ConfigEntry<bool> configEnableUberBotActivatedBlankCanvas;

	public ConfigEntry<bool> configEnableUberBotActivatedGollysTheme;

	public ConfigEntry<bool> configEnableUberBotActivatedGollysThemeUploading;

	public ConfigEntry<bool> configEnableFinalDuel;

	public ConfigEntry<bool> configEnableDeathcardCabinReprise;

	public ConfigEntry<bool> configEnableAnglerMashup;

	public ConfigEntry<bool> configEnableProspectorMashup;

	public ConfigEntry<bool> configEnableTrapperMashup;

	public ConfigEntry<bool> configEnableUberBotActivatedArchivest;

	public ConfigEntry<bool> configEnableRoyalsTheme;

	public void Awake()
	{
		configEnableTitleTheme = ((BaseUnityPlugin)this).Config.Bind<bool>("Gramopone.Enable.Songs", "Title Theme?", true, "Should the 'Title Theme' Show up on the Gramophone?");
		configEnableSFXTheAngler = ((BaseUnityPlugin)this).Config.Bind<bool>("Gramopone.Enable.Songs", "The Angler + SFX", false, "Should the 'The Angler + SFX' Show up on the Gramophone?");
		configEnableTheAngler = ((BaseUnityPlugin)this).Config.Bind<bool>("Gramopone.Enable.Songs", "The Angler?", true, "Should the 'The Angler' Show up on the Gramophone?");
		configEnableSFXTheProspector = ((BaseUnityPlugin)this).Config.Bind<bool>("Gramopone.Enable.Songs", "The Prospector + SFX?", false, "Should the 'The Prospector + SFX' Show up on the Gramophone?");
		configEnableTheProspector = ((BaseUnityPlugin)this).Config.Bind<bool>("Gramopone.Enable.Songs", "The Prospector?", true, "Should the 'The Prospector' Show up on the Gramophone?");
		configEnableSFXTheTrapper = ((BaseUnityPlugin)this).Config.Bind<bool>("Gramopone.Enable.Songs", "The Trapper + SFX?", false, "Should the 'The Trapper + SFX' Show up on the Gramophone?");
		configEnableTheTrapper = ((BaseUnityPlugin)this).Config.Bind<bool>("Gramopone.Enable.Songs", "The Trapper?", true, "Should the 'The Trapper' Show up on the Gramophone?");
		configEnableAWalkInTheWoods = ((BaseUnityPlugin)this).Config.Bind<bool>("Gramopone.Enable.Songs", "A Walk In The Woods?", true, "Should the 'A Walk In The Woods' Show up on the Gramophone?");
		configEnableLeshysTheme = ((BaseUnityPlugin)this).Config.Bind<bool>("Gramopone.Enable.Songs", "Leshys Theme?", true, "Should the 'Leshys Theme' Show up on the Gramophone?");
		configEnableLeshysThemeAngler = ((BaseUnityPlugin)this).Config.Bind<bool>("Gramopone.Enable.Songs", "Leshys Theme + Angler?", true, "Should the 'Leshys Theme + Angler' Show up on the Gramophone?");
		configEnableLeshysThemeAnglerSFX = ((BaseUnityPlugin)this).Config.Bind<bool>("Gramopone.Enable.Songs", "Leshys Theme + Angler + SFX?", false, "Should the 'Leshys Theme + Angler + SFX' Show up on the Gramophone?");
		configEnableLeshysThemeProspector = ((BaseUnityPlugin)this).Config.Bind<bool>("Gramopone.Enable.Songs", "Leshys Theme + Prospector?", true, "Should the 'Leshys Theme + Prospector' Show up on the Gramophone?");
		configEnableLeshysThemeProspectorSFX = ((BaseUnityPlugin)this).Config.Bind<bool>("Gramopone.Enable.Songs", "Leshys Theme + Prospector + SFX?", false, "Should the 'Leshys Theme + Prospector + SFX' Show up on the Gramophone?");
		configEnableLeshysThemeTrapper = ((BaseUnityPlugin)this).Config.Bind<bool>("Gramopone.Enable.Songs", "Leshys Theme + Trapper?", true, "Should the 'Leshys Theme + Trapper' Show up on the Gramophone?");
		configEnableLeshysThemeTrapperSFX = ((BaseUnityPlugin)this).Config.Bind<bool>("Gramopone.Enable.Songs", "Leshys Theme + Trapper + SFX?", false, "Should the 'Leshys Theme + Trapper + SFX' Show up on the Gramophone?");
		configEnableTheMoon = ((BaseUnityPlugin)this).Config.Bind<bool>("Gramopone.Enable.Songs", "The Moon?", true, "Should the 'The Moon' Show up on the Gramophone?");
		configEnableLongForgottenMonuments = ((BaseUnityPlugin)this).Config.Bind<bool>("Gramopone.Enable.Songs", "Long Forgotten Monuments?", true, "Should the 'Long Forgotten Monuments' Show up on the Gramophone?");
		configEnableTheFourScrybes = ((BaseUnityPlugin)this).Config.Bind<bool>("Gramopone.Enable.Songs", "The Four Scrybes?", true, "Should the 'The Four Scrybes' Show up on the Gramophone?");
		configEnableTempleOfTheDead = ((BaseUnityPlugin)this).Config.Bind<bool>("Gramopone.Enable.Songs", "The Temple of the Dead?", true, "Should the 'The Temple of The dead' Show up on the Gramophone?");
		configEnableTempleOfTechnology = ((BaseUnityPlugin)this).Config.Bind<bool>("Gramopone.Enable.Songs", "The Temple of Technology?", true, "Should the 'The Temple of Technology' Show up on the Gramophone?");
		configEnableCardplay = ((BaseUnityPlugin)this).Config.Bind<bool>("Gramopone.Enable.Songs", "Cardplay?", true, "Should 'Cardplay' show up on the Gramophone");
		configEnableCardplayUndead = ((BaseUnityPlugin)this).Config.Bind<bool>("Gramopone.Enable.Songs", "Cardplay + Undead?", true, "Should 'Card Play + Undead' show up on the gramophone");
		configEnableCardPlayBeast = ((BaseUnityPlugin)this).Config.Bind<bool>("Gramopone.Enable.Songs", "Cardplay + Beast?", true, "Should 'Cardplay + Beast' show up on the gramophone?");
		configEnableCardPlayMagiks = ((BaseUnityPlugin)this).Config.Bind<bool>("Gramopone.Enable.Songs", "Cardplay + Magiks?", true, "Should 'Cardplay + Magiks' show up on the gramophone?");
		configEnableCardplayTechnology = ((BaseUnityPlugin)this).Config.Bind<bool>("Gramopone.Enable.Songs", "Cardplay + Technology?", true, "Should 'Cardplay + Technology' show up on the gramophone?");
		configEnableScrybeofTheUndead = ((BaseUnityPlugin)this).Config.Bind<bool>("Gramopone.Enable.Songs", "Scrybe of the Undead?", true, "Should 'Scrybe of the Undead' show up on the gramophone?");
		configEnableScrybeofTheBeasts = ((BaseUnityPlugin)this).Config.Bind<bool>("Gramopone.Enable.Songs", "Scrybe of the Beasts?", true, "Should 'Scrybe of the Beasts' show up on the gramophone?");
		configEnableScrybeofTheMagiks = ((BaseUnityPlugin)this).Config.Bind<bool>("Gramopone.Enable.Songs", "Scrybe of the Magiks?", true, "Should 'Scrybe of the Magiks' show up on the gramophone?");
		configEnableScrybeofTheTechnology = ((BaseUnityPlugin)this).Config.Bind<bool>("Gramopone.Enable.Songs", "Scrybe of the Technology?", true, "Should 'Scrybe of the Technology' show up on the gramophone?");
		configEnableDamageRace = ((BaseUnityPlugin)this).Config.Bind<bool>("Gramopone.Enable.Songs", "Damage Race?", true, "Should 'Damage Race' show up on the gramophone?");
		configEnableBountyHunters = ((BaseUnityPlugin)this).Config.Bind<bool>("Gramopone.Enable.Songs", "Bounty Hunters?", true, "Should 'Bounty Hunters' show up on the gramophone?");
		configEnableUberBotActivated = ((BaseUnityPlugin)this).Config.Bind<bool>("Gramopone.Enable.Songs", "Uber Bot Activated?", true, "Should 'Uber Bot Activated' show up on the gramophone?");
		configEnableUberBotActivatedBlankCanvas = ((BaseUnityPlugin)this).Config.Bind<bool>("Gramopone.Enable.Songs", "Uber Bot Activated + Blank Canvas?", true, "Should 'Uber Bot Activated + Blank Canvas' show up on the gramophone?");
		configEnableUberBotActivatedGollysTheme = ((BaseUnityPlugin)this).Config.Bind<bool>("Gramopone.Enable.Songs", "Uber Bot Activated + Gollys Theme?", true, "Should 'Uber Bot Activated + Gollys Theme' show up on the gramophone?");
		configEnableUberBotActivatedGollysThemeUploading = ((BaseUnityPlugin)this).Config.Bind<bool>("Gramopone.Enable.Songs", "Uber Bot Activated + Gollys Theme + Uploading?", true, "Should 'Uber Bot Activated + Gollys Theme + Uploading' show up on the gramophone?");
		configEnableFinalDuel = ((BaseUnityPlugin)this).Config.Bind<bool>("Gramopone.Enable.Songs", "Final Duel?", true, "Should 'Final Duel' show up on the gramophone?");
		configEnableDeathcardCabinReprise = ((BaseUnityPlugin)this).Config.Bind<bool>("Gramopone.Enable.Songs", "Deathcard Cabin + Reprise?", true, "Should 'Deathcard Cabin + Reprise' show up on the gramophone?");
		configEnableAnglerMashup = ((BaseUnityPlugin)this).Config.Bind<bool>("Gramopone.Enable.Songs", "Angler Mashup?", true, "Should 'Angler Mashup' show up on the gramophone?");
		configEnableProspectorMashup = ((BaseUnityPlugin)this).Config.Bind<bool>("Gramopone.Enable.Songs", "Prospector Mashup?", true, "Should 'Prospector Mashup' show up on the gramophone?");
		configEnableTrapperMashup = ((BaseUnityPlugin)this).Config.Bind<bool>("Gramopone.Enable.Songs", "Trapper Mashup?", true, "Should 'Trapper Mashup' show up on the gramophone?");
		configEnableUberBotActivatedArchivest = ((BaseUnityPlugin)this).Config.Bind<bool>("Gramopone.Enable.Songs", "Uber Bot Activated + Archivest?", true, "Should 'Uber Bot Activated + Archivest' show up on the gramophone?");
		configEnableRoyalsTheme = ((BaseUnityPlugin)this).Config.Bind<bool>("Gramopone.Enable.Songs", "Royals Theme?", true, "Should 'Royals Theme' show up on the gramophone?");
		int num = 0;
		harmony.PatchAll(typeof(Plugin));
		if (configEnableTitleTheme.Value)
		{
			GramophoneManager.AddTrack("creator.inscryption.gramophone.add.tracks", "01.mp3", 0.5f);
			num++;
		}
		if (configEnableSFXTheAngler.Value)
		{
			GramophoneManager.AddTrack("creator.inscryption.gramophone.add.tracks", "03.mp3", 0.5f);
			num++;
		}
		if (configEnableTheAngler.Value)
		{
			GramophoneManager.AddTrack("creator.inscryption.gramophone.add.tracks", "04.mp3", 0.5f);
			num++;
		}
		if (configEnableSFXTheProspector.Value)
		{
			GramophoneManager.AddTrack("creator.inscryption.gramophone.add.tracks", "05.mp3", 0.5f);
			num++;
		}
		if (configEnableTheProspector.Value)
		{
			GramophoneManager.AddTrack("creator.inscryption.gramophone.add.tracks", "06.mp3", 0.5f);
			num++;
		}
		if (configEnableSFXTheTrapper.Value)
		{
			GramophoneManager.AddTrack("creator.inscryption.gramophone.add.tracks", "07.mp3", 0.5f);
			num++;
		}
		if (configEnableTheTrapper.Value)
		{
			GramophoneManager.AddTrack("creator.inscryption.gramophone.add.tracks", "08.mp3", 0.5f);
			num++;
		}
		if (configEnableAWalkInTheWoods.Value)
		{
			GramophoneManager.AddTrack("creator.inscryption.gramophone.add.tracks", "09.mp3", 0.5f);
			num++;
		}
		if (configEnableLeshysTheme.Value)
		{
			GramophoneManager.AddTrack("creator.inscryption.gramophone.add.tracks", "10.mp3", 0.5f);
			num++;
		}
		if (configEnableLeshysThemeAngler.Value)
		{
			GramophoneManager.AddTrack("creator.inscryption.gramophone.add.tracks", "11.mp3", 0.5f);
			num++;
		}
		if (configEnableLeshysThemeAnglerSFX.Value)
		{
			GramophoneManager.AddTrack("creator.inscryption.gramophone.add.tracks", "03.mp3", 0.5f);
			num++;
		}
		if (configEnableLeshysThemeProspector.Value)
		{
			GramophoneManager.AddTrack("creator.inscryption.gramophone.add.tracks", "13.mp3", 0.5f);
			num++;
		}
		if (configEnableLeshysThemeProspectorSFX.Value)
		{
			GramophoneManager.AddTrack("creator.inscryption.gramophone.add.tracks", "03.mp3", 0.5f);
			num++;
		}
		if (configEnableLeshysThemeTrapper.Value)
		{
			GramophoneManager.AddTrack("creator.inscryption.gramophone.add.tracks", "15.mp3", 0.5f);
			num++;
		}
		if (configEnableLeshysThemeTrapperSFX.Value)
		{
			GramophoneManager.AddTrack("creator.inscryption.gramophone.add.tracks", "03.mp3", 0.5f);
			num++;
		}
		if (configEnableTheMoon.Value)
		{
			GramophoneManager.AddTrack("creator.inscryption.gramophone.add.tracks", "17.mp3", 0.5f);
			num++;
		}
		if (configEnableLongForgottenMonuments.Value)
		{
			GramophoneManager.AddTrack("creator.inscryption.gramophone.add.tracks", "18.mp3", 0.5f);
			num++;
		}
		if (configEnableTheFourScrybes.Value)
		{
			GramophoneManager.AddTrack("creator.inscryption.gramophone.add.tracks", "19.mp3", 0.5f);
			num++;
		}
		if (configEnableTempleOfTheDead.Value)
		{
			GramophoneManager.AddTrack("creator.inscryption.gramophone.add.tracks", "20.mp3", 0.5f);
			num++;
		}
		if (configEnableTempleOfTechnology.Value)
		{
			GramophoneManager.AddTrack("creator.inscryption.gramophone.add.tracks", "23.mp3", 0.5f);
			num++;
		}
		if (configEnableCardplay.Value)
		{
			GramophoneManager.AddTrack("creator.inscryption.gramophone.add.tracks", "24.mp3", 0.5f);
			num++;
		}
		if (configEnableCardplayUndead.Value)
		{
			GramophoneManager.AddTrack("creator.inscryption.gramophone.add.tracks", "25.mp3", 0.5f);
			num++;
		}
		if (configEnableCardPlayBeast.Value)
		{
			GramophoneManager.AddTrack("creator.inscryption.gramophone.add.tracks", "26.mp3", 0.5f);
			num++;
		}
		if (configEnableCardPlayMagiks.Value)
		{
			GramophoneManager.AddTrack("creator.inscryption.gramophone.add.tracks", "27.mp3", 0.5f);
			num++;
		}
		if (configEnableCardplayTechnology.Value)
		{
			GramophoneManager.AddTrack("creator.inscryption.gramophone.add.tracks", "28.mp3", 0.5f);
			num++;
		}
		if (configEnableScrybeofTheUndead.Value)
		{
			GramophoneManager.AddTrack("creator.inscryption.gramophone.add.tracks", "29.mp3", 0.5f);
			num++;
		}
		if (configEnableScrybeofTheBeasts.Value)
		{
			GramophoneManager.AddTrack("creator.inscryption.gramophone.add.tracks", "30.mp3", 0.5f);
			num++;
		}
		if (configEnableScrybeofTheMagiks.Value)
		{
			GramophoneManager.AddTrack("creator.inscryption.gramophone.add.tracks", "31.mp3", 0.5f);
			num++;
		}
		if (configEnableScrybeofTheTechnology.Value)
		{
			GramophoneManager.AddTrack("creator.inscryption.gramophone.add.tracks", "32.mp3", 0.5f);
			num++;
		}
		if (configEnableDamageRace.Value)
		{
			GramophoneManager.AddTrack("creator.inscryption.gramophone.add.tracks", "34.mp3", 0.5f);
			num++;
		}
		if (configEnableBountyHunters.Value)
		{
			GramophoneManager.AddTrack("creator.inscryption.gramophone.add.tracks", "35.mp3", 0.5f);
			num++;
		}
		if (configEnableUberBotActivated.Value)
		{
			GramophoneManager.AddTrack("creator.inscryption.gramophone.add.tracks", "36.mp3", 0.5f);
			num++;
		}
		if (configEnableUberBotActivatedBlankCanvas.Value)
		{
			GramophoneManager.AddTrack("creator.inscryption.gramophone.add.tracks", "37.mp3", 0.5f);
			num++;
		}
		if (configEnableUberBotActivatedGollysTheme.Value)
		{
			GramophoneManager.AddTrack("creator.inscryption.gramophone.add.tracks", "38.mp3", 0.5f);
			num++;
		}
		if (configEnableUberBotActivatedGollysThemeUploading.Value)
		{
			GramophoneManager.AddTrack("creator.inscryption.gramophone.add.tracks", "39.mp3", 0.5f);
			num++;
		}
		if (configEnableFinalDuel.Value)
		{
			GramophoneManager.AddTrack("creator.inscryption.gramophone.add.tracks", "41.mp3", 0.5f);
			num++;
		}
		if (configEnableDeathcardCabinReprise.Value)
		{
			GramophoneManager.AddTrack("creator.inscryption.gramophone.add.tracks", "42.mp3", 0.5f);
			num++;
		}
		if (configEnableAnglerMashup.Value)
		{
			GramophoneManager.AddTrack("creator.inscryption.gramophone.add.tracks", "43.mp3", 0.5f);
			num++;
		}
		if (configEnableProspectorMashup.Value)
		{
			GramophoneManager.AddTrack("creator.inscryption.gramophone.add.tracks", "44.mp3", 0.5f);
			num++;
		}
		if (configEnableTrapperMashup.Value)
		{
			GramophoneManager.AddTrack("creator.inscryption.gramophone.add.tracks", "45.mp3", 0.5f);
			num++;
		}
		if (configEnableUberBotActivatedArchivest.Value)
		{
			GramophoneManager.AddTrack("creator.inscryption.gramophone.add.tracks", "46.mp3", 0.5f);
			num++;
		}
		if (configEnableRoyalsTheme.Value)
		{
			GramophoneManager.AddTrack("creator.inscryption.gramophone.add.tracks", "47.mp3", 0.5f);
			num++;
		}
		((BaseUnityPlugin)this).Logger.LogInfo((object)$"Sucsessfully Loaded {num} Song(s)");
	}
}
public class ExampleSequencer : CustomNodeSequencer, ICustomNodeSequencer
{
	public SelectCardFromDeckSlot selectionSlot = Singleton<SpecialNodeHandler>.Instance.cardStatBoostSequencer.selectionSlot;

	public override bool ShouldNotReturnToMapOnEnd(CustomSpecialNodeData exampleNode)
	{
		return true;
	}

	public override IEnumerator DoCustomSequence(CustomSpecialNodeData exampleNode)
	{
		Singleton<ViewManager>.Instance.SwitchToView((View)1, false, true);
		yield return (object)new WaitForSeconds(0.5f);
		Singleton<ViewManager>.Instance.SwitchToView((View)38, false, true);
		Singleton<TableRuleBook>.Instance.SetOnBoard(true);
		Singleton<InteractionCursor>.Instance.SetEnabled(true);
		((InteractableBase)selectionSlot).ClearDelegates();
		Component[] componentsInChildren = ((Component)selectionSlot).GetComponentsInChildren<Component>();
		foreach (Component val in componentsInChildren)
		{
			if (Object.op_Implicit((Object)(object)val) && ((object)val).ToString().Contains("FireAnim"))
			{
				Object.Destroy((Object)(object)val.gameObject);
			}
		}
		if (((HighlightedInteractable)selectionSlot).specificRenderers.Count > 1)
		{
			((HighlightedInteractable)selectionSlot).specificRenderers.RemoveAt(1);
		}
		((HighlightedInteractable)selectionSlot).specificRenderers[0].material.mainTexture = (Texture)(object)TextureHelper.GetImageAsTexture("slot_example_sequence.png", (FilterMode)0);
		SelectCardFromDeckSlot obj = selectionSlot;
		((MainInputInteractable)obj).CursorSelectStarted = (Action<MainInputInteractable>)Delegate.Combine(((MainInputInteractable)obj).CursorSelectStarted, (Action<MainInputInteractable>)delegate(MainInputInteractable i)
		{
			OnSlotSelected(i);
		});
		yield return (object)new WaitForSeconds(0.3f);
		((Component)Singleton<ExplorableAreaManager>.Instance.HangingLight).gameObject.SetActive(false);
		((Component)Singleton<ExplorableAreaManager>.Instance.HandLight).gameObject.SetActive(false);
		yield return Singleton<TextDisplayer>.Instance.ShowUntilInput("There is nothing here yet...", -0.65f, 0.5f, (Emotion)1, (LetterAnimation)0, (Speaker)0, (string[])null, true);
		yield return Singleton<TextDisplayer>.Instance.ShowUntilInput("Pity.", -0.45f, 0.5f, (Emotion)2, (LetterAnimation)0, (Speaker)1, (string[])null, true);
		((Component)selectionSlot).gameObject.SetActive(true);
		selectionSlot.RevealAndEnable();
		yield return (object)new WaitForSeconds(0.3f);
		((Component)Singleton<ExplorableAreaManager>.Instance.HangingLight).gameObject.SetActive(true);
		((Component)Singleton<ExplorableAreaManager>.Instance.HandLight).gameObject.SetActive(true);
		yield return (object)new WaitForSeconds(0.5f);
		yield return Singleton<TextDisplayer>.Instance.ShowUntilInput("Oh..?", -0.45f, 0.5f, (Emotion)5, (LetterAnimation)0, (Speaker)1, (string[])null, true);
	}

	private void OnSlotSelected(MainInputInteractable slot)
	{
		List<CardInfo> validCards = GetValidCards();
		((InteractableBase)selectionSlot).SetEnabled(false);
		((HighlightedInteractable)selectionSlot).ShowState((State)1, false, 0.15f);
		if (validCards == null)
		{
			((MonoBehaviour)this).StartCoroutine(ApplyCardCostSequence(validCards: false));
		}
		else if (validCards != null)
		{
			((SelectCardFromDeckSlot)((slot is SelectCardFromDeckSlot) ? slot : null)).SelectFromCards(validCards, (Action)OnSlotSelectionEnded, false);
		}
	}

	private IEnumerator ApplyCardCostSequence(bool validCards)
	{
		if (!validCards)
		{
			((InteractableBase)selectionSlot).SetEnabled(false);
			selectionSlot.FlyOffCard();
			selectionSlot.Disable();
			((HighlightedInteractable)selectionSlot).SetShown(false, false);
			Singleton<SpecialNodeHandler>.Instance.cardStatBoostSequencer.selectionSlot.pile.Draw();
			Singleton<SpecialNodeHandler>.Instance.cardStatBoostSequencer.selectionSlot.pile.DestroyCardsImmediate();
			yield return (object)new WaitForSeconds(0.5f);
			if ((Object)(object)Singleton<GameFlowManager>.Instance != (Object)null)
			{
				Singleton<GameFlowManager>.Instance.TransitionToGameState((GameState)1, (NodeData)null);
			}
			yield break;
		}
		((InteractableBase)selectionSlot).SetEnabled(false);
		yield return Singleton<TextDisplayer>.Instance.ShowUntilInput("That's a fine " + ((Card)selectionSlot.Card).Info.displayedName + "...", -2.5f, 0.5f, (Emotion)0, (LetterAnimation)0, (Speaker)0, (string[])null, true);
		ScriptableObject.CreateInstance<CardInfo>();
		CardInfo modifiedCard = ((Card)selectionSlot.Card).Info;
		modifiedCard.cost = ((Card)selectionSlot.Card).Info.cost - 1;
		((Card)selectionSlot.Card).SetFaceDown(true, false);
		((Card)selectionSlot.Card).Info.cost = modifiedCard.cost;
		((Card)selectionSlot.Card).SetInfo(modifiedCard);
		((Card)selectionSlot.Card).RenderCard();
		yield return (object)new WaitForSeconds(0.6f);
		((Card)selectionSlot.Card).SetFaceDown(false, false);
		((CardCollectionInfo)RunState.Run.playerDeck).RemoveCard(((Card)selectionSlot.Card).Info);
		((CardCollectionInfo)RunState.Run.playerDeck).AddCard(modifiedCard);
		SaveManager.SaveToFile(false);
		Singleton<ViewManager>.Instance.SwitchToView((View)38, false, true);
		yield return (object)new WaitForSeconds(1.2f);
		selectionSlot.FlyOffCard();
		selectionSlot.Disable();
		((HighlightedInteractable)selectionSlot).SetShown(false, false);
		Singleton<SpecialNodeHandler>.Instance.cardStatBoostSequencer.selectionSlot.pile.Draw();
		Singleton<SpecialNodeHandler>.Instance.cardStatBoostSequencer.selectionSlot.pile.DestroyCardsImmediate();
		yield return (object)new WaitForSeconds(0.5f);
		if ((Object)(object)Singleton<GameFlowManager>.Instance != (Object)null)
		{
			Singleton<GameFlowManager>.Instance.TransitionToGameState((GameState)1, (NodeData)null);
		}
	}

	private void OnSlotSelectionEnded()
	{
		if ((Object)(object)selectionSlot.Card != (Object)null)
		{
			Debug.Log((object)"SlotSelectionEnded");
			((HighlightedInteractable)selectionSlot).SetShown(true, false);
			((HighlightedInteractable)selectionSlot).ShowState((State)2, false, 0.15f);
			Singleton<ViewManager>.Instance.SwitchToView((View)38, false, true);
			((MonoBehaviour)this).StartCoroutine(ApplyCardCostSequence(validCards: true));
		}
	}

	private List<CardInfo> GetValidCards()
	{
		List<CardInfo> list = new List<CardInfo>();
		list.Clear();
		list.AddRange(RunState.DeckList);
		list.RemoveAll((CardInfo x) => x.cost == 0);
		return list;
	}
}
public static class PluginInfo
{
	public const string PLUGIN_GUID = "ExpandedGramaphoneMod";

	public const string PLUGIN_NAME = "ExpandedGramaphoneMod";

	public const string PLUGIN_VERSION = "1.0.0";
}

plugins/creator-Tribal_Pelts/plugins/TribalPelts.dll

Decompiled 5 months ago
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using BepInEx;
using BepInEx.Bootstrap;
using DiskCardGame;
using HarmonyLib;
using InscryptionAPI.Card;
using InscryptionAPI.Guid;
using InscryptionAPI.Helpers;
using InscryptionAPI.Pelts;
using Microsoft.CodeAnalysis;
using MushroomTribes;
using UnityEngine;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: TargetFramework(".NETStandard,Version=v2.0", FrameworkDisplayName = ".NET Standard 2.0")]
[assembly: AssemblyCompany("TribalPelts")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyDescription("A Libary of TribalPelts")]
[assembly: AssemblyFileVersion("2.1.0.0")]
[assembly: AssemblyInformationalVersion("2.1.0+cef1b633b007986625abddde0195509406521946")]
[assembly: AssemblyProduct("TribalPelts")]
[assembly: AssemblyTitle("TribalPelts")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("2.1.0.0")]
[module: UnverifiableCode]
[module: RefSafetyRules(11)]
namespace Microsoft.CodeAnalysis
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	internal sealed class EmbeddedAttribute : Attribute
	{
	}
}
namespace System.Runtime.CompilerServices
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	[AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)]
	internal sealed class RefSafetyRulesAttribute : Attribute
	{
		public readonly int Version;

		public RefSafetyRulesAttribute(int P_0)
		{
			Version = P_0;
		}
	}
}
namespace Tribal_Pelts
{
	[BepInPlugin("creator.TribalPelts", "TribalPelts", "2.0.0")]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	public class PeltLoader : BaseUnityPlugin
	{
		private readonly Harmony harmony = new Harmony("creator.TribalPelts");

		private const string PluginGuid = "creator.TribalPelts";

		private const string PluginName = "TribalPelts";

		private const string PluginVersion = "2.0.0";

		private const string PluginPrefix = "TribalPelts";

		public const string TGUID = "tribes.libary";

		public const string NGUID = "nevernamed.inscryption.sigils";

		public const string ZGUID = "zepht.inscryption.ZephtPvZ";

		public const string VGUID = "extraVoid.inscryption.VerminTribe";

		public const string JGUID = "MADH.inscryption.JSONLoader";

		public const string WGUID = "whistlewind.inscryption.abnormalsigils";

		public const string LGUID = "Lily.BOT";

		public const string MGUID = "mushroom.pelts";

		public int Count;

		public static CardInfo CreateCard(string name, string displayName, string imagePath, string imagePathEmisive, int attack, int health, Tribe tribe)
		{
			//IL_005e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0075: Unknown result type (might be due to invalid IL or missing references)
			//IL_008d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0082: Unknown result type (might be due to invalid IL or missing references)
			//IL_0085: Expected I4, but got Unknown
			CardInfo val = CardManager.New("creator.TribalPelts", name, displayName, attack, health, (string)null);
			CardExtensions.SetPortrait(val, TextureHelper.GetImageAsTexture(Path.Combine(imagePath), (FilterMode)0), (FilterMode?)null);
			CardExtensions.SetEmissivePortrait(val, TextureHelper.GetImageAsTexture(Path.Combine(imagePathEmisive), (FilterMode)0), (FilterMode?)null);
			val.cardComplexity = (CardComplexity)1;
			CardExtensions.AddTraits(val, (Trait[])(object)new Trait[1] { (Trait)13 });
			if ((int)tribe != 0)
			{
				CardExtensions.AddTribes(val, (Tribe[])(object)new Tribe[1] { (Tribe)(int)tribe });
			}
			val.temple = (CardTemple)0;
			CardExtensions.AddSpecialAbilities(val, (SpecialTriggeredAbility[])(object)new SpecialTriggeredAbility[1] { (SpecialTriggeredAbility)27 });
			CardExtensions.AddAppearances(val, (Appearance[])(object)new Appearance[2]
			{
				(Appearance)2,
				(Appearance)9
			});
			return val;
		}

		public static CardInfo CreateRareCard(string name, string displayName, string imagePath, string imagePathEmisive, int attack, int health, Tribe tribe)
		{
			CardInfo val = CreateCard(name, displayName, imagePath, imagePathEmisive, attack, health, (Tribe)0);
			CardExtensions.AddAppearances(val, (Appearance[])(object)new Appearance[1] { (Appearance)6 });
			return val;
		}

		public static Tribe GetCustomTribe(string GUID, string name)
		{
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			return GuidManager.GetEnumValue<Tribe>(GUID, name);
		}

		public void Awake()
		{
			AvianPelt();
			CaninePelt();
			HoovedPelt();
			TurtlePelt();
			InsectPelt();
			Count++;
			Count++;
			Count++;
			Count++;
			Count++;
			if (Chainloader.PluginInfos.ContainsKey("tribes.libary"))
			{
				((BaseUnityPlugin)this).Logger.LogMessage((object)"Do I see The other DLL? I do, I do see the other DLL! (Tribal Libary)");
			}
			if (Chainloader.PluginInfos.ContainsKey("nevernamed.inscryption.sigils"))
			{
				((BaseUnityPlugin)this).Logger.LogMessage((object)"Do I see The other DLL? I do, I do see the other DLL! (Nevernameds Sigilarium)");
				NeverNamedsSigilarium();
			}
			if (Chainloader.PluginInfos.ContainsKey("zepht.inscryption.ZephtPvZ"))
			{
				((BaseUnityPlugin)this).Logger.LogMessage((object)"Do I see The other DLL? I do, I do see the other DLL! (Plants Vs Zombies)");
			}
			if (Chainloader.PluginInfos.ContainsKey("extraVoid.inscryption.VerminTribe"))
			{
				((BaseUnityPlugin)this).Logger.LogMessage((object)"Do I see The other DLL? I do, I do see the other DLL! (Vermin Tribe)");
				VerminTribe();
			}
			if (Chainloader.PluginInfos.ContainsKey("whistlewind.inscryption.abnormalsigils"))
			{
				((BaseUnityPlugin)this).Logger.LogMessage((object)"Do I see The other DLL? I do, I do see the other DLL! (Abnormal Sigils)");
			}
			if (Chainloader.PluginInfos.ContainsKey("Lily.BOT"))
			{
				((BaseUnityPlugin)this).Logger.LogMessage((object)"Do I see The other DLL? I do, I do see the other DLL! (Bundle O' Totems)");
				BundleOTotems();
			}
			if (Chainloader.PluginInfos.ContainsKey("mushroom.pelts"))
			{
				((BaseUnityPlugin)this).Logger.LogMessage((object)"Do I see The other DLL? I do, I do see the other DLL! (Mushroom Tribes)");
				MushroomTribesPelts();
			}
			else
			{
				((BaseUnityPlugin)this).Logger.LogMessage((object)"Do I see the Other DLL? I dont, I dont see any other DLLs!");
			}
			((BaseUnityPlugin)this).Logger.LogMessage((object)$"Successfully Loaded {Count} Pelt(s)!");
			static void AvianPelt()
			{
				CardInfo val5 = CreateCard("Vanila_Bird_Pelt", "Raven Epidermis", "Avian_Pelt.png", "none.png", 0, 2, (Tribe)2);
				PeltManager.New("creator.TribalPelts", val5, 6, 0, 4, (Func<List<CardInfo>>)(() => CardManager.AllCardsCopy.FindAll((CardInfo a) => a.IsOfTribe((Tribe)2) && CardExtensions.HasAnyOfCardMetaCategories(a, (CardMetaCategory[])(object)new CardMetaCategory[2]
				{
					default(CardMetaCategory),
					(CardMetaCategory)1
				}))));
			}
			static void CaninePelt()
			{
				CardInfo val4 = CreateCard("Vanila_Canine_Pelt", "Coyote Pelt", "Canine_Pelt.png", "none.png", 0, 2, (Tribe)3);
				PeltManager.New("creator.TribalPelts", val4, 6, 0, 4, (Func<List<CardInfo>>)(() => CardManager.AllCardsCopy.FindAll((CardInfo a) => a.IsOfTribe((Tribe)3) && CardExtensions.HasAnyOfCardMetaCategories(a, (CardMetaCategory[])(object)new CardMetaCategory[2]
				{
					default(CardMetaCategory),
					(CardMetaCategory)1
				}))));
			}
			static void HoovedPelt()
			{
				CardInfo val3 = CreateCard("Vanila_Hooved_Pelt", "Deer Pelt", "Deer_Pelt.png", "none.png", 0, 2, (Tribe)4);
				PeltManager.New("creator.TribalPelts", val3, 6, 0, 4, (Func<List<CardInfo>>)(() => CardManager.AllCardsCopy.FindAll((CardInfo a) => a.IsOfTribe((Tribe)4) && CardExtensions.HasAnyOfCardMetaCategories(a, (CardMetaCategory[])(object)new CardMetaCategory[2]
				{
					default(CardMetaCategory),
					(CardMetaCategory)1
				}))));
			}
			static void InsectPelt()
			{
				CardInfo val = CreateCard("Vanila_Insect_Pelt", "Moth Molt", "Insect_Pelt.png", "none.png", 0, 2, (Tribe)6);
				PeltManager.New("creator.TribalPelts", val, 6, 0, 4, (Func<List<CardInfo>>)(() => CardManager.AllCardsCopy.FindAll((CardInfo a) => a.IsOfTribe((Tribe)6) && CardExtensions.HasAnyOfCardMetaCategories(a, (CardMetaCategory[])(object)new CardMetaCategory[2]
				{
					default(CardMetaCategory),
					(CardMetaCategory)1
				}))));
			}
			static void TurtlePelt()
			{
				CardInfo val2 = CreateCard("Vanila_Reptile_Pelt", "Crocodile Hide", "Reptile_Pelt.png", "none.png", 0, 2, (Tribe)5);
				PeltManager.New("creator.TribalPelts", val2, 6, 0, 4, (Func<List<CardInfo>>)(() => CardManager.AllCardsCopy.FindAll((CardInfo a) => a.IsOfTribe((Tribe)5) && CardExtensions.HasAnyOfCardMetaCategories(a, (CardMetaCategory[])(object)new CardMetaCategory[2]
				{
					default(CardMetaCategory),
					(CardMetaCategory)1
				}))));
			}
		}

		public void BundleOTotems()
		{
			HumanRemains();
			SharkLeather();
			TigerPelt();
			BeaverPelt();
			Count++;
			Count++;
			Count++;
			Count++;
			static void BeaverPelt()
			{
				//IL_0020: Unknown result type (might be due to invalid IL or missing references)
				CardInfo val = CreateCard("Bundle_Of_Totems_Rodent_Pelt", "Beaver Pelt", "Beaver Pelt.png", "None.png", 0, 2, GetCustomTribe("Lily.BOT", "rodent"));
				PeltManager.New("creator.TribalPelts", val, 6, 0, 4, (Func<List<CardInfo>>)(() => CardManager.AllCardsCopy.FindAll((CardInfo a) => a.IsOfTribe(GetCustomTribe("Lily.BOT", "rodent")) && CardExtensions.HasAnyOfCardMetaCategories(a, (CardMetaCategory[])(object)new CardMetaCategory[2]
				{
					default(CardMetaCategory),
					(CardMetaCategory)1
				}))));
			}
			static void HumanRemains()
			{
				//IL_0020: Unknown result type (might be due to invalid IL or missing references)
				CardInfo val4 = CreateCard("Bundle_Of_Totems_Undead_Pelt", "Human Remains", "Human Remains.png", "None.png", 0, 2, GetCustomTribe("Lily.BOT", "undead"));
				PeltManager.New("creator.TribalPelts", val4, 6, 0, 4, (Func<List<CardInfo>>)(() => CardManager.AllCardsCopy.FindAll((CardInfo a) => a.IsOfTribe(GetCustomTribe("Lily.BOT", "undead")) && CardExtensions.HasAnyOfCardMetaCategories(a, (CardMetaCategory[])(object)new CardMetaCategory[2]
				{
					default(CardMetaCategory),
					(CardMetaCategory)1
				}))));
			}
			static void SharkLeather()
			{
				//IL_0020: Unknown result type (might be due to invalid IL or missing references)
				CardInfo val3 = CreateCard("Bundle_Of_Totems_Aquatic_Pelt", "Shark Leather", "Shark Leather.png", "None.png", 0, 2, GetCustomTribe("Lily.BOT", "aquatic"));
				PeltManager.New("creator.TribalPelts", val3, 6, 0, 4, (Func<List<CardInfo>>)(() => CardManager.AllCardsCopy.FindAll((CardInfo a) => a.IsOfTribe(GetCustomTribe("Lily.BOT", "aquatic")) && CardExtensions.HasAnyOfCardMetaCategories(a, (CardMetaCategory[])(object)new CardMetaCategory[2]
				{
					default(CardMetaCategory),
					(CardMetaCategory)1
				}))));
			}
			static void TigerPelt()
			{
				//IL_0020: Unknown result type (might be due to invalid IL or missing references)
				CardInfo val2 = CreateCard("Bundle_Of_Totems_Feline_Pelt", "Tiger Pelt", "Tiger Pelt.png", "None.png", 0, 2, GetCustomTribe("Lily.BOT", "feline"));
				PeltManager.New("creator.TribalPelts", val2, 6, 0, 4, (Func<List<CardInfo>>)(() => CardManager.AllCardsCopy.FindAll((CardInfo a) => a.IsOfTribe(GetCustomTribe("Lily.BOT", "feline")) && CardExtensions.HasAnyOfCardMetaCategories(a, (CardMetaCategory[])(object)new CardMetaCategory[2]
				{
					default(CardMetaCategory),
					(CardMetaCategory)1
				}))));
			}
		}

		public void MushroomTribesPelts()
		{
			BlasterPelt();
			BlockPelt();
			BlooperPelt();
			BobOmbPelt();
			BooPelt();
			BronzePortrait();
			ChainChompPelt();
			CheepCheepPelt();
			ConkdorPelt();
			DragonPelt();
			DryBonesPelt();
			GoldPortrait();
			GoombaPelt();
			KoopaPelt();
			PiranhaPelt();
			PokeyPelt();
			PowerUpPelt();
			RamPelt();
			ShroobPelt();
			ShyGuyPelt();
			SilverPortrait();
			StarPelt();
			SpikePelt();
			TanukiPelt();
			ThwompPelt();
			WaddlewingPelt();
			WigglerPelt();
			PowerMoon();
			StarBits();
			ShineSprite();
			Count++;
			Count++;
			Count++;
			Count++;
			Count++;
			Count++;
			Count++;
			Count++;
			Count++;
			Count++;
			Count++;
			Count++;
			Count++;
			Count++;
			Count++;
			Count++;
			Count++;
			Count++;
			Count++;
			Count++;
			Count++;
			Count++;
			Count++;
			Count++;
			Count++;
			Count++;
			Count++;
			Count++;
			Count++;
			Count++;
			static void BlasterPelt()
			{
				//IL_0016: Unknown result type (might be due to invalid IL or missing references)
				CardInfo val30 = CreateCard("Mushroom_Blaster_Pelt", "Blaster Pelt", "Blaster Pelt.png", "Blaster Pelt_e.png", 0, 2, MushroomTribes.blasterTribe);
				PeltManager.New("creator.TribalPelts", val30, 6, 0, 4, (Func<List<CardInfo>>)(() => CardManager.AllCardsCopy.FindAll((CardInfo a) => a.IsOfTribe(MushroomTribes.blasterTribe) && (CardExtensions.ModPrefixIs(a, "Mushroom") || CardExtensions.ModPrefixIs(a, "Gallery")) && CardExtensions.HasAnyOfCardMetaCategories(a, (CardMetaCategory[])(object)new CardMetaCategory[2]
				{
					default(CardMetaCategory),
					(CardMetaCategory)1
				}))));
			}
			static void BlockPelt()
			{
				//IL_0016: Unknown result type (might be due to invalid IL or missing references)
				CardInfo val29 = CreateCard("Mushroom_Block_Pelt", "Block Pelt", "Block Pelt.png", "Block Pelt_e.png", 0, 2, MushroomTribes.blockTribe);
				PeltManager.New("creator.TribalPelts", val29, 6, 0, 4, (Func<List<CardInfo>>)(() => CardManager.AllCardsCopy.FindAll((CardInfo a) => a.IsOfTribe(MushroomTribes.blockTribe) && (CardExtensions.ModPrefixIs(a, "Mushroom") || CardExtensions.ModPrefixIs(a, "Gallery")) && CardExtensions.HasAnyOfCardMetaCategories(a, (CardMetaCategory[])(object)new CardMetaCategory[2]
				{
					default(CardMetaCategory),
					(CardMetaCategory)1
				}))));
			}
			static void BlooperPelt()
			{
				//IL_0016: Unknown result type (might be due to invalid IL or missing references)
				CardInfo val28 = CreateCard("Mushroom_Blooper_Pelt", "Blooper Pelt", "Blooper Pelt.png", "Blooper Pelt_e.png", 0, 2, MushroomTribes.blooperTribe);
				PeltManager.New("creator.TribalPelts", val28, 6, 0, 4, (Func<List<CardInfo>>)(() => CardManager.AllCardsCopy.FindAll((CardInfo a) => a.IsOfTribe(MushroomTribes.blooperTribe) && (CardExtensions.ModPrefixIs(a, "Mushroom") || CardExtensions.ModPrefixIs(a, "Gallery")) && CardExtensions.HasAnyOfCardMetaCategories(a, (CardMetaCategory[])(object)new CardMetaCategory[2]
				{
					default(CardMetaCategory),
					(CardMetaCategory)1
				}))));
			}
			static void BobOmbPelt()
			{
				//IL_0016: Unknown result type (might be due to invalid IL or missing references)
				CardInfo val27 = CreateCard("Mushroom_Bob_Omb_Pelt", "Bob-Omb Pelt", "Bob-Omb Pelt.png", "Bob-Omb Pelt_e.png", 0, 2, MushroomTribes.bombombTribe);
				PeltManager.New("creator.TribalPelts", val27, 6, 0, 4, (Func<List<CardInfo>>)(() => CardManager.AllCardsCopy.FindAll((CardInfo a) => a.IsOfTribe(MushroomTribes.bombombTribe) && (CardExtensions.ModPrefixIs(a, "Mushroom") || CardExtensions.ModPrefixIs(a, "Gallery")) && CardExtensions.HasAnyOfCardMetaCategories(a, (CardMetaCategory[])(object)new CardMetaCategory[2]
				{
					default(CardMetaCategory),
					(CardMetaCategory)1
				}))));
			}
			static void BooPelt()
			{
				//IL_0016: Unknown result type (might be due to invalid IL or missing references)
				CardInfo val26 = CreateCard("Mushroom_Boo_Pelt", "Boo Pelt", "Boo Pelt.png", "Boo Pelt_e.png", 0, 2, MushroomTribes.booTribe);
				PeltManager.New("creator.TribalPelts", val26, 6, 0, 4, (Func<List<CardInfo>>)(() => CardManager.AllCardsCopy.FindAll((CardInfo a) => a.IsOfTribe(MushroomTribes.booTribe) && (CardExtensions.ModPrefixIs(a, "Mushroom") || CardExtensions.ModPrefixIs(a, "Gallery")) && CardExtensions.HasAnyOfCardMetaCategories(a, (CardMetaCategory[])(object)new CardMetaCategory[2]
				{
					default(CardMetaCategory),
					(CardMetaCategory)1
				}))));
			}
			static void BronzePortrait()
			{
				CardInfo val25 = CreateCard("Mushroom_Bronze_Portrait", "Bronze Portrait", "Bronze Portrait.png", "Bronze Portrait_e.png", 0, 2, (Tribe)0);
				PeltManager.New("creator.TribalPelts", val25, 3, 0, 4, (Func<List<CardInfo>>)(() => CardManager.AllCardsCopy.FindAll((CardInfo a) => CardExtensions.ModPrefixIs(a, "Gallery") && CardExtensions.HasAnyOfCardMetaCategories(a, (CardMetaCategory[])(object)new CardMetaCategory[2]
				{
					default(CardMetaCategory),
					(CardMetaCategory)1
				}))));
			}
			static void ChainChompPelt()
			{
				//IL_0016: Unknown result type (might be due to invalid IL or missing references)
				CardInfo val24 = CreateCard("Mushroom_Chain_Chomp_Pelt", "Chain Chomp Pelt", "Chain Chomp Pelt.png", "Chain Chomp Pelt_e.png", 0, 2, MushroomTribes.chompTribe);
				PeltManager.New("creator.TribalPelts", val24, 6, 0, 4, (Func<List<CardInfo>>)(() => CardManager.AllCardsCopy.FindAll((CardInfo a) => a.IsOfTribe(MushroomTribes.chompTribe) && (CardExtensions.ModPrefixIs(a, "Mushroom") || CardExtensions.ModPrefixIs(a, "Gallery")) && CardExtensions.HasAnyOfCardMetaCategories(a, (CardMetaCategory[])(object)new CardMetaCategory[2]
				{
					default(CardMetaCategory),
					(CardMetaCategory)1
				}))));
			}
			static void CheepCheepPelt()
			{
				//IL_0016: Unknown result type (might be due to invalid IL or missing references)
				CardInfo val23 = CreateCard("Mushroom_Cheep_Cheep_Pelt", "Cheep-Cheep Pelt", "Cheep-Cheep Pelt.png", "Cheep-Cheep Pelt_e.png", 0, 2, MushroomTribes.cheepCheepTribe);
				PeltManager.New("creator.TribalPelts", val23, 6, 0, 4, (Func<List<CardInfo>>)(() => CardManager.AllCardsCopy.FindAll((CardInfo a) => a.IsOfTribe(MushroomTribes.cheepCheepTribe) && (CardExtensions.ModPrefixIs(a, "Mushroom") || CardExtensions.ModPrefixIs(a, "Gallery")) && CardExtensions.HasAnyOfCardMetaCategories(a, (CardMetaCategory[])(object)new CardMetaCategory[2]
				{
					default(CardMetaCategory),
					(CardMetaCategory)1
				}))));
			}
			static void ConkdorPelt()
			{
				//IL_0016: Unknown result type (might be due to invalid IL or missing references)
				CardInfo val22 = CreateCard("Mushroom_Conkdor_Pelt", "Conkdor Pelt", "Conkdor Pelt.png", "Conkdor Pelt_e.png", 0, 2, MushroomTribes.conkdorTribe);
				PeltManager.New("creator.TribalPelts", val22, 6, 0, 4, (Func<List<CardInfo>>)(() => CardManager.AllCardsCopy.FindAll((CardInfo a) => a.IsOfTribe(MushroomTribes.conkdorTribe) && (CardExtensions.ModPrefixIs(a, "Mushroom") || CardExtensions.ModPrefixIs(a, "Gallery")) && CardExtensions.HasAnyOfCardMetaCategories(a, (CardMetaCategory[])(object)new CardMetaCategory[2]
				{
					default(CardMetaCategory),
					(CardMetaCategory)1
				}))));
			}
			static void DragonPelt()
			{
				//IL_0016: Unknown result type (might be due to invalid IL or missing references)
				CardInfo val21 = CreateCard("Mushroom_Dragon_Pelt", "Dragon Pelt", "Dragon Pelt.png", "Dragon Pelt_e.png", 0, 2, MushroomTribes.dinosaurTribe);
				PeltManager.New("creator.TribalPelts", val21, 6, 0, 4, (Func<List<CardInfo>>)(() => CardManager.AllCardsCopy.FindAll((CardInfo a) => a.IsOfTribe(MushroomTribes.dinosaurTribe) && (CardExtensions.ModPrefixIs(a, "Mushroom") || CardExtensions.ModPrefixIs(a, "Gallery")) && CardExtensions.HasAnyOfCardMetaCategories(a, (CardMetaCategory[])(object)new CardMetaCategory[2]
				{
					default(CardMetaCategory),
					(CardMetaCategory)1
				}))));
			}
			static void DryBonesPelt()
			{
				//IL_0016: Unknown result type (might be due to invalid IL or missing references)
				CardInfo val20 = CreateCard("Mushroom_Dry_Bones_Pelt", "Dry Bones Pelt", "Dry Bones Pelt.png", "Dry Bones Pelt_e.png", 0, 2, MushroomTribes.skeletonTribe);
				PeltManager.New("creator.TribalPelts", val20, 6, 0, 4, (Func<List<CardInfo>>)(() => CardManager.AllCardsCopy.FindAll((CardInfo a) => a.IsOfTribe(MushroomTribes.skeletonTribe) && (CardExtensions.ModPrefixIs(a, "Mushroom") || CardExtensions.ModPrefixIs(a, "Gallery")) && CardExtensions.HasAnyOfCardMetaCategories(a, (CardMetaCategory[])(object)new CardMetaCategory[2]
				{
					default(CardMetaCategory),
					(CardMetaCategory)1
				}))));
			}
			static void GoldPortrait()
			{
				CardInfo val19 = CreateRareCard("Mushroom_Gold_Portrait", "Gold Portrait", "Gold Portrait.png", "Gold Portrait_e.png", 0, 2, (Tribe)0);
				PeltManager.New("creator.TribalPelts", val19, 11, 0, 2, (Func<List<CardInfo>>)(() => CardManager.AllCardsCopy.FindAll((CardInfo a) => CardExtensions.ModPrefixIs(a, "Gallery") && CardExtensions.HasAnyOfCardMetaCategories(a, (CardMetaCategory[])(object)new CardMetaCategory[1] { (CardMetaCategory)3 }))));
			}
			static void GoombaPelt()
			{
				//IL_0016: Unknown result type (might be due to invalid IL or missing references)
				CardInfo val18 = CreateCard("Mushroom_Goomba_Pelt", "Goomba Pelt", "Goomba Pelt.png", "Goomba Pelt_e.png", 0, 2, MushroomTribes.goombaTribe);
				PeltManager.New("creator.TribalPelts", val18, 6, 0, 4, (Func<List<CardInfo>>)(() => CardManager.AllCardsCopy.FindAll((CardInfo a) => a.IsOfTribe(MushroomTribes.goombaTribe) && (CardExtensions.ModPrefixIs(a, "Mushroom") || CardExtensions.ModPrefixIs(a, "Gallery")) && CardExtensions.HasAnyOfCardMetaCategories(a, (CardMetaCategory[])(object)new CardMetaCategory[2]
				{
					default(CardMetaCategory),
					(CardMetaCategory)1
				}))));
			}
			static void KoopaPelt()
			{
				//IL_0016: Unknown result type (might be due to invalid IL or missing references)
				CardInfo val17 = CreateCard("Mushroom_Koopa_Pelt", "Koopa Pelt", "Koopa Pelt.png", "Koopa Pelt_e.png", 0, 2, MushroomTribes.koopaTribe);
				PeltManager.New("creator.TribalPelts", val17, 6, 0, 4, (Func<List<CardInfo>>)(() => CardManager.AllCardsCopy.FindAll((CardInfo a) => a.IsOfTribe(MushroomTribes.koopaTribe) && (CardExtensions.ModPrefixIs(a, "Mushroom") || CardExtensions.ModPrefixIs(a, "Gallery")) && CardExtensions.HasAnyOfCardMetaCategories(a, (CardMetaCategory[])(object)new CardMetaCategory[2]
				{
					default(CardMetaCategory),
					(CardMetaCategory)1
				}))));
			}
			static void PiranhaPelt()
			{
				//IL_0016: Unknown result type (might be due to invalid IL or missing references)
				CardInfo val16 = CreateCard("Mushroom_Piranha_Plant_Pelt", "Piranha Plant Pelt", "Piranha Pelt.png", "Piranha Pelt_e.png", 0, 2, MushroomTribes.piranhaPlantTribe);
				PeltManager.New("creator.TribalPelts", val16, 6, 0, 4, (Func<List<CardInfo>>)(() => CardManager.AllCardsCopy.FindAll((CardInfo a) => a.IsOfTribe(MushroomTribes.piranhaPlantTribe) && (CardExtensions.ModPrefixIs(a, "Mushroom") || CardExtensions.ModPrefixIs(a, "Gallery")) && CardExtensions.HasAnyOfCardMetaCategories(a, (CardMetaCategory[])(object)new CardMetaCategory[2]
				{
					default(CardMetaCategory),
					(CardMetaCategory)1
				}))));
			}
			static void PokeyPelt()
			{
				//IL_0016: Unknown result type (might be due to invalid IL or missing references)
				CardInfo val15 = CreateCard("Mushroom_Pokey_Pelt", "Pokey Pelt", "Pokey Pelt.png", "Pokey Pelt_e.png", 0, 2, MushroomTribes.pokeyTribe);
				PeltManager.New("creator.TribalPelts", val15, 6, 0, 4, (Func<List<CardInfo>>)(() => CardManager.AllCardsCopy.FindAll((CardInfo a) => a.IsOfTribe(MushroomTribes.pokeyTribe) && (CardExtensions.ModPrefixIs(a, "Mushroom") || CardExtensions.ModPrefixIs(a, "Gallery")) && CardExtensions.HasAnyOfCardMetaCategories(a, (CardMetaCategory[])(object)new CardMetaCategory[2]
				{
					default(CardMetaCategory),
					(CardMetaCategory)1
				}))));
			}
			static void PowerMoon()
			{
				CardInfo val3 = CreateCard("Mushroom_Power_Moon", "Power Moon", "Power Moon.png", "Power Moon_e.png", 0, 2, (Tribe)0);
				PeltManager.New("creator.TribalPelts", val3, 7, 1, 4, (Func<List<CardInfo>>)(() => CardManager.AllCardsCopy.FindAll((CardInfo a) => CardExtensions.ModPrefixIs(a, "Mushroom") && CardExtensions.HasAnyOfCardMetaCategories(a, (CardMetaCategory[])(object)new CardMetaCategory[2]
				{
					default(CardMetaCategory),
					(CardMetaCategory)1
				}))));
			}
			static void PowerUpPelt()
			{
				//IL_0016: Unknown result type (might be due to invalid IL or missing references)
				CardInfo val14 = CreateCard("Mushroom_Power_Up_Pelt", "Power-Up Pelt", "Power-Up Pelt.png", "Power-Up Pelt_e.png", 0, 2, MushroomTribes.powerUpTribe);
				PeltManager.New("creator.TribalPelts", val14, 6, 0, 4, (Func<List<CardInfo>>)(() => CardManager.AllCardsCopy.FindAll((CardInfo a) => a.IsOfTribe(MushroomTribes.powerUpTribe) && (CardExtensions.ModPrefixIs(a, "Mushroom") || CardExtensions.ModPrefixIs(a, "Gallery")) && CardExtensions.HasAnyOfCardMetaCategories(a, (CardMetaCategory[])(object)new CardMetaCategory[2]
				{
					default(CardMetaCategory),
					(CardMetaCategory)1
				}))));
			}
			static void RamPelt()
			{
				//IL_0016: Unknown result type (might be due to invalid IL or missing references)
				CardInfo val13 = CreateCard("Mushroom_Ram_Pelt", "Ram Pelt", "Ram Pelt.png", "Ram Pelt_e.png", 0, 2, MushroomTribes.ramTribe);
				PeltManager.New("creator.TribalPelts", val13, 6, 0, 4, (Func<List<CardInfo>>)(() => CardManager.AllCardsCopy.FindAll((CardInfo a) => a.IsOfTribe(MushroomTribes.ramTribe) && (CardExtensions.ModPrefixIs(a, "Mushroom") || CardExtensions.ModPrefixIs(a, "Gallery")) && CardExtensions.HasAnyOfCardMetaCategories(a, (CardMetaCategory[])(object)new CardMetaCategory[2]
				{
					default(CardMetaCategory),
					(CardMetaCategory)1
				}))));
			}
			static void ShineSprite()
			{
				CardInfo val = CreateCard("Mushroom_Shine_Sprite", "Shine Sprite", "Shine Sprite.png", "Shine Sprite_e.png", 0, 2, (Tribe)0);
				PeltManager.New("creator.TribalPelts", val, 11, 0, 2, (Func<List<CardInfo>>)(() => CardManager.AllCardsCopy.FindAll((CardInfo a) => CardExtensions.ModPrefixIs(a, "Mushroom") && CardExtensions.HasAnyOfCardMetaCategories(a, (CardMetaCategory[])(object)new CardMetaCategory[1] { (CardMetaCategory)3 }))));
			}
			static void ShroobPelt()
			{
				//IL_0016: Unknown result type (might be due to invalid IL or missing references)
				CardInfo val12 = CreateCard("Mushroom_Shroob_Pelt", "Shroob Pelt", "Shroob Pelt.png", "Shroob Pelt_e.png", 0, 2, MushroomTribes.shroobTribe);
				PeltManager.New("creator.TribalPelts", val12, 6, 0, 4, (Func<List<CardInfo>>)(() => CardManager.AllCardsCopy.FindAll((CardInfo a) => a.IsOfTribe(MushroomTribes.shroobTribe) && (CardExtensions.ModPrefixIs(a, "Mushroom") || CardExtensions.ModPrefixIs(a, "Gallery")) && CardExtensions.HasAnyOfCardMetaCategories(a, (CardMetaCategory[])(object)new CardMetaCategory[2]
				{
					default(CardMetaCategory),
					(CardMetaCategory)1
				}))));
			}
			static void ShyGuyPelt()
			{
				//IL_0016: Unknown result type (might be due to invalid IL or missing references)
				CardInfo val11 = CreateCard("Mushroom_Shy_Guy_Pelt", "Shy Guy Pelt", "Shy Guy Pelt.png", "Shy Guy Pelt_e.png", 0, 2, MushroomTribes.shyGuyTribe);
				PeltManager.New("creator.TribalPelts", val11, 6, 0, 4, (Func<List<CardInfo>>)(() => CardManager.AllCardsCopy.FindAll((CardInfo a) => a.IsOfTribe(MushroomTribes.shyGuyTribe) && (CardExtensions.ModPrefixIs(a, "Mushroom") || CardExtensions.ModPrefixIs(a, "Gallery")) && CardExtensions.HasAnyOfCardMetaCategories(a, (CardMetaCategory[])(object)new CardMetaCategory[2]
				{
					default(CardMetaCategory),
					(CardMetaCategory)1
				}))));
			}
			static void SilverPortrait()
			{
				CardInfo val10 = CreateCard("Mushroom_Silver_Portrait", "Silver Portrait", "Silver Portrait.png", "Silver Portrait_e.png", 0, 2, (Tribe)0);
				PeltManager.New("creator.TribalPelts", val10, 7, 1, 4, (Func<List<CardInfo>>)(() => CardManager.AllCardsCopy.FindAll((CardInfo a) => CardExtensions.ModPrefixIs(a, "Gallery") && CardExtensions.HasAnyOfCardMetaCategories(a, (CardMetaCategory[])(object)new CardMetaCategory[2]
				{
					default(CardMetaCategory),
					(CardMetaCategory)1
				}))));
			}
			static void SpikePelt()
			{
				//IL_0016: Unknown result type (might be due to invalid IL or missing references)
				CardInfo val8 = CreateCard("Mushroom_Spike_Pelt", "Spike Pelt", "Spike Pelt.png", "Spike Pelt_e.png", 0, 2, MushroomTribes.spikeTribe);
				PeltManager.New("creator.TribalPelts", val8, 6, 0, 4, (Func<List<CardInfo>>)(() => CardManager.AllCardsCopy.FindAll((CardInfo a) => a.IsOfTribe(MushroomTribes.spikeTribe) && (CardExtensions.ModPrefixIs(a, "Mushroom") || CardExtensions.ModPrefixIs(a, "Gallery")) && CardExtensions.HasAnyOfCardMetaCategories(a, (CardMetaCategory[])(object)new CardMetaCategory[2]
				{
					default(CardMetaCategory),
					(CardMetaCategory)1
				}))));
			}
			static void StarBits()
			{
				CardInfo val2 = CreateCard("Mushroom_Star_Bits", "Star Bits", "Star Bits.png", "Star Bits_e.png", 0, 2, (Tribe)0);
				PeltManager.New("creator.TribalPelts", val2, 3, 0, 4, (Func<List<CardInfo>>)(() => CardManager.AllCardsCopy.FindAll((CardInfo a) => CardExtensions.ModPrefixIs(a, "Mushroom") && CardExtensions.HasAnyOfCardMetaCategories(a, (CardMetaCategory[])(object)new CardMetaCategory[2]
				{
					default(CardMetaCategory),
					(CardMetaCategory)1
				}))));
			}
			static void StarPelt()
			{
				//IL_0016: Unknown result type (might be due to invalid IL or missing references)
				CardInfo val9 = CreateCard("Mushroom_Star_Pelt", "Star Pelt", "Star Pelt.png", "Star Pelt_e.png", 0, 2, MushroomTribes.starTribe);
				PeltManager.New("creator.TribalPelts", val9, 6, 0, 4, (Func<List<CardInfo>>)(() => CardManager.AllCardsCopy.FindAll((CardInfo a) => a.IsOfTribe(MushroomTribes.starTribe) && (CardExtensions.ModPrefixIs(a, "Mushroom") || CardExtensions.ModPrefixIs(a, "Gallery")) && CardExtensions.HasAnyOfCardMetaCategories(a, (CardMetaCategory[])(object)new CardMetaCategory[2]
				{
					default(CardMetaCategory),
					(CardMetaCategory)1
				}))));
			}
			static void TanukiPelt()
			{
				//IL_0016: Unknown result type (might be due to invalid IL or missing references)
				CardInfo val7 = CreateCard("Mushroom_Tanuki_Pelt", "Tanuki Pelt", "Tanuki Pelt.png", "Tanuki Pelt_e.png", 0, 2, MushroomTribes.tanukiTribe);
				PeltManager.New("creator.TribalPelts", val7, 6, 0, 4, (Func<List<CardInfo>>)(() => CardManager.AllCardsCopy.FindAll((CardInfo a) => a.IsOfTribe(MushroomTribes.tanukiTribe) && (CardExtensions.ModPrefixIs(a, "Mushroom") || CardExtensions.ModPrefixIs(a, "Gallery")) && CardExtensions.HasAnyOfCardMetaCategories(a, (CardMetaCategory[])(object)new CardMetaCategory[2]
				{
					default(CardMetaCategory),
					(CardMetaCategory)1
				}))));
			}
			static void ThwompPelt()
			{
				//IL_0016: Unknown result type (might be due to invalid IL or missing references)
				CardInfo val6 = CreateCard("Mushroom_Thwomp_Pelt", "Thwomp Pelt", "Thwomp Pelt.png", "Thwomp Pelt_e.png", 0, 2, MushroomTribes.crusherTribe);
				PeltManager.New("creator.TribalPelts", val6, 6, 0, 4, (Func<List<CardInfo>>)(() => CardManager.AllCardsCopy.FindAll((CardInfo a) => a.IsOfTribe(MushroomTribes.crusherTribe) && (CardExtensions.ModPrefixIs(a, "Mushroom") || CardExtensions.ModPrefixIs(a, "Gallery")) && CardExtensions.HasAnyOfCardMetaCategories(a, (CardMetaCategory[])(object)new CardMetaCategory[2]
				{
					default(CardMetaCategory),
					(CardMetaCategory)1
				}))));
			}
			static void WaddlewingPelt()
			{
				//IL_0016: Unknown result type (might be due to invalid IL or missing references)
				CardInfo val5 = CreateCard("Mushroom_Waddlewing_Pelt", "Waddlewing Pelt", "Waddlewing Pelt.png", "Waddlewing Pelt_e.png", 0, 2, MushroomTribes.waddlewingTribe);
				PeltManager.New("creator.TribalPelts", val5, 6, 0, 4, (Func<List<CardInfo>>)(() => CardManager.AllCardsCopy.FindAll((CardInfo a) => a.IsOfTribe(MushroomTribes.waddlewingTribe) && (CardExtensions.ModPrefixIs(a, "Mushroom") || CardExtensions.ModPrefixIs(a, "Gallery")) && CardExtensions.HasAnyOfCardMetaCategories(a, (CardMetaCategory[])(object)new CardMetaCategory[2]
				{
					default(CardMetaCategory),
					(CardMetaCategory)1
				}))));
			}
			static void WigglerPelt()
			{
				//IL_0016: Unknown result type (might be due to invalid IL or missing references)
				CardInfo val4 = CreateCard("Mushroom_Wiggler_Pelt", "Wiggler Pelt", "Wiggler Pelt.png", "Wiggler Pelt_e.png", 0, 2, MushroomTribes.wrigglerTribe);
				PeltManager.New("creator.TribalPelts", val4, 6, 0, 4, (Func<List<CardInfo>>)(() => CardManager.AllCardsCopy.FindAll((CardInfo a) => a.IsOfTribe(MushroomTribes.wrigglerTribe) && (CardExtensions.ModPrefixIs(a, "Mushroom") || CardExtensions.ModPrefixIs(a, "Gallery")) && CardExtensions.HasAnyOfCardMetaCategories(a, (CardMetaCategory[])(object)new CardMetaCategory[2]
				{
					default(CardMetaCategory),
					(CardMetaCategory)1
				}))));
			}
		}

		public void NeverNamedsSigilarium()
		{
			BeaverPeltSigilarium();
			LobsterShell();
			SpiderSkin();
			Count++;
			Count++;
			Count++;
			static void BeaverPeltSigilarium()
			{
				//IL_0020: Unknown result type (might be due to invalid IL or missing references)
				CardInfo val3 = CreateCard("Nevernameds_Sigilarium_Rodent_Pelt", "Beaver Pelt", "Beaver Pelt.png", "None.png", 0, 2, GetCustomTribe("nevernamed.inscryption.sigils", "Rodent"));
				PeltManager.New("creator.TribalPelts", val3, 6, 0, 4, (Func<List<CardInfo>>)(() => CardManager.AllCardsCopy.FindAll((CardInfo a) => a.IsOfTribe(GetCustomTribe("Lily.BOT", "Rodent")) && CardExtensions.HasAnyOfCardMetaCategories(a, (CardMetaCategory[])(object)new CardMetaCategory[2]
				{
					default(CardMetaCategory),
					(CardMetaCategory)1
				}))));
			}
			static void LobsterShell()
			{
				//IL_0020: Unknown result type (might be due to invalid IL or missing references)
				CardInfo val2 = CreateCard("Nevernameds_Sigilarium_Crustacean_Pelt", "Lobster Shell", "Lobster Shell.png", "None.png", 0, 2, GetCustomTribe("nevernamed.inscryption.sigils", "Crustacean"));
				PeltManager.New("creator.TribalPelts", val2, 6, 0, 4, (Func<List<CardInfo>>)(() => CardManager.AllCardsCopy.FindAll((CardInfo a) => a.IsOfTribe(GetCustomTribe("nevernamed.inscryption.sigils", "Crustacean")) && CardExtensions.HasAnyOfCardMetaCategories(a, (CardMetaCategory[])(object)new CardMetaCategory[2]
				{
					default(CardMetaCategory),
					(CardMetaCategory)1
				}))));
			}
			static void SpiderSkin()
			{
				//IL_0020: Unknown result type (might be due to invalid IL or missing references)
				CardInfo val = CreateCard("Nevernameds_Sigilarium_Arachnid_Pelt", "Spider Skin", "Spider Skin.png", "None.png", 0, 2, GetCustomTribe("nevernamed.inscryption.sigils", "Arachnid"));
				PeltManager.New("creator.TribalPelts", val, 6, 0, 4, (Func<List<CardInfo>>)(() => CardManager.AllCardsCopy.FindAll((CardInfo a) => a.IsOfTribe(GetCustomTribe("nevernamed.inscryption.sigils", "Arachnid")) && CardExtensions.HasAnyOfCardMetaCategories(a, (CardMetaCategory[])(object)new CardMetaCategory[2]
				{
					default(CardMetaCategory),
					(CardMetaCategory)1
				}))));
			}
		}

		public void VerminTribe()
		{
			BeaverPeltVermin();
			Count++;
			static void BeaverPeltVermin()
			{
				CardInfo val = CreateCard("Vermin_Vermin_Pelt", "Beaver Pelt", "Beaver Pelt.png", "None.png", 0, 2, (Tribe)1);
				PeltManager.New("creator.TribalPelts", val, 6, 0, 4, (Func<List<CardInfo>>)(() => CardManager.AllCardsCopy.FindAll((CardInfo a) => a.IsOfTribe((Tribe)1) && CardExtensions.HasAnyOfCardMetaCategories(a, (CardMetaCategory[])(object)new CardMetaCategory[2]
				{
					default(CardMetaCategory),
					(CardMetaCategory)1
				}))));
			}
		}
	}
	public static class PluginInfo
	{
		public const string PLUGIN_GUID = "TribalPelts";

		public const string PLUGIN_NAME = "TribalPelts";

		public const string PLUGIN_VERSION = "2.1.0";
	}
}

plugins/Gareth48-GarethMod/plugins/GarethMod.dll

Decompiled 5 months ago
using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using BepInEx;
using BepInEx.Bootstrap;
using DiskCardGame;
using Infiniscryption.PackManagement;
using InscryptionAPI.Ascension;
using InscryptionAPI.Card;
using InscryptionAPI.Helpers;
using Microsoft.CodeAnalysis;
using UnityEngine;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: TargetFramework(".NETStandard,Version=v2.0", FrameworkDisplayName = ".NET Standard 2.0")]
[assembly: AssemblyCompany("GarethMod")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyDescription("A balanced, in flavor card pack for Inscryption")]
[assembly: AssemblyFileVersion("2.0.0.0")]
[assembly: AssemblyInformationalVersion("2.0.0")]
[assembly: AssemblyProduct("GarethMod")]
[assembly: AssemblyTitle("GarethMod")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("2.0.0.0")]
[module: UnverifiableCode]
[module: RefSafetyRules(11)]
namespace Microsoft.CodeAnalysis
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	internal sealed class EmbeddedAttribute : Attribute
	{
	}
}
namespace System.Runtime.CompilerServices
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	[AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)]
	internal sealed class RefSafetyRulesAttribute : Attribute
	{
		public readonly int Version;

		public RefSafetyRulesAttribute(int P_0)
		{
			Version = P_0;
		}
	}
}
namespace GarethMod
{
	[BepInPlugin("gareth48.inscryption.garethmod", "Gareth's Mod", "2.0.0")]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	public class Plugin : BaseUnityPlugin
	{
		private const string PluginGuid = "gareth48.inscryption.garethmod";

		private const string PluginName = "Gareth's Mod";

		private const string PluginVersion = "2.0.0";

		private const string PluginPrefix = "Garethmod";

		private const string env = "GarethMod.dll";

		private const string LESHY_PLACEHOLDER = "Curious, I don't seem to remember this creature...";

		private const string LESHY_EXPLOIT_DESC = "How did this creature get here?";

		private void Awake()
		{
			((BaseUnityPlugin)this).Logger.LogInfo((object)"Loaded Gareth's Mod!");
			RegisterModElements();
		}

		private void Start()
		{
			if (Chainloader.PluginInfos.ContainsKey("zorro.inscryption.infiniscryption.packmanager"))
			{
				CreatePack();
			}
		}

		public static void CreatePack()
		{
			PackInfo packInfo = PackManager.GetPackInfo("Garethmod");
			packInfo.Title = "Gareth's Mod";
			packInfo.SetTexture(TextureHelper.GetImageAsTexture("pack_icon.png", (FilterMode)0));
			packInfo.Description = "A part 1 booster pack created by Gareth48 and illustrated by Plutraser. Adds [count] cards and 7 sigils designed to fit right into vanilla Inscryption.";
			packInfo.ValidFor.Add((PackMetacategory)0);
		}

		private void RegisterModElements()
		{
			//IL_00e2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e8: Expected I4, but got Unknown
			//IL_0183: Unknown result type (might be due to invalid IL or missing references)
			//IL_0189: Expected I4, but got Unknown
			//IL_0222: Unknown result type (might be due to invalid IL or missing references)
			//IL_0228: Expected I4, but got Unknown
			//IL_0487: Unknown result type (might be due to invalid IL or missing references)
			//IL_048d: Expected I4, but got Unknown
			//IL_052b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0531: Expected I4, but got Unknown
			//IL_05c3: Unknown result type (might be due to invalid IL or missing references)
			//IL_05c9: Expected I4, but got Unknown
			//IL_0662: Unknown result type (might be due to invalid IL or missing references)
			//IL_0668: Expected I4, but got Unknown
			//IL_06f2: Unknown result type (might be due to invalid IL or missing references)
			//IL_06f8: Expected I4, but got Unknown
			//IL_078f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0795: Expected I4, but got Unknown
			//IL_08c5: Unknown result type (might be due to invalid IL or missing references)
			//IL_08cb: Expected I4, but got Unknown
			//IL_0955: Unknown result type (might be due to invalid IL or missing references)
			//IL_095b: Expected I4, but got Unknown
			//IL_0ba5: Unknown result type (might be due to invalid IL or missing references)
			//IL_0bab: Expected I4, but got Unknown
			//IL_0c3a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0c40: Expected I4, but got Unknown
			//IL_0cca: Unknown result type (might be due to invalid IL or missing references)
			//IL_0cd0: Expected I4, but got Unknown
			//IL_0d63: Unknown result type (might be due to invalid IL or missing references)
			//IL_0d69: Expected I4, but got Unknown
			//IL_0e19: Unknown result type (might be due to invalid IL or missing references)
			//IL_0e1f: Expected I4, but got Unknown
			//IL_0e9f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0ea5: Expected I4, but got Unknown
			//IL_0ea7: Unknown result type (might be due to invalid IL or missing references)
			//IL_0ead: Expected I4, but got Unknown
			//IL_0f36: Unknown result type (might be due to invalid IL or missing references)
			//IL_0f3c: Expected I4, but got Unknown
			Texture2D imageAsTexture = TextureHelper.GetImageAsTexture("garethmodwatermark.png", (FilterMode)0);
			CardInfo val = CardExtensions.SetEmissivePortrait(CardExtensions.SetPortrait(CardExtensions.AddDecal(CardExtensions.AddAppearances(CardExtensions.SetCost(CardManager.New("Garethmod", "Gareth48", "Sorry, can't do that", 1, 1, "Whats... he doing here?"), (int?)0, (int?)0, (int?)0, (List<GemType>)null), (Appearance[])(object)new Appearance[1] { (Appearance)7 }), (Texture[])(object)new Texture[1] { (Texture)imageAsTexture }), "garethmod_gareth48.png"), "garethmod_gareth48_emission.png");
			CardManager.Add("Garethmod", val);
			AddDrawAlly();
			AddTastyMorsel();
			AddIdentityTheft();
			AddShove();
			AddStandoffish();
			AddHungry();
			AddFlighty();
			CardInfo val2 = CardExtensions.SetPixelPortrait(CardExtensions.SetEmissivePortrait(CardExtensions.SetPortrait(CardExtensions.AddMetaCategories(CardExtensions.AddDecal(CardExtensions.AddAppearances(CardExtensions.AddAbilities(CardExtensions.SetCost(CardManager.New("Garethmod", "Skinwalker", "Skinwalker", 3, 2, "The enigmatic skinwalker. It mimics the identity of the first creature it slays."), (int?)2, (int?)0, (int?)0, (List<GemType>)null), (Ability[])(object)new Ability[1] { (Ability)(int)Garethmod_IdentityTheft.ability }), (Appearance[])(object)new Appearance[1] { (Appearance)7 }), (Texture[])(object)new Texture[1] { (Texture)imageAsTexture }), (CardMetaCategory[])(object)new CardMetaCategory[1] { (CardMetaCategory)3 }), "garethmod_skinwalker.png"), "garethmod_skinwalker_emission.png"), "garethmod_skinwalker_pixel.png");
			CardManager.Add("Garethmod", val2);
			CardInfo obj = CardManager.New("Garethmod", "WoundedAnimal", "Wounded Animal", 0, 1, "An easy target for hungry predators.");
			int? num = 3;
			CardInfo val3 = CardExtensions.SetPixelPortrait(CardExtensions.SetEmissivePortrait(CardExtensions.SetPortrait(CardExtensions.AddDecal(CardExtensions.AddAppearances(CardExtensions.AddMetaCategories(CardExtensions.AddAbilities(CardExtensions.SetCost(obj, (int?)0, num, (int?)0, (List<GemType>)null), (Ability[])(object)new Ability[1] { (Ability)(int)Garethmod_TastyMorsel.ability }), (CardMetaCategory[])(object)new CardMetaCategory[2]
			{
				default(CardMetaCategory),
				(CardMetaCategory)1
			}), (Appearance[])(object)new Appearance[1] { (Appearance)8 }), (Texture[])(object)new Texture[1] { (Texture)imageAsTexture }), "garethmod_woundedanimal.png"), "garethmod_woundedanimal_emission.png"), "garethmod_woundedanimal_pixel.png");
			CardManager.Add("Garethmod", val3);
			CardInfo val4 = CardExtensions.SetPixelPortrait(CardExtensions.SetEmissivePortrait(CardExtensions.SetPortrait(CardExtensions.AddMetaCategories(CardExtensions.AddDecal(CardExtensions.AddAbilities(CardExtensions.SetCost(CardManager.New("Garethmod", "Lemming", "Lemming", 1, 1, "The paranoid lemming. Fragile and a favorite treat among many animals."), (int?)2, (int?)0, (int?)0, (List<GemType>)null), (Ability[])(object)new Ability[2]
			{
				(Ability)(int)Garethmod_TastyMorsel.ability,
				(Ability)35
			}), (Texture[])(object)new Texture[1] { (Texture)imageAsTexture }), (CardMetaCategory[])(object)new CardMetaCategory[2]
			{
				default(CardMetaCategory),
				(CardMetaCategory)1
			}), "garethmod_lemming.png"), "garethmod_lemming_emission.png"), "garethmod_lemming_pixel.png");
			CardManager.Add("Garethmod", val4);
			CardInfo val5 = CardExtensions.SetPixelPortrait(CardExtensions.SetEmissivePortrait(CardExtensions.SetPortrait(CardExtensions.AddDecal(CardExtensions.AddAppearances(CardExtensions.AddAbilities(CardExtensions.SetCost(CardManager.New("Garethmod", "Treant", "Treant", 1, 9, "How did this creature get here?"), (int?)3, (int?)0, (int?)0, (List<GemType>)null), (Ability[])(object)new Ability[2]
			{
				(Ability)8,
				(Ability)15
			}), (Appearance[])(object)new Appearance[1] { (Appearance)7 }), (Texture[])(object)new Texture[1] { (Texture)imageAsTexture }), "garethmod_treant.png"), "garethmod_treant_emission.png"), "garethmod_treant_pixel.png");
			CardManager.Add("Garethmod", val5);
			CardInfo val6 = CardExtensions.SetEvolve(CardExtensions.SetPixelPortrait(CardExtensions.SetEmissivePortrait(CardExtensions.SetPortrait(CardExtensions.AddDecal(CardExtensions.AddAppearances(CardExtensions.AddAbilities(CardExtensions.SetCost(CardManager.New("Garethmod", "Snag", "Snag", 0, 5, "How did this creature get here?"), (int?)2, (int?)0, (int?)0, (List<GemType>)null), (Ability[])(object)new Ability[2]
			{
				(Ability)5,
				(Ability)15
			}), (Appearance[])(object)new Appearance[1] { (Appearance)7 }), (Texture[])(object)new Texture[1] { (Texture)imageAsTexture }), "garethmod_snag.png"), "garethmod_snag_emission.png"), "garethmod_snag_pixel.png"), val5, 1, (IEnumerable<CardModificationInfo>)null);
			CardManager.Add("Garethmod", val6);
			CardInfo val7 = CardExtensions.SetEvolve(CardExtensions.SetPixelPortrait(CardExtensions.SetEmissivePortrait(CardExtensions.SetPortrait(CardExtensions.AddDecal(CardExtensions.AddAppearances(CardExtensions.AddMetaCategories(CardExtensions.AddAbilities(CardExtensions.SetCost(CardManager.New("Garethmod", "Sapling", "Sapling", 0, 3, "With time, even the smallest sapling becomes a massive, imposing obstacle."), (int?)1, (int?)0, (int?)0, (List<GemType>)null), (Ability[])(object)new Ability[1] { (Ability)5 }), (CardMetaCategory[])(object)new CardMetaCategory[1] { (CardMetaCategory)3 }), (Appearance[])(object)new Appearance[1] { (Appearance)7 }), (Texture[])(object)new Texture[1] { (Texture)imageAsTexture }), "garethmod_sapling.png"), "garethmod_sapling_emission.png"), "garethmod_sapling_pixel.png"), val6, 1, (IEnumerable<CardModificationInfo>)null);
			CardManager.Add("Garethmod", val7);
			CardInfo val8 = CardExtensions.SetPixelPortrait(CardExtensions.SetEmissivePortrait(CardExtensions.SetPortrait(CardExtensions.AddTribes(CardExtensions.AddDecal(CardExtensions.AddMetaCategories(CardExtensions.AddAbilities(CardExtensions.SetCost(CardManager.New("Garethmod", "Oxpecker", "Oxpecker", 1, 1, "The adored Oxpecker. A bird capable of befriending even the fiercest of foes."), (int?)1, (int?)0, (int?)0, (List<GemType>)null), (Ability[])(object)new Ability[2]
			{
				(Ability)(int)Garethmod_DrawAlly.ability,
				(Ability)19
			}), (CardMetaCategory[])(object)new CardMetaCategory[2]
			{
				default(CardMetaCategory),
				(CardMetaCategory)1
			}), (Texture[])(object)new Texture[1] { (Texture)imageAsTexture }), (Tribe[])(object)new Tribe[1] { (Tribe)2 }), "garethmod_oxpecker.png"), "garethmod_oxpecker_emission.png"), "garethmod_oxpecker_pixel.png");
			CardManager.Add("Garethmod", val8);
			CardInfo val9 = CardExtensions.SetPixelPortrait(CardExtensions.SetEmissivePortrait(CardExtensions.SetPortrait(CardExtensions.AddDecal(CardExtensions.AddMetaCategories(CardExtensions.AddAbilities(CardExtensions.SetCost(CardManager.New("Garethmod", "Elephant", "Elephant", 2, 8, "The sturdy elephant. Friendly but not weak."), (int?)3, (int?)0, (int?)0, (List<GemType>)null), (Ability[])(object)new Ability[2]
			{
				(Ability)(int)Garethmod_TastyMorsel.ability,
				(Ability)8
			}), (CardMetaCategory[])(object)new CardMetaCategory[2]
			{
				default(CardMetaCategory),
				(CardMetaCategory)1
			}), (Texture[])(object)new Texture[1] { (Texture)imageAsTexture }), "garethmod_elephant.png"), "garethmod_elephant_emission.png"), "garethmod_elephant_pixel.png");
			CardManager.Add("Garethmod", val9);
			CardInfo obj2 = CardManager.New("Garethmod", "Hyena", "Hyena", 1, 2, "The cackling hyena. It always has an ally lurking in the shadows.");
			num = 3;
			CardInfo val10 = CardExtensions.SetPixelPortrait(CardExtensions.SetEmissivePortrait(CardExtensions.SetPortrait(CardExtensions.AddTribes(CardExtensions.AddDecal(CardExtensions.AddMetaCategories(CardExtensions.AddAbilities(CardExtensions.SetCost(obj2, (int?)0, num, (int?)0, (List<GemType>)null), (Ability[])(object)new Ability[1] { (Ability)(int)Garethmod_DrawAlly.ability }), (CardMetaCategory[])(object)new CardMetaCategory[2]
			{
				default(CardMetaCategory),
				(CardMetaCategory)1
			}), (Texture[])(object)new Texture[1] { (Texture)imageAsTexture }), (Tribe[])(object)new Tribe[1] { (Tribe)3 }), "garethmod_hyena.png"), "garethmod_hyena_emission.png"), "garethmod_hyena_pixel.png");
			CardManager.Add("Garethmod", val10);
			CardInfo val11 = CardExtensions.SetPixelPortrait(CardExtensions.SetEmissivePortrait(CardExtensions.SetPortrait(CardExtensions.AddDecal(CardExtensions.AddMetaCategories(CardExtensions.AddAbilities(CardExtensions.SetCost(CardManager.New("Garethmod", "Panther", "Panther", 2, 3, "The aggressive panther. Never one to back down from a fight."), (int?)2, (int?)0, (int?)0, (List<GemType>)null), (Ability[])(object)new Ability[1] { (Ability)(int)Garethmod_Standoffish.ability }), (CardMetaCategory[])(object)new CardMetaCategory[2]
			{
				default(CardMetaCategory),
				(CardMetaCategory)1
			}), (Texture[])(object)new Texture[1] { (Texture)imageAsTexture }), "garethmod_panther.png"), "garethmod_panther_emission.png"), "garethmod_panther_pixel.png");
			CardManager.Add("Garethmod", val11);
			CardInfo val12 = CardExtensions.SetEvolve(CardExtensions.SetPixelPortrait(CardExtensions.SetEmissivePortrait(CardExtensions.SetPortrait(CardExtensions.AddDecal(CardExtensions.AddMetaCategories(CardExtensions.AddAbilities(CardExtensions.SetCost(CardManager.New("Garethmod", "PantherCub", "Panther Cub", 0, 1, "The young panther. Even now its caution is unwavering"), (int?)1, (int?)0, (int?)0, (List<GemType>)null), (Ability[])(object)new Ability[2]
			{
				(Ability)(int)Garethmod_Standoffish.ability,
				(Ability)5
			}), (CardMetaCategory[])(object)new CardMetaCategory[2]
			{
				default(CardMetaCategory),
				(CardMetaCategory)1
			}), (Texture[])(object)new Texture[1] { (Texture)imageAsTexture }), "garethmod_panthercub.png"), "garethmod_panthercub_emission.png"), "garethmod_panthercub_pixel.png"), val11, 1, (IEnumerable<CardModificationInfo>)null);
			CardManager.Add("Garethmod", val12);
			CardInfo val13 = CardExtensions.SetPixelPortrait(CardExtensions.SetEmissivePortrait(CardExtensions.SetPortrait(CardExtensions.AddDecal(CardExtensions.AddMetaCategories(CardExtensions.AddAbilities(CardExtensions.SetCost(CardManager.New("Garethmod", "TasmanianDevil", "Tasmanian Devil", 1, 4, "The vicious Tasmanian devil. A fierce carnivore with a voracious appetite."), (int?)2, (int?)0, (int?)0, (List<GemType>)null), (Ability[])(object)new Ability[2]
			{
				(Ability)(int)Garethmod_Standoffish.ability,
				(Ability)18
			}), (CardMetaCategory[])(object)new CardMetaCategory[2]
			{
				default(CardMetaCategory),
				(CardMetaCategory)1
			}), (Texture[])(object)new Texture[1] { (Texture)imageAsTexture }), "garethmod_tasmaniandevil.png"), "garethmod_tasmaniandevil_emission.png"), "garethmod_tasmaniandevil_pixel.png");
			CardManager.Add("Garethmod", val13);
			CardInfo val14 = CardExtensions.SetPixelPortrait(CardExtensions.SetEmissivePortrait(CardExtensions.SetPortrait(CardExtensions.AddDecal(CardExtensions.AddMetaCategories(CardExtensions.AddAbilities(CardExtensions.SetCost(CardManager.New("Garethmod", "Archerfish", "Archerfish", 2, 1, "The archerfish, an excellent marksman, known to shoot bugs out of the air with a blast of water."), (int?)2, (int?)0, (int?)0, (List<GemType>)null), (Ability[])(object)new Ability[2]
			{
				(Ability)13,
				(Ability)53
			}), (CardMetaCategory[])(object)new CardMetaCategory[2]
			{
				default(CardMetaCategory),
				(CardMetaCategory)1
			}), (Texture[])(object)new Texture[1] { (Texture)imageAsTexture }), "garethmod_archerfish.png"), "garethmod_archerfish_emission.png"), "garethmod_archerfish_pixel.png");
			CardManager.Add("Garethmod", val14);
			CardInfo val15 = CardExtensions.SetPixelPortrait(CardExtensions.SetEmissivePortrait(CardExtensions.SetPortrait(CardExtensions.AddDecal(CardExtensions.AddMetaCategories(CardExtensions.AddAbilities(CardExtensions.AddTribes(CardExtensions.SetCost(CardManager.New("Garethmod", "HerculesBeetle", "Hercules Beetle", 0, 4, "The forceful Hercules beetle. It can move creatures many times its size."), (int?)1, (int?)0, (int?)0, (List<GemType>)null), (Tribe[])(object)new Tribe[1] { (Tribe)6 }), (Ability[])(object)new Ability[1] { (Ability)(int)Garethmod_Shove.ability }), (CardMetaCategory[])(object)new CardMetaCategory[2]
			{
				default(CardMetaCategory),
				(CardMetaCategory)1
			}), (Texture[])(object)new Texture[1] { (Texture)imageAsTexture }), "garethmod_herculesbeetle.png"), "garethmod_herculesbeetle_emission.png"), "garethmod_herculesbeetle_pixel.png");
			CardManager.Add("Garethmod", val15);
			CardInfo val16 = CardExtensions.SetPixelPortrait(CardExtensions.SetEmissivePortrait(CardExtensions.SetPortrait(CardExtensions.AddDecal(CardExtensions.AddAppearances(CardExtensions.AddMetaCategories(CardExtensions.AddAbilities(CardExtensions.SetCost(CardManager.New("Garethmod", "Golem", "Golem", 0, 1, "An ancient golem. The magic that binds it is old but powerful. It will reform after death."), (int?)1, (int?)0, (int?)0, (List<GemType>)null), (Ability[])(object)new Ability[2]
			{
				(Ability)(int)Garethmod_Shove.ability,
				(Ability)14
			}), (CardMetaCategory[])(object)new CardMetaCategory[1] { (CardMetaCategory)3 }), (Appearance[])(object)new Appearance[1] { (Appearance)7 }), (Texture[])(object)new Texture[1] { (Texture)imageAsTexture }), "garethmod_golem.png"), "garethmod_golem_emission.png"), "garethmod_golem_pixel.png");
			CardManager.Add("Garethmod", val16);
			CardInfo val17 = CardExtensions.SetPixelPortrait(CardExtensions.SetEmissivePortrait(CardExtensions.SetPortrait(CardExtensions.AddDecal(CardExtensions.AddMetaCategories(CardExtensions.AddAbilities(CardExtensions.SetCost(CardManager.New("Garethmod", "Lion", "Lion", 3, 5, "The awe-inspiring lion. Sure to lead your creatures to victory."), (int?)3, (int?)0, (int?)0, (List<GemType>)null), (Ability[])(object)new Ability[1] { (Ability)34 }), (CardMetaCategory[])(object)new CardMetaCategory[2]
			{
				default(CardMetaCategory),
				(CardMetaCategory)1
			}), (Texture[])(object)new Texture[1] { (Texture)imageAsTexture }), "garethmod_lion.png"), "garethmod_lion_emission.png"), "garethmod_lion_pixel.png");
			CardManager.Add("Garethmod", val17);
			CardInfo val18 = CardExtensions.SetPixelPortrait(CardExtensions.SetEmissivePortrait(CardExtensions.SetPortrait(CardExtensions.SetEvolve(CardExtensions.AddDecal(CardExtensions.AddAbilities(CardExtensions.SetCost(CardManager.New("Garethmod", "YoungLion", "Juvenile Lion", 1, 3, "How did this creature get here?"), (int?)2, (int?)0, (int?)0, (List<GemType>)null), (Ability[])(object)new Ability[1] { (Ability)5 }), (Texture[])(object)new Texture[1] { (Texture)imageAsTexture }), val17, 1, (IEnumerable<CardModificationInfo>)null), "garethmod_younglion.png"), "garethmod_younglion_emission.png"), "garethmod_younglion_pixel.png");
			CardManager.Add("Garethmod", val18);
			CardInfo val19 = CardExtensions.SetPixelPortrait(CardExtensions.SetEmissivePortrait(CardExtensions.SetPortrait(CardExtensions.AddDecal(CardExtensions.AddMetaCategories(CardExtensions.SetEvolve(CardExtensions.AddAbilities(CardExtensions.SetCost(CardManager.New("Garethmod", "LionCub", "Lion Cub", 1, 1, "The princely lion cub. Given time it will become the king of its pride."), (int?)1, (int?)0, (int?)0, (List<GemType>)null), (Ability[])(object)new Ability[1] { (Ability)5 }), val18, 1, (IEnumerable<CardModificationInfo>)null), (CardMetaCategory[])(object)new CardMetaCategory[2]
			{
				default(CardMetaCategory),
				(CardMetaCategory)1
			}), (Texture[])(object)new Texture[1] { (Texture)imageAsTexture }), "garethmod_lioncub.png"), "garethmod_lioncub_emission.png"), "garethmod_lioncub_pixel.png");
			CardManager.Add("Garethmod", val19);
			CardInfo obj3 = CardManager.New("Garethmod", "Piranha", "Piranha", 1, 1, "The ferocious piranha. Schools can devour any living thing in seconds.");
			num = 3;
			CardInfo val20 = CardExtensions.SetPixelPortrait(CardExtensions.SetEmissivePortrait(CardExtensions.SetPortrait(CardExtensions.AddDecal(CardExtensions.AddMetaCategories(CardExtensions.AddAbilities(CardExtensions.SetCost(obj3, (int?)0, num, (int?)0, (List<GemType>)null), (Ability[])(object)new Ability[2]
			{
				(Ability)(int)Garethmod_Hungry.ability,
				(Ability)13
			}), (CardMetaCategory[])(object)new CardMetaCategory[2]
			{
				default(CardMetaCategory),
				(CardMetaCategory)1
			}), (Texture[])(object)new Texture[1] { (Texture)imageAsTexture }), "garethmod_piranha.png"), "garethmod_piranha_emission.png"), "garethmod_piranha_pixel.png");
			CardManager.Add("Garethmod", val20);
			CardInfo val21 = CardExtensions.SetPixelPortrait(CardExtensions.SetEmissivePortrait(CardExtensions.SetPortrait(CardExtensions.AddDecal(CardExtensions.AddMetaCategories(CardExtensions.AddAbilities(CardExtensions.SetCost(CardManager.New("Garethmod", "Leopard", "Leopard", 2, 3, "The stealthy leopard. Invisible to its prey until it's too late."), (int?)2, (int?)0, (int?)0, (List<GemType>)null), (Ability[])(object)new Ability[1] { (Ability)(int)Garethmod_Hungry.ability }), (CardMetaCategory[])(object)new CardMetaCategory[2]
			{
				default(CardMetaCategory),
				(CardMetaCategory)1
			}), (Texture[])(object)new Texture[1] { (Texture)imageAsTexture }), "garethmod_leopard.png"), "garethmod_leopard_emission.png"), "garethmod_leopard_pixel.png");
			CardManager.Add("Garethmod", val21);
			CardInfo val22 = CardExtensions.SetEmissivePortrait(CardExtensions.SetPortrait(CardExtensions.AddTribes(CardExtensions.AddDecal(CardExtensions.AddMetaCategories(CardExtensions.AddAbilities(CardExtensions.SetCost(CardManager.New("Garethmod", "KillerBees", "Killer Bee Swarm", 1, 1, "The vicious killer bee. The more one fights the more will swarm."), (int?)1, (int?)0, (int?)0, (List<GemType>)null), (Ability[])(object)new Ability[2]
			{
				(Ability)(int)Garethmod_Hungry.ability,
				(Ability)2
			}), (CardMetaCategory[])(object)new CardMetaCategory[2]
			{
				default(CardMetaCategory),
				(CardMetaCategory)1
			}), (Texture[])(object)new Texture[1] { (Texture)imageAsTexture }), (Tribe[])(object)new Tribe[1] { (Tribe)6 }), "garethmod_killerbees.png"), "garethmod_killerbees_emission.png");
			CardManager.Add("Garethmod", val22);
			CardInfo val23 = CardExtensions.SetEmissivePortrait(CardExtensions.SetPixelPortrait(CardExtensions.SetAltPortrait(CardExtensions.SetPortrait(CardExtensions.AddDecal(CardExtensions.AddAppearances(CardExtensions.AddTribes(CardExtensions.AddMetaCategories(CardExtensions.AddAbilities(CardExtensions.SetCost(CardManager.New("Garethmod", "Pig", "Pig", 1, 2, "The ravenous pig. Its hunger is insatiable, it will eat and eat until nothing remains."), (int?)1, (int?)0, (int?)0, (List<GemType>)null), (Ability[])(object)new Ability[1] { (Ability)(int)Garethmod_Hungry.ability }), (CardMetaCategory[])(object)new CardMetaCategory[1] { (CardMetaCategory)3 }), (Tribe[])(object)new Tribe[1] { (Tribe)4 }), (Appearance[])(object)new Appearance[1] { (Appearance)7 }), (Texture[])(object)new Texture[1] { (Texture)imageAsTexture }), "garethmod_pig.png"), "garethmod_pig_alt.png"), "garethmod_pig_pixel.png"), "garethmod_pig_emission.png");
			CardManager.Add("Garethmod", val23);
			CardInfo val24 = CardExtensions.SetEmissivePortrait(CardExtensions.SetPortrait(CardExtensions.AddDecal(CardExtensions.AddMetaCategories(CardExtensions.AddAbilities(CardExtensions.SetCost(CardManager.New("Garethmod", "Badger", "Badger", 2, 3, "The bothersome badger. Quick to strike and retreat back into the shadows."), (int?)2, (int?)0, (int?)0, (List<GemType>)null), (Ability[])(object)new Ability[1] { (Ability)(int)Garethmod_Flighty.ability }), (CardMetaCategory[])(object)new CardMetaCategory[2]
			{
				default(CardMetaCategory),
				(CardMetaCategory)1
			}), (Texture[])(object)new Texture[1] { (Texture)imageAsTexture }), "garethmod_badger.png"), "garethmod_badger_emission.png");
			CardManager.Add("Garethmod", val24);
			CardInfo val25 = CardExtensions.SetEmissivePortrait(CardExtensions.SetPortrait(CardExtensions.AddDecal(CardExtensions.AddMetaCategories(CardExtensions.AddAbilities(CardExtensions.SetCost(CardManager.New("Garethmod", "Bobcat", "Bobcat", 1, 2, "The wily bobcat. Unafraid to defend its territory but smart enough to know when to retreat."), (int?)1, (int?)0, (int?)0, (List<GemType>)null), (Ability[])(object)new Ability[2]
			{
				(Ability)(int)Garethmod_Standoffish.ability,
				(Ability)(int)Garethmod_Flighty.ability
			}), (CardMetaCategory[])(object)new CardMetaCategory[2]
			{
				default(CardMetaCategory),
				(CardMetaCategory)1
			}), (Texture[])(object)new Texture[1] { (Texture)imageAsTexture }), "garethmod_bobcat.png"), "garethmod_bobcat_emission.png");
			CardManager.Add("Garethmod", val25);
			CardInfo obj4 = CardManager.New("Garethmod", "Dragonfly", "Dragonfly", 2, 1, "The hasty dragonfly. Few can hit an insect this fast.");
			num = 6;
			CardInfo val26 = CardExtensions.SetEmissivePortrait(CardExtensions.SetPortrait(CardExtensions.AddTribes(CardExtensions.AddDecal(CardExtensions.AddMetaCategories(CardExtensions.AddAbilities(CardExtensions.SetCost(obj4, (int?)0, num, (int?)0, (List<GemType>)null), (Ability[])(object)new Ability[2]
			{
				(Ability)19,
				(Ability)(int)Garethmod_Flighty.ability
			}), (CardMetaCategory[])(object)new CardMetaCategory[2]
			{
				default(CardMetaCategory),
				(CardMetaCategory)1
			}), (Texture[])(object)new Texture[1] { (Texture)imageAsTexture }), (Tribe[])(object)new Tribe[1] { (Tribe)6 }), "garethmod_dragonfly.png"), "garethmod_dragonfly_emission.png");
			CardManager.Add("Garethmod", val26);
			StarterDeckInfo val27 = ScriptableObject.CreateInstance<StarterDeckInfo>();
			val27.title = "GarethSkinwalkerDeck";
			val27.iconSprite = TextureHelper.GetImageAsSprite("garethmod_deck_skinwalker_icon.png", (SpriteType)9, (FilterMode)0);
			val27.cards = new List<CardInfo> { val2, val2 };
			StarterDeckInfo val28 = ScriptableObject.CreateInstance<StarterDeckInfo>();
			val28.title = "GarethEvolveDeck";
			val28.iconSprite = TextureHelper.GetImageAsSprite("garethmod_deck_evolve_icon.png", (SpriteType)9, (FilterMode)0);
			val28.cards = new List<CardInfo> { val12, val19, val7 };
			StarterDeckManager.Add("gareth48.inscryption.garethmod", val27, 0);
			StarterDeckManager.Add("gareth48.inscryption.garethmod", val28, 0);
		}

		private void AddDrawAlly()
		{
			//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_005a: Expected O, but got Unknown
			//IL_0063: Unknown result type (might be due to invalid IL or missing references)
			//IL_006d: Expected O, but got Unknown
			//IL_006d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0072: Unknown result type (might be due to invalid IL or missing references)
			AbilityInfo obj = AbilityManager.New("gareth48.inscryption.garethmod.drawally", "Allies", "When a creature bearing this sigil dies, a random ally will temporarily join your hand to avenge it.", typeof(Garethmod_DrawAlly), "garethmod_drawally.png");
			obj.powerLevel = 2;
			obj.metaCategories = new List<AbilityMetaCategory>
			{
				(AbilityMetaCategory)0,
				(AbilityMetaCategory)1
			};
			List<Line> list = new List<Line>();
			Line item = new Line
			{
				text = "It seems a creature has come to avenge the passing of its ally."
			};
			list.Add(item);
			obj.abilityLearnedDialogue = new LineSet(list);
			Garethmod_DrawAlly.ability = obj.ability;
		}

		private void AddIdentityTheft()
		{
			//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_005a: Expected O, but got Unknown
			//IL_0063: Unknown result type (might be due to invalid IL or missing references)
			//IL_006d: Expected O, but got Unknown
			//IL_006d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0072: Unknown result type (might be due to invalid IL or missing references)
			AbilityInfo obj = AbilityManager.New("gareth48.inscryption.garethmod.identitytheft", "Essence Steal", "When a creature bearing this sigil kills another, it transforms into an exact copy of it.", typeof(Garethmod_IdentityTheft), "garethmod_identitytheft.png");
			obj.powerLevel = 3;
			obj.metaCategories = new List<AbilityMetaCategory>
			{
				(AbilityMetaCategory)0,
				(AbilityMetaCategory)1
			};
			List<Line> list = new List<Line>();
			Line item = new Line
			{
				text = "Your creature has slain mine, and will now become an imitation of it."
			};
			list.Add(item);
			obj.abilityLearnedDialogue = new LineSet(list);
			Garethmod_IdentityTheft.ability = obj.ability;
		}

		private void AddFlighty()
		{
			//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_005a: Expected O, but got Unknown
			//IL_0063: Unknown result type (might be due to invalid IL or missing references)
			//IL_006d: Expected O, but got Unknown
			//IL_006d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0072: Unknown result type (might be due to invalid IL or missing references)
			AbilityInfo obj = AbilityManager.New("gareth48.inscryption.garethmod.flighty", "Flighty", "After a creature bearing this sigil attacks the user chooses a space. The creature will move to that space.", typeof(Garethmod_Flighty), "garethmod_flighty.png");
			obj.powerLevel = 2;
			obj.metaCategories = new List<AbilityMetaCategory>
			{
				(AbilityMetaCategory)0,
				(AbilityMetaCategory)1
			};
			List<Line> list = new List<Line>();
			Line item = new Line
			{
				text = "It retreated after it struck, perhaps it's regathering its strength for another strike."
			};
			list.Add(item);
			obj.abilityLearnedDialogue = new LineSet(list);
			Garethmod_Flighty.ability = obj.ability;
		}

		private void AddHungry()
		{
			//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_005a: Expected O, but got Unknown
			//IL_0063: Unknown result type (might be due to invalid IL or missing references)
			//IL_006d: Expected O, but got Unknown
			//IL_006d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0072: Unknown result type (might be due to invalid IL or missing references)
			AbilityInfo obj = AbilityManager.New("gareth48.inscryption.garethmod.hungry", "Hungry", "When a creature bearing this sigil is played, choose another friendly creature to eat. The eaten creature will have its health and power added to the creature bearing this sigil.", typeof(Garethmod_Hungry), "garethmod_hungry.png");
			obj.powerLevel = 2;
			obj.metaCategories = new List<AbilityMetaCategory>
			{
				(AbilityMetaCategory)0,
				(AbilityMetaCategory)1
			};
			List<Line> list = new List<Line>();
			Line item = new Line
			{
				text = "It seems eating another creature has caused yours to grow stronger."
			};
			list.Add(item);
			obj.abilityLearnedDialogue = new LineSet(list);
			Garethmod_Hungry.ability = obj.ability;
		}

		private void AddShove()
		{
			//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_0061: Expected O, but got Unknown
			//IL_006a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0074: Expected O, but got Unknown
			//IL_0074: Unknown result type (might be due to invalid IL or missing references)
			//IL_0079: Unknown result type (might be due to invalid IL or missing references)
			AbilityInfo obj = AbilityManager.New("gareth48.inscryption.garethmod.shove", "Shove", "When a creature bearing this sigil is played, it will move up to the space opposing it. Creatures that are in the way will be pushed in the same direction.", typeof(Garethmod_Shove), "garethmod_shove.png");
			obj.powerLevel = -1;
			obj.opponentUsable = false;
			obj.metaCategories = new List<AbilityMetaCategory>
			{
				(AbilityMetaCategory)0,
				(AbilityMetaCategory)1
			};
			List<Line> list = new List<Line>();
			Line item = new Line
			{
				text = "You have such fickle allies."
			};
			list.Add(item);
			obj.abilityLearnedDialogue = new LineSet(list);
			Garethmod_Shove.ability = obj.ability;
		}

		private void AddStandoffish()
		{
			//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_005a: Expected O, but got Unknown
			//IL_0063: Unknown result type (might be due to invalid IL or missing references)
			//IL_006d: Expected O, but got Unknown
			//IL_006d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0072: Unknown result type (might be due to invalid IL or missing references)
			AbilityInfo obj = AbilityManager.New("gareth48.inscryption.garethmod.standoffish", "Standoffish", "As long as a creature bearing this sigil is opposed by another, it has +2 attack.", typeof(Garethmod_Standoffish), "garethmod_standoffish.png");
			obj.powerLevel = 3;
			obj.metaCategories = new List<AbilityMetaCategory>
			{
				(AbilityMetaCategory)0,
				(AbilityMetaCategory)1
			};
			List<Line> list = new List<Line>();
			Line item = new Line
			{
				text = "Your creature will fight with all it has until none oppose it."
			};
			list.Add(item);
			obj.abilityLearnedDialogue = new LineSet(list);
			Garethmod_Standoffish.ability = obj.ability;
		}

		private void AddTastyMorsel()
		{
			//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_005a: Expected O, but got Unknown
			//IL_0063: Unknown result type (might be due to invalid IL or missing references)
			//IL_006d: Expected O, but got Unknown
			//IL_006d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0072: Unknown result type (might be due to invalid IL or missing references)
			AbilityInfo obj = AbilityManager.New("gareth48.inscryption.garethmod.tastymorsel", "Tasty", "When a creature bearing this sigil dies, a random creature shows up to devour it.", typeof(Garethmod_TastyMorsel), "garethmod_tastymorsel.png");
			obj.powerLevel = 3;
			obj.metaCategories = new List<AbilityMetaCategory>
			{
				(AbilityMetaCategory)0,
				(AbilityMetaCategory)1
			};
			List<Line> list = new List<Line>();
			Line item = new Line
			{
				text = "It seems that another animal has come to feed. The cycle of life continues."
			};
			list.Add(item);
			obj.abilityLearnedDialogue = new LineSet(list);
			Garethmod_TastyMorsel.ability = obj.ability;
		}
	}
	public class Garethmod_DrawAlly : DrawCreatedCard
	{
		public static Ability ability;

		public override Ability Ability => ability;

		public override CardInfo CardToDraw
		{
			get
			{
				List<CardInfo> list = ScriptableObjectLoader<CardInfo>.AllData.FindAll((CardInfo x) => x.metaCategories.Contains((CardMetaCategory)0) && ((object)(CardTemple)(ref x.temple)).Equals((object)(CardTemple)0) && !((Object)x).name.Equals("!STATIC!GLITCH"));
				list.Add(CardLoader.GetCardByName("Squirrel"));
				return list[SeededRandom.Range(0, list.Count, ((TriggerReceiver)this).GetRandomSeed())];
			}
		}

		public override bool RespondsToDie(bool wasSacrifice, PlayableCard killer)
		{
			return true;
		}

		public override IEnumerator OnDie(bool wasSacrifice, PlayableCard killer)
		{
			yield return ((AbilityBehaviour)this).PreSuccessfulTriggerSequence();
			yield return ((DrawCreatedCard)this).CreateDrawnCard();
			yield return ((AbilityBehaviour)this).LearnAbility(0.5f);
		}
	}
	public class Garethmod_IdentityTheft : AbilityBehaviour
	{
		public static Ability ability;

		public override Ability Ability => ability;

		public override bool RespondsToDealDamage(int amount, PlayableCard target)
		{
			return amount > 0;
		}

		public override IEnumerator OnDealDamage(int amount, PlayableCard target)
		{
			if (target.Health == 0)
			{
				if (((Card)target).Info.traits.Contains((Trait)14) || ((Card)target).Info.traits.Contains((Trait)16))
				{
					yield return ((AbilityBehaviour)this).Card.TransformIntoCard(CardLoader.GetCardByName("Garethmod_Gareth48"), (Action)null, (Action)null);
					((AbilityBehaviour)this).Card.HealDamage(((AbilityBehaviour)this).Card.Status.damageTaken);
				}
				else if (((AbilityBehaviour)this).Card.Health > 0)
				{
					yield return ((AbilityBehaviour)this).PreSuccessfulTriggerSequence();
					yield return (object)new WaitForSeconds(0.5f);
					yield return ((AbilityBehaviour)this).LearnAbility(0.5f);
					CardInfo info = ((Card)target).Info;
					yield return ((AbilityBehaviour)this).Card.TransformIntoCard(info, (Action)null, (Action)null);
					((AbilityBehaviour)this).Card.HealDamage(((AbilityBehaviour)this).Card.Status.damageTaken);
				}
			}
		}
	}
	public class Garethmod_Flighty : AbilityBehaviour
	{
		public static Ability ability;

		public override Ability Ability => ability;

		public override bool RespondsToAttackEnded()
		{
			return true;
		}

		public override IEnumerator OnAttackEnded()
		{
			List<CardSlot> playerSlotsCopy = Singleton<BoardManager>.Instance.PlayerSlotsCopy;
			playerSlotsCopy.RemoveAll((CardSlot x) => (Object)(object)x.Card != (Object)null);
			if (playerSlotsCopy.Count == 1)
			{
				CardSlot selectedSlot = playerSlotsCopy.First();
				yield return ((MonoBehaviour)this).StartCoroutine(MoveToSlot(selectedSlot));
				if ((Object)(object)selectedSlot != (Object)null)
				{
					yield return ((AbilityBehaviour)this).PreSuccessfulTriggerSequence();
					yield return ((AbilityBehaviour)this).LearnAbility(0f);
				}
			}
			else if (playerSlotsCopy.Count > 0)
			{
				Singleton<ViewManager>.Instance.Controller.SwitchToControlMode(Singleton<BoardManager>.Instance.ChoosingSlotViewMode, false);
				Singleton<ViewManager>.Instance.Controller.LockState = (ViewLockState)0;
				CardSlot selectedSlot2 = null;
				List<CardSlot> allSlotsCopy = Singleton<BoardManager>.Instance.AllSlotsCopy;
				allSlotsCopy.Remove(((AbilityBehaviour)this).Card.Slot);
				yield return Singleton<BoardManager>.Instance.ChooseTarget(allSlotsCopy, playerSlotsCopy, (Action<CardSlot>)delegate(CardSlot s)
				{
					selectedSlot2 = s;
				}, (Action<CardSlot>)OnInvalidTargetSelected, (Action<CardSlot>)delegate(CardSlot s)
				{
					_ = (Object)(object)s.Card != (Object)null;
				}, (Func<bool>)null, (CursorType)2);
				yield return ((MonoBehaviour)this).StartCoroutine(MoveToSlot(selectedSlot2));
				if ((Object)(object)selectedSlot2 != (Object)null)
				{
					yield return ((AbilityBehaviour)this).PreSuccessfulTriggerSequence();
					yield return ((AbilityBehaviour)this).LearnAbility(0f);
				}
			}
			else
			{
				((Card)((AbilityBehaviour)this).Card).Anim.StrongNegationEffect();
			}
		}

		protected IEnumerator MoveToSlot(CardSlot destination)
		{
			if ((Object)(object)destination != (Object)null)
			{
				CardSlot oldSlot = ((AbilityBehaviour)this).Card.Slot;
				yield return Singleton<BoardManager>.Instance.AssignCardToSlot(((AbilityBehaviour)this).Card, destination, 0.1f, (Action)null, true);
				yield return PostSuccessfulMoveSequence(oldSlot);
				yield return (object)new WaitForSeconds(0.25f);
			}
			else
			{
				((Card)((AbilityBehaviour)this).Card).Anim.StrongNegationEffect();
				yield return (object)new WaitForSeconds(0.15f);
			}
		}

		protected virtual IEnumerator PostSuccessfulMoveSequence(CardSlot oldSlot)
		{
			yield break;
		}

		protected virtual void OnInvalidTargetSelected(CardSlot targetSlot)
		{
		}
	}
	public class Garethmod_Hungry : AbilityBehaviour
	{
		public static Ability ability;

		public override Ability Ability => ability;

		public override bool RespondsToResolveOnBoard()
		{
			return true;
		}

		public override IEnumerator OnResolveOnBoard()
		{
			Debug.Log((object)((Object)((Card)((AbilityBehaviour)this).Card).Info).name);
			if (((Object)((Card)((AbilityBehaviour)this).Card).Info).name.Equals("Garethmod_Pig"))
			{
				List<CardSlot> allSlotsCopy = Singleton<BoardManager>.Instance.AllSlotsCopy;
				allSlotsCopy.RemoveAll((CardSlot x) => (Object)(object)x.Card == (Object)null || x.Card.Dead || (Object)(object)x.Card == (Object)(object)((AbilityBehaviour)this).Card || x.Card.OpponentCard);
				int healthAdd = 0;
				int attackAdd = 0;
				if (allSlotsCopy.Count <= 0)
				{
					yield break;
				}
				foreach (CardSlot item in allSlotsCopy)
				{
					healthAdd += item.Card.Health - item.Card.GetPassiveHealthBuffs();
					attackAdd += item.Card.Attack - item.Card.GetPassiveAttackBuffs();
					yield return item.Card.Die(false, (PlayableCard)null, true);
					yield return (object)new WaitForSeconds(0.1f);
				}
				CardModificationInfo val = new CardModificationInfo();
				val.nonCopyable = true;
				val.fromCardMerge = true;
				val.singletonId = "carnage";
				val.attackAdjustment = attackAdd;
				val.healthAdjustment = healthAdd;
				((AbilityBehaviour)this).Card.AddTemporaryMod(val);
				yield return ((Card)((AbilityBehaviour)this).Card).Anim.FlipInAir();
				((AbilityBehaviour)this).Card.SwitchToAlternatePortrait();
				yield return (object)new WaitForSeconds(0.75f);
				yield return ((AbilityBehaviour)this).LearnAbility(0f);
				yield break;
			}
			List<CardSlot> allSlotsCopy2 = Singleton<BoardManager>.Instance.AllSlotsCopy;
			allSlotsCopy2.RemoveAll((CardSlot x) => (Object)(object)x.Card == (Object)null || x.Card.Dead || (Object)(object)x.Card == (Object)(object)((AbilityBehaviour)this).Card || x.Card.OpponentCard || ((Card)x.Card).Info.traits.Contains((Trait)12) || ((Card)x.Card).Info.traits.Contains((Trait)13));
			if (allSlotsCopy2.Count > 0)
			{
				CardSlot selectedSlot = null;
				List<CardSlot> allSlotsCopy3 = Singleton<BoardManager>.Instance.AllSlotsCopy;
				allSlotsCopy3.Remove(((AbilityBehaviour)this).Card.Slot);
				yield return Singleton<BoardManager>.Instance.ChooseTarget(allSlotsCopy3, allSlotsCopy2, (Action<CardSlot>)delegate(CardSlot s)
				{
					selectedSlot = s;
				}, (Action<CardSlot>)OnInvalidTargetSelected, (Action<CardSlot>)delegate(CardSlot s)
				{
					_ = (Object)(object)s.Card != (Object)null;
				}, (Func<bool>)null, (CursorType)16);
				CardModificationInfo val2 = new CardModificationInfo();
				val2.nonCopyable = true;
				val2.singletonId = "food";
				val2.attackAdjustment = selectedSlot.Card.Attack - selectedSlot.Card.GetPassiveAttackBuffs();
				val2.healthAdjustment = selectedSlot.Card.Health - selectedSlot.Card.GetPassiveHealthBuffs();
				((AbilityBehaviour)this).Card.AddTemporaryMod(val2);
				yield return selectedSlot.Card.Die(false, (PlayableCard)null, true);
				yield return (object)new WaitForSeconds(0.75f);
				yield return ((AbilityBehaviour)this).LearnAbility(0f);
			}
		}

		protected virtual void OnInvalidTargetSelected(CardSlot targetSlot)
		{
		}
	}
	public class Garethmod_Shove : AbilityBehaviour
	{
		public static Ability ability;

		public override Ability Ability => ability;

		public override bool RespondsToResolveOnBoard()
		{
			return true;
		}

		public override IEnumerator OnResolveOnBoard()
		{
			if (!((AbilityBehaviour)this).Card.slot.IsPlayerSlot)
			{
				yield break;
			}
			bool isntCuttable = true;
			CardSlot mySlot = ((AbilityBehaviour)this).Card.Slot;
			yield return ((AbilityBehaviour)this).PreSuccessfulTriggerSequence();
			yield return (object)new WaitForSeconds(0.25f);
			if ((Object)(object)mySlot.opposingSlot.Card != (Object)null)
			{
				if (!((Card)((AbilityBehaviour)this).Card.Slot.opposingSlot.Card).Info.traits.Contains((Trait)14))
				{
					yield return Singleton<TurnManager>.Instance.Opponent.ReturnCardToQueue(mySlot.opposingSlot.Card, 0.25f);
				}
				else
				{
					isntCuttable = false;
				}
			}
			if (isntCuttable)
			{
				mySlot.Card.SetIsOpponentCard(true);
				Transform transform = ((Component)mySlot.Card).transform;
				transform.eulerAngles += new Vector3(0f, 0f, -180f);
				CardSlot val = mySlot;
				yield return Singleton<BoardManager>.Instance.AssignCardToSlot(val.Card, val.opposingSlot, 0.25f, (Action)null, true);
				yield return (object)new WaitForSeconds(0.4f);
				yield return ((AbilityBehaviour)this).LearnAbility(0.5f);
			}
		}
	}
	public class Garethmod_Standoffish : AbilityBehaviour
	{
		public static Ability ability;

		private CardModificationInfo mod;

		public override Ability Ability => ability;

		private void Start()
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_000b: Expected O, but got Unknown
			mod = new CardModificationInfo();
			mod.nonCopyable = true;
			mod.singletonId = "enraged";
			mod.attackAdjustment = 0;
			((AbilityBehaviour)this).Card.AddTemporaryMod(mod);
		}

		public override bool RespondsToResolveOnBoard()
		{
			return true;
		}

		public override bool RespondsToOtherCardAssignedToSlot(PlayableCard otherCard)
		{
			return RespondsToTrigger(otherCard);
		}

		public bool RespondsToTrigger(PlayableCard otherCard)
		{
			if (!((AbilityBehaviour)this).Card.Dead && !otherCard.Dead)
			{
				return (Object)(object)otherCard.Slot == (Object)(object)((AbilityBehaviour)this).Card.Slot.opposingSlot;
			}
			return false;
		}

		public override bool RespondsToUpkeep(bool playerUpkeep)
		{
			return true;
		}

		public override IEnumerator OnUpkeep(bool playerUpkeep)
		{
			int current = mod.attackAdjustment;
			if ((Object)(object)((AbilityBehaviour)this).Card.Slot.opposingSlot.Card != (Object)null)
			{
				yield return ((AbilityBehaviour)this).PreSuccessfulTriggerSequence();
				mod.attackAdjustment = 2;
				((AbilityBehaviour)this).Card.OnStatsChanged();
				yield return ((AbilityBehaviour)this).LearnAbility(0.5f);
			}
			else
			{
				yield return ((AbilityBehaviour)this).PreSuccessfulTriggerSequence();
				mod.attackAdjustment = 0;
				((AbilityBehaviour)this).Card.OnStatsChanged();
			}
			if (mod.attackAdjustment != current)
			{
				((Card)((AbilityBehaviour)this).Card).Anim.StrongNegationEffect();
			}
		}

		public override IEnumerator OnResolveOnBoard()
		{
			if ((Object)(object)((AbilityBehaviour)this).Card.Slot.opposingSlot.Card != (Object)null)
			{
				yield return ((AbilityBehaviour)this).PreSuccessfulTriggerSequence();
				mod.attackAdjustment = 2;
				((AbilityBehaviour)this).Card.OnStatsChanged();
				((Card)((AbilityBehaviour)this).Card).Anim.StrongNegationEffect();
				yield return ((AbilityBehaviour)this).LearnAbility(0.5f);
			}
		}

		public override IEnumerator OnOtherCardAssignedToSlot(PlayableCard otherCard)
		{
			if ((Object)(object)((AbilityBehaviour)this).Card.Slot.opposingSlot.Card != (Object)null)
			{
				yield return ((AbilityBehaviour)this).PreSuccessfulTriggerSequence();
				mod.attackAdjustment = 2;
				((AbilityBehaviour)this).Card.OnStatsChanged();
				((Card)((AbilityBehaviour)this).Card).Anim.StrongNegationEffect();
				yield return ((AbilityBehaviour)this).LearnAbility(0.5f);
			}
		}
	}
	public class Garethmod_TastyMorsel : AbilityBehaviour
	{
		public static Ability ability;

		public override Ability Ability => ability;

		public override bool RespondsToDie(bool wasSacrifice, PlayableCard killer)
		{
			if (!wasSacrifice)
			{
				return ((AbilityBehaviour)this).Card.OnBoard;
			}
			return false;
		}

		public override IEnumerator OnDie(bool wasSacrifice, PlayableCard killer)
		{
			yield return ((AbilityBehaviour)this).PreSuccessfulTriggerSequence();
			yield return (object)new WaitForSeconds(0.3f);
			List<string> list = new List<string>
			{
				"Adder", "Alpha", "Shark", "Bat", "Bee", "Bloodhound", "Bullfrog", "Cat", "Cockroach", "Coyote",
				"Elk", "ElkCub", "FieldMouse", "Grizzly", "Kingfisher", "Maggots", "Magpie", "Mantis", "Mole", "Moose",
				"Porcupine", "Pronghorn", "RatKing", "Rattler", "Raven", "Skink", "Skunk", "Snapper", "Squirrel", "Vulture",
				"Wolf", "WolfCub"
			};
			((Object)this).name = list[SeededRandom.Range(0, list.Count, ((TriggerReceiver)this).GetRandomSeed())];
			yield return Singleton<BoardManager>.Instance.CreateCardInSlot(CardLoader.GetCardByName(((Object)this).name), ((AbilityBehaviour)this).Card.Slot, 0.15f, true);
			yield return ((AbilityBehaviour)this).LearnAbility(0.5f);
		}
	}
	public static class PluginInfo
	{
		public const string PLUGIN_GUID = "GarethMod";

		public const string PLUGIN_NAME = "GarethMod";

		public const string PLUGIN_VERSION = "2.0.0";
	}
}

plugins/Infiniscryption-Achievements/plugins/Infiniscryption.Achievements.dll

Decompiled 5 months ago
using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using BepInEx;
using BepInEx.Logging;
using DiskCardGame;
using GBC;
using HarmonyLib;
using InscryptionAPI.Ascension;
using InscryptionAPI.Guid;
using InscryptionAPI.Helpers;
using InscryptionAPI.Sound;
using Pixelplacement;
using UnityEngine;
using UnityEngine.SceneManagement;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: TargetFramework(".NETStandard,Version=v2.0", FrameworkDisplayName = "")]
[assembly: AssemblyCompany("Infiniscryption.Achievements")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyDescription("Infinite Inscryption - Achievements")]
[assembly: AssemblyFileVersion("1.0.2.0")]
[assembly: AssemblyInformationalVersion("1.0.2")]
[assembly: AssemblyProduct("Infiniscryption.Achievements")]
[assembly: AssemblyTitle("Infiniscryption.Achievements")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.2.0")]
[module: UnverifiableCode]
namespace Infiniscryption.Achievements;

[BepInPlugin("zorro.inscryption.infiniscryption.achievements", "Achievements Plugin", "1.0")]
[BepInDependency(/*Could not decode attribute arguments.*/)]
public class AchievementsPlugin : BaseUnityPlugin
{
	public const string PluginGuid = "zorro.inscryption.infiniscryption.achievements";

	public const string PluginName = "Achievements Plugin";

	internal const string PluginVersion = "1.0";

	internal static ManualLogSource Log;

	private void Awake()
	{
		//IL_0019: Unknown result type (might be due to invalid IL or missing references)
		//IL_001f: Expected O, but got Unknown
		Log = ((BaseUnityPlugin)this).Logger;
		ModdedAchievementManager.AchievementById((Achievement)30);
		Harmony val = new Harmony("zorro.inscryption.infiniscryption.achievements");
		SceneManager.sceneLoaded += OnSceneLoaded;
		val.PatchAll();
		((BaseUnityPlugin)this).Logger.LogInfo((object)"Plugin Achievements Plugin is loaded!");
	}

	private void OnSceneLoaded(Scene scene, LoadSceneMode mode)
	{
		Log.LogDebug((object)("Scene loaded " + ((Scene)(ref scene)).name + ". Initializing achievement popup handler"));
		AchievementPopupHandler.Initialize(((Scene)(ref scene)).name);
	}
}
[HarmonyPatch]
public class AchievementPopupHandler : ManagedBehaviour
{
	public const float POPUP_TIMER = 5f;

	private List<Achievement> showQueue = new List<Achievement>();

	private AchievementBadge PopupBadge;

	public static AchievementPopupHandler Instance { get; private set; }

	public void TryShowUnlockAchievement(Achievement id)
	{
		//IL_000e: 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_0016: Unknown result type (might be due to invalid IL or missing references)
		//IL_0022: Unknown result type (might be due to invalid IL or missing references)
		//IL_0076: Unknown result type (might be due to invalid IL or missing references)
		//IL_0092: Unknown result type (might be due to invalid IL or missing references)
		//IL_0101: Unknown result type (might be due to invalid IL or missing references)
		//IL_005b: Unknown result type (might be due to invalid IL or missing references)
		ModdedAchievementManager.AchievementDefinition achievementDefinition = ModdedAchievementManager.AchievementById(id);
		ModdedAchievementManager.AchievementGroupDefinition achievementGroupDefinition = ModdedAchievementManager.GroupByAchievementId(id);
		if ((Object)(object)achievementDefinition.IconSprite == (Object)null)
		{
			return;
		}
		if (((Component)this).gameObject.activeSelf)
		{
			showQueue.Add(id);
			return;
		}
		AchievementsPlugin.Log.LogDebug((object)$"Showing achievement popup for {id}");
		PopupBadge.ToastAchievement(id);
		((Component)this).gameObject.SetActive(true);
		Tween.Value(-0.3f, 0.4f, (Action<float>)delegate(float v)
		{
			//IL_0016: Unknown result type (might be due to invalid IL or missing references)
			//IL_001b: Unknown result type (might be due to invalid IL or missing references)
			PopupBadge.ViewportPosition.offset = new Vector2(0f, v);
		}, 0.2f, 0f, (AnimationCurve)null, (LoopType)0, (Action)null, (Action)null, true);
		AudioController.Instance.PlaySound2D(achievementGroupDefinition.AudioCue, (MixerGroup)0, 0.75f, 0f, (Pitch)null, (Repetition)null, (Randomization)null, (Distortion)null, false);
		AchievementsPlugin.Log.LogDebug((object)$"Scheduling achievement popup close for {id}");
		CustomCoroutine.WaitThenExecute(5f, (Action)delegate
		{
			//IL_000c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0089: 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)
			AchievementsPlugin.Log.LogDebug((object)$"Closing achievement popup for {id}");
			Tween.Value(0.4f, -0.3f, (Action<float>)delegate(float v)
			{
				//IL_0016: Unknown result type (might be due to invalid IL or missing references)
				//IL_001b: Unknown result type (might be due to invalid IL or missing references)
				PopupBadge.ViewportPosition.offset = new Vector2(0f, v);
			}, 0.2f, 0f, (AnimationCurve)null, (LoopType)0, (Action)null, (Action)delegate
			{
				((Component)this).gameObject.SetActive(false);
			}, true);
			if (showQueue.Count > 0)
			{
				Achievement next = showQueue[0];
				showQueue.RemoveAt(0);
				CustomCoroutine.WaitThenExecute(1f, (Action)delegate
				{
					//IL_000c: Unknown result type (might be due to invalid IL or missing references)
					TryShowUnlockAchievement(next);
				}, false);
			}
		}, false);
	}

	internal static void Initialize(string sceneName)
	{
		//IL_00a2: Unknown result type (might be due to invalid IL or missing references)
		//IL_00c4: Unknown result type (might be due to invalid IL or missing references)
		//IL_00c9: Unknown result type (might be due to invalid IL or missing references)
		try
		{
			GameObject val = null;
			Camera val2 = null;
			Vector3 localScale = default(Vector3);
			((Vector3)(ref localScale))..ctor(2f, 2f, 1f);
			bool flag = sceneName.Equals("Ascension_Configure", StringComparison.InvariantCultureIgnoreCase);
			if (flag)
			{
				val = ((Component)Singleton<AscensionMenuScreens>.Instance).gameObject;
				val2 = Camera.main;
				((Vector3)(ref localScale))..ctor(1f, 1f, 1f);
			}
			else
			{
				val = ((Component)((Component)Singleton<UIManager>.Instance.Canvas).transform.parent).gameObject;
				val2 = val.GetComponent<Camera>();
			}
			AchievementBadge achievementBadge = AchievementBadge.Create(val.transform, val2);
			((Component)achievementBadge).gameObject.transform.localScale = localScale;
			achievementBadge.ViewportPosition.offset = new Vector2(0f, flag ? 0.3f : (-0.3f));
			AchievementPopupHandler achievementPopupHandler = ((Component)achievementBadge).gameObject.AddComponent<AchievementPopupHandler>();
			achievementPopupHandler.PopupBadge = achievementBadge;
			Instance = achievementPopupHandler;
			((Component)achievementBadge).gameObject.SetActive(false);
		}
		catch (Exception ex)
		{
			AchievementsPlugin.Log.LogInfo((object)("Could not create singleton Achievement Popup Handler for scene " + sceneName));
			AchievementsPlugin.Log.LogInfo((object)ex);
		}
	}
}
[HarmonyPatch]
public class AchievementScreen : AscensionRunSetupScreenBase
{
	public static readonly Screen ScreenID = GuidManager.GetEnumValue<Screen>("zorro.inscryption.infiniscryption.achievements", "AchievementsScreen");

	private List<AchievementBadge> Badges = new List<AchievementBadge>();

	private MainInputInteractable leftPageButton = null;

	private MainInputInteractable rightPageButton = null;

	private PixelText pageNumbers = null;

	private List<ModdedAchievementManager.AchievementGroup> AllGroups = new List<ModdedAchievementManager.AchievementGroup>();

	public override string headerText => "Choose Active Packs";

	public override bool showCardDisplayer => false;

	public override bool showCardPanel => false;

	public static AchievementScreen Instance { get; private set; }

	private ModdedAchievementManager.AchievementGroup ActiveGroup => AllGroups[ActiveGroupIndex];

	private int ActiveGroupIndex { get; set; } = 0;


	private int GroupPage { get; set; } = 0;


	internal static AchievementScreen CreateInstance()
	{
		//IL_0077: Unknown result type (might be due to invalid IL or missing references)
		//IL_007e: Expected O, but got Unknown
		//IL_015d: Unknown result type (might be due to invalid IL or missing references)
		//IL_016d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0183: Unknown result type (might be due to invalid IL or missing references)
		//IL_018d: Unknown result type (might be due to invalid IL or missing references)
		if ((Object)(object)Instance != (Object)null)
		{
			Object.DestroyImmediate((Object)(object)((Component)Instance).gameObject);
		}
		Instance = AscensionRunSetupScreenBase.BuildScreen(typeof(AchievementScreen), (Screen)5, (Screen)5) as AchievementScreen;
		GameObject unlockSummaryScreen = Singleton<AscensionMenuScreens>.Instance.unlockSummaryScreen;
		Transform val = unlockSummaryScreen.transform.Find("Stats/ScreenAnchor");
		List<Transform> list = new List<Transform>();
		foreach (Transform item2 in ((Component)val).transform)
		{
			Transform item = item2;
			list.Add(item);
		}
		if (((Component)list[list.Count - 1]).gameObject.GetComponentInChildren<PixelText>().Text.Equals(Localization.Translate("- ACHIEVEMENTS -"), StringComparison.InvariantCultureIgnoreCase))
		{
			((MainInputInteractable)((Component)list[list.Count - 1]).gameObject.GetComponentInChildren<AscensionMenuInteractable>()).CursorSelectStarted = delegate
			{
				//IL_0005: Unknown result type (might be due to invalid IL or missing references)
				Singleton<AscensionMenuScreens>.Instance.SwitchToScreen(ScreenID);
			};
			return Instance;
		}
		GameObject val2 = Object.Instantiate<GameObject>(((Component)list[list.Count - 1]).gameObject, list[list.Count - 1].parent);
		val2.transform.localPosition = new Vector3(val2.transform.localPosition.x, val2.transform.localPosition.y - 0.11f, val2.transform.localPosition.z);
		val2.GetComponentInChildren<PixelText>().SetText(Localization.Translate("- ACHIEVEMENTS -"), false);
		((MainInputInteractable)val2.GetComponentInChildren<AscensionMenuInteractable>()).CursorSelectStarted = delegate
		{
			//IL_0005: Unknown result type (might be due to invalid IL or missing references)
			Singleton<AscensionMenuScreens>.Instance.SwitchToScreen(ScreenID);
		};
		return Instance;
	}

	public override void InitializeScreen(GameObject partialScreen)
	{
		//IL_0006: Unknown result type (might be due to invalid IL or missing references)
		//IL_000c: Expected O, but got Unknown
		//IL_01f3: Unknown result type (might be due to invalid IL or missing references)
		//IL_01f8: Unknown result type (might be due to invalid IL or missing references)
		//IL_0217: Unknown result type (might be due to invalid IL or missing references)
		//IL_021c: Unknown result type (might be due to invalid IL or missing references)
		//IL_02c5: Unknown result type (might be due to invalid IL or missing references)
		//IL_02ca: Unknown result type (might be due to invalid IL or missing references)
		//IL_02e9: Unknown result type (might be due to invalid IL or missing references)
		//IL_02ee: Unknown result type (might be due to invalid IL or missing references)
		//IL_0359: Unknown result type (might be due to invalid IL or missing references)
		//IL_0385: Unknown result type (might be due to invalid IL or missing references)
		//IL_038a: Unknown result type (might be due to invalid IL or missing references)
		//IL_0437: Unknown result type (might be due to invalid IL or missing references)
		//IL_00a8: Unknown result type (might be due to invalid IL or missing references)
		//IL_00dc: Unknown result type (might be due to invalid IL or missing references)
		//IL_00e1: Unknown result type (might be due to invalid IL or missing references)
		//IL_00f2: Unknown result type (might be due to invalid IL or missing references)
		//IL_00f7: Unknown result type (might be due to invalid IL or missing references)
		GameObject val = new GameObject("GameIcons");
		val.transform.SetParent(partialScreen.transform);
		AnchorToScreenEdge val2 = val.AddComponent<AnchorToScreenEdge>();
		val2.anchorToMidpoint = true;
		val2.anchorToBottom = false;
		val2.anchorYOffset = -0.25f;
		val2.worldAnchor = partialScreen.transform.Find("Footer");
		for (int i = 0; i < 4; i++)
		{
			for (int j = 0; j < 2; j++)
			{
				AchievementBadge achievementBadge = AchievementBadge.Create(val.transform, Camera.main, (j == 0) ? 0.5f : 1f);
				((Component)achievementBadge).gameObject.transform.localScale = new Vector3(1f, 1f, 1f);
				ViewportRelativePosition component = ((Component)achievementBadge).GetComponent<ViewportRelativePosition>();
				component.viewportAnchor = new Vector2(0.09f + 0.5f * (float)j, 0.75f - 0.175f * (float)i);
				component.offset = new Vector2(0f, 0f);
				float num = ((j == 0) ? 0.5f : 1f);
				((Component)achievementBadge).gameObject.SetActive(false);
				Badges.Add(achievementBadge);
			}
		}
		(AscensionMenuInteractable, AscensionMenuInteractable) tuple = AscensionRunSetupScreenBase.BuildPaginators(val.transform, false);
		base.leftButton = (MainInputInteractable)(object)tuple.Item1;
		base.rightButton = (MainInputInteractable)(object)tuple.Item2;
		Action<MainInputInteractable> b = delegate(MainInputInteractable mii)
		{
			((AscensionRunSetupScreenBase)this).LeftButtonClicked(mii);
		};
		Action<MainInputInteractable> b2 = delegate(MainInputInteractable mii)
		{
			((AscensionRunSetupScreenBase)this).RightButtonClicked(mii);
		};
		base.leftButton.CursorSelectStarted = (Action<MainInputInteractable>)Delegate.Combine(base.leftButton.CursorSelectStarted, b);
		base.rightButton.CursorSelectStarted = (Action<MainInputInteractable>)Delegate.Combine(base.rightButton.CursorSelectStarted, b2);
		((Component)base.leftButton).gameObject.GetComponent<ViewportRelativePosition>().viewportAnchor = new Vector2(0.239f, 0.92f);
		((Component)base.rightButton).gameObject.GetComponent<ViewportRelativePosition>().viewportAnchor = new Vector2(0.761f, 0.92f);
		(AscensionMenuInteractable, AscensionMenuInteractable) tuple2 = AscensionRunSetupScreenBase.BuildPaginators(val.transform, false);
		leftPageButton = (MainInputInteractable)(object)tuple2.Item1;
		rightPageButton = (MainInputInteractable)(object)tuple2.Item2;
		Action<MainInputInteractable> b3 = delegate(MainInputInteractable mii)
		{
			LeftPageButtonClicked(mii);
		};
		Action<MainInputInteractable> b4 = delegate(MainInputInteractable mii)
		{
			RightPageButtonClicked(mii);
		};
		leftPageButton.CursorSelectStarted = (Action<MainInputInteractable>)Delegate.Combine(leftPageButton.CursorSelectStarted, b3);
		rightPageButton.CursorSelectStarted = (Action<MainInputInteractable>)Delegate.Combine(rightPageButton.CursorSelectStarted, b4);
		((Component)leftPageButton).gameObject.GetComponent<ViewportRelativePosition>().viewportAnchor = new Vector2(0.65f, 0.1f);
		((Component)rightPageButton).gameObject.GetComponent<ViewportRelativePosition>().viewportAnchor = new Vector2(0.8f, 0.1f);
		GameObject val3 = Object.Instantiate<GameObject>(ResourceBank.Get<GameObject>("prefabs/gbcui/PixelTextCanvas"), val.transform);
		((Object)val3).name = "PageNumber";
		val3.layer = ((Component)base.screenTitle).gameObject.layer;
		pageNumbers = val3.GetComponent<PixelText>();
		pageNumbers.SetText("1 / 1", false);
		pageNumbers.SetColor(GameColors.Instance.red);
		ViewportRelativePosition val4 = val3.AddComponent<ViewportRelativePosition>();
		val4.viewportCam = Camera.main;
		val4.viewportAnchor = new Vector2(0.725f, 0.105f);
		((Behaviour)val4).enabled = true;
		val3.SetActive(true);
		((Component)base.continueButton).gameObject.SetActive(false);
		base.challengeHeaderDisplay.headerPointsLines.lines.ForEach(delegate(PixelText pt)
		{
			((Component)pt).gameObject.SetActive(false);
		});
		base.challengeFooterLines.lines.ForEach(delegate(PixelText pt)
		{
			((Component)pt).gameObject.SetActive(false);
		});
		((Component)base.screenTitle).gameObject.transform.localPosition = new Vector3(0f, -0.17f, 0f);
	}

	private void SyncComponents()
	{
		//IL_015e: Unknown result type (might be due to invalid IL or missing references)
		ModdedAchievementManager.AchievementGroupDefinition achievementGroupDefinition = ModdedAchievementManager.GroupById(ActiveGroup);
		base.screenTitle.SetText(Localization.Translate(achievementGroupDefinition.EnglishGroupName), false);
		base.screenTitle.SetText(Localization.Translate(achievementGroupDefinition.EnglishGroupName), false);
		int num = Mathf.CeilToInt((float)achievementGroupDefinition.Achievements.Count() / (float)Badges.Count);
		pageNumbers.SetText($"{GroupPage + 1} / {num}", false);
		int num2 = Badges.Count * GroupPage;
		int count = Math.Min(Badges.Count, achievementGroupDefinition.Achievements.Count - num2);
		List<ModdedAchievementManager.AchievementDefinition> range = achievementGroupDefinition.Achievements.GetRange(num2, count);
		string text = string.Join(", ", range);
		AchievementsPlugin.Log.LogDebug((object)("Displaying achievements " + text));
		Badges.ForEach(delegate(AchievementBadge b)
		{
			((Component)b).gameObject.SetActive(false);
		});
		for (int i = 0; i < range.Count; i++)
		{
			try
			{
				AchievementsPlugin.Log.LogDebug((object)("Setting achievement " + range[i].EnglishName + " active"));
				Badges[i].DisplayAchievement(range[i].ID);
				((Component)Badges[i]).gameObject.SetActive(true);
			}
			catch (Exception ex)
			{
				AchievementsPlugin.Log.LogError((object)ex);
				((Component)Badges[i]).gameObject.SetActive(false);
			}
		}
	}

	private void LeftPageButtonClicked(MainInputInteractable button)
	{
		try
		{
			if (GroupPage > 0)
			{
				GroupPage--;
				SyncComponents();
			}
		}
		catch
		{
			ActiveGroupIndex = 0;
			GroupPage = 0;
			SyncComponents();
		}
	}

	private void RightPageButtonClicked(MainInputInteractable button)
	{
		try
		{
			int num = Mathf.CeilToInt((float)ModdedAchievementManager.GroupById(ActiveGroup).Achievements.Count / (float)Badges.Count);
			if (GroupPage < num - 1)
			{
				GroupPage++;
				SyncComponents();
			}
		}
		catch
		{
			ActiveGroupIndex = 0;
			GroupPage = 0;
			SyncComponents();
		}
	}

	public override void LeftButtonClicked(MainInputInteractable button)
	{
		try
		{
			if (ActiveGroupIndex > 0)
			{
				ActiveGroupIndex--;
				GroupPage = 0;
				SyncComponents();
			}
		}
		catch
		{
			ActiveGroupIndex = 0;
			GroupPage = 0;
			SyncComponents();
		}
	}

	public override void RightButtonClicked(MainInputInteractable button)
	{
		try
		{
			if (ActiveGroupIndex < AllGroups.Count - 1)
			{
				ActiveGroupIndex++;
				GroupPage = 0;
				SyncComponents();
			}
		}
		catch
		{
			ActiveGroupIndex = 0;
			GroupPage = 0;
			SyncComponents();
		}
	}

	public override void OnEnable()
	{
		Badges.ForEach(delegate(AchievementBadge b)
		{
			b.ReAlign();
		});
		AllGroups.Clear();
		AllGroups.AddRange(from ag in GuidManager.GetValues<ModdedAchievementManager.AchievementGroup>()
			where ag != 0 && ModdedAchievementManager.GroupById(ag) != null
			select ag);
		ActiveGroupIndex = 0;
		GroupPage = 0;
		SyncComponents();
		SyncComponents();
		((AscensionRunSetupScreenBase)this).OnEnable();
	}

	[HarmonyPatch(typeof(AscensionMenuScreens), "ConfigurePostGameScreens")]
	[HarmonyPostfix]
	private static void InitializeScreensOnStart()
	{
		CreateInstance();
	}

	[HarmonyPatch(typeof(AscensionMenuScreens), "DeactivateAllScreens")]
	[HarmonyPostfix]
	private static void DeactivateAllCustomScreens()
	{
		if ((Object)(object)Instance != (Object)null)
		{
			((Component)Instance).gameObject.SetActive(false);
		}
	}

	[HarmonyPatch(typeof(AscensionMenuScreens), "ScreenSwitchSequence")]
	[HarmonyPostfix]
	[HarmonyPriority(100)]
	private static IEnumerator SwitchToScreen(IEnumerator sequenceEvent, Screen screen)
	{
		//IL_000e: 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)
		while (sequenceEvent.MoveNext())
		{
			yield return sequenceEvent.Current;
		}
		yield return (object)new WaitForSeconds(0.05f);
		if ((Object)(object)Instance != (Object)null && ScreenID == screen)
		{
			((Component)Instance).gameObject.SetActive(true);
			((Component)Instance).gameObject.SetActive(false);
			((Component)Instance).gameObject.SetActive(true);
		}
	}
}
public class AchievementBadge : ManagedBehaviour
{
	private static int ORTHO_LAYER
	{
		get
		{
			//IL_0000: Unknown result type (might be due to invalid IL or missing references)
			//IL_0005: Unknown result type (might be due to invalid IL or missing references)
			Scene activeScene = SceneManager.GetActiveScene();
			return ((Scene)(ref activeScene)).name.Equals("Ascension_Configure", StringComparison.InvariantCultureIgnoreCase) ? LayerMask.NameToLayer("GBCUI") : LayerMask.NameToLayer("OrthographicUI");
		}
	}

	public ViewportRelativePosition ViewportPosition { get; set; }

	private SpriteRenderer AchievementSprite { get; set; }

	private float? RightAnchor { get; set; }

	private PixelText HeaderDisplayer { get; set; }

	private PixelText AchievementTitleDisplayer { get; set; }

	public void ReAlign()
	{
		//IL_009d: Unknown result type (might be due to invalid IL or missing references)
		//IL_00a2: Unknown result type (might be due to invalid IL or missing references)
		//IL_00dd: Unknown result type (might be due to invalid IL or missing references)
		//IL_0105: Unknown result type (might be due to invalid IL or missing references)
		//IL_0111: 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)
		//IL_013a: Unknown result type (might be due to invalid IL or missing references)
		//IL_0146: Unknown result type (might be due to invalid IL or missing references)
		//IL_0156: Unknown result type (might be due to invalid IL or missing references)
		//IL_0058: Unknown result type (might be due to invalid IL or missing references)
		//IL_006e: Unknown result type (might be due to invalid IL or missing references)
		RectTransform component = ((Component)((Component)HeaderDisplayer).transform.Find("Text")).GetComponent<RectTransform>();
		RectTransform component2 = ((Component)((Component)AchievementTitleDisplayer).transform.Find("Text")).GetComponent<RectTransform>();
		if (!RightAnchor.HasValue)
		{
			component.sizeDelta = new Vector2(165f, 50f);
			component2.sizeDelta = new Vector2(165f, 50f);
			return;
		}
		float x = Camera.main.ViewportToWorldPoint(new Vector3(RightAnchor.Value, 0.5f, 0f)).x;
		AchievementsPlugin.Log.LogDebug((object)$"Setting right edge to {RightAnchor.Value} = {x} from {((Component)component2).gameObject.transform.position.x}");
		component.sizeDelta = new Vector2((x - ((Component)component).gameObject.transform.position.x) / ((Transform)component).lossyScale.x, 50f);
		component2.sizeDelta = new Vector2((x - ((Component)component2).gameObject.transform.position.x) / ((Transform)component).lossyScale.x, 50f);
	}

	public void ToastAchievement(Achievement id)
	{
		//IL_0001: 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)
		ModdedAchievementManager.AchievementDefinition achievementDefinition = ModdedAchievementManager.AchievementById(id);
		ModdedAchievementManager.AchievementGroupDefinition achievementGroupDefinition = ModdedAchievementManager.GroupByAchievementId(id);
		AchievementSprite.sprite = achievementDefinition.IconSprite;
		AchievementTitleDisplayer.SetText(Localization.Translate(achievementDefinition.EnglishName), false);
		HeaderDisplayer.SetText(Localization.Translate("Achievement Unlocked"), false);
	}

	public void DisplayAchievement(Achievement id)
	{
		//IL_0001: 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)
		ModdedAchievementManager.AchievementDefinition achievementDefinition = ModdedAchievementManager.AchievementById(id);
		ModdedAchievementManager.AchievementGroupDefinition achievementGroupDefinition = ModdedAchievementManager.GroupByAchievementId(id);
		if (achievementDefinition != null && achievementGroupDefinition != null)
		{
			AchievementsPlugin.Log.LogDebug((object)("Displaying " + achievementDefinition.EnglishName));
			AchievementsPlugin.Log.LogDebug((object)$"Unlocked? {achievementDefinition.IsUnlocked}");
			if (achievementDefinition.Secret && !achievementDefinition.IsUnlocked)
			{
				AchievementSprite.sprite = achievementGroupDefinition.LockedSprite;
				HeaderDisplayer.SetText(Localization.Translate("Secret Achievement"), false);
				AchievementTitleDisplayer.SetText(Localization.Translate("Revealed Once Unlocked"), false);
			}
			else
			{
				AchievementSprite.sprite = (achievementDefinition.IsUnlocked ? achievementDefinition.IconSprite : achievementGroupDefinition.LockedSprite);
				AchievementTitleDisplayer.SetText(Localization.Translate(achievementDefinition.EnglishDescription), false);
				HeaderDisplayer.SetText(Localization.Translate(achievementDefinition.EnglishName), false);
			}
		}
	}

	public static AchievementBadge Create(Transform parent, Camera viewportCam = null, float? rightAnchor = null)
	{
		//IL_0006: Unknown result type (might be due to invalid IL or missing references)
		//IL_000c: Expected O, but got Unknown
		//IL_002e: 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_00ea: Unknown result type (might be due to invalid IL or missing references)
		//IL_00f0: Expected O, but got Unknown
		//IL_00b3: 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_00cd: Unknown result type (might be due to invalid IL or missing references)
		//IL_00d2: Unknown result type (might be due to invalid IL or missing references)
		//IL_0130: Unknown result type (might be due to invalid IL or missing references)
		//IL_0150: Unknown result type (might be due to invalid IL or missing references)
		//IL_01fc: Unknown result type (might be due to invalid IL or missing references)
		//IL_021c: Unknown result type (might be due to invalid IL or missing references)
		//IL_0251: Unknown result type (might be due to invalid IL or missing references)
		//IL_02d5: Unknown result type (might be due to invalid IL or missing references)
		//IL_02f6: Unknown result type (might be due to invalid IL or missing references)
		//IL_032c: Unknown result type (might be due to invalid IL or missing references)
		GameObject val = new GameObject("AchievementDisplayer");
		val.transform.SetParent(parent);
		val.transform.localPosition = new Vector3(0f, 0f, 1f);
		val.transform.localScale = new Vector3(2.5f, 2.5f, 1f);
		val.SetActive(false);
		AchievementBadge achievementBadge = val.AddComponent<AchievementBadge>();
		achievementBadge.RightAnchor = rightAnchor;
		if ((Object)(object)viewportCam != (Object)null)
		{
			val.layer = ORTHO_LAYER;
			achievementBadge.ViewportPosition = val.AddComponent<ViewportRelativePosition>();
			achievementBadge.ViewportPosition.viewportCam = viewportCam;
			achievementBadge.ViewportPosition.viewportAnchor = new Vector2(0.4f, 0f);
			achievementBadge.ViewportPosition.offset = new Vector2(0f, 0.5f);
			((Behaviour)achievementBadge.ViewportPosition).enabled = true;
		}
		GameObject val2 = new GameObject("AchievementIcon");
		val2.transform.SetParent(val.transform);
		if ((Object)(object)viewportCam != (Object)null)
		{
			val2.layer = ORTHO_LAYER;
		}
		val2.transform.localPosition = new Vector3(-0.25f, 0f, 0f);
		val2.transform.localScale = new Vector3(1f, 1f, 1f);
		achievementBadge.AchievementSprite = val2.AddComponent<SpriteRenderer>();
		achievementBadge.AchievementSprite.sprite = ModdedAchievementManager.AchievementById((Achievement)30).IconSprite;
		((Renderer)achievementBadge.AchievementSprite).enabled = true;
		((Renderer)achievementBadge.AchievementSprite).sortingOrder = 230;
		GameObject val3 = Object.Instantiate<GameObject>(ResourceBank.Get<GameObject>("prefabs/gbcui/PixelTextCanvas"), val.transform);
		((Object)val3).name = "CongratsTitle";
		if ((Object)(object)viewportCam != (Object)null)
		{
			val3.layer = ORTHO_LAYER;
		}
		RectTransform component = ((Component)val3.transform.Find("Text")).GetComponent<RectTransform>();
		component.pivot = new Vector2(0f, 1f);
		val3.transform.localPosition = new Vector3(-0.11f, 0.3f, 0f);
		achievementBadge.HeaderDisplayer = val3.GetComponent<PixelText>();
		achievementBadge.HeaderDisplayer.mainText.alignment = (TextAnchor)3;
		achievementBadge.HeaderDisplayer.SetColor(GameColors.Instance.nearWhite);
		achievementBadge.HeaderDisplayer.SetText(Localization.Translate("Achievement Unlocked"), false);
		GameObject val4 = Object.Instantiate<GameObject>(ResourceBank.Get<GameObject>("prefabs/gbcui/PixelTextCanvas"), val.transform);
		((Object)val4).name = "AchievementTitle";
		if ((Object)(object)viewportCam != (Object)null)
		{
			val4.layer = ORTHO_LAYER;
		}
		RectTransform component2 = ((Component)val4.transform.Find("Text")).GetComponent<RectTransform>();
		component2.pivot = new Vector2(0f, 1f);
		val4.transform.localPosition = new Vector3(-0.11f, 0f, 0f);
		achievementBadge.AchievementTitleDisplayer = val4.GetComponent<PixelText>();
		achievementBadge.AchievementTitleDisplayer.mainText.alignment = (TextAnchor)0;
		achievementBadge.AchievementTitleDisplayer.SetColor(GameColors.Instance.red);
		achievementBadge.AchievementTitleDisplayer.SetText(Localization.Translate(ModdedAchievementManager.AchievementById((Achievement)30).EnglishName), false);
		achievementBadge.ReAlign();
		return achievementBadge;
	}
}
[HarmonyPatch]
public static class ModdedAchievementManager
{
	public enum AchievementGroup
	{
		StoryAchievements,
		KayceesModAchievements
	}

	public class AchievementGroupDefinition
	{
		public AchievementGroup ID { get; internal set; }

		public string EnglishGroupName { get; internal set; }

		public string AudioCue { get; set; }

		public bool IsDefault { get; internal set; }

		public Sprite LockedSprite { get; internal set; }

		public List<AchievementDefinition> Achievements => new List<AchievementDefinition>(AllAchievements.Where((AchievementDefinition ad) => ad.GroupID == ID));
	}

	public class AchievementDefinition
	{
		public Achievement ID { get; internal set; }

		public AchievementGroup GroupID { get; internal set; }

		public string EnglishName { get; internal set; }

		public string EnglishDescription { get; internal set; }

		public Sprite IconSprite { get; internal set; }

		public bool Secret { get; internal set; }

		public bool IsUnlocked => SaveManager.SaveFile.unlockedAchievements != null && SaveManager.SaveFile.unlockedAchievements.Contains(ID);
	}

	private static readonly AudioClip DefaultAudioClip;

	private static readonly Rect ICON_RECT;

	private static readonly Vector2 ICON_PIVOT;

	private static List<AchievementDefinition> AllAchievements;

	private static List<AchievementGroupDefinition> AllAchievementGroups;

	private static List<AudioClip> clipsToPatchIn;

	static ModdedAchievementManager()
	{
		//IL_0023: Unknown result type (might be due to invalid IL or missing references)
		//IL_0028: Unknown result type (might be due to invalid IL or missing references)
		//IL_0037: Unknown result type (might be due to invalid IL or missing references)
		//IL_003c: Unknown result type (might be due to invalid IL or missing references)
		//IL_00ea: Unknown result type (might be due to invalid IL or missing references)
		//IL_00ef: Unknown result type (might be due to invalid IL or missing references)
		//IL_013a: Unknown result type (might be due to invalid IL or missing references)
		//IL_0141: Invalid comparison between Unknown and I4
		//IL_0122: Unknown result type (might be due to invalid IL or missing references)
		//IL_0155: Unknown result type (might be due to invalid IL or missing references)
		//IL_017c: Unknown result type (might be due to invalid IL or missing references)
		DefaultAudioClip = SoundManager.LoadAudioClip("achievement_default.wav");
		ICON_RECT = new Rect(0f, 0f, 22f, 22f);
		ICON_PIVOT = new Vector2(0.5f, 0.5f);
		AllAchievements = new List<AchievementDefinition>();
		AllAchievementGroups = new List<AchievementGroupDefinition>();
		clipsToPatchIn = new List<AudioClip> { DefaultAudioClip };
		AllAchievementGroups.Clear();
		NewGroup(AchievementGroup.KayceesModAchievements, "Kaycee's Mod Achievements", ((Object)DefaultAudioClip).name, TextureHelper.GetImageAsTexture("KMOD_LOCKED.png", typeof(ModdedAchievementManager).Assembly, (FilterMode)0), isDefault: true);
		NewGroup(AchievementGroup.StoryAchievements, "Story Achievements", null, null, isDefault: true);
		AllAchievements.Clear();
		foreach (Achievement ach in Enum.GetValues(typeof(Achievement)))
		{
			Achievement_t val = ((IEnumerable<Achievement_t>)AchievementsList.m_Achievements).FirstOrDefault((Func<Achievement_t, bool>)((Achievement_t at) => at.m_eAchievementID == ach));
			if (val == null)
			{
				AchievementsPlugin.Log.LogWarning((object)$"Could not find a definition for achievement {(object)ach}");
				continue;
			}
			AchievementGroup achievementGroup = (((int)ach >= 30) ? AchievementGroup.KayceesModAchievements : AchievementGroup.StoryAchievements);
			Texture2D icon = ((achievementGroup == AchievementGroup.KayceesModAchievements) ? TextureHelper.GetImageAsTexture($"{(object)ach}.png", typeof(ModdedAchievementManager).Assembly, (FilterMode)0) : null);
			New(ach, val.m_strName, val.m_strDescription, secret: true, achievementGroup, icon);
		}
	}

	internal static AchievementGroupDefinition NewGroup(AchievementGroup id, string name, string audioCue, Texture2D lockedTexture, bool isDefault)
	{
		//IL_0084: Unknown result type (might be due to invalid IL or missing references)
		//IL_0089: Unknown result type (might be due to invalid IL or missing references)
		if (AllAchievementGroups.Any((AchievementGroupDefinition agd) => agd.ID == id))
		{
			throw new InvalidOperationException($"An achievement group with ID {id} already exists!");
		}
		if ((Object)(object)lockedTexture != (Object)null && (((Texture)lockedTexture).width != 22 || ((Texture)lockedTexture).height != 22))
		{
			throw new InvalidOperationException("Locked icon texture must be 22x22 pixels");
		}
		Sprite lockedSprite = (((Object)(object)lockedTexture == (Object)null) ? GroupById(AchievementGroup.KayceesModAchievements).LockedSprite : Sprite.Create(lockedTexture, ICON_RECT, ICON_PIVOT));
		AchievementGroupDefinition achievementGroupDefinition = new AchievementGroupDefinition
		{
			ID = id,
			EnglishGroupName = name,
			AudioCue = audioCue,
			LockedSprite = lockedSprite
		};
		AllAchievementGroups.Add(achievementGroupDefinition);
		return achievementGroupDefinition;
	}

	public static AchievementGroupDefinition NewGroup(string modGuid, string englishGroupName, string audioCue, Texture2D lockedTexture)
	{
		return NewGroup(GuidManager.GetEnumValue<AchievementGroup>(modGuid, englishGroupName), englishGroupName, audioCue, lockedTexture, isDefault: false);
	}

	public static AchievementGroupDefinition NewGroup(string modGuid, string englishGroupName, AudioClip audioCue, Texture2D lockedTexture)
	{
		if (!clipsToPatchIn.Any((AudioClip ac) => ((Object)ac).name.Equals(((Object)audioCue).name)))
		{
			clipsToPatchIn.Add(audioCue);
		}
		return NewGroup(GuidManager.GetEnumValue<AchievementGroup>(modGuid, englishGroupName), englishGroupName, ((Object)audioCue).name, lockedTexture, isDefault: false);
	}

	public static AchievementGroupDefinition NewGroup(string modGuid, string englishGroupName, Texture2D lockedTexture)
	{
		return NewGroup(GuidManager.GetEnumValue<AchievementGroup>(modGuid, englishGroupName), englishGroupName, ((Object)DefaultAudioClip).name, lockedTexture, isDefault: false);
	}

	public static AchievementGroupDefinition NewGroup(string modGuid, string englishGroupName)
	{
		return NewGroup(GuidManager.GetEnumValue<AchievementGroup>(modGuid, englishGroupName), englishGroupName, ((Object)DefaultAudioClip).name, null, isDefault: false);
	}

	internal static AchievementDefinition New(Achievement id, string achievementEnglishName, string achievementEnglishDescription, bool secret, AchievementGroup groupId, Texture2D icon)
	{
		//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_002e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0082: Unknown result type (might be due to invalid IL or missing references)
		//IL_00a9: 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)
		if (AllAchievements.Any((AchievementDefinition agd) => agd.ID == id))
		{
			throw new InvalidOperationException($"An achievement with ID {id} already exists!");
		}
		if ((Object)(object)icon != (Object)null && (((Texture)icon).width != 22 || ((Texture)icon).height != 22))
		{
			throw new InvalidOperationException("Achievement icon texture must be 22x22 pixels");
		}
		AchievementDefinition achievementDefinition = new AchievementDefinition
		{
			ID = id,
			GroupID = groupId,
			EnglishName = achievementEnglishName,
			EnglishDescription = achievementEnglishDescription,
			IconSprite = Sprite.Create(icon, ICON_RECT, ICON_PIVOT),
			Secret = secret
		};
		AllAchievements.Add(achievementDefinition);
		return achievementDefinition;
	}

	public static AchievementDefinition New(string modGuid, string achievementEnglishName, string achievementEnglishDescription, bool secret, AchievementGroup groupId, Texture2D icon)
	{
		//IL_0003: Unknown result type (might be due to invalid IL or missing references)
		return New(GuidManager.GetEnumValue<Achievement>(modGuid, achievementEnglishName), achievementEnglishName, achievementEnglishDescription, secret, groupId, icon);
	}

	public static AchievementDefinition AchievementById(Achievement id)
	{
		//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)
		return AllAchievements.FirstOrDefault((AchievementDefinition ad) => ad.ID == id);
	}

	public static AchievementGroupDefinition GroupById(AchievementGroup id)
	{
		return AllAchievementGroups.FirstOrDefault((AchievementGroupDefinition agd) => agd.ID == id);
	}

	public static AchievementGroupDefinition GroupByAchievementId(Achievement id)
	{
		//IL_0001: Unknown result type (might be due to invalid IL or missing references)
		AchievementDefinition achievementDefinition = AchievementById(id);
		if (achievementDefinition == null)
		{
			return null;
		}
		return GroupById(achievementDefinition.GroupID);
	}

	[HarmonyPatch(typeof(AchievementManager), "Unlock")]
	[HarmonyPrefix]
	[HarmonyPriority(700)]
	private static bool Unlock(Achievement achievementID)
	{
		//IL_0001: 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_0046: Unknown result type (might be due to invalid IL or missing references)
		//IL_0061: Unknown result type (might be due to invalid IL or missing references)
		//IL_0086: Unknown result type (might be due to invalid IL or missing references)
		bool flag = GroupByAchievementId(achievementID)?.IsDefault ?? false;
		if (SaveManager.SaveFile.unlockedAchievements != null && !SaveManager.SaveFile.unlockedAchievements.Contains(achievementID))
		{
			SaveManager.SaveFile.unlockedAchievements.Add(achievementID);
			if ((Object)(object)AchievementPopupHandler.Instance != (Object)null)
			{
				AchievementPopupHandler.Instance.TryShowUnlockAchievement(achievementID);
			}
		}
		if (flag && (Object)(object)AchievementManager.platformHandler != (Object)null)
		{
			AchievementManager.platformHandler.Unlock(achievementID);
		}
		return false;
	}

	[HarmonyPatch(typeof(AudioController), "Awake")]
	[HarmonyPostfix]
	internal static void LoadMyCustomAudio(ref AudioController __instance)
	{
		foreach (AudioClip clip in clipsToPatchIn)
		{
			if ((Object)(object)clip != (Object)null && !__instance.SFX.Any((AudioClip ac) => ((Object)ac).name.Equals(((Object)clip).name, StringComparison.InvariantCultureIgnoreCase)))
			{
				__instance.SFX.Add(clip);
			}
		}
	}
}

plugins/Infiniscryption-Curses/plugins/Infiniscryption.Curses.dll

Decompiled 5 months ago
using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using BepInEx;
using BepInEx.Configuration;
using BepInEx.Logging;
using DiskCardGame;
using HarmonyLib;
using Infiniscryption.Achievements;
using Infiniscryption.Curses.Cards;
using Infiniscryption.Curses.Components;
using Infiniscryption.Curses.Helpers;
using Infiniscryption.Curses.Patchers;
using Infiniscryption.Curses.Sequences;
using Infiniscryption.Spells.Sigils;
using InscryptionAPI.Ascension;
using InscryptionAPI.Card;
using InscryptionAPI.Dialogue;
using InscryptionAPI.Guid;
using InscryptionAPI.Helpers;
using InscryptionAPI.Saves;
using InscryptionAPI.Sound;
using UnityEngine;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: TargetFramework(".NETStandard,Version=v2.0", FrameworkDisplayName = "")]
[assembly: AssemblyCompany("Infiniscryption.Curses")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyDescription("Infinite Inscryption - Curses")]
[assembly: AssemblyFileVersion("1.0.2.0")]
[assembly: AssemblyInformationalVersion("1.0.2")]
[assembly: AssemblyProduct("Infiniscryption.Curses")]
[assembly: AssemblyTitle("Infiniscryption.Curses")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.2.0")]
[module: UnverifiableCode]
namespace Infiniscryption.Curses
{
	[BepInPlugin("zorro.inscryption.infiniscryption.curses", "Infiniscryption Curses", "0.1")]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	public class CursePlugin : BaseUnityPlugin
	{
		internal const string PluginGuid = "zorro.inscryption.infiniscryption.curses";

		internal const string PluginName = "Infiniscryption Curses";

		internal const string PluginVersion = "0.1";

		internal const string CardPrefix = "CURSES";

		internal static ManualLogSource Log;

		internal static CursePlugin Instance;

		internal string DebugCode => ((BaseUnityPlugin)this).Config.Bind<string>("CurseMod", "DebugCode", "nothing", new ConfigDescription("A special code to use for debugging purposes only. Don't change this unless your name is DivisionByZorro or he told you how it works.", (AcceptableValueBase)null, Array.Empty<object>())).Value;

		private void Awake()
		{
			//IL_0011: Unknown result type (might be due to invalid IL or missing references)
			//IL_0017: Expected O, but got Unknown
			Log = ((BaseUnityPlugin)this).Logger;
			Harmony val = new Harmony("zorro.inscryption.infiniscryption.curses");
			RandomSigils.Register(val);
			HarderBosses.Register(val);
			DeathcardHaunt.Register(val);
			ThreeCandles.Register(val);
			GoldenPeltStart.Register(val);
			NoOneHitKills.Register(val);
			DrawDynamite.Register(val);
			StartWithTribalTotems.Register(val);
			BiggerMoon.Register(val);
			BoonsAssist.Register(val);
			CursedAchievements.Register();
			val.PatchAll(typeof(AudioHelper));
			val.PatchAll(typeof(CursePlugin));
			Instance = this;
			((BaseUnityPlugin)this).Logger.LogInfo((object)("Plugin Infiniscryption Curses is loaded with debug code " + DebugCode));
		}
	}
}
namespace Infiniscryption.Curses.Sequences
{
	public class AnglerBossHardOpponent : AnglerBossOpponent
	{
		public static readonly string MEGA_SHARK = "CURSES_Angler_Shark";

		public override int StartingLives => 3;

		public override IEnumerator IntroSequence(EncounterData encounter)
		{
			yield return <>n__0(encounter);
			yield return HarderBosses.ShowExtraBossCandle((Part1BossOpponent)(object)this, "AnglerExtraCandle");
		}

		public override IEnumerator StartNewPhaseSequence()
		{
			if (((Opponent)this).NumLives >= 2)
			{
				yield return <>n__1();
				yield break;
			}
			Singleton<ViewManager>.Instance.Controller.LockState = (ViewLockState)1;
			Singleton<ViewManager>.Instance.SwitchToView((View)21, false, false);
			yield return Singleton<TextDisplayer>.Instance.PlayDialogueEvent("AnglerPhaseThree", (MessageAdvanceMode)1, (EventIntersectMode)0, (string[])null, (Action<Line>)null);
			Singleton<ViewManager>.Instance.SwitchToView((View)4, false, false);
			yield return ((Opponent)this).ClearQueue();
			yield return ((Opponent)this).ClearBoard();
			((Opponent)this).Blueprint = null;
			((Opponent)this).ReplaceAndAppendTurnPlan(new List<List<CardInfo>>());
			List<CardSlot> slots = Singleton<BoardManager>.Instance.OpponentSlotsCopy;
			int numberOfSharks = 2;
			if (SaveFile.IsAscension && AscensionSaveData.Data.currentRun.regionTier == 0)
			{
				numberOfSharks = 1;
			}
			for (int i = 0; i < numberOfSharks; i++)
			{
				int slotNum = i switch
				{
					2 => 2, 
					1 => 3, 
					0 => 1, 
					_ => 0, 
				};
				CardInfo shark = CardLoader.GetCardByName(MEGA_SHARK);
				if (SaveFile.IsAscension && AscensionSaveData.Data.currentRun.regionTier == 2)
				{
					shark.mods.Add(new CardModificationInfo(1, 1));
				}
				yield return Singleton<BoardManager>.Instance.CreateCardInSlot(shark, slots[slotNum], 0.1f, true);
				yield return (object)new WaitForSeconds(0.15f);
			}
			yield return (object)new WaitForSeconds(0.75f);
			Singleton<ViewManager>.Instance.SwitchToView((View)1, false, false);
			Singleton<ViewManager>.Instance.Controller.LockState = (ViewLockState)0;
		}

		[CompilerGenerated]
		[DebuggerHidden]
		private IEnumerator <>n__0(EncounterData encounter)
		{
			return ((AnglerBossOpponent)this).IntroSequence(encounter);
		}

		[CompilerGenerated]
		[DebuggerHidden]
		private IEnumerator <>n__1()
		{
			return ((AnglerBossOpponent)this).StartNewPhaseSequence();
		}
	}
	public class AnglerBossHardSequencer : AnglerBattleSequencer
	{
	}
	public class ProspectorBossHardOpponent : ProspectorBossOpponent
	{
		public static readonly string DYNAMITE = "CURSES_Prospector_Dynamite";

		public override int StartingLives => 3;

		public override IEnumerator IntroSequence(EncounterData encounter)
		{
			yield return <>n__0(encounter);
			yield return HarderBosses.ShowExtraBossCandle((Part1BossOpponent)(object)this, "ProspectorExtraCandle");
		}

		public override IEnumerator StartNewPhaseSequence()
		{
			if (((Opponent)this).NumLives >= 2)
			{
				yield return <>n__1();
				yield break;
			}
			Singleton<ViewManager>.Instance.Controller.LockState = (ViewLockState)1;
			Singleton<ViewManager>.Instance.SwitchToView((View)21, false, false);
			yield return Singleton<TextDisplayer>.Instance.PlayDialogueEvent("ProspectorPhaseThree", (MessageAdvanceMode)1, (EventIntersectMode)0, (string[])null, (Action<Line>)null);
			Singleton<ViewManager>.Instance.SwitchToView((View)4, false, false);
			yield return ((Opponent)this).ClearQueue();
			yield return ((Opponent)this).ClearBoard();
			foreach (CardSlot slot2 in Singleton<BoardManager>.Instance.PlayerSlotsCopy)
			{
				if ((Object)(object)slot2.Card != (Object)null && ((Object)((Card)slot2.Card).Info).name == "GoldNugget")
				{
					((Card)slot2.Card).ExitBoard(0.4f, Vector3.zero);
				}
			}
			((Opponent)this).Blueprint = null;
			((Opponent)this).ReplaceAndAppendTurnPlan(new List<List<CardInfo>>());
			foreach (CardSlot slot in Singleton<BoardManager>.Instance.OpponentSlotsCopy)
			{
				CardInfo bigBoulder = CardLoader.GetCardByName("Boulder");
				bigBoulder.Mods.Add(new CardModificationInfo((Ability)23));
				if (RunState.CurrentRegionTier == 0)
				{
					bigBoulder.Mods.Add(new CardModificationInfo(0, -3));
				}
				if (RunState.CurrentRegionTier == 1)
				{
					bigBoulder.Mods.Add(new CardModificationInfo(0, -1));
				}
				if (RunState.CurrentRegionTier == 2)
				{
					bigBoulder.Mods.Add(new CardModificationInfo(0, 1));
				}
				yield return Singleton<BoardManager>.Instance.CreateCardInSlot(bigBoulder, slot, 0.1f, true);
				yield return (object)new WaitForSeconds(0.15f);
			}
			yield return (object)new WaitForSeconds(0.35f);
			Singleton<ViewManager>.Instance.SwitchToView((View)1, false, false);
			Singleton<ViewManager>.Instance.Controller.LockState = (ViewLockState)0;
		}

		[CompilerGenerated]
		[DebuggerHidden]
		private IEnumerator <>n__0(EncounterData encounter)
		{
			return ((ProspectorBossOpponent)this).IntroSequence(encounter);
		}

		[CompilerGenerated]
		[DebuggerHidden]
		private IEnumerator <>n__1()
		{
			return ((ProspectorBossOpponent)this).StartNewPhaseSequence();
		}
	}
	public class ProspectorBossHardSequencer : ProspectorBattleSequencer
	{
		public override IEnumerator PlayerPostDraw()
		{
			if (Singleton<TurnManager>.Instance.Opponent.NumLives <= 1)
			{
				Singleton<ViewManager>.Instance.Controller.LockState = (ViewLockState)1;
				Singleton<ViewManager>.Instance.SwitchToView((View)1, false, false);
				yield return Singleton<TextDisplayer>.Instance.PlayDialogueEvent("CatchDynamite", (MessageAdvanceMode)1, (EventIntersectMode)0, (string[])null, (Action<Line>)null);
				Singleton<ViewManager>.Instance.SwitchToView((View)0, false, false);
				PlayableCard dynamite = CardSpawner.SpawnPlayableCard(CardLoader.GetCardByName(ProspectorBossHardOpponent.DYNAMITE));
				yield return Singleton<PlayerHand>.Instance.AddCardToHand(dynamite, Vector3.zero, 0f);
				Singleton<PlayerHand>.Instance.OnCardInspected(dynamite);
				Singleton<PlayerHand>.Instance.InspectingLocked = true;
				((Card)dynamite).Anim.PlayHitAnimation();
				yield return (object)new WaitForSeconds(0.6f);
				Singleton<PlayerHand>.Instance.InspectingLocked = false;
				Singleton<ViewManager>.Instance.SwitchToView((View)1, false, false);
				yield return (object)new WaitForSeconds(0.33f);
				Singleton<ViewManager>.Instance.Controller.LockState = (ViewLockState)0;
			}
		}

		private List<CardSlot> EmptyLanes()
		{
			return Singleton<BoardManager>.Instance.OpponentSlotsCopy.Where((CardSlot s) => (Object)(object)s.Card == (Object)null && (Object)(object)s.opposingSlot.Card == (Object)null).ToList();
		}

		public override bool RespondsToTurnEnd(bool playerTurnEnd)
		{
			return !playerTurnEnd && EmptyLanes().Count > 0 && Singleton<TurnManager>.Instance.Opponent.NumLives == 1;
		}

		public override IEnumerator OnTurnEnd(bool playerTurnEnd)
		{
			List<CardSlot> wolfSlots = EmptyLanes();
			if (playerTurnEnd || wolfSlots.Count == 0 || Singleton<TurnManager>.Instance.Opponent.NumLives > 1)
			{
				yield break;
			}
			foreach (CardSlot slot in wolfSlots)
			{
				yield return Singleton<TurnManager>.Instance.Opponent.QueueCard(CardLoader.GetCardByName("Wolf"), slot, true, true, true);
				if (DialogueEventsData.GetEventRepeatCount("ProspectorWolfSpawn") == 0)
				{
					yield return Singleton<TextDisplayer>.Instance.PlayDialogueEvent("ProspectorWolfSpawn", (MessageAdvanceMode)1, (EventIntersectMode)0, (string[])null, (Action<Line>)null);
				}
			}
		}
	}
	public class TrapperTraderBossHardOpponent : TrapperTraderBossOpponent
	{
		public static readonly string LEAPING_TRAP = "Trap";

		public static readonly string BOW_CARD = "CURSES_Trapper_Bow";

		public static readonly string CAPTURE_CARD = "CURSES_Trapper_Capture";

		public static readonly string SPIKE_TRAP_CARD = "CURSES_Trapper_Spike_Trap";

		private static Vector3 BOSS_CARD_RECEIVE_OFFSET = new Vector3(0f, 2f, 8f);

		private static SpecialStatIcon[] USELESS_STAT_ICONS;

		public override int StartingLives => 3;

		public override IEnumerator IntroSequence(EncounterData encounter)
		{
			yield return <>n__0(encounter);
			yield return HarderBosses.ShowExtraBossCandle((Part1BossOpponent)(object)this, "TrapperTraderExtraCandle");
		}

		private void RemoveCovered(List<CardInfo> list, Func<CardInfo, bool> predicate, int count)
		{
			List<CardInfo> list2 = list.Where(predicate).Take(count).ToList();
			foreach (CardInfo item in list2)
			{
				list.Remove(item);
			}
		}

		private bool CardUsableByBoss(CardInfo card)
		{
			if (!card.Sacrificable)
			{
				return false;
			}
			if (card.Health == 0)
			{
				return false;
			}
			if (card.Attack == 0 && USELESS_STAT_ICONS.Any((SpecialStatIcon st) => st == card.SpecialStatIcon))
			{
				return false;
			}
			return true;
		}

		private List<CardInfo> BuildPhaseThreeDeck(List<CardInfo> trapperDeck)
		{
			List<CardInfo> list = new List<CardInfo>();
			for (int i = 0; i < 2; i++)
			{
				list.Add(CardLoader.GetCardByName(LEAPING_TRAP));
				list.Add(CardLoader.GetCardByName(SPIKE_TRAP_CARD));
				list.Add(CardLoader.GetCardByName(CAPTURE_CARD));
				list.Add(CardLoader.GetCardByName(BOW_CARD));
			}
			List<CardInfo> list2 = new List<CardInfo>(trapperDeck);
			RemoveCovered(list2, (CardInfo card) => !card.HasAbility((Ability)19) && card.HasAbility((Ability)35), 3);
			Func<CardInfo, bool> func = (CardInfo card) => !card.HasAbility((Ability)19) && (card.Health == 1 || card.Attack <= 2 || card.Health == 2);
			RemoveCovered(list2, func, 2);
			Func<CardInfo, bool> func2 = (CardInfo card) => card.Health <= 2;
			RemoveCovered(list2, func2, 2);
			list2.Sort((CardInfo a, CardInfo b) => b.Health - a.Health);
			list2.RemoveRange(0, Math.Min(4, list2.Count));
			for (int j = 0; j < 2; j++)
			{
				CardInfo val = list2.Find(func.Invoke);
				if ((Object)(object)val != (Object)null)
				{
					list.Add(CardLoader.GetCardByName(SPIKE_TRAP_CARD));
					list2.Remove(val);
				}
			}
			List<CardInfo> list3 = list2.Where((CardInfo card) => card.Health <= 2).ToList();
			foreach (CardInfo item in list3)
			{
				list.Add(CardLoader.GetCardByName(BOW_CARD));
				list2.Remove(item);
			}
			CardInfo val2 = list2.Find(func2.Invoke);
			if ((Object)(object)val2 != (Object)null)
			{
				list.Add(CardLoader.GetCardByName(BOW_CARD));
				list.Add(CardLoader.GetCardByName(BOW_CARD));
				list2.Remove(val2);
			}
			for (int k = 0; k < list2.Count; k++)
			{
				list.Add(CardLoader.GetCardByName(LEAPING_TRAP));
			}
			if (!RunState.Run.consumables.Any((string c) => c.ToLowerInvariant() == "fishhook"))
			{
				list.Add(CardLoader.GetCardByName(CAPTURE_CARD));
			}
			if (!RunState.Run.consumables.Any((string c) => c.ToLowerInvariant() == "scissors"))
			{
				list.Add(CardLoader.GetCardByName(LEAPING_TRAP));
			}
			int num = trapperDeck.Where((CardInfo card) => card.HasAbility((Ability)26)).Count();
			for (int l = 0; l < num; l++)
			{
				list.Add(CardLoader.GetCardByName(LEAPING_TRAP));
			}
			list.Add(CardLoader.GetCardByName(BOW_CARD));
			list.Add(CardLoader.GetCardByName(BOW_CARD));
			if (RunState.CurrentRegionTier == 0)
			{
				list.Add(CardLoader.GetCardByName(CAPTURE_CARD));
			}
			return list;
		}

		private IEnumerator FlyBothDecksIntoOpponent()
		{
			CardDrawPiles3D drawPiles = CardDrawPiles3D.Instance;
			yield return drawPiles.Pile.DestroyCards(BOSS_CARD_RECEIVE_OFFSET, 30f, 0.5f);
			((CardDrawPiles)drawPiles).Deck.ClearCards();
			yield return drawPiles.SidePile.DestroyCards(BOSS_CARD_RECEIVE_OFFSET, 30f, 0.5f);
			drawPiles.SideDeck.ClearCards();
		}

		private IEnumerator GeneratePhaseThreeDeck(List<CardInfo> currentDeck)
		{
			List<CardInfo> phaseThreeDeck = BuildPhaseThreeDeck(currentDeck);
			CardDrawPiles3D drawPiles = CardDrawPiles3D.Instance;
			Traverse pileTraverse = Traverse.Create((object)drawPiles);
			((CardDrawPiles)drawPiles).Deck.Initialize(phaseThreeDeck, SaveManager.SaveFile.GetCurrentRandomSeed());
			yield return drawPiles.Pile.SpawnCards(phaseThreeDeck.Count, 0.5f);
			pileTraverse.Method("AssignHintActionToPiles", Array.Empty<object>()).GetValue();
			drawPiles.Pile.Draw();
			yield return ((CardDrawPiles)drawPiles).DrawCardFromDeck(((CardDrawPiles)drawPiles).Deck.GetCardByName(LEAPING_TRAP), (Action<PlayableCard>)null);
			drawPiles.Pile.Draw();
			yield return ((CardDrawPiles)drawPiles).DrawCardFromDeck(((CardDrawPiles)drawPiles).Deck.GetCardByName(SPIKE_TRAP_CARD), (Action<PlayableCard>)null);
			drawPiles.Pile.Draw();
			yield return ((CardDrawPiles)drawPiles).DrawCardFromDeck(((CardDrawPiles)drawPiles).Deck.GetCardByName(BOW_CARD), (Action<PlayableCard>)null);
			drawPiles.Pile.Draw();
			yield return ((CardDrawPiles)drawPiles).DrawCardFromDeck(((CardDrawPiles)drawPiles).Deck.GetCardByName(BOW_CARD), (Action<PlayableCard>)null);
		}

		private CardInfo CloneWithModsForTrapperDeck(CardInfo info)
		{
			//IL_0055: Unknown result type (might be due to invalid IL or missing references)
			//IL_005b: Expected O, but got Unknown
			//IL_009c: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a9: Unknown result type (might be due to invalid IL or missing references)
			object obj = info.Clone();
			CardInfo val = (CardInfo)((obj is CardInfo) ? obj : null);
			foreach (CardModificationInfo mod in info.Mods)
			{
				List<CardModificationInfo> mods = val.Mods;
				object obj2 = mod.Clone();
				mods.Add((CardModificationInfo)((obj2 is CardModificationInfo) ? obj2 : null));
			}
			CardModificationInfo val2 = new CardModificationInfo();
			val2.negateAbilities = new List<Ability>();
			foreach (Ability item in val.Abilities.Where((Ability ab) => !AbilitiesUtil.GetInfo(ab).opponentUsable))
			{
				val2.negateAbilities.Add(item);
			}
			val.Mods.Add(val2);
			return val;
		}

		private List<List<CardInfo>> BuildTurnPlan(List<CardInfo> currentDeck)
		{
			List<List<CardInfo>> list = new List<List<CardInfo>>();
			int num = 0;
			while (num < currentDeck.Count)
			{
				List<CardInfo> list2 = new List<CardInfo>();
				list2.Add(CloneWithModsForTrapperDeck(currentDeck[num]));
				num++;
				if (num < currentDeck.Count)
				{
					list2.Add(CloneWithModsForTrapperDeck(currentDeck[num]));
					num++;
				}
				list.Add(list2);
				if (list.Count > 5)
				{
					list.Add(new List<CardInfo>());
				}
			}
			return list;
		}

		public override IEnumerator StartNewPhaseSequence()
		{
			if (((Opponent)this).NumLives >= 2)
			{
				yield return <>n__1();
				yield break;
			}
			Singleton<ViewManager>.Instance.Controller.LockState = (ViewLockState)1;
			Singleton<ViewManager>.Instance.SwitchToView((View)1, false, false);
			yield return Singleton<TextDisplayer>.Instance.PlayDialogueEvent("TrapperTraderPhaseThree", (MessageAdvanceMode)1, (EventIntersectMode)0, (string[])null, (Action<Line>)null);
			yield return ((Opponent)this).ClearQueue();
			yield return ((Opponent)this).ClearBoard();
			foreach (CardSlot cardSlot in Singleton<BoardManager>.Instance.PlayerSlotsCopy)
			{
				if ((Object)(object)cardSlot.Card != (Object)null)
				{
					((Card)cardSlot.Card).ExitBoard(0.4f, Vector3.zero);
					yield return (object)new WaitForSeconds(0.1f);
				}
			}
			yield return Singleton<PlayerHand>.Instance.CleanUp();
			yield return FlyBothDecksIntoOpponent();
			List<CardInfo> currentDeck2 = ((CardCollectionInfo)SaveManager.SaveFile.CurrentDeck).Cards;
			currentDeck2.Sort((CardInfo a, CardInfo b) => a.PowerLevel - b.PowerLevel);
			currentDeck2 = currentDeck2.Where(CardUsableByBoss).ToList();
			Singleton<PlayerHand>.Instance.Initialize();
			yield return GeneratePhaseThreeDeck(currentDeck2);
			((Opponent)this).Blueprint = null;
			((Opponent)this).ReplaceAndAppendTurnPlan(BuildTurnPlan(currentDeck2));
			yield return ((Opponent)this).QueueNewCards(true, true);
			Singleton<ViewManager>.Instance.Controller.LockState = (ViewLockState)0;
		}

		static TrapperTraderBossHardOpponent()
		{
			//IL_0037: Unknown result type (might be due to invalid IL or missing references)
			//IL_003c: Unknown result type (might be due to invalid IL or missing references)
			SpecialStatIcon[] array = new SpecialStatIcon[4];
			RuntimeHelpers.InitializeArray(array, (RuntimeFieldHandle)/*OpCode not supported: LdMemberToken*/);
			USELESS_STAT_ICONS = (SpecialStatIcon[])(object)array;
		}

		[CompilerGenerated]
		[DebuggerHidden]
		private IEnumerator <>n__0(EncounterData encounter)
		{
			return ((TrapperTraderBossOpponent)this).IntroSequence(encounter);
		}

		[CompilerGenerated]
		[DebuggerHidden]
		private IEnumerator <>n__1()
		{
			return ((TrapperTraderBossOpponent)this).StartNewPhaseSequence();
		}
	}
	public class TrapperTraderBossHardSequencer : TrapperTraderBattleSequencer
	{
	}
}
namespace Infiniscryption.Curses.Patchers
{
	[HarmonyPatch]
	internal static class CursedAchievements
	{
		internal static Achievement HIGH_LEVEL { get; private set; }

		internal static Achievement LOW_LEVEL { get; private set; }

		internal static Achievement DOUBLE_CHAOS { get; private set; }

		internal static Achievement TRIPLE_HAUNT { get; private set; }

		internal static Achievement SUPER_CELLO { get; private set; }

		internal static Achievement SHARK_POP { get; private set; }

		internal static Achievement HOT_POTATO { get; private set; }

		internal static void Register()
		{
			//IL_002a: Unknown result type (might be due to invalid IL or missing references)
			//IL_002f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0040: Unknown result type (might be due to invalid IL or missing references)
			//IL_0060: Unknown result type (might be due to invalid IL or missing references)
			//IL_007b: Unknown result type (might be due to invalid IL or missing references)
			//IL_009b: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b6: 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_00f1: Unknown result type (might be due to invalid IL or missing references)
			//IL_0111: Unknown result type (might be due to invalid IL or missing references)
			//IL_012c: Unknown result type (might be due to invalid IL or missing references)
			//IL_014c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0167: Unknown result type (might be due to invalid IL or missing references)
			//IL_0187: Unknown result type (might be due to invalid IL or missing references)
			//IL_01a2: Unknown result type (might be due to invalid IL or missing references)
			//IL_01c2: Unknown result type (might be due to invalid IL or missing references)
			//IL_01d7: Unknown result type (might be due to invalid IL or missing references)
			AchievementGroup iD = ModdedAchievementManager.NewGroup("zorro.inscryption.infiniscryption.curses", "Cursed Achievements", TextureHelper.GetImageAsTexture("achievement_locked.png", typeof(CursedAchievements).Assembly, (FilterMode)0)).ID;
			LOW_LEVEL = ModdedAchievementManager.New("zorro.inscryption.infiniscryption.curses", "Here For A Good Time", "Complete a run with a negative challenge level", false, iD, TextureHelper.GetImageAsTexture("achievement_251.png", typeof(CursedAchievements).Assembly, (FilterMode)0)).ID;
			HIGH_LEVEL = ModdedAchievementManager.New("zorro.inscryption.infiniscryption.curses", "Here For A Hard Time", "Complete a run with a challenge level above 250", false, iD, TextureHelper.GetImageAsTexture("achievement_251.png", typeof(CursedAchievements).Assembly, (FilterMode)0)).ID;
			DOUBLE_CHAOS = ModdedAchievementManager.New("zorro.inscryption.infiniscryption.curses", "Utter Insanity", "Complete a run with two Chaotic Enemy skulls active", false, iD, TextureHelper.GetImageAsTexture("achievement_double_chaos.png", typeof(CursedAchievements).Assembly, (FilterMode)0)).ID;
			TRIPLE_HAUNT = ModdedAchievementManager.New("zorro.inscryption.infiniscryption.curses", "Too Spooky", "Reach the maximum deathcard haunt level", false, iD, TextureHelper.GetImageAsTexture("achievement_triple_haunt.png", typeof(CursedAchievements).Assembly, (FilterMode)0)).ID;
			SUPER_CELLO = ModdedAchievementManager.New("zorro.inscryption.infiniscryption.curses", "That's No Moon", "Defeat the Limoncello with the Bigger Moon skull active", false, iD, TextureHelper.GetImageAsTexture("achievement_pirate.png", typeof(CursedAchievements).Assembly, (FilterMode)0)).ID;
			SHARK_POP = ModdedAchievementManager.New("zorro.inscryption.infiniscryption.curses", "'Tis But A Flesh Wound", "Retrieve a damaged card from the belly of a Mega Shark", false, iD, TextureHelper.GetImageAsTexture("achievement_sharkpop.png", typeof(CursedAchievements).Assembly, (FilterMode)0)).ID;
			HOT_POTATO = ModdedAchievementManager.New("zorro.inscryption.infiniscryption.curses", "Munitions Expert", "Safely dispose of a stick of dynamite", false, iD, TextureHelper.GetImageAsTexture("achievement_safety.png", typeof(CursedAchievements).Assembly, (FilterMode)0)).ID;
			CursePlugin.Log.LogDebug((object)$"Cursed Achievements Have Been Loaded. Group number is {iD}");
		}

		[HarmonyPatch(typeof(AscensionMenuScreens), "ConfigurePostGameScreens")]
		[HarmonyPrefix]
		private static void AscensionCompleteAchievements()
		{
			//IL_0013: Unknown result type (might be due to invalid IL or missing references)
			//IL_0027: Unknown result type (might be due to invalid IL or missing references)
			//IL_0047: 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_0063: 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)
			if (AscensionMenuScreens.ReturningFromSuccessfulRun)
			{
				if (AscensionSaveData.Data.GetNumChallengesOfTypeActive(RandomSigils.ID) >= 2)
				{
					AchievementManager.Unlock(DOUBLE_CHAOS);
				}
				if (AscensionSaveData.Data.GetActiveChallengePoints() > 250)
				{
					AchievementManager.Unlock(HIGH_LEVEL);
				}
				if (AscensionSaveData.Data.GetActiveChallengePoints() < 0)
				{
					AchievementManager.Unlock(LOW_LEVEL);
				}
				if (AscensionSaveData.Data.ChallengeIsActive(BiggerMoon.ID) && AscensionSaveData.Data.ChallengeIsActive((AscensionChallenge)15))
				{
					AchievementManager.Unlock(SUPER_CELLO);
				}
			}
		}
	}
	public static class BiggerMoon
	{
		public const string MOON = "!GIANTCARD_MOON";

		public const string PIRATESHIP = "!GIANTCARD_SHIP";

		public static AscensionChallenge ID { get; private set; }

		public static void Register(Harmony harmony)
		{
			//IL_0052: Unknown result type (might be due to invalid IL or missing references)
			ID = ChallengeManager.Add("zorro.inscryption.infiniscryption.curses", "Full Moon", "Giant cards like the moon have more attack and health", 20, TextureHelper.GetImageAsTexture("challenge_bigger_moon.png", typeof(BiggerMoon).Assembly, (FilterMode)0), TextureHelper.GetImageAsTexture("activated_challenge_bigger_moon.png", typeof(BiggerMoon).Assembly, (FilterMode)0), 0, false).Challenge.challengeType;
			CardManager.ModifyCardList += delegate(List<CardInfo> cards)
			{
				//IL_0006: Unknown result type (might be due to invalid IL or missing references)
				if (AscensionSaveData.Data.ChallengeIsActive(ID))
				{
					CardExtensions.CardByName((IEnumerable<CardInfo>)cards, "!GIANTCARD_MOON").baseAttack = 2;
					CardExtensions.CardByName((IEnumerable<CardInfo>)cards, "!GIANTCARD_MOON").baseHealth = 80;
					CardExtensions.CardByName((IEnumerable<CardInfo>)cards, "!GIANTCARD_SHIP").baseAttack = 3;
					CardExtensions.CardByName((IEnumerable<CardInfo>)cards, "!GIANTCARD_SHIP").baseHealth = 120;
				}
				return cards;
			};
			harmony.PatchAll(typeof(BiggerMoon));
		}

		[HarmonyPatch(typeof(BoardManager), "CreateCardInSlot")]
		[HarmonyPostfix]
		private static IEnumerator ShowChallengeWhenMakingMoon(IEnumerator sequence, CardInfo info)
		{
			if (((Object)info).name.Equals("!GIANTCARD_MOON") && SaveFile.IsAscension && AscensionSaveData.Data.ChallengeIsActive(ID))
			{
				ChallengeActivationUI.TryShowActivation(ID);
			}
			yield return sequence;
		}
	}
	public static class BoonsAssist
	{
		public static AscensionChallenge ID { get; private set; }

		public static void Register(Harmony harmony)
		{
			//IL_0052: Unknown result type (might be due to invalid IL or missing references)
			ID = ChallengeManager.Add("zorro.inscryption.infiniscryption.curses", "Minor Boon of the Bone Lord", "Start the game with a Minor Boon of the Bone Lord", -5, TextureHelper.GetImageAsTexture("assist_bones_boon.png", typeof(BoonsAssist).Assembly, (FilterMode)0), TextureHelper.GetImageAsTexture("activated_assist_bones_boon.png", typeof(BoonsAssist).Assembly, (FilterMode)0), 0, true).Challenge.challengeType;
			harmony.PatchAll(typeof(BoonsAssist));
		}

		[HarmonyPatch(typeof(AscensionSaveData), "NewRun")]
		[HarmonyPostfix]
		[HarmonyAfter(new string[] { "zorro.inscryption.infiniscryption.kayceestarters" })]
		public static void AddBoonToStart(ref AscensionSaveData __instance)
		{
			//IL_0022: Unknown result type (might be due to invalid IL or missing references)
			for (int i = 0; i < AscensionSaveData.Data.GetNumChallengesOfTypeActive(ID); i++)
			{
				__instance.currentRun.playerDeck.AddBoon((Type)7);
			}
		}
	}
	public class DeathcardGenerator
	{
		private static readonly string[] DEATHCARD_NAMES = new string[26]
		{
			"Aaron", "Mad Hatter", "Julian", "Joseph", "Ingo", "Green", "Never Named", "Matzie", "Lily", "Deer Sir",
			"Gary", "Ara", "Bitty", "Papi", "Hayper", "Slime", "Blind", "Kek", "Cactus", "xXxStoner420BongMasterxXx",
			"Void", "Warrior", "Spritz", "Penguin", "Jury", "Thunder"
		};

		public static CardModificationInfo GenerateMod(int hauntLevel)
		{
			//IL_0060: Unknown result type (might be due to invalid IL or missing references)
			//IL_008f: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a9: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b3: Expected O, but got Unknown
			//IL_007f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0082: Unknown result type (might be due to invalid IL or missing references)
			//IL_008c: Expected O, but got Unknown
			List<AbilityInfo> list = ScriptableObjectLoader<AbilityInfo>.AllData.FindAll((AbilityInfo x) => x.metaCategories.Contains((AbilityMetaCategory)1) && x.opponentUsable);
			int num = 3 + hauntLevel + 2 * RunState.Run.regionTier;
			CardModificationInfo val = CardInfoGenerator.CreateRandomizedAbilitiesStatsMod(list, num, 1, 2);
			int num2 = SaveManager.saveFile.GetCurrentRandomSeed() + 110;
			FigurineType val2 = (FigurineType)SeededRandom.Range(0, 8, num2++);
			if ((double)SeededRandom.Value(num2++) < 0.2)
			{
				val.deathCardInfo = new DeathCardInfo(val2, true);
			}
			else
			{
				val.deathCardInfo = new DeathCardInfo(val2, SeededRandom.Range(0, 6, num2++), SeededRandom.Range(0, 6, num2++));
			}
			val.nameReplacement = DEATHCARD_NAMES[SeededRandom.Range(0, DEATHCARD_NAMES.Length, num2++)];
			return val;
		}
	}
	public static class DeathcardHaunt
	{
		public class IntWrapper
		{
			public int Value { get; set; }
		}

		public class TalkWhenGhostDiesHandler : TriggerReceiver
		{
			public override bool RespondsToPreDeathAnimation(bool wasSacrifice)
			{
				return true;
			}

			public override IEnumerator OnPreDeathAnimation(bool wasSacrifice)
			{
				return DeathcardOuttroSequence();
			}
		}

		private static ConditionalWeakTable<CardInfo, IntWrapper> deathcardAnimationPlayTable = new ConditionalWeakTable<CardInfo, IntWrapper>();

		private static ConditionalWeakTable<CardTriggerHandler, List<TriggerReceiver>> _customReceivers = new ConditionalWeakTable<CardTriggerHandler, List<TriggerReceiver>>();

		internal const string DEATHCARD_INTRO_CLIP = "wind_blowing_loop";

		private const float FADE_IN_DURATION = 1f;

		private const float FADE_OUT_DURATION = 1f;

		private static CardInfo _deathcardOnBoard = null;

		private static bool _sawDeathcard = false;

		private static string _oldLoopName = null;

		private static float _oldVolume = 0f;

		private static Vector3[] SLOT_OFFSETS = (Vector3[])(object)new Vector3[4]
		{
			new Vector3(-2f, -1f, 1.5f),
			new Vector3(-0.5f, -1f, 1.5f),
			new Vector3(1f, -1f, 1.5f),
			new Vector3(2.4f, -1f, 1.5f)
		};

		private const int MAX_HAUNT_LEVEL = 11;

		private static List<GameObject> _orbitingFace = null;

		private static Vector3 UP_REF = Vector3.up;

		private static Vector3 START_REF = Vector3.forward;

		public static AscensionChallenge ID { get; private set; }

		private static int HauntLevel => ModdedSaveManager.RunState.GetValueAsInt("zorro.inscryption.infiniscryption.curses", "Curse.BaseHauntLevel") + (RunState.Run.survivorsDead ? 3 : 0) + RunState.Run.playerDeck.Boons.FindAll((BoonData boon) => (int)boon.type == 7).Count + RunState.Run.playerDeck.Boons.FindAll((BoonData boon) => (int)boon.type == 6).Count * 2;

		private static bool HasExplainedHaunt
		{
			get
			{
				return ModdedSaveManager.SaveData.GetValueAsBoolean("zorro.inscryption.infiniscryption.curses", "Curses.HauntExplanation");
			}
			set
			{
				ModdedSaveManager.SaveData.SetValue("zorro.inscryption.infiniscryption.curses", "Curses.HauntExplanation", (object)value);
			}
		}

		private static void SetHauntedCardFlag(CardInfo card)
		{
			if (!deathcardAnimationPlayTable.TryGetValue(card, out var _))
			{
				deathcardAnimationPlayTable.Add(card, new IntWrapper
				{
					Value = -1
				});
			}
		}

		private static bool GetHauntedCardFlag(CardInfo card)
		{
			IntWrapper value;
			return deathcardAnimationPlayTable.TryGetValue(card, out value);
		}

		private static void SetHauntedCardSlot(CardInfo card, int slot)
		{
			if (!deathcardAnimationPlayTable.TryGetValue(card, out var value))
			{
				deathcardAnimationPlayTable.Add(card, new IntWrapper
				{
					Value = slot
				});
			}
			else
			{
				value.Value = slot;
			}
		}

		private static int GetHauntedCardSlot(CardInfo card)
		{
			if (deathcardAnimationPlayTable.TryGetValue(card, out var value))
			{
				return value.Value;
			}
			return -1;
		}

		public static CardInfo GetRandomDeathcard()
		{
			CardModificationInfo val = DeathcardGenerator.GenerateMod(HauntLevel);
			CardInfo val2 = CardLoader.CreateDeathCard(val);
			SetHauntedCardFlag(val2);
			return val2;
		}

		public static void AddReceiver(CardTriggerHandler handler, TriggerReceiver receiver)
		{
			List<TriggerReceiver> value = null;
			if (!_customReceivers.TryGetValue(handler, out value))
			{
				value = new List<TriggerReceiver>();
				_customReceivers.Add(handler, value);
			}
			value.Add(receiver);
		}

		public static List<TriggerReceiver> GetReceivers(CardTriggerHandler handler)
		{
			List<TriggerReceiver> value = null;
			_customReceivers.TryGetValue(handler, out value);
			return value;
		}

		[HarmonyPatch(typeof(PlayableCard), "AttachAbilities")]
		[HarmonyPostfix]
		public static void AttachDeathListener(CardInfo info, ref PlayableCard __instance)
		{
			CursePlugin.Log.LogInfo((object)("In Opponent.CreateCard " + ((Object)info).name));
			if (GetHauntedCardFlag(info))
			{
				CursePlugin.Log.LogInfo((object)"Adding ghostdieshandler");
				TalkWhenGhostDiesHandler receiver = ((Component)__instance).gameObject.AddComponent<TalkWhenGhostDiesHandler>();
				AddReceiver(__instance.TriggerHandler, (TriggerReceiver)(object)receiver);
			}
		}

		[HarmonyPatch(typeof(CardTriggerHandler), "GetAllReceivers")]
		[HarmonyPostfix]
		public static void GetCustomListeners(ref List<TriggerReceiver> __result, ref CardTriggerHandler __instance)
		{
			List<TriggerReceiver> receivers = GetReceivers(__instance);
			if (receivers != null)
			{
				__result.AddRange(receivers);
			}
		}

		public static void Register(Harmony harmony)
		{
			//IL_0052: Unknown result type (might be due to invalid IL or missing references)
			ID = ChallengeManager.Add("zorro.inscryption.infiniscryption.curses", "Haunted Past", "Deathcards will sometimes attack you in battle", 15, TextureHelper.GetImageAsTexture("challenge_deathcards.png", typeof(DeathcardHaunt).Assembly, (FilterMode)0), TextureHelper.GetImageAsTexture("ascensionicon_activated_deathcards.png", typeof(DeathcardHaunt).Assembly, (FilterMode)0), 0, false).Challenge.challengeType;
			harmony.PatchAll(typeof(DeathcardHaunt));
			DialogueHelper.GenerateVeryLargeDialogue("DeathcardArrives", new string[3] { "you feel a chill in the air", "the hair stands up on the back of your neck", "[c:bR][v:0][c:] has arrived" }, new string[3] { "you suddenly feel weak", "your teeth start to chatter", "[c:bR][v:0][c:] is coming" }, new string[2] { "you can't explain how", "but you can feel the presence of [c:bR][v:0][c:]" }, new string[1] { "it finally happened: [c:bR][v:0][c:] is here" });
			DialogueHelper.GenerateVeryLargeDialogue("DeathcardZoom", new string[2] { "[c:O]\"I have been looking for you\"[c:] says the apparition", "[c:O]\"And now you must die!\"[c:]" }, new string[2] { "the apparition has nothing to say", "but you sense that it is here for you" }, new string[2] { "[c:O]\"you made a mistake coming here\"[c:] it growls", "[c:O]\"let me show you the way home\"[c:]" }, new string[2] { "the apparition seems lonely", "it wants you to join it in the afterlife" });
			DialogueHelper.GenerateVeryLargeDialogue("DeathcardDies", new string[2] { "the apparition fades into the wind", "you can't shake the feeling there are [c:O]more[c:] out there waiting" });
			DialogueHelper.GenerateVeryLargeDialogue("DeathcardWins", new string[1] { "[c:bR][v:0][c:] shivers with delight as your candle is extinguished" });
			DialogueHelper.GenerateLargeDialogue("HauntedExplanation", "do you see the [c:O]apparition[c:] encircling you?", "you have become [c:O]haunted[c:] by [c:O]those who have come before[c:]", "the more you [c:O]win in battle[c:] the angrier they become", "and they may [c:O]oppose you in battle[c:] in the future");
		}

		public static bool RollForDeathcard()
		{
			//IL_0059: Unknown result type (might be due to invalid IL or missing references)
			if (CursePlugin.Instance.DebugCode.ToLowerInvariant().Contains("deathcard"))
			{
				return true;
			}
			if (HauntLevel <= 1)
			{
				return false;
			}
			float num = SeededRandom.Value(SaveManager.SaveFile.GetCurrentRandomSeed());
			return num < (float)HauntLevel / 11f && AscensionSaveData.Data.ChallengeIsActive(ID);
		}

		[HarmonyPatch(typeof(TurnManager), "CleanupPhase")]
		[HarmonyPrefix]
		public static void ResetPlayerHauntLevelWhenBattleLost(ref TurnManager __instance)
		{
			bool flag = __instance.Opponent.NumLives <= 0 || __instance.Opponent.Surrendered;
			CursePlugin.Log.LogInfo((object)$"Battle over. Player Won = {flag}");
			if (flag)
			{
				if (!_sawDeathcard)
				{
					IncreaseHaunt();
				}
			}
			else
			{
				ResetHaunt();
			}
			if (_oldLoopName != null)
			{
				CursePlugin.Log.LogDebug((object)("DEATHCARDAUDIO: End of battle. Immediately setting old loop " + _oldLoopName + " back in"));
				AudioController.Instance.SetLoopAndPlay(_oldLoopName, 0, true, true);
				AudioController.Instance.SetLoopVolumeImmediate(_oldVolume, 0);
				_oldLoopName = null;
			}
			else
			{
				CursePlugin.Log.LogDebug((object)"DEATHCARDAUDIO: End of battle. No audio to resume.");
			}
			_sawDeathcard = false;
			_deathcardOnBoard = null;
		}

		public static double TurnAverage(IEnumerable<CardInfo> turn)
		{
			int num = 0;
			double num2 = 0.0;
			foreach (CardInfo item in turn)
			{
				num2 += (double)item.PowerLevel;
				num++;
			}
			return (num == 0) ? (-100.0) : (num2 / (double)num);
		}

		[HarmonyPatch(typeof(EncounterBuilder), "Build")]
		[HarmonyPostfix]
		public static void AddDeathcardToEncounter(ref EncounterData __result, CardBattleNodeData nodeData)
		{
			//IL_000c: Unknown result type (might be due to invalid IL or missing references)
			if (!AscensionSaveData.Data.ChallengeIsActive(ID) || nodeData is BossBattleNodeData)
			{
				return;
			}
			CursePlugin.Log.LogInfo((object)"Checking to see if we should add a deathcard...");
			if (!RollForDeathcard())
			{
				return;
			}
			CursePlugin.Log.LogInfo((object)"Adding a deathcard...");
			List<List<CardInfo>> tp = __result.opponentTurnPlan;
			CardInfo deathcard = GetRandomDeathcard();
			List<double> differences = tp.Select((List<CardInfo> cards) => Math.Abs((double)deathcard.PowerLevel - TurnAverage(cards))).ToList();
			int idealTurn = Enumerable.Range(0, differences.Count).Aggregate((int a, int b) => (differences[a] < differences[b]) ? a : b);
			if (idealTurn > 2)
			{
				if (tp[2].Count > 0)
				{
					idealTurn = 2;
				}
				else if (tp[1].Count > 0)
				{
					idealTurn = 1;
				}
				else
				{
					idealTurn = 0;
				}
			}
			int num = Enumerable.Range(0, tp[idealTurn].Count).Aggregate((int a, int b) => (tp[idealTurn][a].PowerLevel < tp[idealTurn][b].PowerLevel) ? a : b);
			tp[idealTurn][num] = deathcard;
			_deathcardOnBoard = deathcard;
			SetHauntedCardSlot(deathcard, num);
			CursePlugin.Log.LogInfo((object)$"Added a deathcard in turn {idealTurn} in slot {num}");
		}

		[HarmonyPatch(typeof(Opponent), "CanOfferSurrender")]
		[HarmonyPostfix]
		public static void PreventSurrenderIfDeathcardInPlan(ref bool __result)
		{
			if ((Object)(object)_deathcardOnBoard != (Object)null)
			{
				__result = false;
			}
		}

		[HarmonyPatch(typeof(Opponent), "QueueCard")]
		[HarmonyPostfix]
		public static IEnumerator PlayDeathcardIntro(IEnumerator sequenceEvent, CardInfo cardInfo, CardSlot slot)
		{
			CursePlugin.Log.LogInfo((object)"In QueueCard");
			sequenceEvent.MoveNext();
			yield return sequenceEvent.Current;
			sequenceEvent.MoveNext();
			int customSlot = GetHauntedCardSlot(cardInfo);
			if (customSlot >= 0)
			{
				_sawDeathcard = true;
				CursePlugin.Log.LogInfo((object)"Playing animation");
				View oldView = Singleton<ViewManager>.Instance.CurrentView;
				Singleton<ViewManager>.Instance.SwitchToView((View)33, false, false);
				_oldLoopName = ((Object)AudioController.Instance.loopSources[0].clip).name;
				_oldVolume = AudioController.Instance.loopSources[0].volume;
				AudioController.Instance.CrossFadeLoop("wind_blowing_loop", 1f, 1f, 0f);
				CursePlugin.Log.LogDebug((object)"DEATHCARDAUDIO: Cross-faded audio loop");
				ChallengeActivationUI.TryShowActivation(ID);
				yield return Singleton<TextDisplayer>.Instance.PlayDialogueEvent("DeathcardArrives", (MessageAdvanceMode)1, (EventIntersectMode)0, new string[1] { cardInfo.DisplayedNameLocalized }, (Action<Line>)null);
				yield return (object)new WaitForSeconds(0.25f);
				ViewInfo targetPos = ViewManager.GetViewInfo((View)6);
				Vector3 translationOffset = targetPos.camPosition + SLOT_OFFSETS[slot.Index] - ViewManager.GetViewInfo(Singleton<ViewManager>.Instance.CurrentView).camPosition;
				Vector3 rotationOffset = targetPos.camRotation - ViewManager.GetViewInfo(Singleton<ViewManager>.Instance.CurrentView).camRotation;
				Singleton<ViewManager>.Instance.OffsetPosition(translationOffset, 0.75f);
				Singleton<ViewManager>.Instance.OffsetRotation(rotationOffset, 0.75f);
				yield return Singleton<TextDisplayer>.Instance.PlayDialogueEvent("DeathcardZoom", (MessageAdvanceMode)1, (EventIntersectMode)0, (string[])null, (Action<Line>)null);
				yield return (object)new WaitForSeconds(0.5f);
				Singleton<ViewManager>.Instance.SwitchToView(oldView, false, false);
			}
		}

		public static IEnumerator DeathcardOuttroSequence()
		{
			yield return Singleton<TextDisplayer>.Instance.PlayDialogueEvent("DeathcardDies", (MessageAdvanceMode)1, (EventIntersectMode)0, (string[])null, (Action<Line>)null);
			if (_oldLoopName != null)
			{
				CursePlugin.Log.LogDebug((object)"DEATHCARDAUDIO: Deathcard died. Resuming background audio");
				AudioController.Instance.CrossFadeLoop(_oldLoopName, 1f, _oldVolume, 0f);
				_oldLoopName = null;
			}
			else
			{
				CursePlugin.Log.LogDebug((object)"DEATHCARDAUDIO: Deathcard died. No audio to resume.");
				CursePlugin.Log.LogInfo((object)"No audio info to resume");
			}
			IncreaseHaunt(-1);
		}

		[HarmonyPatch(typeof(CandleHolder), "BlowOutCandleSequence")]
		[HarmonyPostfix]
		public static IEnumerator DeathcardWonSequence(IEnumerator sequenceResult)
		{
			if ((Object)(object)_deathcardOnBoard == (Object)null || !AscensionSaveData.Data.ChallengeIsActive(ID))
			{
				while (sequenceResult.MoveNext())
				{
					yield return sequenceResult.Current;
				}
				yield break;
			}
			sequenceResult.MoveNext();
			yield return sequenceResult.Current;
			yield return Singleton<TextDisplayer>.Instance.PlayDialogueEvent("DeathcardWins", (MessageAdvanceMode)1, (EventIntersectMode)0, new string[1] { _deathcardOnBoard.DisplayedNameLocalized }, (Action<Line>)null);
			while (sequenceResult.MoveNext())
			{
				yield return sequenceResult.Current;
			}
		}

		public static void ResetHaunt(int value = 0)
		{
			CursePlugin.Log.LogInfo((object)$"Resetting haunt to {value}");
			ModdedSaveManager.RunState.SetValue("zorro.inscryption.infiniscryption.curses", "Curse.BaseHauntLevel", (object)value);
		}

		public static void IncreaseHaunt(int by = 1)
		{
			int num = Mathf.Clamp(ModdedSaveManager.RunState.GetValueAsInt("zorro.inscryption.infiniscryption.curses", "Curse.BaseHauntLevel") + by, 0, 11);
			CursePlugin.Log.LogInfo((object)$"Updated haunt by {by} to {num}");
			ModdedSaveManager.RunState.SetValue("zorro.inscryption.infiniscryption.curses", "Curse.BaseHauntLevel", (object)num.ToString());
		}

		private static void BuildOrbiters(AnimatedGameMapMarker marker)
		{
			//IL_0023: Unknown result type (might be due to invalid IL or missing references)
			//IL_0029: Expected O, but got Unknown
			//IL_005a: Unknown result type (might be due to invalid IL or missing references)
			//IL_006b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0070: Unknown result type (might be due to invalid IL or missing references)
			//IL_0075: Unknown result type (might be due to invalid IL or missing references)
			//IL_00bc: Unknown result type (might be due to invalid IL or missing references)
			//IL_00cb: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00fc: Unknown result type (might be due to invalid IL or missing references)
			CursePlugin.Log.LogInfo((object)"Adding rotating sprite");
			_orbitingFace = new List<GameObject>();
			for (int i = 0; i < 3; i++)
			{
				GameObject val = new GameObject();
				val.transform.SetParent(((Component)marker.Anim).gameObject.transform);
				val.transform.localPosition = new Vector3(0f, 0f, 0f);
				val.transform.rotation = Quaternion.LookRotation(-UP_REF);
				SpriteRenderer val2 = val.AddComponent<SpriteRenderer>();
				Texture2D imageAsTexture = TextureHelper.GetImageAsTexture("orbit_icon.png", typeof(DeathcardHaunt).Assembly, (FilterMode)0);
				val2.sprite = Sprite.Create(imageAsTexture, new Rect(0f, 0f, (float)((Texture)imageAsTexture).width, (float)((Texture)imageAsTexture).height), new Vector2(0.5f, 0.5f));
				Orbiter orbiter = val.AddComponent<Orbiter>();
				orbiter.Cos0Vector = START_REF;
				orbiter.Sin0Vector = Vector3.Cross(START_REF, UP_REF);
				orbiter.OrbitRadius = 0.35f;
				orbiter.OrbitSpeed = 0.25f;
				orbiter.ThetaOffset = i * 120;
				orbiter.StartFromBeginning();
				_orbitingFace.Add(val);
			}
			SyncOrbiters(marker);
		}

		[HarmonyPatch(typeof(PlayerMarker), "Awake")]
		[HarmonyPostfix]
		public static void AttachAnimationToPlayerMarker(ref PlayerMarker __instance)
		{
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			if (AscensionSaveData.Data.ChallengeIsActive(ID) && _orbitingFace == null)
			{
				BuildOrbiters((AnimatedGameMapMarker)(object)__instance);
			}
		}

		private static void SyncOrbiters(AnimatedGameMapMarker marker)
		{
			//IL_00d8: Unknown result type (might be due to invalid IL or missing references)
			//IL_0138: Unknown result type (might be due to invalid IL or missing references)
			if (_orbitingFace == null)
			{
				BuildOrbiters(marker);
				return;
			}
			foreach (GameObject item in _orbitingFace)
			{
				if ((Object)(object)item == (Object)null)
				{
					BuildOrbiters(marker);
					return;
				}
			}
			int hauntLevel = HauntLevel;
			CursePlugin.Log.LogInfo((object)$"Setting orbit for haunt level {hauntLevel}");
			if ((!_orbitingFace[2].activeSelf && hauntLevel >= 8) || (!_orbitingFace[1].activeSelf && hauntLevel >= 5) || (!_orbitingFace[0].activeSelf && hauntLevel >= 2))
			{
				ChallengeActivationUI.TryShowActivation(ID);
			}
			_orbitingFace[2].SetActive(hauntLevel >= 8);
			_orbitingFace[1].SetActive(hauntLevel >= 5);
			_orbitingFace[0].SetActive(hauntLevel >= 2);
			if (hauntLevel >= 8)
			{
				AchievementManager.Unlock(CursedAchievements.TRIPLE_HAUNT);
			}
		}

		[HarmonyPatch(typeof(AnimatedGameMapMarker), "Show")]
		[HarmonyPostfix]
		public static void SetActiveOrbiters(ref AnimatedGameMapMarker __instance)
		{
			//IL_0016: Unknown result type (might be due to invalid IL or missing references)
			CursePlugin.Log.LogInfo((object)"Showing map marker");
			if (AscensionSaveData.Data.ChallengeIsActive(ID) && __instance is PlayerMarker)
			{
				CursePlugin.Log.LogInfo((object)"Is player marker");
				if (_orbitingFace != null)
				{
					SyncOrbiters(__instance);
				}
				else
				{
					BuildOrbiters(__instance);
				}
			}
		}

		[HarmonyPatch(typeof(GameMap), "ShowMapSequence")]
		[HarmonyPostfix]
		public static IEnumerator GiveHauntExplanation(IEnumerator sequenceResult)
		{
			while (sequenceResult.MoveNext())
			{
				yield return sequenceResult.Current;
			}
			if (AscensionSaveData.Data.ChallengeIsActive(ID) && !HasExplainedHaunt && HauntLevel >= 2)
			{
				yield return Singleton<TextDisplayer>.Instance.PlayDialogueEvent("HauntedExplanation", (MessageAdvanceMode)1, (EventIntersectMode)0, (string[])null, (Action<Line>)null);
				HasExplainedHaunt = true;
			}
		}
	}
	public static class DrawDynamite
	{
		public static AscensionChallenge ID { get; private set; }

		public static void Register(Harmony harmony)
		{
			//IL_0051: Unknown result type (might be due to invalid IL or missing references)
			ID = ChallengeManager.Add("zorro.inscryption.infiniscryption.curses", "Exploding Cards", "Dynamite is added to your deck after every boss battle", 5, TextureHelper.GetImageAsTexture("challenge_dynamite.png", typeof(DrawDynamite).Assembly, (FilterMode)0), TextureHelper.GetImageAsTexture("activated_challenge_dynamite.png", typeof(DrawDynamite).Assembly, (FilterMode)0), 0, false).Challenge.challengeType;
			harmony.PatchAll(typeof(DrawDynamite));
		}

		[HarmonyPatch(typeof(TurnManager), "CleanupPhase")]
		[HarmonyPrefix]
		public static void AddDynamiteToDeck()
		{
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			if (AscensionSaveData.Data.ChallengeIsActive(ID) && Singleton<TurnManager>.Instance.opponent is Part1BossOpponent && Singleton<TurnManager>.Instance.PlayerIsWinner())
			{
				((CardCollectionInfo)AscensionSaveData.Data.currentRun.playerDeck).AddCard(CardLoader.GetCardByName(ProspectorBossHardOpponent.DYNAMITE));
			}
		}

		[HarmonyPatch(typeof(CardRemoveSequencer), "GetValidCards")]
		[HarmonyPostfix]
		private static void DontAllowSacrificeDynamite(ref List<CardInfo> __result)
		{
			__result.RemoveAll((CardInfo ci) => ci.HasAbility(Dynamite.AbilityID));
		}
	}
	public static class GoldenPeltStart
	{
		public static AscensionChallenge ID { get; private set; }

		public static CardTemple ScreenState
		{
			get
			{
				//IL_0034: Unknown result type (might be due to invalid IL or missing references)
				//IL_0039: Unknown result type (might be due to invalid IL or missing references)
				//IL_0021: 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)
				string value = ModdedSaveManager.SaveData.GetValue("zorro.inscryption.infiniscryption.p03kayceerun", "ScreenState");
				if (string.IsNullOrEmpty(value))
				{
					return (CardTemple)0;
				}
				return (CardTemple)Enum.Parse(typeof(CardTemple), value);
			}
		}

		public static bool IsP03Run
		{
			get
			{
				//IL_0035: Unknown result type (might be due to invalid IL or missing references)
				//IL_003b: Invalid comparison between Unknown and I4
				try
				{
					CardLoader.GetCardByName("P03KCM_Draft_Token_Rare");
				}
				catch
				{
					return false;
				}
				if (SceneLoader.ActiveSceneName.ToLowerInvariant().Contains("part3"))
				{
					return true;
				}
				if ((int)ScreenState == 2)
				{
					return true;
				}
				if (SceneLoader.ActiveSceneName.ToLowerInvariant().Contains("part1"))
				{
					return false;
				}
				if (AscensionSaveData.Data != null && AscensionSaveData.Data.currentRun != null && AscensionSaveData.Data.currentRun.playerLives > 0)
				{
					return ModdedSaveManager.SaveData.GetValueAsBoolean("zorro.inscryption.infiniscryption.p03kayceerun", "IsP03Run");
				}
				return false;
			}
		}

		public static void Register(Harmony harmony)
		{
			//IL_0054: Unknown result type (might be due to invalid IL or missing references)
			FullChallenge val = ChallengeManager.Add("zorro.inscryption.infiniscryption.curses", "Golden Beginnings", "Start the game with the ability to draft a rare card", -10, TextureHelper.GetImageAsTexture("assist_golden_pelt.png", typeof(GoldenPeltStart).Assembly, (FilterMode)0), ChallengeManager.HAPPY_ACTIVATED_SPRITE, 0, true);
			val.SetFlags(new object[1] { "P03" });
			ID = val.Challenge.challengeType;
			harmony.PatchAll(typeof(GoldenPeltStart));
		}

		[HarmonyPatch(typeof(AscensionSaveData), "NewRun")]
		[HarmonyPostfix]
		[HarmonyAfter(new string[] { "zorro.inscryption.infiniscryption.kayceestarters" })]
		private static void AddGoldenPeltToStart(ref AscensionSaveData __instance)
		{
			//IL_003b: Unknown result type (might be due to invalid IL or missing references)
			string text = (IsP03Run ? "P03KCM_Draft_Token_Rare" : "PeltGolden");
			for (int i = 0; i < AscensionSaveData.Data.GetNumChallengesOfTypeActive(ID); i++)
			{
				((CardCollectionInfo)__instance.currentRun.playerDeck).AddCard(CardLoader.GetCardByName(text));
			}
		}

		[HarmonyPatch(typeof(Part3SaveData), "Initialize")]
		[HarmonyPostfix]
		[HarmonyAfter(new string[] { "zorro.inscryption.infiniscryption.p03kayceerun" })]
		private static void AddTokenToStart(ref Part3SaveData __instance)
		{
			//IL_0040: Unknown result type (might be due to invalid IL or missing references)
			string text = (IsP03Run ? "P03KCM_Draft_Token_Rare" : "PeltGolden");
			if (SaveFile.IsAscension)
			{
				for (int i = 0; i < AscensionSaveData.Data.GetNumChallengesOfTypeActive(ID); i++)
				{
					((CardCollectionInfo)__instance.deck).AddCard(CardLoader.GetCardByName(text));
				}
			}
		}

		[HarmonyPatch(typeof(MapGenerator), "ForceFirstNodeTraderForAscension")]
		[HarmonyPrefix]
		private static bool LogicUpdateForPelts(int rowIndex, ref bool __result)
		{
			__result = SaveFile.IsAscension && rowIndex == 1 && RunState.Run.regionTier == 0 && ((CardCollectionInfo)AscensionSaveData.Data.currentRun.playerDeck).Cards.Any((CardInfo ci) => CardLoader.PeltNames.Contains(((Object)ci).name));
			return false;
		}
	}
	public static class HarderBosses
	{
		private static Type[] SUPPORTED_OPPONENTS;

		public static AscensionChallenge ID { get; private set; }

		public static void Register(Harmony harmony)
		{
			//IL_0052: Unknown result type (might be due to invalid IL or missing references)
			ID = ChallengeManager.Add("zorro.inscryption.infiniscryption.curses", "Boss Revenge", "Each boss has an additional phase", 10, TextureHelper.GetImageAsTexture("challenge_boss_revenge.png", typeof(HarderBosses).Assembly, (FilterMode)0), TextureHelper.GetImageAsTexture("ascensionicon_activated_bossrevenge.png", typeof(HarderBosses).Assembly, (FilterMode)0), 0, false).Challenge.challengeType;
			harmony.PatchAll(typeof(HarderBosses));
			Dynamite.RegisterCardAndAbilities(harmony);
			Digester.RegisterCardAndAbilities(harmony);
			Bitten.RegisterCardAndAbilities(harmony);
			Bow.RegisterCardAndAbilities(harmony);
			DialogueHelper.GenerateDialogue("ProspectorExtraCandle", "Let's play longer this time!", "A lil' more fun never hurt nobody!", "I got a little somethin' special for ya!", "Heeeeeeee-haaw! Let's keep the fun goin'!");
			DialogueHelper.GenerateDialogue("AnglerExtraCandle", "You want more fish?", "We get extra fish.", "Many fish this time.");
			DialogueHelper.GenerateDialogue("TrapperTraderExtraCandle", "I'm afraid our encounter today will take a little more time", "It looks like you and I have extra business to attend to");
			DialogueHelper.GenerateDialogue("CardIsSleep", "He swalled it whole..");
			DialogueHelper.GenerateDialogue("CardAtePoison", "Eating that was a bad idea..");
			DialogueHelper.GenerateDialogue("CardAteSharp", "That's a little uncomfortable..");
			DialogueHelper.GenerateDialogue("DigestedCardDeadForever", "Your [c:bR][v:0][c:] has been fully digested. You will never see it again.");
			DialogueHelper.GenerateDialogue("DigestingCard", "Your [c:bR][v:0][c:] is being slowly digested. It has [c:bR][v:1][c:] health left.");
			DialogueHelper.GenerateLargeDialogue("TrapperTraderPhaseThree", "I have yet another trade to propose", "This time, let us trade our whole decks");
			DialogueHelper.GenerateDialogue("HungryAgain", "He's hungry again", "Time for more morsels", "Back on the hunt");
			DialogueHelper.GenerateDialogue("CatchDynamite", "Think fast!", "Catch!", "Heads up!");
			DialogueHelper.GenerateLargeDialogue("ProspectorPhaseThree", "You're a dad-gum pain in my backside!", "Let's see you get past this!");
			DialogueHelper.GenerateDialogue("AnglerPhaseThree", "Fish not big enough. Get bigger fish.", "Little fish bad. Big fish better.", "Need better fish.");
			DialogueHelper.GenerateDialogue("ProspectorWolfSpawn", "That fella looks mighty curious about that [c:bR]empty lane[c:]");
		}

		internal static IEnumerator ShowExtraBossCandle(Part1BossOpponent opponent, string dialogueEvent)
		{
			Singleton<ViewManager>.Instance.Controller.LockState = (ViewLockState)1;
			ChallengeActivationUI.TryShowActivation(ID);
			Singleton<ViewManager>.Instance.SwitchToView((View)19, false, false);
			yield return (object)new WaitForSeconds(0.25f);
			yield return Singleton<TextDisplayer>.Instance.PlayDialogueEvent(dialogueEvent, (MessageAdvanceMode)1, (EventIntersectMode)0, (string[])null, (Action<Line>)null);
			yield return (object)new WaitForSeconds(0.4f);
			((Component)opponent).gameObject.GetComponentInChildren<BossSkull>().EnterHand();
			yield return (object)new WaitForSeconds(3.5f);
			Singleton<ViewManager>.Instance.SwitchToView((View)1, false, false);
			Singleton<ViewManager>.Instance.Controller.LockState = (ViewLockState)0;
		}

		private static void AddBossSequencer<T>(TurnManager manager) where T : SpecialBattleSequencer
		{
			Object.Destroy((Object)(object)manager.SpecialSequencer);
			SpecialBattleSequencer value = (SpecialBattleSequencer)(object)((Component)manager).gameObject.AddComponent<T>();
			Traverse val = Traverse.Create((object)manager);
			val.Property("SpecialSequencer", (object[])null).SetValue((object)value);
		}

		[HarmonyPatch(typeof(TurnManager), "UpdateSpecialSequencer")]
		[HarmonyPrefix]
		public static bool ReplaceSequencers(string specialBattleId, ref TurnManager __instance)
		{
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			if (AscensionSaveData.Data.ChallengeIsActive(ID))
			{
				if (specialBattleId == BossBattleSequencer.GetSequencerIdForBoss((Type)3))
				{
					AddBossSequencer<ProspectorBossHardSequencer>(__instance);
					return false;
				}
				if (specialBattleId == BossBattleSequencer.GetSequencerIdForBoss((Type)4))
				{
					AddBossSequencer<AnglerBossHardSequencer>(__instance);
					return false;
				}
				if (specialBattleId == BossBattleSequencer.GetSequencerIdForBoss((Type)6))
				{
					AddBossSequencer<TrapperTraderBossHardSequencer>(__instance);
					return false;
				}
			}
			return true;
		}

		[HarmonyPatch(typeof(Opponent), "SpawnOpponent")]
		[HarmonyPrefix]
		public static bool ReplaceOpponent(EncounterData encounterData, ref Opponent __result)
		{
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			//IL_0027: Unknown result type (might be due to invalid IL or missing references)
			//IL_0042: Unknown result type (might be due to invalid IL or missing references)
			//IL_0048: Expected O, but got Unknown
			//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_005b: Unknown result type (might be due to invalid IL or missing references)
			//IL_005c: Unknown result type (might be due to invalid IL or missing references)
			//IL_005e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0060: 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_0065: Unknown result type (might be due to invalid IL or missing references)
			//IL_007b: Expected I4, but got Unknown
			//IL_00e8: Unknown result type (might be due to invalid IL or missing references)
			if (!AscensionSaveData.Data.ChallengeIsActive(ID))
			{
				return true;
			}
			if (!SUPPORTED_OPPONENTS.Contains(encounterData.opponentType))
			{
				return true;
			}
			GameObject val = new GameObject();
			((Object)val).name = "Opponent";
			Type opponentType = encounterData.opponentType;
			Type val2 = opponentType;
			Type val3 = val2;
			Opponent val4 = (Opponent)((val3 - 3) switch
			{
				0 => val.AddComponent<ProspectorBossHardOpponent>(), 
				1 => val.AddComponent<AnglerBossHardOpponent>(), 
				3 => val.AddComponent<TrapperTraderBossHardOpponent>(), 
				_ => throw new InvalidOperationException("Somehow got into a patch for hard opponents with an unsupported opponent"), 
			});
			string text = encounterData.aiId;
			if (string.IsNullOrEmpty(text))
			{
				text = "AI";
			}
			? val5 = val4;
			object? obj = Activator.CreateInstance(CustomType.GetType("DiskCardGame", text));
			((Opponent)val5).AI = (AI)((obj is AI) ? obj : null);
			val4.NumLives = val4.StartingLives;
			val4.OpponentType = opponentType;
			val4.TurnPlan = val4.ModifyTurnPlan(encounterData.opponentTurnPlan);
			val4.Blueprint = encounterData.Blueprint;
			val4.Difficulty = encounterData.Difficulty;
			val4.ExtraTurnsToSurrender = SeededRandom.Range(0, 3, SaveManager.SaveFile.GetCurrentRandomSeed());
			__result = val4;
			return false;
		}

		static HarderBosses()
		{
			Type[] array = new Type[3];
			RuntimeHelpers.InitializeArray(array, (RuntimeFieldHandle)/*OpCode not supported: LdMemberToken*/);
			SUPPORTED_OPPONENTS = (Type[])(object)array;
		}
	}
	public static class NoOneHitKills
	{
		public static AscensionChallenge ID { get; private set; }

		public static void Register(Harmony harmony)
		{
			//IL_003d: Unknown result type (might be due to invalid IL or missing references)
			ID = ChallengeManager.Add("zorro.inscryption.infiniscryption.curses", "Two Turn Minimum", "You cannot deal lethal damage on the first turn.", 10, TextureHelper.GetImageAsTexture("challenge_no_ohk.png", typeof(NoOneHitKills).Assembly, (FilterMode)0), ChallengeManager.DEFAULT_ACTIVATED_SPRITE, 0, false).Challenge.challengeType;
			harmony.PatchAll(typeof(NoOneHitKills));
		}

		[HarmonyPatch(typeof(LifeManager), "ShowDamageSequence")]
		[HarmonyPrefix]
		public static void StopLethalTurnOneDamage(ref int damage, ref int numWeights, bool toPlayer)
		{
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			//IL_0040: Unknown result type (might be due to invalid IL or missing references)
			if (!(!AscensionSaveData.Data.ChallengeIsActive(ID) || toPlayer) && Singleton<TurnManager>.Instance.TurnNumber <= 1 && damage >= Singleton<LifeManager>.Instance.DamageUntilPlayerWin)
			{
				Singleton<ChallengeActivationUI>.Instance.ShowActivation(ID);
				damage = Singleton<LifeManager>.Instance.DamageUntilPlayerWin - 1;
				numWeights = damage;
			}
		}
	}
	public static class RandomSigils
	{
		private static Ability[] EXCLUDED_SIGILS;

		public static AscensionChallenge ID { get; private set; }

		public static void Register(Harmony harmony)
		{
			//IL_0054: Unknown result type (might be due to invalid IL or missing references)
			FullChallenge val = ChallengeManager.Add("zorro.inscryption.infiniscryption.curses", "Chaotic Enemies", "Opposing creatures gain random abilities", 15, TextureHelper.GetImageAsTexture("challenge_random_sigils.png", typeof(RandomSigils).Assembly, (FilterMode)0), ChallengeManager.DEFAULT_ACTIVATED_SPRITE, 0, true);
			val.SetFlags(new object[1] { "P03" });
			ID = val.Challenge.challengeType;
			harmony.PatchAll(typeof(RandomSigils));
		}

		[HarmonyPatch(typeof(TurnManager), "SetupPhase")]
		[HarmonyPrefix]
		private static void AlwaysInstantiateConduitManager()
		{
			if ((Object)(object)Singleton<ConduitCircuitManager>.Instance == (Object)null)
			{
				((Component)Singleton<BoardManager>.Instance).gameObject.AddComponent<ConduitCircuitManager>();
			}
		}

		[HarmonyPatch(typeof(Part1Opponent), "ShowDifficultyChallengeUIIfTurnIsHarder")]
		[HarmonyPrefix]
		public static void ActivateRandomSigilsAlert(ref Part1Opponent __instance)
		{
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			//IL_0019: Unknown result type (might be due to invalid IL or missing references)
			if (AscensionSaveData.Data.ChallengeIsActive(ID))
			{
				Singleton<ChallengeActivationUI>.Instance.ShowActivation(ID);
			}
		}

		[HarmonyPatch(typeof(EncounterBuilder), "BuildOpponentTurnPlan")]
		[HarmonyPostfix]
		public static void AddSigilsToCards(ref List<List<CardInfo>> __result)
		{
			//IL_0014: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ef: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f6: Expected O, but got Unknown
			//IL_0236: Unknown result type (might be due to invalid IL or missing references)
			//IL_01e7: Unknown result type (might be due to invalid IL or missing references)
			//IL_0203: Unknown result type (might be due to invalid IL or missing references)
			int num = SaveManager.SaveFile.GetCurrentRandomSeed() + 10;
			if (!AscensionSaveData.Data.ChallengeIsActive(ID))
			{
				return;
			}
			foreach (List<CardInfo> item in __result)
			{
				for (int i = 0; i < item.Count; i++)
				{
					if (item[i].SpecialAbilities.Where((SpecialTriggeredAbility tr) => (int)tr == 10).Count() > 0 || item[i].Mods.Where((CardModificationInfo mod) => mod.deathCardInfo != null).Count() > 0 || item[i].HasTrait((Trait)16))
					{
						continue;
					}
					CardModificationInfo val = new CardModificationInfo();
					val.fromCardMerge = SaveManager.SaveFile.IsPart1;
					val.abilities = new List<Ability>();
					CardInfo val3 = (item[i] = (CardInfo)/*isinst with value type is only supported in some contexts*/);
					CardInfo card = val3;
					for (int j = 0; j < AscensionSaveData.Data.GetNumChallengesOfTypeActive(ID); j++)
					{
						List<Ability> list = (from ab in ScriptableObjectLoader<AbilityInfo>.AllData
							where ab.PositiveEffect && ab.opponentUsable && !card.Abilities.Contains(ab.ability) && !EXCLUDED_SIGILS.Contains(ab.ability)
							select ab.ability).ToList();
						if (list.Count == 0)
						{
							CursePlugin.Log.LogDebug((object)("Could not add any ability to " + ((Object)card).name));
							continue;
						}
						val.abilities.Add(list[SeededRandom.Range(0, list.Count, num)]);
						CursePlugin.Log.LogDebug((object)$"Adding {val.abilities.Last()} to {((Object)card).name}");
						num++;
					}
					card.Mods.Add(val);
				}
			}
		}

		static RandomSigils()
		{
			Ability[] array = new Ability[5];
			RuntimeHelpers.InitializeArray(array, (RuntimeFieldHandle)/*OpCode not supported: LdMemberToken*/);
			EXCLUDED_SIGILS = (Ability[])(object)array;
		}
	}
	public static class StartWithTribalTotems
	{
		public static AscensionChallenge ID { get; private set; }

		public static void Register(Harmony harmony)
		{
			//IL_002d: Unknown result type (might be due to invalid IL or missing references)
			ID = ChallengeManager.Add("zorro.inscryption.infiniscryption.curses", "Totem Collector", "You start with all tribal totem tops", -15, Resources.Load<Texture2D>("art/ui/ascension/ascensionicon_totems"), ChallengeManager.HAPPY_ACTIVATED_SPRITE, 0, false).Challenge.challengeType;
			harmony.PatchAll(typeof(StartWithTribalTotems));
		}

		[HarmonyPatch(typeof(AscensionSaveData), "NewRun")]
		[HarmonyPostfix]
		public static void SetNumberOfLives(ref AscensionSaveData __instance)
		{
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			if (AscensionSaveData.Data.ChallengeIsActive(ID))
			{
				__instance.currentRun.totemTops.Clear();
				__instance.currentRun.totemTops.AddRange(from t in GuidManager.GetValues<Tribe>()
					where (int)t != 0 && (int)t < 7
					select t);
			}
		}
	}
	public static class ThreeCandles
	{
		public static AscensionChallenge ID { get; private set; }

		public static void Register(Harmony harmony)
		{
			//IL_003f: Unknown result type (might be due to invalid IL or missing references)
			FullChallenge val = ChallengeManager.Add("zorro.inscryption.infiniscryption.curses", "Extra Candle", "You are given an extra life", -30, TextureHelper.GetImageAsTexture("assist_three_candles.png", typeof(DrawDynamite).Assembly, (FilterMode)0), ChallengeManager.HAPPY_ACTIVATED_SPRITE, 0, false);
			ID = val.Challenge.challengeType;
			harmony.PatchAll(typeof(ThreeCandles));
		}

		[HarmonyPatch(typeof(AscensionSaveData), "NewRun")]
		[HarmonyPostfix]
		public static void SetNumberOfLives(ref AscensionSaveData __instance)
		{
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			if (AscensionSaveData.Data.ChallengeIsActive(ID))
			{
				if (AscensionSaveData.Data.ChallengeIsActive((AscensionChallenge)6))
				{
					__instance.currentRun.playerLives = 2;
					__instance.currentRun.maxPlayerLives = 2;
				}
				else
				{
					__instance.currentRun.playerLives = 3;
					__instance.currentRun.maxPlayerLives = 3;
				}
			}
		}
	}
}
namespace Infiniscryption.Curses.Helpers
{
	[HarmonyPatch]
	internal static class AudioHelper
	{
		[HarmonyPatch(typeof(AudioController), "Awake")]
		[HarmonyPostfix]
		internal static void LoadMyCustomAudio(ref AudioController __instance)
		{
			string[] array = new string[3] { "card_explosion", "gulp", "wind_blowing_loop" };
			foreach (string clipName in array)
			{
				if (!__instance.SFX.Any((AudioClip ac) => ((Object)ac).name.Equals(clipName, StringComparison.InvariantCultureIgnoreCase)))
				{
					AudioClip val = SoundManager.LoadAudioClip("zorro.inscryption.infiniscryption.curses", clipName + ".wav");
					((Object)val).name = clipName;
					if (clipName.Equals("wind_blowing_loop"))
					{
						__instance.Loops.Add(val);
					}
					else
					{
						__instance.SFX.Add(val);
					}
				}
			}
		}
	}
	internal static class DialogueHelper
	{
		private static Tuple<List<CustomLine>, List<List<CustomLine>>> LinesHelper(params string[] lines)
		{
			//IL_0018: Unknown result type (might be due to invalid IL or missing references)
			List<CustomLine> list = new List<CustomLine>();
			CustomLine item = default(CustomLine);
			((CustomLine)(ref item))..ctor();
			item.text = lines[0];
			list.Add(item);
			List<CustomLine> item2 = list;
			List<List<CustomLine>> item3 = lines.Skip(1).Select(delegate(string l)
			{
				//IL_0015: Unknown result type (might be due to invalid IL or missing references)
				List<CustomLine> list2 = new List<CustomLine>();
				CustomLine item4 = default(CustomLine);
				((CustomLine)(ref item4))..ctor();
				item4.text = l;
				list2.Add(item4);
				return list2;
			}).ToList();
			return new Tuple<List<CustomLine>, List<List<CustomLine>>>(item2, item3);
		}

		internal static void GenerateVeryLargeDialogue(string dialogueId, Speaker speaker, params string[][] lines)
		{
			//IL_006d: Unknown result type (might be due to invalid IL or missing references)
			List<CustomLine> list = lines[0].Select(delegate(string l)
			{
				//IL_000f: Unknown result type (might be due to invalid IL or missing references)
				CustomLine result2 = default(CustomLine);
				((CustomLine)(ref result2))..ctor();
				result2.text = l;
				return result2;
			}).ToList();
			List<List<CustomLine>> list2 = (from ls in lines.Skip(1)
				select ls.Select(delegate(string l)
				{
					//IL_000f: Unknown result type (might be due to invalid IL or missing references)
					CustomLine result = default(CustomLine);
					((CustomLine)(ref result))..ctor();
					result.text = l;
					return result;
				}).ToList()).ToList();
			DialogueManager.Add("zorro.inscryption.infiniscryption.curses", DialogueManager.GenerateEvent("zorro.inscryption.infiniscryption.curses", dialogueId, list, list2, (MaxRepeatsBehaviour)0, speaker));
		}

		internal static void GenerateVeryLargeDialogue(string dialogueId, params string[][] lines)
		{
			GenerateVeryLargeDialogue(dialogueId, (Speaker)1, lines);
		}

		internal static void GenerateLargeDialogue(string dialogueId, Speaker speaker, params string[] lines)
		{
			//IL_003a: Unknown result type (might be due to invalid IL or missing references)
			List<CustomLine> list = lines.Select(delegate(string l)
			{
				//IL_000f: Unknown result type (might be due to invalid IL or missing references)
				CustomLine result = default(CustomLine);
				((CustomLine)(ref result))..ctor();
				result.text = l;
				return result;
			}).ToList();
			DialogueManager.Add("zorro.inscryption.infiniscryption.curses", DialogueManager.GenerateEvent("zorro.inscryption.infiniscryption.curses", dialogueId, list, (List<List<CustomLine>>)null, (MaxRepeatsBehaviour)0, speaker));
		}

		internal static void GenerateLargeDialogue(string dialogueId, params string[] lines)
		{
			GenerateLargeDialogue(dialogueId, (Speaker)1, lines);
		}

		internal static void GenerateDialogue(string dialogueId, Speaker speaker, params string[] lines)
		{
			//IL_0020: Unknown result type (might be due to invalid IL or missing references)
			Tuple<List<CustomLine>, List<List<CustomLine>>> tuple = LinesHelper(lines);
			DialogueManager.Add("zorro.inscryption.infiniscryption.curses", DialogueManager.GenerateEvent("zorro.inscryption.infiniscryption.curses", dialogueId, tuple.Item1, tuple.Item2, (MaxRepeatsBehaviour)0, speaker));
		}

		internal static void GenerateDialogue(string dialogueId, params string[] lines)
		{
			GenerateDialogue(dialogueId, (Speaker)1, lines);
		}
	}
}
namespace Infiniscryption.Curses.Components
{
	public class Orbiter : ManagedBehaviour
	{
		private const float FULL_ROTATION = 360f;

		private float _orbitRadius = 1f;

		private Vector3 _rotationAxis = Vector3.Cross(Vector3.forward, Vector3.up);

		private Vector3 _cos0vector = Vector3.forward;

		private Vector3 _sin0vector = Vector3.up;

		public bool Reversed { get; set; }

		public float OrbitSpeed { get; set; } = 0.333f;


		public float OrbitRadius
		{
			get
			{
				return _orbitRadius;
			}
			set
			{
				//IL_000a: 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_0015: Unknown result type (might be due to invalid IL or missing references)
				//IL_001a: Unknown result type (might be due to invalid IL or missing references)
				//IL_0021: 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_002c: 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)
				_orbitRadius = value;
				_cos0vector = Vector3.Normalize(_cos0vector) * value;
				_sin0vector = Vector3.Normalize(_sin0vector) * value;
			}
		}

		public float ThetaOffset { get; set; } = 0f;


		public bool RandomThetaOffset { get; set; }

		public Vector3 Cos0Vector
		{
			get
			{
				//IL_0002: Unknown result type (might be due to invalid IL or missing references)
				//IL_0007: Unknown result type (might be due to invalid IL or missing references)
				//IL_000a: Unknown result type (might be due to invalid IL or missing references)
				return _cos0vector;
			}
			set
			{
				//IL_0002: Unknown result type (might be due to invalid IL or missing references)
				//IL_0003: 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_0013: Unknown result type (might be due to invalid IL or missing references)
				//IL_0019: Unknown result type (might be due to invalid IL or missing references)
				//IL_001b: Unknown result type (might be due to invalid IL or missing references)
				//IL_0020: Unknown result type (might be due to invalid IL or missing references)
				//IL_0025: Unknown result type (might be due to invalid IL or missing references)
				//IL_002a: Unknown result type (might be due to invalid IL or missing references)
				_cos0vector = Vector3.Normalize(value) * OrbitRadius;
				_rotationAxis = Vector3.Normalize(Vector3.Cross(value, Sin0Vector));
			}
		}

		public Vector3 Sin0Vector
		{
			get
			{
				//IL_0002: Unknown result type (might be due to invalid IL or missing references)
				//IL_0007: Unknown result type (might be due to invalid IL or missing references)
				//IL_000a: Unknown result type (might be due to invalid IL or missing references)
				return _sin0vector;
			}
			set
			{
				//IL_0002: Unknown result type (might be due to invalid IL or missing references)
				//IL_0003: 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_0013: Unknown result type (might be due to invalid IL or missing references)
				//IL_001a: Unknown result type (might be due to invalid IL or missing references)
				//IL_0020: Unknown result type (might be due to invalid IL or missing references)
				//IL_0025: Unknown result type (might be due to invalid IL or missing references)
				//IL_002a: Unknown result type (might be due to invalid IL or missing references)
				//IL_002f: Unknown result type (might be due to invalid IL or missing references)
				_sin0vector = Vector3.Normalize(value) * OrbitRadius;
				_rotationAxis = Vector3.Normalize(Vector3.Cross(Cos0Vector, _sin0vector));
			}
		}

		private float Theta { get; set; }

		private void Awake()
		{
			if (RandomThetaOffset)
			{
				Theta = Random.Range(0f, 360f);
			}
			else
			{
				Theta = ThetaOffset;
			}
			SetLocation();
		}

		private void Start()
		{
			((Behaviour)this).enabled = true;
		}

		public void StartFromBeginning()
		{
			((Behaviour)this).enabled = true;
			if (RandomThetaOffset)
			{
				Theta = Random.Range(0f, 360f);
			}
			else
			{
				Theta = ThetaOffset;
			}
		}

		public void Stop()
		{
			((Behaviour)this).enabled = false;
		}

		private void SetLocation()
		{
			//IL_0008: Unknown result type (might be due to invalid IL or missing references)
			//IL_000d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0013: Unknown result type (might be due to invalid IL or missing references)
			//IL_0018: Unknown result type (might be due to invalid IL or missing references)
			//IL_001d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			Vector3 localPosition = Quaternion.AngleAxis(Theta, _rotationAxis) * Cos0Vector;
			((Component)this).transform.localPosition = localPosition;
		}

		public override void ManagedUpdate()
		{
			if (((Behaviour)this).enabled)
			{
				float num = (((ManagedBehaviour)this).UpdateWhenPaused ? Time.unscaledDeltaTime : Time.deltaTime);
				Theta += 360f * OrbitSpeed * num * (Reversed ? (-1f) : 1f);
				while (Theta > 360f)
				{
					Theta -= 360f;
				}
				while (Theta < -360f)
				{
					Theta += 360f;
				}
				SetLocation();
			}
		}
	}
}
namespace Infiniscryption.Curses.Cards
{
	public class Bitten : AbilityBehaviour
	{
		public static Ability AbilityID { get; private set; }

		public override Ability Ability => AbilityID;

		public static void RegisterCardAndAbilities(Harmony harmony)
		{
			//IL_0064: Unknown result type (might be due to invalid IL or missing references)
			AbilityInfo val = ScriptableObject.CreateInstance<AbilityInfo>();
			val.rulebookName = "Bitten By Predator";
			val.rulebookDescription = "This card was bitten by a predator";
			val.canStack = false;
			val.powerLevel = -2;
			val.opponentUsable = false;
			val.passive = false;
			val.metaCategories = new List<AbilityMetaCategory>();
			AbilityID = AbilityManager.Add("zorro.inscryption.infiniscryption.curses", val, typeof(Bitten), (Texture)(object)Resources.Load<Texture2D>("art/cards/abilityicons/ability_deathtouch")).Id;
			harmony.PatchAll(typeof(Bitten));
		}

		[HarmonyPatch(typeof(Card), "ApplyAppearanceBehaviours")]
		[HarmonyPostfix]
		public static void SpellBackground(ref Card __instance)
		{
			if (__instance.Info.Abilities.Any((Ability sp) => sp == AbilityID))
			{
				((CardAppearanceBehaviour)((Component)__instance).gameObject.AddComponent<BittenCardAppearance>()).ApplyAppearance();
			}
		}

		[HarmonyPatch(typeof(CardAbilityIcons), "GetDistinctShownAbilities")]
		[HarmonyPostfix]
		public static void DontShowThisIcon(ref List<Ability> __result)
		{
			//IL_0003: Unknown result type (might be due to invalid IL or missing references)
			__result.Remove(AbilityID);
		}
	}
	public class BittenCardAppearance : CardAppearanceBehaviour
	{
		private static Texture2D _sharkBiteDecal = TextureHelper.GetImageAsTexture("shark_bite_decal.png", typeof(BittenCardAppearance).Assembly, (FilterMode)0);

		private static Texture2D _sharkBiteBackground = TextureHelper.GetImageAsTexture("card_empty_sharkbite.png", typeof(BittenCardAppearance).Assembly, (FilterMode)0);

		public static Appearance ID { get; private set; }

		public override void ApplyAppearance()
		{
			((CardAppearanceBehaviour)this).Card.Info.temporaryDecals = new List<Texture>();
			((CardAppearanceBehaviour)this).Card.RenderInfo.baseTextureOverride = (Texture)(object)_sharkBiteBackground;
			if (!((CardAppearanceBehaviour)this).Card.Info.TempDecals.Any((Texture t) => ((Object)t).name == ((Object)_sharkBiteDecal).name))
			{
				((CardAppearanceBehaviour)this).Card.Info.TempDecals.Add((Texture)(object)_sharkBiteDecal);
			}
		}

		public static void Register()
		{
			//IL_001a: Unknown result type (might be due to invalid IL or missing references)
			ID = CardAppearanceBehaviourManager.Add("zorro.inscryption.infiniscryption.curses", "BittenByShark", typeof(BittenCardAppearance)).Id;
		}
	}
	public static class Bow
	{
		public static void RegisterCardAndAbilities(Harmony harmony)
		{
			//IL_004d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0053: Expected I4, but got Unknown
			//IL_0055: Unknown result type (might be due to invalid IL or missing references)
			//IL_005b: Expected I4, but got Unknown
			//IL_00ad: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b3: Expected I4, but got Unknown
			CardExtensions.AddAbilities(CardExtensions.SetPortrait(CardHelpers.SetTargetedSpell(CardManager.New("CURSES", TrapperTraderBossHardOpponent.BOW_CARD, "Bow and Arrow", 0, 0, (string)null)), TextureHelper.GetImageAsTexture("portrait_bow.png", typeof(Bow).Assembly, (FilterMode)0), (FilterMode?)null), (Ability[])(object)new Ability[2]
			{
				(Ability)(int)DirectDamage.AbilityID,
				(Ability)(int)DirectDamage.AbilityID
			});
			CardExtensions.AddAbilities(CardExtensions.SetPortrait(CardHelpers.SetTargetedSpell(CardManager.New("CURSES", TrapperTraderBossHardOpponent.CAPTURE_CARD, "Capture", 0, 0, (string)null)), TextureHelper.GetImageAsTexture("portrait_capture.png", typeof(Bow).Assembly, (FilterMode)0), (FilterMode?)null), (Ability[])(object)new Ability[1] { (Ability)(int)Fishhook.AbilityID });
			CardExtensions.AddAbilities(CardExtensions.AddAppearances(CardExtensions.AddTraits(CardExtensions.SetPortrait(CardManager.New("CURSES", TrapperTraderBossHardOpponent.SPIKE_TRAP_CARD, "Spike Trap", 0, 2, (string)null), TextureHelper.GetImageAsTexture("portrait_spike_trap.png", typeof(Bow).Assembly, (FilterMode)0), (FilterMode?)null), (Trait[])(object)new Trait[1] { (Trait)12 }), (Appearance[])(object)new Appearance[2]
			{
				(Appearance)2,
				(Appearance)9
			}), (Ability[])(object)new Ability[2]
			{
				(Ability)15,
				(Ability)83
			});
		}
	}
	public class Digester : SpecialCardBehaviour
	{
		public const string GULP_SOUND = "gulp";

		public static SpecialTriggeredAbility ID { get; private set; }

		public override int Priority => int.MinValue;

		private CardInfo StomachContents
		{
			get
			{
				if (((Card)((SpecialCardBehaviour)this).PlayableCard).Info.iceCubeParams == null || ((SpecialCardBehaviour)this).PlayableCard.HasAbility((Ability)26))
				{
					return null;
				}
				return ((Card)((SpecialCardBehaviour)this).PlayableCard).Info.iceCubeParams.creatureWithin;
			}
			set
			{
				//IL_0040: Unknown result type (might be due to invalid IL or missing references)
				//IL_0045: Unknown result type (might be due to invalid IL or missing references)
				//IL_0051: Expected O, but got Unknown
				if (!((SpecialCardBehaviour)this).PlayableCard.HasAbility((Ability)26))
				{
					if ((Object)(object)value == (Object)null)
					{
						((Card)((SpecialCardBehaviour)this).PlayableCard).Info.iceCubeParams = null;
						return;
					}
					((Card)((SpecialCardBehaviour)this).PlayableCard).Info.iceCubeParams = new IceCubeParams
					{
						creatureWithin = value
					};
				}
			}
		}

		public static void RegisterCardAndAbilities(Harmony harmony)
		{
			//IL_0020: 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_008c: Expected I4, but got Unknown
			//IL_0099: Unknown result type (might be due to invalid IL or missing references)
			//IL_009f: Expected I4, but got Unknown
			MegaSharkAppearance.Register();
			ID = SpecialTriggeredAbilityManager.Add("zorro.inscryption.infiniscryption.curses", "Swallow Whole", typeof(Digester)).Id;
			CardExtensions.AddSpecialAbilities(CardExtensions.AddAppearances(CardExtensions.AddAbilities(CardExtensions.SetPortrait(CardExtensions.AddTraits(CardManager.New("CURSES", AnglerBossHardOpponent.MEGA_SHARK, "Mega Shark", 3, 5, (string)null), (Trait[])(object)new Trait[1] { (Trait)14 }), MegaSharkAppearance.SHARK_OPEN_PORTRAIT, MegaSharkAppearance.SHARK_OPEN_EMISSION, (FilterMode?)null), (Ability[])(object)new Ability[2]
			{
				(Ability)23,
				(Ability)8
			}), (Appearance[])(object)new Appearance[1] { (Appearance)(int)MegaSharkAppearance.ID }), (SpecialTriggeredAbility[])(object)new SpecialTriggeredAbility[1] { (SpecialTriggeredAbility)(int)ID });
			RuntimeHelpers.RunClassConstructor(typeof(Digester).TypeHandle);
			RuntimeHelpers.RunClassConstructor(typeof(Bitten).TypeHandle);
			RuntimeHelpers.RunClassConstructor(typeof(BittenCardAppearance).TypeHandle);
			RuntimeHelpers.RunClassConstructor(typeof(MegaSharkAppearance).TypeHandle);
			TextureHelper.RegisterEmissionForSprite(MegaSharkAppearance.SHARK_CLOSED_PORTRAIT_SPRITE, MegaSharkAppearance.SHARK_CLOSED_EMISSION_SPRITE);
			harmony.PatchAll(typeof(Digester));
		}

		[HarmonyPatch(typeof(Card), "ApplyAppearanceBehaviours")]
		[HarmonyPostfix]
		public static void SpellBackground(ref Card __instance)
		{
			if (((Object)__instance.Info).name == "Angler_Shark")
			{
				((CardAppearanceBehaviour)((Component)__instance).gameObject.AddComponent<MegaSharkAppearance>()).ApplyAppearance();
			}
		}

		private void UpdateAppearances()
		{
			CardAppearanceBehaviour[] components = ((Component)((SpecialCardBehaviour)this).PlayableCard).GetComponents<CardAppearanceBehaviour>();
			foreach (CardAppearanceBehaviour val in components)
			{
				val.ApplyAppearance();
			}
		}

		private IEnumerator TransitionAwayFromDigestingState()
		{
			Singleton<ViewManager>.Instance.SwitchToView((View)4, false, false);
			List<CardModificationInfo> modsToRemove = ((SpecialCardBehaviour)this).PlayableCard.TemporaryMods.Where((CardModificationInfo mod) => mod.attackAdjustment == -1000).ToList();
			foreach (CardModificationInfo mod2 in modsToRemove)
			{
				((SpecialCardBehaviour)this).PlayableCard.TemporaryMods.Remove(mod2);
			}
			UpdateAppearances();
			((Card)((SpecialCardBehaviour)this).PlayableCard).Anim.SetShaking(true);
			yield return Singleton<TextDisplayer>.Instance.PlayDialogueEvent("HungryAgain", (MessageAdvanceMode)1, (EventIntersectMode)0, (string[])null, (Action<Line>)null);
			((Card)((SpecialCardBehaviour)this).PlayableCard).Anim.SetShaking(false);
		}

		private IEnumerator EatCard(PlayableCard target, bool attackerWasMeal)
		{
			if (attackerWasMeal)
			{
				((Card)((SpecialCardBehaviour)this).PlayableCard).Anim.PlayTransformAnimation();
				yield return (object)new WaitForSeconds(0.2f);
			}
			AudioController.Instance.PlaySound3D("gulp", (MixerGroup)5, ((Component)((SpecialCardBehaviour)this).Card).transform.position, 1f, 0f, (Pitch)null, (Repetition)null, (Randomization)null, (Distortion)null, false);
			yield return (object)new WaitForSeconds(0.1f);
			StomachContents = ((Card)target).Info;
			((MonoBehaviour)((Card)target).Anim).StopAllCoroutines();
			target.UnassignFromSlot();
			Object.Destroy((Object)(object)((Component)target).gameObject, 0.1f);
			((SpecialCardBehaviour)this).PlayableCard.TemporaryMods.Add(new CardModificationInfo(-1000, 0));
			UpdateAppearances();
			((Card)((SpecialCardBehaviour)this).PlayableCard).Anim.SetShaking(true);
			yield return Singleton<TextDisplayer>.Instance.PlayDialogueEvent("CardIsSleep", (MessageAdvanceMode)1, (EventIntersectMode)0, (string[])null, (Action<Line>)null);
			((Card)((SpecialCardBehaviour)this).PlayableCard).Anim.SetShaking(false);
		}

		private void AddModToCard(CardInfo card, CardModificationInfo mod)
		{
			if (((CardCollectionInfo)RunState.Run.playerDeck).Cards.Contains(card))
			{
				RunState.Run.playerDeck.ModifyCard(card, mod);
			}
			else
			{
				card.Mods.Add(mod);
			}
		}

		private IEnumerator Digest()
		{
			if ((Object)(object)StomachContents == (Object)null)
			{
				yield break;
			}
			Singleton<ViewManager>.Instance.SwitchToView((View)4, false, false);
			((Card)((SpecialCardBehaviour)this).PlayableCard).Anim.PlayTransformAnimation();
			yield return (object)new WaitForSeconds(0.3f);
			if (StomachContents.traits.Any((Trait tr) => (int)tr == 19))
			{
				yield return Singleton<TextDisplayer>.Instance.PlayDialogueEvent("CardAtePoison", (MessageAdvanceMode)1, (EventIntersectMode)0, (string[])null, (Action<Line>)null);
				yield return ExpelCard();
				yield return ((SpecialCardBehaviour)this).PlayableCard.Die(true, (PlayableCard)null, true);
				yield break;
			}
			int internalDamage = StomachContents.Abilities.Where((Ability ab) => (int)ab == 15).Count();
			if (internalDamage > 0)
			{
				yield return Singleton<TextDisplayer>.Instance.PlayDialogueEvent("CardAteSharp", (MessageAdvanceMode)1, (EventIntersectMode)0, (string[])null, (Action<Line>)null);
				bool quitAfterTakeDamage = false;
				if (internalDamage > ((SpecialCardBehaviour)this).PlayableCard.Health)
				{
					yield return ExpelCard();
					quitAfterTakeDamage = true;
				}
				yield return ((SpecialCardBehaviour)this).PlayableCard.TakeDamage(internalDamage, (PlayableCard)null);
				if (quitAfterTakeDamage)
				{
					yield break;
				}
			}
			if ((Object)(object)((SpecialCardBehaviour)this).PlayableCard == (Object)null || ((SpecialCardBehaviour)this).PlayableCard.Health <= 0 || ((SpecialCardBehaviour)this).PlayableCard.Dead || (Object)(object)StomachContents == (Object)null)
			{
				yield break;
			}
			bool isMainDeckCard = ((CardCollectionInfo)RunState.Run.playerDeck).Cards.Any((CardInfo c) => ((Object)c).name == ((Object)StomachContents).name);
			if (!StomachContents.HasAbility(Bitten.AbilityID) && isMainDeckCard)
			{
				AddModToCard(mod: new CardModificationInfo(Bitten.AbilityID), card: StomachContents);
			}
			else
			{
				AddModToCard(StomachContents, new CardModificationInfo(-1, -1));
			}
			if (StomachContents.Health > 0)
			{
				if (internalDamage == 0)
				{
					yield return Singleton<TextDisplayer>.Instance.PlayDialogueEvent("DigestingCard", (MessageAdvanceMode)1, (EventIntersectMode)0, new string[2]
					{
						StomachContents.DisplayedNameLocalized,
						StomachContents.Health.ToString()
					}, (Action<Line>)null);
				}
				yield break;
			}
			if (((SpecialCardBehaviour)this).PlayableCard.OpponentCard && ((CardCollectionInfo)SaveManager.SaveFile.CurrentDeck).Cards.Contains(StomachContents))
			{
				((CardCollectionInfo)SaveManager.SaveFile.CurrentDeck).RemoveCard(StomachContents);
				yield return Singleton<TextDisplayer>.Instance.PlayDialogueEvent("DigestedCardDeadForever", (MessageAdvanceMode)1, (EventIntersectMode)0, new string[1] { StomachContents.DisplayedNameLocalized }, (Action<Line>)null);
			}
			StomachContents = null;
			yield return TransitionAwayFromDigestingState();
		}

		public override bool RespondsToUpkeep(bool playerUpkeep)
		{
			if (((Card)((SpecialCardBehaviour)this).PlayableCard).Info.iceCubeParams == null || (Object)(object)((Card)((SpecialCardBehaviour)this).PlayableCard).Info.iceCubeParams.creatureWithin == (Object)null)
			{
				return false;
			}
			return (((SpecialCardBehaviour)this).PlayableCard.OpponentCard && !playerUpkeep) || (!((SpecialCardBehaviour)this).PlayableCard.OpponentCard && playerUpkeep);
		}

		public override IEnumerator OnUpkeep(bool playerUpkeep)
		{
			yield return Digest();
			CursePlugin.Log.LogInfo((object)"Upkeep complete");
		}

		public override bool RespondsToSlotTargetedForAttack(CardSlot slot, PlayableCard attacker)
		{
			return true;
		}

		public override IEnumerator OnSlotTargetedForAttack(CardSlot slot, PlayableCard attacker)
		{
			if ((Object)(object)slot.Card == (Object)null || (Object)(object)attacker == (Object)null)
			{
				yield break;
			}
			PlayableCard defender = slot.Card;
			if (((Object)(object)attacker != (Object)(object)((SpecialCardBehaviour)this).PlayableCard && (Object)(object)slot.Card != (Object)(object)((SpecialCardBehaviour)this).PlayableCard) || (Object)(object)StomachContents != (Object)null)
			{
				yield break;
			}
			PlayableCard meal = (((Object)(object)attacker == (Object)(object)((SpecialCardBehaviour)this).PlayableCard) ? defender : attacker);
			if (!attacker.HasAbility((Ability)19) || defender.HasAbility((Ability)23) || defender.HasAbility((Ability)19))
			{
				bool hitHappened = false;
				((Card)attacker).Anim.PlayAttackAnimation(false, slot, (Action)delegate
				{
					((Card)attacker).Anim.SetAnimationPaused(true);
					hitHappened = true;
				});
				yield return (object)new WaitUntil((Func<bool>)(() => hitHappened));
				yield return EatCard(meal, (Object)(object)meal == (Object)(object)attacker);
				if ((Object)(object)attacker != (Object)null && attacker.OnBoard)
				{
					((Card)attacker).Anim.SetAnimationPaused(false);
				}
			}
		}

		public override bool RespondsToDie(bool wasSacrifice, PlayableCard killer)
		{
			return (Object)(object)StomachContents != (Object)null;
		}

		private IEnumerator ExpelCard()
		{
			CardInfo digestedCard = StomachContents;
			if ((Object)(object)digestedCard == (Object)null)
			{
				yield break;
			}
			if (((SpecialCardBehaviour)this).PlayableCard.OpponentCard)
			{
				Singleton<ViewManager>.Instance.SwitchToView((View)0, false, false);
				if (digestedCard.HasAbility(Bitten.AbilityID))
				{
					AchievementManager.Unlock(CursedAchievements.SHARK_POP);
				}
				PlayableCard spawnedCard = CardSpawner.SpawnPlayableCard(digestedCard);
				yield return Singleton<PlayerHand>.Instance.AddCardToHand(spawnedCard, Vector3.zero, 0f);
				Singleton<PlayerHand>.Instance.OnCardInspected(spawnedCard);
				Singleton<PlayerHand>.Instance.InspectingLocked = true;
				((Card)spawnedCard).Anim.PlayHitAnimation();
				yield return (object)new WaitForSeconds(0.6f);
				Singleton<PlayerHand>.Instance.InspectingLocked = false;
				Singleton<ViewManager>.Instance.SwitchToView((View)1, false, false);
			}
			StomachContents = null;
		}

		public override IEnumerator OnDie(bool wasSacrifice, PlayableCard killer)
		{
			yield return ExpelCard();
		}

		public override void OnCleanUp()
		{
			((SpecialCardBehaviour)this).OnCleanUp();
			StomachContents = null;
		}
	}
	[HarmonyPatch]
	public class Dynamite : AbilityBehaviour
	{
		public const string EXPLOSION_SOUND = "card_explosion";

		private bool _blewUp = false;

		private int _lastKnownDamage = 2;

		public override Ability Ability => AbilityID;

		public static Ability AbilityID { get; private set; }

		public int Damage
		{
			get
			{
				try
				{
					_lastKnownDamage = (((Card)((AbilityBehaviour)this).Card).Info.Mods.Any((CardModificationInfo m) => m.fromDuplicateMerge) ? 4 : 2);
					return _lastKnownDamage;
				}
				catch
				{
					return _lastKnownDamage;
				}
			}
		}

		public static void RegisterCardAndAbilities(Harmony harmony)
		{
			//IL_00b4: 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_0136: Expected I4, but got Unknown
			//IL_0143: Unknown result type (might be due to invalid IL or missing references)
			//IL_0149: Expected I4, but got Unknown
			//IL_014f: Unknown result type (might be due to invalid IL or missing references)
			DynamiteAppearance.Register();
			AbilityInfo val = ScriptableObject.CreateInstance<AbilityInfo>();
			val.rulebookName = "Booby Trap";
			val.rulebookDescription = "If this is in your hand at the end of your turn, it explodes. If it is on the board at the end of your opponent's turn, it explodes. Either way, it explodes.";
			val.canStack = true;
			val.powerLevel = -2;
			val.opponentUsable = false;
			val.passive = false;
			val.metaCategories = new List<AbilityMetaCategory> { (AbilityMetaCategory)0 };
			DialogueHelper.GenerateDialogue("MycologistsDynamite", "This is more difficult than anticipated...");
			DialogueHelper.GenerateDialogue("MycologistsDynamiteSuccess", "We - We may have made things worse");
			AbilityID = AbilityManager.Add("zorro.inscryption.infiniscryption.curses", val, typeof(Dynamite), (Texture)(object)TextureHelper.GetImageAsTexture("ability_dynamite.png", typeof(Dynamite).Assembly, (FilterMode)0)).Id;
			CardExtensions.AddAppearances(CardExtensions.AddAbilities(CardExtensions.SetPortrait(CardExtensions.AddTraits(CardManager.New("CURSES", ProspectorBossHardOpponent.DYNAMITE, "Dynamite", 0, 2, (string)null), (Trait[])(object)new Trait[1] { (Trait)12 }), TextureHelper.GetImageAsTexture("dynamite_portrait.png", typeof(Dynamite).Assembly, (FilterMode)0), TextureHelper.GetImageAsTexture("dynamite_emission.png", typeof(Dynamite).Assembly, (FilterMode)0), (FilterMode?)null), (Ability[])(object)new Ability[1] { (Ability)(int)AbilityID }), (Appearance[])(object)new Appearance[1] { (Appearance)(int)DynamiteAppearance.ID }).temple = (CardTemple)0;
			RuntimeHelpers.RunClassConstructor(typeof(Dynamite).TypeHandle);
			RuntimeHelpers.RunClassConstructor(typeof(DynamiteAppearance).TypeHandle);
			harmony.PatchAll(typeof(Dynamite));
		}

		[HarmonyPatch(typeof(TurnManager), "PlayerTurn")]
		[HarmonyPostfix]
		public static IEnumerator ExplodeAtEndOfTurn(IEnumerator sequenceEvent)
		{
			yield return sequenceEvent;
			if (!((Object)(object)Singleton<PlayerHand>.Instance != (Object)null))
			{
				yield break;
			}
			List<PlayableCard> cardsToExplode = Singleton<PlayerHand>.Instance.CardsInHand.Where((PlayableCard c) => ((Card)c).Info.Abilities.Any((Ability a) => a == AbilityID)).ToList();
			object[] upkeepVars = new object[1] { true };
			foreach (PlayableCard card in cardsToExplode)
			{
				yield return card.TriggerHandler.OnTrigger((Trigger)13, upkeepVars);
			}
		}

		public override bool RespondsToDie(bool wasSacrifice, PlayableCard killer)
		{
			return true;
		}

		public override IEnumerator OnDie(bool wasSacrifice, PlayableCard killer)
		{
			if (!_blewUp)
			{
				AchievementManager.Unlock(CursedAchievements.HOT_POTATO);
			}
			yield break;
		}

		public override bool RespondsToTurnEnd(bool playerTurnEnd)
		{
			return playerTurnEnd;
		}

		public override IEnumerator OnTurnEnd(bool playerTurnEnd)
		{
			if (!playerTurnEnd)
			{
				yield break;
			}
			_blewUp = true;
			if (((AbilityBehaviour)this).Card.InHand)
			{
				if (Singleton<LifeManager>.Instance.DamageUntilPlayerWin > 0)
				{
					Singleton<ViewManager>.Instance.SwitchToView((View)0, false, false);
					Singleton<PlayerHand>.Instance.OnCardInspected(((AbilityBehaviour)this).Card);
					Singleton<PlayerHand>.Instance.InspectingLocked = true;
					((Card)((AbilityBehaviour)this).Card).Anim.SetShaking(true);
					yield return (object)new WaitForSeconds(0.75f);
					((Card)((AbilityBehaviour)this).Card).Anim.PlaySacrificeParticles();
					yield return (object)new WaitForSeconds(0.2f);
					AudioController.Instance.PlaySound3D("card_explosion", (MixerGroup)5, ((Component)((AbilityBehaviour)this).Card).transform.position, 1f, 0f, (Pitch)null, (Repetition)null, (Randomization)null, (Distortion)null, false);
					((Card)((AbilityBehaviour)this).Card).Anim.PlayTransformAnimation();
					if (Damage == 4)
					{
						yi

plugins/keks307-Perk_Pelts/plugins/PerkPelts.dll

Decompiled 5 months ago
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using BepInEx;
using DiskCardGame;
using InscryptionAPI.Card;
using InscryptionAPI.Helpers;
using InscryptionAPI.Pelts;
using Microsoft.CodeAnalysis;
using UnityEngine;

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

		public RefSafetyRulesAttribute(int P_0)
		{
			Version = P_0;
		}
	}
}
namespace PerkPelts
{
	[BepInPlugin("Keks.Inscryption.PerkPelts", "PerkPelts", "0.0.1")]
	public class Plugin : BaseUnityPlugin
	{
		internal const string PluginGUID = "Keks.Inscryption.PerkPelts";

		internal const string PluginNAME = "PerkPelts";

		internal const string PluginVERSION = "0.0.1";

		public static string ModPrefix = "PerkPelt";

		private void Awake()
		{
			addCard();
			addPelt();
		}

		private void addPelt()
		{
			Tools.AddPeltToManager(Tools.CreatePeltCard(ModPrefix, "PerkToken", "Perk Rat", "PerkRatBase", "Empty", 2, 2, 2, 0, 0, null, new List<Ability>(), new List<SpecialTriggeredAbility>(), new List<Appearance> { (Appearance)6 }), "PerkRat", 5, 0, 8);
		}

		private void addCard()
		{
			Tools.CreateCard(ModPrefix, "PerkRatOneBlood", "Stunted Rat", "PerkRatOneBlood", "PerkRatEmission", 2, 2, 1, 0, 0, null, new List<Ability>(), new List<SpecialTriggeredAbility>(), new List<Trait>(), new List<Tribe>(), new List<Appearance> { (Appearance)7 }, (SpecialStatIcon)0, "BloodDecalSacRat", appearChoiceNode: false, appearTrader: false, Rare: false, (CardTemple)0);
			Tools.CreateCard(ModPrefix, "PerkRatBall", "Shedding Rat", "PerkRatBall", "PerkRatEmission", 2, 2, 2, 0, 0, null, new List<Ability> { (Ability)46 }, new List<SpecialTriggeredAbility>(), new List<Trait>(), new List<Tribe> { (Tribe)1 }, new List<Appearance> { (Appearance)7 }, (SpecialStatIcon)0, "PerkRatDecal", appearChoiceNode: false, appearTrader: false, Rare: false, (CardTemple)0);
			Tools.CreateCard(ModPrefix, "PerkRatBloodPower", "Bloody Rat", "PerkRatBloodPower", "PerkRatEmission", 0, 4, 2, 0, 0, null, new List<Ability>(), new List<SpecialTriggeredAbility> { (SpecialTriggeredAbility)26 }, new List<Trait>(), new List<Tribe>(), new List<Appearance> { (Appearance)7 }, (SpecialStatIcon)7, "BloodDecalOneRat", appearChoiceNode: false, appearTrader: false, Rare: false, (CardTemple)0);
			Tools.CreateCard(ModPrefix, "PerkRatBones", "Marrow Rat", "PerkRatBones", "PerkRatEmission", 2, 2, 0, 3, 0, null, new List<Ability>(), new List<SpecialTriggeredAbility>(), new List<Trait>(), new List<Tribe>(), new List<Appearance> { (Appearance)7 }, (SpecialStatIcon)0, "PerkRatDecal", appearChoiceNode: false, appearTrader: false, Rare: false, (CardTemple)0);
			Tools.CreateCard(ModPrefix, "PerkRatDigger", "Digging Rat", "PerkRatDigger", "PerkRatEmission", 2, 4, 2, 0, 0, null, new List<Ability> { (Ability)28 }, new List<SpecialTriggeredAbility>(), new List<Trait>(), new List<Tribe>(), new List<Appearance> { (Appearance)7 }, (SpecialStatIcon)0, "SmokeDecal", appearChoiceNode: false, appearTrader: false, Rare: false, (CardTemple)0);
			Tools.CreateCard(ModPrefix, "PerkRatItem", "Packing Rat", "PerkRatItem", "PerkRatEmission", 2, 3, 2, 0, 0, null, new List<Ability> { (Ability)29 }, new List<SpecialTriggeredAbility>(), new List<Trait>(), new List<Tribe>(), new List<Appearance> { (Appearance)7 }, (SpecialStatIcon)0, "PerkRatDecal", appearChoiceNode: false, appearTrader: false, Rare: false, (CardTemple)0);
			Tools.CreateCard(ModPrefix, "PerkRatLooter", "Orlus Rat", "PerkRatLooter", "PerkRatEmission", 2, 2, 2, 0, 0, null, new List<Ability> { (Ability)79 }, new List<SpecialTriggeredAbility>(), new List<Trait>(), new List<Tribe>(), new List<Appearance> { (Appearance)7 }, (SpecialStatIcon)0, "PerkRatDecal", appearChoiceNode: false, appearTrader: false, Rare: false, (CardTemple)0);
			Tools.CreateCard(ModPrefix, "PerkRatStatic", "Corrupted Rat", "PerkRatStatic", "PerkRatEmission", 6, 6, 0, 6, 0, null, new List<Ability>(), new List<SpecialTriggeredAbility> { (SpecialTriggeredAbility)7 }, new List<Trait>(), new List<Tribe>(), new List<Appearance>
			{
				(Appearance)15,
				(Appearance)14,
				(Appearance)7
			}, (SpecialStatIcon)0, "PerkRatDecal", appearChoiceNode: false, appearTrader: false, Rare: false, (CardTemple)0);
		}
	}
	public class Tools
	{
		public static Assembly _assembly;

		public static Assembly CurrentAssembly => _assembly ?? (_assembly = Assembly.GetExecutingAssembly());

		public static Texture2D LoadTexture(string name)
		{
			if (name == null)
			{
				return null;
			}
			return TextureHelper.GetImageAsTexture(name + (name.EndsWith(".png") ? "" : ".png"), CurrentAssembly, (FilterMode)0);
		}

		public static void AddPeltToManager(CardInfo info, string Name, int baseBuyPrice = 5, int extraAbilities = 0, int choiceAmount = 4)
		{
			PeltManager.New("Keks.Inscryption.PerkPelts", info, baseBuyPrice, extraAbilities, choiceAmount, (Func<List<CardInfo>>)(() => CardManager.AllCardsCopy.FindAll((CardInfo a) => ((Object)a).name.Contains(Name))));
		}

		public static CardInfo CreatePeltCard(string modPrefix, string internalName, string displayName, string imageName, string imageEmissiveName, int attack = 0, int health = 1, int bloodCost = 0, int bonesCost = 0, int energyCost = 0, List<GemType> gemsCost = null, List<Ability> abilities = null, List<SpecialTriggeredAbility> specialAbilities = null, List<Appearance> appearances = null, string decalName = null, bool Rare = false)
		{
			//IL_004e: 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)
			CardInfo val = CardExtensions.SetPortraitAndEmission(CardManager.New(modPrefix, internalName, displayName, attack, health, (string)null), LoadTexture(imageName), LoadTexture(imageEmissiveName), (FilterMode?)null);
			if (decalName != null)
			{
				CardExtensions.AddDecal(val, (Texture[])(object)new Texture[1] { (Texture)LoadTexture(decalName) });
			}
			val.cardComplexity = (CardComplexity)1;
			CardExtensions.SetCost(val, (int?)bloodCost, (int?)bonesCost, (int?)energyCost, gemsCost);
			CardExtensions.AddTraits(val, (Trait[])(object)new Trait[1] { (Trait)13 });
			val.temple = (CardTemple)0;
			val.abilities = abilities;
			val.specialAbilities = specialAbilities;
			CardExtensions.AddSpecialAbilities(val, (SpecialTriggeredAbility[])(object)new SpecialTriggeredAbility[1] { (SpecialTriggeredAbility)27 });
			val.appearanceBehaviour = appearances;
			CardExtensions.AddAppearances(val, (Appearance[])(object)new Appearance[1] { (Appearance)2 });
			if (Rare)
			{
				CardExtensions.AddAppearances(val, (Appearance[])(object)new Appearance[1] { (Appearance)6 });
			}
			CardManager.Add(modPrefix, val);
			return val;
		}

		public static CardInfo CreateCard(string modPrefix, string internalName, string displayName, string imageName, string imageEmissiveName, int attack = 0, int health = 1, int bloodCost = 0, int bonesCost = 0, int energyCost = 0, List<GemType> gemsCost = null, List<Ability> abilities = null, List<SpecialTriggeredAbility> specialAbilities = null, List<Trait> traits = null, List<Tribe> tribes = null, List<Appearance> appearances = null, SpecialStatIcon icon = 0, string decalName = null, bool appearChoiceNode = true, bool appearTrader = true, bool Rare = false, CardTemple temple = 0)
		{
			//IL_0078: Unknown result type (might be due to invalid IL or missing references)
			//IL_007b: Invalid comparison between Unknown and I4
			//IL_0083: Unknown result type (might be due to invalid IL or missing references)
			//IL_0103: Unknown result type (might be due to invalid IL or missing references)
			//IL_0105: Unknown result type (might be due to invalid IL or missing references)
			CardInfo val = CardExtensions.SetCost(CardExtensions.SetPortraitAndEmission(CardManager.New(modPrefix, internalName, displayName, attack, health, (string)null), LoadTexture(imageName), LoadTexture(imageEmissiveName), (FilterMode?)null), (int?)bloodCost, (int?)bonesCost, (int?)energyCost, gemsCost);
			if (decalName != null)
			{
				CardExtensions.AddDecal(val, (Texture[])(object)new Texture[1] { (Texture)LoadTexture(decalName) });
			}
			val.abilities = abilities;
			val.specialAbilities = specialAbilities;
			if ((int)icon > 0)
			{
				CardExtensions.SetStatIcon(val, icon);
			}
			val.traits = traits;
			val.tribes = tribes;
			val.appearanceBehaviour = appearances;
			if (appearChoiceNode)
			{
				CardExtensions.AddMetaCategories(val, (CardMetaCategory[])(object)new CardMetaCategory[1]);
			}
			if (appearTrader)
			{
				CardExtensions.AddMetaCategories(val, (CardMetaCategory[])(object)new CardMetaCategory[1] { (CardMetaCategory)1 });
			}
			if (Rare)
			{
				CardExtensions.AddMetaCategories(val, (CardMetaCategory[])(object)new CardMetaCategory[1] { (CardMetaCategory)3 });
				CardExtensions.AddAppearances(val, (Appearance[])(object)new Appearance[1] { (Appearance)7 });
			}
			val.temple = temple;
			CardManager.Add(modPrefix, val);
			return val;
		}
	}
}

plugins/Lily-Bundle_Of_Totems/plugins/Bundle_Of_Totems.dll

Decompiled 5 months ago
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using BepInEx;
using BepInEx.Configuration;
using BepInEx.Logging;
using DiskCardGame;
using HarmonyLib;
using InscryptionAPI.Card;
using InscryptionAPI.Guid;
using InscryptionAPI.Helpers;
using InscryptionAPI.Helpers.Extensions;
using InscryptionAPI.Totems;
using UnityEngine;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = "")]
[assembly: AssemblyCompany("Bundle_Of_Totems")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyDescription("A collection of vanilla-like custom totems.")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("Bundle_Of_Totems")]
[assembly: AssemblyTitle("Bundle_Of_Totems")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.0.0")]
[module: UnverifiableCode]
public class CatTotem : CompositeTotemPiece
{
	public override void SetData(ItemData data)
	{
		((CompositeTotemPiece)this).SetData(data);
		GameObject val = GameObjectExtensions.FindChild(((Component)this).gameObject, "EYES");
		if ((Object)(object)val != (Object)null)
		{
			base.emissiveRenderer = val.GetComponent<Renderer>();
		}
	}
}
public class FishTotem : CompositeTotemPiece
{
	public override void SetData(ItemData data)
	{
		((CompositeTotemPiece)this).SetData(data);
		GameObject val = GameObjectExtensions.FindChild(((Component)this).gameObject, "FishEyes");
		if ((Object)(object)val != (Object)null)
		{
			base.emissiveRenderer = val.GetComponent<Renderer>();
		}
	}
}
public class MouseTotem : CompositeTotemPiece
{
	public override void SetData(ItemData data)
	{
		((CompositeTotemPiece)this).SetData(data);
		GameObject val = GameObjectExtensions.FindChild(((Component)this).gameObject, "eyes");
		if ((Object)(object)val != (Object)null)
		{
			base.emissiveRenderer = val.GetComponent<Renderer>();
		}
	}
}
public class ZombieTotem : CompositeTotemPiece
{
	public override void SetData(ItemData data)
	{
		((CompositeTotemPiece)this).SetData(data);
		GameObject val = GameObjectExtensions.FindChild(((Component)this).gameObject, "FishEyes");
		if ((Object)(object)val != (Object)null)
		{
			base.emissiveRenderer = val.GetComponent<Renderer>();
		}
	}
}
namespace Bundle_Of_Totems
{
	public static class MyPluginInfo
	{
		public const string PLUGIN_GUID = "Bundle_Of_Totems";

		public const string PLUGIN_NAME = "Bundle_Of_Totems";

		public const string PLUGIN_VERSION = "1.0.0";
	}
}
namespace BundleOfTotems
{
	[HarmonyPatch]
	[BepInPlugin("Lily.BOT", "Bundle Of Totems", "1.0.0")]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	public class Plugin : BaseUnityPlugin
	{
		public const string PluginGuid = "Lily.BOT";

		private const string PluginName = "Bundle Of Totems";

		private const string PluginVersion = "1.0.0";

		public static string Directory;

		internal static ManualLogSource Log;

		public static Tribe FelineTribe;

		public static Tribe AquaticTribe;

		public static Tribe UndeadTribe;

		public static Tribe RodentTribe;

		public static ConfigEntry<bool> configAddTribesToVanillaCards;

		public static ConfigEntry<bool> configAddRodentTribeToSquirrels;

		public void Awake()
		{
			//IL_0022: Unknown result type (might be due to invalid IL or missing references)
			//IL_0028: Expected O, but got Unknown
			//IL_007c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0081: Unknown result type (might be due to invalid IL or missing references)
			//IL_0090: 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_00df: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ee: Unknown result type (might be due to invalid IL or missing references)
			//IL_0138: Unknown result type (might be due to invalid IL or missing references)
			//IL_013d: Unknown result type (might be due to invalid IL or missing references)
			//IL_014c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0196: Unknown result type (might be due to invalid IL or missing references)
			//IL_019b: Unknown result type (might be due to invalid IL or missing references)
			//IL_01aa: Unknown result type (might be due to invalid IL or missing references)
			((BaseUnityPlugin)this).Logger.LogInfo((object)"Loaded Bundle Of Totems!");
			Log = ((BaseUnityPlugin)this).Logger;
			Harmony val = new Harmony("Lily.BOT");
			val.PatchAll();
			Directory = ((BaseUnityPlugin)this).Info.Location;
			GameObject val2 = default(GameObject);
			if (AssetBundleHelper.TryGet<GameObject>(Path.Combine(Path.GetDirectoryName(Directory), "custom_totems"), "cat", ref val2))
			{
				FelineTribe = TribeManager.Add("Lily.BOT", "feline", GetTexture("feline_tribe"), true, (Texture2D)null);
				TotemManager.NewTopPiece<CatTotem>("feline_totem", "Lily.BOT", FelineTribe, val2);
			}
			GameObject val3 = default(GameObject);
			if (AssetBundleHelper.TryGet<GameObject>(Path.Combine(Path.GetDirectoryName(Directory), "custom_totems"), "fish", ref val3))
			{
				AquaticTribe = TribeManager.Add("Lily.BOT", "aquatic", GetTexture("aquatic_tribe"), true, (Texture2D)null);
				TotemManager.NewTopPiece<FishTotem>("aquatic_totem", "Lily.BOT", AquaticTribe, val3);
			}
			GameObject val4 = default(GameObject);
			if (AssetBundleHelper.TryGet<GameObject>(Path.Combine(Path.GetDirectoryName(Directory), "custom_totems"), "zombie", ref val4))
			{
				UndeadTribe = TribeManager.Add("Lily.BOT", "undead", GetTexture("undead_tribe"), true, (Texture2D)null);
				TotemManager.NewTopPiece<ZombieTotem>("undead_totem", "Lily.BOT", UndeadTribe, val4);
			}
			GameObject val5 = default(GameObject);
			if (AssetBundleHelper.TryGet<GameObject>(Path.Combine(Path.GetDirectoryName(Directory), "custom_totems"), "mouse", ref val5))
			{
				RodentTribe = TribeManager.Add("Lily.BOT", "rodent", GetTexture("rodent_tribe"), true, (Texture2D)null);
				TotemManager.NewTopPiece<MouseTotem>("rodent_totem", "Lily.BOT", RodentTribe, val5);
			}
			configAddTribesToVanillaCards = ((BaseUnityPlugin)this).Config.Bind<bool>("General", "Add Tribes To Vanilla Cards", true, "Makes it so vanilla cards gain custom tribes from this mod if said tribe fits that card.");
			configAddRodentTribeToSquirrels = ((BaseUnityPlugin)this).Config.Bind<bool>("General", "Add Rodent Tribe To Squirrels", false, "Makes it so squirrels and aquasquirrels gain the rodent tribe.");
			if (configAddTribesToVanillaCards.Value)
			{
				AddTribesToVanillaCards();
			}
			if (configAddRodentTribeToSquirrels.Value)
			{
				AddRodentTribeToSquirrels();
			}
		}

		public static void AddTribesToVanillaCards()
		{
			//IL_0018: Unknown result type (might be due to invalid IL or missing references)
			//IL_001e: Expected I4, but got Unknown
			//IL_003b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0041: Expected I4, but got Unknown
			//IL_005e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0064: Expected I4, but got Unknown
			//IL_0081: Unknown result type (might be due to invalid IL or missing references)
			//IL_0087: Expected I4, but got Unknown
			//IL_00a4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00aa: Expected I4, but got Unknown
			//IL_00c7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00cd: Expected I4, but got Unknown
			//IL_00ea: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f0: Expected I4, but got Unknown
			//IL_010d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0113: Expected I4, but got Unknown
			//IL_0130: Unknown result type (might be due to invalid IL or missing references)
			//IL_0136: Expected I4, but got Unknown
			//IL_0153: Unknown result type (might be due to invalid IL or missing references)
			//IL_0159: Expected I4, but got Unknown
			//IL_0176: Unknown result type (might be due to invalid IL or missing references)
			//IL_017c: Expected I4, but got Unknown
			//IL_0199: Unknown result type (might be due to invalid IL or missing references)
			//IL_019f: Expected I4, but got Unknown
			//IL_01bc: Unknown result type (might be due to invalid IL or missing references)
			//IL_01c2: Expected I4, but got Unknown
			//IL_01df: Unknown result type (might be due to invalid IL or missing references)
			//IL_01e5: Expected I4, but got Unknown
			//IL_0202: Unknown result type (might be due to invalid IL or missing references)
			//IL_0208: Expected I4, but got Unknown
			//IL_0225: Unknown result type (might be due to invalid IL or missing references)
			//IL_022b: Expected I4, but got Unknown
			//IL_0248: Unknown result type (might be due to invalid IL or missing references)
			//IL_024e: Expected I4, but got Unknown
			//IL_026b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0271: Expected I4, but got Unknown
			//IL_028e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0294: Expected I4, but got Unknown
			//IL_02b1: Unknown result type (might be due to invalid IL or missing references)
			//IL_02b7: Expected I4, but got Unknown
			//IL_02d4: Unknown result type (might be due to invalid IL or missing references)
			//IL_02da: Expected I4, but got Unknown
			//IL_02f7: Unknown result type (might be due to invalid IL or missing references)
			//IL_02fd: Expected I4, but got Unknown
			CardExtensions.AddTribes(CardExtensions.CardByName((IEnumerable<CardInfo>)CardManager.BaseGameCards, "Cat"), (Tribe[])(object)new Tribe[1] { (Tribe)(int)FelineTribe });
			CardExtensions.AddTribes(CardExtensions.CardByName((IEnumerable<CardInfo>)CardManager.BaseGameCards, "Bullfrog"), (Tribe[])(object)new Tribe[1] { (Tribe)(int)AquaticTribe });
			CardExtensions.AddTribes(CardExtensions.CardByName((IEnumerable<CardInfo>)CardManager.BaseGameCards, "Tadpole"), (Tribe[])(object)new Tribe[1] { (Tribe)(int)AquaticTribe });
			CardExtensions.AddTribes(CardExtensions.CardByName((IEnumerable<CardInfo>)CardManager.BaseGameCards, "Kraken"), (Tribe[])(object)new Tribe[1] { (Tribe)(int)AquaticTribe });
			CardExtensions.AddTribes(CardExtensions.CardByName((IEnumerable<CardInfo>)CardManager.BaseGameCards, "Shark"), (Tribe[])(object)new Tribe[1] { (Tribe)(int)AquaticTribe });
			CardExtensions.AddTribes(CardExtensions.CardByName((IEnumerable<CardInfo>)CardManager.BaseGameCards, "Snelk"), (Tribe[])(object)new Tribe[1] { (Tribe)(int)UndeadTribe });
			CardExtensions.AddTribes(CardExtensions.CardByName((IEnumerable<CardInfo>)CardManager.BaseGameCards, "Snelk_Neck"), (Tribe[])(object)new Tribe[1] { (Tribe)(int)UndeadTribe });
			CardExtensions.AddTribes(CardExtensions.CardByName((IEnumerable<CardInfo>)CardManager.BaseGameCards, "SkeletonPirate"), (Tribe[])(object)new Tribe[1] { (Tribe)(int)UndeadTribe });
			CardExtensions.AddTribes(CardExtensions.CardByName((IEnumerable<CardInfo>)CardManager.BaseGameCards, "SkeletonParrot"), (Tribe[])(object)new Tribe[1] { (Tribe)(int)UndeadTribe });
			CardExtensions.AddTribes(CardExtensions.CardByName((IEnumerable<CardInfo>)CardManager.BaseGameCards, "Beaver"), (Tribe[])(object)new Tribe[1] { (Tribe)(int)RodentTribe });
			CardExtensions.AddTribes(CardExtensions.CardByName((IEnumerable<CardInfo>)CardManager.BaseGameCards, "FieldMouse"), (Tribe[])(object)new Tribe[1] { (Tribe)(int)RodentTribe });
			CardExtensions.AddTribes(CardExtensions.CardByName((IEnumerable<CardInfo>)CardManager.BaseGameCards, "Mole"), (Tribe[])(object)new Tribe[1] { (Tribe)(int)RodentTribe });
			CardExtensions.AddTribes(CardExtensions.CardByName((IEnumerable<CardInfo>)CardManager.BaseGameCards, "MoleMan"), (Tribe[])(object)new Tribe[1] { (Tribe)(int)RodentTribe });
			CardExtensions.AddTribes(CardExtensions.CardByName((IEnumerable<CardInfo>)CardManager.BaseGameCards, "MoleSeaman"), (Tribe[])(object)new Tribe[1] { (Tribe)(int)RodentTribe });
			CardExtensions.AddTribes(CardExtensions.CardByName((IEnumerable<CardInfo>)CardManager.BaseGameCards, "PackRat"), (Tribe[])(object)new Tribe[1] { (Tribe)(int)RodentTribe });
			CardExtensions.AddTribes(CardExtensions.CardByName((IEnumerable<CardInfo>)CardManager.BaseGameCards, "Porcupine"), (Tribe[])(object)new Tribe[1] { (Tribe)(int)RodentTribe });
			CardExtensions.AddTribes(CardExtensions.CardByName((IEnumerable<CardInfo>)CardManager.BaseGameCards, "Rabbit"), (Tribe[])(object)new Tribe[1] { (Tribe)(int)RodentTribe });
			CardExtensions.AddTribes(CardExtensions.CardByName((IEnumerable<CardInfo>)CardManager.BaseGameCards, "Warren"), (Tribe[])(object)new Tribe[1] { (Tribe)(int)RodentTribe });
			CardExtensions.AddTribes(CardExtensions.CardByName((IEnumerable<CardInfo>)CardManager.BaseGameCards, "SquirrelBall"), (Tribe[])(object)new Tribe[1] { (Tribe)(int)RodentTribe });
			CardExtensions.AddTribes(CardExtensions.CardByName((IEnumerable<CardInfo>)CardManager.BaseGameCards, "Amalgam"), (Tribe[])(object)new Tribe[1] { (Tribe)(int)FelineTribe });
			CardExtensions.AddTribes(CardExtensions.CardByName((IEnumerable<CardInfo>)CardManager.BaseGameCards, "Amalgam"), (Tribe[])(object)new Tribe[1] { (Tribe)(int)AquaticTribe });
			CardExtensions.AddTribes(CardExtensions.CardByName((IEnumerable<CardInfo>)CardManager.BaseGameCards, "Amalgam"), (Tribe[])(object)new Tribe[1] { (Tribe)(int)UndeadTribe });
		}

		public static void AddRodentTribeToSquirrels()
		{
			//IL_0018: Unknown result type (might be due to invalid IL or missing references)
			//IL_001e: Expected I4, but got Unknown
			//IL_003b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0041: Expected I4, but got Unknown
			CardExtensions.AddTribes(CardExtensions.CardByName((IEnumerable<CardInfo>)CardManager.BaseGameCards, "Squirrel"), (Tribe[])(object)new Tribe[1] { (Tribe)(int)RodentTribe });
			CardExtensions.AddTribes(CardExtensions.CardByName((IEnumerable<CardInfo>)CardManager.BaseGameCards, "AquaSquirrel"), (Tribe[])(object)new Tribe[1] { (Tribe)(int)RodentTribe });
		}

		public void AddDevStuff()
		{
			//IL_0023: Unknown result type (might be due to invalid IL or missing references)
			//IL_0029: Expected I4, but got Unknown
			CardInfo val = CardExtensions.CardByName((IEnumerable<CardInfo>)CardManager.BaseGameCards, "Squirrel");
			Tribe[] array = (Tribe[])(object)new Tribe[1] { (Tribe)(int)GuidManager.GetEnumValue<Tribe>("Lily.BOT", "undead") };
			CardExtensions.AddTribes(val, array);
			val.baseHealth = 99;
			val.baseAttack = 1;
			CardInfo val2 = CardExtensions.CardByName((IEnumerable<CardInfo>)CardManager.BaseGameCards, "Geck");
			CardExtensions.AddAbilities(val2, (Ability[])(object)new Ability[1] { (Ability)4 });
			val2.baseHealth = 99;
			val2.baseAttack = 1;
		}

		public static Texture2D GetTexture(string path)
		{
			//IL_0028: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Expected O, but got Unknown
			byte[] array = File.ReadAllBytes(Path.Combine(Path.GetDirectoryName(Directory), "Artwork/", path + ".png"));
			Texture2D val = new Texture2D(2, 2);
			ImageConversion.LoadImage(val, array);
			((Texture)val).filterMode = (FilterMode)0;
			return val;
		}
	}
}

plugins/MADH95Mods-JSONCardLoader/plugins/JSONLoader.dll

Decompiled 5 months ago
using System;
using System.Collections;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Diagnostics;
using System.Globalization;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Serialization;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using System.Text;
using System.Text.RegularExpressions;
using APIPlugin;
using BepInEx;
using BepInEx.Bootstrap;
using BepInEx.Configuration;
using BepInEx.Logging;
using DiskCardGame;
using HarmonyLib;
using InscryptionAPI.Ascension;
using InscryptionAPI.Card;
using InscryptionAPI.Encounters;
using InscryptionAPI.Guid;
using InscryptionAPI.Helpers;
using InscryptionAPI.Localizing;
using InscryptionAPI.Masks;
using InscryptionAPI.Regions;
using InscryptionAPI.Saves;
using InscryptionAPI.Sound;
using InscryptionAPI.TalkingCards;
using InscryptionAPI.TalkingCards.Animation;
using InscryptionAPI.TalkingCards.Create;
using InscryptionAPI.TalkingCards.Helpers;
using InscryptionAPI.Triggers;
using JLPlugin;
using JLPlugin.ConfigilFunctions;
using JLPlugin.Data;
using JLPlugin.Hotkeys;
using JLPlugin.SigilCode;
using JLPlugin.Utils;
using JLPlugin.V2.Data;
using JSONLoader.Data;
using JSONLoader.Data.TalkingCards;
using JSONLoader.V2Code;
using Microsoft.CodeAnalysis;
using MonoMod.Utils;
using NCalc;
using PanoramicData.NCalcExtensions;
using TMPro;
using TinyJson;
using UnityEngine;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: TargetFramework(".NETStandard,Version=v2.0", FrameworkDisplayName = "")]
[assembly: AssemblyCompany("JSONLoader")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyDescription("JSON Loader")]
[assembly: AssemblyFileVersion("2.0.0.0")]
[assembly: AssemblyInformationalVersion("2.0")]
[assembly: AssemblyProduct("JSONLoader")]
[assembly: AssemblyTitle("JSONLoader")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("2.0.0.0")]
[module: UnverifiableCode]
namespace Microsoft.CodeAnalysis
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	internal sealed class EmbeddedAttribute : Attribute
	{
	}
}
namespace System.Runtime.CompilerServices
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	internal sealed class IsReadOnlyAttribute : Attribute
	{
	}
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	internal sealed class IsUnmanagedAttribute : Attribute
	{
	}
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	[AttributeUsage(AttributeTargets.Class | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Parameter | AttributeTargets.ReturnValue | AttributeTargets.GenericParameter, AllowMultiple = false, Inherited = false)]
	internal sealed class NullableAttribute : Attribute
	{
		public readonly byte[] NullableFlags;

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

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

		public NullableContextAttribute(byte P_0)
		{
			Flag = P_0;
		}
	}
}
public static class ImportExportUtils
{
	private static string ID;

	private static string DebugPath;

	private static string LoggingSuffix;

	public static void SetID(string id)
	{
		ID = id;
	}

	public static void SetDebugPath(string path)
	{
		DebugPath = path.Substring(Plugin.BepInExDirectory.Length);
		LoggingSuffix = "";
	}

	public static T ParseEnum<T>(string value) where T : unmanaged, Enum
	{
		if (Enum.TryParse<T>(value, out var result))
		{
			return result;
		}
		int num = Math.Max(value.LastIndexOf('_'), value.LastIndexOf('.'));
		if (num < 0)
		{
			throw new InvalidCastException("Cannot parse " + value + " as " + typeof(T).FullName);
		}
		string text = value.Substring(0, num);
		string text2 = value.Substring(num + 1);
		return GuidManager.GetEnumValue<T>(text, text2);
	}

	public static void ApplyProperty<T, Y>(Func<T> getter, Action<T> setter, ref Y serializeInfoValue, bool toCardInfo, string category, string suffix)
	{
		if (toCardInfo)
		{
			T a = default(T);
			ApplyValue(ref a, ref serializeInfoValue, toA: true, category, suffix);
			setter(a);
		}
		else
		{
			T a2 = getter();
			ApplyValue(ref a2, ref serializeInfoValue, toA: false, category, suffix);
		}
	}

	public static void ApplyProperty<T, Y>(ref T serializeInfoValue, Func<Y> getter, Action<Y> setter, bool toCardInfo, string category, string suffix)
	{
		if (toCardInfo)
		{
			Y b = getter();
			ApplyValue(ref serializeInfoValue, ref b, toA: false, category, suffix);
		}
		else
		{
			Y b2 = default(Y);
			ApplyValue(ref serializeInfoValue, ref b2, toA: true, category, suffix);
			setter(b2);
		}
	}

	public static void ApplyValue<T, Y>(ref T a, ref Y b, bool toA, string category, string suffix)
	{
		if (toA)
		{
			ConvertValue(ref b, ref a, category, suffix);
		}
		else
		{
			ConvertValue(ref a, ref b, category, suffix);
		}
	}

	private static void ConvertValue<FromType, ToType>(ref FromType from, ref ToType to, string category, string suffix)
	{
		//IL_0882: Unknown result type (might be due to invalid IL or missing references)
		//IL_0889: Expected O, but got Unknown
		//IL_099b: Unknown result type (might be due to invalid IL or missing references)
		//IL_09a2: Expected O, but got Unknown
		LoggingSuffix = suffix;
		Type typeFromHandle = typeof(FromType);
		Type typeFromHandle2 = typeof(ToType);
		try
		{
			if (typeFromHandle == typeFromHandle2)
			{
				to = (ToType)(object)from;
				return;
			}
			if (AreNullableTypesEqual(from, to, out var a2, out var _, out var aHasValue, out var _))
			{
				if (aHasValue)
				{
					to = (ToType)a2;
				}
				return;
			}
			if (typeFromHandle.IsGenericType && typeFromHandle.GetGenericTypeDefinition() == typeof(List<>) && typeFromHandle2.IsGenericType && typeFromHandle2.GetGenericTypeDefinition() == typeof(List<>))
			{
				if (from != null)
				{
					IList list = (IList)Activator.CreateInstance(typeFromHandle2);
					to = (ToType)list;
					IList list2 = (IList)(object)from;
					for (int i = 0; i < list2.Count; i++)
					{
						object o = list2[i];
						object @default = GetDefault(typeFromHandle2.GetGenericArguments().Single());
						object value = ConvertType(typeFromHandle, typeFromHandle2, o, @default, category, $"{suffix}_{i + 1}");
						list.Add(value);
					}
				}
				return;
			}
			if (typeFromHandle.IsGenericType && typeFromHandle.GetGenericTypeDefinition() == typeof(List<>) && typeFromHandle2.IsArray)
			{
				if (from != null)
				{
					IList list3 = (IList)(object)from;
					int length = ((from != null) ? list3.Count : 0);
					Array array = Array.CreateInstance(typeFromHandle2.GetElementType(), length);
					to = (ToType)(object)array;
					for (int j = 0; j < list3.Count; j++)
					{
						object obj = list3[j];
						object default2 = GetDefault(typeFromHandle2.GetElementType());
						object[] array2 = new object[4]
						{
							obj,
							default2,
							category,
							$"{suffix}_{j + 1}"
						};
						MethodInfo methodInfo = typeof(ImportExportUtils).GetMethod("ConvertValue", BindingFlags.Static | BindingFlags.NonPublic).MakeGenericMethod(typeFromHandle.GetGenericArguments().Single(), typeFromHandle2.GetElementType());
						methodInfo.Invoke(null, array2);
						array.SetValue(array2[1], j);
					}
				}
				return;
			}
			if (typeFromHandle.IsArray && typeFromHandle2.IsGenericType && typeFromHandle2.GetGenericTypeDefinition() == typeof(List<>))
			{
				if (from != null)
				{
					IList list4 = (IList)Activator.CreateInstance(typeFromHandle2);
					to = (ToType)list4;
					Array array3 = (Array)(object)from;
					for (int k = 0; k < array3.Length; k++)
					{
						object value2 = array3.GetValue(k);
						object default3 = GetDefault(typeFromHandle2.GetGenericArguments().Single());
						object[] array4 = new object[4]
						{
							value2,
							default3,
							category,
							$"{suffix}_{k + 1}"
						};
						MethodInfo methodInfo2 = typeof(ImportExportUtils).GetMethod("ConvertValue", BindingFlags.Static | BindingFlags.NonPublic).MakeGenericMethod(typeFromHandle.GetElementType(), typeFromHandle2.GetGenericArguments().Single());
						methodInfo2.Invoke(null, array4);
						list4.Add(array4[1]);
					}
				}
				return;
			}
			if (typeFromHandle.IsEnum && typeFromHandle2 == typeof(string))
			{
				string text = from.ToString();
				if (int.TryParse(text, out var result))
				{
					object[] array5 = new object[3] { result, "guid", "name" };
					MethodInfo methodInfo3 = typeof(GuidManager).GetMethod("TryGetGuidAndKeyEnumValue", BindingFlags.Static | BindingFlags.Public).MakeGenericMethod(typeFromHandle);
					if ((bool)methodInfo3.Invoke(null, array5))
					{
						string text2 = (string)array5[1];
						string text3 = (string)array5[2];
						to = (ToType)(object)(text2 + "_" + text3);
					}
					else
					{
						Error($"Failed to convert enum to string! '{from}'");
						to = (ToType)(object)text;
					}
				}
				else
				{
					to = (ToType)(object)text;
				}
				return;
			}
			if (typeFromHandle == typeof(string) && typeFromHandle2.IsEnum)
			{
				if (!string.IsNullOrEmpty((string)(object)from))
				{
					object obj2 = typeof(ImportExportUtils).GetMethod("ParseEnum", BindingFlags.Static | BindingFlags.Public).MakeGenericMethod(typeFromHandle2).Invoke(null, new object[1] { from });
					to = (ToType)obj2;
				}
				return;
			}
			if (typeFromHandle == typeof(CardInfo) && typeFromHandle2 == typeof(string))
			{
				if (from != null)
				{
					object obj3 = from;
					to = (ToType)(object)((Object)((obj3 is CardInfo) ? obj3 : null)).name;
				}
				return;
			}
			if (typeFromHandle == typeof(string) && typeFromHandle2 == typeof(CardInfo))
			{
				string text4 = (string)(object)from;
				if (text4 != null)
				{
					text4 = text4.Trim();
				}
				if (string.IsNullOrEmpty(text4))
				{
					return;
				}
				to = (ToType)(object)CardExtensions.CardByName((IEnumerable<CardInfo>)CardManager.AllCardsCopy, text4);
				if (to != null)
				{
					return;
				}
				CardInfo[] array6 = FindSimilarCards(text4);
				if (array6.Length == 0)
				{
					string text5 = string.Join(", ", CardManager.AllCardsCopy.Select((CardInfo c) => ((Object)c).name));
					Error("Could not find CardInfo with name '" + text4 + "'!\nAllCards: " + text5);
					return;
				}
				to = (ToType)(object)array6[0];
				string text6 = string.Join(" or ", array6.Select((CardInfo a) => "'" + ((Object)a).name + "'"));
				Warning("Could not find CardInfo with name '" + text4 + "'. Did you mean " + text6 + "?");
				return;
			}
			if (typeFromHandle == typeof(string) && (typeFromHandle2 == typeof(Texture) || typeFromHandle2.IsSubclassOf(typeof(Texture))))
			{
				string text7 = (string)(object)from;
				if (!string.IsNullOrEmpty(text7))
				{
					try
					{
						to = (ToType)(object)TextureHelper.GetImageAsTexture(text7, (FilterMode)0);
						return;
					}
					catch (FileNotFoundException)
					{
						Error("Failed to find texture " + text7 + "!");
						return;
					}
				}
				return;
			}
			if ((typeFromHandle == typeof(Texture) || typeFromHandle.IsSubclassOf(typeof(Texture))) && typeFromHandle2 == typeof(string))
			{
				Texture val = (Texture)(object)from;
				if ((Object)(object)val != (Object)null)
				{
					string path = Path.Combine(Plugin.ExportDirectory, category, "Assets", ID + "_" + suffix + ".png");
					to = (ToType)(object)ExportTexture(val, path);
				}
				return;
			}
			if (typeFromHandle == typeof(string) && typeFromHandle2 == typeof(Sprite))
			{
				string text8 = (string)(object)from;
				if (!string.IsNullOrEmpty(text8))
				{
					Texture2D imageAsTexture = TextureHelper.GetImageAsTexture(text8, (FilterMode)0);
					if ((Object)(object)imageAsTexture != (Object)null)
					{
						to = (ToType)(object)TextureHelper.ConvertTexture(imageAsTexture, (Vector2?)null);
					}
				}
				return;
			}
			if (typeFromHandle == typeof(Sprite) && typeFromHandle2 == typeof(string))
			{
				Sprite val2 = (Sprite)(object)from;
				if ((Object)(object)val2 != (Object)null)
				{
					string path2 = Path.Combine(Plugin.ExportDirectory, category, "Assets", ID + "_" + suffix + ".png");
					to = (ToType)(object)ExportTexture(val2.texture, path2);
				}
				return;
			}
			if (typeFromHandle.GetInterfaces().Contains(typeof(IConvertible)) && typeFromHandle2.GetInterfaces().Contains(typeof(IConvertible)))
			{
				IConvertible convertible = from as IConvertible;
				IConvertible convertible2 = to as IConvertible;
				if (convertible != null && convertible2 != null)
				{
					to = (ToType)Convert.ChangeType(convertible, typeFromHandle2);
				}
				return;
			}
			if (typeFromHandle == typeof(JSONParser.LocalizableField) && typeFromHandle2 == typeof(string))
			{
				Error("Use ApplyLocaleField when converted from LocalizableField to string!");
			}
			else if (typeFromHandle == typeof(string) && typeFromHandle2 == typeof(JSONParser.LocalizableField))
			{
				Error("Use ApplyLocaleField when converted from string to LocalizableField!");
			}
		}
		catch (Exception e)
		{
			Error($"Failed to convert: {typeFromHandle} to {typeFromHandle2}");
			Exception(e);
			return;
		}
		Error($"Unsupported conversion type: {typeFromHandle} to {typeFromHandle2}\n{Environment.StackTrace}");
	}

	private static CardInfo[] FindSimilarCards(string misspelledCardName)
	{
		List<Tuple<int, CardInfo>> list = new List<Tuple<int, CardInfo>>();
		string text = misspelledCardName.ToLower().Replace("-", "").Replace("_", "");
		int num = Mathf.Clamp(text.Length - 1, 1, 4);
		foreach (CardInfo item in CardManager.AllCardsCopy)
		{
			string text2 = ((Object)item).name.ToLower().Replace("-", "").Replace("_", "");
			if (Mathf.Abs(text.Length - text2.Length) > num)
			{
				continue;
			}
			int num2 = 0;
			int num3 = Mathf.Max(0, text.Length - text2.Length);
			int num4 = text2.Length - 1;
			int num5 = text.Length - 1;
			while (num5 >= 0 && num4 >= 0)
			{
				if (text2[num4] == text[num5])
				{
					num2++;
				}
				else
				{
					num3++;
					if (num3 > num)
					{
						break;
					}
					if (num4 > 0 && text2[num4 - 1] == text[num5])
					{
						num4--;
						num2++;
					}
					else if (num5 > 0 && text2[num4] == text[num5 - 1])
					{
						num5--;
						num2++;
					}
				}
				num5--;
				num4--;
			}
			if (num2 > 0 && num3 < num)
			{
				list.Add(new Tuple<int, CardInfo>(num2, item));
			}
		}
		list.Sort((Tuple<int, CardInfo> a, Tuple<int, CardInfo> b) => b.Item1 - a.Item1);
		return list.Select((Tuple<int, CardInfo> a) => a.Item2).ToArray();
	}

	private static object ConvertType(Type fromType, Type toType, object o1, object o2, string category, string suffix)
	{
		object[] array = new object[4] { o1, o2, category, suffix };
		MethodInfo methodInfo = typeof(ImportExportUtils).GetMethod("ConvertValue", BindingFlags.Static | BindingFlags.NonPublic).MakeGenericMethod(fromType.GetGenericArguments().Single(), toType.GetGenericArguments().Single());
		methodInfo.Invoke(null, array);
		return array[1];
	}

	private static bool AreNullableTypesEqual<T, Y>(T t, Y y, out object a, out object b, out bool aHasValue, out bool bHasValue)
	{
		aHasValue = false;
		bHasValue = false;
		a = null;
		b = null;
		bool flag = typeof(T).IsGenericType && typeof(T).GetGenericTypeDefinition() == typeof(Nullable<>);
		bool flag2 = typeof(Y).IsGenericType && typeof(Y).GetGenericTypeDefinition() == typeof(Nullable<>);
		if (!flag && !flag2)
		{
			return false;
		}
		Type type = (flag ? Nullable.GetUnderlyingType(typeof(T)) : typeof(T));
		Type type2 = (flag2 ? Nullable.GetUnderlyingType(typeof(Y)) : typeof(Y));
		if (type == type2)
		{
			if (flag)
			{
				a = GetValueFromNullable(t, out aHasValue);
			}
			else
			{
				a = t;
				aHasValue = true;
			}
			if (flag2)
			{
				b = GetValueFromNullable(y, out bHasValue);
			}
			else
			{
				b = y;
				bHasValue = true;
			}
			return true;
		}
		Error($"Not same types {typeof(T)} {typeof(Y)}");
		return false;
	}

	private static string ExportTexture(Texture texture, string path)
	{
		Texture2D val = (Texture2D)(object)((texture is Texture2D) ? texture : null);
		if (val != null)
		{
			return ExportTexture(val, path);
		}
		Texture2D texture2 = Texture2D.CreateExternalTexture(texture.width, texture.height, (TextureFormat)4, false, false, texture.GetNativeTexturePtr());
		return ExportTexture(texture2, path);
	}

	private static string ExportTexture(Texture2D texture, string path)
	{
		//IL_0049: Unknown result type (might be due to invalid IL or missing references)
		//IL_0050: Expected O, but got Unknown
		//IL_006a: Unknown result type (might be due to invalid IL or missing references)
		if (!((Texture)texture).isReadable)
		{
			RenderTexture temporary = RenderTexture.GetTemporary(((Texture)texture).width, ((Texture)texture).height, 0, (RenderTextureFormat)7, (RenderTextureReadWrite)1);
			Graphics.Blit((Texture)(object)texture, temporary);
			RenderTexture active = RenderTexture.active;
			RenderTexture.active = temporary;
			Texture2D val = new Texture2D(((Texture)texture).width, ((Texture)texture).height);
			val.ReadPixels(new Rect(0f, 0f, (float)((Texture)temporary).width, (float)((Texture)temporary).height), 0, 0);
			val.Apply();
			RenderTexture.active = active;
			RenderTexture.ReleaseTemporary(temporary);
			texture = val;
		}
		byte[] array = ImageConversion.EncodeToPNG(texture);
		if (array == null)
		{
			Error("Failed to turn into bytes??");
		}
		if (string.IsNullOrEmpty(path))
		{
			Error("path is empty????");
		}
		string directoryName = Path.GetDirectoryName(path);
		if (!Directory.Exists(directoryName))
		{
			Directory.CreateDirectory(directoryName);
		}
		File.WriteAllBytes(path, array);
		return Path.GetFileName(path);
	}

	public static string[] ExportTextures(IEnumerable<Texture2D> texture, string type, string fileName)
	{
		int num = 0;
		List<string> list = new List<string>();
		foreach (Texture2D item in texture)
		{
			num++;
			string path = Path.Combine(Plugin.ExportDirectory, type, "Assets", $"{fileName}_{num}.png");
			list.Add(ExportTexture(item, path));
		}
		return list.ToArray();
	}

	public static void ApplyLocaleField(string field, ref JSONParser.LocalizableField rows, ref string cardInfoEnglishField, bool toCardInfo)
	{
		if (toCardInfo)
		{
			ApplyLocaleField(field, rows, ref cardInfoEnglishField);
			return;
		}
		string text = cardInfoEnglishField;
		cardInfoEnglishField = text;
		ImportLocaleField(rows, cardInfoEnglishField);
	}

	private static void ImportLocaleField(JSONParser.LocalizableField rows, string cardInfoEnglishField)
	{
		//IL_0065: 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)
		rows.rows.Clear();
		rows.Initialize(cardInfoEnglishField);
		Translation val = Localization.Translations.Find((Translation a) => a.englishStringFormatted == cardInfoEnglishField);
		if (val != null)
		{
			foreach (KeyValuePair<Language, string> value in val.values)
			{
				string text = LocalizationManager.LanguageToCode(value.Key);
				rows.SetValue(rows.englishFieldName + "_" + text, value.Value);
				VerboseLog($"Loaded {cardInfoEnglishField} translation for {text} => {value.Key}");
			}
			return;
		}
		VerboseLog("ApplyLocaleField could not find any translations from english '" + cardInfoEnglishField + "'");
	}

	private static void ApplyLocaleField(string field, JSONParser.LocalizableField rows, ref string cardInfoEnglishField)
	{
		//IL_0127: Unknown result type (might be due to invalid IL or missing references)
		//IL_012c: Unknown result type (might be due to invalid IL or missing references)
		//IL_012e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0132: Invalid comparison between Unknown and I4
		//IL_014d: Unknown result type (might be due to invalid IL or missing references)
		if (rows.rows.TryGetValue(rows.englishFieldName, out var value))
		{
			cardInfoEnglishField = value;
		}
		else
		{
			if (rows.rows.Count <= 0)
			{
				return;
			}
			cardInfoEnglishField = rows.rows.First().Value;
		}
		VerboseLog("ApplyLocaleField " + field + " english " + cardInfoEnglishField);
		foreach (KeyValuePair<string, string> row in rows.rows)
		{
			if (row.Key == rows.englishFieldName)
			{
				continue;
			}
			int num = row.Key.LastIndexOf("_", StringComparison.Ordinal);
			if (num < 0)
			{
				VerboseError("Could not find _ of key " + row.Key + " in field " + field + "!");
				continue;
			}
			int length = row.Key.Length - num - 1;
			string text = row.Key.Substring(num + 1, length);
			Language val = LocalizationManager.CodeToLanguage(text);
			if ((int)val != 12)
			{
				LocalizationManager.Translate("MADH.inscryption.JSONLoader", (string)null, cardInfoEnglishField, row.Value, val);
				VerboseLog("Translation " + cardInfoEnglishField + " to " + text + " = " + row.Value);
			}
			else
			{
				Error("Unknown language code " + text + " for card " + cardInfoEnglishField + " in field " + field);
			}
		}
	}

	private static object GetValueFromNullable<U>(U u, out bool hasValue)
	{
		Type typeFromHandle = typeof(U);
		if (u != null && (bool)typeFromHandle.GetProperty("HasValue", BindingFlags.Instance | BindingFlags.Public).GetValue(u))
		{
			hasValue = true;
			return typeFromHandle.GetProperty("Value", BindingFlags.Instance | BindingFlags.Public).GetValue(u);
		}
		hasValue = false;
		Type underlyingType = Nullable.GetUnderlyingType(typeFromHandle);
		if (underlyingType.IsValueType)
		{
			return Activator.CreateInstance(underlyingType);
		}
		return null;
	}

	private static object GetDefault(Type type)
	{
		if (type.IsValueType)
		{
			return Activator.CreateInstance(type);
		}
		return null;
	}

	private static void VerboseLog(string message)
	{
		Plugin.VerboseLog("[" + DebugPath + "][" + ID + "][" + LoggingSuffix + "] " + message);
	}

	private static void VerboseWarning(string message)
	{
		if (Configs.VerboseLogging)
		{
			Plugin.VerboseWarning("[" + DebugPath + "][" + ID + "][" + LoggingSuffix + "] " + message);
		}
	}

	private static void VerboseError(string message)
	{
		if (Configs.VerboseLogging)
		{
			Plugin.VerboseError("[" + DebugPath + "][" + ID + "][" + LoggingSuffix + "] " + message);
		}
	}

	private static void Warning(string message)
	{
		if (Configs.VerboseLogging)
		{
			VerboseWarning(message);
			return;
		}
		Plugin.Log.LogWarning((object)("[" + ID + "][" + LoggingSuffix + "] " + message));
	}

	private static void Error(string message)
	{
		if (Configs.VerboseLogging)
		{
			VerboseError(message);
			return;
		}
		Plugin.Log.LogError((object)("[" + ID + "][" + LoggingSuffix + "] " + message));
	}

	private static void Exception(Exception e)
	{
		Plugin.Log.LogError((object)("[" + DebugPath + "][" + ID + "][" + LoggingSuffix + "] " + e.Message + "\n" + e.StackTrace));
	}
}
namespace TinyJson
{
	public static class JSONParser
	{
		public interface IFlexibleField
		{
			bool ContainsKey(string key);

			void SetValue(string key, string value);

			string ToJSON();
		}

		public interface IInitializable
		{
			void Initialize();
		}

		[Serializable]
		public class LocalizableField : IFlexibleField
		{
			public Dictionary<string, string> rows;

			public string englishFieldName;

			public LocalizableField(string EnglishFieldName)
			{
				rows = new Dictionary<string, string>();
				englishFieldName = EnglishFieldName;
			}

			public void Initialize(string englishValue)
			{
				rows[englishFieldName] = englishValue;
			}

			public bool ContainsKey(string key)
			{
				return key.StartsWith(englishFieldName);
			}

			public void SetValue(string key, string value)
			{
				rows[key] = value;
			}

			public string ToJSON()
			{
				string text = "";
				foreach (KeyValuePair<string, string> row in rows)
				{
					text = text + "\t\"" + row.Key + "\": \"" + row.Value + "\",\n";
				}
				return text;
			}

			public override string ToString()
			{
				return rows.ToString();
			}
		}

		[ThreadStatic]
		private static Stack<List<string>> splitArrayPool;

		[ThreadStatic]
		private static StringBuilder stringBuilder;

		[ThreadStatic]
		private static Dictionary<Type, Dictionary<string, FieldInfo>> fieldInfoCache;

		[ThreadStatic]
		private static Dictionary<Type, Dictionary<string, PropertyInfo>> propertyInfoCache;

		[ThreadStatic]
		private static Dictionary<Type, FieldInfo[]> publicFieldInfoCache;

		public static T FromJson<T>(this string json)
		{
			if (propertyInfoCache == null)
			{
				propertyInfoCache = new Dictionary<Type, Dictionary<string, PropertyInfo>>();
			}
			if (fieldInfoCache == null)
			{
				fieldInfoCache = new Dictionary<Type, Dictionary<string, FieldInfo>>();
			}
			if (stringBuilder == null)
			{
				stringBuilder = new StringBuilder();
			}
			if (splitArrayPool == null)
			{
				splitArrayPool = new Stack<List<string>>();
			}
			if (publicFieldInfoCache == null)
			{
				publicFieldInfoCache = new Dictionary<Type, FieldInfo[]>();
			}
			stringBuilder.Length = 0;
			for (int i = 0; i < json.Length; i++)
			{
				char c = json[i];
				switch (c)
				{
				case '"':
					i = AppendUntilStringEnd(appendEscapeCharacter: true, i, json);
					continue;
				case '/':
					if (i + 1 != json.Length && json[i + 1] == '/')
					{
						i = SkipUntilLineEnd(i, json);
						continue;
					}
					break;
				}
				if (!char.IsWhiteSpace(c))
				{
					stringBuilder.Append(c);
				}
			}
			return (T)ParseValue(typeof(T), stringBuilder.ToString());
		}

		private static int SkipUntilLineEnd(int startIdx, string json)
		{
			for (int i = startIdx + 2; i < json.Length; i++)
			{
				if (json[i] == '\n')
				{
					return i + 1;
				}
			}
			return json.Length - 1;
		}

		private static int AppendUntilStringEnd(bool appendEscapeCharacter, int startIdx, string json)
		{
			stringBuilder.Append(json[startIdx]);
			for (int i = startIdx + 1; i < json.Length; i++)
			{
				if (json[i] == '\\')
				{
					if (appendEscapeCharacter)
					{
						stringBuilder.Append(json[i]);
					}
					stringBuilder.Append(json[i + 1]);
					i++;
				}
				else
				{
					if (json[i] == '"')
					{
						stringBuilder.Append(json[i]);
						return i;
					}
					stringBuilder.Append(json[i]);
				}
			}
			return json.Length - 1;
		}

		private static List<string> Split(string json)
		{
			List<string> list = ((splitArrayPool.Count > 0) ? splitArrayPool.Pop() : new List<string>());
			list.Clear();
			if (json.Length == 2)
			{
				return list;
			}
			int num = 0;
			stringBuilder.Length = 0;
			for (int i = 1; i < json.Length - 1; i++)
			{
				switch (json[i])
				{
				case '[':
				case '{':
					num++;
					break;
				case ']':
				case '}':
					num--;
					break;
				case '"':
					i = AppendUntilStringEnd(appendEscapeCharacter: true, i, json);
					continue;
				case ',':
				case ':':
					if (num == 0)
					{
						list.Add(stringBuilder.ToString());
						stringBuilder.Length = 0;
						continue;
					}
					break;
				}
				stringBuilder.Append(json[i]);
			}
			list.Add(stringBuilder.ToString());
			return list;
		}

		internal static object ParseValue(Type type, string json)
		{
			if (type == typeof(string))
			{
				if (json.Length <= 2)
				{
					return string.Empty;
				}
				StringBuilder stringBuilder = new StringBuilder(json.Length);
				for (int i = 1; i < json.Length - 1; i++)
				{
					if (json[i] == '\\' && i + 1 < json.Length - 1)
					{
						int num = "\"\\nrtbf/".IndexOf(json[i + 1]);
						if (num >= 0)
						{
							stringBuilder.Append("\"\\\n\r\t\b\f/"[num]);
							i++;
							continue;
						}
						if (json[i + 1] == 'u' && i + 5 < json.Length - 1)
						{
							uint result = 0u;
							if (uint.TryParse(json.Substring(i + 2, 4), NumberStyles.AllowHexSpecifier, null, out result))
							{
								stringBuilder.Append((char)result);
								i += 5;
								continue;
							}
						}
					}
					stringBuilder.Append(json[i]);
				}
				return stringBuilder.ToString();
			}
			if (type.IsGenericType && type.GetGenericTypeDefinition() == typeof(Nullable<>))
			{
				return Convert.ChangeType(json, type.GetGenericArguments().First(), CultureInfo.InvariantCulture);
			}
			if (type.IsPrimitive)
			{
				return Convert.ChangeType(json, type, CultureInfo.InvariantCulture);
			}
			if (type == typeof(decimal))
			{
				decimal.TryParse(json, NumberStyles.Float, CultureInfo.InvariantCulture, out var result2);
				return result2;
			}
			if (type == typeof(DateTime))
			{
				DateTime.TryParse(json.Replace("\"", ""), CultureInfo.InvariantCulture, DateTimeStyles.None, out var result3);
				return result3;
			}
			if (json == "null")
			{
				return null;
			}
			if (type.IsEnum)
			{
				if (json[0] == '"')
				{
					json = json.Substring(1, json.Length - 2);
				}
				try
				{
					return Enum.Parse(type, json, ignoreCase: false);
				}
				catch
				{
					return 0;
				}
			}
			if (type.IsArray)
			{
				Type elementType = type.GetElementType();
				if (json[0] != '[' || json[json.Length - 1] != ']')
				{
					return null;
				}
				List<string> list = Split(json);
				Array array = Array.CreateInstance(elementType, list.Count);
				for (int j = 0; j < list.Count; j++)
				{
					array.SetValue(ParseValue(elementType, list[j]), j);
				}
				splitArrayPool.Push(list);
				return array;
			}
			if (type.IsGenericType && type.GetGenericTypeDefinition() == typeof(List<>))
			{
				Type type2 = type.GetGenericArguments()[0];
				if (json[0] != '[' || json[json.Length - 1] != ']')
				{
					return null;
				}
				List<string> list2 = Split(json);
				IList list3 = (IList)type.GetConstructor(new Type[1] { typeof(int) }).Invoke(new object[1] { list2.Count });
				for (int k = 0; k < list2.Count; k++)
				{
					list3.Add(ParseValue(type2, list2[k]));
				}
				splitArrayPool.Push(list2);
				return list3;
			}
			if (type.IsGenericType && type.GetGenericTypeDefinition() == typeof(Dictionary<, >))
			{
				Type[] genericArguments = type.GetGenericArguments();
				Type type3 = genericArguments[0];
				Type type4 = genericArguments[1];
				if (type3 != typeof(string))
				{
					return null;
				}
				if (json[0] != '{' || json[json.Length - 1] != '}')
				{
					return null;
				}
				List<string> list4 = Split(json);
				if (list4.Count % 2 != 0)
				{
					return null;
				}
				IDictionary dictionary = (IDictionary)type.GetConstructor(new Type[1] { typeof(int) }).Invoke(new object[1] { list4.Count / 2 });
				for (int l = 0; l < list4.Count; l += 2)
				{
					if (list4[l].Length > 2)
					{
						string key = list4[l].Substring(1, list4[l].Length - 2);
						object value = ParseValue(type4, list4[l + 1]);
						dictionary[key] = value;
					}
				}
				return dictionary;
			}
			if (type == typeof(object))
			{
				return ParseAnonymousValue(json);
			}
			if (json[0] == '{' && json[json.Length - 1] == '}')
			{
				return ParseObject(type, json);
			}
			return null;
		}

		private static object ParseAnonymousValue(string json)
		{
			if (json.Length == 0)
			{
				return null;
			}
			if (json[0] == '{' && json[json.Length - 1] == '}')
			{
				List<string> list = Split(json);
				if (list.Count % 2 != 0)
				{
					return null;
				}
				Dictionary<string, object> dictionary = new Dictionary<string, object>(list.Count / 2);
				for (int i = 0; i < list.Count; i += 2)
				{
					dictionary[list[i].Substring(1, list[i].Length - 2)] = ParseAnonymousValue(list[i + 1]);
				}
				return dictionary;
			}
			if (json[0] == '[' && json[json.Length - 1] == ']')
			{
				List<string> list2 = Split(json);
				List<object> list3 = new List<object>(list2.Count);
				for (int j = 0; j < list2.Count; j++)
				{
					list3.Add(ParseAnonymousValue(list2[j]));
				}
				return list3;
			}
			if (json[0] == '"' && json[json.Length - 1] == '"')
			{
				string text = json.Substring(1, json.Length - 2);
				return text.Replace("\\", string.Empty);
			}
			if (char.IsDigit(json[0]) || json[0] == '-')
			{
				if (json.Contains("."))
				{
					double.TryParse(json, NumberStyles.Float, CultureInfo.InvariantCulture, out var result);
					return result;
				}
				int.TryParse(json, out var result2);
				return result2;
			}
			if (json == "true")
			{
				return true;
			}
			if (json == "false")
			{
				return false;
			}
			return null;
		}

		private static Dictionary<string, T> CreateMemberNameDictionary<T>(T[] members) where T : MemberInfo
		{
			Dictionary<string, T> dictionary = new Dictionary<string, T>(StringComparer.OrdinalIgnoreCase);
			foreach (T val in members)
			{
				if (val.IsDefined(typeof(IgnoreDataMemberAttribute), inherit: true))
				{
					continue;
				}
				string name = val.Name;
				if (val.IsDefined(typeof(DataMemberAttribute), inherit: true))
				{
					DataMemberAttribute dataMemberAttribute = (DataMemberAttribute)Attribute.GetCustomAttribute(val, typeof(DataMemberAttribute), inherit: true);
					if (!string.IsNullOrEmpty(dataMemberAttribute.Name))
					{
						name = dataMemberAttribute.Name;
					}
				}
				dictionary.Add(name.ToLower(), val);
			}
			return dictionary;
		}

		private static object ParseObject(Type type, string json)
		{
			object uninitializedObject = FormatterServices.GetUninitializedObject(type);
			if (uninitializedObject is IInitializable initializable)
			{
				initializable.Initialize();
			}
			List<string> list = Split(json);
			if (list.Count % 2 != 0)
			{
				return uninitializedObject;
			}
			if (!fieldInfoCache.TryGetValue(type, out var value))
			{
				value = CreateMemberNameDictionary(type.GetFields(BindingFlags.Instance | BindingFlags.Public | BindingFlags.FlattenHierarchy));
				fieldInfoCache.Add(type, value);
			}
			if (!propertyInfoCache.TryGetValue(type, out var value2))
			{
				value2 = CreateMemberNameDictionary(type.GetProperties(BindingFlags.Instance | BindingFlags.Public | BindingFlags.FlattenHierarchy));
				propertyInfoCache.Add(type, value2);
			}
			for (int i = 0; i < list.Count; i += 2)
			{
				if (list[i].Length <= 2)
				{
					continue;
				}
				string text = list[i].Substring(1, list[i].Length - 2).ToLower();
				string text2 = list[i + 1];
				if (value.TryGetValue(text, out var value3))
				{
					SetField(value3, uninitializedObject, text2);
					continue;
				}
				if (value2.TryGetValue(text, out var value4))
				{
					SetProperty(value4, uninitializedObject, text2);
					continue;
				}
				bool flag = false;
				foreach (KeyValuePair<string, FieldInfo> item in value)
				{
					FieldInfo value5 = item.Value;
					if (value5.FieldType.GetInterfaces().Contains(typeof(IFlexibleField)))
					{
						object value6 = value5.GetValue(uninitializedObject);
						if (value6 is IFlexibleField flexibleField && flexibleField.ContainsKey(text))
						{
							flexibleField.SetValue(text, (string)ParseValue(typeof(string), text2));
							flag = true;
							break;
						}
					}
				}
				if (!flag)
				{
					Plugin.VerboseWarning($"{text} field not found for {type}");
				}
			}
			return uninitializedObject;
		}

		private static void SetField(FieldInfo info, object o, string v)
		{
			if (info.FieldType.GetInterfaces().Contains(typeof(IFlexibleField)))
			{
				object value = info.GetValue(o);
				if (value == null)
				{
					Debug.LogError((object)$"{info.Name} field is null! {info.FieldType} o:{o} instance:{o}");
				}
				else if (value is IFlexibleField flexibleField)
				{
					flexibleField.SetValue(info.Name, (string)ParseValue(typeof(string), v));
				}
			}
			else
			{
				info.SetValue(o, ParseValue(info.FieldType, v));
			}
		}

		private static void SetProperty(PropertyInfo info, object o, string v)
		{
			info.SetValue(o, ParseValue(info.PropertyType, v), null);
		}

		public static string ToJSON<T>(T t)
		{
			return ToJSONInternal(typeof(T), t, "");
		}

		private static string ToJSONInternal(Type type, object t, string prefix)
		{
			try
			{
				if (type == typeof(string))
				{
					string text = (string)t;
					if (text != null)
					{
						return "\"" + text + "\"";
					}
					return "\"\"";
				}
				if (type == typeof(string[]))
				{
					string[] array = (string[])t;
					if (array != null && array.Length != 0)
					{
						string text2 = "[";
						for (int i = 0; i < array.Length; i++)
						{
							string text3 = array[i];
							text2 = text2 + "\"" + text3 + "\"";
							if (i < array.Length - 1)
							{
								text2 += ",";
							}
						}
						return text2 + "]";
					}
					return "[]";
				}
				if (type == typeof(int?))
				{
					int? num = (int?)t;
					if (num.HasValue)
					{
						return num.Value.ToString();
					}
					return "0";
				}
				if (type == typeof(bool?))
				{
					bool? flag = (bool?)t;
					if (flag.HasValue)
					{
						return flag.Value ? "true" : "false";
					}
					return "false";
				}
				if (type == typeof(bool))
				{
					return ((bool)t) ? "true" : "false";
				}
				if (type == typeof(int) || type == typeof(long))
				{
					return t.ToString();
				}
				if (type == typeof(Dictionary<string, string>))
				{
					Dictionary<string, string> dictionary = (Dictionary<string, string>)t;
					if (dictionary != null && dictionary.Count > 0)
					{
						string text4 = "{";
						int num2 = 0;
						foreach (KeyValuePair<string, string> item in dictionary)
						{
							text4 = ((num2++ <= 0) ? (text4 + "\n\t" + prefix + "\"" + item.Key + "\": \"" + item.Value + "\"") : (text4 + ",\n\t" + prefix + "\"" + item.Key + "\": \"" + item.Value + "\""));
						}
						if (num2 > 0)
						{
							return text4 + "\n" + prefix + "}";
						}
						return text4 + "}";
					}
					return "{}";
				}
				if (type.IsGenericType && type.GetGenericTypeDefinition() == typeof(List<>))
				{
					IList list = (IList)t;
					if (list != null && list.Count > 0)
					{
						Type type2 = list.GetType().GetGenericArguments().Single();
						string text5 = "";
						string text6 = prefix + "\t";
						for (int j = 0; j < list.Count; j++)
						{
							object t2 = list[j];
							text5 = text5 + "\n" + text6 + ToJSONInternal(type2, t2, text6);
							if (j < list.Count - 1)
							{
								text5 += ",";
							}
						}
						return "[" + text5 + "\n" + prefix + "]";
					}
					return "[]";
				}
				if (type.IsAssignableFrom(typeof(IFlexibleField)))
				{
					if (t != null)
					{
						return ((IFlexibleField)t).ToJSON();
					}
					Dictionary<string, string> rows = ((LocalizableField)t).rows;
					return ToJSONInternal(rows.GetType(), rows, prefix);
				}
				if (!type.IsValueType)
				{
					if (!publicFieldInfoCache.TryGetValue(type, out var value))
					{
						value = type.GetFields(BindingFlags.Instance | BindingFlags.Public);
						publicFieldInfoCache[type] = value;
					}
					string text7 = "{";
					int num3 = 0;
					string text8 = prefix + "\t";
					FieldInfo[] array2 = value;
					foreach (FieldInfo fieldInfo in array2)
					{
						string text9 = ToJSONInternal(fieldInfo.FieldType, fieldInfo.GetValue(t), text8);
						if (num3++ > 0)
						{
							text7 += ",";
						}
						text7 = text7 + "\n" + text8 + "\"" + fieldInfo.Name + "\": " + text9;
					}
					if (num3 > 0)
					{
						return text7 + "\n" + prefix + "}";
					}
					return text7 + prefix + "}";
				}
			}
			catch (Exception ex)
			{
				Plugin.Log.LogError((object)$"Something went wrong while serializing JSON type: {type} value: {t}");
				Plugin.Log.LogError((object)ex);
				throw;
			}
			throw new NotImplementedException($"Type not supported for JSON serialization {type}");
		}
	}
}
namespace JLPlugin
{
	public static class Extensions
	{
		public static void Append<K, V>(this Dictionary<K, V> first, Dictionary<K, V> second)
		{
			second.ToList().ForEach(delegate(KeyValuePair<K, V> pair)
			{
				first[pair.Key] = pair.Value;
			});
		}
	}
	internal static class Interpreter
	{
		public static class RegexStrings
		{
			public static string Function = "([a-zA-Z]+)(?<!if|in)(\\(((?>\\((?<c>)|[^()]+|\\)(?<-c>))*(?(c)(?!)))\\))";

			public static string Variable = "\\[((?>\\[(?<c>)|[^\\[\\]]+|\\](?<-c>))*(?(c)(?!)))\\]";

			public static string GeneratedVariable = "\\[([^]]*?\\.[^[]*?)\\]";

			public static string Expression = "\\(((?>\\((?<c>)|[^()]+|\\)(?<-c>))*(?(c)(?!)))\\)";
		}

		public static Random random = new Random();

		public static object Process(in string input, AbilityBehaviourData abilityData, Type type = null, bool sendDebug = true, Dictionary<string, object?> additionalParameters = null)
		{
			//IL_0097: Unknown result type (might be due to invalid IL or missing references)
			//IL_009e: Expected O, but got Unknown
			//IL_00b2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ba: Expected O, but got Unknown
			//IL_00bf: Expected O, but got Unknown
			object obj = input;
			MatchCollection matchCollection = Regex.Matches(input, RegexStrings.Expression);
			if (matchCollection.Cast<Match>().Any((Match expressions) => expressions.Success))
			{
				EvaluateFunctionHandler val2 = default(EvaluateFunctionHandler);
				foreach (Match item in matchCollection)
				{
					string value = item.Groups[0].Value;
					string value2 = item.Groups[1].Value;
					ExtendedExpression val = new ExtendedExpression(value2);
					EvaluateFunctionHandler obj2 = val2;
					if (obj2 == null)
					{
						EvaluateFunctionHandler val3 = delegate(string functionName, FunctionArgs functionArgs)
						{
							ConfigilExtensions.Extend(functionName, functionArgs, abilityData);
						};
						EvaluateFunctionHandler val4 = val3;
						val2 = val3;
						obj2 = val4;
					}
					((Expression)val).EvaluateFunction += obj2;
					if (additionalParameters != null)
					{
						Extensions.AddRange<string, object>(((Expression)val).Parameters, additionalParameters);
					}
					foreach (KeyValuePair<string, string> variable in abilityData.variables)
					{
						((Expression)val).Parameters[variable.Key] = variable.Value;
					}
					foreach (KeyValuePair<string, object> generatedVariable in abilityData.generatedVariables)
					{
						((Expression)val).Parameters[generatedVariable.Key] = generatedVariable.Value;
					}
					MatchCollection matchCollection2 = Regex.Matches(value2, RegexStrings.GeneratedVariable);
					if (matchCollection2.Cast<Match>().Any((Match variables) => variables.Success))
					{
						foreach (Match item2 in matchCollection2)
						{
							string value3 = item2.Groups[1].Value;
							((Expression)val).Parameters[value3] = ProcessGeneratedVariable(value3, abilityData);
						}
					}
					if (sendDebug)
					{
						Plugin.Log.LogDebug((object)("input: " + value));
					}
					object obj3 = ((Expression)val).Evaluate();
					if (type == null || matchCollection.Count > 1)
					{
						if (obj3.GetType() == typeof(bool))
						{
							obj3 = obj3.ToString().ToLower();
						}
						obj = obj.ToString().Replace(value, obj3.ToString());
					}
					else
					{
						obj = obj3;
					}
					if (sendDebug)
					{
						Plugin.Log.LogDebug((object)$"output: {obj3}");
					}
				}
			}
			return obj;
		}

		public static object ProcessGeneratedVariable(string contents, AbilityBehaviourData abilityData = null, object variable = null)
		{
			//IL_00bd: Unknown result type (might be due to invalid IL or missing references)
			//IL_0155: Unknown result type (might be due to invalid IL or missing references)
			//IL_01c3: Unknown result type (might be due to invalid IL or missing references)
			List<string> list = contents.Split(new char[1] { '.' }).ToList();
			object value = variable;
			if (variable == null && abilityData != null && !abilityData.generatedVariables.TryGetValue(list[0], out value))
			{
				throw new Exception(list[0] + " is an invalid generated variable");
			}
			for (int i = 1; i < list.Count; i++)
			{
				if (value == null)
				{
					return null;
				}
				if (value.GetType() == typeof(PlayableCard))
				{
					if (list[i] == "TemporaryAbilities")
					{
						List<Ability> list2 = new List<Ability>();
						foreach (List<Ability> item in ((PlayableCard)value).TemporaryMods.Select((CardModificationInfo x) => x.abilities).ToList())
						{
							list2.AddRange(item);
						}
						value = list2;
						break;
					}
					if (list[i] == "AllAbilities")
					{
						List<Ability> list3 = new List<Ability>();
						foreach (List<Ability> item2 in ((PlayableCard)value).TemporaryMods.Select((CardModificationInfo x) => x.abilities).ToList())
						{
							list3.AddRange(item2);
						}
						list3.AddRange(((Card)(PlayableCard)value).Info.Abilities);
						value = list3;
						break;
					}
				}
				PropertyInfo property = value.GetType().GetProperty(list[i]);
				if ((object)property == null)
				{
					FieldInfo field = value.GetType().GetField(list[i]);
					if ((object)field == null)
					{
						return null;
					}
					value = field.GetValue(value);
				}
				else
				{
					if (property.GetIndexParameters().Length >= 1)
					{
						break;
					}
					value = property.GetValue(value);
				}
			}
			return value;
		}
	}
	internal static class Configs
	{
		private static ConfigEntry<bool> betaCompatibility;

		private static ConfigEntry<bool> verboseLogging;

		private static ConfigEntry<string> reloadHotkey;

		private static ConfigEntry<string> exportHotkey;

		private static ConfigFile configFile;

		private static Version oldConfigVersion;

		private static Version currentVersion;

		internal static bool BetaCompatibility => betaCompatibility.Value;

		internal static bool VerboseLogging => verboseLogging.Value;

		internal static string ReloadHotkey => reloadHotkey.Value;

		internal static string ExportHotkey => exportHotkey.Value;

		public static void InitializeConfigs(ConfigFile config)
		{
			configFile = config;
			currentVersion = new Version("2.5.3");
			oldConfigVersion = GetOldConfigVersion();
			betaCompatibility = config.Bind<bool>("JSONLoader", "JDLR Backwards Compatibility", true, "Set to true to enable old-style JSON files (JLDR) to be read and converted to new-style files (JLDR2)");
			verboseLogging = config.Bind<bool>("JSONLoader", "Verbose Logging", false, "Set to true to see more logs on what JSONLoader is doing and what isn't working.");
			reloadHotkey = config.Bind<string>("Hotkeys", "Reload JLDR2 and game", "LeftShift+R", "Restarts the game and reloads all JLDR2 files.");
			exportHotkey = config.Bind<string>("Hotkeys", "Export all to JLDR2", "LeftControl+RightControl+X", "Exports all data in the game back to .JLDR2 files.");
			MigrateConfigs();
			ModdedSaveManager.SaveData.SetValue("MADH.inscryption.JSONLoader", "LastLoadedVersion", (object)currentVersion.ToString());
		}

		private static Version GetOldConfigVersion()
		{
			string value = ModdedSaveManager.SaveData.GetValue("MADH.inscryption.JSONLoader", "LastLoadedVersion");
			if (string.IsNullOrEmpty(value))
			{
				return new Version("2.5.2");
			}
			return new Version(value);
		}

		private static void MigrateConfigs()
		{
			if (!(oldConfigVersion == currentVersion) && oldConfigVersion <= new Version("2.5.3"))
			{
				Plugin.Log.LogInfo((object)$"Migrating from {oldConfigVersion} to {currentVersion}!");
				if (ReloadHotkey == (string)((ConfigEntryBase)exportHotkey).DefaultValue && ExportHotkey == (string)((ConfigEntryBase)reloadHotkey).DefaultValue)
				{
					Plugin.Log.LogInfo((object)"\tMigrating hotkeys to new defaults!");
					exportHotkey.Value = (string)((ConfigEntryBase)exportHotkey).DefaultValue;
					reloadHotkey.Value = (string)((ConfigEntryBase)reloadHotkey).DefaultValue;
					configFile.Save();
				}
			}
		}
	}
	[BepInPlugin("MADH.inscryption.JSONLoader", "JSONLoader", "2.5.3")]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	public class Plugin : BaseUnityPlugin
	{
		public static Plugin Instance;

		public const string PluginGuid = "MADH.inscryption.JSONLoader";

		public const string PluginName = "JSONLoader";

		public const string PluginVersion = "2.5.3";

		public static string JSONLoaderDirectory = "";

		public static string BepInExDirectory = "";

		internal static ManualLogSource Log;

		private HotkeyController hotkeyController;

		public static string ExportDirectory => Path.Combine(JSONLoaderDirectory, "Exported");

		private static List<string> GetAllJLDRFiles()
		{
			return (from a in Directory.GetFiles(Paths.PluginPath, "*.jldr*", SearchOption.AllDirectories)
				where (a.EndsWith(".jldr") || a.EndsWith(".jldr2")) && !a.Contains(Path.Combine(JSONLoaderDirectory, "Examples"))
				select a).ToList();
		}

		private void Awake()
		{
			//IL_009c: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a2: Expected O, but got Unknown
			((BaseUnityPlugin)this).Logger.LogInfo((object)"Loading JSONLoader!");
			Instance = this;
			Log = ((BaseUnityPlugin)this).Logger;
			JSONLoaderDirectory = Path.GetDirectoryName(((BaseUnityPlugin)this).Info.Location);
			int num = ((BaseUnityPlugin)this).Info.Location.LastIndexOf("BepInEx");
			if (num > 0)
			{
				BepInExDirectory = ((BaseUnityPlugin)this).Info.Location.Substring(0, num);
			}
			else
			{
				BepInExDirectory = Directory.GetParent(JSONLoaderDirectory)?.FullName ?? "";
			}
			Harmony val = new Harmony("MADH.inscryption.JSONLoader");
			val.PatchAll();
			Configs.InitializeConfigs(((BaseUnityPlugin)this).Config);
			Log.LogWarning((object)"Note: JSONLoader now uses .jldr2 files, not .json files.");
			List<string> allJLDRFiles = GetAllJLDRFiles();
			if (Configs.BetaCompatibility)
			{
				Log.LogWarning((object)"Note: Backwards compatibility has been enabled. Old *.jldr files will be converted to *.jldr2 automatically. This will slow down your game loading!");
				JLUtils.LoadCardsFromFiles(allJLDRFiles);
			}
			LoadAll(allJLDRFiles);
			hotkeyController = new HotkeyController();
			hotkeyController.AddHotkey(Configs.ReloadHotkey, ReloadGame);
			hotkeyController.AddHotkey(Configs.ExportHotkey, ExportAllToJLDR2);
			((BaseUnityPlugin)this).Logger.LogInfo((object)"Loaded JSONLoader!");
		}

		public static void LogFields()
		{
			string text = "\n";
			List<Type> list = new List<Type>();
			list.Add(typeof(PlayableCard));
			list.Add(typeof(CardInfo));
			list.Add(typeof(CardSlot));
			List<Type> list2 = list;
			foreach (Type item in list2)
			{
				FieldInfo[] fields = item.GetFields();
				if (fields.Length != 0)
				{
					string text2 = item.Name + " fields:\n";
					text += text2;
					text = text + new string('-', text2.Length - 1) + "\n";
					FieldInfo[] array = fields;
					foreach (FieldInfo fieldInfo in array)
					{
						text = text + fieldInfo.Name + " (" + fieldInfo.FieldType.Name + ")\n";
					}
					text = text + new string('-', text2.Length - 1) + "\n\n";
				}
				PropertyInfo[] properties = item.GetProperties();
				if (properties.Length != 0)
				{
					string text3 = item.Name + " properties:\n";
					text += text3;
					text = text + new string('-', text3.Length - 1) + "\n";
					PropertyInfo[] array2 = properties;
					foreach (PropertyInfo propertyInfo in array2)
					{
						text = text + propertyInfo.Name + " (" + propertyInfo.PropertyType.Name + ")\n";
					}
					text = text + new string('-', text3.Length - 1) + "\n\n";
				}
			}
			Log.LogInfo((object)text);
		}

		public void LoadAll(List<string> files)
		{
			TribeList.LoadAllTribes(files);
			SigilData.LoadAllSigils(files);
			CardSerializeInfo.LoadAllJLDR2(files);
			EncounterData.LoadAllEncounters(files);
			StarterDeckList.LoadAllStarterDecks(files);
			GramophoneData.LoadAllGramophone(files);
			LanguageData.LoadAllLanguages(files);
			MaskData.LoadAllMasks(files);
			LoadTalkingCards.InitAndLoad(files);
		}

		public void Update()
		{
			hotkeyController.Update();
		}

		private void ReloadGame()
		{
			List<string> allJLDRFiles = GetAllJLDRFiles();
			LoadAll(allJLDRFiles);
			CachedCardData.Flush();
			if (SaveFile.IsAscension)
			{
				ReloadKaycees();
			}
			if (SaveManager.SaveFile.IsPart1)
			{
				ReloadVanilla();
			}
		}

		public void ExportAllToJLDR2()
		{
			TribeList.ExportAllTribes();
			EncounterData.ExportAllEncounters();
			StarterDeckList.ExportAllStarterDecks();
			LanguageData.ExportAllLanguages();
			CardSerializeInfo.ExportAllCards();
		}

		public static void ReloadVanilla()
		{
			FrameLoopManager.Instance.SetIterationDisabled(false);
			MenuController.ReturnToStartScreen();
			MenuController.LoadGameFromMenu(false);
		}

		public static void ReloadKaycees()
		{
			FrameLoopManager.Instance.SetIterationDisabled(false);
			SceneLoader.Load("Ascension_Configure");
			FrameLoopManager.Instance.SetIterationDisabled(false);
			SaveManager.savingDisabled = false;
			MenuController.LoadGameFromMenu(false);
		}

		internal static void VerboseLog(string s)
		{
			if (Configs.VerboseLogging)
			{
				Log.LogInfo((object)s);
			}
		}

		internal static void VerboseWarning(string s)
		{
			if (Configs.VerboseLogging)
			{
				Log.LogWarning((object)s);
			}
		}

		internal static void VerboseError(string s)
		{
			if (Configs.VerboseLogging)
			{
				Log.LogError((object)s);
			}
		}
	}
}
namespace JLPlugin.Hotkeys
{
	internal class HotkeyController
	{
		public class Hotkey
		{
			public KeyCode[] KeyCodes;

			public Action Function;
		}

		private static Action<List<KeyCode>, KeyCode> OnHotkeyPressed = delegate
		{
		};

		private static KeyCode[] AllCodes = Enum.GetValues(typeof(KeyCode)).Cast<KeyCode>().ToArray();

		private List<Hotkey> Hotkeys = new List<Hotkey>();

		private List<KeyCode> m_pressedKeys = new List<KeyCode>();

		private bool m_hotkeyActivated = false;

		private static KeyCode[] DeserializeKeyCodes(string hotkey)
		{
			return hotkey.Trim().Split(new char[1] { '+' }).Select(delegate(string a)
			{
				//IL_002d: Unknown result type (might be due to invalid IL or missing references)
				//IL_002e: Unknown result type (might be due to invalid IL or missing references)
				//IL_0031: Unknown result type (might be due to invalid IL or missing references)
				if (!Enum.TryParse<KeyCode>(a, out KeyCode result))
				{
					Plugin.Log.LogError((object)("Unknown hotkey: '" + a + "'. See possible hotkeys here separated by +. https://docs.unity3d.com/ScriptReference/KeyCode.html"));
				}
				return result;
			})
				.ToArray();
		}

		public void Update()
		{
			//IL_000f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0011: 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_0060: Unknown result type (might be due to invalid IL or missing references)
			//IL_0065: Unknown result type (might be due to invalid IL or missing references)
			//IL_0067: Unknown result type (might be due to invalid IL or missing references)
			//IL_0036: Unknown result type (might be due to invalid IL or missing references)
			//IL_003e: Unknown result type (might be due to invalid IL or missing references)
			//IL_007e: Unknown result type (might be due to invalid IL or missing references)
			KeyCode[] allCodes = AllCodes;
			foreach (KeyCode val in allCodes)
			{
				if (Input.GetKeyDown(val) && !m_pressedKeys.Contains(val))
				{
					m_pressedKeys.Add(val);
					HotkeysChanged(val, triggerHotkey: true);
				}
			}
			for (int j = 0; j < m_pressedKeys.Count; j++)
			{
				KeyCode val2 = m_pressedKeys[j];
				if (!Input.GetKey(val2))
				{
					m_pressedKeys.Remove(val2);
					HotkeysChanged((KeyCode)0, triggerHotkey: false);
					m_hotkeyActivated = false;
				}
			}
		}

		private void HotkeysChanged(KeyCode pressedButton, bool triggerHotkey)
		{
			//IL_00d1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d3: Invalid comparison between Unknown and I4
			//IL_00ed: Unknown result type (might be due to invalid IL or missing references)
			if (triggerHotkey)
			{
				Hotkey hotkey = null;
				foreach (Hotkey hotkey2 in Hotkeys)
				{
					if (!m_hotkeyActivated && hotkey2.KeyCodes.Length != 0 && m_pressedKeys.Intersect(hotkey2.KeyCodes).Count() == hotkey2.KeyCodes.Length && (hotkey == null || hotkey.KeyCodes.Length < hotkey2.KeyCodes.Length))
					{
						hotkey = hotkey2;
					}
				}
				hotkey?.Function?.Invoke();
			}
			if ((int)pressedButton > 0)
			{
				OnHotkeyPressed?.Invoke(m_pressedKeys, pressedButton);
			}
		}

		public void AddHotkey(string hotkeys, Action callback)
		{
			Hotkeys.Add(new Hotkey
			{
				KeyCodes = DeserializeKeyCodes(hotkeys),
				Function = callback
			});
		}
	}
}
namespace JLPlugin.V2.Data
{
	public class CardSerializeInfo : JSONParser.IInitializable
	{
		public const string DEFAULT_MOD_PREFIX = "JSON";

		private static FieldInfo[] PUBLIC_FIELD_INFOS = typeof(CardSerializeInfo).GetFields(BindingFlags.Instance | BindingFlags.Public);

		public string name;

		public string modPrefix;

		public string[] decals;

		public JSONParser.LocalizableField displayedName;

		public JSONParser.LocalizableField description;

		public int? baseAttack;

		public int? baseHealth;

		public int? bloodCost;

		public int? bonesCost;

		public int? energyCost;

		public string[] gemsCost;

		public string[] abilities;

		public string[] specialAbilities;

		public string specialStatIcon;

		public string[] metaCategories;

		public string cardComplexity;

		public bool? onePerDeck;

		public string temple;

		public string titleGraphic;

		public bool? hideAttackAndHealth;

		public string[] appearanceBehaviour;

		public string texture;

		public string emissionTexture;

		public string holoPortraitPrefab;

		public string animatedPortrait;

		public string altTexture;

		public string altEmissionTexture;

		public string pixelTexture;

		public string[] tribes;

		public string[] traits;

		public string evolveIntoName;

		public int? evolveTurns;

		public string defaultEvolutionName;

		public string tailName;

		public string tailLostPortrait;

		public string iceCubeName;

		public bool? flipPortraitForStrafe;

		public Dictionary<string, string> extensionProperties;

		public string filePath;

		public CardSerializeInfo()
		{
			Initialize();
		}

		public void Initialize()
		{
			displayedName = new JSONParser.LocalizableField("displayedName");
			description = new JSONParser.LocalizableField("description");
		}

		public static void Apply(CardInfo cardInfo, CardSerializeInfo serializeInfo, bool toCardInfo, string cardName)
		{
			ImportExportUtils.SetID(cardName);
			ImportExportUtils.ApplyLocaleField("displayedName", ref serializeInfo.displayedName, ref cardInfo.displayedName, toCardInfo);
			ImportExportUtils.ApplyLocaleField("description", ref serializeInfo.description, ref cardInfo.description, toCardInfo);
			ImportExportUtils.ApplyProperty(() => ((Object)cardInfo).name, delegate(string a)
			{
				((Object)cardInfo).name = a;
			}, ref serializeInfo.name, toCardInfo, "Cards", "name");
			ImportExportUtils.ApplyValue(ref cardInfo.baseAttack, ref serializeInfo.baseAttack, toCardInfo, "Cards", "baseAttack");
			ImportExportUtils.ApplyValue(ref cardInfo.baseHealth, ref serializeInfo.baseHealth, toCardInfo, "Cards", "baseHealth");
			ImportExportUtils.ApplyValue(ref cardInfo.cost, ref serializeInfo.bloodCost, toCardInfo, "Cards", "cost");
			ImportExportUtils.ApplyValue(ref cardInfo.bonesCost, ref serializeInfo.bonesCost, toCardInfo, "Cards", "bonesCost");
			ImportExportUtils.ApplyValue(ref cardInfo.energyCost, ref serializeInfo.energyCost, toCardInfo, "Cards", "energyCost");
			ImportExportUtils.ApplyValue(ref cardInfo.gemsCost, ref serializeInfo.gemsCost, toCardInfo, "Cards", "gemsCost");
			ImportExportUtils.ApplyValue(ref cardInfo.abilities, ref serializeInfo.abilities, toCardInfo, "Cards", "abilities");
			ImportExportUtils.ApplyValue(ref cardInfo.specialAbilities, ref serializeInfo.specialAbilities, toCardInfo, "Cards", "specialAbilities");
			ImportExportUtils.ApplyValue(ref cardInfo.specialStatIcon, ref serializeInfo.specialStatIcon, toCardInfo, "Cards", "specialStatIcon");
			ImportExportUtils.ApplyValue(ref cardInfo.metaCategories, ref serializeInfo.metaCategories, toCardInfo, "Cards", "metaCategories");
			ImportExportUtils.ApplyValue(ref cardInfo.cardComplexity, ref serializeInfo.cardComplexity, toCardInfo, "Cards", "cardComplexity");
			ImportExportUtils.ApplyValue(ref cardInfo.onePerDeck, ref serializeInfo.onePerDeck, toCardInfo, "Cards", "onePerDeck");
			ImportExportUtils.ApplyValue(ref cardInfo.temple, ref serializeInfo.temple, toCardInfo, "Cards", "temple");
			ImportExportUtils.ApplyValue(ref cardInfo.titleGraphic, ref serializeInfo.titleGraphic, toCardInfo, "Cards", "titleGraphic");
			ImportExportUtils.ApplyValue(ref cardInfo.hideAttackAndHealth, ref serializeInfo.hideAttackAndHealth, toCardInfo, "Cards", "hideAttackAndHealth");
			ImportExportUtils.ApplyValue(ref cardInfo.appearanceBehaviour, ref serializeInfo.appearanceBehaviour, toCardInfo, "Cards", "appearanceBehaviour");
			ImportExportUtils.ApplyValue(ref cardInfo.tribes, ref serializeInfo.tribes, toCardInfo, "Cards", "tribes");
			ImportExportUtils.ApplyValue(ref cardInfo.traits, ref serializeInfo.traits, toCardInfo, "Cards", "traits");
			ImportExportUtils.ApplyValue(ref cardInfo.defaultEvolutionName, ref serializeInfo.defaultEvolutionName, toCardInfo, "Cards", "defaultEvolutionName");
			ImportExportUtils.ApplyValue(ref cardInfo.flipPortraitForStrafe, ref serializeInfo.flipPortraitForStrafe, toCardInfo, "Cards", "flipPortraitForStrafe");
			ImportExportUtils.ApplyValue(ref cardInfo.decals, ref serializeInfo.decals, toCardInfo, "Cards", "decals");
			ImportExportUtils.ApplyValue(ref cardInfo.portraitTex, ref serializeInfo.texture, toCardInfo, "Cards", "texture");
			ImportExportUtils.ApplyValue(ref cardInfo.alternatePortrait, ref serializeInfo.altTexture, toCardInfo, "Cards", "altTexture");
			ImportExportUtils.ApplyValue(ref cardInfo.pixelPortrait, ref serializeInfo.pixelTexture, toCardInfo, "Cards", "pixelTexture");
			Sprite a2 = CardExtensions.GetEmissivePortrait(cardInfo);
			Sprite a3 = CardExtensions.GetEmissiveAltPortrait(cardInfo);
			ImportExportUtils.ApplyValue(ref a2, ref serializeInfo.emissionTexture, toCardInfo, "Cards", "emissionTexture");
			ImportExportUtils.ApplyValue(ref a3, ref serializeInfo.altEmissionTexture, toCardInfo, "Cards", "altEmissionTexture");
			if ((Object)(object)cardInfo.portraitTex != (Object)null && (Object)(object)a2 != (Object)null)
			{
				CardExtensions.SetEmissivePortrait(cardInfo, a2);
			}
			if ((Object)(object)cardInfo.alternatePortrait != (Object)null && (Object)(object)a3 != (Object)null)
			{
				CardExtensions.SetEmissiveAltPortrait(cardInfo, a3);
			}
			if (toCardInfo)
			{
				if (!string.IsNullOrEmpty(serializeInfo.evolveIntoName))
				{
					CardExtensions.SetEvolve(cardInfo, serializeInfo.evolveIntoName, (!serializeInfo.evolveTurns.HasValue) ? 1 : serializeInfo.evolveTurns.Value, (IEnumerable<CardModificationInfo>)null);
				}
			}
			else if (cardInfo.evolveParams != null)
			{
				CardInfo evolution = cardInfo.evolveParams.evolution;
				serializeInfo.evolveIntoName = ((evolution != null) ? ((Object)evolution).name : null);
				serializeInfo.evolveTurns = cardInfo.evolveParams.turnsToEvolve;
			}
			if (toCardInfo)
			{
				if (!string.IsNullOrEmpty(serializeInfo.tailName))
				{
					CardExtensions.SetTail(cardInfo, serializeInfo.tailName, serializeInfo.tailLostPortrait, (IEnumerable<CardModificationInfo>)null);
				}
			}
			else if (cardInfo.tailParams != null)
			{
				CardInfo tail = cardInfo.tailParams.tail;
				serializeInfo.tailName = ((tail != null) ? ((Object)tail).name : null);
				ImportExportUtils.ApplyValue(ref cardInfo.tailParams.tailLostPortrait, ref serializeInfo.tailLostPortrait, toCardInfo, "Cards", "tailLostPortrait");
			}
			if (toCardInfo)
			{
				if (!string.IsNullOrEmpty(serializeInfo.iceCubeName))
				{
					CardExtensions.SetIceCube(cardInfo, serializeInfo.iceCubeName, (IEnumerable<CardModificationInfo>)null);
				}
			}
			else if (cardInfo.iceCubeParams != null)
			{
				serializeInfo.iceCubeName = ((Object)cardInfo.iceCubeParams.creatureWithin).name;
			}
			if (toCardInfo)
			{
				if (serializeInfo.extensionProperties != null)
				{
					foreach (KeyValuePair<string, string> extensionProperty in serializeInfo.extensionProperties)
					{
						CardExtensions.SetExtendedProperty(cardInfo, extensionProperty.Key, (object)extensionProperty.Value);
					}
				}
				CardExtensions.SetExtendedProperty(cardInfo, "JSONFilePath", (object)serializeInfo.filePath);
			}
			else
			{
				Dictionary<string, string> cardExtensionTable = CardManager.GetCardExtensionTable(cardInfo);
				if (cardExtensionTable != null && cardExtensionTable.Count > 0)
				{
					foreach (KeyValuePair<string, string> item in cardExtensionTable)
					{
						if (item.Key == "ModPrefix")
						{
							serializeInfo.modPrefix = item.Value;
						}
					}
					serializeInfo.extensionProperties = cardExtensionTable;
				}
			}
			if (toCardInfo)
			{
				if (!string.IsNullOrEmpty(serializeInfo.holoPortraitPrefab))
				{
					cardInfo.holoPortraitPrefab = Resources.Load<GameObject>(serializeInfo.holoPortraitPrefab);
				}
			}
			else if ((Object)(object)cardInfo.holoPortraitPrefab != (Object)null)
			{
				serializeInfo.holoPortraitPrefab = ((object)cardInfo.holoPortraitPrefab).ToString();
			}
			if (toCardInfo)
			{
				if (!string.IsNullOrEmpty(serializeInfo.animatedPortrait))
				{
					cardInfo.animatedPortrait = Resources.Load<GameObject>(serializeInfo.animatedPortrait);
				}
			}
			else if ((Object)(object)cardInfo.animatedPortrait != (Object)null)
			{
				serializeInfo.holoPortraitPrefab = ((object)cardInfo.animatedPortrait).ToString();
			}
		}

		private void ApplyLocaleField(string field, JSONParser.LocalizableField rows, out string cardInfoEnglishField)
		{
			//IL_00d7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00dc: Unknown result type (might be due to invalid IL or missing references)
			//IL_00de: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e2: Invalid comparison between Unknown and I4
			//IL_00fd: Unknown result type (might be due to invalid IL or missing references)
			if (rows.rows.TryGetValue(rows.englishFieldName, out var value))
			{
				cardInfoEnglishField = value;
			}
			else
			{
				if (rows.rows.Count <= 0)
				{
					cardInfoEnglishField = null;
					return;
				}
				cardInfoEnglishField = rows.rows.First().Value;
			}
			foreach (KeyValuePair<string, string> row in rows.rows)
			{
				if (row.Key == rows.englishFieldName)
				{
					continue;
				}
				int num = row.Key.LastIndexOf("_", StringComparison.Ordinal);
				if (num >= 0)
				{
					int length = row.Key.Length - num - 1;
					string text = row.Key.Substring(num + 1, length);
					Language val = LocalizationManager.CodeToLanguage(text);
					if ((int)val != 12)
					{
						LocalizationManager.Translate("MADH.inscryption.JSONLoader", (string)null, cardInfoEnglishField, row.Value, val);
					}
					else
					{
						Plugin.Log.LogDebug((object)$"Unknown language code {text} for card {displayedName} in field {field}");
					}
				}
			}
		}

		internal void Apply(bool UpdateCard = false)
		{
			if (string.IsNullOrEmpty(name))
			{
				throw new InvalidOperationException("Card cannot have an empty name!");
			}
			CardInfo val = (CardInfo)(UpdateCard ? ((object)ScriptableObjectLoader<CardInfo>.AllData.Find((CardInfo x) => ((Object)x).name == name)) : ((object)CardExtensions.CardByName((IEnumerable<CardInfo>)CardManager.BaseGameCards, name)));
			if ((Object)(object)val != (Object)null)
			{
				Plugin.VerboseLog("Modifying " + name + " using " + ToJSON());
				Apply(val, this, toCardInfo: true, ((Object)val).name);
				return;
			}
			Plugin.VerboseLog("New Card " + name + " using " + ToJSON());
			string text = modPrefix ?? "JSON";
			CardInfo val2 = ScriptableObject.CreateInstance<CardInfo>();
			((Object)val2).name = (name.StartsWith(text + "_") ? name : (text + "_" + name));
			Apply(val2, this, toCardInfo: true, ((Object)val2).name);
			CardManager.Add(text, val2);
		}

		internal void Remove()
		{
			if (string.IsNullOrEmpty(name))
			{
				throw new InvalidOperationException("Card cannot have an empty name!");
			}
			CardInfo val = CardExtensions.CardByName((IEnumerable<CardInfo>)CardManager.BaseGameCards, name);
			if ((Object)(object)val != (Object)null)
			{
				throw new InvalidOperationException("Base game cards cannot be removed!");
			}
			ObservableCollection<CardInfo> source = (ObservableCollection<CardInfo>)typeof(CardManager).GetField("NewCards", BindingFlags.Static | BindingFlags.NonPublic).GetValue(null);
			CardInfo val2 = ((IEnumerable<CardInfo>)source).FirstOrDefault((Func<CardInfo, bool>)((CardInfo x) => ((Object)x).name == name));
			if ((Object)(object)val2 != (Object)null)
			{
				CardManager.Remove(val2);
			}
			else
			{
				Plugin.Log.LogWarning((object)("Cannot remove " + name));
			}
		}

		internal CardInfo ToCardInfo()
		{
			//IL_0030: Unknown result type (might be due to invalid IL or missing references)
			//IL_0036: Expected O, but got Unknown
			if (string.IsNullOrEmpty(name))
			{
				throw new InvalidOperationException("Card cannot have an empty name!");
			}
			CardInfo val = (CardInfo)CardExtensions.CardByName((IEnumerable<CardInfo>)CardManager.BaseGameCards, name).Clone();
			if ((Object)(object)val != (Object)null)
			{
				Plugin.Log.LogDebug((object)("Modifying " + name + " using " + ToJSON()));
				Apply(val, this, toCardInfo: true, name);
				return val;
			}
			string text = modPrefix ?? "JSON";
			CardInfo val2 = ScriptableObject.CreateInstance<CardInfo>();
			((Object)val2).name = (name.StartsWith(text + "_") ? name : (text + "_" + name));
			Apply(val2, this, toCardInfo: true, name);
			return val2;
		}

		public string WriteToFile(string filename, bool overwrite = true)
		{
			Plugin.Log.LogDebug((object)("Writing card " + (name ?? "Unnamed") + " to " + filename));
			if (!filename.EndsWith("2"))
			{
				filename += "2";
			}
			if (overwrite || !File.Exists(filename))
			{
				File.WriteAllText(filename, ToJSON());
			}
			return filename;
		}

		private string ToJSON()
		{
			string text = "{\n";
			FieldInfo[] pUBLIC_FIELD_INFOS = PUBLIC_FIELD_INFOS;
			foreach (FieldInfo fieldInfo in pUBLIC_FIELD_INFOS)
			{
				if (fieldInfo.FieldType == typeof(string))
				{
					string text2 = (string)fieldInfo.GetValue(this);
					if (!string.IsNullOrEmpty(text2))
					{
						text = text + "\t\"" + fieldInfo.Name + "\": \"" + text2 + "\",\n";
					}
				}
				else if (fieldInfo.FieldType == typeof(string[]))
				{
					string[] array = (string[])fieldInfo.GetValue(this);
					if (array != null && array.Length != 0)
					{
						text = text + "\t\"" + fieldInfo.Name + "\": [" + string.Join(",", array.Select((string v) => "\"" + v + "\"")) + "],\n";
					}
				}
				else if (fieldInfo.FieldType == typeof(int?))
				{
					int? num = (int?)fieldInfo.GetValue(this);
					if (num.HasValue)
					{
						text += $"\t\"{fieldInfo.Name}\": {num.Value},\n";
					}
				}
				else if (fieldInfo.FieldType == typeof(bool?))
				{
					bool? flag = (bool?)fieldInfo.GetValue(this);
					if (flag.HasValue)
					{
						text = text + "\t\"" + fieldInfo.Name + "\": " + (flag.Value ? "true" : "false") + ",\n";
					}
				}
				else if (fieldInfo.FieldType == typeof(Dictionary<string, string>))
				{
					Dictionary<string, string> dictionary = (Dictionary<string, string>)fieldInfo.GetValue(this);
					if (dictionary == null || dictionary.Count <= 0)
					{
						continue;
					}
					text = text + "\t\"" + fieldInfo.Name + "\": {\n";
					foreach (KeyValuePair<string, string> item in dictionary.Where((KeyValuePair<string, string> kvp) => !string.IsNullOrEmpty(kvp.Key) && !string.IsNullOrEmpty(kvp.Value)))
					{
						text = text + "\t\t\"" + item.Key + "\": \"" + item.Value + "\",\n";
					}
					text += "\t},\n";
				}
				else
				{
					if (!fieldInfo.FieldType.IsAssignableFrom(typeof(JSONParser.IFlexibleField)))
					{
						continue;
					}
					object value = fieldInfo.GetValue(this);
					if (value != null)
					{
						text += ((JSONParser.IFlexibleField)value).ToJSON();
					}
					Dictionary<string, string> rows = ((JSONParser.LocalizableField)fieldInfo.GetValue(this)).rows;
					foreach (KeyValuePair<string, string> item2 in rows)
					{
						text = text + "\t\"" + item2.Key + "\": " + item2.Value + ",\n";
					}
				}
			}
			return text.TrimEnd('\n', ',') + "\n}";
		}

		public static void LoadAllJLDR2(List<string> files)
		{
			for (int i = 0; i < files.Count; i++)
			{
				string text = files[i];
				string text2 = text.Substring(text.LastIndexOf(Path.DirectorySeparatorChar) + 1);
				if (!text2.EndsWith("_encounter.jldr2") && !text2.EndsWith("_tribe.jldr2") && !text2.EndsWith("_tribes.jldr2") && !text2.EndsWith("_sigil.jldr2") && !text2.EndsWith("_deck.jldr2") && !text2.EndsWith("_gram.jldr2") && !text2.EndsWith("_language.jldr2") && !text2.EndsWith("_mask.jldr2") && !text2.EndsWith("_talk.jldr2"))
				{
					files.RemoveAt(i--);
					Plugin.VerboseLog("Loading JLDR2 Card " + text2);
					ImportExportUtils.SetDebugPath(text);
					try
					{
						CardSerializeInfo cardSerializeInfo = File.ReadAllText(text).FromJson<CardSerializeInfo>();
						cardSerializeInfo.filePath = text;
						cardSerializeInfo.Apply();
						Plugin.VerboseLog("Loaded JSON card " + cardSerializeInfo.name);
					}
					catch (Exception ex)
					{
						Plugin.Log.LogError((object)("Failed to load " + text2 + ": " + ex.Message));
						Plugin.Log.LogError((object)ex);
					}
				}
			}
		}

		public static void ExportAllCards()
		{
			Plugin.Log.LogInfo((object)$"Exporting {CardManager.AllCardsCopy.Count} cards.");
			foreach (CardInfo item in CardManager.AllCardsCopy)
			{
				string text = Path.Combine(Plugin.ExportDirectory, "Cards", ((Object)item).name + ".jldr2");
				ImportExportUtils.SetDebugPath(text);
				CardSerializeInfo cardSerializeInfo = new CardSerializeInfo();
				Apply(item, cardSerializeInfo, toCardInfo: false, ((Object)item).name);
				string directoryName = Path.GetDirectoryName(text);
				if (!Directory.Exists(directoryName))
				{
					Directory.CreateDirectory(directoryName);
				}
				cardSerializeInfo.WriteToFile(text);
			}
		}
	}
}
namespace JLPlugin.Utils
{
	public static class CDUtils
	{
		public static void CheckValidFields(List<string> fields)
		{
			foreach (string field in fields)
			{
				if (string.IsNullOrEmpty(field))
				{
					Plugin.Log.LogError((object)(ErrorUtil.Card + " - fieldsToEdit cannot contain an empty string"));
				}
				else if (!Dicts.CardDataFields.Contains(field))
				{
					Plugin.Log.LogError((object)(ErrorUtil.Card + " - \"" + field + "\" is an invalid field name"));
				}
			}
		}

		public static T Assign<T>(string data, string field, Dictionary<string, T> dict)
		{
			ErrorUtil.Field = field;
			if (string.IsNullOrEmpty(data))
			{
				return default(T);
			}
			if (!dict.ContainsKey(data))
			{
				ErrorUtil.Log(data);
				return default(T);
			}
			return dict[data];
		}

		public static List<T> Assign<T>(List<string> list, string field, Dictionary<string, T> dict)
		{
			ErrorUtil.Field = field;
			if (list == null || list.Count == 0)
			{
				return null;
			}
			List<T> list2 = new List<T>();
			foreach (string item in list)
			{
				if (!dict.ContainsKey(item))
				{
					ErrorUtil.Log(item);
				}
				else
				{
					list2.Add(dict[item]);
				}
			}
			if (list2.Count == 0)
			{
				return null;
			}
			return list2;
		}

		public static Texture2D Assign(string image, string field)
		{
			ErrorUtil.Field = field;
			if (string.IsNullOrEmpty(image))
			{
				return null;
			}
			if (!image.EndsWith(".png"))
			{
				ErrorUtil.Log(image, ", it must be a .png");
				return null;
			}
			return JLUtils.LoadTexture2D(image);
		}

		public static List<Texture> Assign(List<string> list, string field)
		{
			ErrorUtil.Field = field;
			if (list == null || list.Count == 0)
			{
				return null;
			}
			List<Texture> list2 = new List<Texture>();
			foreach (string item in list)
			{
				if (!string.IsNullOrEmpty(item))
				{
					if (!item.EndsWith(".png"))
					{
						ErrorUtil.Log(item, ", it must be a .png");
					}
					else
					{
						list2.Add((Texture)(object)JLUtils.LoadTexture2D(item));
					}
				}
			}
			if (list2.Count == 0)
			{
				return null;
			}
			return list2;
		}
	}
	public static class Dicts
	{
		public static readonly Dictionary<string, CardMetaCategory> MetaCategory = Enum.GetValues(typeof(CardMetaCategory)).Cast<CardMetaCategory>().ToDictionary((CardMetaCategory t) => ((object)(CardMetaCategory)(ref t)).ToString(), (CardMetaCategory t) => t);

		public static readonly Dictionary<string, CardComplexity> Complexity = Enum.GetValues(typeof(CardComplexity)).Cast<CardComplexity>().ToDictionary((CardComplexity t) => ((object)(CardComplexity)(ref t)).ToString(), (CardComplexity t) => t);

		public static readonly Dictionary<string, CardTemple> Temple = Enum.GetValues(typeof(CardTemple)).Cast<CardTemple>().ToDictionary((CardTemple t) => ((object)(CardTemple)(ref t)).ToString(), (CardTemple t) => t);

		public static readonly Dictionary<string, GemType> GemColour = Enum.GetValues(typeof(GemType)).Cast<GemType>().ToDictionary((GemType t) => ((object)(GemType)(ref t)).ToString(), (GemType t) => t);

		public static readonly Dictionary<string, SpecialStatIcon> StatIcon = Enum.GetValues(typeof(SpecialStatIcon)).Cast<SpecialStatIcon>().ToDictionary((SpecialStatIcon t) => ((object)(SpecialStatIcon)(ref t)).ToString(), (SpecialStatIcon t) => t);

		public static readonly Dictionary<string, Tribe> Tribes = Enum.GetValues(typeof(Tribe)).Cast<Tribe>().ToDictionary((Tribe t) => ((object)(Tribe)(ref t)).ToString(), (Tribe t) => t);

		public static readonly Dictionary<string, Trait> Traits = Enum.GetValues(typeof(Trait)).Cast<Trait>().ToDictionary((Trait t) => ((object)(Trait)(ref t)).ToString(), (Trait t) => t);

		public static readonly Dictionary<string, SpecialTriggeredAbility> SpecialAbilities = Enum.GetValues(typeof(SpecialTriggeredAbility)).Cast<SpecialTriggeredAbility>().ToDictionary((SpecialTriggeredAbility t) => ((object)(SpecialTriggeredAbility)(ref t)).ToString(), (SpecialTriggeredAbility t) => t);

		public static readonly Dictionary<string, Ability> Abilities = Enum.GetValues(typeof(Ability)).Cast<Ability>().ToDictionary((Ability t) => ((object)(Ability)(ref t)).ToString(), (Ability t) => t);

		public static readonly Dictionary<string, Appearance> AppearanceBehaviour = Enum.GetValues(typeof(Appearance)).Cast<Appearance>().ToDictionary((Appearance t) => ((object)(Appearance)(ref t)).ToString(), (Appearance t) => t);

		public static readonly List<string> CardDataFields = (from elem in typeof(CardData).GetFields()
			select elem.Name).ToList();
	}
	[StructLayout(LayoutKind.Sequential, Size = 1)]
	public struct ErrorUtil
	{
		public static string Card { get; set; }

		public static string Field { get; set; }

		public static string Message { get; set; }

		public static void Log(string Data, string addition = "")
		{
			Plugin.Log.LogError((object)string.Format(Message + addition, Card, Field, Data));
		}

		public static void Clear()
		{
			Card = null;
			Field = null;
			Message = null;
		}
	}
	[Obsolete]
	public static class IDUtils
	{
		public static EvolveIdentifier GenerateEvolveIdentifier(CardData card)
		{
			//IL_006d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0073: Expected O, but got Unknown
			if (card.evolution == null)
			{
				return null;
			}
			if (string.IsNullOrEmpty(card.evolution.name))
			{
				Plugin.Log.LogError((object)(card.name + " - evolution must have a name"));
				return null;
			}
			return new EvolveIdentifier(card.evolution.name, (card.evolution.turnsToEvolve == 0) ? 1 : card.evolution.turnsToEvolve, (CardModificationInfo)null);
		}

		public static TailIdentifier GenerateTailIdentifier(CardData card)
		{
			//IL_0067: Unknown result type (might be due to invalid IL or missing references)
			//IL_006d: Expected O, but got Unknown
			if (card.tail == null)
			{
				return null;
			}
			if (string.IsNullOrEmpty(card.tail.name))
			{
				Plugin.Log.LogError((object)(card.name + " - tail must have a name"));
				return null;
			}
			return new TailIdentifier(card.tail.name, CDUtils.Assign(card.tail.tailLostPortrait, "tailLostPortrait"), (CardModificationInfo)null);
		}

		public static IceCubeIdentifier GenerateIceCubeIdentifier(CardData card)
		{
			//IL_0052: Unknown result type (might be due to invalid IL or missing references)
			//IL_0058: Expected O, but got Unknown
			if (card.iceCube == null)
			{
				return null;
			}
			if (string.IsNullOrEmpty(card.iceCube.creatureWithin))
			{
				Plugin.Log.LogError((object)(card.name + " - iceCube must have a creatureWithin"));
				return null;
			}
			return new IceCubeIdentifier(card.iceCube.creatureWithin, (CardModificationInfo)null);
		}

		public static List<AbilityIdentifier> GenerateAbilityIdentifiers(List<AbilityData> list)
		{
			return list?.Select((AbilityData elem) => AbilityIdentifier.GetAbilityIdentifier(elem.GUID, elem.name)).ToList();
		}

		public static List<SpecialAbilityIdentifier> GenerateSpecialAbilityIdentifiers(List<SpecialAbilityData> list)
		{
			return list?.Select((SpecialAbilityData elem) => SpecialAbilityIdentifier.GetID(elem.GUID, elem.name)).ToList();
		}
	}
	[Obsolete]
	public static class JLUtils
	{
		public static void LoadCardsFromFiles(List<string> files)
		{
			Dictionary<string, CardData> dictionary = new Dictionary<string, CardData>();
			for (int num = files.Count - 1; num >= 0; num--)
			{
				string text = files[num];
				string text2 = text.Substring(text.LastIndexOf(Path.DirectorySeparatorChar) + 1);
				if (text.EndsWith(".jldr"))
				{
					files.RemoveAt(num);
					CardData cardData = File.ReadAllText(text).FromJson<CardData>();
					if (cardData == null)
					{
						Plugin.Log.LogWarning((object)("Failed to load " + text2));
					}
					else
					{
						dictionary.Add(text, cardData);
					}
				}
			}
			List<CardData> allKnownCards = dictionary.Values.ToList();
			foreach (KeyValuePair<string, CardData> item2 in dictionary)
			{
				string key = item2.Key;
				CardData value = item2.Value;
				CardSerializeInfo cardSerializeInfo = value.ConvertToV2(allKnownCards);
				if (cardSerializeInfo != null)
				{
					string item = cardSerializeInfo.WriteToFile(key, overwrite: false);
					files.Add(item);
				}
				else
				{
					Plugin.Log.LogError((object)(key + " is a JLDR without a valid name"));
				}
			}
		}

		public static Texture2D LoadTexture2D(string image)
		{
			//IL_00b9: Unknown result type (might be due to invalid IL or missing references)
			//IL_00bf: Expected O, but got Unknown
			string[] files = Directory.GetFiles(Paths.PluginPath, image, SearchOption.AllDirectories);
			if (files.Length == 0)
			{
				Plugin.Log.LogError((object)(ErrorUtil.Card + " - Couldn't find texture \"" + image + "\" to load into " + ErrorUtil.Field));
				return null;
			}
			if (files.Length > 1)
			{
				Plugin.Log.LogError((object)(ErrorUtil.Card + " - Couldn't load \"" + image + "\" into " + ErrorUtil.Field + ", more than one file with that name found in the plugins folder"));
				return null;
			}
			byte[] array = File.ReadAllBytes(files[0]);
			Texture2D val = new Texture2D(2, 2);
			if (!ImageConversion.LoadImage(val, array))
			{
				Plugin.Log.LogError((object)(ErrorUtil.Card + " - Couldn't load \"" + image + "\" into " + ErrorUtil.Field));
				return null;
			}
			return val;
		}
	}
}
namespace JLPlugin.SigilCode
{
	public abstract class ConfigurableBase : ActivatedAbilityBehaviour
	{
		public SigilData abilityData = new SigilData();

		public Ability ability = (Ability)0;

		public override Ability Ability => ability;

		public PlayableCard PlayableCard => ((Component)this).GetComponent<PlayableCard>();
	}
	public abstract class ConfigurableSpecialBase : SpecialCardBehaviour
	{
		public SigilData abilityData = new SigilData();

		public SpecialTriggeredAbility specialAbility = (SpecialTriggeredAbility)0;
	}
	[HarmonyPatch(typeof(CardTriggerHandler), "AddAbility", new Type[] { typeof(Ability) })]
	public class Add_Ability_patch
	{
		[HarmonyPrefix]
		public static bool Prefix(Ability ability, CardTriggerHandler __instance)
		{
			//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_0014: Unknown result type (might be due to invalid IL or missing references)
			//IL_0033: Unknown result type (might be due to invalid IL or missing references)
			//IL_006f: 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_00a1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b3: 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_00c4: Unknown result type (might be due to invalid IL or missing references)
			if (!SigilDicts.ArgumentList.ContainsKey(ability))
			{
				return true;
			}
			Type item = SigilDicts.ArgumentList[ability].Item1;
			if ((!__instance.triggeredAbilities.Exists((Tuple<Ability, AbilityBehaviour> x) => x.Item1 == ability) || AbilitiesUtil.GetInfo(ability).canStack) && !AbilitiesUtil.GetInfo(ability).passive)
			{
				ConfigurableBase configurableBase = ((Component)__instance).gameObject.AddComponent(item) as ConfigurableBase;
				configurableBase.abilityData = SigilData.GetAbilityArguments(ability);
				configurableBase.ability = ability;
				__instance.triggeredAbilities.Add(new Tuple<Ability, AbilityBehaviour>(ability, (AbilityBehaviour)(object)configurableBase));
			}
			return false;
		}
	}
	[HarmonyPatch(typeof(CardTriggerHandler), "AddAbility", new Type[] { typeof(SpecialTriggeredAbility) })]
	public class Add__Special_Ability_patch
	{
		[HarmonyPrefix]
		public static bool Prefix(SpecialTriggeredAbility ability, CardTriggerHandler __instance)
		{
			//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_0014: Unknown result type (might be due to invalid IL or missing references)
			//IL_0030: 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_008d: Unknown result type (might be due to invalid IL or missing references)
			if (!SigilDicts.SpecialArgumentList.ContainsKey(ability))
			{
				return true;
			}
			Type item = SigilDicts.SpecialArgumentList[ability].Item1;
			if (!__instance.specialAbilities.Exists((Tuple<SpecialTriggeredAbility, SpecialCardBehaviour> x) => x.Item1 == ability))
			{
				ConfigurableSpecialBase configurableSpecialBase = ((Component)__instance).gameObject.AddComponent(item) as ConfigurableSpecialBase;
				configurableSpecialBase.abilityData = SigilData.GetAbilityArguments(ability);
				__instance.specialAbilities.Add(new Tuple<SpecialTriggeredAbility, SpecialCardBehaviour>(ability, (SpecialCardBehaviour)(object)configurableSpecialBase));
			}
			return false;
		}
	}
	[HarmonyPatch(/*Could not decode attribute arguments.*/)]
	public class GetOpposingSlots_patch
	{
		[HarmonyPostfix]
		public static void Postfix(PlayableCard __instance, ref List<CardSlot> __result)
		{
			//IL_0063: 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_0070: 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_0099: Unknown result type (might be due to invalid IL or missing references)
			if (!__instance.OnBoard)
			{
				return;
			}
			foreach (CardSlot item in Singleton<BoardManager>.Instance.AllSlotsCopy)
			{
				if ((Object)(object)item.Card == (Object)null)
				{
					continue;
				}
				foreach (Ability triggeredAbility in item.Card.GetTriggeredAbilities())
				{
					if (!SigilDicts.ArgumentList.ContainsKey(triggeredAbility) || !item.Card.HasAbility(triggeredAbility))
					{
						continue;
					}
					foreach (AbilityBehaviourData item2 in SigilData.GetAbilityArguments(triggeredAbility).abilityBehaviour.Where((AbilityBehaviourData x) => x?.extraAttacks != null))
					{
						foreach (extraAttacks extraAttack in item2.extraAttacks)
						{
							SigilData.UpdateVariables(item2, item.Card);
							item2.generatedVariables["TriggerCard"] = __instance;
							if (SigilData.ConvertArgument(extraAttack.runOnCondition, item2) == "false")
							{
								continue;
							}
							CardSlot val = slotData.GetSlot(extraAttack.attackingSlot, item2);
							if (extraAttack.attackingSlot == null)
							{
								val = item;
							}
							if (!((Object)(object)val == (Object)(object)__instance.slot))
							{
								continue;
							}
							__result.Remove(__instance.Slot.opposingSlot);
							foreach (slotData item3 in extraAttack.slotsToAttack)
							{
								CardSlot slot = slotData.GetSlot(item3, item2);
								if ((Object)(object)slot != (Object)null)
								{
									__result.Add(slot);
								}
							}
						}
					}
				}
			}
		}
	}
	[HarmonyPatch]
	public class OnBoardCleanup_patch
	{
		[HarmonyPrefix]
		[HarmonyPatch(typeof(TurnManager), "CleanupPhase")]
		public static void CleanupPhase()
		{
			//IL_004c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0051: Unknown result type (might be due to invalid IL or missing references)
			//IL_0059: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ca: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d2: Unknown result type (might be due to invalid IL or missing references)
			foreach (CardSlot item in Singleton<BoardManager>.Instance.AllSlotsCopy)
			{
				if ((Object)(object)item.Card == (Object)null)
				{
					continue;
				}
				foreach (Ability triggeredAbility in item.Card.GetTriggeredAbilities())
				{
					if (SigilDicts.ArgumentList.ContainsKey(triggeredAbility))
					{
						((Card)item.Card).Info.temporaryDecals.Clear();
						((Card)item.Card).RenderCard();
					}
				}
				foreach (SpecialTriggeredAbility specialAbility in ((Card)item.Card).Info.SpecialAbilities)
				{
					if (SigilDicts.SpecialArgumentList.ContainsKey(specialAbility))
					{
						((Card)item.Card).Info.temporaryDecals.Clear();
						((Card)item.Card).RenderCard();
					}
				}
			}
		}
	}
	[HarmonyPatch(typeof(PlayableCard), "GetPassiveAttackBuffs")]
	public class PassiveAttackBuffs_patch
	{
		[HarmonyPostfix]
		public static void Postfix(ref int __result, ref PlayableCard __instance)
		{
			//IL_0061: Unknown result type (might be due to invalid IL or missing references)
			//IL_0066: Unknown result type (might be due to invalid IL or missing references)
			//IL_006e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0081: Unknown result type (might be due to invalid IL or missing references)
			//IL_00cd: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00da: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ed: Unknown result type (might be due to invalid IL or missing references)
			if (!__instance.OnBoard)
			{
				return;
			}
			foreach (CardSlot item in Singleton<BoardManager>.Instance.AllSlotsCopy)
			{
				if ((Object)(object)item.Card == (Object)null)
				{
					continue;
				}
				foreach (Ability triggeredAbility in item.Card.GetTriggeredAbilities())
				{
					if (SigilDicts.ArgumentList.ContainsKey(triggeredAbility))
					{
						ApplyBuffs(SigilData.GetAbilityArguments(triggeredAbility).abilityBehaviour, item, ref __result, ref __instance);
					}
				}
				foreach (SpecialTriggeredAbility specialAbility in ((Card)item.Card).Info.SpecialAbilities)
				{
					if (SigilDicts.SpecialArgumentList.ContainsKey(specialAbility))
					{
						ApplyBuffs(SigilData.GetAbilityArguments(specialAbility).abilityBehaviour, item, ref __result, ref __instance);
					}
				}
			}
		}

		public static void ApplyBuffs(List<AbilityBehaviourData> AbilityBehaviourList, CardSlot slot, ref int __result, ref PlayableCard __instance)
		{
			foreach (AbilityBehaviourData item in AbilityBehaviourList.Where((AbilityBehaviourData x) => x.trigger?.triggerType == "Passive"))
			{
				if (item.buffCards == null)
				{
					continue;
				}
				foreach (buffCards buffCard in item.buffCards)
				{
					SigilData.UpdateVariables(item, slot.Card);
					if (SigilData.ConvertArgument(buffCard.runOnCondition, item, sendDebug: false) == "false")
					{
						continue;
					}
					CardSlot val = slotData.GetSlot(buffCard.slot, item, sendDebug: false);
					if (buffCard.slot == null)
					{
						val = slot;
					}
					if (!((Object)(object)val == (Object)(object)__instance.slot))
					{
						continue;
					}
					if (!string.IsNullOrEmpty(buffCard.addStats))
					{
						string text = SigilData.ConvertArgument(buffCard.addStats.Split(new char[1] { '/' })[0], item, sendDebug: false);
						if (text != "?")
						{
							__result += int.Parse(text);
						}
					}
					if (!string.IsNullOrEmpty(buffCard.setStats))
					{
						string text2 = SigilData.ConvertArgument(buffCard.setStats.Split(new char[1] { '/' })[0], item, sendDebug: false);
						if (text2 != "?")
						{
							__result = int.Parse(text2) - ((Card)slot.Card).Info.Attack;
						}
					}
				}
			}
		}
	}
	[HarmonyPatch(typeof(PlayableCard), "GetPassiveHealthBuffs")]
	public class PassiveHealthBuffs_patch
	{
		[HarmonyPostfix]
		public static void Postfix(ref int __result, ref PlayableCard __instance)
		{
			//IL_0061: Unknown result type (might be due to invalid IL or missing references)
			//IL_0066: Unknown result type (might be due to invalid IL or missing references)
			//IL_006e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0081: Unknown result type (might be due to invalid IL or missing references)
			//IL_00cd: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00da: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ed: Unknown result type (might be due to invalid IL or missing references)
			if (!__instance.OnBoard)
			{
				return;
			}
			foreach (CardSlot item in Singleton<BoardManager>.Instance.AllSlotsCopy)
			{
				if ((Object)(object)item.Card == (Object)null)
				{
					continue;
				}
				foreach (Ability triggeredAbility in item.Card.GetTriggeredAbilities())
				{
					if (SigilDicts.ArgumentList.ContainsKey(triggeredAbility))
					{
						ApplyBuffs(SigilData.GetAbilityArguments(triggeredAbility).abilityBehaviour, item, ref __result, ref __instance);
					}
				}
				foreach (SpecialTriggeredAbility specialAbility in ((Card)item.Card).Info.SpecialAbilities)
				{
					if (SigilDicts.SpecialArgumentList.ContainsKey(specialAbility))
					{
						ApplyBuffs(SigilData.GetAbilityArguments(specialAbility).abilityBehaviour, item, ref __result, ref __instance);
					}
				}
			}
		}

		public static void ApplyBuffs(List<AbilityBehaviourData> AbilityBehaviourList, CardSlot slot, ref int __result, ref PlayableCard __instance)
		{
			foreach (AbilityBehaviourData item in AbilityBehaviourList.Where((AbilityBehaviourData x) => x.trigger?.triggerType == "Passive"))
			{
				if (item.buffCards == null)
				{
					continue;
				}
				foreach (buffCards buffCard in item.buffCards)
				{
					SigilData.UpdateVariables(item, slot.Card);
					if (SigilData.ConvertArgument(buffCard.runOnCondition, item, sendDebug: false) == "false")
					{
						continue;
					}
					CardSlot val = slotData.GetSlot(buffCard.slot, item, sendDebug: false);
					if (buffCard.slot == null)
					{
						val = slot;
					}
					if (!((Object)(object)val == (Object)(object)__instance.slot))
					{
						continue;
					}
					if (!string.IsNullOrEmpty(buffCard.addStats))
					{
						string text = SigilData.ConvertArgument(buffCard.addStats.Split(new char[1] { '/' })[1], item, sendDebug: false);
						if (text != "?")
						{
							__result += int.Parse(text);
						}
					}
					if (!string.IsNullOrEmpty(buffCard.setStats))
					{
						string text2 = SigilData.ConvertArgument(buffCard.setStats.Split(new char[1] { '/' })[1], item, sendDebug: false);
						if (text2 != "?")
						{
							__result = int.Parse(text2) - ((Card)slot.Card).Info.Health;
						}
					}
					if (((Card)__instance).Info.Health + __result <= 0)
					{
						((MonoBehaviour)Singleton<BoardManager>.Instance).StartCoroutine(__instance.Die(false, (PlayableCard)null, true));
					}
				}
			}
		}
	}
	public static class CachedCardData
	{
		private static Dictionary<string, CardSerializeInfo> CardDataCache = new Dictionary<string, CardSerializeInfo>();

		public static CardSerializeInfo? Get(string filePath)
		{
			if (filePath == null)
			{
				return null;
			}
			if (!CardDataCache.ContainsKey(filePath))
			{
				return null;
			}
			return CardDataCache[filePath];
		}

		public static void Add(string filePath, CardSerializeInfo data)
		{
			CardDataCache[filePath] = data;
		}

		public static bool Contains(string? filePath)
		{
			return filePath != null && CardDataCache.ContainsKey(filePath);
		}

		public static void Flush()
		{
			CardDataCache.Clear();
		}
	}
	public class ConfigurableMain : ConfigurableBase, IOnBellRung, IOnOtherCardAddedToHand, IOnCardAssignedToSlotContext, IOnCardDealtDamageDirectly
	{
		public override int BonesCost => (abilityData.activationCost?.bonesCost).GetValueOrDefault();

		public override int EnergyCost => (abilityData.activationCost?.energyCost).GetValueOrDefault();

		public override int Priority => abilityData.priority.GetValueOrDefault();

		public override bool CanActivate()
		{
			AbilityBehaviourData abilityBehaviourData = abilityData.abilityBehaviour.Where((AbilityBehaviourData x) => x.trigger?.triggerType == "OnActivate").ToList()[0];
			if (abilityBehaviourData == null)
			{
				return false;
			}
			SigilData.UpdateVariables(abilityBehaviourData, base.PlayableCard);
			return (SigilData.ConvertArgument(abilityBehaviourData.trigger?.activatesForCardsWithCondition, abilityBehaviourData) ?? "true") == "true";
		}

		public override IEnumerator Activate()
		{
			int BloodCost = (abilityData.activationCost?.bloodCost).GetValueOrDefault();
			if (BloodCost > 0)
			{
				List<CardSlot> occupiedSlots = Singleton<BoardManager>.Instance.PlayerSlotsCopy.FindAll((CardSlot x) => (Object)(object)x.Card != (Object)null && (Object)(object)x.Card != (Object)(object)((AbilityBehaviour)this).Card);
				if (!((Object)(object)Singleton<BoardManager>.Instance != (Object)null) || Singleton<BoardManager>.Instance.AvailableSacrificeValueInSlots(occupiedSlots) < BloodCost)
				{
					((Card)base.PlayableCard).Anim.LightNegationEffect();
					AudioController.Instance.PlaySound2D("toneless_negate", (MixerGroup)10, 0.2f, 0f, (Pitch)null, (Repetition)null, (Randomization)null, (Distortion)null, false);
					yield return (object)new WaitForSeconds(0.25f);
					yield break;
				}
				Singleton<BoardManager>.Instance.CancelledSacrifice = false;
				yield return Singleton<BoardManager>.Instance.ChooseSacrificesForCard(occupiedSlots, ((AbilityBehaviour)this).Card, BloodCost);
				if (Singleton<BoardManager>.Instance.CancelledSacrifice)
				{
					yield break;
				}
			}
			List<GemType> GemCost = abilityData.activationCost?.gemsCost?.Select((string s) => ImportExportUtils.ParseEnum<GemType>(s)).ToList() ?? new List<GemType>();
			foreach (GemType Gem in GemCost)
			{
				if (!Singleton<ResourcesManager>.Instance.HasGem(Gem))
				{
					((Card)base.PlayableCard).Anim.LightNegationEffect();
					AudioController.Instance.PlaySound2D("toneless_negate", (MixerGroup)10, 0.2f, 0f, (Pitch)null, (Repetition)null, (Randomization)null, (Distortion)null, false);
					yield return (object)new WaitForSeconds(0.25f);
					yield break;
				}
			}
			yield return TriggerSigil("OnActivate");
		}

		public void Start()
		{
			if (abilityData?.abilityBehaviour == null)
			{
				return;
			}
			foreach (AbilityBehaviourData item in abilityData.abilityBehaviour)
			{
				item.TurnsInPlay = 0;
				string extendedProperty = CardExtensions.GetExtendedProperty(((Card)base.PlayableCard).Info, "JSONFilePath");
				if (extendedProperty != null)
				{
					if (!CachedCardData.Contains(extendedProperty))
					{
						CachedCardData.Add(extendedProperty, File.ReadAllText(extendedProperty).FromJson<CardSerializeInfo>());
					}
					CardSerializeInfo cardSerializeInfo = CachedCardData.Get(extendedProperty);
					if (cardSerializeInfo.extensionProperties != null)
					{
						foreach (KeyValuePair<string, string> extensionProperty in cardSerializeI

plugins/MADH95Mods-JSONCardLoader/plugins/Libs/Antlr3.Runtime.dll

Decompiled 5 months ago
using System;
using System.Collections;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Diagnostics;
using System.IO;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Serialization;
using System.Security;
using System.Security.Permissions;
using System.Text;
using System.Text.RegularExpressions;
using Antlr.Runtime.Debug;
using Antlr.Runtime.Misc;
using Antlr.Runtime.Tree;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: AssemblyTitle("Antlr3.Runtime")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("Tunnel Vision Laboratories, LLC")]
[assembly: AssemblyProduct("Antlr3.Runtime")]
[assembly: AssemblyCopyright("Copyright © Sam Harwell 2013")]
[assembly: AssemblyTrademark("")]
[assembly: CLSCompliant(true)]
[assembly: AllowPartiallyTrustedCallers]
[assembly: ComVisible(false)]
[assembly: Guid("7a0b4db7-f127-4cf5-ac2c-e294957efcd6")]
[assembly: AssemblyFileVersion("3.5.1.0")]
[assembly: AssemblyInformationalVersion("3.5.1")]
[assembly: AssemblyVersion("3.5.0.2")]
namespace Antlr.Runtime
{
	[Serializable]
	[FileIOPermission(SecurityAction.Demand, Unrestricted = true)]
	public class ANTLRFileStream : ANTLRStringStream
	{
		protected string fileName;

		public override string SourceName => fileName;

		public ANTLRFileStream(string fileName)
			: this(fileName, null)
		{
		}

		public ANTLRFileStream(string fileName, Encoding encoding)
		{
			this.fileName = fileName;
			Load(fileName, encoding);
		}

		public virtual void Load(string fileName, Encoding encoding)
		{
			if (fileName != null)
			{
				string text = ((encoding != null) ? File.ReadAllText(fileName, encoding) : File.ReadAllText(fileName));
				data = text.ToCharArray();
				n = data.Length;
			}
		}
	}
	[Serializable]
	public class ANTLRInputStream : ANTLRReaderStream
	{
		public ANTLRInputStream(Stream input)
			: this(input, null)
		{
		}

		public ANTLRInputStream(Stream input, int size)
			: this(input, size, null)
		{
		}

		public ANTLRInputStream(Stream input, Encoding encoding)
			: this(input, 1024, encoding)
		{
		}

		public ANTLRInputStream(Stream input, int size, Encoding encoding)
			: this(input, size, 1024, encoding)
		{
		}

		public ANTLRInputStream(Stream input, int size, int readBufferSize, Encoding encoding)
			: base(GetStreamReader(input, encoding), size, readBufferSize)
		{
		}

		private static StreamReader GetStreamReader(Stream input, Encoding encoding)
		{
			if (encoding != null)
			{
				return new StreamReader(input, encoding);
			}
			return new StreamReader(input);
		}
	}
	[Serializable]
	public class ANTLRReaderStream : ANTLRStringStream
	{
		public const int ReadBufferSize = 1024;

		public const int InitialBufferSize = 1024;

		public ANTLRReaderStream(TextReader r)
			: this(r, 1024, 1024)
		{
		}

		public ANTLRReaderStream(TextReader r, int size)
			: this(r, size, 1024)
		{
		}

		public ANTLRReaderStream(TextReader r, int size, int readChunkSize)
		{
			Load(r, size, readChunkSize);
		}

		public virtual void Load(TextReader r, int size, int readChunkSize)
		{
			if (r == null)
			{
				return;
			}
			if (size <= 0)
			{
				size = 1024;
			}
			if (readChunkSize <= 0)
			{
				readChunkSize = 1024;
			}
			try
			{
				data = r.ReadToEnd().ToCharArray();
				n = data.Length;
			}
			finally
			{
				r.Dispose();
			}
		}
	}
	[Serializable]
	public class ANTLRStringStream : ICharStream, IIntStream
	{
		protected char[] data;

		protected int n;

		protected int p;

		private int line = 1;

		private int charPositionInLine;

		protected int markDepth;

		protected IList<CharStreamState> markers;

		protected int lastMarker;

		public string name;

		public virtual int Index => p;

		public virtual int Line
		{
			get
			{
				return line;
			}
			set
			{
				line = value;
			}
		}

		public virtual int CharPositionInLine
		{
			get
			{
				return charPositionInLine;
			}
			set
			{
				charPositionInLine = value;
			}
		}

		public virtual int Count => n;

		public virtual string SourceName => name;

		public ANTLRStringStream(string input)
			: this(input, null)
		{
		}

		public ANTLRStringStream(string input, string sourceName)
			: this(input.ToCharArray(), input.Length, sourceName)
		{
		}

		public ANTLRStringStream(char[] data, int numberOfActualCharsInArray)
			: this(data, numberOfActualCharsInArray, null)
		{
		}

		public ANTLRStringStream(char[] data, int numberOfActualCharsInArray, string sourceName)
		{
			if (data == null)
			{
				throw new ArgumentNullException("data");
			}
			if (numberOfActualCharsInArray < 0)
			{
				throw new ArgumentOutOfRangeException();
			}
			if (numberOfActualCharsInArray > data.Length)
			{
				throw new ArgumentException();
			}
			this.data = data;
			n = numberOfActualCharsInArray;
			name = sourceName;
		}

		protected ANTLRStringStream()
		{
			data = new char[0];
		}

		public virtual void Reset()
		{
			p = 0;
			line = 1;
			charPositionInLine = 0;
			markDepth = 0;
		}

		public virtual void Consume()
		{
			if (p < n)
			{
				charPositionInLine++;
				if (data[p] == '\n')
				{
					line++;
					charPositionInLine = 0;
				}
				p++;
			}
		}

		public virtual int LA(int i)
		{
			if (i == 0)
			{
				return 0;
			}
			if (i < 0)
			{
				i++;
				if (p + i - 1 < 0)
				{
					return -1;
				}
			}
			if (p + i - 1 >= n)
			{
				return -1;
			}
			return data[p + i - 1];
		}

		public virtual int LT(int i)
		{
			return LA(i);
		}

		public virtual int Mark()
		{
			if (markers == null)
			{
				markers = new List<CharStreamState>();
				markers.Add(null);
			}
			markDepth++;
			CharStreamState charStreamState = null;
			if (markDepth >= markers.Count)
			{
				charStreamState = new CharStreamState();
				markers.Add(charStreamState);
			}
			else
			{
				charStreamState = markers[markDepth];
			}
			charStreamState.p = Index;
			charStreamState.line = Line;
			charStreamState.charPositionInLine = CharPositionInLine;
			lastMarker = markDepth;
			return markDepth;
		}

		public virtual void Rewind(int m)
		{
			if (m < 0)
			{
				throw new ArgumentOutOfRangeException();
			}
			CharStreamState charStreamState = markers[m];
			Seek(charStreamState.p);
			line = charStreamState.line;
			charPositionInLine = charStreamState.charPositionInLine;
			Release(m);
		}

		public virtual void Rewind()
		{
			Rewind(lastMarker);
		}

		public virtual void Release(int marker)
		{
			markDepth = marker;
			markDepth--;
		}

		public virtual void Seek(int index)
		{
			if (index <= p)
			{
				p = index;
				return;
			}
			while (p < index)
			{
				Consume();
			}
		}

		public virtual string Substring(int start, int length)
		{
			if (start < 0)
			{
				throw new ArgumentOutOfRangeException();
			}
			if (length < 0)
			{
				throw new ArgumentOutOfRangeException();
			}
			if (start + length > data.Length)
			{
				throw new ArgumentException();
			}
			if (length == 0)
			{
				return string.Empty;
			}
			return new string(data, start, length);
		}

		public override string ToString()
		{
			return new string(data);
		}
	}
	public class AstParserRuleReturnScope<TTree, TToken> : ParserRuleReturnScope<TToken>, IAstRuleReturnScope<TTree>, IAstRuleReturnScope, IRuleReturnScope
	{
		private TTree _tree;

		public TTree Tree
		{
			get
			{
				return _tree;
			}
			set
			{
				_tree = value;
			}
		}

		object IAstRuleReturnScope.Tree => Tree;
	}
	public abstract class BaseRecognizer
	{
		public const int MemoRuleFailed = -2;

		public const int MemoRuleUnknown = -1;

		public const int InitialFollowStackSize = 100;

		public const int DefaultTokenChannel = 0;

		public const int Hidden = 99;

		public const string NextTokenRuleName = "nextToken";

		protected internal RecognizerSharedState state;

		public TextWriter TraceDestination { get; set; }

		public virtual int NumberOfSyntaxErrors => state.syntaxErrors;

		public virtual int BacktrackingLevel
		{
			get
			{
				return state.backtracking;
			}
			set
			{
				state.backtracking = value;
			}
		}

		public virtual bool Failed => state.failed;

		public virtual string[] TokenNames => null;

		public virtual string GrammarFileName => null;

		public abstract string SourceName { get; }

		public virtual IDebugEventListener DebugListener => null;

		public BaseRecognizer()
			: this(new RecognizerSharedState())
		{
		}

		public BaseRecognizer(RecognizerSharedState state)
		{
			if (state == null)
			{
				state = new RecognizerSharedState();
			}
			this.state = state;
			InitDFAs();
		}

		public virtual void SetState(RecognizerSharedState value)
		{
			state = value;
		}

		protected virtual void InitDFAs()
		{
		}

		public virtual void Reset()
		{
			if (state != null)
			{
				state._fsp = -1;
				state.errorRecovery = false;
				state.lastErrorIndex = -1;
				state.failed = false;
				state.syntaxErrors = 0;
				state.backtracking = 0;
				int num = 0;
				while (state.ruleMemo != null && num < state.ruleMemo.Length)
				{
					state.ruleMemo[num] = null;
					num++;
				}
			}
		}

		public virtual object Match(IIntStream input, int ttype, BitSet follow)
		{
			object currentInputSymbol = GetCurrentInputSymbol(input);
			if (input.LA(1) == ttype)
			{
				input.Consume();
				state.errorRecovery = false;
				state.failed = false;
				return currentInputSymbol;
			}
			if (state.backtracking > 0)
			{
				state.failed = true;
				return currentInputSymbol;
			}
			return RecoverFromMismatchedToken(input, ttype, follow);
		}

		public virtual void MatchAny(IIntStream input)
		{
			state.errorRecovery = false;
			state.failed = false;
			input.Consume();
		}

		public virtual bool MismatchIsUnwantedToken(IIntStream input, int ttype)
		{
			return input.LA(2) == ttype;
		}

		public virtual bool MismatchIsMissingToken(IIntStream input, BitSet follow)
		{
			if (follow == null)
			{
				return false;
			}
			if (follow.Member(1))
			{
				BitSet a = ComputeContextSensitiveRuleFOLLOW();
				follow = follow.Or(a);
				if (state._fsp >= 0)
				{
					follow.Remove(1);
				}
			}
			if (follow.Member(input.LA(1)) || follow.Member(1))
			{
				return true;
			}
			return false;
		}

		public virtual void ReportError(RecognitionException e)
		{
			if (!state.errorRecovery)
			{
				state.syntaxErrors++;
				state.errorRecovery = true;
				DisplayRecognitionError(TokenNames, e);
			}
		}

		public virtual void DisplayRecognitionError(string[] tokenNames, RecognitionException e)
		{
			string errorHeader = GetErrorHeader(e);
			string errorMessage = GetErrorMessage(e, tokenNames);
			EmitErrorMessage(errorHeader + " " + errorMessage);
		}

		public virtual string GetErrorMessage(RecognitionException e, string[] tokenNames)
		{
			string result = e.Message;
			if (e is UnwantedTokenException)
			{
				UnwantedTokenException ex = (UnwantedTokenException)e;
				string text = "<unknown>";
				result = string.Concat(str3: (ex.Expecting != -1) ? tokenNames[ex.Expecting] : "EndOfFile", str0: "extraneous input ", str1: GetTokenErrorDisplay(ex.UnexpectedToken), str2: " expecting ");
			}
			else if (e is MissingTokenException)
			{
				MissingTokenException ex2 = (MissingTokenException)e;
				string text2 = "<unknown>";
				text2 = ((ex2.Expecting != -1) ? tokenNames[ex2.Expecting] : "EndOfFile");
				result = "missing " + text2 + " at " + GetTokenErrorDisplay(e.Token);
			}
			else if (e is MismatchedTokenException)
			{
				MismatchedTokenException ex3 = (MismatchedTokenException)e;
				string text3 = "<unknown>";
				result = string.Concat(str3: (ex3.Expecting != -1) ? tokenNames[ex3.Expecting] : "EndOfFile", str0: "mismatched input ", str1: GetTokenErrorDisplay(e.Token), str2: " expecting ");
			}
			else if (e is MismatchedTreeNodeException)
			{
				MismatchedTreeNodeException ex4 = (MismatchedTreeNodeException)e;
				string text4 = "<unknown>";
				text4 = ((ex4.Expecting != -1) ? tokenNames[ex4.Expecting] : "EndOfFile");
				string text5 = ((ex4.Node != null) ? (ex4.Node.ToString() ?? string.Empty) : string.Empty);
				result = "mismatched tree node: " + text5 + " expecting " + text4;
			}
			else if (e is NoViableAltException)
			{
				result = "no viable alternative at input " + GetTokenErrorDisplay(e.Token);
			}
			else if (e is EarlyExitException)
			{
				result = "required (...)+ loop did not match anything at input " + GetTokenErrorDisplay(e.Token);
			}
			else if (e is MismatchedSetException)
			{
				MismatchedSetException ex5 = (MismatchedSetException)e;
				result = "mismatched input " + GetTokenErrorDisplay(e.Token) + " expecting set " + ex5.Expecting;
			}
			else if (e is MismatchedNotSetException)
			{
				MismatchedNotSetException ex6 = (MismatchedNotSetException)e;
				result = "mismatched input " + GetTokenErrorDisplay(e.Token) + " expecting set " + ex6.Expecting;
			}
			else if (e is FailedPredicateException)
			{
				FailedPredicateException ex7 = (FailedPredicateException)e;
				result = "rule " + ex7.RuleName + " failed predicate: {" + ex7.PredicateText + "}?";
			}
			return result;
		}

		public virtual string GetErrorHeader(RecognitionException e)
		{
			string text = SourceName ?? string.Empty;
			if (text.Length > 0)
			{
				text += " ";
			}
			return $"{text}line {e.Line}:{e.CharPositionInLine + 1}";
		}

		public virtual string GetTokenErrorDisplay(IToken t)
		{
			string text = t.Text;
			if (text == null)
			{
				text = ((t.Type != -1) ? ("<" + t.Type + ">") : "<EOF>");
			}
			text = Regex.Replace(text, "\n", "\\\\n");
			text = Regex.Replace(text, "\r", "\\\\r");
			text = Regex.Replace(text, "\t", "\\\\t");
			return "'" + text + "'";
		}

		public virtual void EmitErrorMessage(string msg)
		{
			if (TraceDestination != null)
			{
				TraceDestination.WriteLine(msg);
			}
		}

		public virtual void Recover(IIntStream input, RecognitionException re)
		{
			if (state.lastErrorIndex == input.Index)
			{
				input.Consume();
			}
			state.lastErrorIndex = input.Index;
			BitSet set = ComputeErrorRecoverySet();
			BeginResync();
			ConsumeUntil(input, set);
			EndResync();
		}

		public virtual void BeginResync()
		{
		}

		public virtual void EndResync()
		{
		}

		protected virtual BitSet ComputeErrorRecoverySet()
		{
			return CombineFollows(exact: false);
		}

		protected virtual BitSet ComputeContextSensitiveRuleFOLLOW()
		{
			return CombineFollows(exact: true);
		}

		protected virtual BitSet CombineFollows(bool exact)
		{
			int fsp = state._fsp;
			BitSet bitSet = new BitSet();
			for (int num = fsp; num >= 0; num--)
			{
				BitSet bitSet2 = state.following[num];
				bitSet.OrInPlace(bitSet2);
				if (exact)
				{
					if (!bitSet2.Member(1))
					{
						break;
					}
					if (num > 0)
					{
						bitSet.Remove(1);
					}
				}
			}
			return bitSet;
		}

		protected virtual object RecoverFromMismatchedToken(IIntStream input, int ttype, BitSet follow)
		{
			RecognitionException e = null;
			if (MismatchIsUnwantedToken(input, ttype))
			{
				e = new UnwantedTokenException(ttype, input, TokenNames);
				BeginResync();
				input.Consume();
				EndResync();
				ReportError(e);
				object currentInputSymbol = GetCurrentInputSymbol(input);
				input.Consume();
				return currentInputSymbol;
			}
			if (MismatchIsMissingToken(input, follow))
			{
				object missingSymbol = GetMissingSymbol(input, e, ttype, follow);
				e = new MissingTokenException(ttype, input, missingSymbol);
				ReportError(e);
				return missingSymbol;
			}
			e = new MismatchedTokenException(ttype, input, TokenNames);
			throw e;
		}

		public virtual object RecoverFromMismatchedSet(IIntStream input, RecognitionException e, BitSet follow)
		{
			if (MismatchIsMissingToken(input, follow))
			{
				ReportError(e);
				return GetMissingSymbol(input, e, 0, follow);
			}
			throw e;
		}

		protected virtual object GetCurrentInputSymbol(IIntStream input)
		{
			return null;
		}

		protected virtual object GetMissingSymbol(IIntStream input, RecognitionException e, int expectedTokenType, BitSet follow)
		{
			return null;
		}

		public virtual void ConsumeUntil(IIntStream input, int tokenType)
		{
			int num = input.LA(1);
			while (num != -1 && num != tokenType)
			{
				input.Consume();
				num = input.LA(1);
			}
		}

		public virtual void ConsumeUntil(IIntStream input, BitSet set)
		{
			int num = input.LA(1);
			while (num != -1 && !set.Member(num))
			{
				input.Consume();
				num = input.LA(1);
			}
		}

		protected void PushFollow(BitSet fset)
		{
			if (state._fsp + 1 >= state.following.Length)
			{
				Array.Resize(ref state.following, state.following.Length * 2);
			}
			state.following[++state._fsp] = fset;
		}

		protected void PopFollow()
		{
			state._fsp--;
		}

		public virtual IList<string> GetRuleInvocationStack()
		{
			return GetRuleInvocationStack(new StackTrace(fNeedFileInfo: true));
		}

		public static IList<string> GetRuleInvocationStack(StackTrace trace)
		{
			if (trace == null)
			{
				throw new ArgumentNullException("trace");
			}
			List<string> list = new List<string>();
			StackFrame[] array = trace.GetFrames() ?? new StackFrame[0];
			for (int num = array.Length - 1; num >= 0; num--)
			{
				GrammarRuleAttribute[] array2 = (GrammarRuleAttribute[])array[num].GetMethod().GetCustomAttributes(typeof(GrammarRuleAttribute), inherit: true);
				if (array2 != null && array2.Length != 0)
				{
					list.Add(array2[0].Name);
				}
			}
			return list;
		}

		public virtual List<string> ToStrings(ICollection<IToken> tokens)
		{
			if (tokens == null)
			{
				return null;
			}
			List<string> list = new List<string>(tokens.Count);
			foreach (IToken token in tokens)
			{
				list.Add(token.Text);
			}
			return list;
		}

		public virtual int GetRuleMemoization(int ruleIndex, int ruleStartIndex)
		{
			if (state.ruleMemo[ruleIndex] == null)
			{
				state.ruleMemo[ruleIndex] = new Dictionary<int, int>();
			}
			if (!state.ruleMemo[ruleIndex].TryGetValue(ruleStartIndex, out var value))
			{
				return -1;
			}
			return value;
		}

		public virtual bool AlreadyParsedRule(IIntStream input, int ruleIndex)
		{
			int ruleMemoization = GetRuleMemoization(ruleIndex, input.Index);
			switch (ruleMemoization)
			{
			case -1:
				return false;
			case -2:
				state.failed = true;
				break;
			default:
				input.Seek(ruleMemoization + 1);
				break;
			}
			return true;
		}

		public virtual void Memoize(IIntStream input, int ruleIndex, int ruleStartIndex)
		{
			int value = (state.failed ? (-2) : (input.Index - 1));
			if (state.ruleMemo == null && TraceDestination != null)
			{
				TraceDestination.WriteLine("!!!!!!!!! memo array is null for " + GrammarFileName);
			}
			if (ruleIndex >= state.ruleMemo.Length && TraceDestination != null)
			{
				TraceDestination.WriteLine("!!!!!!!!! memo size is " + state.ruleMemo.Length + ", but rule index is " + ruleIndex);
			}
			if (state.ruleMemo[ruleIndex] != null)
			{
				state.ruleMemo[ruleIndex][ruleStartIndex] = value;
			}
		}

		public virtual int GetRuleMemoizationCacheSize()
		{
			int num = 0;
			int num2 = 0;
			while (state.ruleMemo != null && num2 < state.ruleMemo.Length)
			{
				IDictionary<int, int> dictionary = state.ruleMemo[num2];
				if (dictionary != null)
				{
					num += dictionary.Count;
				}
				num2++;
			}
			return num;
		}

		public virtual void TraceIn(string ruleName, int ruleIndex, object inputSymbol)
		{
			if (TraceDestination != null)
			{
				TraceDestination.Write("enter " + ruleName + " " + inputSymbol);
				if (state.backtracking > 0)
				{
					TraceDestination.Write(" backtracking=" + state.backtracking);
				}
				TraceDestination.WriteLine();
			}
		}

		public virtual void TraceOut(string ruleName, int ruleIndex, object inputSymbol)
		{
			if (TraceDestination == null)
			{
				return;
			}
			TraceDestination.Write("exit " + ruleName + " " + inputSymbol);
			if (state.backtracking > 0)
			{
				TraceDestination.Write(" backtracking=" + state.backtracking);
				if (state.failed)
				{
					TraceDestination.Write(" failed");
				}
				else
				{
					TraceDestination.Write(" succeeded");
				}
			}
			TraceDestination.WriteLine();
		}

		[Conditional("ANTLR_DEBUG")]
		protected virtual void DebugEnterRule(string grammarFileName, string ruleName)
		{
			DebugListener?.EnterRule(grammarFileName, ruleName);
		}

		[Conditional("ANTLR_DEBUG")]
		protected virtual void DebugExitRule(string grammarFileName, string ruleName)
		{
			DebugListener?.ExitRule(grammarFileName, ruleName);
		}

		[Conditional("ANTLR_DEBUG")]
		protected virtual void DebugEnterSubRule(int decisionNumber)
		{
			DebugListener?.EnterSubRule(decisionNumber);
		}

		[Conditional("ANTLR_DEBUG")]
		protected virtual void DebugExitSubRule(int decisionNumber)
		{
			DebugListener?.ExitSubRule(decisionNumber);
		}

		[Conditional("ANTLR_DEBUG")]
		protected virtual void DebugEnterAlt(int alt)
		{
			DebugListener?.EnterAlt(alt);
		}

		[Conditional("ANTLR_DEBUG")]
		protected virtual void DebugEnterDecision(int decisionNumber, bool couldBacktrack)
		{
			DebugListener?.EnterDecision(decisionNumber, couldBacktrack);
		}

		[Conditional("ANTLR_DEBUG")]
		protected virtual void DebugExitDecision(int decisionNumber)
		{
			DebugListener?.ExitDecision(decisionNumber);
		}

		[Conditional("ANTLR_DEBUG")]
		protected virtual void DebugLocation(int line, int charPositionInLine)
		{
			DebugListener?.Location(line, charPositionInLine);
		}

		[Conditional("ANTLR_DEBUG")]
		protected virtual void DebugSemanticPredicate(bool result, string predicate)
		{
			DebugListener?.SemanticPredicate(result, predicate);
		}

		[Conditional("ANTLR_DEBUG")]
		protected virtual void DebugBeginBacktrack(int level)
		{
			DebugListener?.BeginBacktrack(level);
		}

		[Conditional("ANTLR_DEBUG")]
		protected virtual void DebugEndBacktrack(int level, bool successful)
		{
			DebugListener?.EndBacktrack(level, successful);
		}

		[Conditional("ANTLR_DEBUG")]
		protected virtual void DebugRecognitionException(RecognitionException ex)
		{
			DebugListener?.RecognitionException(ex);
		}
	}
	[Serializable]
	public sealed class BitSet : ICloneable
	{
		private const int BITS = 64;

		private const int LOG_BITS = 6;

		private const int MOD_MASK = 63;

		private ulong[] _bits;

		public BitSet()
			: this(64)
		{
		}

		[CLSCompliant(false)]
		public BitSet(ulong[] bits)
		{
			_bits = bits;
		}

		public BitSet(IEnumerable<int> items)
			: this()
		{
			foreach (int item in items)
			{
				Add(item);
			}
		}

		public BitSet(int nbits)
		{
			_bits = new ulong[(nbits - 1 >> 6) + 1];
		}

		public static BitSet Of(int el)
		{
			BitSet bitSet = new BitSet(el + 1);
			bitSet.Add(el);
			return bitSet;
		}

		public static BitSet Of(int a, int b)
		{
			BitSet bitSet = new BitSet(Math.Max(a, b) + 1);
			bitSet.Add(a);
			bitSet.Add(b);
			return bitSet;
		}

		public static BitSet Of(int a, int b, int c)
		{
			BitSet bitSet = new BitSet();
			bitSet.Add(a);
			bitSet.Add(b);
			bitSet.Add(c);
			return bitSet;
		}

		public static BitSet Of(int a, int b, int c, int d)
		{
			BitSet bitSet = new BitSet();
			bitSet.Add(a);
			bitSet.Add(b);
			bitSet.Add(c);
			bitSet.Add(d);
			return bitSet;
		}

		public BitSet Or(BitSet a)
		{
			if (a == null)
			{
				return this;
			}
			BitSet obj = (BitSet)Clone();
			obj.OrInPlace(a);
			return obj;
		}

		public void Add(int el)
		{
			int num = WordNumber(el);
			if (num >= _bits.Length)
			{
				GrowToInclude(el);
			}
			_bits[num] |= BitMask(el);
		}

		public void GrowToInclude(int bit)
		{
			int size = Math.Max(_bits.Length << 1, NumWordsToHold(bit));
			SetSize(size);
		}

		public void OrInPlace(BitSet a)
		{
			if (a != null)
			{
				if (a._bits.Length > _bits.Length)
				{
					SetSize(a._bits.Length);
				}
				for (int num = Math.Min(_bits.Length, a._bits.Length) - 1; num >= 0; num--)
				{
					_bits[num] |= a._bits[num];
				}
			}
		}

		private void SetSize(int nwords)
		{
			Array.Resize(ref _bits, nwords);
		}

		private static ulong BitMask(int bitNumber)
		{
			int num = bitNumber & 0x3F;
			return (ulong)(1L << num);
		}

		public object Clone()
		{
			return new BitSet((ulong[])_bits.Clone());
		}

		public int Size()
		{
			int num = 0;
			for (int num2 = _bits.Length - 1; num2 >= 0; num2--)
			{
				ulong num3 = _bits[num2];
				if (num3 != 0L)
				{
					for (int num4 = 63; num4 >= 0; num4--)
					{
						if ((num3 & (ulong)(1L << num4)) != 0L)
						{
							num++;
						}
					}
				}
			}
			return num;
		}

		public override int GetHashCode()
		{
			throw new NotImplementedException();
		}

		public override bool Equals(object other)
		{
			if (other == null || !(other is BitSet))
			{
				return false;
			}
			BitSet bitSet = (BitSet)other;
			int num = Math.Min(_bits.Length, bitSet._bits.Length);
			for (int i = 0; i < num; i++)
			{
				if (_bits[i] != bitSet._bits[i])
				{
					return false;
				}
			}
			if (_bits.Length > num)
			{
				for (int j = num + 1; j < _bits.Length; j++)
				{
					if (_bits[j] != 0L)
					{
						return false;
					}
				}
			}
			else if (bitSet._bits.Length > num)
			{
				for (int k = num + 1; k < bitSet._bits.Length; k++)
				{
					if (bitSet._bits[k] != 0L)
					{
						return false;
					}
				}
			}
			return true;
		}

		public bool Member(int el)
		{
			if (el < 0)
			{
				return false;
			}
			int num = WordNumber(el);
			if (num >= _bits.Length)
			{
				return false;
			}
			return (_bits[num] & BitMask(el)) != 0;
		}

		public void Remove(int el)
		{
			int num = WordNumber(el);
			if (num < _bits.Length)
			{
				_bits[num] &= ~BitMask(el);
			}
		}

		public bool IsNil()
		{
			for (int num = _bits.Length - 1; num >= 0; num--)
			{
				if (_bits[num] != 0L)
				{
					return false;
				}
			}
			return true;
		}

		private static int NumWordsToHold(int el)
		{
			return (el >> 6) + 1;
		}

		public int NumBits()
		{
			return _bits.Length << 6;
		}

		public int LengthInLongWords()
		{
			return _bits.Length;
		}

		public int[] ToArray()
		{
			int[] array = new int[Size()];
			int num = 0;
			for (int i = 0; i < _bits.Length << 6; i++)
			{
				if (Member(i))
				{
					array[num++] = i;
				}
			}
			return array;
		}

		private static int WordNumber(int bit)
		{
			return bit >> 6;
		}

		public override string ToString()
		{
			return ToString(null);
		}

		public string ToString(string[] tokenNames)
		{
			StringBuilder stringBuilder = new StringBuilder();
			string value = ",";
			bool flag = false;
			stringBuilder.Append('{');
			for (int i = 0; i < _bits.Length << 6; i++)
			{
				if (Member(i))
				{
					if (i > 0 && flag)
					{
						stringBuilder.Append(value);
					}
					if (tokenNames != null)
					{
						stringBuilder.Append(tokenNames[i]);
					}
					else
					{
						stringBuilder.Append(i);
					}
					flag = true;
				}
			}
			stringBuilder.Append('}');
			return stringBuilder.ToString();
		}
	}
	[Serializable]
	public class BufferedTokenStream : ITokenStream, IIntStream, ITokenStreamInformation
	{
		private ITokenSource _tokenSource;

		[CLSCompliant(false)]
		protected List<IToken> _tokens = new List<IToken>(100);

		private int _lastMarker;

		[CLSCompliant(false)]
		protected int _p = -1;

		public virtual ITokenSource TokenSource
		{
			get
			{
				return _tokenSource;
			}
			set
			{
				_tokenSource = value;
				_tokens.Clear();
				_p = -1;
			}
		}

		public virtual int Index => _p;

		public virtual int Range { get; protected set; }

		public virtual int Count => _tokens.Count;

		public virtual string SourceName => _tokenSource.SourceName;

		public virtual IToken LastToken => LB(1);

		public virtual IToken LastRealToken
		{
			get
			{
				int num = 0;
				IToken token;
				do
				{
					num++;
					token = LB(num);
				}
				while (token != null && token.Line <= 0);
				return token;
			}
		}

		public virtual int MaxLookBehind => int.MaxValue;

		public BufferedTokenStream()
		{
		}

		public BufferedTokenStream(ITokenSource tokenSource)
		{
			_tokenSource = tokenSource;
		}

		public virtual int Mark()
		{
			if (_p == -1)
			{
				Setup();
			}
			_lastMarker = Index;
			return _lastMarker;
		}

		public virtual void Release(int marker)
		{
		}

		public virtual void Rewind(int marker)
		{
			Seek(marker);
		}

		public virtual void Rewind()
		{
			Seek(_lastMarker);
		}

		public virtual void Reset()
		{
			_p = 0;
			_lastMarker = 0;
		}

		public virtual void Seek(int index)
		{
			_p = index;
		}

		public virtual void Consume()
		{
			if (_p == -1)
			{
				Setup();
			}
			_p++;
			Sync(_p);
		}

		protected virtual void Sync(int i)
		{
			int num = i - _tokens.Count + 1;
			if (num > 0)
			{
				Fetch(num);
			}
		}

		protected virtual void Fetch(int n)
		{
			for (int i = 0; i < n; i++)
			{
				IToken token = TokenSource.NextToken();
				token.TokenIndex = _tokens.Count;
				_tokens.Add(token);
				if (token.Type == -1)
				{
					break;
				}
			}
		}

		public virtual IToken Get(int i)
		{
			if (i < 0 || i >= _tokens.Count)
			{
				throw new IndexOutOfRangeException("token index " + i + " out of range 0.." + (_tokens.Count - 1));
			}
			return _tokens[i];
		}

		public virtual int LA(int i)
		{
			return LT(i).Type;
		}

		protected virtual IToken LB(int k)
		{
			if (_p - k < 0)
			{
				return null;
			}
			return _tokens[_p - k];
		}

		public virtual IToken LT(int k)
		{
			if (_p == -1)
			{
				Setup();
			}
			if (k == 0)
			{
				return null;
			}
			if (k < 0)
			{
				return LB(-k);
			}
			int num = _p + k - 1;
			Sync(num);
			if (num >= _tokens.Count)
			{
				return _tokens[_tokens.Count - 1];
			}
			if (num > Range)
			{
				Range = num;
			}
			return _tokens[_p + k - 1];
		}

		protected virtual void Setup()
		{
			Sync(0);
			_p = 0;
		}

		public virtual List<IToken> GetTokens()
		{
			return _tokens;
		}

		public virtual List<IToken> GetTokens(int start, int stop)
		{
			return GetTokens(start, stop, (BitSet)null);
		}

		public virtual List<IToken> GetTokens(int start, int stop, BitSet types)
		{
			if (_p == -1)
			{
				Setup();
			}
			if (stop >= _tokens.Count)
			{
				stop = _tokens.Count - 1;
			}
			if (start < 0)
			{
				start = 0;
			}
			if (start > stop)
			{
				return null;
			}
			List<IToken> list = new List<IToken>();
			for (int i = start; i <= stop; i++)
			{
				IToken token = _tokens[i];
				if (types == null || types.Member(token.Type))
				{
					list.Add(token);
				}
			}
			if (list.Count == 0)
			{
				list = null;
			}
			return list;
		}

		public virtual List<IToken> GetTokens(int start, int stop, IEnumerable<int> types)
		{
			return GetTokens(start, stop, new BitSet(types));
		}

		public virtual List<IToken> GetTokens(int start, int stop, int ttype)
		{
			return GetTokens(start, stop, BitSet.Of(ttype));
		}

		public override string ToString()
		{
			if (_p == -1)
			{
				Setup();
			}
			Fill();
			return ToString(0, _tokens.Count - 1);
		}

		public virtual string ToString(int start, int stop)
		{
			if (start < 0 || stop < 0)
			{
				return null;
			}
			if (_p == -1)
			{
				Setup();
			}
			if (stop >= _tokens.Count)
			{
				stop = _tokens.Count - 1;
			}
			StringBuilder stringBuilder = new StringBuilder();
			for (int i = start; i <= stop; i++)
			{
				IToken token = _tokens[i];
				if (token.Type == -1)
				{
					break;
				}
				stringBuilder.Append(token.Text);
			}
			return stringBuilder.ToString();
		}

		public virtual string ToString(IToken start, IToken stop)
		{
			if (start != null && stop != null)
			{
				return ToString(start.TokenIndex, stop.TokenIndex);
			}
			return null;
		}

		public virtual void Fill()
		{
			if (_p == -1)
			{
				Setup();
			}
			if (_tokens[_p].Type != -1)
			{
				int num = _p + 1;
				Sync(num);
				while (_tokens[num].Type != -1)
				{
					num++;
					Sync(num);
				}
			}
		}
	}
	public static class CharStreamConstants
	{
		public const int EndOfFile = -1;
	}
	[Serializable]
	public class CharStreamState
	{
		public int p;

		public int line;

		public int charPositionInLine;
	}
	[Serializable]
	public class ClassicToken : IToken
	{
		private string text;

		private int type;

		private int line;

		private int charPositionInLine;

		private int channel;

		private int index;

		public string Text
		{
			get
			{
				return text;
			}
			set
			{
				text = value;
			}
		}

		public int Type
		{
			get
			{
				return type;
			}
			set
			{
				type = value;
			}
		}

		public int Line
		{
			get
			{
				return line;
			}
			set
			{
				line = value;
			}
		}

		public int CharPositionInLine
		{
			get
			{
				return charPositionInLine;
			}
			set
			{
				charPositionInLine = value;
			}
		}

		public int Channel
		{
			get
			{
				return channel;
			}
			set
			{
				channel = value;
			}
		}

		public int StartIndex
		{
			get
			{
				return -1;
			}
			set
			{
			}
		}

		public int StopIndex
		{
			get
			{
				return -1;
			}
			set
			{
			}
		}

		public int TokenIndex
		{
			get
			{
				return index;
			}
			set
			{
				index = value;
			}
		}

		public ICharStream InputStream
		{
			get
			{
				return null;
			}
			set
			{
			}
		}

		public ClassicToken(int type)
		{
			this.type = type;
		}

		public ClassicToken(IToken oldToken)
		{
			text = oldToken.Text;
			type = oldToken.Type;
			line = oldToken.Line;
			charPositionInLine = oldToken.CharPositionInLine;
			channel = oldToken.Channel;
		}

		public ClassicToken(int type, string text)
		{
			this.type = type;
			this.text = text;
		}

		public ClassicToken(int type, string text, int channel)
		{
			this.type = type;
			this.text = text;
			this.channel = channel;
		}

		public override string ToString()
		{
			string text = "";
			if (channel > 0)
			{
				text = ",channel=" + channel;
			}
			string text2 = Text;
			if (text2 != null)
			{
				text2 = text2.Replace("\n", "\\\\n");
				text2 = text2.Replace("\r", "\\\\r");
				text2 = text2.Replace("\t", "\\\\t");
			}
			else
			{
				text2 = "<no text>";
			}
			return "[@" + TokenIndex + ",'" + text2 + "',<" + type + ">" + text + "," + line + ":" + CharPositionInLine + "]";
		}
	}
	[Serializable]
	public class CommonToken : IToken
	{
		private int type;

		private int line;

		private int charPositionInLine = -1;

		private int channel;

		[NonSerialized]
		private ICharStream input;

		private string text;

		private int index = -1;

		private int start;

		private int stop;

		public string Text
		{
			get
			{
				if (text != null)
				{
					return text;
				}
				if (input == null)
				{
					return null;
				}
				if (start <= stop && stop < input.Count)
				{
					return input.Substring(start, stop - start + 1);
				}
				return "<EOF>";
			}
			set
			{
				text = value;
			}
		}

		public int Type
		{
			get
			{
				return type;
			}
			set
			{
				type = value;
			}
		}

		public int Line
		{
			get
			{
				return line;
			}
			set
			{
				line = value;
			}
		}

		public int CharPositionInLine
		{
			get
			{
				return charPositionInLine;
			}
			set
			{
				charPositionInLine = value;
			}
		}

		public int Channel
		{
			get
			{
				return channel;
			}
			set
			{
				channel = value;
			}
		}

		public int StartIndex
		{
			get
			{
				return start;
			}
			set
			{
				start = value;
			}
		}

		public int StopIndex
		{
			get
			{
				return stop;
			}
			set
			{
				stop = value;
			}
		}

		public int TokenIndex
		{
			get
			{
				return index;
			}
			set
			{
				index = value;
			}
		}

		public ICharStream InputStream
		{
			get
			{
				return input;
			}
			set
			{
				input = value;
			}
		}

		public CommonToken()
		{
		}

		public CommonToken(int type)
		{
			this.type = type;
		}

		public CommonToken(ICharStream input, int type, int channel, int start, int stop)
		{
			this.input = input;
			this.type = type;
			this.channel = channel;
			this.start = start;
			this.stop = stop;
		}

		public CommonToken(int type, string text)
		{
			this.type = type;
			channel = 0;
			this.text = text;
		}

		public CommonToken(IToken oldToken)
		{
			text = oldToken.Text;
			type = oldToken.Type;
			line = oldToken.Line;
			index = oldToken.TokenIndex;
			charPositionInLine = oldToken.CharPositionInLine;
			channel = oldToken.Channel;
			input = oldToken.InputStream;
			if (oldToken is CommonToken)
			{
				start = ((CommonToken)oldToken).start;
				stop = ((CommonToken)oldToken).stop;
			}
		}

		public override string ToString()
		{
			string text = "";
			if (channel > 0)
			{
				text = ",channel=" + channel;
			}
			string text2 = Text;
			if (text2 != null)
			{
				text2 = Regex.Replace(text2, "\n", "\\\\n");
				text2 = Regex.Replace(text2, "\r", "\\\\r");
				text2 = Regex.Replace(text2, "\t", "\\\\t");
			}
			else
			{
				text2 = "<no text>";
			}
			return "[@" + TokenIndex + "," + start + ":" + stop + "='" + text2 + "',<" + type + ">" + text + "," + line + ":" + CharPositionInLine + "]";
		}

		[OnSerializing]
		internal void OnSerializing(StreamingContext context)
		{
			if (text == null)
			{
				text = Text;
			}
		}
	}
	[Serializable]
	public class CommonTokenStream : BufferedTokenStream
	{
		private int _channel;

		public int Channel => _channel;

		public override ITokenSource TokenSource
		{
			get
			{
				return base.TokenSource;
			}
			set
			{
				base.TokenSource = value;
				_channel = 0;
			}
		}

		public CommonTokenStream()
		{
		}

		public CommonTokenStream(ITokenSource tokenSource)
			: this(tokenSource, 0)
		{
		}

		public CommonTokenStream(ITokenSource tokenSource, int channel)
			: base(tokenSource)
		{
			_channel = channel;
		}

		public override void Consume()
		{
			if (_p == -1)
			{
				Setup();
			}
			_p++;
			_p = SkipOffTokenChannels(_p);
		}

		protected override IToken LB(int k)
		{
			if (k == 0 || _p - k < 0)
			{
				return null;
			}
			int num = _p;
			for (int i = 1; i <= k; i++)
			{
				num = SkipOffTokenChannelsReverse(num - 1);
			}
			if (num < 0)
			{
				return null;
			}
			return _tokens[num];
		}

		public override IToken LT(int k)
		{
			if (_p == -1)
			{
				Setup();
			}
			if (k == 0)
			{
				return null;
			}
			if (k < 0)
			{
				return LB(-k);
			}
			int num = _p;
			for (int i = 1; i < k; i++)
			{
				num = SkipOffTokenChannels(num + 1);
			}
			if (num > Range)
			{
				Range = num;
			}
			return _tokens[num];
		}

		protected virtual int SkipOffTokenChannels(int i)
		{
			Sync(i);
			while (_tokens[i].Channel != _channel)
			{
				i++;
				Sync(i);
			}
			return i;
		}

		protected virtual int SkipOffTokenChannelsReverse(int i)
		{
			while (i >= 0 && _tokens[i].Channel != _channel)
			{
				i--;
			}
			return i;
		}

		public override void Reset()
		{
			base.Reset();
			_p = SkipOffTokenChannels(0);
		}

		protected override void Setup()
		{
			_p = 0;
			_p = SkipOffTokenChannels(_p);
		}
	}
	public delegate int SpecialStateTransitionHandler(DFA dfa, int s, IIntStream input);
	public class DFA
	{
		protected short[] eot;

		protected short[] eof;

		protected char[] min;

		protected char[] max;

		protected short[] accept;

		protected short[] special;

		protected short[][] transition;

		protected int decisionNumber;

		protected BaseRecognizer recognizer;

		public bool debug;

		public virtual string Description => "n/a";

		public SpecialStateTransitionHandler SpecialStateTransition { get; private set; }

		public DFA()
			: this(SpecialStateTransitionDefault)
		{
		}

		public DFA(SpecialStateTransitionHandler specialStateTransition)
		{
			SpecialStateTransition = specialStateTransition ?? new SpecialStateTransitionHandler(SpecialStateTransitionDefault);
		}

		public virtual int Predict(IIntStream input)
		{
			if (input == null)
			{
				throw new ArgumentNullException("input");
			}
			int marker = input.Mark();
			int num = 0;
			try
			{
				char c;
				while (true)
				{
					int num2 = special[num];
					if (num2 >= 0)
					{
						num = SpecialStateTransition(this, num2, input);
						if (num == -1)
						{
							NoViableAlt(num, input);
							return 0;
						}
						input.Consume();
						continue;
					}
					if (accept[num] >= 1)
					{
						return accept[num];
					}
					c = (char)input.LA(1);
					if (c >= min[num] && c <= max[num])
					{
						int num3 = transition[num][c - min[num]];
						if (num3 < 0)
						{
							if (eot[num] < 0)
							{
								NoViableAlt(num, input);
								return 0;
							}
							num = eot[num];
							input.Consume();
						}
						else
						{
							num = num3;
							input.Consume();
						}
					}
					else
					{
						if (eot[num] < 0)
						{
							break;
						}
						num = eot[num];
						input.Consume();
					}
				}
				if (c == '\uffff' && eof[num] >= 0)
				{
					return accept[eof[num]];
				}
				NoViableAlt(num, input);
				return 0;
			}
			finally
			{
				input.Rewind(marker);
			}
		}

		[Conditional("DEBUG_DFA")]
		private void DfaDebugMessage(string format, params object[] args)
		{
			Console.Error.WriteLine(format, args);
		}

		[Conditional("DEBUG_DFA")]
		private void DfaDebugInvalidSymbol(int s)
		{
			Console.Error.WriteLine("min[{0}]={1}", s, min[s]);
			Console.Error.WriteLine("max[{0}]={1}", s, max[s]);
			Console.Error.WriteLine("eot[{0}]={1}", s, eot[s]);
			Console.Error.WriteLine("eof[{0}]={1}", s, eof[s]);
			for (int i = 0; i < transition[s].Length; i++)
			{
				Console.Error.Write(transition[s][i] + " ");
			}
			Console.Error.WriteLine();
		}

		protected virtual void NoViableAlt(int s, IIntStream input)
		{
			if (recognizer.state.backtracking > 0)
			{
				recognizer.state.failed = true;
				return;
			}
			NoViableAltException ex = new NoViableAltException(Description, decisionNumber, s, input);
			Error(ex);
			throw ex;
		}

		public virtual void Error(NoViableAltException nvae)
		{
		}

		private static int SpecialStateTransitionDefault(DFA dfa, int s, IIntStream input)
		{
			return -1;
		}

		public static short[] UnpackEncodedString(string encodedString)
		{
			int num = 0;
			for (int i = 0; i < encodedString.Length; i += 2)
			{
				num += encodedString[i];
			}
			short[] array = new short[num];
			int num2 = 0;
			for (int j = 0; j < encodedString.Length; j += 2)
			{
				char c = encodedString[j];
				char c2 = encodedString[j + 1];
				for (int k = 1; k <= c; k++)
				{
					array[num2++] = (short)c2;
				}
			}
			return array;
		}

		public static char[] UnpackEncodedStringToUnsignedChars(string encodedString)
		{
			int num = 0;
			for (int i = 0; i < encodedString.Length; i += 2)
			{
				num += encodedString[i];
			}
			char[] array = new char[num];
			int num2 = 0;
			for (int j = 0; j < encodedString.Length; j += 2)
			{
				char c = encodedString[j];
				char c2 = encodedString[j + 1];
				for (int k = 1; k <= c; k++)
				{
					array[num2++] = c2;
				}
			}
			return array;
		}

		[Conditional("ANTLR_DEBUG")]
		protected virtual void DebugRecognitionException(RecognitionException ex)
		{
			recognizer.DebugListener?.RecognitionException(ex);
		}
	}
	[Serializable]
	public class EarlyExitException : RecognitionException
	{
		private readonly int _decisionNumber;

		public int DecisionNumber => _decisionNumber;

		public EarlyExitException()
		{
		}

		public EarlyExitException(string message)
			: base(message)
		{
		}

		public EarlyExitException(string message, Exception innerException)
			: base(message, innerException)
		{
		}

		public EarlyExitException(int decisionNumber, IIntStream input)
			: base(input)
		{
			_decisionNumber = decisionNumber;
		}

		public EarlyExitException(string message, int decisionNumber, IIntStream input)
			: base(message, input)
		{
			_decisionNumber = decisionNumber;
		}

		public EarlyExitException(string message, int decisionNumber, IIntStream input, Exception innerException)
			: base(message, input, innerException)
		{
			_decisionNumber = decisionNumber;
		}

		protected EarlyExitException(SerializationInfo info, StreamingContext context)
			: base(info, context)
		{
			if (info == null)
			{
				throw new ArgumentNullException("info");
			}
			_decisionNumber = info.GetInt32("DecisionNumber");
		}

		[SecurityCritical]
		public override void GetObjectData(SerializationInfo info, StreamingContext context)
		{
			if (info == null)
			{
				throw new ArgumentNullException("info");
			}
			base.GetObjectData(info, context);
			info.AddValue("DecisionNumber", DecisionNumber);
		}
	}
	[Serializable]
	public class FailedPredicateException : RecognitionException
	{
		private readonly string _ruleName;

		private readonly string _predicateText;

		public string RuleName => _ruleName;

		public string PredicateText => _predicateText;

		public FailedPredicateException()
		{
		}

		public FailedPredicateException(string message)
			: base(message)
		{
		}

		public FailedPredicateException(string message, Exception innerException)
			: base(message, innerException)
		{
		}

		public FailedPredicateException(IIntStream input, string ruleName, string predicateText)
			: base(input)
		{
			_ruleName = ruleName;
			_predicateText = predicateText;
		}

		public FailedPredicateException(string message, IIntStream input, string ruleName, string predicateText)
			: base(message, input)
		{
			_ruleName = ruleName;
			_predicateText = predicateText;
		}

		public FailedPredicateException(string message, IIntStream input, string ruleName, string predicateText, Exception innerException)
			: base(message, input, innerException)
		{
			_ruleName = ruleName;
			_predicateText = predicateText;
		}

		protected FailedPredicateException(SerializationInfo info, StreamingContext context)
			: base(info, context)
		{
			if (info == null)
			{
				throw new ArgumentNullException("info");
			}
			_ruleName = info.GetString("RuleName");
			_predicateText = info.GetString("PredicateText");
		}

		[SecurityCritical]
		public override void GetObjectData(SerializationInfo info, StreamingContext context)
		{
			if (info == null)
			{
				throw new ArgumentNullException("info");
			}
			base.GetObjectData(info, context);
			info.AddValue("RuleName", _ruleName);
			info.AddValue("PredicateText", _predicateText);
		}

		public override string ToString()
		{
			return "FailedPredicateException(" + RuleName + ",{" + PredicateText + "}?)";
		}
	}
	[AttributeUsage(AttributeTargets.Method, AllowMultiple = false, Inherited = true)]
	public sealed class GrammarRuleAttribute : Attribute
	{
		private readonly string _name;

		public string Name => _name;

		public GrammarRuleAttribute(string name)
		{
			_name = name;
		}
	}
	public interface IAstRuleReturnScope : IRuleReturnScope
	{
		object Tree { get; }
	}
	public interface IAstRuleReturnScope<TAstLabel> : IAstRuleReturnScope, IRuleReturnScope
	{
		new TAstLabel Tree { get; }
	}
	public interface ICharStream : IIntStream
	{
		int Line { get; set; }

		int CharPositionInLine { get; set; }

		string Substring(int start, int length);

		int LT(int i);
	}
	public interface IIntStream
	{
		int Index { get; }

		int Count { get; }

		string SourceName { get; }

		void Consume();

		int LA(int i);

		int Mark();

		void Rewind(int marker);

		void Rewind();

		void Release(int marker);

		void Seek(int index);
	}
	public interface IRuleReturnScope
	{
		object Start { get; }

		object Stop { get; }
	}
	public interface IRuleReturnScope<TLabel> : IRuleReturnScope
	{
		new TLabel Start { get; }

		new TLabel Stop { get; }
	}
	public interface ITemplateRuleReturnScope
	{
		object Template { get; }
	}
	public interface ITemplateRuleReturnScope<TTemplate> : ITemplateRuleReturnScope
	{
		new TTemplate Template { get; }
	}
	public interface IToken
	{
		string Text { get; set; }

		int Type { get; set; }

		int Line { get; set; }

		int CharPositionInLine { get; set; }

		int Channel { get; set; }

		int StartIndex { get; set; }

		int StopIndex { get; set; }

		int TokenIndex { get; set; }

		ICharStream InputStream { get; set; }
	}
	public interface ITokenSource
	{
		string SourceName { get; }

		string[] TokenNames { get; }

		IToken NextToken();
	}
	public interface ITokenStream : IIntStream
	{
		int Range { get; }

		ITokenSource TokenSource { get; }

		IToken LT(int k);

		IToken Get(int i);

		string ToString(int start, int stop);

		string ToString(IToken start, IToken stop);
	}
	public interface ITokenStreamInformation
	{
		IToken LastToken { get; }

		IToken LastRealToken { get; }

		int MaxLookBehind { get; }
	}
	[Serializable]
	public class LegacyCommonTokenStream : ITokenStream, IIntStream
	{
		[NonSerialized]
		private ITokenSource _tokenSource;

		protected List<IToken> tokens;

		protected IDictionary<int, int> channelOverrideMap;

		protected List<int> discardSet;

		protected int channel;

		protected bool discardOffChannelTokens;

		protected int lastMarker;

		protected int p = -1;

		public virtual int Index => p;

		public virtual int Range { get; protected set; }

		public virtual int Count => tokens.Count;

		public virtual ITokenSource TokenSource => _tokenSource;

		public virtual string SourceName => TokenSource.SourceName;

		public LegacyCommonTokenStream()
		{
			tokens = new List<IToken>(500);
		}

		public LegacyCommonTokenStream(ITokenSource tokenSource)
			: this()
		{
			_tokenSource = tokenSource;
		}

		public LegacyCommonTokenStream(ITokenSource tokenSource, int channel)
			: this(tokenSource)
		{
			this.channel = channel;
		}

		public virtual void SetTokenSource(ITokenSource tokenSource)
		{
			_tokenSource = tokenSource;
			tokens.Clear();
			p = -1;
			channel = 0;
		}

		public virtual void FillBuffer()
		{
			if (p != -1)
			{
				return;
			}
			int num = 0;
			IToken token = _tokenSource.NextToken();
			while (token != null && token.Type != -1)
			{
				bool flag = false;
				if (channelOverrideMap != null && channelOverrideMap.TryGetValue(token.Type, out var value))
				{
					token.Channel = value;
				}
				if (discardSet != null && discardSet.Contains(token.Type))
				{
					flag = true;
				}
				else if (discardOffChannelTokens && token.Channel != channel)
				{
					flag = true;
				}
				if (!flag)
				{
					token.TokenIndex = num;
					tokens.Add(token);
					num++;
				}
				token = _tokenSource.NextToken();
			}
			p = 0;
			p = SkipOffTokenChannels(p);
		}

		public virtual void Consume()
		{
			if (p < tokens.Count)
			{
				p++;
				p = SkipOffTokenChannels(p);
			}
		}

		protected virtual int SkipOffTokenChannels(int i)
		{
			int count = tokens.Count;
			while (i < count && tokens[i].Channel != channel)
			{
				i++;
			}
			return i;
		}

		protected virtual int SkipOffTokenChannelsReverse(int i)
		{
			while (i >= 0 && tokens[i].Channel != channel)
			{
				i--;
			}
			return i;
		}

		public virtual void SetTokenTypeChannel(int ttype, int channel)
		{
			if (channelOverrideMap == null)
			{
				channelOverrideMap = new Dictionary<int, int>();
			}
			channelOverrideMap[ttype] = channel;
		}

		public virtual void DiscardTokenType(int ttype)
		{
			if (discardSet == null)
			{
				discardSet = new List<int>();
			}
			discardSet.Add(ttype);
		}

		public virtual void SetDiscardOffChannelTokens(bool discardOffChannelTokens)
		{
			this.discardOffChannelTokens = discardOffChannelTokens;
		}

		public virtual IList<IToken> GetTokens()
		{
			if (p == -1)
			{
				FillBuffer();
			}
			return tokens;
		}

		public virtual IList<IToken> GetTokens(int start, int stop)
		{
			return GetTokens(start, stop, (BitSet)null);
		}

		public virtual IList<IToken> GetTokens(int start, int stop, BitSet types)
		{
			if (p == -1)
			{
				FillBuffer();
			}
			if (stop >= tokens.Count)
			{
				stop = tokens.Count - 1;
			}
			if (start < 0)
			{
				start = 0;
			}
			if (start > stop)
			{
				return null;
			}
			IList<IToken> list = new List<IToken>();
			for (int i = start; i <= stop; i++)
			{
				IToken token = tokens[i];
				if (types == null || types.Member(token.Type))
				{
					list.Add(token);
				}
			}
			if (list.Count == 0)
			{
				list = null;
			}
			return list;
		}

		public virtual IList<IToken> GetTokens(int start, int stop, IList<int> types)
		{
			return GetTokens(start, stop, new BitSet(types));
		}

		public virtual IList<IToken> GetTokens(int start, int stop, int ttype)
		{
			return GetTokens(start, stop, BitSet.Of(ttype));
		}

		public virtual IToken LT(int k)
		{
			if (p == -1)
			{
				FillBuffer();
			}
			if (k == 0)
			{
				return null;
			}
			if (k < 0)
			{
				return LB(-k);
			}
			if (p + k - 1 >= tokens.Count)
			{
				return tokens[tokens.Count - 1];
			}
			int num = p;
			for (int i = 1; i < k; i++)
			{
				num = SkipOffTokenChannels(num + 1);
			}
			if (num >= tokens.Count)
			{
				return tokens[tokens.Count - 1];
			}
			if (num > Range)
			{
				Range = num;
			}
			return tokens[num];
		}

		protected virtual IToken LB(int k)
		{
			if (p == -1)
			{
				FillBuffer();
			}
			if (k == 0)
			{
				return null;
			}
			if (p - k < 0)
			{
				return null;
			}
			int num = p;
			for (int i = 1; i <= k; i++)
			{
				num = SkipOffTokenChannelsReverse(num - 1);
			}
			if (num < 0)
			{
				return null;
			}
			return tokens[num];
		}

		public virtual IToken Get(int i)
		{
			return tokens[i];
		}

		public virtual int LA(int i)
		{
			return LT(i).Type;
		}

		public virtual int Mark()
		{
			if (p == -1)
			{
				FillBuffer();
			}
			lastMarker = Index;
			return lastMarker;
		}

		public virtual void Release(int marker)
		{
		}

		public virtual void Rewind(int marker)
		{
			Seek(marker);
		}

		public virtual void Rewind()
		{
			Seek(lastMarker);
		}

		public virtual void Reset()
		{
			p = 0;
			lastMarker = 0;
		}

		public virtual void Seek(int index)
		{
			p = index;
		}

		public override string ToString()
		{
			if (p == -1)
			{
				throw new InvalidOperationException("Buffer is not yet filled.");
			}
			return ToString(0, tokens.Count - 1);
		}

		public virtual string ToString(int start, int stop)
		{
			if (start < 0 || stop < 0)
			{
				return null;
			}
			if (p == -1)
			{
				throw new InvalidOperationException("Buffer is not yet filled.");
			}
			if (stop >= tokens.Count)
			{
				stop = tokens.Count - 1;
			}
			StringBuilder stringBuilder = new StringBuilder();
			for (int i = start; i <= stop; i++)
			{
				IToken token = tokens[i];
				stringBuilder.Append(token.Text);
			}
			return stringBuilder.ToString();
		}

		public virtual string ToString(IToken start, IToken stop)
		{
			if (start != null && stop != null)
			{
				return ToString(start.TokenIndex, stop.TokenIndex);
			}
			return null;
		}
	}
	public abstract class Lexer : BaseRecognizer, ITokenSource
	{
		protected ICharStream input;

		public string Text
		{
			get
			{
				if (state.text != null)
				{
					return state.text;
				}
				return input.Substring(state.tokenStartCharIndex, CharIndex - state.tokenStartCharIndex);
			}
			set
			{
				state.text = value;
			}
		}

		public int Line
		{
			get
			{
				return input.Line;
			}
			set
			{
				input.Line = value;
			}
		}

		public int CharPositionInLine
		{
			get
			{
				return input.CharPositionInLine;
			}
			set
			{
				input.CharPositionInLine = value;
			}
		}

		public virtual ICharStream CharStream
		{
			get
			{
				return input;
			}
			set
			{
				input = null;
				Reset();
				input = value;
			}
		}

		public override string SourceName => input.SourceName;

		public virtual int CharIndex => input.Index;

		public Lexer()
		{
		}

		public Lexer(ICharStream input)
		{
			this.input = input;
		}

		public Lexer(ICharStream input, RecognizerSharedState state)
			: base(state)
		{
			this.input = input;
		}

		public override void Reset()
		{
			base.Reset();
			if (input != null)
			{
				input.Seek(0);
			}
			if (state != null)
			{
				state.token = null;
				state.type = 0;
				state.channel = 0;
				state.tokenStartCharIndex = -1;
				state.tokenStartCharPositionInLine = -1;
				state.tokenStartLine = -1;
				state.text = null;
			}
		}

		public virtual IToken NextToken()
		{
			while (true)
			{
				state.token = null;
				state.channel = 0;
				state.tokenStartCharIndex = input.Index;
				state.tokenStartCharPositionInLine = input.CharPositionInLine;
				state.tokenStartLine = input.Line;
				state.text = null;
				if (input.LA(1) == -1)
				{
					break;
				}
				try
				{
					ParseNextToken();
					if (state.token == null)
					{
						Emit();
						goto IL_00b0;
					}
					if (state.token != Tokens.Skip)
					{
						goto IL_00b0;
					}
					goto end_IL_007d;
					IL_00b0:
					return state.token;
					end_IL_007d:;
				}
				catch (MismatchedRangeException e)
				{
					ReportError(e);
				}
				catch (MismatchedTokenException e2)
				{
					ReportError(e2);
				}
				catch (RecognitionException ex)
				{
					ReportError(ex);
					Recover(ex);
				}
			}
			return GetEndOfFileToken();
		}

		public virtual IToken GetEndOfFileToken()
		{
			return new CommonToken(input, -1, 0, input.Index, input.Index)
			{
				Line = Line,
				CharPositionInLine = CharPositionInLine
			};
		}

		public virtual void Skip()
		{
			state.token = Tokens.Skip;
		}

		public abstract void mTokens();

		public virtual void Emit(IToken token)
		{
			state.token = token;
		}

		public virtual IToken Emit()
		{
			IToken token = new CommonToken(input, state.type, state.channel, state.tokenStartCharIndex, CharIndex - 1);
			token.Line = state.tokenStartLine;
			token.Text = state.text;
			token.CharPositionInLine = state.tokenStartCharPositionInLine;
			Emit(token);
			return token;
		}

		public virtual void Match(string s)
		{
			int num = 0;
			while (num < s.Length)
			{
				if (input.LA(1) != s[num])
				{
					if (state.backtracking > 0)
					{
						state.failed = true;
						break;
					}
					MismatchedTokenException ex = new MismatchedTokenException(s[num], input, TokenNames);
					Recover(ex);
					throw ex;
				}
				num++;
				input.Consume();
				state.failed = false;
			}
		}

		public virtual void MatchAny()
		{
			input.Consume();
		}

		public virtual void Match(int c)
		{
			if (input.LA(1) != c)
			{
				if (state.backtracking <= 0)
				{
					MismatchedTokenException ex = new MismatchedTokenException(c, input, TokenNames);
					Recover(ex);
					throw ex;
				}
				state.failed = true;
			}
			else
			{
				input.Consume();
				state.failed = false;
			}
		}

		public virtual void MatchRange(int a, int b)
		{
			if (input.LA(1) < a || input.LA(1) > b)
			{
				if (state.backtracking <= 0)
				{
					MismatchedRangeException ex = new MismatchedRangeException(a, b, input);
					Recover(ex);
					throw ex;
				}
				state.failed = true;
			}
			else
			{
				input.Consume();
				state.failed = false;
			}
		}

		public override void ReportError(RecognitionException e)
		{
			DisplayRecognitionError(TokenNames, e);
		}

		public override string GetErrorMessage(RecognitionException e, string[] tokenNames)
		{
			string text = null;
			if (e is MismatchedTokenException)
			{
				MismatchedTokenException ex = (MismatchedTokenException)e;
				return "mismatched character " + GetCharErrorDisplay(e.Character) + " expecting " + GetCharErrorDisplay(ex.Expecting);
			}
			if (e is NoViableAltException)
			{
				_ = (NoViableAltException)e;
				return "no viable alternative at character " + GetCharErrorDisplay(e.Character);
			}
			if (e is EarlyExitException)
			{
				_ = (EarlyExitException)e;
				return "required (...)+ loop did not match anything at character " + GetCharErrorDisplay(e.Character);
			}
			if (e is MismatchedNotSetException)
			{
				MismatchedNotSetException ex2 = (MismatchedNotSetException)e;
				return "mismatched character " + GetCharErrorDisplay(e.Character) + " expecting set " + ex2.Expecting;
			}
			if (e is MismatchedSetException)
			{
				MismatchedSetException ex3 = (MismatchedSetException)e;
				return "mismatched character " + GetCharErrorDisplay(e.Character) + " expecting set " + ex3.Expecting;
			}
			if (e is MismatchedRangeException)
			{
				MismatchedRangeException ex4 = (MismatchedRangeException)e;
				return "mismatched character " + GetCharErrorDisplay(e.Character) + " expecting set " + GetCharErrorDisplay(ex4.A) + ".." + GetCharErrorDisplay(ex4.B);
			}
			return base.GetErrorMessage(e, tokenNames);
		}

		public virtual string GetCharErrorDisplay(int c)
		{
			string text = ((char)c).ToString();
			switch (c)
			{
			case -1:
				text = "<EOF>";
				break;
			case 10:
				text = "\\n";
				break;
			case 9:
				text = "\\t";
				break;
			case 13:
				text = "\\r";
				break;
			}
			return "'" + text + "'";
		}

		public virtual void Recover(RecognitionException re)
		{
			input.Consume();
		}

		[Conditional("ANTLR_TRACE")]
		public virtual void TraceIn(string ruleName, int ruleIndex)
		{
			string inputSymbol = ((char)input.LT(1)).ToString() + " line=" + Line + ":" + CharPositionInLine;
			base.TraceIn(ruleName, ruleIndex, inputSymbol);
		}

		[Conditional("ANTLR_TRACE")]
		public virtual void TraceOut(string ruleName, int ruleIndex)
		{
			string inputSymbol = ((char)input.LT(1)).ToString() + " line=" + Line + ":" + CharPositionInLine;
			base.TraceOut(ruleName, ruleIndex, inputSymbol);
		}

		protected virtual void ParseNextToken()
		{
			mTokens();
		}
	}
	[Serializable]
	public class MismatchedNotSetException : MismatchedSetException
	{
		public MismatchedNotSetException()
		{
		}

		public MismatchedNotSetException(string message)
			: base(message)
		{
		}

		public MismatchedNotSetException(string message, Exception innerException)
			: base(message, innerException)
		{
		}

		public MismatchedNotSetException(BitSet expecting, IIntStream input)
			: base(expecting, input)
		{
		}

		public MismatchedNotSetException(string message, BitSet expecting, IIntStream input)
			: base(message, expecting, input)
		{
		}

		public MismatchedNotSetException(string message, BitSet expecting, IIntStream input, Exception innerException)
			: base(message, expecting, input, innerException)
		{
		}

		protected MismatchedNotSetException(SerializationInfo info, StreamingContext context)
			: base(info, context)
		{
		}

		public override string ToString()
		{
			return string.Concat("MismatchedNotSetException(", UnexpectedType, "!=", base.Expecting, ")");
		}
	}
	[Serializable]
	public class MismatchedRangeException : RecognitionException
	{
		private readonly int _a;

		private readonly int _b;

		public int A => _a;

		public int B => _b;

		public MismatchedRangeException()
		{
		}

		public MismatchedRangeException(string message)
			: base(message)
		{
		}

		public MismatchedRangeException(string message, Exception innerException)
			: base(message, innerException)
		{
		}

		public MismatchedRangeException(int a, int b, IIntStream input)
			: base(input)
		{
			_a = a;
			_b = b;
		}

		public MismatchedRangeException(string message, int a, int b, IIntStream input)
			: base(message, input)
		{
			_a = a;
			_b = b;
		}

		public MismatchedRangeException(string message, int a, int b, IIntStream input, Exception innerException)
			: base(message, input, innerException)
		{
			_a = a;
			_b = b;
		}

		protected MismatchedRangeException(SerializationInfo info, StreamingContext context)
			: base(info, context)
		{
			if (info == null)
			{
				throw new ArgumentNullException("info");
			}
			_a = info.GetInt32("A");
			_b = info.GetInt32("B");
		}

		[SecurityCritical]
		public override void GetObjectData(SerializationInfo info, StreamingContext context)
		{
			if (info == null)
			{
				throw new ArgumentNullException("info");
			}
			base.GetObjectData(info, context);
			info.AddValue("A", _a);
			info.AddValue("B", _b);
		}

		public override string ToString()
		{
			return "MismatchedRangeException(" + UnexpectedType + " not in [" + A + "," + B + "])";
		}
	}
	[Serializable]
	public class MismatchedSetException : RecognitionException
	{
		private readonly BitSet _expecting;

		public BitSet Expecting => _expecting;

		public MismatchedSetException()
		{
		}

		public MismatchedSetException(string message)
			: base(message)
		{
		}

		public MismatchedSetException(string message, Exception innerException)
			: base(message, innerException)
		{
		}

		public MismatchedSetException(BitSet expecting, IIntStream input)
			: base(input)
		{
			_expecting = expecting;
		}

		public MismatchedSetException(string message, BitSet expecting, IIntStream input)
			: base(message, input)
		{
			_expecting = expecting;
		}

		public MismatchedSetException(string message, BitSet expecting, IIntStream input, Exception innerException)
			: base(message, input, innerException)
		{
			_expecting = expecting;
		}

		protected MismatchedSetException(SerializationInfo info, StreamingContext context)
			: base(info, context)
		{
			if (info == null)
			{
				throw new ArgumentNullException("info");
			}
			_expecting = (BitSet)info.GetValue("Expecting", typeof(BitSet));
		}

		[SecurityCritical]
		public override void GetObjectData(SerializationInfo info, StreamingContext context)
		{
			if (info == null)
			{
				throw new ArgumentNullException("info");
			}
			base.GetObjectData(info, context);
			info.AddValue("Expecting", _expecting);
		}

		public override string ToString()
		{
			return string.Concat("MismatchedSetException(", UnexpectedType, "!=", Expecting, ")");
		}
	}
	[Serializable]
	public class MismatchedTokenException : RecognitionException
	{
		private readonly int _expecting;

		private readonly ReadOnlyCollection<string> _tokenNames;

		public int Expecting => _expecting;

		public ReadOnlyCollection<string> TokenNames => _tokenNames;

		public MismatchedTokenException()
		{
		}

		public MismatchedTokenException(string message)
			: base(message)
		{
		}

		public MismatchedTokenException(string message, Exception innerException)
			: base(message, innerException)
		{
		}

		public MismatchedTokenException(int expecting, IIntStream input)
			: this(expecting, input, null)
		{
		}

		public MismatchedTokenException(int expecting, IIntStream input, IList<string> tokenNames)
			: base(input)
		{
			_expecting = expecting;
			if (tokenNames != null)
			{
				_tokenNames = new ReadOnlyCollection<string>(new List<string>(tokenNames));
			}
		}

		public MismatchedTokenException(string message, int expecting, IIntStream input, IList<string> tokenNames)
			: base(message, input)
		{
			_expecting = expecting;
			if (tokenNames != null)
			{
				_tokenNames = new ReadOnlyCollection<string>(new List<string>(tokenNames));
			}
		}

		public MismatchedTokenException(string message, int expecting, IIntStream input, IList<string> tokenNames, Exception innerException)
			: base(message, input, innerException)
		{
			_expecting = expecting;
			if (tokenNames != null)
			{
				_tokenNames = new ReadOnlyCollection<string>(new List<string>(tokenNames));
			}
		}

		protected MismatchedTokenException(SerializationInfo info, StreamingContext context)
			: base(info, context)
		{
			if (info == null)
			{
				throw new ArgumentNullException("info");
			}
			_expecting = info.GetInt32("Expecting");
			_tokenNames = new ReadOnlyCollection<string>((string[])info.GetValue("TokenNames", typeof(string[])));
		}

		[SecurityCritical]
		public override void GetObjectData(SerializationInfo info, StreamingContext context)
		{
			if (info == null)
			{
				throw new ArgumentNullException("info");
			}
			base.GetObjectData(info, context);
			info.AddValue("Expecting", _expecting);
			info.AddValue("TokenNames", (_tokenNames != null) ? new List<string>(_tokenNames).ToArray() : null);
		}

		public override string ToString()
		{
			int unexpectedType = UnexpectedType;
			string text = ((TokenNames != null && unexpectedType >= 0 && unexpectedType < TokenNames.Count) ? TokenNames[unexpectedType] : unexpectedType.ToString());
			string text2 = ((TokenNames != null && Expecting >= 0 && Expecting < TokenNames.Count) ? TokenNames[Expecting] : Expecting.ToString());
			return "MismatchedTokenException(" + text + "!=" + text2 + ")";
		}
	}
	[Serializable]
	public class MismatchedTreeNodeException : RecognitionException
	{
		private readonly int _expecting;

		public int Expecting => _expecting;

		public MismatchedTreeNodeException()
		{
		}

		public MismatchedTreeNodeException(string message)
			: base(message)
		{
		}

		public MismatchedTreeNodeException(string message, Exception innerException)
			: base(message, innerException)
		{
		}

		public MismatchedTreeNodeException(int expecting, ITreeNodeStream input)
			: base(input)
		{
			_expecting = expecting;
		}

		public MismatchedTreeNodeException(string message, int expecting, ITreeNodeStream input)
			: base(message, input)
		{
			_expecting = expecting;
		}

		public MismatchedTreeNodeException(string message, int expecting, ITreeNodeStream input, Exception innerException)
			: base(message, input, innerException)
		{
			_expecting = expecting;
		}

		protected MismatchedTreeNodeException(SerializationInfo info, StreamingContext context)
			: base(info, context)
		{
			if (info == null)
			{
				throw new ArgumentNullException("info");
			}
			_expecting = info.GetInt32("Expecting");
		}

		[SecurityCritical]
		public override void GetObjectData(SerializationInfo info, StreamingContext context)
		{
			if (info == null)
			{
				throw new ArgumentNullException("info");
			}
			base.GetObjectData(info, context);
			info.AddValue("Expecting", _expecting);
		}

		public override string ToString()
		{
			return "MismatchedTreeNodeException(" + UnexpectedType + "!=" + Expecting + ")";
		}
	}
	[Serializable]
	public class MissingTokenException : MismatchedTokenException
	{
		private readonly object _inserted;

		public virtual int MissingType => base.Expecting;

		public MissingTokenException()
		{
		}

		public MissingTokenException(string message)
			: base(message)
		{
		}

		public MissingTokenException(string message, Exception innerException)
			: base(message, innerException)
		{
		}

		public MissingTokenException(int expecting, IIntStream input, object inserted)
			: this(expecting, input, inserted, null)
		{
		}

		public MissingTokenException(int expecting, IIntStream input, object inserted, IList<string> tokenNames)
			: base(expecting, input, tokenNames)
		{
			_inserted = inserted;
		}

		public MissingTokenException(string message, int expecting, IIntStream input, object inserted, IList<string> tokenNames)
			: base(message, expecting, input, tokenNames)
		{
			_inserted = inserted;
		}

		public MissingTokenException(string message, int expecting, IIntStream input, object inserted, IList<string> tokenNames, Exception innerException)
			: base(message, expecting, input, tokenNames, innerException)
		{
			_inserted = inserted;
		}

		protected MissingTokenException(SerializationInfo info, StreamingContext context)
			: base(info, context)
		{
		}

		public override string ToString()
		{
			if (_inserted != null && base.Token != null)
			{
				return string.Concat("MissingTokenException(inserted ", _inserted, " at ", base.Token.Text, ")");
			}
			if (base.Token != null)
			{
				return "MissingTokenException(at " + base.Token.Text + ")";
			}
			return "MissingTokenException";
		}
	}
	[Serializable]
	public class NoViableAltException : RecognitionException
	{
		private readonly string _grammarDecisionDescription;

		private readonly int _decisionNumber;

		private readonly int _stateNumber;

		public int DecisionNumber => _decisionNumber;

		public string GrammarDecisionDescription => _grammarDecisionDescription;

		public int StateNumber => _stateNumber;

		public NoViableAltException()
		{
		}

		public NoViableAltException(string grammarDecisionDescription)
		{
			_grammarDecisionDescription = grammarDecisionDescription;
		}

		public NoViableAltException(string message, string grammarDecisionDescription)
			: base(message)
		{
			_grammarDecisionDescription = grammarDecisionDescription;
		}

		public NoViableAltException(string message, string grammarDecisionDescription, Exception innerException)
			: base(message, innerException)
		{
			_grammarDecisionDescription = grammarDecisionDescription;
		}

		public NoViableAltException(string grammarDecisionDescription, int decisionNumber, int stateNumber, IIntStream input)
			: this(grammarDecisionDescription, decisionNumber, stateNumber, input, 1)
		{
		}

		public NoViableAltException(string grammarDecisionDescription, int decisionNumber, int stateNumber, IIntStream input, int k)
			: base(input, k)
		{
			_grammarDecisionDescription = grammarDecisionDescription;
			_decisionNumber = decisionNumber;
			_stateNumber = stateNumber;
		}

		public NoViableAltException(string message, string grammarDecisionDescription, int decisionNumber, int stateNumber, IIntStream input)
			: this(message, grammarDecisionDescription, decisionNumber, stateNumber, input, 1)
		{
		}

		public NoViableAltException(string message, string grammarDecisionDescription, int decisionNumber, int stateNumber, IIntStream input, int k)
			: base(message, input, k)
		{
			_grammarDecisionDescription = grammarDecisionDescription;
			_decisionNumber = decisionNumber;
			_stateNumber = stateNumber;
		}

		public NoViableAltException(string message, string grammarDecisionDescription, int decisionNumber, int stateNumber, IIntStream input, Exception innerException)
			: this(message, grammarDecisionDescription, decisionNumber, stateNumber, input, 1, innerException)
		{
		}

		public NoViableAltException(string message, string grammarDecisionDescription, int decisionNumber, int stateNumber, IIntStream input, int k, Exception innerException)
			: base(message, input, k, innerException)
		{
			_grammarDecisionDescription = grammarDecisionDescription;
			_decisionNumber = decisionNumber;
			_stateNumber = stateNumber;
		}

		protected NoViableAltException(SerializationInfo info, StreamingContext context)
			: base(info, context)
		{
			if (info == null)
			{
				throw new ArgumentNullException("info");
			}
			_grammarDecisionDescription = info.GetString("GrammarDecisionDescription");
			_decisionNumber = info.GetInt32("DecisionNumber");
			_stateNumber = info.GetInt32("StateNumber");
		}

		[SecurityCritical]
		public override void GetObjectData(SerializationInfo info, StreamingContext context)
		{
			if (info == null)
			{
				throw new ArgumentNullException("info");
			}
			base.GetObjectData(info, context);
			info.AddValue("GrammarDecisionDescription", _grammarDecisionDescription);
			info.AddValue("DecisionNumber", _decisionNumber);
			info.AddValue("StateNumber", _stateNumber);
		}

		public override string ToString()
		{
			if (base.Input is ICharStream)
			{
				return "NoViableAltException('" + (char)UnexpectedType + "'@[" + GrammarDecisionDescription + "])";
			}
			return "NoViableAltException(" + UnexpectedType + "@[" + GrammarDecisionDescription + "])";
		}
	}
	public class Parser : BaseRecognizer
	{
		public ITokenStream input;

		public virtual ITokenStream TokenStream
		{
			get
			{
				return input;
			}
			set
			{
				input = null;
				Reset();
				input = value;
			}
		}

		public override string SourceName => input.SourceName;

		public Parser(ITokenStream input)
		{
			TokenStream = input;
		}

		public Parser(ITokenStream input, RecognizerSharedState state)
			: base(state)
		{
			this.input = input;
		}

		public override void Reset()
		{
			base.Reset();
			if (input != null)
			{
				input.Seek(0);
			}
		}

		protected override object GetCurrentInputSymbol(IIntStream input)
		{
			return ((ITokenStream)input).LT(1);
		}

		protected override object GetMissingSymbol(IIntStream input, RecognitionException e, int expectedTokenType, BitSet follow)
		{
			string text = null;
			text = ((expectedTokenType != -1) ? ("<missing " + TokenNames[expectedTokenType] + ">") : "<missing EOF>");
			CommonToken commonToken = new CommonToken(expectedTokenType, text);
			IToken token = ((ITokenStream)input).LT(1);
			if (token.Type == -1)
			{
				token = ((ITokenStream)input).LT(-1);
			}
			commonToken.Line = token.Line;
			commonToken.CharPositionInLine = token.CharPositionInLine;
			commonToken.Channel = 0;
			commonToken.InputStream = token.InputStream;
			return commonToken;
		}

		[Conditional("ANTLR_TRACE")]
		public virtual void TraceIn(string ruleName, int ruleIndex)
		{
			base.TraceIn(ruleName, ruleIndex, input.LT(1));
		}

		[Conditional("ANTLR_TRACE")]
		public virtual void TraceOut(string ruleName, int ruleIndex)
		{
			base.TraceOut(ruleName, ruleIndex, input.LT(1));
		}
	}
	public class ParserRuleReturnScope<TToken> : IRuleReturnScope<TToken>, IRuleReturnScope
	{
		private TToken _start;

		private TToken _stop;

		public TToken Start
		{
			get
			{
				return _start;
			}
			set
			{
				_start = value;
			}
		}

		public TToken Stop
		{
			get
			{
				return _stop;
			}
			set
			{
				_stop = value;
			}
		}

		object IRuleReturnScope.Start => Start;

		object IRuleReturnScope.Stop => Stop;
	}
	[Serializable]
	public class RecognitionException : Exception
	{
		private IIntStream _input;

		private int _k;

		private int _index;

		private IToken _token;

		private object _node;

		private int _c;

		private int _line;

		private int _charPositionInLine;

		private bool _approximateLineInfo;

		public virtual int UnexpectedType
		{
			get
			{
				if (_input is ITokenStream)
				{
					return _token.Type;
				}
				if (_input is ITreeNodeStream treeNodeStream)
				{
					return treeNodeStream.TreeAdaptor.GetType(_node);
				}
				return _c;
			}
		}

		public bool ApproximateLineInfo
		{
			get
			{
				return _approximateLineInfo;
			}
			protected set
			{
				_approximateLineInfo = value;
			}
		}

		public IIntStream Input
		{
			get
			{
				return _input;
			}
			protected set
			{
				_input = value;
			}
		}

		public int Lookahead => _k;

		public IToken Token
		{
			get
			{
				return _token;
			}
			set
			{
				_token = value;
			}
		}

		public object Node
		{
			get
			{
				return _node;
			}
			protected set
			{
				_node = value;
			}
		}

		public int Character
		{
			get
			{
				return _c;
			}
			protected set
			{
				_c = value;
			}
		}

		public int Index
		{
			get
			{
				return _index;
			}
			protected set
			{
				_index = value;
			}
		}

		public int Line
		{
			get
			{
				return _line;
			}
			set
			{
				_line = value;
			}
		}

		public int CharPositionInLine
		{
			get
			{
				return _charPositionInLine;
			}
			set
			{
				_charPositionInLine = value;
			}
		}

		public RecognitionException()
			: this("A recognition error occurred.", null, null)
		{
		}

		public RecognitionException(IIntStream input)
			: this("A recognition error occurred.", input, 1, null)
		{
		}

		public RecognitionException(IIntStream input, int k)
			: this("A recognition error occurred.", input, k, null)
		{
		}

		public RecognitionException(string message)
			: this(message, null, null)
		{
		}

		public RecognitionException(string message, IIntStream input)
			: this(message, input, 1, null)
		{
		}

		public RecognitionException(string message, IIntStream input, int k)
			: this(message, input, k, null)
		{
		}

		public RecognitionException(string message, Exception innerException)
			: this(message, null, innerException)
		{
		}

		public RecognitionException(string message, IIntStream input, Exception innerException)
			: this(message, input, 1, innerException)
		{
		}

		public RecognitionException(string message, IIntStream input, int k, Exception innerException)
			: base(message, innerException)
		{
			_input = input;
			_k = k;
			if (input == null)
			{
				return;
			}
			_index = input.Index + k - 1;
			if (input is ITokenStream)
			{
				_token = ((ITokenStream)input).LT(k);
				_line = _token.Line;
				_charPositionInLine = _token.CharPositionInLine;
			}
			if (input is ITreeNodeStream input2)
			{
				ExtractInformationFromTreeNodeStream(input2, k);
				return;
			}
			if (input is ICharStream)
			{
				int marker = input.Mark();
				try
				{
					for (int i = 0; i < k - 1; i++)
					{
						input.Consume();
					}
					_c = input.LA(1);
					_line = ((ICharStream)input).Line;
					_charPositionInLine = ((ICharStream)input).CharPositionInLine;
					return;
				}
				finally
				{
					input.Rewind(marker);
				}
			}
			_c = input.LA(k);
		}

		protected RecognitionException(SerializationInfo info, StreamingContext context)
			: base(info, context)
		{
			if (info == null)
			{
				throw new ArgumentNullException("info");
			}
			_index = info.GetInt32("Index");
			_c = info.GetInt32("C");
			_line = info.GetInt32("Line");
			_charPositionInLine = info.GetInt32("CharPositionInLine");
			_approximateLineInfo = info.GetBoolean("ApproximateLineInfo");
		}

		[SecurityCritical]
		public override void GetObjectData(SerializationInfo info, StreamingContext context)
		{
			if (info == null)
			{
				throw new ArgumentNullException("info");
			}
			base.GetObjectData(info, context);
			info.AddValue("Index", _index);
			info.AddValue("C", _c);
			info.AddValue("Line", _line);
			info.AddValue("CharPositionInLine", _charPositionInLine);
			info.AddValue("ApproximateLineInfo", _approximateLineInfo);
		}

		protected virtual void ExtractInformationFromTreeNodeStream(ITreeNodeStream input)
		{
			_node = input.LT(1);
			object obj = null;
			if (input is IPositionTrackingStream positionTrackingStream)
			{
				obj = positionTrackingStream.GetKnownPositionElement(allowApproximateLocation: false);
				if (obj == null)
				{
					obj = positionTrackingStream.GetKnownPositionElement(allowApproximateLocation: true);
					_approximateLineInfo = obj != null;
				}
			}
			if (input is ITokenStreamInformation tokenStreamInformation)
			{
				IToken lastToken = tokenStreamInformation.LastToken;
				IToken lastRealToken = tokenStreamInformation.LastRealToken;
				if (lastRealToken != null)
				{
					_token = lastRealToken;
					_line = lastRealToken.Line;
					_charPositionInLine = lastRealToken.CharPositionInLine;
					_approximateLineInfo = lastRealToken.Equals(lastToken);
				}
				return;
			}
			ITreeAdaptor treeAdaptor = input.TreeAdaptor;
			IToken token = treeAdaptor.GetToken(obj ?? _node);
			if (token != null)
			{
				_token = token;
				if (token.Line <= 0)
				{
					int num = -1;
					object obj2 = input.LT(num);
					while (obj2 != null)
					{
						IToken token2 = treeAdaptor.GetToken(obj2);
						if (token2 != null && token2.Line > 0)
						{
							_line = token2.Line;
							_charPositionInLine = token2.CharPositionInLine;
							_approximateLineInfo = true;
							break;
						}
						num--;
						try
						{
							obj2 = input.LT(num);
						}
						catch (NotSupportedException)
						{
							obj2 = null;
						}
					}
				}
				else
				{
					_line = token.Line;
					_charPositionInLine = token.CharPositionInLine;
				}
			}
			else if (_node is ITree)
			{
				_line = ((ITree)_node).Line;
				_charPositionInLine = ((ITree)_node).CharPositionInLine;
				if (_node is CommonTree)
				{
					_token = ((CommonTree)_node).Token;
				}
			}
			else
			{
				int type = treeAdaptor.GetType(_node);
				string text = treeAdaptor.GetText(_node);
				_token = new CommonToken(type, text);
			}
		}

		protected virtual void ExtractInformationFromTreeNodeStream(ITreeNodeStream input, int k)
		{
			int marker = input.Mark();
			try
			{
				for (int i = 0; i < k - 1; i++)
				{
					input.Consume();
				}
				ExtractInformationFromTreeNodeStream(input);
			}
			finally
			{
				input.Rewind(marker);
			}
		}
	}
	public class RecognizerSharedState
	{
		public BitSet[] following;

		[CLSCompliant(false)]
		public int _fsp;

		public bool errorRecovery;

		public int lastErrorIndex;

		public bool failed;

		public int syntaxErrors;

		public int backtracking;

		public IDictionary<int, int>[] ruleMemo;

		public IToken token;

		public int tokenStartCharIndex;

		public int tokenStartLine;

		public int tokenStartCharPositionInLine;

		public int channel;

		public int type;

		public string text;

		public RecognizerSharedState()
		{
			following = new BitSet[100];
			_fsp = -1;
			lastErrorIndex = -1;
			tokenStartCharIndex = -1;
		}

		public RecognizerSharedState(RecognizerSharedState state)
		{
			if (state == null)
			{
				throw new ArgumentNullException("state");
			}
			following = (BitSet[])state.following.Clone();
			_fsp = state._fsp;
			errorRecovery = state.errorRecovery;
			lastErrorIndex = state.lastErrorIndex;
			failed = state.failed;
			syntaxErrors = state.syntaxErrors;
			backtracking = state.backtracking;
			if (state.ruleMemo != null)
			{
				ruleMemo = (IDictionary<int, int>[])state.ruleMemo.Clone();
			}
			token = state.token;
			tokenStartCharIndex = state.tokenStartCharIndex;
			tokenStartCharPositionInLine = state.tokenStartCharPositionInLine;
			channel = state.channel;
			type = state.type;
			text = state.text;
		}
	}
	public class TemplateParserRuleReturnScope<TTemplate, TToken> : ParserRuleReturnScope<TToken>, ITemplateRuleReturnScope<TTemplate>, ITemplateRuleReturnScope
	{
		private TTemplate _template;

		public TTemplate Template
		{
			get
			{
				return _template;
			}
			set
			{
				_template = value;
			}
		}

		object ITemplateRuleReturnScope.Template => Template;
	}
	public static class TokenChannels
	{
		public const int Default = 0;

		public const int Hidden = 99;
	}
	[Serializable]
	[DebuggerDisplay("TODO: TokenRewriteStream debugger display")]
	public class TokenRewriteStream : CommonTokenStream
	{
		protected class RewriteOperation
		{
			public int instructionIndex;

			public int index;

			public object text;

			protected TokenRewriteStream stream;

			protected RewriteOperation(TokenRewriteStream stream, int index)
			{
				this.stream = stream;
				this.index = index;
			}

			protected RewriteOperation(TokenRewriteStream stream, int index, object text)
			{
				this.index = index;
				this.text = text;
				this.stream = stream;
			}

			public virtual int Execute(StringBuilder buf)
			{
				return index;
			}

			public override string ToString()
			{
				string name = GetType().Name;
				int num = name.IndexOf('$');
				name = name.Substring(num + 1);
				return $"<{name}@{stream._tokens[index]}:\"{text}\">";
			}
		}

		private class InsertBeforeOp : RewriteOperation
		{
			public InsertBeforeOp(TokenRewriteStream stream, int index, object text)
				: base(stream, index, text)
			{
			}

			public override int Execute(StringBuilder buf)
			{
				buf.Append(text);
				if (stream._tokens[index].Type != -1)
				{
					buf.Append(stream._tokens[index].Text);
				}
				return index + 1;
			}
		}

		private class ReplaceOp : RewriteOperation
		{
			public int lastIndex;

			public ReplaceOp(TokenRewriteStream stream, int from, int to, object text)
				: base(stream, from, text)
			{
				lastIndex = to;
			}

			public override int Execute(StringBuilder buf)
			{
				if (text != null)
				{
					buf.Append(text);
				}
				return lastIndex + 1;
			}

			public override string ToString()
			{
				if (text == null)
				{
					return $"<DeleteOp@{stream._tokens[index]}..{stream._tokens[lastIndex]}>";
				}
				return $"<ReplaceOp@{stream._tokens[index]}..{stream._tokens[lastIndex]}:\"{text}\">";
			}
		}

		public const string DEFAULT_PROGRAM_NAME = "default";

		public const int PROGRAM_INIT_SIZE = 100;

		public const int MIN_TOKEN_INDEX = 0;

		protected IDictionary<string, IList<RewriteOperation>> programs;

		protected IDictionary<string, int> lastRewriteTokenIndexes;

		public TokenRewriteStream()
		{
			Init();
		}

		protected void Init()
		{
			programs = new Dictionary<string, IList<RewriteOperation>>();
			programs["default"] = new List<RewriteOperation>(100);
			lastRewriteTokenIndexes = new Dictionary<string, int>();
		}

		public TokenRewriteStream(ITokenSource tokenSource)
			: base(tokenSource)
		{
			Init();
		}

		public TokenRewriteStream(ITokenSource tokenSource, int channel)
			: base(tokenSource, channel)
		{
			Init();
		}

		public virtual void Rollback(int instructionIndex)
		{
			Rollback("default", instructionIndex);
		}

		public virtual void Rollback(string programName, int instructionIndex)
		{
			if (programs.TryGetValue(programName, out var value) && value != null)
			{
				List<RewriteOperation> list = new List<RewriteOperation>();
				for (int i = 0; i <= instructionIndex; i++)
				{
					list.Add(value[i]);
				}
				programs[programName] = list;
			}
		}

		public virtual void DeleteProgram()
		{
			DeleteProgram("default");
		}

		public virtual void DeleteProgram(string programName)
		{
			Rollback(programName, 0);
		}

		public virtual void InsertAfter(IToken t, object text)
		{
			InsertAfter("default", t, text);
		}

		public virtual void InsertAfter(int index, object text)
		{
			InsertAfter("default", index, text);
		}

		public virtual void InsertAfter(string programName, IToken t, object text)
		{
			InsertAfter(programName, t.TokenIndex, text);
		}

		public virtual void InsertAfter(string programName, int index, object text)
		{
			InsertBefore(programName, index + 1, text);
		}

		public virtual void InsertBefore(IToken t, object text)
		{
			InsertBefore("default", t, text);
		}

		public virtual void InsertBefore(int index, object text)
		{
			InsertBefore("default", index, text);
		}

		public virtual void InsertBefore(string programName, IToken t, object text)
		{
			InsertBefore(programName, t.TokenIndex, text);
		}

		public virtual void InsertBefore(string programName, int index, object text)
		{
			RewriteOperation rewriteOperation = new InsertBeforeOp(this, index, text);
			IList<RewriteOperation> program = GetProgram(programName);
			rewriteOperation.instructionIndex = program.Count;
			program.Add(rewriteOperation);
		}

		public virtual void Replace(int index, object text)
		{
			Replace("default", index, index, text);
		}

		public virtual void Replace(int from, int to, object text)
		{
			Replace("default", from, to, text);
		}

		public virtual void Replace(IToken indexT, object text)
		{
			Replace("default", indexT, indexT, text);
		}

		public virtual void Replace(IToken from, IToken to, object text)
		{
			Replace("default", from, to, text);
		}

		public virtual void Replace(string programName, int from, int to, object text)
		{
			if (from > to || from < 0 || to < 0 || to >= _tokens.Count)
			{
				throw new ArgumentException("replace: range invalid: " + from + ".." + to + "(size=" + _tokens.Count + ")");
			}
			RewriteOperation rewriteOperation = new ReplaceOp(this, from, to, text);
			IList<RewriteOperation> program = GetProgram(programName);
			rewriteOperation.instructionIndex = program.Count;
			program.Add(rewriteOperation);
		}

		public virtual void Replace(string programName, IToken from, IToken to, object text)
		{
			Replace(programName, from.TokenIndex, to.TokenIndex, text);
		}

		public virtual void Delete(int index)
		{
			Delete("default", index, index);
		}

		public virtual void Delete(int from, int to)
		{
			Delete("default", from, to);
		}

		public virtual void Delete(IToken indexT)
		{
			Delete("default", indexT, indexT);
		}

		public virtual void Delete(IToken from, IToken to)
		{
			Delete("default", from, to);
		}

		public virtual void Delete(string programName, int from, int to)
		{
			Replace(programName, from, to, null);
		}

		public virtual void Delete(string programName, IToken from, IToken to)
		{
			Replace(programName, from, to, null);
		}

		public virtual int GetLastRewriteTokenIndex()
		{
			return GetLastRewriteTokenIndex("default");
		}

		protected virtual int GetLastRewriteTokenIndex(string programName)
		{
			if (lastRewriteTokenIndexes.TryGetValue(programName, out var value))
			{
				return value;
			}
			return -1;
		}

		protected virtual void SetLastRewriteTokenIndex(string programName, int i)
		{
			lastRewriteTokenIndexes[programName] = i;
		}

		protected virtual IList<RewriteOperation> GetProgram(string name)
		{
			if (!programs.TryGetValue(name, out var value) || value == null)
			{
				return InitializeProgram(name);
			}
			return value;
		}

		private IList<RewriteOperation> InitializeProgram(string name)
		{
			IList<RewriteOperation> list = new List<RewriteOperation>(100);
			programs[name] = list;
			return list;
		}

		public virtual string ToOriginalString()
		{
			Fill();
			return ToOriginalString(0, Count - 1);
		}

		public virtual string ToOriginalString(int start, int end)
		{
			StringBuilder stringBuilder = new StringBuilder();
			for (int i = start; i >= 0 && i <= end && i < _tokens.Count; i++)
			{
				if (Get(i).Type != -1)
				{
					stringBuilder.Append(Get(i).Text);
				}
			}
			return stringBuilder.ToString();
		}

		public override string ToString()
		{
			Fill();
			return ToString(0, Count - 1);
		}

		public virtual string ToString(string programName)
		{
			Fill();
			return ToString(programName, 0, Count - 1);
		}

		public override string ToString(int start, int end)
		{
			return ToString("default", start, end);
		}

		public virtual string ToString(string programName, int start, int end)
		{
			if (!programs.TryGetValue(programName, out var value))
			{
				value = null;
			}
			if (end > _tokens.Count - 1)
			{
				end = _tokens.Count - 1;
			}
			if (start < 0)
			{
				start = 0;
			}
			if (value == null || value.Count == 0)
			{
				return ToOriginalString(start, end);
			}
			StringBuilder stringBuilder = new StringBuilder();
			IDictionary<int, RewriteOperation> dictionary = ReduceToSingleOperationPerIndex(value);
			int num = start;
			while (num <= end && num < _tokens.Count)
			{
				RewriteOperation value2;
				bool num2 = dictionary.TryGetValue(num, out value2);
				if (num2)
				{
					dictionary.Remove(num);
				}
				if (!num2 || value2 == null)
				{
					IToken token = _tokens[num];
					if (token.Type != -1)
					{
						stringBuilder.Append(token.Text);
					}
					num++;
				}
				else
				{
					num = value2.Execute(stringBuilder);
				}
			}
			if (end == _tokens.Count - 1)
			{
				foreach (RewriteOperation value3 in dictionary.Values)
				{
					if (value3.index >= _tokens.Count - 1)
					{
						stringBuilder.Append(value3.text);
					}
				}
			}
			return stringBuilder.ToString();
		}

		protected virtual IDictionary<int, RewriteOperation> ReduceToSingleOperationPerIndex(IList<RewriteOperation> rewrites)
		{
			for (int i = 0; i < rewrites.Count; i++)
			{
				RewriteOperation rewriteOperation = rewrites[i];
				if (rewriteOperation == null || !(rewriteOperation is ReplaceOp))
				{
					continue;
				}
				ReplaceOp replaceOp = (ReplaceOp)rewrites[i];
				IList<RewriteOperation> kindOfOps = GetKindOfOps(rewrites, typeof(InsertBeforeOp), i);
				for (int j = 0; j < kindOfOps.Count; j++)
				{
					InsertBeforeOp insertBeforeOp = (InsertBeforeOp)kindOfOps[j];
					if (insertBeforeOp.index == replaceOp.index)
					{
						rewrites[insertBeforeOp.instructionIndex] = null;
						replaceOp.text = insertBeforeOp.text.ToString() + ((replaceOp.text != null) ? replaceOp.text.ToString() : string.Empty);
					}
					else if (insertBeforeOp.index > replaceOp.index && insertBeforeOp.index <= replaceOp.lastIndex)
					{
						rewrites[insertBeforeOp.instructionIndex] = null;
					}
				}
				IList<RewriteOperation> kindOfOps2 = GetKindOfOps(rewrites, typeof(ReplaceOp), i);
				for (int k = 0; k < kindOfOps2.Count; k++)
				{
					ReplaceOp replaceOp2 = (ReplaceOp)kindOfOps2[k];
					if (replaceOp2.index >= replaceOp.index && replaceOp2.lastIndex <= replaceOp.lastIndex)
					{
						rewrites[replaceOp2.instructionIndex] = null;
						continue;
					}
					bool flag = replaceOp2.lastIndex < replaceOp.index || replaceOp2.index > replaceOp.lastIndex;
					bool flag2 = replaceOp2.index == replaceOp.index && replaceOp2.lastIndex == replaceOp.lastIndex;
					if (replaceOp2.text == null && replaceOp.text == null && !flag)
					{
						rewrites[replaceOp2.instructionIndex] = null;
						replaceOp.index = Math.Min(replaceOp2.index, replaceOp.index);
						replaceOp.lastIndex = Math.Max(replaceOp2.lastIndex, replaceOp.lastIndex);
						Console.WriteLine("new rop " + replaceOp);
					}
					else if (!flag && !flag2)
					{
						throw new ArgumentException(string.Concat("replace op boundaries of ", replaceOp, " overlap with previous ", replaceOp2));
					}
				}
			}
			for (int l = 0; l < rewrites.Count; l++)
			{
				RewriteOperation rewriteOperation2 = rewrites[l];
				if (rewriteOperation2 == null || !(rewriteOperation2 is InsertBeforeOp))
				{
					continue;
				}
				InsertBeforeOp insertBeforeOp2 = (InsertBeforeOp)rewrites[l];
				IList<RewriteOperation> kindOfOps3 = GetKindOfOps(rewrites, typeof(InsertBeforeOp), l);
				for (int m = 0; m < kindOfOps3.Count; m++)
				{
					InsertBeforeOp insertBeforeOp3 = (InsertBeforeOp)kindOfOps3[m];
					if (insertBeforeOp3.index == insertBeforeOp2.index)
					{
						insertBeforeOp2.text = CatOpText(insertBeforeOp2.text, insertBeforeOp3.text);
						rewrites[insertBeforeOp3.instructionIndex] = null;
					}
				}
				IList<RewriteOperation> kindOfOps4 = GetKindOfOps(rewrites, typeof(ReplaceOp), l);
				for (int n = 0; n < kindOfOps4.Count; n++)
				{
					ReplaceOp replaceOp3 = (ReplaceOp)kindOfOps4[n];
					if (insertBeforeOp2.index == replaceOp3.index)
					{
						replaceOp3.text = CatOpText(insertBeforeOp2.text, replaceOp3.text);
						rewrites[l] = null;
					}
					else if (insertBeforeOp2.index >= replaceOp3.index && insertBeforeOp2.index <= replaceOp3.lastIndex)
					{
						throw new ArgumentException(string.Concat("insert op ", insertBeforeOp2, " within boundaries of previous ", replaceOp3));
					}
				}
			}
			IDictionary<int, RewriteOperation> dictionary = new Dictionary<int, RewriteOperation>();
			for (int num = 0; num < rewrites.Count; num++)
			{
				RewriteOperation rewriteOperation3 = rewrites[num];
				if (rewriteOperation3 != null)
				{
					if (dictionary.TryGetValue(rewriteOperation3.index, out var value) && value != null)
					{
						throw new Exception("should only be one op per index");
					}
					dictionary[rewriteOperation3.index] = rewriteOperation3;
				}
			}
			return dictionary;
		}

		protected virtual string CatOpText(object a, object b)
		{
			return string.Concat(a, b);
		}

		protected virtual IList<RewriteOperation> GetKindOfOps(IList<RewriteOperation> rewrites, Type kind)
		{
			return GetKindOfOps(rewrites, kind, rewrites.Count);
		}

		protected virtual IList<RewriteOperation> GetKindOfOps(IList<RewriteOperation> rewrites, Type kind, int before)
		{
			IList<RewriteOperation> list = new List<RewriteOperation>();
			for (int i = 0; i < before && i < rewrites.Count; i++)
			{
				RewriteOperation rewriteOperation = rewrites[i];
				if (rewriteOperation != null && (object)rewriteOperation.GetType() == kind)
				{
					list.Add(rewriteOperation);
				}
			}
			return list;
		}

		public virtual string ToDebugString()
		{
			return ToDebugString(0, Count - 1);
		}

		public virtual string ToDebugString(int start, int end)
		{
			StringBuilder stringBuilder = new StringBuilder();
			for (int i = start; i >= 0 && i <= end && i < _tokens.Count; i++)
			{
				stringBuilder.Append(Get(i));
			}
			return stringBuilder.ToString();
		}
	}
	public static class Tokens
	{
		public static readonly IToken Skip = new CommonToken(0);
	}
	public static class TokenTypes
	{
		public const int EndOfFile = -1;

		public const int Invalid = 0;

		public const int EndOfRule = 1;

		public const int Down = 2;

		public const int Up = 3;

		public const int Min = 4;
	}
	public class UnbufferedTokenStream : LookaheadStream<IToken>, ITokenStream, IIntStream, ITokenStreamInformation
	{
		[CLSCompliant(false)]
		protected ITokenSource tokenSource;

		protected int tokenIndex;

		protected int channel;

		private readonly ListStack<IToken> _realTokens = new ListStack<IToken> { null };

		public ITokenSource TokenSource => tokenSource;

		public string SourceName => TokenSource.SourceName;

		public IToken LastToken => LB(1);

		public IToken LastRealToken => _realTokens.Peek();

		public int MaxLookBehind => 1;

		public UnbufferedTokenStream(ITokenSource tokenSource)
		{
			this.tokenSource = tokenSource;
		}

		public override int Mark()
		{
			_realTokens.Push(_realTokens.Peek());
			return base.Mark();
		}

		public override void Release(int marker)
		{
			base.Release(marker);
			_realTokens.Pop();
		}

		public override void Clear()
		{
			_realTokens.Clear();
			_realTokens.Push(null);
		}

		public override void Consume()
		{
			base.Consume();
			if (base.PreviousElement != null && base.PreviousElement.Line > 0)
			{
				_realTokens[_realTokens.Count - 1] = base.PreviousElement;
			}
		}

		public override IToken NextElement()
		{
			IToken token = tokenSource.NextToken();
			token.TokenIndex = tokenIndex++;
			return token;
		}

		public override bool IsEndOfFile(IToken o)
		{
			return o.Type == -1;
		}

		public IToken Get(int i)
		{
			throw new NotSupportedException("Absolute token indexes are meaningless in an unbuffered stream");
		}

		public int LA(int i)
		{
			return LT(i).Type;
		}

		public string ToString(int start, int stop)
		{
			return "n/a";
		}

		public string ToString(IToken start, IToken stop)
		{
			return "n/a";
		}
	}
	[Serializable]
	public class UnwantedTokenException : MismatchedTokenException
	{
		public virtual IToken UnexpectedToken => base.Token;

		public UnwantedTokenException()
		{
		}

		public UnwantedTokenException(string message)
			: base(message)
		{
		}

		public UnwantedTokenException(string message, Exception innerException)
			: base(message, innerException)
		{
		}

		public UnwantedTokenException(int expecting, IIntStream input)
			: base(expecting, input)
		{
		}

		public UnwantedTokenException(int expecting, IIntStream input, IList<string> tokenNames)
			: base(expecting, input, tokenNames)
		{
		}

		public UnwantedTokenException(string message, int expecting, IIntStream input, IList<string> tokenNames)
			: base(message, expecting, input, tokenNames)
		{
		}

		public UnwantedTokenException(string message, int expecting, IIntStream input, IList<string> tokenNames, Exception innerException)
			: base(message, expecting, input, tokenNames, innerE

plugins/MADH95Mods-JSONCardLoader/plugins/Libs/NCalc.dll

Decompiled 5 months ago
using System;
using System.CodeDom.Compiler;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.Diagnostics.CodeAnalysis;
using System.Globalization;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Text;
using System.Threading;
using Antlr.Runtime;
using Antlr.Runtime.Tree;
using NCalc.Domain;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: AssemblyFileVersion("3.5.0.4")]
[assembly: AssemblyInformationalVersion("3.5.0+cbc3cfcd0b")]
[assembly: TargetFramework(".NETStandard,Version=v2.0", FrameworkDisplayName = "")]
[assembly: AssemblyCompany("https://github.com/ncalc")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyCopyright("Sebastien Ros and contributors")]
[assembly: AssemblyDescription("NCalc is a mathematical expressions evaluator in .NET. NCalc can parse any expression and evaluate the result, including static or dynamic parameters and custom functions. This version targets .NET Standard 2.0 framework.")]
[assembly: AssemblyProduct("NCalc")]
[assembly: AssemblyTitle("NCalc")]
[assembly: AssemblyMetadata("RepositoryUrl", "https://github.com/ncalc/ncalc.git")]
[assembly: AssemblyVersion("3.5.0.0")]
[GeneratedCode("Nerdbank.GitVersioning.Tasks", "3.4.244.2758")]
[ExcludeFromCodeCoverage]
internal static class ThisAssembly
{
	internal const string AssemblyConfiguration = "Release";

	internal const string AssemblyFileVersion = "3.5.0.4";

	internal const string AssemblyInformationalVersion = "3.5.0+cbc3cfcd0b";

	internal const string AssemblyName = "NCalc";

	internal const string AssemblyTitle = "NCalc";

	internal const string AssemblyVersion = "3.5.0.0";

	internal static readonly DateTime GitCommitDate = new DateTime(637904536960000000L, DateTimeKind.Utc);

	internal const string GitCommitId = "cbc3cfcd0b440d3378cde3ecdf0183064ab15f85";

	internal const bool IsPrerelease = false;

	internal const bool IsPublicRelease = true;

	internal const string RootNamespace = "NCalc";
}
namespace NCalc
{
	public delegate void EvaluateFunctionHandler(string name, FunctionArgs args);
	public delegate void EvaluateParameterHandler(string name, ParameterArgs args);
	public class EvaluationException : ApplicationException
	{
		public EvaluationException(string message)
			: base(message)
		{
		}

		public EvaluationException(string message, Exception innerException)
			: base(message, innerException)
		{
		}
	}
	[Flags]
	public enum EvaluateOptions
	{
		None = 1,
		IgnoreCase = 2,
		NoCache = 4,
		IterateParameters = 8,
		RoundAwayFromZero = 0x10
	}
	public class Expression
	{
		protected string OriginalExpression;

		protected CultureInfo CultureInfo;

		private static bool _cacheEnabled = true;

		private static Dictionary<string, WeakReference> _compiledExpressions = new Dictionary<string, WeakReference>();

		private static readonly ReaderWriterLock Rwl = new ReaderWriterLock();

		protected Dictionary<string, IEnumerator> ParameterEnumerators;

		protected Dictionary<string, object> ParametersBackup;

		private Dictionary<string, object> _parameters;

		public EvaluateOptions Options { get; set; }

		public static bool CacheEnabled
		{
			get
			{
				return _cacheEnabled;
			}
			set
			{
				_cacheEnabled = value;
				if (!CacheEnabled)
				{
					_compiledExpressions = new Dictionary<string, WeakReference>();
				}
			}
		}

		public string Error { get; private set; }

		public LogicalExpression ParsedExpression { get; private set; }

		public Dictionary<string, object> Parameters
		{
			get
			{
				return _parameters ?? (_parameters = new Dictionary<string, object>());
			}
			set
			{
				_parameters = value;
			}
		}

		public event EvaluateFunctionHandler EvaluateFunction;

		public event EvaluateParameterHandler EvaluateParameter;

		public Expression(string expression)
			: this(expression, EvaluateOptions.None, CultureInfo.CurrentCulture)
		{
		}

		public Expression(string expression, CultureInfo cultureInfo)
			: this(expression, EvaluateOptions.None, cultureInfo)
		{
		}

		public Expression(string expression, EvaluateOptions options)
			: this(expression, options, CultureInfo.CurrentCulture)
		{
		}

		public Expression(string expression, EvaluateOptions options, CultureInfo cultureInfo)
		{
			if (string.IsNullOrEmpty(expression))
			{
				throw new ArgumentException("Expression can't be empty", "expression");
			}
			OriginalExpression = expression;
			Options = options;
			CultureInfo = cultureInfo;
		}

		public Expression(LogicalExpression expression)
			: this(expression, EvaluateOptions.None, CultureInfo.CurrentCulture)
		{
		}

		public Expression(LogicalExpression expression, EvaluateOptions options, CultureInfo cultureInfo)
		{
			if (expression == null)
			{
				throw new ArgumentException("Expression can't be null", "expression");
			}
			ParsedExpression = expression;
			Options = options;
			CultureInfo = cultureInfo;
		}

		private static void CleanCache()
		{
			List<string> list = new List<string>();
			try
			{
				Rwl.AcquireWriterLock(-1);
				foreach (KeyValuePair<string, WeakReference> compiledExpression in _compiledExpressions)
				{
					if (!compiledExpression.Value.IsAlive)
					{
						list.Add(compiledExpression.Key);
					}
				}
				foreach (string item in list)
				{
					_compiledExpressions.Remove(item);
				}
			}
			finally
			{
				Rwl.ReleaseReaderLock();
			}
		}

		public static LogicalExpression Compile(string expression, bool nocache)
		{
			//IL_0060: Unknown result type (might be due to invalid IL or missing references)
			//IL_006a: Expected O, but got Unknown
			//IL_006a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0074: Expected O, but got Unknown
			LogicalExpression logicalExpression = null;
			if (_cacheEnabled && !nocache)
			{
				try
				{
					Rwl.AcquireReaderLock(-1);
					if (_compiledExpressions.ContainsKey(expression))
					{
						WeakReference weakReference = _compiledExpressions[expression];
						logicalExpression = weakReference.Target as LogicalExpression;
						if (weakReference.IsAlive && logicalExpression != null)
						{
							return logicalExpression;
						}
					}
				}
				finally
				{
					Rwl.ReleaseReaderLock();
				}
			}
			if (logicalExpression == null)
			{
				NCalcParser nCalcParser = new NCalcParser((ITokenStream)new CommonTokenStream((ITokenSource)(object)new NCalcLexer((ICharStream)new ANTLRStringStream(expression))));
				logicalExpression = nCalcParser.GetExpression();
				if (nCalcParser.Errors != null && nCalcParser.Errors.Count > 0)
				{
					throw new EvaluationException(string.Join(Environment.NewLine, nCalcParser.Errors.ToArray()));
				}
				if (_cacheEnabled && !nocache)
				{
					try
					{
						Rwl.AcquireWriterLock(-1);
						_compiledExpressions[expression] = new WeakReference(logicalExpression);
					}
					finally
					{
						Rwl.ReleaseWriterLock();
					}
					CleanCache();
				}
			}
			return logicalExpression;
		}

		public bool HasErrors()
		{
			try
			{
				if (ParsedExpression == null)
				{
					ParsedExpression = Compile(OriginalExpression, (Options & EvaluateOptions.NoCache) == EvaluateOptions.NoCache);
				}
				return ParsedExpression != null && Error != null;
			}
			catch (Exception ex)
			{
				Error = ex.Message;
				return true;
			}
		}

		public object Evaluate()
		{
			if (HasErrors())
			{
				throw new EvaluationException(Error);
			}
			if (ParsedExpression == null)
			{
				ParsedExpression = Compile(OriginalExpression, (Options & EvaluateOptions.NoCache) == EvaluateOptions.NoCache);
			}
			EvaluationVisitor evaluationVisitor = new EvaluationVisitor(Options, CultureInfo);
			evaluationVisitor.EvaluateFunction += this.EvaluateFunction;
			evaluationVisitor.EvaluateParameter += this.EvaluateParameter;
			evaluationVisitor.Parameters = Parameters;
			if ((Options & EvaluateOptions.IterateParameters) == EvaluateOptions.IterateParameters)
			{
				int num = -1;
				ParametersBackup = new Dictionary<string, object>();
				foreach (string key in Parameters.Keys)
				{
					ParametersBackup.Add(key, Parameters[key]);
				}
				ParameterEnumerators = new Dictionary<string, IEnumerator>();
				foreach (object value in Parameters.Values)
				{
					if (!(value is IEnumerable))
					{
						continue;
					}
					int num2 = 0;
					foreach (object item in (IEnumerable)value)
					{
						_ = item;
						num2++;
					}
					if (num == -1)
					{
						num = num2;
					}
					else if (num2 != num)
					{
						throw new EvaluationException("When IterateParameters option is used, IEnumerable parameters must have the same number of items");
					}
				}
				foreach (string key2 in Parameters.Keys)
				{
					if (Parameters[key2] is IEnumerable enumerable)
					{
						ParameterEnumerators.Add(key2, enumerable.GetEnumerator());
					}
				}
				List<object> list = new List<object>();
				for (int i = 0; i < num; i++)
				{
					foreach (string key3 in ParameterEnumerators.Keys)
					{
						IEnumerator enumerator5 = ParameterEnumerators[key3];
						enumerator5.MoveNext();
						Parameters[key3] = enumerator5.Current;
					}
					ParsedExpression.Accept(evaluationVisitor);
					list.Add(evaluationVisitor.Result);
				}
				return list;
			}
			ParsedExpression.Accept(evaluationVisitor);
			return evaluationVisitor.Result;
		}
	}
	public class FunctionArgs : EventArgs
	{
		private object _result;

		private Expression[] _parameters = new Expression[0];

		public object Result
		{
			get
			{
				return _result;
			}
			set
			{
				_result = value;
				HasResult = true;
			}
		}

		public bool HasResult { get; set; }

		public Expression[] Parameters
		{
			get
			{
				return _parameters;
			}
			set
			{
				_parameters = value;
			}
		}

		public object[] EvaluateParameters()
		{
			object[] array = new object[_parameters.Length];
			for (int i = 0; i < array.Length; i++)
			{
				array[i] = _parameters[i].Evaluate();
			}
			return array;
		}
	}
	[GeneratedCode("ANTLR", "3.5.0.2")]
	[CLSCompliant(false)]
	public class NCalcLexer : Lexer
	{
		private class DFA10 : DFA
		{
			private const string DFA10_eotS = "\u0003\uffff\u0001\u0006\u0003\uffff";

			private const string DFA10_eofS = "\a\uffff";

			private const string DFA10_minS = "\u0002.\u0001\uffff\u00010\u0003\uffff";

			private const string DFA10_maxS = "\u00019\u0001e\u0001\uffff\u00019\u0003\uffff";

			private const string DFA10_acceptS = "\u0002\uffff\u0001\u0001\u0001\uffff\u0001\u0003\u0001\u0001\u0001\u0002";

			private const string DFA10_specialS = "\a\uffff}>";

			private static readonly string[] DFA10_transitionS;

			private static readonly short[] DFA10_eot;

			private static readonly short[] DFA10_eof;

			private static readonly char[] DFA10_min;

			private static readonly char[] DFA10_max;

			private static readonly short[] DFA10_accept;

			private static readonly short[] DFA10_special;

			private static readonly short[][] DFA10_transition;

			public override string Description => "262:1: FLOAT : ( ( DIGIT )* '.' ( DIGIT )+ ( EXPONENT )? | ( DIGIT )+ '.' ( DIGIT )* ( EXPONENT )? | ( DIGIT )+ EXPONENT );";

			static DFA10()
			{
				DFA10_transitionS = new string[7] { "\u0001\u0002\u0001\uffff\n\u0001", "\u0001\u0003\u0001\uffff\n\u0001\v\uffff\u0001\u0004\u001f\uffff\u0001\u0004", "", "\n\u0005", "", "", "" };
				DFA10_eot = DFA.UnpackEncodedString("\u0003\uffff\u0001\u0006\u0003\uffff");
				DFA10_eof = DFA.UnpackEncodedString("\a\uffff");
				DFA10_min = DFA.UnpackEncodedStringToUnsignedChars("\u0002.\u0001\uffff\u00010\u0003\uffff");
				DFA10_max = DFA.UnpackEncodedStringToUnsignedChars("\u00019\u0001e\u0001\uffff\u00019\u0003\uffff");
				DFA10_accept = DFA.UnpackEncodedString("\u0002\uffff\u0001\u0001\u0001\uffff\u0001\u0003\u0001\u0001\u0001\u0002");
				DFA10_special = DFA.UnpackEncodedString("\a\uffff}>");
				int num = DFA10_transitionS.Length;
				DFA10_transition = new short[num][];
				for (int i = 0; i < num; i++)
				{
					DFA10_transition[i] = DFA.UnpackEncodedString(DFA10_transitionS[i]);
				}
			}

			public DFA10(BaseRecognizer recognizer)
			{
				base.recognizer = recognizer;
				base.decisionNumber = 10;
				base.eot = DFA10_eot;
				base.eof = DFA10_eof;
				base.min = DFA10_min;
				base.max = DFA10_max;
				base.accept = DFA10_accept;
				base.special = DFA10_special;
				base.transition = DFA10_transition;
			}

			public override void Error(NoViableAltException nvae)
			{
			}
		}

		private class DFA17 : DFA
		{
			private const string DFA17_eotS = "\u0001\uffff\u0001!\u0001\uffff\u0001#\u0002\uffff\u0001%\u0005\uffff\u0001)\u0001+\u0001.\u0002\uffff\u00010\u0001\uffff\u0006\u001e\u00018\u0017\uffff\u0003\u001e\u0001<\u0002\u001e\u0002\uffff\u0002\u001e\u0001@\u0001\uffff\u0001A\u0001B\u0001\u001e\u0003\uffff\u0001D\u0001\uffff";

			private const string DFA17_eofS = "E\uffff";

			private const string DFA17_minS = "\u0001\t\u0001=\u0001\uffff\u0001&\u0002\uffff\u0001*\u0005\uffff\u0001<\u0002=\u0002\uffff\u0001|\u0001\uffff\u0001R\u0001A\u0001N\u0001R\u0001O\u0001+\u0001.\u0017\uffff\u0001U\u0001L\u0001D\u00010\u0001T\u00010\u0002\uffff\u0001E\u0001S\u00010\u0001\uffff\u00020\u0001E\u0003\uffff\u00010\u0001\uffff";

			private const string DFA17_maxS = "\u0001~\u0001=\u0001\uffff\u0001&\u0002\uffff\u0001*\u0005\uffff\u0001>\u0001=\u0001>\u0002\uffff\u0001|\u0001\uffff\u0001r\u0001a\u0001n\u0001r\u0001o\u00019\u0001e\u0017\uffff\u0001u\u0001l\u0001d\u0001z\u0001t\u00019\u0002\uffff\u0001e\u0001s\u0001z\u0001\uffff\u0002z\u0001e\u0003\uffff\u0001z\u0001\uffff";

			private const string DFA17_acceptS = "\u0002\uffff\u0001\u0003\u0001\uffff\u0001\u0006\u0001\a\u0001\uffff\u0001\n\u0001\v\u0001\f\u0001\r\u0001\u000e\u0003\uffff\u0001\u0018\u0001\u0019\u0001\uffff\u0001\u001c\a\uffff\u0001$\u0001%\u0001&\u0001'\u0001\"\u0001)\u0001\u0002\u0001\u0001\u0001\u0004\u0001\u0005\u0001\t\u0001\b\u0001\u0010\u0001\u0011\u0001\u0012\u0001\u000f\u0001\u0014\u0001\u0013\u0001\u0016\u0001\u0017\u0001\u0015\u0001\u001b\u0001\u001a\u0006\uffff\u0001(\u0001#\u0003\uffff\u0001 \u0003\uffff\u0001\u001f\u0001!\u0001\u001d\u0001\uffff\u0001\u001e";

			private const string DFA17_specialS = "E\uffff}>";

			private static readonly string[] DFA17_transitionS;

			private static readonly short[] DFA17_eot;

			private static readonly short[] DFA17_eof;

			private static readonly char[] DFA17_min;

			private static readonly char[] DFA17_max;

			private static readonly short[] DFA17_accept;

			private static readonly short[] DFA17_special;

			private static readonly short[][] DFA17_transition;

			public override string Description => "1:1: Tokens : ( T__48 | T__49 | T__50 | T__51 | T__52 | T__53 | T__54 | T__55 | T__56 | T__57 | T__58 | T__59 | T__60 | T__61 | T__62 | T__63 | T__64 | T__65 | T__66 | T__67 | T__68 | T__69 | T__70 | T__71 | T__72 | T__73 | T__74 | T__75 | TRUE | FALSE | AND | OR | NOT | ID | INTEGER | FLOAT | STRING | DATETIME | NAME | EXPONENT | WS );";

			static DFA17()
			{
				DFA17_transitionS = new string[69]
				{
					"\u0002\u001f\u0001\uffff\u0002\u001f\u0012\uffff\u0001\u001f\u0001\u0001\u0001\uffff\u0001\u001c\u0001\uffff\u0001\u0002\u0001\u0003\u0001\u001b\u0001\u0004\u0001\u0005\u0001\u0006\u0001\a\u0001\b\u0001\t\u0001\u001a\u0001\n\n\u0019\u0001\v\u0001\uffff\u0001\f\u0001\r\u0001\u000e\u0001\u000f\u0001\uffff\u0001\u0015\u0003\u001e\u0001\u0018\u0001\u0014\a\u001e\u0001\u0017\u0001\u0016\u0004\u001e\u0001\u0013\u0006\u001e\u0001\u001d\u0002\uffff\u0001\u0010\u0001\u001e\u0001\uffff\u0001\u0015\u0003\u001e\u0001\u0018\u0001\u0014\a\u001e\u0001\u0017\u0001\u0016\u0004\u001e\u0001\u0013\u0006\u001e\u0001\uffff\u0001\u0011\u0001\uffff\u0001\u0012", "\u0001 ", "", "\u0001\"", "", "", "\u0001$", "", "", "",
					"", "", "\u0001&\u0001'\u0001(", "\u0001*", "\u0001,\u0001-", "", "", "\u0001/", "", "\u00011\u001f\uffff\u00011",
					"\u00012\u001f\uffff\u00012", "\u00013\u001f\uffff\u00013", "\u00014\u001f\uffff\u00014", "\u00015\u001f\uffff\u00015", "\u00017\u0001\uffff\u00017\u0002\uffff\n6", "\u0001\u001a\u0001\uffff\n\u0019\v\uffff\u0001\u001a\u001f\uffff\u0001\u001a", "", "", "", "",
					"", "", "", "", "", "", "", "", "", "",
					"", "", "", "", "", "", "", "", "", "\u00019\u001f\uffff\u00019",
					"\u0001:\u001f\uffff\u0001:", "\u0001;\u001f\uffff\u0001;", "\n\u001e\a\uffff\u001a\u001e\u0004\uffff\u0001\u001e\u0001\uffff\u001a\u001e", "\u0001=\u001f\uffff\u0001=", "\n6", "", "", "\u0001>\u001f\uffff\u0001>", "\u0001?\u001f\uffff\u0001?", "\n\u001e\a\uffff\u001a\u001e\u0004\uffff\u0001\u001e\u0001\uffff\u001a\u001e",
					"", "\n\u001e\a\uffff\u001a\u001e\u0004\uffff\u0001\u001e\u0001\uffff\u001a\u001e", "\n\u001e\a\uffff\u001a\u001e\u0004\uffff\u0001\u001e\u0001\uffff\u001a\u001e", "\u0001C\u001f\uffff\u0001C", "", "", "", "\n\u001e\a\uffff\u001a\u001e\u0004\uffff\u0001\u001e\u0001\uffff\u001a\u001e", ""
				};
				DFA17_eot = DFA.UnpackEncodedString("\u0001\uffff\u0001!\u0001\uffff\u0001#\u0002\uffff\u0001%\u0005\uffff\u0001)\u0001+\u0001.\u0002\uffff\u00010\u0001\uffff\u0006\u001e\u00018\u0017\uffff\u0003\u001e\u0001<\u0002\u001e\u0002\uffff\u0002\u001e\u0001@\u0001\uffff\u0001A\u0001B\u0001\u001e\u0003\uffff\u0001D\u0001\uffff");
				DFA17_eof = DFA.UnpackEncodedString("E\uffff");
				DFA17_min = DFA.UnpackEncodedStringToUnsignedChars("\u0001\t\u0001=\u0001\uffff\u0001&\u0002\uffff\u0001*\u0005\uffff\u0001<\u0002=\u0002\uffff\u0001|\u0001\uffff\u0001R\u0001A\u0001N\u0001R\u0001O\u0001+\u0001.\u0017\uffff\u0001U\u0001L\u0001D\u00010\u0001T\u00010\u0002\uffff\u0001E\u0001S\u00010\u0001\uffff\u00020\u0001E\u0003\uffff\u00010\u0001\uffff");
				DFA17_max = DFA.UnpackEncodedStringToUnsignedChars("\u0001~\u0001=\u0001\uffff\u0001&\u0002\uffff\u0001*\u0005\uffff\u0001>\u0001=\u0001>\u0002\uffff\u0001|\u0001\uffff\u0001r\u0001a\u0001n\u0001r\u0001o\u00019\u0001e\u0017\uffff\u0001u\u0001l\u0001d\u0001z\u0001t\u00019\u0002\uffff\u0001e\u0001s\u0001z\u0001\uffff\u0002z\u0001e\u0003\uffff\u0001z\u0001\uffff");
				DFA17_accept = DFA.UnpackEncodedString("\u0002\uffff\u0001\u0003\u0001\uffff\u0001\u0006\u0001\a\u0001\uffff\u0001\n\u0001\v\u0001\f\u0001\r\u0001\u000e\u0003\uffff\u0001\u0018\u0001\u0019\u0001\uffff\u0001\u001c\a\uffff\u0001$\u0001%\u0001&\u0001'\u0001\"\u0001)\u0001\u0002\u0001\u0001\u0001\u0004\u0001\u0005\u0001\t\u0001\b\u0001\u0010\u0001\u0011\u0001\u0012\u0001\u000f\u0001\u0014\u0001\u0013\u0001\u0016\u0001\u0017\u0001\u0015\u0001\u001b\u0001\u001a\u0006\uffff\u0001(\u0001#\u0003\uffff\u0001 \u0003\uffff\u0001\u001f\u0001!\u0001\u001d\u0001\uffff\u0001\u001e");
				DFA17_special = DFA.UnpackEncodedString("E\uffff}>");
				int num = DFA17_transitionS.Length;
				DFA17_transition = new short[num][];
				for (int i = 0; i < num; i++)
				{
					DFA17_transition[i] = DFA.UnpackEncodedString(DFA17_transitionS[i]);
				}
			}

			public DFA17(BaseRecognizer recognizer)
			{
				base.recognizer = recognizer;
				base.decisionNumber = 17;
				base.eot = DFA17_eot;
				base.eof = DFA17_eof;
				base.min = DFA17_min;
				base.max = DFA17_max;
				base.accept = DFA17_accept;
				base.special = DFA17_special;
				base.transition = DFA17_transition;
			}

			public override void Error(NoViableAltException nvae)
			{
			}
		}

		public const int EOF = -1;

		public const int A = 4;

		public const int AND = 5;

		public const int B = 6;

		public const int C = 7;

		public const int D = 8;

		public const int DATETIME = 9;

		public const int DIGIT = 10;

		public const int E = 11;

		public const int EXPONENT = 12;

		public const int EscapeSequence = 13;

		public const int F = 14;

		public const int FALSE = 15;

		public const int FLOAT = 16;

		public const int G = 17;

		public const int H = 18;

		public const int HexDigit = 19;

		public const int I = 20;

		public const int ID = 21;

		public const int INTEGER = 22;

		public const int J = 23;

		public const int K = 24;

		public const int L = 25;

		public const int LETTER = 26;

		public const int M = 27;

		public const int N = 28;

		public const int NAME = 29;

		public const int NOT = 30;

		public const int O = 31;

		public const int OR = 32;

		public const int P = 33;

		public const int Q = 34;

		public const int R = 35;

		public const int S = 36;

		public const int STRING = 37;

		public const int T = 38;

		public const int TRUE = 39;

		public const int U = 40;

		public const int UnicodeEscape = 41;

		public const int V = 42;

		public const int W = 43;

		public const int WS = 44;

		public const int X = 45;

		public const int Y = 46;

		public const int Z = 47;

		public const int T__48 = 48;

		public const int T__49 = 49;

		public const int T__50 = 50;

		public const int T__51 = 51;

		public const int T__52 = 52;

		public const int T__53 = 53;

		public const int T__54 = 54;

		public const int T__55 = 55;

		public const int T__56 = 56;

		public const int T__57 = 57;

		public const int T__58 = 58;

		public const int T__59 = 59;

		public const int T__60 = 60;

		public const int T__61 = 61;

		public const int T__62 = 62;

		public const int T__63 = 63;

		public const int T__64 = 64;

		public const int T__65 = 65;

		public const int T__66 = 66;

		public const int T__67 = 67;

		public const int T__68 = 68;

		public const int T__69 = 69;

		public const int T__70 = 70;

		public const int T__71 = 71;

		public const int T__72 = 72;

		public const int T__73 = 73;

		public const int T__74 = 74;

		public const int T__75 = 75;

		private DFA10 dfa10;

		private DFA17 dfa17;

		public override string GrammarFileName => "NCalc.g";

		public NCalcLexer()
		{
		}

		public NCalcLexer(ICharStream input)
			: this(input, new RecognizerSharedState())
		{
		}//IL_0002: Unknown result type (might be due to invalid IL or missing references)
		//IL_000c: Expected O, but got Unknown


		public NCalcLexer(ICharStream input, RecognizerSharedState state)
			: base(input, state)
		{
		}

		[GrammarRule("T__48")]
		private void mT__48()
		{
			try
			{
				int type = 48;
				int channel = 0;
				((Lexer)this).Match(33);
				((BaseRecognizer)this).state.type = type;
				((BaseRecognizer)this).state.channel = channel;
			}
			finally
			{
			}
		}

		[GrammarRule("T__49")]
		private void mT__49()
		{
			try
			{
				int type = 49;
				int channel = 0;
				((Lexer)this).Match("!=");
				((BaseRecognizer)this).state.type = type;
				((BaseRecognizer)this).state.channel = channel;
			}
			finally
			{
			}
		}

		[GrammarRule("T__50")]
		private void mT__50()
		{
			try
			{
				int type = 50;
				int channel = 0;
				((Lexer)this).Match(37);
				((BaseRecognizer)this).state.type = type;
				((BaseRecognizer)this).state.channel = channel;
			}
			finally
			{
			}
		}

		[GrammarRule("T__51")]
		private void mT__51()
		{
			try
			{
				int type = 51;
				int channel = 0;
				((Lexer)this).Match("&&");
				((BaseRecognizer)this).state.type = type;
				((BaseRecognizer)this).state.channel = channel;
			}
			finally
			{
			}
		}

		[GrammarRule("T__52")]
		private void mT__52()
		{
			try
			{
				int type = 52;
				int channel = 0;
				((Lexer)this).Match(38);
				((BaseRecognizer)this).state.type = type;
				((BaseRecognizer)this).state.channel = channel;
			}
			finally
			{
			}
		}

		[GrammarRule("T__53")]
		private void mT__53()
		{
			try
			{
				int type = 53;
				int channel = 0;
				((Lexer)this).Match(40);
				((BaseRecognizer)this).state.type = type;
				((BaseRecognizer)this).state.channel = channel;
			}
			finally
			{
			}
		}

		[GrammarRule("T__54")]
		private void mT__54()
		{
			try
			{
				int type = 54;
				int channel = 0;
				((Lexer)this).Match(41);
				((BaseRecognizer)this).state.type = type;
				((BaseRecognizer)this).state.channel = channel;
			}
			finally
			{
			}
		}

		[GrammarRule("T__55")]
		private void mT__55()
		{
			try
			{
				int type = 55;
				int channel = 0;
				((Lexer)this).Match(42);
				((BaseRecognizer)this).state.type = type;
				((BaseRecognizer)this).state.channel = channel;
			}
			finally
			{
			}
		}

		[GrammarRule("T__56")]
		private void mT__56()
		{
			try
			{
				int type = 56;
				int channel = 0;
				((Lexer)this).Match("**");
				((BaseRecognizer)this).state.type = type;
				((BaseRecognizer)this).state.channel = channel;
			}
			finally
			{
			}
		}

		[GrammarRule("T__57")]
		private void mT__57()
		{
			try
			{
				int type = 57;
				int channel = 0;
				((Lexer)this).Match(43);
				((BaseRecognizer)this).state.type = type;
				((BaseRecognizer)this).state.channel = channel;
			}
			finally
			{
			}
		}

		[GrammarRule("T__58")]
		private void mT__58()
		{
			try
			{
				int type = 58;
				int channel = 0;
				((Lexer)this).Match(44);
				((BaseRecognizer)this).state.type = type;
				((BaseRecognizer)this).state.channel = channel;
			}
			finally
			{
			}
		}

		[GrammarRule("T__59")]
		private void mT__59()
		{
			try
			{
				int type = 59;
				int channel = 0;
				((Lexer)this).Match(45);
				((BaseRecognizer)this).state.type = type;
				((BaseRecognizer)this).state.channel = channel;
			}
			finally
			{
			}
		}

		[GrammarRule("T__60")]
		private void mT__60()
		{
			try
			{
				int type = 60;
				int channel = 0;
				((Lexer)this).Match(47);
				((BaseRecognizer)this).state.type = type;
				((BaseRecognizer)this).state.channel = channel;
			}
			finally
			{
			}
		}

		[GrammarRule("T__61")]
		private void mT__61()
		{
			try
			{
				int type = 61;
				int channel = 0;
				((Lexer)this).Match(58);
				((BaseRecognizer)this).state.type = type;
				((BaseRecognizer)this).state.channel = channel;
			}
			finally
			{
			}
		}

		[GrammarRule("T__62")]
		private void mT__62()
		{
			try
			{
				int type = 62;
				int channel = 0;
				((Lexer)this).Match(60);
				((BaseRecognizer)this).state.type = type;
				((BaseRecognizer)this).state.channel = channel;
			}
			finally
			{
			}
		}

		[GrammarRule("T__63")]
		private void mT__63()
		{
			try
			{
				int type = 63;
				int channel = 0;
				((Lexer)this).Match("<<");
				((BaseRecognizer)this).state.type = type;
				((BaseRecognizer)this).state.channel = channel;
			}
			finally
			{
			}
		}

		[GrammarRule("T__64")]
		private void mT__64()
		{
			try
			{
				int type = 64;
				int channel = 0;
				((Lexer)this).Match("<=");
				((BaseRecognizer)this).state.type = type;
				((BaseRecognizer)this).state.channel = channel;
			}
			finally
			{
			}
		}

		[GrammarRule("T__65")]
		private void mT__65()
		{
			try
			{
				int type = 65;
				int channel = 0;
				((Lexer)this).Match("<>");
				((BaseRecognizer)this).state.type = type;
				((BaseRecognizer)this).state.channel = channel;
			}
			finally
			{
			}
		}

		[GrammarRule("T__66")]
		private void mT__66()
		{
			try
			{
				int type = 66;
				int channel = 0;
				((Lexer)this).Match(61);
				((BaseRecognizer)this).state.type = type;
				((BaseRecognizer)this).state.channel = channel;
			}
			finally
			{
			}
		}

		[GrammarRule("T__67")]
		private void mT__67()
		{
			try
			{
				int type = 67;
				int channel = 0;
				((Lexer)this).Match("==");
				((BaseRecognizer)this).state.type = type;
				((BaseRecognizer)this).state.channel = channel;
			}
			finally
			{
			}
		}

		[GrammarRule("T__68")]
		private void mT__68()
		{
			try
			{
				int type = 68;
				int channel = 0;
				((Lexer)this).Match(62);
				((BaseRecognizer)this).state.type = type;
				((BaseRecognizer)this).state.channel = channel;
			}
			finally
			{
			}
		}

		[GrammarRule("T__69")]
		private void mT__69()
		{
			try
			{
				int type = 69;
				int channel = 0;
				((Lexer)this).Match(">=");
				((BaseRecognizer)this).state.type = type;
				((BaseRecognizer)this).state.channel = channel;
			}
			finally
			{
			}
		}

		[GrammarRule("T__70")]
		private void mT__70()
		{
			try
			{
				int type = 70;
				int channel = 0;
				((Lexer)this).Match(">>");
				((BaseRecognizer)this).state.type = type;
				((BaseRecognizer)this).state.channel = channel;
			}
			finally
			{
			}
		}

		[GrammarRule("T__71")]
		private void mT__71()
		{
			try
			{
				int type = 71;
				int channel = 0;
				((Lexer)this).Match(63);
				((BaseRecognizer)this).state.type = type;
				((BaseRecognizer)this).state.channel = channel;
			}
			finally
			{
			}
		}

		[GrammarRule("T__72")]
		private void mT__72()
		{
			try
			{
				int type = 72;
				int channel = 0;
				((Lexer)this).Match(94);
				((BaseRecognizer)this).state.type = type;
				((BaseRecognizer)this).state.channel = channel;
			}
			finally
			{
			}
		}

		[GrammarRule("T__73")]
		private void mT__73()
		{
			try
			{
				int type = 73;
				int channel = 0;
				((Lexer)this).Match(124);
				((BaseRecognizer)this).state.type = type;
				((BaseRecognizer)this).state.channel = channel;
			}
			finally
			{
			}
		}

		[GrammarRule("T__74")]
		private void mT__74()
		{
			try
			{
				int type = 74;
				int channel = 0;
				((Lexer)this).Match("||");
				((BaseRecognizer)this).state.type = type;
				((BaseRecognizer)this).state.channel = channel;
			}
			finally
			{
			}
		}

		[GrammarRule("T__75")]
		private void mT__75()
		{
			try
			{
				int type = 75;
				int channel = 0;
				((Lexer)this).Match(126);
				((BaseRecognizer)this).state.type = type;
				((BaseRecognizer)this).state.channel = channel;
			}
			finally
			{
			}
		}

		[GrammarRule("TRUE")]
		private void mTRUE()
		{
			try
			{
				int type = 39;
				int channel = 0;
				mT();
				mR();
				mU();
				mE();
				((BaseRecognizer)this).state.type = type;
				((BaseRecognizer)this).state.channel = channel;
			}
			finally
			{
			}
		}

		[GrammarRule("FALSE")]
		private void mFALSE()
		{
			try
			{
				int type = 15;
				int channel = 0;
				mF();
				mA();
				mL();
				mS();
				mE();
				((BaseRecognizer)this).state.type = type;
				((BaseRecognizer)this).state.channel = channel;
			}
			finally
			{
			}
		}

		[GrammarRule("AND")]
		private void mAND()
		{
			try
			{
				int type = 5;
				int channel = 0;
				mA();
				mN();
				mD();
				((BaseRecognizer)this).state.type = type;
				((BaseRecognizer)this).state.channel = channel;
			}
			finally
			{
			}
		}

		[GrammarRule("OR")]
		private void mOR()
		{
			try
			{
				int type = 32;
				int channel = 0;
				mO();
				mR();
				((BaseRecognizer)this).state.type = type;
				((BaseRecognizer)this).state.channel = channel;
			}
			finally
			{
			}
		}

		[GrammarRule("NOT")]
		private void mNOT()
		{
			try
			{
				int type = 30;
				int channel = 0;
				mN();
				mO();
				mT();
				((BaseRecognizer)this).state.type = type;
				((BaseRecognizer)this).state.channel = channel;
			}
			finally
			{
			}
		}

		[GrammarRule("ID")]
		private void mID()
		{
			try
			{
				int type = 21;
				int channel = 0;
				mLETTER();
				try
				{
					while (true)
					{
						int num = 2;
						try
						{
							int num2 = ((IIntStream)base.input).LA(1);
							if ((num2 < 48 || num2 > 57) && (num2 < 65 || num2 > 90))
							{
								switch (num2)
								{
								case 95:
								case 97:
								case 98:
								case 99:
								case 100:
								case 101:
								case 102:
								case 103:
								case 104:
								case 105:
								case 106:
								case 107:
								case 108:
								case 109:
								case 110:
								case 111:
								case 112:
								case 113:
								case 114:
								case 115:
								case 116:
								case 117:
								case 118:
								case 119:
								case 120:
								case 121:
								case 122:
									break;
								default:
									goto end_IL_000d;
								}
							}
							num = 1;
							end_IL_000d:;
						}
						finally
						{
						}
						if (num != 1)
						{
							break;
						}
						((IIntStream)base.input).Consume();
					}
				}
				finally
				{
				}
				((BaseRecognizer)this).state.type = type;
				((BaseRecognizer)this).state.channel = channel;
			}
			finally
			{
			}
		}

		[GrammarRule("INTEGER")]
		private void mINTEGER()
		{
			//IL_0046: Unknown result type (might be due to invalid IL or missing references)
			try
			{
				int type = 22;
				int channel = 0;
				int num = 0;
				try
				{
					while (true)
					{
						int num2 = 2;
						try
						{
							int num3 = ((IIntStream)base.input).LA(1);
							if (num3 >= 48 && num3 <= 57)
							{
								num2 = 1;
							}
						}
						finally
						{
						}
						if (num2 != 1)
						{
							break;
						}
						((IIntStream)base.input).Consume();
						num++;
					}
					if (num < 1)
					{
						throw new EarlyExitException(2, (IIntStream)(object)base.input);
					}
				}
				finally
				{
				}
				((BaseRecognizer)this).state.type = type;
				((BaseRecognizer)this).state.channel = channel;
			}
			finally
			{
			}
		}

		[GrammarRule("FLOAT")]
		private void mFLOAT()
		{
			//IL_0149: Unknown result type (might be due to invalid IL or missing references)
			//IL_0212: Unknown result type (might be due to invalid IL or missing references)
			//IL_00bd: Unknown result type (might be due to invalid IL or missing references)
			try
			{
				int type = 16;
				int channel = 0;
				int num = 3;
				try
				{
					num = ((DFA)dfa10).Predict((IIntStream)(object)base.input);
				}
				catch (NoViableAltException)
				{
					throw;
				}
				finally
				{
				}
				switch (num)
				{
				case 1:
				{
					try
					{
						while (true)
						{
							int num5 = 2;
							try
							{
								int num6 = ((IIntStream)base.input).LA(1);
								if (num6 >= 48 && num6 <= 57)
								{
									num5 = 1;
								}
							}
							finally
							{
							}
							if (num5 != 1)
							{
								break;
							}
							((IIntStream)base.input).Consume();
						}
					}
					finally
					{
					}
					((Lexer)this).Match(46);
					int num7 = 0;
					try
					{
						while (true)
						{
							int num8 = 2;
							try
							{
								int num9 = ((IIntStream)base.input).LA(1);
								if (num9 >= 48 && num9 <= 57)
								{
									num8 = 1;
								}
							}
							finally
							{
							}
							if (num8 != 1)
							{
								break;
							}
							((IIntStream)base.input).Consume();
							num7++;
						}
						if (num7 < 1)
						{
							throw new EarlyExitException(4, (IIntStream)(object)base.input);
						}
					}
					finally
					{
					}
					int num10 = 2;
					try
					{
						try
						{
							int num11 = ((IIntStream)base.input).LA(1);
							if (num11 == 69 || num11 == 101)
							{
								num10 = 1;
							}
						}
						finally
						{
						}
						if (num10 == 1)
						{
							mEXPONENT();
						}
					}
					finally
					{
					}
					break;
				}
				case 2:
				{
					int num12 = 0;
					try
					{
						while (true)
						{
							int num13 = 2;
							try
							{
								int num14 = ((IIntStream)base.input).LA(1);
								if (num14 >= 48 && num14 <= 57)
								{
									num13 = 1;
								}
							}
							finally
							{
							}
							if (num13 != 1)
							{
								break;
							}
							((IIntStream)base.input).Consume();
							num12++;
						}
						if (num12 < 1)
						{
							throw new EarlyExitException(6, (IIntStream)(object)base.input);
						}
					}
					finally
					{
					}
					((Lexer)this).Match(46);
					try
					{
						while (true)
						{
							int num15 = 2;
							try
							{
								int num16 = ((IIntStream)base.input).LA(1);
								if (num16 >= 48 && num16 <= 57)
								{
									num15 = 1;
								}
							}
							finally
							{
							}
							if (num15 != 1)
							{
								break;
							}
							((IIntStream)base.input).Consume();
						}
					}
					finally
					{
					}
					int num17 = 2;
					try
					{
						try
						{
							int num18 = ((IIntStream)base.input).LA(1);
							if (num18 == 69 || num18 == 101)
							{
								num17 = 1;
							}
						}
						finally
						{
						}
						if (num17 == 1)
						{
							mEXPONENT();
						}
					}
					finally
					{
					}
					break;
				}
				case 3:
				{
					int num2 = 0;
					try
					{
						while (true)
						{
							int num3 = 2;
							try
							{
								int num4 = ((IIntStream)base.input).LA(1);
								if (num4 >= 48 && num4 <= 57)
								{
									num3 = 1;
								}
							}
							finally
							{
							}
							if (num3 != 1)
							{
								break;
							}
							((IIntStream)base.input).Consume();
							num2++;
						}
						if (num2 < 1)
						{
							throw new EarlyExitException(9, (IIntStream)(object)base.input);
						}
					}
					finally
					{
					}
					mEXPONENT();
					break;
				}
				}
				((BaseRecognizer)this).state.type = type;
				((BaseRecognizer)this).state.channel = channel;
			}
			finally
			{
			}
		}

		[GrammarRule("STRING")]
		private void mSTRING()
		{
			try
			{
				int type = 37;
				int channel = 0;
				((Lexer)this).Match(39);
				try
				{
					while (true)
					{
						int num = 3;
						try
						{
							int num2 = ((IIntStream)base.input).LA(1);
							switch (num2)
							{
							case 92:
								num = 1;
								goto end_IL_000f;
							default:
								if ((num2 >= 40 && num2 <= 91) || (num2 >= 93 && num2 <= 65535))
								{
									break;
								}
								goto end_IL_000f;
							case 32:
							case 33:
							case 34:
							case 35:
							case 36:
							case 37:
							case 38:
								break;
							}
							num = 2;
							end_IL_000f:;
						}
						finally
						{
						}
						switch (num)
						{
						case 1:
							mEscapeSequence();
							continue;
						case 2:
							((IIntStream)base.input).Consume();
							continue;
						}
						break;
					}
				}
				finally
				{
				}
				((Lexer)this).Match(39);
				((BaseRecognizer)this).state.type = type;
				((BaseRecognizer)this).state.channel = channel;
			}
			finally
			{
			}
		}

		[GrammarRule("DATETIME")]
		private void mDATETIME()
		{
			try
			{
				int type = 9;
				int channel = 0;
				((Lexer)this).Match(35);
				try
				{
					while (true)
					{
						int num = 2;
						try
						{
							int num2 = ((IIntStream)base.input).LA(1);
							if ((num2 >= 0 && num2 <= 34) || (num2 >= 36 && num2 <= 65535))
							{
								num = 1;
							}
						}
						finally
						{
						}
						if (num != 1)
						{
							break;
						}
						((IIntStream)base.input).Consume();
					}
				}
				finally
				{
				}
				((Lexer)this).Match(35);
				((BaseRecognizer)this).state.type = type;
				((BaseRecognizer)this).state.channel = channel;
			}
			finally
			{
			}
		}

		[GrammarRule("NAME")]
		private void mNAME()
		{
			try
			{
				int type = 29;
				int channel = 0;
				((Lexer)this).Match(91);
				try
				{
					while (true)
					{
						int num = 2;
						try
						{
							int num2 = ((IIntStream)base.input).LA(1);
							if ((num2 >= 0 && num2 <= 92) || (num2 >= 94 && num2 <= 65535))
							{
								num = 1;
							}
						}
						finally
						{
						}
						if (num != 1)
						{
							break;
						}
						((IIntStream)base.input).Consume();
					}
				}
				finally
				{
				}
				((Lexer)this).Match(93);
				((BaseRecognizer)this).state.type = type;
				((BaseRecognizer)this).state.channel = channel;
			}
			finally
			{
			}
		}

		[GrammarRule("EXPONENT")]
		private void mEXPONENT()
		{
			//IL_0039: Unknown result type (might be due to invalid IL or missing references)
			//IL_0040: Expected O, but got Unknown
			//IL_00c5: Unknown result type (might be due to invalid IL or missing references)
			try
			{
				int type = 12;
				int channel = 0;
				if (((IIntStream)base.input).LA(1) == 69 || ((IIntStream)base.input).LA(1) == 101)
				{
					((IIntStream)base.input).Consume();
					int num = 2;
					try
					{
						try
						{
							int num2 = ((IIntStream)base.input).LA(1);
							if (num2 == 43 || num2 == 45)
							{
								num = 1;
							}
						}
						finally
						{
						}
						if (num == 1)
						{
							((IIntStream)base.input).Consume();
						}
					}
					finally
					{
					}
					int num3 = 0;
					try
					{
						while (true)
						{
							int num4 = 2;
							try
							{
								int num5 = ((IIntStream)base.input).LA(1);
								if (num5 >= 48 && num5 <= 57)
								{
									num4 = 1;
								}
							}
							finally
							{
							}
							if (num4 != 1)
							{
								break;
							}
							((IIntStream)base.input).Consume();
							num3++;
						}
						if (num3 < 1)
						{
							throw new EarlyExitException(15, (IIntStream)(object)base.input);
						}
					}
					finally
					{
					}
					((BaseRecognizer)this).state.type = type;
					((BaseRecognizer)this).state.channel = channel;
					return;
				}
				MismatchedSetException val = new MismatchedSetException((BitSet)null, (IIntStream)(object)base.input);
				((Lexer)this).Recover((RecognitionException)(object)val);
				throw val;
			}
			finally
			{
			}
		}

		[GrammarRule("LETTER")]
		private void mLETTER()
		{
			//IL_0064: Unknown result type (might be due to invalid IL or missing references)
			//IL_006a: Expected O, but got Unknown
			try
			{
				if ((((IIntStream)base.input).LA(1) >= 65 && ((IIntStream)base.input).LA(1) <= 90) || ((IIntStream)base.input).LA(1) == 95 || (((IIntStream)base.input).LA(1) >= 97 && ((IIntStream)base.input).LA(1) <= 122))
				{
					((IIntStream)base.input).Consume();
					return;
				}
				MismatchedSetException val = new MismatchedSetException((BitSet)null, (IIntStream)(object)base.input);
				((Lexer)this).Recover((RecognitionException)(object)val);
				throw val;
			}
			finally
			{
			}
		}

		[GrammarRule("DIGIT")]
		private void mDIGIT()
		{
			//IL_0034: Unknown result type (might be due to invalid IL or missing references)
			//IL_003a: Expected O, but got Unknown
			try
			{
				if (((IIntStream)base.input).LA(1) >= 48 && ((IIntStream)base.input).LA(1) <= 57)
				{
					((IIntStream)base.input).Consume();
					return;
				}
				MismatchedSetException val = new MismatchedSetException((BitSet)null, (IIntStream)(object)base.input);
				((Lexer)this).Recover((RecognitionException)(object)val);
				throw val;
			}
			finally
			{
			}
		}

		[GrammarRule("EscapeSequence")]
		private void mEscapeSequence()
		{
			//IL_006f: Unknown result type (might be due to invalid IL or missing references)
			try
			{
				((Lexer)this).Match(92);
				int num = 6;
				try
				{
					try
					{
						num = ((IIntStream)base.input).LA(1) switch
						{
							110 => 1, 
							114 => 2, 
							116 => 3, 
							39 => 4, 
							92 => 5, 
							117 => 6, 
							_ => throw new NoViableAltException("", 16, 0, (IIntStream)(object)base.input, 1), 
						};
					}
					finally
					{
					}
					switch (num)
					{
					case 1:
						((Lexer)this).Match(110);
						break;
					case 2:
						((Lexer)this).Match(114);
						break;
					case 3:
						((Lexer)this).Match(116);
						break;
					case 4:
						((Lexer)this).Match(39);
						break;
					case 5:
						((Lexer)this).Match(92);
						break;
					case 6:
						mUnicodeEscape();
						break;
					}
				}
				finally
				{
				}
			}
			finally
			{
			}
		}

		[GrammarRule("HexDigit")]
		private void mHexDigit()
		{
			//IL_0074: Unknown result type (might be due to invalid IL or missing references)
			//IL_007a: Expected O, but got Unknown
			try
			{
				if ((((IIntStream)base.input).LA(1) >= 48 && ((IIntStream)base.input).LA(1) <= 57) || (((IIntStream)base.input).LA(1) >= 65 && ((IIntStream)base.input).LA(1) <= 70) || (((IIntStream)base.input).LA(1) >= 97 && ((IIntStream)base.input).LA(1) <= 102))
				{
					((IIntStream)base.input).Consume();
					return;
				}
				MismatchedSetException val = new MismatchedSetException((BitSet)null, (IIntStream)(object)base.input);
				((Lexer)this).Recover((RecognitionException)(object)val);
				throw val;
			}
			finally
			{
			}
		}

		[GrammarRule("UnicodeEscape")]
		private void mUnicodeEscape()
		{
			try
			{
				((Lexer)this).Match(117);
				mHexDigit();
				mHexDigit();
				mHexDigit();
				mHexDigit();
			}
			finally
			{
			}
		}

		[GrammarRule("WS")]
		private void mWS()
		{
			//IL_0069: Unknown result type (might be due to invalid IL or missing references)
			//IL_006f: Expected O, but got Unknown
			try
			{
				int type = 44;
				int num = 0;
				if ((((IIntStream)base.input).LA(1) >= 9 && ((IIntStream)base.input).LA(1) <= 10) || (((IIntStream)base.input).LA(1) >= 12 && ((IIntStream)base.input).LA(1) <= 13) || ((IIntStream)base.input).LA(1) == 32)
				{
					((IIntStream)base.input).Consume();
					num = 99;
					((BaseRecognizer)this).state.type = type;
					((BaseRecognizer)this).state.channel = num;
					return;
				}
				MismatchedSetException val = new MismatchedSetException((BitSet)null, (IIntStream)(object)base.input);
				((Lexer)this).Recover((RecognitionException)(object)val);
				throw val;
			}
			finally
			{
			}
		}

		[GrammarRule("A")]
		private void mA()
		{
			//IL_0034: Unknown result type (might be due to invalid IL or missing references)
			//IL_003a: Expected O, but got Unknown
			try
			{
				if (((IIntStream)base.input).LA(1) == 65 || ((IIntStream)base.input).LA(1) == 97)
				{
					((IIntStream)base.input).Consume();
					return;
				}
				MismatchedSetException val = new MismatchedSetException((BitSet)null, (IIntStream)(object)base.input);
				((Lexer)this).Recover((RecognitionException)(object)val);
				throw val;
			}
			finally
			{
			}
		}

		[GrammarRule("B")]
		private void mB()
		{
			//IL_0034: Unknown result type (might be due to invalid IL or missing references)
			//IL_003a: Expected O, but got Unknown
			try
			{
				if (((IIntStream)base.input).LA(1) == 66 || ((IIntStream)base.input).LA(1) == 98)
				{
					((IIntStream)base.input).Consume();
					return;
				}
				MismatchedSetException val = new MismatchedSetException((BitSet)null, (IIntStream)(object)base.input);
				((Lexer)this).Recover((RecognitionException)(object)val);
				throw val;
			}
			finally
			{
			}
		}

		[GrammarRule("C")]
		private void mC()
		{
			//IL_0034: Unknown result type (might be due to invalid IL or missing references)
			//IL_003a: Expected O, but got Unknown
			try
			{
				if (((IIntStream)base.input).LA(1) == 67 || ((IIntStream)base.input).LA(1) == 99)
				{
					((IIntStream)base.input).Consume();
					return;
				}
				MismatchedSetException val = new MismatchedSetException((BitSet)null, (IIntStream)(object)base.input);
				((Lexer)this).Recover((RecognitionException)(object)val);
				throw val;
			}
			finally
			{
			}
		}

		[GrammarRule("D")]
		private void mD()
		{
			//IL_0034: Unknown result type (might be due to invalid IL or missing references)
			//IL_003a: Expected O, but got Unknown
			try
			{
				if (((IIntStream)base.input).LA(1) == 68 || ((IIntStream)base.input).LA(1) == 100)
				{
					((IIntStream)base.input).Consume();
					return;
				}
				MismatchedSetException val = new MismatchedSetException((BitSet)null, (IIntStream)(object)base.input);
				((Lexer)this).Recover((RecognitionException)(object)val);
				throw val;
			}
			finally
			{
			}
		}

		[GrammarRule("E")]
		private void mE()
		{
			//IL_0034: Unknown result type (might be due to invalid IL or missing references)
			//IL_003a: Expected O, but got Unknown
			try
			{
				if (((IIntStream)base.input).LA(1) == 69 || ((IIntStream)base.input).LA(1) == 101)
				{
					((IIntStream)base.input).Consume();
					return;
				}
				MismatchedSetException val = new MismatchedSetException((BitSet)null, (IIntStream)(object)base.input);
				((Lexer)this).Recover((RecognitionException)(object)val);
				throw val;
			}
			finally
			{
			}
		}

		[GrammarRule("F")]
		private void mF()
		{
			//IL_0034: Unknown result type (might be due to invalid IL or missing references)
			//IL_003a: Expected O, but got Unknown
			try
			{
				if (((IIntStream)base.input).LA(1) == 70 || ((IIntStream)base.input).LA(1) == 102)
				{
					((IIntStream)base.input).Consume();
					return;
				}
				MismatchedSetException val = new MismatchedSetException((BitSet)null, (IIntStream)(object)base.input);
				((Lexer)this).Recover((RecognitionException)(object)val);
				throw val;
			}
			finally
			{
			}
		}

		[GrammarRule("G")]
		private void mG()
		{
			//IL_0034: Unknown result type (might be due to invalid IL or missing references)
			//IL_003a: Expected O, but got Unknown
			try
			{
				if (((IIntStream)base.input).LA(1) == 71 || ((IIntStream)base.input).LA(1) == 103)
				{
					((IIntStream)base.input).Consume();
					return;
				}
				MismatchedSetException val = new MismatchedSetException((BitSet)null, (IIntStream)(object)base.input);
				((Lexer)this).Recover((RecognitionException)(object)val);
				throw val;
			}
			finally
			{
			}
		}

		[GrammarRule("H")]
		private void mH()
		{
			//IL_0034: Unknown result type (might be due to invalid IL or missing references)
			//IL_003a: Expected O, but got Unknown
			try
			{
				if (((IIntStream)base.input).LA(1) == 72 || ((IIntStream)base.input).LA(1) == 104)
				{
					((IIntStream)base.input).Consume();
					return;
				}
				MismatchedSetException val = new MismatchedSetException((BitSet)null, (IIntStream)(object)base.input);
				((Lexer)this).Recover((RecognitionException)(object)val);
				throw val;
			}
			finally
			{
			}
		}

		[GrammarRule("I")]
		private void mI()
		{
			//IL_0034: Unknown result type (might be due to invalid IL or missing references)
			//IL_003a: Expected O, but got Unknown
			try
			{
				if (((IIntStream)base.input).LA(1) == 73 || ((IIntStream)base.input).LA(1) == 105)
				{
					((IIntStream)base.input).Consume();
					return;
				}
				MismatchedSetException val = new MismatchedSetException((BitSet)null, (IIntStream)(object)base.input);
				((Lexer)this).Recover((RecognitionException)(object)val);
				throw val;
			}
			finally
			{
			}
		}

		[GrammarRule("J")]
		private void mJ()
		{
			//IL_0034: Unknown result type (might be due to invalid IL or missing references)
			//IL_003a: Expected O, but got Unknown
			try
			{
				if (((IIntStream)base.input).LA(1) == 74 || ((IIntStream)base.input).LA(1) == 106)
				{
					((IIntStream)base.input).Consume();
					return;
				}
				MismatchedSetException val = new MismatchedSetException((BitSet)null, (IIntStream)(object)base.input);
				((Lexer)this).Recover((RecognitionException)(object)val);
				throw val;
			}
			finally
			{
			}
		}

		[GrammarRule("K")]
		private void mK()
		{
			//IL_0034: Unknown result type (might be due to invalid IL or missing references)
			//IL_003a: Expected O, but got Unknown
			try
			{
				if (((IIntStream)base.input).LA(1) == 75 || ((IIntStream)base.input).LA(1) == 107)
				{
					((IIntStream)base.input).Consume();
					return;
				}
				MismatchedSetException val = new MismatchedSetException((BitSet)null, (IIntStream)(object)base.input);
				((Lexer)this).Recover((RecognitionException)(object)val);
				throw val;
			}
			finally
			{
			}
		}

		[GrammarRule("L")]
		private void mL()
		{
			//IL_0034: Unknown result type (might be due to invalid IL or missing references)
			//IL_003a: Expected O, but got Unknown
			try
			{
				if (((IIntStream)base.input).LA(1) == 76 || ((IIntStream)base.input).LA(1) == 108)
				{
					((IIntStream)base.input).Consume();
					return;
				}
				MismatchedSetException val = new MismatchedSetException((BitSet)null, (IIntStream)(object)base.input);
				((Lexer)this).Recover((RecognitionException)(object)val);
				throw val;
			}
			finally
			{
			}
		}

		[GrammarRule("M")]
		private void mM()
		{
			//IL_0034: Unknown result type (might be due to invalid IL or missing references)
			//IL_003a: Expected O, but got Unknown
			try
			{
				if (((IIntStream)base.input).LA(1) == 77 || ((IIntStream)base.input).LA(1) == 109)
				{
					((IIntStream)base.input).Consume();
					return;
				}
				MismatchedSetException val = new MismatchedSetException((BitSet)null, (IIntStream)(object)base.input);
				((Lexer)this).Recover((RecognitionException)(object)val);
				throw val;
			}
			finally
			{
			}
		}

		[GrammarRule("N")]
		private void mN()
		{
			//IL_0034: Unknown result type (might be due to invalid IL or missing references)
			//IL_003a: Expected O, but got Unknown
			try
			{
				if (((IIntStream)base.input).LA(1) == 78 || ((IIntStream)base.input).LA(1) == 110)
				{
					((IIntStream)base.input).Consume();
					return;
				}
				MismatchedSetException val = new MismatchedSetException((BitSet)null, (IIntStream)(object)base.input);
				((Lexer)this).Recover((RecognitionException)(object)val);
				throw val;
			}
			finally
			{
			}
		}

		[GrammarRule("O")]
		private void mO()
		{
			//IL_0034: Unknown result type (might be due to invalid IL or missing references)
			//IL_003a: Expected O, but got Unknown
			try
			{
				if (((IIntStream)base.input).LA(1) == 79 || ((IIntStream)base.input).LA(1) == 111)
				{
					((IIntStream)base.input).Consume();
					return;
				}
				MismatchedSetException val = new MismatchedSetException((BitSet)null, (IIntStream)(object)base.input);
				((Lexer)this).Recover((RecognitionException)(object)val);
				throw val;
			}
			finally
			{
			}
		}

		[GrammarRule("P")]
		private void mP()
		{
			//IL_0034: Unknown result type (might be due to invalid IL or missing references)
			//IL_003a: Expected O, but got Unknown
			try
			{
				if (((IIntStream)base.input).LA(1) == 80 || ((IIntStream)base.input).LA(1) == 112)
				{
					((IIntStream)base.input).Consume();
					return;
				}
				MismatchedSetException val = new MismatchedSetException((BitSet)null, (IIntStream)(object)base.input);
				((Lexer)this).Recover((RecognitionException)(object)val);
				throw val;
			}
			finally
			{
			}
		}

		[GrammarRule("Q")]
		private void mQ()
		{
			//IL_0034: Unknown result type (might be due to invalid IL or missing references)
			//IL_003a: Expected O, but got Unknown
			try
			{
				if (((IIntStream)base.input).LA(1) == 81 || ((IIntStream)base.input).LA(1) == 113)
				{
					((IIntStream)base.input).Consume();
					return;
				}
				MismatchedSetException val = new MismatchedSetException((BitSet)null, (IIntStream)(object)base.input);
				((Lexer)this).Recover((RecognitionException)(object)val);
				throw val;
			}
			finally
			{
			}
		}

		[GrammarRule("R")]
		private void mR()
		{
			//IL_0034: Unknown result type (might be due to invalid IL or missing references)
			//IL_003a: Expected O, but got Unknown
			try
			{
				if (((IIntStream)base.input).LA(1) == 82 || ((IIntStream)base.input).LA(1) == 114)
				{
					((IIntStream)base.input).Consume();
					return;
				}
				MismatchedSetException val = new MismatchedSetException((BitSet)null, (IIntStream)(object)base.input);
				((Lexer)this).Recover((RecognitionException)(object)val);
				throw val;
			}
			finally
			{
			}
		}

		[GrammarRule("S")]
		private void mS()
		{
			//IL_0034: Unknown result type (might be due to invalid IL or missing references)
			//IL_003a: Expected O, but got Unknown
			try
			{
				if (((IIntStream)base.input).LA(1) == 83 || ((IIntStream)base.input).LA(1) == 115)
				{
					((IIntStream)base.input).Consume();
					return;
				}
				MismatchedSetException val = new MismatchedSetException((BitSet)null, (IIntStream)(object)base.input);
				((Lexer)this).Recover((RecognitionException)(object)val);
				throw val;
			}
			finally
			{
			}
		}

		[GrammarRule("T")]
		private void mT()
		{
			//IL_0034: Unknown result type (might be due to invalid IL or missing references)
			//IL_003a: Expected O, but got Unknown
			try
			{
				if (((IIntStream)base.input).LA(1) == 84 || ((IIntStream)base.input).LA(1) == 116)
				{
					((IIntStream)base.input).Consume();
					return;
				}
				MismatchedSetException val = new MismatchedSetException((BitSet)null, (IIntStream)(object)base.input);
				((Lexer)this).Recover((RecognitionException)(object)val);
				throw val;
			}
			finally
			{
			}
		}

		[GrammarRule("U")]
		private void mU()
		{
			//IL_0034: Unknown result type (might be due to invalid IL or missing references)
			//IL_003a: Expected O, but got Unknown
			try
			{
				if (((IIntStream)base.input).LA(1) == 85 || ((IIntStream)base.input).LA(1) == 117)
				{
					((IIntStream)base.input).Consume();
					return;
				}
				MismatchedSetException val = new MismatchedSetException((BitSet)null, (IIntStream)(object)base.input);
				((Lexer)this).Recover((RecognitionException)(object)val);
				throw val;
			}
			finally
			{
			}
		}

		[GrammarRule("V")]
		private void mV()
		{
			//IL_0034: Unknown result type (might be due to invalid IL or missing references)
			//IL_003a: Expected O, but got Unknown
			try
			{
				if (((IIntStream)base.input).LA(1) == 86 || ((IIntStream)base.input).LA(1) == 118)
				{
					((IIntStream)base.input).Consume();
					return;
				}
				MismatchedSetException val = new MismatchedSetException((BitSet)null, (IIntStream)(object)base.input);
				((Lexer)this).Recover((RecognitionException)(object)val);
				throw val;
			}
			finally
			{
			}
		}

		[GrammarRule("W")]
		private void mW()
		{
			//IL_0034: Unknown result type (might be due to invalid IL or missing references)
			//IL_003a: Expected O, but got Unknown
			try
			{
				if (((IIntStream)base.input).LA(1) == 87 || ((IIntStream)base.input).LA(1) == 119)
				{
					((IIntStream)base.input).Consume();
					return;
				}
				MismatchedSetException val = new MismatchedSetException((BitSet)null, (IIntStream)(object)base.input);
				((Lexer)this).Recover((RecognitionException)(object)val);
				throw val;
			}
			finally
			{
			}
		}

		[GrammarRule("X")]
		private void mX()
		{
			//IL_0034: Unknown result type (might be due to invalid IL or missing references)
			//IL_003a: Expected O, but got Unknown
			try
			{
				if (((IIntStream)base.input).LA(1) == 88 || ((IIntStream)base.input).LA(1) == 120)
				{
					((IIntStream)base.input).Consume();
					return;
				}
				MismatchedSetException val = new MismatchedSetException((BitSet)null, (IIntStream)(object)base.input);
				((Lexer)this).Recover((RecognitionException)(object)val);
				throw val;
			}
			finally
			{
			}
		}

		[GrammarRule("Y")]
		private void mY()
		{
			//IL_0034: Unknown result type (might be due to invalid IL or missing references)
			//IL_003a: Expected O, but got Unknown
			try
			{
				if (((IIntStream)base.input).LA(1) == 89 || ((IIntStream)base.input).LA(1) == 121)
				{
					((IIntStream)base.input).Consume();
					return;
				}
				MismatchedSetException val = new MismatchedSetException((BitSet)null, (IIntStream)(object)base.input);
				((Lexer)this).Recover((RecognitionException)(object)val);
				throw val;
			}
			finally
			{
			}
		}

		[GrammarRule("Z")]
		private void mZ()
		{
			//IL_0034: Unknown result type (might be due to invalid IL or missing references)
			//IL_003a: Expected O, but got Unknown
			try
			{
				if (((IIntStream)base.input).LA(1) == 90 || ((IIntStream)base.input).LA(1) == 122)
				{
					((IIntStream)base.input).Consume();
					return;
				}
				MismatchedSetException val = new MismatchedSetException((BitSet)null, (IIntStream)(object)base.input);
				((Lexer)this).Recover((RecognitionException)(object)val);
				throw val;
			}
			finally
			{
			}
		}

		public override void mTokens()
		{
			int num = 41;
			try
			{
				num = ((DFA)dfa17).Predict((IIntStream)(object)base.input);
			}
			catch (NoViableAltException)
			{
				throw;
			}
			finally
			{
			}
			switch (num)
			{
			case 1:
				mT__48();
				break;
			case 2:
				mT__49();
				break;
			case 3:
				mT__50();
				break;
			case 4:
				mT__51();
				break;
			case 5:
				mT__52();
				break;
			case 6:
				mT__53();
				break;
			case 7:
				mT__54();
				break;
			case 8:
				mT__55();
				break;
			case 9:
				mT__56();
				break;
			case 10:
				mT__57();
				break;
			case 11:
				mT__58();
				break;
			case 12:
				mT__59();
				break;
			case 13:
				mT__60();
				break;
			case 14:
				mT__61();
				break;
			case 15:
				mT__62();
				break;
			case 16:
				mT__63();
				break;
			case 17:
				mT__64();
				break;
			case 18:
				mT__65();
				break;
			case 19:
				mT__66();
				break;
			case 20:
				mT__67();
				break;
			case 21:
				mT__68();
				break;
			case 22:
				mT__69();
				break;
			case 23:
				mT__70();
				break;
			case 24:
				mT__71();
				break;
			case 25:
				mT__72();
				break;
			case 26:
				mT__73();
				break;
			case 27:
				mT__74();
				break;
			case 28:
				mT__75();
				break;
			case 29:
				mTRUE();
				break;
			case 30:
				mFALSE();
				break;
			case 31:
				mAND();
				break;
			case 32:
				mOR();
				break;
			case 33:
				mNOT();
				break;
			case 34:
				mID();
				break;
			case 35:
				mINTEGER();
				break;
			case 36:
				mFLOAT();
				break;
			case 37:
				mSTRING();
				break;
			case 38:
				mDATETIME();
				break;
			case 39:
				mNAME();
				break;
			case 40:
				mEXPONENT();
				break;
			case 41:
				mWS();
				break;
			}
		}

		protected override void InitDFAs()
		{
			((BaseRecognizer)this).InitDFAs();
			dfa10 = new DFA10((BaseRecognizer)(object)this);
			dfa17 = new DFA17((BaseRecognizer)(object)this);
		}

		public override void EmitErrorMessage(string msg)
		{
			throw new EvaluationException(msg);
		}
	}
	[GeneratedCode("ANTLR", "3.5.0.2")]
	[CLSCompliant(false)]
	public class NCalcParser : Parser
	{
		private sealed class ncalcExpression_return : AstParserRuleReturnScope<CommonTree, IToken>
		{
			public LogicalExpression value;

			public ncalcExpression_return(NCalcParser grammar)
			{
			}
		}

		private sealed class logicalExpression_return : AstParserRuleReturnScope<CommonTree, IToken>
		{
			public LogicalExpression value;

			public logicalExpression_return(NCalcParser grammar)
			{
			}
		}

		private sealed class conditionalExpression_return : AstParserRuleReturnScope<CommonTree, IToken>
		{
			public LogicalExpression value;

			public conditionalExpression_return(NCalcParser grammar)
			{
			}
		}

		private sealed class booleanAndExpression_return : AstParserRuleReturnScope<CommonTree, IToken>
		{
			public LogicalExpression value;

			public booleanAndExpression_return(NCalcParser grammar)
			{
			}
		}

		private sealed class bitwiseOrExpression_return : AstParserRuleReturnScope<CommonTree, IToken>
		{
			public LogicalExpression value;

			public bitwiseOrExpression_return(NCalcParser grammar)
			{
			}
		}

		private sealed class bitwiseXOrExpression_return : AstParserRuleReturnScope<CommonTree, IToken>
		{
			public LogicalExpression value;

			public bitwiseXOrExpression_return(NCalcParser grammar)
			{
			}
		}

		private sealed class bitwiseAndExpression_return : AstParserRuleReturnScope<CommonTree, IToken>
		{
			public LogicalExpression value;

			public bitwiseAndExpression_return(NCalcParser grammar)
			{
			}
		}

		private sealed class equalityExpression_return : AstParserRuleReturnScope<CommonTree, IToken>
		{
			public LogicalExpression value;

			public equalityExpression_return(NCalcParser grammar)
			{
			}
		}

		private sealed class relationalExpression_return : AstParserRuleReturnScope<CommonTree, IToken>
		{
			public LogicalExpression value;

			public relationalExpression_return(NCalcParser grammar)
			{
			}
		}

		private sealed class shiftExpression_return : AstParserRuleReturnScope<CommonTree, IToken>
		{
			public LogicalExpression value;

			public shiftExpression_return(NCalcParser grammar)
			{
			}
		}

		private sealed class additiveExpression_return : AstParserRuleReturnScope<CommonTree, IToken>
		{
			public LogicalExpression value;

			public additiveExpression_return(NCalcParser grammar)
			{
			}
		}

		private sealed class multiplicativeExpression_return : AstParserRuleReturnScope<CommonTree, IToken>
		{
			public LogicalExpression value;

			public multiplicativeExpression_return(NCalcParser grammar)
			{
			}
		}

		private sealed class unaryExpression_return : AstParserRuleReturnScope<CommonTree, IToken>
		{
			public LogicalExpression value;

			public unaryExpression_return(NCalcParser grammar)
			{
			}
		}

		private sealed class exponentialExpression_return : AstParserRuleReturnScope<CommonTree, IToken>
		{
			public LogicalExpression value;

			public exponentialExpression_return(NCalcParser grammar)
			{
			}
		}

		private sealed class primaryExpression_return : AstParserRuleReturnScope<CommonTree, IToken>
		{
			public LogicalExpression value;

			public primaryExpression_return(NCalcParser grammar)
			{
			}
		}

		private sealed class value_return : AstParserRuleReturnScope<CommonTree, IToken>
		{
			public ValueExpression value;

			public value_return(NCalcParser grammar)
			{
			}
		}

		private sealed class identifier_return : AstParserRuleReturnScope<CommonTree, IToken>
		{
			public Identifier value;

			public identifier_return(NCalcParser grammar)
			{
			}
		}

		private sealed class expressionList_return : AstParserRuleReturnScope<CommonTree, IToken>
		{
			public List<LogicalExpression> value;

			public expressionList_return(NCalcParser grammar)
			{
			}
		}

		private sealed class arguments_return : AstParserRuleReturnScope<CommonTree, IToken>
		{
			public List<LogicalExpression> value;

			public arguments_return(NCalcParser grammar)
			{
			}
		}

		private static class Follow
		{
			public static readonly BitSet _logicalExpression_in_ncalcExpression73 = new BitSet(new ulong[1]);

			public static readonly BitSet _EOF_in_ncalcExpression75 = new BitSet(new ulong[1] { 2uL });

			public static readonly BitSet _conditionalExpression_in_logicalExpression95 = new BitSet(new ulong[2] { 2uL, 128uL });

			public static readonly BitSet _71_in_logicalExpression101 = new BitSet(new ulong[2] { 729865303422501376uL, 2048uL });

			public static readonly BitSet _conditionalExpression_in_logicalExpression105 = new BitSet(new ulong[1] { 2305843009213693952uL });

			public static readonly BitSet _61_in_logicalExpression107 = new BitSet(new ulong[2] { 729865303422501376uL, 2048uL });

			public static readonly BitSet _conditionalExpression_in_logicalExpression111 = new BitSet(new ulong[1] { 2uL });

			public static readonly BitSet _booleanAndExpression_in_conditionalExpression138 = new BitSet(new ulong[2] { 4294967298uL, 1024uL });

			public static readonly BitSet _set_in_conditionalExpression147 = new BitSet(new ulong[2] { 729865303422501376uL, 2048uL });

			public static readonly BitSet _conditionalExpression_in_conditionalExpression163 = new BitSet(new ulong[2] { 4294967298uL, 1024uL });

			public static readonly BitSet _bitwiseOrExpression_in_booleanAndExpression197 = new BitSet(new ulong[1] { 2251799813685282uL });

			public static readonly BitSet _set_in_booleanAndExpression206 = new BitSet(new ulong[2] { 729865303422501376uL, 2048uL });

			public static readonly BitSet _bitwiseOrExpression_in_booleanAndExpression222 = new BitSet(new ulong[1] { 2251799813685282uL });

			public static readonly BitSet _bitwiseXOrExpression_in_bitwiseOrExpression254 = new BitSet(new ulong[2] { 2uL, 512uL });

			public static readonly BitSet _73_in_bitwiseOrExpression263 = new BitSet(new ulong[2] { 729865303422501376uL, 2048uL });

			public static readonly BitSet _bitwiseOrExpression_in_bitwiseOrExpression273 = new BitSet(new ulong[2] { 2uL, 512uL });

			public static readonly BitSet _bitwiseAndExpression_in_bitwiseXOrExpression307 = new BitSet(new ulong[2] { 2uL, 256uL });

			public static readonly BitSet _72_in_bitwiseXOrExpression316 = new BitSet(new ulong[2] { 729865303422501376uL, 2048uL });

			public static readonly BitSet _bitwiseAndExpression_in_bitwiseXOrExpression326 = new BitSet(new ulong[2] { 2uL, 256uL });

			public static readonly BitSet _equalityExpression_in_bitwiseAndExpression358 = new BitSet(new ulong[1] { 4503599627370498uL });

			public static readonly BitSet _52_in_bitwiseAndExpression367 = new BitSet(new ulong[2] { 729865303422501376uL, 2048uL });

			public static readonly BitSet _equalityExpression_in_bitwiseAndExpression377 = new BitSet(new ulong[1] { 4503599627370498uL });

			public static readonly BitSet _relationalExpression_in_equalityExpression411 = new BitSet(new ulong[2] { 562949953421314uL, 14uL });

			public static readonly BitSet _set_in_equalityExpression422 = new BitSet(new ulong[2] { 729865303422501376uL, 2048uL });

			public static readonly BitSet _set_in_equalityExpression439 = new BitSet(new ulong[2] { 729865303422501376uL, 2048uL });

			public static readonly BitSet _relationalExpression_in_equalityExpression458 = new BitSet(new ulong[2] { 562949953421314uL, 14uL });

			public static readonly BitSet _shiftExpression_in_relationalExpression491 = new BitSet(new ulong[2] { 4611686018427387906uL, 49uL });

			public static readonly BitSet _62_in_relationalExpression502 = new BitSet(new ulong[2] { 729865303422501376uL, 2048uL });

			public static readonly BitSet _64_in_relationalExpression512 = new BitSet(new ulong[2] { 729865303422501376uL, 2048uL });

			public static readonly BitSet _68_in_relationalExpression523 = new BitSet(new ulong[2] { 729865303422501376uL, 2048uL });

			public static readonly BitSet _69_in_relationalExpression533 = new BitSet(new ulong[2] { 729865303422501376uL, 2048uL });

			public static readonly BitSet _shiftExpression_in_relationalExpression545 = new BitSet(new ulong[2] { 4611686018427387906uL, 49uL });

			public static readonly BitSet _additiveExpression_in_shiftExpression577 = new BitSet(new ulong[2] { 9223372036854775810uL, 64uL });

			public static readonly BitSet _63_in_shiftExpression588 = new BitSet(new ulong[2] { 729865303422501376uL, 2048uL });

			public static readonly BitSet _70_in_shiftExpression598 = new BitSet(new ulong[2] { 729865303422501376uL, 2048uL });

			public static readonly BitSet _additiveExpression_in_shiftExpression610 = new BitSet(new ulong[2] { 9223372036854775810uL, 64uL });

			public static readonly BitSet _multiplicativeExpression_in_additiveExpression642 = new BitSet(new ulong[1] { 720575940379279362uL });

			public static readonly BitSet _57_in_additiveExpression653 = new BitSet(new ulong[2] { 729865303422501376uL, 2048uL });

			public static readonly BitSet _59_in_additiveExpression663 = new BitSet(new ulong[2] { 729865303422501376uL, 2048uL });

			public static readonly BitSet _multiplicativeExpression_in_additiveExpression675 = new BitSet(new ulong[1] { 720575940379279362uL });

			public static readonly BitSet _unaryExpression_in_multiplicativeExpression707 = new BitSet(new ulong[1] { 1190076201532653570uL });

			public static readonly BitSet _55_in_multiplicativeExpression718 = new BitSet(new ulong[2] { 729865303422501376uL, 2048uL });

			public static readonly BitSet _60_in_multiplicativeExpression728 = new BitSet(new ulong[2] { 729865303422501376uL, 2048uL });

			public static readonly BitSet _50_in_multiplicativeExpression738 = new BitSet(new ulong[2] { 729865303422501376uL, 2048uL });

			public static readonly BitSet _unaryExpression_in_multiplicativeExpression750 = new BitSet(new ulong[1] { 1190076201532653570uL });

			public static readonly BitSet _exponentialExpression_in_unaryExpression776 = new BitSet(new ulong[1] { 2uL });

			public static readonly BitSet _set_in_unaryExpression786 = new BitSet(new ulong[1] { 9007886992769536uL });

			public static readonly BitSet _exponentialExpression_in_unaryExpression794 = new BitSet(new ulong[1] { 2uL });

			public static readonly BitSet _75_in_unaryExpression805 = new BitSet(new ulong[1] { 9007886992769536uL });

			public static readonly BitSet _exponentialExpression_in_unaryExpression808 = new BitSet(new ulong[1] { 2uL });

			public static readonly BitSet _59_in_unaryExpression818 = new BitSet(new ulong[1] { 9007886992769536uL });

			public static readonly BitSet _exponentialExpression_in_unaryExpression820 = new BitSet(new ulong[1] { 2uL });

			public static readonly BitSet _57_in_unaryExpression830 = new BitSet(new ulong[1] { 9007886992769536uL });

			public static readonly BitSet _exponentialExpression_in_unaryExpression832 = new BitSet(new ulong[1] { 2uL });

			public static readonly BitSet _primaryExpression_in_exponentialExpression857 = new BitSet(new ulong[1] { 72057594037927938uL });

			public static readonly BitSet _56_in_exponentialExpression866 = new BitSet(new ulong[2] { 729865303422501376uL, 2048uL });

			public static readonly BitSet _unaryExpression_in_exponentialExpression870 = new BitSet(new ulong[1] { 72057594037927938uL });

			public static readonly BitSet _53_in_primaryExpression893 = new BitSet(new ulong[2] { 729865303422501376uL, 2048uL });

			public static readonly BitSet _logicalExpression_in_primaryExpression895 = new BitSet(new ulong[1] { 18014398509481984uL });

			public static readonly BitSet _54_in_primaryExpression897 = new BitSet(new ulong[1] { 2uL });

			public static readonly BitSet _value_in_primaryExpression907 = new BitSet(new ulong[1] { 2uL });

			public static readonly BitSet _identifier_in_primaryExpression915 = new BitSet(new ulong[1] { 9007199254740994uL });

			public static readonly BitSet _arguments_in_primaryExpression920 = new BitSet(new ulong[1] { 2uL });

			public static readonly BitSet _INTEGER_in_value940 = new BitSet(new ulong[1] { 2uL });

			public static readonly BitSet _FLOAT_in_value948 = new BitSet(new ulong[1] { 2uL });

			public static readonly BitSet _STRING_in_value956 = new BitSet(new ulong[1] { 2uL });

			public static readonly BitSet _DATETIME_in_value965 = new BitSet(new ulong[1] { 2uL });

			public static readonly BitSet _TRUE_in_value972 = new BitSet(new ulong[1] { 2uL });

			public static readonly BitSet _FALSE_in_value980 = new BitSet(new ulong[1] { 2uL });

			public static readonly BitSet _ID_in_identifier998 = new BitSet(new ulong[1] { 2uL });

			public static readonly BitSet _NAME_in_identifier1006 = new BitSet(new ulong[1] { 2uL });

			public static readonly BitSet _logicalExpression_in_expressionList1030 = new BitSet(new ulong[1] { 288230376151711746uL });

			public static readonly BitSet _58_in_expressionList1037 = new BitSet(new ulong[2] { 729865303422501376uL, 2048uL });

			public static readonly BitSet _logicalExpression_in_expressionList1041 = new BitSet(new ulong[1] { 288230376151711746uL });

			public static readonly BitSet _53_in_arguments1070 = new BitSet(new ulong[2] { 747879701931983360uL, 2048uL });

			public static readonly BitSet _expressionList_in_arguments1074 = new BitSet(new ulong[1] { 18014398509481984uL });

			public static readonly BitSet _54_in_arguments1081 = new BitSet(new ulong[1] { 2uL });
		}

		internal static readonly string[] tokenNames = new string[76]
		{
			"<invalid>", "<EOR>", "<DOWN>", "<UP>", "A", "AND", "B", "C", "D", "DATETIME",
			"DIGIT", "E", "EXPONENT", "EscapeSequence", "F", "FALSE", "FLOAT", "G", "H", "HexDigit",
			"I", "ID", "INTEGER", "J", "K", "L", "LETTER", "M", "N", "NAME",
			"NOT", "O", "OR", "P", "Q", "R", "S", "STRING", "T", "TRUE",
			"U", "UnicodeEscape", "V", "W", "WS", "X", "Y", "Z", "'!'", "'!='",
			"'%'", "'&&'", "'&'", "'('", "')'", "'*'", "'**'", "'+'", "','", "'-'",
			"'/'", "':'", "'<'", "'<<'", "'<='", "'<>'", "'='", "'=='", "'>'", "'>='",
			"'>>'", "'?'", "'^'", "'|'", "'||'", "'~'"
		};

		public const int EOF = -1;

		public const int A = 4;

		public const int AND = 5;

		public const int B = 6;

		public const int C = 7;

		public const int D = 8;

		public const int DATETIME = 9;

		public const int DIGIT = 10;

		public const int E = 11;

		public const int EXPONENT = 12;

		public const int EscapeSequence = 13;

		public const int F = 14;

		public const int FALSE = 15;

		public const int FLOAT = 16;

		public const int G = 17;

		public const int H = 18;

		public const int HexDigit = 19;

		public const int I = 20;

		public const int ID = 21;

		public const int INTEGER = 22;

		public const int J = 23;

		public const int K = 24;

		public const int L = 25;

		public const int LETTER = 26;

		public const int M = 27;

		public const int N = 28;

		public const int NAME = 29;

		public const int NOT = 30;

		public const int O = 31;

		public const int OR = 32;

		public const int P = 33;

		public const int Q = 34;

		public const int R = 35;

		public const int S = 36;

		public const int STRING = 37;

		public const int T = 38;

		public const int TRUE = 39;

		public const int U = 40;

		public const int UnicodeEscape = 41;

		public const int V = 42;

		public const int W = 43;

		public const int WS = 44;

		public const int X = 45;

		public const int Y = 46;

		public const int Z = 47;

		public const int T__48 = 48;

		public const int T__49 = 49;

		public const int T__50 = 50;

		public const int T__51 = 51;

		public const int T__52 = 52;

		public const int T__53 = 53;

		public const int T__54 = 54;

		public const int T__55 = 55;

		public const int T__56 = 56;

		public const int T__57 = 57;

		public const int T__58 = 58;

		public const int T__59 = 59;

		public const int T__60 = 60;

		public const int T__61 = 61;

		public const int T__62 = 62;

		public const int T__63 = 63;

		public const int T__64 = 64;

		public const int T__65 = 65;

		public const int T__66 = 66;

		public const int T__67 = 67;

		public const int T__68 = 68;

		public const int T__69 = 69;

		public const int T__70 = 70;

		public const int T__71 = 71;

		public const int T__72 = 72;

		public const int T__73 = 73;

		public const int T__74 = 74;

		public const int T__75 = 75;

		private ITreeAdaptor adaptor;

		private const char BS = '\\';

		private static NumberFormatInfo numberFormatInfo = new NumberFormatInfo();

		public ITreeAdaptor TreeAdaptor
		{
			get
			{
				return adaptor;
			}
			set
			{
				adaptor = value;
			}
		}

		public override string[] TokenNames => tokenNames;

		public override string GrammarFileName => "NCalc.g";

		public List<string> Errors { get; private set; }

		public NCalcParser(ITokenStream input)
			: this(input, new RecognizerSharedState())
		{
		}//IL_0002: Unknown result type (might be due to invalid IL or missing references)
		//IL_000c: Expected O, but got Unknown


		public NCalcParser(ITokenStream input, RecognizerSharedState state)
			: base(input, state)
		{
			//IL_0010: Unknown result type (might be due to invalid IL or missing references)
			ITreeAdaptor val = null;
			TreeAdaptor = (ITreeAdaptor)(((object)val) ?? ((object)new CommonTreeAdaptor()));
		}

		private string extractString(string text)
		{
			//IL_014f: Unknown result type (might be due to invalid IL or missing references)
			StringBuilder stringBuilder = new StringBuilder(text);
			int startIndex = 1;
			int num = -1;
			while ((num = stringBuilder.ToString().IndexOf('\\', startIndex)) != -1)
			{
				char c = stringBuilder[num + 1];
				switch (c)
				{
				case 'u':
				{
					string text2 = string.Concat(stringBuilder[num + 4], stringBuilder[num + 5]);
					string text3 = string.Concat(stringBuilder[num + 2], stringBuilder[num + 3]);
					char c2 = Encoding.Unicode.GetChars(new byte[2]
					{
						Convert.ToByte(text2, 16),
						Convert.ToByte(text3, 16)
					})[0];
					stringBuilder.Remove(num, 6).Insert(num, c2);
					break;
				}
				case 'n':
					stringBuilder.Remove(num, 2).Insert(num, '\n');
					break;
				case 'r':
					stringBuilder.Remove(num, 2).Insert(num, '\r');
					break;
				case 't':
					stringBuilder.Remove(num, 2).Insert(num, '\t');
					break;
				case '\'':
					stringBuilder.Remove(num, 2).Insert(num, '\'');
					break;
				case '\\':
					stringBuilder.Remove(num, 2).Insert(num, '\\');
					break;
				default:
					throw new RecognitionException("Unvalid escape sequence: \\" + c);
				}
				startIndex = num + 1;
			}
			stringBuilder.Remove(0, 1);
			stringBuilder.Remove(stringBuilder.Length - 1, 1);
			return stringBuilder.ToString();
		}

		public override void DisplayRecognitionError(string[] tokenNames, RecognitionException e)
		{
			((BaseRecognizer)this).DisplayRecognitionError(tokenNames, e);
			if (Errors == null)
			{
				Errors = new List<string>();
			}
			string errorHeader = ((BaseRecognizer)this).GetErrorHeader(e);
			string errorMessage = ((BaseRecognizer)this).GetErrorMessage(e, tokenNames);
			Errors.Add(errorMessage + " at " + errorHeader);
		}

		public LogicalExpression GetExpression()
		{
			return ncalcExpression().value;
		}

		[GrammarRule("ncalcExpression")]
		private ncalcExpression_return ncalcExpression()
		{
			//IL_00d0: Expected O, but got Unknown
			//IL_0109: Unknown result type (might be due to invalid IL or missing references)
			//IL_0113: Expected O, but got Unknown
			//IL_0028: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Expected O, but got Unknown
			//IL_006a: 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_00b0: Expected O, but got Unknown
			ncalcExpression_return ncalcExpression_return = new ncalcExpression_return(this);
			((ParserRuleReturnScope<IToken>)(object)ncalcExpression_return).Start = base.input.LT(1);
			CommonTree val = null;
			AstParserRuleReturnScope<CommonTree, IToken> val2 = null;
			try
			{
				try
				{
					val = (CommonTree)adaptor.Nil();
					((BaseRecognizer)this).PushFollow(Follow._logicalExpression_in_ncalcExpression73);
					val2 = logicalExpression();
					((BaseRecognizer)this).PopFollow();
					adaptor.AddChild((object)val, (object)val2.Tree);
					_ = (IToken)((BaseRecognizer)this).Match((IIntStream)(object)base.input, -1, Follow._EOF_in_ncalcExpression75);
					ncalcExpression_return.value = ((val2 != null) ? ((logicalExpression_return)val2).value : null);
					((ParserRuleReturnScope<IToken>)(object)ncalcExpression_return).Stop = base.input.LT(-1);
					((AstParserRuleReturnScope<CommonTree, IToken>)ncalcExpression_return).Tree = (CommonTree)adaptor.RulePostProcessing((object)val);
					adaptor.SetTokenBoundaries((object)((AstParserRuleReturnScope<CommonTree, IToken>)ncalcExpression_return).Tree, ((ParserRuleReturnScope<IToken>)(object)ncalcExpression_return).Start, ((ParserRuleReturnScope<IToken>)(object)ncalcExpression_return).Stop);
				}
				catch (RecognitionException val3)
				{
					RecognitionException val4 = val3;
					((BaseRecognizer)this).ReportError(val4);
					((BaseRecognizer)this).Recover((IIntStream)(object)base.input, val4);
					((AstParserRuleReturnScope<CommonTree, IToken>)ncalcExpression_return).Tree = (CommonTree)adaptor.ErrorNode(base.input, ((ParserRuleReturnScope<IToken>)(object)ncalcExpression_return).Start, base.input.LT(-1), val4);
				}
				finally
				{
				}
			}
			finally
			{
			}
			return ncalcExpression_return;
		}

		[GrammarRule("logicalExpression")]
		private logicalExpression_return logicalExpression()
		{
			//IL_0202: Expected O, but got Unknown
			//IL_023e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0248: Expected O, but got Unknown
			//IL_0039: Unknown result type (might be due to invalid IL or missing references)
			//IL_003f: Expected O, but got Unknown
			//IL_00b8: Unknown result type (might be due to invalid IL or missing references)
			//IL_00be: Expected O, but got Unknown
			//IL_00ca: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d1: Expected O, but got Unknown
			//IL_011e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0124: Expected O, but got Unknown
			//IL_0130: Unknown result type (might be due to invalid IL or missing references)
			//IL_0137: Expected O, but got Unknown
			//IL_01d7: Unknown result type (might be due to invalid IL or missing references)
			//IL_01e1: Expected O, but got Unknown
			logicalExpression_return logicalExpression_return = new logicalExpression_return(this);
			((ParserRuleReturnScope<IToken>)(object)logicalExpression_return).Start = base.input.LT(1);
			CommonTree val = null;
			IToken val2 = null;
			IToken val3 = null;
			AstParserRuleReturnScope<CommonTree, IToken> val4 = null;
			AstParserRuleReturnScope<CommonTree, IToken> val5 = null;
			AstParserRuleReturnScope<CommonTree, IToken> val6 = null;
			CommonTree val7 = null;
			CommonTree val8 = null;
			try
			{
				try
				{
					val = (CommonTree)adaptor.Nil();
					((BaseRecognizer)this).PushFollow(Follow._conditionalExpression_in_logicalExpression95);
					val4 = conditionalExpression();
					((BaseRecognizer)this).PopFollow();
					adaptor.AddChild((object)val, (object)val4.Tree);
					logicalExpression_return.value = ((val4 != null) ? ((conditionalExpression_return)val4).value : null);
					int num = 2;
					try
					{
						try
						{
							if (((IIntStream)base.input).LA(1) == 71)
							{
								num = 1;
							}
						}
						finally
						{
						}
						if (num == 1)
						{
							val2 = (IToken)((BaseRecognizer)this).Match((IIntStream)(object)base.input, 71, Follow._71_in_logicalExpression101);
							val7 = (CommonTree)adaptor.Create(val2);
							adaptor.AddChild((object)val, (object)val7);
							((BaseRecognizer)this).PushFollow(Follow._conditionalExpression_in_logicalExpression105);
							val5 = conditionalExpression();
							((BaseRecognizer)this).PopFollow();
							adaptor.AddChild((object)val, (object)val5.Tree);
							val3 = (IToken)((BaseRecognizer)this).Match((IIntStream)(object)base.input, 61, Follow._61_in_logicalExpression107);
							val8 = (CommonTree)adaptor.Create(val3);
							adaptor.AddChild((object)val, (object)val8);
							((BaseRecognizer)this).PushFollow(Follow._conditionalExpression_in_logicalExpression111);
							val6 = conditionalExpression();
							((BaseRecognizer)this).PopFollow();
							adaptor.AddChild((object)val, (object)val6.Tree);
							logicalExpression_return.value = new TernaryExpression((val4 != null) ? ((conditionalExpression_return)val4).value : null, (val5 != null) ? ((conditionalExpression_return)val5).value : null, (val6 != null) ? ((conditionalExpression_return)val6).value : null);
						}
					}
					finally
					{
					}
					((ParserRuleReturnScope<IToken>)(object)logicalExpression_return).Stop = base.input.LT(-1);
					((AstParserRuleReturnScope<CommonTree, IToken>)logicalExpression_return).Tree = (CommonTree)adaptor.RulePostProcessing((object)val);
					adaptor.SetTokenBoundaries((object)((AstParserRuleReturnScope<CommonTree, IToken>)logicalExpression_return).Tree, ((ParserRuleReturnScope<IToken>)(object)logicalExpression_return).Start, ((ParserRuleReturnScope<IToken>)(object)logicalExpression_return).Stop);
				}
				catch (RecognitionException val9)
				{
					RecognitionException val10 = val9;
					((BaseRecognizer)this).ReportError(val10);
					((BaseRecognizer)this).Recover((IIntStream)(object)base.input, val10);
					((AstParserRuleReturnScope<CommonTree, IToken>)logicalExpression_return).Tree = (CommonTree)adaptor.ErrorNode(base.input, ((ParserRuleReturnScope<IToken>)(object)logicalExpression_return).Start, base.input.LT(-1), val10);
				}
				finally
				{
				}
			}
			finally
			{
			}
			return logicalExpression_return;
		}

		[GrammarRule("conditionalExpression")]
		private conditionalExpression_return conditionalExpression()
		{
			//IL_01ba: Expected O, but got Unknown
			//IL_01f6: Unknown result type (might be due to invalid IL or missing references)
			//IL_0200: Expected O, but got Unknown
			//IL_0031: Unknown result type (might be due to invalid IL or missing references)
			//IL_0037: Expected O, but got Unknown
			//IL_018f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0199: Expected O, but got Unknown
			//IL_00ee: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f8: Expected O, but got Unknown
			//IL_010d: Unknown result type (might be due to invalid IL or missing references)
			conditionalExpression_return conditionalExpression_return = new conditionalExpression_return(this);
			((ParserRuleReturnScope<IToken>)(object)conditionalExpression_return).Start = base.input.LT(1);
			CommonTree val = null;
			IToken val2 = null;
			AstParserRuleReturnScope<CommonTree, IToken> val3 = null;
			AstParserRuleReturnScope<CommonTree, IToken> val4 = null;
			BinaryExpressionType binaryExpressionType = BinaryExpressionType.Unknown;
			try
			{
				try
				{
					val = (CommonTree)adaptor.Nil();
					((BaseRecognizer)this).PushFollow(Follow._booleanAndExpression_in_conditionalExpression138);
					val3 = booleanAndExpression();
					((BaseRecognizer)this).PopFollow();
					adaptor.AddChild((object)val, (object)val3.Tree);
					conditionalExpression_return.value = ((val3 != null) ? ((booleanAndExpression_return)val3).value : null);
					try
					{
						while (true)
						{
							int num = 2;
							try
							{
								int num2 = ((IIntStream)base.input).LA(1);
								if (num2 == 32 || num2 == 74)
								{
									num = 1;
								}
							}
							finally
							{
							}
							if (num == 1)
							{
								val2 = base.input.LT(1);
								if (((IIntStream)base.input).LA(1) == 32 || ((IIntStream)base.input).LA(1) == 74)
								{
									((IIntStream)base.input).Consume();
									adaptor.AddChild((object)val, (object)(CommonTree)adaptor.Create(val2));
									((BaseRecognizer)this).state.errorRecovery = false;
									binaryExpressionType = BinaryExpressionType.Or;
									((BaseRecognizer)this).PushFollow(Follow._conditionalExpression_in_conditionalExpression163);
									val4 = conditionalExpression();
									((BaseRecognizer)this).PopFollow();
									adaptor.AddChild((object)val, (object)val4.Tree);
									conditionalExpression_return.value = new BinaryExpression(binaryExpressionType, conditionalExpression_return.value, (val4 != null) ? ((conditionalExpression_return)val4).value : null);
									continue;
								}
								throw new MismatchedSetException((BitSet)null, (IIntStream)(object)base.input);
							}
							break;
						}
					}
					finally
					{
					}
					((ParserRuleReturnScope<IToken>)(object)conditionalExpression_return).Stop = base.input.LT(-1);
					((AstParserRuleReturnScope<CommonTree, IToken>)conditionalExpression_return).Tree = (CommonTree)adaptor.RulePostProcessing((object)val);
					adaptor.SetTokenBoundaries((object)((AstParserRuleReturnScope<CommonTree, IToken>)conditionalExpression_return).Tree, ((ParserRuleReturnScope<IToken>)(object)conditionalExpression_return).Start, ((ParserRuleReturnScope<IToken>)(object)conditionalExpression_return).Stop);
				}
				catch (RecognitionException val5)
				{
					RecognitionException val6 = val5;
					((BaseRecognizer)this).ReportError(val6);
					((BaseRecognizer)this).Recover((IIntStream)(object)base.input, val6);
					((AstParserRuleReturnScope<CommonTree, IToken>)conditionalExpression_return).Tree = (CommonTree)adaptor.ErrorNode(base.input, ((ParserRuleReturnScope<IToken>)(object)conditionalExpression_return).Start, base.input.LT(-1), val6);
				}
				finally
				{
				}
			}
			finally
			{
			}
			return conditionalExpression_return;
		}

		[GrammarRule("booleanAndExpression")]
		private booleanAndExpression_return booleanAndExpression()
		{
			//IL_01b8: Expected O, but got Unknown
			//IL_01f4: Unknown result type (might be due to invalid IL or missing references)
			//IL_01fe: Expected O, but got Unknown
			//IL_0031: Unknown result type (might be due to invalid IL or missing references)
			//IL_0037: Expected O, but got Unknown
			//IL_018d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0197: Expected O, but got Unknown
			//IL_00ec: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f6: Expected O, but got Unknown
			//IL_010b: Unknown result type (might be due to invalid IL or missing references)
			booleanAndExpression_return booleanAndExpression_return = new booleanAndExpression_return(this);
			((ParserRuleReturnScope<IToken>)(object)booleanAndExpression_return).Start = base.input.LT(1);
			CommonTree val = null;
			IToken val2 = null;
			AstParserRuleReturnScope<CommonTree, IToken> val3 = null;
			AstParserRuleReturnScope<CommonTree, IToken> val4 = null;
			BinaryExpressionType binaryExpressionType = BinaryExpressionType.Unknown;
			try
			{
				try
				{
					val = (CommonTree)adaptor.Nil();
					((BaseRecognizer)this).PushFollow(Follow._bitwiseOrExpression_in_booleanAndExpression197);
					val3 = bitwiseOrExpression();
					((BaseRecognizer)this).PopFollow();
					adaptor.AddChild((object)val, (object)val3.Tree);
					booleanAndExpression_return.value = ((val3 != null) ? ((bitwiseOrExpression_return)val3).value : null);
					try
					{
						while (true)
						{
							int num = 2;
							try
							{
								int num2 = ((IIntStream)base.input).LA(1);
								if (num2 == 5 || num2 == 51)
								{
									num = 1;
								}
							}
							finally
							{
							}
							if (num == 1)
							{
								val2 = base.input.LT(1);
								if (((IIntStream)base.input).LA(1) == 5 || ((IIntStream)base.input).LA(1) == 51)
								{
									((IIntStream)base.input).Consume();
									adaptor.AddChild((object)val, (object)(CommonTree)adaptor.Create(val2));
									((BaseRecognizer)this).state.errorRecovery = false;
									binaryExpressionType = BinaryExpressionType.And;
									((BaseRecognizer)this).PushFollow(Follow._bitwiseOrExpression_in_booleanAndExpression222);
									val4 = bitwiseOrExpression();
									((BaseRecognizer)this).PopFollow();
									adaptor.AddChild((object)val, (object)val4.Tree);
									booleanAndExpression_return.value = new BinaryExpression(binaryExpressionType, booleanAndExpression_return.value, (val4 != null) ? ((bitwiseOrExpression_return)val4).value : null);
									continue;
								}
								throw new MismatchedSetException((BitSet)null, (IIntStream)(object)base.input);
							}
							break;
						}
					}
					finally
					{
					}
					((ParserRuleReturnScope<IToken>)(object)booleanAndExpression_return).Stop = base.input.LT(-1);
					((AstParserRuleReturnScope<CommonTree, IToken>)booleanAndExpression_return).Tree = (CommonTree)adaptor.RulePostProcessing((object)val);
					adaptor.SetTokenBoundaries((object)((AstParserRuleReturnScope<CommonTree, IToken>)booleanAndExpression_return).Tree, ((ParserRuleReturnScope<IToken>)(object)booleanAndExpression_return).Start, ((ParserRuleReturnScope<IToken>)(object)booleanAndExpression_return).Stop);
				}
				catch (RecognitionException val5)
				{
					RecognitionException val6 = val5;
					((BaseRecognizer)this).ReportError(val6);
					((BaseRecognizer)this).Recover((IIntStream)(object)base.input, val6);
					((AstParserRuleReturnScope<CommonTree, IToken>)booleanAndExpression_return).Tree = (CommonTree)adaptor.ErrorNode(base.input, ((ParserRuleReturnScope<IToken>)(object)booleanAndExpression_return).Start, base.input.LT(-1), val6);
				}
				finally
				{
				}
			}
			finally
			{
			}
			return booleanAndExpression_return;
		}

		[GrammarRule("bitwiseOrExpression")]
		private bitwiseOrExpression_return bitwiseOrExpression()
		{
			//IL_017e: Expected O, but got Unknown
			//IL_01ba: Unknown result type (might be due to invalid IL or missing references)
			//IL_01c4: Expected O, but got Unknown
			//IL_0034: Unknown result type (might be due to invalid IL or missing references)
			//IL_003a: Expected O, but got Unknown
			//IL_00af: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b5: Expected O, but got Unknown
			//IL_00c1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c8: Expected O, but got Unknown
			//IL_0153: Unknown result type (might be due to invalid IL or missing references)
			//IL_015d: Expected O, but got Unknown
			bitwiseOrExpression_return bitwiseOrExpression_return = new bitwiseOrExpression_return(this);
			((ParserRuleReturnScope<IToken>)(object)bitwiseOrExpression_return).Start = base.input.LT(1);
			CommonTree val = null;
			IToken val2 = null;
			AstParserRuleReturnScope<CommonTree, IToken> val3 = null;
			AstParserRuleReturnScope<CommonTree, IToken> val4 = null;
			CommonTree val5 = null;
			BinaryExpressionType binaryExpressionType = BinaryExpressionType.Unknown;
			try
			{
				try
				{
					val = (CommonTree)adaptor.Nil();
					((BaseRecognizer)this).PushFollow(Follow._bitwiseXOrExpression_in_bitwiseOrExpression254);
					val3 = bitwiseXOrExpression();
					((BaseRecognizer)this).PopFollow();
					adaptor.AddChild((object)val, (object)val3.Tree);
					bitwiseOrExpression_return.value = ((val3 != null) ? ((bitwiseXOrExpression_return)val3).value : null);
					try
					{
						while (true)
						{
							int num = 2;
							try
							{
								if (((IIntStream)base.input).LA(1) == 73)
								{
									num = 1;
								}
							}
							finally
							{
							}
							if (num == 1)
							{
								val2 = (IToken)((BaseRecognizer)this).Match((IIntStream)(object)base.input, 73, Follow._73_in_bitwiseOrExpression263);
								val5 = (CommonTree)adaptor.Create(val2);
								adaptor.AddChild((object)val, (object)val5);
								binaryExpressionType = BinaryExpressionType.BitwiseOr;
								((BaseRecognizer)this).PushFollow(Follow._bitwiseOrExpression_in_bitwiseOrExpression273);
								val4 = bitwiseOrExpression();
								((BaseRecognizer)this).PopFollow();
								adaptor.AddChild((object)val, (object)val4.Tree);
								bitwiseOrExpression_return.value = new BinaryExpression(binaryExpressionType, bitwiseOrExpression_return.value, (val4 != null) ? ((bitwiseOrExpression_return)val4).value : null);
								continue;
							}
							break;
						}
					}
					finally
					{
					}
					((ParserRuleReturnScope<IToken>)(object)bitwiseOrExpression_return).Stop = base.input.LT(-1);
					((AstParserRuleReturnScope<CommonTree, IToken>)bitwiseOrExpression_return).Tree = (CommonTree)adaptor.RulePostProcessing((object)val);
					adaptor.SetTokenBoundaries((object)((AstParserRuleReturnScope<CommonTree, IToken>)bitwiseOrExpression_return).Tree, ((ParserRuleReturnScope<IToken>)(object)bitwiseOrExpression_return).Start, ((ParserRuleReturnScope<IToken>)(object)bitwiseOrExpression_return).Stop);
				}
				catch (RecognitionException val6)
				{
					RecognitionException val7 = val6;
					((BaseRecognizer)this).ReportError(val7);
					((BaseRecognizer)this).Recover((IIntStream)(object)base.input, val7);
					((AstParserRuleReturnScope<CommonTree, IToken>)bitwiseOrExpression_return).Tree = (CommonTree)adaptor.ErrorNode(base.input, ((ParserRuleReturnScope<IToken>)(object)bitwiseOrExpression_return).Start, base.input.LT(-1), val7);
				}
				finally
				{
				}
			}
			finally
			{
			}
			return bitwiseOrExpression_return;
		}

		[GrammarRule("bitwiseXOrExpression")]
		private bitwiseXOrExpression_return bitwiseXOrExpression()
		{
			//IL_017e: Expected O, but got Unknown
			//IL_01ba: Unknown result type (might be due to invalid IL or missing references)
			//IL_01c4: Expected O, but got Unknown
			//IL_0034: Unknown result type (might be due to invalid IL or missing references)
			//IL_003a: Expected O, but got Unknown
			//IL_00af: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b5: Expected O, but got Unknown
			//IL_00c1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c8: Expected O, but got Unknown
			//IL_0153: Unknown result type (might be due to invalid IL or missing references)
			//IL_015d: Expected O, but got Unknown
			bitwiseXOrExpression_return bitwiseXOrExpression_return = new bitwiseXOrExpression_return(this);
			((ParserRuleReturnScope<IToken>)(object)bitwiseXOrExpression_return).Start = base.input.LT(1);
			CommonTree val = null;
			IToken val2 = null;
			AstParserRuleReturnScope<CommonTree, IToken> val3 = null;
			AstParserRuleReturnScope<CommonTree, IToken> val4 = null;
			CommonTree val5 = null;
			BinaryExpressionType binaryExpressionType = BinaryExpressionType.Unknown;
			try
			{
				try
				{
					val = (CommonTree)adaptor.Nil();
					((BaseRecognizer)this).PushFollow(Follow._bitwiseAndExpression_in_bitwiseXOrExpression307);
					val3 = bitwiseAndExpression();
					((BaseRecognizer)this).PopFollow();
					adaptor.AddChild((object)val, (object)val3.Tree);
					bitwiseXOrExpression_return.value = ((val3 != null) ? ((bitwiseAndExpression_return)val3).value : null);
					try
					{
						while (true)
						{
							int num = 2;
							try
							{
								if (((IIntStream)base.input).LA(1) == 72)
								{
									num = 1;
								}
							}
							finally
							{
							}
							if (num == 1)
							{
								val2 = (IToken)((BaseRecognizer)this).Match((IIntStream)(object)base.input, 72, Follow._72_in_bitwiseXOrExpression316);
								val5 = (CommonTree)adaptor.Create(val2);
								adaptor.AddChild((object)val, (object)val5);
								binaryExpressionType = BinaryExpressionType.BitwiseXOr;
								((BaseRecognizer)this).PushFollow(Follow._bitwiseAndExpression_in_bitwiseXOrExpression326);
								val4 = bitwiseAndExpression();
								((BaseRecognizer)this).PopFollow();
								adaptor.AddChild((object)val, (object)val4.Tree);
								bitwiseXOrExpression_return.value = new BinaryExpression(binaryExpressionType, bitwiseXOrExpression_return.value, (val4 != null) ? ((bitwiseAndExpression_return)val4).value : null);
								continue;
							}
							break;
						}
					}
					finally
					{
					}
					((ParserRuleReturnScope<IToken>)(object)bitwiseXOrExpression_return).Stop = base.input.LT(-1);
					((AstParserRuleReturnScope<CommonTree, IToken>)bitwiseXOrExpression_return).Tree = (CommonTree)adaptor.RulePostProcessing((object)val);
					adaptor.SetTokenBoundaries((object)((AstParserRuleReturnScope<CommonTree, IToken>)bitwiseXOrExpression_return).Tree, ((ParserRuleReturnScope<IToken>)(object)bitwiseXOrExpression_return).Start, ((ParserRuleReturnScope<IToken>)(object)bitwiseXOrExpression_return).Stop);
				}
				catch (RecognitionException val6)
				{
					RecognitionException val7 = val6;
					((BaseRecognizer)this).ReportError(val7);
					((BaseRecognizer)this).Recover((IIntStream)(object)base.input, val7);
					((AstParserRuleReturnScope<CommonTree, IToken>)bitwiseXOrExpression_return).Tree = (CommonTree)adaptor.ErrorNode(base.input, ((ParserRuleReturnScope<IToken>)(object)bit

plugins/MADH95Mods-JSONCardLoader/plugins/Libs/PanoramicData.NCalcExtensions.dll

Decompiled 5 months ago
using System;
using System.CodeDom.Compiler;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.Diagnostics.CodeAnalysis;
using System.Globalization;
using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Text.RegularExpressions;
using Microsoft.CodeAnalysis;
using NCalc;
using Newtonsoft.Json;
using Newtonsoft.Json.Linq;
using PanoramicData.NCalcExtensions.Exceptions;
using PanoramicData.NCalcExtensions.Extensions;
using PanoramicData.NCalcExtensions.Helpers;
using TimeZoneConverter;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: AssemblyFileVersion("1.20.127.34203")]
[assembly: AssemblyInformationalVersion("1.20.127+859b0ed46e")]
[assembly: TargetFramework(".NETStandard,Version=v2.0", FrameworkDisplayName = ".NET Standard 2.0")]
[assembly: AssemblyCompany("Panoramic Data Limited")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyCopyright("Panoramic Data Limited 2019-2023")]
[assembly: AssemblyDescription("Extensions for NCalc")]
[assembly: AssemblyProduct("PanoramicData.NCalcExtensions")]
[assembly: AssemblyTitle("PanoramicData.NCalcExtensions")]
[assembly: AssemblyMetadata("RepositoryUrl", "https://github.com/panoramicdata/PanoramicData.NCalcExtensions")]
[assembly: InternalsVisibleTo("PanoramicData.NCalcExtensions.Test")]
[assembly: AssemblyVersion("1.20.0.0")]
[module: RefSafetyRules(11)]
namespace Microsoft.CodeAnalysis
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	internal sealed class EmbeddedAttribute : Attribute
	{
	}
}
namespace System.Runtime.CompilerServices
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	[AttributeUsage(AttributeTargets.Class | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Parameter | AttributeTargets.ReturnValue | AttributeTargets.GenericParameter, AllowMultiple = false, Inherited = false)]
	internal sealed class NullableAttribute : Attribute
	{
		public readonly byte[] NullableFlags;

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

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

		public NullableContextAttribute(byte P_0)
		{
			Flag = P_0;
		}
	}
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	[AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)]
	internal sealed class RefSafetyRulesAttribute : Attribute
	{
		public readonly int Version;

		public RefSafetyRulesAttribute(int P_0)
		{
			Version = P_0;
		}
	}
}
[GeneratedCode("Nerdbank.GitVersioning.Tasks", "3.5.119.9565")]
[ExcludeFromCodeCoverage]
internal static class ThisAssembly
{
	internal const string AssemblyConfiguration = "Release";

	internal const string AssemblyFileVersion = "1.20.127.34203";

	internal const string AssemblyInformationalVersion = "1.20.127+859b0ed46e";

	internal const string AssemblyName = "PanoramicData.NCalcExtensions";

	internal const string AssemblyTitle = "PanoramicData.NCalcExtensions";

	internal const string AssemblyVersion = "1.20.0.0";

	internal static readonly DateTime GitCommitDate = new DateTime(638332475000000000L, DateTimeKind.Utc);

	internal const string GitCommitId = "859b0ed46eb79975f879772d7edd6b08e2ec9a3c";

	internal const bool IsPrerelease = false;

	internal const bool IsPublicRelease = true;

	internal const string RootNamespace = "PanoramicData.NCalcExtensions";
}
namespace PanoramicData.NCalcExtensions
{
	public class ExtendedExpression : Expression
	{
		private readonly Dictionary<string, object?> _storageDictionary = new Dictionary<string, object>();

		internal const string StorageDictionaryParameterName = "__storageDictionary";

		public ExtendedExpression(string expression)
			: base(expression)
		{
			//IL_0030: Unknown result type (might be due to invalid IL or missing references)
			//IL_003a: Expected O, but got Unknown
			((Expression)this).Parameters["__storageDictionary"] = _storageDictionary;
			((Expression)this).EvaluateFunction += new EvaluateFunctionHandler(Extend);
			Expression.CacheEnabled = false;
			if (((Expression)this).Parameters.ContainsKey("null"))
			{
				throw new InvalidOperationException("You may not set a parameter called 'null', as it is a reserved keyword.");
			}
			((Expression)this).Parameters["null"] = null;
			if (((Expression)this).Parameters.ContainsKey("True"))
			{
				throw new InvalidOperationException("You may not set a parameter called 'True', as it is a reserved keyword.");
			}
			((Expression)this).Parameters["True"] = true;
			if (((Expression)this).Parameters.ContainsKey("False"))
			{
				throw new InvalidOperationException("You may not set a parameter called 'False', as it is a reserved keyword.");
			}
			((Expression)this).Parameters["False"] = false;
		}

		internal static void CheckParameterCount(string functionName, FunctionArgs functionArgs, int? minPropertyCount, int? maxPropertyCount)
		{
			if (minPropertyCount.HasValue && functionArgs.Parameters.Length < minPropertyCount)
			{
				throw new FormatException(string.Format("{0}: At least {1} parameter{2} required.", functionName, minPropertyCount, (minPropertyCount == 1) ? "" : "s"));
			}
			if (maxPropertyCount.HasValue && functionArgs.Parameters.Length > maxPropertyCount)
			{
				throw new FormatException(string.Format("{0}: No more than {1} parameter{2} permitted.", functionName, maxPropertyCount, (maxPropertyCount == 1) ? "" : "s"));
			}
		}

		internal void Extend(string functionName, FunctionArgs functionArgs)
		{
			if (functionArgs == null)
			{
				throw new ArgumentNullException("functionArgs");
			}
			if (functionName == null)
			{
				return;
			}
			switch (functionName.Length)
			{
			case 3:
				switch (functionName[1])
				{
				case 'l':
					if (functionName == "all")
					{
						All.Evaluate(functionArgs);
					}
					break;
				case 'n':
					if (functionName == "any")
					{
						Any.Evaluate(functionArgs);
					}
					break;
				case 'a':
					if (functionName == "max")
					{
						Max.Evaluate(functionArgs);
					}
					break;
				case 'i':
					if (functionName == "min")
					{
						Min.Evaluate(functionArgs);
					}
					break;
				case 'u':
					if (functionName == "sum")
					{
						Sum.Evaluate(functionArgs);
					}
					break;
				case 'r':
					if (functionName == "try")
					{
						Try.Evaluate(functionArgs);
					}
					break;
				}
				break;
			case 11:
				switch (functionName[0])
				{
				case 'c':
					if (functionName == "canEvaluate")
					{
						CanEvaluate.Evaluate(functionArgs);
					}
					break;
				case 'g':
					if (functionName == "getProperty")
					{
						GetProperty.Evaluate(functionArgs);
					}
					break;
				case 'i':
					if (functionName == "itemAtIndex")
					{
						ItemAtIndex.Evaluate(functionArgs);
					}
					break;
				case 'l':
					if (functionName == "lastIndexOf")
					{
						LastIndexOf.Evaluate(functionArgs);
					}
					break;
				}
				break;
			case 10:
				switch (functionName[0])
				{
				case 'c':
					if (functionName == "capitalise" || functionName == "capitalize")
					{
						Capitalize.Evaluate(functionArgs);
					}
					break;
				case 'd':
					if (functionName == "dictionary")
					{
						Dictionary.Evaluate(functionArgs);
					}
					break;
				case 'i':
					if (functionName == "isInfinite")
					{
						IsInfinite.Evaluate(functionArgs);
					}
					break;
				case 'r':
					if (functionName == "regexGroup")
					{
						RegexGroup.Evaluate(functionArgs);
					}
					break;
				case 's':
					if (functionName == "startsWith")
					{
						StartsWith.Evaluate(functionArgs);
					}
					break;
				case 't':
					if (functionName == "toDateTime")
					{
						ToDateTime.Evaluate(functionArgs);
					}
					break;
				}
				break;
			case 4:
				switch (functionName[0])
				{
				case 'c':
					if (functionName == "cast")
					{
						Cast.Evaluate(functionArgs);
					}
					break;
				case 'j':
					if (functionName == "join")
					{
						Join.Evaluate(functionArgs);
					}
					break;
				case 'l':
					if (functionName == "list")
					{
						List.Evaluate(functionArgs);
					}
					break;
				case 's':
					if (!(functionName == "skip"))
					{
						if (functionName == "sort")
						{
							Sort.Evaluate(functionArgs);
						}
					}
					else
					{
						Skip.Evaluate(functionArgs);
					}
					break;
				case 't':
					if (functionName == "take")
					{
						Take.Evaluate(functionArgs);
					}
					break;
				}
				break;
			case 14:
				switch (functionName[0])
				{
				case 'c':
					if (functionName == "changeTimeZone")
					{
						ChangeTimeZone.Evaluate(functionArgs);
					}
					break;
				case 'f':
					if (functionName == "firstOrDefault")
					{
						FirstOrDefault.Evaluate(functionArgs);
					}
					break;
				case 's':
					if (functionName == "selectDistinct")
					{
						SelectDistinct.Evaluate(functionArgs);
					}
					break;
				}
				break;
			case 6:
				switch (functionName[2])
				{
				case 'n':
					if (!(functionName == "concat"))
					{
						if (functionName == "length")
						{
							Length.Evaluate(functionArgs);
						}
					}
					else
					{
						Concat.Evaluate(functionArgs);
					}
					break;
				case 't':
					if (functionName == "extend")
					{
						ExtendObject.Evaluate(functionArgs);
					}
					break;
				case 'r':
					if (functionName == "format")
					{
						Format.Evaluate(functionArgs);
					}
					break;
				case 'G':
					if (functionName == "isGuid")
					{
						IsGuid.Evaluate(functionArgs);
					}
					break;
				case 'N':
					if (functionName == "isNull")
					{
						IsNull.Evaluate(functionArgs);
					}
					break;
				case 's':
					if (functionName == "listOf")
					{
						ListOf.Evaluate(functionArgs);
					}
					break;
				case 'l':
					if (functionName == "select")
					{
						Select.Evaluate(functionArgs);
					}
					break;
				case 'i':
					if (functionName == "switch")
					{
						PanoramicData.NCalcExtensions.Extensions.Switch.Evaluate(functionArgs);
					}
					break;
				case 'p':
					if (functionName == "typeOf")
					{
						TypeOf.Evaluate(functionArgs);
					}
					break;
				}
				break;
			case 8:
				switch (functionName[2])
				{
				case 'n':
					if (!(functionName == "contains"))
					{
						if (functionName == "minValue")
						{
							MinValue.Evaluate(functionArgs);
						}
					}
					else
					{
						Contains.Evaluate(functionArgs);
					}
					break;
				case 't':
					if (!(functionName == "dateTime"))
					{
						if (functionName == "retrieve")
						{
							Retrieve.Evaluate(functionArgs);
						}
					}
					else
					{
						DateTimeMethods.Evaluate(functionArgs);
					}
					break;
				case 's':
					if (functionName == "distinct")
					{
						Distinct.Evaluate(functionArgs);
					}
					break;
				case 'd':
					if (functionName == "endsWith")
					{
						EndsWith.Evaluate(functionArgs);
					}
					break;
				case 'm':
					switch (functionName)
					{
					case "humanise":
					case "humanize":
						Humanize.Evaluate(functionArgs);
						break;
					case "timespan":
					case "timeSpan":
						PanoramicData.NCalcExtensions.Extensions.TimeSpan.Evaluate(functionArgs);
						break;
					}
					break;
				case 'x':
					if (functionName == "maxValue")
					{
						MaxValue.Evaluate(functionArgs);
					}
					break;
				case 'r':
					if (functionName == "parseInt")
					{
						ParseInt.Evaluate(functionArgs);
					}
					break;
				case 'S':
					if (functionName == "toString")
					{
						ToString.Evaluate(functionArgs);
					}
					break;
				case 'y':
					if (functionName == "tryParse")
					{
						TryParse.Evaluate(functionArgs, _storageDictionary);
					}
					break;
				}
				break;
			case 7:
				switch (functionName[0])
				{
				case 'c':
					if (functionName == "convert")
					{
						ConvertFunction.Evaluate(functionArgs);
					}
					break;
				case 'i':
					if (functionName == "indexOf")
					{
						IndexOf.Evaluate(functionArgs);
					}
					break;
				case 'j':
					if (functionName == "jObject")
					{
						NewJObject.Evaluate(functionArgs);
					}
					break;
				case 'o':
					if (functionName == "orderBy")
					{
						OrderBy.Evaluate(functionArgs);
					}
					break;
				case 'p':
					if (functionName == "padLeft")
					{
						PadLeft.Evaluate(functionArgs);
					}
					break;
				case 'r':
					if (functionName == "replace")
					{
						Replace.Evaluate(functionArgs);
					}
					break;
				case 't':
					if (!(functionName == "toLower"))
					{
						if (functionName == "toUpper")
						{
							ToUpper.Evaluate(functionArgs);
						}
					}
					else
					{
						ToLower.Evaluate(functionArgs);
					}
					break;
				}
				break;
			case 5:
				switch (functionName[2])
				{
				case 'u':
					if (functionName == "count")
					{
						Count.Evaluate(functionArgs);
					}
					break;
				case 'r':
					switch (functionName)
					{
					case "first":
						First.Evaluate(functionArgs);
						break;
					case "parse":
						Parse.Evaluate(functionArgs);
						break;
					case "throw":
						throw Throw.Evaluate(functionArgs);
					}
					break;
				case 'N':
					if (functionName == "isNaN")
					{
						IsNaN.Evaluate(functionArgs);
					}
					break;
				case 'S':
					if (functionName == "isSet")
					{
						IsSet.Evaluate(functionArgs);
					}
					break;
				case 'a':
					if (functionName == "jPath")
					{
						JPath.Evaluate(functionArgs);
					}
					break;
				case 'l':
					if (functionName == "split")
					{
						Split.Evaluate(functionArgs);
					}
					break;
				case 'o':
					if (functionName == "store")
					{
						Store.Evaluate(functionArgs);
					}
					break;
				case 'e':
					if (functionName == "where")
					{
						Where.Evaluate(functionArgs);
					}
					break;
				}
				break;
			case 2:
				switch (functionName[1])
				{
				case 'n':
					if (functionName == "in")
					{
						In.Evaluate(functionArgs);
					}
					break;
				case 'f':
					if (functionName == "if")
					{
						If.Evaluate(functionArgs);
					}
					break;
				}
				break;
			case 13:
				switch (functionName[0])
				{
				case 'i':
					if (functionName == "isNullOrEmpty")
					{
						IsNullOrEmpty.Evaluate(functionArgs);
					}
					break;
				case 's':
					if (functionName == "setProperties")
					{
						SetProperties.Evaluate(functionArgs);
					}
					break;
				}
				break;
			case 12:
				switch (functionName[0])
				{
				case 'n':
					if (functionName == "nullCoalesce")
					{
						NullCoalesce.Evaluate(functionArgs);
					}
					break;
				case 'r':
					if (functionName == "regexIsMatch")
					{
						RegexIsMatch.Evaluate(functionArgs);
					}
					break;
				}
				break;
			case 17:
				if (functionName == "dateTimeAsEpochMs")
				{
					DateTimeAsEpochMs.Evaluate(functionArgs);
				}
				break;
			case 18:
				if (functionName == "isNullOrWhiteSpace")
				{
					IsNullOrWhiteSpace.Evaluate(functionArgs);
				}
				break;
			case 9:
				if (functionName == "substring")
				{
					Substring.Evaluate(functionArgs);
				}
				break;
			case 15:
			case 16:
				break;
			}
		}
	}
	public static class ExtensionFunction
	{
		public const string All = "all";

		public const string Any = "any";

		public const string CanEvaluate = "canEvaluate";

		public const string Capitalise = "capitalise";

		public const string Capitalize = "capitalize";

		public const string Cast = "cast";

		public const string ChangeTimeZone = "changeTimeZone";

		public const string Concat = "concat";

		public const string Contains = "contains";

		public const string Convert = "convert";

		public const string Count = "count";

		public const string DateTime = "dateTime";

		public const string DateTimeAsEpochMs = "dateTimeAsEpochMs";

		public const string Dictionary = "dictionary";

		public const string Distinct = "distinct";

		public const string EndsWith = "endsWith";

		public const string Extend = "extend";

		public const string First = "first";

		public const string FirstOrDefault = "firstOrDefault";

		public const string Format = "format";

		public const string GetProperty = "getProperty";

		public const string Humanise = "humanise";

		public const string Humanize = "humanize";

		public const string If = "if";

		public const string In = "in";

		public const string IndexOf = "indexOf";

		public const string IsGuid = "isGuid";

		public const string IsInfinite = "isInfinite";

		public const string IsNaN = "isNaN";

		public const string IsNull = "isNull";

		public const string IsNullOrWhiteSpace = "isNullOrWhiteSpace";

		public const string IsNullOrEmpty = "isNullOrEmpty";

		public const string IsSet = "isSet";

		public const string ItemAtIndex = "itemAtIndex";

		public const string Join = "join";

		public const string JPath = "jPath";

		public const string LastIndexOf = "lastIndexOf";

		public const string Length = "length";

		public const string List = "list";

		public const string ListOf = "listOf";

		public const string Max = "max";

		public const string MaxValue = "maxValue";

		public const string Min = "min";

		public const string MinValue = "minValue";

		public const string NewJObject = "jObject";

		public const string NullCoalesce = "nullCoalesce";

		public const string OrderBy = "orderBy";

		public const string PadLeft = "padLeft";

		public const string Parse = "parse";

		public const string ParseInt = "parseInt";

		public const string RegexGroup = "regexGroup";

		public const string RegexIsMatch = "regexIsMatch";

		public const string Replace = "replace";

		public const string Retrieve = "retrieve";

		public const string Select = "select";

		public const string SelectDistinct = "selectDistinct";

		public const string SetProperties = "setProperties";

		public const string Skip = "skip";

		public const string Sort = "sort";

		public const string Split = "split";

		public const string StartsWith = "startsWith";

		public const string Store = "store";

		public const string Substring = "substring";

		public const string Sum = "sum";

		public const string Switch = "switch";

		public const string Take = "take";

		public const string Throw = "throw";

		public const string TimeSpan = "timespan";

		public const string TimeSpanCamel = "timeSpan";

		public const string ToDateTime = "toDateTime";

		public const string ToLower = "toLower";

		public new const string ToString = "toString";

		public const string ToUpper = "toUpper";

		public const string Try = "try";

		public const string TryParse = "tryParse";

		public const string TypeOf = "typeOf";

		public const string Where = "where";
	}
	public class Lambda
	{
		private readonly string predicate;

		private readonly string nCalcString;

		private readonly Dictionary<string, object?> parameters;

		public Lambda(string predicate, string nCalcString, Dictionary<string, object?> parameters)
		{
			this.predicate = predicate;
			this.nCalcString = nCalcString;
			this.parameters = parameters;
		}

		public object? Evaluate<T>(T value)
		{
			parameters.Remove(predicate);
			parameters.Add(predicate, value);
			ExtendedExpression extendedExpression = new ExtendedExpression(nCalcString);
			((Expression)extendedExpression).Parameters = parameters;
			ExtendedExpression extendedExpression2 = extendedExpression;
			return ((Expression)extendedExpression2).Evaluate();
		}
	}
	public static class NCalcExtensions
	{
	}
	public enum TimeUnit
	{
		Milliseconds,
		Seconds,
		Minutes,
		Hours,
		Days,
		Weeks,
		Years
	}
}
namespace PanoramicData.NCalcExtensions.Helpers
{
	internal static class StringExtensions
	{
		internal static string UpperCaseFirst(this string s)
		{
			if (s == null)
			{
				throw new ArgumentNullException("s");
			}
			return s.Substring(0, 1).ToUpperInvariant() + s.Substring(1);
		}
	}
	internal static class TimeSpanExtensions
	{
		internal static string Humanise(this System.TimeSpan t)
		{
			string text = ((t.Days >= 1) ? string.Format("{0} day{1}", t.Days, (t.Days > 1) ? "s" : "") : "");
			if (t.Hours >= 1)
			{
				text += string.Format(" {0} hour{1}", t.Hours, (t.Hours > 1) ? "s" : "");
			}
			if (t.Minutes >= 1)
			{
				text += string.Format(" {0} minute{1}", t.Minutes, (t.Minutes > 1) ? "s" : "");
			}
			if (t.Seconds >= 1)
			{
				text += string.Format(" {0} second{1}", t.Seconds, (t.Seconds > 1) ? "s" : "");
			}
			return text.Trim();
		}
	}
	internal static class TypeHelper
	{
		internal static string AsHumanString<T>()
		{
			if (typeof(T).IsGenericType)
			{
				return typeof(T).GetGenericTypeDefinition().Name + "<" + string.Join(",", from t in typeof(T).GetGenericArguments()
					select t.Name) + ">";
			}
			return typeof(T).Name;
		}
	}
}
namespace PanoramicData.NCalcExtensions.Extensions
{
	internal static class All
	{
		internal static void Evaluate(FunctionArgs functionArgs)
		{
			IEnumerable<object> source = (functionArgs.Parameters[0].Evaluate() as IEnumerable<object>) ?? throw new FormatException("First all parameter must be an IEnumerable.");
			string predicate = (functionArgs.Parameters[1].Evaluate() as string) ?? throw new FormatException("Second all parameter must be a string.");
			string nCalcString = (functionArgs.Parameters[2].Evaluate() as string) ?? throw new FormatException("Third all parameter must be a string.");
			Lambda lambda = new Lambda(predicate, nCalcString, functionArgs.Parameters[0].Parameters);
			functionArgs.Result = source.All((object value) => lambda.Evaluate(value) as bool? == true);
		}
	}
	internal static class Any
	{
		internal static void Evaluate(FunctionArgs functionArgs)
		{
			IEnumerable<object> source = (functionArgs.Parameters[0].Evaluate() as IEnumerable<object>) ?? throw new FormatException("First any parameter must be an IEnumerable.");
			string predicate = (functionArgs.Parameters[1].Evaluate() as string) ?? throw new FormatException("Second any parameter must be a string.");
			string nCalcString = (functionArgs.Parameters[2].Evaluate() as string) ?? throw new FormatException("Third any parameter must be a string.");
			Lambda lambda = new Lambda(predicate, nCalcString, functionArgs.Parameters[0].Parameters);
			functionArgs.Result = source.Any((object value) => lambda.Evaluate(value) as bool? == true);
		}
	}
	internal static class CanEvaluate
	{
		internal static void Evaluate(FunctionArgs functionArgs)
		{
			try
			{
				Expression[] parameters = functionArgs.Parameters;
				foreach (Expression val in parameters)
				{
					val.Evaluate();
				}
				functionArgs.Result = true;
			}
			catch
			{
				functionArgs.Result = false;
			}
		}
	}
	internal static class Capitalize
	{
		internal static void Evaluate(FunctionArgs functionArgs)
		{
			string text;
			try
			{
				text = (string)functionArgs.Parameters[0].Evaluate();
			}
			catch (Exception ex) when (!(ex is NCalcExtensionsException))
			{
				throw new FormatException("capitalize function -  requires one string parameter.");
			}
			functionArgs.Result = text.ToLowerInvariant().UpperCaseFirst();
		}
	}
	internal static class Cast
	{
		internal static void Evaluate(FunctionArgs functionArgs)
		{
			if (functionArgs.Parameters.Length != 2)
			{
				throw new ArgumentException(string.Format("{0} function - Expected {1} arguments", "cast", 2));
			}
			object value = functionArgs.Parameters[0].Evaluate();
			if (!(functionArgs.Parameters[1].Evaluate() is string typeName))
			{
				throw new ArgumentException("cast function - Expected second argument to be a string.");
			}
			Type conversionType = Type.GetType(typeName) ?? throw new ArgumentException("cast function - Expected second argument to be a valid .NET type e.g. System.Decimal.");
			object result = Convert.ChangeType(value, conversionType, CultureInfo.InvariantCulture);
			functionArgs.Result = result;
		}
	}
	internal static class ChangeTimeZone
	{
		internal static void Evaluate(FunctionArgs functionArgs)
		{
			if (functionArgs.Parameters.Length != 3)
			{
				throw new ArgumentException("changeTimeZone function - Expected 3 arguments");
			}
			DateTime parsedDateTime = (functionArgs.Parameters[0].Evaluate() as DateTime?) ?? throw new ArgumentException("changeTimeZone function - parameter 1 should be a DateTime");
			string sourceTimeZoneName = (functionArgs.Parameters[1].Evaluate() as string) ?? throw new ArgumentException("changeTimeZone function - parameter 2 should be a string");
			string destinationTimeZoneName = (functionArgs.Parameters[2].Evaluate() as string) ?? throw new ArgumentException("changeTimeZone function - parameter 3 should be a string");
			functionArgs.Result = ToDateTime.ConvertTimeZone(parsedDateTime, sourceTimeZoneName, destinationTimeZoneName);
		}
	}
	internal static class Concat
	{
		internal static void Evaluate(FunctionArgs functionArgs)
		{
			List<object> list = new List<object>();
			Expression[] parameters = functionArgs.Parameters;
			foreach (Expression val in parameters)
			{
				object obj = val.Evaluate();
				if (obj is IList list2)
				{
					foreach (object item in list2)
					{
						list.Add(item);
					}
				}
				else
				{
					list.Add(obj);
				}
			}
			functionArgs.Result = list;
		}
	}
	internal static class Contains
	{
		internal static void Evaluate(FunctionArgs functionArgs)
		{
			try
			{
				string text = (string)functionArgs.Parameters[0].Evaluate();
				string value = (string)functionArgs.Parameters[1].Evaluate();
				functionArgs.Result = text.IndexOf(value, StringComparison.InvariantCulture) >= 0;
			}
			catch (Exception ex) when (!(ex is NCalcExtensionsException))
			{
				throw new FormatException("contains() requires two string parameters.");
			}
		}
	}
	internal static class ConvertFunction
	{
		internal static void Evaluate(FunctionArgs functionArgs)
		{
			if (functionArgs.Parameters.Length != 2)
			{
				throw new FormatException("convert() requires two parameters.");
			}
			object value = functionArgs.Parameters[0].Evaluate();
			functionArgs.Parameters[1].Parameters["value"] = value;
			functionArgs.Result = functionArgs.Parameters[1].Evaluate();
		}
	}
	internal static class Count
	{
		internal static void Evaluate(FunctionArgs functionArgs)
		{
			object obj = functionArgs.Parameters[0].Evaluate();
			IEnumerable<object> enumerable = obj as IEnumerable<object>;
			if (functionArgs.Parameters.Length == 1)
			{
				if (obj is string text)
				{
					functionArgs.Result = text.Length;
					return;
				}
				if (enumerable == null)
				{
					throw new FormatException("count() requires IEnumerable parameter.");
				}
				functionArgs.Result = enumerable.Count();
				return;
			}
			if (enumerable == null)
			{
				throw new FormatException("count() requires IEnumerable parameter.");
			}
			string predicate = (functionArgs.Parameters[1].Evaluate() as string) ?? throw new FormatException("Second count parameter must be a string.");
			string nCalcString = (functionArgs.Parameters[2].Evaluate() as string) ?? throw new FormatException("Third count parameter must be a string.");
			Lambda lambda = new Lambda(predicate, nCalcString, functionArgs.Parameters[0].Parameters);
			functionArgs.Result = enumerable.Count((object value) => lambda.Evaluate(value) as bool? == true);
		}
	}
	internal static class DateTimeAsEpochMs
	{
		internal static void Evaluate(FunctionArgs functionArgs)
		{
			functionArgs.Result = DateTimeOffset.ParseExact(functionArgs.Parameters[0].Evaluate() as string, functionArgs.Parameters[1].Evaluate() as string, CultureInfo.InvariantCulture.DateTimeFormat, DateTimeStyles.AssumeUniversal).ToUnixTimeMilliseconds();
		}
	}
	internal static class DateTimeMethods
	{
		internal static void Evaluate(FunctionArgs functionArgs)
		{
			if (functionArgs.Parameters.Length != 0)
			{
				if (!(functionArgs.Parameters[0].Evaluate() is string text))
				{
					throw new FormatException("dateTime function - The first argument should be a string, e.g. 'UTC'");
				}
				if (text != "UTC")
				{
					throw new FormatException("dateTime function - Only UTC timeZone is currently supported.");
				}
			}
			string text2 = ((functionArgs.Parameters.Length > 1) ? (functionArgs.Parameters[1].Evaluate() as string) : "yyyy-MM-dd HH:mm:ss");
			double days = 0.0;
			if (functionArgs.Parameters.Length > 2)
			{
				double? nullableDouble = GetNullableDouble(functionArgs.Parameters[2]);
				if (!nullableDouble.HasValue)
				{
					throw new FormatException("dateTime function - Days to add must be a number.");
				}
				days = nullableDouble.Value;
			}
			double hours = 0.0;
			if (functionArgs.Parameters.Length > 3)
			{
				double? nullableDouble2 = GetNullableDouble(functionArgs.Parameters[3]);
				if (!nullableDouble2.HasValue)
				{
					throw new FormatException("dateTime function - Hours to add must be a number.");
				}
				hours = nullableDouble2.Value;
			}
			double minutes = 0.0;
			if (functionArgs.Parameters.Length > 4)
			{
				double? nullableDouble3 = GetNullableDouble(functionArgs.Parameters[4]);
				if (!nullableDouble3.HasValue)
				{
					throw new FormatException("dateTime function - Minutes to add must be a number.");
				}
				minutes = nullableDouble3.Value;
			}
			double seconds = 0.0;
			if (functionArgs.Parameters.Length > 5)
			{
				double? nullableDouble4 = GetNullableDouble(functionArgs.Parameters[5]);
				if (!nullableDouble4.HasValue)
				{
					throw new FormatException("dateTime function - Seconds to add must be a number.");
				}
				seconds = nullableDouble4.Value;
			}
			functionArgs.Result = DateTimeOffset.UtcNow.AddDays(days).AddHours(hours).AddMinutes(minutes)
				.AddSeconds(seconds)
				.ToString(text2, CultureInfo.InvariantCulture);
		}

		private static double? GetNullableDouble(Expression expression)
		{
			object obj = expression.Evaluate();
			if (!(obj is double value))
			{
				if (obj is int num)
				{
					return num;
				}
				return null;
			}
			return value;
		}

		internal static string BetterToString(this DateTime dateTime, string format)
		{
			return format switch
			{
				"dayOfYear" => dateTime.DayOfYear.ToString(), 
				"weekOfMonth" => dateTime.WeekOfMonth().ToString(), 
				"weekOfMonthText" => GetWeekText(dateTime.WeekOfMonth()), 
				"weekDayOfMonth" => dateTime.WeekDayOfMonth().ToString(), 
				"weekDayOfMonthText" => GetWeekText(dateTime.WeekDayOfMonth()), 
				_ => dateTime.ToString(format, CultureInfo.InvariantCulture), 
			};
		}

		private static string GetWeekText(int weekOfMonth)
		{
			return weekOfMonth switch
			{
				1 => "first", 
				2 => "second", 
				3 => "third", 
				4 => "fourth", 
				_ => "last", 
			};
		}

		public static int WeekOfMonth(this DateTime dateTime)
		{
			DateTime date = dateTime.Date;
			DateTime dateTime2 = new DateTime(date.Year, date.Month, 1);
			return (date - dateTime2.AddDays(0 - dateTime2.DayOfWeek)).Days / 7 + 1;
		}

		public static int WeekDayOfMonth(this DateTime dateTime)
		{
			return (dateTime.Day - 1) / 7 + 1;
		}

		internal static string ToDateTimeInTargetTimeZone(this DateTime dateTime, string formatFormat, string timeZoneString)
		{
			TimeZoneInfo timeZoneInfo = TZConvert.GetTimeZoneInfo(timeZoneString);
			return new DateTimeOffset(dateTime, -timeZoneInfo.GetUtcOffset(dateTime)).UtcDateTime.BetterToString(formatFormat);
		}
	}
	internal static class Dictionary
	{
		internal static void Evaluate(FunctionArgs functionArgs)
		{
			ExtendedExpression.CheckParameterCount("dictionary", functionArgs, 2, 2147483646);
			if (functionArgs.Parameters.Length % 2 != 0)
			{
				throw new FormatException("dictionary: An even number of parameters must be provided.");
			}
			string key = null;
			Dictionary<string, object> dictionary = new Dictionary<string, object>();
			for (int i = 0; i < functionArgs.Parameters.Length; i++)
			{
				object obj = functionArgs.Parameters[i].Evaluate();
				if (i % 2 == 0)
				{
					if (!(obj is string))
					{
						throw new FormatException(string.Format("{0}: parameter {1} must be a string.", "dictionary", i));
					}
					key = (string)obj;
				}
				else
				{
					dictionary[key] = obj;
				}
			}
			functionArgs.Result = dictionary;
		}
	}
	internal static class Distinct
	{
		internal static void Evaluate(FunctionArgs functionArgs)
		{
			IEnumerable<object> source = (functionArgs.Parameters[0].Evaluate() as IEnumerable<object>) ?? throw new FormatException("First distinct parameter must be an IEnumerable.");
			functionArgs.Result = source.Distinct().ToList();
		}
	}
	internal static class EndsWith
	{
		internal static void Evaluate(FunctionArgs functionArgs)
		{
			try
			{
				string text = (string)functionArgs.Parameters[0].Evaluate();
				string value = (string)functionArgs.Parameters[1].Evaluate();
				functionArgs.Result = text.EndsWith(value, StringComparison.InvariantCulture);
			}
			catch (Exception ex) when (!(ex is NCalcExtensionsException))
			{
				throw new FormatException("endsWith function requires two string parameters.");
			}
		}
	}
	internal static class ExtendObject
	{
		internal static void Evaluate(FunctionArgs functionArgs)
		{
			var (obj2, list2) = Parameters.GetParameters<object, List<object>>(functionArgs, "Evaluate");
			if (list2.Count % 2 != 0)
			{
				throw new FormatException("Extension object list must have an even number of parameters, in the form string propertyName1, object value1, propertyName2, object value2, ...");
			}
			JObject val = JObject.FromObject(obj2);
			for (int i = 0; i < list2.Count; i += 2)
			{
				string text = (list2[i] as string) ?? throw new FormatException("Property name must be a string");
				object obj3 = list2[i + 1];
				val[text] = JToken.FromObject(obj3);
			}
			functionArgs.Result = val;
		}
	}
	internal static class First
	{
		internal static void Evaluate(FunctionArgs functionArgs)
		{
			IList list = (functionArgs.Parameters[0].Evaluate() as IList) ?? throw new FormatException("First first parameter must be an IEnumerable.");
			string predicate = (functionArgs.Parameters[1].Evaluate() as string) ?? throw new FormatException("Second first parameter must be a string.");
			string nCalcString = (functionArgs.Parameters[2].Evaluate() as string) ?? throw new FormatException("Third first parameter must be a string.");
			Lambda lambda = new Lambda(predicate, nCalcString, functionArgs.Parameters[0].Parameters);
			foreach (object item in list)
			{
				if (lambda.Evaluate(item) as bool? == true)
				{
					functionArgs.Result = item;
					return;
				}
			}
			throw new FormatException("No matching element found.");
		}
	}
	internal static class FirstOrDefault
	{
		internal static void Evaluate(FunctionArgs functionArgs)
		{
			IList list = (functionArgs.Parameters[0].Evaluate() as IList) ?? throw new FormatException("First firstOrDefault parameter must be an IEnumerable.");
			string predicate = (functionArgs.Parameters[1].Evaluate() as string) ?? throw new FormatException("Second firstOrDefault parameter must be a string.");
			string nCalcString = (functionArgs.Parameters[2].Evaluate() as string) ?? throw new FormatException("Third firstOrDefault parameter must be a string.");
			Lambda lambda = new Lambda(predicate, nCalcString, functionArgs.Parameters[0].Parameters);
			foreach (object item in list)
			{
				if (lambda.Evaluate(item) as bool? == true)
				{
					functionArgs.Result = item;
					return;
				}
			}
			functionArgs.Result = null;
		}
	}
	internal static class Format
	{
		internal static void Evaluate(FunctionArgs functionArgs)
		{
			if (functionArgs.Parameters.Length < 2 || functionArgs.Parameters.Length > 3)
			{
				throw new ArgumentException(string.Format("{0} function - expected between {1} and {2} arguments", "format", 2, 3));
			}
			object obj = functionArgs.Parameters[0].Evaluate();
			if (!(functionArgs.Parameters[1].Evaluate() is string text))
			{
				throw new ArgumentException("format function - expected second argument to be a format string");
			}
			int num = functionArgs.Parameters.Length;
			object result;
			if (obj is int num2)
			{
				if (num != 2)
				{
					goto IL_013f;
				}
				result = num2.ToString(text, CultureInfo.InvariantCulture);
			}
			else if (obj is double num3)
			{
				if (num != 2)
				{
					goto IL_013f;
				}
				result = num3.ToString(text, CultureInfo.InvariantCulture);
			}
			else if (obj is DateTime dateTime)
			{
				if (num != 2)
				{
					if (num != 3)
					{
						goto IL_013f;
					}
					DateTime dateTime2 = dateTime;
					result = dateTime2.ToDateTimeInTargetTimeZone(text, (functionArgs.Parameters[2].Evaluate() as string) ?? throw new ArgumentException("format function - expected third argument to be a TimeZone string"));
				}
				else
				{
					result = dateTime.BetterToString(text);
				}
			}
			else
			{
				if (!(obj is string inputString) || num != 2)
				{
					goto IL_013f;
				}
				result = GetThing(inputString, text);
			}
			functionArgs.Result = result;
			return;
			IL_013f:
			throw new NotSupportedException("Unsupported input type " + obj.GetType().Name + " or incorrect number of parameters.");
		}

		private static object GetThing(string inputString, string formatFormat)
		{
			if (long.TryParse(inputString, out var result))
			{
				return result.ToString(formatFormat, CultureInfo.InvariantCulture);
			}
			if (double.TryParse(inputString, out var result2))
			{
				return result2.ToString(formatFormat, CultureInfo.InvariantCulture);
			}
			if (DateTimeOffset.TryParse(inputString, CultureInfo.InvariantCulture.DateTimeFormat, DateTimeStyles.AssumeUniversal, out var result3))
			{
				return result3.UtcDateTime.BetterToString(formatFormat);
			}
			throw new FormatException("Could not parse '" + inputString + "' as a number or date.");
		}
	}
	internal static class GetProperty
	{
		internal static void Evaluate(FunctionArgs functionArgs)
		{
			//IL_005b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0072: Unknown result type (might be due to invalid IL or missing references)
			//IL_0077: Unknown result type (might be due to invalid IL or missing references)
			//IL_0079: Unknown result type (might be due to invalid IL or missing references)
			//IL_007c: Unknown result type (might be due to invalid IL or missing references)
			//IL_00be: Expected I4, but got Unknown
			//IL_017e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0183: Unknown result type (might be due to invalid IL or missing references)
			object obj;
			string text;
			try
			{
				obj = functionArgs.Parameters[0].Evaluate();
				text = (string)functionArgs.Parameters[1].Evaluate();
			}
			catch (Exception innerException)
			{
				throw new FormatException("getProperty() requires two parameters.", innerException);
			}
			JObject val = (JObject)((obj is JObject) ? obj : null);
			if (val != null)
			{
				JToken val2 = val[text];
				object result;
				switch ((val2 != null) ? new JTokenType?(val2.Type) : null)
				{
				case null:
				case 9L:
				case 10L:
					result = null;
					break;
				case 0L:
					result = val2.ToObject<JObject>();
					break;
				case 1L:
					result = val2.ToObject<JArray>();
					break;
				case 2L:
					result = val2.ToObject<JConstructor>();
					break;
				case 3L:
					result = val2.ToObject<JProperty>();
					break;
				case 4L:
					result = val2.ToObject<JValue>();
					break;
				case 5L:
					result = val2.ToObject<int>();
					break;
				case 6L:
					result = val2.ToObject<float>();
					break;
				case 7L:
					result = val2.ToObject<string>();
					break;
				case 8L:
					result = val2.ToObject<bool>();
					break;
				case 11L:
					result = val2.ToObject<DateTime>();
					break;
				case 12L:
				case 13L:
					result = val2.ToObject<JValue>();
					break;
				case 14L:
					result = val2.ToObject<Guid>();
					break;
				default:
				{
					JTokenType type = val2.Type;
					throw new NotSupportedException("Unsupported JTokenType: " + ((object)(JTokenType)(ref type)).ToString());
				}
				}
				functionArgs.Result = result;
			}
			else
			{
				Type type2 = obj.GetType();
				PropertyInfo propertyInfo = type2.GetProperty(text) ?? throw new FormatException("Could not find property " + text + " on type " + type2.Name);
				functionArgs.Result = propertyInfo.GetValue(obj);
			}
		}
	}
	internal static class Humanize
	{
		internal static void Evaluate(FunctionArgs functionArgs)
		{
			double param1Double;
			string value;
			try
			{
				if (!double.TryParse(functionArgs.Parameters[0].Evaluate().ToString(), out var result))
				{
					throw new Exception();
				}
				param1Double = result;
				value = (string)functionArgs.Parameters[1].Evaluate();
			}
			catch (Exception ex) when (!(ex is NCalcExtensionsException))
			{
				throw new FormatException("humanize function - The first number should be a valid floating-point number and the second should be a time unit (" + string.Join(", ", Enum.GetNames(typeof(TimeUnit))) + ").");
			}
			if (!Enum.TryParse<TimeUnit>(value, ignoreCase: true, out var result2))
			{
				throw new FormatException("humanize function - Parameter 2 must be a time unit - one of " + string.Join(", ", from n in Enum.GetNames(typeof(TimeUnit))
					select "'" + n + "'") + ".");
			}
			functionArgs.Result = Humanise(param1Double, result2);
		}

		private static string Humanise(double param1Double, TimeUnit timeUnit)
		{
			try
			{
				return timeUnit switch
				{
					TimeUnit.Milliseconds => System.TimeSpan.FromMilliseconds(param1Double).Humanise(), 
					TimeUnit.Seconds => System.TimeSpan.FromSeconds(param1Double).Humanise(), 
					TimeUnit.Minutes => System.TimeSpan.FromMinutes(param1Double).Humanise(), 
					TimeUnit.Hours => System.TimeSpan.FromHours(param1Double).Humanise(), 
					TimeUnit.Days => System.TimeSpan.FromDays(param1Double).Humanise(), 
					TimeUnit.Weeks => System.TimeSpan.FromDays(param1Double * 7.0).Humanise(), 
					TimeUnit.Years => System.TimeSpan.FromDays(param1Double * 365.25).Humanise(), 
					_ => throw new FormatException($"{timeUnit} is not a supported time unit for humanization."), 
				};
			}
			catch (OverflowException)
			{
				throw new FormatException("The value is too big to use humanize. It must be a double (a 64-bit, floating point number)");
			}
		}
	}
	internal static class If
	{
		internal static void Evaluate(FunctionArgs functionArgs)
		{
			if (functionArgs.Parameters.Length != 3)
			{
				throw new FormatException("if() requires three parameters.");
			}
			bool flag;
			try
			{
				flag = (bool)functionArgs.Parameters[0].Evaluate();
			}
			catch (Exception ex) when (!(ex is NCalcExtensionsException))
			{
				throw new FormatException(string.Format("Could not evaluate {0} function parameter 1 '{1}'.", "if", functionArgs.Parameters[0].ParsedExpression));
			}
			if (flag)
			{
				try
				{
					functionArgs.Result = functionArgs.Parameters[1].Evaluate();
					return;
				}
				catch (Exception ex2) when (!(ex2 is NCalcExtensionsException))
				{
					throw new FormatException(string.Format("Could not evaluate {0} function parameter 2 '{1}' due to {2}.", "if", functionArgs.Parameters[1].ParsedExpression, ex2.Message), ex2);
				}
			}
			try
			{
				functionArgs.Result = functionArgs.Parameters[2].Evaluate();
			}
			catch (Exception ex3) when (!(ex3 is NCalcExtensionsException))
			{
				throw new FormatException(string.Format("Could not evaluate {0} function parameter 3 '{1}' due to {2}.", "if", functionArgs.Parameters[2].ParsedExpression, ex3.Message), ex3);
			}
		}
	}
	internal static class In
	{
		internal static void Evaluate(FunctionArgs functionArgs)
		{
			if (functionArgs.Parameters.Length < 2)
			{
				throw new FormatException("in() requires at least two parameters.");
			}
			try
			{
				object item = functionArgs.Parameters[0].Evaluate();
				List<object> list = (from p in functionArgs.Parameters.Skip(1)
					select p.Evaluate()).ToList();
				functionArgs.Result = list.Contains(item);
			}
			catch (Exception ex) when (!(ex is NCalcExtensionsException))
			{
				throw new FormatException("in() parameters malformed.");
			}
		}
	}
	internal static class IndexOf
	{
		internal static void Evaluate(FunctionArgs functionArgs)
		{
			try
			{
				string text = (string)functionArgs.Parameters[0].Evaluate();
				string value = (string)functionArgs.Parameters[1].Evaluate();
				functionArgs.Result = text.IndexOf(value, StringComparison.InvariantCulture);
			}
			catch (Exception ex) when (!(ex is NCalcExtensionsException))
			{
				throw new FormatException("indexOf() requires two string parameters.");
			}
		}
	}
	internal static class IsGuid
	{
		internal static void Evaluate(FunctionArgs functionArgs)
		{
			if (functionArgs.Parameters.Length != 1)
			{
				throw new FormatException("isGuid() requires one parameter.");
			}
			object obj = functionArgs.Parameters[0].Evaluate();
			functionArgs.Result = obj is Guid || (obj is string && Guid.TryParse(obj.ToString(), out var _));
		}
	}
	internal static class IsInfinite
	{
		internal static void Evaluate(FunctionArgs functionArgs)
		{
			if (functionArgs.Parameters.Length != 1)
			{
				throw new FormatException("isInfinite() requires one parameter.");
			}
			try
			{
				functionArgs.Result = functionArgs.Parameters[0].Evaluate() is double d && (double.IsPositiveInfinity(d) || double.IsNegativeInfinity(d));
			}
			catch (Exception ex) when (!(ex is NCalcExtensionsException))
			{
				throw new FormatException(ex.Message);
			}
		}
	}
	internal static class IsNaN
	{
		internal static void Evaluate(FunctionArgs functionArgs)
		{
			if (functionArgs.Parameters.Length != 1)
			{
				throw new FormatException("isNaN() requires one parameter.");
			}
			try
			{
				object obj = functionArgs.Parameters[0].Evaluate();
				bool flag = ((obj is double d) ? double.IsNaN(d) : ((obj is float f) ? float.IsNaN(f) : ((!(obj is int) && !(obj is long) && !(obj is short) && !(obj is byte) && !(obj is sbyte) && !(obj is uint) && !(obj is ulong) && !(obj is ushort) && !(obj is decimal)) ? true : false)));
				functionArgs.Result = flag;
			}
			catch (Exception ex) when (!(ex is NCalcExtensionsException))
			{
				throw new FormatException(ex.Message);
			}
		}
	}
	internal static class IsNull
	{
		internal static void Evaluate(FunctionArgs functionArgs)
		{
			//IL_0034: Unknown result type (might be due to invalid IL or missing references)
			//IL_003b: Invalid comparison between Unknown and I4
			if (functionArgs.Parameters.Length != 1)
			{
				throw new FormatException("isNull() requires one parameter.");
			}
			try
			{
				object obj = functionArgs.Parameters[0].Evaluate();
				int num;
				if (obj != null)
				{
					JToken val = (JToken)((obj is JToken) ? obj : null);
					num = ((val != null && (int)val.Type == 10) ? 1 : 0);
				}
				else
				{
					num = 1;
				}
				functionArgs.Result = (byte)num != 0;
			}
			catch (Exception ex) when (!(ex is NCalcExtensionsException))
			{
				throw new FormatException(ex.Message);
			}
		}
	}
	internal static class IsNullOrEmpty
	{
		internal static void Evaluate(FunctionArgs functionArgs)
		{
			//IL_0034: Unknown result type (might be due to invalid IL or missing references)
			//IL_003b: Invalid comparison between Unknown and I4
			if (functionArgs.Parameters.Length != 1)
			{
				throw new FormatException("isNullOrEmpty() requires one parameter.");
			}
			try
			{
				object obj = functionArgs.Parameters[0].Evaluate();
				int num;
				if (obj != null)
				{
					JToken val = (JToken)((obj is JToken) ? obj : null);
					if (val == null || (int)val.Type != 10)
					{
						num = ((obj is string text && text == string.Empty) ? 1 : 0);
						goto IL_0058;
					}
				}
				num = 1;
				goto IL_0058;
				IL_0058:
				functionArgs.Result = (byte)num != 0;
			}
			catch (Exception ex) when (!(ex is NCalcExtensionsException))
			{
				throw new FormatException(ex.Message);
			}
		}
	}
	internal static class IsNullOrWhiteSpace
	{
		internal static void Evaluate(FunctionArgs functionArgs)
		{
			//IL_0034: Unknown result type (might be due to invalid IL or missing references)
			//IL_003b: Invalid comparison between Unknown and I4
			if (functionArgs.Parameters.Length != 1)
			{
				throw new FormatException("isNullOrWhiteSpace() requires one parameter.");
			}
			try
			{
				object obj = functionArgs.Parameters[0].Evaluate();
				int num;
				if (obj != null)
				{
					JToken val = (JToken)((obj is JToken) ? obj : null);
					if (val == null || (int)val.Type != 10)
					{
						num = ((obj is string value && string.IsNullOrWhiteSpace(value)) ? 1 : 0);
						goto IL_0053;
					}
				}
				num = 1;
				goto IL_0053;
				IL_0053:
				functionArgs.Result = (byte)num != 0;
			}
			catch (Exception ex) when (!(ex is NCalcExtensionsException))
			{
				throw new FormatException(ex.Message);
			}
		}
	}
	internal static class IsSet
	{
		internal static void Evaluate(FunctionArgs functionArgs)
		{
			FunctionArgs functionArgs2 = functionArgs;
			if (functionArgs2.Parameters.Length != 1)
			{
				throw new FormatException("isSet() requires one parameter.");
			}
			functionArgs2.Result = functionArgs2.Parameters[0].Parameters.Keys.Any((string p) => p == functionArgs2.Parameters[0].Evaluate() as string);
		}
	}
	internal static class ItemAtIndex
	{
		internal static void Evaluate(FunctionArgs functionArgs)
		{
			IList list;
			int num;
			try
			{
				list = (IList)functionArgs.Parameters[0].Evaluate();
				num = (int)functionArgs.Parameters[1].Evaluate();
				if (num < 0)
				{
					throw new Exception();
				}
			}
			catch (Exception ex) when (!(ex is NCalcExtensionsException))
			{
				throw new FormatException("itemAtIndex() requires two parameters.  The first should be an IList and the second should be a non-negative integer.");
			}
			functionArgs.Result = list[num];
		}
	}
	internal static class Join
	{
		internal static void Evaluate(FunctionArgs functionArgs)
		{
			List<string> values;
			string separator;
			try
			{
				object obj = functionArgs.Parameters[0].Evaluate();
				values = ((obj == null) ? new List<string>() : ((!(obj is List<object> source)) ? (obj as IEnumerable<string>).ToList() : source.Select((object u) => u?.ToString() ?? string.Empty).ToList()));
				separator = (string)functionArgs.Parameters[1].Evaluate();
			}
			catch (Exception ex) when (!(ex is NCalcExtensionsException))
			{
				throw new FormatException("join() requires that the first parameter is a list or enumerable and that the second parameter is a string.");
			}
			functionArgs.Result = string.Join(separator, values);
		}
	}
	internal static class JPath
	{
		internal static void Evaluate(FunctionArgs functionArgs)
		{
			bool flag = false;
			if (functionArgs.Parameters.Length > 3)
			{
				throw new FormatException("jPath function - first parameter should be an object capable of being converted to a JObject and second a string jPath expression with optional third parameter returnNullIfNotFound.");
			}
			JObject val2;
			string text;
			try
			{
				object obj = functionArgs.Parameters[0].Evaluate() ?? throw new NCalcExtensionsException("jPath function - parameter 1 should not be null.");
				JObject val = (JObject)((obj is JObject) ? obj : null);
				val2 = ((val == null) ? JObject.FromObject(obj) : val);
				text = (string)functionArgs.Parameters[1].Evaluate();
			}
			catch (Exception ex) when (!(ex is NCalcExtensionsException))
			{
				throw new FormatException("jPath function - first parameter should be an object capable of being converted to a JObject and second a string jPath expression with optional third parameter returnNullIfNotFound. ... " + ex.Message);
			}
			if (functionArgs.Parameters.Length >= 3)
			{
				try
				{
					flag = (bool)functionArgs.Parameters[2].Evaluate();
				}
				catch (Exception)
				{
					throw new FormatException("jPath function - parameter 3 should be a bool.");
				}
			}
			JToken val3;
			try
			{
				val3 = ((JToken)val2).SelectToken(text);
			}
			catch (Exception ex3)
			{
				throw new NCalcExtensionsException("jPath function - An unknown issue occurred while trying to select jPathExpression value: " + ex3.Message);
			}
			if (val3 == null)
			{
				if (flag)
				{
					functionArgs.Result = null;
					return;
				}
				throw new NCalcExtensionsException("jPath function - jPath expression did not result in a match.");
			}
			JValue val4 = (JValue)(object)((val3 is JValue) ? val3 : null);
			object result;
			if (val4 == null)
			{
				JArray val5 = (JArray)(object)((val3 is JArray) ? val3 : null);
				result = ((val5 == null) ? ((object)JObject.FromObject((object)val3)) : ((object)val5));
			}
			else
			{
				result = val4.Value;
			}
			functionArgs.Result = result;
		}
	}
	internal static class LambdaFunction
	{
		internal static void Evaluate(FunctionArgs functionArgs, Dictionary<string, object?> storageDictionary)
		{
			string predicate;
			string nCalcString;
			try
			{
				predicate = (string)functionArgs.Parameters[0].Evaluate();
				nCalcString = (string)functionArgs.Parameters[1].Evaluate();
			}
			catch (Exception ex) when (!(ex is NCalcExtensionsException))
			{
				throw new FormatException("store() requires two parameters.");
			}
			functionArgs.Result = new Lambda(predicate, nCalcString, storageDictionary);
		}
	}
	internal static class LastIndexOf
	{
		internal static void Evaluate(FunctionArgs functionArgs)
		{
			try
			{
				string text = (string)functionArgs.Parameters[0].Evaluate();
				string value = (string)functionArgs.Parameters[1].Evaluate();
				functionArgs.Result = text.LastIndexOf(value, StringComparison.InvariantCulture);
			}
			catch (Exception ex) when (!(ex is NCalcExtensionsException))
			{
				throw new FormatException("lastIndexOf() requires two string parameters.");
			}
		}
	}
	internal static class Length
	{
		internal static void Evaluate(FunctionArgs functionArgs)
		{
			try
			{
				object obj = functionArgs.Parameters[0].Evaluate();
				if (obj is string text)
				{
					functionArgs.Result = text.Length;
				}
				else
				{
					functionArgs.Result = GetLength(obj);
				}
			}
			catch (Exception ex) when (!(ex is NCalcExtensionsException))
			{
				throw new FormatException("length() requires one string or IList parameter.");
			}
		}

		private static int GetLength(object value)
		{
			if (value is IList list)
			{
				return list.Count;
			}
			throw new FormatException("length() requires one string or IList parameter.");
		}
	}
	internal static class List
	{
		internal static void Evaluate(FunctionArgs functionArgs)
		{
			functionArgs.Result = functionArgs.Parameters.Select((Expression p) => p.Evaluate()).ToList();
		}
	}
	internal static class ListHelpers
	{
		internal static List<object?> Collapse(this List<object?> value)
		{
			while (value.All((object v) => v?.GetType() == typeof(List<object>)))
			{
				if (value.Count == 0)
				{
					return new List<object>();
				}
				value = value.SelectMany((object v) => v as List<object>).ToList();
			}
			return value;
		}
	}
	internal static class ListOf
	{
		internal static void Evaluate(FunctionArgs functionArgs)
		{
			string text = (functionArgs.Parameters[0].Evaluate() as string) ?? throw new FormatException("First listOf parameter must be a string.");
			Expression[] remainingParameters = functionArgs.Parameters.Skip(1).ToArray();
			switch (text)
			{
			case "byte":
				functionArgs.Result = GetListOf<byte>(remainingParameters);
				break;
			case "byte?":
				functionArgs.Result = GetListOf<byte?>(remainingParameters);
				break;
			case "short":
				functionArgs.Result = GetListOf<short>(remainingParameters);
				break;
			case "short?":
				functionArgs.Result = GetListOf<short?>(remainingParameters);
				break;
			case "int":
				functionArgs.Result = GetListOf<int>(remainingParameters);
				break;
			case "int?":
				functionArgs.Result = GetListOf<int?>(remainingParameters);
				break;
			case "long":
				functionArgs.Result = GetListOf<long>(remainingParameters);
				break;
			case "long?":
				functionArgs.Result = GetListOf<long?>(remainingParameters);
				break;
			case "float":
				functionArgs.Result = GetListOf<float>(remainingParameters);
				break;
			case "float?":
				functionArgs.Result = GetListOf<float?>(remainingParameters);
				break;
			case "double":
				functionArgs.Result = GetListOf<double>(remainingParameters);
				break;
			case "double?":
				functionArgs.Result = GetListOf<double?>(remainingParameters);
				break;
			case "decimal":
				functionArgs.Result = GetListOf<decimal>(remainingParameters);
				break;
			case "decimal?":
				functionArgs.Result = GetListOf<decimal?>(remainingParameters);
				break;
			case "string":
				functionArgs.Result = GetListOf<string>(remainingParameters);
				break;
			case "string?":
				functionArgs.Result = GetListOf<string>(remainingParameters);
				break;
			case "object":
				functionArgs.Result = GetListOf<object>(remainingParameters);
				break;
			case "object?":
				functionArgs.Result = GetListOf<object>(remainingParameters);
				break;
			default:
				throw new FormatException("First listOf parameter must be a string of a numeric or string type.");
			}
		}

		private static List<T> GetListOf<T>(Expression[] remainingParameters)
		{
			List<T> list = new List<T>();
			foreach (Expression val in remainingParameters)
			{
				object obj = val.Evaluate();
				if (typeof(T) == typeof(object))
				{
					list.Add((T)obj);
				}
				else if (Nullable.GetUnderlyingType(typeof(T)) != null && obj == null)
				{
					list.Add(default(T));
				}
				else if (Nullable.GetUnderlyingType(typeof(T)) != null && obj != null)
				{
					Type underlyingType = Nullable.GetUnderlyingType(typeof(T));
					if (underlyingType != null)
					{
						object obj2 = Convert.ChangeType(obj, underlyingType);
						list.Add((T)obj2);
					}
				}
				else if (obj is T item)
				{
					list.Add(item);
				}
				else
				{
					if (!(Convert.ChangeType(obj, typeof(T)) is T item2))
					{
						throw new FormatException("Parameter must be of type " + TypeHelper.AsHumanString<T>() + ".");
					}
					list.Add(item2);
				}
			}
			return list;
		}
	}
	internal static class Max
	{
		internal static void Evaluate(FunctionArgs functionArgs)
		{
			object obj = functionArgs.Parameters[0].Evaluate();
			object result;
			if (functionArgs.Parameters.Length == 1)
			{
				object obj2 = obj;
				if (obj2 != null)
				{
					if (!(obj2 is IEnumerable<byte> source))
					{
						if (!(obj2 is IEnumerable<byte?> source2))
						{
							if (!(obj2 is IEnumerable<short> source3))
							{
								if (!(obj2 is IEnumerable<short?> source4))
								{
									if (!(obj2 is IEnumerable<int> source5))
									{
										if (!(obj2 is IEnumerable<int?> source6))
										{
											if (!(obj2 is IEnumerable<long> source7))
											{
												if (!(obj2 is IEnumerable<long?> source8))
												{
													if (!(obj2 is IEnumerable<float> source9))
													{
														if (!(obj2 is IEnumerable<float?> source10))
														{
															if (!(obj2 is IEnumerable<double> source11))
															{
																if (!(obj2 is IEnumerable<double?> source12))
																{
																	if (!(obj2 is IEnumerable<decimal> source13))
																	{
																		if (!(obj2 is IEnumerable<decimal?> source14))
																		{
																			if (!(obj2 is IEnumerable<string> source15))
																			{
																				if (!(obj2 is IEnumerable<object> enumerable))
																				{
																					throw new FormatException("First max parameter must be an IEnumerable of a numeric or string type if only on parameter is present.");
																				}
																				if (enumerable.All((object x) => (x is string || x == null) ? true : false))
																				{
																					result = enumerable.DefaultIfEmpty(null).Max((object x) => x as string);
																				}
																				else
																				{
																					IEnumerable<object> objectList = enumerable;
																					result = GetMax(objectList);
																				}
																			}
																			else
																			{
																				result = source15.DefaultIfEmpty(null).Max();
																			}
																		}
																		else
																		{
																			result = source14.DefaultIfEmpty(null).Max();
																		}
																	}
																	else
																	{
																		result = source13.Max();
																	}
																}
																else
																{
																	result = source12.DefaultIfEmpty(null).Max();
																}
															}
															else
															{
																result = source11.Max();
															}
														}
														else
														{
															result = source10.DefaultIfEmpty(null).Max();
														}
													}
													else
													{
														result = source9.Max();
													}
												}
												else
												{
													result = source8.DefaultIfEmpty(null).Max();
												}
											}
											else
											{
												result = source7.Max();
											}
										}
										else
										{
											result = source6.DefaultIfEmpty(null).Max();
										}
									}
									else
									{
										result = source5.Max();
									}
								}
								else
								{
									result = source4.DefaultIfEmpty(null).Max();
								}
							}
							else
							{
								result = source3.Cast<int>().Max();
							}
						}
						else
						{
							result = source2.DefaultIfEmpty(null).Max();
						}
					}
					else
					{
						result = source.Cast<int>().Max();
					}
				}
				else
				{
					result = null;
				}
				functionArgs.Result = result;
				return;
			}
			string predicate = (functionArgs.Parameters[1].Evaluate() as string) ?? throw new FormatException("Second max parameter must be a string.");
			string nCalcString = (functionArgs.Parameters[2].Evaluate() as string) ?? throw new FormatException("Third max parameter must be a string.");
			Lambda lambda = new Lambda(predicate, nCalcString, functionArgs.Parameters[0].Parameters);
			if (!(obj is IEnumerable<byte> source16))
			{
				if (!(obj is IEnumerable<byte?> source17))
				{
					if (!(obj is IEnumerable<short> source18))
					{
						if (!(obj is IEnumerable<short?> source19))
						{
							if (!(obj is IEnumerable<int> source20))
							{
								if (!(obj is IEnumerable<int?> source21))
								{
									if (!(obj is IEnumerable<long> source22))
									{
										if (!(obj is IEnumerable<long?> source23))
										{
											if (!(obj is IEnumerable<float> source24))
											{
												if (!(obj is IEnumerable<float?> source25))
												{
													if (!(obj is IEnumerable<double> source26))
													{
														if (!(obj is IEnumerable<double?> source27))
														{
															if (!(obj is IEnumerable<decimal> source28))
															{
																if (!(obj is IEnumerable<decimal?> source29))
																{
																	if (!(obj is IEnumerable<string> source30))
																	{
																		throw new FormatException("First max parameter must be an IEnumerable of a numeric type.");
																	}
																	result = source30.Max((string value) => (string)lambda.Evaluate(value));
																}
																else
																{
																	result = source29.Max((decimal? value) => (decimal?)lambda.Evaluate(value));
																}
															}
															else
															{
																result = source28.Max((decimal value) => (decimal?)lambda.Evaluate(value));
															}
														}
														else
														{
															result = source27.Max((double? value) => (double?)lambda.Evaluate(value));
														}
													}
													else
													{
														result = source26.Max((double value) => (double?)lambda.Evaluate(value));
													}
												}
												else
												{
													result = source25.Max((float? value) => (float?)lambda.Evaluate(value));
												}
											}
											else
											{
												result = source24.Max((float value) => (float?)lambda.Evaluate(value));
											}
										}
										else
										{
											result = source23.Max((long? value) => (long?)lambda.Evaluate(value));
										}
									}
									else
									{
										result = source22.Max((long value) => (long?)lambda.Evaluate(value));
									}
								}
								else
								{
									result = source21.Max((int? value) => (int?)lambda.Evaluate(value));
								}
							}
							else
							{
								result = source20.Max((int value) => (int?)lambda.Evaluate(value));
							}
						}
						else
						{
							result = source19.Cast<int>().Max((int value) => (int?)lambda.Evaluate(value));
						}
					}
					else
					{
						result = source18.Cast<int>().Max((int value) => (int?)lambda.Evaluate(value));
					}
				}
				else
				{
					result = source17.Cast<int>().Max((int value) => (int?)lambda.Evaluate(value));
				}
			}
			else
			{
				result = source16.Cast<int>().Max((int value) => (int?)lambda.Evaluate(value));
			}
			functionArgs.Result = result;
		}

		private static double GetMax(IEnumerable<object?> objectList)
		{
			//IL_0101: Unknown result type (might be due to invalid IL or missing references)
			//IL_0106: Unknown result type (might be due to invalid IL or missing references)
			//IL_0108: Unknown result type (might be due to invalid IL or missing references)
			//IL_010b: Invalid comparison between Unknown and I4
			//IL_010d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0110: Invalid comparison between Unknown and I4
			//IL_0130: Unknown result type (might be due to invalid IL or missing references)
			double num = 0.0;
			foreach (object @object in objectList)
			{
				double num8;
				if (!(@object is byte b))
				{
					if (!(@object is short num2))
					{
						if (!(@object is int num3))
						{
							if (!(@object is long num4))
							{
								if (!(@object is float num5))
								{
									if (!(@object is double num6))
									{
										if (!(@object is decimal num7))
										{
											JValue val = (JValue)((@object is JValue) ? @object : null);
											if (val == null)
											{
												if (@object != null)
												{
													throw new FormatException("Found unsupported type '" + @object?.GetType().Name + "' when completing sum.");
												}
												num8 = 0.0;
											}
											else
											{
												JTokenType type = ((JToken)val).Type;
												float num9;
												if ((int)type != 6)
												{
													if ((int)type != 7)
													{
														throw new FormatException($"Found unsupported JToken type '{((JToken)val).Type}' when completing sum.");
													}
													num9 = Extensions.Value<float>((IEnumerable<JToken>)val);
												}
												else
												{
													num9 = Extensions.Value<int>((IEnumerable<JToken>)val);
												}
												num8 = num9;
											}
										}
										else
										{
											num8 = (double)num7;
										}
									}
									else
									{
										num8 = num6;
									}
								}
								else
								{
									num8 = num5;
								}
							}
							else
							{
								num8 = num4;
							}
						}
						else
						{
							num8 = num3;
						}
					}
					else
					{
						num8 = num2;
					}
				}
				else
				{
					num8 = (int)b;
				}
				double num10 = num8;
				if (num10 < num)
				{
					num = num10;
				}
			}
			return num;
		}
	}
	internal static class MaxValue
	{
		private const string ErrorMessage = "maxValue takes exactly one string parameter, which must be one of 'sbyte', 'byte', 'short', 'ushort', 'int', 'uint', 'long', 'ulong', 'float', 'double' or 'decimal'.";

		internal static void Evaluate(FunctionArgs functionArgs)
		{
			object obj = functionArgs.Parameters[0].Evaluate();
			if (functionArgs.Parameters.Length != 1)
			{
				throw new FormatException("maxValue takes exactly one string parameter, which must be one of 'sbyte', 'byte', 'short', 'ushort', 'int', 'uint', 'long', 'ulong', 'float', 'double' or 'decimal'.");
			}
			functionArgs.Result = (obj as string) switch
			{
				"sbyte" => sbyte.MaxValue, 
				"byte" => byte.MaxValue, 
				"short" => short.MaxValue, 
				"ushort" => ushort.MaxValue, 
				"int" => int.MaxValue, 
				"uint" => uint.MaxValue, 
				"long" => long.MaxValue, 
				"ulong" => ulong.MaxValue, 
				"float" => float.MaxValue, 
				"double" => double.MaxValue, 
				"decimal" => decimal.MaxValue, 
				_ => throw new FormatException("maxValue takes exactly one string parameter, which must be one of 'sbyte', 'byte', 'short', 'ushort', 'int', 'uint', 'long', 'ulong', 'float', 'double' or 'decimal'."), 
			};
		}
	}
	internal static class Min
	{
		internal static void Evaluate(FunctionArgs functionArgs)
		{
			object obj = functionArgs.Parameters[0].Evaluate();
			object result;
			if (functionArgs.Parameters.Length == 1)
			{
				object obj2 = obj;
				if (obj2 != null)
				{
					if (!(obj2 is IEnumerable<byte> source))
					{
						if (!(obj2 is IEnumerable<byte?> source2))
						{
							if (!(obj2 is IEnumerable<short> source3))
							{
								if (!(obj2 is IEnumerable<short?> source4))
								{
									if (!(obj2 is IEnumerable<int> source5))
									{
										if (!(obj2 is IEnumerable<int?> source6))
										{
											if (!(obj2 is IEnumerable<long> source7))
											{
												if (!(obj2 is IEnumerable<long?> source8))
												{
													if (!(obj2 is IEnumerable<float> source9))
													{
														if (!(obj2 is IEnumerable<float?> source10))
														{
															if (!(obj2 is IEnumerable<double> source11))
															{
																if (!(obj2 is IEnumerable<double?> source12))
																{
																	if (!(obj2 is IEnumerable<decimal> source13))
																	{
																		if (!(obj2 is IEnumerable<decimal?> source14))
																		{
																			if (!(obj2 is IEnumerable<string> source15))
																			{
																				if (!(obj2 is IEnumerable<object> enumerable))
																				{
																					throw new FormatException("First min parameter must be an IEnumerable of a numeric or string type if only one parameter is present.");
																				}
																				if (enumerable.All((object x) => (x is string || x == null) ? true : false))
																				{
																					result = enumerable.DefaultIfEmpty(null).Min((object x) => x as string);
																				}
																				else
																				{
																					IEnumerable<object> objectList = enumerable;
																					result = GetMin(objectList);
																				}
																			}
																			else
																			{
																				result = source15.DefaultIfEmpty(null).Min();
																			}
																		}
																		else
																		{
																			result = source14.DefaultIfEmpty(null).Min();
																		}
																	}
																	else
																	{
																		result = source13.Min();
																	}
																}
																else
																{
																	result = source12.DefaultIfEmpty(null).Min();
																}
															}
															else
															{
																result = source11.Min();
															}
														}
														else
														{
															result = source10.DefaultIfEmpty(null).Min();
														}
													}
													else
													{
														result = source9.Min();
													}
												}
												else
												{
													result = source8.DefaultIfEmpty(null).Min();
												}
											}
											else
											{
												result = source7.Min();
											}
										}
										else
										{
											result = source6.DefaultIfEmpty(null).Min();
										}
									}
									else
									{
										result = source5.Min();
									}
								}
								else
								{
									result = source4.DefaultIfEmpty(null).Min();
								}
							}
							else
							{
								result = source3.Cast<int>().Min();
							}
						}
						else
						{
							result = source2.DefaultIfEmpty(null).Min();
						}
					}
					else
					{
						result = source.Cast<int>().Min();
					}
				}
				else
				{
					result = null;
				}
				functionArgs.Result = result;
				return;
			}
			string predicate = (functionArgs.Parameters[1].Evaluate() as string) ?? throw new FormatException("Second min parameter must be a string.");
			string nCalcString = (functionArgs.Parameters[2].Evaluate() as string) ?? throw new FormatException("Third min parameter must be a string.");
			Lambda lambda = new Lambda(predicate, nCalcString, functionArgs.Parameters[0].Parameters);
			if (!(obj is IEnumerable<byte> source16))
			{
				if (!(obj is IEnumerable<byte?> source17))
				{
					if (!(obj is IEnumerable<short> source18))
					{
						if (!(obj is IEnumerable<short?> source19))
						{
							if (!(obj is IEnumerable<int> source20))
							{
								if (!(obj is IEnumerable<int?> source21))
								{
									if (!(obj is IEnumerable<long> source22))
									{
										if (!(obj is IEnumerable<long?> source23))
										{
											if (!(obj is IEnumerable<float> source24))
											{
												if (!(obj is IEnumerable<float?> source25))
												{
													if (!(obj is IEnumerable<double> source26))
													{
														if (!(obj is IEnumerable<double?> source27))
														{
															if (!(obj is IEnumerable<decimal> source28))
															{
																if (!(obj is IEnumerable<decimal?> source29))
																{
																	if (!(obj is IEnumerable<string> source30))
																	{
																		throw new FormatException("First min parameter must be an IEnumerable of a numeric type.");
																	}
																	result = source30.Min((string value) => (string)lambda.Evaluate(value));
																}
																else
																{
																	result = source29.Min((decimal? value) => (decimal?)lambda.Evaluate(value));
																}
															}
															else
															{
																result = source28.Min((decimal value) => (decimal?)lambda.Evaluate(value));
															}
														}
														else
														{
															result = source27.Min((double? value) => (double?)lambda.Evaluate(value));
														}
													}
													else
													{
														result = source26.Min((double value) => (double?)lambda.Evaluate(value));
													}
												}
												else
												{
													result = source25.Min((float? value) => (float?)lambda.Evaluate(value));
												}
											}
											else
											{
												result = source24.Min((float value) => (float?)lambda.Evaluate(value));
											}
										}
										else
										{
											result = source23.Min((long? value) => (long?)lambda.Evaluate(value));
										}
									}
									else
									{
										result = source22.Min((long value) => (long?)lambda.Evaluate(value));
									}
								}
								else
								{
									result = source21.Min((int? value) => (int?)lambda.Evaluate(value));
								}
							}
							else
							{
								result = source20.Min((int value) => (int?)lambda.Evaluate(value));
							}
						}
						else
						{
							result = source19.Cast<int>().Min((int value) => (int?)lambda.Evaluate(value));
						}
					}
					else
					{
						result = source18.Cast<int>().Min((int value) => (int?)lambda.Evaluate(value));
					}
				}
				else
				{
					result = source17.Cast<int>().Min((int value) => (int?)lambda.Evaluate(value));
				}
			}
			else
			{
				result = source16.Cast<int>().Min((int value) => (int?)lambda.Evaluate(value));
			}
			functionArgs.Result = result;
		}

		private static double GetMin(IEnumerable<object?> objectList)
		{
			//IL_0101: Unknown result type (might be due to invalid IL or missing references)
			//IL_0106: Unknown result type (might be due to invalid IL or missing references)
			//IL_0108: Unknown result type (might be due to invalid IL or missing references)
			//IL_010b: Invalid comparison between Unknown and I4
			//IL_010d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0110: Invalid comparison between Unknown and I4
			//IL_0130: Unknown result type (might be due to invalid IL or missing references)
			double num = 0.0;
			foreach (object @object in objectList)
			{
				double num8;
				if (!(@object is byte b))
				{
					if (!(@object is short num2))
					{
						if (!(@object is int num3))
						{
							if (!(@object is long num4))
							{
								if (!(@object is float num5))
								{
									if (!(@object is double num6))
									{
										if (!(@object is decimal num7))
										{
											JValue val = (JValue)((@object is JValue) ? @object : null);
											if (val == null)
											{
												if (@object != null)
												{
													throw new FormatException("Found unsupported type '" + @object?.GetType().Name + "' when completing sum.");
												}
												num8 = 0.0;
											}
											else
											{
												JTokenType type = ((JToken)val).Type;
												float num9;
												if ((int)type != 6)
												{
													if ((int)type != 7)
													{
														throw new FormatException($"Found unsupported JToken type '{((JToken)val).Type}' when completing sum.");
													}
													num9 = Extensions.Value<float>((IEnumerable<JToken>)val);
												}
												else
												{
													num9 = Extensions.Value<int>((IEnumerable<JToken>)val);
												}
												num8 = num9;
											}
										}
										else
										{
											num8 = (double)num7;
										}
									}
									else
									{
										num8 = num6;
									}
								}
								else
								{
									num8 = num5;
								}
							}
							else
							{
								num8 = num4;
							}
						}
						else
						{
							num8 = num3;
						}
					}
					else
					{
						num8 = num2;
					}
				}
				else
				{
					num8 = (int)b;
				}
				double num10 = num8;
				if (num10 < num)
				{
					num = num10;
				}
			}
			return num;
		}
	}
	internal static class MinValue
	{
		private const string ErrorMessage = "minValue takes exactly one string parameter, which must be one of 'sbyte', 'byte', 'short', 'ushort', 'int', 'uint', 'long', 'ulong', 'float', 'double' or 'decimal'.";

		internal static void Evaluate(FunctionArgs functionArgs)
		{
			object obj = functionArgs.Parameters[0].Evaluate();
			if (functionArgs.Parameters.Length != 1)
			{
				throw new FormatException("minValue takes exactly one string parameter, which must be one of 'sbyte', 'byte', 'short', 'ushort', 'int', 'uint', 'long', 'ulong', 'float', 'double' or 'decimal'.");
			}
			functionArgs.Result = (obj as string) switch
			{
				"sbyte" => sbyte.MinValue, 
				"byte" => (byte)0, 
				"short" => short.MinValue, 
				"ushort" => (ushort)0, 
				"int" => int.MinValue, 
				"uint" => 0u, 
				"long" => long.MinValue, 
				"ulong" => 0uL, 
				"float" => float.MinValue, 
				"double" => double.MinValue, 
				"decimal" => decimal.MinValue, 
				_ => throw new FormatException("minValue takes exactly one string parameter, which must be one of 'sbyte', 'byte', 'short', 'ushort', 'int', 'uint', 'long', 'ulong', 'float', 'double' or 'decimal'."), 
			};
		}
	}
	internal static class NewJObject
	{
		internal static void Evaluate(FunctionArgs functionArgs)
		{
			//IL_0019: Unknown result type (might be due to invalid IL or missing references)
			//IL_001f: Expected O, but got Unknown
			if (functionArgs.Parameters.Length % 2 != 0)
			{
				throw new FormatException("jObject() requires an even number of parameters.");
			}
			int num = 0;
			JObject val = new JObject();
			while (num < functionArgs.Parameters.Length)
			{
				if (!(functionArgs.Parameters[num++].Evaluate() is string text))
				{
					throw new FormatException("jObject() requires a string key.");
				}
				if (val.ContainsKey(text))
				{
					throw new FormatException("jObject() can only define property " + text + " once.");
				}
				object obj = functionArgs.Parameters[num++].Evaluate();
				val.Add(text, (JToken)((obj == null) ? ((object)JValue.CreateNull()) : ((object)JToken.FromObject(obj))));
			}
			functionArgs.Result = val;
		}
	}
	internal static class SetProperties
	{
		internal static void Evaluate(FunctionArgs functionArgs)
		{
			if (functionArgs.Parameters.Length % 2 != 1)
			{
				throw new FormatException("setProperties() requires an odd number of parameters.");
			}
			int num = 0;
			object obj = functionArgs.Parameters[num++].Evaluate();
			JObject val = (JObject)((obj is JObject) ? obj : null);
			JObject val2 = ((val == null) ? JObject.FromObject(obj) : val);
			while (num < functionArgs.Parameters.Length)
			{
				if (!(functionArgs.Parameters[num++].Evaluate() is string text))
				{
					throw new FormatException("setProperties() requires a string key.");
				}
				if (val2.ContainsKey(text))
				{
					throw new FormatException("setProperties() can only define property " + text + " once.");
				}
				object obj2 = functionArgs.Parameters[num++].Evaluate();
				val2.Add(text, (JToken)((obj2 == null) ? ((object)JValue.CreateNull()) : ((object)JToken.FromObject(obj2))));
			}
			functionArgs.Result = val2;
		}
	}
	internal static class NullCoalesce
	{
		internal static void Evaluate(FunctionArgs functionArgs)
		{
			Expression[] parameters = functionArgs.Parameters;
			foreach (Expression val in parameters)
			{
				object obj = val.Evaluate();
				if (obj != null)
				{
					functionArgs.Result = obj;
					return;
				}
			}
			functionArgs.Result = null;
		}
	}
	internal static class OrderBy
	{
		internal static void Evaluate(FunctionArgs functionArgs)
		{
			int num = 0;
			IEnumerable<object> source = (functionArgs.Parameters[num++].Evaluate() as IEnumerable<object>) ?? throw new FormatException("First orderBy parameter must be an IEnumerable.");
			string predicate = (functionArgs.Parameters[num++].Evaluate() as string) ?? throw new FormatException("Second orderBy parameter must be a string.");
			string nCalcString = (functionArgs.Parameters[num++].Evaluate() as string) ?? throw new FormatException("Third orderBy parameter must be a string.");
			Lambda lambda = new Lambda(predicate, nCalcString, functionArgs.Parameters[0].Parameters);
			IOrderedEnumerable<object> source2 = source.OrderBy((object value) => lambda.Evaluate(value));
			int num2 = functionArgs.Parameters.Length;
			while (num < num2)
			{
				nCalcString = (functionArgs.Parameters[num++].Evaluate() as string) ?? throw new FormatException(string.Format("{0} parameter {1} must be a string.", "orderBy", num + 1));
				lambda = new Lambda(predicate, nCalcString, functionArgs.Parameters[0].Parameters);
				source2 = source2.ThenBy((object value) => lambda.Evaluate(value));
			}
			functionArgs.Result = source2.ToList();
		}
	}
	internal static class PadLeft
	{
		internal static void Evaluate(FunctionArgs functionArgs)
		{
			string text;
			int num;
			char paddingChar;
			try
			{
				text = (string)functionArgs.Parameters[0].Evaluate();
				num = (int)functionArgs.Parameters[1].Evaluate();
				if (num < 1)
				{
					throw new NCalcExtensionsException("padLeft() requires a DesiredStringLength for parameter 2 that is >= 1.");
				}
				string text2 = (functionArgs.Parameters[2].Evaluate() as string) ?? throw new NCalcExtensionsException("padLeft() requires that parameter 3 be a string.");
				if (text2.Length != 1)
				{
					throw new NCalcExtensionsException("padLeft() requires a single character string for parameter 3.");
				}
				paddingChar = text2[0];
			}
			catch (Exception ex) when (!(ex is NCalcExtensionsException))
			{
				throw new FormatException("padLeft() requires a string Input, an integer DesiredStringLength, and a single Padding character.");
			}
			functionArgs.Result = text.PadLeft(num, paddingChar);
		}
	}
	internal static class Parameters
	{
		internal static T1 GetParameter<T1>(FunctionArgs args, [CallerMemberName] string callerName = "")
		{
			CheckParameterCount(1, 1, args.Parameters, callerName);
			T1 val = (T1)args.Parameters[0].Evaluate();
			if (val == null)
			{
				throw new FormatException(callerName + " argument should be a " + typeof(T1).Name + ".");
			}
			return val;
		}

		internal static Tuple<T1, T2> GetParameters<T1, T2>(FunctionArgs args, [CallerMemberName] string callerName = "")
		{
			CheckParameterCount(2, 2, args.Parameters, callerName);
			int num = 0;
			T1 val = (T1)args.Parameters[num++].Evaluate();
			if (val == null)
			{
				throw new FormatException(callerName + " first argument should be a " + typeof(T1).Name + ".");
			}
			T2 val2 = (T2)args.Parameters[num++].Evaluate();
			if (val2 == null)
			{
				throw new FormatException(callerName + " second argument should be a " + typeof(T2).Name + ".");
			}
			return new Tuple<T1, T2>(val, val2);
		}

		internal static Tuple<T1, T2, T3> GetParameters<T1, T2, T3>(FunctionArgs args, [CallerMemberName] string callerName = "")
		{
			CheckParameterCount(3, 3, args.Parameters, callerName);
			int num = 0;
			T1 val = (T1)args.Parameters[num++].Evaluate();
			if (val == null)
			{
				throw new FormatException(callerName + " first argument should be a " + typeof(T1).Name + ".");
			}
			T2 val2 = (T2)args.Parameters[num++].Evaluate();
			if (val2 == null)
			{
				throw new FormatException(callerName + " second argument should be a " + typeof(T2).Name + ".");
			}
			T3 val3 = (T3)args.Parameters[num++].Evaluate();
			if (val3 == null)
			{
				throw new FormatException(callerName + " third argument should be a " + typeof(T3).Name + ".");
			}
			return new Tuple<T1, T2, T3>(val, val2, val3);
		}

		internal static Tuple<T1, T2, T3, T4> GetParameters<T1, T2, T3, T4>(FunctionArgs args, [CallerMemberName] string callerName = "")
		{
			CheckParameterCount(4, 4, args.Parameters, callerName);
			int num = 0;
			T1 val = (T1)args.Parameters[num++].Evaluate();
			if (val == null)
			{
				throw new FormatException(callerName + " first argument should be a " + typeof(T1).Name + ".");
			}
			T2 val2 = (T2)args.Parameters[num++].Evaluate();
			if (val2 == null)
			{
				throw new FormatException(callerName + " second argument should be a " + typeof(T2).Name + ".");
			}
			T3 val3 = (T3)args.Parameters[num++].Evaluate();
			if (val3 == null)
			{
				throw new FormatException(callerName + " third argument should be a " + typeof(T3).Name + ".");
			}
			T4 val4 = (T4)args.Parameters[num++].Evaluate();
			if (val4 == null)
			{
				throw new FormatException(callerName + " fourth argument should be a " + typeof(T4).Name + ".");
			}
			return new Tuple<T1, T2, T3, T4>(val, val2, val3, val4);
		}

		internal static Tuple<T1, T2, T3, T4, T5> GetParameters<T1, T2, T3, T4, T5>(FunctionArgs args, [CallerMemberName] string callerName = "")
		{
			CheckParameterCount(5, 5, args.Parameters, callerName);
			int num = 0;
			T1 val = (T1)args.Parameters[num++].Evaluate();
			if (val == null)
			{
				throw new FormatException(callerName + " first argument should be a " + typeof(T1).Name + ".");
			}
			T2 val2 = (T2)args.Parameters[num++].Evaluate();
			if (val2 == null)
			{
				throw new FormatException(callerName + " second argument should be a " + typeof(T2).Name + ".");
			}
			T3 val3 = (T3)args.Parameters[num++].Evaluate();
			if (val3 == null)
			{
				throw new FormatException(callerName + " third argument should be a " + typeof(T3).Name + ".");
			}
			T4 val4 = (T4)args.Parameters[num++].Evaluate();
			if (val4 == null)
			{
				throw new FormatException(callerName + " fourth argument should be a " + typeof(T4).Name + ".");
			}
			T5 val5 = (T5)args.Parameters[num++].Evaluate();
			if (val5 == null)
			{
				throw new FormatException(callerName + " fifth argument should be a " + typeof(T5).Name + ".");
			}
			return new Tuple<T1, T2, T3, T4, T5>(val, val2, val3, val4, val5);
		}

		internal static Tuple<T1, T2, T3, T4, T5, T6> GetParameters<T1, T2, T3, T4, T5, T6>(FunctionArgs args, [CallerMemberName] string callerName = "")
		{
			CheckParameterCount(6, 6, args.Parameters, callerName);
			int num = 0;
			T1 val = (T1)args.Parameters[num++].Evaluate();
			if (val == null)
			{
				throw new FormatException(callerName + " first argument should be a " + typeof(T1).Name + ".");
			}
			T2 val2 = (T2)args.Parameters[num++].Evaluate();
			if (val2 == null)
			{
				throw new FormatException(callerName + " second argument should be a " + typeof(T2).Name + ".");
			}
			T3 val3 = (T3)args.Parameters[num++].Evaluate();
			if (val3 == null)
			{
				throw new FormatException(callerName + " third argument should be a " + typeof(T3).Name + ".");
			}
			T4 val4 = (T4)args.Parameters[num++].Evaluate();
			if (val4 == null)
			{
				throw new FormatException(callerName + " fourth argument should be a " + typeof(T4).Name + ".");
			}
			T5 val5 = (T5)args.Parameters[num++].Evaluate();
			if (val5 == null)
			{
				throw new FormatException(callerName + " fifth argument should be a " + typeof(T5).Name + ".");
			}
			T6 val6 = (T6)args.Parameters[num++].Evaluate();
			if (val6 == null)
			{
				throw new FormatException(callerName + " sixth argument should be a " + typeof(T6).Name + ".");
			}
			return new Tuple<T1, T2, T3, T4, T5, T6>(val, val2, val3, val4, val5, val6);
		}

		internal static Tuple<T1, T2, T3, T4, T5, T6, T7> GetParameters<T1, T2, T3, T4, T5, T6, T7>(FunctionArgs args, [CallerMemberName] string callerName = "")
		{
			CheckParameterCount(7, 7, args.Parameters, callerName);
			int num = 0;
			T1 val = (T1)args.Parameters[num++].Evaluate();
			if (val == null)
			{
				throw new FormatException(callerName + " first argument should be a " + typeof(T1).Name + ".");
			}
			T2 val2 = (T2)args.Parameters[num++].Evaluate();
			if (val2 == null)
			{
				throw new FormatException(callerName + " second argument should be a " + typeof(T2).Name + ".");
			}
			T3 val3 = (T3)args.Parameters[num++].Evaluate();
			if (val3 == null)
			{
				throw new FormatException(callerName + " third argument should be a " + typeof(T3).Name + ".");
			}
			T4 val4 = (T4)args.Parameters[num++].Evaluate();
			if (val4 == null)
			{
				throw new FormatException(callerName + " fourth argument should be a " + typeof(T4).Name + ".");
			}
			T5 val5 = (T5)args.Parameters[num++].Evaluate();
			if (val5 == null)
			{
				throw new FormatException(callerName + " fifth argument should be a " + typeof(T5).Name + ".");
			}
			T6 val6 = (T6)args.Parameters[num++].Evaluate();
			if (val6 == null)
			{
				throw new FormatException(callerName + " sixth argument should be a " + typeof(T6).Name + ".");
			}
			T7 val7 = (T7)args.Parameters[num++].Evaluate();
			if (val7 == null)
			{
				throw new FormatException(callerName + " seventh argument should be a " + typeof(T7).Name + ".");
			}
			return new Tuple<T1, T2, T3, T4, T5, T6, T7>(val, val2, val3, val4, val5, val6, val7);
		}

		internal static void CheckParameterCount(int? minCount, int? maxCount, Expression[] parameters, [CallerMemberName] string callerName = "")
		{
			if (minCount.HasValue && parameters.Length < minCount.Value)
			{
				throw new FormatException($"{callerName} requires at least {minCount} parameters.");
			}
			if (maxCount.HasValue && parameters.Length > maxCount.Value)
			{
				throw new FormatException($"{callerName} requires at most {maxCount} parameters.");
			}
		}
	}
	internal static class Parse
	{
		internal static void Evaluate(FunctionArgs functionArgs)
		{
			if (functionArgs.Parameters.Length < 2)
			{
				throw new FormatException("parse function - requires at least two string parameters.");
			}
			int num = 0;
			string text = (functionArgs.Parameters[num++].Evaluate() as string) ?? throw new FormatException("parse function - first parameter should be a string.");
			string text2 = (functionArgs.Parameters[num++].Evaluate() as string) ?? throw new FormatException("parse function - second parameter should be a string.");
			try
			{
				object result;
				switch (text)
				{
				case "bool":
				{
					if (!bool.TryParse(text2, out var result12))
					{
						throw new FormatException("parse function - parameter '" + text2 + "' could not be parsed to type '" + text + "'.");
					}
					result = result12;
					break;
				}
				case "sbyte":
				{
					if (!sbyte.TryParse(text2, out var result7))
					{
						throw new FormatException("parse function - parameter '" + text2 + "' could not be parsed to type '" + text + "'.");
					}
					result = result7;
					break;
				}
				case "byte":
				{
					if (!byte.TryParse(text2, out var result13))
					{
						throw new FormatException("parse function - parameter '" + text2 + "' could not be parsed to type '" + text + "'.");
					}
					result = result13;
					break;
				}
				case "short":
				{
					if (!short.TryParse(text2, out var result4))
					{
						throw new FormatException("parse function - parameter '" + text2 + "' could not be parsed to type '" + text + "'.");
					}
					result = result4;
					break;
				}
				case "ushort":
				{
					if (!ushort.TryParse(text2, out var result9))
					{
						throw new FormatException("parse function - parameter '" + text2 + "' could not be parsed to type '" + text + "'.");
					}
					result = result9;
					break;
				}
				case "int":
				{
					if (!int.TryParse(text2, out var result3))
					{
						throw new FormatException("parse function - parameter '" + text2 + "' could not be parsed to type '" + text + "'.");
					}
					result = result3;
					break;
				}
				case "uint":
				{
					if (!uint.TryParse(text2, out var result10))
					{
						throw new FormatException("parse function - parameter '" + text2 + "' could not be parsed to type '" + text + "'.");
					}
					result = result10;
					break;
				}
				case "long":
				{
					if (!long.TryParse(text2, out var result6))
					{
						throw new FormatException("parse function - parameter '" + text2 + "' could not be parsed to type '" + text + "'.");
					}
					result = result6;
					break;
				}
				case "ulong":
				{
					if (!ulong.TryParse(text2, out var result14))
					{
						throw new FormatException("parse function - parameter '" + text2 + "' could not be parsed to type '" + text + "'.");
					}
					result = result14;
					break;
				}
				case "double":
				{
					if (!double.TryParse(text2, out var result11))
					{
						throw new FormatException("parse function - parameter '" + text2 + "' could not be parsed to type '" + text + "'.");
					}
					result = result11;
					break;
				}
				case "float":
				{
					if (!float.TryParse(text2, out var result8))
					{
						throw new FormatException("parse function - parameter '" + text2 + "' could not be parsed to type '" + text + "'.");
					}
					result = result8;
					break;
				}
				case "decimal":
				{
					if (!decimal.TryParse(text2, out var result5))
					{
						throw new FormatException("parse function - parameter '" + text2 + "' could not be parsed to type '" + text + "'.");
					}
					result = result5;
					break;
				}
				case "Guid":
				{
					if (!Guid.TryParse(text2, out var result2))
					{
						throw new FormatException("parse function - parameter '" + text2 + "' could not be parsed to type '" + text + "'.");
					}
					result = result2;
					break;
				}
				case "JObject":
				case "jObject":
					result = ParseJObject(text2);
					break;
				case "jArray":
				case "JArray":
					result = ParseJArray(text2);
					break;
				default:
					throw new FormatException("type '" + text + "' not supported.");
				}
				functionArgs.Result = result;
			}
			catch (FormatException innerException)
			{
				if (functionArgs.Parameters.Length >= 3)
				{
					functionArgs.Result = functionArgs.Parameters[num].Evaluate();
					return;
				}
				throw new FormatException("parse function - parameter '" + text2 + "' could not be parsed to type '" + text + "'.", innerException);
			}
		}

		private static JObject ParseJObject(string text)
		{
			try
			{
				return JObject.Parse(text);
			}
			catch (JsonReaderException)
			{
				throw new FormatException("parse function - parameter '" + text + "' could not be parsed to type 'JObject'.");
			}
		}

		private static JArray ParseJArray(string text)
		{
			try
			{
				return JArray.Parse(text);
			}
			catch (JsonReaderException)
			{
				throw new FormatException("parse function - parameter '" + text + "' could not be parsed to type 'JArray'.");
			}
		}
	}
	internal static class ParseInt
	{
		internal static void Evaluate(FunctionArgs functionArgs)
		{
			if (functionArgs.Parameters.Length != 1)
			{
				throw new FormatException("parseInt function - requires one string parameter.");
			}
			string s = (functionArgs.Parameters[0].Evaluate() as string) ?? throw new FormatException("parseInt function - requires one string parameter.");
			if (!int.TryParse(s, out var result))
			{
				throw new FormatException("parseInt function - parameter could not be parsed to an integer.");
			}
			functionArgs.Result = result;
		}
	}
	internal static class RegexGroup
	{
		internal static void Evaluate(FunctionArgs functionArgs)
		{
			try
			{
				string input = (string)functionArgs.Parameters[0].Evaluate();
				string pattern = (string)functionArgs.Parameters[1].Evaluate();
				int num = ((functionArgs.Parameters.Length == 3) ? ((int)functionArgs.Parameters[2].Evaluate()) : 0);
				Regex regex = new Regex(pattern);
				if (!regex.IsMatch(input))
				{
					functionArgs.Result = null;
					return;
				}
				Group group = regex.Match(input).Groups[1];
				functionArgs.Result = ((num >= group.Captures.Count) ? null : group.Captures[num].Value);
			}
			catch (Exception ex) when (!(ex is NCalcExtensionsException))
			{
				throw new FormatException("replace() requires three string parameters.");
			}
		}
	}
	internal static class RegexIsMatch
	{
		internal static void Evaluate(FunctionArgs functionArgs)
		{
			object obj = functionArgs.Parameters[0].Evaluate();
			object obj2 = functionArgs.Parameters[1].Evaluate();
			if (!(obj is string input))
			{
				throw new FormatException("regexIsMatch function - first parameter should be a string.");
			}
			if (!(obj2 is string pattern))
			{
				throw new FormatException("regexIsMatch function - second parameter should be a string.");
			}
			Regex regex = new Regex(pattern);
			functionArgs.Result = regex.IsMatch(input);
		}
	}
	internal static class Replace
	{
		internal static void Evaluate(FunctionArgs functionArgs)
		{
			try
			{
				string text = (string)functionArgs.Parameters[0].Evaluate();
				string oldValue = (string)functionArgs.Parameters[1].Evaluate();
				string newValue = (string)functionArgs.Parameters[2].Evaluate();
				functionArgs.Result = text.Replace(oldValue, newValue);
			}
			catch (Exception ex) when (!(ex is NCalcExtensionsException))
			{
				throw new FormatException("replace() requires three string parameters.");
			}
		}
	}
	internal static class Retrieve
	{
		internal static void Evaluate(FunctionArgs functionArgs)
		{
			string key;
			try
			{
				key = (string)functionArgs.Parameters[0].Evaluate();
			}
			catch (Exception ex) when (!(ex is NCalcExtensionsException))
			{
				throw new FormatException("retrieve() requires one string parameter.");
			}
			Dictionary<string, object> dictionary = (functionArgs.Parameters[0].Parameters["__storageDictionary"] as Dictionary<string, object>) ?? throw new FormatException("retrieve() requires a storage dictionary.");
			if (!dictionary.TryGetValue(key, out var value))
			{
				throw new FormatException("Key not found");
			}
			functionArgs.Result = value;
		}
	}
	internal static class Select
	{
		internal static void Evaluate(FunctionArgs functionArgs)
		{
			IList list = (functionArgs.Parameters[0].Evaluate() as IList) ?? throw new FormatException("First select parameter must be an IList.");
			string predicate = (functionArgs.Parameters[1].Evaluate() as string) ?? throw new FormatException("Second select parameter must be a string.");
			string nCalcString = (functionArgs.Parameters[2].Evaluate() as string) ?? throw new FormatException("Third select parameter must be a string.");
			string text = ((functionArgs.Parameters.Length == 4) ? ((functionArgs.Parameters[3].Evaluate() as string) ?? throw new FormatException("Fourth select parameter must be a string.")) : "object");
			Lambda lambda = new Lambda(predicate, nCalcString, functionArgs.Parameters[0].Parameters);
			if (!(text == "object"))
			{
				if (text == "JObject")
				{
					List<JObject> list2 = new List<JObject>();
					foreach (object item2 in list)
					{
						object obj = lambda.Evaluate(item2);
						JObject val2;
						if (obj != null)
						{
							JObject val = (JObject)((obj is JObject) ? obj : null);
							val2 = ((val == null) ? JObject.FromObject(item2) : val);
						}
						else
						{
							val2 = null;
						}
						JObject item = val2;
						list2.Add(item);
					}
					functionArgs.Result = list2;
					return;
				}
				throw new FormatException("Fourth select parameter must be either 'object' (default) or 'JObject'.");
			}
			List<object> list3 = new List<object>();
			foreach (object i

plugins/Nevernamed-Graveyard_Manager/plugins/GraveyardHandler.dll

Decompiled 5 months ago
using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using BepInEx;
using DiskCardGame;
using HarmonyLib;
using InscryptionAPI.Card;
using UnityEngine;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: TargetFramework(".NETStandard,Version=v2.0", FrameworkDisplayName = "")]
[assembly: AssemblyCompany("GraveyardHandler")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("GraveyardHandler")]
[assembly: AssemblyTitle("GraveyardHandler")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.0.0")]
[module: UnverifiableCode]
namespace GraveyardHandler;

[BepInPlugin("nevernamed.inscryption.graveyardhandler", "GraveyardHandler", "1.0.0")]
[BepInDependency(/*Could not decode attribute arguments.*/)]
public class Plugin : BaseUnityPlugin
{
	private const string PluginGuid = "nevernamed.inscryption.graveyardhandler";

	private const string PluginName = "GraveyardHandler";

	private const string PluginVersion = "1.0.0";

	public static AssetBundle bundle;

	private void Awake()
	{
		//IL_0017: Unknown result type (might be due to invalid IL or missing references)
		//IL_001d: Expected O, but got Unknown
		((BaseUnityPlugin)this).Logger.LogInfo((object)"Loaded GraveyardHandler!");
		Harmony val = new Harmony("nevernamed.inscryption.graveyardhandler.harmonypatcher");
		val.PatchAll();
	}
}
public class GraveyardManager : NonCardTriggerReceiver
{
	public static GraveyardManager instance;

	public List<CardInfo> playerGraveyard = new List<CardInfo>();

	public List<CardInfo> opponentGraveyard = new List<CardInfo>();

	private Dictionary<CardSlot, List<CardInfo>> deathSlots = new Dictionary<CardSlot, List<CardInfo>>();

	public override bool TriggerBeforeCards => false;

	public static int GetActAsInt()
	{
		if (SaveManager.SaveFile.IsPart1)
		{
			return 1;
		}
		if (SaveManager.SaveFile.IsPart2)
		{
			return 2;
		}
		if (SaveManager.SaveFile.IsPart3)
		{
			return 3;
		}
		if (SaveManager.SaveFile.IsGrimora)
		{
			return 4;
		}
		if (SaveManager.SaveFile.IsMagnificus)
		{
			return 5;
		}
		return 0;
	}

	public List<CardInfo> GetCardsDiedInSlot(CardSlot slot)
	{
		if (deathSlots.ContainsKey(slot))
		{
			return deathSlots[slot];
		}
		return new List<CardInfo>();
	}

	public override IEnumerator OnOtherCardDie(PlayableCard card, CardSlot deathSlot, bool fromCombat, PlayableCard killer)
	{
		if (card.OpponentCard)
		{
			opponentGraveyard.Add(((Card)card).Info);
		}
		else
		{
			playerGraveyard.Add(((Card)card).Info);
		}
		if ((Object)(object)deathSlot != (Object)null && (Object)(object)card.QueuedSlot == (Object)null)
		{
			if (!deathSlots.ContainsKey(deathSlot))
			{
				deathSlots.Add(deathSlot, new List<CardInfo>());
			}
			if (deathSlots[deathSlot] == null)
			{
				deathSlots[deathSlot] = new List<CardInfo>();
			}
			deathSlots[deathSlot].Add(((Card)card).Info);
		}
		yield break;
	}

	public override bool RespondsToOtherCardDie(PlayableCard card, CardSlot deathSlot, bool fromCombat, PlayableCard killer)
	{
		return !card.HasAbility((Ability)55) && !card.HasAbility((Ability)14) && CardExtensions.GetExtendedProperty(((Card)card).Info, "PreventAdditionToGraveyard") == null && !((Card)card).Info.Mods.Exists((CardModificationInfo x) => x.singletonId == "IsFromSideDeck");
	}

	public IEnumerator CleanupManager()
	{
		instance = null;
		Object.Destroy((Object)(object)((Component)this).gameObject);
		yield break;
	}
}
[HarmonyPatch(typeof(TurnManager), "StartGame", new Type[] { typeof(EncounterData) })]
public class BattleStart
{
	[HarmonyPrefix]
	public static void BattleStartPatch(TurnManager __instance)
	{
		//IL_0022: Unknown result type (might be due to invalid IL or missing references)
		//IL_0028: Expected O, but got Unknown
		if ((Object)(object)GraveyardManager.instance != (Object)null)
		{
			Object.Destroy((Object)(object)((Component)GraveyardManager.instance).gameObject);
		}
		GameObject val = new GameObject();
		GraveyardManager instance = val.AddComponent<GraveyardManager>();
		GraveyardManager.instance = instance;
	}
}
[HarmonyPatch(typeof(TurnManager), "CleanupPhase")]
public class BattleEnd
{
	[HarmonyPostfix]
	public static IEnumerator BattleEndPatch(IEnumerator enumerator, TurnManager __instance)
	{
		if ((Object)(object)GraveyardManager.instance != (Object)null)
		{
			yield return GraveyardManager.instance.CleanupManager();
		}
		yield return enumerator;
	}
}
[HarmonyPatch(typeof(Part1CardDrawPiles))]
public class CardDrawPilesPatches
{
	[HarmonyPostfix]
	[HarmonyPatch(/*Could not decode attribute arguments.*/)]
	public static void Postfix(ref List<CardInfo> __result)
	{
		//IL_001b: Unknown result type (might be due to invalid IL or missing references)
		//IL_0020: Unknown result type (might be due to invalid IL or missing references)
		//IL_0030: Expected O, but got Unknown
		foreach (CardInfo item in __result)
		{
			item.Mods.Add(new CardModificationInfo
			{
				singletonId = "IsFromSideDeck"
			});
		}
	}
}
[HarmonyPatch(typeof(Part3CardDrawPiles))]
public class CardDrawPilesPatchesAct3
{
	[HarmonyPostfix]
	[HarmonyPatch(/*Could not decode attribute arguments.*/)]
	public static void Postfix(ref List<CardInfo> __result)
	{
		//IL_001b: Unknown result type (might be due to invalid IL or missing references)
		//IL_0020: Unknown result type (might be due to invalid IL or missing references)
		//IL_0030: Expected O, but got Unknown
		foreach (CardInfo item in __result)
		{
			item.Mods.Add(new CardModificationInfo
			{
				singletonId = "IsFromSideDeck"
			});
		}
	}
}
[HarmonyPatch(typeof(GrimoraCardDrawPiles))]
public class CardDrawPilesPatchesGrimora
{
	[HarmonyPostfix]
	[HarmonyPatch(/*Could not decode attribute arguments.*/)]
	public static void Postfix(ref List<CardInfo> __result)
	{
		//IL_001b: Unknown result type (might be due to invalid IL or missing references)
		//IL_0020: Unknown result type (might be due to invalid IL or missing references)
		//IL_0030: Expected O, but got Unknown
		foreach (CardInfo item in __result)
		{
			item.Mods.Add(new CardModificationInfo
			{
				singletonId = "IsFromSideDeck"
			});
		}
	}
}
[HarmonyPatch(typeof(MagnificusCardDrawPiles))]
public class CardDrawPilesPatchesMagnificus
{
	[HarmonyPostfix]
	[HarmonyPatch(/*Could not decode attribute arguments.*/)]
	public static void Postfix(ref List<CardInfo> __result)
	{
		//IL_001b: Unknown result type (might be due to invalid IL or missing references)
		//IL_0020: Unknown result type (might be due to invalid IL or missing references)
		//IL_0030: Expected O, but got Unknown
		foreach (CardInfo item in __result)
		{
			item.Mods.Add(new CardModificationInfo
			{
				singletonId = "IsFromSideDeck"
			});
		}
	}
}

plugins/Nevernamed-Nevernameds_Sigilarium/plugins/NevernamedsSigils.dll

Decompiled 5 months ago
using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using BepInEx;
using BepInEx.Configuration;
using DigitalRuby.LightningBolt;
using DiskCardGame;
using GBC;
using GraveyardHandler;
using HarmonyLib;
using InscryptionAPI.Card;
using InscryptionAPI.Dialogue;
using InscryptionAPI.Guid;
using InscryptionAPI.PixelCard;
using InscryptionAPI.Saves;
using InscryptionAPI.Triggers;
using InscryptionCommunityPatch.Card;
using InscryptionCommunityPatch.PixelTutor;
using OpponentBones;
using Pixelplacement;
using UnityEngine;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: TargetFramework(".NETStandard,Version=v2.0", FrameworkDisplayName = "")]
[assembly: AssemblyCompany("NevernamedsSigils")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("NevernamedsSigils")]
[assembly: AssemblyTitle("NevernamedsSigils")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.0.0")]
[module: UnverifiableCode]
namespace NevernamedsSigils;

public static class Act2ItemCards
{
	public static void Init()
	{
		//IL_0022: Unknown result type (might be due to invalid IL or missing references)
		//IL_002e: Unknown result type (might be due to invalid IL or missing references)
		//IL_00be: Unknown result type (might be due to invalid IL or missing references)
		//IL_00ca: Unknown result type (might be due to invalid IL or missing references)
		//IL_015a: Unknown result type (might be due to invalid IL or missing references)
		//IL_0166: Unknown result type (might be due to invalid IL or missing references)
		//IL_01ff: Unknown result type (might be due to invalid IL or missing references)
		//IL_028f: Unknown result type (might be due to invalid IL or missing references)
		//IL_029b: Unknown result type (might be due to invalid IL or missing references)
		//IL_0334: Unknown result type (might be due to invalid IL or missing references)
		//IL_03c4: Unknown result type (might be due to invalid IL or missing references)
		//IL_03d0: Unknown result type (might be due to invalid IL or missing references)
		//IL_0469: Unknown result type (might be due to invalid IL or missing references)
		//IL_04f9: Unknown result type (might be due to invalid IL or missing references)
		//IL_0505: Unknown result type (might be due to invalid IL or missing references)
		//IL_0595: Unknown result type (might be due to invalid IL or missing references)
		//IL_05a1: Unknown result type (might be due to invalid IL or missing references)
		//IL_0631: Unknown result type (might be due to invalid IL or missing references)
		//IL_063d: Unknown result type (might be due to invalid IL or missing references)
		//IL_06d6: Unknown result type (might be due to invalid IL or missing references)
		//IL_06f5: Unknown result type (might be due to invalid IL or missing references)
		CardExtensions.SetExtendedProperty(SigilSetupUtility.NewCard(categories: new List<CardMetaCategory>(), description: "", bloodCost: 0, bonesCost: 0, energyCost: 0, gemsCost: null, abilities: new List<Ability>
		{
			Desperate.ability,
			InstantEffect.ability
		}, defaultTex: null, emissionTex: null, traits: new List<Trait>(), appearanceBehaviour: new List<Appearance>(), internalName: "SigilNevernamed PixelItemPliers", displayname: "Pliers", power: 0, health: 0, temple: (CardTemple)0, pixelTex: Tools.LoadTex("NevernamedsSigils/Resources/PixelCards/PixelItems/pliers_pixel.png"), altTexture: null, altTextureEmission: null, titleGraphic: null, decals: null, tribes: null, preventSignature: false, defaultTailCard: null, defaultEvolutionCard: null, defaultEvolutionName: null, defaultEvolutionTurns: 1, defaultFrozenCard: null, tailLostTexture: null, specialAbilities: null, variableStat: (SpecialStatIcon)0, hideStats: false, onePerDeck: false, animatedPortrait: null, flipPortraitWhenStrafing: false, overrideDamID: null, overrideDamBlockedDialogue: null, overrideFactoryConduitSpawn: null, overrideRabbitHoleSpawn: null, overrideAntSpawnerSpawn: null, overrideBellistID: null, overrideBellistBlockedDialogue: null, overrideSquirrelShedderId: null, overrideSkeletonCrewID: null, overrideBeesWithinID: null, twisterForm: null, transformerForm: null, overrideLeftClaw: null, overrideRightClaw: null, customDoomedLifespan: null, customGutSpewerGuts: null, customExplodingCorpseGuts: null, customOrganThiefGuts: null, harbingerLeaveBehind: null, tramplerLeaveBehind: null, flightyLeaveBehind: null, parthenogenesisOverride: null, sigilShedderDef: null, preventBones: true), "Act2TrinketBearerItemCard", (object)"true");
		CardExtensions.SetExtendedProperty(SigilSetupUtility.NewCard(categories: new List<CardMetaCategory>(), description: "", bloodCost: 0, bonesCost: 0, energyCost: 0, gemsCost: null, abilities: new List<Ability>
		{
			Snip.ability,
			InstantEffect.ability
		}, defaultTex: null, emissionTex: null, traits: new List<Trait>(), appearanceBehaviour: new List<Appearance>(), internalName: "SigilNevernamed PixelItemScissors", displayname: "Scissors", power: 0, health: 0, temple: (CardTemple)0, pixelTex: Tools.LoadTex("NevernamedsSigils/Resources/PixelCards/PixelItems/scissors_pixel.png"), altTexture: null, altTextureEmission: null, titleGraphic: null, decals: null, tribes: null, preventSignature: false, defaultTailCard: null, defaultEvolutionCard: null, defaultEvolutionName: null, defaultEvolutionTurns: 1, defaultFrozenCard: null, tailLostTexture: null, specialAbilities: null, variableStat: (SpecialStatIcon)0, hideStats: false, onePerDeck: false, animatedPortrait: null, flipPortraitWhenStrafing: false, overrideDamID: null, overrideDamBlockedDialogue: null, overrideFactoryConduitSpawn: null, overrideRabbitHoleSpawn: null, overrideAntSpawnerSpawn: null, overrideBellistID: null, overrideBellistBlockedDialogue: null, overrideSquirrelShedderId: null, overrideSkeletonCrewID: null, overrideBeesWithinID: null, twisterForm: null, transformerForm: null, overrideLeftClaw: null, overrideRightClaw: null, customDoomedLifespan: null, customGutSpewerGuts: null, customExplodingCorpseGuts: null, customOrganThiefGuts: null, harbingerLeaveBehind: null, tramplerLeaveBehind: null, flightyLeaveBehind: null, parthenogenesisOverride: null, sigilShedderDef: null, preventBones: true), "Act2TrinketBearerItemCard", (object)"true");
		CardExtensions.SetExtendedProperty(SigilSetupUtility.NewCard(categories: new List<CardMetaCategory>(), description: "", bloodCost: 0, bonesCost: 0, energyCost: 0, gemsCost: null, abilities: new List<Ability>
		{
			Bleach.ability,
			InstantEffect.ability
		}, defaultTex: null, emissionTex: null, traits: new List<Trait>(), appearanceBehaviour: new List<Appearance>(), internalName: "SigilNevernamed PixelItemBleach", displayname: "Bleach", power: 0, health: 0, temple: (CardTemple)0, pixelTex: Tools.LoadTex("NevernamedsSigils/Resources/PixelCards/PixelItems/bleachitem_pixel.png"), altTexture: null, altTextureEmission: null, titleGraphic: null, decals: null, tribes: null, preventSignature: false, defaultTailCard: null, defaultEvolutionCard: null, defaultEvolutionName: null, defaultEvolutionTurns: 1, defaultFrozenCard: null, tailLostTexture: null, specialAbilities: null, variableStat: (SpecialStatIcon)0, hideStats: false, onePerDeck: false, animatedPortrait: null, flipPortraitWhenStrafing: false, overrideDamID: null, overrideDamBlockedDialogue: null, overrideFactoryConduitSpawn: null, overrideRabbitHoleSpawn: null, overrideAntSpawnerSpawn: null, overrideBellistID: null, overrideBellistBlockedDialogue: null, overrideSquirrelShedderId: null, overrideSkeletonCrewID: null, overrideBeesWithinID: null, twisterForm: null, transformerForm: null, overrideLeftClaw: null, overrideRightClaw: null, customDoomedLifespan: null, customGutSpewerGuts: null, customExplodingCorpseGuts: null, customOrganThiefGuts: null, harbingerLeaveBehind: null, tramplerLeaveBehind: null, flightyLeaveBehind: null, parthenogenesisOverride: null, sigilShedderDef: null, preventBones: true), "Act2TrinketBearerItemCard", (object)"true");
		CardExtensions.SetExtendedProperty(SigilSetupUtility.NewCard(categories: new List<CardMetaCategory>(), description: "", bloodCost: 0, bonesCost: 0, energyCost: 0, gemsCost: null, abilities: new List<Ability>
		{
			(Ability)30,
			InstantEffect.ability
		}, defaultTex: null, emissionTex: null, traits: new List<Trait>(), appearanceBehaviour: new List<Appearance>(), internalName: "SigilNevernamed PixelItemSkinningKnife", displayname: "Skinning Knife", power: 0, health: 0, temple: (CardTemple)0, pixelTex: Tools.LoadTex("NevernamedsSigils/Resources/PixelCards/PixelItems/skinningknife_pixel.png"), altTexture: null, altTextureEmission: null, titleGraphic: null, decals: null, tribes: null, preventSignature: false, defaultTailCard: null, defaultEvolutionCard: null, defaultEvolutionName: null, defaultEvolutionTurns: 1, defaultFrozenCard: null, tailLostTexture: null, specialAbilities: null, variableStat: (SpecialStatIcon)0, hideStats: false, onePerDeck: false, animatedPortrait: null, flipPortraitWhenStrafing: false, overrideDamID: null, overrideDamBlockedDialogue: null, overrideFactoryConduitSpawn: null, overrideRabbitHoleSpawn: null, overrideAntSpawnerSpawn: null, overrideBellistID: null, overrideBellistBlockedDialogue: null, overrideSquirrelShedderId: null, overrideSkeletonCrewID: null, overrideBeesWithinID: null, twisterForm: null, transformerForm: null, overrideLeftClaw: null, overrideRightClaw: null, customDoomedLifespan: null, customGutSpewerGuts: null, customExplodingCorpseGuts: null, customOrganThiefGuts: null, harbingerLeaveBehind: null, tramplerLeaveBehind: null, flightyLeaveBehind: null, parthenogenesisOverride: null, sigilShedderDef: null, preventBones: true), "Act2TrinketBearerItemCard", (object)"true");
		CardExtensions.SetExtendedProperty(SigilSetupUtility.NewCard(categories: new List<CardMetaCategory>(), description: "", bloodCost: 0, bonesCost: 0, energyCost: 0, gemsCost: null, abilities: new List<Ability>
		{
			HookLineAndSinker.ability,
			InstantEffect.ability
		}, defaultTex: null, emissionTex: null, traits: new List<Trait>(), appearanceBehaviour: new List<Appearance>(), internalName: "SigilNevernamed PixelItemFishhook", displayname: "Fish Hook", power: 0, health: 0, temple: (CardTemple)0, pixelTex: Tools.LoadTex("NevernamedsSigils/Resources/PixelCards/PixelItems/fishhook_pixel.png"), altTexture: null, altTextureEmission: null, titleGraphic: null, decals: null, tribes: null, preventSignature: false, defaultTailCard: null, defaultEvolutionCard: null, defaultEvolutionName: null, defaultEvolutionTurns: 1, defaultFrozenCard: null, tailLostTexture: null, specialAbilities: null, variableStat: (SpecialStatIcon)0, hideStats: false, onePerDeck: false, animatedPortrait: null, flipPortraitWhenStrafing: false, overrideDamID: null, overrideDamBlockedDialogue: null, overrideFactoryConduitSpawn: null, overrideRabbitHoleSpawn: null, overrideAntSpawnerSpawn: null, overrideBellistID: null, overrideBellistBlockedDialogue: null, overrideSquirrelShedderId: null, overrideSkeletonCrewID: null, overrideBeesWithinID: null, twisterForm: null, transformerForm: null, overrideLeftClaw: null, overrideRightClaw: null, customDoomedLifespan: null, customGutSpewerGuts: null, customExplodingCorpseGuts: null, customOrganThiefGuts: null, harbingerLeaveBehind: null, tramplerLeaveBehind: null, flightyLeaveBehind: null, parthenogenesisOverride: null, sigilShedderDef: null, preventBones: true), "Act2TrinketBearerItemCard", (object)"true");
		CardExtensions.SetExtendedProperty(SigilSetupUtility.NewCard(categories: new List<CardMetaCategory>(), description: "", bloodCost: 0, bonesCost: 0, energyCost: 0, gemsCost: null, abilities: new List<Ability>
		{
			(Ability)45,
			InstantEffect.ability
		}, defaultTex: null, emissionTex: null, traits: new List<Trait>(), appearanceBehaviour: new List<Appearance>(), internalName: "SigilNevernamed PixelItemDeadHand", displayname: "Dead Hand", power: 0, health: 0, temple: (CardTemple)0, pixelTex: Tools.LoadTex("NevernamedsSigils/Resources/PixelCards/PixelItems/deadhanditem_pixel.png"), altTexture: null, altTextureEmission: null, titleGraphic: null, decals: null, tribes: null, preventSignature: false, defaultTailCard: null, defaultEvolutionCard: null, defaultEvolutionName: null, defaultEvolutionTurns: 1, defaultFrozenCard: null, tailLostTexture: null, specialAbilities: null, variableStat: (SpecialStatIcon)0, hideStats: false, onePerDeck: false, animatedPortrait: null, flipPortraitWhenStrafing: false, overrideDamID: null, overrideDamBlockedDialogue: null, overrideFactoryConduitSpawn: null, overrideRabbitHoleSpawn: null, overrideAntSpawnerSpawn: null, overrideBellistID: null, overrideBellistBlockedDialogue: null, overrideSquirrelShedderId: null, overrideSkeletonCrewID: null, overrideBeesWithinID: null, twisterForm: null, transformerForm: null, overrideLeftClaw: null, overrideRightClaw: null, customDoomedLifespan: null, customGutSpewerGuts: null, customExplodingCorpseGuts: null, customOrganThiefGuts: null, harbingerLeaveBehind: null, tramplerLeaveBehind: null, flightyLeaveBehind: null, parthenogenesisOverride: null, sigilShedderDef: null, preventBones: true), "Act2TrinketBearerItemCard", (object)"true");
		CardExtensions.SetExtendedProperty(SigilSetupUtility.NewCard(categories: new List<CardMetaCategory>(), description: "", bloodCost: 0, bonesCost: 0, energyCost: 0, gemsCost: null, abilities: new List<Ability>
		{
			FanTailed.ability,
			InstantEffect.ability
		}, defaultTex: null, emissionTex: null, traits: new List<Trait>(), appearanceBehaviour: new List<Appearance>(), internalName: "SigilNevernamed PixelItemHarpiesBirdlegFan", displayname: "Harpie's Birdleg Fan", power: 0, health: 0, temple: (CardTemple)0, pixelTex: Tools.LoadTex("NevernamedsSigils/Resources/PixelCards/PixelItems/harpiesbirdlegfan_pixel.png"), altTexture: null, altTextureEmission: null, titleGraphic: null, decals: null, tribes: null, preventSignature: false, defaultTailCard: null, defaultEvolutionCard: null, defaultEvolutionName: null, defaultEvolutionTurns: 1, defaultFrozenCard: null, tailLostTexture: null, specialAbilities: null, variableStat: (SpecialStatIcon)0, hideStats: false, onePerDeck: false, animatedPortrait: null, flipPortraitWhenStrafing: false, overrideDamID: null, overrideDamBlockedDialogue: null, overrideFactoryConduitSpawn: null, overrideRabbitHoleSpawn: null, overrideAntSpawnerSpawn: null, overrideBellistID: null, overrideBellistBlockedDialogue: null, overrideSquirrelShedderId: null, overrideSkeletonCrewID: null, overrideBeesWithinID: null, twisterForm: null, transformerForm: null, overrideLeftClaw: null, overrideRightClaw: null, customDoomedLifespan: null, customGutSpewerGuts: null, customExplodingCorpseGuts: null, customOrganThiefGuts: null, harbingerLeaveBehind: null, tramplerLeaveBehind: null, flightyLeaveBehind: null, parthenogenesisOverride: null, sigilShedderDef: null, preventBones: true), "Act2TrinketBearerItemCard", (object)"true");
		CardExtensions.SetExtendedProperty(SigilSetupUtility.NewCard(categories: new List<CardMetaCategory>(), description: "", bloodCost: 0, bonesCost: 0, energyCost: 0, gemsCost: null, abilities: new List<Ability>
		{
			(Ability)12,
			InstantEffect.ability
		}, defaultTex: null, emissionTex: null, traits: new List<Trait>(), appearanceBehaviour: new List<Appearance>(), internalName: "SigilNevernamed PixelItemHoggyBank", displayname: "Hoggy Bank", power: 0, health: 0, temple: (CardTemple)0, pixelTex: Tools.LoadTex("NevernamedsSigils/Resources/PixelCards/PixelItems/hoggybank_pixel.png"), altTexture: null, altTextureEmission: null, titleGraphic: null, decals: null, tribes: null, preventSignature: false, defaultTailCard: null, defaultEvolutionCard: null, defaultEvolutionName: null, defaultEvolutionTurns: 1, defaultFrozenCard: null, tailLostTexture: null, specialAbilities: null, variableStat: (SpecialStatIcon)0), "Act2TrinketBearerItemCard", (object)"true");
		CardExtensions.SetExtendedProperty(SigilSetupUtility.NewCard(categories: new List<CardMetaCategory>(), description: "", bloodCost: 0, bonesCost: 0, energyCost: 0, gemsCost: null, abilities: new List<Ability>
		{
			Supercharge.ability,
			InstantEffect.ability
		}, defaultTex: null, emissionTex: null, traits: new List<Trait>(), appearanceBehaviour: new List<Appearance>(), internalName: "SigilNevernamed PixelItemExtraBattery", displayname: "Extra Battery", power: 0, health: 0, temple: (CardTemple)0, pixelTex: Tools.LoadTex("NevernamedsSigils/Resources/PixelCards/PixelItems/extrabattery_pixel.png"), altTexture: null, altTextureEmission: null, titleGraphic: null, decals: null, tribes: null, preventSignature: false, defaultTailCard: null, defaultEvolutionCard: null, defaultEvolutionName: null, defaultEvolutionTurns: 1, defaultFrozenCard: null, tailLostTexture: null, specialAbilities: null, variableStat: (SpecialStatIcon)0, hideStats: false, onePerDeck: false, animatedPortrait: null, flipPortraitWhenStrafing: false, overrideDamID: null, overrideDamBlockedDialogue: null, overrideFactoryConduitSpawn: null, overrideRabbitHoleSpawn: null, overrideAntSpawnerSpawn: null, overrideBellistID: null, overrideBellistBlockedDialogue: null, overrideSquirrelShedderId: null, overrideSkeletonCrewID: null, overrideBeesWithinID: null, twisterForm: null, transformerForm: null, overrideLeftClaw: null, overrideRightClaw: null, customDoomedLifespan: null, customGutSpewerGuts: null, customExplodingCorpseGuts: null, customOrganThiefGuts: null, harbingerLeaveBehind: null, tramplerLeaveBehind: null, flightyLeaveBehind: null, parthenogenesisOverride: null, sigilShedderDef: null, preventBones: true), "Act2TrinketBearerItemCard", (object)"true");
		CardExtensions.SetExtendedProperty(SigilSetupUtility.NewCard(categories: new List<CardMetaCategory>(), description: "", bloodCost: 0, bonesCost: 0, energyCost: 0, gemsCost: null, abilities: new List<Ability>
		{
			Omniguardian.ability,
			InstantEffect.ability
		}, defaultTex: null, emissionTex: null, traits: new List<Trait>(), appearanceBehaviour: new List<Appearance>(), internalName: "SigilNevernamed PixelItemShieldGenerator", displayname: "Shield Generator", power: 0, health: 0, temple: (CardTemple)0, pixelTex: Tools.LoadTex("NevernamedsSigils/Resources/PixelCards/PixelItems/shieldgenerator_pixel.png"), altTexture: null, altTextureEmission: null, titleGraphic: null, decals: null, tribes: null, preventSignature: false, defaultTailCard: null, defaultEvolutionCard: null, defaultEvolutionName: null, defaultEvolutionTurns: 1, defaultFrozenCard: null, tailLostTexture: null, specialAbilities: null, variableStat: (SpecialStatIcon)0, hideStats: false, onePerDeck: false, animatedPortrait: null, flipPortraitWhenStrafing: false, overrideDamID: null, overrideDamBlockedDialogue: null, overrideFactoryConduitSpawn: null, overrideRabbitHoleSpawn: null, overrideAntSpawnerSpawn: null, overrideBellistID: null, overrideBellistBlockedDialogue: null, overrideSquirrelShedderId: null, overrideSkeletonCrewID: null, overrideBeesWithinID: null, twisterForm: null, transformerForm: null, overrideLeftClaw: null, overrideRightClaw: null, customDoomedLifespan: null, customGutSpewerGuts: null, customExplodingCorpseGuts: null, customOrganThiefGuts: null, harbingerLeaveBehind: null, tramplerLeaveBehind: null, flightyLeaveBehind: null, parthenogenesisOverride: null, sigilShedderDef: null, preventBones: true), "Act2TrinketBearerItemCard", (object)"true");
		CardExtensions.SetExtendedProperty(SigilSetupUtility.NewCard(categories: new List<CardMetaCategory>(), description: "", bloodCost: 0, bonesCost: 0, energyCost: 0, gemsCost: null, abilities: new List<Ability>
		{
			Revolve.ability,
			InstantEffect.ability
		}, defaultTex: null, emissionTex: null, traits: new List<Trait>(), appearanceBehaviour: new List<Appearance>(), internalName: "SigilNevernamed PixelItemWiseclock", displayname: "Wiseclock", power: 0, health: 0, temple: (CardTemple)0, pixelTex: Tools.LoadTex("NevernamedsSigils/Resources/PixelCards/PixelItems/wiseclock_pixel.png"), altTexture: null, altTextureEmission: null, titleGraphic: null, decals: null, tribes: null, preventSignature: false, defaultTailCard: null, defaultEvolutionCard: null, defaultEvolutionName: null, defaultEvolutionTurns: 1, defaultFrozenCard: null, tailLostTexture: null, specialAbilities: null, variableStat: (SpecialStatIcon)0, hideStats: false, onePerDeck: false, animatedPortrait: null, flipPortraitWhenStrafing: false, overrideDamID: null, overrideDamBlockedDialogue: null, overrideFactoryConduitSpawn: null, overrideRabbitHoleSpawn: null, overrideAntSpawnerSpawn: null, overrideBellistID: null, overrideBellistBlockedDialogue: null, overrideSquirrelShedderId: null, overrideSkeletonCrewID: null, overrideBeesWithinID: null, twisterForm: null, transformerForm: null, overrideLeftClaw: null, overrideRightClaw: null, customDoomedLifespan: null, customGutSpewerGuts: null, customExplodingCorpseGuts: null, customOrganThiefGuts: null, harbingerLeaveBehind: null, tramplerLeaveBehind: null, flightyLeaveBehind: null, parthenogenesisOverride: null, sigilShedderDef: null, preventBones: true), "Act2TrinketBearerItemCard", (object)"true");
		CardExtensions.SetExtendedProperty(SigilSetupUtility.NewCard(categories: new List<CardMetaCategory>(), description: "", bloodCost: 0, bonesCost: 0, energyCost: 0, gemsCost: null, abilities: new List<Ability>
		{
			(Ability)67,
			InstantEffect.ability
		}, defaultTex: null, emissionTex: null, traits: new List<Trait>(), appearanceBehaviour: new List<Appearance>(), specialAbilities: new List<SpecialTriggeredAbility> { InherentGraveyardShift.ability }, internalName: "SigilNevernamed PixelItemMrsBombsRemote", displayname: "Mrs Bombs Remote", power: 0, health: 0, temple: (CardTemple)0, pixelTex: Tools.LoadTex("NevernamedsSigils/Resources/PixelCards/PixelItems/mrsbombsremote_pixel.png"), altTexture: null, altTextureEmission: null, titleGraphic: null, decals: null, tribes: null, preventSignature: false, defaultTailCard: null, defaultEvolutionCard: null, defaultEvolutionName: null, defaultEvolutionTurns: 1, defaultFrozenCard: "Bombbot", tailLostTexture: null, variableStat: (SpecialStatIcon)0, hideStats: false, onePerDeck: false, animatedPortrait: null, flipPortraitWhenStrafing: false, overrideDamID: null, overrideDamBlockedDialogue: null, overrideFactoryConduitSpawn: null, overrideRabbitHoleSpawn: null, overrideAntSpawnerSpawn: null, overrideBellistID: null, overrideBellistBlockedDialogue: null, overrideSquirrelShedderId: null, overrideSkeletonCrewID: null, overrideBeesWithinID: null, twisterForm: null, transformerForm: null, overrideLeftClaw: null, overrideRightClaw: null, customDoomedLifespan: null, customGutSpewerGuts: null, customExplodingCorpseGuts: null, customOrganThiefGuts: null, harbingerLeaveBehind: null, tramplerLeaveBehind: null, flightyLeaveBehind: null, parthenogenesisOverride: null, sigilShedderDef: null, preventBones: true), "Act2TrinketBearerItemCard", (object)"true");
	}
}
public static class CustomAppearances
{
	public static Appearance HiddenStats;

	public static Appearance GreyBackground;

	public static Appearance LeshyCardBackground;

	public static Appearance InstantEffectBackground;

	public static Appearance GrueAppearance;

	public static Appearance RareTerrainBackground;

	public static Appearance TechPaperCardBackground;

	public static Appearance TestRedBackground;

	public static Appearance PixelGravestoneCard;

	public static Appearance PixelBloodDecal;

	public static Appearance PixelRepulsiveDecal;

	public static Appearance PixelGooDecal;

	public static Appearance PixelSmokeDecal;

	public static Appearance PixelChaosCardDecal;

	public static Appearance PixelDeathcardBackground;

	public static Appearance PixelRareBackground;

	public static Appearance PixelGoldBackground;

	public static Appearance PixelBoneHeader;

	public static Appearance PixelScrappyHeader;

	public static Appearance PixelTechHeader;

	public static Appearance PixelSparkleHeader;

	public static Appearance PixelDogBiteDecal;

	public static Appearance PixelSnowflakeDecal;

	public static Appearance PixelShipDecal;

	public static Appearance PixelWaterDamageDecal;

	public static Appearance PixelGoobertBackground;

	public static Appearance PixelPikeMageBackground;

	public static Appearance PixelLonelyWizBackground;

	public static Appearance PixelAnglerBackground;

	public static Appearance PixelCharredBackground;

	public static void Init()
	{
		//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_003d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0042: Unknown result type (might be due to invalid IL or missing references)
		//IL_0060: Unknown result type (might be due to invalid IL or missing references)
		//IL_0065: Unknown result type (might be due to invalid IL or missing references)
		//IL_0083: Unknown result type (might be due to invalid IL or missing references)
		//IL_0088: Unknown result type (might be due to invalid IL or missing references)
		//IL_00a6: Unknown result type (might be due to invalid IL or missing references)
		//IL_00ab: Unknown result type (might be due to invalid IL or missing references)
		//IL_00c9: 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_00ec: Unknown result type (might be due to invalid IL or missing references)
		//IL_00f1: Unknown result type (might be due to invalid IL or missing references)
		//IL_010f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0114: Unknown result type (might be due to invalid IL or missing references)
		//IL_0132: Unknown result type (might be due to invalid IL or missing references)
		//IL_0137: Unknown result type (might be due to invalid IL or missing references)
		//IL_0155: Unknown result type (might be due to invalid IL or missing references)
		//IL_015a: Unknown result type (might be due to invalid IL or missing references)
		//IL_0178: Unknown result type (might be due to invalid IL or missing references)
		//IL_017d: Unknown result type (might be due to invalid IL or missing references)
		//IL_019b: Unknown result type (might be due to invalid IL or missing references)
		//IL_01a0: Unknown result type (might be due to invalid IL or missing references)
		//IL_01be: Unknown result type (might be due to invalid IL or missing references)
		//IL_01c3: Unknown result type (might be due to invalid IL or missing references)
		//IL_01e1: Unknown result type (might be due to invalid IL or missing references)
		//IL_01e6: Unknown result type (might be due to invalid IL or missing references)
		//IL_0204: Unknown result type (might be due to invalid IL or missing references)
		//IL_0209: Unknown result type (might be due to invalid IL or missing references)
		//IL_0227: Unknown result type (might be due to invalid IL or missing references)
		//IL_022c: Unknown result type (might be due to invalid IL or missing references)
		//IL_024a: Unknown result type (might be due to invalid IL or missing references)
		//IL_024f: Unknown result type (might be due to invalid IL or missing references)
		//IL_026d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0272: Unknown result type (might be due to invalid IL or missing references)
		//IL_0290: Unknown result type (might be due to invalid IL or missing references)
		//IL_0295: Unknown result type (might be due to invalid IL or missing references)
		//IL_02b3: Unknown result type (might be due to invalid IL or missing references)
		//IL_02b8: Unknown result type (might be due to invalid IL or missing references)
		//IL_02d6: Unknown result type (might be due to invalid IL or missing references)
		//IL_02db: Unknown result type (might be due to invalid IL or missing references)
		//IL_02f9: Unknown result type (might be due to invalid IL or missing references)
		//IL_02fe: Unknown result type (might be due to invalid IL or missing references)
		//IL_031c: Unknown result type (might be due to invalid IL or missing references)
		//IL_0321: Unknown result type (might be due to invalid IL or missing references)
		//IL_033f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0344: Unknown result type (might be due to invalid IL or missing references)
		//IL_0362: Unknown result type (might be due to invalid IL or missing references)
		//IL_0367: Unknown result type (might be due to invalid IL or missing references)
		//IL_0385: Unknown result type (might be due to invalid IL or missing references)
		//IL_038a: Unknown result type (might be due to invalid IL or missing references)
		//IL_03a8: Unknown result type (might be due to invalid IL or missing references)
		//IL_03ad: Unknown result type (might be due to invalid IL or missing references)
		//IL_03cb: Unknown result type (might be due to invalid IL or missing references)
		//IL_03d0: Unknown result type (might be due to invalid IL or missing references)
		GreyBackground = CardAppearanceBehaviourManager.Add("nevernamed.inscryption.sigils", "GreyCardBackground", typeof(GreyCardBackground)).Id;
		GrueAppearance = CardAppearanceBehaviourManager.Add("nevernamed.inscryption.sigils", "GrueAppearance", typeof(GrueBackground)).Id;
		RareTerrainBackground = CardAppearanceBehaviourManager.Add("nevernamed.inscryption.sigils", "RareTerrainBackground", typeof(RareTerrainBackground)).Id;
		TechPaperCardBackground = CardAppearanceBehaviourManager.Add("nevernamed.inscryption.sigils", "TechPaperCardBackground", typeof(TechPaperCardBackground)).Id;
		InstantEffectBackground = CardAppearanceBehaviourManager.Add("nevernamed.inscryption.sigils", "InstantEffectBackground", typeof(InstantEffectCardBackground)).Id;
		LeshyCardBackground = CardAppearanceBehaviourManager.Add("nevernamed.inscryption.sigils", "CabinFinaleOpponentCardBackground", typeof(LeshyCardBackground)).Id;
		HiddenStats = CardAppearanceBehaviourManager.Add("nevernamed.inscryption.sigils", "HiddenStats", typeof(HiddenStats)).Id;
		PixelRepulsiveDecal = CardAppearanceBehaviourManager.Add("nevernamed.inscryption.sigils", "PixelRepulsiveDecal", typeof(PixelRepulsiveDecal)).Id;
		PixelBloodDecal = CardAppearanceBehaviourManager.Add("nevernamed.inscryption.sigils", "PixelBloodDecal", typeof(PixelBloodDecal)).Id;
		PixelGooDecal = CardAppearanceBehaviourManager.Add("nevernamed.inscryption.sigils", "PixelGooDecal", typeof(PixelGooDecal)).Id;
		PixelSmokeDecal = CardAppearanceBehaviourManager.Add("nevernamed.inscryption.sigils", "PixelSmokeDecal", typeof(PixelSmokeDecal)).Id;
		PixelChaosCardDecal = CardAppearanceBehaviourManager.Add("nevernamed.inscryption.sigils", "PixelChaosCard", typeof(PixelChaosCardDecal)).Id;
		PixelDeathcardBackground = CardAppearanceBehaviourManager.Add("nevernamed.inscryption.sigils", "PixelDeathcardBackground", typeof(PixelDeathcardBackground)).Id;
		PixelRareBackground = CardAppearanceBehaviourManager.Add("nevernamed.inscryption.sigils", "PixelRareBackground", typeof(PixelRareCardBackground)).Id;
		PixelGoldBackground = CardAppearanceBehaviourManager.Add("nevernamed.inscryption.sigils", "PixelGoldBackground", typeof(PixelGoldCardBackground)).Id;
		PixelBoneHeader = CardAppearanceBehaviourManager.Add("nevernamed.inscryption.sigils", "PixelBoneHeader", typeof(PixelBoneHeader)).Id;
		PixelScrappyHeader = CardAppearanceBehaviourManager.Add("nevernamed.inscryption.sigils", "PixelScrappyHeader", typeof(PixelScrappyHeader)).Id;
		PixelTechHeader = CardAppearanceBehaviourManager.Add("nevernamed.inscryption.sigils", "PixelTechHeader", typeof(PixelTechHeader)).Id;
		PixelSparkleHeader = CardAppearanceBehaviourManager.Add("nevernamed.inscryption.sigils", "PixelSparkleHeader", typeof(PixelSparkleHeader)).Id;
		PixelDogBiteDecal = CardAppearanceBehaviourManager.Add("nevernamed.inscryption.sigils", "PixelDogBiteDecal", typeof(PixelDogBiteDecal)).Id;
		PixelSnowflakeDecal = CardAppearanceBehaviourManager.Add("nevernamed.inscryption.sigils", "PixelSnowflakeDecal", typeof(PixelSnowflakeDecal)).Id;
		PixelShipDecal = CardAppearanceBehaviourManager.Add("nevernamed.inscryption.sigils", "PixelShipDecal", typeof(PixelShipDecal)).Id;
		PixelWaterDamageDecal = CardAppearanceBehaviourManager.Add("nevernamed.inscryption.sigils", "PixelWaterDamageDecal", typeof(PixelWaterDamageDecal)).Id;
		PixelGoobertBackground = CardAppearanceBehaviourManager.Add("nevernamed.inscryption.sigils", "PixelGoobertBackground", typeof(GoobertBackgroundPixel)).Id;
		PixelPikeMageBackground = CardAppearanceBehaviourManager.Add("nevernamed.inscryption.sigils", "PixelPikeMageBackground", typeof(PikeMageBackgroundPixel)).Id;
		PixelLonelyWizBackground = CardAppearanceBehaviourManager.Add("nevernamed.inscryption.sigils", "PixelLonelyWizBackground", typeof(LonelyWizBackgroundPixel)).Id;
		PixelAnglerBackground = CardAppearanceBehaviourManager.Add("nevernamed.inscryption.sigils", "PixelAnglerBackground", typeof(AnglerBackgroundPixel)).Id;
		PixelCharredBackground = CardAppearanceBehaviourManager.Add("nevernamed.inscryption.sigils", "PixelCharredBackground", typeof(CharredBackgroundPixel)).Id;
	}
}
public class PixelRepulsiveDecal : PixelAppearanceBehaviour
{
	public override Sprite PixelAppearance()
	{
		return Tools.GenerateAct2Portrait(Tools.LoadTex("NevernamedsSigils/Resources/Appearances/pixelrepulsivedecal.png"));
	}
}
public class PixelSmokeDecal : PixelAppearanceBehaviour
{
	public override Sprite PixelAppearance()
	{
		return Tools.GenerateAct2Portrait(Tools.LoadTex("NevernamedsSigils/Resources/Appearances/pixelsmokedecal.png"));
	}
}
public class PixelGooDecal : PixelAppearanceBehaviour
{
	public override Sprite PixelAppearance()
	{
		return Tools.GenerateAct2Portrait(Tools.LoadTex("NevernamedsSigils/Resources/Appearances/pixelgoodecal.png"));
	}
}
public class PixelGoldCardBackground : PixelAppearanceBehaviour
{
	public static Sprite tex = Tools.GenerateAct2Portrait(Tools.LoadTex("NevernamedsSigils/Resources/Appearances/goldcardback_pixel.png"));

	public static Sprite texrare = Tools.GenerateAct2Portrait(Tools.LoadTex("NevernamedsSigils/Resources/Appearances/goldcardbackrare_pixel.png"));

	public override Sprite OverrideBackground()
	{
		if ((Object)(object)((CardAppearanceBehaviour)this).Card != (Object)null && (Object)(object)((CardAppearanceBehaviour)this).Card.Info != (Object)null && ((CardAppearanceBehaviour)this).Card.Info.metaCategories.Contains((CardMetaCategory)3))
		{
			return texrare;
		}
		return tex;
	}
}
public class PixelDeathcardBackground : PixelAppearanceBehaviour
{
	public static Sprite tex = Tools.GenerateAct2Portrait(Tools.LoadTex("NevernamedsSigils/Resources/Appearances/pixel_card_empty_deathcard.png"));

	public override Sprite OverrideBackground()
	{
		return tex;
	}
}
public class PixelRareCardBackground : PixelAppearanceBehaviour
{
	public static Sprite tex = Tools.GenerateAct2Portrait(Tools.LoadTex("NevernamedsSigils/Resources/Appearances/pixel_card_empty_rare.png"));

	public override Sprite OverrideBackground()
	{
		return tex;
	}
}
public class HiddenStats : CardAppearanceBehaviour
{
	public override void ApplyAppearance()
	{
		UpdateAttackHidden();
	}

	public override void OnPreRenderCard()
	{
		UpdateAttackHidden();
	}

	private void UpdateAttackHidden()
	{
		((CardAppearanceBehaviour)this).Card.RenderInfo.hiddenAttack = true;
		((CardAppearanceBehaviour)this).Card.RenderInfo.hiddenHealth = true;
		if (((CardAppearanceBehaviour)this).Card is PlayableCard && ((PlayableCard)/*isinst with value type is only supported in some contexts*/).Attack > 0)
		{
			((CardAppearanceBehaviour)this).Card.RenderInfo.hiddenAttack = false;
		}
		if (((CardAppearanceBehaviour)this).Card is PlayableCard && ((PlayableCard)/*isinst with value type is only supported in some contexts*/).Health > 0)
		{
			((CardAppearanceBehaviour)this).Card.RenderInfo.hiddenHealth = false;
		}
	}
}
public class PixelSparkleHeader : PixelAppearanceBehaviour
{
	public static Sprite tex = Tools.GenerateAct2Portrait(Tools.LoadTex("NevernamedsSigils/Resources/Appearances/sparkleheader_pixel.png"));

	public override Sprite PixelAppearance()
	{
		return tex;
	}
}
public class PixelChaosCardDecal : PixelAppearanceBehaviour
{
	public static Sprite tex = Tools.GenerateAct2Portrait(Tools.LoadTex("NevernamedsSigils/Resources/Appearances/pixelchaoscard.png"));

	public override Sprite PixelAppearance()
	{
		return tex;
	}
}
public class PixelWaterDamageDecal : PixelAppearanceBehaviour
{
	public static Sprite tex = Tools.GenerateAct2Portrait(Tools.LoadTex("NevernamedsSigils/Resources/Appearances/waterdamagedecal_pixel.png"));

	public override Sprite PixelAppearance()
	{
		return tex;
	}
}
public class CharredBackgroundPixel : PixelAppearanceBehaviour
{
	public static Sprite tex = Tools.GenerateAct2Portrait(Tools.LoadTex("NevernamedsSigils/Resources/Appearances/charredbackground_pixel.png"));

	public override Sprite OverrideBackground()
	{
		return tex;
	}
}
public class AnglerBackgroundPixel : PixelAppearanceBehaviour
{
	public static Sprite tex = Tools.GenerateAct2Portrait(Tools.LoadTex("NevernamedsSigils/Resources/Appearances/anglerbackground_pixel.png"));

	public override Sprite OverrideBackground()
	{
		return tex;
	}
}
public class LonelyWizBackgroundPixel : PixelAppearanceBehaviour
{
	public static Sprite tex = Tools.GenerateAct2Portrait(Tools.LoadTex("NevernamedsSigils/Resources/Appearances/lonelywizardbackground_pixel.png"));

	public override Sprite OverrideBackground()
	{
		return tex;
	}
}
public class PikeMageBackgroundPixel : PixelAppearanceBehaviour
{
	public static Sprite tex = Tools.GenerateAct2Portrait(Tools.LoadTex("NevernamedsSigils/Resources/Appearances/pikemagebackground_pixel.png"));

	public override Sprite OverrideBackground()
	{
		return tex;
	}
}
public class GoobertBackgroundPixel : PixelAppearanceBehaviour
{
	public static Sprite tex = Tools.GenerateAct2Portrait(Tools.LoadTex("NevernamedsSigils/Resources/Appearances/goobertbackground_pixel.png"));

	public override Sprite OverrideBackground()
	{
		return tex;
	}
}
public class PixelShipDecal : PixelAppearanceBehaviour
{
	public static Sprite tex = Tools.GenerateAct2Portrait(Tools.LoadTex("NevernamedsSigils/Resources/Appearances/shipdecal_pixel.png"));

	public override Sprite PixelAppearance()
	{
		return tex;
	}
}
public class PixelSnowflakeDecal : PixelAppearanceBehaviour
{
	public static Sprite tex = Tools.GenerateAct2Portrait(Tools.LoadTex("NevernamedsSigils/Resources/Appearances/snowflakedecal_pixel.png"));

	public override Sprite PixelAppearance()
	{
		return tex;
	}
}
public class LeshyCardBackground : CardAppearanceBehaviour
{
	public static Texture2D tex = Tools.LoadTex("NevernamedsSigils/Resources/Appearances/leshycard.png");

	public override void ApplyAppearance()
	{
		((CardAppearanceBehaviour)this).Card.renderInfo.baseTextureOverride = (Texture)(object)tex;
	}
}
public class PixelDogBiteDecal : PixelAppearanceBehaviour
{
	public static Sprite tex = Tools.GenerateAct2Portrait(Tools.LoadTex("NevernamedsSigils/Resources/Appearances/dogbitedecal_pixel.png"));

	public override Sprite PixelAppearance()
	{
		return tex;
	}
}
public class PixelTechHeader : PixelAppearanceBehaviour
{
	public static Sprite tex = Tools.GenerateAct2Portrait(Tools.LoadTex("NevernamedsSigils/Resources/Appearances/techheader_pixel.png"));

	public override Sprite PixelAppearance()
	{
		return tex;
	}
}
public class PixelScrappyHeader : PixelAppearanceBehaviour
{
	public static Sprite tex = Tools.GenerateAct2Portrait(Tools.LoadTex("NevernamedsSigils/Resources/Appearances/scrapedheader_pixel.png"));

	public override Sprite PixelAppearance()
	{
		return tex;
	}
}
public class PixelBoneHeader : PixelAppearanceBehaviour
{
	public static Sprite tex = Tools.GenerateAct2Portrait(Tools.LoadTex("NevernamedsSigils/Resources/Appearances/boneheader_pixel.png"));

	public override Sprite PixelAppearance()
	{
		return tex;
	}
}
public class PixelBloodDecal : PixelAppearanceBehaviour
{
	public override Sprite PixelAppearance()
	{
		return Tools.GenerateAct2Portrait(Tools.LoadTex("NevernamedsSigils/Resources/Appearances/pixelblooddecal.png"));
	}
}
public class InstantEffectCardBackground : CardAppearanceBehaviour
{
	public static Texture2D instantEffectTex = Tools.LoadTex("NevernamedsSigils/Resources/Appearances/instanteffect_cardback.png");

	public static Texture2D instantEffectRareTex = Tools.LoadTex("NevernamedsSigils/Resources/Appearances/instanteffect_cardback_rare.png");

	public override void ApplyAppearance()
	{
		if ((Object)(object)((CardAppearanceBehaviour)this).Card.Info != (Object)null && ((CardAppearanceBehaviour)this).Card.Info.metaCategories.Contains((CardMetaCategory)3))
		{
			((CardAppearanceBehaviour)this).Card.renderInfo.baseTextureOverride = (Texture)(object)instantEffectRareTex;
		}
		else
		{
			((CardAppearanceBehaviour)this).Card.renderInfo.baseTextureOverride = (Texture)(object)instantEffectTex;
		}
	}
}
public class GreyCardBackground : CardAppearanceBehaviour
{
	public override void ApplyAppearance()
	{
		((CardAppearanceBehaviour)this).Card.renderInfo.baseTextureOverride = (Texture)(object)Tools.LoadTex("NevernamedsSigils/Resources/Appearances/grey_cardback.png");
	}
}
public class TechPaperCardBackground : CardAppearanceBehaviour
{
	public override void ApplyAppearance()
	{
		((CardAppearanceBehaviour)this).Card.renderInfo.baseTextureOverride = (Texture)(object)Tools.LoadTex("NevernamedsSigils/Resources/Appearances/tech_bg.png");
	}
}
public class GrueBackground : CardAppearanceBehaviour
{
	public override void ApplyAppearance()
	{
		//IL_0026: Unknown result type (might be due to invalid IL or missing references)
		//IL_002b: Unknown result type (might be due to invalid IL or missing references)
		//IL_003b: Unknown result type (might be due to invalid IL or missing references)
		//IL_0040: Unknown result type (might be due to invalid IL or missing references)
		//IL_005a: Unknown result type (might be due to invalid IL or missing references)
		//IL_005f: Unknown result type (might be due to invalid IL or missing references)
		//IL_006f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0074: Unknown result type (might be due to invalid IL or missing references)
		((CardAppearanceBehaviour)this).Card.renderInfo.baseTextureOverride = (Texture)(object)Tools.LoadTex("NevernamedsSigils/Resources/Appearances/grue_cardback.png");
		((CardAppearanceBehaviour)this).Card.renderInfo.attackTextColor = Color.white;
		((CardAppearanceBehaviour)this).Card.renderInfo.healthTextColor = Color.white;
		((CardAppearanceBehaviour)this).Card.renderInfo.healthTextOffset = new Vector2(0f, 0.07f);
		((CardAppearanceBehaviour)this).Card.renderInfo.defaultAbilityColor = Color.white;
	}
}
public class RareTerrainBackground : CardAppearanceBehaviour
{
	public override void ApplyAppearance()
	{
		((CardAppearanceBehaviour)this).Card.renderInfo.baseTextureOverride = (Texture)(object)Tools.LoadTex("NevernamedsSigils/Resources/Appearances/rareterrain_cardback.png");
	}
}
public static class Cards
{
	public static void Init()
	{
		//IL_0102: Unknown result type (might be due to invalid IL or missing references)
		//IL_010e: Unknown result type (might be due to invalid IL or missing references)
		//IL_027c: Unknown result type (might be due to invalid IL or missing references)
		//IL_0388: Unknown result type (might be due to invalid IL or missing references)
		//IL_0394: Unknown result type (might be due to invalid IL or missing references)
		//IL_041a: Unknown result type (might be due to invalid IL or missing references)
		//IL_0426: Unknown result type (might be due to invalid IL or missing references)
		//IL_083b: Unknown result type (might be due to invalid IL or missing references)
		//IL_08d6: Unknown result type (might be due to invalid IL or missing references)
		//IL_0ad9: Unknown result type (might be due to invalid IL or missing references)
		//IL_0b91: Unknown result type (might be due to invalid IL or missing references)
		//IL_0c54: Unknown result type (might be due to invalid IL or missing references)
		//IL_0e65: Unknown result type (might be due to invalid IL or missing references)
		//IL_0edb: Unknown result type (might be due to invalid IL or missing references)
		//IL_100a: Unknown result type (might be due to invalid IL or missing references)
		//IL_111c: Unknown result type (might be due to invalid IL or missing references)
		//IL_1128: Unknown result type (might be due to invalid IL or missing references)
		//IL_11b4: Unknown result type (might be due to invalid IL or missing references)
		//IL_11c0: Unknown result type (might be due to invalid IL or missing references)
		//IL_124c: Unknown result type (might be due to invalid IL or missing references)
		//IL_1543: Unknown result type (might be due to invalid IL or missing references)
		//IL_17bc: Unknown result type (might be due to invalid IL or missing references)
		SigilSetupUtility.NewCard("SigilNevernamed WrigglingPereiopod", "Wriggling Pereiopod", 0, 2, new List<CardMetaCategory>(), (CardTemple)0, "", 0, 0, 0, null, null, Tools.LoadTex("NevernamedsSigils/Resources/Cards/wrigglingpereiopod.png"), null, null, null, null, null, null, null, null, preventSignature: false, null, null, null, null, 1, null, null, null, (SpecialStatIcon)0);
		SigilSetupUtility.NewCard("SigilNevernamed WormyTail", "Wormy Tail", 0, 2, new List<CardMetaCategory>(), (CardTemple)0, "", 0, 0, 0, null, null, Tools.LoadTex("NevernamedsSigils/Resources/Cards/wormytail.png"), null, null, null, null, null, null, null, null, preventSignature: false, null, null, null, null, 1, null, null, null, (SpecialStatIcon)0);
		List<CardMetaCategory> categories = new List<CardMetaCategory>();
		Texture2D val = Tools.LoadTex("NevernamedsSigils/Resources/Cards/web.png");
		Texture2D val2 = Tools.LoadTex("NevernamedsSigils/Resources/Cards/web_emission.png");
		SigilSetupUtility.NewCard(abilities: new List<Ability>
		{
			WebSigil.ability,
			Remove.ability,
			(Ability)23
		}, defaultTex: val, emissionTex: val2, pixelTex: null, altTexture: null, altTextureEmission: null, titleGraphic: null, decals: null, traits: new List<Trait> { (Trait)12 }, internalName: "SigilNevernamed Web", displayname: "Web", power: 0, health: 1, categories: categories, temple: (CardTemple)0, description: "", bloodCost: 0, bonesCost: 0, energyCost: 0, gemsCost: null, appearanceBehaviour: new List<Appearance>
		{
			(Appearance)2,
			(Appearance)9
		}, tribes: null, preventSignature: false, defaultTailCard: null, defaultEvolutionCard: null, defaultEvolutionName: null, defaultEvolutionTurns: 1, defaultFrozenCard: null, tailLostTexture: null, specialAbilities: null, variableStat: (SpecialStatIcon)0, hideStats: false, onePerDeck: false, animatedPortrait: null, flipPortraitWhenStrafing: false, overrideDamID: null, overrideDamBlockedDialogue: null, overrideFactoryConduitSpawn: null, overrideRabbitHoleSpawn: null, overrideAntSpawnerSpawn: null, overrideBellistID: null, overrideBellistBlockedDialogue: null, overrideSquirrelShedderId: null, overrideSkeletonCrewID: null, overrideBeesWithinID: null, twisterForm: null, transformerForm: null, overrideLeftClaw: null, overrideRightClaw: null, customDoomedLifespan: null, customGutSpewerGuts: null, customExplodingCorpseGuts: null, customOrganThiefGuts: null, harbingerLeaveBehind: null, tramplerLeaveBehind: null, flightyLeaveBehind: null, parthenogenesisOverride: null, sigilShedderDef: null, preventBones: true);
		List<CardMetaCategory> categories2 = new List<CardMetaCategory>();
		val2 = Tools.LoadTex("NevernamedsSigils/Resources/Cards/guts.png");
		val = Tools.LoadTex("NevernamedsSigils/Resources/Cards/guts_emission.png");
		Texture2D val3 = Tools.LoadTex("NevernamedsSigils/Resources/PixelCards/guts_pixel.png");
		SigilSetupUtility.NewCard(abilities: new List<Ability> { (Ability)5 }, defaultTex: val2, emissionTex: val, pixelTex: val3, altTexture: null, altTextureEmission: null, titleGraphic: null, decals: null, traits: new List<Trait> { (Trait)12 }, internalName: "SigilNevernamed Guts", displayname: "Guts", power: 0, health: 1, categories: categories2, temple: (CardTemple)0, description: "", bloodCost: 0, bonesCost: 0, energyCost: 0, gemsCost: null, appearanceBehaviour: new List<Appearance>
		{
			(Appearance)2,
			(Appearance)9
		}, tribes: null, preventSignature: false, defaultTailCard: null, defaultEvolutionCard: "SigilNevernamed FesteringGuts", defaultEvolutionName: null, defaultEvolutionTurns: 3, defaultFrozenCard: null, tailLostTexture: null, specialAbilities: null, variableStat: (SpecialStatIcon)0);
		List<CardMetaCategory> categories3 = new List<CardMetaCategory>();
		val3 = Tools.LoadTex("NevernamedsSigils/Resources/Cards/festeringguts.png");
		val = Tools.LoadTex("NevernamedsSigils/Resources/Cards/festeringguts_emission.png");
		val2 = Tools.LoadTex("NevernamedsSigils/Resources/PixelCards/festeringguts_pixel.png");
		SigilSetupUtility.NewCard(abilities: new List<Ability> { Doomed.ability }, defaultTex: val3, emissionTex: val, pixelTex: val2, altTexture: null, altTextureEmission: null, titleGraphic: null, decals: null, traits: new List<Trait> { (Trait)12 }, internalName: "SigilNevernamed FesteringGuts", displayname: "Festering Guts", power: 0, health: 1, categories: categories3, temple: (CardTemple)0, description: "", bloodCost: 0, bonesCost: 0, energyCost: 0, gemsCost: null, appearanceBehaviour: new List<Appearance>
		{
			(Appearance)2,
			(Appearance)9
		}, tribes: null, preventSignature: false, defaultTailCard: null, defaultEvolutionCard: null, defaultEvolutionName: null, defaultEvolutionTurns: 1, defaultFrozenCard: null, tailLostTexture: null, specialAbilities: null, variableStat: (SpecialStatIcon)0);
		SigilSetupUtility.NewCard("SigilNevernamed Act2EmptyVessel", "Empty Vessel", 0, 2, new List<CardMetaCategory>(), (CardTemple)2, "", 0, 0, 1, null, null, null, null, Tools.LoadTex("NevernamedsSigils/Resources/PixelCards/act2emptyves_pixel.png"), null, null, null, null, null, null, preventSignature: false, null, null, null, null, 1, null, null, null, (SpecialStatIcon)0);
		SigilSetupUtility.NewCard(categories: new List<CardMetaCategory>(), description: "", bloodCost: 0, bonesCost: 0, energyCost: 0, gemsCost: null, defaultTex: Tools.LoadTex("NevernamedsSigils/Resources/Cards/claw_left.png"), pixelTex: Tools.LoadTex("NevernamedsSigils/Resources/PixelCards/clawleft_pixel.png"), internalName: "SigilNevernamed ClawLeft", displayname: "Claw", power: 1, health: 1, temple: (CardTemple)0, abilities: new List<Ability>
		{
			CrookedStrikeRight.ability,
			Claw.ability
		}, emissionTex: null, altTexture: null, altTextureEmission: null, titleGraphic: null, decals: null, appearanceBehaviour: new List<Appearance>(), tribes: null, preventSignature: false, traits: null, defaultTailCard: null, defaultEvolutionCard: null, defaultEvolutionName: null, defaultEvolutionTurns: 1, defaultFrozenCard: null, tailLostTexture: null, specialAbilities: null, variableStat: (SpecialStatIcon)0);
		SigilSetupUtility.NewCard(categories: new List<CardMetaCategory>(), description: "", bloodCost: 0, bonesCost: 0, energyCost: 0, gemsCost: null, defaultTex: Tools.LoadTex("NevernamedsSigils/Resources/Cards/claw_right.png"), pixelTex: Tools.LoadTex("NevernamedsSigils/Resources/PixelCards/clawright_pixel.png"), internalName: "SigilNevernamed ClawRight", displayname: "Claw", power: 1, health: 1, temple: (CardTemple)0, abilities: new List<Ability>
		{
			CrookedStrikeLeft.ability,
			Claw.ability
		}, emissionTex: null, altTexture: null, altTextureEmission: null, titleGraphic: null, decals: null, appearanceBehaviour: new List<Appearance>(), tribes: null, preventSignature: false, traits: null, defaultTailCard: null, defaultEvolutionCard: null, defaultEvolutionName: null, defaultEvolutionTurns: 1, defaultFrozenCard: null, tailLostTexture: null, specialAbilities: null, variableStat: (SpecialStatIcon)0);
		SigilSetupUtility.NewCard(categories: new List<CardMetaCategory>(), description: "", bloodCost: 0, bonesCost: 0, energyCost: 0, gemsCost: null, defaultTex: Tools.LoadTex("NevernamedsSigils/Resources/Cards/clonegrub.png"), emissionTex: Tools.LoadTex("NevernamedsSigils/Resources/Cards/clonegrub_emission.png"), pixelTex: Tools.LoadTex("NevernamedsSigils/Resources/PixelCards/clonegrub_pixel.png"), internalName: "SigilNevernamed CloneGrub", displayname: "Clone Grub", power: 0, health: 2, temple: (CardTemple)0, abilities: new List<Ability> { (Ability)5 }, altTexture: null, altTextureEmission: null, titleGraphic: null, decals: null, appearanceBehaviour: null, tribes: null, preventSignature: false, traits: null, defaultTailCard: null, defaultEvolutionCard: null, defaultEvolutionName: null, defaultEvolutionTurns: 1, defaultFrozenCard: null, tailLostTexture: null, specialAbilities: null, variableStat: (SpecialStatIcon)0);
		SigilSetupUtility.NewCard("SigilNevernamed EnchantedPine", "Enchanted Pine", 0, 3, new List<CardMetaCategory>(), (CardTemple)3, "", 0, 0, 0, null, new List<Ability>
		{
			(Ability)23,
			(Ability)43
		}, null, null, Tools.LoadTex("NevernamedsSigils/Resources/PixelCards/enchantedpine_pixel.png"), null, null, null, null, null, null, preventSignature: false, null, null, null, null, 1, null, null, null, (SpecialStatIcon)0);
		SigilSetupUtility.NewCard("SigilNevernamed UnnaturalCreature", "Unnatural Creature", 1, 1, new List<CardMetaCategory>(), (CardTemple)0, "", 0, 0, 0, null, null, Tools.LoadTex("NevernamedsSigils/Resources/Cards/unnaturalcreature.png"), Tools.LoadTex("NevernamedsSigils/Resources/Cards/unnaturalcreature_emission.png"), null, null, null, null, null, null, null, preventSignature: false, null, null, null, null, 1, null, null, null, (SpecialStatIcon)0);
		SigilSetupUtility.NewCard("SigilNevernamed ShadowedCreature", "Shadowed Creature", 1, 1, new List<CardMetaCategory>(), (CardTemple)0, "", 0, 0, 0, null, new List<Ability> { (Ability)35 }, Tools.LoadTex("NevernamedsSigils/Resources/Cards/shadowedcreature.png"), Tools.LoadTex("NevernamedsSigils/Resources/Cards/shadowedcreature_emission.png"), null, null, null, null, null, null, null, preventSignature: false, null, null, null, null, 1, null, null, null, (SpecialStatIcon)0);
		SigilSetupUtility.NewCard("SigilNevernamed Mess", "Mess", 0, 2, new List<CardMetaCategory>(), (CardTemple)0, "", 0, 0, 0, null, new List<Ability> { (Ability)83 }, Tools.LoadTex("NevernamedsSigils/Resources/Cards/mess.png"), null, Tools.LoadTex("NevernamedsSigils/Resources/PixelCards/mess_pixel.png"), null, null, null, null, null, null, preventSignature: false, null, null, null, null, 1, null, null, null, (SpecialStatIcon)0);
		SigilSetupUtility.NewCard(categories: new List<CardMetaCategory>(), description: "", bloodCost: 0, bonesCost: 2, energyCost: 0, gemsCost: null, tribes: new List<Tribe> { (Tribe)6 }, abilities: new List<Ability>(), defaultTex: Tools.LoadTex("NevernamedsSigils/Resources/Cards/termite.png"), pixelTex: Tools.LoadTex("NevernamedsSigils/Resources/PixelCards/termite_pixel.png"), internalName: "SigilNevernamed Termite", displayname: "Termite", power: 1, health: 2, temple: (CardTemple)0, emissionTex: Tools.LoadTex("NevernamedsSigils/Resources/Cards/termite_emission.png"), altTexture: null, altTextureEmission: null, titleGraphic: null, decals: null, appearanceBehaviour: null, preventSignature: false, traits: null, defaultTailCard: null, defaultEvolutionCard: null, defaultEvolutionName: null, defaultEvolutionTurns: 1, defaultFrozenCard: null, tailLostTexture: null, specialAbilities: null, variableStat: (SpecialStatIcon)0);
		SigilSetupUtility.NewCard(categories: new List<CardMetaCategory>(), description: "", bloodCost: 0, bonesCost: 1, energyCost: 0, gemsCost: null, tribes: new List<Tribe> { (Tribe)6 }, internalName: "SigilNevernamed SwarmedMayfly", displayname: "Mayfly", power: 1, health: 1, temple: (CardTemple)0, abilities: new List<Ability>
		{
			(Ability)19,
			(Ability)35
		}, defaultTex: Tools.LoadTex("NevernamedsSigils/Resources/Cards/mayfly.png"), emissionTex: Tools.LoadTex("NevernamedsSigils/Resources/Cards/mayfly_emission.png"), pixelTex: Tools.LoadTex("NevernamedsSigils/Resources/PixelCards/mayfly_pixel.png"), altTexture: null, altTextureEmission: null, titleGraphic: null, decals: null, appearanceBehaviour: null, preventSignature: false, traits: null, defaultTailCard: null, defaultEvolutionCard: null, defaultEvolutionName: null, defaultEvolutionTurns: 1, defaultFrozenCard: null, tailLostTexture: null, specialAbilities: null, variableStat: (SpecialStatIcon)0);
		SigilSetupUtility.NewCard(categories: new List<CardMetaCategory>(), description: "", bloodCost: 2, bonesCost: 0, energyCost: 0, gemsCost: null, tribes: new List<Tribe>(), internalName: "SigilNevernamed CopiedProspecter", displayname: "The Prospector", power: 2, health: 3, temple: (CardTemple)0, abilities: new List<Ability>
		{
			(Ability)8,
			GoldRush.ability
		}, defaultTex: Tools.LoadTex("NevernamedsSigils/Resources/Cards/copiedprospector.png"), emissionTex: Tools.LoadTex("NevernamedsSigils/Resources/Cards/copiedprospector_emission.png"), pixelTex: null, altTexture: null, altTextureEmission: null, titleGraphic: null, decals: null, appearanceBehaviour: new List<Appearance> { (Appearance)7 }, preventSignature: false, traits: null, defaultTailCard: null, defaultEvolutionCard: null, defaultEvolutionName: null, defaultEvolutionTurns: 1, defaultFrozenCard: null, tailLostTexture: null, specialAbilities: null, variableStat: (SpecialStatIcon)0);
		SigilSetupUtility.NewCard(categories: new List<CardMetaCategory>(), description: "", bloodCost: 0, bonesCost: 5, energyCost: 0, gemsCost: null, tribes: new List<Tribe>(), internalName: "SigilNevernamed CopiedRoyal", displayname: "Royal Dominguez", power: 1, health: 3, temple: (CardTemple)0, abilities: new List<Ability>
		{
			(Ability)36,
			FireInTheHole.ability
		}, defaultTex: Tools.LoadTex("NevernamedsSigils/Resources/Cards/copiedroyal.png"), emissionTex: Tools.LoadTex("NevernamedsSigils/Resources/Cards/copiedroyal_emission.png"), pixelTex: null, altTexture: null, altTextureEmission: null, titleGraphic: null, decals: null, appearanceBehaviour: new List<Appearance> { (Appearance)7 }, preventSignature: false, traits: null, defaultTailCard: null, defaultEvolutionCard: null, defaultEvolutionName: null, defaultEvolutionTurns: 1, defaultFrozenCard: null, tailLostTexture: null, specialAbilities: null, variableStat: (SpecialStatIcon)0, hideStats: false, onePerDeck: false, animatedPortrait: null, flipPortraitWhenStrafing: false, overrideDamID: null, overrideDamBlockedDialogue: null, overrideFactoryConduitSpawn: null, overrideRabbitHoleSpawn: null, overrideAntSpawnerSpawn: null, overrideBellistID: null, overrideBellistBlockedDialogue: null, overrideSquirrelShedderId: null, overrideSkeletonCrewID: "SkeletonPirate");
		SigilSetupUtility.NewCard(categories: new List<CardMetaCategory>(), description: "", bloodCost: 0, bonesCost: 0, energyCost: 1, gemsCost: null, tribes: new List<Tribe>(), internalName: "SigilNevernamed RemoteController", displayname: "Remote Controller", power: 0, health: 2, temple: (CardTemple)2, abilities: new List<Ability>(), defaultTex: Tools.LoadTex("NevernamedsSigils/Resources/Cards/remotecontroller.png"), emissionTex: null, pixelTex: Tools.LoadTex("NevernamedsSigils/Resources/PixelCards/remotecontroller_pixel.png"), altTexture: null, altTextureEmission: null, titleGraphic: null, decals: null, appearanceBehaviour: null, preventSignature: false, traits: null, defaultTailCard: null, defaultEvolutionCard: null, defaultEvolutionName: null, defaultEvolutionTurns: 1, defaultFrozenCard: null, tailLostTexture: null, specialAbilities: null, variableStat: (SpecialStatIcon)0);
		SigilSetupUtility.NewCard(categories: new List<CardMetaCategory>(), description: "", bloodCost: 1, bonesCost: 0, energyCost: 0, gemsCost: null, tribes: new List<Tribe>(), internalName: "SigilNevernamed SpiritBeast", displayname: "Spirit Beast", power: 1, health: 2, temple: (CardTemple)0, abilities: new List<Ability>(), defaultTex: Tools.LoadTex("NevernamedsSigils/Resources/Cards/spiritbeast.png"), emissionTex: Tools.LoadTex("NevernamedsSigils/Resources/Cards/spiritbeast_emission.png"), pixelTex: Tools.LoadTex("NevernamedsSigils/Resources/PixelCards/spiritbeast_pixel.png"), altTexture: null, altTextureEmission: null, titleGraphic: null, decals: null, appearanceBehaviour: null, preventSignature: false, traits: null, defaultTailCard: null, defaultEvolutionCard: null, defaultEvolutionName: null, defaultEvolutionTurns: 1, defaultFrozenCard: null, tailLostTexture: null, specialAbilities: null, variableStat: (SpecialStatIcon)0);
		SigilSetupUtility.NewCard("SigilNevernamed Bud", "Bud", 0, 3, new List<CardMetaCategory>(), (CardTemple)0, "", 0, 0, 0, null, null, Tools.LoadTex("NevernamedsSigils/Resources/Cards/bud.png"), Tools.LoadTex("NevernamedsSigils/Resources/Cards/bud_emission.png"), null, null, null, null, null, null, null, preventSignature: false, null, null, null, null, 1, null, null, null, (SpecialStatIcon)0);
		SigilSetupUtility.NewCard(categories: new List<CardMetaCategory>(), description: "", bloodCost: 0, bonesCost: 0, energyCost: 0, gemsCost: null, abilities: new List<Ability>
		{
			(Ability)21,
			Doomed.ability
		}, traits: new List<Trait> { (Trait)12 }, appearanceBehaviour: new List<Appearance>
		{
			(Appearance)2,
			(Appearance)9
		}, internalName: "SigilNevernamed Vomit", displayname: "Vomit", power: 0, health: 1, temple: (CardTemple)0, defaultTex: Tools.LoadTex("NevernamedsSigils/Resources/Cards/vomit.png"), emissionTex: Tools.LoadTex("NevernamedsSigils/Resources/Cards/vomit_emission.png"), pixelTex: Tools.LoadTex("NevernamedsSigils/Resources/PixelCards/vomit_pixel.png"), altTexture: null, altTextureEmission: null, titleGraphic: null, decals: null, tribes: null, preventSignature: false, defaultTailCard: null, defaultEvolutionCard: null, defaultEvolutionName: null, defaultEvolutionTurns: 1, defaultFrozenCard: null, tailLostTexture: null, specialAbilities: null, variableStat: (SpecialStatIcon)0);
		SigilSetupUtility.NewCard(categories: new List<CardMetaCategory>(), description: "", bloodCost: 0, bonesCost: 0, energyCost: 0, gemsCost: null, abilities: new List<Ability>
		{
			(Ability)21,
			Doomed.ability
		}, traits: new List<Trait> { (Trait)12 }, appearanceBehaviour: new List<Appearance>
		{
			(Appearance)2,
			(Appearance)9
		}, internalName: "SigilNevernamed VomitGrimora", displayname: "Vomit", power: 0, health: 1, temple: (CardTemple)1, defaultTex: Tools.LoadTex("NevernamedsSigils/Resources/Cards/vomitgrimora.png"), emissionTex: null, pixelTex: null, altTexture: null, altTextureEmission: null, titleGraphic: null, decals: null, tribes: null, preventSignature: false, defaultTailCard: null, defaultEvolutionCard: null, defaultEvolutionName: null, defaultEvolutionTurns: 1, defaultFrozenCard: null, tailLostTexture: null, specialAbilities: null, variableStat: (SpecialStatIcon)0);
		CardInfo val4 = CardExtensions.SetExtendedProperty(SigilSetupUtility.NewCard(categories: new List<CardMetaCategory>(), description: "The bloated, everpregnant guppy... it always contains more fish...", bloodCost: 0, bonesCost: 3, energyCost: 0, gemsCost: null, defaultTex: Tools.LoadTex("NevernamedsSigils/Resources/Cards/morefish.png"), emissionTex: Tools.LoadTex("NevernamedsSigils/Resources/Cards/morefish_emission.png"), appearanceBehaviour: new List<Appearance> { (Appearance)7 }, internalName: "SigilNevernamed MoreFish", displayname: "More Fish", power: 0, health: 1, temple: (CardTemple)0, abilities: new List<Ability> { GiftBearerCustom.ability }, pixelTex: null, altTexture: null, altTextureEmission: null, titleGraphic: null, decals: null, tribes: null, preventSignature: false, traits: null, defaultTailCard: null, defaultEvolutionCard: null, defaultEvolutionName: null, defaultEvolutionTurns: 1, defaultFrozenCard: null, tailLostTexture: null, specialAbilities: null, variableStat: (SpecialStatIcon)0), "GiftBearerCustomPoolIdentifier", (object)"FishbotFishPool");
		CardExtensions.SetExtendedProperty(val4, "FishbotFishPool", (object)"true");
		CardExtensions.SetExtendedProperty(SigilSetupUtility.NewCard(categories: new List<CardMetaCategory>(), description: "", bloodCost: 0, bonesCost: 3, energyCost: 0, gemsCost: null, defaultTex: Tools.LoadTex("NevernamedsSigils/Resources/Cards/badfish.png"), emissionTex: Tools.LoadTex("NevernamedsSigils/Resources/Cards/badfish_emission.png"), appearanceBehaviour: new List<Appearance> { (Appearance)7 }, internalName: "SigilNevernamed BadFish", displayname: "Bad Fish", power: 0, health: 1, temple: (CardTemple)0, abilities: new List<Ability>
		{
			(Ability)76,
			(Ability)35
		}, pixelTex: null, altTexture: null, altTextureEmission: null, titleGraphic: null, decals: null, tribes: null, preventSignature: false, traits: null, defaultTailCard: null, defaultEvolutionCard: null, defaultEvolutionName: null, defaultEvolutionTurns: 1, defaultFrozenCard: null, tailLostTexture: null, specialAbilities: null, variableStat: (SpecialStatIcon)0), "FishbotFishPool", (object)"true");
		CardExtensions.SetExtendedProperty(SigilSetupUtility.NewCard(categories: new List<CardMetaCategory>(), description: "", bloodCost: 0, bonesCost: 6, energyCost: 0, gemsCost: null, defaultTex: Tools.LoadTex("NevernamedsSigils/Resources/Cards/goodfish.png"), emissionTex: Tools.LoadTex("NevernamedsSigils/Resources/Cards/goodfish_emission.png"), appearanceBehaviour: new List<Appearance> { (Appearance)7 }, internalName: "SigilNevernamed GoodFish", displayname: "Good Fish", power: 2, health: 2, temple: (CardTemple)0, abilities: new List<Ability>
		{
			(Ability)23,
			(Ability)62,
			(Ability)15,
			(Ability)53
		}, pixelTex: null, altTexture: null, altTextureEmission: null, titleGraphic: null, decals: null, tribes: null, preventSignature: false, traits: null, defaultTailCard: null, defaultEvolutionCard: null, defaultEvolutionName: null, defaultEvolutionTurns: 1, defaultFrozenCard: null, tailLostTexture: null, specialAbilities: null, variableStat: (SpecialStatIcon)0), "FishbotFishPool", (object)"true");
		SigilSetupUtility.NewCard(categories: new List<CardMetaCategory>(), description: "", bloodCost: 0, bonesCost: 0, energyCost: 0, gemsCost: null, abilities: new List<Ability>(), defaultTex: null, emissionTex: null, traits: new List<Trait>
		{
			(Trait)13,
			(Trait)12
		}, specialAbilities: new List<SpecialTriggeredAbility> { Act2SpawnLice.ability }, internalName: "SigilNevernamed WolfPelt", displayname: "Wolf Pelt", power: 0, health: 2, temple: (CardTemple)0, pixelTex: Tools.LoadTex("NevernamedsSigils/Resources/PixelCards/wolfpelt_pixel.png"), altTexture: null, altTextureEmission: null, titleGraphic: null, decals: null, appearanceBehaviour: null, tribes: null, preventSignature: false, defaultTailCard: null, defaultEvolutionCard: null, defaultEvolutionName: null, defaultEvolutionTurns: 1, defaultFrozenCard: null, tailLostTexture: null, variableStat: (SpecialStatIcon)0);
		SigilSetupUtility.NewCard(categories: new List<CardMetaCategory>(), description: "", bloodCost: 0, bonesCost: 0, energyCost: 0, gemsCost: null, abilities: new List<Ability>
		{
			Endangered.ability,
			(Ability)52
		}, traits: new List<Trait> { (Trait)12 }, appearanceBehaviour: new List<Appearance>
		{
			(Appearance)2,
			(Appearance)9
		}, internalName: "SigilNevernamed Payload", displayname: "Payload", power: 0, health: 1, temple: (CardTemple)0, defaultTex: Tools.LoadTex("NevernamedsSigils/Resources/Cards/payload.png"), emissionTex: null, pixelTex: Tools.LoadTex("NevernamedsSigils/Resources/PixelCards/payload_pixel.png"), altTexture: null, altTextureEmission: null, titleGraphic: null, decals: null, tribes: null, preventSignature: false, defaultTailCard: null, defaultEvolutionCard: null, defaultEvolutionName: null, defaultEvolutionTurns: 1, defaultFrozenCard: null, tailLostTexture: null, specialAbilities: null, variableStat: (SpecialStatIcon)0);
		SigilSetupUtility.NewCard(categories: new List<CardMetaCategory>(), description: "", bloodCost: 0, bonesCost: 0, energyCost: 0, gemsCost: null, abilities: new List<Ability>(), traits: new List<Trait> { (Trait)12 }, appearanceBehaviour: new List<Appearance>(), internalName: "SigilNevernamed Components", displayname: "Components", power: 0, health: 1, temple: (CardTemple)2, defaultTex: Tools.LoadTex("NevernamedsSigils/Resources/Cards/components.png"), emissionTex: null, pixelTex: null, altTexture: null, altTextureEmission: null, titleGraphic: null, decals: null, tribes: null, preventSignature: false, defaultTailCard: null, defaultEvolutionCard: null, defaultEvolutionName: null, defaultEvolutionTurns: 1, defaultFrozenCard: null, tailLostTexture: null, specialAbilities: null, variableStat: (SpecialStatIcon)0);
		CardExtensions.SetExtendedProperty(SigilSetupUtility.NewCard(categories: new List<CardMetaCategory>(), description: "", bloodCost: 0, bonesCost: 0, energyCost: 0, gemsCost: null, abilities: new List<Ability> { Doomed.ability }, traits: new List<Trait>(), appearanceBehaviour: new List<Appearance>(), internalName: "SigilNevernamed GutsGrimora", displayname: "Guts", power: 0, health: 1, temple: (CardTemple)1, defaultTex: Tools.LoadTex("NevernamedsSigils/Resources/Cards/gutsgrimora.png"), emissionTex: null, pixelTex: null, altTexture: null, altTextureEmission: null, titleGraphic: null, decals: null, tribes: null, preventSignature: false, defaultTailCard: null, defaultEvolutionCard: null, defaultEvolutionName: null, defaultEvolutionTurns: 1, defaultFrozenCard: null, tailLostTexture: null, specialAbilities: null, variableStat: (SpecialStatIcon)0), "CustomDoomedDuration", (object)"4");
		SigilSetupUtility.NewCard(categories: new List<CardMetaCategory>(), description: "", bloodCost: 0, bonesCost: 0, energyCost: 0, gemsCost: null, abilities: new List<Ability>(), defaultTex: null, emissionTex: null, traits: new List<Trait>(), appearanceBehaviour: new List<Appearance>(), internalName: "SigilNevernamed RawMeat", displayname: "Raw Meat", power: 0, health: 1, temple: (CardTemple)0, pixelTex: Tools.LoadTex("NevernamedsSigils/Resources/PixelCards/rawmeat_pixel.png"), altTexture: null, altTextureEmission: null, titleGraphic: null, decals: null, tribes: null, preventSignature: false, defaultTailCard: null, defaultEvolutionCard: null, defaultEvolutionName: null, defaultEvolutionTurns: 1, defaultFrozenCard: null, tailLostTexture: null, specialAbilities: null, variableStat: (SpecialStatIcon)0, hideStats: false, onePerDeck: false, animatedPortrait: null, flipPortraitWhenStrafing: false, overrideDamID: null, overrideDamBlockedDialogue: null, overrideFactoryConduitSpawn: null, overrideRabbitHoleSpawn: null, overrideAntSpawnerSpawn: null, overrideBellistID: null, overrideBellistBlockedDialogue: null, overrideSquirrelShedderId: null, overrideSkeletonCrewID: null, overrideBeesWithinID: null, twisterForm: null, transformerForm: null, overrideLeftClaw: null, overrideRightClaw: null, customDoomedLifespan: null, customGutSpewerGuts: null, customExplodingCorpseGuts: null, customOrganThiefGuts: null, harbingerLeaveBehind: null, tramplerLeaveBehind: null, flightyLeaveBehind: null, parthenogenesisOverride: null, sigilShedderDef: null, preventBones: true);
		SigilSetupUtility.NewCard(categories: new List<CardMetaCategory>(), description: "", bloodCost: 0, bonesCost: 0, energyCost: 0, gemsCost: null, abilities: new List<Ability>
		{
			(Ability)51,
			Recharge.ability,
			InstantEffect.ability
		}, defaultTex: null, emissionTex: null, traits: new List<Trait> { (Trait)12 }, appearanceBehaviour: new List<Appearance>(), internalName: "SigilNevernamed ExcisedPowerCell", displayname: "Excised Power Cell", power: 0, health: 1, temple: (CardTemple)2, pixelTex: Tools.LoadTex("NevernamedsSigils/Resources/PixelCards/excisedpowercell_pixel.png"), altTexture: null, altTextureEmission: null, titleGraphic: null, decals: null, tribes: null, preventSignature: false, defaultTailCard: null, defaultEvolutionCard: null, defaultEvolutionName: null, defaultEvolutionTurns: 1, defaultFrozenCard: null, tailLostTexture: null, specialAbilities: null, variableStat: (SpecialStatIcon)0, hideStats: false, onePerDeck: false, animatedPortrait: null, flipPortraitWhenStrafing: false, overrideDamID: null, overrideDamBlockedDialogue: null, overrideFactoryConduitSpawn: null, overrideRabbitHoleSpawn: null, overrideAntSpawnerSpawn: null, overrideBellistID: null, overrideBellistBlockedDialogue: null, overrideSquirrelShedderId: null, overrideSkeletonCrewID: null, overrideBeesWithinID: null, twisterForm: null, transformerForm: null, overrideLeftClaw: null, overrideRightClaw: null, customDoomedLifespan: null, customGutSpewerGuts: null, customExplodingCorpseGuts: null, customOrganThiefGuts: null, harbingerLeaveBehind: null, tramplerLeaveBehind: null, flightyLeaveBehind: null, parthenogenesisOverride: null, sigilShedderDef: null, preventBones: true);
		SigilSetupUtility.NewCard(categories: new List<CardMetaCategory>(), description: "", bloodCost: 0, bonesCost: 0, energyCost: 0, gemsCost: null, abilities: new List<Ability>
		{
			BoneDuke.ability,
			Unhammerable.ability
		}, defaultTex: null, emissionTex: null, traits: new List<Trait> { (Trait)12 }, appearanceBehaviour: new List<Appearance>(), internalName: "SigilNevernamed BoneEffigy", displayname: "Bone Effigy", power: 0, health: 1, temple: (CardTemple)1, pixelTex: Tools.LoadTex("NevernamedsSigils/Resources/PixelCards/boneeffigy_pixel.png"), altTexture: null, altTextureEmission: null, titleGraphic: null, decals: null, tribes: null, preventSignature: false, defaultTailCard: null, defaultEvolutionCard: null, defaultEvolutionName: null, defaultEvolutionTurns: 1, defaultFrozenCard: null, tailLostTexture: null, specialAbilities: null, variableStat: (SpecialStatIcon)0);
		SigilSetupUtility.NewCard(categories: new List<CardMetaCategory>(), description: "", bloodCost: 0, bonesCost: 0, energyCost: 0, gemsCost: null, abilities: new List<Ability> { MysteryMox.ability }, defaultTex: null, emissionTex: null, traits: new List<Trait>
		{
			(Trait)12,
			(Trait)17
		}, appearanceBehaviour: new List<Appearance>(), internalName: "SigilNevernamed DesecratedMox", displayname: "Desecrated Mox", power: 0, health: 1, temple: (CardTemple)3, pixelTex: Tools.LoadTex("NevernamedsSigils/Resources/PixelCards/desecratedmox_pixel.png"), altTexture: null, altTextureEmission: null, titleGraphic: null, decals: null, tribes: null, preventSignature: false, defaultTailCard: null, defaultEvolutionCard: null, defaultEvolutionName: null, defaultEvolutionTurns: 1, defaultFrozenCard: null, tailLostTexture: null, specialAbilities: null, variableStat: (SpecialStatIcon)0, hideStats: false, onePerDeck: false, animatedPortrait: null, flipPortraitWhenStrafing: false, overrideDamID: null, overrideDamBlockedDialogue: null, overrideFactoryConduitSpawn: null, overrideRabbitHoleSpawn: null, overrideAntSpawnerSpawn: null, overrideBellistID: null, overrideBellistBlockedDialogue: null, overrideSquirrelShedderId: null, overrideSkeletonCrewID: null, overrideBeesWithinID: null, twisterForm: null, transformerForm: null, overrideLeftClaw: null, overrideRightClaw: null, customDoomedLifespan: null, customGutSpewerGuts: null, customExplodingCorpseGuts: null, customOrganThiefGuts: null, harbingerLeaveBehind: null, tramplerLeaveBehind: null, flightyLeaveBehind: null, parthenogenesisOverride: null, sigilShedderDef: null, preventBones: true);
		SigilSetupUtility.NewCard("SigilNevernamed LooseFlesh", "Loose Flesh", 0, 1, new List<CardMetaCategory>(), (CardTemple)0, "", 0, 0, 0, null, new List<Ability> { (Ability)103 }, Tools.LoadTex("NevernamedsSigils/Resources/Cards/looseflesh.png"), null, Tools.LoadTex("NevernamedsSigils/Resources/PixelCards/looseflesh_pixel.png"), null, null, null, null, null, null, preventSignature: false, null, null, null, null, 1, null, null, null, (SpecialStatIcon)0);
		SigilSetupUtility.NewCard(categories: new List<CardMetaCategory>(), description: "", bloodCost: 0, bonesCost: 0, energyCost: 0, gemsCost: null, abilities: new List<Ability>
		{
			(Ability)38,
			(Ability)23
		}, defaultTex: null, emissionTex: null, traits: new List<Trait>
		{
			(Trait)12,
			(Trait)17
		}, appearanceBehaviour: new List<Appearance>(), internalName: "SigilNevernamed RubyPillar", displayname: "Ruby Pillar", power: 0, health: 4, temple: (CardTemple)3, pixelTex: Tools.LoadTex("NevernamedsSigils/Resources/PixelCards/rubypillar_pixel.png"), altTexture: null, altTextureEmission: null, titleGraphic: null, decals: null, tribes: null, preventSignature: false, defaultTailCard: null, defaultEvolutionCard: null, defaultEvolutionName: null, defaultEvolutionTurns: 1, defaultFrozenCard: null, tailLostTexture: null, specialAbilities: null, variableStat: (SpecialStatIcon)0);
		SigilSetupUtility.NewCard(categories: new List<CardMetaCategory>(), description: "", bloodCost: 0, bonesCost: 0, energyCost: 0, gemsCost: null, abilities: new List<Ability>
		{
			(Ability)37,
			(Ability)23
		}, defaultTex: null, emissionTex: null, traits: new List<Trait>
		{
			(Trait)12,
			(Trait)17
		}, appearanceBehaviour: new List<Appearance>(), internalName: "SigilNevernamed EmeraldPillar", displayname: "Emerald Pillar", power: 0, health: 4, temple: (CardTemple)3, pixelTex: Tools.LoadTex("NevernamedsSigils/Resources/PixelCards/emeraldpillar_pixel.png"), altTexture: null, altTextureEmission: null, titleGraphic: null, decals: null, tribes: null, preventSignature: false, defaultTailCard: null, defaultEvolutionCard: null, defaultEvolutionName: null, defaultEvolutionTurns: 1, defaultFrozenCard: null, tailLostTexture: null, specialAbilities: null, variableStat: (SpecialStatIcon)0);
		SigilSetupUtility.NewCard(categories: new List<CardMetaCategory>(), description: "", bloodCost: 0, bonesCost: 0, energyCost: 0, gemsCost: null, abilities: new List<Ability>
		{
			(Ability)39,
			(Ability)23
		}, defaultTex: null, emissionTex: null, traits: new List<Trait>
		{
			(Trait)12,
			(Trait)17
		}, appearanceBehaviour: new List<Appearance>(), internalName: "SigilNevernamed SapphirePillar", displayname: "Sapphire Pillar", power: 0, health: 4, temple: (CardTemple)3, pixelTex: Tools.LoadTex("NevernamedsSigils/Resources/PixelCards/sapphirepillar_pixel.png"), altTexture: null, altTextureEmission: null, titleGraphic: null, decals: null, tribes: null, preventSignature: false, defaultTailCard: null, defaultEvolutionCard: null, defaultEvolutionName: null, defaultEvolutionTurns: 1, defaultFrozenCard: null, tailLostTexture: null, specialAbilities: null, variableStat: (SpecialStatIcon)0);
		SigilSetupUtility.NewCard(categories: new List<CardMetaCategory>(), description: "", bloodCost: 0, bonesCost: 0, energyCost: 0, gemsCost: null, abilities: new List<Ability>(), defaultTex: null, emissionTex: null, traits: new List<Trait> { (Trait)12 }, appearanceBehaviour: new List<Appearance> { CustomAppearances.PixelGoldBackground }, internalName: "SigilNevernamed Act2GoldNugget", displayname: "Gold Nugget", power: 0, health: 2, temple: (CardTemple)3, pixelTex: Tools.LoadTex("NevernamedsSigils/Resources/PixelCards/goldnugget_pixel.png"), altTexture: null, altTextureEmission: null, titleGraphic: null, decals: null, tribes: null, preventSignature: false, defaultTailCard: null, defaultEvolutionCard: null, defaultEvolutionName: null, defaultEvolutionTurns: 1, defaultFrozenCard: null, tailLostTexture: null, specialAbilities: null, variableStat: (SpecialStatIcon)0);
		SigilSetupUtility.NewCard(categories: new List<CardMetaCategory>(), description: "", bloodCost: 0, bonesCost: 0, energyCost: 0, gemsCost: null, abilities: new List<Ability> { (Ability)52 }, traits: new List<Trait> { (Trait)12 }, internalName: "SigilNevernamed MagicBomb", displayname: "Magic Bomb", power: 0, health: 1, temple: (CardTemple)3, defaultTex: Tools.LoadTex("NevernamedsSigils/Resources/Cards/magicbomb.png"), emissionTex: null, pixelTex: Tools.LoadTex("NevernamedsSigils/Resources/PixelCards/magicbomb_pixel.png"), altTexture: null, altTextureEmission: null, titleGraphic: null, decals: null, appearanceBehaviour: null, tribes: null, preventSignature: false, defaultTailCard: null, defaultEvolutionCard: null, defaultEvolutionName: null, defaultEvolutionTurns: 1, defaultFrozenCard: null, tailLostTexture: null, specialAbilities: null, variableStat: (SpecialStatIcon)0);
		SigilSetupUtility.NewCard("SigilNevernamed SapphireSkeleton", "Sapphire Skeleton", 1, 1, new List<CardMetaCategory>(), (CardTemple)1, "", 0, 0, 0, null, new List<Ability>
		{
			(Ability)35,
			(Ability)39
		}, null, null, Tools.LoadTex("NevernamedsSigils/Resources/PixelCards/sapphireskeleton_pixel.png"), null, null, null, null, null, null, preventSignature: false, null, null, null, null, 1, null, null, null, (SpecialStatIcon)0);
		SigilSetupUtility.NewCard("SigilNevernamed RubySkeleton", "Ruby Skeleton", 1, 1, new List<CardMetaCategory>(), (CardTemple)1, "", 0, 0, 0, null, new List<Ability>
		{
			(Ability)35,
			(Ability)38
		}, null, null, Tools.LoadTex("NevernamedsSigils/Resources/PixelCards/rubyskeleton_pixel.png"), null, null, null, null, null, null, preventSignature: false, null, null, null, null, 1, null, null, null, (SpecialStatIcon)0);
		SigilSetupUtility.NewCard("SigilNevernamed EmeraldSkeleton", "Emerald Skeleton", 1, 1, new List<CardMetaCategory>(), (CardTemple)1, "", 0, 0, 0, null, new List<Ability>
		{
			(Ability)35,
			(Ability)37
		}, null, null, Tools.LoadTex("NevernamedsSigils/Resources/PixelCards/emeraldskeleton_pixel.png"), null, null, null, null, null, null, preventSignature: false, null, null, null, null, 1, null, null, null, (SpecialStatIcon)0);
		SigilSetupUtility.NewCard(categories: new List<CardMetaCategory> { (CardMetaCategory)3 }, description: "", bloodCost: 0, bonesCost: 0, energyCost: 0, gemsCost: null, abilities: new List<Ability> { PerfectForm.ability }, defaultTex: null, emissionTex: null, traits: new List<Trait>
		{
			(Trait)12,
			(Trait)17
		}, internalName: "SigilNevernamed PinnacleMox", displayname: "Pinnacle Mox", power: 0, health: 1, temple: (CardTemple)3, pixelTex: Tools.LoadTex("NevernamedsSigils/Resources/PixelCards/pinnaclemox_pixel.png"), altTexture: null, altTextureEmission: null, titleGraphic: null, decals: null, appearanceBehaviour: null, tribes: null, preventSignature: false, defaultTailCard: null, defaultEvolutionCard: null, defaultEvolutionName: null, defaultEvolutionTurns: 1, defaultFrozenCard: null, tailLostTexture: null, specialAbilities: null, variableStat: (SpecialStatIcon)0);
	}
}
[BepInPlugin("nevernamed.inscryption.sigils", "NevernamedsSigils", "1.10.0.0")]
[BepInDependency(/*Could not decode attribute arguments.*/)]
[BepInDependency(/*Could not decode attribute arguments.*/)]
[BepInDependency(/*Could not decode attribute arguments.*/)]
public class Plugin : BaseUnityPlugin
{
	public const string PluginGuid = "nevernamed.inscryption.sigils";

	private const string PluginName = "NevernamedsSigils";

	private const string PluginVersion = "1.10.0.0";

	public static AssetBundle bundle;

	public static List<string> toBeMadeRodent = new List<string> { "Amalgam", "Hydra", "PackRat", "Porcupine", "Beaver", "FieldMouse", "RatKing" };

	public static List<string> toBeMadeArachnid = new List<string> { "Amalgam", "Hydra" };

	public static List<string> toBeMadeCrustacean = new List<string> { "Amalgam", "Hydra" };

	public static List<CardInfo> mycoRequiredCardAdded = new List<CardInfo>();

	public static List<CardInfo> mycoFusedCardAdded = new List<CardInfo>();

	internal static ConfigEntry<bool> arachnophobiaMode;

	public static Texture2D NoBonesDecal;

	public static readonly AbilityMetaCategory GrimoraModChair1 = GuidManager.GetEnumValue<AbilityMetaCategory>("arackulele.inscryption.grimoramod", "ElectricChairLevel1");

	public static readonly AbilityMetaCategory GrimoraModChair2 = GuidManager.GetEnumValue<AbilityMetaCategory>("arackulele.inscryption.grimoramod", "ElectricChairLevel2");

	public static readonly AbilityMetaCategory GrimoraModChair3 = GuidManager.GetEnumValue<AbilityMetaCategory>("arackulele.inscryption.grimoramod", "ElectricChairLevel3");

	public static readonly AbilityMetaCategory Part2Modular = GuidManager.GetEnumValue<AbilityMetaCategory>("cyantist.inscryption.api", "Part2Modular");

	public static readonly CardMetaCategory GrimoraChoiceNode = GuidManager.GetEnumValue<CardMetaCategory>("arackulele.inscryption.grimoramod", "GrimoraModChoiceNode");

	public static readonly CardMetaCategory P03KayceesWizardRegion = GuidManager.GetEnumValue<CardMetaCategory>("zorro.inscryption.infiniscryption.p03kayceerun", "WizardRegionCards");

	public static readonly CardMetaCategory P03KayceesBastionRegion = GuidManager.GetEnumValue<CardMetaCategory>("zorro.inscryption.infiniscryption.p03kayceerun", "TechRegionCards");

	public static readonly CardMetaCategory P03KayceesNatureRegion = GuidManager.GetEnumValue<CardMetaCategory>("zorro.inscryption.infiniscryption.p03kayceerun", "NatureRegionCards");

	public static readonly CardMetaCategory P03KayceesUndeadRegion = GuidManager.GetEnumValue<CardMetaCategory>("zorro.inscryption.infiniscryption.p03kayceerun", "UndeadRegionCards");

	public static readonly CardMetaCategory P03KayceesNeutralRegion = GuidManager.GetEnumValue<CardMetaCategory>("zorro.inscryption.infiniscryption.p03kayceerun", "NeutralRegionCards");

	private void Awake()
	{
		//IL_0026: Unknown result type (might be due to invalid IL or missing references)
		//IL_002c: Expected O, but got Unknown
		((BaseUnityPlugin)this).Logger.LogInfo((object)"Loaded NevernamedsSigils!");
		bundle = LoadBundle("NevernamedsSigils/Resources/sigilassetbundle");
		Harmony val = new Harmony("NevernamedsSigils.harmonypatcher");
		val.PatchAll();
		NoBonesDecal = Tools.LoadTex("NevernamedsSigils/Resources/Other/preventbonesdecal.png");
		arachnophobiaMode = ((BaseUnityPlugin)this).Config.Bind<bool>("General", "Arachnophobia Mode", false, "Replaces certain icons to resemble webs rather than spiders.");
		NevernamedsTribes.InitTribes();
		CustomAppearances.Init();
		CustomDeathcardPortrait.InitialiseDictionaries();
		Copier.Init();
		Flighty.Init();
		Harbinger.Init();
		GutSpewer.Init();
		ExplodingCorpseCustom.Init();
		Doomed.Init();
		UnfocusedStrike.Init();
		Commander.Init();
		BandageWeaver.Init();
		Endangered.Init();
		ToothPuller.Init();
		TrophyHunter.Init();
		Fearsome.Init();
		Trio.Init();
		Hypermorphic.Init();
		Enraged.Init();
		Medicinal.Init();
		Burning.Init();
		FireResistant.Init();
		Ignition.Init();
		SavageRitual.Init();
		Trapjaw.Init();
		SkinAnimator.Init();
		OrganThief.Init();
		Snapshot.Init();
		EnergyDependent.Init();
		CrookedStrikeLeft.Init();
		CrookedStrikeRight.Init();
		Lonesome.Init();
		DeusHoof.Init();
		Ripper.Init();
		HaunterCustom.Init();
		FrailSacrifice.Init();
		Mockery.Init();
		ImmortalCoil.Init();
		Clawed.Init();
		Claw.Init();
		RunningStrike.Init();
		Abstain.Init();
		Cute.Init();
		WebSigil.Init();
		Trampler.Init();
		SharperQuills.Init();
		ClawingHand.Init();
		Weaver.Init();
		ReturnStrike.Init();
		InspiringSacrifice.Init();
		DeckedOut.Init();
		BoneDependent.Init();
		OtherSide.Init();
		ExceptionalSacrifice.Init();
		TriflingSacrifice.Init();
		Visceral.Init();
		TuckAndRoll.Init();
		BoneSpurs.Init();
		Crossbones.Init();
		HomeRun.Init();
		SquirrelDependent.Init();
		Vampiric.Init();
		Allure.Init();
		Traitor.Init();
		TermiteKing.Init();
		Termatriarch.Init();
		Parthenogenesis.Init();
		Landscaper.Init();
		Diver.Init();
		FanTailed.Init();
		TransformerCustom.Init();
		Twister.Init();
		TwinBond.Init();
		SubaquaticSpines.Init();
		Frail.Init();
		Caustic.Init();
		Unlucky.Init();
		AntGuardian.Init();
		Drop.Init();
		Moxcraft.Init();
		WoodsieLord.Init();
		FringeStrike.Init();
		Mason.Init();
		Dupeglitch.Init();
		Downdraft.Init();
		Recharge.Init();
		VesselShedder.Init();
		GiftBearerCustom.Init();
		KinBearer.Init();
		HartsWithin.Init();
		ArtisticLicense.Init();
		ChaosStrike.Init();
		BloodDependent.Init();
		DeathSnatch.Init();
		AculeateGrip.Init();
		Motivator.Init();
		Paralytic.Init();
		BuzzOff.Init();
		CoastGuard.Init();
		SpidersWeb.Init();
		TripleStrike.Init();
		Bonelust.Init();
		Moxwarp.Init();
		TemptingTarget.Init();
		SwoopingStrike.Init();
		GraveyardShift.Init();
		Incontinent.Init();
		BloodFromStone.Init();
		Tug.Init();
		PointNemo.Init();
		Gooey.Init();
		Immaterial.Init();
		Stalwart.Init();
		GoldRush.Init();
		FireInTheHole.Init();
		Erratic.Init();
		Soak.Init();
		DogGone.Init();
		Snakebite.Init();
		DeerlyDeparted.Init();
		FowlPlay.Init();
		Insectivore.Init();
		Crusher.Init();
		RockEater.Init();
		FatalFlank.Init();
		Eager.Init();
		Lurk.Init();
		LashOut.Init();
		Ravenous.Init();
		EspritDeCorp.Init();
		Sanguine.Init();
		UnbalancedLeadership.Init();
		BoneDuke.Init();
		Sturdy.Init();
		Resilient.Init();
		Mauler.Init();
		FossilRecord.Init();
		CallToArms.Init();
		SplashDamage.Init();
		Phantasmic.Init();
		FilterFeeder.Init();
		WaveringStrike.Init();
		PinnacleStrike.Init();
		OddStrike.Init();
		EvenStrike.Init();
		Valuable.Init();
		Thief.Init();
		CenterStrike.Init();
		Herald.Init();
		Revolve.Init();
		DivisibilityStrike.Init();
		Venator.Init();
		Summoner.Init();
		SharpestQuills.Init();
		SinisterStrike.Init();
		DexterStrike.Init();
		RemoteControlled.Init();
		Pushover.Init();
		Healshield.Init();
		Sentriple.Init();
		Bloodrunner.Init();
		SurgingQuills.Init();
		SplitSentry.Init();
		Snare.Init();
		Bully.Init();
		Legion.Init();
		TrajectileQuills.Init();
		BloodGusher.Init();
		Propagation.Init();
		EyeForBattle.Init();
		Wingrider.Init();
		Bisection.Init();
		Emancipation.Init();
		Cheater.Init();
		Collector.Init();
		CollateralDamage.Init();
		Siphon.Init();
		HookLineAndSinker.Init();
		SquirrelKing.Init();
		Spurred.Init();
		SharpShot.Init();
		EnemyLines.Init();
		PainfulPresence.Init();
		BloodBorn.Init();
		Armortify.Init();
		Distraction.Init();
		FlankBlast.Init();
		SplitDetonation.Init();
		CardShedder.Init();
		SapphireHeart.Init();
		EmeraldHeart.Init();
		RubyCore.Init();
		SapphireCore.Init();
		EmeraldCore.Init();
		TestSigil.Init();
		Docile.Init();
		Reroute.Init();
		Globetrotter.Init();
		Expulsion.Init();
		Crunchy.Init();
		InstantEffect.Init();
		Wimpy.Init();
		Osteoklepty.Init();
		Annihilation.Init();
		Telepathic.Init();
		OrangeInspiration.Init();
		Transmogrification.Init();
		Divination.Init();
		Freefall.Init();
		Disembowel.Init();
		Exsanguination.Init();
		FaceToFace.Init();
		BloodArtist.Init();
		FriendFinder.Init();
		NatureOfTheBeast.Init();
		Quickdraw.Init();
		Bleach.Init();
		SkullSwarm.Init();
		KillingJoke.Init();
		UnstableGems.Init();
		GreenInspiration.Init();
		BlueInspiration.Init();
		WildShape.Init();
		EasyPickings.Init();
		Antimagic.Init();
		SplashZone.Init();
		Obedient.Init();
		Snip.Init();
		Desperate.Init();
		Act2TrinketBearer.Init();
		Omniguardian.Init();
		Supercharge.Init();
		Cleaving.Init();
		MorphMover.Init();
		Backup.Init();
		SapphireDependant.Init();
		RubyDependant.Init();
		EmeraldDependant.Init();
		BombsAway.Init();
		SigilMimic.Init();
		MysteryMox.Init();
		Recycle.Init();
		BatchDelete.Init();
		Unhammerable.Init();
		Absorber.Init();
		Marcescent.Init();
		DoubleTap.Init();
		Dripping.Init();
		UnderPressure.Init();
		Regenerator.Init();
		Exhume.Init();
		Lockdown.Init();
		Magitech.Init();
		QuadStrike.Init();
		GemShedder.Init();
		SwitchStrike.Init();
		Bombjuration.Init();
		Firebomb.Init();
		Piercing.Init();
		PreemptiveStrike.Init();
		Bloodguzzler.Init();
		Eternal.Init();
		Giant.Init();
		HighPowered.Init();
		Rupture.Init();
		Ranger.Init();
		Rememberance.Init();
		Toxic.Init();
		Waterbird.Init();
		Bloated.Init();
		Draw.Init();
		FrogFriend.Init();
		L33pLeaver.Init();
		Deadringer.Init();
		PutSentryHere.Init();
		CircuitMaker.Init();
		VivaLaRevolution.Init();
		MoxMax.Init();
		Goated.Init();
		WingClipper.Init();
		Gravity.Init();
		Bastion.Init();
		Healer.Init();
		PerfectForm.Init();
		ImmaculateForm.Init();
		PureHeart.Init();
		GemSkeptic.Init();
		Defiler.Init();
		BifurcatedWhenGempowered.Init();
		SweepingStrikeLeft.Init();
		SweepingStrikeRight.Init();
		Entangle.Init();
		Coward.Init();
		Reflective.Init();
		Mirrific.Init();
		Unspeakable.Init();
		Prophecy.Init();
		DiagonalStrike.Init();
		Retreat.Init();
		WaterborneLatch.Init();
		SprinterLatch.Init();
		BurningLatch.Init();
		BurrowerLatch.Init();
		WeirdLatch.Init();
		NullLatch.Init();
		FrailLatch.Init();
		HaunterLatch.Init();
		OverclockedLatch.Init();
		GemLatch.Init();
		AirborneLatch.Init();
		AnnoyingLatch.Init();
		SniperLatch.Init();
		StalwartLatch.Init();
		TotemLatch.Init();
		MeaninglessBond.Init();
		FriendshipBond.Init();
		TenderBond.Init();
		BillowingBond.Init();
		GraveConduit.Init();
		StimConduit.Init();
		LootConduit.Init();
		MalfunctioningConduit.Init();
		GunConduit.Init();
		ThornyConduit.Init();
		ElderConduit.Init();
		NanoConduit.Init();
		HotConduit.Init();
		SapphireConduit.Init();
		RubyConduit.Init();
		EmeraldConduit.Init();
		RepulsiveWhenPowered.Init();
		SplashDamageWhenPowered.Init();
		GiftWhenPoweredCustom.Init();
		DoubleStrikeWhenPowered.Init();
		OmnipotentWhenPowered.Init();
		MorselWhenPowered.Init();
		PoweredQuills.Init();
		PrintWhenPowered.Init();
		ScavengeWhenPowered.Init();
		StimulateWhenPowered.Init();
		Fetch.Init();
		Remove.Init();
		EternalGallop.Init();
		Flip.Init();
		TrainedFlier.Init();
		EnlargeCustom.Init();
		Dredge.Init();
		Bonefed.Init();
		Bonestrike.Init();
		UpgradeSubroutine.Init();
		Causality.Init();
		Carnivore.Init();
		Deadbeat.Init();
		Bloodbait.Init();
		TrainedSwimmer.Init();
		Gorge.Init();
		PunchingBag.Init();
		FairTrade.Init();
		Broodfeast.Init();
		PickyEater.Init();
		Escape.Init();
		Spellsword.Init();
		Sharpen.Init();
		ExaltedRune.Init();
		AntPlusTwo.Init();
		HealthDamage.Init();
		BloodAndBone.Init();
		DirectorOfTheBoard.Init();
		DamageDice.Init();
		OneDFour.Init();
		BirdsOfAFeather.Init();
		PackHunter.Init();
		HerdingBeast.Init();
		WorldWideWeb.Init();
		Boned.Init();
		OneHalfSquirrels.Init();
		SinEater.Init();
		Ambitious.Init();
		StrengthInNumbers.Init();
		PackPower.Init();
		PackPowerPlus.Init();
		TrinketVitality.Init();
		HalfCharged.Init();
		Greenhorn.Init();
		Fabled.Init();
		MagickePower.Init();
		CrabDance.Init();
		HandOnHeart.Init();
		Lithophile.Init();
		Firepower.Init();
		FollowTheLeader.Init();
		Starved.Init();
		DrawnOut.Init();
		SanguineBond.Init();
		InherentFecundity.Init();
		ContinualEvolution.Init();
		AbsorbOtherCards.Init();
		SigilShedder.Init();
		InherentUndying.Init();
		InherentCardOnHit.Init();
		InherentGooey.Init();
		InherentCardShedder.Init();
		BetterRandomCard.Init();
		InherentGraveyardShift.Init();
		Act2SpawnLice.Init();
		Act2Shapeshifter.Init();
		Cards.Init();
		FaceToFaceCardsInit.Init();
		Act2ItemCards.Init();
		CardExtensions.SetPixelPortrait(CardExtensions.CardByName((IEnumerable<CardInfo>)CardManager.BaseGameCards, "EmptyVessel"), Tools.LoadTex("NevernamedsSigils/Resources/PixelCards/act2emptyves_pixel.png"), (FilterMode?)null);
		CardExtensions.SetPixelPortrait(CardExtensions.CardByName((IEnumerable<CardInfo>)CardManager.BaseGameCards, "EmptyVessel_GreenGem"), Tools.LoadTex("NevernamedsSigils/Resources/PixelCards/emeraldvessel_pixel.png"), (FilterMode?)null);
		CardExtensions.SetPixelPortrait(CardExtensions.CardByName((IEnumerable<CardInfo>)CardManager.BaseGameCards, "EmptyVessel_OrangeGem"), Tools.LoadTex("NevernamedsSigils/Resources/PixelCards/rubyvessel_pixel.png"), (FilterMode?)null);
		CardExtensions.SetPixelPortrait(CardExtensions.CardByName((IEnumerable<CardInfo>)CardManager.BaseGameCards, "EmptyVessel_BlueGem"), Tools.LoadTex("NevernamedsSigils/Resources/PixelCards/sapphirevessel_pixel.png"), (FilterMode?)null);
		CardManager.ModifyCardList += delegate(List<CardInfo> cards)
		{
			//IL_014b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0178: Unknown result type (might be due to invalid IL or missing references)
			//IL_01a5: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ce: Unknown result type (might be due to invalid IL or missing references)
			//IL_01d3: Unknown result type (might be due to invalid IL or missing references)
			//IL_01df: Expected O, but got Unknown
			foreach (CardInfo item in cards.Where((CardInfo c) => CardExtensions.GetExtendedProperty(c, "PreventBones") != null))
			{
				if (item.decals == null)
				{
					item.decals = new List<Texture>();
				}
				item.decals.Add((Texture)(object)NoBonesDecal);
			}
			bool flag = ScriptableObjectLoader<CardInfo>.AllData.FindAll((CardInfo x) => x.tribes.Contains(NevernamedsTribes.Arachnid)).Count > 0;
			bool flag2 = ScriptableObjectLoader<CardInfo>.AllData.FindAll((CardInfo x) => x.tribes.Contains(NevernamedsTribes.Crustacean)).Count > 0;
			bool flag3 = ScriptableObjectLoader<CardInfo>.AllData.FindAll((CardInfo x) => x.tribes.Contains(NevernamedsTribes.Rodent)).Count > 0;
			foreach (CardInfo card in cards)
			{
				if (toBeMadeArachnid.Contains(((Object)card).name) && flag)
				{
					card.tribes.Add(NevernamedsTribes.Arachnid);
				}
				if (toBeMadeCrustacean.Contains(((Object)card).name) && flag2)
				{
					card.tribes.Add(NevernamedsTribes.Crustacean);
				}
				if (toBeMadeRodent.Contains(((Object)card).name) && flag3)
				{
					card.tribes.Add(NevernamedsTribes.Rodent);
				}
				if (CardExtensions.GetExtendedProperty(card, "SigilariumGemified") != null)
				{
					card.Mods.Add(new CardModificationInfo
					{
						gemify = true
					});
				}
			}
			return cards;
		};
		AbilityManager.ModifyAbilityList += (List<FullAbility> abilities) => abilities;
	}

	public static AssetBundle LoadBundle(string path)
	{
		using Stream stream = Assembly.GetExecutingAssembly().GetManifestResourceStream(path.Replace("\\", ".").Replace("/", "."));
		return AssetBundle.LoadFromStream(stream);
	}
}
public class CustomDeathcardPortrait : DynamicCardPortrait
{
	[SerializeField]
	public SpriteRenderer bodyRenderer;

	[SerializeField]
	public SpriteRenderer headRenderer;

	[SerializeField]
	public SpriteRenderer faceRenderer;

	[SerializeField]
	public SpriteRenderer earsRenderer;

	[SerializeField]
	public SpriteRenderer emissionRenderer;

	private CardModificationInfo bountyHunterInfo;

	public static Dictionary<int, List<Sprite>> BodySprites;

	public static Dictionary<int, List<Sprite>> HeadSprites;

	public static Dictionary<int, List<Sprite>> EyesSprites;

	public static Dictionary<int, List<Sprite>> EmissionSprites;

	public static Dictionary<int, List<Sprite>> EarsSprites;

	public static Dictionary<Tribe, int> tribeToInt = new Dictionary<Tribe, int>
	{
		{
			(Tribe)3,
			10
		},
		{
			(Tribe)2,
			11
		},
		{
			(Tribe)5,
			12
		},
		{
			(Tribe)6,
			13
		},
		{
			(Tribe)4,
			14
		},
		{
			(Tribe)1,
			15
		},
		{
			NevernamedsTribes.Arachnid,
			16
		},
		{
			NevernamedsTribes.Crustacean,
			17
		},
		{
			NevernamedsTribes.Rodent,
			18
		}
	};

	public static List<int> validRandomAct1Tribes = new List<int> { 10, 11, 12, 13, 14, 16, 17, 18 };

	private static List<string> syllable1 = new List<string>
	{
		"Bull", "Mos", "Man", "The ", "Deadly ", "Wild ", "Ho", "Am", "Amph", "Co",
		"Kar", "Fi", "Ra", "Spar", "Blood ", "King", "Coy", "Al", "El", "Moo",
		"Wa", "Pa", "Wor", "Mag", "Lar", "Strange ", "Stink", "Our", "Add", "Ura",
		"Squi", "Por", "Ara", "Bea", "Ot", "War"
	};

	private static List<string> syllable2 = new List<string>
	{
		"qui", "fro", "ti", "digi", "al", "pe", "ki", "sher", "wal", "fi",
		"o", "loo", "ker", "got", "goat", "va", "lar", "ink", "yu", "oe",
		"cu", "cku", "pu"
	};

	private static List<string> syllable3 = new List<string>
	{
		"frog", "to", "s", "amy", "gam", "pod", "pog", "nos", "pa", "ven",
		"row", "ker", "te", "pha", "se", "sie", "ant", "va", "bug", "fly",
		"boros", "li", "ba", "rrel", "pine", "lele", "ver", "ter", "ren"
	};

	private static List<string> RobotSyllable1 = new List<string>
	{
		"The ", "Not ", "Holy ", "Tall ", "Lil ", "Big ", "Ms. ", "Mr. ", "Mrs. ", "Master ",
		"Dr. ", "St. ", "Dat ", "Prof. ", "Hon. ", "Grim", "Super ", "Capt. ", "Rev. ", "Gen. ",
		"My ", "Your ", "Msgr. ", "King ", "Queen ", "Mistress ", "Tiny ", "Crazy "
	};

	private static List<string> RobotSyllable2 = new List<string>
	{
		"Lol", "The", "Toot", "Loot", "Shoot", "Help", "Good", "Smart", "Fat", "Fire",
		"Screw", "Bomb", "Gun", "Sad", "Happy", "Killer", "Death", "Steel", "Tin", "Gold",
		"Iron", "Green", "Engi", "Zap", "Buzz", "Clunker", "Angry", "Eat", "Old"
	};

	private static List<string> RobotSyllable3 = new List<string>
	{
		" 2000", " 3000", "matic", "Bot", " bot", " You", " thing", "robo", " Esq.", " X",
		" Boi", " Jr.", " Man", "tron", "tronic", " .v4", "man", "droid", " droid", " Toe",
		" Me"
	};

	private static List<string> UndeadSyllable1 = new List<string>
	{
		"Dr. ", "Master ", "The ", "Sir ", "Horrid ", "Festering ", "Gruesome ", "Corpulent ", "Lady ", "Madame ",
		"Capt. ", "First Mate ", "Loathesome ", "Dear ", "The Late ", "Mad ", "Msgr. ", "Prof. ", "Unholy ", "Evil ",
		"Dead ", "Wild ", "Lt. ", "Baron ", "Duke ", "Duke of ", "Starved ", "Smooth "
	};

	private static List<string> UndeadSyllable2 = new List<string>
	{
		"Bones", "Graves", "Deads", "Ghoul", "Frost", "Dirt", "Heart", "Rip", "Dark", "Cold",
		"Limb", "Bone", "Skull", 

plugins/Nevernamed-Opponent_Bones/plugins/OpponentBones.dll

Decompiled 5 months ago
using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using BepInEx;
using DiskCardGame;
using GBC;
using HarmonyLib;
using InscryptionAPI.Card;
using Pixelplacement;
using UnityEngine;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: TargetFramework(".NETStandard,Version=v2.0", FrameworkDisplayName = "")]
[assembly: AssemblyCompany("OpponentBones")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("OpponentBones")]
[assembly: AssemblyTitle("OpponentBones")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.0.0")]
[module: UnverifiableCode]
namespace OpponentBones;

[BepInPlugin("nevernamed.inscryption.opponentbones", "OpponentBones", "1.0.0")]
[BepInDependency(/*Could not decode attribute arguments.*/)]
public class Plugin : BaseUnityPlugin
{
	private const string PluginGuid = "nevernamed.inscryption.opponentbones";

	private const string PluginName = "OpponentBones";

	private const string PluginVersion = "1.0.0";

	public static AssetBundle bundle;

	private void Awake()
	{
		//IL_0017: Unknown result type (might be due to invalid IL or missing references)
		//IL_001d: Expected O, but got Unknown
		((BaseUnityPlugin)this).Logger.LogInfo((object)"Loaded OpponentBones!");
		Harmony val = new Harmony("nevernamed.inscryption.opponentbones.harmonypatcher");
		val.PatchAll();
	}
}
public class OpponentResourceManager : NonCardTriggerReceiver
{
	public static GameObject pixelBonesIcon;

	public static PixelNumeral pixelBonesCounter;

	public static OpponentResourceManager instance;

	public static Vector3 opponentBonesPosition = new Vector3(4.1795f, 5.01f, 2.761f);

	private int opponentBones;

	private List<OpponentBoneToken> opponentTokens = new List<OpponentBoneToken>();

	public override bool TriggerBeforeCards => true;

	public int OpponentBones => opponentBones;

	public static int GetActAsInt()
	{
		if (SaveManager.SaveFile.IsPart1)
		{
			return 1;
		}
		if (SaveManager.SaveFile.IsPart2)
		{
			return 2;
		}
		if (SaveManager.SaveFile.IsPart3)
		{
			return 3;
		}
		if (SaveManager.SaveFile.IsGrimora)
		{
			return 4;
		}
		if (SaveManager.SaveFile.IsMagnificus)
		{
			return 5;
		}
		return 0;
	}

	private void Start()
	{
		//IL_0028: Unknown result type (might be due to invalid IL or missing references)
		//IL_0069: Unknown result type (might be due to invalid IL or missing references)
		if ((Object)(object)pixelBonesIcon == (Object)null && Singleton<ResourcesManager>.Instance is PixelResourcesManager)
		{
			pixelBonesIcon = Object.Instantiate<GameObject>(((Component)((PixelResourcesManager)Singleton<ResourcesManager>.Instance).bonesParent).gameObject);
			pixelBonesCounter = pixelBonesIcon.GetComponentInChildren<PixelNumeral>();
			pixelBonesIcon.transform.localPosition = new Vector3(2.0555f, 0.97f, 0f);
		}
	}

	public override IEnumerator OnOtherCardDie(PlayableCard card, CardSlot deathSlot, bool fromCombat, PlayableCard killer)
	{
		yield return AddOpponentBones(deathSlot, 1);
	}

	public override bool RespondsToOtherCardDie(PlayableCard card, CardSlot deathSlot, bool fromCombat, PlayableCard killer)
	{
		return card.OpponentCard && CardExtensions.GetExtendedProperty(((Card)card).Info, "PreventBones") == null;
	}

	public IEnumerator AddOpponentBones(CardSlot slot, int bones)
	{
		opponentBones += bones;
		ResourcesManager res = Singleton<ResourcesManager>.Instance;
		if ((Object)(object)res != (Object)null && res is Part1ResourcesManager)
		{
			for (int i = 0; i < bones; i++)
			{
				GameObject gameObject = Object.Instantiate<GameObject>(((Part1ResourcesManager)((res is Part1ResourcesManager) ? res : null)).boneTokenPrefab);
				Object.Destroy((Object)(object)gameObject.GetComponent<BoneTokenInteractable>());
				OpponentBoneToken component = gameObject.AddComponent<OpponentBoneToken>();
				Rigidbody tokenRB = gameObject.GetComponent<Rigidbody>();
				if ((Object)(object)slot != (Object)null)
				{
					gameObject.transform.position = ((Component)slot).transform.position + Vector3.up;
				}
				else
				{
					gameObject.transform.position = opponentBonesPosition + Vector3.up * 5f;
				}
				((Part1ResourcesManager)((res is Part1ResourcesManager) ? res : null)).PushTokenDown(tokenRB);
				Vector3 endValue = opponentBonesPosition + Vector3.up * (float)opponentBones * 0.1f;
				Tween.Rotation(((Component)component).transform, new Vector3(-90f, 0f, 0f), 0.1f, 0f, Tween.EaseInOut, (LoopType)0, (Action)null, (Action)null, true);
				Tween.Position(((Component)component).transform, endValue, 0.25f, 0.5f, Tween.EaseInOut, (LoopType)0, (Action)null, (Action)delegate
				{
					gameObject.GetComponent<Collider>().enabled = true;
				}, true);
				opponentTokens.Add(component);
				yield return (object)new WaitForSeconds(0.05f);
			}
		}
		else if ((Object)(object)pixelBonesIcon != (Object)null)
		{
			AudioController.Instance.PlaySound2D("chipBlip2", (MixerGroup)0, 0.4f, 0f, new Pitch(Mathf.Min(0.8f + (float)opponentBones * 0.05f, 1.2f)), (Repetition)null, (Randomization)null, (Distortion)null, false);
			pixelBonesCounter.DisplayValue(opponentBones);
			BounceRenderer(pixelBonesIcon.transform);
		}
	}

	private void BounceRenderer(Transform rendererTransform)
	{
		//IL_0002: Unknown result type (might be due to invalid IL or missing references)
		//IL_0007: Unknown result type (might be due to invalid IL or missing references)
		//IL_0009: Unknown result type (might be due to invalid IL or missing references)
		//IL_000a: Unknown result type (might be due to invalid IL or missing references)
		//IL_0014: Unknown result type (might be due to invalid IL or missing references)
		//IL_0019: Unknown result type (might be due to invalid IL or missing references)
		//IL_0038: Unknown result type (might be due to invalid IL or missing references)
		Vector3 localPosition = rendererTransform.localPosition;
		Tween.LocalPosition(rendererTransform, localPosition + Vector3.up * 0.02f, 0.025f, 0f, Tween.EaseOut, (LoopType)0, (Action)null, (Action)null, true);
		Tween.LocalPosition(rendererTransform, localPosition, 0.025f, 0.075f, Tween.EaseIn, (LoopType)0, (Action)null, (Action)null, true);
	}

	public IEnumerator RemoveOpponentBones(int number)
	{
		opponentBones -= number;
		for (int i = 0; i < number; i++)
		{
			if (opponentTokens.Count > 0)
			{
				OpponentBoneToken component = ((Component)opponentTokens[opponentTokens.Count - 1]).GetComponent<OpponentBoneToken>();
				component.FlyOffBoard();
				opponentTokens.Remove(component);
				yield return (object)new WaitForSeconds(0.075f);
			}
		}
	}

	public IEnumerator CleanupManager()
	{
		yield return RemoveOpponentBones(opponentBones);
		instance = null;
		Object.Destroy((Object)(object)((Component)this).gameObject);
	}
}
public class OpponentBoneToken : MonoBehaviour
{
	public void FlyOffBoard()
	{
		//IL_0019: Unknown result type (might be due to invalid IL or missing references)
		//IL_002d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0032: Unknown result type (might be due to invalid IL or missing references)
		//IL_0061: Unknown result type (might be due to invalid IL or missing references)
		//IL_008d: Unknown result type (might be due to invalid IL or missing references)
		//IL_009d: Unknown result type (might be due to invalid IL or missing references)
		//IL_00ac: Unknown result type (might be due to invalid IL or missing references)
		//IL_00b9: Expected O, but got Unknown
		//IL_00b9: Expected O, but got Unknown
		Object.Destroy((Object)(object)((Component)this).GetComponent<Rigidbody>());
		Tween.Position(((Component)this).transform, ((Component)this).transform.position + new Vector3(4f, 2f, 0f), 0.3f, 0f, (AnimationCurve)null, (LoopType)0, (Action)null, (Action)null, true);
		Tween.Rotate(((Component)this).transform, new Vector3(90f, 0f, 90f), (Space)0, 0.3f, 0f, (AnimationCurve)null, (LoopType)0, (Action)null, (Action)null, true);
		AudioController.Instance.PlaySound3D("token_enter_higher", (MixerGroup)4, ((Component)this).transform.position, 1f, 0f, new Pitch((Variation)0), new Repetition(0.05f, ""), (Randomization)null, (Distortion)null, false);
		Object.Destroy((Object)(object)((Component)this).gameObject, 0.3f);
	}

	private void OnCollisionEnter(Collision collision)
	{
		//IL_0002: Unknown result type (might be due to invalid IL or missing references)
		//IL_0007: Unknown result type (might be due to invalid IL or missing references)
		//IL_001c: Unknown result type (might be due to invalid IL or missing references)
		//IL_0021: 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_0061: Unknown result type (might be due to invalid IL or missing references)
		//IL_0070: Unknown result type (might be due to invalid IL or missing references)
		//IL_007d: Expected O, but got Unknown
		//IL_007d: Expected O, but got Unknown
		Vector3 impulse = collision.impulse;
		if (((Vector3)(ref impulse)).magnitude > 10f)
		{
			impulse = collision.impulse;
			float num = Mathf.Clamp(Mathf.Sqrt(((Vector3)(ref impulse)).magnitude) * 0.1f, 0.5f, 1f);
			AudioController.Instance.PlaySound3D("token_enter", (MixerGroup)4, ((Component)this).transform.position, num, 0f, new Pitch((Variation)0), new Repetition(0.05f, ""), (Randomization)null, (Distortion)null, false);
		}
	}
}
[HarmonyPatch(typeof(TurnManager), "StartGame", new Type[] { typeof(EncounterData) })]
public class BattleStart
{
	[HarmonyPrefix]
	public static void BattleStartPatch(TurnManager __instance)
	{
		//IL_003e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0044: Expected O, but got Unknown
		int actAsInt = OpponentResourceManager.GetActAsInt();
		if (actAsInt == 1 || actAsInt == 2 || actAsInt == 4)
		{
			if ((Object)(object)OpponentResourceManager.instance != (Object)null)
			{
				Object.Destroy((Object)(object)((Component)OpponentResourceManager.instance).gameObject);
			}
			GameObject val = new GameObject();
			OpponentResourceManager instance = val.AddComponent<OpponentResourceManager>();
			OpponentResourceManager.instance = instance;
		}
	}
}
[HarmonyPatch(typeof(TurnManager), "CleanupPhase")]
public class BattleEnd
{
	[HarmonyPostfix]
	public static IEnumerator BattleEndPatch(IEnumerator enumerator, TurnManager __instance)
	{
		if ((Object)(object)OpponentResourceManager.instance != (Object)null)
		{
			yield return OpponentResourceManager.instance.CleanupManager();
		}
		yield return enumerator;
	}
}
[HarmonyPatch(typeof(BoneDigger), "OnTurnEnd")]
public class BonesPatch
{
	[HarmonyPostfix]
	private static void BoneDiggerPatch(BoneDigger __instance, ref IEnumerator __result)
	{
		if (Object.op_Implicit((Object)(object)__instance) && Object.op_Implicit((Object)(object)((AbilityBehaviour)__instance).Card) && !CardExtensions.IsPlayerCard(((AbilityBehaviour)__instance).Card))
		{
			__result = GiveBoneToPlayer(__instance, (__instance != null) ? ((AbilityBehaviour)__instance).Card : null);
		}
	}

	public static IEnumerator GiveBoneToPlayer(BoneDigger instance, PlayableCard card)
	{
		Singleton<ViewManager>.Instance.SwitchToView((View)4, false, true);
		yield return (object)new WaitForSeconds(0.1f);
		((Card)card).Anim.LightNegationEffect();
		yield return ((AbilityBehaviour)instance).PreSuccessfulTriggerSequence();
		if (Object.op_Implicit((Object)(object)OpponentResourceManager.instance))
		{
			yield return OpponentResourceManager.instance.AddOpponentBones(card.slot, 1);
		}
		yield return (object)new WaitForSeconds(0.1f);
		yield return ((AbilityBehaviour)instance).LearnAbility(0.1f);
		Singleton<ViewManager>.Instance.Controller.LockState = (ViewLockState)0;
	}
}

plugins/Orochi_Umbra-NodeBane/plugins/NodeBane.dll

Decompiled 5 months ago
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using BepInEx;
using BepInEx.Configuration;
using BepInEx.Logging;
using DiskCardGame;
using HarmonyLib;
using InscryptionAPI.Ascension;
using InscryptionAPI.Card;
using InscryptionAPI.Helpers;
using Microsoft.CodeAnalysis;
using Sirenix.Utilities;
using UnityEngine;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: TargetFramework(".NETStandard,Version=v2.0", FrameworkDisplayName = ".NET Standard 2.0")]
[assembly: AssemblyCompany("NodeBane")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyDescription("A BepInEx plugin made for Inscryption to limit a card from entering Campfire, Mycologists, Copy Card node twice.")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("NodeBane")]
[assembly: AssemblyTitle("NodeBane")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.0.0")]
[module: UnverifiableCode]
[module: RefSafetyRules(11)]
namespace Microsoft.CodeAnalysis
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	internal sealed class EmbeddedAttribute : Attribute
	{
	}
}
namespace System.Runtime.CompilerServices
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	[AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)]
	internal sealed class RefSafetyRulesAttribute : Attribute
	{
		public readonly int Version;

		public RefSafetyRulesAttribute(int P_0)
		{
			Version = P_0;
		}
	}
}
namespace NodeBane
{
	[BepInPlugin("orochiumbra.inscryption.nodebane", "NodeBane", "1.0.0")]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	public class NodeBane : BaseUnityPlugin
	{
		public static class DisableDecals
		{
			public static AscensionChallenge Id { get; private set; }

			public static void Register()
			{
				//IL_0036: Unknown result type (might be due to invalid IL or missing references)
				Id = ChallengeManager.Add("orochiumbra.inscryption.nodebane", StringExtensions.SplitPascalCase("DisableDecals"), "Remove Extra Decals for Cards affected by Node Bane.", 0, Asset.LoadTexture("NoDecal_Challenge"), Asset.LoadTexture("NoDecal_Active_Challenge"), 0, false).Challenge.challengeType;
			}
		}

		public static class DisableNodeBane
		{
			public static AscensionChallenge Id { get; private set; }

			public static void Register()
			{
				//IL_003a: Unknown result type (might be due to invalid IL or missing references)
				//IL_0040: Expected I4, but got Unknown
				//IL_0042: Unknown result type (might be due to invalid IL or missing references)
				//IL_0048: Expected I4, but got Unknown
				//IL_004a: Unknown result type (might be due to invalid IL or missing references)
				//IL_0050: Expected I4, but got Unknown
				//IL_005a: Unknown result type (might be due to invalid IL or missing references)
				Id = ChallengeManager.Add("orochiumbra.inscryption.nodebane", StringExtensions.SplitPascalCase("DisableNodeBane"), "Remove restrictions on Campfire, Mycologists, Copy Card nodes.", -10, Asset.LoadTexture("NoBane_Challenge"), Asset.LoadTexture("NoBane_Active_Challenge"), 0, false).SetIncompatibleChallengeGetterStatic((AscensionChallenge[])(object)new AscensionChallenge[3]
				{
					(AscensionChallenge)(int)DisableDecals.Id,
					(AscensionChallenge)(int)StrictMerge.Id,
					(AscensionChallenge)(int)TrueBane.Id
				}).Challenge.challengeType;
			}
		}

		public static class StrictMerge
		{
			public static AscensionChallenge Id { get; private set; }

			public static void Register()
			{
				//IL_003a: Unknown result type (might be due to invalid IL or missing references)
				//IL_0040: Expected I4, but got Unknown
				//IL_004a: Unknown result type (might be due to invalid IL or missing references)
				Id = ChallengeManager.Add("orochiumbra.inscryption.nodebane", StringExtensions.SplitPascalCase("StrictMerge"), "Modified cards will not be allowed to be modified again after Mycologists nodes.", 10, Asset.LoadTexture("StrictMerge_Challenge"), Asset.LoadTexture("StrictMerge_Active_Challenge"), 0, false).SetIncompatibleChallengeGetterStatic((AscensionChallenge[])(object)new AscensionChallenge[1] { (AscensionChallenge)(int)TrueBane.Id }).Challenge.challengeType;
			}
		}

		public static class TrueBane
		{
			public static AscensionChallenge Id { get; private set; }

			public static void Register()
			{
				//IL_0037: Unknown result type (might be due to invalid IL or missing references)
				Id = ChallengeManager.Add("orochiumbra.inscryption.nodebane", StringExtensions.SplitPascalCase("TrueBane"), "A card can only ever enter one of the Campfire, Mycologists, Copy Card nodes.", 20, Asset.LoadTexture("TrueBane_Challenge"), Asset.LoadTexture("TrueBane_Active_Challenge"), 0, false).Challenge.challengeType;
			}
		}

		public class NodeBaneConfigManager
		{
			private static NodeBaneConfigManager nodebane_Instance;

			private readonly ConfigFile NodeBaneConfigFile = new ConfigFile(Path.Combine(Paths.ConfigPath, "orochiumbra.inscryption.nodebane.cfg"), true);

			private ConfigEntry<bool> Config_ExtraDecals;

			private ConfigEntry<bool> Config_ModEnabled;

			private ConfigEntry<bool> Config_StrictMerge;

			private ConfigEntry<bool> Config_TrueBane;

			public static NodeBaneConfigManager Instance => nodebane_Instance ?? (nodebane_Instance = new NodeBaneConfigManager());

			public bool ExtraDecals => Config_ExtraDecals.Value;

			public bool ModEnabled => Config_ModEnabled.Value;

			public bool StrictMyco => Config_StrictMerge.Value;

			public bool TrueBane => Config_TrueBane.Value;

			internal void BindConfig()
			{
				//IL_001e: Unknown result type (might be due to invalid IL or missing references)
				//IL_0028: Expected O, but got Unknown
				//IL_004a: Unknown result type (might be due to invalid IL or missing references)
				//IL_0054: Expected O, but got Unknown
				//IL_0076: Unknown result type (might be due to invalid IL or missing references)
				//IL_0080: Expected O, but got Unknown
				//IL_00a2: Unknown result type (might be due to invalid IL or missing references)
				//IL_00ac: Expected O, but got Unknown
				Config_ExtraDecals = NodeBaneConfigFile.Bind<bool>("Config", "Decals", true, new ConfigDescription("PART 1 ONLY - Enable Extra Decals for Cards affected by Node Bane.", (AcceptableValueBase)null, Array.Empty<object>()));
				Config_ModEnabled = NodeBaneConfigFile.Bind<bool>("Config", "Active", true, new ConfigDescription("PART 1 ONLY - Enables Node Bane.", (AcceptableValueBase)null, Array.Empty<object>()));
				Config_StrictMerge = NodeBaneConfigFile.Bind<bool>("Config", "Strict", false, new ConfigDescription("PART 1 ONLY - Modified cards will not be allowed to be modified again after Mycologists nodes.", (AcceptableValueBase)null, Array.Empty<object>()));
				Config_TrueBane = NodeBaneConfigFile.Bind<bool>("Config", "Hard", false, new ConfigDescription("PART 1 ONLY - A card can only ever enter one of the Campfire, Mycologists, Copy Card nodes.", (AcceptableValueBase)null, Array.Empty<object>()));
			}
		}

		private const string PluginGuid = "orochiumbra.inscryption.nodebane";

		private const string PluginName = "NodeBane";

		private const string PluginVersion = "1.0.0";

		internal static ManualLogSource Log;

		private Harmony harmony = new Harmony("orochiumbra.inscryption.nodebane");

		public const string FlameModId = "NodeBane_Flame";

		public const string MergeModId = "NodeBane_Merge";

		public const string PaintModId = "NodeBane_Paint";

		public static bool Decals => SaveFile.IsAscension ? (!AscensionSaveData.Data.ChallengeIsActive(DisableDecals.Id)) : NodeBaneConfigManager.Instance.ExtraDecals;

		public static bool Active => SaveFile.IsAscension ? (!AscensionSaveData.Data.ChallengeIsActive(DisableNodeBane.Id)) : NodeBaneConfigManager.Instance.ModEnabled;

		public static bool Strict => SaveFile.IsAscension ? AscensionSaveData.Data.ChallengeIsActive(StrictMerge.Id) : NodeBaneConfigManager.Instance.StrictMyco;

		public static bool Hard => SaveFile.IsAscension ? AscensionSaveData.Data.ChallengeIsActive(TrueBane.Id) : NodeBaneConfigManager.Instance.TrueBane;

		private void Awake()
		{
			Log = ((BaseUnityPlugin)this).Logger;
			harmony.PatchAll(typeof(NodeBane));
			NodeBaneConfigManager.Instance.BindConfig();
			DisableDecals.Register();
			TrueBane.Register();
			StrictMerge.Register();
			DisableNodeBane.Register();
		}

		[HarmonyPatch(typeof(CardStatBoostSequencer), "ApplyModToCard")]
		[HarmonyPrefix]
		public static bool MarkFlameCardsPatch(CardInfo card)
		{
			//IL_0013: Unknown result type (might be due to invalid IL or missing references)
			//IL_0035: Unknown result type (might be due to invalid IL or missing references)
			//IL_003a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0046: Expected O, but got Unknown
			//IL_00c1: Unknown result type (might be due to invalid IL or missing references)
			if (!Active)
			{
				Singleton<ChallengeActivationUI>.Instance.ShowActivation(DisableNodeBane.Id);
				return true;
			}
			if (CardExtensions.LacksTrait(card, (Trait)19))
			{
				CardModificationInfo val = new CardModificationInfo
				{
					singletonId = "NodeBane_Flame"
				};
				if (Decals && !card.Mods.Exists((CardModificationInfo x) => x.DecalIds.Exists((string y) => y.Contains("decal_smoke_abilityhole"))))
				{
					val.DecalIds.Add("decal_smoke_abilityhole");
				}
				if (!card.HasFlameMod())
				{
					card.Mods.Add(val);
					if (Hard)
					{
						Singleton<ChallengeActivationUI>.Instance.ShowActivation(TrueBane.Id);
					}
				}
			}
			return true;
		}

		[HarmonyPatch(typeof(CardStatBoostSequencer), "GetValidCards")]
		[HarmonyPostfix]
		public static List<CardInfo> GetFlameCardsPatch(List<CardInfo> __result)
		{
			if (Active)
			{
				__result.RemoveAll((CardInfo x) => x.HasFlameMod());
			}
			return __result;
		}

		[HarmonyPatch(typeof(DuplicateMergeSequencer), "MergeCards")]
		[HarmonyPostfix]
		public static void MarkMergeCardsPatch(CardInfo card1, CardInfo card2, ref CardInfo __result)
		{
			//IL_0020: 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_00ae: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c3: Expected O, but got Unknown
			//IL_00d4: Unknown result type (might be due to invalid IL or missing references)
			if (!Active)
			{
				Singleton<ChallengeActivationUI>.Instance.ShowActivation(DisableNodeBane.Id);
				return;
			}
			if (Strict)
			{
				Singleton<ChallengeActivationUI>.Instance.ShowActivation(StrictMerge.Id);
				__result.Mods.AddRange((from mod in card2.Mods
					where mod.singletonId != null && mod.singletonId.StartsWith("NodeBane_")
					where !card1.Mods.Any((CardModificationInfo card1Mod) => card1Mod.singletonId == mod.singletonId)
					select mod).ToList());
			}
			if (!__result.HasMergeMod())
			{
				__result.Mods.Add(new CardModificationInfo
				{
					singletonId = "NodeBane_Merge"
				});
				if (Hard)
				{
					Singleton<ChallengeActivationUI>.Instance.ShowActivation(TrueBane.Id);
				}
			}
		}

		[HarmonyPatch(typeof(DuplicateMergeSequencer), "GetValidDuplicateCards")]
		[HarmonyPostfix]
		public static void GetMergeCardsPatch(ref List<CardInfo> __result)
		{
			if (!Active)
			{
				return;
			}
			List<CardInfo> list = RunState.DeckList.FindAll((CardInfo x) => !x.HasMergeMod());
			List<CardInfo> list2 = new List<CardInfo>();
			foreach (CardInfo card in list)
			{
				if (list.Count((CardInfo x) => ((Object)x).name == ((Object)card).name) > 1)
				{
					list2.Add(card);
				}
			}
			__result = list2;
		}

		[HarmonyPatch(typeof(CopyCardSequencer), "CreateCloneCard")]
		[HarmonyPostfix]
		public static void MarkPaintCardsPatch(ref CardInfo __result, CardInfo cardToCopy)
		{
			//IL_0023: Unknown result type (might be due to invalid IL or missing references)
			//IL_0028: Unknown result type (might be due to invalid IL or missing references)
			//IL_0034: Expected O, but got Unknown
			//IL_0013: 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)
			if (!Active)
			{
				Singleton<ChallengeActivationUI>.Instance.ShowActivation(DisableNodeBane.Id);
				return;
			}
			CardModificationInfo val = new CardModificationInfo
			{
				singletonId = "NodeBane_Paint"
			};
			if (!__result.HasPaintMod())
			{
				__result.Mods.Add(val);
				if (Hard)
				{
					Singleton<ChallengeActivationUI>.Instance.ShowActivation(TrueBane.Id);
				}
			}
			if (Decals && !cardToCopy.Mods.Exists((CardModificationInfo x) => x.DecalIds.Exists((string y) => y.StartsWith("decal_blood_"))))
			{
				val.DecalIds.Add(AlternatingBloodDecal.GetBloodDecalId());
			}
			if (!cardToCopy.HasPaintMod())
			{
				cardToCopy.Mods.Add(val);
			}
		}

		[HarmonyPatch(typeof(CopyCardSequencer), "GetValidCards")]
		[HarmonyPostfix]
		public static List<CardInfo> GetPaintCardsPatch(List<CardInfo> __result)
		{
			if (Active)
			{
				__result.RemoveAll((CardInfo x) => x.HasPaintMod());
			}
			return __result;
		}
	}
	internal class Asset
	{
		private static Assembly _assembly;

		public static Assembly CurrentAssembly => _assembly ?? (_assembly = Assembly.GetExecutingAssembly());

		public static Texture2D LoadTexture(string name)
		{
			return TextureHelper.GetImageAsTexture((name + (name.EndsWith(".png") ? "" : ".png")).ToLowerInvariant(), CurrentAssembly, (FilterMode)0);
		}

		public static Sprite LoadSprite(string name)
		{
			return TextureHelper.ConvertTexture(TextureHelper.GetImageAsTexture((name + (name.EndsWith(".png") ? "" : ".png")).ToLowerInvariant(), CurrentAssembly, (FilterMode)0), (Vector2?)null);
		}
	}
	public static class NodeBaneSingletonManager
	{
		public static bool HasFlameMod(this CardInfo card)
		{
			return ((card == null) ? null : card.Mods?.Any((CardModificationInfo mod) => (!NodeBane.Hard) ? (mod?.singletonId == "NodeBane_Flame") : (mod != null && mod.singletonId?.StartsWith("NodeBane_") == true))).GetValueOrDefault();
		}

		public static bool HasMergeMod(this CardInfo card)
		{
			return ((card == null) ? null : card.Mods?.Any((CardModificationInfo mod) => (!NodeBane.Hard) ? (mod?.singletonId == "NodeBane_Merge") : (mod != null && mod.singletonId?.StartsWith("NodeBane_") == true))).GetValueOrDefault();
		}

		public static bool HasPaintMod(this CardInfo card)
		{
			return ((card == null) ? null : card.Mods?.Any((CardModificationInfo mod) => (!NodeBane.Hard) ? (mod?.singletonId == "NodeBane_Paint") : (mod != null && mod.singletonId?.StartsWith("NodeBane_") == true))).GetValueOrDefault();
		}

		public static string UpdateSingletonId(CardInfo card, string modToAdd)
		{
			string text = card.Mods.Find((CardModificationInfo x) => x.singletonId.StartsWith("NodeBane"))?.singletonId ?? "NodeBane";
			if (!text.Contains(modToAdd))
			{
				text = text + "_" + modToAdd;
			}
			return text;
		}
	}
	public static class PluginInfo
	{
		public const string PLUGIN_GUID = "NodeBane";

		public const string PLUGIN_NAME = "NodeBane";

		public const string PLUGIN_VERSION = "1.0.0";
	}
}

plugins/ProfessorEggnog-Inscryption_Repainted_Project/more_portrait_replacements.dll

Decompiled 5 months ago
using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.Globalization;
using System.IO;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using B83.Image.BMP;
using BepInEx;
using BepInEx.Logging;
using DiskCardGame;
using Dummiesman;
using Dummiesman.Extensions;
using HarmonyLib;
using UnityEngine;
using UnityEngine.Rendering;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: TargetFramework(".NETStandard,Version=v2.0", FrameworkDisplayName = "")]
[assembly: AssemblyCompany("more_portrait_replacements")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyDescription("Adds the ability to replace more alternate portraits.")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("more_portrait_replacements")]
[assembly: AssemblyTitle("more_portrait_replacements")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.0.0")]
[module: UnverifiableCode]
public class MTLLoader
{
	public List<string> SearchPaths = new List<string>
	{
		"%FileName%_Textures",
		string.Empty
	};

	private FileInfo _objFileInfo = null;

	public virtual Texture2D TextureLoadFunction(string path, bool isNormalMap)
	{
		foreach (string searchPath in SearchPaths)
		{
			string path2 = ((_objFileInfo != null) ? searchPath.Replace("%FileName%", Path.GetFileNameWithoutExtension(_objFileInfo.Name)) : searchPath);
			string text = Path.Combine(path2, path);
			if (File.Exists(text))
			{
				Texture2D val = ImageLoader.LoadTexture(text);
				if (isNormalMap)
				{
					val = ImageUtils.ConvertToNormalMap(val);
				}
				return val;
			}
		}
		return null;
	}

	private Texture2D TryLoadTexture(string texturePath, bool normalMap = false)
	{
		texturePath = texturePath.Replace('\\', Path.DirectorySeparatorChar);
		texturePath = texturePath.Replace('/', Path.DirectorySeparatorChar);
		return TextureLoadFunction(texturePath, normalMap);
	}

	private int GetArgValueCount(string arg)
	{
		switch (arg)
		{
		case "-bm":
		case "-clamp":
		case "-blendu":
		case "-blendv":
		case "-imfchan":
		case "-texres":
			return 1;
		case "-mm":
			return 2;
		case "-o":
		case "-s":
		case "-t":
			return 3;
		default:
			return -1;
		}
	}

	private int GetTexNameIndex(string[] components)
	{
		int num;
		for (num = 1; num < components.Length; num++)
		{
			int argValueCount = GetArgValueCount(components[num]);
			if (argValueCount < 0)
			{
				return num;
			}
			num += argValueCount;
		}
		return -1;
	}

	private float GetArgValue(string[] components, string arg, float fallback = 1f)
	{
		string text = arg.ToLower();
		for (int i = 1; i < components.Length - 1; i++)
		{
			string text2 = components[i].ToLower();
			if (text == text2)
			{
				return OBJLoaderHelper.FastFloatParse(components[i + 1]);
			}
		}
		return fallback;
	}

	private string GetTexPathFromMapStatement(string processedLine, string[] splitLine)
	{
		int texNameIndex = GetTexNameIndex(splitLine);
		if (texNameIndex < 0)
		{
			Debug.LogError((object)("texNameCmpIdx < 0 on line " + processedLine + ". Texture not loaded."));
			return null;
		}
		int startIndex = processedLine.IndexOf(splitLine[texNameIndex]);
		return processedLine.Substring(startIndex);
	}

	public Dictionary<string, Material> Load(Stream input)
	{
		//IL_00a3: Unknown result type (might be due to invalid IL or missing references)
		//IL_00a8: Unknown result type (might be due to invalid IL or missing references)
		//IL_00b3: Expected O, but got Unknown
		//IL_0106: 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_0114: Unknown result type (might be due to invalid IL or missing references)
		//IL_0119: Unknown result type (might be due to invalid IL or missing references)
		//IL_0121: Unknown result type (might be due to invalid IL or missing references)
		//IL_0128: Unknown result type (might be due to invalid IL or missing references)
		//IL_012f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0136: Unknown result type (might be due to invalid IL or missing references)
		//IL_013d: Unknown result type (might be due to invalid IL or missing references)
		//IL_01ba: Unknown result type (might be due to invalid IL or missing references)
		//IL_01c1: Invalid comparison between Unknown and I4
		//IL_01c5: Unknown result type (might be due to invalid IL or missing references)
		//IL_01cb: Invalid comparison between Unknown and I4
		//IL_020a: Unknown result type (might be due to invalid IL or missing references)
		//IL_02f1: Unknown result type (might be due to invalid IL or missing references)
		//IL_0336: Unknown result type (might be due to invalid IL or missing references)
		//IL_041e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0423: Unknown result type (might be due to invalid IL or missing references)
		//IL_0434: Unknown result type (might be due to invalid IL or missing references)
		StreamReader streamReader = new StreamReader(input);
		StringReader stringReader = new StringReader(streamReader.ReadToEnd());
		Dictionary<string, Material> dictionary = new Dictionary<string, Material>();
		Material val = null;
		for (string text = stringReader.ReadLine(); text != null; text = stringReader.ReadLine())
		{
			if (!string.IsNullOrWhiteSpace(text))
			{
				string text2 = text.Clean();
				string[] array = text2.Split(new char[1] { ' ' });
				if (array.Length >= 2 && text2[0] != '#')
				{
					if (array[0] == "newmtl")
					{
						string text3 = text2.Substring(7);
						Material val3 = (dictionary[text3] = new Material(Shader.Find("Standard (Specular setup)"))
						{
							name = text3
						});
						val = val3;
					}
					else if (!((Object)(object)val == (Object)null))
					{
						if (array[0] == "Kd" || array[0] == "kd")
						{
							Color color = val.GetColor("_Color");
							Color val4 = OBJLoaderHelper.ColorFromStrArray(array);
							val.SetColor("_Color", new Color(val4.r, val4.g, val4.b, color.a));
						}
						else if (array[0] == "map_Kd" || array[0] == "map_kd")
						{
							string texPathFromMapStatement = GetTexPathFromMapStatement(text2, array);
							if (texPathFromMapStatement != null)
							{
								Texture2D val5 = TryLoadTexture(texPathFromMapStatement);
								val.SetTexture("_MainTex", (Texture)(object)val5);
								if ((Object)(object)val5 != (Object)null && ((int)val5.format == 12 || (int)val5.format == 5))
								{
									OBJLoaderHelper.EnableMaterialTransparency(val);
								}
								if (Path.GetExtension(texPathFromMapStatement).ToLower() == ".dds")
								{
									val.mainTextureScale = new Vector2(1f, -1f);
								}
							}
						}
						else if (array[0] == "map_Bump" || array[0] == "map_bump")
						{
							string texPathFromMapStatement2 = GetTexPathFromMapStatement(text2, array);
							if (texPathFromMapStatement2 != null)
							{
								Texture2D val6 = TryLoadTexture(texPathFromMapStatement2, normalMap: true);
								float argValue = GetArgValue(array, "-bm");
								if ((Object)(object)val6 != (Object)null)
								{
									val.SetTexture("_BumpMap", (Texture)(object)val6);
									val.SetFloat("_BumpScale", argValue);
									val.EnableKeyword("_NORMALMAP");
								}
							}
						}
						else if (array[0] == "Ks" || array[0] == "ks")
						{
							val.SetColor("_SpecColor", OBJLoaderHelper.ColorFromStrArray(array));
						}
						else if (array[0] == "Ka" || array[0] == "ka")
						{
							val.SetColor("_EmissionColor", OBJLoaderHelper.ColorFromStrArray(array, 0.05f));
							val.EnableKeyword("_EMISSION");
						}
						else if (array[0] == "map_Ka" || array[0] == "map_ka")
						{
							string texPathFromMapStatement3 = GetTexPathFromMapStatement(text2, array);
							if (texPathFromMapStatement3 != null)
							{
								val.SetTexture("_EmissionMap", (Texture)(object)TryLoadTexture(texPathFromMapStatement3));
							}
						}
						else if (array[0] == "d" || array[0] == "Tr")
						{
							float num = OBJLoaderHelper.FastFloatParse(array[1]);
							if (array[0] == "Tr")
							{
								num = 1f - num;
							}
							if (num < 1f - Mathf.Epsilon)
							{
								Color color2 = val.GetColor("_Color");
								color2.a = num;
								val.SetColor("_Color", color2);
								OBJLoaderHelper.EnableMaterialTransparency(val);
							}
						}
						else if (array[0] == "Ns" || array[0] == "ns")
						{
							float num2 = OBJLoaderHelper.FastFloatParse(array[1]);
							num2 /= 1000f;
							val.SetFloat("_Glossiness", num2);
						}
					}
				}
			}
		}
		return dictionary;
	}

	public Dictionary<string, Material> Load(string path)
	{
		_objFileInfo = new FileInfo(path);
		SearchPaths.Add(_objFileInfo.Directory.FullName);
		using FileStream input = new FileStream(path, FileMode.Open);
		return Load(input);
	}
}
namespace more_portrait_replacements
{
	public static class PluginInfo
	{
		public const string PLUGIN_GUID = "more_portrait_replacements";

		public const string PLUGIN_NAME = "more_portrait_replacements";

		public const string PLUGIN_VERSION = "1.0.0";
	}
}
namespace motribes
{
	[BepInPlugin("lily.inscryption.more_portrait_replacements", "More Portrait Replacements", "1.0.0")]
	public class Plugin : BaseUnityPlugin
	{
		internal static ManualLogSource Log;

		private const string PluginVersion = "1.0.0";

		public const string PluginGuid = "lily.inscryption.more_portrait_replacements";

		public const string PluginName = "More Portrait Replacements";

		public static string Directory;

		private void Awake()
		{
			//IL_0032: Unknown result type (might be due to invalid IL or missing references)
			//IL_0038: Expected O, but got Unknown
			((BaseUnityPlugin)this).Logger.LogInfo((object)"Loaded the More Portrait Replacements mod! - Made by Lily");
			Log = ((BaseUnityPlugin)this).Logger;
			Directory = ((BaseUnityPlugin)this).Info.Location;
			Harmony val = new Harmony("lily.inscryption.more_portrait_replacements");
			val.PatchAll();
		}

		public static Texture2D GetTexture(string path)
		{
			//IL_002a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0030: Expected O, but got Unknown
			if (path == null)
			{
				return null;
			}
			byte[] array = File.ReadAllBytes(Path.Combine(Path.GetDirectoryName(Directory), "Artwork/", path));
			Texture2D val = new Texture2D(2, 2);
			ImageConversion.LoadImage(val, array);
			((Texture)val).filterMode = (FilterMode)0;
			return val;
		}

		public static Sprite SpriteFromTexture(Texture2D tex)
		{
			//IL_0032: 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)
			Rect val = default(Rect);
			((Rect)(ref val))..ctor(0f, 0f, (float)((Texture)tex).width, (float)((Texture)tex).height);
			Vector2 val2 = default(Vector2);
			((Vector2)(ref val2))..ctor(0.5f, 0.5f);
			return Sprite.Create(tex, val, val2);
		}
	}
	[HarmonyPatch(typeof(AddSnelkDecals), "ApplyAppearance")]
	public class ChangeSnelkDecal
	{
		[HarmonyPrefix]
		public static bool Prefix(CardAppearanceBehaviour __instance)
		{
			if (__instance.Card is PlayableCard)
			{
				__instance.Card.Info.TempDecals.Clear();
				__instance.Card.Info.TempDecals.Add((Texture)(object)Plugin.GetTexture("snelk.png"));
				return false;
			}
			__instance.Card.Info.TempDecals.Clear();
			__instance.Card.Info.TempDecals.Add((Texture)(object)Plugin.GetTexture("snelk_in_deck.png"));
			return false;
		}
	}
	[HarmonyPatch(typeof(SteelTrap), "OnTakeDamage")]
	public class ChangeSteelTrapDecal
	{
		[HarmonyPrefix]
		public static bool Prefix(SteelTrap __instance, ref IEnumerator __result)
		{
			__result = SwitchPortrait(__instance);
			return false;
		}

		public static IEnumerator SwitchPortrait(SteelTrap Base)
		{
			yield return (object)new WaitForSeconds(0.65f);
			AudioController.Instance.PlaySound3D("sacrifice_default", (MixerGroup)4, ((Component)((AbilityBehaviour)Base).Card).transform.position, 1f, 0f, (Pitch)null, (Repetition)null, (Randomization)null, (Distortion)null, false);
			yield return (object)new WaitForSeconds(0.1f);
			((Card)((AbilityBehaviour)Base).Card).Anim.LightNegationEffect();
			((AbilityBehaviour)Base).Card.SwitchToPortrait(Plugin.SpriteFromTexture(Plugin.GetTexture("trap.png")));
			AudioController.Instance.PlaySound3D("dial_metal", (MixerGroup)4, ((Component)((AbilityBehaviour)Base).Card).transform.position, 1f, 0f, (Pitch)null, (Repetition)null, (Randomization)null, (Distortion)null, false);
			yield return (object)new WaitForSeconds(0.75f);
		}
	}
}
namespace B83.Image.BMP
{
	public enum BMPComressionMode
	{
		BI_RGB = 0,
		BI_RLE8 = 1,
		BI_RLE4 = 2,
		BI_BITFIELDS = 3,
		BI_JPEG = 4,
		BI_PNG = 5,
		BI_ALPHABITFIELDS = 6,
		BI_CMYK = 11,
		BI_CMYKRLE8 = 12,
		BI_CMYKRLE4 = 13
	}
	public struct BMPFileHeader
	{
		public ushort magic;

		public uint filesize;

		public uint reserved;

		public uint offset;
	}
	public struct BitmapInfoHeader
	{
		public uint size;

		public int width;

		public int height;

		public ushort nColorPlanes;

		public ushort nBitsPerPixel;

		public BMPComressionMode compressionMethod;

		public uint rawImageSize;

		public int xPPM;

		public int yPPM;

		public uint nPaletteColors;

		public uint nImportantColors;

		public int absWidth => Mathf.Abs(width);

		public int absHeight => Mathf.Abs(height);
	}
	public class BMPImage
	{
		public BMPFileHeader header;

		public BitmapInfoHeader info;

		public uint rMask = 16711680u;

		public uint gMask = 65280u;

		public uint bMask = 255u;

		public uint aMask = 0u;

		public List<Color32> palette;

		public Color32[] imageData;

		public Texture2D ToTexture2D()
		{
			//IL_0017: Unknown result type (might be due to invalid IL or missing references)
			//IL_001d: Expected O, but got Unknown
			Texture2D val = new Texture2D(info.absWidth, info.absHeight);
			val.SetPixels32(imageData);
			val.Apply();
			return val;
		}
	}
	public class BMPLoader
	{
		private const ushort MAGIC = 19778;

		public bool ReadPaletteAlpha = false;

		public bool ForceAlphaReadWhenPossible = false;

		public BMPImage LoadBMP(string aFileName)
		{
			using FileStream aData = File.OpenRead(aFileName);
			return LoadBMP(aData);
		}

		public BMPImage LoadBMP(byte[] aData)
		{
			using MemoryStream aData2 = new MemoryStream(aData);
			return LoadBMP(aData2);
		}

		public BMPImage LoadBMP(Stream aData)
		{
			using BinaryReader aReader = new BinaryReader(aData);
			return LoadBMP(aReader);
		}

		public BMPImage LoadBMP(BinaryReader aReader)
		{
			BMPImage bMPImage = new BMPImage();
			if (!ReadFileHeader(aReader, ref bMPImage.header))
			{
				Debug.LogError((object)"Not a BMP file");
				return null;
			}
			if (!ReadInfoHeader(aReader, ref bMPImage.info))
			{
				Debug.LogError((object)"Unsupported header format");
				return null;
			}
			if (bMPImage.info.compressionMethod != 0 && bMPImage.info.compressionMethod != BMPComressionMode.BI_BITFIELDS && bMPImage.info.compressionMethod != BMPComressionMode.BI_ALPHABITFIELDS && bMPImage.info.compressionMethod != BMPComressionMode.BI_RLE4 && bMPImage.info.compressionMethod != BMPComressionMode.BI_RLE8)
			{
				Debug.LogError((object)("Unsupported image format: " + bMPImage.info.compressionMethod));
				return null;
			}
			long offset = 14 + bMPImage.info.size;
			aReader.BaseStream.Seek(offset, SeekOrigin.Begin);
			if (bMPImage.info.nBitsPerPixel < 24)
			{
				bMPImage.rMask = 31744u;
				bMPImage.gMask = 992u;
				bMPImage.bMask = 31u;
			}
			if (bMPImage.info.compressionMethod == BMPComressionMode.BI_BITFIELDS || bMPImage.info.compressionMethod == BMPComressionMode.BI_ALPHABITFIELDS)
			{
				bMPImage.rMask = aReader.ReadUInt32();
				bMPImage.gMask = aReader.ReadUInt32();
				bMPImage.bMask = aReader.ReadUInt32();
			}
			if (ForceAlphaReadWhenPossible)
			{
				bMPImage.aMask = GetMask(bMPImage.info.nBitsPerPixel) ^ (bMPImage.rMask | bMPImage.gMask | bMPImage.bMask);
			}
			if (bMPImage.info.compressionMethod == BMPComressionMode.BI_ALPHABITFIELDS)
			{
				bMPImage.aMask = aReader.ReadUInt32();
			}
			if (bMPImage.info.nPaletteColors != 0 || bMPImage.info.nBitsPerPixel <= 8)
			{
				bMPImage.palette = ReadPalette(aReader, bMPImage, ReadPaletteAlpha || ForceAlphaReadWhenPossible);
			}
			aReader.BaseStream.Seek(bMPImage.header.offset, SeekOrigin.Begin);
			bool flag = bMPImage.info.compressionMethod == BMPComressionMode.BI_RGB || bMPImage.info.compressionMethod == BMPComressionMode.BI_BITFIELDS || bMPImage.info.compressionMethod == BMPComressionMode.BI_ALPHABITFIELDS;
			if (bMPImage.info.nBitsPerPixel == 32 && flag)
			{
				Read32BitImage(aReader, bMPImage);
			}
			else if (bMPImage.info.nBitsPerPixel == 24 && flag)
			{
				Read24BitImage(aReader, bMPImage);
			}
			else if (bMPImage.info.nBitsPerPixel == 16 && flag)
			{
				Read16BitImage(aReader, bMPImage);
			}
			else if (bMPImage.info.compressionMethod == BMPComressionMode.BI_RLE4 && bMPImage.info.nBitsPerPixel == 4 && bMPImage.palette != null)
			{
				ReadIndexedImageRLE4(aReader, bMPImage);
			}
			else if (bMPImage.info.compressionMethod == BMPComressionMode.BI_RLE8 && bMPImage.info.nBitsPerPixel == 8 && bMPImage.palette != null)
			{
				ReadIndexedImageRLE8(aReader, bMPImage);
			}
			else
			{
				if (!flag || bMPImage.info.nBitsPerPixel > 8 || bMPImage.palette == null)
				{
					Debug.LogError((object)("Unsupported file format: " + bMPImage.info.compressionMethod.ToString() + " BPP: " + bMPImage.info.nBitsPerPixel));
					return null;
				}
				ReadIndexedImage(aReader, bMPImage);
			}
			return bMPImage;
		}

		private static void Read32BitImage(BinaryReader aReader, BMPImage bmp)
		{
			//IL_0116: Unknown result type (might be due to invalid IL or missing references)
			//IL_011b: Unknown result type (might be due to invalid IL or missing references)
			int num = Mathf.Abs(bmp.info.width);
			int num2 = Mathf.Abs(bmp.info.height);
			Color32[] array = (bmp.imageData = (Color32[])(object)new Color32[num * num2]);
			if (aReader.BaseStream.Position + num * num2 * 4 > aReader.BaseStream.Length)
			{
				Debug.LogError((object)"Unexpected end of file.");
				return;
			}
			int shiftCount = GetShiftCount(bmp.rMask);
			int shiftCount2 = GetShiftCount(bmp.gMask);
			int shiftCount3 = GetShiftCount(bmp.bMask);
			int shiftCount4 = GetShiftCount(bmp.aMask);
			byte b = byte.MaxValue;
			for (int i = 0; i < array.Length; i++)
			{
				uint num3 = aReader.ReadUInt32();
				byte b2 = (byte)((num3 & bmp.rMask) >> shiftCount);
				byte b3 = (byte)((num3 & bmp.gMask) >> shiftCount2);
				byte b4 = (byte)((num3 & bmp.bMask) >> shiftCount3);
				if (bmp.bMask != 0)
				{
					b = (byte)((num3 & bmp.aMask) >> shiftCount4);
				}
				array[i] = new Color32(b2, b3, b4, b);
			}
		}

		private static void Read24BitImage(BinaryReader aReader, BMPImage bmp)
		{
			//IL_016c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0171: Unknown result type (might be due to invalid IL or missing references)
			int num = Mathf.Abs(bmp.info.width);
			int num2 = Mathf.Abs(bmp.info.height);
			int num3 = (24 * num + 31) / 32 * 4;
			int num4 = num3 * num2;
			int num5 = num3 - num * 3;
			Color32[] array = (bmp.imageData = (Color32[])(object)new Color32[num * num2]);
			if (aReader.BaseStream.Position + num4 > aReader.BaseStream.Length)
			{
				Debug.LogError((object)("Unexpected end of file. (Have " + (aReader.BaseStream.Position + num4) + " bytes, expected " + aReader.BaseStream.Length + " bytes)"));
				return;
			}
			int shiftCount = GetShiftCount(bmp.rMask);
			int shiftCount2 = GetShiftCount(bmp.gMask);
			int shiftCount3 = GetShiftCount(bmp.bMask);
			for (int i = 0; i < num2; i++)
			{
				for (int j = 0; j < num; j++)
				{
					uint num6 = (uint)(aReader.ReadByte() | (aReader.ReadByte() << 8) | (aReader.ReadByte() << 16));
					byte b = (byte)((num6 & bmp.rMask) >> shiftCount);
					byte b2 = (byte)((num6 & bmp.gMask) >> shiftCount2);
					byte b3 = (byte)((num6 & bmp.bMask) >> shiftCount3);
					array[j + i * num] = new Color32(b, b2, b3, byte.MaxValue);
				}
				for (int k = 0; k < num5; k++)
				{
					aReader.ReadByte();
				}
			}
		}

		private static void Read16BitImage(BinaryReader aReader, BMPImage bmp)
		{
			//IL_0197: Unknown result type (might be due to invalid IL or missing references)
			//IL_019c: Unknown result type (might be due to invalid IL or missing references)
			int num = Mathf.Abs(bmp.info.width);
			int num2 = Mathf.Abs(bmp.info.height);
			int num3 = (16 * num + 31) / 32 * 4;
			int num4 = num3 * num2;
			int num5 = num3 - num * 2;
			Color32[] array = (bmp.imageData = (Color32[])(object)new Color32[num * num2]);
			if (aReader.BaseStream.Position + num4 > aReader.BaseStream.Length)
			{
				Debug.LogError((object)("Unexpected end of file. (Have " + (aReader.BaseStream.Position + num4) + " bytes, expected " + aReader.BaseStream.Length + " bytes)"));
				return;
			}
			int shiftCount = GetShiftCount(bmp.rMask);
			int shiftCount2 = GetShiftCount(bmp.gMask);
			int shiftCount3 = GetShiftCount(bmp.bMask);
			int shiftCount4 = GetShiftCount(bmp.aMask);
			byte b = byte.MaxValue;
			for (int i = 0; i < num2; i++)
			{
				for (int j = 0; j < num; j++)
				{
					uint num6 = (uint)(aReader.ReadByte() | (aReader.ReadByte() << 8));
					byte b2 = (byte)((num6 & bmp.rMask) >> shiftCount);
					byte b3 = (byte)((num6 & bmp.gMask) >> shiftCount2);
					byte b4 = (byte)((num6 & bmp.bMask) >> shiftCount3);
					if (bmp.aMask != 0)
					{
						b = (byte)((num6 & bmp.aMask) >> shiftCount4);
					}
					array[j + i * num] = new Color32(b2, b3, b4, b);
				}
				for (int k = 0; k < num5; k++)
				{
					aReader.ReadByte();
				}
			}
		}

		private static void ReadIndexedImage(BinaryReader aReader, BMPImage bmp)
		{
			//IL_013c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0141: Unknown result type (might be due to invalid IL or missing references)
			int num = Mathf.Abs(bmp.info.width);
			int num2 = Mathf.Abs(bmp.info.height);
			int nBitsPerPixel = bmp.info.nBitsPerPixel;
			int num3 = (nBitsPerPixel * num + 31) / 32 * 4;
			int num4 = num3 * num2;
			int num5 = num3 - (num * nBitsPerPixel + 7) / 8;
			Color32[] array = (bmp.imageData = (Color32[])(object)new Color32[num * num2]);
			if (aReader.BaseStream.Position + num4 > aReader.BaseStream.Length)
			{
				Debug.LogError((object)("Unexpected end of file. (Have " + (aReader.BaseStream.Position + num4) + " bytes, expected " + aReader.BaseStream.Length + " bytes)"));
				return;
			}
			BitStreamReader bitStreamReader = new BitStreamReader(aReader);
			for (int i = 0; i < num2; i++)
			{
				for (int j = 0; j < num; j++)
				{
					int num6 = (int)bitStreamReader.ReadBits(nBitsPerPixel);
					if (num6 >= bmp.palette.Count)
					{
						Debug.LogError((object)"Indexed bitmap has indices greater than it's color palette");
						return;
					}
					array[j + i * num] = bmp.palette[num6];
				}
				bitStreamReader.Flush();
				for (int k = 0; k < num5; k++)
				{
					aReader.ReadByte();
				}
			}
		}

		private static void ReadIndexedImageRLE4(BinaryReader aReader, BMPImage bmp)
		{
			//IL_0083: Unknown result type (might be due to invalid IL or missing references)
			//IL_0088: Unknown result type (might be due to invalid IL or missing references)
			//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_00e1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e6: Unknown result type (might be due to invalid IL or missing references)
			//IL_0178: Unknown result type (might be due to invalid IL or missing references)
			//IL_017d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0196: Unknown result type (might be due to invalid IL or missing references)
			//IL_019b: Unknown result type (might be due to invalid IL or missing references)
			//IL_01da: Unknown result type (might be due to invalid IL or missing references)
			//IL_01df: Unknown result type (might be due to invalid IL or missing references)
			int num = Mathf.Abs(bmp.info.width);
			int num2 = Mathf.Abs(bmp.info.height);
			Color32[] array = (bmp.imageData = (Color32[])(object)new Color32[num * num2]);
			int num3 = 0;
			int num4 = 0;
			int num5 = 0;
			while (aReader.BaseStream.Position < aReader.BaseStream.Length - 1)
			{
				int num6 = aReader.ReadByte();
				byte b = aReader.ReadByte();
				if (num6 > 0)
				{
					for (int num7 = num6 / 2; num7 > 0; num7--)
					{
						array[num3++ + num5] = bmp.palette[(b >> 4) & 0xF];
						array[num3++ + num5] = bmp.palette[b & 0xF];
					}
					if ((num6 & 1) > 0)
					{
						array[num3++ + num5] = bmp.palette[(b >> 4) & 0xF];
					}
					continue;
				}
				switch (b)
				{
				case 0:
					num3 = 0;
					num4++;
					num5 = num4 * num;
					continue;
				case 1:
					return;
				case 2:
					num3 += aReader.ReadByte();
					num4 += aReader.ReadByte();
					num5 = num4 * num;
					continue;
				}
				for (int num8 = b / 2; num8 > 0; num8--)
				{
					byte b2 = aReader.ReadByte();
					array[num3++ + num5] = bmp.palette[(b2 >> 4) & 0xF];
					array[num3++ + num5] = bmp.palette[b2 & 0xF];
				}
				if ((b & 1) > 0)
				{
					array[num3++ + num5] = bmp.palette[(aReader.ReadByte() >> 4) & 0xF];
				}
				if ((((b - 1) / 2) & 1) == 0)
				{
					aReader.ReadByte();
				}
			}
		}

		private static void ReadIndexedImageRLE8(BinaryReader aReader, BMPImage bmp)
		{
			//IL_0079: Unknown result type (might be due to invalid IL or missing references)
			//IL_007e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0113: Unknown result type (might be due to invalid IL or missing references)
			//IL_0118: Unknown result type (might be due to invalid IL or missing references)
			int num = Mathf.Abs(bmp.info.width);
			int num2 = Mathf.Abs(bmp.info.height);
			Color32[] array = (bmp.imageData = (Color32[])(object)new Color32[num * num2]);
			int num3 = 0;
			int num4 = 0;
			int num5 = 0;
			while (aReader.BaseStream.Position < aReader.BaseStream.Length - 1)
			{
				int num6 = aReader.ReadByte();
				byte b = aReader.ReadByte();
				if (num6 > 0)
				{
					for (int num7 = num6; num7 > 0; num7--)
					{
						array[num3++ + num5] = bmp.palette[b];
					}
					continue;
				}
				switch (b)
				{
				case 0:
					num3 = 0;
					num4++;
					num5 = num4 * num;
					continue;
				case 1:
					return;
				case 2:
					num3 += aReader.ReadByte();
					num4 += aReader.ReadByte();
					num5 = num4 * num;
					continue;
				}
				for (int num8 = b; num8 > 0; num8--)
				{
					array[num3++ + num5] = bmp.palette[aReader.ReadByte()];
				}
				if ((b & 1) > 0)
				{
					aReader.ReadByte();
				}
			}
		}

		private static int GetShiftCount(uint mask)
		{
			for (int i = 0; i < 32; i++)
			{
				if ((mask & (true ? 1u : 0u)) != 0)
				{
					return i;
				}
				mask >>= 1;
			}
			return -1;
		}

		private static uint GetMask(int bitCount)
		{
			uint num = 0u;
			for (int i = 0; i < bitCount; i++)
			{
				num <<= 1;
				num |= 1u;
			}
			return num;
		}

		private static bool ReadFileHeader(BinaryReader aReader, ref BMPFileHeader aFileHeader)
		{
			aFileHeader.magic = aReader.ReadUInt16();
			if (aFileHeader.magic != 19778)
			{
				return false;
			}
			aFileHeader.filesize = aReader.ReadUInt32();
			aFileHeader.reserved = aReader.ReadUInt32();
			aFileHeader.offset = aReader.ReadUInt32();
			return true;
		}

		private static bool ReadInfoHeader(BinaryReader aReader, ref BitmapInfoHeader aHeader)
		{
			aHeader.size = aReader.ReadUInt32();
			if (aHeader.size < 40)
			{
				return false;
			}
			aHeader.width = aReader.ReadInt32();
			aHeader.height = aReader.ReadInt32();
			aHeader.nColorPlanes = aReader.ReadUInt16();
			aHeader.nBitsPerPixel = aReader.ReadUInt16();
			aHeader.compressionMethod = (BMPComressionMode)aReader.ReadInt32();
			aHeader.rawImageSize = aReader.ReadUInt32();
			aHeader.xPPM = aReader.ReadInt32();
			aHeader.yPPM = aReader.ReadInt32();
			aHeader.nPaletteColors = aReader.ReadUInt32();
			aHeader.nImportantColors = aReader.ReadUInt32();
			int num = (int)(aHeader.size - 40);
			if (num > 0)
			{
				aReader.ReadBytes(num);
			}
			return true;
		}

		public static List<Color32> ReadPalette(BinaryReader aReader, BMPImage aBmp, bool aReadAlpha)
		{
			//IL_006c: Unknown result type (might be due to invalid IL or missing references)
			uint num = aBmp.info.nPaletteColors;
			if (num == 0)
			{
				num = (uint)(1 << (int)aBmp.info.nBitsPerPixel);
			}
			List<Color32> list = new List<Color32>((int)num);
			for (int i = 0; i < num; i++)
			{
				byte b = aReader.ReadByte();
				byte b2 = aReader.ReadByte();
				byte b3 = aReader.ReadByte();
				byte b4 = aReader.ReadByte();
				if (!aReadAlpha)
				{
					b4 = byte.MaxValue;
				}
				list.Add(new Color32(b3, b2, b, b4));
			}
			return list;
		}
	}
	public class BitStreamReader
	{
		private BinaryReader m_Reader;

		private byte m_Data = 0;

		private int m_Bits = 0;

		public BitStreamReader(BinaryReader aReader)
		{
			m_Reader = aReader;
		}

		public BitStreamReader(Stream aStream)
			: this(new BinaryReader(aStream))
		{
		}

		public byte ReadBit()
		{
			if (m_Bits <= 0)
			{
				m_Data = m_Reader.ReadByte();
				m_Bits = 8;
			}
			return (byte)((uint)(m_Data >> --m_Bits) & 1u);
		}

		public ulong ReadBits(int aCount)
		{
			ulong num = 0uL;
			if (aCount <= 0 || aCount > 32)
			{
				throw new ArgumentOutOfRangeException("aCount", "aCount must be between 1 and 32 inclusive");
			}
			for (int num2 = aCount - 1; num2 >= 0; num2--)
			{
				num |= (ulong)ReadBit() << num2;
			}
			return num;
		}

		public void Flush()
		{
			m_Data = 0;
			m_Bits = 0;
		}
	}
}
namespace Dummiesman
{
	public class CharWordReader
	{
		public char[] word;

		public int wordSize;

		public bool endReached;

		private StreamReader reader;

		private int bufferSize;

		private char[] buffer;

		public char currentChar;

		private int currentPosition = 0;

		private int maxPosition = 0;

		public CharWordReader(StreamReader reader, int bufferSize)
		{
			this.reader = reader;
			this.bufferSize = bufferSize;
			buffer = new char[this.bufferSize];
			word = new char[this.bufferSize];
			MoveNext();
		}

		public void SkipWhitespaces()
		{
			while (char.IsWhiteSpace(currentChar))
			{
				MoveNext();
			}
		}

		public void SkipWhitespaces(out bool newLinePassed)
		{
			newLinePassed = false;
			while (char.IsWhiteSpace(currentChar))
			{
				if (currentChar == '\r' || currentChar == '\n')
				{
					newLinePassed = true;
				}
				MoveNext();
			}
		}

		public void SkipUntilNewLine()
		{
			while (currentChar != 0 && currentChar != '\n' && currentChar != '\r')
			{
				MoveNext();
			}
			SkipNewLineSymbols();
		}

		public void ReadUntilWhiteSpace()
		{
			wordSize = 0;
			while (currentChar != 0 && !char.IsWhiteSpace(currentChar))
			{
				word[wordSize] = currentChar;
				wordSize++;
				MoveNext();
			}
		}

		public void ReadUntilNewLine()
		{
			wordSize = 0;
			while (currentChar != 0 && currentChar != '\n' && currentChar != '\r')
			{
				word[wordSize] = currentChar;
				wordSize++;
				MoveNext();
			}
			SkipNewLineSymbols();
		}

		public bool Is(string other)
		{
			if (other.Length != wordSize)
			{
				return false;
			}
			for (int i = 0; i < wordSize; i++)
			{
				if (word[i] != other[i])
				{
					return false;
				}
			}
			return true;
		}

		public string GetString(int startIndex = 0)
		{
			if (startIndex >= wordSize - 1)
			{
				return string.Empty;
			}
			return new string(word, startIndex, wordSize - startIndex);
		}

		public Vector3 ReadVector()
		{
			//IL_0042: Unknown result type (might be due to invalid IL or missing references)
			//IL_0047: Unknown result type (might be due to invalid IL or missing references)
			//IL_004b: Unknown result type (might be due to invalid IL or missing references)
			SkipWhitespaces();
			float num = ReadFloat();
			SkipWhitespaces();
			float num2 = ReadFloat();
			SkipWhitespaces(out var newLinePassed);
			float num3 = 0f;
			if (!newLinePassed)
			{
				num3 = ReadFloat();
			}
			return new Vector3(num, num2, num3);
		}

		public int ReadInt()
		{
			int num = 0;
			bool flag = currentChar == '-';
			if (flag)
			{
				MoveNext();
			}
			while (currentChar >= '0' && currentChar <= '9')
			{
				int num2 = currentChar - 48;
				num = num * 10 + num2;
				MoveNext();
			}
			return flag ? (-num) : num;
		}

		public float ReadFloat()
		{
			bool flag = currentChar == '-';
			if (flag)
			{
				MoveNext();
			}
			float num = ReadInt();
			if (currentChar == '.' || currentChar == ',')
			{
				MoveNext();
				num += ReadFloatEnd();
				if (currentChar == 'e' || currentChar == 'E')
				{
					MoveNext();
					int num2 = ReadInt();
					num *= Mathf.Pow(10f, (float)num2);
				}
			}
			if (flag)
			{
				num = 0f - num;
			}
			return num;
		}

		private float ReadFloatEnd()
		{
			float num = 0f;
			float num2 = 0.1f;
			while (currentChar >= '0' && currentChar <= '9')
			{
				int num3 = currentChar - 48;
				num += (float)num3 * num2;
				num2 *= 0.1f;
				MoveNext();
			}
			return num;
		}

		private void SkipNewLineSymbols()
		{
			while (currentChar == '\n' || currentChar == '\r')
			{
				MoveNext();
			}
		}

		public void MoveNext()
		{
			currentPosition++;
			if (currentPosition >= maxPosition)
			{
				if (reader.EndOfStream)
				{
					currentChar = '\0';
					endReached = true;
					return;
				}
				currentPosition = 0;
				maxPosition = reader.Read(buffer, 0, bufferSize);
			}
			currentChar = buffer[currentPosition];
		}
	}
	public enum SplitMode
	{
		None,
		Object,
		Material
	}
	public class OBJLoader
	{
		public SplitMode SplitMode = SplitMode.Object;

		internal List<Vector3> Vertices = new List<Vector3>();

		internal List<Vector3> Normals = new List<Vector3>();

		internal List<Vector2> UVs = new List<Vector2>();

		internal Dictionary<string, Material> Materials;

		private FileInfo _objInfo;

		private void LoadMaterialLibrary(string mtlLibPath)
		{
			if (_objInfo != null && File.Exists(Path.Combine(_objInfo.Directory.FullName, mtlLibPath)))
			{
				Materials = new MTLLoader().Load(Path.Combine(_objInfo.Directory.FullName, mtlLibPath));
			}
			else if (File.Exists(mtlLibPath))
			{
				Materials = new MTLLoader().Load(mtlLibPath);
			}
		}

		public GameObject Load(Stream input)
		{
			//IL_03e5: Unknown result type (might be due to invalid IL or missing references)
			//IL_03ec: Expected O, but got Unknown
			//IL_0402: Unknown result type (might be due to invalid IL or missing references)
			//IL_0113: Unknown result type (might be due to invalid IL or missing references)
			//IL_013e: 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_016e: Unknown result type (might be due to invalid IL or missing references)
			StreamReader reader = new StreamReader(input);
			Dictionary<string, OBJObjectBuilder> builderDict = new Dictionary<string, OBJObjectBuilder>();
			OBJObjectBuilder currentBuilder = null;
			string material = "default";
			List<int> list = new List<int>();
			List<int> list2 = new List<int>();
			List<int> list3 = new List<int>();
			Action<string> action = delegate(string objectName)
			{
				if (!builderDict.TryGetValue(objectName, out currentBuilder))
				{
					currentBuilder = new OBJObjectBuilder(objectName, this);
					builderDict[objectName] = currentBuilder;
				}
			};
			action("default");
			CharWordReader charWordReader = new CharWordReader(reader, 4096);
			while (true)
			{
				charWordReader.SkipWhitespaces();
				if (charWordReader.endReached)
				{
					break;
				}
				charWordReader.ReadUntilWhiteSpace();
				if (charWordReader.Is("#"))
				{
					charWordReader.SkipUntilNewLine();
				}
				else if (Materials == null && charWordReader.Is("mtllib"))
				{
					charWordReader.SkipWhitespaces();
					charWordReader.ReadUntilNewLine();
					string @string = charWordReader.GetString();
					LoadMaterialLibrary(@string);
				}
				else if (charWordReader.Is("v"))
				{
					Vertices.Add(charWordReader.ReadVector());
				}
				else if (charWordReader.Is("vn"))
				{
					Normals.Add(charWordReader.ReadVector());
				}
				else if (charWordReader.Is("vt"))
				{
					UVs.Add(Vector2.op_Implicit(charWordReader.ReadVector()));
				}
				else if (charWordReader.Is("usemtl"))
				{
					charWordReader.SkipWhitespaces();
					charWordReader.ReadUntilNewLine();
					string string2 = charWordReader.GetString();
					material = string2;
					if (SplitMode == SplitMode.Material)
					{
						action(string2);
					}
				}
				else if ((charWordReader.Is("o") || charWordReader.Is("g")) && SplitMode == SplitMode.Object)
				{
					charWordReader.ReadUntilNewLine();
					string string3 = charWordReader.GetString(1);
					action(string3);
				}
				else if (charWordReader.Is("f"))
				{
					while (true)
					{
						charWordReader.SkipWhitespaces(out var newLinePassed);
						if (newLinePassed)
						{
							break;
						}
						int num = int.MinValue;
						int num2 = int.MinValue;
						int num3 = int.MinValue;
						num = charWordReader.ReadInt();
						if (charWordReader.currentChar == '/')
						{
							charWordReader.MoveNext();
							if (charWordReader.currentChar != '/')
							{
								num3 = charWordReader.ReadInt();
							}
							if (charWordReader.currentChar == '/')
							{
								charWordReader.MoveNext();
								num2 = charWordReader.ReadInt();
							}
						}
						if (num > int.MinValue)
						{
							if (num < 0)
							{
								num = Vertices.Count - num;
							}
							num--;
						}
						if (num2 > int.MinValue)
						{
							if (num2 < 0)
							{
								num2 = Normals.Count - num2;
							}
							num2--;
						}
						if (num3 > int.MinValue)
						{
							if (num3 < 0)
							{
								num3 = UVs.Count - num3;
							}
							num3--;
						}
						list.Add(num);
						list2.Add(num2);
						list3.Add(num3);
					}
					currentBuilder.PushFace(material, list, list2, list3);
					list.Clear();
					list2.Clear();
					list3.Clear();
				}
				else
				{
					charWordReader.SkipUntilNewLine();
				}
			}
			GameObject val = new GameObject((_objInfo != null) ? Path.GetFileNameWithoutExtension(_objInfo.Name) : "WavefrontObject");
			val.transform.localScale = new Vector3(-1f, 1f, 1f);
			foreach (KeyValuePair<string, OBJObjectBuilder> item in builderDict)
			{
				if (item.Value.PushedFaceCount != 0)
				{
					GameObject val2 = item.Value.Build();
					val2.transform.SetParent(val.transform, false);
				}
			}
			return val;
		}

		public GameObject Load(Stream input, Stream mtlInput)
		{
			MTLLoader mTLLoader = new MTLLoader();
			Materials = mTLLoader.Load(mtlInput);
			return Load(input);
		}

		public GameObject Load(string path, string mtlPath)
		{
			_objInfo = new FileInfo(path);
			if (!string.IsNullOrEmpty(mtlPath) && File.Exists(mtlPath))
			{
				MTLLoader mTLLoader = new MTLLoader();
				Materials = mTLLoader.Load(mtlPath);
				using FileStream input = new FileStream(path, FileMode.Open);
				return Load(input);
			}
			using FileStream input2 = new FileStream(path, FileMode.Open);
			return Load(input2);
		}

		public GameObject Load(string path)
		{
			return Load(path, null);
		}
	}
	public static class OBJLoaderHelper
	{
		public static void EnableMaterialTransparency(Material mtl)
		{
			mtl.SetFloat("_Mode", 3f);
			mtl.SetInt("_SrcBlend", 5);
			mtl.SetInt("_DstBlend", 10);
			mtl.SetInt("_ZWrite", 0);
			mtl.DisableKeyword("_ALPHATEST_ON");
			mtl.EnableKeyword("_ALPHABLEND_ON");
			mtl.DisableKeyword("_ALPHAPREMULTIPLY_ON");
			mtl.renderQueue = 3000;
		}

		public static float FastFloatParse(string input)
		{
			if (input.Contains("e") || input.Contains("E"))
			{
				return float.Parse(input, CultureInfo.InvariantCulture);
			}
			float num = 0f;
			int num2 = 0;
			int length = input.Length;
			if (length == 0)
			{
				return float.NaN;
			}
			char c = input[0];
			float num3 = 1f;
			if (c == '-')
			{
				num3 = -1f;
				num2++;
				if (num2 >= length)
				{
					return float.NaN;
				}
			}
			while (true)
			{
				if (num2 >= length)
				{
					return num3 * num;
				}
				c = input[num2++];
				if (c < '0' || c > '9')
				{
					break;
				}
				num = num * 10f + (float)(c - 48);
			}
			if (c != '.' && c != ',')
			{
				return float.NaN;
			}
			float num4 = 0.1f;
			while (num2 < length)
			{
				c = input[num2++];
				if (c < '0' || c > '9')
				{
					return float.NaN;
				}
				num += (float)(c - 48) * num4;
				num4 *= 0.1f;
			}
			return num3 * num;
		}

		public static int FastIntParse(string input)
		{
			int num = 0;
			bool flag = input[0] == '-';
			for (int i = (flag ? 1 : 0); i < input.Length; i++)
			{
				num = num * 10 + (input[i] - 48);
			}
			return flag ? (-num) : num;
		}

		public static Material CreateNullMaterial()
		{
			//IL_000b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0011: Expected O, but got Unknown
			return new Material(Shader.Find("Standard (Specular setup)"));
		}

		public static Vector3 VectorFromStrArray(string[] cmps)
		{
			//IL_0035: Unknown result type (might be due to invalid IL or missing references)
			//IL_003a: Unknown result type (might be due to invalid IL or missing references)
			//IL_003f: Unknown result type (might be due to invalid IL or missing references)
			//IL_002a: Unknown result type (might be due to invalid IL or missing references)
			//IL_002f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0043: Unknown result type (might be due to invalid IL or missing references)
			float num = FastFloatParse(cmps[1]);
			float num2 = FastFloatParse(cmps[2]);
			if (cmps.Length == 4)
			{
				float num3 = FastFloatParse(cmps[3]);
				return new Vector3(num, num2, num3);
			}
			return Vector2.op_Implicit(new Vector2(num, num2));
		}

		public static Color ColorFromStrArray(string[] cmps, float scalar = 1f)
		{
			//IL_0025: Unknown result type (might be due to invalid IL or missing references)
			//IL_002a: Unknown result type (might be due to invalid IL or missing references)
			//IL_002d: Unknown result type (might be due to invalid IL or missing references)
			float num = FastFloatParse(cmps[1]) * scalar;
			float num2 = FastFloatParse(cmps[2]) * scalar;
			float num3 = FastFloatParse(cmps[3]) * scalar;
			return new Color(num, num2, num3);
		}
	}
	public class OBJObjectBuilder
	{
		private class ObjLoopHash
		{
			public int vertexIndex;

			public int normalIndex;

			public int uvIndex;

			public override bool Equals(object obj)
			{
				if (!(obj is ObjLoopHash))
				{
					return false;
				}
				ObjLoopHash objLoopHash = obj as ObjLoopHash;
				return objLoopHash.vertexIndex == vertexIndex && objLoopHash.uvIndex == uvIndex && objLoopHash.normalIndex == normalIndex;
			}

			public override int GetHashCode()
			{
				int num = 3;
				num = num * 314159 + vertexIndex;
				num = num * 314159 + normalIndex;
				return num * 314159 + uvIndex;
			}
		}

		private OBJLoader _loader;

		private string _name;

		private Dictionary<ObjLoopHash, int> _globalIndexRemap = new Dictionary<ObjLoopHash, int>();

		private Dictionary<string, List<int>> _materialIndices = new Dictionary<string, List<int>>();

		private List<int> _currentIndexList;

		private string _lastMaterial = null;

		private List<Vector3> _vertices = new List<Vector3>();

		private List<Vector3> _normals = new List<Vector3>();

		private List<Vector2> _uvs = new List<Vector2>();

		private bool recalculateNormals = false;

		public int PushedFaceCount { get; private set; } = 0;


		public GameObject Build()
		{
			//IL_0007: Unknown result type (might be due to invalid IL or missing references)
			//IL_000d: Expected O, but got Unknown
			//IL_0104: Unknown result type (might be due to invalid IL or missing references)
			//IL_0109: Unknown result type (might be due to invalid IL or missing references)
			//IL_0116: Unknown result type (might be due to invalid IL or missing references)
			//IL_0133: Unknown result type (might be due to invalid IL or missing references)
			//IL_0147: Expected O, but got Unknown
			GameObject val = new GameObject(_name);
			MeshRenderer val2 = val.AddComponent<MeshRenderer>();
			int num = 0;
			Material[] array = (Material[])(object)new Material[_materialIndices.Count];
			foreach (KeyValuePair<string, List<int>> materialIndex in _materialIndices)
			{
				Material value = null;
				if (_loader.Materials == null)
				{
					value = OBJLoaderHelper.CreateNullMaterial();
					((Object)value).name = materialIndex.Key;
				}
				else if (!_loader.Materials.TryGetValue(materialIndex.Key, out value))
				{
					value = OBJLoaderHelper.CreateNullMaterial();
					((Object)value).name = materialIndex.Key;
					_loader.Materials[materialIndex.Key] = value;
				}
				array[num] = value;
				num++;
			}
			((Renderer)val2).sharedMaterials = array;
			MeshFilter val3 = val.AddComponent<MeshFilter>();
			num = 0;
			Mesh val4 = new Mesh
			{
				name = _name,
				indexFormat = (IndexFormat)(_vertices.Count > 65535),
				subMeshCount = _materialIndices.Count
			};
			val4.SetVertices(_vertices);
			val4.SetNormals(_normals);
			val4.SetUVs(0, _uvs);
			foreach (KeyValuePair<string, List<int>> materialIndex2 in _materialIndices)
			{
				val4.SetTriangles(materialIndex2.Value, num);
				num++;
			}
			if (recalculateNormals)
			{
				val4.RecalculateNormals();
			}
			val4.RecalculateTangents();
			val4.RecalculateBounds();
			val3.sharedMesh = val4;
			return val;
		}

		public void SetMaterial(string name)
		{
			if (!_materialIndices.TryGetValue(name, out _currentIndexList))
			{
				_currentIndexList = new List<int>();
				_materialIndices[name] = _currentIndexList;
			}
		}

		public void PushFace(string material, List<int> vertexIndices, List<int> normalIndices, List<int> uvIndices)
		{
			//IL_00e8: Unknown result type (might be due to invalid IL or missing references)
			//IL_00fc: Unknown result type (might be due to invalid IL or missing references)
			//IL_0126: Unknown result type (might be due to invalid IL or missing references)
			//IL_013a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0164: Unknown result type (might be due to invalid IL or missing references)
			//IL_0178: Unknown result type (might be due to invalid IL or missing references)
			if (vertexIndices.Count < 3)
			{
				return;
			}
			if (material != _lastMaterial)
			{
				SetMaterial(material);
				_lastMaterial = material;
			}
			int[] array = new int[vertexIndices.Count];
			for (int i = 0; i < vertexIndices.Count; i++)
			{
				int num = vertexIndices[i];
				int num2 = normalIndices[i];
				int num3 = uvIndices[i];
				ObjLoopHash key = new ObjLoopHash
				{
					vertexIndex = num,
					normalIndex = num2,
					uvIndex = num3
				};
				int value = -1;
				if (!_globalIndexRemap.TryGetValue(key, out value))
				{
					_globalIndexRemap.Add(key, _vertices.Count);
					value = _vertices.Count;
					_vertices.Add((num >= 0 && num < _loader.Vertices.Count) ? _loader.Vertices[num] : Vector3.zero);
					_normals.Add((num2 >= 0 && num2 < _loader.Normals.Count) ? _loader.Normals[num2] : Vector3.zero);
					_uvs.Add((num3 >= 0 && num3 < _loader.UVs.Count) ? _loader.UVs[num3] : Vector2.zero);
					if (num2 < 0)
					{
						recalculateNormals = true;
					}
				}
				array[i] = value;
			}
			if (array.Length == 3)
			{
				_currentIndexList.AddRange(new int[3]
				{
					array[0],
					array[1],
					array[2]
				});
			}
			else if (array.Length == 4)
			{
				_currentIndexList.AddRange(new int[3]
				{
					array[0],
					array[1],
					array[2]
				});
				_currentIndexList.AddRange(new int[3]
				{
					array[2],
					array[3],
					array[0]
				});
			}
			else if (array.Length > 4)
			{
				for (int num4 = array.Length - 1; num4 >= 2; num4--)
				{
					_currentIndexList.AddRange(new int[3]
					{
						array[0],
						array[num4 - 1],
						array[num4]
					});
				}
			}
			PushedFaceCount++;
		}

		public OBJObjectBuilder(string name, OBJLoader loader)
		{
			_name = name;
			_loader = loader;
		}
	}
	public static class StringExtensions
	{
		public static string Clean(this string str)
		{
			string text = str.Replace('\t', ' ');
			while (text.Contains("  "))
			{
				text = text.Replace("  ", " ");
			}
			return text.Trim();
		}
	}
	public static class BinaryExtensions
	{
		public static Color32 ReadColor32RGBR(this BinaryReader r)
		{
			//IL_0017: Unknown result type (might be due to invalid IL or missing references)
			//IL_001c: Unknown result type (might be due to invalid IL or missing references)
			//IL_001f: Unknown result type (might be due to invalid IL or missing references)
			byte[] array = r.ReadBytes(4);
			return new Color32(array[0], array[1], array[2], byte.MaxValue);
		}

		public static Color32 ReadColor32RGBA(this BinaryReader r)
		{
			//IL_0015: Unknown result type (might be due to invalid IL or missing references)
			//IL_001a: Unknown result type (might be due to invalid IL or missing references)
			//IL_001d: Unknown result type (might be due to invalid IL or missing references)
			byte[] array = r.ReadBytes(4);
			return new Color32(array[0], array[1], array[2], array[3]);
		}

		public static Color32 ReadColor32RGB(this BinaryReader r)
		{
			//IL_0017: Unknown result type (might be due to invalid IL or missing references)
			//IL_001c: Unknown result type (might be due to invalid IL or missing references)
			//IL_001f: Unknown result type (might be due to invalid IL or missing references)
			byte[] array = r.ReadBytes(3);
			return new Color32(array[0], array[1], array[2], byte.MaxValue);
		}

		public static Color32 ReadColor32BGR(this BinaryReader r)
		{
			//IL_0017: Unknown result type (might be due to invalid IL or missing references)
			//IL_001c: Unknown result type (might be due to invalid IL or missing references)
			//IL_001f: Unknown result type (might be due to invalid IL or missing references)
			byte[] array = r.ReadBytes(3);
			return new Color32(array[2], array[1], array[0], byte.MaxValue);
		}
	}
	public static class DDSLoader
	{
		public static Texture2D Load(Stream ddsStream)
		{
			byte[] array = new byte[ddsStream.Length];
			ddsStream.Read(array, 0, (int)ddsStream.Length);
			return Load(array);
		}

		public static Texture2D Load(string ddsPath)
		{
			return Load(File.ReadAllBytes(ddsPath));
		}

		public static Texture2D Load(byte[] ddsBytes)
		{
			//IL_0079: 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_00a7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ae: Expected O, but got Unknown
			try
			{
				byte b = ddsBytes[4];
				if (b != 124)
				{
					throw new Exception("Invalid DDS header. Structure length is incrrrect.");
				}
				byte b2 = ddsBytes[87];
				if (b2 != 49 && b2 != 53)
				{
					throw new Exception("Cannot load DDS due to an unsupported pixel format. Needs to be DXT1 or DXT5.");
				}
				int num = ddsBytes[13] * 256 + ddsBytes[12];
				int num2 = ddsBytes[17] * 256 + ddsBytes[16];
				bool flag = ddsBytes[28] > 0;
				TextureFormat val = (TextureFormat)((b2 == 49) ? 10 : 12);
				int num3 = 128;
				byte[] array = new byte[ddsBytes.Length - num3];
				Buffer.BlockCopy(ddsBytes, num3, array, 0, ddsBytes.Length - num3);
				Texture2D val2 = new Texture2D(num2, num, val, flag);
				val2.LoadRawTextureData(array);
				val2.Apply();
				return val2;
			}
			catch (Exception ex)
			{
				throw new Exception("An error occured while loading DirectDraw Surface: " + ex.Message);
			}
		}
	}
	public class ImageLoader
	{
		public enum TextureFormat
		{
			DDS,
			TGA,
			BMP,
			PNG,
			JPG,
			CRN
		}

		public static void SetNormalMap(ref Texture2D tex)
		{
			//IL_0010: Unknown result type (might be due to invalid IL or missing references)
			//IL_0015: Unknown result type (might be due to invalid IL or missing references)
			//IL_003e: Unknown result type (might be due to invalid IL or missing references)
			//IL_003f: Unknown result type (might be due to invalid IL or missing references)
			Color[] pixels = tex.GetPixels();
			for (int i = 0; i < pixels.Length; i++)
			{
				Color val = pixels[i];
				val.r = pixels[i].g;
				val.a = pixels[i].r;
				pixels[i] = val;
			}
			tex.SetPixels(pixels);
			tex.Apply(true);
		}

		public static Texture2D LoadTexture(Stream stream, TextureFormat format)
		{
			//IL_0060: Unknown result type (might be due to invalid IL or missing references)
			//IL_0067: Expected O, but got Unknown
			switch (format)
			{
			case TextureFormat.BMP:
				return new BMPLoader().LoadBMP(stream).ToTexture2D();
			case TextureFormat.DDS:
				return DDSLoader.Load(stream);
			default:
				if (format != TextureFormat.PNG)
				{
					if (format == TextureFormat.TGA)
					{
						return TGALoader.Load(stream);
					}
					return null;
				}
				goto case TextureFormat.JPG;
			case TextureFormat.JPG:
			{
				byte[] array = new byte[stream.Length];
				stream.Read(array, 0, (int)stream.Length);
				Texture2D val = new Texture2D(1, 1);
				ImageConversion.LoadImage(val, array);
				return val;
			}
			}
		}

		public static Texture2D LoadTexture(string fn)
		{
			//IL_0139: Unknown result type (might be due to invalid IL or missing references)
			//IL_013f: Expected O, but got Unknown
			//IL_01c1: Unknown result type (might be due to invalid IL or missing references)
			//IL_01d1: Unknown result type (might be due to invalid IL or missing references)
			//IL_01e4: Unknown result type (might be due to invalid IL or missing references)
			//IL_023f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0242: Unknown result type (might be due to invalid IL or missing references)
			//IL_0248: Expected O, but got Unknown
			//IL_01f8: Unknown result type (might be due to invalid IL or missing references)
			if (!File.Exists(fn))
			{
				return null;
			}
			byte[] array = File.ReadAllBytes(fn);
			string text = Path.GetExtension(fn).ToLower();
			string fileName = Path.GetFileName(fn);
			Texture2D val = null;
			switch (text)
			{
			case ".png":
			case ".jpg":
			case ".jpeg":
				val = new Texture2D(1, 1);
				ImageConversion.LoadImage(val, array);
				break;
			case ".dds":
				val = DDSLoader.Load(array);
				break;
			case ".tga":
				val = TGALoader.Load(array);
				break;
			case ".bmp":
				val = new BMPLoader().LoadBMP(array).ToTexture2D();
				break;
			case ".crn":
			{
				byte[] array2 = array;
				ushort num = BitConverter.ToUInt16(new byte[2]
				{
					array2[13],
					array2[12]
				}, 0);
				ushort num2 = BitConverter.ToUInt16(new byte[2]
				{
					array2[15],
					array2[14]
				}, 0);
				byte b = array2[18];
				TextureFormat val2 = (TextureFormat)3;
				if (b == 0)
				{
					val2 = (TextureFormat)28;
				}
				else if (b == 2)
				{
					val2 = (TextureFormat)29;
				}
				else
				{
					if (b != 12)
					{
						Debug.LogError((object)("Could not load crunched texture " + fileName + " because its format is not supported (" + b + "): " + fn));
						break;
					}
					val2 = (TextureFormat)65;
				}
				val = new Texture2D((int)num, (int)num2, val2, true);
				val.LoadRawTextureData(array2);
				val.Apply(true);
				break;
			}
			default:
				Debug.LogError((object)("Could not load texture " + fileName + " because its format is not supported : " + fn));
				break;
			}
			if ((Object)(object)val != (Object)null)
			{
				val = ImageLoaderHelper.VerifyFormat(val);
				((Object)val).name = Path.GetFileNameWithoutExtension(fn);
			}
			return val;
		}
	}
	public class ImageLoaderHelper
	{
		public static Texture2D VerifyFormat(Texture2D tex)
		{
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			//IL_0008: Invalid comparison between Unknown and I4
			//IL_000b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0011: Invalid comparison between Unknown and I4
			//IL_0014: Unknown result type (might be due to invalid IL or missing references)
			//IL_001b: Invalid comparison between Unknown and I4
			//IL_0044: 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_004c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0095: Unknown result type (might be due to invalid IL or missing references)
			//IL_009c: Expected O, but got Unknown
			if ((int)tex.format != 5 && (int)tex.format != 4 && (int)tex.format != 12)
			{
				return tex;
			}
			Color32[] pixels = tex.GetPixels32();
			bool flag = false;
			Color32[] array = pixels;
			foreach (Color32 val in array)
			{
				if (val.a < byte.MaxValue)
				{
					flag = true;
					break;
				}
			}
			if (!flag)
			{
				Texture2D val2 = new Texture2D(((Texture)tex).width, ((Texture)tex).height, (TextureFormat)3, ((Texture)tex).mipmapCount > 0);
				val2.SetPixels32(pixels);
				val2.Apply(true);
				return val2;
			}
			return tex;
		}

		public static void FillPixelArray(Color32[] fillArray, byte[] pixelData, int bytesPerPixel, bool bgra = false)
		{
			//IL_0030: Unknown result type (might be due to invalid IL or missing references)
			//IL_0035: Unknown result type (might be due to invalid IL or missing references)
			if (bgra)
			{
				if (bytesPerPixel == 4)
				{
					for (int i = 0; i < fillArray.Length; i++)
					{
						int num = i * bytesPerPixel;
						fillArray[i] = new Color32(pixelData[num + 2], pixelData[num + 1], pixelData[num], pixelData[num + 3]);
					}
					return;
				}
				for (int j = 0; j < fillArray.Length; j++)
				{
					fillArray[j].r = pixelData[j * 3 + 2];
					fillArray[j].g = pixelData[j * 3 + 1];
					fillArray[j].b = pixelData[j * 3];
				}
			}
			else if (bytesPerPixel == 4)
			{
				for (int k = 0; k < fillArray.Length; k++)
				{
					fillArray[k].r = pixelData[k * 4];
					fillArray[k].g = pixelData[k * 4 + 1];
					fillArray[k].b = pixelData[k * 4 + 2];
					fillArray[k].a = pixelData[k * 4 + 3];
				}
			}
			else
			{
				int num2 = 0;
				for (int l = 0; l < fillArray.Length; l++)
				{
					fillArray[l].r = pixelData[num2++];
					fillArray[l].g = pixelData[num2++];
					fillArray[l].b = pixelData[num2++];
					fillArray[l].a = byte.MaxValue;
				}
			}
		}
	}
	public static class ImageUtils
	{
		public static Texture2D ConvertToNormalMap(Texture2D tex)
		{
			//IL_0004: Unknown result type (might be due to invalid IL or missing references)
			//IL_000a: Invalid comparison between Unknown and I4
			//IL_000d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0013: Invalid comparison between Unknown and I4
			//IL_002e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0034: Expected O, but got Unknown
			//IL_0043: Unknown result type (might be due to invalid IL or missing references)
			//IL_0048: Unknown result type (might be due to invalid IL or missing references)
			//IL_008a: Unknown result type (might be due to invalid IL or missing references)
			//IL_008c: Unknown result type (might be due to invalid IL or missing references)
			Texture2D val = tex;
			if ((int)tex.format != 4 && (int)tex.format != 5)
			{
				val = new Texture2D(((Texture)tex).width, ((Texture)tex).height, (TextureFormat)4, true);
			}
			Color[] pixels = tex.GetPixels();
			for (int i = 0; i < pixels.Length; i++)
			{
				Color val2 = pixels[i];
				val2.a = pixels[i].r;
				val2.r = 0f;
				val2.g = pixels[i].g;
				val2.b = 0f;
				pixels[i] = val2;
			}
			val.SetPixels(pixels);
			val.Apply(true);
			return val;
		}
	}
	public class TGALoader
	{
		private static int GetBits(byte b, int offset, int count)
		{
			return (b >> offset) & ((1 << count) - 1);
		}

		private static Color32[] LoadRawTGAData(BinaryReader r, int bitDepth, int width, int height)
		{
			Color32[] array = (Color32[])(object)new Color32[width * height];
			byte[] pixelData = r.ReadBytes(width * height * (bitDepth / 8));
			ImageLoaderHelper.FillPixelArray(array, pixelData, bitDepth / 8, bgra: true);
			return array;
		}

		private static Color32[] LoadRLETGAData(BinaryReader r, int bitDepth, int width, int height)
		{
			//IL_0094: Unknown result type (might be due to invalid IL or missing references)
			//IL_0099: Unknown result type (might be due to invalid IL or missing references)
			//IL_0087: Unknown result type (might be due to invalid IL or missing references)
			//IL_008c: 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_0052: Unknown result type (might be due to invalid IL or missing references)
			//IL_0057: Unknown result type (might be due to invalid IL or missing references)
			//IL_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_00ab: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ad: Unknown result type (might be due to invalid IL or missing references)
			//IL_005c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0063: Unknown result type (might be due to invalid IL or missing references)
			//IL_0065: Unknown result type (might be due to invalid IL or missing references)
			Color32[] array = (Color32[])(object)new Color32[width * height];
			int num;
			for (int i = 0; i < array.Length; i += num)
			{
				byte b = r.ReadByte();
				int bits = GetBits(b, 7, 1);
				num = GetBits(b, 0, 7) + 1;
				if (bits == 0)
				{
					for (int j = 0; j < num; j++)
					{
						Color32 val = ((bitDepth == 32) ? r.ReadColor32RGBA().FlipRB() : r.ReadColor32RGB().FlipRB());
						array[j + i] = val;
					}
				}
				else
				{
					Color32 val2 = ((bitDepth == 32) ? r.ReadColor32RGBA().FlipRB() : r.ReadColor32RGB().FlipRB());
					for (int k = 0; k < num; k++)
					{
						array[k + i] = val2;
					}
				}
			}
			return array;
		}

		public static Texture2D Load(string fileName)
		{
			using FileStream tGAStream = File.OpenRead(fileName);
			return Load(tGAStream);
		}

		public static Texture2D Load(byte[] bytes)
		{
			using MemoryStream tGAStream = new MemoryStream(bytes);
			return Load(tGAStream);
		}

		public static Texture2D Load(Stream TGAStream)
		{
			//IL_00ac: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b3: Expected O, but got Unknown
			using BinaryReader binaryReader = new BinaryReader(TGAStream);
			binaryReader.BaseStream.Seek(2L, SeekOrigin.Begin);
			byte b = binaryReader.ReadByte();
			if (b != 10 && b != 2)
			{
				Debug.LogError((object)$"Unsupported targa image type. ({b})");
				return null;
			}
			binaryReader.BaseStream.Seek(12L, SeekOrigin.Begin);
			short num = binaryReader.ReadInt16();
			short num2 = binaryReader.ReadInt16();
			int num3 = binaryReader.ReadByte();
			if (num3 < 24)
			{
				throw new Exception("Tried to load TGA with unsupported bit depth");
			}
			binaryReader.BaseStream.Seek(1L, SeekOrigin.Current);
			Texture2D val = new Texture2D((int)num, (int)num2, (TextureFormat)((num3 == 24) ? 3 : 5), true);
			if (b == 2)
			{
				val.SetPixels32(LoadRawTGAData(binaryReader, num3, num, num2));
			}
			else
			{
				val.SetPixels32(LoadRLETGAData(binaryReader, num3, num, num2));
			}
			val.Apply();
			return val;
		}
	}
}
namespace Dummiesman.Extensions
{
	public static class ColorExtensions
	{
		public static Color FlipRB(this Color color)
		{
			//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)
			//IL_000d: 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_0019: Unknown result type (might be due to invalid IL or missing references)
			//IL_001e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0021: Unknown result type (might be due to invalid IL or missing references)
			return new Color(color.b, color.g, color.r, color.a);
		}

		public static Color32 FlipRB(this Color32 color)
		{
			//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)
			//IL_000d: 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_0019: Unknown result type (might be due to invalid IL or missing references)
			//IL_001e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0021: Unknown result type (might be due to invalid IL or missing references)
			return new Color32(color.b, color.g, color.r, color.a);
		}
	}
}

plugins/RoundQueen-ItemDraft/plugins/ItemDraft.dll

Decompiled 5 months ago
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using BepInEx;
using DiskCardGame;
using HarmonyLib;
using InscryptionAPI.Ascension;
using UnityEngine;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: TargetFramework(".NETStandard,Version=v2.0", FrameworkDisplayName = "")]
[assembly: AssemblyCompany("ItemDraft")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("ItemDraft")]
[assembly: AssemblyTitle("ItemDraft")]
[assembly: AssemblyVersion("1.0.0.0")]
namespace ItemDraft;

internal class ItemDraftPatch
{
	[HarmonyPostfix]
	[HarmonyPatch(typeof(AscensionSaveData), "NewRun")]
	public static void OnNewRun(ref AscensionSaveData __instance)
	{
		//IL_0006: Unknown result type (might be due to invalid IL or missing references)
		if (!AscensionSaveData.Data.ChallengeIsActive(PluginManager.ItemDraftID))
		{
			return;
		}
		List<string> list = new List<string>();
		foreach (string consumable in __instance.currentRun.consumables)
		{
			if (consumable != "FishHook")
			{
				list.Add(consumable);
			}
		}
		foreach (string item in list)
		{
			__instance.currentRun.consumables.Remove(item);
		}
	}

	private static bool First(int rowIndex)
	{
		return SaveFile.IsAscension && rowIndex == 1 && RunState.Run.regionTier == 0 && AscensionSaveData.Data.numRunsSinceReachedFirstBoss < 2;
	}

	[HarmonyPatch(typeof(MapGenerator), "GenerateNodes")]
	[HarmonyPostfix]
	private static void AddItemNodeChallenge(ref List<NodeData> __result)
	{
		//IL_0024: Unknown result type (might be due to invalid IL or missing references)
		//IL_002a: Expected O, but got Unknown
		//IL_004a: 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)
		int frontStart = ((!First(1)) ? 1 : 2);
		List<NodeData> frontNodes = new List<NodeData>();
		NodeData val = (NodeData)new GainConsumablesNodeData();
		frontNodes.Add(val);
		val.gridY++;
		if (!AscensionSaveData.Data.ChallengeIsActive(PluginManager.ItemDraftID) || RunState.Run.regionTier != 0)
		{
			return;
		}
		Singleton<ChallengeActivationUI>.Instance.ShowActivation(PluginManager.ItemDraftID);
		foreach (NodeData item in __result.Where((NodeData n) => n.gridY >= frontStart).ToList())
		{
			item.gridY += frontNodes.Count;
		}
		NodeData lastNodeBeforeCustomFront = GetLastNodeBeforeCustomFront(__result);
		lastNodeBeforeCustomFront.connectedNodes.Clear();
		lastNodeBeforeCustomFront.connectedNodes.Add(frontNodes[0]);
		foreach (NodeData item2 in __result.Where((NodeData n) => n.gridY == frontStart + frontNodes.Count))
		{
			frontNodes[frontNodes.Count - 1].connectedNodes.Add(item2);
		}
		__result = __result.Where((NodeData n) => n.gridY < frontStart).Concat(frontNodes).Concat(__result.Where((NodeData n) => n.gridY >= frontStart))
			.ToList();
	}

	private static NodeData GetLastNodeBeforeCustomFront(List<NodeData> nodes)
	{
		if (First(1))
		{
			return nodes.First((NodeData n) => n.gridY == 1);
		}
		return nodes.First((NodeData n) => n.gridY == 0);
	}

	public static void Register(Harmony harmony)
	{
		//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)
		AscensionChallengeInfo val = ScriptableObject.CreateInstance<AscensionChallengeInfo>();
		val.title = "Item Draft";
		val.iconSprite = Tools.ConvertTexToSprite(Tools.LoadTex("ItemDraft/Resources/ItemDraftInactive.png"));
		val.description = "No items except Fish Hook, but guarenteed item node at the start.";
		val.activatedSprite = Tools.ConvertTexToSprite(Tools.LoadTex("ItemDraft/Resources/ItemDraftActive.png"));
		val.pointValue = -10;
		PluginManager.ItemDraftID = ChallengeManager.Add("roundqueen.inscryption.itemdraft", val, 0, false).Challenge.challengeType;
		harmony.PatchAll(typeof(ItemDraftPatch));
	}
}
[BepInPlugin("roundqueen.inscryption.itemdraft", "ItemDraft", "1.0.0")]
[BepInDependency(/*Could not decode attribute arguments.*/)]
public class PluginManager : BaseUnityPlugin
{
	public static AscensionChallenge ItemDraftID;

	public const string PluginGuid = "roundqueen.inscryption.itemdraft";

	public const string PluginName = "ItemDraft";

	public const string PluginVersion = "1.0.0";

	public const string PluginPrefix = "ItemDraft";

	public void Awake()
	{
		//IL_0006: Unknown result type (might be due to invalid IL or missing references)
		//IL_000c: Expected O, but got Unknown
		Harmony val = new Harmony("ItemDraft.harmonypatcher");
		val.PatchAll(Assembly.GetExecutingAssembly());
		ItemDraftPatch.Register(val);
	}
}
internal static class Tools
{
	public static Texture2D LoadTex(string path)
	{
		//IL_000a: Unknown result type (might be due to invalid IL or missing references)
		//IL_0010: Expected O, but got Unknown
		byte[] array = ExtractEmbeddedResource(path);
		Texture2D val = new Texture2D(2, 2);
		ImageConversion.LoadImage(val, array);
		((Texture)val).filterMode = (FilterMode)0;
		return val;
	}

	public static byte[] ExtractEmbeddedResource(string filePath)
	{
		filePath = filePath.Replace("/", ".");
		filePath = filePath.Replace("\\", ".");
		Assembly callingAssembly = Assembly.GetCallingAssembly();
		using Stream stream = callingAssembly.GetManifestResourceStream(filePath);
		if (stream == null)
		{
			return null;
		}
		byte[] array = new byte[stream.Length];
		stream.Read(array, 0, array.Length);
		return array;
	}

	public static Sprite ConvertTexToSprite(Texture2D tex, Vector2? pivot = null)
	{
		//IL_005f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0064: Unknown result type (might be due to invalid IL or missing references)
		//IL_0022: Unknown result type (might be due to invalid IL or missing references)
		//IL_002e: Unknown result type (might be due to invalid IL or missing references)
		Vector2 val = default(Vector2);
		((Vector2)(ref val))..ctor(0.5f, 0.5f);
		if (pivot.HasValue)
		{
			((Vector2)(ref val))..ctor(pivot.Value.x, pivot.Value.y);
		}
		((Texture)tex).filterMode = (FilterMode)0;
		return Sprite.Create(tex, new Rect(0f, 0f, (float)((Texture)tex).width, (float)((Texture)tex).height), val, 100f);
	}

	public static T2 GetPrivateType<T, T2>(T obj, string field)
	{
		FieldInfo field2 = typeof(T).GetField(field, BindingFlags.Instance | BindingFlags.NonPublic);
		return (T2)field2.GetValue(obj);
	}

	public static void ShowLeshyMessage(string message, Emotion emotion, float duration)
	{
		//IL_0012: Unknown result type (might be due to invalid IL or missing references)
		((MonoBehaviour)Singleton<TextDisplayer>.Instance).StartCoroutine(Singleton<TextDisplayer>.Instance.ShowThenClear(message, duration, 0f, emotion, (LetterAnimation)0, (Speaker)1, (string[])null));
	}

	public static Texture2D ChangeSize(this Texture2D texture2D, int targetX, int targetY)
	{
		//IL_0005: Unknown result type (might be due to invalid IL or missing references)
		//IL_000b: Expected O, but got Unknown
		//IL_001c: Unknown result type (might be due to invalid IL or missing references)
		//IL_0022: Expected O, but got Unknown
		//IL_0031: Unknown result type (might be due to invalid IL or missing references)
		RenderTexture val2 = (RenderTexture.active = new RenderTexture(targetX, targetY, 24));
		Graphics.Blit((Texture)(object)texture2D, val2);
		Texture2D val3 = new Texture2D(targetX, targetY);
		val3.ReadPixels(new Rect(0f, 0f, (float)targetX, (float)targetY), 0, 0);
		val3.Apply();
		return val3;
	}
}

plugins/RoundQueen-SideDeckNode/plugins/SideDeckNode.dll

Decompiled 5 months ago
using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using BepInEx;
using CustomSideDeck;
using CustomSideDeck.Info;
using DiskCardGame;
using HarmonyLib;
using InscryptionAPI.Nodes;
using InscryptionAPI.Saves;
using Pixelplacement;
using UnityEngine;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: TargetFramework(".NETStandard,Version=v2.0", FrameworkDisplayName = "")]
[assembly: AssemblyCompany("SideDeckNode")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("SideDeckNode")]
[assembly: AssemblyTitle("SideDeckNode")]
[assembly: AssemblyVersion("1.0.0.0")]
namespace SideDeckNode;

internal class MycologistSideDeckNode : CardChoicesSequencer, ICustomNodeSequencer
{
	private MycologistSideDeckNode sequencer = null;

	private static FullNode fullNode;

	private DuplicateMergeSequencer dupie;

	private List<GameObject> mushrooms;

	public SideDeckInfo sideDeckInfo;

	private static Traverse _parentContainer;

	private string selectedCardName = null;

	private Vector3 basePosition;

	private readonly Vector3 BASE_ANCHOR = new Vector3(-2.2f, 5.01f, -0.12f);

	private readonly Vector3 ROW_OFFSET = new Vector3(0f, 0f, -1.6f);

	private readonly Vector3 COL_OFFSET = new Vector3(1.6f, 0f, 0f);

	private void Initialize()
	{
		//IL_0028: Unknown result type (might be due to invalid IL or missing references)
		//IL_002d: Unknown result type (might be due to invalid IL or missing references)
		if ((Object)(object)base.selectableCardPrefab == (Object)null)
		{
			base.selectableCardPrefab = GetCopiedField<GameObject>("selectableCardPrefab");
		}
		basePosition = ((Component)this).transform.position;
	}

	private static T GetCopiedField<T>(string fieldName) where T : class
	{
		if (_parentContainer == null)
		{
			object value = Traverse.Create((object)Singleton<SpecialNodeHandler>.Instance).Field("cardChoiceSequencer").GetValue();
			_parentContainer = Traverse.Create((value is CardSingleChoicesSequencer) ? value : null);
		}
		return _parentContainer.Field(fieldName).GetValue() as T;
	}

	public static void AddNode()
	{
		//IL_0062: Unknown result type (might be due to invalid IL or missing references)
		//IL_006c: Expected O, but got Unknown
		//IL_0070: Unknown result type (might be due to invalid IL or missing references)
		//IL_007a: Expected O, but got Unknown
		string text = "roundqueen.inscryption.sidedecknode";
		string text2 = "Side Deck Node Sequencer";
		FullNode val = NewNodeManager.New<MycologistSideDeckNode>(text, text2, (GenerationType)8, new List<Texture2D>
		{
			Tools.LoadTex("SideDeckNode/Resources/Sequencers/choosedeck_1.png"),
			Tools.LoadTex("SideDeckNode/Resources/Sequencers/choosedeck_2.png"),
			Tools.LoadTex("SideDeckNode/Resources/Sequencers/choosedeck_3.png"),
			Tools.LoadTex("SideDeckNode/Resources/Sequencers/choosedeck_4.png")
		}, new List<SelectionCondition>
		{
			(SelectionCondition)new CustomPreviousNodesContent(text, text2, false),
			(SelectionCondition)new WithinRegionIndexRange(0, 2)
		}, new List<SelectionCondition>(), (Action<CustomSpecialNodeData>)null, (Action<CustomSpecialNodeData, MapNode2D>)null, (GameObject)null, (GameObject)null);
	}

	public IEnumerator DoCustomSequence(CustomSpecialNodeData nodeData)
	{
		Initialize();
		Singleton<ViewManager>.Instance.Controller.SwitchToControlMode((ControlMode)5, false);
		Singleton<ViewManager>.Instance.Controller.LockState = (ViewLockState)1;
		DuplicateMergeSequencer handler = Tools.GetPrivateType<SpecialNodeHandler, DuplicateMergeSequencer>(Singleton<SpecialNodeHandler>.Instance, "duplicateMerger");
		mushrooms = Tools.GetPrivateType<DuplicateMergeSequencer, List<GameObject>>(handler, "mushrooms");
		AudioController.Instance.PlaySound3D("mushrooms_small_appear", (MixerGroup)4, ((Component)LeshyAnimationController.Instance).transform.position, 1f, 0f, (Pitch)null, (Repetition)null, (Randomization)null, (Distortion)null, false);
		foreach (GameObject mushroom in mushrooms)
		{
			mushroom.SetActive(true);
			yield return (object)new WaitForSeconds(0.05f);
			mushroom.GetComponent<Collider>().enabled = true;
		}
		yield return (object)new WaitForSeconds(0.5f);
		if (!HasLearnedSequence())
		{
			yield return Singleton<TextDisplayer>.Instance.ShowUntilInput("A pair of familiar faces shuffles out from the cover of darkness and fungi.", -2.5f, 0.5f, (Emotion)0, (LetterAnimation)1, (Speaker)0, (string[])null, true);
			yield return Singleton<TextDisplayer>.Instance.ShowUntilInput("You squint to make them out through the dense sporeclouds surrounding you.", -2.5f, 0.5f, (Emotion)0, (LetterAnimation)1, (Speaker)0, (string[])null, true);
			new WaitForSeconds(0.3f);
		}
		LeshyAnimationController.Instance.PutOnMask((Mask)5, true);
		yield return (object)new WaitForSeconds(1f);
		Singleton<ViewManager>.Instance.SwitchToView((View)29, false, true);
		Singleton<OpponentAnimationController>.Instance.SetHeadTrigger("doctor_idle");
		if (!HasLearnedSequence())
		{
			yield return Singleton<TextDisplayer>.Instance.ShowUntilInput("P-pleasure to see you agai- again.", -2.5f, 0.5f, (Emotion)4, (LetterAnimation)0, (Speaker)0, (string[])null, true);
			SetSideHeadTalking(sideHeadTalking: true);
			yield return Singleton<TextDisplayer>.Instance.ShowUntilInput("[size:3]Yes.[size:]", -2.5f, 0.5f, (Emotion)0, (LetterAnimation)0, (Speaker)5, (string[])null, true);
			SetSideHeadTalking(sideHeadTalking: false);
			yield return Singleton<TextDisplayer>.Instance.ShowUntilInput("We have gleaned knowledge f-from the un-unknowable [c:R]OLD_DATA[c:].", -2.5f, 0.5f, (Emotion)4, (LetterAnimation)0, (Speaker)0, (string[])null, true);
			SetSideHeadTalking(sideHeadTalking: true);
			yield return Singleton<TextDisplayer>.Instance.ShowUntilInput("[size:3]Our work has improved.[size:]", -2.5f, 0.5f, (Emotion)0, (LetterAnimation)0, (Speaker)5, (string[])null, true);
			SetSideHeadTalking(sideHeadTalking: false);
			yield return Singleton<TextDisplayer>.Instance.ShowUntilInput("With it, we can oper- operate to b-birth your creatures anew!", -2.5f, 0.5f, (Emotion)4, (LetterAnimation)0, (Speaker)0, (string[])null, true);
			SetSideHeadTalking(sideHeadTalking: true);
			yield return Singleton<TextDisplayer>.Instance.ShowUntilInput("[size:3]Choose a sidedeck.[size:]", -2.5f, 0.5f, (Emotion)0, (LetterAnimation)0, (Speaker)5, (string[])null, true);
			SetSideHeadTalking(sideHeadTalking: false);
			Singleton<ViewManager>.Instance.SwitchToView((View)1, false, false);
		}
		else
		{
			Singleton<ViewManager>.Instance.SwitchToView((View)29, false, true);
			yield return Singleton<TextDisplayer>.Instance.ShowUntilInput("A-allow us to o-operate on your c-creatures.", -2.5f, 0.5f, (Emotion)4, (LetterAnimation)0, (Speaker)0, (string[])null, true);
			SetSideHeadTalking(sideHeadTalking: true);
			yield return Singleton<TextDisplayer>.Instance.ShowUntilInput("[size:3]Choose.[size:]", -2.5f, 0.5f, (Emotion)0, (LetterAnimation)0, (Speaker)5, (string[])null, true);
			SetSideHeadTalking(sideHeadTalking: false);
			Singleton<ViewManager>.Instance.SwitchToView((View)1, false, false);
		}
		Singleton<ViewManager>.Instance.SwitchToView((View)3, false, false);
		Singleton<ViewManager>.Instance.Controller.SwitchToControlMode((ControlMode)11, false);
		Singleton<ViewManager>.Instance.Controller.LockState = (ViewLockState)1;
		List<SideDeckInfo> SideDecks = SideDeckManager.sideDecksList;
		int i = 0;
		List<string> stringsName = new List<string>();
		foreach (SideDeckInfo sideDecks in SideDeckManager.sideDecksList)
		{
			stringsName.Add(sideDecks.defaultCard);
		}
		using (List<string>.Enumerator enumerator3 = stringsName.GetEnumerator())
		{
			while (enumerator3.MoveNext())
			{
				CreateSideDeckCard(carder: enumerator3.Current, index: i, totalCards: stringsName.Count);
				i++;
			}
		}
		((CardChoicesSequencer)this).SetCollidersEnabled(true);
		((CardChoicesSequencer)this).EnableViewDeck((ControlMode)11, basePosition);
		yield return (object)new WaitUntil((Func<bool>)(() => !string.IsNullOrEmpty(selectedCardName)));
		foreach (string stringer in stringsName)
		{
			if (stringer == selectedCardName)
			{
				int index = stringsName.IndexOf(stringer);
				SideDeckInfo objectiveDeck = SideDecks.ElementAt(index);
				if (objectiveDeck.displayName != null)
				{
					yield return Singleton<TextDisplayer>.Instance.ShowUntilInput("T-the [c:R]" + objectiveDeck.displayName + " Deck[c:] it is- is.", -2.5f, 0.5f, (Emotion)4, (LetterAnimation)0, (Speaker)0, (string[])null, true);
				}
				else
				{
					yield return Singleton<TextDisplayer>.Instance.ShowUntilInput("T-the [c:R]" + objectiveDeck.defaultCard + " Deck[c:] it is- is.", -2.5f, 0.5f, (Emotion)4, (LetterAnimation)0, (Speaker)0, (string[])null, true);
				}
				SetSideHeadTalking(sideHeadTalking: true);
				yield return Singleton<TextDisplayer>.Instance.ShowUntilInput("[size:3]It will suffice.[size:]", -2.5f, 0.5f, (Emotion)0, (LetterAnimation)0, (Speaker)5, (string[])null, true);
				Plugin.CurrentSideDeck = objectiveDeck;
				SetSideHeadTalking(sideHeadTalking: false);
			}
		}
		((CardChoicesSequencer)this).DisableViewDeck();
		CleanUpCards();
		Singleton<ViewManager>.Instance.SwitchToView((View)1, false, false);
		((MonoBehaviour)this).StartCoroutine(LeshyAnimationController.Instance.TakeOffMask());
		yield return (object)new WaitForSeconds(1.5f);
		SetSequenceLearned();
		yield return CleanUp();
		selectedCardName = null;
	}

	private void OnCardChosen2(SelectableCard obj)
	{
		CleanUpCards();
	}

	public static CardModificationInfo FungalStarterMod()
	{
		//IL_0001: Unknown result type (might be due to invalid IL or missing references)
		//IL_0006: Unknown result type (might be due to invalid IL or missing references)
		//IL_0017: Unknown result type (might be due to invalid IL or missing references)
		//IL_0029: Expected O, but got Unknown
		return new CardModificationInfo
		{
			DecalIds = { AlternatingBloodDecal.GetBloodDecalId() },
			DecalIds = { "decal_fungus" }
		};
	}

	private void CreateSideDeckCard(int index, int totalCards, string carder, float tweenDelay = 0f)
	{
		//IL_0051: Unknown result type (might be due to invalid IL or missing references)
		//IL_0056: Unknown result type (might be due to invalid IL or missing references)
		//IL_005d: Unknown result type (might be due to invalid IL or missing references)
		//IL_005e: Unknown result type (might be due to invalid IL or missing references)
		//IL_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_0084: Unknown result type (might be due to invalid IL or missing references)
		//IL_0098: Unknown result type (might be due to invalid IL or missing references)
		//IL_009d: Unknown result type (might be due to invalid IL or missing references)
		//IL_00ae: Unknown result type (might be due to invalid IL or missing references)
		//IL_00e6: Unknown result type (might be due to invalid IL or missing references)
		GameObject val = Object.Instantiate<GameObject>(base.selectableCardPrefab, ((Component)this).transform);
		SelectableCard component = val.GetComponent<SelectableCard>();
		((Component)component).gameObject.SetActive(true);
		CardInfo cardByName = CardLoader.GetCardByName(carder);
		component.Initialize(cardByName, (Action<SelectableCard>)OnCardChosen, (Action<SelectableCard>)null, false, (Action<SelectableCard>)null);
		((Card)component).SetFaceDown(false, false);
		Vector3 locationForCard = GetLocationForCard(index, totalCards);
		val.transform.localPosition = locationForCard + Vector3.forward * 6f;
		val.transform.localScale = Vector3.Scale(val.transform.localScale, new Vector3(0.8f, 0.8f, 1f));
		Tween.LocalPosition(val.transform, locationForCard, 0.2f, tweenDelay, Tween.EaseOut, (LoopType)0, (Action)null, (Action)null, true);
		Tween.Rotate(val.transform, new Vector3(0f, 0f, -2f + Random.value * 4f), (Space)1, 0.25f, tweenDelay, Tween.EaseOut, (LoopType)0, (Action)null, (Action)null, true);
		CustomCoroutine.WaitThenExecute(tweenDelay, (Action)((Card)component).Anim.PlayRiffleSound, false);
		base.selectableCards.Add(component);
	}

	private Vector3 GetLocationForCard(int index, int totalCards)
	{
		//IL_0038: Unknown result type (might be due to invalid IL or missing references)
		//IL_003d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0093: Unknown result type (might be due to invalid IL or missing references)
		//IL_0099: Unknown result type (might be due to invalid IL or missing references)
		//IL_00a9: Unknown result type (might be due to invalid IL or missing references)
		//IL_00ae: Unknown result type (might be due to invalid IL or missing references)
		//IL_00b3: 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_00ca: Unknown result type (might be due to invalid IL or missing references)
		//IL_00cf: Unknown result type (might be due to invalid IL or missing references)
		//IL_00d4: Unknown result type (might be due to invalid IL or missing references)
		//IL_00d9: Unknown result type (might be due to invalid IL or missing references)
		//IL_00dd: Unknown result type (might be due to invalid IL or missing references)
		int num = (int)Math.Ceiling((float)totalCards / 4f);
		int num2 = 4;
		if (totalCards < 4)
		{
			num2 = totalCards;
		}
		if (totalCards == 5 || totalCards == 6 || totalCards == 9)
		{
			num2 = 3;
		}
		Vector3 bASE_ANCHOR = BASE_ANCHOR;
		float num3 = num switch
		{
			2 => 0.5f, 
			1 => 1f, 
			_ => 0f, 
		};
		float num4 = num2 switch
		{
			2 => 1f, 
			3 => 0.5f, 
			4 => 0f, 
			_ => 1.5f, 
		};
		num3 += (float)(index / num2);
		num4 += (float)(index % num2);
		return BASE_ANCHOR + Vector3.Scale(ROW_OFFSET, new Vector3(0f, 0f, num3)) + Vector3.Scale(COL_OFFSET, new Vector3(num4, 0f, 0f));
	}

	private void OnCardChosen(SelectableCard card)
	{
		if (selectedCardName == null)
		{
			((CardChoicesSequencer)this).SetCollidersEnabled(false);
			selectedCardName = ((Object)((Card)card).Info).name;
		}
	}

	private void OnCardFlipped(SelectableCard card)
	{
		if ((Object)(object)((Card)card).Info != (Object)null)
		{
			((MonoBehaviour)this).StartCoroutine(TutorialTextSequence(card));
		}
	}

	private IEnumerator TutorialTextSequence(SelectableCard card)
	{
		if (!ProgressionData.IntroducedCard(((Card)card).Info))
		{
			if (!string.IsNullOrEmpty(((Card)card).Info.description))
			{
				Singleton<ViewManager>.Instance.Controller.LockState = (ViewLockState)1;
				Singleton<RuleBookController>.Instance.SetShown(false, true);
				yield return Singleton<TextDisplayer>.Instance.ShowUntilInput(((Card)card).Info.description, -2.5f, 0.5f, (Emotion)0, (LetterAnimation)0, (Speaker)0, (string[])null, true);
				Singleton<ViewManager>.Instance.Controller.LockState = (ViewLockState)0;
			}
			ProgressionData.SetCardIntroduced(((Card)card).Info);
		}
	}

	protected void CleanUpCards()
	{
		//IL_0034: Unknown result type (might be due to invalid IL or missing references)
		//IL_0039: Unknown result type (might be due to invalid IL or missing references)
		//IL_0043: Unknown result type (might be due to invalid IL or missing references)
		//IL_0048: Unknown result type (might be due to invalid IL or missing references)
		((CardChoicesSequencer)this).ResetLocalRotations();
		foreach (SelectableCard selectableCard in base.selectableCards)
		{
			((Card)selectableCard).SetInteractionEnabled(false);
			Tween.Position(((Component)selectableCard).transform, ((Component)selectableCard).transform.position + Vector3.forward * 20f, 0.5f, 0f, Tween.EaseInOut, (LoopType)0, (Action)null, (Action)null, true);
			Object.Destroy((Object)(object)((Component)selectableCard).gameObject, 0.5f);
		}
		base.selectableCards.Clear();
	}

	public static List<string> GetConfCards(SideDeckInfo decker)
	{
		List<string> list = new List<string>();
		if (decker.csdType != "Advanced")
		{
			if (decker.options.Count > 0)
			{
				for (int i = 0; i < decker.numCards; i++)
				{
					list.Add(ModdedSaveManager.SaveData.GetValue("tvflabs.inscryption.CustomSideDeck", $"ConfCard{i}"));
				}
			}
		}
		else
		{
			int num = 0;
			foreach (string card in decker.cards)
			{
				if (card == "conf")
				{
					list.Add(ModdedSaveManager.SaveData.GetValue("tvflabs.inscryption.CustomSideDeck", $"ConfCard{num}"));
					num++;
				}
			}
		}
		return list;
	}

	public static List<CardInfo> SideDeckCards(SideDeckInfo decker)
	{
		List<CardInfo> list = new List<CardInfo>();
		if (decker.csdType != "Advanced")
		{
			for (int i = 0; i < decker.numCards; i++)
			{
				if (decker.options.Count > 0)
				{
					list.Add(CardLoader.GetCardByName(GetConfCards(decker)[i]));
				}
				else
				{
					list.Add(CardLoader.GetCardByName(decker.defaultCard));
				}
			}
		}
		else
		{
			int num = 0;
			foreach (string card in decker.cards)
			{
				if (card == "conf")
				{
					list.Add(CardLoader.GetCardByName(GetConfCards(decker)[num]));
					num++;
				}
				else if (card == "def" || card == "self")
				{
					CardLoader.GetCardByName(decker.defaultCard);
				}
				else
				{
					list.Add(CardLoader.GetCardByName(card));
				}
			}
		}
		return list;
	}

	private IEnumerator CleanUp()
	{
		Singleton<ViewManager>.Instance.SwitchToView((View)1, false, true);
		AudioController.Instance.PlaySound3D("mushrooms_small_disappear", (MixerGroup)4, ((Component)Singleton<BoardManager>.Instance).transform.position, 1f, 0f, (Pitch)null, (Repetition)null, (Randomization)null, (Distortion)null, false);
		if (mushrooms == null)
		{
			yield break;
		}
		foreach (GameObject gameObject2 in mushrooms)
		{
			gameObject2.GetComponent<Collider>().enabled = false;
			gameObject2.GetComponentInChildren<Animator>().Play("mushroom_shrink", 0, 0f);
			yield return (object)new WaitForSeconds(0.05f);
		}
		mushrooms.ForEach(delegate(GameObject x)
		{
			x.SetActive(false);
		});
	}

	private bool HasLearnedSequence()
	{
		return ModdedSaveManager.SaveData.GetValueAsBoolean("roundqueen.inscryption.sidedecknode", "LearnedSideDeckNodeSequence");
	}

	private void SetSequenceLearned()
	{
		ModdedSaveManager.SaveData.SetValue("roundqueen.inscryption.sidedecknode", "LearnedSideDeckNodeSequence", (object)true);
	}

	private void SetSideHeadTalking(bool sideHeadTalking)
	{
		Singleton<OpponentAnimationController>.Instance.SetHeadBool("doctor_sidehead", sideHeadTalking);
		LeshyAnimationController.Instance.CurrentMask.GetComponent<DoctorMask>().SetEyesActive(sideHeadTalking);
		LeshyAnimationController.Instance.EyeAnimationsDisabled = sideHeadTalking;
	}
}
[BepInPlugin("roundqueen.inscryption.sidedecknode", "SideDeckNode", "1.0.0")]
[BepInDependency(/*Could not decode attribute arguments.*/)]
[BepInDependency(/*Could not decode attribute arguments.*/)]
public class PluginManager : BaseUnityPlugin
{
	public const string PluginGuid = "roundqueen.inscryption.sidedecknode";

	public const string PluginName = "SideDeckNode";

	public const string PluginVersion = "1.0.0";

	public const string PluginPrefix = "SideDeckNode";

	public void Awake()
	{
		//IL_0006: Unknown result type (might be due to invalid IL or missing references)
		//IL_000c: Expected O, but got Unknown
		Harmony val = new Harmony("SideDeckNode.harmonypatcher");
		val.PatchAll(Assembly.GetExecutingAssembly());
		MycologistSideDeckNode.AddNode();
	}
}
internal static class Tools
{
	public static Texture2D LoadTex(string path)
	{
		//IL_000a: Unknown result type (might be due to invalid IL or missing references)
		//IL_0010: Expected O, but got Unknown
		byte[] array = ExtractEmbeddedResource(path);
		Texture2D val = new Texture2D(2, 2);
		ImageConversion.LoadImage(val, array);
		((Texture)val).filterMode = (FilterMode)0;
		return val;
	}

	public static byte[] ExtractEmbeddedResource(string filePath)
	{
		filePath = filePath.Replace("/", ".");
		filePath = filePath.Replace("\\", ".");
		Assembly callingAssembly = Assembly.GetCallingAssembly();
		using Stream stream = callingAssembly.GetManifestResourceStream(filePath);
		if (stream == null)
		{
			return null;
		}
		byte[] array = new byte[stream.Length];
		stream.Read(array, 0, array.Length);
		return array;
	}

	public static Sprite ConvertTexToSprite(Texture2D tex, Vector2? pivot = null)
	{
		//IL_005f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0064: Unknown result type (might be due to invalid IL or missing references)
		//IL_0022: Unknown result type (might be due to invalid IL or missing references)
		//IL_002e: Unknown result type (might be due to invalid IL or missing references)
		Vector2 val = default(Vector2);
		((Vector2)(ref val))..ctor(0.5f, 0.5f);
		if (pivot.HasValue)
		{
			((Vector2)(ref val))..ctor(pivot.Value.x, pivot.Value.y);
		}
		((Texture)tex).filterMode = (FilterMode)0;
		return Sprite.Create(tex, new Rect(0f, 0f, (float)((Texture)tex).width, (float)((Texture)tex).height), val, 100f);
	}

	public static T2 GetPrivateType<T, T2>(T obj, string field)
	{
		FieldInfo field2 = typeof(T).GetField(field, BindingFlags.Instance | BindingFlags.NonPublic);
		return (T2)field2.GetValue(obj);
	}

	public static void ShowLeshyMessage(string message, Emotion emotion, float duration)
	{
		//IL_0012: Unknown result type (might be due to invalid IL or missing references)
		((MonoBehaviour)Singleton<TextDisplayer>.Instance).StartCoroutine(Singleton<TextDisplayer>.Instance.ShowThenClear(message, duration, 0f, emotion, (LetterAnimation)0, (Speaker)1, (string[])null));
	}

	public static Texture2D ChangeSize(this Texture2D texture2D, int targetX, int targetY)
	{
		//IL_0005: Unknown result type (might be due to invalid IL or missing references)
		//IL_000b: Expected O, but got Unknown
		//IL_001c: Unknown result type (might be due to invalid IL or missing references)
		//IL_0022: Expected O, but got Unknown
		//IL_0031: Unknown result type (might be due to invalid IL or missing references)
		RenderTexture val2 = (RenderTexture.active = new RenderTexture(targetX, targetY, 24));
		Graphics.Blit((Texture)(object)texture2D, val2);
		Texture2D val3 = new Texture2D(targetX, targetY);
		val3.ReadPixels(new Rect(0f, 0f, (float)targetX, (float)targetY), 0, 0);
		val3.Apply();
		return val3;
	}
}

plugins/SpecialAPI-MergeSigils/plugins/MergeSigils.dll

Decompiled 5 months ago
using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
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 DiskCardGame;
using HarmonyLib;
using InscryptionMod.Abilities;
using Pixelplacement;
using UnityEngine;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: TargetFramework(".NETStandard,Version=v2.0", FrameworkDisplayName = "")]
[assembly: AssemblyCompany("MergeSigils")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("MergeSigils")]
[assembly: AssemblyTitle("MergeSigils")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.0.0")]
[module: UnverifiableCode]
namespace MergeSigils
{
	[BepInPlugin("spapi.inscryption.mergesigils", "Merge Sigils", "1.0.0")]
	public class Plugin : BaseUnityPlugin
	{
		public const string NAME = "Merge Sigils";

		public const string GUID = "spapi.inscryption.mergesigils";

		public const string VERSION = "1.0.0";

		public void Awake()
		{
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			//IL_000c: Expected O, but got Unknown
			Harmony val = new Harmony("spapi.inscryption.mergesigils");
			val.PatchAll();
		}
	}
}
namespace InscryptionMod.HarmonyPatches
{
	[HarmonyPatch(typeof(PlayerHand), "SelectSlotForCard")]
	public class PlayerHand_SelectSlotForCard
	{
		[StructLayout(LayoutKind.Auto)]
		[CompilerGenerated]
		private struct <>c__DisplayClass0_1
		{
			public bool hasMerge;

			public MergeBase merge;

			public bool hasPlaceAbove;

			public PlaceAboveBase placeAbove;

			public PlayableCard slotCard;
		}

		public static Type type;

		public static Type placeType;

		[HarmonyPostfix]
		public static IEnumerator Postfix(IEnumerator rat, PlayableCard card)
		{
			<>c__DisplayClass0_1 CS$<>8__locals1 = default(<>c__DisplayClass0_1);
			while (rat.MoveNext())
			{
				object current = rat.Current;
				Type obj = current.GetType();
				object obj2 = type;
				if (obj2 == null)
				{
					obj2 = AccessTools.TypeByName("DiskCardGame.BoardManager+<ChooseSlot>d__75") ?? AccessTools.TypeByName("DiskCardGame.BoardManager+<ChooseSlot>d__81");
					type = (Type)obj2;
				}
				if (obj == (Type?)obj2)
				{
					List<CardSlot> emptySlots = Singleton<BoardManager>.Instance.PlayerSlotsCopy.FindAll((CardSlot x) => (Object)(object)x.Card == (Object)null || (((Component)x.Card).GetComponentInChildren<MergeBase>()?.CanMergeWith(x.Card)).GetValueOrDefault() || (((Component)card).GetComponentInChildren<PlaceAboveBase>()?.CanPlaceAbove(x.Card)).GetValueOrDefault());
					yield return Singleton<BoardManager>.Instance.ChooseSlot(emptySlots, ((Card)card).Info.BloodCost <= 0);
					continue;
				}
				Type obj3 = current.GetType();
				object obj4 = placeType;
				if (obj4 == null)
				{
					obj4 = AccessTools.TypeByName("DiskCardGame.PlayerHand+<PlayCardOnSlot>d__37") ?? AccessTools.TypeByName("DiskCardGame.PlayerHand+<PlayCardOnSlot>d__36");
					placeType = (Type)obj4;
				}
				if (obj3 == (Type?)obj4)
				{
					CardSlot slot = Singleton<BoardManager>.Instance.LastSelectedSlot;
					CS$<>8__locals1.merge = null;
					CS$<>8__locals1.placeAbove = null;
					if ((Object)(object)slot != (Object)null && (Object)(object)slot.Card != (Object)null && (Object)(object)slot.Card != (Object)null && (Object)(object)((Component)slot.Card).GetComponentInChildren<MergeBase>() != (Object)null)
					{
						CS$<>8__locals1.merge = ((Component)slot.Card).GetComponentInChildren<MergeBase>();
					}
					int num;
					if ((Object)(object)slot != (Object)null)
					{
						PlayableCard obj5 = card;
						num = (((Object)(object)((obj5 != null) ? ((Component)obj5).GetComponentInChildren<PlaceAboveBase>() : null) != (Object)null) ? 1 : 0);
					}
					else
					{
						num = 0;
					}
					if (num != 0)
					{
						PlayableCard obj6 = card;
						CS$<>8__locals1.placeAbove = ((obj6 != null) ? ((Component)obj6).GetComponentInChildren<PlaceAboveBase>() : null);
					}
					CS$<>8__locals1.slotCard = slot.Card;
					CS$<>8__locals1.hasMerge = false;
					CS$<>8__locals1.hasPlaceAbove = false;
					UpdateValues();
					if (CS$<>8__locals1.hasMerge)
					{
						MergeBase[] componentsInChildren = ((Component)CS$<>8__locals1.slotCard).GetComponentsInChildren<MergeBase>();
						foreach (MergeBase merge3 in componentsInChildren)
						{
							UpdateValues();
							if (CS$<>8__locals1.hasMerge)
							{
								GlobalTriggerHandler instance = Singleton<GlobalTriggerHandler>.Instance;
								int stackSize = instance.StackSize;
								instance.StackSize = stackSize + 1;
								yield return merge3.OnPreMerge(card);
								GlobalTriggerHandler instance2 = Singleton<GlobalTriggerHandler>.Instance;
								stackSize = instance2.StackSize;
								instance2.StackSize = stackSize - 1;
							}
						}
					}
					UpdateValues();
					if (CS$<>8__locals1.hasPlaceAbove)
					{
						PlaceAboveBase[] componentsInChildren2 = ((Component)card).GetComponentsInChildren<PlaceAboveBase>();
						foreach (PlaceAboveBase placeAbove3 in componentsInChildren2)
						{
							UpdateValues();
							if (CS$<>8__locals1.hasPlaceAbove)
							{
								GlobalTriggerHandler instance3 = Singleton<GlobalTriggerHandler>.Instance;
								int stackSize = instance3.StackSize;
								instance3.StackSize = stackSize + 1;
								yield return placeAbove3.OnPrePlaceAbove(CS$<>8__locals1.slotCard);
								GlobalTriggerHandler instance4 = Singleton<GlobalTriggerHandler>.Instance;
								stackSize = instance4.StackSize;
								instance4.StackSize = stackSize - 1;
							}
						}
					}
					yield return current;
					UpdateValues();
					if (CS$<>8__locals1.hasMerge)
					{
						MergeBase[] componentsInChildren3 = ((Component)CS$<>8__locals1.slotCard).GetComponentsInChildren<MergeBase>();
						foreach (MergeBase merge2 in componentsInChildren3)
						{
							UpdateValues();
							if (CS$<>8__locals1.hasMerge)
							{
								GlobalTriggerHandler instance5 = Singleton<GlobalTriggerHandler>.Instance;
								int stackSize = instance5.StackSize;
								instance5.StackSize = stackSize + 1;
								yield return merge2.OnMerge(card);
								GlobalTriggerHandler instance6 = Singleton<GlobalTriggerHandler>.Instance;
								stackSize = instance6.StackSize;
								instance6.StackSize = stackSize - 1;
							}
						}
					}
					UpdateValues();
					if (CS$<>8__locals1.hasPlaceAbove)
					{
						PlaceAboveBase[] componentsInChildren4 = ((Component)card).GetComponentsInChildren<PlaceAboveBase>();
						foreach (PlaceAboveBase placeAbove2 in componentsInChildren4)
						{
							UpdateValues();
							if (CS$<>8__locals1.hasPlaceAbove)
							{
								GlobalTriggerHandler instance7 = Singleton<GlobalTriggerHandler>.Instance;
								int stackSize = instance7.StackSize;
								instance7.StackSize = stackSize + 1;
								yield return placeAbove2.OnPostPlaceAbove(CS$<>8__locals1.slotCard);
								GlobalTriggerHandler instance8 = Singleton<GlobalTriggerHandler>.Instance;
								stackSize = instance8.StackSize;
								instance8.StackSize = stackSize - 1;
							}
						}
					}
					CS$<>8__locals1 = default(<>c__DisplayClass0_1);
				}
				else
				{
					yield return current;
				}
				void UpdateValues()
				{
					CS$<>8__locals1.hasMerge = (Object)(object)CS$<>8__locals1.merge != (Object)null;
					CS$<>8__locals1.hasPlaceAbove = (Object)(object)CS$<>8__locals1.placeAbove != (Object)null && (Object)(object)CS$<>8__locals1.slotCard != (Object)null;
				}
			}
		}
	}
}
namespace InscryptionMod.Abilities
{
	public abstract class MergeBase : AbilityBehaviour
	{
		public abstract IEnumerator OnPreMerge(PlayableCard mergeCard);

		public abstract IEnumerator OnMerge(PlayableCard mergeCard);

		public virtual bool CanMergeWith(PlayableCard mergeCard)
		{
			return true;
		}
	}
	public abstract class MergeKillOther : MergeBase
	{
		public virtual bool IsActualDeath => true;

		public sealed override IEnumerator OnMerge(PlayableCard mergeCard)
		{
			yield return OnPreMergeDeath(mergeCard);
			if (mergeCard.Dead)
			{
				yield break;
			}
			if (IsActualDeath)
			{
				CardSlot prevSlot2 = (((Object)(object)((AbilityBehaviour)this).Card != (Object)null && !((AbilityBehaviour)this).Card.Dead) ? mergeCard.slot : null);
				if ((Object)(object)prevSlot2 != (Object)null)
				{
					prevSlot2.Card = ((AbilityBehaviour)this).Card;
					((AbilityBehaviour)this).Card.Slot = prevSlot2;
				}
				yield return mergeCard.Die(false, (PlayableCard)null, true);
				if ((Object)(object)prevSlot2 != (Object)null && (Object)(object)((AbilityBehaviour)this).Card != (Object)null && !((AbilityBehaviour)this).Card.Dead)
				{
					prevSlot2.Card = ((AbilityBehaviour)this).Card;
					((AbilityBehaviour)this).Card.Slot = prevSlot2;
				}
				yield break;
			}
			CardSlot prevSlot = (((Object)(object)((AbilityBehaviour)this).Card != (Object)null && !((AbilityBehaviour)this).Card.Dead) ? mergeCard.slot : null);
			if ((Object)(object)prevSlot != (Object)null)
			{
				prevSlot.Card = ((AbilityBehaviour)this).Card;
				((AbilityBehaviour)this).Card.Slot = prevSlot;
			}
			mergeCard.Dead = true;
			mergeCard.UnassignFromSlot();
			((MonoBehaviour)mergeCard).StartCoroutine(mergeCard.DestroyWhenStackIsClear());
			if ((Object)(object)prevSlot != (Object)null && (Object)(object)((AbilityBehaviour)this).Card != (Object)null && !((AbilityBehaviour)this).Card.Dead)
			{
				prevSlot.Card = ((AbilityBehaviour)this).Card;
				((AbilityBehaviour)this).Card.Slot = prevSlot;
			}
		}

		public sealed override IEnumerator OnPreMerge(PlayableCard mergeCard)
		{
			CustomCoroutine.WaitThenExecute(0.025f, (Action)delegate
			{
				//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_0042: Unknown result type (might be due to invalid IL or missing references)
				//IL_0047: Unknown result type (might be due to invalid IL or missing references)
				//IL_007f: Unknown result type (might be due to invalid IL or missing references)
				Tween.Stop(((Object)((Component)mergeCard).transform).GetInstanceID(), (TweenType)0);
				Tween.Position(((Component)mergeCard).transform, ((Component)((AbilityBehaviour)this).Card).transform.position + Vector3.up * 0.2f, 0.1f, 0f, (AnimationCurve)null, (LoopType)0, (Action)null, (Action)null, true);
				if (!IsActualDeath)
				{
					Tween.LocalScale(((Component)this).transform, Vector3.zero, 0.1f, 0f, (AnimationCurve)null, (LoopType)0, (Action)null, (Action)null, true);
				}
			}, false);
			yield return OnPreCreatureMerge(mergeCard);
		}

		public abstract IEnumerator OnPreCreatureMerge(PlayableCard mergeCard);

		public abstract IEnumerator OnPreMergeDeath(PlayableCard mergeCard);
	}
	public abstract class MergeKillSelf : MergeBase
	{
		public virtual bool IsActualDeath => false;

		public sealed override IEnumerator OnMerge(PlayableCard mergeCard)
		{
			yield return OnPreMergeDeath(mergeCard);
			if (!((AbilityBehaviour)this).Card.Dead)
			{
				if (IsActualDeath)
				{
					yield return ((AbilityBehaviour)this).Card.Die(false, (PlayableCard)null, true);
					yield break;
				}
				((AbilityBehaviour)this).Card.Dead = true;
				((AbilityBehaviour)this).Card.UnassignFromSlot();
				((MonoBehaviour)((AbilityBehaviour)this).Card).StartCoroutine(((AbilityBehaviour)this).Card.DestroyWhenStackIsClear());
			}
		}

		public sealed override IEnumerator OnPreMerge(PlayableCard mergeCard)
		{
			if (!IsActualDeath)
			{
				Tween.LocalScale(((Component)this).transform, Vector3.zero, 0.2f, 0f, (AnimationCurve)null, (LoopType)0, (Action)null, (Action)null, true);
			}
			else
			{
				Tween.Position(((Component)this).transform, ((Component)this).transform.position - Vector3.up * -0.02f, 0.1f, 0f, (AnimationCurve)null, (LoopType)0, (Action)null, (Action)null, true);
			}
			yield return OnPreCreatureMerge(mergeCard);
		}

		public abstract IEnumerator OnPreCreatureMerge(PlayableCard mergeCard);

		public abstract IEnumerator OnPreMergeDeath(PlayableCard mergeCard);
	}
	public abstract class PlaceAboveBase : AbilityBehaviour
	{
		public virtual bool CanPlaceAbove(PlayableCard card)
		{
			return card.CanBeSacrificed;
		}

		public abstract IEnumerator OnPrePlaceAbove(PlayableCard placeAboveCard);

		public abstract IEnumerator OnPostPlaceAbove(PlayableCard placeAboveCard);
	}
	public abstract class PlaceAboveKillOther : PlaceAboveBase
	{
		public virtual bool IsActualDeath => false;

		public sealed override IEnumerator OnPostPlaceAbove(PlayableCard placeAboveCard)
		{
			yield return OnPrePlaceAboveDeath(placeAboveCard);
			if (!placeAboveCard.Dead)
			{
				if (IsActualDeath)
				{
					yield return placeAboveCard.Die(false, (PlayableCard)null, true);
					yield break;
				}
				placeAboveCard.Dead = true;
				placeAboveCard.UnassignFromSlot();
				((MonoBehaviour)placeAboveCard).StartCoroutine(placeAboveCard.DestroyWhenStackIsClear());
			}
		}

		public sealed override IEnumerator OnPrePlaceAbove(PlayableCard placeAboveCard)
		{
			if (!IsActualDeath)
			{
				Tween.LocalScale(((Component)placeAboveCard).transform, Vector3.zero, 0.2f, 0f, (AnimationCurve)null, (LoopType)0, (Action)null, (Action)null, true);
			}
			else
			{
				Tween.Position(((Component)placeAboveCard).transform, ((Component)placeAboveCard).transform.position + Vector3.up * -0.02f, 0.1f, 0f, (AnimationCurve)null, (LoopType)0, (Action)null, (Action)null, true);
			}
			yield return OnPreCreaturePlaceAbove(placeAboveCard);
		}

		public abstract IEnumerator OnPreCreaturePlaceAbove(PlayableCard placeAboveCard);

		public abstract IEnumerator OnPrePlaceAboveDeath(PlayableCard placeAboveCard);
	}
	public abstract class PlaceAboveKillSelf : PlaceAboveBase
	{
		public virtual bool IsActualDeath => true;

		public sealed override IEnumerator OnPostPlaceAbove(PlayableCard placeAboveCard)
		{
			yield return OnPrePlaceAboveDeath(placeAboveCard);
			if (((AbilityBehaviour)this).Card.Dead)
			{
				yield break;
			}
			if (IsActualDeath)
			{
				CardSlot prevSlot2 = (((Object)(object)placeAboveCard != (Object)null && !placeAboveCard.Dead) ? ((AbilityBehaviour)this).Card.slot : null);
				if ((Object)(object)prevSlot2 != (Object)null)
				{
					prevSlot2.Card = placeAboveCard;
					placeAboveCard.Slot = prevSlot2;
				}
				yield return ((AbilityBehaviour)this).Card.Die(false, (PlayableCard)null, true);
				if ((Object)(object)prevSlot2 != (Object)null && (Object)(object)placeAboveCard != (Object)null && !placeAboveCard.Dead)
				{
					prevSlot2.Card = placeAboveCard;
					placeAboveCard.Slot = prevSlot2;
				}
				yield break;
			}
			CardSlot prevSlot = (((Object)(object)placeAboveCard != (Object)null && !placeAboveCard.Dead) ? ((AbilityBehaviour)this).Card.slot : null);
			if ((Object)(object)prevSlot != (Object)null)
			{
				prevSlot.Card = placeAboveCard;
				placeAboveCard.Slot = prevSlot;
			}
			((AbilityBehaviour)this).Card.Dead = true;
			((AbilityBehaviour)this).Card.UnassignFromSlot();
			((MonoBehaviour)((AbilityBehaviour)this).Card).StartCoroutine(((AbilityBehaviour)this).Card.DestroyWhenStackIsClear());
			if ((Object)(object)prevSlot != (Object)null && (Object)(object)placeAboveCard != (Object)null && !placeAboveCard.Dead)
			{
				prevSlot.Card = placeAboveCard;
				placeAboveCard.Slot = prevSlot;
			}
		}

		public sealed override IEnumerator OnPrePlaceAbove(PlayableCard placeAboveCard)
		{
			CustomCoroutine.WaitThenExecute(0.025f, (Action)delegate
			{
				//IL_0038: Unknown result type (might be due to invalid IL or missing references)
				//IL_003d: 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_004c: Unknown result type (might be due to invalid IL or missing references)
				//IL_0084: Unknown result type (might be due to invalid IL or missing references)
				Tween.Stop(((Object)((Component)((AbilityBehaviour)this).Card).transform).GetInstanceID(), (TweenType)0);
				Tween.Position(((Component)((AbilityBehaviour)this).Card).transform, ((Component)placeAboveCard).transform.position + Vector3.up * 0.2f, 0.1f, 0f, (AnimationCurve)null, (LoopType)0, (Action)null, (Action)null, true);
				if (!IsActualDeath)
				{
					Tween.LocalScale(((Component)this).transform, Vector3.zero, 0.1f, 0f, (AnimationCurve)null, (LoopType)0, (Action)null, (Action)null, true);
				}
			}, false);
			yield return OnPreCreaturePlaceAbove(placeAboveCard);
		}

		public abstract IEnumerator OnPreCreaturePlaceAbove(PlayableCard mergeCard);

		public abstract IEnumerator OnPrePlaceAboveDeath(PlayableCard mergeCard);
	}
}

plugins/The_Unwanted_but_Useful_Libraries-Unused_Sigils_Disabler_by_Void_Slime/plugins/sigilManager.dll

Decompiled 5 months ago
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using BepInEx;
using BepInEx.Configuration;
using BepInEx.Logging;
using DiskCardGame;
using HarmonyLib;
using UnityEngine;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: TargetFramework(".NETStandard,Version=v2.0", FrameworkDisplayName = "")]
[assembly: AssemblyCompany("sigilManager")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyDescription("a plugin designed to help manage sigils.")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("sigilManager")]
[assembly: AssemblyTitle("sigilManager")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.0.0")]
[module: UnverifiableCode]
namespace sigilManager;

[BepInPlugin("zzzzVoid.inscryption.sigil_patcher", "Void's Sigil Manager", "3.0.0")]
public class Plugin : BaseUnityPlugin
{
	[HarmonyPatch(typeof(LoadingScreenManager), "LoadGameData")]
	public class LoadingScreenManager_LoadGameData
	{
		public static void Postfix()
		{
			if (configHideUnuseAbilities.Value)
			{
				SigilHider.HideUnuseSigils();
			}
		}
	}

	public const string PluginGuid = "zzzzVoid.inscryption.sigil_patcher";

	private const string PluginName = "Void's Sigil Manager";

	private const string PluginVersion = "3.0.0";

	internal static ConfigEntry<bool> configHideUnuseAbilities;

	internal static ConfigEntry<bool> configAddAllSigilsToAct1;

	internal static ConfigEntry<string> configList;

	public static string Directory;

	internal static ManualLogSource Log;

	private void Awake()
	{
		//IL_0010: Unknown result type (might be due to invalid IL or missing references)
		//IL_0064: Unknown result type (might be due to invalid IL or missing references)
		//IL_006a: Expected O, but got Unknown
		//IL_0075: Unknown result type (might be due to invalid IL or missing references)
		//IL_007b: Expected O, but got Unknown
		Log = ((BaseUnityPlugin)this).Logger;
		new Harmony("zzzzVoid.inscryption.sigil_patcher").PatchAll();
		configAddAllSigilsToAct1 = ((BaseUnityPlugin)this).Config.Bind<bool>("Add All sigils to act 1", "Add All sigils to Act 1", true, "Should all sigils be added to the act 1 rulebook? This is ran before Hide unused Abilities.");
		configHideUnuseAbilities = ((BaseUnityPlugin)this).Config.Bind<bool>("Hide Unused Abilities", "Hide Unused Abilities", true, "Should the sigil manager go thru all abilities on cards, and hide those not used? Off by default.");
		ConfigDefinition val = new ConfigDefinition("Whitelist to Prevent Abilities from being Hidden", "Whitelist");
		ConfigDescription val2 = new ConfigDescription("Items on this list will not be removed from the rulebook. Put the RULEBOOK names seperated by a comma, like in the example below. Do not remove the default values, as those are there to prevent other sigils from breaking.", (AcceptableValueBase)null, Array.Empty<object>());
		configList = ((BaseUnityPlugin)this).Config.Bind<string>(val, "BeesOnHit, CreateDams, DrawRabbits, Flying", val2);
	}

	private void Start()
	{
		//IL_003d: 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)
		if (!configAddAllSigilsToAct1.Value)
		{
			return;
		}
		List<CardInfo> allData = ScriptableObjectLoader<CardInfo>.AllData;
		List<AbilityInfo> allData2 = ScriptableObjectLoader<AbilityInfo>.AllData;
		List<Ability> list = new List<Ability>();
		for (int i = 0; i < allData.Count; i++)
		{
			CardInfo val = allData[i];
			for (int j = 0; j < val.DefaultAbilities.Count; j++)
			{
				list.Add(val.DefaultAbilities[j]);
			}
		}
		for (int k = 0; k < allData2.Count; k++)
		{
			if (list.Contains(allData2[k].ability) && !allData2[k].metaCategories.Contains((AbilityMetaCategory)0) && (Object)(object)allData2[k].pixelIcon != (Object)null)
			{
				allData2[k].metaCategories.Add((AbilityMetaCategory)0);
			}
		}
	}
}
internal class SigilHider
{
	public static void HideUnuseSigils()
	{
		//IL_0030: Unknown result type (might be due to invalid IL or missing references)
		//IL_00e3: 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)
		List<CardInfo> allData = ScriptableObjectLoader<CardInfo>.AllData;
		List<AbilityInfo> allData2 = ScriptableObjectLoader<AbilityInfo>.AllData;
		List<Ability> list = new List<Ability>();
		for (int i = 0; i < allData.Count; i++)
		{
			CardInfo val = allData[i];
			for (int j = 0; j < val.DefaultAbilities.Count; j++)
			{
				list.Add(val.DefaultAbilities[j]);
			}
		}
		string[] array = Plugin.configList.Value.Split(new char[1] { ',' });
		for (int k = 0; k < allData2.Count; k++)
		{
			string rulebookName = allData2[k].rulebookName;
			for (int l = 0; l < array.Length; l++)
			{
				if (array[l] == rulebookName)
				{
					Plugin.Log.LogWarning((object)("Found config to not hide the following ability: " + rulebookName));
					list.Add(allData2[k].ability);
				}
			}
			if (!list.Contains(allData2[k].ability))
			{
				allData2[k].metaCategories.Clear();
				allData2[k].powerLevel = -10;
				allData2[k].opponentUsable = false;
				Plugin.Log.LogMessage((object)("Did not find the following ability on any card, hiding it: " + allData2[k].rulebookName));
			}
		}
	}
}
public static class PluginInfo
{
	public const string PLUGIN_GUID = "sigilManager";

	public const string PLUGIN_NAME = "sigilManager";

	public const string PLUGIN_VERSION = "1.0.0";
}

plugins/TVFLabs-CustomSideDeck/plugins/CustomSideDeck.dll

Decompiled 5 months ago
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using BepInEx;
using BepInEx.Bootstrap;
using CustomSideDeck.Info;
using DiskCardGame;
using GBC;
using HarmonyLib;
using InscryptionAPI.Ascension;
using InscryptionAPI.Card;
using InscryptionAPI.Guid;
using InscryptionAPI.Helpers;
using InscryptionAPI.Saves;
using UnityEngine;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: TargetFramework(".NETStandard,Version=v2.0", FrameworkDisplayName = "")]
[assembly: AssemblyCompany("CustomSideDeck")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyDescription("Allows changing the side deck to something other than squirrels")]
[assembly: AssemblyFileVersion("1.1.0.0")]
[assembly: AssemblyInformationalVersion("1.1.0")]
[assembly: AssemblyProduct("CustomSideDeck")]
[assembly: AssemblyTitle("CustomSideDeck")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.1.0.0")]
[module: UnverifiableCode]
namespace CustomSideDeck
{
	[BepInPlugin("tvflabs.inscryption.CustomSideDeck", "CustomSideDeck", "1.2.0")]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	public class Plugin : BaseUnityPlugin
	{
		public class Part1CardDrawPiles_SideDeckData_Patch
		{
			public static void Register(Harmony harmony)
			{
				harmony.PatchAll(typeof(Part1CardDrawPiles_SideDeckData_Patch));
			}

			[HarmonyPatch(/*Could not decode attribute arguments.*/)]
			[HarmonyPostfix]
			public static void OnSideDeckData(ref List<CardInfo> __result)
			{
				List<CardInfo> sideDeckCards = SideDeckCards;
				__result = sideDeckCards;
			}
		}

		public class AscensionStartScreen_ContinueGameSequence_Patch
		{
			public static void Register(Harmony harmony)
			{
				harmony.PatchAll(typeof(AscensionStartScreen_ContinueGameSequence_Patch));
			}

			[HarmonyPatch(typeof(AscensionStartScreen), "ContinueGameSequence")]
			[HarmonyPostfix]
			public static void OnContinueGameSequence()
			{
				if (alreadyInitialized)
				{
					return;
				}
				if (Chainloader.PluginInfos.ContainsKey("zorro.inscryption.infiniscryption.sidedecks"))
				{
					foreach (CardInfo item in CardManager.AllCardsCopy.Where((CardInfo c) => CardExtensions.HasCardMetaCategory(c, GuidManager.GetEnumValue<CardMetaCategory>("zorro.inscryption.infiniscryption.sidedecks", "SideDeck"))))
					{
						if ((!CardExtensions.GetExtendedPropertyAsBool(item, "CSDIsSideDeck")).GetValueOrDefault())
						{
							SideDeckInfo sideDeckInfo = null;
							sideDeckInfo = SideDeckManager.New(CardExtensions.GetModPrefix(item), ((Object)item).name, "Basic", new List<string>(), new List<string>(), ((Object)item).name);
							CardExtensions.SetExtendedProperty(item, "CSDAssociatedSideDeck", (object)sideDeckInfo.internalName);
						}
					}
				}
				foreach (CardInfo item2 in CardManager.AllCardsCopy.Where((CardInfo c) => CardExtensions.GetExtendedPropertyAsBool(c, "CSDIsSideDeck").GetValueOrDefault()))
				{
					SideDeckInfo sideDeckInfo2 = null;
					if (CardExtensions.GetExtendedProperty(item2, "CSDSideDeckType").ToLower() == "basic")
					{
						sideDeckInfo2 = SideDeckManager.New(CardExtensions.GetModPrefix(item2), ((Object)item2).name, "Basic", new List<string>(), new List<string>(), ((Object)item2).name);
					}
					else if (CardExtensions.GetExtendedProperty(item2, "CSDSideDeckType").ToLower() == "setcount")
					{
						sideDeckInfo2 = SideDeckManager.New(CardExtensions.GetModPrefix(item2), ((Object)item2).name, "SetCount", new List<string>(), new List<string>(), ((Object)item2).name, CardExtensions.GetExtendedPropertyAsInt(item2, "CSDNumCards") ?? 10);
					}
					else if (CardExtensions.GetExtendedProperty(item2, "CSDSideDeckType").ToLower() == "configurable")
					{
						List<string> list = new List<string>();
						for (int i = 0; i < CardExtensions.GetExtendedPropertyAsInt(item2, "CSDNumOptions").GetValueOrDefault(); i++)
						{
							list.Add(CardExtensions.GetExtendedProperty(item2, $"CSDOption{i + 1}"));
						}
						sideDeckInfo2 = SideDeckManager.New(CardExtensions.GetModPrefix(item2), ((Object)item2).name, "Configurable", new List<string>(), list, ((Object)item2).name, CardExtensions.GetExtendedPropertyAsInt(item2, "CSDNumCards") ?? 10);
					}
					else if (CardExtensions.GetExtendedProperty(item2, "CSDSideDeckType").ToLower() == "advanced")
					{
						List<string> list2 = new List<string>();
						for (int j = 0; j < CardExtensions.GetExtendedPropertyAsInt(item2, "CSDNumOptions").GetValueOrDefault(); j++)
						{
							list2.Add(CardExtensions.GetExtendedProperty(item2, $"CSDOption{j + 1}"));
						}
						List<string> list3 = new List<string>();
						for (int k = 0; k < (CardExtensions.GetExtendedPropertyAsInt(item2, "CSDNumCards") ?? 1); k++)
						{
							list3.Add(CardExtensions.GetExtendedProperty(item2, $"CSDCard{k + 1}"));
						}
						sideDeckInfo2 = SideDeckManager.New(CardExtensions.GetModPrefix(item2), ((Object)item2).name, "Advanced", list3, list2, ((Object)item2).name, CardExtensions.GetExtendedPropertyAsInt(item2, "CSDNumCards") ?? 10);
					}
					else
					{
						sideDeckInfo2 = SideDeckManager.New(CardExtensions.GetModPrefix(item2), ((Object)item2).name, "Basic", new List<string>(), new List<string>(), ((Object)item2).name);
					}
					CardExtensions.SetExtendedProperty(item2, "CSDAssociatedSideDeck", (object)sideDeckInfo2.internalName);
				}
				alreadyInitialized = true;
			}
		}

		[AscensionScreenSort(/*Could not decode attribute arguments.*/)]
		public class SideDeckSelectionScreen : AscensionRunSetupScreenBase
		{
			private GameObject selectedBorder;

			public static SideDeckSelectionScreen Instance;

			public int scrollIndex = 0;

			public override string headerText => "Select Side Deck";

			public override bool showCardDisplayer => true;

			public override bool showCardPanel => true;

			public override void InitializeScreen(GameObject partialScreen)
			{
				//IL_0034: Unknown result type (might be due to invalid IL or missing references)
				GameObject val = Resources.Load<GameObject>("prefabs/gbcui/pixelselectionborder");
				GameObject val2 = Object.Instantiate<GameObject>(val, ((Component)base.cards[0]).gameObject.transform);
				val2.GetComponent<SpriteRenderer>().color = GameColors.Instance.brightNearWhite;
				val2.AddComponent<PixelSnapElement>();
				selectedBorder = val2;
				Instance = this;
			}

			public override void CardClicked(PixelSelectableCard card)
			{
				if ((Object)(object)card != (Object)null && (Object)(object)((Card)card).Info != (Object)null)
				{
					CurrentSideDeck = SideDeckManager.GetSideDeckByName(CardExtensions.GetExtendedProperty(((Card)card).Info, "CSDAssociatedSideDeck"));
					ShowPage();
				}
			}

			public override void OnEnable()
			{
				((AscensionRunSetupScreenBase)this).OnEnable();
				if (!alreadyInitialized)
				{
					if (Chainloader.PluginInfos.ContainsKey("zorro.inscryption.infiniscryption.sidedecks"))
					{
						foreach (CardInfo item in CardManager.AllCardsCopy.Where((CardInfo c) => CardExtensions.HasCardMetaCategory(c, GuidManager.GetEnumValue<CardMetaCategory>("zorro.inscryption.infiniscryption.sidedecks", "SideDeck"))))
						{
							if ((!CardExtensions.GetExtendedPropertyAsBool(item, "CSDIsSideDeck")).GetValueOrDefault())
							{
								SideDeckInfo sideDeckInfo = null;
								sideDeckInfo = SideDeckManager.New(CardExtensions.GetModPrefix(item), ((Object)item).name, "Basic", new List<string>(), new List<string>(), ((Object)item).name);
								CardExtensions.SetExtendedProperty(item, "CSDAssociatedSideDeck", (object)sideDeckInfo.internalName);
							}
						}
					}
					foreach (CardInfo item2 in CardManager.AllCardsCopy.Where((CardInfo c) => CardExtensions.GetExtendedPropertyAsBool(c, "CSDIsSideDeck").GetValueOrDefault()))
					{
						SideDeckInfo sideDeckInfo2 = null;
						if (CardExtensions.GetExtendedProperty(item2, "CSDSideDeckType").ToLower() == "basic")
						{
							sideDeckInfo2 = SideDeckManager.New(CardExtensions.GetModPrefix(item2), ((Object)item2).name, "Basic", new List<string>(), new List<string>(), ((Object)item2).name);
						}
						else if (CardExtensions.GetExtendedProperty(item2, "CSDSideDeckType").ToLower() == "setcount")
						{
							sideDeckInfo2 = SideDeckManager.New(CardExtensions.GetModPrefix(item2), ((Object)item2).name, "SetCount", new List<string>(), new List<string>(), ((Object)item2).name, CardExtensions.GetExtendedPropertyAsInt(item2, "CSDNumCards") ?? 10);
						}
						else if (CardExtensions.GetExtendedProperty(item2, "CSDSideDeckType").ToLower() == "configurable")
						{
							List<string> list = new List<string>();
							for (int i = 0; i < CardExtensions.GetExtendedPropertyAsInt(item2, "CSDNumOptions").GetValueOrDefault(); i++)
							{
								list.Add(CardExtensions.GetExtendedProperty(item2, $"CSDOption{i + 1}"));
							}
							sideDeckInfo2 = SideDeckManager.New(CardExtensions.GetModPrefix(item2), ((Object)item2).name, "Configurable", new List<string>(), list, ((Object)item2).name, CardExtensions.GetExtendedPropertyAsInt(item2, "CSDNumCards") ?? 10);
						}
						else if (CardExtensions.GetExtendedProperty(item2, "CSDSideDeckType").ToLower() == "advanced")
						{
							List<string> list2 = new List<string>();
							for (int j = 0; j < CardExtensions.GetExtendedPropertyAsInt(item2, "CSDNumOptions").GetValueOrDefault(); j++)
							{
								list2.Add(CardExtensions.GetExtendedProperty(item2, $"CSDOption{j + 1}"));
							}
							List<string> list3 = new List<string>();
							for (int k = 0; k < (CardExtensions.GetExtendedPropertyAsInt(item2, "CSDNumCards") ?? 1); k++)
							{
								list3.Add(CardExtensions.GetExtendedProperty(item2, $"CSDCard{k + 1}"));
							}
							sideDeckInfo2 = SideDeckManager.New(CardExtensions.GetModPrefix(item2), ((Object)item2).name, "Advanced", list3, list2, ((Object)item2).name, CardExtensions.GetExtendedPropertyAsInt(item2, "CSDNumCards") ?? 10);
						}
						else
						{
							sideDeckInfo2 = SideDeckManager.New(CardExtensions.GetModPrefix(item2), ((Object)item2).name, "Basic", new List<string>(), new List<string>(), ((Object)item2).name);
						}
						CardExtensions.SetExtendedProperty(item2, "CSDAssociatedSideDeck", (object)sideDeckInfo2.internalName);
					}
					alreadyInitialized = true;
				}
				ShowPage();
				((AscensionRunSetupScreenBase)this).CardClicked(base.cards[0]);
			}

			public void ShowPage()
			{
				List<CardInfo> list = new List<CardInfo>();
				foreach (SideDeckInfo sideDecks in SideDeckManager.sideDecksList)
				{
					list.Add(CardLoader.GetCardByName(sideDecks.defaultCard));
				}
				((AscensionRunSetupScreenBase)this).ShowCards(list.GetRange(scrollIndex, Math.Min(list.Count, 6)));
				foreach (PixelSelectableCard card in base.cards)
				{
					if (CardExtensions.GetExtendedProperty(((Card)card).Info, "CSDAssociatedSideDeck") == CurrentSideDeck.internalName)
					{
						selectedBorder.SetActive(true);
						selectedBorder.transform.SetParent(((Component)card).transform.Find("Base/PixelSnap"), false);
						break;
					}
					selectedBorder.SetActive(false);
				}
			}

			public override void LeftButtonClicked(MainInputInteractable button)
			{
				if (scrollIndex > 0)
				{
					scrollIndex--;
					ShowPage();
				}
			}

			public override void RightButtonClicked(MainInputInteractable button)
			{
				if (scrollIndex < SideDeckManager.sideDecksList.Count - 6)
				{
					scrollIndex++;
					ShowPage();
				}
			}
		}

		[AscensionScreenSort(/*Could not decode attribute arguments.*/)]
		public class SideDeckConfigurationScreen : AscensionRunSetupScreenBase
		{
			public static SideDeckConfigurationScreen Instance;

			public bool isAdvanced = false;

			public List<CardInfo> confCards;

			public int scrollIndex = 0;

			public override string headerText => "Configure Side Deck";

			public override bool showCardDisplayer => true;

			public override bool showCardPanel => true;

			public override void InitializeScreen(GameObject partialScreen)
			{
				Instance = this;
			}

			public override void CardClicked(PixelSelectableCard card)
			{
				if (!((Object)(object)card != (Object)null) || !((Object)(object)((Card)card).Info != (Object)null))
				{
					return;
				}
				int index = confCards.IndexOf(((Card)card).Info);
				string extendedProperty = CardExtensions.GetExtendedProperty(((Card)card).Info, "ConfIndex");
				confCards.RemoveAt(index);
				for (int i = 0; i <= CurrentSideDeck.options.Count; i++)
				{
					if (((Object)((Card)card).Info).name == CurrentSideDeck.options[i])
					{
						if (i == CurrentSideDeck.options.Count - 1)
						{
							((Card)card).SetInfo(CardExtensions.SetExtendedProperty(CardLoader.GetCardByName(CurrentSideDeck.options[0]), "ConfIndex", (object)extendedProperty));
						}
						else
						{
							((Card)card).SetInfo(CardExtensions.SetExtendedProperty(CardLoader.GetCardByName(CurrentSideDeck.options[i + 1]), "ConfIndex", (object)extendedProperty));
						}
						break;
					}
				}
				confCards.Insert(index, ((Card)card).Info);
				int num = 0;
				foreach (CardInfo confCard in confCards)
				{
					SetConfCard(((Object)confCard).name, num);
					num++;
				}
				ShowPage();
			}

			public override void OnEnable()
			{
				int num = 0;
				if (CurrentSideDeck.csdType == "Advanced")
				{
					isAdvanced = true;
					for (int i = 1; i <= CurrentSideDeck.cards.Count; i++)
					{
						if (!Utility.IsNullOrWhiteSpace(CurrentSideDeck.cards[i - 1]) && (CurrentSideDeck.cards[i - 1] == "conf" || CurrentSideDeck.cards[i - 1] == "c"))
						{
							num++;
						}
					}
				}
				else if (CurrentSideDeck.options.Count > 0)
				{
					num = CurrentSideDeck.numCards;
				}
				if (CurrentSideDeck.options.Count == 0 || num == 0)
				{
					Singleton<AscensionMenuScreens>.Instance.TransitionToGame(true);
				}
				((AscensionRunSetupScreenBase)this).OnEnable();
				confCards = new List<CardInfo>();
				if (isAdvanced)
				{
					for (int j = 1; j <= num; j++)
					{
						confCards.Add(CardLoader.GetCardByName(CurrentSideDeck.options[0]));
					}
				}
				else
				{
					for (int k = 1; k <= CurrentSideDeck.numCards; k++)
					{
						confCards.Add(CardLoader.GetCardByName(CurrentSideDeck.options[0]));
					}
				}
				int num2 = 0;
				foreach (CardInfo confCard in confCards)
				{
					SetConfCard(((Object)confCard).name, num2);
					num2++;
				}
				ShowPage();
			}

			public void ShowPage()
			{
				((AscensionRunSetupScreenBase)this).ShowCards(confCards.GetRange(scrollIndex, Math.Min(confCards.Count, 6)));
			}

			public override void LeftButtonClicked(MainInputInteractable button)
			{
				if (scrollIndex > 0)
				{
					scrollIndex--;
					ShowPage();
				}
			}

			public override void RightButtonClicked(MainInputInteractable button)
			{
				if (scrollIndex < confCards.Count - 6)
				{
					scrollIndex++;
					ShowPage();
				}
			}
		}

		private const string PluginGuid = "tvflabs.inscryption.CustomSideDeck";

		private const string PluginName = "CustomSideDeck";

		private const string PluginVersion = "1.2.0";

		private static bool alreadyInitialized;

		public static List<CardInfo> SideDeckCards
		{
			get
			{
				List<CardInfo> list = new List<CardInfo>();
				if (CurrentSideDeck.csdType != "Advanced")
				{
					for (int i = 0; i < CurrentSideDeck.numCards; i++)
					{
						if (CurrentSideDeck.options.Count > 0)
						{
							list.Add(CardLoader.GetCardByName(GetConfCards()[i]));
						}
						else
						{
							list.Add(CardLoader.GetCardByName(CurrentSideDeck.defaultCard));
						}
					}
				}
				else
				{
					int num = 0;
					foreach (string card in CurrentSideDeck.cards)
					{
						if (card == "conf")
						{
							list.Add(CardLoader.GetCardByName(GetConfCards()[num]));
							num++;
						}
						else if (card == "def" || card == "self")
						{
							CardLoader.GetCardByName(CurrentSideDeck.defaultCard);
						}
						else
						{
							list.Add(CardLoader.GetCardByName(card));
						}
					}
				}
				return list;
			}
		}

		public static SideDeckInfo CurrentSideDeck
		{
			get
			{
				string value = ModdedSaveManager.SaveData.GetValue("tvflabs.inscryption.CustomSideDeck", "CurrentSideDeck");
				if (string.IsNullOrEmpty(value))
				{
					return SideDeckManager.GetSideDeckByName("CustomSideDeck_Squirrels");
				}
				return SideDeckManager.GetSideDeckByName(value);
			}
			set
			{
				ModdedSaveManager.SaveData.SetValue("tvflabs.inscryption.CustomSideDeck", "CurrentSideDeck", (object)value.internalName);
			}
		}

		private void Awake()
		{
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			//IL_000c: Expected O, but got Unknown
			Harmony harmony = new Harmony("tvflabs.inscryption.CustomSideDeck");
			Part1CardDrawPiles_SideDeckData_Patch.Register(harmony);
			AscensionStartScreen_ContinueGameSequence_Patch.Register(harmony);
			AscensionScreenManager.RegisterScreen<SideDeckSelectionScreen>();
			AscensionScreenManager.RegisterScreen<SideDeckConfigurationScreen>();
			RegisterSideDecks();
			((BaseUnityPlugin)this).Logger.LogInfo((object)"Loaded CustomSideDeck!");
		}

		private void RegisterSideDecks()
		{
			SideDeckManager.New("CustomSideDeck", "Squirrels", "Basic", new List<string>(), new List<string>(), "Squirrel");
			CardExtensions.SetExtendedProperty(CardLoader.GetCardByName("Squirrel"), "CSDAssociatedSideDeck", (object)"CustomSideDeck_Squirrels");
			SideDeckManager.New("CustomSideDeck", "Bees", "Basic", new List<string>(), new List<string>(), "Bee");
			CardExtensions.SetExtendedProperty(CardLoader.GetCardByName("Bee"), "CSDAssociatedSideDeck", (object)"CustomSideDeck_Bees");
			CardExtensions.SetPixelPortrait(CardLoader.GetCardByName("Bee"), TextureHelper.GetImageAsSprite("pixelportrait_bee.png", (SpriteType)1, (FilterMode)0));
			SideDeckManager.New("CustomSideDeck", "AquaSquirrels", "Basic", new List<string>(), new List<string>(), "AquaSquirrel");
			CardExtensions.SetExtendedProperty(CardLoader.GetCardByName("AquaSquirrel"), "CSDAssociatedSideDeck", (object)"CustomSideDeck_AquaSquirrels");
			CardExtensions.SetPixelPortrait(CardLoader.GetCardByName("AquaSquirrel"), TextureHelper.GetImageAsSprite("pixelportrait_aquasquirrel.png", (SpriteType)1, (FilterMode)0));
		}

		public static List<string> GetConfCards()
		{
			List<string> list = new List<string>();
			if (CurrentSideDeck.csdType != "Advanced")
			{
				if (CurrentSideDeck.options.Count > 0)
				{
					for (int i = 0; i < CurrentSideDeck.numCards; i++)
					{
						list.Add(ModdedSaveManager.SaveData.GetValue("tvflabs.inscryption.CustomSideDeck", $"ConfCard{i}"));
					}
				}
			}
			else
			{
				int num = 0;
				foreach (string card in CurrentSideDeck.cards)
				{
					if (card == "conf")
					{
						list.Add(ModdedSaveManager.SaveData.GetValue("tvflabs.inscryption.CustomSideDeck", $"ConfCard{num}"));
						num++;
					}
				}
			}
			return list;
		}

		public static void SetConfCard(string card, int cardNum)
		{
			ModdedSaveManager.SaveData.SetValue("tvflabs.inscryption.CustomSideDeck", $"ConfCard{cardNum}", (object)card);
		}
	}
	internal class SideDeckIcon : MainInputInteractable
	{
		public SideDeckInfo Info;

		private Plugin.SideDeckSelectionScreen ScreenParent => ((Component)this).GetComponentInParent<Plugin.SideDeckSelectionScreen>();

		protected override bool CollisionIs2D => true;

		protected override void OnCursorEnter()
		{
			((AscensionRunSetupScreenBase)ScreenParent).DisplayCardInfo((CardInfo)null, Localization.Translate(Info.displayName), Info.description + $"\nContains {Info.cards.Count} cards", false);
		}

		protected override void OnCursorExit()
		{
			((AscensionRunSetupScreenBase)ScreenParent).ClearMessage();
		}
	}
	public static class SideDeckManager
	{
		public static List<SideDeckInfo> sideDecksList = new List<SideDeckInfo>();

		public static SideDeckInfo New(string modPrefix, string name, string csdType, List<string> cards, List<string> options, string defaultCard, int numCards = 10, string cardBack = null, string pixelCardBack = null)
		{
			SideDeckInfo sideDeckInfo = new SideDeckInfo();
			sideDeckInfo.internalName = modPrefix + "_" + name;
			sideDeckInfo.numCards = numCards;
			sideDeckInfo.defaultCard = defaultCard;
			sideDeckInfo.cards = new List<string>();
			sideDeckInfo.options = new List<string>();
			sideDeckInfo.csdType = csdType;
			foreach (string card in cards)
			{
				sideDeckInfo.cards.Add(card);
			}
			foreach (string option in options)
			{
				sideDeckInfo.options.Add(option);
			}
			sideDecksList.Add(sideDeckInfo);
			return sideDeckInfo;
		}

		public static SideDeckInfo GetSideDeckByName(string name)
		{
			return sideDecksList.Find((SideDeckInfo sideDeck) => sideDeck.internalName == name);
		}
	}
	public static class PluginInfo
	{
		public const string PLUGIN_GUID = "CustomSideDeck";

		public const string PLUGIN_NAME = "CustomSideDeck";

		public const string PLUGIN_VERSION = "1.1.0";
	}
}
namespace CustomSideDeck.Info
{
	public class SideDeckInfo
	{
		public string internalName;

		public string displayName;

		public string description;

		public string csdType;

		public int numCards;

		public string defaultCard;

		public List<string> cards;

		public List<string> options;

		public string cardBack;

		public string pixelCardBack;
	}
}

plugins/TVFLabs-StarterSideDecks/plugins/StarterSideDecks.dll

Decompiled 5 months ago
using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using BepInEx;
using DiskCardGame;
using InscryptionAPI.Card;
using InscryptionAPI.Helpers;
using UnityEngine;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: TargetFramework(".NETStandard,Version=v2.0", FrameworkDisplayName = "")]
[assembly: AssemblyCompany("StarterSideDecks")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyDescription("Adds a side deck to go along with each starter deck")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("StarterSideDecks")]
[assembly: AssemblyTitle("StarterSideDecks")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.0.0")]
[module: UnverifiableCode]
namespace CardLoaderMod
{
	public static class PluginInfo
	{
		public const string PLUGIN_GUID = "StarterSideDecks";

		public const string PLUGIN_NAME = "StarterSideDecks";

		public const string PLUGIN_VERSION = "1.0.0";
	}
}
namespace StarterSideDecks
{
	[BepInPlugin("tvflabs.inscryption.StarterSideDecks", "StarterSideDecks", "1.0.0")]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	public class Plugin : BaseUnityPlugin
	{
		public class StrugglingSacrificeAbility : AbilityBehaviour
		{
			public static Ability ability;

			public override Ability Ability => ability;

			public override bool RespondsToSacrifice()
			{
				return true;
			}

			public override IEnumerator OnSacrifice()
			{
				yield return Singleton<LifeManager>.Instance.ShowDamageSequence(((AbilityBehaviour)this).Card.Attack, ((AbilityBehaviour)this).Card.Attack, true, 0.125f, (GameObject)null, 0f, true);
				yield return (object)new WaitForSeconds(0.5f);
				Singleton<ViewManager>.Instance.SwitchToView((View)1, false, false);
			}
		}

		public class FledglingAntAbility : AbilityBehaviour
		{
			public static Ability ability;

			public override Ability Ability => ability;

			public override bool RespondsToUpkeep(bool playerUpkeep)
			{
				return playerUpkeep;
			}

			public override IEnumerator OnUpkeep(bool playerUpkeep)
			{
				List<CardInfo> evolveOptions = new List<CardInfo>();
				int evolveDecider = Random.Range(1, 4);
				string evolveCardName;
				if (evolveDecider == 1)
				{
					foreach (CardInfo card in CardManager.AllCardsCopy)
					{
						if ((int)card.SpecialStatIcon == 1 && card.metaCategories.Contains((CardMetaCategory)0) && (int)card.temple == 0)
						{
							evolveOptions.Add(card);
						}
					}
					evolveCardName = ((evolveOptions.Count <= 0) ? "Ant" : ((Object)evolveOptions[Random.Range(0, evolveOptions.Count)]).name);
				}
				else
				{
					evolveCardName = "Ant";
				}
				if ((Object)(object)Singleton<BoardManager>.Instance.PlayerSlotsCopy[0].Card != (Object)null && ((Object)((Card)Singleton<BoardManager>.Instance.PlayerSlotsCopy[0].Card).Info).name == "AntQueen")
				{
					CardInfo evolution = CardLoader.GetCardByName(evolveCardName);
					foreach (CardModificationInfo cardModificationInfo in ((Card)((AbilityBehaviour)this).Card).Info.Mods.FindAll((CardModificationInfo x) => !x.nonCopyable))
					{
						CardModificationInfo cardModificationInfo6 = (CardModificationInfo)cardModificationInfo.Clone();
						if (cardModificationInfo6.HasAbility(((AbilityBehaviour)this).Ability))
						{
							cardModificationInfo6.abilities.Remove(((AbilityBehaviour)this).Ability);
						}
						evolution.Mods.Add(cardModificationInfo6);
					}
					yield return ((AbilityBehaviour)this).PreSuccessfulTriggerSequence();
					yield return ((AbilityBehaviour)this).Card.TransformIntoCard(evolution, (Action)RemoveTemporaryModsWithEvolve, (Action)null);
					yield return (object)new WaitForSeconds(0.5f);
				}
				else if ((Object)(object)Singleton<BoardManager>.Instance.PlayerSlotsCopy[1].Card != (Object)null && ((Object)((Card)Singleton<BoardManager>.Instance.PlayerSlotsCopy[1].Card).Info).name == "AntQueen")
				{
					CardInfo evolution4 = CardLoader.GetCardByName(evolveCardName);
					foreach (CardModificationInfo cardModificationInfo4 in ((Card)((AbilityBehaviour)this).Card).Info.Mods.FindAll((CardModificationInfo x) => !x.nonCopyable))
					{
						CardModificationInfo cardModificationInfo8 = (CardModificationInfo)cardModificationInfo4.Clone();
						if (cardModificationInfo8.HasAbility(((AbilityBehaviour)this).Ability))
						{
							cardModificationInfo8.abilities.Remove(((AbilityBehaviour)this).Ability);
						}
						evolution4.Mods.Add(cardModificationInfo8);
					}
					yield return ((AbilityBehaviour)this).PreSuccessfulTriggerSequence();
					yield return ((AbilityBehaviour)this).Card.TransformIntoCard(evolution4, (Action)RemoveTemporaryModsWithEvolve, (Action)null);
					yield return (object)new WaitForSeconds(0.5f);
				}
				else if ((Object)(object)Singleton<BoardManager>.Instance.PlayerSlotsCopy[2].Card != (Object)null && ((Object)((Card)Singleton<BoardManager>.Instance.PlayerSlotsCopy[2].Card).Info).name == "AntQueen")
				{
					CardInfo evolution3 = CardLoader.GetCardByName(evolveCardName);
					foreach (CardModificationInfo cardModificationInfo3 in ((Card)((AbilityBehaviour)this).Card).Info.Mods.FindAll((CardModificationInfo x) => !x.nonCopyable))
					{
						CardModificationInfo cardModificationInfo7 = (CardModificationInfo)cardModificationInfo3.Clone();
						if (cardModificationInfo7.HasAbility(((AbilityBehaviour)this).Ability))
						{
							cardModificationInfo7.abilities.Remove(((AbilityBehaviour)this).Ability);
						}
						evolution3.Mods.Add(cardModificationInfo7);
					}
					yield return ((AbilityBehaviour)this).PreSuccessfulTriggerSequence();
					yield return ((AbilityBehaviour)this).Card.TransformIntoCard(evolution3, (Action)RemoveTemporaryModsWithEvolve, (Action)null);
					yield return (object)new WaitForSeconds(0.5f);
				}
				else
				{
					if (!((Object)(object)Singleton<BoardManager>.Instance.PlayerSlotsCopy[3].Card != (Object)null) || !(((Object)((Card)Singleton<BoardManager>.Instance.PlayerSlotsCopy[3].Card).Info).name == "AntQueen"))
					{
						yield break;
					}
					CardInfo evolution2 = CardLoader.GetCardByName(evolveCardName);
					foreach (CardModificationInfo cardModificationInfo2 in ((Card)((AbilityBehaviour)this).Card).Info.Mods.FindAll((CardModificationInfo x) => !x.nonCopyable))
					{
						CardModificationInfo cardModificationInfo5 = (CardModificationInfo)cardModificationInfo2.Clone();
						if (cardModificationInfo5.HasAbility(((AbilityBehaviour)this).Ability))
						{
							cardModificationInfo5.abilities.Remove(((AbilityBehaviour)this).Ability);
						}
						evolution2.Mods.Add(cardModificationInfo5);
					}
					yield return ((AbilityBehaviour)this).PreSuccessfulTriggerSequence();
					yield return ((AbilityBehaviour)this).Card.TransformIntoCard(evolution2, (Action)RemoveTemporaryModsWithEvolve, (Action)null);
					yield return (object)new WaitForSeconds(0.5f);
				}
			}

			private void RemoveTemporaryModsWithEvolve()
			{
				//IL_0012: Unknown result type (might be due to invalid IL or missing references)
				if (!((Card)((AbilityBehaviour)this).Card).Info.Abilities.Contains(((AbilityBehaviour)this).Ability))
				{
					for (CardModificationInfo temporaryEvolveMod = GetTemporaryEvolveMod(); temporaryEvolveMod != null; temporaryEvolveMod = GetTemporaryEvolveMod())
					{
						((AbilityBehaviour)this).Card.RemoveTemporaryMod(temporaryEvolveMod, true);
					}
				}
			}

			private CardModificationInfo GetTemporaryEvolveMod()
			{
				return ((AbilityBehaviour)this).Card.TemporaryMods.Find((CardModificationInfo x) => x.abilities.Contains(((AbilityBehaviour)this).Ability));
			}
		}

		public class HatchAbility : AbilityBehaviour
		{
			public static Ability ability;

			public override Ability Ability => ability;

			public override bool RespondsToDie(bool wasSacrifice, PlayableCard killer)
			{
				return !wasSacrifice;
			}

			public override bool RespondsToUpkeep(bool playerUpkeep)
			{
				return playerUpkeep;
			}

			public override IEnumerator OnDie(bool wasSacrifice, PlayableCard killer)
			{
				CardInfo evolution = ((!Utility.IsNullOrWhiteSpace(CardExtensions.GetExtendedProperty(((Card)((AbilityBehaviour)this).Card).Info, "HatchIntoCard"))) ? CardLoader.GetCardByName(CardExtensions.GetExtendedProperty(((Card)((AbilityBehaviour)this).Card).Info, "HatchIntoCard")) : CardLoader.GetCardByName("Sparrow"));
				foreach (CardModificationInfo cardModificationInfo in ((Card)((AbilityBehaviour)this).Card).Info.Mods.FindAll((CardModificationInfo x) => !x.nonCopyable))
				{
					CardModificationInfo cardModificationInfo2 = (CardModificationInfo)cardModificationInfo.Clone();
					if (cardModificationInfo2.HasAbility(((AbilityBehaviour)this).Ability))
					{
						cardModificationInfo2.abilities.Remove(((AbilityBehaviour)this).Ability);
					}
					evolution.Mods.Add(cardModificationInfo2);
				}
				yield return ((AbilityBehaviour)this).PreSuccessfulTriggerSequence();
				yield return ((AbilityBehaviour)this).Card.TransformIntoCard(evolution, (Action)RemoveTemporaryModsWithEvolve, (Action)null);
				yield return (object)new WaitForSeconds(0.5f);
			}

			public override IEnumerator OnUpkeep(bool playerUpkeep)
			{
				CardInfo evolution = ((!Utility.IsNullOrWhiteSpace(CardExtensions.GetExtendedProperty(((Card)((AbilityBehaviour)this).Card).Info, "HatchIntoCard"))) ? CardLoader.GetCardByName(CardExtensions.GetExtendedProperty(((Card)((AbilityBehaviour)this).Card).Info, "HatchIntoCard")) : CardLoader.GetCardByName("Sparrow"));
				foreach (CardModificationInfo cardModificationInfo in ((Card)((AbilityBehaviour)this).Card).Info.Mods.FindAll((CardModificationInfo x) => !x.nonCopyable))
				{
					CardModificationInfo cardModificationInfo2 = (CardModificationInfo)cardModificationInfo.Clone();
					if (cardModificationInfo2.HasAbility(((AbilityBehaviour)this).Ability))
					{
						cardModificationInfo2.abilities.Remove(((AbilityBehaviour)this).Ability);
					}
					evolution.Mods.Add(cardModificationInfo2);
				}
				yield return ((AbilityBehaviour)this).PreSuccessfulTriggerSequence();
				yield return ((AbilityBehaviour)this).Card.TransformIntoCard(evolution, (Action)RemoveTemporaryModsWithEvolve, (Action)null);
				yield return (object)new WaitForSeconds(0.5f);
			}

			private void RemoveTemporaryModsWithEvolve()
			{
				//IL_0012: Unknown result type (might be due to invalid IL or missing references)
				if (!((Card)((AbilityBehaviour)this).Card).Info.Abilities.Contains(((AbilityBehaviour)this).Ability))
				{
					for (CardModificationInfo temporaryEvolveMod = GetTemporaryEvolveMod(); temporaryEvolveMod != null; temporaryEvolveMod = GetTemporaryEvolveMod())
					{
						((AbilityBehaviour)this).Card.RemoveTemporaryMod(temporaryEvolveMod, true);
					}
				}
			}

			private CardModificationInfo GetTemporaryEvolveMod()
			{
				return ((AbilityBehaviour)this).Card.TemporaryMods.Find((CardModificationInfo x) => x.abilities.Contains(((AbilityBehaviour)this).Ability));
			}
		}

		public class ShortLivedAbility : AbilityBehaviour
		{
			public static Ability ability;

			public override Ability Ability => ability;

			public override bool RespondsToUpkeep(bool playerUpkeep)
			{
				return playerUpkeep;
			}

			public override IEnumerator OnUpkeep(bool playerUpkeep)
			{
				yield return ((AbilityBehaviour)this).PreSuccessfulTriggerSequence();
				yield return ((AbilityBehaviour)this).Card.Die(false, (PlayableCard)null, true);
			}
		}

		public class AwakenDeityAbility : SpecialCardBehaviour
		{
			public static SpecialTriggeredAbility ability;

			public override bool RespondsToOtherCardResolve(PlayableCard otherCard)
			{
				return ((Object)otherCard).name == "MantisGod";
			}

			public override bool RespondsToDrawn()
			{
				return true;
			}

			public override IEnumerator OnOtherCardResolve(PlayableCard otherCard)
			{
				CardInfo evolution = CardLoader.GetCardByName("tvflabs.inscryption.StarterSideDecks_MantisGodEgg");
				foreach (CardModificationInfo cardModificationInfo in ((SpecialCardBehaviour)this).Card.Info.Mods.FindAll((CardModificationInfo x) => !x.nonCopyable))
				{
					CardModificationInfo cardModificationInfo2 = (CardModificationInfo)cardModificationInfo.Clone();
					evolution.Mods.Add(cardModificationInfo2);
				}
				yield return ((SpecialCardBehaviour)this).PlayableCard.TransformIntoCard(evolution, (Action)null, (Action)null);
				yield return (object)new WaitForSeconds(0.5f);
			}

			public override IEnumerator OnDrawn()
			{
				if ((Object)(object)Singleton<BoardManager>.Instance.PlayerSlotsCopy[0].Card != (Object)null && ((Object)((Card)Singleton<BoardManager>.Instance.PlayerSlotsCopy[0].Card).Info).name == "MantisGod")
				{
					CardInfo evolution = CardLoader.GetCardByName("tvflabs.inscryption.StarterSideDecks_MantisGodEgg");
					foreach (CardModificationInfo cardModificationInfo in ((SpecialCardBehaviour)this).Card.Info.Mods.FindAll((CardModificationInfo x) => !x.nonCopyable))
					{
						CardModificationInfo cardModificationInfo6 = (CardModificationInfo)cardModificationInfo.Clone();
						evolution.Mods.Add(cardModificationInfo6);
					}
					yield return ((SpecialCardBehaviour)this).PlayableCard.TransformIntoCard(evolution, (Action)null, (Action)null);
					yield return (object)new WaitForSeconds(0.5f);
				}
				else if ((Object)(object)Singleton<BoardManager>.Instance.PlayerSlotsCopy[1].Card != (Object)null && ((Object)((Card)Singleton<BoardManager>.Instance.PlayerSlotsCopy[1].Card).Info).name == "MantisGod")
				{
					CardInfo evolution2 = CardLoader.GetCardByName("tvflabs.inscryption.StarterSideDecks_MantisGodEgg");
					foreach (CardModificationInfo cardModificationInfo2 in ((SpecialCardBehaviour)this).Card.Info.Mods.FindAll((CardModificationInfo x) => !x.nonCopyable))
					{
						CardModificationInfo cardModificationInfo7 = (CardModificationInfo)cardModificationInfo2.Clone();
						evolution2.Mods.Add(cardModificationInfo7);
					}
					yield return ((SpecialCardBehaviour)this).PlayableCard.TransformIntoCard(evolution2, (Action)null, (Action)null);
					yield return (object)new WaitForSeconds(0.5f);
				}
				else if ((Object)(object)Singleton<BoardManager>.Instance.PlayerSlotsCopy[2].Card != (Object)null && ((Object)((Card)Singleton<BoardManager>.Instance.PlayerSlotsCopy[2].Card).Info).name == "MantisGod")
				{
					CardInfo evolution4 = CardLoader.GetCardByName("tvflabs.inscryption.StarterSideDecks_MantisGodEgg");
					foreach (CardModificationInfo cardModificationInfo4 in ((SpecialCardBehaviour)this).Card.Info.Mods.FindAll((CardModificationInfo x) => !x.nonCopyable))
					{
						CardModificationInfo cardModificationInfo8 = (CardModificationInfo)cardModificationInfo4.Clone();
						evolution4.Mods.Add(cardModificationInfo8);
					}
					yield return ((SpecialCardBehaviour)this).PlayableCard.TransformIntoCard(evolution4, (Action)null, (Action)null);
					yield return (object)new WaitForSeconds(0.5f);
				}
				else
				{
					if (!((Object)(object)Singleton<BoardManager>.Instance.PlayerSlotsCopy[3].Card != (Object)null) || !(((Object)((Card)Singleton<BoardManager>.Instance.PlayerSlotsCopy[3].Card).Info).name == "MantisGod"))
					{
						yield break;
					}
					CardInfo evolution3 = CardLoader.GetCardByName("tvflabs.inscryption.StarterSideDecks_MantisGodEgg");
					foreach (CardModificationInfo cardModificationInfo3 in ((SpecialCardBehaviour)this).Card.Info.Mods.FindAll((CardModificationInfo x) => !x.nonCopyable))
					{
						CardModificationInfo cardModificationInfo5 = (CardModificationInfo)cardModificationInfo3.Clone();
						evolution3.Mods.Add(cardModificationInfo5);
					}
					yield return ((SpecialCardBehaviour)this).PlayableCard.TransformIntoCard(evolution3, (Action)null, (Action)null);
					yield return (object)new WaitForSeconds(0.5f);
				}
			}
		}

		private const string PluginGuid = "tvflabs.inscryption.StarterSideDecks";

		private const string PluginName = "StarterSideDecks";

		private const string PluginVersion = "1.0.0";

		private void Awake()
		{
			RegisterAbilites();
			RegisterCards();
			((BaseUnityPlugin)this).Logger.LogInfo((object)"Loaded StarterSideDecks!");
		}

		private static void RegisterAbilites()
		{
			//IL_0053: Unknown result type (might be due to invalid IL or missing references)
			//IL_0058: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a8: 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_00fd: Unknown result type (might be due to invalid IL or missing references)
			//IL_0102: Unknown result type (might be due to invalid IL or missing references)
			//IL_0152: Unknown result type (might be due to invalid IL or missing references)
			//IL_0157: Unknown result type (might be due to invalid IL or missing references)
			//IL_0179: Unknown result type (might be due to invalid IL or missing references)
			//IL_017e: Unknown result type (might be due to invalid IL or missing references)
			AbilityInfo val = AbilityManager.New("tvflabs.inscryption.StarterSideDecks", "Struggling Sacrifice", "When [creature] is sacrificed, it deals damage equal to its attack power to its owner.", typeof(StrugglingSacrificeAbility), "ability_StrugglingSacrifice.png");
			val.canStack = true;
			val.pixelIcon = TextureHelper.GetImageAsSprite("pixelability_StrugglingSacrifice.png", (SpriteType)2, (FilterMode)0);
			val.powerLevel = 0;
			AbilityExtensions.AddMetaCategories(val, (AbilityMetaCategory[])(object)new AbilityMetaCategory[1]);
			StrugglingSacrificeAbility.ability = val.ability;
			AbilityInfo val2 = AbilityManager.New("tvflabs.inscryption.StarterSideDecks", "Fledgling Ant", "If there is an Ant Queen on its owner's side of the board, [creature] will grow into a more powerful form after 1 turn on the board.", typeof(FledglingAntAbility), "ability_FledglingAnt.png");
			val2.pixelIcon = TextureHelper.GetImageAsSprite("pixelability_FledglingAnt.png", (SpriteType)2, (FilterMode)0);
			val2.powerLevel = 1;
			AbilityExtensions.AddMetaCategories(val2, (AbilityMetaCategory[])(object)new AbilityMetaCategory[1]);
			FledglingAntAbility.ability = val2.ability;
			AbilityInfo val3 = AbilityManager.New("tvflabs.inscryption.StarterSideDecks", "Hatch", "At the beginning of your turn or when it perishes, [creature] will hatch into the creature inside.", typeof(HatchAbility), "ability_Hatch.png");
			val3.pixelIcon = TextureHelper.GetImageAsSprite("pixelability_Hatch.png", (SpriteType)2, (FilterMode)0);
			val3.powerLevel = 3;
			AbilityExtensions.AddMetaCategories(val3, (AbilityMetaCategory[])(object)new AbilityMetaCategory[1]);
			HatchAbility.ability = val3.ability;
			AbilityInfo val4 = AbilityManager.New("tvflabs.inscryption.StarterSideDecks", "Short-Lived", "At the beginning of your turn, [creature] perishes.", typeof(ShortLivedAbility), "ability_ShortLived.png");
			val4.pixelIcon = TextureHelper.GetImageAsSprite("pixelability_ShortLived.png", (SpriteType)2, (FilterMode)0);
			val4.powerLevel = 0;
			AbilityExtensions.AddMetaCategories(val4, (AbilityMetaCategory[])(object)new AbilityMetaCategory[1]);
			ShortLivedAbility.ability = val4.ability;
			FullSpecialTriggeredAbility val5 = SpecialTriggeredAbilityManager.Add("tvflabs.inscryption.StarterSideDecks", "Awaken Deity", typeof(AwakenDeityAbility));
			AwakenDeityAbility.ability = val5.Id;
		}

		private static void RegisterCards()
		{
			//IL_0027: Unknown result type (might be due to invalid IL or missing references)
			//IL_002d: Expected I4, but got Unknown
			//IL_002f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0035: Expected I4, but got Unknown
			//IL_004e: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d7: Expected I4, but got Unknown
			//IL_00f0: Unknown result type (might be due to invalid IL or missing references)
			//IL_0185: Unknown result type (might be due to invalid IL or missing references)
			//IL_018b: Expected I4, but got Unknown
			//IL_01a4: Unknown result type (might be due to invalid IL or missing references)
			//IL_0223: Unknown result type (might be due to invalid IL or missing references)
			//IL_0229: Expected I4, but got Unknown
			//IL_0242: Unknown result type (might be due to invalid IL or missing references)
			//IL_028b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0291: Expected I4, but got Unknown
			//IL_02ba: Unknown result type (might be due to invalid IL or missing references)
			//IL_02c0: Expected I4, but got Unknown
			//IL_02db: Unknown result type (might be due to invalid IL or missing references)
			//IL_0402: Unknown result type (might be due to invalid IL or missing references)
			//IL_047f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0485: Expected I4, but got Unknown
			//IL_048e: Unknown result type (might be due to invalid IL or missing references)
			//IL_052b: Unknown result type (might be due to invalid IL or missing references)
			CardInfo val = CardManager.New("tvflabs.inscryption.StarterSideDecks", "ScreamingGoat", "Screaming Goat", 1, 1, (string)null);
			CardExtensions.AddAbilities(val, (Ability[])(object)new Ability[3]
			{
				(Ability)22,
				(Ability)(int)StrugglingSacrificeAbility.ability,
				(Ability)(int)StrugglingSacrificeAbility.ability
			});
			CardExtensions.AddTribes(val, (Tribe[])(object)new Tribe[1] { (Tribe)4 });
			val.temple = (CardTemple)0;
			CardExtensions.SetTail(val, CardLoader.GetCardByName("Tail_Furry"), (IEnumerable<CardModificationInfo>)null);
			CardExtensions.SetPortrait(val, "portrait_ScreamingGoat.png");
			CardExtensions.SetPixelPortrait(val, "pixelportrait_ScreamingGoat.png");
			CardExtensions.SetExtendedProperty(val, "CSDIsSideDeck", (object)"true");
			CardExtensions.SetExtendedProperty(val, "CSDSideDeckType", (object)"SetCount");
			CardExtensions.SetExtendedProperty(val, "CSDNumCards", (object)"4");
			CardInfo val2 = CardManager.New("tvflabs.inscryption.StarterSideDecks", "AntLarva", "Ant Larva", 0, 1, (string)null);
			CardExtensions.AddAbilities(val2, (Ability[])(object)new Ability[1] { (Ability)(int)FledglingAntAbility.ability });
			CardExtensions.AddTribes(val2, (Tribe[])(object)new Tribe[1] { (Tribe)6 });
			val2.temple = (CardTemple)0;
			CardExtensions.SetTail(val2, CardLoader.GetCardByName("Tail_Insect"), (IEnumerable<CardModificationInfo>)null);
			CardExtensions.SetPortrait(val2, "portrait_AntLarva.png");
			CardExtensions.SetPixelPortrait(val2, "pixelportrait_AntLarva.png");
			CardExtensions.SetExtendedProperty(val2, "CSDIsSideDeck", (object)"true");
			CardExtensions.SetExtendedProperty(val2, "CSDSideDeckType", (object)"SetCount");
			CardExtensions.SetExtendedProperty(val2, "CSDNumCards", (object)"8");
			CardExtensions.AddTraits(val2, (Trait[])(object)new Trait[1] { (Trait)11 });
			CardInfo val3 = CardManager.New("tvflabs.inscryption.StarterSideDecks", "MantisGodEgg", "Awakened Egg", 0, 1, (string)null);
			CardExtensions.AddAbilities(val3, (Ability[])(object)new Ability[1] { (Ability)(int)HatchAbility.ability });
			CardExtensions.AddTribes(val3, (Tribe[])(object)new Tribe[1] { (Tribe)6 });
			val3.temple = (CardTemple)0;
			CardExtensions.SetTail(val3, CardLoader.GetCardByName("Tail_Insect"), (IEnumerable<CardModificationInfo>)null);
			CardExtensions.SetPortrait(val3, "portrait_UnidentifiedEgg.png");
			CardExtensions.SetEmissivePortrait(val3, "portrait_MantisGodEgg_emission.png");
			CardExtensions.AddAppearances(val3, (Appearance[])(object)new Appearance[1] { (Appearance)15 });
			CardExtensions.SetPixelPortrait(val3, "pixelportrait_UnidentifiedEgg.png");
			CardExtensions.SetExtendedProperty(val3, "HatchIntoCard", (object)"MantisGod");
			CardInfo val4 = CardManager.New("tvflabs.inscryption.StarterSideDecks", "MantisEgg", "Unidentified Egg", 0, 1, (string)null);
			CardExtensions.AddAbilities(val4, (Ability[])(object)new Ability[1] { (Ability)(int)HatchAbility.ability });
			CardExtensions.AddTribes(val4, (Tribe[])(object)new Tribe[1] { (Tribe)6 });
			val4.temple = (CardTemple)0;
			CardExtensions.SetTail(val4, CardLoader.GetCardByName("Tail_Insect"), (IEnumerable<CardModificationInfo>)null);
			CardExtensions.SetPortrait(val4, "portrait_UnidentifiedEgg.png");
			CardExtensions.SetPixelPortrait(val4, "pixelportrait_UnidentifiedEgg.png");
			CardExtensions.SetExtendedProperty(val4, "HatchIntoCard", (object)"Mantis");
			CardExtensions.AddSpecialAbilities(val4, (SpecialTriggeredAbility[])(object)new SpecialTriggeredAbility[1] { (SpecialTriggeredAbility)(int)AwakenDeityAbility.ability });
			CardInfo val5 = CardManager.New("tvflabs.inscryption.StarterSideDecks", "RingWormEgg", "Unidentified Egg", 0, 1, (string)null);
			CardExtensions.AddAbilities(val5, (Ability[])(object)new Ability[1] { (Ability)(int)HatchAbility.ability });
			CardExtensions.AddTribes(val5, (Tribe[])(object)new Tribe[1] { (Tribe)6 });
			val5.temple = (CardTemple)0;
			CardExtensions.SetTail(val5, CardLoader.GetCardByName("Tail_Insect"), (IEnumerable<CardModificationInfo>)null);
			CardExtensions.SetPortrait(val5, "portrait_UnidentifiedEgg.png");
			CardExtensions.SetPixelPortrait(val5, "pixelportrait_UnidentifiedEgg.png");
			CardExtensions.SetExtendedProperty(val5, "HatchIntoCard", (object)"RingWorm");
			CardExtensions.SetExtendedProperty(val5, "CSDIsSideDeck", (object)"true");
			CardExtensions.SetExtendedProperty(val5, "CSDSideDeckType", (object)"Advanced");
			CardExtensions.SetExtendedProperty(val5, "CSDNumCards", (object)"7");
			CardExtensions.SetExtendedProperty(val5, "CSDCard1", (object)"tvflabs.inscryption.StarterSideDecks_RingWormEgg");
			CardExtensions.SetExtendedProperty(val5, "CSDCard2", (object)"tvflabs.inscryption.StarterSideDecks_RingWormEgg");
			CardExtensions.SetExtendedProperty(val5, "CSDCard3", (object)"tvflabs.inscryption.StarterSideDecks_RingWormEgg");
			CardExtensions.SetExtendedProperty(val5, "CSDCard4", (object)"tvflabs.inscryption.StarterSideDecks_RingWormEgg");
			CardExtensions.SetExtendedProperty(val5, "CSDCard5", (object)"tvflabs.inscryption.StarterSideDecks_MantisEgg");
			CardExtensions.SetExtendedProperty(val5, "CSDCard6", (object)"tvflabs.inscryption.StarterSideDecks_MantisEgg");
			CardExtensions.SetExtendedProperty(val5, "CSDCard7", (object)"tvflabs.inscryption.StarterSideDecks_MantisEgg");
			CardInfo val6 = CardManager.New("tvflabs.inscryption.StarterSideDecks", "Minnow", "Minnow", 0, 1, (string)null);
			CardExtensions.AddAbilities(val6, (Ability[])(object)new Ability[1] { (Ability)13 });
			val6.temple = (CardTemple)0;
			CardExtensions.SetPortrait(val6, "portrait_Minnow.png");
			CardExtensions.SetPixelPortrait(val6, "pixelportrait_Minnow.png");
			CardExtensions.SetExtendedProperty(val6, "CSDIsSideDeck", (object)"true");
			CardExtensions.SetExtendedProperty(val6, "CSDSideDeckType", (object)"SetCount");
			CardExtensions.SetExtendedProperty(val6, "CSDNumCards", (object)"12");
			CardInfo val7 = CardManager.New("tvflabs.inscryption.StarterSideDecks", "FruitFly", "Fruit Fly", 0, 1, (string)null);
			CardExtensions.AddAbilities(val7, (Ability[])(object)new Ability[2]
			{
				(Ability)19,
				(Ability)(int)ShortLivedAbility.ability
			});
			val7.temple = (CardTemple)0;
			CardExtensions.AddTribes(val7, (Tribe[])(object)new Tribe[1] { (Tribe)6 });
			CardExtensions.SetPortrait(val7, "portrait_FruitFly.png");
			CardExtensions.SetPixelPortrait(val7, "pixelportrait_FruitFly.png");
			CardExtensions.SetExtendedProperty(val7, "CSDIsSideDeck", (object)"true");
			CardExtensions.SetExtendedProperty(val7, "CSDSideDeckType", (object)"SetCount");
			CardExtensions.SetExtendedProperty(val7, "CSDNumCards", (object)"9");
			CardInfo val8 = CardManager.New("tvflabs.inscryption.StarterSideDecks", "MagpiesNest", "Magpie's Nest", 0, 2, (string)null);
			CardExtensions.AddAbilities(val8, (Ability[])(object)new Ability[1] { (Ability)7 });
			CardExtensions.SetTerrain(val8);
			val8.temple = (CardTemple)0;
			CardExtensions.SetPortrait(val8, "portrait_MagpiesNest.png");
			CardExtensions.SetPixelPortrait(val8, "pixelportrait_MagpiesNest.png");
			CardExtensions.SetExtendedProperty(val8, "CSDIsSideDeck", (object)"true");
			CardExtensions.SetExtendedProperty(val8, "CSDSideDeckType", (object)"SetCount");
			CardExtensions.SetExtendedProperty(val8, "CSDNumCards", (object)"5");
		}
	}
}

plugins/Void_Slime-Eri_Encounter_Expansion/plugins/Eri_Encounters.dll

Decompiled 5 months ago
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using APIPlugin;
using BepInEx;
using BepInEx.Logging;
using DiskCardGame;
using ExtraEncounters.Encounters;
using UnityEngine;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: TargetFramework(".NETStandard,Version=v2.0", FrameworkDisplayName = "")]
[assembly: AssemblyCompany("Encounters")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyDescription("An encounter mod for Eris mod")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("Encounters")]
[assembly: AssemblyTitle("Encounters")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.0.0")]
[module: UnverifiableCode]
namespace Encounters
{
	public static class PluginInfo
	{
		public const string PLUGIN_GUID = "Encounters";

		public const string PLUGIN_NAME = "Encounters";

		public const string PLUGIN_VERSION = "1.0.0";
	}
}
namespace ExtraEncounters
{
	public class SigilUtils
	{
		public static AbilityInfo CreateInfoWithDefaultSettings(string rulebookName, string rulebookDescription, bool withDialogue = false, int powerLevel = 0)
		{
			AbilityInfo val = ScriptableObject.CreateInstance<AbilityInfo>();
			val.powerLevel = powerLevel;
			val.rulebookName = rulebookName;
			val.rulebookDescription = rulebookDescription;
			val.metaCategories = new List<AbilityMetaCategory>
			{
				(AbilityMetaCategory)1,
				(AbilityMetaCategory)0
			};
			if (withDialogue)
			{
				val.abilityLearnedDialogue = SetAbilityInfoDialogue(rulebookDescription.Replace("[creature]", "a card bearing this sigil"));
			}
			return val;
		}

		public static LineSet SetAbilityInfoDialogue(string dialogue)
		{
			//IL_0007: Unknown result type (might be due to invalid IL or missing references)
			//IL_000c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0018: Expected O, but got Unknown
			//IL_0019: Unknown result type (might be due to invalid IL or missing references)
			//IL_001f: Expected O, but got Unknown
			return new LineSet(new List<Line>
			{
				new Line
				{
					text = dialogue
				}
			});
		}

		public static Texture2D GetTextureFromPath(string path)
		{
			//IL_0014: Unknown result type (might be due to invalid IL or missing references)
			//IL_001a: Expected O, but got Unknown
			byte[] array = File.ReadAllBytes(Path.Combine(Plugin.Directory, path));
			Texture2D val = new Texture2D(2, 2);
			ImageConversion.LoadImage(val, array);
			return val;
		}

		public static Texture2D LoadTextureFromResource(byte[] resourceFile)
		{
			//IL_0003: Unknown result type (might be due to invalid IL or missing references)
			//IL_0009: Expected O, but got Unknown
			Texture2D val = new Texture2D(2, 2);
			ImageConversion.LoadImage(val, resourceFile);
			return val;
		}

		public static AbilityIdentifier GetAbilityId(string rulebookName)
		{
			return AbilityIdentifier.GetID("extraVoid.inscryption.ExtraEncounters", rulebookName);
		}

		public static string GetFullPathOfFile(string fileToLookFor)
		{
			return Directory.GetFiles(Paths.PluginPath, fileToLookFor, SearchOption.AllDirectories)[0];
		}

		public static byte[] ReadArtworkFileAsBytes(string nameOfCardArt)
		{
			return File.ReadAllBytes(GetFullPathOfFile(nameOfCardArt));
		}

		public static Texture2D LoadImageAndGetTexture(string nameOfCardArt)
		{
			//IL_0003: Unknown result type (might be due to invalid IL or missing references)
			//IL_0009: Expected O, but got Unknown
			Texture2D val = new Texture2D(2, 2);
			byte[] array = ReadArtworkFileAsBytes(nameOfCardArt);
			bool flag = ImageConversion.LoadImage(val, array);
			return val;
		}

		public static CardSlot GetSlot(PlayableCard cardToGetSlot)
		{
			if ((Object)(object)cardToGetSlot.Slot != (Object)null)
			{
				return cardToGetSlot.Slot;
			}
			CardSlot component = ((Component)((Component)cardToGetSlot).transform.parent).GetComponent<CardSlot>();
			if ((Object)(object)component != (Object)null)
			{
				return component;
			}
			int instanceID = ((Object)((Component)cardToGetSlot).gameObject).GetInstanceID();
			Plugin.Log.LogInfo((object)("[SplashDamageAbility][GetSlot] Getting slot for " + instanceID));
			List<CardSlot> list = new List<CardSlot>();
			list.AddRange(Singleton<BoardManager>.Instance.GetSlots(false));
			list.AddRange(Singleton<BoardManager>.Instance.GetSlots(true));
			for (int i = 0; i < list.Count; i++)
			{
				CardSlot val = list[i];
				if (val.Index != 2)
				{
					continue;
				}
				PlayableCard card = val.Card;
				if (!((Object)(object)card == (Object)null))
				{
					if ((Object)(object)((Component)card).gameObject == (Object)(object)((Component)cardToGetSlot).gameObject)
					{
						return val;
					}
					int instanceID2 = ((Object)((Component)card).gameObject).GetInstanceID();
				}
			}
			Plugin.Log.LogInfo((object)("[SplashDamageAbility][GetSlot] Could not find slot for " + instanceID));
			return null;
		}
	}
	[BepInPlugin("extraVoid.inscryption.ExtraEncounters", "Extra Encounters", "1.0.0")]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	public class Plugin : BaseUnityPlugin
	{
		public const string APIGUID = "cyantist.inscryption.api";

		public const string PluginGuid = "extraVoid.inscryption.ExtraEncounters";

		private const string PluginName = "Extra Encounters";

		private const string PluginVersion = "1.0.0";

		public static string Directory;

		internal static ManualLogSource Log;

		private void Awake()
		{
			Log = ((BaseUnityPlugin)this).Logger;
			Directory = ((BaseUnityPlugin)this).Info.Location.Replace("Encounters.dll", "");
		}

		private void Start()
		{
			ApeEscape.AddEncounter();
			EriAnt.AddEncounter();
			EriBird.AddEncounter();
			EriHooved.AddEncounter();
			EriWolf.AddEncounter();
			UndeadMarch.AddEncounter();
		}
	}
}
namespace ExtraEncounters.Encounters
{
	internal class ApeEscape
	{
		public static void AddEncounter()
		{
			//IL_0067: Unknown result type (might be due to invalid IL or missing references)
			//IL_006c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0081: Expected O, but got Unknown
			//IL_008b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0090: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a5: Expected O, but got Unknown
			//IL_00a8: 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_00c2: Expected O, but got Unknown
			//IL_00cc: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e6: Expected O, but got Unknown
			//IL_00f0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f5: Unknown result type (might be due to invalid IL or missing references)
			//IL_0105: Unknown result type (might be due to invalid IL or missing references)
			//IL_0112: Expected O, but got Unknown
			//IL_0115: Unknown result type (might be due to invalid IL or missing references)
			//IL_011a: 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)
			//IL_0137: Expected O, but got Unknown
			//IL_0141: Unknown result type (might be due to invalid IL or missing references)
			//IL_0146: Unknown result type (might be due to invalid IL or missing references)
			//IL_0156: Unknown result type (might be due to invalid IL or missing references)
			//IL_0163: Expected O, but got Unknown
			string text = "ApeEscape";
			string text2 = "Forest";
			List<Tribe> list = new List<Tribe>();
			List<Ability> list2 = new List<Ability>();
			bool flag = false;
			List<CardInfo> list3 = EncounterUtil.AddRandomCards("Wolf", "WolfCub");
			List<TurnModBlueprint> list4 = new List<TurnModBlueprint>();
			List<List<CardBlueprint>> list5 = new List<List<CardBlueprint>>();
			List<CardBlueprint> list6 = new List<CardBlueprint>();
			list6.Add(new CardBlueprint
			{
				card = CardLoader.GetCardByName("eri_Capuchin")
			});
			List<CardBlueprint> list7 = new List<CardBlueprint>();
			list7.Add(new CardBlueprint
			{
				card = CardLoader.GetCardByName("eri_Capuchin")
			});
			list7.Add(new CardBlueprint
			{
				card = CardLoader.GetCardByName("eri_Gorilla")
			});
			List<CardBlueprint> list8 = new List<CardBlueprint>();
			list8.Add(new CardBlueprint
			{
				card = CardLoader.GetCardByName("eri_Capuchin")
			});
			List<CardBlueprint> list9 = new List<CardBlueprint>();
			list9.Add(new CardBlueprint
			{
				card = CardLoader.GetCardByName("eri_Capuchin"),
				randomReplaceChance = 25
			});
			list9.Add(new CardBlueprint
			{
				card = CardLoader.GetCardByName("eri_Gorilla"),
				randomReplaceChance = 25
			});
			List<CardBlueprint> list10 = new List<CardBlueprint>();
			list10.Add(new CardBlueprint
			{
				card = CardLoader.GetCardByName("eri_Capuchin"),
				randomReplaceChance = 25
			});
			list5.Add(list6);
			list5.Add(list7);
			list5.Add(list8);
			list5.Add(list9);
			list5.Add(list10);
			NewEncounter.Add(text, text2, list4, list, list2, (List<CardInfo>)null, flag, 1, 30, list3, list5, true, false, 0);
		}
	}
	internal class EncounterUtil
	{
		public static List<List<CardBlueprint>> BuildEncounter(string turn1_1 = "none", string turn1_2 = "none", string turn2_1 = "none", string turn2_2 = "none", string turn3_1 = "none", string turn3_2 = "none", string turn4_1 = "none", string turn4_2 = "none", string turn5_1 = "none", string turn5_2 = "none", string turn6_1 = "none", string turn6_2 = "none", string turn7_1 = "none", string turn7_2 = "none", string turn8_1 = "none", string turn8_2 = "none", string turn9_1 = "none", string turn9_2 = "none")
		{
			//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_0030: Expected O, but got Unknown
			//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_005b: Expected O, but got Unknown
			//IL_0076: Unknown result type (might be due to invalid IL or missing references)
			//IL_007b: Unknown result type (might be due to invalid IL or missing references)
			//IL_008c: Expected O, but got Unknown
			//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_00b7: Expected O, but got Unknown
			//IL_00d3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d8: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ea: Expected O, but got Unknown
			//IL_0100: Unknown result type (might be due to invalid IL or missing references)
			//IL_0105: Unknown result type (might be due to invalid IL or missing references)
			//IL_0117: Expected O, but got Unknown
			//IL_0133: Unknown result type (might be due to invalid IL or missing references)
			//IL_0138: Unknown result type (might be due to invalid IL or missing references)
			//IL_014a: Expected O, but got Unknown
			//IL_0160: Unknown result type (might be due to invalid IL or missing references)
			//IL_0165: Unknown result type (might be due to invalid IL or missing references)
			//IL_0177: Expected O, but got Unknown
			//IL_0195: Unknown result type (might be due to invalid IL or missing references)
			//IL_019a: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ac: Expected O, but got Unknown
			//IL_01c3: Unknown result type (might be due to invalid IL or missing references)
			//IL_01c8: Unknown result type (might be due to invalid IL or missing references)
			//IL_01da: Expected O, but got Unknown
			//IL_01f8: Unknown result type (might be due to invalid IL or missing references)
			//IL_01fd: Unknown result type (might be due to invalid IL or missing references)
			//IL_020f: Expected O, but got Unknown
			//IL_0226: Unknown result type (might be due to invalid IL or missing references)
			//IL_022b: Unknown result type (might be due to invalid IL or missing references)
			//IL_023d: Expected O, but got Unknown
			//IL_025b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0260: Unknown result type (might be due to invalid IL or missing references)
			//IL_0272: Expected O, but got Unknown
			//IL_0289: Unknown result type (might be due to invalid IL or missing references)
			//IL_028e: Unknown result type (might be due to invalid IL or missing references)
			//IL_02a0: Expected O, but got Unknown
			//IL_02be: Unknown result type (might be due to invalid IL or missing references)
			//IL_02c3: Unknown result type (might be due to invalid IL or missing references)
			//IL_02d5: Expected O, but got Unknown
			//IL_02ec: Unknown result type (might be due to invalid IL or missing references)
			//IL_02f1: Unknown result type (might be due to invalid IL or missing references)
			//IL_0303: Expected O, but got Unknown
			//IL_0321: Unknown result type (might be due to invalid IL or missing references)
			//IL_0326: Unknown result type (might be due to invalid IL or missing references)
			//IL_0338: Expected O, but got Unknown
			//IL_034f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0354: Unknown result type (might be due to invalid IL or missing references)
			//IL_0366: Expected O, but got Unknown
			List<CardBlueprint> list = new List<CardBlueprint>();
			if (turn1_1 != "none")
			{
				list.Add(new CardBlueprint
				{
					card = CardLoader.GetCardByName(turn1_1)
				});
			}
			if (turn1_2 != "none")
			{
				list.Add(new CardBlueprint
				{
					card = CardLoader.GetCardByName(turn1_2)
				});
			}
			List<CardBlueprint> list2 = new List<CardBlueprint>();
			if (turn2_1 != "none")
			{
				list2.Add(new CardBlueprint
				{
					card = CardLoader.GetCardByName(turn2_1)
				});
			}
			if (turn2_2 != "none")
			{
				list2.Add(new CardBlueprint
				{
					card = CardLoader.GetCardByName(turn2_2)
				});
			}
			List<CardBlueprint> list3 = new List<CardBlueprint>();
			if (turn3_1 != "none")
			{
				list3.Add(new CardBlueprint
				{
					card = CardLoader.GetCardByName(turn3_1)
				});
			}
			if (turn3_2 != "none")
			{
				list3.Add(new CardBlueprint
				{
					card = CardLoader.GetCardByName(turn3_2)
				});
			}
			List<CardBlueprint> list4 = new List<CardBlueprint>();
			if (turn4_1 != "none")
			{
				list4.Add(new CardBlueprint
				{
					card = CardLoader.GetCardByName(turn4_1)
				});
			}
			if (turn4_2 != "none")
			{
				list4.Add(new CardBlueprint
				{
					card = CardLoader.GetCardByName(turn4_2)
				});
			}
			List<CardBlueprint> list5 = new List<CardBlueprint>();
			if (turn5_1 != "none")
			{
				list5.Add(new CardBlueprint
				{
					card = CardLoader.GetCardByName(turn5_1)
				});
			}
			if (turn5_2 != "none")
			{
				list5.Add(new CardBlueprint
				{
					card = CardLoader.GetCardByName(turn5_2)
				});
			}
			List<CardBlueprint> list6 = new List<CardBlueprint>();
			if (turn6_1 != "none")
			{
				list6.Add(new CardBlueprint
				{
					card = CardLoader.GetCardByName(turn6_1)
				});
			}
			if (turn6_2 != "none")
			{
				list6.Add(new CardBlueprint
				{
					card = CardLoader.GetCardByName(turn6_2)
				});
			}
			List<CardBlueprint> list7 = new List<CardBlueprint>();
			if (turn7_1 != "none")
			{
				list7.Add(new CardBlueprint
				{
					card = CardLoader.GetCardByName(turn7_1)
				});
			}
			if (turn7_2 != "none")
			{
				list7.Add(new CardBlueprint
				{
					card = CardLoader.GetCardByName(turn7_2)
				});
			}
			List<CardBlueprint> list8 = new List<CardBlueprint>();
			if (turn8_1 != "none")
			{
				list8.Add(new CardBlueprint
				{
					card = CardLoader.GetCardByName(turn8_1)
				});
			}
			if (turn8_2 != "none")
			{
				list8.Add(new CardBlueprint
				{
					card = CardLoader.GetCardByName(turn8_2)
				});
			}
			List<CardBlueprint> list9 = new List<CardBlueprint>();
			if (turn9_1 != "none")
			{
				list9.Add(new CardBlueprint
				{
					card = CardLoader.GetCardByName(turn9_1)
				});
			}
			if (turn9_2 != "none")
			{
				list9.Add(new CardBlueprint
				{
					card = CardLoader.GetCardByName(turn9_2)
				});
			}
			List<List<CardBlueprint>> list10 = new List<List<CardBlueprint>>();
			list10.Add(list);
			list10.Add(list2);
			list10.Add(list3);
			list10.Add(list4);
			list10.Add(list5);
			list10.Add(list6);
			list10.Add(list7);
			list10.Add(list8);
			list10.Add(list9);
			return list10;
		}

		public static List<CardInfo> AddRandomCards(string turn1 = "none", string turn2 = "none", string turn3 = "none", string turn4 = "none", string turn5 = "none", string turn6 = "none", string turn7 = "none", string turn8 = "none", string turn9 = "none")
		{
			List<CardInfo> list = new List<CardInfo>();
			if (turn1 != "none")
			{
				list.Add(CardLoader.GetCardByName(turn1));
				if (turn2 != "none")
				{
					list.Add(CardLoader.GetCardByName(turn2));
					if (turn3 != "none")
					{
						list.Add(CardLoader.GetCardByName(turn3));
						if (turn4 != "none")
						{
							list.Add(CardLoader.GetCardByName(turn4));
							if (turn5 != "none")
							{
								list.Add(CardLoader.GetCardByName(turn5));
								if (turn6 != "none")
								{
									list.Add(CardLoader.GetCardByName(turn6));
									if (turn7 != "none")
									{
										list.Add(CardLoader.GetCardByName(turn7));
										if (turn8 != "none")
										{
											list.Add(CardLoader.GetCardByName(turn8));
											if (turn9 != "none")
											{
												list.Add(CardLoader.GetCardByName(turn9));
												return list;
											}
											return list;
										}
										return list;
									}
									return list;
								}
								return list;
							}
							return list;
						}
						return list;
					}
					return list;
				}
				return list;
			}
			return list;
		}
	}
	internal class EriAnt
	{
		public static void AddEncounter()
		{
			//IL_006f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0074: Unknown result type (might be due to invalid IL or missing references)
			//IL_0084: Unknown result type (might be due to invalid IL or missing references)
			//IL_0099: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ae: Expected O, but got Unknown
			//IL_00b1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00db: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f0: Expected O, but got Unknown
			//IL_00fa: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ff: Unknown result type (might be due to invalid IL or missing references)
			//IL_0114: Expected O, but got Unknown
			//IL_011e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0123: Unknown result type (might be due to invalid IL or missing references)
			//IL_0133: Unknown result type (might be due to invalid IL or missing references)
			//IL_0148: Unknown result type (might be due to invalid IL or missing references)
			//IL_0150: Unknown result type (might be due to invalid IL or missing references)
			//IL_015d: Expected O, but got Unknown
			//IL_0167: Unknown result type (might be due to invalid IL or missing references)
			//IL_016c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0181: Expected O, but got Unknown
			//IL_0184: 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_0199: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ae: Unknown result type (might be due to invalid IL or missing references)
			//IL_01b6: Unknown result type (might be due to invalid IL or missing references)
			//IL_01c3: Expected O, but got Unknown
			//IL_01cd: Unknown result type (might be due to invalid IL or missing references)
			//IL_01d2: Unknown result type (might be due to invalid IL or missing references)
			//IL_01e7: Expected O, but got Unknown
			//IL_01ea: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ef: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ff: Unknown result type (might be due to invalid IL or missing references)
			//IL_0214: Unknown result type (might be due to invalid IL or missing references)
			//IL_021c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0229: Expected O, but got Unknown
			//IL_0233: Unknown result type (might be due to invalid IL or missing references)
			//IL_0238: Unknown result type (might be due to invalid IL or missing references)
			//IL_0248: Unknown result type (might be due to invalid IL or missing references)
			//IL_025d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0265: Unknown result type (might be due to invalid IL or missing references)
			//IL_0272: Expected O, but got Unknown
			//IL_0275: Unknown result type (might be due to invalid IL or missing references)
			//IL_027a: Unknown result type (might be due to invalid IL or missing references)
			//IL_028a: Unknown result type (might be due to invalid IL or missing references)
			//IL_029f: Unknown result type (might be due to invalid IL or missing references)
			//IL_02a7: Unknown result type (might be due to invalid IL or missing references)
			//IL_02b4: Expected O, but got Unknown
			string text = "EriAnt";
			string text2 = "Wetlands";
			List<Tribe> list = new List<Tribe>();
			list.Add((Tribe)6);
			List<Ability> list2 = new List<Ability>();
			bool flag = true;
			List<CardInfo> list3 = EncounterUtil.AddRandomCards("Bee");
			List<TurnModBlueprint> list4 = new List<TurnModBlueprint>();
			List<List<CardBlueprint>> list5 = new List<List<CardBlueprint>>();
			List<CardBlueprint> list6 = new List<CardBlueprint>();
			list6.Add(new CardBlueprint
			{
				card = CardLoader.GetCardByName("eri_AntNestWorkerEgg"),
				difficultyReplace = Object.op_Implicit((Object)(object)CardLoader.GetCardByName("eri_ExplodingAnt")),
				difficultyReq = 18,
				randomReplaceChance = 25
			});
			list6.Add(new CardBlueprint
			{
				card = CardLoader.GetCardByName("eri_AntNestWorkerEgg"),
				difficultyReplace = Object.op_Implicit((Object)(object)CardLoader.GetCardByName("eri_AntHusk")),
				difficultyReq = 13,
				randomReplaceChance = 25
			});
			List<CardBlueprint> list7 = new List<CardBlueprint>();
			list7.Add(new CardBlueprint
			{
				card = CardLoader.GetCardByName("eri_AntNestWorkerEgg")
			});
			List<CardBlueprint> list8 = new List<CardBlueprint>();
			list8.Add(new CardBlueprint
			{
				card = CardLoader.GetCardByName("eri_AntNestWorkerEgg"),
				difficultyReplace = Object.op_Implicit((Object)(object)CardLoader.GetCardByName("eri_AntNestWorker")),
				difficultyReq = 13,
				randomReplaceChance = 25
			});
			List<CardBlueprint> list9 = new List<CardBlueprint>();
			list9.Add(new CardBlueprint
			{
				card = CardLoader.GetCardByName("eri_AntNestWorkerEgg")
			});
			list9.Add(new CardBlueprint
			{
				card = CardLoader.GetCardByName("eri_AntNestWorkerEgg"),
				difficultyReplace = Object.op_Implicit((Object)(object)CardLoader.GetCardByName("eri_ExplodingAnt")),
				difficultyReq = 18,
				randomReplaceChance = 25
			});
			List<CardBlueprint> list10 = new List<CardBlueprint>();
			list10.Add(new CardBlueprint
			{
				card = CardLoader.GetCardByName("eri_AntNestWorkerEgg")
			});
			list10.Add(new CardBlueprint
			{
				card = CardLoader.GetCardByName("eri_AntNestWorkerEgg"),
				difficultyReplace = Object.op_Implicit((Object)(object)CardLoader.GetCardByName("eri_AntHusk")),
				difficultyReq = 13,
				randomReplaceChance = 25
			});
			List<CardBlueprint> list11 = new List<CardBlueprint>();
			list11.Add(new CardBlueprint
			{
				card = CardLoader.GetCardByName("eri_AntNestWorkerEgg"),
				difficultyReplace = Object.op_Implicit((Object)(object)CardLoader.GetCardByName("eri_ExplodingAnt")),
				difficultyReq = 18,
				randomReplaceChance = 25
			});
			list11.Add(new CardBlueprint
			{
				card = CardLoader.GetCardByName("eri_AntNestWorkerEgg"),
				difficultyReplace = Object.op_Implicit((Object)(object)CardLoader.GetCardByName("eri_AntNestWorker")),
				difficultyReq = 13,
				randomReplaceChance = 25
			});
			list5.Add(list6);
			list5.Add(list7);
			list5.Add(list8);
			list5.Add(list9);
			list5.Add(list10);
			list5.Add(list11);
			NewEncounter.Add(text, text2, list4, list, list2, (List<CardInfo>)null, flag, 1, 30, list3, list5, true, false, 0);
		}
	}
	internal class EriBird
	{
		public static void AddEncounter()
		{
			//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_008d: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00aa: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b7: Expected O, but got Unknown
			//IL_00ba: Unknown result type (might be due to invalid IL or missing references)
			//IL_00bf: Unknown result type (might be due to invalid IL or missing references)
			//IL_00cf: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ec: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f9: Expected O, but got Unknown
			//IL_010a: Unknown result type (might be due to invalid IL or missing references)
			//IL_010f: Unknown result type (might be due to invalid IL or missing references)
			//IL_011f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0134: Unknown result type (might be due to invalid IL or missing references)
			//IL_013c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0149: Expected O, but got Unknown
			//IL_0153: Unknown result type (might be due to invalid IL or missing references)
			//IL_0158: Unknown result type (might be due to invalid IL or missing references)
			//IL_016d: Expected O, but got Unknown
			//IL_0170: Unknown result type (might be due to invalid IL or missing references)
			//IL_0175: Unknown result type (might be due to invalid IL or missing references)
			//IL_0185: Unknown result type (might be due to invalid IL or missing references)
			//IL_019a: Unknown result type (might be due to invalid IL or missing references)
			//IL_01a2: Unknown result type (might be due to invalid IL or missing references)
			//IL_01af: Expected O, but got Unknown
			//IL_01b9: Unknown result type (might be due to invalid IL or missing references)
			//IL_01be: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ce: Unknown result type (might be due to invalid IL or missing references)
			//IL_01e3: 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_01f8: Expected O, but got Unknown
			//IL_0202: Unknown result type (might be due to invalid IL or missing references)
			//IL_0207: Unknown result type (might be due to invalid IL or missing references)
			//IL_0217: Unknown result type (might be due to invalid IL or missing references)
			//IL_022c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0234: Unknown result type (might be due to invalid IL or missing references)
			//IL_0241: Expected O, but got Unknown
			//IL_0244: Unknown result type (might be due to invalid IL or missing references)
			//IL_0249: Unknown result type (might be due to invalid IL or missing references)
			//IL_0259: Unknown result type (might be due to invalid IL or missing references)
			//IL_026e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0276: Unknown result type (might be due to invalid IL or missing references)
			//IL_0283: Expected O, but got Unknown
			string text = "EriBird";
			string text2 = "Alpine";
			List<Tribe> list = new List<Tribe>();
			list.Add((Tribe)2);
			List<Ability> list2 = new List<Ability>();
			list2.Add((Ability)19);
			bool flag = true;
			List<CardInfo> list3 = EncounterUtil.AddRandomCards("Kingfisher", "Sparrow", "Raven", "Vulture");
			List<TurnModBlueprint> list4 = new List<TurnModBlueprint>();
			List<List<CardBlueprint>> list5 = new List<List<CardBlueprint>>();
			List<CardBlueprint> list6 = new List<CardBlueprint>();
			list6.Add(new CardBlueprint
			{
				card = CardLoader.GetCardByName("eri_Mockingbird"),
				difficultyReplace = Object.op_Implicit((Object)(object)CardLoader.GetCardByName("eri_Secretary")),
				difficultyReq = 18,
				randomReplaceChance = 25
			});
			list6.Add(new CardBlueprint
			{
				card = CardLoader.GetCardByName("eri_Mockingbird"),
				difficultyReplace = Object.op_Implicit((Object)(object)CardLoader.GetCardByName("eri_FatBird")),
				difficultyReq = 13,
				randomReplaceChance = 25
			});
			List<CardBlueprint> item = new List<CardBlueprint>();
			List<CardBlueprint> list7 = new List<CardBlueprint>();
			list7.Add(new CardBlueprint
			{
				card = CardLoader.GetCardByName("eri_Mockingbird"),
				difficultyReplace = Object.op_Implicit((Object)(object)CardLoader.GetCardByName("eri_Vulture")),
				difficultyReq = 13,
				randomReplaceChance = 25
			});
			List<CardBlueprint> list8 = new List<CardBlueprint>();
			list8.Add(new CardBlueprint
			{
				card = CardLoader.GetCardByName("eri_Mockingbird")
			});
			list8.Add(new CardBlueprint
			{
				card = CardLoader.GetCardByName("eri_Mockingbird"),
				difficultyReplace = Object.op_Implicit((Object)(object)CardLoader.GetCardByName("eri_Secretary")),
				difficultyReq = 18,
				randomReplaceChance = 25
			});
			List<CardBlueprint> list9 = new List<CardBlueprint>();
			list9.Add(new CardBlueprint
			{
				card = CardLoader.GetCardByName("eri_Mockingbird"),
				difficultyReplace = Object.op_Implicit((Object)(object)CardLoader.GetCardByName("eri_Vulture")),
				difficultyReq = 13,
				randomReplaceChance = 25
			});
			List<CardBlueprint> list10 = new List<CardBlueprint>();
			list10.Add(new CardBlueprint
			{
				card = CardLoader.GetCardByName("eri_Mockingbird"),
				difficultyReplace = Object.op_Implicit((Object)(object)CardLoader.GetCardByName("eri_Secretary")),
				difficultyReq = 18,
				randomReplaceChance = 25
			});
			list10.Add(new CardBlueprint
			{
				card = CardLoader.GetCardByName("eri_Mockingbird"),
				difficultyReplace = Object.op_Implicit((Object)(object)CardLoader.GetCardByName("eri_FatBird")),
				difficultyReq = 13,
				randomReplaceChance = 25
			});
			list5.Add(list6);
			list5.Add(item);
			list5.Add(list7);
			list5.Add(list8);
			list5.Add(list9);
			list5.Add(list10);
			NewEncounter.Add(text, text2, list4, list, list2, (List<CardInfo>)null, flag, 1, 30, list3, list5, true, false, 0);
		}
	}
	internal class EriHooved
	{
		public static void AddEncounter()
		{
			//IL_0077: Unknown result type (might be due to invalid IL or missing references)
			//IL_007c: Unknown result type (might be due to invalid IL or missing references)
			//IL_008c: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a9: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b6: Expected O, but got Unknown
			//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_00ce: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00eb: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f8: Expected O, but got Unknown
			//IL_0109: Unknown result type (might be due to invalid IL or missing references)
			//IL_010e: Unknown result type (might be due to invalid IL or missing references)
			//IL_011e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0133: Unknown result type (might be due to invalid IL or missing references)
			//IL_013b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0148: Expected O, but got Unknown
			//IL_0152: Unknown result type (might be due to invalid IL or missing references)
			//IL_0157: Unknown result type (might be due to invalid IL or missing references)
			//IL_016c: Expected O, but got Unknown
			//IL_016f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0174: Unknown result type (might be due to invalid IL or missing references)
			//IL_0184: Unknown result type (might be due to invalid IL or missing references)
			//IL_0199: Unknown result type (might be due to invalid IL or missing references)
			//IL_01a1: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ae: Expected O, but got Unknown
			//IL_01b8: Unknown result type (might be due to invalid IL or missing references)
			//IL_01bd: Unknown result type (might be due to invalid IL or missing references)
			//IL_01cd: Unknown result type (might be due to invalid IL or missing references)
			//IL_01e2: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ea: Unknown result type (might be due to invalid IL or missing references)
			//IL_01f7: Expected O, but got Unknown
			//IL_0201: Unknown result type (might be due to invalid IL or missing references)
			//IL_0206: Unknown result type (might be due to invalid IL or missing references)
			//IL_0216: Unknown result type (might be due to invalid IL or missing references)
			//IL_022b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0233: Unknown result type (might be due to invalid IL or missing references)
			//IL_0240: Expected O, but got Unknown
			string text = "EriHooved";
			string text2 = "Alpine";
			List<Tribe> list = new List<Tribe>();
			list.Add((Tribe)4);
			List<Ability> list2 = new List<Ability>();
			list2.Add((Ability)3);
			bool flag = true;
			List<CardInfo> list3 = EncounterUtil.AddRandomCards("Mole", "Wolf", "Coyote");
			List<TurnModBlueprint> list4 = new List<TurnModBlueprint>();
			List<List<CardBlueprint>> list5 = new List<List<CardBlueprint>>();
			List<CardBlueprint> list6 = new List<CardBlueprint>();
			list6.Add(new CardBlueprint
			{
				card = CardLoader.GetCardByName("eri_Ram"),
				difficultyReplace = Object.op_Implicit((Object)(object)CardLoader.GetCardByName("eri_Buffalo")),
				difficultyReq = 18,
				randomReplaceChance = 25
			});
			list6.Add(new CardBlueprint
			{
				card = CardLoader.GetCardByName("eri_Ram"),
				difficultyReplace = Object.op_Implicit((Object)(object)CardLoader.GetCardByName("eri_Warthog")),
				difficultyReq = 13,
				randomReplaceChance = 25
			});
			List<CardBlueprint> item = new List<CardBlueprint>();
			List<CardBlueprint> list7 = new List<CardBlueprint>();
			list7.Add(new CardBlueprint
			{
				card = CardLoader.GetCardByName("eri_Ram"),
				difficultyReplace = Object.op_Implicit((Object)(object)CardLoader.GetCardByName("eri_Warthog")),
				difficultyReq = 13,
				randomReplaceChance = 25
			});
			List<CardBlueprint> list8 = new List<CardBlueprint>();
			list8.Add(new CardBlueprint
			{
				card = CardLoader.GetCardByName("eri_Ram")
			});
			list8.Add(new CardBlueprint
			{
				card = CardLoader.GetCardByName("eri_Ram"),
				difficultyReplace = Object.op_Implicit((Object)(object)CardLoader.GetCardByName("eri_Buffalo")),
				difficultyReq = 18,
				randomReplaceChance = 25
			});
			List<CardBlueprint> list9 = new List<CardBlueprint>();
			list9.Add(new CardBlueprint
			{
				card = CardLoader.GetCardByName("eri_Ram"),
				difficultyReplace = Object.op_Implicit((Object)(object)CardLoader.GetCardByName("eri_Warthog")),
				difficultyReq = 13,
				randomReplaceChance = 25
			});
			List<CardBlueprint> list10 = new List<CardBlueprint>();
			list10.Add(new CardBlueprint
			{
				card = CardLoader.GetCardByName("eri_Ram"),
				difficultyReplace = Object.op_Implicit((Object)(object)CardLoader.GetCardByName("eri_Buffalo")),
				difficultyReq = 18,
				randomReplaceChance = 25
			});
			list5.Add(list6);
			list5.Add(item);
			list5.Add(list7);
			list5.Add(list8);
			list5.Add(list9);
			list5.Add(list10);
			NewEncounter.Add(text, text2, list4, list, list2, (List<CardInfo>)null, flag, 1, 30, list3, list5, true, false, 0);
		}
	}
	internal class EriWolf
	{
		public static void AddEncounter()
		{
			//IL_006f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0074: Unknown result type (might be due to invalid IL or missing references)
			//IL_0084: Unknown result type (might be due to invalid IL or missing references)
			//IL_0099: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ae: Expected O, but got Unknown
			//IL_00b1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00db: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f0: Expected O, but got Unknown
			//IL_0101: Unknown result type (might be due to invalid IL or missing references)
			//IL_0106: Unknown result type (might be due to invalid IL or missing references)
			//IL_0116: Unknown result type (might be due to invalid IL or missing references)
			//IL_012b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0133: Unknown result type (might be due to invalid IL or missing references)
			//IL_0140: Expected O, but got Unknown
			//IL_014a: Unknown result type (might be due to invalid IL or missing references)
			//IL_014f: Unknown result type (might be due to invalid IL or missing references)
			//IL_015f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0174: Unknown result type (might be due to invalid IL or missing references)
			//IL_017c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0189: Expected O, but got Unknown
			//IL_018c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0191: Unknown result type (might be due to invalid IL or missing references)
			//IL_01a1: Unknown result type (might be due to invalid IL or missing references)
			//IL_01b6: Unknown result type (might be due to invalid IL or missing references)
			//IL_01be: Unknown result type (might be due to invalid IL or missing references)
			//IL_01cb: Expected O, but got Unknown
			//IL_01d5: Unknown result type (might be due to invalid IL or missing references)
			//IL_01da: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ea: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ff: Unknown result type (might be due to invalid IL or missing references)
			//IL_0207: Unknown result type (might be due to invalid IL or missing references)
			//IL_0214: Expected O, but got Unknown
			//IL_021e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0223: Unknown result type (might be due to invalid IL or missing references)
			//IL_0233: Unknown result type (might be due to invalid IL or missing references)
			//IL_0248: Unknown result type (might be due to invalid IL or missing references)
			//IL_0250: Unknown result type (might be due to invalid IL or missing references)
			//IL_025d: Expected O, but got Unknown
			string text = "EriWolf";
			string text2 = "Forest";
			List<Tribe> list = new List<Tribe>();
			list.Add((Tribe)3);
			List<Ability> list2 = new List<Ability>();
			bool flag = true;
			List<CardInfo> list3 = EncounterUtil.AddRandomCards("Mole", "Wolf", "Coyote");
			List<TurnModBlueprint> list4 = new List<TurnModBlueprint>();
			List<List<CardBlueprint>> list5 = new List<List<CardBlueprint>>();
			List<CardBlueprint> list6 = new List<CardBlueprint>();
			list6.Add(new CardBlueprint
			{
				card = CardLoader.GetCardByName("WolfCub"),
				difficultyReplace = Object.op_Implicit((Object)(object)CardLoader.GetCardByName("eri_Jackal")),
				difficultyReq = 18,
				randomReplaceChance = 25
			});
			list6.Add(new CardBlueprint
			{
				card = CardLoader.GetCardByName("WolfCub"),
				difficultyReplace = Object.op_Implicit((Object)(object)CardLoader.GetCardByName("Alpha")),
				difficultyReq = 13,
				randomReplaceChance = 25
			});
			List<CardBlueprint> item = new List<CardBlueprint>();
			List<CardBlueprint> list7 = new List<CardBlueprint>();
			list7.Add(new CardBlueprint
			{
				card = CardLoader.GetCardByName("WolfCub"),
				difficultyReplace = Object.op_Implicit((Object)(object)CardLoader.GetCardByName("eri_WhiteWolf")),
				difficultyReq = 13,
				randomReplaceChance = 25
			});
			List<CardBlueprint> list8 = new List<CardBlueprint>();
			list8.Add(new CardBlueprint
			{
				card = CardLoader.GetCardByName("WolfCub"),
				difficultyReplace = Object.op_Implicit((Object)(object)CardLoader.GetCardByName("eri_WhiteWolf")),
				difficultyReq = 18,
				randomReplaceChance = 25
			});
			list8.Add(new CardBlueprint
			{
				card = CardLoader.GetCardByName("Coyote"),
				difficultyReplace = Object.op_Implicit((Object)(object)CardLoader.GetCardByName("eri_Hyena")),
				difficultyReq = 18,
				randomReplaceChance = 25
			});
			List<CardBlueprint> list9 = new List<CardBlueprint>();
			list9.Add(new CardBlueprint
			{
				card = CardLoader.GetCardByName("WolfCub"),
				difficultyReplace = Object.op_Implicit((Object)(object)CardLoader.GetCardByName("eri_Jackal")),
				difficultyReq = 13,
				randomReplaceChance = 25
			});
			List<CardBlueprint> list10 = new List<CardBlueprint>();
			list10.Add(new CardBlueprint
			{
				card = CardLoader.GetCardByName("Coyote"),
				difficultyReplace = Object.op_Implicit((Object)(object)CardLoader.GetCardByName("eri_Hyena")),
				difficultyReq = 18,
				randomReplaceChance = 25
			});
			list5.Add(list6);
			list5.Add(item);
			list5.Add(list7);
			list5.Add(list8);
			list5.Add(list9);
			list5.Add(list10);
			NewEncounter.Add(text, text2, list4, list, list2, (List<CardInfo>)null, flag, 1, 30, list3, list5, true, false, 0);
		}
	}
	internal class UndeadMarch
	{
		public static void AddEncounter()
		{
			//IL_006f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0074: Unknown result type (might be due to invalid IL or missing references)
			//IL_0084: Unknown result type (might be due to invalid IL or missing references)
			//IL_0099: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ae: Expected O, but got Unknown
			//IL_00b1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00db: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f0: Expected O, but got Unknown
			//IL_0101: Unknown result type (might be due to invalid IL or missing references)
			//IL_0106: Unknown result type (might be due to invalid IL or missing references)
			//IL_0116: Unknown result type (might be due to invalid IL or missing references)
			//IL_012b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0133: Unknown result type (might be due to invalid IL or missing references)
			//IL_0140: Expected O, but got Unknown
			//IL_014a: Unknown result type (might be due to invalid IL or missing references)
			//IL_014f: Unknown result type (might be due to invalid IL or missing references)
			//IL_015f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0174: Unknown result type (might be due to invalid IL or missing references)
			//IL_017c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0189: Expected O, but got Unknown
			//IL_018c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0191: Unknown result type (might be due to invalid IL or missing references)
			//IL_01a1: Unknown result type (might be due to invalid IL or missing references)
			//IL_01b6: Unknown result type (might be due to invalid IL or missing references)
			//IL_01be: Unknown result type (might be due to invalid IL or missing references)
			//IL_01cb: Expected O, but got Unknown
			//IL_01dc: Unknown result type (might be due to invalid IL or missing references)
			//IL_01e1: Unknown result type (might be due to invalid IL or missing references)
			//IL_01f1: Unknown result type (might be due to invalid IL or missing references)
			//IL_0206: Unknown result type (might be due to invalid IL or missing references)
			//IL_020e: Unknown result type (might be due to invalid IL or missing references)
			//IL_021b: Expected O, but got Unknown
			//IL_021e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0223: Unknown result type (might be due to invalid IL or missing references)
			//IL_0233: Unknown result type (might be due to invalid IL or missing references)
			//IL_0248: Unknown result type (might be due to invalid IL or missing references)
			//IL_0250: Unknown result type (might be due to invalid IL or missing references)
			//IL_025d: Expected O, but got Unknown
			string text = "UndeadMarch";
			string text2 = "Forest";
			List<Tribe> list = new List<Tribe>();
			list.Add((Tribe)3);
			List<Ability> list2 = new List<Ability>();
			bool flag = false;
			List<CardInfo> list3 = EncounterUtil.AddRandomCards();
			List<TurnModBlueprint> list4 = new List<TurnModBlueprint>();
			List<List<CardBlueprint>> list5 = new List<List<CardBlueprint>>();
			List<CardBlueprint> list6 = new List<CardBlueprint>();
			list6.Add(new CardBlueprint
			{
				card = CardLoader.GetCardByName("eri_RatSkeleton"),
				difficultyReplace = Object.op_Implicit((Object)(object)CardLoader.GetCardByName("eri_WolfSkeleton")),
				difficultyReq = 13,
				randomReplaceChance = 25
			});
			list6.Add(new CardBlueprint
			{
				card = CardLoader.GetCardByName("eri_BirdSkeleton"),
				difficultyReplace = Object.op_Implicit((Object)(object)CardLoader.GetCardByName("eri_ElkSkeleton")),
				difficultyReq = 13,
				randomReplaceChance = 25
			});
			List<CardBlueprint> item = new List<CardBlueprint>();
			List<CardBlueprint> list7 = new List<CardBlueprint>();
			list7.Add(new CardBlueprint
			{
				card = CardLoader.GetCardByName("eri_RatSkeleton"),
				difficultyReplace = Object.op_Implicit((Object)(object)CardLoader.GetCardByName("eri_WolfSkeleton")),
				difficultyReq = 13,
				randomReplaceChance = 25
			});
			List<CardBlueprint> list8 = new List<CardBlueprint>();
			list8.Add(new CardBlueprint
			{
				card = CardLoader.GetCardByName("eri_BirdSkeleton"),
				difficultyReplace = Object.op_Implicit((Object)(object)CardLoader.GetCardByName("eri_BearSkeleton")),
				difficultyReq = 18,
				randomReplaceChance = 25
			});
			list8.Add(new CardBlueprint
			{
				card = CardLoader.GetCardByName("eri_RatSkeleton"),
				difficultyReplace = Object.op_Implicit((Object)(object)CardLoader.GetCardByName("eri_BearSkeleton")),
				difficultyReq = 18,
				randomReplaceChance = 25
			});
			List<CardBlueprint> item2 = new List<CardBlueprint>();
			List<CardBlueprint> list9 = new List<CardBlueprint>();
			list9.Add(new CardBlueprint
			{
				card = CardLoader.GetCardByName("eri_BirdSkeleton"),
				difficultyReplace = Object.op_Implicit((Object)(object)CardLoader.GetCardByName("eri_ElkSkeleton")),
				difficultyReq = 13,
				randomReplaceChance = 25
			});
			list9.Add(new CardBlueprint
			{
				card = CardLoader.GetCardByName("eri_RatSkeleton"),
				difficultyReplace = Object.op_Implicit((Object)(object)CardLoader.GetCardByName("eri_BearSkeleton")),
				difficultyReq = 18,
				randomReplaceChance = 25
			});
			list5.Add(list6);
			list5.Add(item);
			list5.Add(list7);
			list5.Add(list8);
			list5.Add(item2);
			list5.Add(list9);
			NewEncounter.Add(text, text2, list4, list, list2, (List<CardInfo>)null, flag, 1, 30, list3, list5, true, false, 0);
		}
	}
}

plugins/Void_Slime-Life_Cost_API/plugins/LifeCost.dll

Decompiled 5 months 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 BepInEx.Logging;
using DiskCardGame;
using GBC;
using HarmonyLib;
using InscryptionAPI.Ascension;
using InscryptionAPI.Card;
using InscryptionAPI.CardCosts;
using InscryptionAPI.Helpers;
using InscryptionCommunityPatch.Card;
using LifeCost.Cards;
using LifeCost.Costs;
using LifeCost.Costs.HCost;
using LifeCost.Costs.LCost;
using LifeCost.Costs.MCost;
using LifeCost.Sigils;
using LifeCost.Utility;
using Microsoft.CodeAnalysis;
using Pixelplacement;
using UnityEngine;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: AssemblyDescription("")]
[assembly: AssemblyCopyright("Copyright ©  2024")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("05fe5e41-204a-49d6-bb88-1d873869dc85")]
[assembly: TargetFramework(".NETStandard,Version=v2.0", FrameworkDisplayName = ".NET Standard 2.0")]
[assembly: AssemblyCompany("LifeCost")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("LifeCost")]
[assembly: AssemblyTitle("LifeCost")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.0.0")]
[module: UnverifiableCode]
[module: RefSafetyRules(11)]
namespace Microsoft.CodeAnalysis
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	internal sealed class EmbeddedAttribute : Attribute
	{
	}
}
namespace System.Runtime.CompilerServices
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	[AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)]
	internal sealed class RefSafetyRulesAttribute : Attribute
	{
		public readonly int Version;

		public RefSafetyRulesAttribute(int P_0)
		{
			Version = P_0;
		}
	}
}
namespace LifeCost
{
	[BepInPlugin("extraVoid.inscryption.LifeCost", "Life Scrybe", "4.0.0")]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	public class Plugin : BaseUnityPlugin
	{
		public const string APIGUID = "cyantist.inscryption.api";

		public const string PluginGuid = "extraVoid.inscryption.LifeCost";

		public const string ZGUID = "community.inscryption.patch";

		private const string PluginName = "Life Scrybe";

		private const string PluginVersion = "4.0.0";

		public static string Directory;

		internal static ManualLogSource Log;

		internal static ConfigEntry<bool> configFairHandActive;

		internal static ConfigEntry<int> configFairHandCostL;

		internal static ConfigEntry<int> configFairHandCostM;

		internal static ConfigEntry<int> configFairHandCostH;

		private void Awake()
		{
			//IL_002f: Unknown result type (might be due to invalid IL or missing references)
			Log = ((BaseUnityPlugin)this).Logger;
			Directory = ((BaseUnityPlugin)this).Info.Location.Replace("LifeCost.dll", "");
			new Harmony("extraVoid.inscryption.LifeCost").PatchAll();
			configFairHandActive = ((BaseUnityPlugin)this).Config.Bind<bool>("Fair Hand", "Active", true, "Should this mod post-fix patch fair hand to include the Money, Life, and Hybrid Costs?");
			configFairHandCostL = ((BaseUnityPlugin)this).Config.Bind<int>("Fair Hand", "Life Cost", 4, "The value in which the card should not show up in fair hand.");
			configFairHandCostM = ((BaseUnityPlugin)this).Config.Bind<int>("Fair Hand", "Money Cost", 2, "The value in which the card should not show up in fair hand.");
			configFairHandCostH = ((BaseUnityPlugin)this).Config.Bind<int>("Fair Hand", "Hybrid Cost", 2, "The value in which the card should not show up in fair hand.");
			CostsToAdd.AddCost();
			SigilsToAdd.AddSigils();
			Teck.AddCard();
			Meck.AddCard();
			Leck.AddCard();
		}

		private void Start()
		{
			Log.LogMessage((object)"Lifecost start event fired");
			BackwardsCompatibility.ChangeCardsToLifecost();
		}

		public static void AddStartingDeck()
		{
			Texture2D imageAsTexture = TextureHelper.GetImageAsTexture("Dev_Test.png", typeof(Plugin).Assembly, (FilterMode)0);
			StarterDeckInfo val = ScriptableObject.CreateInstance<StarterDeckInfo>();
			val.title = "NewCost Dev Test";
			val.iconSprite = TextureHelper.ConvertTexture(imageAsTexture, (SpriteType)9, (FilterMode)0);
			val.cards = new List<CardInfo>
			{
				CardLoader.GetCardByName("lifecost_Leck"),
				CardLoader.GetCardByName("lifecost_Meck"),
				CardLoader.GetCardByName("lifecost_Teck")
			};
			StarterDeckManager.Add("extraVoid.inscryption.LifeCost", val, 0);
		}
	}
	public static class MyPluginInfo
	{
		public const string PLUGIN_GUID = "LifeCost";

		public const string PLUGIN_NAME = "LifeCost";

		public const string PLUGIN_VERSION = "1.0.0";
	}
}
namespace LifeCost.Utility
{
	public static class ext
	{
		public static int LifeCost(this CardInfo info)
		{
			int? extendedPropertyAsInt = CardExtensions.GetExtendedPropertyAsInt(info, "LifeCost");
			if (!extendedPropertyAsInt.HasValue)
			{
				return 0;
			}
			return extendedPropertyAsInt.Value;
		}

		public static int MoneyCost(this CardInfo info)
		{
			int? extendedPropertyAsInt = CardExtensions.GetExtendedPropertyAsInt(info, "MoneyCost");
			if (!extendedPropertyAsInt.HasValue)
			{
				return 0;
			}
			return extendedPropertyAsInt.Value;
		}

		public static int LifeMoneyCost(this CardInfo info)
		{
			int? extendedPropertyAsInt = CardExtensions.GetExtendedPropertyAsInt(info, "LifeMoneyCost");
			if (!extendedPropertyAsInt.HasValue)
			{
				return 0;
			}
			return extendedPropertyAsInt.Value;
		}
	}
	public static class BackwardsCompatibility
	{
		public static void ChangeCardsToLifecost()
		{
			CardManager.ModifyCardList += delegate(List<CardInfo> cards)
			{
				foreach (CardInfo item in cards.Where((CardInfo c) => c.EnergyCost < 0))
				{
					int num = item.EnergyCost * -1;
					CardExtensions.SetExtendedProperty(item, "LifeMoneyCost", (object)num);
					CardExtensions.SetEnergyCost(item, (int?)0);
				}
				return cards;
			};
		}

		public static void SetCardsToLifeMoneycost()
		{
			CardManager.ModifyCardList += delegate(List<CardInfo> cards)
			{
				foreach (CardInfo item in cards.Where((CardInfo c) => CardExtensions.GetCustomCost(c, "LifeMoneyCost", false) != 0))
				{
					int customCost = CardExtensions.GetCustomCost(item, "LifeMoneyCost", false);
					CardExtensions.SetExtendedProperty(item, "LifeMoneyCost", (object)customCost);
				}
				return cards;
			};
		}

		public static void SetCardsToMoneycost()
		{
			CardManager.ModifyCardList += delegate(List<CardInfo> cards)
			{
				foreach (CardInfo item in cards.Where((CardInfo c) => CardExtensions.GetCustomCost(c, "MoneyCost", false) != 0))
				{
					int customCost = CardExtensions.GetCustomCost(item, "MoneyCost", false);
					CardExtensions.SetExtendedProperty(item, "MoneyCost", (object)customCost);
				}
				return cards;
			};
		}

		public static void SetCardsToLifecost()
		{
			CardManager.ModifyCardList += delegate(List<CardInfo> cards)
			{
				foreach (CardInfo item in cards.Where((CardInfo c) => CardExtensions.GetCustomCost(c, "LifeCost", false) != 0))
				{
					int customCost = CardExtensions.GetCustomCost(item, "LifeCost", false);
					CardExtensions.SetExtendedProperty(item, "LifeCost", (object)customCost);
				}
				return cards;
			};
		}

		public static void FixCardsToLifeMoneycost()
		{
			CardManager.ModifyCardList += delegate(List<CardInfo> cards)
			{
				foreach (CardInfo item in cards.Where((CardInfo c) => c.LifeMoneyCost() != 0))
				{
					int num = item.LifeMoneyCost();
					CardExtensions.SetCustomCost(item, "LifeMoneyCost", num);
				}
				return cards;
			};
		}

		public static void FixCardsToMoneycost()
		{
			CardManager.ModifyCardList += delegate(List<CardInfo> cards)
			{
				foreach (CardInfo item in cards.Where((CardInfo c) => c.MoneyCost() != 0))
				{
					int num = item.MoneyCost();
					CardExtensions.SetCustomCost(item, "MoneyCost", num);
				}
				return cards;
			};
		}

		public static void FixCardsToLifecost()
		{
			CardManager.ModifyCardList += delegate(List<CardInfo> cards)
			{
				foreach (CardInfo item in cards.Where((CardInfo c) => c.LifeCost() != 0))
				{
					int num = item.LifeCost();
					CardExtensions.SetCustomCost(item, "LifeCost", num);
				}
				return cards;
			};
		}
	}
	public static class CardUtils
	{
		private static Assembly _assembly;

		public static Assembly CurrentAssembly
		{
			get
			{
				Assembly result;
				if ((result = _assembly) == null)
				{
					result = (_assembly = Assembly.GetExecutingAssembly());
				}
				return result;
			}
		}

		public static Texture2D getImage(string path)
		{
			return TextureHelper.GetImageAsTexture(path, CurrentAssembly, (FilterMode)0);
		}

		public static Sprite getSprite(string path)
		{
			//IL_0000: 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_0035: Unknown result type (might be due to invalid IL or missing references)
			new Sprite();
			Texture2D image = getImage(path);
			return Sprite.Create(image, new Rect(0f, 0f, (float)((Texture)image).width, (float)((Texture)image).height), new Vector2(0.5f, 0.5f));
		}

		public static LineSet SetAbilityInfoDialogue(string dialogue)
		{
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			//IL_000b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0017: Expected O, but got Unknown
			//IL_0017: Unknown result type (might be due to invalid IL or missing references)
			//IL_001d: Expected O, but got Unknown
			return new LineSet(new List<Line>
			{
				new Line
				{
					text = dialogue
				}
			});
		}

		public static AbilityInfo CreateAbilityWithDefaultSettings(string rulebookName, string rulebookDescription, Type behavior, Texture2D text_a1, Sprite text_a2, string LearnDialogue, bool withDialogue = false, int powerLevel = 0, bool leshyUsable = false, bool part1Modular = true, bool stack = false)
		{
			AbilityInfo val = AbilityManager.New("extraVoid.inscryption.LifeCost", rulebookName, rulebookDescription, behavior, (Texture)(object)text_a1);
			if (withDialogue)
			{
				val.abilityLearnedDialogue = SetAbilityInfoDialogue(LearnDialogue);
			}
			val.powerLevel = powerLevel;
			val.activated = true;
			if (part1Modular)
			{
				val.metaCategories = new List<AbilityMetaCategory>
				{
					(AbilityMetaCategory)1,
					(AbilityMetaCategory)0
				};
			}
			else
			{
				val.metaCategories = new List<AbilityMetaCategory> { (AbilityMetaCategory)0 };
			}
			val.pixelIcon = text_a2;
			val.canStack = stack;
			return val;
		}

		public static CardInfo CreateCardWithDefaultSettings(string InternalName, string DisplayName, int attack, int health, Texture2D texture_base, Texture2D texture_emission, List<CardMetaCategory> cardMetaCategories, List<Tribe> tribes, List<Trait> traits, List<Ability> abilities, Texture2D texture_pixel = null, int bloodCost = 0, int boneCost = 0, int energyCost = 0)
		{
			//IL_006c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0072: Expected I4, but got Unknown
			//IL_0088: Unknown result type (might be due to invalid IL or missing references)
			//IL_008f: Unknown result type (might be due to invalid IL or missing references)
			CardInfo val = CardManager.New("lifecost", InternalName, DisplayName, attack, health, "A puddle that errods all that touches it.");
			CardExtensions.SetPortrait(val, texture_base, texture_emission, (FilterMode?)null);
			if ((Object)(object)texture_pixel != (Object)null)
			{
				CardExtensions.SetPixelPortrait(val, texture_pixel, (FilterMode?)null);
			}
			val.metaCategories = cardMetaCategories;
			val.tribes = tribes;
			val.traits = traits;
			for (int i = 0; i < abilities.Count; i++)
			{
				CardExtensions.AddAbilities(val, (Ability[])(object)new Ability[1] { (Ability)(int)abilities[i] });
			}
			val.temple = (CardTemple)0;
			val.cardComplexity = (CardComplexity)2;
			CardExtensions.SetBloodCost(val, (int?)bloodCost);
			CardExtensions.SetBonesCost(val, (int?)boneCost);
			CardExtensions.SetEnergyCost(val, (int?)energyCost);
			return val;
		}
	}
}
namespace LifeCost.Sigils
{
	public class lifecost_ActivateEnergyGamble : LifeActiveAbilityCost
	{
		public static Ability ability;

		public override Ability Ability => ability;

		public override int EnergyCost => 6;

		public override IEnumerator Activate()
		{
			yield return ((AbilityBehaviour)this).PreSuccessfulTriggerSequence();
			yield return (object)new WaitForSeconds(0.15f);
			bool flag = !SaveManager.SaveFile.IsPart2;
			int amount = Random.Range(0, 3);
			if (amount == 0)
			{
				yield return ((AbilityBehaviour)this).LearnAbility(0.25f);
				yield return (object)new WaitForSeconds(0.1f);
				yield break;
			}
			Random random = new Random();
			bool whoGetsit = random.Next(2) == 0;
			if (flag)
			{
				float waitTime2 = 0.1f;
				Singleton<ViewManager>.Instance.SwitchToView((View)7, false, true);
				yield return (object)new WaitForSeconds(waitTime2);
				((Card)((AbilityBehaviour)this).Card).Anim.LightNegationEffect();
				yield return PayCost.ShowDamageSequence(amount, amount, whoGetsit);
				yield return (object)new WaitForSeconds(waitTime2);
				Singleton<ViewManager>.Instance.SwitchToView((View)4, false, true);
				Singleton<ViewManager>.Instance.Controller.LockState = (ViewLockState)0;
			}
			else
			{
				float waitTime2 = 0.5f;
				yield return (object)new WaitForSeconds(waitTime2);
				((Card)((AbilityBehaviour)this).Card).Anim.LightNegationEffect();
				yield return PayCost.ShowDamageSequence(amount, amount, whoGetsit);
				yield return (object)new WaitForSeconds(waitTime2);
			}
			yield return ((AbilityBehaviour)this).LearnAbility(0.25f);
			yield return (object)new WaitForSeconds(0.1f);
		}
	}
	public class lifecost_ActivateLifeRandomStatsUp : LifeActiveAbilityCost
	{
		public static Ability ability;

		private const string MOD_ID = "extraVoid.inscryption.LifeCost_statsUp";

		public override Ability Ability => ability;

		public override int LifeMoneyCost => 5;

		public override IEnumerator Activate()
		{
			yield return ((AbilityBehaviour)this).PreSuccessfulTriggerSequence();
			yield return (object)new WaitForSeconds(0.15f);
			CardModificationInfo mod = ((AbilityBehaviour)this).Card.TemporaryMods.Find((CardModificationInfo x) => x.singletonId == "extraVoid.inscryption.LifeCost_statsUp");
			bool isPart = !SaveManager.SaveFile.IsPart2;
			if (mod == null)
			{
				mod = new CardModificationInfo();
				mod.singletonId = "extraVoid.inscryption.LifeCost_statsUp";
				((AbilityBehaviour)this).Card.AddTemporaryMod(mod);
			}
			yield return (object)new WaitForSeconds(0.5f);
			int StatsUp = Random.Range(0, 6);
			if (isPart)
			{
				Singleton<ViewManager>.Instance.SwitchToView((View)4, false, true);
				for (int index2 = 0; index2 < StatsUp; index2++)
				{
					if (Random.Range(1, 100) > 50)
					{
						yield return (object)new WaitForSeconds(0.2f);
						CardModificationInfo obj = mod;
						obj.healthAdjustment++;
						((AbilityBehaviour)this).Card.OnStatsChanged();
						((Card)((AbilityBehaviour)this).Card).Anim.StrongNegationEffect();
					}
					else
					{
						yield return (object)new WaitForSeconds(0.2f);
						CardModificationInfo obj2 = mod;
						obj2.attackAdjustment++;
						((AbilityBehaviour)this).Card.OnStatsChanged();
						((Card)((AbilityBehaviour)this).Card).Anim.StrongNegationEffect();
					}
				}
				yield return (object)new WaitForSeconds(0.1f);
				Singleton<ViewManager>.Instance.Controller.LockState = (ViewLockState)0;
			}
			else
			{
				for (int index2 = 0; index2 < StatsUp; index2++)
				{
					if (Random.Range(1, 100) > 50)
					{
						yield return (object)new WaitForSeconds(0.2f);
						CardModificationInfo obj3 = mod;
						obj3.healthAdjustment++;
						((AbilityBehaviour)this).Card.OnStatsChanged();
						((Card)((AbilityBehaviour)this).Card).Anim.StrongNegationEffect();
					}
					else
					{
						yield return (object)new WaitForSeconds(0.2f);
						CardModificationInfo obj4 = mod;
						obj4.attackAdjustment++;
						((AbilityBehaviour)this).Card.OnStatsChanged();
						((Card)((AbilityBehaviour)this).Card).Anim.StrongNegationEffect();
					}
				}
			}
			yield return ((AbilityBehaviour)this).LearnAbility(0.25f);
			yield return (object)new WaitForSeconds(0.1f);
		}
	}
	public class lifecost_ActivateCashConverter : LifeActiveAbilityCost
	{
		public static Ability ability;

		public override Ability Ability => ability;

		public override int MoneyCost => 4;

		public override IEnumerator Activate()
		{
			yield return ((AbilityBehaviour)this).PreSuccessfulTriggerSequence();
			yield return (object)new WaitForSeconds(0.15f);
			if (!SaveManager.SaveFile.IsPart2)
			{
				float waitTime2 = 0.1f;
				Singleton<ViewManager>.Instance.SwitchToView((View)7, false, true);
				yield return (object)new WaitForSeconds(waitTime2);
				yield return PayCost.ShowDamageSequence(1, 1, toPlayer: false);
				yield return (object)new WaitForSeconds(waitTime2);
				Singleton<ViewManager>.Instance.SwitchToView((View)7, false, true);
				Singleton<ViewManager>.Instance.Controller.LockState = (ViewLockState)0;
			}
			else
			{
				float waitTime2 = 0.5f;
				yield return (object)new WaitForSeconds(waitTime2);
				yield return PayCost.ShowDamageSequence(1, 1, toPlayer: false);
				yield return (object)new WaitForSeconds(waitTime2);
			}
			yield return ((AbilityBehaviour)this).LearnAbility(0.25f);
			yield return (object)new WaitForSeconds(0.1f);
		}
	}
	public class lifecost_ActivateLifeConverter : LifeActiveAbilityCost
	{
		public static Ability ability;

		public override Ability Ability => ability;

		public override int LifeCost => 2;

		public override IEnumerator Activate()
		{
			yield return ((AbilityBehaviour)this).PreSuccessfulTriggerSequence();
			yield return (object)new WaitForSeconds(0.15f);
			if (!SaveManager.SaveFile.IsPart2)
			{
				if (Chainloader.PluginInfos.ContainsKey("extraVoid.inscryption.LifeCost"))
				{
					Singleton<ViewManager>.Instance.SwitchToView((View)7, false, true);
					yield return (object)new WaitForSeconds(0.25f);
					RunState run = RunState.Run;
					run.currency += 2;
					yield return Singleton<CurrencyBowl>.Instance.DropWeightsIn(2);
					yield return (object)new WaitForSeconds(0.75f);
					Singleton<ViewManager>.Instance.SwitchToView((View)4, false, true);
					Singleton<ViewManager>.Instance.Controller.LockState = (ViewLockState)0;
				}
				else
				{
					Singleton<ViewManager>.Instance.SwitchToView((View)7, false, true);
					yield return (object)new WaitForSeconds(0.25f);
					RunState run2 = RunState.Run;
					run2.currency += 2;
					yield return Singleton<CurrencyBowl>.Instance.ShowGain(2, true, false);
					yield return (object)new WaitForSeconds(0.25f);
					Singleton<ViewManager>.Instance.SwitchToView((View)4, false, true);
					Singleton<ViewManager>.Instance.Controller.LockState = (ViewLockState)0;
				}
			}
			else
			{
				SaveData data = SaveData.Data;
				data.currency += 2;
				((Card)((AbilityBehaviour)this).Card).Anim.LightNegationEffect();
			}
			yield return ((AbilityBehaviour)this).LearnAbility(0.25f);
			yield return (object)new WaitForSeconds(0.1f);
		}
	}
	public class lifecost_ActivateStatsUpLife : LifeActiveAbilityCost
	{
		public static Ability ability;

		private const string MOD_ID = "extraVoid.inscryption.LifeCost_statsUp";

		public override Ability Ability => ability;

		public override int LifeCost => 3;

		public override IEnumerator Activate()
		{
			bool flag = !SaveManager.SaveFile.IsPart2;
			if (flag)
			{
				Singleton<ViewManager>.Instance.SwitchToView((View)4, false, true);
			}
			CardModificationInfo val = ((AbilityBehaviour)this).Card.TemporaryMods.Find((CardModificationInfo x) => x.singletonId == "extraVoid.inscryption.LifeCost_statsUp");
			if (val == null)
			{
				val = new CardModificationInfo();
				val.singletonId = "extraVoid.inscryption.LifeCost_statsUp";
				((AbilityBehaviour)this).Card.AddTemporaryMod(val);
			}
			CardModificationInfo obj = val;
			obj.attackAdjustment++;
			CardModificationInfo obj2 = val;
			obj2.healthAdjustment++;
			((AbilityBehaviour)this).Card.OnStatsChanged();
			yield return (object)new WaitForSeconds(0.25f);
			if (flag)
			{
				Singleton<ViewManager>.Instance.Controller.LockState = (ViewLockState)0;
			}
		}
	}
	public class lifecost_ActiveStatsUpMoney : LifeActiveAbilityCost
	{
		public static Ability ability;

		private const string MOD_ID = "extraVoid.inscryption.LifeCost_statsUp";

		public override Ability Ability => ability;

		public override int MoneyCost => 5;

		public override IEnumerator Activate()
		{
			CardModificationInfo val = ((AbilityBehaviour)this).Card.TemporaryMods.Find((CardModificationInfo x) => x.singletonId == "extraVoid.inscryption.LifeCost_statsUp");
			if (val == null)
			{
				val = new CardModificationInfo();
				val.singletonId = "extraVoid.inscryption.LifeCost_statsUp";
				((AbilityBehaviour)this).Card.AddTemporaryMod(val);
			}
			CardModificationInfo obj = val;
			obj.attackAdjustment++;
			CardModificationInfo obj2 = val;
			obj2.healthAdjustment++;
			((AbilityBehaviour)this).Card.OnStatsChanged();
			Singleton<ViewManager>.Instance.SwitchToView((View)4, false, true);
			yield return (object)new WaitForSeconds(0.25f);
			Singleton<ViewManager>.Instance.Controller.LockState = (ViewLockState)0;
		}
	}
	[HarmonyPatch]
	public abstract class LifeActiveAbilityCost : ActivatedAbilityBehaviour
	{
		public virtual int LifeMoneyCost { get; }

		public virtual int LifeCost { get; }

		public virtual int MoneyCost { get; }

		public override int EnergyCost { get; }

		public override int BonesCost { get; }

		private bool CanAffordLife()
		{
			return Singleton<LifeManager>.Instance.Balance + 4 >= LifeCost;
		}

		private bool CanAffordMoney()
		{
			int num = ((!SaveManager.SaveFile.IsPart2) ? RunState.Run.currency : SaveData.Data.currency);
			return num >= MoneyCost;
		}

		private bool CanAffordHybrid()
		{
			Plugin.Log.LogMessage((object)"Lifecost active ability patch firing 3");
			int num = ((!SaveManager.SaveFile.IsPart2) ? RunState.Run.currency : SaveData.Data.currency);
			int num2 = Singleton<LifeManager>.Instance.Balance + 4;
			return num + num2 >= LifeMoneyCost;
		}

		public IEnumerator OnActivatedAbility()
		{
			if (((ActivatedAbilityBehaviour)this).CanAfford() && CanAffordLife() && CanAffordMoney() && CanAffordHybrid() && ((ActivatedAbilityBehaviour)this).CanActivate())
			{
				if (((ActivatedAbilityBehaviour)this).EnergyCost > 0)
				{
					yield return Singleton<ResourcesManager>.Instance.SpendEnergy(((ActivatedAbilityBehaviour)this).EnergyCost);
					if ((Object)(object)Singleton<ConduitCircuitManager>.Instance != (Object)null)
					{
						CardSlot val = Singleton<BoardManager>.Instance.GetSlots(true).Find((CardSlot x) => (Object)(object)x.Card != (Object)null && x.Card.HasAbility((Ability)66));
						if ((Object)(object)val != (Object)null)
						{
							ConduitEnergy component = ((Component)val.Card).GetComponent<ConduitEnergy>();
							if ((Object)(object)component != (Object)null && component.CompletesCircuit())
							{
								yield return Singleton<ResourcesManager>.Instance.AddEnergy(((ActivatedAbilityBehaviour)this).EnergyCost);
							}
						}
					}
				}
				if (((ActivatedAbilityBehaviour)this).BonesCost > 0)
				{
					yield return Singleton<ResourcesManager>.Instance.SpendBones(((ActivatedAbilityBehaviour)this).BonesCost);
				}
				if (LifeCost > 0)
				{
					if (SaveManager.SaveFile.IsPart2)
					{
						yield return PayCost.extractCostPart2_lifeOnly(LifeCost);
					}
					else
					{
						yield return PayCost.extractCostPart1_lifeOnly(LifeCost);
					}
				}
				if (MoneyCost > 0)
				{
					if (SaveManager.SaveFile.IsPart2)
					{
						yield return PayCost.extractCostPart2_MoneyOnly(MoneyCost);
					}
					else
					{
						int currency = RunState.Run.currency;
						yield return PayCost.extractCostPart1_MoneyOnly(MoneyCost, currency);
					}
				}
				if (LifeMoneyCost > 0)
				{
					if (SaveManager.SaveFile.IsPart2)
					{
						int currency2 = SaveData.Data.currency;
						yield return PayCost.extractCostPart2_hybrid(LifeMoneyCost, currency2);
					}
					else
					{
						int currency3 = RunState.Run.currency;
						yield return PayCost.extractCostPart1_hybrid(LifeMoneyCost, currency3);
					}
				}
				yield return (object)new WaitForSeconds(0.1f);
				yield return ((AbilityBehaviour)this).PreSuccessfulTriggerSequence();
				yield return ((ActivatedAbilityBehaviour)this).Activate();
				ProgressionData.SetMechanicLearned((MechanicsConcept)61);
			}
			else
			{
				((Card)((AbilityBehaviour)this).Card).Anim.LightNegationEffect();
				AudioController.Instance.PlaySound2D("toneless_negate", (MixerGroup)10, 0.2f, 0f, (Pitch)null, (Repetition)null, (Randomization)null, (Distortion)null, false);
				yield return (object)new WaitForSeconds(0.25f);
			}
		}
	}
	internal class SigilsToAdd
	{
		public static void AddSigils()
		{
			AddActivateEnergyGamble();
			AddActivateLifeConverter();
			AddActivateLifeRandomStatsUp();
			AddActiveCashConverter();
			AddActiveStatsUpLife();
			AddActiveStatsUpMoney();
		}

		private static void AddActivateEnergyGamble()
		{
			//IL_0069: 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)
			Texture2D imageAsTexture = TextureHelper.GetImageAsTexture("lifecost_ActivateEnergyGamble.png", typeof(Plugin).Assembly, (FilterMode)0);
			Sprite imageAsSprite = TextureHelper.GetImageAsSprite("lifecost_ActivateEnergyGamble_a2.png", typeof(Plugin).Assembly, (SpriteType)11, (FilterMode)0);
			int powerLevel = 0;
			bool leshyUsable = true;
			bool part1Modular = false;
			bool stack = false;
			lifecost_ActivateEnergyGamble.ability = CardUtils.CreateAbilityWithDefaultSettings("Max Energy Gamble", "Pay 6 energy to put 0 to 3 damage on someone's side of the scale", typeof(lifecost_ActivateEnergyGamble), imageAsTexture, imageAsSprite, "Money for Blood", withDialogue: true, powerLevel, leshyUsable, part1Modular, stack).ability;
		}

		private static void AddActivateLifeRandomStatsUp()
		{
			//IL_0070: Unknown result type (might be due to invalid IL or missing references)
			//IL_0075: Unknown result type (might be due to invalid IL or missing references)
			Texture2D imageAsTexture = TextureHelper.GetImageAsTexture("lifecost_ActivateLifeRandomStatsUp.png", typeof(Plugin).Assembly, (FilterMode)0);
			Sprite imageAsSprite = TextureHelper.GetImageAsSprite("lifecost_ActivateLifeRandomStatsUp_a2.png", typeof(Plugin).Assembly, (SpriteType)11, (FilterMode)0);
			int powerLevel = 2;
			bool leshyUsable = true;
			bool part1Modular = false;
			bool stack = false;
			AbilityInfo obj = CardUtils.CreateAbilityWithDefaultSettings("Die Roll", "Pay 5 Life/Foils to gain between 0 and 6 increase in stats, distributed randomly", typeof(lifecost_ActivateLifeRandomStatsUp), imageAsTexture, imageAsSprite, "Sing it once, Sing it twice, take a chance and roll the dice!", withDialogue: true, powerLevel, leshyUsable, part1Modular, stack);
			obj.activated = true;
			lifecost_ActivateLifeRandomStatsUp.ability = obj.ability;
		}

		private static void AddActiveCashConverter()
		{
			//IL_0069: 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)
			Texture2D imageAsTexture = TextureHelper.GetImageAsTexture("lifecost_CashConverter.png", typeof(Plugin).Assembly, (FilterMode)0);
			Sprite imageAsSprite = TextureHelper.GetImageAsSprite("lifecost_CashConverter_a2.png", typeof(Plugin).Assembly, (SpriteType)11, (FilterMode)0);
			int powerLevel = 2;
			bool leshyUsable = true;
			bool part1Modular = false;
			bool stack = false;
			lifecost_ActivateCashConverter.ability = CardUtils.CreateAbilityWithDefaultSettings("Cash Converter", "Pay 4 foils to put 1 damage on your opponent's side of the scale", typeof(lifecost_ActivateCashConverter), imageAsTexture, imageAsSprite, "Money for Blood", withDialogue: true, powerLevel, leshyUsable, part1Modular, stack).ability;
		}

		private static void AddActivateLifeConverter()
		{
			//IL_0069: 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)
			Texture2D imageAsTexture = TextureHelper.GetImageAsTexture("lifecost_LifeConverter.png", typeof(Plugin).Assembly, (FilterMode)0);
			Sprite imageAsSprite = TextureHelper.GetImageAsSprite("lifecost_LifeConverter_a2.png", typeof(Plugin).Assembly, (SpriteType)11, (FilterMode)0);
			int powerLevel = 3;
			bool leshyUsable = true;
			bool part1Modular = false;
			bool stack = false;
			lifecost_ActivateLifeConverter.ability = CardUtils.CreateAbilityWithDefaultSettings("Life Converter", "Pay 2 life to gain 1 foils", typeof(lifecost_ActivateLifeConverter), imageAsTexture, imageAsSprite, "Blood for money", withDialogue: true, powerLevel, leshyUsable, part1Modular, stack).ability;
		}

		private static void AddActiveStatsUpLife()
		{
			//IL_0070: Unknown result type (might be due to invalid IL or missing references)
			//IL_0075: Unknown result type (might be due to invalid IL or missing references)
			Texture2D imageAsTexture = TextureHelper.GetImageAsTexture("lifecost_ActivateStatsUpLife.png", typeof(Plugin).Assembly, (FilterMode)0);
			Sprite imageAsSprite = TextureHelper.GetImageAsSprite("lifecost_ActivateStatsUpLife_a2.png", typeof(Plugin).Assembly, (SpriteType)11, (FilterMode)0);
			int powerLevel = 3;
			bool leshyUsable = true;
			bool part1Modular = true;
			bool stack = false;
			AbilityInfo obj = CardUtils.CreateAbilityWithDefaultSettings("Vamperic Strength", "Pay 3 life to increase the power and health of this card by 1", typeof(lifecost_ActivateStatsUpLife), imageAsTexture, imageAsSprite, "Hurting oneself can lead to an increase in strength.", withDialogue: true, powerLevel, leshyUsable, part1Modular, stack);
			obj.activated = true;
			lifecost_ActivateStatsUpLife.ability = obj.ability;
		}

		private static void AddActiveStatsUpMoney()
		{
			//IL_0069: 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)
			Texture2D imageAsTexture = TextureHelper.GetImageAsTexture("lifecostActivateStatsUpMoney.png", typeof(Plugin).Assembly, (FilterMode)0);
			Sprite imageAsSprite = TextureHelper.GetImageAsSprite("lifecostActivateStatsUpMoney_a2.png", typeof(Plugin).Assembly, (SpriteType)11, (FilterMode)0);
			int powerLevel = 3;
			bool leshyUsable = true;
			bool part1Modular = false;
			bool stack = false;
			lifecost_ActiveStatsUpMoney.ability = CardUtils.CreateAbilityWithDefaultSettings("Greedy Strength", "Pay 5 currency to increase the power and health of this card by 1", typeof(lifecost_ActiveStatsUpMoney), imageAsTexture, imageAsSprite, "One can be hired to do many tasks", withDialogue: true, powerLevel, leshyUsable, part1Modular, stack).ability;
		}
	}
}
namespace LifeCost.Costs
{
	internal class CostsToAdd
	{
		public static void AddCost()
		{
			//IL_0090: Unknown result type (might be due to invalid IL or missing references)
			//IL_0112: Unknown result type (might be due to invalid IL or missing references)
			//IL_0117: Unknown result type (might be due to invalid IL or missing references)
			//IL_0190: Unknown result type (might be due to invalid IL or missing references)
			//IL_0195: Unknown result type (might be due to invalid IL or missing references)
			Texture2D imageAsTexture = TextureHelper.GetImageAsTexture("CostChoiceBack.png", typeof(CostsToAdd).Assembly, (FilterMode)0);
			FullCardCost val = CardCostManager.Register("extraVoid.inscryption.LifeCost", "LifeMoneyCost", typeof(LifeMoneyCost), (Func<int, CardInfo, PlayableCard, Texture2D>)LifeCost.Costs.HCost.Textures.Texture_3D, (Func<int, CardInfo, PlayableCard, Texture2D>)LifeCost.Costs.HCost.Textures.Texture_Pixel);
			CardCostManager.SetCostTier(val, (Func<int, int>)LifeCost.Costs.HCost.CostTier.CostTierH);
			val.ResourceType = (ResourceType)42;
			CardCostManager.SetFoundAtChoiceNodes(val, true, (Texture)(object)imageAsTexture);
			FullCardCost val2 = CardCostManager.Register("extraVoid.inscryption.LifeCost", "LifeCost", typeof(LifeCost.Costs.LCost.LifeCost), (Func<int, CardInfo, PlayableCard, Texture2D>)LifeCost.Costs.LCost.Textures.Texture_3D, (Func<int, CardInfo, PlayableCard, Texture2D>)LifeCost.Costs.LCost.Textures.Texture_Pixel);
			CardCostManager.SetCostTier(val2, (Func<int, int>)LifeCost.Costs.LCost.CostTier.CostTierL);
			val2.ResourceType = val.ResourceType;
			FullCardCost val3 = CardCostManager.Register("extraVoid.inscryption.LifeCost", "MoneyCost", typeof(MoneyCost), (Func<int, CardInfo, PlayableCard, Texture2D>)LifeCost.Costs.MCost.Textures.Texture_3D, (Func<int, CardInfo, PlayableCard, Texture2D>)LifeCost.Costs.MCost.Textures.Texture_Pixel);
			CardCostManager.SetCostTier(val3, (Func<int, int>)LifeCost.Costs.MCost.CostTier.CostTierM);
			val3.ResourceType = val.ResourceType;
			if (Plugin.configFairHandActive.Value)
			{
				CardCostManager.SetCanBePlayedByTurn2WithHand(val, (Func<int, CardInfo, List<CardInfo>, bool>)LifeCost.Costs.HCost.CardCanBePlayedByTurn2WithHand.CanBePlayed);
				CardCostManager.SetCanBePlayedByTurn2WithHand(val2, (Func<int, CardInfo, List<CardInfo>, bool>)LifeCost.Costs.LCost.CardCanBePlayedByTurn2WithHand.CanBePlayed);
				CardCostManager.SetCanBePlayedByTurn2WithHand(val3, (Func<int, CardInfo, List<CardInfo>, bool>)LifeCost.Costs.MCost.CardCanBePlayedByTurn2WithHand.CanBePlayed);
			}
		}
	}
	internal class PayCost
	{
		public static IEnumerator extractCostPart1_hybrid(int costToPay, int currentCurrency)
		{
			float waitTime = 0.1f;
			List<Rigidbody> list2;
			if (costToPay > currentCurrency)
			{
				Singleton<ViewManager>.Instance.SwitchToView((View)7, false, true);
				costToPay -= currentCurrency;
				yield return (object)new WaitForSeconds(waitTime);
				list2 = Singleton<CurrencyBowl>.Instance.TakeWeights(RunState.Run.currency);
				foreach (Rigidbody rigidbody2 in list2)
				{
					yield return (object)new WaitForSeconds(waitTime);
					float num = (float)list2.IndexOf(rigidbody2) * 0.05f;
					Tween.Position(((Component)rigidbody2).transform, ((Component)rigidbody2).transform.position + Vector3.up * 0.5f, 0.075f, num, Tween.EaseIn, (LoopType)0, (Action)null, (Action)null, true);
					Tween.Position(((Component)rigidbody2).transform, new Vector3(0f, 5.5f, 4f), 0.3f, 0.125f + num, Tween.EaseOut, (LoopType)0, (Action)null, (Action)null, true);
					Object.Destroy((Object)(object)((Component)rigidbody2).gameObject, 0.5f);
				}
				RunState.Run.currency = 0;
				yield return (object)new WaitForSeconds(waitTime);
				yield return ShowDamageSequence(costToPay, costToPay, toPlayer: true);
				Singleton<ViewManager>.Instance.SwitchToView((View)0, false, true);
				Singleton<ViewManager>.Instance.Controller.LockState = (ViewLockState)0;
				yield break;
			}
			Singleton<ViewManager>.Instance.SwitchToView((View)7, false, true);
			yield return (object)new WaitForSeconds(waitTime);
			list2 = Singleton<CurrencyBowl>.Instance.TakeWeights(costToPay);
			foreach (Rigidbody rigidbody2 in list2)
			{
				yield return (object)new WaitForSeconds(waitTime);
				float num2 = (float)list2.IndexOf(rigidbody2) * 0.05f;
				Tween.Position(((Component)rigidbody2).transform, ((Component)rigidbody2).transform.position + Vector3.up * 0.5f, 0.075f, num2, Tween.EaseIn, (LoopType)0, (Action)null, (Action)null, true);
				Tween.Position(((Component)rigidbody2).transform, new Vector3(0f, 5.5f, 4f), 0.3f, 0.125f + num2, Tween.EaseOut, (LoopType)0, (Action)null, (Action)null, true);
				Object.Destroy((Object)(object)((Component)rigidbody2).gameObject, 0.5f);
			}
			yield return (object)new WaitForSeconds(waitTime);
			RunState.Run.currency = currentCurrency - costToPay;
			Singleton<ViewManager>.Instance.SwitchToView((View)0, false, true);
			Singleton<ViewManager>.Instance.Controller.LockState = (ViewLockState)0;
		}

		public static IEnumerator extractCostPart1_lifeOnly(int costToPay)
		{
			float waitTime = 0.1f;
			Singleton<ViewManager>.Instance.SwitchToView((View)7, false, true);
			yield return (object)new WaitForSeconds(waitTime);
			yield return ShowDamageSequence(costToPay, costToPay, toPlayer: true);
			yield return (object)new WaitForSeconds(waitTime);
			Singleton<ViewManager>.Instance.SwitchToView((View)0, false, true);
			Singleton<ViewManager>.Instance.Controller.LockState = (ViewLockState)0;
		}

		public static IEnumerator extractCostPart1_MoneyOnly(int costToPay, int currentCurrency)
		{
			float waitTime = 0.1f;
			Singleton<ViewManager>.Instance.SwitchToView((View)7, false, true);
			yield return (object)new WaitForSeconds(waitTime);
			List<Rigidbody> list = Singleton<CurrencyBowl>.Instance.TakeWeights(costToPay);
			foreach (Rigidbody rigidbody in list)
			{
				yield return (object)new WaitForSeconds(waitTime);
				float num = (float)list.IndexOf(rigidbody) * 0.05f;
				Tween.Position(((Component)rigidbody).transform, ((Component)rigidbody).transform.position + Vector3.up * 0.5f, 0.075f, num, Tween.EaseIn, (LoopType)0, (Action)null, (Action)null, true);
				Tween.Position(((Component)rigidbody).transform, new Vector3(0f, 5.5f, 4f), 0.3f, 0.125f + num, Tween.EaseOut, (LoopType)0, (Action)null, (Action)null, true);
				Object.Destroy((Object)(object)((Component)rigidbody).gameObject, 0.5f);
			}
			yield return (object)new WaitForSeconds(waitTime);
			RunState.Run.currency = currentCurrency - costToPay;
			Singleton<ViewManager>.Instance.SwitchToView((View)0, false, true);
			Singleton<ViewManager>.Instance.Controller.LockState = (ViewLockState)0;
		}

		public static IEnumerator ShowDamageSequence(int damage, int numWeights, bool toPlayer, float waitAfter = 0.125f, GameObject alternateWeightPrefab = null, float waitBeforeCalcDamage = 0f, bool changeView = false)
		{
			if (damage > 1 && (Object)(object)Singleton<OpponentAnimationController>.Instance != (Object)null)
			{
				if ((Object)(object)P03AnimationController.Instance != (Object)null && (int)P03AnimationController.Instance.CurrentFace == 0)
				{
					P03AnimationController.Instance.SwitchToFace((Face)(toPlayer ? 4 : 3), false, true);
				}
				else if ((Object)(object)Singleton<LifeManager>.Instance.Scales != (Object)null)
				{
					Singleton<OpponentAnimationController>.Instance.SetLookTarget(((Component)Singleton<LifeManager>.Instance.Scales).transform, Vector3.up * 2f);
				}
			}
			if ((Object)(object)Singleton<LifeManager>.Instance.Scales != (Object)null)
			{
				if (changeView)
				{
					Singleton<ViewManager>.Instance.SwitchToView((View)7, false, false);
					yield return (object)new WaitForSeconds(0.1f);
				}
				yield return Singleton<LifeManager>.Instance.Scales.AddDamage(damage, numWeights, toPlayer, alternateWeightPrefab);
				if (waitBeforeCalcDamage > 0f)
				{
					yield return (object)new WaitForSeconds(waitBeforeCalcDamage);
				}
				if (toPlayer)
				{
					LifeManager instance = Singleton<LifeManager>.Instance;
					instance.PlayerDamage += damage;
				}
				else
				{
					LifeManager instance2 = Singleton<LifeManager>.Instance;
					instance2.OpponentDamage += damage;
				}
				yield return (object)new WaitForSeconds(waitAfter);
			}
			if ((Object)(object)Singleton<OpponentAnimationController>.Instance != (Object)null)
			{
				if ((Object)(object)P03AnimationController.Instance != (Object)null && ((int)P03AnimationController.Instance.CurrentFace == 3 || (int)P03AnimationController.Instance.CurrentFace == 4))
				{
					P03AnimationController.Instance.PlayFaceStatic();
					P03AnimationController.Instance.SwitchToFace((Face)0, false, false);
				}
				else
				{
					Singleton<OpponentAnimationController>.Instance.ClearLookTarget();
				}
			}
		}

		public static IEnumerator extractCostPart2_hybrid(int costToPay, int currentCurrency)
		{
			float waitTime = 0.5f;
			if (costToPay > currentCurrency)
			{
				costToPay -= currentCurrency;
				yield return (object)new WaitForSeconds(waitTime);
				AudioController.Instance.PlaySound2D("chipDelay_2", (MixerGroup)0, 1f, 0f, (Pitch)null, (Repetition)null, (Randomization)null, (Distortion)null, false);
				yield return foilToZero();
				yield return (object)new WaitForSeconds(waitTime);
				yield return ShowDamageSequence(costToPay, costToPay, toPlayer: true);
			}
			else
			{
				AudioController.Instance.PlaySound2D("chipDelay_2", (MixerGroup)0, 1f, 0f, (Pitch)null, (Repetition)null, (Randomization)null, (Distortion)null, false);
				yield return foilSpend(costToPay);
			}
		}

		public static IEnumerator extractCostPart2_lifeOnly(int costToPay)
		{
			float waitTime = 0.5f;
			yield return (object)new WaitForSeconds(waitTime);
			yield return ShowDamageSequence(costToPay, costToPay, toPlayer: true);
			yield return (object)new WaitForSeconds(waitTime);
		}

		public static IEnumerator extractCostPart2_MoneyOnly(int costToPay)
		{
			float waitTime = 0.5f;
			yield return (object)new WaitForSeconds(waitTime);
			AudioController.Instance.PlaySound2D("chipDelay_2", (MixerGroup)0, 1f, 0f, (Pitch)null, (Repetition)null, (Randomization)null, (Distortion)null, false);
			yield return foilSpend(costToPay);
			yield return (object)new WaitForSeconds(waitTime);
		}

		public static IEnumerator foilSetup()
		{
			Plugin.Log.LogWarning((object)"Life cost set up");
			Plugin.Log.LogWarning((object)SaveData.Data.currency);
			yield break;
		}

		public static IEnumerator foilCleanUp()
		{
			Plugin.Log.LogWarning((object)"Life cost clean up");
			Plugin.Log.LogWarning((object)SaveData.Data.currency);
			yield break;
		}

		public static IEnumerator foilSpend(int amount)
		{
			Plugin.Log.LogWarning((object)("Spending foils: " + SaveData.Data.currency));
			yield return SaveData.Data.currency = SaveData.Data.currency - amount;
			Plugin.Log.LogWarning((object)("current foils: " + SaveData.Data.currency));
		}

		public static IEnumerator foilToZero()
		{
			SaveData data = SaveData.Data;
			int num = 0;
			data.currency = 0;
			yield return num;
		}
	}
}
namespace LifeCost.Costs.MCost
{
	internal class CardCanBePlayedByTurn2WithHand
	{
		public static bool CanBePlayed(int amount, CardInfo card, List<CardInfo> hand)
		{
			return amount <= Plugin.configFairHandCostM.Value;
		}
	}
	internal class CostTier
	{
		public static int CostTierM(int amount)
		{
			return Mathf.FloorToInt((float)amount / 5f);
		}
	}
	public class MoneyCost : CustomCardCost
	{
		public ResourceType ResourceType = (ResourceType)42;

		public override string CostName => "MoneyCost";

		public override bool CostSatisfied(int cardCost, PlayableCard card)
		{
			int num = ((!SaveManager.SaveFile.IsPart2) ? RunState.Run.currency : SaveData.Data.currency);
			if (cardCost > num)
			{
				return false;
			}
			return true;
		}

		public override string CostUnsatisfiedHint(int cardCost, PlayableCard card)
		{
			if (SaveManager.SaveFile.IsPart2)
			{
				return "You do not have enough [c:gray]Foils[c:] to play that. You gain [c:gray]Foils[c:] by dealing overkill damage.";
			}
			string item = "You lack the foils to play that [c:gray]" + ((Card)card).Info.DisplayedNameLocalized + "[c:].";
			string item2 = $"[c:gray]{((Card)card).Info.DisplayedNameLocalized}[c:] requires you pay it's cost in [c:gray]foils[c:], that which you have [c:gray]{RunState.Run.currency}[c:].";
			string item3 = $"That [c:gray]{((Card)card).Info.DisplayedNameLocalized}[c:] has the cost of [c:gray]{cardCost}[c:] foils, which you do not have.";
			List<string> list = new List<string>();
			list.Add(item);
			list.Add(item2);
			list.Add(item3);
			return list[Random.Range(0, list.Count)];
		}

		public override IEnumerator OnPlayed(int cardCost, PlayableCard card)
		{
			if (SaveManager.SaveFile.IsPart2)
			{
				yield return PayCost.extractCostPart2_MoneyOnly(cardCost);
			}
			else
			{
				yield return PayCost.extractCostPart1_MoneyOnly(cardCost, RunState.Run.currency);
			}
		}
	}
	internal class Textures
	{
		public static Texture2D Texture_3D(int cardCost, CardInfo info, PlayableCard card)
		{
			return TextureHelper.GetImageAsTexture($"MoneyCost_{cardCost}.png", typeof(Plugin).Assembly, (FilterMode)0);
		}

		public static Texture2D Texture_Pixel(int cardCost, CardInfo info, PlayableCard card)
		{
			return Part2CardCostRender.CombineIconAndCount(cardCost, TextureHelper.GetImageAsTexture("MoneyCost_pixel.png", typeof(Plugin).Assembly, (FilterMode)0));
		}
	}
}
namespace LifeCost.Costs.HCost
{
	internal class CardCanBePlayedByTurn2WithHand
	{
		public static bool CanBePlayed(int amount, CardInfo card, List<CardInfo> hand)
		{
			return amount <= Plugin.configFairHandCostH.Value;
		}
	}
	internal class CostTier
	{
		public static int CostTierH(int amount)
		{
			return Mathf.FloorToInt((float)amount / 3f);
		}
	}
	public class LifeMoneyCost : CustomCardCost
	{
		public ResourceType ResourceType = (ResourceType)42;

		public override string CostName => "LifeMoneyCost";

		public override bool CostSatisfied(int cardCost, PlayableCard card)
		{
			int num = ((!SaveManager.SaveFile.IsPart2) ? RunState.Run.currency : SaveData.Data.currency);
			int num2 = num + Singleton<LifeManager>.Instance.Balance + 4;
			if (cardCost > num2)
			{
				return false;
			}
			return true;
		}

		public override string CostUnsatisfiedHint(int cardCost, PlayableCard card)
		{
			if (SaveManager.SaveFile.IsPart2)
			{
				return "You do not have enough [c:bG]Life[c:] or [c:gray]Foils[c:] to play that. Damage your opponent to gain more [c:bG]Life[c:].";
			}
			return "Your [c:bG]Scales[c:] are too tipped and you lack the [c:gray]Foils[c:] to play " + ((Card)card).Info.DisplayedNameLocalized + ".";
		}

		public override IEnumerator OnPlayed(int cardCost, PlayableCard card)
		{
			if (SaveManager.SaveFile.IsPart2)
			{
				yield return PayCost.extractCostPart2_hybrid(cardCost, SaveData.Data.currency);
			}
			else
			{
				yield return PayCost.extractCostPart1_hybrid(cardCost, RunState.Run.currency);
			}
		}
	}
	internal class Textures
	{
		public static Texture2D Texture_3D(int cardCost, CardInfo info, PlayableCard card)
		{
			return TextureHelper.GetImageAsTexture($"LifeMoneyCost_{cardCost}.png", typeof(Plugin).Assembly, (FilterMode)0);
		}

		public static Texture2D Texture_Pixel(int cardCost, CardInfo info, PlayableCard card)
		{
			return Part2CardCostRender.CombineIconAndCount(cardCost, TextureHelper.GetImageAsTexture("LifeMoneyCost_pixel.png", typeof(Plugin).Assembly, (FilterMode)0));
		}
	}
}
namespace LifeCost.Costs.LCost
{
	internal class CardCanBePlayedByTurn2WithHand
	{
		public static bool CanBePlayed(int amount, CardInfo card, List<CardInfo> hand)
		{
			return amount <= Plugin.configFairHandCostL.Value;
		}
	}
	internal class CostTier
	{
		public static int CostTierL(int amount)
		{
			return Mathf.FloorToInt((float)amount);
		}
	}
	public class LifeCost : CustomCardCost
	{
		public ResourceType ResourceType = (ResourceType)42;

		public override string CostName => "LifeCost";

		public override bool CostSatisfied(int cardCost, PlayableCard card)
		{
			int num = Singleton<LifeManager>.Instance.Balance + 4;
			if (cardCost > num)
			{
				return false;
			}
			return true;
		}

		public override string CostUnsatisfiedHint(int cardCost, PlayableCard card)
		{
			if (SaveManager.SaveFile.IsPart2)
			{
				return "You do not have enough [c:bG]Life[c:] on your scales to play that. Damage your opponent to gain more [c:bG]Life[c:].";
			}
			string item = "Your [c:bG]Scales[c:] are too tipped to play [c:bG]" + ((Card)card).Info.DisplayedNameLocalized + "[c:].";
			string item2 = "[c:bG]" + ((Card)card).Info.DisplayedNameLocalized + "[c:] requires you to pay in life, in which you can not fullfill without killing yourself.";
			string item3 = "You would kill yourself if you played [c:bG]" + ((Card)card).Info.DisplayedNameLocalized + "[c:]. Your [c:bG]Scales[c:] are too tipped";
			List<string> list = new List<string>();
			list.Add(item);
			list.Add(item2);
			list.Add(item3);
			return list[Random.Range(0, list.Count)];
		}

		public override IEnumerator OnPlayed(int cardCost, PlayableCard card)
		{
			if (SaveManager.SaveFile.IsPart2)
			{
				yield return PayCost.extractCostPart2_lifeOnly(cardCost);
			}
			else
			{
				yield return PayCost.extractCostPart1_lifeOnly(cardCost);
			}
		}
	}
	internal class Textures
	{
		public static Texture2D Texture_3D(int cardCost, CardInfo info, PlayableCard card)
		{
			return TextureHelper.GetImageAsTexture($"LifeCost_{cardCost}.png", typeof(Plugin).Assembly, (FilterMode)0);
		}

		public static Texture2D Texture_Pixel(int cardCost, CardInfo info, PlayableCard card)
		{
			return Part2CardCostRender.CombineIconAndCount(cardCost, TextureHelper.GetImageAsTexture("LifeCost_pixel.png", typeof(Plugin).Assembly, (FilterMode)0));
		}
	}
}
namespace LifeCost.Cards
{
	public static class Leck
	{
		public static void AddCard()
		{
			string displayName = "Leck";
			string description = "The Lost Beast, in the shape of a tooth, showing up only in error.";
			int attack = 5;
			int health = 1;
			int bloodCost = 0;
			int boneCost = 0;
			int energyCost = 0;
			List<CardMetaCategory> cardMetaCategories = new List<CardMetaCategory>();
			List<Tribe> tribes = new List<Tribe>();
			List<Ability> abilities = new List<Ability>();
			List<Trait> traits = new List<Trait>();
			Texture2D imageAsTexture = TextureHelper.GetImageAsTexture("teck.png", typeof(Plugin).Assembly, (FilterMode)0);
			Texture2D imageAsTexture2 = TextureHelper.GetImageAsTexture("pixel_teck.png", typeof(Plugin).Assembly, (FilterMode)0);
			Texture2D imageAsTexture3 = TextureHelper.GetImageAsTexture("teck_e.png", typeof(Plugin).Assembly, (FilterMode)0);
			Texture2D texture_base = imageAsTexture;
			Texture2D texture_emission = imageAsTexture3;
			Texture2D texture_pixel = imageAsTexture2;
			CardInfo val = CardUtils.CreateCardWithDefaultSettings("lifecost_Leck", displayName, attack, health, texture_base, texture_emission, cardMetaCategories, tribes, traits, abilities, texture_pixel, bloodCost, boneCost, energyCost);
			val.description = description;
			CardExtensions.SetCustomCost(val, "LifeCost", 4);
			CardManager.Add("lifecost", val);
		}
	}
	public static class Meck
	{
		public static void AddCard()
		{
			string displayName = "Meck";
			string description = "The Lost Beast, in the shape of a tooth, showing up only in error.";
			int attack = 1;
			int health = 1;
			int bloodCost = 0;
			int boneCost = 0;
			int energyCost = 0;
			List<CardMetaCategory> cardMetaCategories = new List<CardMetaCategory>();
			List<Tribe> tribes = new List<Tribe>();
			List<Ability> abilities = new List<Ability>();
			List<Trait> traits = new List<Trait>();
			Texture2D imageAsTexture = TextureHelper.GetImageAsTexture("teck.png", typeof(Plugin).Assembly, (FilterMode)0);
			Texture2D imageAsTexture2 = TextureHelper.GetImageAsTexture("pixel_teck.png", typeof(Plugin).Assembly, (FilterMode)0);
			Texture2D imageAsTexture3 = TextureHelper.GetImageAsTexture("teck_e.png", typeof(Plugin).Assembly, (FilterMode)0);
			Texture2D texture_base = imageAsTexture;
			Texture2D texture_emission = imageAsTexture3;
			Texture2D texture_pixel = imageAsTexture2;
			CardInfo val = CardUtils.CreateCardWithDefaultSettings("lifecost_Meck", displayName, attack, health, texture_base, texture_emission, cardMetaCategories, tribes, traits, abilities, texture_pixel, bloodCost, boneCost, energyCost);
			val.description = description;
			CardExtensions.SetCustomCost(val, "MoneyCost", 1);
			CardManager.Add("lifecost", val);
		}
	}
	public static class Teck
	{
		public static void AddCard()
		{
			string displayName = "Teck";
			string description = "The Lost Beast, in the shape of a tooth, showing up only in error.";
			int attack = 1;
			int health = 1;
			int bloodCost = 0;
			int boneCost = 0;
			int energyCost = 0;
			List<CardMetaCategory> cardMetaCategories = new List<CardMetaCategory>();
			List<Tribe> tribes = new List<Tribe>();
			List<Ability> abilities = new List<Ability>();
			List<Trait> traits = new List<Trait>();
			Texture2D imageAsTexture = TextureHelper.GetImageAsTexture("teck.png", typeof(Plugin).Assembly, (FilterMode)0);
			Texture2D imageAsTexture2 = TextureHelper.GetImageAsTexture("pixel_teck.png", typeof(Plugin).Assembly, (FilterMode)0);
			Texture2D imageAsTexture3 = TextureHelper.GetImageAsTexture("teck_e.png", typeof(Plugin).Assembly, (FilterMode)0);
			Texture2D texture_base = imageAsTexture;
			Texture2D texture_emission = imageAsTexture3;
			Texture2D texture_pixel = imageAsTexture2;
			CardInfo val = CardUtils.CreateCardWithDefaultSettings("lifecost_Teck", displayName, attack, health, texture_base, texture_emission, cardMetaCategories, tribes, traits, abilities, texture_pixel, bloodCost, boneCost, energyCost);
			val.description = description;
			CardExtensions.SetCustomCost(val, "LifeMoneyCost", 1);
			CardManager.Add("lifecost", val);
		}
	}
}
namespace LifeCost.Act2Experiment
{
	internal class Act2Temple
	{
		[HarmonyPatch(typeof(CollectionUI), "Start")]
		public class AddLifeTab
		{
			public static void Postfix(ref CollectionUI __instance)
			{
				if (!Chainloader.PluginInfos.ContainsKey("mrfantastik.inscryption.infact2"))
				{
					AddTab(__instance);
				}
			}

			public static void AddTab(CollectionUI instance)
			{
				//IL_007e: Unknown result type (might be due to invalid IL or missing references)
				//IL_00a1: Unknown result type (might be due to invalid IL or missing references)
				//IL_00f9: Unknown result type (might be due to invalid IL or missing references)
				GameObject val = Object.Instantiate<GameObject>(((Component)((Component)instance).gameObject.transform.Find("MainPanel").Find("Tabs").Find("Tab_4")).gameObject);
				((Object)val).name = "Tab_5";
				val.transform.parent = ((Component)instance).gameObject.transform.Find("MainPanel").Find("Tabs");
				val.transform.localPosition = new Vector3(-0.718f, 0.175f, 0f);
				((TabbedUIPanel)instance).tabButtons.Add(val.GetComponent<GenericUIButton>());
				val.GetComponent<GenericUIButton>().inputKey = (KeyCode)53;
				val.GetComponent<GenericUIButton>().OnButtonDown = ((Component)((Component)instance).gameObject.transform.Find("MainPanel").Find("Tabs").Find("Tab_4")).gameObject.GetComponent<GenericUIButton>().OnButtonDown;
				val.GetComponent<BoxCollider2D>().size = new Vector2(0.55f, 0.44f);
				((Component)val.gameObject.transform.Find("Icon")).gameObject.GetComponent<SpriteRenderer>().sprite = CardUtils.getSprite("life_temple_tab.png");
			}
		}

		[HarmonyPatch(typeof(CollectionUI), "CreatePages")]
		public class SortLifeCards
		{
			public static void Postfix(ref CollectionUI __instance, ref List<List<CardInfo>> __result, ref List<CardInfo> cards)
			{
				if (!Chainloader.PluginInfos.ContainsKey("mrfantastik.inscryption.infact2"))
				{
					__result = Test(__instance, __result, cards);
				}
			}

			public static List<List<CardInfo>> Test(CollectionUI Instance, List<List<CardInfo>> Result, List<CardInfo> cards)
			{
				//IL_01d4: Unknown result type (might be due to invalid IL or missing references)
				//IL_01db: Expected I4, but got Unknown
				//IL_024b: Unknown result type (might be due to invalid IL or missing references)
				//IL_0252: Expected I4, but got Unknown
				//IL_025c: Unknown result type (might be due to invalid IL or missing references)
				//IL_0263: Expected I4, but got Unknown
				cards.Sort(delegate(CardInfo a, CardInfo b)
				{
					//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)
					//IL_000c: Unknown result type (might be due to invalid IL or missing references)
					//IL_000e: Expected I4, but got Unknown
					//IL_00a1: 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)
					int num10 = a.temple - b.temple;
					if (num10 != 0)
					{
						return num10;
					}
					int num11 = (a.metaCategories.Contains((CardMetaCategory)3) ? 1 : 0);
					int num12 = (b.metaCategories.Contains((CardMetaCategory)3) ? 1 : 0) - num11;
					if (num12 != 0)
					{
						return num12;
					}
					int num13 = a.CostTier - b.CostTier;
					if (num13 != 0)
					{
						return num13;
					}
					int num14 = a.BonesCost - b.BonesCost;
					if (num14 != 0)
					{
						return num14;
					}
					int num15 = ((a.GemsCost.Count == 1) ? ((int)a.GemsCost[0]) : 0);
					num15 = ((b.GemsCost.Count == 1) ? ((int)b.GemsCost[0]) : 0);
					int num16 = num15 - num15;
					if (num16 != 0)
					{
						return num16;
					}
					int num17 = a.DisplayedNameEnglish.CompareTo(b.DisplayedNameEnglish);
					return (num17 == 0) ? ((Object)a).name.CompareTo(((Object)b).name) : num17;
				});
				cards = new List<CardInfo>(cards);
				List<CardInfo> toRemove = new List<CardInfo>();
				for (int i = 1; i < cards.Count; i++)
				{
					if (((Object)cards[i]).name == ((Object)cards[i - 1]).name)
					{
						toRemove.Add(cards[i]);
					}
				}
				cards.RemoveAll((CardInfo x) => toRemove.Contains(x));
				List<List<CardInfo>> list = new List<List<CardInfo>>();
				List<CardInfo> AllBoons = new List<CardInfo>();
				int num = 0;
				for (int j = 0; j < cards.Count; j++)
				{
					int num2 = num / 8;
					if (num2 >= list.Count)
					{
						list.Add(new List<CardInfo>());
					}
					bool flag = false;
					if ((Object)(object)cards[j] != (Object)null && (cards[j].LifeCost() != 0 || cards[j].LifeMoneyCost() != 0 || cards[j].MoneyCost() != 0))
					{
						flag = true;
					}
					if (flag)
					{
						num++;
						AllBoons.Add(cards[j]);
						list[num2].Add(cards[j]);
					}
				}
				cards.RemoveAll((CardInfo x) => AllBoons.Contains(x));
				List<List<CardInfo>> list2 = new List<List<CardInfo>>();
				list2.Add(new List<CardInfo>());
				Instance.tabPageIndices = new int[5];
				for (int k = 0; k < Instance.tabPageIndices.Length; k++)
				{
					Instance.tabPageIndices[k] = 0;
				}
				for (int l = 0; l < cards.Count; l++)
				{
					List<CardInfo> list3 = list2[list2.Count - 1];
					if (l == 0)
					{
						int num3 = (int)cards[l].temple;
						for (int m = 0; m < num3; m++)
						{
							list2.Add(new List<CardInfo>());
							Instance.tabPageIndices[m + 1] = list2.IndexOf(list3) + 1;
							list3 = list2[list2.Count - 1];
						}
					}
					list3.Add(cards[l]);
					bool flag2 = l == cards.Count - 1;
					if (flag2)
					{
						continue;
					}
					int num4 = (int)cards[l].temple;
					int num5 = (int)cards[l + 1].temple;
					int num6 = num5 - num4 - 1;
					for (int n = 0; n < num6; n++)
					{
						list2.Add(new List<CardInfo>());
						Instance.tabPageIndices[num4 + 1 + n] = list2.IndexOf(list3) + 1;
						list3 = list2[list2.Count - 1];
					}
					bool flag3 = !flag2 && num4 != num5;
					if (list3.Count >= 8 || flag3)
					{
						list2.Add(new List<CardInfo>());
						if (flag3)
						{
							Instance.tabPageIndices[num5] = list2.IndexOf(list3) + 1;
						}
					}
				}
				for (int num7 = 0; num7 < Instance.tabPageIndices.Length; num7++)
				{
					if (num7 > 0 && Instance.tabPageIndices[num7] == 0)
					{
						list2.Add(new List<CardInfo>());
						Instance.tabPageIndices[num7] = list2.Count - 1;
					}
				}
				list2[list2.Count - 1] = list[0];
				int num8 = list2.Count - 1;
				if (list.Count > 0)
				{
					for (int num9 = 1; num9 < list.Count; num9++)
					{
						list2.Add(list[num9]);
					}
				}
				Instance.tabPageIndices[4] = num8;
				return list2;
			}
		}
	}
}

plugins/Void_Slime-Region_Expansions/plugins/RegionExpansions.dll

Decompiled 5 months ago
using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using BepInEx;
using BepInEx.Bootstrap;
using BepInEx.Logging;
using DiskCardGame;
using HarmonyLib;
using Infiniscryption.PackManagement;
using InscryptionAPI.Card;
using InscryptionAPI.Encounters;
using InscryptionAPI.Guid;
using InscryptionAPI.Helpers;
using InscryptionAPI.Regions;
using Microsoft.CodeAnalysis;
using RegionExpansions.Encounter;
using RegionExpansions.Regions;
using RegionExpansions.cards;
using RegionExpansions.lib;
using RegionExpansions.sigils;
using UnityEngine;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: TargetFramework(".NETStandard,Version=v2.0", FrameworkDisplayName = ".NET Standard 2.0")]
[assembly: AssemblyCompany("RegionExpansions")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyDescription("a collection of regions for inscryption")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("RegionExpansions")]
[assembly: AssemblyTitle("RegionExpansions")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.0.0")]
[module: UnverifiableCode]
[module: RefSafetyRules(11)]
namespace Microsoft.CodeAnalysis
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	internal sealed class EmbeddedAttribute : Attribute
	{
	}
}
namespace System.Runtime.CompilerServices
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	[AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)]
	internal sealed class RefSafetyRulesAttribute : Attribute
	{
		public readonly int Version;

		public RefSafetyRulesAttribute(int P_0)
		{
			Version = P_0;
		}
	}
}
namespace RegionExpansions
{
	public class CustomLine
	{
		public Face p03Face;

		public Emotion emotion;

		public LetterAnimation letterAnimation;

		public Speaker speaker;

		public string text;

		public string specialInstruction;

		public StoryEvent storyCondition;

		public bool storyConditionMustBeMet;

		public Line ToLine(List<Speaker> speakers)
		{
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			//IL_001d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0022: Unknown result type (might be due to invalid IL or missing references)
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_0029: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0030: Unknown result type (might be due to invalid IL or missing references)
			//IL_0035: Unknown result type (might be due to invalid IL or missing references)
			//IL_003a: 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)
			//IL_0041: Unknown result type (might be due to invalid IL or missing references)
			//IL_0046: Unknown result type (might be due to invalid IL or missing references)
			//IL_0049: Unknown result type (might be due to invalid IL or missing references)
			//IL_0058: Unknown result type (might be due to invalid IL or missing references)
			//IL_0013: 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_0082: Unknown result type (might be due to invalid IL or missing references)
			//IL_0084: Unknown result type (might be due to invalid IL or missing references)
			//IL_0089: 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_009b: Expected O, but got Unknown
			if (!speakers.Contains(speaker))
			{
				speakers.Add(speaker);
			}
			return new Line
			{
				p03Face = p03Face,
				emotion = emotion,
				letterAnimation = letterAnimation,
				speakerIndex = speakers.IndexOf(speaker),
				text = (text ?? ""),
				specialInstruction = (specialInstruction ?? ""),
				storyCondition = storyCondition,
				storyConditionMustBeMet = storyConditionMustBeMet
			};
		}

		public static implicit operator CustomLine(string str)
		{
			return new CustomLine
			{
				text = str
			};
		}

		public static implicit operator CustomLine((string, LetterAnimation, Emotion) param)
		{
			//IL_0013: Unknown result type (might be due to invalid IL or missing references)
			//IL_0018: Unknown result type (might be due to invalid IL or missing references)
			//IL_001f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			return new CustomLine
			{
				text = param.Item1,
				emotion = param.Item3,
				letterAnimation = param.Item2
			};
		}

		public static implicit operator CustomLine((string, LetterAnimation) param)
		{
			//IL_0013: Unknown result type (might be due to invalid IL or missing references)
			//IL_0018: Unknown result type (might be due to invalid IL or missing references)
			CustomLine customLine = new CustomLine();
			(customLine.text, customLine.letterAnimation) = param;
			return customLine;
		}

		public static implicit operator CustomLine((string, LetterAnimation, Speaker) param)
		{
			//IL_0013: Unknown result type (might be due to invalid IL or missing references)
			//IL_0018: Unknown result type (might be due to invalid IL or missing references)
			//IL_001f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			return new CustomLine
			{
				text = param.Item1,
				speaker = param.Item3,
				letterAnimation = param.Item2
			};
		}

		public static implicit operator CustomLine((string, LetterAnimation, Speaker, Emotion) param)
		{
			//IL_0013: Unknown result type (might be due to invalid IL or missing references)
			//IL_0018: Unknown result type (might be due to invalid IL or missing references)
			//IL_001f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0024: 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_0030: Unknown result type (might be due to invalid IL or missing references)
			return new CustomLine
			{
				text = param.Item1,
				speaker = param.Item3,
				letterAnimation = param.Item2,
				emotion = param.Item4
			};
		}

		public static implicit operator CustomLine((string, Emotion) param)
		{
			//IL_0013: Unknown result type (might be due to invalid IL or missing references)
			//IL_0018: Unknown result type (might be due to invalid IL or missing references)
			CustomLine customLine = new CustomLine();
			(customLine.text, customLine.emotion) = param;
			return customLine;
		}

		public static implicit operator CustomLine((string, Emotion, Speaker) param)
		{
			//IL_0013: Unknown result type (might be due to invalid IL or missing references)
			//IL_0018: Unknown result type (might be due to invalid IL or missing references)
			//IL_001f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			return new CustomLine
			{
				text = param.Item1,
				speaker = param.Item3,
				emotion = param.Item2
			};
		}

		public static implicit operator CustomLine((string, Speaker) param)
		{
			//IL_0013: Unknown result type (might be due to invalid IL or missing references)
			//IL_0018: Unknown result type (might be due to invalid IL or missing references)
			CustomLine customLine = new CustomLine();
			(customLine.text, customLine.speaker) = param;
			return customLine;
		}
	}
	public static class DialogueEventGenerator
	{
		public static DialogueEvent GenerateEvent(string name, List<CustomLine> mainLines, List<List<CustomLine>> repeatLines, MaxRepeatsBehaviour afterMaxRepeats, string groupID = "", LetterAnimation animationLetter = 2, LetterAnimation animationLetterRepeat = 2)
		{
			//IL_0007: Unknown result type (might be due to invalid IL or missing references)
			//IL_0009: Unknown result type (might be due to invalid IL or missing references)
			//IL_000f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0011: Unknown result type (might be due to invalid IL or missing references)
			//IL_0016: Unknown result type (might be due to invalid IL or missing references)
			//IL_001c: Expected O, but got Unknown
			//IL_0048: Unknown result type (might be due to invalid IL or missing references)
			//IL_0052: Expected O, but got Unknown
			//IL_009e: Unknown result type (might be due to invalid IL or missing references)
			//IL_009f: Unknown result type (might be due to invalid IL or missing references)
			DialogueEvent val = new DialogueEvent();
			List<Speaker> speakers = new List<Speaker> { (Speaker)0 };
			val.id = name;
			val.mainLines = new LineSet(mainLines.ConvertAll((CustomLine x) => x.ToLine(speakers)));
			val.mainLines.lines.ForEach(delegate(Line line)
			{
				//IL_0002: Unknown result type (might be due to invalid IL or missing references)
				//IL_0007: Unknown result type (might be due to invalid IL or missing references)
				line.letterAnimation = animationLetter;
			});
			val.repeatLines = repeatLines.ConvertAll((Converter<List<CustomLine>, LineSet>)((List<CustomLine> x) => new LineSet(x.ConvertAll((CustomLine x2) => x2.ToLine(speakers)))));
			val.repeatLines.ForEach(delegate(LineSet line)
			{
				line.lines.ForEach(delegate(Line lineZ)
				{
					//IL_0002: Unknown result type (might be due to invalid IL or missing references)
					//IL_0007: Unknown result type (might be due to invalid IL or missing references)
					lineZ.letterAnimation = animationLetterRepeat;
				});
			});
			val.maxRepeatsBehaviour = afterMaxRepeats;
			val.speakers = new List<Speaker>(speakers);
			val.groupId = groupID;
			DialogueDataUtil.Data?.events?.Add(val);
			return val;
		}
	}
	public class EncounterHelper
	{
		public static EncounterBlueprintData BuildBlueprint(string name, List<Tribe> tribes, List<Ability> redundant, bool regionLocked, int minDifficulty, int maxDifficulty, List<CardInfo> randomReplacementCards, List<List<CardBlueprint>> blueprintTurns)
		{
			EncounterBlueprintData obj = ScriptableObject.CreateInstance<EncounterBlueprintData>();
			((Object)obj).name = name;
			obj.regionSpecific = regionLocked;
			EncounterExtensions.SetDifficulty<EncounterBlueprintData>(obj, minDifficulty, maxDifficulty);
			obj.dominantTribes = tribes;
			obj.redundantAbilities = redundant;
			obj.randomReplacementCards = randomReplacementCards;
			obj.turns = blueprintTurns;
			return obj;
		}

		public static CardInfo GetCardInfo(string self)
		{
			return CardLoader.GetCardByName(self);
		}

		public static RegionData GetRegionData(string RegionName)
		{
			RegionData result = RegionManager.BaseGameRegions[0];
			for (int i = 0; i < RegionManager.BaseGameRegions.Count; i++)
			{
				if (((Object)RegionManager.BaseGameRegions[i]).name == RegionName)
				{
					result = RegionManager.BaseGameRegions[i];
				}
			}
			return result;
		}

		public static EncounterBlueprintData GetBlueprintData(string EncounterName)
		{
			EncounterBlueprintData result = EncounterManager.BaseGameEncounters[0];
			for (int i = 0; i < EncounterManager.BaseGameEncounters.Count; i++)
			{
				if (((Object)EncounterManager.BaseGameEncounters[i]).name == EncounterName)
				{
					result = EncounterManager.BaseGameEncounters[i];
				}
			}
			return result;
		}

		public static EncounterBlueprintData GetCustomBlueprintData(string EncounterName)
		{
			EncounterBlueprintData result = EncounterManager.NewEncounters[0];
			for (int i = 0; i < EncounterManager.NewEncounters.Count; i++)
			{
				if (((Object)EncounterManager.NewEncounters[i]).name == EncounterName)
				{
					result = EncounterManager.NewEncounters[i];
				}
			}
			return result;
		}

		public static List<CardInfo> AddRandomCards(string turn1 = "none", string turn2 = "none", string turn3 = "none", string turn4 = "none", string turn5 = "none", string turn6 = "none", string turn7 = "none", string turn8 = "none", string turn9 = "none")
		{
			List<CardInfo> list = new List<CardInfo>();
			if (turn1 != "none")
			{
				list.Add(CardLoader.GetCardByName(turn1));
				if (turn2 != "none")
				{
					list.Add(CardLoader.GetCardByName(turn2));
					if (turn3 != "none")
					{
						list.Add(CardLoader.GetCardByName(turn3));
						if (turn4 != "none")
						{
							list.Add(CardLoader.GetCardByName(turn4));
							if (turn5 != "none")
							{
								list.Add(CardLoader.GetCardByName(turn5));
								if (turn6 != "none")
								{
									list.Add(CardLoader.GetCardByName(turn6));
									if (turn7 != "none")
									{
										list.Add(CardLoader.GetCardByName(turn7));
										if (turn8 != "none")
										{
											list.Add(CardLoader.GetCardByName(turn8));
											if (turn9 != "none")
											{
												list.Add(CardLoader.GetCardByName(turn9));
												return list;
											}
											return list;
										}
										return list;
									}
									return list;
								}
								return list;
							}
							return list;
						}
						return list;
					}
					return list;
				}
				return list;
			}
			return list;
		}
	}
	public class SigilUtils
	{
		public static AbilityInfo CreateAbilityWithDefaultSettings(string rulebookName, string rulebookDescription, Type behavior, Texture2D text_a1, Texture2D text_a2, string LearnDialogue, bool withDialogue = false, int powerLevel = 0, bool leshyUsable = false, bool part1Modular = true, bool stack = false)
		{
			AbilityInfo val = AbilityExtensions.SetPixelAbilityIcon(AbilityManager.New("extraVoid.inscryption.RegionExpansions", rulebookName, rulebookDescription, behavior, (Texture)(object)text_a1), text_a2, (FilterMode?)null);
			if (withDialogue)
			{
				val.abilityLearnedDialogue = SetAbilityInfoDialogue(LearnDialogue);
			}
			val.powerLevel = powerLevel;
			val.opponentUsable = leshyUsable;
			if (part1Modular)
			{
				val.metaCategories = new List<AbilityMetaCategory>
				{
					(AbilityMetaCategory)1,
					(AbilityMetaCategory)0
				};
			}
			else
			{
				val.metaCategories = new List<AbilityMetaCategory> { (AbilityMetaCategory)0 };
			}
			val.canStack = stack;
			return val;
		}

		public static CardInfo CreateCardWithDefaultSettings(string InternalName, string DisplayName, int attack, int health, Texture2D texture_base, Texture2D texture_emission, List<CardMetaCategory> cardMetaCategories, List<Tribe> tribes, List<Trait> traits, List<Ability> abilities, Texture2D texture_pixel = null, int bloodCost = 0, int boneCost = 0, int energyCost = 0)
		{
			//IL_0050: Unknown result type (might be due to invalid IL or missing references)
			//IL_0056: Expected I4, but got Unknown
			//IL_006c: 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)
			CardInfo val = CardManager.New("re", InternalName, DisplayName, attack, health, "A puddle that errods all that touches it.");
			CardExtensions.SetPortrait(val, texture_base, texture_emission, (FilterMode?)null);
			val.metaCategories = cardMetaCategories;
			val.tribes = tribes;
			val.traits = traits;
			for (int i = 0; i < abilities.Count; i++)
			{
				CardExtensions.AddAbilities(val, (Ability[])(object)new Ability[1] { (Ability)(int)abilities[i] });
			}
			val.temple = (CardTemple)0;
			val.cardComplexity = (CardComplexity)2;
			val.cost = bloodCost;
			val.bonesCost = boneCost;
			val.energyCost = energyCost;
			return val;
		}

		public static LineSet SetAbilityInfoDialogue(string dialogue)
		{
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			//IL_000b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0017: Expected O, but got Unknown
			//IL_0017: Unknown result type (might be due to invalid IL or missing references)
			//IL_001d: Expected O, but got Unknown
			return new LineSet(new List<Line>
			{
				new Line
				{
					text = dialogue
				}
			});
		}

		public static Texture2D GetTextureFromPath(string path)
		{
			//IL_0013: Unknown result type (might be due to invalid IL or missing references)
			//IL_0018: Unknown result type (might be due to invalid IL or missing references)
			//IL_001f: Expected O, but got Unknown
			//IL_0021: Expected O, but got Unknown
			byte[] array = File.ReadAllBytes(Path.Combine(Plugin.Directory, path));
			Texture2D val = new Texture2D(2, 2);
			ImageConversion.LoadImage(val, array);
			return val;
		}

		public static Texture2D LoadTextureFromResource(byte[] resourceFile)
		{
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			//IL_0007: Unknown result type (might be due to invalid IL or missing references)
			//IL_000e: Expected O, but got Unknown
			//IL_0010: Expected O, but got Unknown
			Texture2D val = new Texture2D(2, 2);
			ImageConversion.LoadImage(val, resourceFile);
			return val;
		}

		public static string GetFullPathOfFile(string fileToLookFor)
		{
			return Directory.GetFiles(Paths.PluginPath, fileToLookFor, SearchOption.AllDirectories)[0];
		}

		public static byte[] ReadArtworkFileAsBytes(string nameOfCardArt)
		{
			return File.ReadAllBytes(GetFullPathOfFile(nameOfCardArt));
		}

		public static Texture2D LoadImageAndGetTexture(string nameOfCardArt)
		{
			//IL_0002: 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_0015: Expected O, but got Unknown
			//IL_0017: Expected O, but got Unknown
			Texture2D val = new Texture2D(2, 2);
			byte[] array = ReadArtworkFileAsBytes(nameOfCardArt);
			ImageConversion.LoadImage(val, array);
			return val;
		}

		public static CardSlot GetSlot(PlayableCard cardToGetSlot)
		{
			if ((Object)(object)cardToGetSlot.Slot != (Object)null)
			{
				return cardToGetSlot.Slot;
			}
			CardSlot component = ((Component)((Component)cardToGetSlot).transform.parent).GetComponent<CardSlot>();
			if ((Object)(object)component != (Object)null)
			{
				return component;
			}
			int instanceID = ((Object)((Component)cardToGetSlot).gameObject).GetInstanceID();
			Plugin.Log.LogInfo((object)("[SplashDamageAbility][GetSlot] Getting slot for " + instanceID));
			List<CardSlot> list = new List<CardSlot>();
			list.AddRange(Singleton<BoardManager>.Instance.GetSlots(false));
			list.AddRange(Singleton<BoardManager>.Instance.GetSlots(true));
			for (int i = 0; i < list.Count; i++)
			{
				CardSlot val = list[i];
				if (val.Index != 2)
				{
					continue;
				}
				PlayableCard card = val.Card;
				if (!((Object)(object)card == (Object)null))
				{
					if ((Object)(object)((Component)card).gameObject == (Object)(object)((Component)cardToGetSlot).gameObject)
					{
						return val;
					}
					((Object)((Component)card).gameObject).GetInstanceID();
				}
			}
			Plugin.Log.LogInfo((object)("[SplashDamageAbility][GetSlot] Could not find slot for " + instanceID));
			return null;
		}
	}
	[BepInPlugin("extraVoid.inscryption.RegionExpansions", "RegionExpansions", "2.2.0")]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	public class Plugin : BaseUnityPlugin
	{
		public const string APIGUID = "cyantist.inscryption.api";

		public const string SigilGUID = "extraVoid.inscryption.voidSigils";

		public const string TotemGUID = "Lily.BOT";

		public const string NeverGUID = "nevernamed.inscryption.sigils";

		public const string PackManagerGUID = "zorro.inscryption.infiniscryption.packmanager";

		public const string PluginGuid = "extraVoid.inscryption.RegionExpansions";

		private const string PluginName = "RegionExpansions";

		private const string PluginVersion = "2.2.0";

		public static string Directory;

		internal static ManualLogSource Log;

		private void Awake()
		{
			//IL_002f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0052: Unknown result type (might be due to invalid IL or missing references)
			//IL_0057: Unknown result type (might be due to invalid IL or missing references)
			Log = ((BaseUnityPlugin)this).Logger;
			Directory = ((BaseUnityPlugin)this).Info.Location.Replace("RegionExpansions.dll", "");
			new Harmony("extraVoid.inscryption.RegionExpansions").PatchAll();
			DyingWind.specialAbility = SpecialTriggeredAbilityManager.Add("extraVoid.inscryption.RegionExpansions", "Dying Wind", typeof(DyingWind)).Id;
			High_Tide.AddCard();
			Low_Tide.AddCard();
			Strong_Wind_1.AddCard();
			American_Lobster.AddCard();
			Jonah_Crab.AddCard();
			Costal_Salmon.AddCard();
			Moon_Jellyfish.AddCard();
			Mussel.AddCard();
			School_Fish.AddCard();
			Starfish.AddCard();
			Region_Beach.AddRegionIntroDialogue();
			Region_Ridgeline.AddRegionIntroDialogue();
		}

		private void Start()
		{
			BirdOfTheSea.AddEncounter();
			TideOfFish.AddEncounter();
			CrabsAndLobster.AddEncounter();
			Region_Beach.AddRegion();
			Region_Ridgeline.AddRegion();
			if (Chainloader.PluginInfos.ContainsKey("zorro.inscryption.infiniscryption.packmanager"))
			{
				CreateCardPack.CreatePack();
			}
		}
	}
	public static class ScriptableObjectExtension
	{
		public static T Clone<T>(this T scriptableObject) where T : ScriptableObject
		{
			if ((Object)(object)scriptableObject == (Object)null)
			{
				Debug.LogError((object)$"ScriptableObject was null. Returning default {typeof(T)} object.");
				return (T)(object)ScriptableObject.CreateInstance(typeof(T));
			}
			T val = Object.Instantiate<T>(scriptableObject);
			((Object)(object)val).name = ((Object)(object)scriptableObject).name;
			return val;
		}
	}
	public static class PluginInfo
	{
		public const string PLUGIN_GUID = "RegionExpansions";

		public const string PLUGIN_NAME = "RegionExpansions";

		public const string PLUGIN_VERSION = "1.0.0";
	}
}
namespace RegionExpansions.sigils
{
	internal class DyingWind : SpecialCardBehaviour
	{
		public static SpecialTriggeredAbility specialAbility;

		private int numTurnsInPlay;

		public SpecialTriggeredAbility SpecialAbility => specialAbility;

		public override bool RespondsToUpkeep(bool playerUpkeep)
		{
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			//IL_000c: Expected O, but got Unknown
			PlayableCard val = (PlayableCard)((SpecialCardBehaviour)this).Card;
			if (val.OpponentCard != playerUpkeep)
			{
				return val.OnBoard;
			}
			return false;
		}

		public override IEnumerator OnUpkeep(bool playerUpkeep)
		{
			PlayableCard val = (PlayableCard)((SpecialCardBehaviour)this).Card;
			int num = SeededRandom.Range(2, 4, ((TriggerReceiver)this).GetRandomSeed());
			numTurnsInPlay++;
			((Card)val).Anim.LightNegationEffect();
			if (numTurnsInPlay >= num)
			{
				yield return val.Die(false, (PlayableCard)null, true);
			}
		}
	}
}
namespace RegionExpansions.Regions
{
	internal class PirateSkullBossOpponent_patchers
	{
		[HarmonyPatch(typeof(PirateSkullBossOpponent))]
		public class re_PirateSkullBoss_Intro_Patch
		{
			[HarmonyPostfix]
			[HarmonyPatch("IntroSequence")]
			public static IEnumerator Postfix(IEnumerator enumerator, PirateSkullBossOpponent __instance, EncounterData encounter)
			{
				yield return enumerator;
				if (((Object)RunState.CurrentMapRegion).name != "Pirateville")
				{
					((Opponent)__instance).NumLives = 2;
				}
			}
		}

		[HarmonyPatch(typeof(PirateSkullBossOpponent))]
		public class re_PirateSkullBoss_LifeLostSequence_Patch
		{
			[HarmonyPostfix]
			[HarmonyPatch("LifeLostSequence")]
			public static IEnumerator Postfix(IEnumerator enumerator, PirateSkullBossOpponent __instance)
			{
				if (((Object)RunState.CurrentMapRegion).name != "Pirateville" && ((Opponent)__instance).NumLives == 0)
				{
					AudioController.Instance.SetLoopVolume(0f, 1f, 0, true);
					AudioController.Instance.SetLoopVolume(0f, 1f, 1, true);
					SpecialBattleSequencer specialSequencer = Singleton<TurnManager>.Instance.SpecialSequencer;
					((PirateSkullBattleSequencer)((specialSequencer is PirateSkullBattleSequencer) ? specialSequencer : null)).CleanupTargetIcons();
					yield return (object)new WaitForSeconds(0.4f);
					Singleton<ViewManager>.Instance.SwitchToView((View)21, false, true);
					yield return (object)new WaitForSeconds(0.4f);
					yield return Singleton<TextDisplayer>.Instance.ShowUntilInput("Avast ye!", -2.5f, 0.5f, (Emotion)0, (LetterAnimation)0, (Speaker)22, (string[])null, true);
					yield return (object)new WaitForSeconds(0.2f);
					((Component)((Part1BossOpponent)__instance).bossSkull).GetComponentInChildren<Animator>().SetTrigger("close_eye");
					yield return (object)new WaitForSeconds(1.25f);
					if (SaveFile.IsAscension && AscensionSaveData.Data.ChallengeIsActive((AscensionChallenge)15))
					{
						Singleton<ChallengeActivationUI>.Instance.ShowActivation((AscensionChallenge)15);
						yield return Singleton<TextDisplayer>.Instance.ShowUntilInput("I'll be seeing you later, and I'll be bringing my crew with me too!", -2.5f, 0.5f, (Emotion)0, (LetterAnimation)0, (Speaker)22, (string[])null, true);
					}
					else
					{
						yield return Singleton<TextDisplayer>.Instance.ShowUntilInput("Farewell.", -2.5f, 0.5f, (Emotion)0, (LetterAnimation)0, (Speaker)22, (string[])null, true);
					}
					AscensionStatsData.TryIncrementStat((Type)2);
					yield return (object)new WaitForSeconds(0.5f);
					((Part1BossOpponent)__instance).bossSkull.ExitSimple();
					yield return (object)new WaitForSeconds(1.2f);
					((OpponentAnimationController)LeshyAnimationController.Instance).ResetHeadOffset(true);
					LeshyAnimationController.Instance.ResetEyesTexture();
					yield return ((Part1BossOpponent)__instance).BossDefeatedSequence();
					Singleton<ViewManager>.Instance.Controller.LockState = (ViewLockState)0;
					Singleton<InteractionCursor>.Instance.InteractionDisabled = false;
				}
				else
				{
					yield return enumerator;
				}
			}
		}

		[HarmonyPatch(typeof(PirateSkullBossOpponent))]
		public class re_PirateSkullBoss_StartNewPhaseSequence_Patch
		{
			[HarmonyPostfix]
			[HarmonyPatch("StartNewPhaseSequence")]
			public static IEnumerator Postfix(IEnumerator enumerator, PirateSkullBossOpponent __instance)
			{
				if (((Object)RunState.CurrentMapRegion).name != "Pirateville")
				{
					((Opponent)__instance).TurnPlan.Clear();
					if (((Opponent)__instance).NumLives == 1)
					{
						yield return __instance.StartPhase2();
					}
				}
				else
				{
					yield return enumerator;
				}
			}
		}

		[HarmonyPatch(typeof(PirateSkullBattleSequencer))]
		public class re_PirateSkullBoss_PirateSkullBattleSequencer_Patch
		{
			[HarmonyPostfix]
			[HarmonyPatch("RespondsToUpkeep")]
			public static void Postfix(bool playerUpkeep, ref bool __result)
			{
				if (((Object)RunState.CurrentMapRegion).name != "Pirateville" && playerUpkeep && Singleton<TurnManager>.Instance.TurnNumber > 1 && Singleton<TurnManager>.Instance.Opponent.NumLives > 0)
				{
					__result = true;
				}
			}
		}
	}
	internal class RegionDataDump
	{
		public static void DumpRegionData()
		{
			//IL_0084: Unknown result type (might be due to invalid IL or missing references)
			//IL_0089: Unknown result type (might be due to invalid IL or missing references)
			//IL_0122: Unknown result type (might be due to invalid IL or missing references)
			//IL_0127: Unknown result type (might be due to invalid IL or missing references)
			//IL_0157: Unknown result type (might be due to invalid IL or missing references)
			//IL_015c: 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_01f0: Unknown result type (might be due to invalid IL or missing references)
			//IL_049b: Unknown result type (might be due to invalid IL or missing references)
			//IL_04a0: Unknown result type (might be due to invalid IL or missing references)
			Plugin.Log.LogMessage((object)"Dumping Region Data");
			for (int i = 0; i < RegionManager.BaseGameRegions.Count; i++)
			{
				RegionData val = RegionManager.BaseGameRegions[i];
				Plugin.Log.LogMessage((object)("Dumping Region Data, region " + i));
				Plugin.Log.LogMessage((object)("Dumping Region Data, region " + i + " name is:" + ((Object)val).name));
				for (int j = 0; j < val.bosses.Count; j++)
				{
					ManualLogSource log = Plugin.Log;
					string text = i.ToString();
					Type val2 = val.bosses[j];
					log.LogMessage((object)("Dumping Region Data, region " + text + " boss is:" + ((object)(Type)(ref val2)).ToString()));
				}
				Plugin.Log.LogMessage((object)("Dumping Region Data, region " + i + " bossPrepCondition is:" + (object)val.bossPrepCondition));
				Plugin.Log.LogMessage((object)("Dumping Region Data, region " + i + " ambientLoopId is:" + val.ambientLoopId));
				ManualLogSource log2 = Plugin.Log;
				string text2 = i.ToString();
				Color val3 = val.boardLightColor;
				log2.LogMessage((object)("Dumping Region Data, region " + text2 + " boardLightColor is:" + ((object)(Color)(ref val3)).ToString()));
				ManualLogSource log3 = Plugin.Log;
				string text3 = i.ToString();
				val3 = val.cardsLightColor;
				log3.LogMessage((object)("Dumping Region Data, region " + text3 + " cardsLightColor is:" + ((object)(Color)(ref val3)).ToString()));
				for (int k = 0; k < val.consumableItems.Count; k++)
				{
					Plugin.Log.LogMessage((object)("Dumping Region Data, region " + i + " consumableItems is:" + (object)val.consumableItems[k]));
				}
				for (int l = 0; l < val.dominantTribes.Count; l++)
				{
					ManualLogSource log4 = Plugin.Log;
					string text4 = i.ToString();
					Tribe val4 = val.dominantTribes[l];
					log4.LogMessage((object)("Dumping Region Data, region " + text4 + " dominantTribes is:" + ((object)(Tribe)(ref val4)).ToString()));
				}
				Plugin.Log.LogMessage((object)("Dumping Region Data, region " + i + " dustParticlesDisabled is:" + val.dustParticlesDisabled));
				for (int m = 0; m < val.encounters.Count; m++)
				{
					Plugin.Log.LogMessage((object)("Dumping Region Data, region " + i + " encounters is:" + (object)val.encounters[m]));
				}
				for (int n = 0; n < val.fillerScenery.Count; n++)
				{
					Plugin.Log.LogMessage((object)("Dumping Region Data, region " + i + " fillerScenery is:" + (object)val.fillerScenery[n]));
					if (((Object)((SceneryEntry)val.fillerScenery[n]).data).name != null)
					{
						Plugin.Log.LogMessage((object)("Dumping Region Data, region " + i + " fillerScenery.data.name is:" + ((Object)((SceneryEntry)val.fillerScenery[n]).data).name));
					}
				}
				Plugin.Log.LogMessage((object)("Dumping Region Data, region " + i + " fogAlpha is:" + val.fogAlpha));
				Plugin.Log.LogMessage((object)("Dumping Region Data, region " + i + " fogEnabled is:" + val.fogEnabled));
				Plugin.Log.LogMessage((object)("Dumping Region Data, region " + i + " fogProfile is:" + (object)val.fogProfile));
				for (int num = 0; num < val.likelyCards.Count; num++)
				{
					Plugin.Log.LogMessage((object)("Dumping Region Data, region " + i + " likelyCards is:" + (object)val.likelyCards[num]));
				}
				Plugin.Log.LogMessage((object)("Dumping Region Data, region " + i + " mapAlbedo is:" + (object)val.mapAlbedo));
				Plugin.Log.LogMessage((object)("Dumping Region Data, region " + i + " mapEmission is:" + (object)val.mapEmission));
				ManualLogSource log5 = Plugin.Log;
				string text5 = i.ToString();
				val3 = val.mapEmissionColor;
				log5.LogMessage((object)("Dumping Region Data, region " + text5 + " mapEmissionColor is:" + ((object)(Color)(ref val3)).ToString()));
				for (int num2 = 0; num2 < val.mapParticlesPrefabs.Count; num2++)
				{
					Plugin.Log.LogMessage((object)("Dumping Region Data, region " + i + " mapParticlesPrefabs is:" + (object)val.mapParticlesPrefabs[num2]));
				}
				Plugin.Log.LogMessage((object)("Dumping Region Data, region " + i + " predefinedNodes is:" + (object)val.predefinedNodes));
				if ((Object)(object)val.predefinedScenery != (Object)null)
				{
					for (int num3 = 0; num3 < val.predefinedScenery.scenery.Count; num3++)
					{
						Plugin.Log.LogMessage((object)("Dumping Region Data, region " + i + " predefinedScenery is:" + ((Object)val.predefinedScenery.scenery[num3].data).name));
					}
				}
				for (int num4 = 0; num4 < val.scarceScenery.Count; num4++)
				{
					Plugin.Log.LogMessage((object)("Dumping Region Data, region " + i + " scarceScenery is:" + (object)val.scarceScenery[num4]));
					if (((Object)((SceneryEntry)val.scarceScenery[num4]).data).name != null)
					{
						Plugin.Log.LogMessage((object)("Dumping Region Data, region " + i + " scarceScenery.data.name is:" + ((Object)((SceneryEntry)val.scarceScenery[num4]).data).name));
					}
				}
				for (int num5 = 0; num5 < val.terrainCards.Count; num5++)
				{
					Plugin.Log.LogMessage((object)("Dumping Region Data, region " + i + " terrainCards is:" + (object)val.terrainCards[num5]));
				}
				for (int num6 = 0; num6 < val.encounters.Count; num6++)
				{
					Plugin.Log.LogMessage((object)("Dumping Region Data, region " + i + " terrainCards is:" + ((Object)val.encounters[num6]).name));
				}
			}
		}
	}
	internal class Region_Beach
	{
		public static void AddRegionIntroDialogue()
		{
			List<CustomLine> list = new List<CustomLine>();
			list.Add(("In the distance, you hear what sounds like singing... 'heave, ho'", (Speaker)1));
			list.Add(("Your curiosity of it brought you here to this place.", (Speaker)1));
			list.Add(("To get to the source, you must pass through... [c:bR]The Shoreline[c:]", (Speaker)1));
			List<CustomLine> list2 = new List<CustomLine>();
			list2.Add(("The smell of salt water assults your nose...", (Speaker)1));
			list2.Add(("as the sound of waves crash apon the sand.", (Speaker)1));
			list2.Add(("You journey on in... [c:bR]The Shoreline[c:]", (Speaker)1));
			List<CustomLine> list3 = new List<CustomLine>();
			list3.Add(("The sea is calm.", (Speaker)1));
			list3.Add(("The tide is full", (Speaker)1));
			list3.Add(("You walk along... [c:bR]The Shoreline[c:]", (Speaker)1));
			List<CustomLine> list4 = new List<CustomLine>();
			list4.Add(("The coarse sand on the beach entered your boots...", (Speaker)1));
			list4.Add(("You continued your travels despite the irritation...", (Speaker)1));
			list4.Add(("You tread through... [c:bR]The Shoreline.[c:]", (Speaker)1));
			List<List<CustomLine>> list5 = new List<List<CustomLine>>();
			list5.Add(list2);
			list5.Add(list3);
			list5.Add(list4);
			DialogueEventGenerator.GenerateEvent("RegionBeach", list, list5, (MaxRepeatsBehaviour)0, "Game Flow", (LetterAnimation)1, (LetterAnimation)1);
		}

		public static void AddRegion()
		{
			//IL_0060: Unknown result type (might be due to invalid IL or missing references)
			//IL_0067: Expected O, but got Unknown
			//IL_0067: Unknown result type (might be due to invalid IL or missing references)
			//IL_006e: Expected O, but got Unknown
			//IL_0094: Unknown result type (might be due to invalid IL or missing references)
			//IL_009b: Expected O, but got Unknown
			//IL_010c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0113: Expected O, but got Unknown
			//IL_0176: Unknown result type (might be due to invalid IL or missing references)
			//IL_017b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0191: Unknown result type (might be due to invalid IL or missing references)
			//IL_0196: Unknown result type (might be due to invalid IL or missing references)
			//IL_01b1: Unknown result type (might be due to invalid IL or missing references)
			//IL_01b6: Unknown result type (might be due to invalid IL or missing references)
			//IL_01da: Unknown result type (might be due to invalid IL or missing references)
			//IL_01df: Unknown result type (might be due to invalid IL or missing references)
			//IL_01e2: Unknown result type (might be due to invalid IL or missing references)
			//IL_01e7: Unknown result type (might be due to invalid IL or missing references)
			//IL_0356: Unknown result type (might be due to invalid IL or missing references)
			//IL_035d: Unknown result type (might be due to invalid IL or missing references)
			//IL_03a2: Unknown result type (might be due to invalid IL or missing references)
			//IL_03ee: Unknown result type (might be due to invalid IL or missing references)
			//IL_03f4: Expected I4, but got Unknown
			//IL_0211: Unknown result type (might be due to invalid IL or missing references)
			//IL_0218: Unknown result type (might be due to invalid IL or missing references)
			//IL_025d: Unknown result type (might be due to invalid IL or missing references)
			RegionData regionData = EncounterHelper.GetRegionData("Pirateville");
			SceneryData data = ((SceneryEntry)regionData.fillerScenery[0]).data.Clone<SceneryData>();
			SceneryData data2 = regionData.predefinedScenery.scenery[0].data.Clone<SceneryData>();
			SceneryData data3 = regionData.predefinedScenery.scenery[7].data.Clone<SceneryData>();
			Texture2D val = (Texture2D)regionData.mapEmission;
			FillerSceneryEntry val2 = new FillerSceneryEntry();
			((SceneryEntry)val2).data = data;
			((SceneryEntry)val2).data.radius = ((SceneryEntry)val2).data.radius * 1.5f;
			ScarceSceneryEntry val3 = new ScarceSceneryEntry();
			((SceneryEntry)val3).data = data2;
			val3.minDensity = 200f;
			val3.minInstances = 20;
			val3.maxInstances = 40;
			((Object)((SceneryEntry)val3).data).name = "PalmTree";
			((SceneryEntry)val3).data.prefabNames = new List<string> { "PalmTree" };
			((SceneryEntry)val3).data.radius = 0.065f;
			((SceneryEntry)val3).data.perlinNoiseHeight = false;
			ScarceSceneryEntry val4 = new ScarceSceneryEntry();
			((SceneryEntry)val4).data = data3;
			val4.minDensity = 25f;
			val4.minInstances = 5;
			val4.maxInstances = 10;
			((Object)((SceneryEntry)val4).data).name = "TreasureChest";
			((SceneryEntry)val4).data.prefabNames = new List<string> { "TreasureChest" };
			((SceneryEntry)val4).data.maxScale = new Vector2(1.5f, 1.5f);
			((SceneryEntry)val4).data.minScale = new Vector2(0.5f, 0.5f);
			((SceneryEntry)val4).data.baseEulers = new Vector3(-90f, 0f, 0f);
			((SceneryEntry)val4).data.radius = 0.05f;
			((SceneryEntry)val4).data.perlinNoiseHeight = false;
			Color boardLightColor = regionData.boardLightColor;
			Color cardsLightColor = regionData.cardsLightColor;
			Texture mapAlbedo = regionData.mapAlbedo;
			if (!Chainloader.PluginInfos.ContainsKey("Lily.BOT"))
			{
				RegionExtensions.Build(RegionExtensions.AddTerrainCards(RegionExtensions.AddLikelyCards(RegionExtensions.AddLikelyCards(RegionExtensions.AddEncounters(RegionExtensions.AddDominantTribes(RegionExtensions.AddBosses(RegionExtensions.SetDustParticlesEnabled(RegionExtensions.SetFogEnabled(RegionExtensions.SetFogAlpha(RegionExtensions.SetMapEmissionColor(RegionExtensions.SetAmbientLoopId(RegionExtensions.SetMapEmission(RegionExtensions.SetMapAlbedo(RegionExtensions.AddScarceScenery(RegionExtensions.AddFillerScenery(RegionExtensions.SetCardsColor(RegionExtensions.SetBoardColor(RegionManager.New("Beach", 2, true), boardLightColor), cardsLightColor), (FillerSceneryEntry[])(object)new FillerSceneryEntry[1] { val2 }), (ScarceSceneryEntry[])(object)new ScarceSceneryEntry[2] { val3, val4 }), mapAlbedo), val), "boss_pirateskull_ambient"), regionData.mapEmissionColor), regionData.fogAlpha), regionData.fogEnabled), false), (Type[])(object)new Type[1] { (Type)20 }), (Tribe[])(object)new Tribe[1] { (Tribe)2 }), (EncounterBlueprintData[])(object)new EncounterBlueprintData[5]
				{
					EncounterHelper.GetBlueprintData("Submerge"),
					EncounterHelper.GetBlueprintData("BirdFlock"),
					EncounterHelper.GetCustomBlueprintData("BirdOfTheSea"),
					EncounterHelper.GetCustomBlueprintData("CrabsAndLobster"),
					EncounterHelper.GetCustomBlueprintData("TideOfFish")
				}), new string[1] { "Kingfisher" }), new string[1] { "portrait_skeletonparrot" }), new string[4] { "re_High_Tide", "re_Strong_Wind_1", "Boulder", "re_Low_Tide" }), false, false, false, false);
			}
			else
			{
				RegionExtensions.Build(RegionExtensions.AddTerrainCards(RegionExtensions.AddLikelyCards(RegionExtensions.AddLikelyCards(RegionExtensions.AddEncounters(RegionExtensions.AddDominantTribes(RegionExtensions.AddBosses(RegionExtensions.SetDustParticlesEnabled(RegionExtensions.SetFogEnabled(RegionExtensions.SetFogAlpha(RegionExtensions.SetMapEmissionColor(RegionExtensions.SetAmbientLoopId(RegionExtensions.SetMapEmission(RegionExtensions.SetMapAlbedo(RegionExtensions.AddScarceScenery(RegionExtensions.AddFillerScenery(RegionExtensions.SetCardsColor(RegionExtensions.SetBoardColor(RegionManager.New("Beach", 2, true), boardLightColor), cardsLightColor), (FillerSceneryEntry[])(object)new FillerSceneryEntry[1] { val2 }), (ScarceSceneryEntry[])(object)new ScarceSceneryEntry[2] { val3, val4 }), mapAlbedo), val), "boss_pirateskull_ambient"), regionData.mapEmissionColor), regionData.fogAlpha), regionData.fogEnabled), false), (Type[])(object)new Type[1] { (Type)20 }), (Tribe[])(object)new Tribe[2]
				{
					(Tribe)2,
					(Tribe)(int)GuidManager.GetEnumValue<Tribe>("Lily.BOT", "aquatic")
				}), (EncounterBlueprintData[])(object)new EncounterBlueprintData[5]
				{
					EncounterHelper.GetBlueprintData("Submerge"),
					EncounterHelper.GetBlueprintData("BirdFlock"),
					EncounterHelper.GetCustomBlueprintData("BirdOfTheSea"),
					EncounterHelper.GetCustomBlueprintData("CrabsAndLobster"),
					EncounterHelper.GetCustomBlueprintData("TideOfFish")
				}), new string[1] { "Kingfisher" }), new string[1] { "portrait_skeletonparrot" }), new string[4] { "re_High_Tide", "re_Strong_Wind_1", "Boulder", "re_Low_Tide" }), false, false, false, false);
			}
		}
	}
	internal class Region_Ridgeline
	{
		public static void AddRegionIntroDialogue()
		{
			List<CustomLine> list = new List<CustomLine>();
			list.Add(("Pines and bare rock formations jet up from the ground.", (Speaker)1));
			list.Add(("You hear a mining off in the distance.", (Speaker)1));
			list.Add(("To get to the source, you must pass through... [c:bR]The Ridgeline[c:]", (Speaker)1));
			List<CustomLine> list2 = new List<CustomLine>();
			list2.Add(("You see a glint of gold among the rocks above.", (Speaker)1));
			list2.Add(("As you climb for it, a rock slips out from under your foot and you tumble down.", (Speaker)1));
			list2.Add(("When you get back up, you decide to ignore it and continue on thrhough... [c:bR]The Ridgeline[c:]", (Speaker)1));
			List<List<CustomLine>> list3 = new List<List<CustomLine>>();
			list3.Add(list2);
			DialogueEventGenerator.GenerateEvent("RegionRidgeline", list, list3, (MaxRepeatsBehaviour)0, "Game Flow", (LetterAnimation)1, (LetterAnimation)1);
		}

		public static void AddRegion()
		{
			//IL_0075: Unknown result type (might be due to invalid IL or missing references)
			//IL_007c: Expected O, but got Unknown
			//IL_007c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0083: Expected O, but got Unknown
			//IL_00c0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00db: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e0: Unknown result type (might be due to invalid IL or missing references)
			//IL_0103: Unknown result type (might be due to invalid IL or missing references)
			//IL_010a: Expected O, but got Unknown
			//IL_013e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0148: Unknown result type (might be due to invalid IL or missing references)
			//IL_014d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0160: Unknown result type (might be due to invalid IL or missing references)
			//IL_016a: Unknown result type (might be due to invalid IL or missing references)
			//IL_016f: Unknown result type (might be due to invalid IL or missing references)
			//IL_01b6: Unknown result type (might be due to invalid IL or missing references)
			//IL_01bb: Unknown result type (might be due to invalid IL or missing references)
			//IL_01bd: Unknown result type (might be due to invalid IL or missing references)
			//IL_01c2: Unknown result type (might be due to invalid IL or missing references)
			//IL_01d8: Unknown result type (might be due to invalid IL or missing references)
			//IL_01df: Unknown result type (might be due to invalid IL or missing references)
			//IL_0229: Unknown result type (might be due to invalid IL or missing references)
			RegionData regionData = EncounterHelper.GetRegionData("Forest");
			RegionData regionData2 = EncounterHelper.GetRegionData("Wetlands");
			SceneryData data = ((SceneryEntry)regionData.fillerScenery[0]).data.Clone<SceneryData>();
			SceneryData val = ((SceneryEntry)regionData.scarceScenery[0]).data.Clone<SceneryData>();
			SceneryData val2 = ((SceneryEntry)regionData2.fillerScenery[0]).data.Clone<SceneryData>();
			Plugin.Log.LogMessage((object)val2.prefabNames[0]);
			Texture2D val3 = (Texture2D)regionData.mapEmission;
			FillerSceneryEntry val4 = new FillerSceneryEntry();
			((SceneryEntry)val4).data = data;
			((Object)((SceneryEntry)val4).data).name = ((Object)val).name;
			((SceneryEntry)val4).data.prefabNames = val.prefabNames;
			((SceneryEntry)val4).data.minScale = new Vector2(0.05f, 0.01f);
			((SceneryEntry)val4).data.maxScale = new Vector2(0.1f, 0.02f);
			((SceneryEntry)val4).data.radius = ((SceneryEntry)val4).data.radius * 1.75f;
			ScarceSceneryEntry val5 = new ScarceSceneryEntry();
			((SceneryEntry)val5).data = val;
			val5.minDensity = 500f;
			val5.minInstances = 50;
			val5.maxInstances = 100;
			((SceneryEntry)val5).data.minScale = ((SceneryEntry)val5).data.minScale * 2f;
			((SceneryEntry)val5).data.maxScale = ((SceneryEntry)val5).data.maxScale * 2f;
			((SceneryEntry)val5).data.radius = ((SceneryEntry)val5).data.radius * 0.25f;
			((Object)((SceneryEntry)val5).data).name = ((Object)val2).name;
			((SceneryEntry)val5).data.prefabNames = val2.prefabNames;
			Color gray = Color.gray;
			Color grey = Color.grey;
			Texture mapAlbedo = regionData.mapAlbedo;
			RegionExtensions.Build(RegionExtensions.AddTerrainCards(RegionExtensions.AddEncounters(RegionExtensions.AddDominantTribes(RegionExtensions.AddBosses(RegionExtensions.SetDustParticlesEnabled(RegionExtensions.SetFogEnabled(RegionExtensions.SetFogAlpha(RegionExtensions.SetMapEmissionColor(RegionExtensions.SetAmbientLoopId(RegionExtensions.SetMapEmission(RegionExtensions.SetMapAlbedo(RegionExtensions.AddScarceScenery(RegionExtensions.AddFillerScenery(RegionExtensions.SetCardsColor(RegionExtensions.SetBoardColor(RegionManager.New("Ridgeline", 0, true), gray), grey), (FillerSceneryEntry[])(object)new FillerSceneryEntry[1] { val4 }), (ScarceSceneryEntry[])(object)new ScarceSceneryEntry[3] { val5, val5, val5 }), mapAlbedo), val3), "boss_prospector_ambient"), regionData.mapEmissionColor), regionData.fogAlpha), regionData.fogEnabled), false), (Type[])(object)new Type[1] { (Type)3 }), (Tribe[])(object)new Tribe[2]
			{
				(Tribe)3,
				(Tribe)4
			}), (EncounterBlueprintData[])(object)new EncounterBlueprintData[6]
			{
				EncounterHelper.GetBlueprintData("CoyotePack"),
				EncounterHelper.GetBlueprintData("WolfPack"),
				EncounterHelper.GetBlueprintData("DireWolfJuggernaut"),
				EncounterHelper.GetBlueprintData("ElkHerd"),
				EncounterHelper.GetBlueprintData("MooseJuggernaut"),
				EncounterHelper.GetBlueprintData("WildBulls")
			}), new string[2] { "Boulder", "GoldNugget" }), false, false, false, false);
		}
	}
}
namespace RegionExpansions.lib
{
	public static class CreateCardPack
	{
		public static void CreatePack()
		{
			PackInfo packInfo = PackManager.GetPackInfo("re");
			packInfo.Title = "Beach Region Card Pack";
			packInfo.SetTexture(TextureHelper.GetImageAsTexture("beach_pack.png", typeof(High_Tide).Assembly, (FilterMode)0));
			packInfo.Description = "Cards to help make the beach region with Royal as the boss more flavorful. Don't disable! Will break custom encounters for beach region!";
			packInfo.ValidFor.Add((PackMetacategory)0);
		}
	}
}
namespace RegionExpansions.Encounter
{
	internal class BirdOfTheSea
	{
		public static void AddEncounter()
		{
			//IL_0065: Unknown result type (might be due to invalid IL or missing references)
			//IL_006a: Unknown result type (might be due to invalid IL or missing references)
			//IL_007f: Expected O, but got Unknown
			//IL_0088: Unknown result type (might be due to invalid IL or missing references)
			//IL_008d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0094: 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_00a3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b8: Expected O, but got Unknown
			//IL_00ba: Unknown result type (might be due to invalid IL or missing references)
			//IL_00bf: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d4: Expected O, but got Unknown
			//IL_00dd: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f7: Expected O, but got Unknown
			//IL_0100: Unknown result type (might be due to invalid IL or missing references)
			//IL_0105: Unknown result type (might be due to invalid IL or missing references)
			//IL_0115: Unknown result type (might be due to invalid IL or missing references)
			//IL_0122: Expected O, but got Unknown
			//IL_0124: Unknown result type (might be due to invalid IL or missing references)
			//IL_0129: Unknown result type (might be due to invalid IL or missing references)
			//IL_0130: Unknown result type (might be due to invalid IL or missing references)
			//IL_0137: Unknown result type (might be due to invalid IL or missing references)
			//IL_013f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0154: Expected O, but got Unknown
			//IL_0156: Unknown result type (might be due to invalid IL or missing references)
			//IL_015b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0170: Expected O, but got Unknown
			//IL_0179: Unknown result type (might be due to invalid IL or missing references)
			//IL_017e: Unknown result type (might be due to invalid IL or missing references)
			//IL_018e: Unknown result type (might be due to invalid IL or missing references)
			//IL_019b: Expected O, but got Unknown
			//IL_019d: Unknown result type (might be due to invalid IL or missing references)
			//IL_01a2: Unknown result type (might be due to invalid IL or missing references)
			//IL_01b2: Unknown result type (might be due to invalid IL or missing references)
			//IL_01bf: Expected O, but got Unknown
			//IL_01c1: Unknown result type (might be due to invalid IL or missing references)
			//IL_01c6: Unknown result type (might be due to invalid IL or missing references)
			//IL_01db: Expected O, but got Unknown
			//IL_01e4: Unknown result type (might be due to invalid IL or missing references)
			//IL_01e9: Unknown result type (might be due to invalid IL or missing references)
			//IL_01f9: Unknown result type (might be due to invalid IL or missing references)
			//IL_0206: Expected O, but got Unknown
			//IL_0208: Unknown result type (might be due to invalid IL or missing references)
			//IL_020d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0214: Unknown result type (might be due to invalid IL or missing references)
			//IL_021b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0223: Unknown result type (might be due to invalid IL or missing references)
			//IL_0238: Expected O, but got Unknown
			//IL_023a: Unknown result type (might be due to invalid IL or missing references)
			//IL_023f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0246: Unknown result type (might be due to invalid IL or missing references)
			//IL_024d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0255: Unknown result type (might be due to invalid IL or missing references)
			//IL_026a: Expected O, but got Unknown
			//IL_0273: Unknown result type (might be due to invalid IL or missing references)
			//IL_0278: Unknown result type (might be due to invalid IL or missing references)
			//IL_0288: Unknown result type (might be due to invalid IL or missing references)
			//IL_0295: Expected O, but got Unknown
			//IL_0297: Unknown result type (might be due to invalid IL or missing references)
			//IL_029c: Unknown result type (might be due to invalid IL or missing references)
			//IL_02ac: Unknown result type (might be due to invalid IL or missing references)
			//IL_02b9: Expected O, but got Unknown
			List<Tribe> tribes = new List<Tribe> { (Tribe)2 };
			List<Ability> redundant = new List<Ability> { (Ability)19 };
			bool regionLocked = true;
			List<CardInfo> randomReplacementCards = EncounterHelper.AddRandomCards("Stoat", "Shark", "re_Starfish");
			List<List<CardBlueprint>> list = new List<List<CardBlueprint>>();
			List<CardBlueprint> item = new List<CardBlueprint>
			{
				new CardBlueprint
				{
					card = CardLoader.GetCardByName("re_Starfish")
				}
			};
			List<CardBlueprint> item2 = new List<CardBlueprint>
			{
				new CardBlueprint
				{
					card = null,
					difficultyReplace = true,
					difficultyReq = 13,
					replacement = CardLoader.GetCardByName("SkeletonParrot")
				},
				new CardBlueprint
				{
					card = CardLoader.GetCardByName("Kingfisher")
				}
			};
			List<CardBlueprint> item3 = new List<CardBlueprint>
			{
				new CardBlueprint
				{
					card = CardLoader.GetCardByName("Kingfisher")
				}
			};
			List<CardBlueprint> item4 = new List<CardBlueprint>
			{
				new CardBlueprint
				{
					card = CardLoader.GetCardByName("SkeletonParrot"),
					randomReplaceChance = 25
				},
				new CardBlueprint
				{
					card = null,
					difficultyReplace = true,
					difficultyReq = 18,
					replacement = CardLoader.GetCardByName("SkeletonParrot")
				},
				new CardBlueprint
				{
					card = CardLoader.GetCardByName("SkeletonParrot")
				}
			};
			List<CardBlueprint> item5 = new List<CardBlueprint>
			{
				new CardBlueprint
				{
					card = CardLoader.GetCardByName("SkeletonParrot"),
					randomReplaceChance = 25
				},
				new CardBlueprint
				{
					card = CardLoader.GetCardByName("SkeletonParrot"),
					randomReplaceChance = 25
				},
				new CardBlueprint
				{
					card = CardLoader.GetCardByName("SkeletonParrot")
				}
			};
			List<CardBlueprint> item6 = new List<CardBlueprint>
			{
				new CardBlueprint
				{
					card = CardLoader.GetCardByName("Kingfisher"),
					randomReplaceChance = 25
				},
				new CardBlueprint
				{
					card = null,
					difficultyReplace = true,
					difficultyReq = 18,
					replacement = CardLoader.GetCardByName("SkeletonParrot")
				},
				new CardBlueprint
				{
					card = null,
					difficultyReplace = true,
					difficultyReq = 13,
					replacement = CardLoader.GetCardByName("SkeletonParrot")
				}
			};
			List<CardBlueprint> item7 = new List<CardBlueprint>
			{
				new CardBlueprint
				{
					card = CardLoader.GetCardByName("Kingfisher"),
					randomReplaceChance = 25
				},
				new CardBlueprint
				{
					card = CardLoader.GetCardByName("SkeletonParrot"),
					randomReplaceChance = 25
				}
			};
			List<CardBlueprint> item8 = new List<CardBlueprint>();
			List<CardBlueprint> item9 = new List<CardBlueprint>();
			list.Add(item);
			list.Add(item2);
			list.Add(item3);
			list.Add(item4);
			list.Add(item5);
			list.Add(item6);
			list.Add(item7);
			list.Add(item8);
			list.Add(item9);
			EncounterManager.Add(EncounterHelper.BuildBlueprint("BirdOfTheSea", tribes, redundant, regionLocked, 0, 30, randomReplacementCards, list));
		}
	}
	internal class CrabsAndLobster
	{
		public static void AddEncounter()
		{
			//IL_0027: Unknown result type (might be due to invalid IL or missing references)
			//IL_008d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0092: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a7: Expected O, but got Unknown
			//IL_00a9: 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_00c3: Expected O, but got Unknown
			//IL_00cc: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e8: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f0: 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_010d: Expected O, but got Unknown
			//IL_0116: Unknown result type (might be due to invalid IL or missing references)
			//IL_011b: Unknown result type (might be due to invalid IL or missing references)
			//IL_012b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0132: Unknown result type (might be due to invalid IL or missing references)
			//IL_013a: Unknown result type (might be due to invalid IL or missing references)
			//IL_014a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0157: Expected O, but got Unknown
			//IL_0159: Unknown result type (might be due to invalid IL or missing references)
			//IL_015e: Unknown result type (might be due to invalid IL or missing references)
			//IL_016e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0175: Unknown result type (might be due to invalid IL or missing references)
			//IL_017d: Unknown result type (might be due to invalid IL or missing references)
			//IL_018d: Unknown result type (might be due to invalid IL or missing references)
			//IL_019a: Expected O, but got Unknown
			//IL_01a3: Unknown result type (might be due to invalid IL or missing references)
			//IL_01a8: 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)
			//IL_01bf: Unknown result type (might be due to invalid IL or missing references)
			//IL_01c7: Unknown result type (might be due to invalid IL or missing references)
			//IL_01d7: Unknown result type (might be due to invalid IL or missing references)
			//IL_01e4: Expected O, but got Unknown
			//IL_01ed: Unknown result type (might be due to invalid IL or missing references)
			//IL_01f2: Unknown result type (might be due to invalid IL or missing references)
			//IL_01f9: Unknown result type (might be due to invalid IL or missing references)
			//IL_0200: Unknown result type (might be due to invalid IL or missing references)
			//IL_0208: Unknown result type (might be due to invalid IL or missing references)
			//IL_0218: Unknown result type (might be due to invalid IL or missing references)
			//IL_0225: Expected O, but got Unknown
			//IL_022e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0233: Unknown result type (might be due to invalid IL or missing references)
			//IL_023a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0241: Unknown result type (might be due to invalid IL or missing references)
			//IL_0249: Unknown result type (might be due to invalid IL or missing references)
			//IL_0259: Unknown result type (might be due to invalid IL or missing references)
			//IL_0266: Expected O, but got Unknown
			//IL_026f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0274: Unknown result type (might be due to invalid IL or missing references)
			//IL_027b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0282: Unknown result type (might be due to invalid IL or missing references)
			//IL_028a: Unknown result type (might be due to invalid IL or missing references)
			//IL_029a: Unknown result type (might be due to invalid IL or missing references)
			//IL_02a7: Expected O, but got Unknown
			List<Tribe> list = new List<Tribe>();
			if (Chainloader.PluginInfos.ContainsKey("Lily.BOT"))
			{
				list.Add(GuidManager.GetEnumValue<Tribe>("Lily.BOT", "aquatic"));
			}
			else
			{
				list.Add((Tribe)2);
			}
			List<Ability> redundant = new List<Ability> { (Ability)13 };
			bool regionLocked = true;
			List<CardInfo> randomReplacementCards = EncounterHelper.AddRandomCards("re_Starfish", "Shark", "Kingfisher", "re_Moon_Jellyfish");
			List<List<CardBlueprint>> list2 = new List<List<CardBlueprint>>();
			List<CardBlueprint> item = new List<CardBlueprint>
			{
				new CardBlueprint
				{
					card = CardLoader.GetCardByName("re_Jonah_Crab")
				},
				new CardBlueprint
				{
					card = CardLoader.GetCardByName("Kingfisher")
				}
			};
			List<CardBlueprint> item2 = new List<CardBlueprint>
			{
				new CardBlueprint
				{
					card = CardLoader.GetCardByName("Kingfisher"),
					difficultyReplace = true,
					difficultyReq = 13,
					replacement = CardLoader.GetCardByName("re_American_Lobster"),
					randomReplaceChance = 25
				}
			};
			List<CardBlueprint> item3 = new List<CardBlueprint>
			{
				new CardBlueprint
				{
					card = CardLoader.GetCardByName("re_Jonah_Crab"),
					difficultyReplace = true,
					difficultyReq = 12,
					replacement = CardLoader.GetCardByName("re_Starfish"),
					randomReplaceChance = 25
				},
				new CardBlueprint
				{
					card = CardLoader.GetCardByName("re_Jonah_Crab"),
					difficultyReplace = true,
					difficultyReq = 19,
					replacement = CardLoader.GetCardByName("re_American_Lobster"),
					randomReplaceChance = 25
				}
			};
			List<CardBlueprint> item4 = new List<CardBlueprint>
			{
				new CardBlueprint
				{
					card = CardLoader.GetCardByName("Kingfisher"),
					difficultyReplace = true,
					difficultyReq = 13,
					replacement = CardLoader.GetCardByName("re_Jonah_Crab"),
					randomReplaceChance = 25
				}
			};
			List<CardBlueprint> item5 = new List<CardBlueprint>
			{
				new CardBlueprint
				{
					card = null,
					difficultyReplace = true,
					difficultyReq = 15,
					replacement = CardLoader.GetCardByName("re_Jonah_Crab"),
					randomReplaceChance = 25
				}
			};
			List<CardBlueprint> item6 = new List<CardBlueprint>
			{
				new CardBlueprint
				{
					card = null,
					difficultyReplace = true,
					difficultyReq = 17,
					replacement = CardLoader.GetCardByName("re_American_Lobster"),
					randomReplaceChance = 25
				}
			};
			List<CardBlueprint> item7 = new List<CardBlueprint>
			{
				new CardBlueprint
				{
					card = null,
					difficultyReplace = true,
					difficultyReq = 19,
					replacement = CardLoader.GetCardByName("Shark"),
					randomReplaceChance = 25
				}
			};
			List<CardBlueprint> item8 = new List<CardBlueprint>();
			List<CardBlueprint> item9 = new List<CardBlueprint>();
			list2.Add(item);
			list2.Add(item2);
			list2.Add(item3);
			list2.Add(item4);
			list2.Add(item5);
			list2.Add(item6);
			list2.Add(item7);
			list2.Add(item8);
			list2.Add(item9);
			EncounterManager.Add(EncounterHelper.BuildBlueprint("CrabsAndLobster", list, redundant, regionLocked, 0, 30, randomReplacementCards, list2));
		}
	}
	internal class TideOfFish
	{
		public static void AddEncounter()
		{
			//IL_0027: Unknown result type (might be due to invalid IL or missing references)
			//IL_008d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0092: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a7: Expected O, but got Unknown
			//IL_00b0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00cc: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f1: Expected O, but got Unknown
			//IL_00f3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f8: Unknown result type (might be due to invalid IL or missing references)
			//IL_010d: Expected O, but got Unknown
			//IL_0116: Unknown result type (might be due to invalid IL or missing references)
			//IL_011b: Unknown result type (might be due to invalid IL or missing references)
			//IL_012b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0132: Unknown result type (might be due to invalid IL or missing references)
			//IL_013a: Unknown result type (might be due to invalid IL or missing references)
			//IL_014a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0157: Expected O, but got Unknown
			//IL_0159: Unknown result type (might be due to invalid IL or missing references)
			//IL_015e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0165: Unknown result type (might be due to invalid IL or missing references)
			//IL_016c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0174: Unknown result type (might be due to invalid IL or missing references)
			//IL_0184: Unknown result type (might be due to invalid IL or missing references)
			//IL_0191: Expected O, but got Unknown
			//IL_019a: Unknown result type (might be due to invalid IL or missing references)
			//IL_019f: Unknown result type (might be due to invalid IL or missing references)
			//IL_01a6: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ad: Unknown result type (might be due to invalid IL or missing references)
			//IL_01b5: Unknown result type (might be due to invalid IL or missing references)
			//IL_01c5: Unknown result type (might be due to invalid IL or missing references)
			//IL_01d2: Expected O, but got Unknown
			//IL_01db: Unknown result type (might be due to invalid IL or missing references)
			//IL_01e0: Unknown result type (might be due to invalid IL or missing references)
			//IL_01e7: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ee: Unknown result type (might be due to invalid IL or missing references)
			//IL_01f6: Unknown result type (might be due to invalid IL or missing references)
			//IL_0206: Unknown result type (might be due to invalid IL or missing references)
			//IL_0213: Expected O, but got Unknown
			//IL_021c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0221: Unknown result type (might be due to invalid IL or missing references)
			//IL_0228: Unknown result type (might be due to invalid IL or missing references)
			//IL_022f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0237: Unknown result type (might be due to invalid IL or missing references)
			//IL_0247: Unknown result type (might be due to invalid IL or missing references)
			//IL_0254: Expected O, but got Unknown
			//IL_025d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0262: Unknown result type (might be due to invalid IL or missing references)
			//IL_0269: Unknown result type (might be due to invalid IL or missing references)
			//IL_0270: Unknown result type (might be due to invalid IL or missing references)
			//IL_0278: Unknown result type (might be due to invalid IL or missing references)
			//IL_0288: Unknown result type (might be due to invalid IL or missing references)
			//IL_0295: Expected O, but got Unknown
			List<Tribe> list = new List<Tribe>();
			if (Chainloader.PluginInfos.ContainsKey("Lily.BOT"))
			{
				list.Add(GuidManager.GetEnumValue<Tribe>("Lily.BOT", "aquatic"));
			}
			else
			{
				list.Add((Tribe)2);
			}
			List<Ability> redundant = new List<Ability> { (Ability)13 };
			bool regionLocked = true;
			List<CardInfo> randomReplacementCards = EncounterHelper.AddRandomCards("re_Schoolling_Fish", "Shark", "Kingfisher");
			List<List<CardBlueprint>> list2 = new List<List<CardBlueprint>>();
			List<CardBlueprint> item = new List<CardBlueprint>
			{
				new CardBlueprint
				{
					card = CardLoader.GetCardByName("re_Moon_Jellyfish")
				}
			};
			List<CardBlueprint> item2 = new List<CardBlueprint>
			{
				new CardBlueprint
				{
					card = CardLoader.GetCardByName("re_Moon_Jellyfish"),
					difficultyReplace = true,
					difficultyReq = 18,
					replacement = CardLoader.GetCardByName("re_Costal_Salmon"),
					randomReplaceChance = 25
				},
				new CardBlueprint
				{
					card = CardLoader.GetCardByName("Kingfisher")
				}
			};
			List<CardBlueprint> item3 = new List<CardBlueprint>
			{
				new CardBlueprint
				{
					card = CardLoader.GetCardByName("re_Moon_Jellyfish"),
					difficultyReplace = true,
					difficultyReq = 12,
					replacement = CardLoader.GetCardByName("re_Costal_Salmon"),
					randomReplaceChance = 25
				},
				new CardBlueprint
				{
					card = null,
					difficultyReplace = true,
					difficultyReq = 19,
					replacement = CardLoader.GetCardByName("Shark"),
					randomReplaceChance = 25
				}
			};
			List<CardBlueprint> item4 = new List<CardBlueprint>
			{
				new CardBlueprint
				{
					card = null,
					difficultyReplace = true,
					difficultyReq = 15,
					replacement = CardLoader.GetCardByName("re_Costal_Salmon"),
					randomReplaceChance = 25
				}
			};
			List<CardBlueprint> item5 = new List<CardBlueprint>
			{
				new CardBlueprint
				{
					card = null,
					difficultyReplace = true,
					difficultyReq = 17,
					replacement = CardLoader.GetCardByName("re_Schoolling_Fish"),
					randomReplaceChance = 25
				}
			};
			List<CardBlueprint> item6 = new List<CardBlueprint>
			{
				new CardBlueprint
				{
					card = null,
					difficultyReplace = true,
					difficultyReq = 19,
					replacement = CardLoader.GetCardByName("re_Schoolling_Fish"),
					randomReplaceChance = 25
				}
			};
			List<CardBlueprint> item7 = new List<CardBlueprint>
			{
				new CardBlueprint
				{
					card = null,
					difficultyReplace = true,
					difficultyReq = 21,
					replacement = CardLoader.GetCardByName("Shark"),
					randomReplaceChance = 25
				}
			};
			List<CardBlueprint> item8 = new List<CardBlueprint>();
			List<CardBlueprint> item9 = new List<CardBlueprint>();
			list2.Add(item);
			list2.Add(item2);
			list2.Add(item3);
			list2.Add(item4);
			list2.Add(item5);
			list2.Add(item6);
			list2.Add(item7);
			list2.Add(item8);
			list2.Add(item9);
			EncounterManager.Add(EncounterHelper.BuildBlueprint("TideOfFish", list, redundant, regionLocked, 0, 30, randomReplacementCards, list2));
		}
	}
}
namespace RegionExpansions.cards
{
	public static class American_Lobster
	{
		public static readonly Ability CustomAbility1 = GuidManager.GetEnumValue<Ability>("extraVoid.inscryption.voidSigils", "Gripper");

		public static void AddCard()
		{
			//IL_0068: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b1: 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)
			string displayName = "Small Lobster";
			string description = "Their claws can keep a grip on almost anything.";
			int attack = 2;
			int health = 1;
			int bloodCost = 2;
			int boneCost = 0;
			int energyCost = 0;
			List<CardMetaCategory> cardMetaCategories = new List<CardMetaCategory>
			{
				(CardMetaCategory)0,
				(CardMetaCategory)1
			};
			List<Tribe> list = new List<Tribe>();
			if (Chainloader.PluginInfos.ContainsKey("Lily.BOT"))
			{
				Plugin.Log.LogMessage((object)"Lily Totems found, Small Lobster is now aquatic");
				list.Add(GuidManager.GetEnumValue<Tribe>("Lily.BOT", "aquatic"));
			}
			if (Chainloader.PluginInfos.ContainsKey("nevernamed.inscryption.sigils"))
			{
				Plugin.Log.LogMessage((object)"Never stuff found, Small Lobster is now Crustacean");
				list.Add(GuidManager.GetEnumValue<Tribe>("nevernamed.inscryption.sigils", "Crustacean"));
			}
			List<Ability> abilities = new List<Ability>
			{
				CustomAbility1,
				(Ability)13
			};
			List<Trait> traits = new List<Trait>();
			Texture2D imageAsTexture = TextureHelper.GetImageAsTexture("re_Lobster.png", typeof(High_Tide).Assembly, (FilterMode)0);
			Texture2D imageAsTexture2 = TextureHelper.GetImageAsTexture("re_Lobster_e.png", typeof(High_Tide).Assembly, (FilterMode)0);
			CardInfo val = SigilUtils.CreateCardWithDefaultSettings("re_American_Lobster", displayName, attack, health, imageAsTexture, imageAsTexture2, cardMetaCategories, list, traits, abilities, null, bloodCost, boneCost, energyCost);
			val.description = description;
			CardManager.Add("re", val);
		}
	}
	public static class Costal_Salmon
	{
		public static void AddCard()
		{
			//IL_0068: Unknown result type (might be due to invalid IL or missing references)
			string displayName = "Costal Salmon";
			string description = "A salmon found along the coast around this time.";
			int attack = 2;
			int health = 2;
			int bloodCost = 2;
			int boneCost = 0;
			int energyCost = 0;
			List<CardMetaCategory> cardMetaCategories = new List<CardMetaCategory>
			{
				(CardMetaCategory)0,
				(CardMetaCategory)1
			};
			List<Tribe> list = new List<Tribe>();
			if (Chainloader.PluginInfos.ContainsKey("Lily.BOT"))
			{
				Plugin.Log.LogMessage((object)"Lily Totems found, Costal Salmon is now aquatic");
				list.Add(GuidManager.GetEnumValue<Tribe>("Lily.BOT", "aquatic"));
			}
			List<Ability> abilities = new List<Ability>
			{
				(Ability)3,
				(Ability)13
			};
			List<Trait> traits = new List<Trait>();
			Texture2D imageAsTexture = TextureHelper.GetImageAsTexture("re_salmon.png", typeof(High_Tide).Assembly, (FilterMode)0);
			Texture2D imageAsTexture2 = TextureHelper.GetImageAsTexture("re_salmon_e.png", typeof(High_Tide).Assembly, (FilterMode)0);
			CardInfo val = SigilUtils.CreateCardWithDefaultSettings("re_Costal_Salmon", displayName, attack, health, imageAsTexture, imageAsTexture2, cardMetaCategories, list, traits, abilities, null, bloodCost, boneCost, energyCost);
			val.description = description;
			CardManager.Add("re", val);
		}
	}
	public static class High_Tide
	{
		public static readonly Ability CustomAbility1 = GuidManager.GetEnumValue<Ability>("extraVoid.inscryption.voidSigils", "High Tide");

		public static void AddCard()
		{
			//IL_0035: Unknown result type (might be due to invalid IL or missing references)
			string displayName = "High Tide";
			string description = "A high tide swallows everything.";
			int attack = 0;
			int health = 2;
			int bloodCost = 0;
			int boneCost = 0;
			int energyCost = 0;
			List<CardMetaCategory> cardMetaCategories = new List<CardMetaCategory>();
			List<Tribe> tribes = new List<Tribe>();
			List<Ability> abilities = new List<Ability> { CustomAbility1 };
			List<Trait> traits = new List<Trait> { (Trait)12 };
			Texture2D imageAsTexture = TextureHelper.GetImageAsTexture("re_HighTide.png", typeof(High_Tide).Assembly, (FilterMode)0);
			Texture2D imageAsTexture2 = TextureHelper.GetImageAsTexture("re_HighTide.png", typeof(High_Tide).Assembly, (FilterMode)0);
			CardInfo val = SigilUtils.CreateCardWithDefaultSettings("re_High_Tide", displayName, attack, health, imageAsTexture, imageAsTexture2, cardMetaCategories, tribes, traits, abilities, null, bloodCost, boneCost, energyCost);
			val.description = description;
			CardExtensions.SetTerrain(val);
			CardManager.Add("re", val);
		}
	}
	public static class Jonah_Crab
	{
		public static readonly Ability CustomAbility1 = GuidManager.GetEnumValue<Ability>("extraVoid.inscryption.voidSigils", "Thick Shell");

		public static void AddCard()
		{
			//IL_0068: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b1: 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)
			string displayName = "Jonah Crab";
			string description = "A crab with a thick shell.";
			int attack = 1;
			int health = 1;
			int bloodCost = 1;
			int boneCost = 0;
			int energyCost = 0;
			List<CardMetaCategory> cardMetaCategories = new List<CardMetaCategory>
			{
				(CardMetaCategory)0,
				(CardMetaCategory)1
			};
			List<Tribe> list = new List<Tribe>();
			if (Chainloader.PluginInfos.ContainsKey("Lily.BOT"))
			{
				Plugin.Log.LogMessage((object)"Lily Totems found, Jonah Crab is now aquatic");
				list.Add(GuidManager.GetEnumValue<Tribe>("Lily.BOT", "aquatic"));
			}
			if (Chainloader.PluginInfos.ContainsKey("nevernamed.inscryption.sigils"))
			{
				Plugin.Log.LogMessage((object)"Never stuff found, Jonah Crab is now Crustacean");
				list.Add(GuidManager.GetEnumValue<Tribe>("nevernamed.inscryption.sigils", "Crustacean"));
			}
			List<Ability> abilities = new List<Ability> { CustomAbility1 };
			List<Trait> traits = new List<Trait>();
			Texture2D imageAsTexture = TextureHelper.GetImageAsTexture("re_Crab.png", typeof(High_Tide).Assembly, (FilterMode)0);
			Texture2D imageAsTexture2 = TextureHelper.GetImageAsTexture("re_Crab_e.png", typeof(High_Tide).Assembly, (FilterMode)0);
			CardInfo val = SigilUtils.CreateCardWithDefaultSettings("re_Jonah_Crab", displayName, attack, health, imageAsTexture, imageAsTexture2, cardMetaCategories, list, traits, abilities, null, bloodCost, boneCost, energyCost);
			val.description = description;
			CardManager.Add("re", val);
		}
	}
	public static class Low_Tide
	{
		public static readonly Ability CustomAbility1 = GuidManager.GetEnumValue<Ability>("extraVoid.inscryption.voidSigils", "Low Tide");

		public static void AddCard()
		{
			//IL_0035: Unknown result type (might be due to invalid IL or missing references)
			string displayName = "Low Tide";
			string description = "A low tide reveals treasure.";
			int attack = 0;
			int health = 2;
			int bloodCost = 0;
			int boneCost = 0;
			int energyCost = 0;
			List<CardMetaCategory> cardMetaCategories = new List<CardMetaCategory>();
			List<Tribe> tribes = new List<Tribe>();
			List<Ability> abilities = new List<Ability> { CustomAbility1 };
			List<Trait> traits = new List<Trait> { (Trait)12 };
			Texture2D imageAsTexture = TextureHelper.GetImageAsTexture("re_LowTide.png", typeof(Low_Tide).Assembly, (FilterMode)0);
			Texture2D imageAsTexture2 = TextureHelper.GetImageAsTexture("re_LowTide.png", typeof(Low_Tide).Assembly, (FilterMode)0);
			CardInfo val = SigilUtils.CreateCardWithDefaultSettings("re_Low_Tide", displayName, attack, health, imageAsTexture, imageAsTexture2, cardMetaCategories, tribes, traits, abilities, null, bloodCost, boneCost, energyCost);
			val.description = description;
			CardExtensions.SetTerrain(val);
			CardManager.Add("re", val);
		}
	}
	public static class Moon_Jellyfish
	{
		public static readonly Ability CustomAbility1 = GuidManager.GetEnumValue<Ability>("extraVoid.inscryption.voidSigils", "Submerged Ambush");

		public static void AddCard()
		{
			//IL_007b: 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)
			string displayName = "Moon Jellyfish";
			string description = "A crab with a thick shell.";
			int attack = 1;
			int health = 1;
			int bloodCost = 1;
			int boneCost = 0;
			int energyCost = 0;
			List<CardMetaCategory> cardMetaCategories = new List<CardMetaCategory>
			{
				(CardMetaCategory)0,
				(CardMetaCategory)1
			};
			List<Tribe> list = new List<Tribe>();
			if (Chainloader.PluginInfos.ContainsKey("Lily.BOT"))
			{
				Plugin.Log.LogMessage((object)"Lily Totems found, Moon Jellyfish is now aquatic");
				list.Add(GuidManager.GetEnumValue<Tribe>("Lily.BOT", "aquatic"));
			}
			List<Ability> abilities = new List<Ability>
			{
				CustomAbility1,
				(Ability)13
			};
			List<Trait> traits = new List<Trait>();
			Texture2D imageAsTexture = TextureHelper.GetImageAsTexture("re_Jellyfish.png", typeof(High_Tide).Assembly, (FilterMode)0);
			Texture2D imageAsTexture2 = TextureHelper.GetImageAsTexture("re_Jellyfish_e.png", typeof(High_Tide).Assembly, (FilterMode)0);
			CardInfo val = SigilUtils.CreateCardWithDefaultSettings("re_Moon_Jellyfish", displayName, attack, health, imageAsTexture, imageAsTexture2, cardMetaCategories, list, traits, abilities, null, bloodCost, boneCost, energyCost);
			val.description = description;
			CardManager.Add("re", val);
		}
	}
	public static class Mussel
	{
		public static readonly Ability CustomAbility1 = GuidManager.GetEnumValue<Ability>("extraVoid.inscryption.voidSigils", "Sluggish");

		public static readonly Ability CustomAbility2 = GuidManager.GetEnumValue<Ability>("extraVoid.inscryption.voidSigils", "Sticky");

		public static void AddCard()
		{
			//IL_0068: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00bd: Unknown result type (might be due to invalid IL or missing references)
			//IL_009e: Unknown result type (might be due to invalid IL or missing references)
			string displayName = "Rock Mussel";
			string description = "A mussel that can stick to anything.";
			int attack = 0;
			int health = 3;
			int bloodCost = 1;
			int boneCost = 0;
			int energyCost = 0;
			List<CardMetaCategory> cardMetaCategories = new List<CardMetaCategory>
			{
				(CardMetaCategory)0,
				(CardMetaCategory)1
			};
			List<Tribe> list = new List<Tribe>();
			if (Chainloader.PluginInfos.ContainsKey("Lily.BOT"))
			{
				Plugin.Log.LogMessage((object)"Lily Totems found, Rock Mussel is now aquatic");
				list.Add(GuidManager.GetEnumValue<Tribe>("Lily.BOT", "aquatic"));
			}
			if (Chainloader.PluginInfos.ContainsKey("nevernamed.inscryption.sigils"))
			{
				Plugin.Log.LogMessage((object)"Never stuff found, Rock Mussel is now Crustacean");
				list.Add(GuidManager.GetEnumValue<Tribe>("nevernamed.inscryption.sigils", "Crustacean"));
			}
			List<Ability> abilities = new List<Ability> { CustomAbility1, CustomAbility2 };
			List<Trait> traits = new List<Trait>();
			Texture2D imageAsTexture = TextureHelper.GetImageAsTexture("re_Mussel.png", typeof(High_Tide).Assembly, (FilterMode)0);
			Texture2D imageAsTexture2 = TextureHelper.GetImageAsTexture("re_Mussel_e.png", typeof(High_Tide).Assembly, (FilterMode)0);
			CardInfo val = SigilUtils.CreateCardWithDefaultSettings("re_Mussel", displayName, attack, health, imageAsTexture, imageAsTexture2, cardMetaCategories, list, traits, abilities, null, bloodCost, boneCost, energyCost);
			val.description = description;
			CardManager.Add("re", val);
		}
	}
	public static class School_Fish
	{
		public static readonly Ability CustomAbility1 = GuidManager.GetEnumValue<Ability>("extraVoid.inscryption.voidSigils", "Schooling");

		public static void AddCard()
		{
			//IL_007b: 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)
			string displayName = "Schooling Fish";
			string description = "A fish that likes to swim with fellow waterborne, increasing their numbers and strength.";
			int attack = 1;
			int health = 1;
			int bloodCost = 1;
			int boneCost = 0;
			int energyCost = 0;
			List<CardMetaCategory> cardMetaCategories = new List<CardMetaCategory>
			{
				(CardMetaCategory)0,
				(CardMetaCategory)1
			};
			List<Tribe> list = new List<Tribe>();
			if (Chainloader.PluginInfos.ContainsKey("Lily.BOT"))
			{
				Plugin.Log.LogMessage((object)"Lily Totems found, Schooling Fish is now aquatic");
				list.Add(GuidManager.GetEnumValue<Tribe>("Lily.BOT", "aquatic"));
			}
			List<Ability> abilities = new List<Ability>
			{
				CustomAbility1,
				(Ability)13
			};
			List<Trait> traits = new List<Trait>();
			Texture2D imageAsTexture = TextureHelper.GetImageAsTexture("re_Pogfish.png", typeof(High_Tide).Assembly, (FilterMode)0);
			Texture2D imageAsTexture2 = TextureHelper.GetImageAsTexture("re_Pogfish_e.png", typeof(High_Tide).Assembly, (FilterMode)0);
			CardInfo val = SigilUtils.CreateCardWithDefaultSettings("re_Schoolling_Fish", displayName, attack, health, imageAsTexture, imageAsTexture2, cardMetaCategories, list, traits, abilities, null, bloodCost, boneCost, energyCost);
			val.description = description;
			CardManager.Add("re", val);
		}
	}
	public static class Starfish
	{
		public static readonly Ability CustomAbility1 = GuidManager.GetEnumValue<Ability>("extraVoid.inscryption.voidSigils", "Sluggish");

		public static readonly Ability CustomAbility2 = GuidManager.GetEnumValue<Ability>("extraVoid.inscryption.voidSigils", "Regen 2");

		public static void AddCard()
		{
			//IL_007b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0087: 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)
			string displayName = "Beach Star";
			string description = "A starfish found in tidepools. They love to consume crab.";
			int attack = 1;
			int health = 4;
			int bloodCost = 2;
			int boneCost = 0;
			int energyCost = 0;
			List<CardMetaCategory> cardMetaCategories = new List<CardMetaCategory>
			{
				(CardMetaCategory)0,
				(CardMetaCategory)1
			};
			List<Tribe> list = new List<Tribe>();
			if (Chainloader.PluginInfos.ContainsKey("Lily.BOT"))
			{
				Plugin.Log.LogMessage((object)"Lily Totems found, Beach Star is now aquatic");
				list.Add(GuidManager.GetEnumValue<Tribe>("Lily.BOT", "aquatic"));
			}
			List<Ability> abilities = new List<Ability> { CustomAbility1, CustomAbility2 };
			List<Trait> traits = new List<Trait>();
			Texture2D imageAsTexture = TextureHelper.GetImageAsTexture("re_Starfish.png", typeof(High_Tide).Assembly, (FilterMode)0);
			Texture2D imageAsTexture2 = TextureHelper.GetImageAsTexture("re_Starfish_e.png", typeof(High_Tide).Assembly, (FilterMode)0);
			CardInfo val = SigilUtils.CreateCardWithDefaultSettings("re_Starfish", displayName, attack, health, imageAsTexture, imageAsTexture2, cardMetaCategories, list, traits, abilities, null, bloodCost, boneCost, energyCost);
			val.description = description;
			CardManager.Add("re", val);
		}
	}
	public static class Strong_Wind_1
	{
		public static readonly Ability CustomAbility2 = GuidManager.GetEnumValue<Ability>("extraVoid.inscryption.voidSigils", "Strong Wind");

		public static void AddCard()
		{
			//IL_003e: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d8: Expected I4, but got Unknown
			string displayName = "Strong Wind";
			string description = "A strong wind forces fliers to land.";
			int attack = 0;
			int health = 1;
			int bloodCost = 0;
			int boneCost = 0;
			int energyCost = 0;
			List<CardMetaCategory> cardMetaCategories = new List<CardMetaCategory>();
			List<Tribe> tribes = new List<Tribe>();
			List<Ability> abilities = new List<Ability>
			{
				(Ability)23,
				CustomAbility2
			};
			List<Trait> traits = new List<Trait> { (Trait)12 };
			Texture2D imageAsTexture = TextureHelper.GetImageAsTexture("re_Strong_Wind.png", typeof(Strong_Wind_1).Assembly, (FilterMode)0);
			Texture2D imageAsTexture2 = TextureHelper.GetImageAsTexture("re_Strong_Wind.png", typeof(Strong_Wind_1).Assembly, (FilterMode)0);
			CardInfo val = SigilUtils.CreateCardWithDefaultSettings("re_Strong_Wind_1", displayName, attack, health, imageAsTexture, imageAsTexture2, cardMetaCategories, tribes, traits, abilities, null, bloodCost, boneCost, energyCost);
			val.description = description;
			CardExtensions.SetExtendedProperty(val, "void_dying_count", (object)1);
			CardExtensions.AddSpecialAbilities(val, (SpecialTriggeredAbility[])(object)new SpecialTriggeredAbility[1] { (SpecialTriggeredAbility)(int)DyingWind.specialAbility });
			CardExtensions.SetTerrain(val);
			CardManager.Add("re", val);
		}
	}
}

plugins/WhistleWind-New_Spell_Card_Toolkit/plugins/Infiniscryption.Spells.dll

Decompiled 5 months ago
using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.Globalization;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Serialization;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using System.Text;
using BepInEx;
using BepInEx.Configuration;
using BepInEx.Logging;
using DiskCardGame;
using GBC;
using HarmonyLib;
using Infiniscryption.Core.Helpers;
using Infiniscryption.Spells.Patchers;
using Infiniscryption.Spells.Sigils;
using InscryptionAPI.Card;
using InscryptionAPI.Guid;
using InscryptionAPI.Helpers.Extensions;
using Microsoft.CodeAnalysis;
using Pixelplacement;
using UnityEngine;
using UnityEngine.Networking;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: TargetFramework(".NETStandard,Version=v2.0", FrameworkDisplayName = ".NET Standard 2.0")]
[assembly: AssemblyCompany("Infiniscryption.Spells")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyDescription("An updated version of Infiniscryption's Spell Card Toolkit with new features and general improvements.")]
[assembly: AssemblyFileVersion("1.2.4.0")]
[assembly: AssemblyInformationalVersion("1.2.4")]
[assembly: AssemblyProduct("Infiniscryption.Spells")]
[assembly: AssemblyTitle("Infiniscryption.Spells")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.2.4.0")]
[module: UnverifiableCode]
[module: RefSafetyRules(11)]
namespace Microsoft.CodeAnalysis
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	internal sealed class EmbeddedAttribute : Attribute
	{
	}
}
namespace System.Runtime.CompilerServices
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	[AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)]
	internal sealed class RefSafetyRulesAttribute : Attribute
	{
		public readonly int Version;

		public RefSafetyRulesAttribute(int P_0)
		{
			Version = P_0;
		}
	}
}
namespace NewSpellsAPI
{
	public static class PluginInfo
	{
		public const string PLUGIN_GUID = "Infiniscryption.Spells";

		public const string PLUGIN_NAME = "Infiniscryption.Spells";

		public const string PLUGIN_VERSION = "1.2.4";
	}
}
namespace Infiniscryption.Spells
{
	public class SpellSniperVisualiser : ManagedBehaviour
	{
		public List<GameObject> sniperIcons = new List<GameObject>();

		private GameObject sniperIconPrefab;

		private GameObject tempSniperIcon;

		public void VisualizeStartSniperAbility(CardSlot sniperSlot)
		{
		}

		public void VisualizeAimSniperAbility(CardSlot sniperSlot, CardSlot targetSlot)
		{
			//IL_0066: Unknown result type (might be due to invalid IL or missing references)
			//IL_0076: Unknown result type (might be due to invalid IL or missing references)
			if ((Object)(object)tempSniperIcon != (Object)null)
			{
				CleanUpTargetIcon(tempSniperIcon);
				tempSniperIcon = null;
			}
			if ((Object)(object)sniperIconPrefab == (Object)null)
			{
				sniperIconPrefab = ResourceBank.Get<GameObject>("Prefabs/Cards/SpecificCardModels/CannonTargetIcon");
			}
			GameObject val = Object.Instantiate<GameObject>(sniperIconPrefab, ((Component)targetSlot).transform);
			val.transform.localPosition = new Vector3(0f, 0.25f, 0f);
			val.transform.localRotation = Quaternion.identity;
			tempSniperIcon = val;
		}

		public void CleanUpTargetIcon(GameObject icon)
		{
			//IL_0018: Unknown result type (might be due to invalid IL or missing references)
			Tween.LocalScale(icon.transform, Vector3.zero, 0.1f, 0f, Tween.EaseIn, (LoopType)0, (Action)null, (Action)delegate
			{
				Object.Destroy((Object)(object)icon);
			}, true);
		}

		public void VisualizeConfirmSniperAbility(CardSlot targetSlot)
		{
			//IL_0045: 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)
			if ((Object)(object)sniperIconPrefab == (Object)null)
			{
				sniperIconPrefab = ResourceBank.Get<GameObject>("Prefabs/Cards/SpecificCardModels/CannonTargetIcon");
			}
			GameObject val = Object.Instantiate<GameObject>(sniperIconPrefab, ((Component)targetSlot).transform);
			val.transform.localPosition = new Vector3(0f, 0.25f, 0f);
			val.transform.localRotation = Quaternion.identity;
			sniperIcons.Add(val);
			if ((Object)(object)tempSniperIcon != (Object)null)
			{
				CleanUpTargetIcon(tempSniperIcon);
				tempSniperIcon = null;
			}
		}

		public void VisualizeClearSniperAbility()
		{
			sniperIcons.ForEach(delegate(GameObject x)
			{
				if ((Object)(object)x != (Object)null)
				{
					CleanUpTargetIcon(x);
				}
			});
			sniperIcons.Clear();
			if ((Object)(object)tempSniperIcon != (Object)null)
			{
				CleanUpTargetIcon(tempSniperIcon);
				tempSniperIcon = null;
			}
		}
	}
	[BepInPlugin("zorro.inscryption.infiniscryption.spells", "New Infiniscryption Spells", "1.2.4")]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	public class InfiniscryptionSpellsPlugin : BaseUnityPlugin
	{
		internal const string OriginalPluginGuid = "zorro.infiniscryption.sigils";

		public const string PluginGuid = "zorro.inscryption.infiniscryption.spells";

		internal const string PluginName = "New Infiniscryption Spells";

		internal const string PluginVersion = "1.2.4";

		internal const string CardPrefix = "ZSPL";

		internal static ManualLogSource Log;

		private bool AddCards => ((BaseUnityPlugin)this).Config.Bind<bool>("InfiniscryptionSpells", "AddCards", false, new ConfigDescription("If true, this will add the sample cards to the card pool.", (AcceptableValueBase)null, Array.Empty<object>())).Value;

		private bool AllowStatBoost => ((BaseUnityPlugin)this).Config.Bind<bool>("InfiniscryptionSpells", "AllowStatBoost", true, new ConfigDescription("If true, this will allow stat-showing spells to be buffed at campfires.", (AcceptableValueBase)null, Array.Empty<object>())).Value;

		private bool AllowCardMerge => ((BaseUnityPlugin)this).Config.Bind<bool>("InfiniscryptionSpells", "AllowCardMerge", true, new ConfigDescription("If true, this will allow spell cards to gain and transfer their sigils.", (AcceptableValueBase)null, Array.Empty<object>())).Value;

		internal static bool SpellMerge { get; private set; }

		private void Awake()
		{
			//IL_0010: Unknown result type (might be due to invalid IL or missing references)
			//IL_0016: Expected O, but got Unknown
			//IL_0069: Unknown result type (might be due to invalid IL or missing references)
			//IL_0076: Expected O, but got Unknown
			Log = ((BaseUnityPlugin)this).Logger;
			Harmony val = new Harmony("zorro.inscryption.infiniscryption.spells");
			SpellMerge = AllowCardMerge;
			val.PatchAll(typeof(SpellBehavior));
			if (AllowStatBoost)
			{
				MethodInfo method = typeof(CardStatBoostSequencer).GetMethod("GetValidCards", BindingFlags.Instance | BindingFlags.NonPublic);
				MethodInfo method2 = typeof(SpellBehavior).GetMethod("AllowStatBoostForSpells");
				val.Patch((MethodBase)method, (HarmonyMethod)null, new HarmonyMethod(method2), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null);
			}
			TargetedSpellAbility.Register();
			GlobalSpellAbility.Register();
			InstaGlobalSpellAbility.Register();
			RuntimeHelpers.RunClassConstructor(typeof(SpellBehavior.SpellBackgroundAppearance).TypeHandle);
			RuntimeHelpers.RunClassConstructor(typeof(SpellBehavior.RareSpellBackgroundAppearance).TypeHandle);
			DrawTwoCards.Register();
			DestroyAllCardsOnDeath.Register();
			DirectDamage.Register();
			DirectHeal.Register();
			AttackBuff.Register();
			AttackNerf.Register();
			Fishhook.Register();
			GiveStats.Register();
			GiveSigils.Register();
			GiveStatsSigils.Register();
			if (AddCards)
			{
				SpellCards.RegisterCustomCards();
			}
			CardManager.ModifyCardList += delegate(List<CardInfo> cards)
			{
				//IL_001d: Unknown result type (might be due to invalid IL or missing references)
				//IL_0022: Unknown result type (might be due to invalid IL or missing references)
				//IL_005b: Unknown result type (might be due to invalid IL or missing references)
				//IL_0060: 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)
				foreach (CardInfo card in cards)
				{
					if (card.IsTargetedSpell() && card.SpecialStatIcon != TargetedSpellAbility.Icon)
					{
						card.SetTargetedSpell();
						if (!card.hideAttackAndHealth && (card.baseHealth > 0 || card.baseAttack > 0))
						{
							CardExtensions.SetHideStats(card, false);
						}
					}
					if (card.IsGlobalSpell() && (card.SpecialStatIcon != GlobalSpellAbility.Icon || card.SpecialStatIcon != InstaGlobalSpellAbility.Icon))
					{
						if (card.IsInstaGlobalSpell())
						{
							card.SetInstaGlobalSpell();
						}
						else
						{
							card.SetGlobalSpell();
						}
						if (!card.hideAttackAndHealth && (card.baseHealth > 0 || card.baseAttack > 0))
						{
							CardExtensions.SetHideStats(card, false);
						}
					}
				}
				return cards;
			};
			((BaseUnityPlugin)this).Logger.LogInfo((object)"New Infiniscryption Spells is loaded!");
		}
	}
}
namespace Infiniscryption.Spells.Sigils
{
	public class AttackNerf : AbilityBehaviour
	{
		public override Ability Ability => AbilityID;

		public static Ability AbilityID { get; private set; }

		public override bool RespondsToResolveOnBoard()
		{
			return ((Card)((AbilityBehaviour)this).Card).Info.IsGlobalSpell();
		}

		public override bool RespondsToSlotTargetedForAttack(CardSlot slot, PlayableCard attacker)
		{
			if (((Card)((AbilityBehaviour)this).Card).Info.IsSpell() && (Object)(object)slot.Card != (Object)null && slot.Card.Attack > 0)
			{
				return ((AbilityBehaviour)this).Card.OpponentCard != slot.Card.OpponentCard;
			}
			return false;
		}

		public override IEnumerator OnResolveOnBoard()
		{
			Singleton<ViewManager>.Instance.SwitchToView((View)4, false, false);
			yield return (object)new WaitForSeconds(0.2f);
			foreach (CardSlot slot in Singleton<BoardManager>.Instance.GetSlots(((AbilityBehaviour)this).Card.OpponentCard))
			{
				if ((Object)(object)slot.Card != (Object)null)
				{
					slot.Card.AddTemporaryMod(new CardModificationInfo(-1, 0));
				}
			}
			yield return ((AbilityBehaviour)this).LearnAbility(0.5f);
		}

		public override IEnumerator OnSlotTargetedForAttack(CardSlot slot, PlayableCard attacker)
		{
			slot.Card.AddTemporaryMod(new CardModificationInfo(-1, 0));
			yield return ((AbilityBehaviour)this).LearnAbility(0.5f);
		}

		public static void Register()
		{
			//IL_0085: Unknown result type (might be due to invalid IL or missing references)
			AbilityInfo val = ScriptableObject.CreateInstance<AbilityInfo>();
			val.rulebookName = "Attack Down";
			val.rulebookDescription = "Decreases the target's attack for the rest of the battle.";
			val.canStack = true;
			val.powerLevel = 1;
			val.opponentUsable = false;
			val.passive = false;
			val.metaCategories = new List<AbilityMetaCategory> { (AbilityMetaCategory)0 };
			AbilityExtensions.SetPixelAbilityIcon(val, AssetHelper.LoadTexture("attack_down_pixel", (FilterMode)0), (FilterMode?)null);
			AbilityID = AbilityManager.Add("zorro.infiniscryption.sigils", val, typeof(AttackNerf), (Texture)(object)AssetHelper.LoadTexture("ability_attack_down", (FilterMode)0)).Id;
		}
	}
	public class AttackBuff : AbilityBehaviour
	{
		public override Ability Ability => AbilityID;

		public static Ability AbilityID { get; private set; }

		public override bool RespondsToSacrifice()
		{
			return true;
		}

		public override bool RespondsToResolveOnBoard()
		{
			return ((Card)((AbilityBehaviour)this).Card).Info.IsGlobalSpell();
		}

		public override bool RespondsToSlotTargetedForAttack(CardSlot slot, PlayableCard attacker)
		{
			if (((Card)((AbilityBehaviour)this).Card).Info.IsSpell() && (Object)(object)slot.Card != (Object)null)
			{
				return ((AbilityBehaviour)this).Card.OpponentCard == slot.Card.OpponentCard;
			}
			return false;
		}

		public override IEnumerator OnSacrifice()
		{
			PlayableCard currentSacrificeDemandingCard = Singleton<BoardManager>.Instance.CurrentSacrificeDemandingCard;
			((Card)currentSacrificeDemandingCard).Anim.LightNegationEffect();
			if ((Object)(object)currentSacrificeDemandingCard != (Object)null)
			{
				currentSacrificeDemandingCard.AddTemporaryMod(new CardModificationInfo(1, 0));
			}
			yield return ((AbilityBehaviour)this).LearnAbility(0.5f);
		}

		public override IEnumerator OnResolveOnBoard()
		{
			Singleton<ViewManager>.Instance.SwitchToView((View)4, false, false);
			yield return (object)new WaitForSeconds(0.2f);
			foreach (CardSlot slot in Singleton<BoardManager>.Instance.GetSlots(CardExtensions.IsPlayerCard(((AbilityBehaviour)this).Card)))
			{
				if ((Object)(object)slot.Card != (Object)null)
				{
					((Card)slot.Card).Anim.LightNegationEffect();
					slot.Card.AddTemporaryMod(new CardModificationInfo(1, 0));
				}
			}
			yield return ((AbilityBehaviour)this).LearnAbility(0.5f);
		}

		public override IEnumerator OnSlotTargetedForAttack(CardSlot slot, PlayableCard attacker)
		{
			((Card)slot.Card).Anim.LightNegationEffect();
			slot.Card.AddTemporaryMod(new CardModificationInfo(1, 0));
			yield return ((AbilityBehaviour)this).LearnAbility(0.5f);
		}

		public static void Register()
		{
			//IL_0085: Unknown result type (might be due to invalid IL or missing references)
			AbilityInfo val = ScriptableObject.CreateInstance<AbilityInfo>();
			val.rulebookName = "Attack Up";
			val.rulebookDescription = "Increases the target's attack for the rest of the battle.";
			val.canStack = true;
			val.powerLevel = 1;
			val.opponentUsable = false;
			val.passive = false;
			val.metaCategories = new List<AbilityMetaCategory> { (AbilityMetaCategory)0 };
			AbilityExtensions.SetPixelAbilityIcon(val, AssetHelper.LoadTexture("attack_up_pixel", (FilterMode)0), (FilterMode?)null);
			AbilityID = AbilityManager.Add("zorro.infiniscryption.sigils", val, typeof(AttackBuff), (Texture)(object)AssetHelper.LoadTexture("ability_attack_up", (FilterMode)0)).Id;
		}
	}
	public static class CardHelpers
	{
		public static Trait NeverBoostStats = GuidManager.GetEnumValue<Trait>("zorro.infiniscryption.sigils", "NeverBoostStats");

		public static CardInfo SetGlobalSpell(this CardInfo card)
		{
			//IL_0008: 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: Expected I4, but got Unknown
			//IL_0025: Unknown result type (might be due to invalid IL or missing references)
			//IL_002b: Expected I4, but got Unknown
			card.hideAttackAndHealth = true;
			CardExtensions.SetStatIcon(card, GlobalSpellAbility.Icon);
			if (CardExtensions.HasCardMetaCategory(card, (CardMetaCategory)3))
			{
				CardExtensions.AddAppearances(card, (Appearance[])(object)new Appearance[1] { (Appearance)(int)SpellBehavior.RareSpellBackgroundAppearance.ID });
				card.appearanceBehaviour.Remove((Appearance)7);
			}
			else
			{
				CardExtensions.AddAppearances(card, (Appearance[])(object)new Appearance[1] { (Appearance)(int)SpellBehavior.SpellBackgroundAppearance.ID });
			}
			return card;
		}

		public static CardInfo SetInstaGlobalSpell(this CardInfo card)
		{
			//IL_0008: 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: Expected I4, but got Unknown
			//IL_0025: Unknown result type (might be due to invalid IL or missing references)
			//IL_002b: Expected I4, but got Unknown
			card.hideAttackAndHealth = true;
			CardExtensions.SetStatIcon(card, InstaGlobalSpellAbility.Icon);
			if (CardExtensions.HasCardMetaCategory(card, (CardMetaCategory)3))
			{
				CardExtensions.AddAppearances(card, (Appearance[])(object)new Appearance[1] { (Appearance)(int)SpellBehavior.RareSpellBackgroundAppearance.ID });
				card.appearanceBehaviour.Remove((Appearance)7);
			}
			else
			{
				CardExtensions.AddAppearances(card, (Appearance[])(object)new Appearance[1] { (Appearance)(int)SpellBehavior.SpellBackgroundAppearance.ID });
			}
			return card;
		}

		public static CardInfo SetTargetedSpell(this CardInfo card)
		{
			//IL_0008: 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: Expected I4, but got Unknown
			//IL_0025: Unknown result type (might be due to invalid IL or missing references)
			//IL_002b: Expected I4, but got Unknown
			card.hideAttackAndHealth = true;
			CardExtensions.SetStatIcon(card, TargetedSpellAbility.Icon);
			if (CardExtensions.HasCardMetaCategory(card, (CardMetaCategory)3))
			{
				CardExtensions.AddAppearances(card, (Appearance[])(object)new Appearance[1] { (Appearance)(int)SpellBehavior.RareSpellBackgroundAppearance.ID });
				card.appearanceBehaviour.Remove((Appearance)7);
			}
			else
			{
				CardExtensions.AddAppearances(card, (Appearance[])(object)new Appearance[1] { (Appearance)(int)SpellBehavior.SpellBackgroundAppearance.ID });
			}
			return card;
		}

		public static CardInfo SetTargetedSpellStats(this CardInfo card)
		{
			card.SetTargetedSpell();
			card.hideAttackAndHealth = false;
			return card;
		}

		public static CardInfo SetGlobalSpellStats(this CardInfo card)
		{
			card.SetGlobalSpell();
			card.hideAttackAndHealth = false;
			return card;
		}

		public static CardInfo SetInstaGlobalSpellStats(this CardInfo card)
		{
			card.SetInstaGlobalSpell();
			card.hideAttackAndHealth = false;
			return card;
		}

		public static CardInfo SetNeverBoostStats(this CardInfo card)
		{
			//IL_0009: Unknown result type (might be due to invalid IL or missing references)
			//IL_000f: Expected I4, but got Unknown
			CardExtensions.AddTraits(card, (Trait[])(object)new Trait[1] { (Trait)(int)NeverBoostStats });
			return card;
		}

		public static List<Ability> GetDistinctShownAbilities(CardInfo info, List<CardModificationInfo> mods, List<Ability> hiddenAbilities)
		{
			List<Ability> abilities = info.Abilities;
			abilities.AddRange(AbilitiesUtil.GetAbilitiesFromMods(mods));
			abilities = AbilitiesUtil.RemoveNonDistinctNonStacking(abilities);
			abilities.RemoveAll((Ability x) => mods.Exists((CardModificationInfo m) => m.negateAbilities.Contains(x)));
			if (hiddenAbilities != null)
			{
				abilities.RemoveAll(hiddenAbilities.Contains);
			}
			return abilities;
		}

		public static AbilityInfo SetCanMerge(this AbilityInfo info, bool canMerge = true)
		{
			AbilityExtensions.SetExtendedProperty(info, "Spells:CanMerge", (object)canMerge);
			return info;
		}

		public static bool CanMerge(this AbilityInfo info)
		{
			return AbilityExtensions.GetExtendedPropertyAsBool(info, "Spells:CanMerge") ?? true;
		}

		public static bool CanMerge(this Ability ability)
		{
			//IL_0000: Unknown result type (might be due to invalid IL or missing references)
			return AbilityExtensions.GetExtendedPropertyAsBool(ability, "Spells:CanMerge") ?? true;
		}
	}
	public class DestroyAllCardsOnDeath : AbilityBehaviour
	{
		public override Ability Ability => AbilityID;

		public static Ability AbilityID { get; private set; }

		public override bool RespondsToDie(bool wasSacrifice, PlayableCard killer)
		{
			return true;
		}

		public override IEnumerator OnDie(bool wasSacrifice, PlayableCard killer)
		{
			yield return ((AbilityBehaviour)this).PreSuccessfulTriggerSequence();
			Singleton<ViewManager>.Instance.SwitchToView((View)4, false, false);
			foreach (CardSlot item in Singleton<BoardManager>.Instance.OpponentSlotsCopy)
			{
				if ((Object)(object)item.Card != (Object)null)
				{
					yield return item.Card.Die(true, (PlayableCard)null, true);
				}
			}
			foreach (CardSlot item2 in Singleton<BoardManager>.Instance.PlayerSlotsCopy)
			{
				if ((Object)(object)item2.Card != (Object)null)
				{
					yield return item2.Card.Die(true, (PlayableCard)null, true);
				}
			}
			yield return (object)new WaitForSeconds(0.5f);
			yield return ((AbilityBehaviour)this).LearnAbility(0f);
			Singleton<ViewManager>.Instance.SwitchToView((View)1, false, false);
		}

		public static void Register()
		{
			//IL_007e: Unknown result type (might be due to invalid IL or missing references)
			AbilityInfo val = ScriptableObject.CreateInstance<AbilityInfo>();
			val.rulebookName = "Cataclysm";
			val.rulebookDescription = "When [creature] dies, all other cards on the boards perish as well.";
			val.canStack = false;
			val.powerLevel = 6;
			val.passive = false;
			val.metaCategories = new List<AbilityMetaCategory> { (AbilityMetaCategory)0 };
			AbilityExtensions.SetPixelAbilityIcon(val, AssetHelper.LoadTexture("nuke_pixel", (FilterMode)0), (FilterMode?)null);
			AbilityID = AbilityManager.Add("zorro.infiniscryption.sigils", val, typeof(DestroyAllCardsOnDeath), (Texture)(object)AssetHelper.LoadTexture("ability_nuke", (FilterMode)0)).Id;
		}
	}
	public class DirectDamage : AbilityBehaviour
	{
		public override Ability Ability => AbilityID;

		public static Ability AbilityID { get; private set; }

		public override bool RespondsToResolveOnBoard()
		{
			return ((Card)((AbilityBehaviour)this).Card).Info.IsGlobalSpell();
		}

		public override bool RespondsToSlotTargetedForAttack(CardSlot slot, PlayableCard attacker)
		{
			if (((Card)((AbilityBehaviour)this).Card).Info.IsSpell() && (Object)(object)slot.Card != (Object)null)
			{
				return ((AbilityBehaviour)this).Card.OpponentCard != slot.Card.OpponentCard;
			}
			return false;
		}

		public override IEnumerator OnResolveOnBoard()
		{
			Singleton<ViewManager>.Instance.SwitchToView((View)4, false, false);
			yield return (object)new WaitForSeconds(0.2f);
			foreach (CardSlot item in BoardManagerExtensions.GetSlotsCopy(Singleton<BoardManager>.Instance, !((AbilityBehaviour)this).Card.OpponentCard))
			{
				if ((Object)(object)item.Card != (Object)null)
				{
					yield return item.Card.TakeDamage(1, (PlayableCard)null);
				}
			}
			yield return ((AbilityBehaviour)this).LearnAbility(0.5f);
		}

		public override IEnumerator OnSlotTargetedForAttack(CardSlot slot, PlayableCard attacker)
		{
			yield return slot.Card.TakeDamage(1, attacker);
			yield return ((AbilityBehaviour)this).LearnAbility(0.5f);
		}

		public static void Register()
		{
			//IL_007e: Unknown result type (might be due to invalid IL or missing references)
			AbilityInfo val = ScriptableObject.CreateInstance<AbilityInfo>();
			val.rulebookName = "Direct Damage";
			val.rulebookDescription = "Deals damage directly to a target.";
			val.canStack = true;
			val.powerLevel = 1;
			val.passive = false;
			val.metaCategories = new List<AbilityMetaCategory> { (AbilityMetaCategory)0 };
			AbilityExtensions.SetPixelAbilityIcon(val, AssetHelper.LoadTexture("damage_pixel", (FilterMode)0), (FilterMode?)null);
			AbilityID = AbilityManager.Add("zorro.infiniscryption.sigils", val, typeof(DirectDamage), (Texture)(object)AssetHelper.LoadTexture("ability_damage", (FilterMode)0)).Id;
		}
	}
	public class DirectHeal : AbilityBehaviour
	{
		public override Ability Ability => AbilityID;

		public static Ability AbilityID { get; private set; }

		public override bool RespondsToSacrifice()
		{
			return true;
		}

		public override bool RespondsToResolveOnBoard()
		{
			return ((Card)((AbilityBehaviour)this).Card).Info.IsGlobalSpell();
		}

		public override bool RespondsToSlotTargetedForAttack(CardSlot slot, PlayableCard attacker)
		{
			if (((Card)((AbilityBehaviour)this).Card).Info.IsSpell() && (Object)(object)slot.Card != (Object)null)
			{
				return ((AbilityBehaviour)this).Card.OpponentCard == slot.Card.OpponentCard;
			}
			return false;
		}

		public override IEnumerator OnSacrifice()
		{
			PlayableCard currentSacrificeDemandingCard = Singleton<BoardManager>.Instance.CurrentSacrificeDemandingCard;
			if ((Object)(object)currentSacrificeDemandingCard != (Object)null)
			{
				currentSacrificeDemandingCard.HealDamage(1);
				yield return (object)new WaitForSeconds(0.45f);
				yield return ((AbilityBehaviour)this).LearnAbility(0.5f);
			}
		}

		public override IEnumerator OnResolveOnBoard()
		{
			foreach (CardSlot slot in Singleton<BoardManager>.Instance.GetSlots(true))
			{
				if ((Object)(object)slot.Card != (Object)null)
				{
					((AbilityBehaviour)this).Card.HealDamage(1);
				}
			}
			yield return (object)new WaitForSeconds(0.45f);
			yield return ((AbilityBehaviour)this).LearnAbility(0f);
		}

		public override IEnumerator OnSlotTargetedForAttack(CardSlot slot, PlayableCard attacker)
		{
			slot.Card.HealDamage(1);
			yield return (object)new WaitForSeconds(0.45f);
			yield return ((AbilityBehaviour)this).LearnAbility(0f);
		}

		public static void Register()
		{
			//IL_0077: Unknown result type (might be due to invalid IL or missing references)
			AbilityInfo val = ScriptableObject.CreateInstance<AbilityInfo>();
			val.rulebookName = "Direct Heal";
			val.rulebookDescription = "Heals the target. This can heal the target beyond its original max health.";
			val.canStack = true;
			val.passive = false;
			val.metaCategories = new List<AbilityMetaCategory> { (AbilityMetaCategory)0 };
			AbilityExtensions.SetPixelAbilityIcon(val, AssetHelper.LoadTexture("direct_heal_pixel", (FilterMode)0), (FilterMode?)null);
			AbilityID = AbilityManager.Add("zorro.infiniscryption.sigils", val, typeof(DirectHeal), (Texture)(object)AssetHelper.LoadTexture("ability_health_up", (FilterMode)0)).Id;
		}
	}
	public class DrawTwoCards : AbilityBehaviour
	{
		public override Ability Ability => AbilityID;

		public static Ability AbilityID { get; private set; }

		public static void Register()
		{
			//IL_0077: Unknown result type (might be due to invalid IL or missing references)
			AbilityInfo val = ScriptableObject.CreateInstance<AbilityInfo>();
			val.rulebookName = "Draw Twice";
			val.rulebookDescription = "When [creature] dies, draw two more cards and add them to your deck.";
			val.canStack = true;
			val.passive = false;
			val.metaCategories = new List<AbilityMetaCategory> { (AbilityMetaCategory)0 };
			AbilityExtensions.SetPixelAbilityIcon(val, AssetHelper.LoadTexture("drawtwocardsondeath_pixel", (FilterMode)0), (FilterMode?)null);
			AbilityID = AbilityManager.Add("zorro.infiniscryption.sigils", val, typeof(DrawTwoCards), (Texture)(object)AssetHelper.LoadTexture("ability_drawtwocardsondeath", (FilterMode)0)).Id;
		}

		public override bool RespondsToResolveOnBoard()
		{
			return !((Card)((AbilityBehaviour)this).Card).Info.IsSpell();
		}

		public override bool RespondsToDie(bool wasSacrifice, PlayableCard killer)
		{
			return ((Card)((AbilityBehaviour)this).Card).Info.IsSpell();
		}

		public override IEnumerator OnResolveOnBoard()
		{
			return Effect();
		}

		public override IEnumerator OnDie(bool wasSacrifice, PlayableCard killer)
		{
			if (((AbilityBehaviour)this).Card.OpponentCard)
			{
				int randomSeed = SaveManager.SaveFile.GetCurrentRandomSeed();
				List<CardInfo> possibleCards = new List<CardInfo>();
				foreach (List<CardInfo> item in Singleton<TurnManager>.Instance.Opponent.TurnPlan)
				{
					foreach (CardInfo item2 in item)
					{
						if ((Object)(object)((Card)((AbilityBehaviour)this).Card).Info != (Object)(object)item2)
						{
							possibleCards.Add(item2);
						}
					}
				}
				for (int i = 0; i < 2; i++)
				{
					List<CardSlot> list = Singleton<BoardManager>.Instance.OpponentSlotsCopy.Where((CardSlot s) => !Singleton<TurnManager>.Instance.Opponent.QueuedSlots.Contains(s)).ToList();
					if (list.Count() > 0)
					{
						CardSlot val = list[SeededRandom.Range(0, list.Count, randomSeed++)];
						CardInfo cardToQueue = possibleCards[SeededRandom.Range(0, possibleCards.Count, randomSeed++)];
						yield return Singleton<TurnManager>.Instance.Opponent.QueueCard(cardToQueue, val, true, true, true);
						possibleCards.Remove(cardToQueue);
					}
				}
				yield return (object)new WaitForSeconds(0.45f);
			}
			else
			{
				yield return Effect();
			}
		}

		private IEnumerator Effect()
		{
			yield return ((AbilityBehaviour)this).PreSuccessfulTriggerSequence();
			Singleton<ViewManager>.Instance.SwitchToView((View)1, false, false);
			if (Singleton<CardDrawPiles>.Instance is CardDrawPiles3D)
			{
				CardDrawPiles instance = Singleton<CardDrawPiles>.Instance;
				CardDrawPiles3D cardPiles = (CardDrawPiles3D)(object)((instance is CardDrawPiles3D) ? instance : null);
				yield return ((CardDrawPiles)cardPiles).DrawCardFromDeck((CardInfo)null, (Action<PlayableCard>)null);
				yield return cardPiles.DrawFromSidePile();
			}
			else
			{
				yield return Singleton<CardDrawPiles>.Instance.DrawCardFromDeck((CardInfo)null, (Action<PlayableCard>)null);
				yield return Singleton<CardDrawPiles>.Instance.DrawCardFromDeck((CardInfo)null, (Action<PlayableCard>)null);
			}
			yield return ((AbilityBehaviour)this).LearnAbility(0.5f);
		}
	}
	public class Fishhook : AbilityBehaviour
	{
		public override Ability Ability => AbilityID;

		public static Ability AbilityID { get; private set; }

		public override bool RespondsToResolveOnBoard()
		{
			return ((Card)((AbilityBehaviour)this).Card).Info.IsGlobalSpell();
		}

		public override bool RespondsToSlotTargetedForAttack(CardSlot slot, PlayableCard attacker)
		{
			if (((Card)((AbilityBehaviour)this).Card).Info.IsSpell() && (Object)(object)slot.Card != (Object)null && (Object)(object)slot.opposingSlot.Card == (Object)null)
			{
				return ((AbilityBehaviour)this).Card.OpponentCard != slot.Card.OpponentCard;
			}
			return false;
		}

		public override IEnumerator OnResolveOnBoard()
		{
			foreach (CardSlot slot in Singleton<BoardManager>.Instance.GetSlots(((AbilityBehaviour)this).Card.OpponentCard))
			{
				if ((Object)(object)slot.Card != (Object)null && (Object)(object)slot.opposingSlot.Card == (Object)null)
				{
					yield return HookEffect(slot);
					yield return (object)new WaitForSeconds(0.2f);
				}
			}
			yield return ((AbilityBehaviour)this).LearnAbility(0f);
		}

		public override IEnumerator OnSlotTargetedForAttack(CardSlot slot, PlayableCard attacker)
		{
			yield return HookEffect(slot);
			yield return (object)new WaitForSeconds(0.2f);
		}

		private IEnumerator HookEffect(CardSlot slot)
		{
			PlayableCard targetCard = slot.Card;
			targetCard.SetIsOpponentCard(false);
			Transform transform = ((Component)targetCard).transform;
			transform.eulerAngles += new Vector3(0f, 0f, -180f);
			yield return Singleton<BoardManager>.Instance.AssignCardToSlot(targetCard, slot.opposingSlot, 0.1f, (Action)null, true);
			if (((Card)targetCard).FaceDown)
			{
				((Card)targetCard).SetFaceDown(false, false);
				targetCard.UpdateFaceUpOnBoardEffects();
			}
		}

		public static void Register()
		{
			//IL_007e: Unknown result type (might be due to invalid IL or missing references)
			AbilityInfo val = ScriptableObject.CreateInstance<AbilityInfo>();
			val.rulebookName = "Gain Control";
			val.rulebookDescription = "Takes control of the targeted creature.";
			val.powerLevel = 8;
			val.canStack = false;
			val.passive = false;
			val.metaCategories = new List<AbilityMetaCategory> { (AbilityMetaCategory)0 };
			AbilityExtensions.SetPixelAbilityIcon(val, AssetHelper.LoadTexture("fishhook_pixel", (FilterMode)0), (FilterMode?)null);
			AbilityID = AbilityManager.Add("zorro.infiniscryption.sigils", val, typeof(Fishhook), (Texture)(object)AssetHelper.LoadTexture("ability_fishhook", (FilterMode)0)).Id;
		}
	}
	public class GiveSigils : AbilityBehaviour
	{
		public override Ability Ability => AbilityID;

		public static Ability AbilityID { get; private set; }

		private bool OpponentTargetsPlayerSlots
		{
			get
			{
				//IL_0017: Unknown result type (might be due to invalid IL or missing references)
				//IL_001c: Unknown result type (might be due to invalid IL or missing references)
				//IL_001e: Unknown result type (might be due to invalid IL or missing references)
				int num = 0;
				foreach (Ability item in CardExtensions.AllAbilities(((AbilityBehaviour)this).Card))
				{
					num += AbilitiesUtil.GetInfo(item).powerLevel;
				}
				return num < 0;
			}
		}

		public override bool RespondsToSacrifice()
		{
			return true;
		}

		public override bool RespondsToSlotTargetedForAttack(CardSlot slot, PlayableCard attacker)
		{
			if (((Card)((AbilityBehaviour)this).Card).Info.IsSpell() && (Object)(object)slot.Card != (Object)null)
			{
				bool result = ((AbilityBehaviour)this).Card.OpponentCard == slot.Card.OpponentCard;
				if (((AbilityBehaviour)this).Card.OpponentCard && OpponentTargetsPlayerSlots)
				{
					result = ((AbilityBehaviour)this).Card.OpponentCard != slot.Card.OpponentCard;
				}
				return result;
			}
			return false;
		}

		public override bool RespondsToResolveOnBoard()
		{
			return ((Card)((AbilityBehaviour)this).Card).Info.IsGlobalSpell();
		}

		public override IEnumerator OnSacrifice()
		{
			PlayableCard currentSacrificeDemandingCard = Singleton<BoardManager>.Instance.CurrentSacrificeDemandingCard;
			if ((Object)(object)currentSacrificeDemandingCard != (Object)null)
			{
				Effect(currentSacrificeDemandingCard);
				yield return (object)new WaitForSeconds(0.5f);
				yield return ((AbilityBehaviour)this).LearnAbility(0f);
			}
		}

		public override IEnumerator OnSlotTargetedForAttack(CardSlot slot, PlayableCard attacker)
		{
			Effect(slot.Card);
			yield return (object)new WaitForSeconds(0.5f);
			yield return ((AbilityBehaviour)this).LearnAbility(0f);
		}

		public override IEnumerator OnResolveOnBoard()
		{
			foreach (CardSlot slot in Singleton<BoardManager>.Instance.GetSlots(CardExtensions.IsPlayerCard(((AbilityBehaviour)this).Card)))
			{
				if ((Object)(object)slot.Card != (Object)null)
				{
					Effect(slot.Card);
				}
			}
			yield return (object)new WaitForSeconds(0.5f);
			yield return ((AbilityBehaviour)this).LearnAbility(0f);
		}

		private void Effect(PlayableCard card)
		{
			//IL_005d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0063: Expected O, but got Unknown
			//IL_0063: 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_0070: Expected O, but got Unknown
			//IL_0070: Unknown result type (might be due to invalid IL or missing references)
			//IL_0076: Expected O, but got Unknown
			//IL_0084: Unknown result type (might be due to invalid IL or missing references)
			//IL_0089: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d9: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d0: 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)
			//IL_017f: Unknown result type (might be due to invalid IL or missing references)
			List<Ability> distinctShownAbilities = CardHelpers.GetDistinctShownAbilities(((Card)card).Info, card.TemporaryMods, card.Status.hiddenAbilities);
			if (distinctShownAbilities.Count >= 8)
			{
				return;
			}
			List<Ability> list = new List<Ability>(CardExtensions.AllAbilities(((AbilityBehaviour)this).Card));
			list.RemoveAll((Ability ab) => ab == GiveStats.AbilityID || ab == AbilityID || ab == GiveStatsSigils.AbilityID);
			CardModificationInfo val = new CardModificationInfo();
			CardModificationInfo val2 = new CardModificationInfo
			{
				fromCardMerge = true
			};
			CardModificationInfo val3 = new CardModificationInfo();
			foreach (Ability item in list)
			{
				if (distinctShownAbilities.Count + val.abilities.Count + val2.abilities.Count >= 8)
				{
					break;
				}
				if (card.HasAbility(item) || val.abilities.Contains(item) || val2.abilities.Contains(item))
				{
					if (AbilitiesUtil.GetInfo(item).canStack)
					{
						val3.abilities.Add(item);
					}
				}
				else if (((Card)card).Info.Abilities.Count + val.abilities.Count < 4)
				{
					val.abilities.Add(item);
				}
				else if (((Card)card).Info.ModAbilities.Count + card.TemporaryMods.Where((CardModificationInfo tm) => tm.fromCardMerge).Count() + val2.abilities.Count < 4)
				{
					val2.abilities.Add(item);
				}
			}
			List<CardModificationInfo> second = new List<CardModificationInfo> { val, val2 };
			distinctShownAbilities = CardHelpers.GetDistinctShownAbilities(((Card)card).Info, card.TemporaryMods.Concat(second).ToList(), card.Status.hiddenAbilities);
			while (distinctShownAbilities.Count > 8)
			{
				if (val2.abilities.Count > 0)
				{
					val2.abilities.RemoveAt(0);
				}
				else if (val.abilities.Count > 0)
				{
					val.abilities.RemoveAt(0);
				}
				second = new List<CardModificationInfo> { val, val2 };
				distinctShownAbilities = CardHelpers.GetDistinctShownAbilities(((Card)card).Info, card.TemporaryMods.Concat(second).ToList(), card.Status.hiddenAbilities);
			}
			((Card)card).Anim.PlayTransformAnimation();
			if (((Object)((Card)card).Info).name == "!DEATHCARD_BASE")
			{
				card.AddTemporaryMod(val);
				card.AddTemporaryMod(val2);
				card.AddTemporaryMod(val3);
				return;
			}
			object obj = ((Card)card).Info.Clone();
			CardInfo val4 = (CardInfo)((obj is CardInfo) ? obj : null);
			val4.Mods = new List<CardModificationInfo>(((Card)card).Info.Mods) { val, val2, val3 };
			((Card)card).SetInfo(val4);
		}

		public static void Register()
		{
			//IL_0085: Unknown result type (might be due to invalid IL or missing references)
			AbilityInfo val = ScriptableObject.CreateInstance<AbilityInfo>();
			val.rulebookName = "Give Sigils";
			val.rulebookDescription = "Gives this card's sigils to the target.";
			val.canStack = false;
			val.powerLevel = 4;
			val.opponentUsable = false;
			val.passive = false;
			val.metaCategories = new List<AbilityMetaCategory> { (AbilityMetaCategory)0 };
			AbilityExtensions.SetPixelAbilityIcon(val, AssetHelper.LoadTexture("give_sigils_pixel", (FilterMode)0), (FilterMode?)null);
			AbilityID = AbilityManager.Add("zorro.infiniscryption.sigils", val, typeof(GiveSigils), (Texture)(object)AssetHelper.LoadTexture("ability_give_sigils", (FilterMode)0)).Id;
		}
	}
	public class GiveStats : AbilityBehaviour
	{
		public override Ability Ability => AbilityID;

		public static Ability AbilityID { get; private set; }

		public override bool RespondsToSacrifice()
		{
			return true;
		}

		public override bool RespondsToSlotTargetedForAttack(CardSlot slot, PlayableCard attacker)
		{
			if (((Card)((AbilityBehaviour)this).Card).Info.IsSpell() && (Object)(object)slot.Card != (Object)null)
			{
				return ((AbilityBehaviour)this).Card.OpponentCard == slot.Card.OpponentCard;
			}
			return false;
		}

		public override bool RespondsToResolveOnBoard()
		{
			return ((Card)((AbilityBehaviour)this).Card).Info.IsGlobalSpell();
		}

		public override IEnumerator OnSacrifice()
		{
			PlayableCard currentSacrificeDemandingCard = Singleton<BoardManager>.Instance.CurrentSacrificeDemandingCard;
			if ((Object)(object)currentSacrificeDemandingCard != (Object)null)
			{
				yield return SingleEffect(currentSacrificeDemandingCard);
			}
		}

		public override IEnumerator OnSlotTargetedForAttack(CardSlot slot, PlayableCard attacker)
		{
			return SingleEffect(slot.Card);
		}

		public override IEnumerator OnResolveOnBoard()
		{
			foreach (CardSlot slot in Singleton<BoardManager>.Instance.GetSlots(CardExtensions.IsPlayerCard(((AbilityBehaviour)this).Card)))
			{
				if ((Object)(object)slot.Card != (Object)null)
				{
					slot.Card.AddTemporaryMod(new CardModificationInfo(((AbilityBehaviour)this).Card.Attack, ((AbilityBehaviour)this).Card.Health));
				}
			}
			yield return ((AbilityBehaviour)this).LearnAbility(0.5f);
		}

		private IEnumerator SingleEffect(PlayableCard card)
		{
			card.AddTemporaryMod(new CardModificationInfo(((AbilityBehaviour)this).Card.Attack, ((AbilityBehaviour)this).Card.Health));
			yield return ((AbilityBehaviour)this).LearnAbility(0.5f);
		}

		public static void Register()
		{
			//IL_0085: Unknown result type (might be due to invalid IL or missing references)
			AbilityInfo val = ScriptableObject.CreateInstance<AbilityInfo>();
			val.rulebookName = "Give Stats";
			val.rulebookDescription = "Gives this card's stats to the target.";
			val.canStack = false;
			val.powerLevel = 4;
			val.opponentUsable = false;
			val.passive = false;
			val.metaCategories = new List<AbilityMetaCategory> { (AbilityMetaCategory)0 };
			AbilityExtensions.SetPixelAbilityIcon(val, AssetHelper.LoadTexture("give_stats_pixel", (FilterMode)0), (FilterMode?)null);
			AbilityID = AbilityManager.Add("zorro.infiniscryption.sigils", val, typeof(GiveStats), (Texture)(object)AssetHelper.LoadTexture("ability_give_stats", (FilterMode)0)).Id;
		}
	}
	public class GiveStatsSigils : AbilityBehaviour
	{
		public override Ability Ability => AbilityID;

		public static Ability AbilityID { get; private set; }

		private bool OpponentTargetsPlayerSlots
		{
			get
			{
				//IL_002f: Unknown result type (might be due to invalid IL or missing references)
				//IL_0034: Unknown result type (might be due to invalid IL or missing references)
				//IL_0036: Unknown result type (might be due to invalid IL or missing references)
				int num = ((AbilityBehaviour)this).Card.Health + 2 * ((AbilityBehaviour)this).Card.Attack;
				foreach (Ability item in CardExtensions.AllAbilities(((AbilityBehaviour)this).Card))
				{
					num += AbilitiesUtil.GetInfo(item).powerLevel;
				}
				return num < 0;
			}
		}

		public override bool RespondsToSacrifice()
		{
			return true;
		}

		public override bool RespondsToSlotTargetedForAttack(CardSlot slot, PlayableCard attacker)
		{
			//IL_007b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0081: Expected I4, but got Unknown
			//IL_0083: Unknown result type (might be due to invalid IL or missing references)
			//IL_0089: Expected I4, but got Unknown
			if (((Card)((AbilityBehaviour)this).Card).Info.IsSpell() && (Object)(object)slot.Card != (Object)null)
			{
				bool flag = ((AbilityBehaviour)this).Card.OpponentCard == slot.Card.OpponentCard;
				if (((AbilityBehaviour)this).Card.OpponentCard && OpponentTargetsPlayerSlots)
				{
					flag = ((AbilityBehaviour)this).Card.OpponentCard != slot.Card.OpponentCard;
				}
				if (flag)
				{
					return CardExtensions.LacksAllAbilities(((AbilityBehaviour)this).Card, (Ability[])(object)new Ability[2]
					{
						(Ability)(int)GiveStats.AbilityID,
						(Ability)(int)GiveSigils.AbilityID
					});
				}
				return false;
			}
			return false;
		}

		public override bool RespondsToResolveOnBoard()
		{
			return ((Card)((AbilityBehaviour)this).Card).Info.IsGlobalSpell();
		}

		public override IEnumerator OnSacrifice()
		{
			PlayableCard currentSacrificeDemandingCard = Singleton<BoardManager>.Instance.CurrentSacrificeDemandingCard;
			if ((Object)(object)currentSacrificeDemandingCard != (Object)null)
			{
				Effect(currentSacrificeDemandingCard);
				yield return (object)new WaitForSeconds(0.5f);
				yield return ((AbilityBehaviour)this).LearnAbility(0f);
			}
		}

		public override IEnumerator OnSlotTargetedForAttack(CardSlot slot, PlayableCard attacker)
		{
			Effect(slot.Card);
			yield return (object)new WaitForSeconds(0.5f);
			yield return ((AbilityBehaviour)this).LearnAbility(0f);
		}

		public override IEnumerator OnResolveOnBoard()
		{
			foreach (CardSlot slot in Singleton<BoardManager>.Instance.GetSlots(CardExtensions.IsPlayerCard(((AbilityBehaviour)this).Card)))
			{
				if ((Object)(object)slot.Card != (Object)null)
				{
					Effect(slot.Card);
				}
			}
			yield return (object)new WaitForSeconds(0.5f);
			yield return ((AbilityBehaviour)this).LearnAbility(0f);
		}

		private void Effect(PlayableCard card)
		{
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			//IL_0008: Expected O, but got Unknown
			//IL_000e: 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)
			//IL_0030: Unknown result type (might be due to invalid IL or missing references)
			//IL_0036: Expected O, but got Unknown
			//IL_00aa: Unknown result type (might be due to invalid IL or missing references)
			//IL_00af: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b7: Expected O, but got Unknown
			//IL_00b7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00be: Expected O, but got Unknown
			//IL_00cc: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00fa: Unknown result type (might be due to invalid IL or missing references)
			//IL_0121: Unknown result type (might be due to invalid IL or missing references)
			//IL_0109: Unknown result type (might be due to invalid IL or missing references)
			//IL_0139: Unknown result type (might be due to invalid IL or missing references)
			//IL_0118: Unknown result type (might be due to invalid IL or missing references)
			//IL_016a: Unknown result type (might be due to invalid IL or missing references)
			//IL_01c8: Unknown result type (might be due to invalid IL or missing references)
			bool flag = false;
			CardModificationInfo val = new CardModificationInfo();
			if (CardExtensions.LacksAbility(((AbilityBehaviour)this).Card, GiveStats.AbilityID))
			{
				val = new CardModificationInfo(((AbilityBehaviour)this).Card.Attack, ((AbilityBehaviour)this).Card.Health);
			}
			if (CardExtensions.LacksAbility(((AbilityBehaviour)this).Card, GiveSigils.AbilityID))
			{
				List<Ability> distinctShownAbilities = CardHelpers.GetDistinctShownAbilities(((Card)card).Info, card.TemporaryMods, card.Status.hiddenAbilities);
				if (distinctShownAbilities.Count < 8)
				{
					List<Ability> list = new List<Ability>(CardExtensions.AllAbilities(((AbilityBehaviour)this).Card));
					list.RemoveAll((Ability ab) => ab == GiveStats.AbilityID || ab == GiveSigils.AbilityID || ab == AbilityID);
					CardModificationInfo val2 = new CardModificationInfo
					{
						fromCardMerge = true
					};
					CardModificationInfo val3 = new CardModificationInfo();
					foreach (Ability item in list)
					{
						if (distinctShownAbilities.Count + val.abilities.Count + val2.abilities.Count >= 8)
						{
							break;
						}
						if (card.HasAbility(item) || val.abilities.Contains(item) || val2.abilities.Contains(item))
						{
							if (AbilitiesUtil.GetInfo(item).canStack)
							{
								val3.abilities.Add(item);
							}
						}
						else if (((Card)card).Info.Abilities.Count + val.abilities.Count < 4)
						{
							val.abilities.Add(item);
						}
						else if (((Card)card).Info.ModAbilities.Count + card.TemporaryMods.Where((CardModificationInfo tm) => tm.fromCardMerge).Count() + val2.abilities.Count < 4)
						{
							val2.abilities.Add(item);
						}
					}
					List<CardModificationInfo> second = new List<CardModificationInfo> { val, val2 };
					distinctShownAbilities = CardHelpers.GetDistinctShownAbilities(((Card)card).Info, card.TemporaryMods.Concat(second).ToList(), card.Status.hiddenAbilities);
					while (distinctShownAbilities.Count > 8)
					{
						if (val2.abilities.Count > 0)
						{
							val2.abilities.RemoveAt(0);
						}
						else if (val.abilities.Count > 0)
						{
							val.abilities.RemoveAt(0);
						}
						second = new List<CardModificationInfo> { val, val2 };
						distinctShownAbilities = CardHelpers.GetDistinctShownAbilities(((Card)card).Info, card.TemporaryMods.Concat(second).ToList(), card.Status.hiddenAbilities);
					}
					((Card)card).Anim.PlayTransformAnimation();
					if (((Object)((Card)card).Info).name == "!DEATHCARD_BASE")
					{
						card.AddTemporaryMod(val);
						card.AddTemporaryMod(val2);
						card.AddTemporaryMod(val3);
					}
					else
					{
						object obj = ((Card)card).Info.Clone();
						CardInfo val4 = (CardInfo)((obj is CardInfo) ? obj : null);
						val4.Mods = new List<CardModificationInfo>(((Card)card).Info.Mods) { val, val2, val3 };
						((Card)card).SetInfo(val4);
					}
					flag = true;
				}
			}
			if (!flag)
			{
				card.AddTemporaryMod(val);
			}
		}

		public static void Register()
		{
			//IL_0085: Unknown result type (might be due to invalid IL or missing references)
			AbilityInfo val = ScriptableObject.CreateInstance<AbilityInfo>();
			val.rulebookName = "Give Stats and Sigils";
			val.rulebookDescription = "Gives this card's stats and sigils to the target.";
			val.canStack = false;
			val.powerLevel = 8;
			val.opponentUsable = false;
			val.passive = false;
			val.metaCategories = new List<AbilityMetaCategory> { (AbilityMetaCategory)0 };
			AbilityExtensions.SetPixelAbilityIcon(val, AssetHelper.LoadTexture("give_stats_sigils_pixel", (FilterMode)0), (FilterMode?)null);
			AbilityID = AbilityManager.Add("zorro.infiniscryption.sigils", val, typeof(GiveStatsSigils), (Texture)(object)AssetHelper.LoadTexture("ability_give_stats_sigils", (FilterMode)0)).Id;
		}
	}
	public class GlobalSpellAbility : VariableStatBehaviour
	{
		private static SpecialStatIcon _icon;

		private static SpecialTriggeredAbility _id;

		public static SpecialStatIcon Icon => _icon;

		public override SpecialStatIcon IconType => _icon;

		public static SpecialTriggeredAbility ID => _id;

		public static void Register()
		{
			//IL_007e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0083: Unknown result type (might be due to invalid IL or missing references)
			//IL_0088: Unknown result type (might be due to invalid IL or missing references)
			//IL_008d: Unknown result type (might be due to invalid IL or missing references)
			StatIconInfo val = ScriptableObject.CreateInstance<StatIconInfo>();
			val.appliesToAttack = true;
			val.appliesToHealth = true;
			val.rulebookName = "Spell (Global)";
			val.rulebookDescription = "When this card is played anywhere on the board, it will cause an immediate effect and then disappear.";
			val.gbcDescription = "GLOBAL SPELL.";
			val.iconGraphic = (Texture)(object)AssetHelper.LoadTexture("global_spell_stat_icon", (FilterMode)0);
			AbilityExtensions.SetPixelIcon(val, AssetHelper.LoadTexture("global_spell_icon_pixel", (FilterMode)0), (FilterMode?)null);
			AbilityExtensions.SetDefaultPart1Ability(val);
			FullStatIcon obj = StatIconManager.Add("zorro.infiniscryption.sigils", val, typeof(GlobalSpellAbility));
			_icon = obj.Id;
			_id = obj.AbilityId;
		}

		public override int[] GetStatValues()
		{
			return new int[2];
		}
	}
	public class InstaGlobalSpellAbility : VariableStatBehaviour
	{
		private static SpecialStatIcon _icon;

		private static SpecialTriggeredAbility _id;

		public static SpecialStatIcon Icon => _icon;

		public override SpecialStatIcon IconType => _icon;

		public static SpecialTriggeredAbility ID => _id;

		public static void Register()
		{
			//IL_007e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0083: Unknown result type (might be due to invalid IL or missing references)
			//IL_0088: Unknown result type (might be due to invalid IL or missing references)
			//IL_008d: Unknown result type (might be due to invalid IL or missing references)
			StatIconInfo val = ScriptableObject.CreateInstance<StatIconInfo>();
			val.appliesToAttack = true;
			val.appliesToHealth = true;
			val.rulebookName = "Spell (Global, Instant)";
			val.rulebookDescription = "When this card is played, it will cause an immediate effect and then disappear.";
			val.gbcDescription = "INSTA-GLOBAL SPELL.";
			val.iconGraphic = (Texture)(object)AssetHelper.LoadTexture("insta_global_spell_stat_icon", (FilterMode)0);
			AbilityExtensions.SetPixelIcon(val, AssetHelper.LoadTexture("insta_global_spell_icon_pixel", (FilterMode)0), (FilterMode?)null);
			AbilityExtensions.SetDefaultPart1Ability(val);
			FullStatIcon obj = StatIconManager.Add("zorro.infiniscryption.sigils", val, typeof(InstaGlobalSpellAbility));
			_icon = obj.Id;
			_id = obj.AbilityId;
		}

		public override int[] GetStatValues()
		{
			return new int[2];
		}
	}
	public class TargetedSpellAbility : VariableStatBehaviour
	{
		private static SpecialStatIcon _icon;

		private static SpecialTriggeredAbility _id;

		public static SpecialStatIcon Icon => _icon;

		public override SpecialStatIcon IconType => _icon;

		public static SpecialTriggeredAbility ID => _id;

		public static void Register()
		{
			//IL_007d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0082: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b5: Unknown result type (might be due to invalid IL or missing references)
			StatIconInfo val = ScriptableObject.CreateInstance<StatIconInfo>();
			val.appliesToAttack = true;
			val.appliesToHealth = true;
			val.rulebookName = "Spell (Targeted)";
			val.rulebookDescription = "When this card is played, it will target and affect a chosen space on the board and then disappear.";
			val.gbcDescription = "TARGETED SPELL.";
			val.iconGraphic = (Texture)(object)AssetHelper.LoadTexture("targeted_spell_stat_icon", (FilterMode)0);
			AbilityExtensions.SetPixelIcon(val, AssetHelper.LoadTexture("targeted_spell_icon_pixel", (FilterMode)0), (FilterMode?)null);
			AbilityExtensions.SetDefaultPart1Ability(val);
			_icon = StatIconManager.Add("zorro.infiniscryption.sigils", val, typeof(TargetedSpellAbility)).Id;
			_id = ((IEnumerable<FullStatIcon>)StatIconManager.AllStatIcons).FirstOrDefault((Func<FullStatIcon, bool>)((FullStatIcon sii) => sii.Id == Icon)).AbilityId;
		}

		public override int[] GetStatValues()
		{
			return new int[2];
		}
	}
}
namespace Infiniscryption.Spells.Patchers
{
	public class Act1QueuedCardInteractable : MainInputInteractable
	{
		public HighlightedInteractable queueSlot;

		public PlayableCard playableCard;

		public void QueueCursorEnter()
		{
			PlayableCard obj = playableCard;
			if ((Object)(object)((obj != null) ? obj.QueuedSlot : null) == (Object)null)
			{
				playableCard = null;
			}
			else
			{
				SpellBehavior.UpdatePlayableStatsSpellDisplay(playableCard, showStats: true);
			}
		}

		public void QueueCursorExit()
		{
			PlayableCard obj = playableCard;
			if ((Object)(object)((obj != null) ? obj.QueuedSlot : null) == (Object)null)
			{
				playableCard = null;
			}
			else
			{
				SpellBehavior.UpdatePlayableStatsSpellDisplay(playableCard, showStats: false);
			}
		}
	}
	public static class SpellBehavior
	{
		public class SpellBackgroundAppearance : CardAppearanceBehaviour
		{
			public static Appearance ID = CardAppearanceBehaviourManager.Add("zorro.infiniscryption.sigils", "SpellBackground", typeof(SpellBackgroundAppearance)).Id;

			private static readonly Texture _emptySpell = (Texture)(object)AssetHelper.LoadTexture("empty_spell_background", (FilterMode)0);

			public override void ApplyAppearance()
			{
				((CardAppearanceBehaviour)this).Card.RenderInfo.baseTextureOverride = _emptySpell;
			}
		}

		public class RareSpellBackgroundAppearance : CardAppearanceBehaviour
		{
			public static Appearance ID = CardAppearanceBehaviourManager.Add("zorro.infiniscryption.sigils", "RareSpellBackground", typeof(RareSpellBackgroundAppearance)).Id;

			private static readonly Texture _emptySpell = (Texture)(object)AssetHelper.LoadTexture("empty_spell_background_rare", (FilterMode)0);

			public override void ApplyAppearance()
			{
				((CardAppearanceBehaviour)this).Card.RenderInfo.baseTextureOverride = _emptySpell;
			}
		}

		public static Hint TargetSpellsNeedTargetHint = new Hint("NoValidTargets", 2);

		public static bool IsGlobalSpell(this CardInfo card)
		{
			//IL_0009: Unknown result type (might be due to invalid IL or missing references)
			//IL_000f: Expected I4, but got Unknown
			//IL_0011: Unknown result type (might be due to invalid IL or missing references)
			//IL_0017: Expected I4, but got Unknown
			return CardExtensions.HasAnyOfSpecialAbilities(card, (SpecialTriggeredAbility[])(object)new SpecialTriggeredAbility[2]
			{
				(SpecialTriggeredAbility)(int)GlobalSpellAbility.ID,
				(SpecialTriggeredAbility)(int)InstaGlobalSpellAbility.ID
			});
		}

		public static bool IsInstaGlobalSpell(this CardInfo card)
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			return CardExtensions.HasSpecialAbility(card, InstaGlobalSpellAbility.ID);
		}

		public static bool IsTargetedSpell(this CardInfo card)
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			return CardExtensions.HasSpecialAbility(card, TargetedSpellAbility.ID);
		}

		public static bool IsSpell(this CardInfo card)
		{
			if (!card.IsTargetedSpell())
			{
				return card.IsGlobalSpell();
			}
			return true;
		}

		public static bool IsSpellShowStats(this CardInfo card)
		{
			if (card.IsSpell())
			{
				return !card.hideAttackAndHealth;
			}
			return false;
		}

		public static List<CardSlot> GetAffectedSlots(this CardSlot slot, PlayableCard card)
		{
			if (card.HasAbility((Ability)33))
			{
				return Singleton<BoardManager>.Instance.AllSlotsCopy.FindAll((CardSlot s) => s.IsValidTarget(card));
			}
			List<CardSlot> list = new List<CardSlot>();
			if (CardExtensions.HasAnyOfAbilities(card, (Ability[])(object)new Ability[2]
			{
				(Ability)24,
				(Ability)25
			}))
			{
				CardSlot adjacent = Singleton<BoardManager>.Instance.GetAdjacent(slot, true);
				CardSlot adjacent2 = Singleton<BoardManager>.Instance.GetAdjacent(slot, false);
				if ((Object)(object)adjacent != (Object)null)
				{
					list.Add(adjacent);
				}
				if ((Object)(object)adjacent2 != (Object)null)
				{
					list.Add(adjacent2);
				}
				if (card.HasAbility((Ability)25))
				{
					list.Add(slot);
				}
			}
			else
			{
				list.Add(slot);
			}
			list.Sort((CardSlot a, CardSlot b) => a.Index - b.Index);
			return list;
		}

		public static bool IsValidTarget(this CardSlot slot, PlayableCard card, bool checkSingleSlot = false)
		{
			if (!Object.op_Implicit((Object)(object)slot))
			{
				return false;
			}
			if (checkSingleSlot)
			{
				if (card.TriggerHandler.RespondsToTrigger((Trigger)3, Array.Empty<object>()))
				{
					return true;
				}
				if (card.TriggerHandler.CustomRespondsToTrigger((Trigger)6, slot, card))
				{
					return true;
				}
				return false;
			}
			return slot.GetAffectedSlots(card).Exists((CardSlot subSlot) => subSlot.IsValidTarget(card, checkSingleSlot: true));
		}

		public static bool HasValidTarget(this PlayableCard card)
		{
			foreach (CardSlot item in Singleton<BoardManager>.Instance.AllSlotsCopy)
			{
				if (item.IsValidTarget(card))
				{
					return true;
				}
			}
			return false;
		}

		[HarmonyPatch(typeof(DialogueDataUtil), "ReadDialogueData")]
		[HarmonyPostfix]
		public static void SpellHints()
		{
			DialogueHelper.AddOrModifySimpleDialogEvent("NoValidTargets", new string[1] { "You cannot use that without a target." });
		}

		[HarmonyPatch(typeof(HintsHandler), "OnNonplayableCardClicked")]
		[HarmonyPrefix]
		public static bool TargetSpellsNeedATarget(PlayableCard card)
		{
			if (((Card)card).Info.IsTargetedSpell() && !card.HasValidTarget())
			{
				TargetSpellsNeedTargetHint.TryPlayDialogue((string[])null);
				return false;
			}
			return true;
		}

		public static bool NotStatsSpellInfo(CardInfo info)
		{
			if (!((Object)(object)info == (Object)null))
			{
				return !info.IsSpellShowStats();
			}
			return true;
		}

		public static void UpdateStatsSpellDisplay<T>(T card, bool showStats) where T : Card
		{
			//IL_0091: 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_0096: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b9: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ca: Unknown result type (might be due to invalid IL or missing references)
			if (!NotStatsSpellInfo(((Card)card).Info))
			{
				((Card)card).RenderInfo.showSpecialStats = showStats;
				if (showStats)
				{
					((Card)card).RenderInfo.attack = ((Card)card).Info.Attack;
					((Card)card).RenderInfo.health = ((Card)card).Info.Health;
				}
				((Card)card).RenderInfo.attackTextColor = ((((Card)card).RenderInfo.attack > 0) ? GameColors.Instance.darkBlue : Color.black);
				((Card)card).RenderInfo.healthTextColor = ((((Card)card).RenderInfo.health > 0) ? GameColors.Instance.darkBlue : Color.black);
				((Card)card).RenderCard();
			}
		}

		public static void UpdatePlayableStatsSpellDisplay(PlayableCard card, bool showStats)
		{
			//IL_006a: Unknown result type (might be due to invalid IL or missing references)
			//IL_005e: Unknown result type (might be due to invalid IL or missing references)
			//IL_006f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0095: Unknown result type (might be due to invalid IL or missing references)
			//IL_0089: Unknown result type (might be due to invalid IL or missing references)
			//IL_009a: Unknown result type (might be due to invalid IL or missing references)
			if (!NotStatsSpellInfo(((Card)card).Info))
			{
				((Card)card).RenderInfo.showSpecialStats = showStats;
				if (showStats)
				{
					((Card)card).RenderInfo.attack = ((Card)card).Info.Attack;
					((Card)card).RenderInfo.health = ((Card)card).Info.Health;
				}
				((Card)card).RenderInfo.attackTextColor = ((card.GetPassiveAttackBuffs() + card.GetStatIconAttackBuffs() != 0) ? GameColors.Instance.darkBlue : Color.black);
				((Card)card).RenderInfo.healthTextColor = ((card.GetPassiveHealthBuffs() + CardExtensions.GetStatIconHealthBuffs(card) != 0) ? GameColors.Instance.darkBlue : Color.black);
				((Card)card).RenderCard();
			}
		}

		[HarmonyPostfix]
		[HarmonyPatch(typeof(SelectableCard), "OnCursorEnter")]
		private static void ShowStatsSelectableCards(SelectableCard __instance)
		{
			SpellBehavior.UpdateStatsSpellDisplay<SelectableCard>(__instance, showStats: true);
		}

		[HarmonyPostfix]
		[HarmonyPatch(typeof(PlayableCard), "OnCursorEnter")]
		private static void ShowStatsPlayableCards(PlayableCard __instance)
		{
			UpdatePlayableStatsSpellDisplay(__instance, showStats: true);
		}

		[HarmonyPostfix]
		[HarmonyPatch(typeof(PixelSelectableCard), "OnCursorEnter")]
		private static void ShowStatsPixelSelectableCards(PixelSelectableCard __instance)
		{
			SpellBehavior.UpdateStatsSpellDisplay<PixelSelectableCard>(__instance, showStats: true);
		}

		[HarmonyPostfix]
		[HarmonyPatch(typeof(PixelPlayableCard), "OnCursorEnter")]
		private static void ShowStatsPixelPlayableCards(PixelPlayableCard __instance)
		{
			UpdatePlayableStatsSpellDisplay((PlayableCard)(object)__instance, showStats: true);
		}

		[HarmonyPostfix]
		[HarmonyPatch(typeof(PixelSelectableCard), "OnCursorExit")]
		private static void HideStatsPixelSelectableCards(PixelSelectableCard __instance)
		{
			SpellBehavior.UpdateStatsSpellDisplay<PixelSelectableCard>(__instance, showStats: false);
		}

		[HarmonyPostfix]
		[HarmonyPatch(typeof(PixelPlayableCard), "OnCursorExit")]
		private static void HideStatsPixelPlayableCards(PixelPlayableCard __instance)
		{
			UpdatePlayableStatsSpellDisplay((PlayableCard)(object)__instance, showStats: false);
		}

		[HarmonyPostfix]
		[HarmonyPatch(typeof(MainInputInteractable), "OnCursorExit")]
		private static void ShowStatsSelectableCards(MainInputInteractable __instance)
		{
			if (__instance is SelectableCard)
			{
				SpellBehavior.UpdateStatsSpellDisplay<SelectableCard>((SelectableCard)(object)((__instance is SelectableCard) ? __instance : null), showStats: false);
			}
			else if (__instance is PlayableCard)
			{
				UpdatePlayableStatsSpellDisplay((PlayableCard)(object)((__instance is PlayableCard) ? __instance : null), showStats: false);
			}
		}

		[HarmonyPostfix]
		[HarmonyPatch(typeof(BoardManager), "QueueCardForSlot")]
		private static void ShowStatsSelectableCards(PlayableCard card)
		{
			if (SaveManager.SaveFile.IsPart2 || NotStatsSpellInfo(((Card)card).Info))
			{
				return;
			}
			HighlightedInteractable val = Singleton<BoardManager>.Instance.opponentQueueSlots[card.QueuedSlot.Index];
			Act1QueuedCardInteractable interactable = ((Component)val).GetComponent<Act1QueuedCardInteractable>();
			if ((Object)(object)interactable == (Object)null)
			{
				interactable = ((Component)val).gameObject.AddComponent<Act1QueuedCardInteractable>();
				((MainInputInteractable)val).CursorEntered = (Action<MainInputInteractable>)Delegate.Combine(((MainInputInteractable)val).CursorEntered, (Action<MainInputInteractable>)delegate
				{
					interactable.QueueCursorEnter();
				});
				((MainInputInteractable)val).CursorExited = (Action<MainInputInteractable>)Delegate.Combine(((MainInputInteractable)val).CursorExited, (Action<MainInputInteractable>)delegate
				{
					interactable.QueueCursorExit();
				});
			}
			interactable.playableCard = card;
		}

		public static void AllowStatBoostForSpells(List<CardInfo> __result)
		{
			List<CardInfo> list = new List<CardInfo>(RunState.DeckList);
			list.RemoveAll((CardInfo ci) => __result.Contains(ci) || !ci.IsSpellShowStats() || (ci.baseAttack == 0 && ci.baseHealth == 0));
			__result.AddRange(list);
		}

		[HarmonyPrefix]
		[HarmonyPatch(typeof(BoardManager), "SacrificesCreateRoomForCard")]
		public static bool SpellsDoNotNeedSpace(PlayableCard card, BoardManager __instance, List<CardSlot> sacrifices, ref bool __result)
		{
			if ((Object)(object)card == (Object)null || !((Card)card).Info.IsSpell())
			{
				return true;
			}
			if (((Card)card).Info.BloodCost <= 0)
			{
				__result = true;
				return false;
			}
			foreach (CardSlot item in __instance.AllSlotsCopy)
			{
				if ((!sacrifices.Contains(item) || ((Object)(object)item.Card != (Object)null && item.Card.HasAbility((Ability)20))) && item.IsValidTarget(card))
				{
					__result = true;
					return false;
				}
			}
			return true;
		}

		[HarmonyPatch(typeof(PlayableCard), "CanPlay")]
		[HarmonyPostfix]
		public static void TargetSpellsMustHaveValidTarget(ref bool __result, ref PlayableCard __instance)
		{
			if (__result && ((Card)__instance).Info.IsTargetedSpell() && !__instance.HasValidTarget())
			{
				__result = false;
			}
		}

		[HarmonyPatch(typeof(PlayerHand), "SelectSlotForCard")]
		[HarmonyPostfix]
		public static IEnumerator SpellsResolveDifferently(IEnumerator sequenceResult, PlayableCard card)
		{
			if ((Object)(object)card != (Object)null && !((Card)card).Info.IsSpell())
			{
				while (sequenceResult.MoveNext())
				{
					yield return sequenceResult.Current;
				}
				yield break;
			}
			Singleton<PlayerHand>.Instance.CardsInHand.ForEach(delegate(PlayableCard x)
			{
				((InteractableBase)x).SetEnabled(false);
			});
			yield return (object)new WaitWhile((Func<bool>)(() => Singleton<PlayerHand>.Instance.ChoosingSlot));
			Singleton<PlayerHand>.Instance.OnSelectSlotStartedForCard(card);
			RuleBookController instance = Singleton<RuleBookController>.Instance;
			if (instance != null)
			{
				instance.SetShown(false, true);
			}
			Singleton<BoardManager>.Instance.CancelledSacrifice = false;
			Singleton<PlayerHand>.Instance.choosingSlotCard = card;
			if ((Object)(object)card != (Object)null && (Object)(object)((Card)card).Anim != (Object)null)
			{
				((Card)card).Anim.SetSelectedToPlay(true);
			}
			Singleton<BoardManager>.Instance.ShowCardNearBoard(card, true);
			if ((Object)(object)Singleton<TurnManager>.Instance.SpecialSequencer != (Object)null)
			{
				yield return Singleton<TurnManager>.Instance.SpecialSequencer.CardSelectedFromHand(card);
			}
			bool cardWasPlayed = false;
			bool requiresSacrifices = ((Card)card).Info.BloodCost > 0;
			if (requiresSacrifices)
			{
				List<CardSlot> list = Singleton<BoardManager>.Instance.PlayerSlotsCopy.FindAll((CardSlot x) => (Object)(object)x.Card != (Object)null);
				yield return Singleton<BoardManager>.Instance.ChooseSacrificesForCard(list, card);
			}
			List<CardSlot> allSlots = Singleton<BoardManager>.Instance.AllSlotsCopy;
			if (!Singleton<BoardManager>.Instance.CancelledSacrifice)
			{
				bool flag = true;
				if (!((Card)card).Info.IsInstaGlobalSpell())
				{
					IEnumerator chooseSlotEnumerator2 = Singleton<BoardManager>.Instance.ChooseSlot(allSlots, !requiresSacrifices);
					chooseSlotEnumerator2.MoveNext();
					foreach (CardSlot item in allSlots)
					{
						bool flag2 = !((Card)card).Info.IsTargetedSpell() || item.IsValidTarget(card);
						((InteractableBase)item).SetEnabled(flag2);
						((HighlightedInteractable)item).ShowState((State)((!flag2) ? 1 : 2), false, 0.15f);
						item.Chooseable = flag2;
					}
					yield return chooseSlotEnumerator2.Current;
					while (chooseSlotEnumerator2.MoveNext())
					{
						yield return chooseSlotEnumerator2.Current;
					}
					flag = ((!SaveManager.SaveFile.IsPart2 || !InputButtons.GetButtonDown((Button)2) || !((Card)card).Info.IsTargetedSpell()) ? (!Singleton<BoardManager>.Instance.cancelledPlacementWithInput) : ((CardSlot)/*isinst with value type is only supported in some contexts*/).IsValidTarget(card, checkSingleSlot: true));
				}
				if (flag)
				{
					cardWasPlayed = true;
					((Card)card).Anim.SetSelectedToPlay(false);
					if (Singleton<PlayerHand>.Instance.CardsInHand.Contains(card))
					{
						if (((Card)card).Info.BonesCost > 0)
						{
							yield return Singleton<ResourcesManager>.Instance.SpendBones(((Card)card).Info.BonesCost);
						}
						if (card.EnergyCost > 0)
						{
							yield return Singleton<ResourcesManager>.Instance.SpendEnergy(card.EnergyCost);
						}
						Singleton<PlayerHand>.Instance.RemoveCardFromHand(card);
						if (card.TriggerHandler.RespondsToTrigger((Trigger)2, Array.Empty<object>()))
						{
							yield return card.TriggerHandler.OnTrigger((Trigger)2, Array.Empty<object>());
						}
						if (card.TriggerHandler.RespondsToTrigger((Trigger)3, Array.Empty<object>()))
						{
							List<CardSlot> list2 = ((!((Card)card).Info.IsTargetedSpell()) ? new List<CardSlot> { null } : Singleton<BoardManager>.Instance.LastSelectedSlot.GetAffectedSlots(card));
							foreach (CardSlot item2 in list2)
							{
								card.Slot = item2;
								IEnumerator chooseSlotEnumerator2 = card.TriggerHandler.OnTrigger((Trigger)3, Array.Empty<object>());
								bool active = true;
								while (active)
								{
									try
									{
										active = chooseSlotEnumerator2.MoveNext();
									}
									catch (Exception ex)
									{
										Debug.Log((object)("IteratorFunction() threw exception: " + ex));
									}
									if (active)
									{
										yield return chooseSlotEnumerator2.Current;
									}
								}
								card.Slot = null;
							}
						}
						if (((Card)card).Info.IsTargetedSpell())
						{
							CardSlot slot = (CardSlot)(SaveManager.SaveFile.IsPart2 ? ((object)/*isinst with value type is only supported in some contexts*/) : ((object)Singleton<BoardManager>.Instance.LastSelectedSlot));
							foreach (CardSlot affectedSlot in slot.GetAffectedSlots(card))
							{
								object[] array = new object[2] { affectedSlot, card };
								yield return card.TriggerHandler.OnTrigger((Trigger)6, array);
							}
						}
						card.Dead = true;
						((Card)card).Anim.PlayDeathAnimation(false);
						object[] array2 = new object[2] { true, null };
						if (card.TriggerHandler.RespondsToTrigger((Trigger)12, array2))
						{
							yield return card.TriggerHandler.OnTrigger((Trigger)12, array2);
						}
						yield return (object)new WaitUntil((Func<bool>)(() => Singleton<GlobalTriggerHandler>.Instance.StackSize == 0));
						if (Singleton<TurnManager>.Instance.IsPlayerTurn)
						{
							Singleton<BoardManager>.Instance.playerCardsPlayedThisRound.Add(((Card)card).Info);
						}
						Singleton<InteractionCursor>.Instance.ClearForcedCursorType();
						yield return (object)new WaitForSeconds(0.6f);
						Object.Destroy((Object)(object)((Component)card).gameObject, 0.5f);
						Singleton<ViewManager>.Instance.SwitchToView((View)1, false, false);
					}
				}
			}
			if (!cardWasPlayed)
			{
				Singleton<BoardManager>.Instance.ShowCardNearBoard(card, false);
			}
			Singleton<PlayerHand>.Instance.choosingSlotCard = null;
			if ((Object)(object)card != (Object)null && (Object)(object)((Card)card).Anim != (Object)null)
			{
				((Card)card).Anim.SetSelectedToPlay(false);
			}
			Singleton<PlayerHand>.Instance.CardsInHand.ForEach(delegate(PlayableCard x)
			{
				((InteractableBase)x).SetEnabled(true);
			});
			foreach (CardSlot item3 in allSlots)
			{
				((InteractableBase)item3).SetEnabled(true);
				((HighlightedInteractable)item3).ShowState((State)2, false, 0.15f);
				item3.Chooseable = false;
			}
		}

		[HarmonyPostfix]
		[HarmonyPatch(typeof(CardMergeSequencer), "GetValidCardsForSacrifice")]
		private static void RemoveFromValidCardsForSacrifice(ref List<CardInfo> __result)
		{
			__result.RemoveAll((CardInfo x) => x.Abilities.Exists((Ability x) => !x.CanMerge()));
			if (InfiniscryptionSpellsPlugin.SpellMerge)
			{
				__result.RemoveAll((CardInfo x) => x.IsSpell());
			}
		}

		[HarmonyPostfix]
		[HarmonyPatch(typeof(CardMergeSequencer), "GetValidCardsForHost")]
		private static void RemoveFromValidCardsForHost(ref List<CardInfo> __result)
		{
			__result.RemoveAll((CardInfo x) => x.Abilities.Exists((Ability x) => !x.CanMerge()));
			if (InfiniscryptionSpellsPlugin.SpellMerge)
			{
				__result.RemoveAll((CardInfo x) => x.IsSpell());
			}
		}

		[HarmonyPatch(typeof(BoardManager), "ResolveCardOnBoard")]
		[HarmonyPostfix]
		public static IEnumerator OpponentSpellsResolveDifferently(IEnumerator enumerator, PlayableCard card, CardSlot slot)
		{
			if ((Object)(object)card != (Object)null && card.OpponentCard && ((Card)card).Info.IsSpell())
			{
				CombatPhaseManager instance = Singleton<CombatPhaseManager>.Instance;
				SpellSniperVisualiser visualiser = null;
				SaveFile saveFile = SaveManager.SaveFile;
				if (((saveFile != null) ? new bool?(saveFile.IsPart1) : null).GetValueOrDefault())
				{
					visualiser = ((Component)instance).GetComponent<SpellSniperVisualiser>() ?? ((Component)instance).gameObject.AddComponent<SpellSniperVisualiser>();
				}
				CardSlot targetSlot = null;
				if (((Card)card).Info.IsTargetedSpell())
				{
					targetSlot = OpponentGetTargetSlot(Singleton<BoardManager>.Instance.AllSlotsCopy.FindAll((CardSlot s) => s.IsValidTarget(card)));
				}
				bool targetPlayer = ((Card)card).Info.IsGlobalSpell() || ((Object)(object)targetSlot != (Object)null && card.OpponentCard == targetSlot.IsPlayerSlot);
				Singleton<ViewManager>.Instance.SwitchToView((View)6, false, false);
				yield return (object)new WaitForSeconds(0.3f);
				Tween.LocalPosition(((Component)card).transform, new Vector3(0.65f, 6.2f, targetPlayer ? 0f : 1f), 0.1f, 0f, Tween.EaseOut, (LoopType)0, (Action)delegate
				{
					if (targetPlayer)
					{
						Singleton<ViewManager>.Instance.SwitchToView((View)4, false, false);
					}
					if (((Card)card).Info.IsSpellShowStats())
					{
						UpdatePlayableStatsSpellDisplay(card, showStats: true);
					}
				}, (Action)delegate
				{
					//IL_002c: Unknown result type (might be due to invalid IL or missing references)
					((Card)card).Anim.PlayRiffleSound();
					Tween.Rotation(((Component)card).transform, ((Component)slot).transform.GetChild(0).rotation, 0.1f, 0f, Tween.EaseOut, (LoopType)0, (Action)null, (Action)null, true);
				}, true);
				yield return (object)new WaitForSeconds(0.4f);
				if (card.TriggerHandler.RespondsToTrigger((Trigger)2, Array.Empty<object>()))
				{
					yield return card.TriggerHandler.OnTrigger((Trigger)2, Array.Empty<object>());
				}
				if (card.TriggerHandler.RespondsToTrigger((Trigger)3, Array.Empty<object>()))
				{
					List<CardSlot> resolveSlots = ((!((Card)card).Info.IsTargetedSpell()) ? new List<CardSlot> { null } : slot.GetAffectedSlots(card));
					if (((Card)card).Info.IsTargetedSpell())
					{
						foreach (CardSlot item in resolveSlots)
						{
							instance.VisualizeAimSniperAbility(card.Slot, item);
							visualiser?.VisualizeAimSniperAbility(card.Slot, item);
							instance.VisualizeConfirmSniperAbility(item);
							visualiser?.VisualizeConfirmSniperAbility(item);
							yield return (object)new WaitForSeconds(0.1f);
						}
						yield return (object)new WaitForSeconds(0.4f);
					}
					for (int j = 0; j < resolveSlots.Count; j++)
					{
						card.Slot = resolveSlots[j];
						IEnumerator resolveTrigger = card.TriggerHandler.OnTrigger((Trigger)3, Array.Empty<object>());
						bool active = true;
						while (active)
						{
							try
							{
								active = resolveTrigger.MoveNext();
							}
							catch (Exception ex)
							{
								Debug.Log((object)("IteratorFunction() threw exception: " + ex));
							}
							if (active)
							{
								yield return resolveTrigger.Current;
							}
						}
						SpellSniperVisualiser spellSniperVisualiser = visualiser;
						if (spellSniperVisualiser != null && spellSniperVisualiser.sniperIcons.Count > j && (Object)(object)visualiser?.sniperIcons[j] != (Object)null)
						{
							visualiser?.CleanUpTargetIcon(visualiser?.sniperIcons[j]);
						}
						card.Slot = null;
					}
					yield return (object)new WaitForSeconds(0.2f);
					instance.VisualizeClearSniperAbility();
					visualiser?.VisualizeClearSniperAbility();
				}
				if (((Card)card).Info.IsTargetedSpell() && (Object)(object)targetSlot != (Object)null)
				{
					List<CardSlot> resolveSlots = targetSlot.GetAffectedSlots(card);
					resolveSlots.RemoveAll((CardSlot s) => !card.TriggerHandler.CustomRespondsToTrigger((Trigger)6, s, card));
					foreach (CardSlot item2 in resolveSlots)
					{
						instance.VisualizeAimSniperAbility(card.Slot, item2);
						visualiser?.VisualizeAimSniperAbility(card.Slot, item2);
						instance.VisualizeConfirmSniperAbility(item2);
						visualiser?.VisualizeConfirmSniperAbility(item2);
						yield return (object)new WaitForSeconds(0.1f);
					}
					yield return (object)new WaitForSeconds(0.2f);
					for (int j = 0; j < resolveSlots.Count; j++)
					{
						SpellSniperVisualiser spellSniperVisualiser2 = visualiser;
						if (spellSniperVisualiser2 != null && spellSniperVisualiser2.sniperIcons.Count > j && (Object)(object)visualiser?.sniperIcons[j] != (Object)null)
						{
							visualiser?.CleanUpTargetIcon(visualiser?.sniperIcons[j]);
						}
						yield return card.TriggerHandler.OnTrigger((Trigger)6, new object[2]
						{
							resolveSlots[j],
							card
						});
					}
					yield return (object)new WaitForSeconds(0.2f);
					instance.VisualizeClearSniperAbility();
					visualiser?.VisualizeClearSniperAbility();
				}
				card.Dead = true;
				((Card)card).Anim.PlayDeathAnimation(false);
				object[] array = new object[2] { true, null };
				if (card.TriggerHandler.RespondsToTrigger((Trigger)12, array))
				{
					yield return card.TriggerHandler.OnTrigger((Trigger)12, array);
				}
				yield return (object)new WaitUntil((Func<bool>)(() => Singleton<GlobalTriggerHandler>.Instance.StackSize == 0));
			}
			else
			{
				yield return enumerator;
			}
		}

		[HarmonyPatch(typeof(Opponent), "PlayCardsInQueue")]
		[HarmonyPostfix]
		public static IEnumerator QueuedSpellsGoLast(IEnumerator enumerator, Opponent __instance, float tweenLength)
		{
			if (__instance.Queue.Count <= 0)
			{
				yield break;
			}
			if (!__instance.Queue.Exists((PlayableCard x) => ((Card)x).Info.IsSpell()))
			{
				yield return enumerator;
				yield break;
			}
			yield return __instance.VisualizePrePlayQueuedCards();
			List<PlayableCard> playedCards = new List<PlayableCard>();
			List<PlayableCard> queuedCards = new List<PlayableCard>(__instance.Queue);
			queuedCards.Sort((PlayableCard a, PlayableCard b) => a.QueuedSlot.Index - b.QueuedSlot.Index);
			foreach (PlayableCard queuedCard in queuedCards.Where((PlayableCard qc) => !((Card)qc).Info.IsSpell()))
			{
				if (!__instance.QueuedCardIsBlocked(queuedCard))
				{
					CardSlot queuedSlot = queuedCard.QueuedSlot;
					queuedCard.QueuedSlot = null;
					PlayableCard obj = queuedCard;
					if (obj != null)
					{
						obj.OnPlayedFromOpponentQueue();
					}
					yield return Singleton<BoardManager>.Instance.ResolveCardOnBoard(queuedCard, queuedSlot, tweenLength, (Action)null, true);
					playedCards.Add(queuedCard);
				}
			}
			foreach (PlayableCard queuedCard in queuedCards.Where((PlayableCard qc) => ((Card)qc).Info.IsSpell()))
			{
				if (!__instance.QueuedCardIsBlocked(queuedCard))
				{
					CardSlot queuedSlot2 = queuedCard.QueuedSlot;
					queuedCard.QueuedSlot = null;
					PlayableCard obj2 = queuedCard;
					if (obj2 != null)
					{
						obj2.OnPlayedFromOpponentQueue();
					}
					yield return Singleton<BoardManager>.Instance.ResolveCardOnBoard(queuedCard, queuedSlot2, tweenLength, (Action)null, true);
					playedCards.Add(queuedCard);
				}
			}
			__instance.Queue.RemoveAll(playedCards.Contains);
			yield return (object)new WaitForSeconds(0.5f);
		}

		[HarmonyPostfix]
		[HarmonyPatch(typeof(Opponent), "QueuedCardIsBlocked")]
		private static void QueuedSpellsCantBeBlocked(ref bool __result, PlayableCard queuedCard)
		{
			if ((Object)(object)queuedCard != (Object)null && ((Card)queuedCard).Info.IsSpell())
			{
				__result = false;
			}
		}

		public static CardSlot OpponentGetTargetSlot(List<CardSlot> validTargets)
		{
			CardSlot result = null;
			if (validTargets.Count > 0)
			{
				validTargets.Sort((CardSlot a, CardSlot b) => AIEvaluateTarget(b.Card) - AIEvaluateTarget(a.Card));
				result = validTargets[0];
			}
			return result;
		}

		private static int AIEvaluateTarget(PlayableCard card)
		{
			if ((Object)(object)card == (Object)null)
			{
				return Random.Range(0, 5);
			}
			int result = card.PowerLevel;
			if (((Card)card).Info.HasTrait((Trait)12))
			{
				result = 10 * (card.OpponentCard ? 1 : (-1));
			}
			return result;
		}

		private static bool CustomRespondsToTrigger(this CardTriggerHandler handler, Trigger trigger, params object[] otherArgs)
		{
			//IL_0016: Unknown result type (might be due to invalid IL or missing references)
			foreach (TriggerReceiver allReceiver in GetAllReceivers(handler))
			{
				if (GlobalTriggerHandler.ReceiverRespondsToTrigger(trigger, allReceiver, otherArgs))
				{
					return true;
				}
			}
			return false;
		}

		private static List<TriggerReceiver> GetAllReceivers(CardTriggerHandler handler)
		{
			//IL_005a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0061: Invalid comparison between Unknown and I4
			List<TriggerReceiver> list = new List<TriggerReceiver>();
			foreach (Tuple<SpecialTriggeredAbility, SpecialCardBehaviour> specialAbility in handler.specialAbilities)
			{
				list.Add((TriggerReceiver)(object)specialAbility.Item2);
			}
			foreach (Tuple<Ability, AbilityBehaviour> triggeredAbility in handler.triggeredAbilities)
			{
				if ((int)triggeredAbility.Item1 != 35)
				{
					list.Add((TriggerReceiver)(object)triggeredAbility.Item2);
				}
			}
			list.AddRange((IEnumerable<TriggerReceiver>)handler.permanentlyAttachedBehaviours);
			list.Sort((TriggerReceiver a, TriggerReceiver b) => b.Priority.CompareTo(a.Priority));
			return list;
		}
	}
	public static class SpellCards
	{
		internal static void RegisterCustomCards()
		{
			//IL_005e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0064: Expected I4, but got Unknown
			//IL_00cd: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d3: Expected I4, but got Unknown
			//IL_0137: Unknown result type (might be due to invalid IL or missing references)
			//IL_013d: Expected I4, but got Unknown
			//IL_013f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0145: Expected I4, but got Unknown
			//IL_0213: Unknown result type (might be due to invalid IL or missing references)
			//IL_0219: Expected I4, but got Unknown
			//IL_021b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0221: Expected I4, but got Unknown
			//IL_02f3: Unknown result type (might be due to invalid IL or missing references)
			//IL_02f9: Expected I4, but got Unknown
			//IL_02fb: Unknown result type (might be due to invalid IL or missing references)
			//IL_0301: Expected I4, but got Unknown
			//IL_0368: Unknown result type (might be due to invalid IL or missing references)
			//IL_036e: Expected I4, but got Unknown
			//IL_0424: Unknown result type (might be due to invalid IL or missing references)
			//IL_042a: Expected I4, but got Unknown
			//IL_0492: Unknown result type (might be due to invalid IL or missing references)
			//IL_0498: Expected I4, but got Unknown
			//IL_0501: Unknown result type (might be due to invalid IL or missing references)
			//IL_0507: Expected I4, but got Unknown
			//IL_0573: Unknown result type (might be due to invalid IL or missing references)
			//IL_0579: Expected I4, but got Unknown
			CardExtensions.AddAbilities(CardExtensions.SetCost(CardExtensions.SetPortrait(CardExtensions.SetDefaultPart1Card(CardManager.New("ZSPL", "Spell_Kettle_of_Avarice", "Kettle of Avarice", 0, 0, "A jug that allows you to draw two more cards from your deck.")), AssetHelper.LoadTexture("kettle_of_avarice", (FilterMode)0), (FilterMode?)null).SetGlobalSpell(), (int?)1, (int?)0, (int?)0, (List<GemType>)null), (Ability[])(object)new Ability[1] { (Ability)(int)DrawTwoCards.AbilityID });
			CardExtensions.AddAbilities(CardExtensions.SetCost(CardExtensions.SetRare(CardExtensions.SetPortrait(CardExtensions.SetDefaultPart1Card(CardManager.New("ZSPL", "Spell_Anger_of_the_Gods", "Anger of the Gods", 0, 0, "For when nothing else will do the trick.")), AssetHelper.LoadTexture("anger_of_all", (FilterMode)0), (FilterMode?)null).SetGlobalSpell()), (int?)2, (int?)0, (int?)0, (List<GemType>)null), (Ability[])(object)new Ability[1] { (Ability)(int)DestroyAllCardsOnDeath.AbilityID });
			CardExtensions.AddAbilities(CardExtensions.SetCost(CardExtensions.SetPortrait(CardExtensions.SetDefaultPart1Card(CardManager.New("ZSPL", "Spell_Lightning", "Lightning", 0, 0, "A perfectly serviceable amount of damage.")), AssetHelper.LoadTexture("lightning_bolt", (FilterMode)0), (FilterMode?)null).SetTargetedSpell(), (int?)1, (int?)0, (int?)0, (List<GemType>)null), (Ability[])(object)new Ability[2]
			{
				(Ability)(int)DirectDamage.AbilityID,
				(Ability)(int)DirectDamage.AbilityID
			});
			CardExtensions.AddAbilities(CardExtensions.SetCost(CardExtensions.SetPortrait(CardExtensions.SetDefaultPart1Card(CardManager.New("ZSPL", "Spell_Backpack", "Trip to the Store", 0, 0, "Send one of your creatures on a trip to the store. Who knows what they will come back with.")), AssetHelper.LoadTexture("backpack", (FilterMode)0), (FilterMode?)null).SetGlobalSpell(), (int?)2, (int?)0, (int?)0, (List<GemType>)null), (Ability[])(object)new Ability[1] { (Ability)29 });
			CardInfo obj = CardExtensions.SetPortrait(CardExtensions.SetDefaultPart1Card(CardManager.New("ZSPL", "Spell_Rot_Healing", "Rot Healing", 0, 0, "Restores just a little bit of health.")), AssetHelper.LoadTexture("plague_doctor", (FilterMode)0), (FilterMode?)null).SetTargetedSpell();
			int? num = 1;
			CardExtensions.AddAbilities(CardExtensions.SetCost(obj, (int?)0, num, (int?)0, (List<GemType>)null), (Ability[])(object)new Ability[2]
			{
				(Ability)(int)DirectHeal.AbilityID,
				(Ability)(int)DirectHeal.AbilityID
			});
			CardExtensions.AddAbilities(CardExtensions.SetCost(CardExtensions.SetPortrait(CardExtensions.SetDefaultPart1Card(CardManager.New("ZSPL", "Spell_Dammed_up", "Dammed Up", 0, 0, "So many dams...")), AssetHelper.LoadTexture("dammed_up", (FilterMode)0), (FilterMode?)null).SetTargetedSpell(), (int?)1, (int?)0, (int?)0, (List<GemType>)null), (Ability[])(object)new Ability[2]
			{
				(Ability)33,
				(Ability)6
			});
			CardInfo obj2 = CardExtensions.SetPortrait(CardExtensions.SetDefaultPart1Card(CardManager.New("ZSPL", "Spell_Irritate", "Irritate", 0, 0, "This is what happens when you poke the bear...or wolf.")), AssetHelper.LoadTexture("snarling_wolf", (FilterMode)0), (FilterMode?)null).SetTargetedSpell();
			num = 2;
			CardExtensions.AddAbilities(CardExtensions.SetCost(obj2, (int?)0, num, (int?)0, (List<GemType>)null), (Ability[])(object)new Ability[2]
			{
				(Ability)(int)AttackBuff.AbilityID,
				(Ability)(int)DirectDamage.AbilityID
			});
			CardInfo obj3 = CardExtensions.SetPortrait(CardExtensions.SetDefaultPart1Card(CardManager.New("ZSPL", "Spell_Compost", "Compost", 0, 0, "Time to recycle those old bones.")), AssetHelper.LoadTexture("compost", (FilterMode)0), (FilterMode?)null).SetGlobalSpell();
			num = 5;
			CardExtensions.AddAbilities(CardExtensions.SetCost(obj3, (int?)0, num, (int?)0, (List<GemType>)null), (Ability[])(object)new Ability[1] { (Ability)(int)DrawTwoCards.AbilityID });
			CardExtensions.AddAbilities(CardExtensions.SetPortrait(CardExtensions.SetDefaultPart1Card(CardManager.New("ZSPL", "Spell_Fetch", "Go Fetch", 0, 0, "Good doggy.")), AssetHelper.LoadTexture("wolf_fetch", (FilterMode)0), (FilterMode?)null).SetGlobalSpell(), (Ability[])(object)new Ability[1] { (Ability)12 });
			CardInfo obj4 = CardExtensions.SetPortrait(CardExtensions.SetDefaultPart1Card(CardManager.New("ZSPL", "Spell_Body", "Body Without a Soul", 0, 3, "A husk to be used and discarded.")), AssetHelper.LoadTexture("body", (FilterMode)0), (FilterMode?)null).SetTargetedSpellStats();
			num = 2;
			CardExtensions.AddAbilities(CardExtensions.SetCost(obj4, (int?)0, num, (int?)0, (List<GemType>)null), (Ability[])(object)new Ability[1] { (Ability)(int)GiveStats.AbilityID });
			CardExtensions.AddAbilities(CardExtensions.SetCost(CardExtensions.SetPortrait(CardExtensions.SetDefaultPart1Card(CardManager.New("ZSPL", "Spell_Soul", "Soul Without a Body", 0, 0, "A disembodied soul. It will empower one of your creatures.")), AssetHelper.LoadTexture("soul", (FilterMode)0), (FilterMode?)null).SetTargetedSpell(), (int?)1, (int?)0, (int?)0, (List<GemType>)null), (Ability[])(object)new Ability[2]
			{
				(Ability)5,
				(Ability)(int)GiveSigils.AbilityID
			});
			CardExtensions.AddAbilities(CardExtensions.SetCost(CardExtensions.SetPortrait(CardExtensions.SetDefaultPart1Card(CardManager.New("ZSPL", "Spell_Desire", "Another's Desire", 2, 0, "Nothing short of victory will suffice.")), AssetHelper.LoadTexture("desire", (FilterMode)0), (FilterMode?)null).SetTargetedSpellStats(), (int?)1, (int?)0, (int?)0, (List<GemType>)null), (Ability[])(object)new Ability[2]
			{
				(Ability)35,
				(Ability)(int)GiveStatsSigils.AbilityID
			});
			CardInfo obj5 = CardExtensions.SetRare(CardExtensions.SetPortrait(CardExtensions.SetDefaultPart1Card(CardManager.New("ZSPL", "Spell_Hope", "Hope", 1, 1, "A rare, fleeting feeling. Hold onto it.")), AssetHelper.LoadTexture("hope", (FilterMode)0), (FilterMode?)null).SetGlobalSpellStats());
			num = 2;
			CardExtensions.AddAbilities(CardExtensions.SetCost(obj5, (int?)0, num, (int?)0, (List<GemType>)null), (Ability[])(object)new Ability[1] { (Ability)(int)GiveStats.AbilityID });
		}
	}
}
namespace Infiniscryption.Core.Helpers
{
	public static class AssetHelper
	{
		public static string FindResourceName(string key, string type, Assembly target)
		{
			string value = "." + key.ToLowerInvariant() + "." + type.ToLowerInvariant();
			string[] manifestResourceNames = target.GetManifestResourceNames();
			foreach (string text in manifestResourceNames)
			{
				if (text.ToLowerInvariant().EndsWith(value))
				{
					return text;
				}
			}
			return null;
		}

		private static byte[] GetResourceBytes(string key, string type, Assembly target)
		{
			string text = FindResourceName(key, type, target);
			if (string.IsNullOrEmpty(text))
			{
				string text2 = "";
				string[] manifestResourceNames = target.GetManifestResourceNames();
				foreach (string text3 in manifestResourceNames)
				{
					text2 = text2 + "," + text3;
				}
				throw new InvalidDataException("Could not find resource matching " + key + ". This is what I have: " + text2);
			}
			using Stream stream = target.GetManifestResourceStream(text);
			using MemoryStream memoryStream = new MemoryStream();
			stream.CopyTo(memoryStream);
			return memoryStream.ToArray();
		}

		public static string GetResourceString(string key, string type)
		{
			Assembly executingAssembly = Assembly.GetExecutingAssembly();
			string text = FindResourceName(key, type, executingAssembly);
			if (string.IsNullOrEmpty(text))
			{
				string text2 = "";
				string[] manifestResourceNames = executingAssembly.GetManifestResourceNames();
				foreach (string text3 in manifestResourceNames)
				{
					text2 = text2 + "," + text3;
				}
				throw new InvalidDataException("Could not find resource matching " + key + ". This is what I have: " + text2);
			}
			using Stream stream = executingAssembly.GetManifestResourceStream(text);
			using StreamReader streamReader = new StreamReader(stream);
			return streamReader.ReadToEnd();
		}

		public static Texture2D LoadTexture(string texture, FilterMode filterMode = 0)
		{
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			//IL_0018: Unknown result type (might be due to invalid IL or missing references)
			//IL_001f: Expected O, but got Unknown
			//IL_0020: Unknown result type (might be due to invalid IL or missing references)
			//IL_0031: Unknown result type (might be due to invalid IL or missing references)
			//IL_0032: Unknown result type (might be due to invalid IL or missing references)
			//IL_0039: Expected O, but got Unknown
			Texture2D val = new Texture2D(2, 2);
			byte[] resourceBytes = GetResourceBytes(texture, "png", Assembly.GetExecutingAssembly());
			ImageConversion.LoadImage(val, resourceBytes);
			((Object)val).name = "Infiniscryption_" + texture;
			((Texture)val).filterMode = filterMode;
			return val;
		}

		private static string WriteWavToFile(string wavname)
		{
			byte[] resourceBytes = GetResourceBytes(wavname, "wav", Assembly.GetExecutingAssembly());
			string text = Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), wavname + ".wav");
			File.WriteAllBytes(text, resourceBytes);
			return text;
		}

		public static void LoadAudioClip(string clipname, ManualLogSource log = null, string group = "Loops")
		{
			List<AudioClip> value = Traverse.Create((object)AudioController.Instance).Field(group).GetValue<List<AudioClip>>();
			if ((Object)(object)value.Find((AudioClip clip) => ((Object)clip).name.Equals(clipname)) != (Object)null)
			{
				return;
			}
			string text = WriteWavToFile(clipname);
			try
			{
				if (log != null)
				{
					log.LogInfo((object)("About to get audio clip at file://" + text));
				}
				UnityWebRequest audioClip = UnityWebRequestMultimedia.GetAudioClip("file://" + text, (AudioType)20);
				try
				{
					audioClip.SendWebRequest();
					while (audioClip.IsExecuting())
					{
					}
					if (audioClip.isHttpError)
					{
						throw new InvalidOperationException("Bad request getting audio clip " + audioClip.error);
					}
					AudioClip content = DownloadHandlerAudioClip.GetContent(audioClip);
					((Object)content).name = clipname;
					value.Add(content);
				}
				finally
				{
					((IDisposable)audioClip)?.Dispose();
				}
			}
			finally
			{
				if (File.Exists(text))
				{
					File.Delete(text);
				}
			}
		}
	}
	public static class AudioHelper
	{
		public struct AudioState
		{
			public int sourceNum;

			public string clipName;

			public float position;

			public bool isPlaying;

			public float volume;
		}

		public static List<AudioState> PauseAllLoops()
		{
			List<AudioSource> value = Traverse.Create((object)AudioController.Instance).Field("loopSources").GetValue<List<AudioSource>>();
			List<AudioState> list = new List<AudioState>();
			for (int i = 0; i < value.Count; i++)
			{
				AudioSource val = value[i];
				if ((Object)(object)val == (Object)null || (Object)(object)val.clip == (Object)null)
				{
					list.Add(new AudioState
					{
						sourceNum = i,
						position = 0f,
						clipName = null,
						isPlaying = false
					});
				}
				else
				{
					list.Add(new AudioState
					{
						sourceNum = i,
						position = (val.isPlaying ? (val.time / val.clip.length) : 0f),
						clipName = ((Object)val.clip).name,
						isPlaying = val.isPlaying,
						volume = val.volume
					});
				}
			}
			AudioController.Instance.StopAllLoops();
			return list;
		}

		public static void ResumeAllLoops(List<AudioState> states)
		{
			for (int i = 0; i < states.Count; i++)
			{
				if (states[i].isPlaying)
				{
					AudioController.Instance.SetLoopAndPlay(states[i].clipName, i, true, true);
					AudioController.Instance.SetLoopVolumeImmediate(0f, i);
					AudioController.Instance.SetLoopTimeNormalized(states[i].position, i);
					AudioController.Instance.FadeInLoop(1f, states[i].volume, new int[1] { i });
				}
				else
				{
					AudioController.Instance.StopLoop(i);
				}
			}
		}
	}
	public static class DialogueHelper
	{
		public static LineSet CreateLineSet(string[] lineString, Emotion emotion = 0, LetterAnimation animation = 2, Face p03Face = 0, int speakerIndex = 0)
		{
			//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_000f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0015: Unknown result type (might be due to invalid IL or missing references)
			//IL_0016: 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_0028: Unknown result type (might be due to invalid IL or missing references)
			//IL_0046: Expected O, but got Unknown
			return new LineSet
			{
				lines = ((IEnumerable<string>)lineString).Select((Func<string, Line>)((string s) => new Line
				{
					text = s,
					emotion = emotion,
					letterAnimation = animation,
					p03Face = p03Face,
					speakerIndex = speakerIndex
				})).ToList()
			};
		}

		public static void AddOrModifySimpleDialogEvent(string eventId, string line, LetterAnimation? animation = null, Emotion? emotion = null)
		{
			string[] lines = new string[1] { line };
			AddOrModifySimpleDialogEvent(eventId, lines, null, animation, emotion);
		}

		private static void SyncLineCollection(List<Line> curLines, string[] newLines, LetterAnimation? animation, Emotion? emotion)
		{
			//IL_0066: Unknown result type (might be due to invalid IL or missing references)
			//IL_006b: Unknown result type (might be due to invalid IL or missing references)
			//IL_007c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0081: Unknown result type (might be due to invalid IL or missing references)
			while (curLines.Count > newLines.Length)
			{
				curLines.RemoveAt(curLines.Count - 1);
			}
			for (int i = 0; i < curLines.Count; i++)
			{
				curLines[i].text = newLines[i];
			}
			for (int j = curLines.Count; j < newLines.Length; j++)
			{
				Line val = CloneLine(curLines[0]);
				val.text = newLines[j];
				if (animation.HasValue)
				{
					val.letterAnimation = animation.Value;
				}
				if (emotion.HasValue)
				{
					val.emotion = emotion.Value;
				}
				curLines.Add(val);
			}
		}

		public static void AddOrModifySimpleDialogEvent(string eventId, string[] lines, string[][] repeatLines = null, LetterAnimation? animation = null, Emotion? emotion = null, string template = "NewRunDealtDeckDefault")
		{
			bool flag = false;
			DialogueEvent val = DialogueDataUtil.Data.GetEvent(eventId);
			if (val == null)
			{
				flag = true;
				val = CloneDialogueEvent(DialogueDataUtil.Data.GetEvent(template), eventId);
				while (val.mainLines.lines.Count > lines.Length)
				{
					val.mainLines.lines.RemoveAt(lines.Length);
				}
			}
			SyncLineCollection(val.mainLines.lines, lines, animation, emotion);
			if (repeatLines == null)
			{
				val.repeatLines.Clear();
			}
			else
			{
				while (val.repeatLines.Count > repeatLines.Length)
				{
					val.repeatLines.RemoveAt(val.repeatLines.Count - 1);
				}
				for (int i = 0; i < val.repeatLines.Count; i++)
				{
					SyncLineCollection(val.repeatLines[i].lines, repeatLines[i], animation, emotion);
				}
			}
			if (flag)
			{
				DialogueDataUtil.Data.events.Add(val);
			}
		}

		public static Line CloneLine(Line line)
		{
			//IL_0000: Unknown result type (might be due to invalid IL or missing references)
			//IL_0005: Unknown result type (might be due to invalid IL or missing references)
			//IL_0007: Unknown result type (might be due to invalid IL or missing references)
			//IL_000c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0011: 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_0018: Unknown result type (might be due to invalid IL or missing references)
			//IL_001d: Unknown result type (might be due to invalid IL or missing references)
			//IL_001f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0024: Unknown result ty