Decompiled source of Mystic Assistant v2.1.0

MysticAssistant.dll

Decompiled a month 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 HarmonyLib;
using I2.Loc;
using Lamb.UI;
using Lamb.UI.BuildMenu;
using MMTools;
using Microsoft.CodeAnalysis;
using TMPro;
using UnityEngine;
using src.Extensions;
using src.UINavigator;

[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("MysticAssistant")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyDescription("Adds a standard shop to the Mystic Shop")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0+bf3623fbca1ee78a98d568633b4fac8a1241286b")]
[assembly: AssemblyProduct("MysticAssistant")]
[assembly: AssemblyTitle("MysticAssistant")]
[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 MysticAssistant
{
	[BepInPlugin("ciarenni.cultofthelamb.mysticassistant", "Mystic Assistant", "2.1.0")]
	public class MysticAssistant : BaseUnityPlugin
	{
		private static readonly Type patchType = typeof(MysticAssistant);

		private static string SHOP_CONTEXT_KEY = "mystic_assistant_shop";

		private static MysticAssistantInventoryManager _inventoryManager;

		private static List<Action> _postShopActions = new List<Action>();

		private static bool _showOverbuyWarning = false;

		private static List<TYPES> _unlockedDecorations = new List<TYPES>();

		private static List<Card> _unlockedTarotCards = new List<Card>();

		private static List<RelicType> _unlockedRelics = new List<RelicType>();

		private void Awake()
		{
			//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_003d: Unknown result type (might be due to invalid IL or missing references)
			//IL_004a: Expected O, but got Unknown
			//IL_004b: 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_007b: Expected O, but got Unknown
			//IL_007c: 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_00ac: Expected O, but got Unknown
			//IL_00ad: 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_00dd: Expected O, but got Unknown
			//IL_00ff: Unknown result type (might be due to invalid IL or missing references)
			//IL_010d: Expected O, but got Unknown
			((BaseUnityPlugin)this).Logger.LogInfo((object)"Plugin ciarenni.cultofthelamb.mysticassistant is loaded!");
			Harmony val = new Harmony("ciarenni.cultofthelamb.mysticassistant");
			val.Patch((MethodBase)AccessTools.Method(typeof(Interaction_MysticShop), "Start", (Type[])null, (Type[])null), (HarmonyMethod)null, new HarmonyMethod(patchType, "PostfixEnableMysticAssistantOnTheMysticShop", (Type[])null), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null);
			val.Patch((MethodBase)AccessTools.Method(typeof(UIItemSelectorOverlayController), "RefreshContextText", (Type[])null, (Type[])null), new HarmonyMethod(patchType, "PrefixRefreshContextTextForAssistant", (Type[])null), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null);
			val.Patch((MethodBase)AccessTools.Method(typeof(UIItemSelectorOverlayController), "OnItemSelected", (Type[])null, (Type[])null), new HarmonyMethod(patchType, "PrefixOnItemSelectedForAssistant", (Type[])null), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null);
			val.Patch((MethodBase)AccessTools.Method(typeof(UIItemSelectorOverlayController), "OnItemClicked", (Type[])null, (Type[])null), new HarmonyMethod(patchType, "PrefixOnItemClickedForAssistant", (Type[])null), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null);
			val.Patch((MethodBase)AccessTools.Method(typeof(Interaction_MysticShop), "OnSecondaryInteract", (Type[])null, (Type[])null), new HarmonyMethod(patchType, "PrefixOnSecondaryInteract", (Type[])null), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null);
		}

		public static void PostfixEnableMysticAssistantOnTheMysticShop(Interaction_MysticShop __instance)
		{
			((Interaction)__instance).HasSecondaryInteraction = true;
			((Interaction)__instance).SecondaryLabel = DataManager.Instance.MysticKeeperName + "'s assistant";
			Console.WriteLine("Mystic Assistant postfix applied to MysticShop");
		}

		public static bool PrefixRefreshContextTextForAssistant(UIItemSelectorOverlayController __instance, Params ____params, Category ____category, TextMeshProUGUI ____buttonPromptText, string ____addtionalText, string ____contextString)
		{
			//IL_0000: 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_001f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0025: Invalid comparison between Unknown and I4
			//IL_0038: Unknown result type (might be due to invalid IL or missing references)
			//IL_008b: Unknown result type (might be due to invalid IL or missing references)
			if (____params.Key != SHOP_CONTEXT_KEY)
			{
				Console.WriteLine("item selector interaction detected but it is not the mystic shop, skipping");
				return true;
			}
			if ((int)____params.Context == 2)
			{
				TraderTrackerItems val = __instance.CostProvider?.Invoke(____category.MostRecentItem);
				if (val == null)
				{
					return false;
				}
				if (_showOverbuyWarning)
				{
					((TMP_Text)____buttonPromptText).text = " <color=red>You are buying more of this than the game normally allows. Click it again to confirm.</color>";
				}
				else
				{
					if (____category == null)
					{
						((TMP_Text)____buttonPromptText).text = string.Format(____contextString, "something broke, please leave the shop and try again", CostFormatter.FormatCost((ITEM_TYPE)119, val.SellPriceActual, true, false)) + ____addtionalText;
					}
					((TMP_Text)____buttonPromptText).text = string.Format(____contextString, MysticAssistantInventoryInfo.GetShopLabelByItemType(____category.MostRecentItem), CostFormatter.FormatCost((ITEM_TYPE)119, val.SellPriceActual, true, false)) + ____addtionalText;
				}
				return false;
			}
			return false;
		}

		public static bool PrefixOnItemSelectedForAssistant()
		{
			_showOverbuyWarning = false;
			return true;
		}

		public static bool PrefixOnItemClickedForAssistant(UIItemSelectorOverlayController __instance, Params ____params, GenericInventoryItem item)
		{
			//IL_0000: 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_004f: 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_0056: Invalid comparison between Unknown and I4
			//IL_0069: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d7: 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)
			if (____params.Key != SHOP_CONTEXT_KEY)
			{
				return true;
			}
			if ((int)AccessTools.Method(typeof(UIItemSelectorOverlayController), "GetItemQuantity", (Type[])null, (Type[])null).Invoke(__instance, new object[1] { ((UIInventoryItem)item).Type }) > 0 && (int)____params.Context == 2)
			{
				TraderTrackerItems val = __instance.CostProvider?.Invoke(((UIInventoryItem)item).Type);
				if (val != null && Inventory.GetItemQuantity((ITEM_TYPE)119) >= val.SellPriceActual)
				{
					if (!_showOverbuyWarning && MysticAssistantInventoryInfo.CheckForBoughtQuantityWarning(val))
					{
						_showOverbuyWarning = true;
						((UIInventoryItem)item).Shake();
						if (Random.Range(0, 9) == 5)
						{
							UIManager.PlayAudio("event:/player/yeehaa");
						}
						else
						{
							UIManager.PlayAudio("event:/player/speak_to_follower_noBookPage");
						}
					}
					else
					{
						__instance.OnItemChosen?.Invoke(((UIInventoryItem)item).Type);
						if (____params.HideOnSelection)
						{
							((UIMenuBase)__instance).Hide(false);
						}
						else
						{
							__instance.UpdateQuantities();
						}
						_showOverbuyWarning = false;
					}
					AccessTools.Method(typeof(UIItemSelectorOverlayController), "RefreshContextText", (Type[])null, (Type[])null).Invoke(__instance, new object[0]);
					return false;
				}
			}
			((UIInventoryItem)item).Shake();
			UIManager.PlayAudio("event:/ui/negative_feedback");
			return false;
		}

		public static void PrefixOnSecondaryInteract(Interaction_MysticShop __instance, StateMachine state)
		{
			//IL_00fc: Unknown result type (might be due to invalid IL or missing references)
			//IL_0140: 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_0166: Unknown result type (might be due to invalid IL or missing references)
			//IL_016b: Unknown result type (might be due to invalid IL or missing references)
			//IL_019d: Unknown result type (might be due to invalid IL or missing references)
			if (((object)__instance).GetType() != typeof(Interaction_MysticShop))
			{
				Console.WriteLine("instance is not type of Interaction_MysticShop, skipping adding secondary interaction");
				return;
			}
			object value = Traverse.Create((object)__instance).Field("boughtBark").GetValue();
			SimpleBark val = (SimpleBark)((value is SimpleBark) ? value : null);
			if (val.IsSpeaking)
			{
				((MonoBehaviour)__instance).StartCoroutine(ClearShopKeeperSimpleBark(val, __instance, state));
				return;
			}
			Console.WriteLine("mystic assistant secondary action applied to mystic shop");
			_inventoryManager = new MysticAssistantInventoryManager(__instance);
			_postShopActions.Clear();
			_unlockedDecorations.Clear();
			_unlockedTarotCards.Clear();
			_unlockedRelics.Clear();
			HUD_Manager.Instance.Hide(false, 0, false);
			PlayerFarming playerFarming = ((Component)state).GetComponent<PlayerFarming>();
			PlayerFarming.SetStateForAllPlayers((State)13, false, (PlayerFarming)null);
			playerFarming.GoToAndStop(((Component)playerFarming).transform.position, playerFarming.LookToObject, false, false, (Action)null, 20f, true, (Action)null, true, true, true, true, (Vector3?)null);
			UIItemSelectorOverlayController shopItemSelector = MonoSingleton<UIManager>.Instance.ShowItemSelector(playerFarming, _inventoryManager.GetShopInventory(), new Params
			{
				Key = SHOP_CONTEXT_KEY,
				Context = (Context)2,
				Offset = new Vector2(0f, 150f),
				ShowEmpty = true,
				RequiresDiscovery = false,
				HideQuantity = false,
				ShowCoins = false,
				AllowInputOnlyFromPlayer = playerFarming
			});
			if (((Interaction)__instance).InputOnlyFromInteractingPlayer)
			{
				MonoSingleton<UINavigatorNew>.Instance.AllowInputOnlyFromPlayer = playerFarming;
			}
			shopItemSelector.CostProvider = GetTraderTrackerItemFromItemType;
			shopItemSelector.OnItemChosen = (Action<ITEM_TYPE>)Delegate.Combine(shopItemSelector.OnItemChosen, (Action<ITEM_TYPE>)delegate(ITEM_TYPE chosenItemType)
			{
				//IL_0000: 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)
				TraderTrackerItems traderTrackerItemFromItemType = GetTraderTrackerItemFromItemType(chosenItemType);
				GivePlayerBoughtItem(__instance, shopItemSelector, playerFarming, traderTrackerItemFromItemType, chosenItemType);
			});
			((UIMenuBase)shopItemSelector).OnCancel = (Action)Delegate.Combine(((UIMenuBase)shopItemSelector).OnCancel, (Action)delegate
			{
				HUD_Manager.Instance.Show(0, false);
			});
			UIItemSelectorOverlayController obj = shopItemSelector;
			((UIMenuBase)obj).OnHidden = (Action)Delegate.Combine(((UIMenuBase)obj).OnHidden, (Action)delegate
			{
				PlayerFarming.SetStateForAllPlayers((State)13, false, (PlayerFarming)null);
				SetMysticShopInteractable(__instance, activeFlag: false);
				((MonoBehaviour)__instance).StartCoroutine(RunTutorialsCoroutine(__instance, state));
				shopItemSelector = null;
			});
		}

		private static void GivePlayerBoughtItem(Interaction_MysticShop __instance, UIItemSelectorOverlayController shopItemSelector, PlayerFarming playerFarming, TraderTrackerItems boughtItem, ITEM_TYPE boughtItemType)
		{
			//IL_0026: 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_0032: Invalid comparison between Unknown and I4
			//IL_0051: Unknown result type (might be due to invalid IL or missing references)
			//IL_0055: Invalid comparison between Unknown and I4
			//IL_0034: Unknown result type (might be due to invalid IL or missing references)
			//IL_0038: Invalid comparison between Unknown and I4
			//IL_006e: 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_008c: Expected I4, but got Unknown
			//IL_0057: Unknown result type (might be due to invalid IL or missing references)
			//IL_005b: Invalid comparison between Unknown and I4
			//IL_009d: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a7: Expected I4, but got Unknown
			//IL_003a: Unknown result type (might be due to invalid IL or missing references)
			//IL_003e: Invalid comparison between Unknown and I4
			//IL_00c8: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d1: Expected I4, but got Unknown
			//IL_00d6: Unknown result type (might be due to invalid IL or missing references)
			//IL_042d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0436: Expected I4, but got Unknown
			//IL_00ac: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b5: Expected I4, but got Unknown
			//IL_00ba: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c3: Expected I4, but got Unknown
			//IL_008c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0093: Invalid comparison between Unknown and I4
			//IL_0240: 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_0060: Unknown result type (might be due to invalid IL or missing references)
			//IL_0064: Invalid comparison between Unknown and I4
			//IL_044c: 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_033b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0342: Unknown result type (might be due to invalid IL or missing references)
			//IL_034e: Unknown result type (might be due to invalid IL or missing references)
			//IL_035c: 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_0047: Invalid comparison between Unknown and I4
			//IL_02a9: Unknown result type (might be due to invalid IL or missing references)
			//IL_02ae: Unknown result type (might be due to invalid IL or missing references)
			//IL_02af: Unknown result type (might be due to invalid IL or missing references)
			//IL_02b5: Unknown result type (might be due to invalid IL or missing references)
			//IL_02c0: Unknown result type (might be due to invalid IL or missing references)
			//IL_02cb: Unknown result type (might be due to invalid IL or missing references)
			//IL_02d8: Unknown result type (might be due to invalid IL or missing references)
			//IL_03ba: Unknown result type (might be due to invalid IL or missing references)
			//IL_03bf: Unknown result type (might be due to invalid IL or missing references)
			//IL_03c1: Unknown result type (might be due to invalid IL or missing references)
			//IL_03cd: Unknown result type (might be due to invalid IL or missing references)
			//IL_03d9: Unknown result type (might be due to invalid IL or missing references)
			//IL_03e7: Unknown result type (might be due to invalid IL or missing references)
			Inventory.ChangeItemQuantity(119, -boughtItem.SellPriceActual, 0);
			DataManager instance = DataManager.Instance;
			instance.MysticRewardCount++;
			int itemListCountByItemType = _inventoryManager.GetItemListCountByItemType(boughtItemType);
			if ((int)boughtItemType <= 27)
			{
				if ((int)boughtItemType != 20)
				{
					if ((int)boughtItemType != 26)
					{
						if ((int)boughtItemType != 27)
						{
							goto IL_042d;
						}
						int index = Random.Range(0, itemListCountByItemType - 1);
						RelicType relicByIndex = _inventoryManager.GetRelicByIndex(index);
						DataManager.UnlockRelic(relicByIndex);
						_unlockedRelics.Add(relicByIndex);
						_inventoryManager.RemoveItemFromListByTypeAndIndex(boughtItemType, index);
						_inventoryManager.ChangeShopStockByQuantity(boughtItemType, -1);
						if (!_inventoryManager.BoughtRelic)
						{
							_postShopActions.Add(ShowUnlockedRelics);
							_inventoryManager.SetBoughtRelicFlag(showFlag: true);
						}
					}
					else
					{
						int index2 = Random.Range(0, itemListCountByItemType - 1);
						Card tarotCardByIndex = _inventoryManager.GetTarotCardByIndex(index2);
						_unlockedTarotCards.Add(tarotCardByIndex);
						_inventoryManager.RemoveItemFromListByTypeAndIndex(boughtItemType, index2);
						_inventoryManager.ChangeShopStockByQuantity(boughtItemType, -1);
						if (!_inventoryManager.BoughtTarotCard)
						{
							_postShopActions.Add(ShowUnlockedTarotCards);
							_inventoryManager.SetBoughtTarotCardFlag(showFlag: true);
						}
					}
				}
				else
				{
					Inventory.ChangeItemQuantity((int)boughtItemType, 100, 0);
				}
			}
			else if ((int)boughtItemType <= 114)
			{
				if ((int)boughtItemType != 52)
				{
					if ((int)boughtItemType != 114)
					{
						goto IL_042d;
					}
					Inventory.KeyPieces += 1;
					if (DataManager.Instance.TalismanPiecesReceivedFromMysticShop < (int)Traverse.Create((object)__instance).Field("maxAmountOfTalismanPieces").GetValue())
					{
						DataManager instance2 = DataManager.Instance;
						instance2.TalismanPiecesReceivedFromMysticShop++;
					}
					if (!_inventoryManager.BoughtKeyPiece)
					{
						_postShopActions.Add(ShowNewTalismanPieceAnimation);
						_inventoryManager.SetBoughtKeyPieceFlag(showFlag: true);
					}
				}
				else
				{
					int index3 = Random.Range(0, itemListCountByItemType - 1);
					DataManager.SetFollowerSkinUnlocked(_inventoryManager.GetFollowerSkinNameByIndex(index3));
					_inventoryManager.RemoveItemFromListByTypeAndIndex(boughtItemType, index3);
					_inventoryManager.ChangeShopStockByQuantity(boughtItemType, -1);
					if (!_inventoryManager.BoughtFollowerSkin)
					{
						_postShopActions.Add(ShowUnlockedFollowerSkins);
						_inventoryManager.SetBoughtFollowerSkinFlag(showFlag: true);
					}
				}
			}
			else
			{
				switch (boughtItemType - 121)
				{
				case 3:
					goto IL_00ac;
				case 4:
					goto IL_00ba;
				case 0:
					goto IL_00c8;
				case 1:
				case 2:
					goto IL_042d;
				}
				if ((int)boughtItemType != 164)
				{
					goto IL_042d;
				}
				int index4 = Random.Range(0, itemListCountByItemType - 1);
				TYPES decorationByIndex = _inventoryManager.GetDecorationByIndex(index4);
				StructuresData.CompleteResearch(decorationByIndex);
				StructuresData.SetRevealed(decorationByIndex);
				_unlockedDecorations.Add(decorationByIndex);
				_inventoryManager.RemoveItemFromListByTypeAndIndex(boughtItemType, index4);
				_inventoryManager.ChangeShopStockByQuantity(boughtItemType, -1);
				if (!_inventoryManager.BoughtDecoration)
				{
					_postShopActions.Add(ShowUnlockedDecorations);
					_inventoryManager.SetBoughtDecorationFlag(showFlag: true);
				}
			}
			goto IL_0436;
			IL_00ba:
			Inventory.ChangeItemQuantity((int)boughtItemType, 1, 0);
			goto IL_0436;
			IL_0436:
			UIManager.PlayAudio("event:/followers/pop_in");
			ResourceCustomTarget.Create(((Component)__instance).gameObject, ((Component)playerFarming).transform.position, (ITEM_TYPE)119, (Action)delegate
			{
			}, true);
			return;
			IL_00c8:
			Inventory.ChangeItemQuantity((int)boughtItemType, 1, 0);
			_inventoryManager.ChangeShopStockByQuantity(boughtItemType, -1);
			if (DataManager.Instance.CrystalDoctrinesReceivedFromMysticShop < (int)Traverse.Create((object)__instance).Field("maxAmountOfCrystalDoctrines").GetValue())
			{
				DataManager instance3 = DataManager.Instance;
				instance3.CrystalDoctrinesReceivedFromMysticShop++;
			}
			if (!_inventoryManager.BoughtCrystalDoctrineStone)
			{
				UpgradeSystem.UnlockAbility((Type)252, false);
				if (DataManager.Instance.TryRevealTutorialTopic((TutorialTopic)32))
				{
					_postShopActions.Add(ShowCrystalDoctrineTutorial);
					_postShopActions.Add(ShowCrystalDoctrineInMenu);
				}
				_inventoryManager.SetBoughtCrystalDoctrineStoneFlag(showFlag: true);
			}
			goto IL_0436;
			IL_042d:
			Inventory.ChangeItemQuantity((int)boughtItemType, 1, 0);
			goto IL_0436;
			IL_00ac:
			Inventory.ChangeItemQuantity((int)boughtItemType, 1, 0);
			goto IL_0436;
		}

		private static IEnumerator RunTutorialsCoroutine(Interaction_MysticShop instance, StateMachine state)
		{
			SetMysticShopInteractable(instance, activeFlag: false);
			while (UIMenuBase.ActiveMenus.Count > 0)
			{
				yield return null;
			}
			foreach (Action postShopAction in _postShopActions)
			{
				postShopAction();
				while (UIMenuBase.ActiveMenus.Count > 0)
				{
					yield return null;
				}
				yield return (object)new WaitForSecondsRealtime(0.25f);
			}
			yield return (object)new WaitForSecondsRealtime(0.5f);
			SetMysticShopInteractable(instance, activeFlag: true);
			foreach (PlayerFarming player in PlayerFarming.players)
			{
				if (player.GoToAndStopping)
				{
					player.AbortGoTo(true);
				}
			}
			PlayerFarming.SetStateForAllPlayers((State)((LetterBox.IsPlaying || MMConversation.isPlaying) ? 13 : 0), false, (PlayerFarming)null);
			state.CURRENT_STATE = (State)0;
		}

		private static void ShowCrystalDoctrineTutorial()
		{
			((UIMenuBase)MonoSingleton<UIManager>.Instance.ShowTutorialOverlay((TutorialTopic)32, 0f)).Show(false);
		}

		private static void ShowCrystalDoctrineInMenu()
		{
			GameObjectExtensions.Instantiate<UIPlayerUpgradesMenuController>(MonoSingleton<UIManager>.Instance.PlayerUpgradesMenuTemplate).ShowCrystalUnlock();
		}

		private static void ShowNewTalismanPieceAnimation()
		{
			((UIMenuBase)GameObjectExtensions.Instantiate<UIKeyScreenOverlayController>(MonoSingleton<UIManager>.Instance.KeyScreenTemplate)).Show(false);
		}

		private static void ShowUnlockedFollowerSkins()
		{
			((UIMenuBase)GameObjectExtensions.Instantiate<UIFollowerFormsMenuController>(MonoSingleton<UIManager>.Instance.FollowerFormsMenuTemplate)).Show(false);
		}

		private static void ShowUnlockedDecorations()
		{
			GameObjectExtensions.Instantiate<UIBuildMenuController>(MonoSingleton<UIManager>.Instance.BuildMenuTemplate).Show(_unlockedDecorations);
		}

		private static void ShowUnlockedTarotCards()
		{
			GameObjectExtensions.Instantiate<UITarotCardsMenuController>(MonoSingleton<UIManager>.Instance.TarotCardsMenuTemplate).Show(_unlockedTarotCards.ToArray(), false);
		}

		private static void ShowUnlockedRelics()
		{
			GameObjectExtensions.Instantiate<UIRelicMenuController>(MonoSingleton<UIManager>.Instance.RelicMenuTemplate).Show(_unlockedRelics, false);
		}

		private static void SetMysticShopInteractable(Interaction_MysticShop instance, bool activeFlag)
		{
			((Interaction)instance).Interactable = activeFlag;
		}

		private static void GivePlayerNewFollowerSkin(List<string> possibleSkins)
		{
			SkinAndData val = WorshipperData.Instance.GetSkinsAll(false)[0];
			Console.WriteLine("first skin: " + val.Skin[0].Skin);
		}

		private static TraderTrackerItems GetTraderTrackerItemFromItemType(ITEM_TYPE specifiedType)
		{
			//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)
			foreach (TraderTrackerItems mysticAssistantShopItemType in MysticAssistantInventoryInfo.GetMysticAssistantShopItemTypeList())
			{
				if (mysticAssistantShopItemType.itemForTrade == specifiedType)
				{
					return mysticAssistantShopItemType;
				}
			}
			return null;
		}

		private static IEnumerator ClearShopKeeperSimpleBark(SimpleBark boughtBark, Interaction_MysticShop instance, StateMachine state)
		{
			((Component)boughtBark).gameObject.SetActive(false);
			boughtBark.Close();
			yield return (object)new WaitForSecondsRealtime(0.5f);
			((Interaction)instance).OnSecondaryInteract(state);
		}
	}
	internal static class MysticAssistantInventoryInfo
	{
		private const int MAX_COUNT_DARK_NECKLACE = 1;

		private const int MAX_COUNT_LIGHT_NECKLACE = 1;

		private const int MAX_COUNT_TALISMAN_PIECES = 12;

		public static string GetShopLabelByItemType(ITEM_TYPE itemType)
		{
			//IL_0000: Unknown result type (might be due to invalid IL or missing references)
			//IL_0003: Invalid comparison between Unknown and I4
			//IL_0005: Unknown result type (might be due to invalid IL or missing references)
			//IL_000b: Invalid comparison between Unknown and I4
			//IL_0036: Unknown result type (might be due to invalid IL or missing references)
			if ((int)itemType != 27)
			{
				if ((int)itemType == 164)
				{
					return LocalizationManager.GetTranslation($"Inventory/{(object)(ITEM_TYPE)40}", true, 0, true, false, (GameObject)null, (string)null, true);
				}
				return LocalizationManager.GetTranslation($"Inventory/{itemType}", true, 0, true, false, (GameObject)null, (string)null, true);
			}
			return "Relic";
		}

		public static bool CheckForBoughtQuantityWarning(TraderTrackerItems chosenItem)
		{
			//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_0007: Unknown result type (might be due to invalid IL or missing references)
			//IL_000a: Invalid comparison between Unknown and I4
			//IL_000f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0012: Invalid comparison between Unknown and I4
			//IL_0014: Unknown result type (might be due to invalid IL or missing references)
			//IL_0017: Invalid comparison between Unknown and I4
			ITEM_TYPE itemForTrade = chosenItem.itemForTrade;
			if ((int)itemForTrade != 114)
			{
				if ((int)itemForTrade != 124)
				{
					if ((int)itemForTrade != 125)
					{
						return false;
					}
					if (DataManager.Instance.HasBaalSkin || Inventory.GetItemQuantity((ITEM_TYPE)125) >= 1 || DataManager.Instance.Followers.Exists((FollowerInfo f) => (int)f.Necklace == 125))
					{
						return true;
					}
				}
				else if (DataManager.Instance.HasAymSkin || Inventory.GetItemQuantity((ITEM_TYPE)124) >= 1 || DataManager.Instance.Followers.Exists((FollowerInfo f) => (int)f.Necklace == 124))
				{
					return true;
				}
			}
			else if (DataManager.Instance.TalismanPiecesReceivedFromMysticShop >= 12)
			{
				return true;
			}
			return false;
		}

		public static List<TraderTrackerItems> GetMysticAssistantShopItemTypeList()
		{
			//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_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_0014: Unknown result type (might be due to invalid IL or missing references)
			//IL_001b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0022: Unknown result type (might be due to invalid IL or missing references)
			//IL_0029: Unknown result type (might be due to invalid IL or missing references)
			//IL_0035: Expected O, but got Unknown
			//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_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_0049: 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_0057: 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_006a: Expected O, but got Unknown
			//IL_006a: 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_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_007e: 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_008c: 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_009f: Expected O, but got Unknown
			//IL_009f: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a7: 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_00b3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ba: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c8: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d4: Expected O, but got Unknown
			//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_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_00e8: 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: 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_010a: 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_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_011e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0125: 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_0133: Unknown result type (might be due to invalid IL or missing references)
			//IL_0140: Expected O, but got Unknown
			//IL_0140: Unknown result type (might be due to invalid IL or missing references)
			//IL_0145: 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_0154: 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_0162: 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_0176: 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_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)
			//IL_018a: 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_0198: 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_01ac: Expected O, but got Unknown
			//IL_01ac: 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_01b4: Unknown result type (might be due to invalid IL or missing references)
			//IL_01b9: Unknown result type (might be due to invalid IL or missing references)
			//IL_01c0: Unknown result type (might be due to invalid IL or missing references)
			//IL_01c7: 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_01d5: Unknown result type (might be due to invalid IL or missing references)
			//IL_01e2: Expected O, but got Unknown
			//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_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_0207: 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_021b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0220: 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_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_0236: 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_0244: Unknown result type (might be due to invalid IL or missing references)
			//IL_0251: Expected O, but got Unknown
			//IL_0251: Unknown result type (might be due to invalid IL or missing references)
			//IL_0256: 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_025e: 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_026c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0273: 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_0287: Expected O, but got Unknown
			//IL_0287: Unknown result type (might be due to invalid IL or missing references)
			//IL_028c: 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_0294: 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_02a2: Unknown result type (might be due to invalid IL or missing references)
			//IL_02a9: Unknown result type (might be due to invalid IL or missing references)
			//IL_02b0: Unknown result type (might be due to invalid IL or missing references)
			//IL_02bd: Expected O, but got Unknown
			TraderTrackerItems item = new TraderTrackerItems
			{
				itemForTrade = (ITEM_TYPE)124,
				BuyPrice = 1,
				BuyOffset = 0,
				SellPrice = 1,
				SellOffset = 0,
				LastDayChecked = TimeManager.CurrentDay
			};
			TraderTrackerItems item2 = new TraderTrackerItems
			{
				itemForTrade = (ITEM_TYPE)125,
				BuyPrice = 1,
				BuyOffset = 0,
				SellPrice = 1,
				SellOffset = 0,
				LastDayChecked = TimeManager.CurrentDay
			};
			TraderTrackerItems item3 = new TraderTrackerItems
			{
				itemForTrade = (ITEM_TYPE)127,
				BuyPrice = 1,
				BuyOffset = 0,
				SellPrice = 1,
				SellOffset = 0,
				LastDayChecked = TimeManager.CurrentDay
			};
			TraderTrackerItems item4 = new TraderTrackerItems
			{
				itemForTrade = (ITEM_TYPE)123,
				BuyPrice = 1,
				BuyOffset = 0,
				SellPrice = 1,
				SellOffset = 0,
				LastDayChecked = TimeManager.CurrentDay
			};
			TraderTrackerItems item5 = new TraderTrackerItems
			{
				itemForTrade = (ITEM_TYPE)122,
				BuyPrice = 1,
				BuyOffset = 0,
				SellPrice = 1,
				SellOffset = 0,
				LastDayChecked = TimeManager.CurrentDay
			};
			TraderTrackerItems item6 = new TraderTrackerItems
			{
				itemForTrade = (ITEM_TYPE)126,
				BuyPrice = 1,
				BuyOffset = 0,
				SellPrice = 1,
				SellOffset = 0,
				LastDayChecked = TimeManager.CurrentDay
			};
			TraderTrackerItems item7 = new TraderTrackerItems
			{
				itemForTrade = (ITEM_TYPE)121,
				BuyPrice = 1,
				BuyOffset = 0,
				SellPrice = 1,
				SellOffset = 0,
				LastDayChecked = TimeManager.CurrentDay
			};
			TraderTrackerItems item8 = new TraderTrackerItems
			{
				itemForTrade = (ITEM_TYPE)114,
				BuyPrice = 1,
				BuyOffset = 0,
				SellPrice = 1,
				SellOffset = 0,
				LastDayChecked = TimeManager.CurrentDay
			};
			TraderTrackerItems item9 = new TraderTrackerItems
			{
				itemForTrade = (ITEM_TYPE)52,
				BuyPrice = 1,
				BuyOffset = 0,
				SellPrice = 1,
				SellOffset = 0,
				LastDayChecked = TimeManager.CurrentDay
			};
			TraderTrackerItems item10 = new TraderTrackerItems
			{
				itemForTrade = (ITEM_TYPE)164,
				BuyPrice = 1,
				BuyOffset = 0,
				SellPrice = 1,
				SellOffset = 0,
				LastDayChecked = TimeManager.CurrentDay
			};
			TraderTrackerItems item11 = new TraderTrackerItems
			{
				itemForTrade = (ITEM_TYPE)26,
				BuyPrice = 1,
				BuyOffset = 0,
				SellPrice = 1,
				SellOffset = 0,
				LastDayChecked = TimeManager.CurrentDay
			};
			TraderTrackerItems item12 = new TraderTrackerItems
			{
				itemForTrade = (ITEM_TYPE)27,
				BuyPrice = 1,
				BuyOffset = 0,
				SellPrice = 1,
				SellOffset = 0,
				LastDayChecked = TimeManager.CurrentDay
			};
			TraderTrackerItems item13 = new TraderTrackerItems
			{
				itemForTrade = (ITEM_TYPE)20,
				BuyPrice = 1,
				BuyOffset = 0,
				SellPrice = 1,
				SellOffset = 0,
				LastDayChecked = TimeManager.CurrentDay
			};
			return new List<TraderTrackerItems>
			{
				item3, item4, item5, item6, item2, item, item7, item8, item9, item10,
				item11, item12, item13
			};
		}
	}
	internal class MysticAssistantInventoryManager
	{
		private List<InventoryItem> _shopInventory = new List<InventoryItem>();

		private List<ITEM_TYPE> _limitedStockTypes = new List<ITEM_TYPE>();

		private List<string> _followerSkinsAvailableFromMysticShop = new List<string>();

		private List<TYPES> _decorationsAvailableFromMysticShop = new List<TYPES>();

		private List<Card> _tarotCardsAvailableFromMysticShop = new List<Card>();

		private List<RelicType> _relicsAvailableFromMysticShop = new List<RelicType>();

		private int maxCountCrystalDoctrineStone = 24;

		public bool BoughtKeyPiece { get; private set; }

		public bool BoughtCrystalDoctrineStone { get; private set; }

		public bool BoughtFollowerSkin { get; private set; }

		public bool BoughtDecoration { get; private set; }

		public bool BoughtTarotCard { get; private set; }

		public bool BoughtRelic { get; private set; }

		public MysticAssistantInventoryManager(Interaction_MysticShop instance)
		{
			ResetInventory();
			maxCountCrystalDoctrineStone = (int)Traverse.Create((object)instance).Field("maxAmountOfCrystalDoctrines").GetValue();
			bool hasAymSkin = DataManager.Instance.Followers.Exists((FollowerInfo f) => f.Name == "Aym") || DataManager.Instance.Followers_Dead.Exists((FollowerInfo f) => f.Name == "Aym") || DataManager.Instance.HasReturnedAym || DataManager.Instance.HasReturnedBoth;
			DataManager.Instance.HasAymSkin = hasAymSkin;
			bool hasBaalSkin = DataManager.Instance.Followers.Exists((FollowerInfo f) => f.Name == "Baal") || DataManager.Instance.Followers_Dead.Exists((FollowerInfo f) => f.Name == "Baal") || DataManager.Instance.HasReturnedBaal || DataManager.Instance.HasReturnedBoth;
			DataManager.Instance.HasBaalSkin = hasBaalSkin;
		}

		public void ResetInventory()
		{
			_followerSkinsAvailableFromMysticShop.Clear();
			_decorationsAvailableFromMysticShop.Clear();
			_tarotCardsAvailableFromMysticShop.Clear();
			_relicsAvailableFromMysticShop.Clear();
			_shopInventory.Clear();
			_limitedStockTypes.Clear();
			PopulateShopInventory();
			SetAllBoughtFlags(flag: false);
		}

		private void PopulateShopInventory()
		{
			//IL_0040: 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_0072: Invalid comparison between Unknown and I4
			//IL_004e: 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_009f: Invalid comparison between Unknown and I4
			//IL_00ab: 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_00bb: Expected O, but got Unknown
			//IL_005e: Unknown result type (might be due to invalid IL or missing references)
			//IL_008b: 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_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_00f3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00fd: Expected O, but got Unknown
			PopulateFollowerSkinShopList();
			PopulateDecorationShopList();
			PopulateTarotCardShopList();
			PopulateRelicShopList();
			List<ITEM_TYPE> list = new List<ITEM_TYPE>();
			foreach (TraderTrackerItems mysticAssistantShopItemType in MysticAssistantInventoryInfo.GetMysticAssistantShopItemTypeList())
			{
				int num = 99;
				if (_limitedStockTypes.Contains(mysticAssistantShopItemType.itemForTrade))
				{
					num = GetItemListCountByItemType(mysticAssistantShopItemType.itemForTrade);
					if (num == 0)
					{
						list.Add(mysticAssistantShopItemType.itemForTrade);
						continue;
					}
				}
				else if ((int)mysticAssistantShopItemType.itemForTrade == 121)
				{
					num = maxCountCrystalDoctrineStone - DataManager.Instance.CrystalDoctrinesReceivedFromMysticShop;
					if (num == 0)
					{
						list.Add(mysticAssistantShopItemType.itemForTrade);
						continue;
					}
				}
				else if ((int)mysticAssistantShopItemType.itemForTrade == 20)
				{
					num = 100;
				}
				_shopInventory.Add(new InventoryItem(mysticAssistantShopItemType.itemForTrade, num));
			}
			foreach (ITEM_TYPE item in list)
			{
				_shopInventory.Add(new InventoryItem(item, 0));
			}
		}

		private void PopulateFollowerSkinShopList()
		{
			foreach (string item in DataManager.MysticShopKeeperSkins.ToList())
			{
				if (!DataManager.GetFollowerSkinUnlocked(item))
				{
					_followerSkinsAvailableFromMysticShop.Add(item);
				}
			}
			_limitedStockTypes.Add((ITEM_TYPE)52);
		}

		private void PopulateDecorationShopList()
		{
			//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_0024: 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)
			foreach (TYPES item in DataManager.MysticShopKeeperDecorations.ToList())
			{
				if (!DataManager.Instance.UnlockedStructures.Contains(item))
				{
					_decorationsAvailableFromMysticShop.Add(item);
				}
			}
			_limitedStockTypes.Add((ITEM_TYPE)164);
		}

		private void PopulateTarotCardShopList()
		{
			//IL_000d: 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_0026: Unknown result type (might be due to invalid IL or missing references)
			Card[] mysticCards = TarotCards.MysticCards;
			foreach (Card item in mysticCards)
			{
				if (!DataManager.Instance.PlayerFoundTrinkets.Contains(item))
				{
					_tarotCardsAvailableFromMysticShop.Add(item);
				}
			}
			_limitedStockTypes.Add((ITEM_TYPE)26);
		}

		private void PopulateRelicShopList()
		{
			if (!DataManager.Instance.PlayerFoundRelics.Contains((RelicType)59))
			{
				_relicsAvailableFromMysticShop.Add((RelicType)59);
			}
			if (!DataManager.Instance.PlayerFoundRelics.Contains((RelicType)61))
			{
				_relicsAvailableFromMysticShop.Add((RelicType)61);
			}
			_limitedStockTypes.Add((ITEM_TYPE)27);
		}

		public List<InventoryItem> GetShopInventory()
		{
			return _shopInventory;
		}

		public void ChangeShopStockByQuantity(ITEM_TYPE itemType, int quantity)
		{
			//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)
			InventoryItem obj = _shopInventory.First((InventoryItem s) => s.type == (int)itemType);
			obj.quantity += quantity;
		}

		public int GetItemListCountByItemType(ITEM_TYPE itemType)
		{
			//IL_0000: Unknown result type (might be due to invalid IL or missing references)
			//IL_0003: Invalid comparison between Unknown and I4
			//IL_0011: Unknown result type (might be due to invalid IL or missing references)
			//IL_0014: Invalid comparison between Unknown and I4
			//IL_0005: Unknown result type (might be due to invalid IL or missing references)
			//IL_0008: Invalid comparison between Unknown and I4
			//IL_0016: Unknown result type (might be due to invalid IL or missing references)
			//IL_001c: Invalid comparison between Unknown and I4
			//IL_000a: Unknown result type (might be due to invalid IL or missing references)
			//IL_000d: Invalid comparison between Unknown and I4
			if ((int)itemType <= 27)
			{
				if ((int)itemType == 26)
				{
					return _tarotCardsAvailableFromMysticShop.Count;
				}
				if ((int)itemType == 27)
				{
					return _relicsAvailableFromMysticShop.Count;
				}
			}
			else
			{
				if ((int)itemType == 52)
				{
					return _followerSkinsAvailableFromMysticShop.Count;
				}
				if ((int)itemType == 164)
				{
					return _decorationsAvailableFromMysticShop.Count;
				}
			}
			return 0;
		}

		public void RemoveItemFromListByTypeAndIndex(ITEM_TYPE itemType, int index)
		{
			//IL_0000: Unknown result type (might be due to invalid IL or missing references)
			//IL_0003: Invalid comparison between Unknown and I4
			//IL_0010: Unknown result type (might be due to invalid IL or missing references)
			//IL_0013: Invalid comparison between Unknown and I4
			//IL_0005: Unknown result type (might be due to invalid IL or missing references)
			//IL_0008: Invalid comparison between Unknown and I4
			//IL_0015: Unknown result type (might be due to invalid IL or missing references)
			//IL_001b: Invalid comparison between Unknown and I4
			//IL_000a: Unknown result type (might be due to invalid IL or missing references)
			//IL_000d: Invalid comparison between Unknown and I4
			if ((int)itemType <= 27)
			{
				if ((int)itemType != 26)
				{
					if ((int)itemType == 27)
					{
						_relicsAvailableFromMysticShop.RemoveAt(index);
					}
				}
				else
				{
					_tarotCardsAvailableFromMysticShop.RemoveAt(index);
				}
			}
			else if ((int)itemType != 52)
			{
				if ((int)itemType == 164)
				{
					_decorationsAvailableFromMysticShop.RemoveAt(index);
				}
			}
			else
			{
				_followerSkinsAvailableFromMysticShop.RemoveAt(index);
			}
		}

		public string GetFollowerSkinNameByIndex(int index)
		{
			return _followerSkinsAvailableFromMysticShop[index];
		}

		public TYPES GetDecorationByIndex(int index)
		{
			//IL_0007: Unknown result type (might be due to invalid IL or missing references)
			return _decorationsAvailableFromMysticShop[index];
		}

		public Card GetTarotCardByIndex(int index)
		{
			//IL_0007: Unknown result type (might be due to invalid IL or missing references)
			return _tarotCardsAvailableFromMysticShop[index];
		}

		public RelicType GetRelicByIndex(int index)
		{
			//IL_0007: Unknown result type (might be due to invalid IL or missing references)
			return _relicsAvailableFromMysticShop[index];
		}

		public void SetAllBoughtFlags(bool flag)
		{
			BoughtKeyPiece = flag;
			BoughtCrystalDoctrineStone = flag;
			BoughtFollowerSkin = flag;
			BoughtDecoration = flag;
			BoughtTarotCard = flag;
			BoughtRelic = flag;
		}

		public void SetBoughtKeyPieceFlag(bool showFlag)
		{
			BoughtKeyPiece = showFlag;
		}

		public void SetBoughtCrystalDoctrineStoneFlag(bool showFlag)
		{
			BoughtCrystalDoctrineStone = showFlag;
		}

		public void SetBoughtFollowerSkinFlag(bool showFlag)
		{
			BoughtFollowerSkin = showFlag;
		}

		public void SetBoughtDecorationFlag(bool showFlag)
		{
			BoughtDecoration = showFlag;
		}

		public void SetBoughtTarotCardFlag(bool showFlag)
		{
			BoughtTarotCard = showFlag;
		}

		public void SetBoughtRelicFlag(bool showFlag)
		{
			BoughtRelic = showFlag;
		}
	}
	public static class PluginInfo
	{
		public const string PLUGIN_GUID = "MysticAssistant";

		public const string PLUGIN_NAME = "MysticAssistant";

		public const string PLUGIN_VERSION = "1.0.0";
	}
}