Decompiled source of BazaarIsMyHaven v4.2.0

BazaarIsMyHaven.dll

Decompiled 2 weeks ago
using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using BepInEx;
using BepInEx.Bootstrap;
using BepInEx.Configuration;
using BepInEx.Logging;
using EntityStates;
using EntityStates.NewtMonster;
using HG.Reflection;
using IL.RoR2;
using InLobbyConfig;
using InLobbyConfig.Fields;
using ItemStringParser;
using Microsoft.CodeAnalysis;
using Mono.Cecil.Cil;
using MonoMod.Cil;
using On.EntityStates.NewtMonster;
using On.RoR2;
using R2API.Utils;
using RoR2;
using RoR2.Skills;
using UnityEngine;
using UnityEngine.AddressableAssets;
using UnityEngine.Networking;
using UnityEngine.ResourceManagement.AsyncOperations;
using UnityEngine.SceneManagement;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: OptIn]
[assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")]
[assembly: AssemblyCompany("BazaarIsMyHaven")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0+16bef58287d648ffdaae338dbb0482dfbe692d7b")]
[assembly: AssemblyProduct("BazaarIsMyHaven")]
[assembly: AssemblyTitle("BazaarIsMyHaven")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.0.0")]
[module: UnverifiableCode]
[module: RefSafetyRules(11)]
[module: UnverifiableCode]
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 BazaarIsMyHaven
{
	public abstract class BazaarBase
	{
		protected Random RNG = new Random();

		protected readonly DirectorPlacementRule DirectPlacement = new DirectorPlacementRule
		{
			placementMode = (PlacementMode)0
		};

		public abstract void Preload();

		public abstract void Hook();

		public abstract void RunStart();

		public abstract void SetupBazaar();

		protected List<GameObject> DoSpawnCard(Dictionary<int, SpawnCardStruct> keyValuePairs, AsyncOperationHandle<InteractableSpawnCard> card, int max)
		{
			//IL_003e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0043: Unknown result type (might be due to invalid IL or missing references)
			//IL_0059: Unknown result type (might be due to invalid IL or missing references)
			//IL_0063: Expected O, but got Unknown
			//IL_005e: 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)
			int num = 0;
			num = ((!ModConfig.SpawnCountByStage.Value) ? max : SetCountbyGameStage(max, ModConfig.SpawnCountOffset.Value));
			List<GameObject> list = new List<GameObject>();
			for (int i = 0; i < num; i++)
			{
				SpawnCard val = (SpawnCard)(object)card.WaitForCompletion();
				GameObject spawnedInstance = val.DoSpawn(keyValuePairs[i].Position, Quaternion.identity, new DirectorSpawnRequest(val, DirectPlacement, Run.instance.runRNG)).spawnedInstance;
				spawnedInstance.transform.eulerAngles = keyValuePairs[i].Rotation;
				list.Add(spawnedInstance);
			}
			return list;
		}

		protected virtual List<GameObject> DoSpawnGameObject(Dictionary<int, SpawnCardStruct> keyValuePairs, AsyncOperationHandle<GameObject> card, int max)
		{
			//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_0059: Unknown result type (might be due to invalid IL or missing references)
			int num = 0;
			num = ((!ModConfig.SpawnCountByStage.Value) ? max : SetCountbyGameStage(max, ModConfig.SpawnCountOffset.Value));
			List<GameObject> list = new List<GameObject>();
			for (int i = 0; i < num; i++)
			{
				GameObject val = Object.Instantiate<GameObject>(card.WaitForCompletion(), keyValuePairs[i].Position, Quaternion.identity);
				val.transform.eulerAngles = keyValuePairs[i].Rotation;
				NetworkServer.Spawn(val);
				list.Add(val);
			}
			return list;
		}

		public static void SpawnEffect(AsyncOperationHandle<GameObject> effect, Vector3 position, Color32 color, float scale = 1f)
		{
			//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_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_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_0025: 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_0027: Unknown result type (might be due to invalid IL or missing references)
			//IL_0032: Expected O, but got Unknown
			EffectManager.SpawnEffect(effect.WaitForCompletion(), new EffectData
			{
				origin = position,
				rotation = Quaternion.identity,
				scale = scale,
				color = color
			}, true);
		}

		protected int SetCountbyGameStage(int max, int offset = 0)
		{
			int val = Math.Min(Run.instance.stageClearCount + offset, max);
			return Math.Max(0, val);
		}

		protected bool IsCurrentMapInBazaar()
		{
			//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 == "bazaar";
		}

		protected bool IsMultiplayer()
		{
			return PlayerCharacterMasterController.instances.Count > 1;
		}

		protected T GetRandom<T>(List<T> list, T defaultValue)
		{
			if (list == null || list.Count == 0)
			{
				return defaultValue;
			}
			return list[RNG.Next(list.Count)];
		}

		protected List<t> DisorderList<t>(List<t> TList)
		{
			List<t> list = new List<t>();
			foreach (t T in TList)
			{
				list.Insert(RNG.Next(list.Count()), T);
			}
			return list;
		}
	}
	public class BazaarCauldron : BazaarBase
	{
		private AsyncOperationHandle<GameObject> lunarCauldronWhiteToGreen;

		private AsyncOperationHandle<GameObject> lunarCauldronGreenToRed;

		private AsyncOperationHandle<GameObject> lunarCauldronRedToWhite;

		private AsyncOperationHandle<GameObject>[] LunarCauldronsCode;

		private Dictionary<int, SpawnCardStruct> DicCauldrons = new Dictionary<int, SpawnCardStruct>();

		public override void Preload()
		{
			//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_001b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0026: Unknown result type (might be due to invalid IL or missing references)
			//IL_002b: Unknown result type (might be due to invalid IL or missing references)
			//IL_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_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_0054: 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)
			lunarCauldronWhiteToGreen = Addressables.LoadAssetAsync<GameObject>((object)"RoR2/Base/LunarCauldrons/LunarCauldron, WhiteToGreen.prefab");
			lunarCauldronGreenToRed = Addressables.LoadAssetAsync<GameObject>((object)"RoR2/Base/LunarCauldrons/LunarCauldron, GreenToRed Variant.prefab");
			lunarCauldronRedToWhite = Addressables.LoadAssetAsync<GameObject>((object)"RoR2/Base/LunarCauldrons/LunarCauldron, RedToWhite Variant.prefab");
			LunarCauldronsCode = new AsyncOperationHandle<GameObject>[3] { lunarCauldronWhiteToGreen, lunarCauldronGreenToRed, lunarCauldronRedToWhite };
		}

		public override void Hook()
		{
			//IL_0007: Unknown result type (might be due to invalid IL or missing references)
			//IL_0011: Expected O, but got Unknown
			//IL_0018: Unknown result type (might be due to invalid IL or missing references)
			//IL_0022: Expected O, but got Unknown
			//IL_0029: Unknown result type (might be due to invalid IL or missing references)
			//IL_0033: Expected O, but got Unknown
			PurchaseInteraction.Awake += new hook_Awake(PurchaseInteraction_Awake);
			PurchaseInteraction.OnInteractionBegin += new hook_OnInteractionBegin(PurchaseInteraction_OnInteractionBegin);
			ShopTerminalBehavior.SetPickup += new hook_SetPickup(ShopTerminalBehavior_SetPickup);
		}

		public override void RunStart()
		{
		}

		public override void SetupBazaar()
		{
			if (ModConfig.CauldronSectionEnabled.Value)
			{
				SpawnLunarCauldron();
			}
		}

		public void PurchaseInteraction_Awake(orig_Awake orig, PurchaseInteraction self)
		{
			orig.Invoke(self);
			if (ModConfig.EnableMod.Value && ModConfig.CauldronSectionEnabled.Value && IsCurrentMapInBazaar() && NetworkServer.active)
			{
				if (((Object)self).name.StartsWith("LunarCauldron, WhiteToGreen"))
				{
					self.cost = ModConfig.CauldronWhiteToGreenCost.Value;
					self.Networkcost = ModConfig.CauldronWhiteToGreenCost.Value;
				}
				if (((Object)self).name.StartsWith("LunarCauldron, GreenToRed"))
				{
					self.cost = ModConfig.CauldronGreenToRedCost.Value;
					self.Networkcost = ModConfig.CauldronGreenToRedCost.Value;
				}
				if (((Object)self).name.StartsWith("LunarCauldron, RedToWhite"))
				{
					self.cost = ModConfig.CauldronRedToWhiteCost.Value;
					self.Networkcost = ModConfig.CauldronRedToWhiteCost.Value;
				}
			}
		}

		public void PurchaseInteraction_OnInteractionBegin(orig_OnInteractionBegin orig, PurchaseInteraction self, Interactor activator)
		{
			//IL_0062: 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_0071: Unknown result type (might be due to invalid IL or missing references)
			if (ModConfig.EnableMod.Value && ModConfig.CauldronSectionEnabled.Value && IsCurrentMapInBazaar() && NetworkServer.active && ((Object)self).name.StartsWith("LunarCauldron, RedToWhite Variant") && IsMultiplayer() && ModCompatibilityShareSuite.enabled && ModCompatibilityShareSuite.IsShareSuite_PrinterCauldronFixEnabled())
			{
				Inventory inventory = ((Component)activator).GetComponent<CharacterBody>().inventory;
				ShopTerminalBehavior component = ((Component)self).GetComponent<ShopTerminalBehavior>();
				inventory.GiveItemPermanent(PickupCatalog.GetPickupDef(component.CurrentPickup().pickupIndex).itemIndex, 2);
			}
			orig.Invoke(self, activator);
		}

		public void ShopTerminalBehavior_SetPickup(orig_SetPickup orig, ShopTerminalBehavior self, UniquePickup newPickup, bool newHidden)
		{
			//IL_00e3: 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_0068: 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)
			//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)
			if (ModConfig.EnableMod.Value && ModConfig.CauldronSectionEnabled.Value && IsCurrentMapInBazaar() && NetworkServer.active)
			{
				if (((Object)self).name.StartsWith("LunarCauldronGreen"))
				{
					CauldronHacked_SetPickupIndex(self, out var listLunarItem);
					newPickup.pickupIndex = listLunarItem[RNG.Next(0, listLunarItem.Count)];
				}
				if (((Object)self).name.StartsWith("LunarCauldronRed"))
				{
					CauldronHacked_SetPickupIndex(self, out var listLunarItem2);
					newPickup.pickupIndex = listLunarItem2[RNG.Next(0, listLunarItem2.Count)];
				}
				if (((Object)self).name.StartsWith("LunarCauldronWhite"))
				{
					CauldronHacked_SetPickupIndex(self, out var listLunarItem3);
					newPickup.pickupIndex = listLunarItem3[RNG.Next(0, listLunarItem3.Count)];
				}
			}
			orig.Invoke(self, newPickup, newHidden);
		}

		public void SpawnLunarCauldron()
		{
			//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_0075: Unknown result type (might be due to invalid IL or missing references)
			//IL_007a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0096: Unknown result type (might be due to invalid IL or missing references)
			if (ModConfig.CauldronAmount.Value > 0)
			{
				DicCauldrons.Clear();
				SetCauldron();
				int num = 0;
				num = ((!ModConfig.SpawnCountByStage.Value) ? ModConfig.CauldronAmount.Value : SetCountbyGameStage(ModConfig.CauldronAmount.Value, ModConfig.SpawnCountOffset.Value));
				for (int i = 0; i < num; i++)
				{
					GameObject obj = Object.Instantiate<GameObject>(GetRandomLunarCauldron().WaitForCompletion(), DicCauldrons[i].Position, Quaternion.identity);
					obj.transform.eulerAngles = DicCauldrons[i].Rotation;
					NetworkServer.Spawn(obj);
				}
			}
		}

		private void SetCauldron()
		{
			//IL_008a: 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_00d2: 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_011a: 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_0162: Unknown result type (might be due to invalid IL or missing references)
			//IL_0176: 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)
			//IL_01be: 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_0206: 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_024e: Unknown result type (might be due to invalid IL or missing references)
			List<int> list = new List<int> { 0, 1, 2, 3, 4, 5, 6 };
			List<int> list2 = new List<int>();
			while (list.Count > 0)
			{
				int index = RNG.Next(list.Count);
				list2.Add(list[index]);
				list.RemoveAt(index);
			}
			DicCauldrons.Add(list2[0], new SpawnCardStruct(new Vector3(-115.9816f, -24.1175f, -6.2091f), new Vector3(0f, 120f, 0f)));
			DicCauldrons.Add(list2[1], new SpawnCardStruct(new Vector3(-119.928f, -24.1238f, -7.0865f), new Vector3(0f, 140f, 0f)));
			DicCauldrons.Add(list2[2], new SpawnCardStruct(new Vector3(-123.4725f, -23.7951f, -5.469f), new Vector3(0f, 160f, 0f)));
			DicCauldrons.Add(list2[3], new SpawnCardStruct(new Vector3(-107.8159f, -23.8448f, -4.517f), new Vector3(0f, 130f, 0f)));
			DicCauldrons.Add(list2[4], new SpawnCardStruct(new Vector3(-101.2425f, -24.8612f, -9.1464f), new Vector3(0f, 160f, 0f)));
			DicCauldrons.Add(list2[5], new SpawnCardStruct(new Vector3(-98.5219f, -25.6548f, -12.3659f), new Vector3(0f, 155f, 0f)));
			DicCauldrons.Add(list2[6], new SpawnCardStruct(new Vector3(-94.6071f, -25.8717f, -13.6159f), new Vector3(0f, 135f, 0f)));
		}

		private void CauldronHacked_SetPickupIndex(ShopTerminalBehavior self, out List<PickupIndex> listLunarItem)
		{
			listLunarItem = new List<PickupIndex>();
			if (((Object)self).name.EndsWith("Yellow"))
			{
				listLunarItem.AddRange(Run.instance.availableBossDropList);
			}
			if (((Object)self).name.EndsWith("Blue"))
			{
				listLunarItem.AddRange(Run.instance.availableLunarItemDropList);
			}
			if (((Object)self).name.EndsWith("Purple"))
			{
				listLunarItem.AddRange(Run.instance.availableVoidTier1DropList);
				listLunarItem.AddRange(Run.instance.availableVoidTier2DropList);
				listLunarItem.AddRange(Run.instance.availableVoidTier3DropList);
				listLunarItem.AddRange(Run.instance.availableVoidBossDropList);
			}
		}

		private AsyncOperationHandle<GameObject> GetRandomLunarCauldron()
		{
			//IL_0044: 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_0059: Unknown result type (might be due to invalid IL or missing references)
			float value = ModConfig.CauldronWhiteToGreenWeight.Value;
			float value2 = ModConfig.CauldronGreenToRedWeight.Value;
			float value3 = ModConfig.CauldronRedToWhiteWeight.Value;
			float num = value + value2 + value3;
			double num2 = RNG.NextDouble() * (double)num;
			if (num2 <= (double)value)
			{
				return LunarCauldronsCode[0];
			}
			if (num2 <= (double)(value + value2))
			{
				return LunarCauldronsCode[1];
			}
			return LunarCauldronsCode[2];
		}
	}
	public class BazaarCleansingPool : BazaarBase
	{
		private AsyncOperationHandle<InteractableSpawnCard> iscShrineCleanse;

		private AsyncOperationHandle<GameObject> lunarShopTerminal;

		private AsyncOperationHandle<GameObject> duplicator;

		private AsyncOperationHandle<InteractableSpawnCard> iscDuplicator;

		private AsyncOperationHandle<GameObject> SingleLunarShop;

		private Dictionary<int, SpawnCardStruct> DicLunarPools = new Dictionary<int, SpawnCardStruct>();

		public override void Preload()
		{
			//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_001b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0026: Unknown result type (might be due to invalid IL or missing references)
			//IL_002b: Unknown result type (might be due to invalid IL or missing references)
			//IL_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_0046: 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)
			iscDuplicator = Addressables.LoadAssetAsync<InteractableSpawnCard>((object)"RoR2/Base/Duplicator/iscDuplicator.asset");
			duplicator = Addressables.LoadAssetAsync<GameObject>((object)"RoR2/Base/Duplicator/Duplicator.prefab");
			iscShrineCleanse = Addressables.LoadAssetAsync<InteractableSpawnCard>((object)"RoR2/Base/ShrineCleanse/iscShrineCleanse.asset");
			lunarShopTerminal = Addressables.LoadAssetAsync<GameObject>((object)"RoR2/Base/LunarShopTerminal/LunarShopTerminal.prefab");
			SingleLunarShop = Addressables.LoadAssetAsync<GameObject>((object)"RoR2/Junk/SingleLunarShop.prefab");
		}

		public override void Hook()
		{
			//IL_0007: Unknown result type (might be due to invalid IL or missing references)
			//IL_0011: Expected O, but got Unknown
			ShopTerminalBehavior.SetPickup += new hook_SetPickup(ShopTerminalBehavior_SetPickup);
		}

		public override void RunStart()
		{
		}

		public override void SetupBazaar()
		{
			if (ModConfig.CleansingPoolSectionEnabled.Value)
			{
				SpawnShrineCleanse();
			}
		}

		private void ShopTerminalBehavior_SetPickup(orig_SetPickup orig, ShopTerminalBehavior self, UniquePickup newPickup, bool newHidden)
		{
			//IL_0099: 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_0054: 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_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_0081: Unknown result type (might be due to invalid IL or missing references)
			if (ModConfig.EnableMod.Value && ModConfig.CleansingPoolSectionEnabled.Value && ModConfig.CleansingPoolRewardsLunarCoins.Value && IsCurrentMapInBazaar() && NetworkServer.active)
			{
				if (((Object)self).name.StartsWith("ShrineCleanse"))
				{
					newPickup.pickupIndex = PickupCatalog.FindPickupIndex(MiscPickups.LunarCoin.miscPickupIndex);
				}
				if (((Object)self).name.StartsWith("HoveringLunarCoin"))
				{
					newPickup.pickupIndex = PickupCatalog.FindPickupIndex(MiscPickups.LunarCoin.miscPickupIndex);
					((Component)self).gameObject.GetComponent<PurchaseInteraction>().SetAvailable(false);
				}
			}
			orig.Invoke(self, newPickup, newHidden);
		}

		private void SpawnShrineCleanse()
		{
			//IL_0019: 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_0076: 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_00a8: 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_00ce: Unknown result type (might be due to invalid IL or missing references)
			DicLunarPools.Clear();
			SetLunarPool();
			DoSpawnCard(DicLunarPools, iscShrineCleanse, DicLunarPools.Count);
			if (ModConfig.CleansingPoolRewardsLunarCoins.Value)
			{
				GameObject obj = Object.Instantiate<GameObject>(lunarShopTerminal.WaitForCompletion(), DicLunarPools[0].Position, Quaternion.identity);
				obj.transform.localPosition = new Vector3(DicLunarPools[0].Position.x, DicLunarPools[0].Position.y + 0.5f, DicLunarPools[0].Position.z);
				obj.transform.eulerAngles = DicLunarPools[0].Rotation;
				((Object)obj).name = "HoveringLunarCoin";
				NetworkServer.Spawn(obj);
			}
		}

		private void SetLunarPool()
		{
			//IL_0016: 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)
			DicLunarPools.Add(0, new SpawnCardStruct(new Vector3(-71.5092f, -25.5622f, -44.2288f), new Vector3(6.4123f, 0f, 356.459f)));
		}
	}
	public class BazaarDecorate : BazaarBase
	{
		private Dictionary<int, SpawnCardStruct> DicGlodChests = new Dictionary<int, SpawnCardStruct>();

		private Dictionary<int, SpawnCardStruct> DicBigChests = new Dictionary<int, SpawnCardStruct>();

		private Dictionary<int, SpawnCardStruct> DicSmallChests = new Dictionary<int, SpawnCardStruct>();

		private AsyncOperationHandle<InteractableSpawnCard> iscChest1;

		private AsyncOperationHandle<InteractableSpawnCard> iscChest2;

		private AsyncOperationHandle<InteractableSpawnCard> iscGoldChest;

		private AsyncOperationHandle<InteractableSpawnCard> iscShopPortal;

		private AsyncOperationHandle<InteractableSpawnCard> iscDeepVoidPortalBattery;

		private AsyncOperationHandle<GameObject> TeleporterBeaconEffect;

		public override void Preload()
		{
			//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_001b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0026: Unknown result type (might be due to invalid IL or missing references)
			//IL_002b: Unknown result type (might be due to invalid IL or missing references)
			//IL_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_0046: 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)
			iscChest1 = Addressables.LoadAssetAsync<InteractableSpawnCard>((object)"RoR2/Base/Chest1/iscChest1.asset");
			iscChest2 = Addressables.LoadAssetAsync<InteractableSpawnCard>((object)"RoR2/Base/Chest2/iscChest2.asset");
			iscGoldChest = Addressables.LoadAssetAsync<InteractableSpawnCard>((object)"RoR2/Base/GoldChest/iscGoldChest.asset");
			iscShopPortal = Addressables.LoadAssetAsync<InteractableSpawnCard>((object)"RoR2/Base/PortalShop/iscShopPortal.asset");
			TeleporterBeaconEffect = Addressables.LoadAssetAsync<GameObject>((object)"RoR2/Junk/Teleporter/TeleporterBeaconEffect.prefab");
		}

		public override void Hook()
		{
		}

		public override void RunStart()
		{
		}

		public override void SetupBazaar()
		{
			//IL_001c: 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_004a: 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_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_0078: 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_0091: 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_00a6: 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_00bf: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c4: Unknown result type (might be due to invalid IL or missing references)
			if (ModConfig.DecorateBazaar.Value)
			{
				SpawnDecorate();
				SpawnBluePortal();
				BazaarBase.SpawnEffect(TeleporterBeaconEffect, new Vector3(-73.5143f, -22.2897f, 9.1621f), Color32.op_Implicit(Color.blue));
				BazaarBase.SpawnEffect(TeleporterBeaconEffect, new Vector3(-57.0645f, -22.2698f, -0.5218f), Color32.op_Implicit(Color.blue));
				BazaarBase.SpawnEffect(TeleporterBeaconEffect, new Vector3(15.7063f, -2.1074f, 2.5406f), Color32.op_Implicit(Color.blue));
				BazaarBase.SpawnEffect(TeleporterBeaconEffect, new Vector3(2.5543f, -2.7093f, -8.7185f), Color32.op_Implicit(Color.blue));
			}
		}

		private void SpawnBluePortal()
		{
			//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_0037: Unknown result type (might be due to invalid IL or missing references)
			//IL_0041: Expected O, but got Unknown
			//IL_003c: 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)
			SpawnCard val = (SpawnCard)(object)iscShopPortal.WaitForCompletion();
			val.DoSpawn(new Vector3(-135f, -23f, -60f), Quaternion.identity, new DirectorSpawnRequest(val, DirectPlacement, Run.instance.runRNG)).spawnedInstance.transform.eulerAngles = new Vector3(0f, 220f, 0f);
		}

		private void SetDecorate()
		{
			//IL_006e: 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_00b6: 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_00fe: 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_01a2: 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_01ea: Unknown result type (might be due to invalid IL or missing references)
			//IL_01fe: Unknown result type (might be due to invalid IL or missing references)
			//IL_0232: 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_027a: 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_032c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0340: Unknown result type (might be due to invalid IL or missing references)
			//IL_0374: 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_03bc: 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_0404: Unknown result type (might be due to invalid IL or missing references)
			//IL_0418: 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_0460: Unknown result type (might be due to invalid IL or missing references)
			//IL_0494: Unknown result type (might be due to invalid IL or missing references)
			//IL_04a8: Unknown result type (might be due to invalid IL or missing references)
			List<int> list = new List<int> { 0, 1, 2 };
			List<int> list2 = new List<int>();
			while (list.Count > 0)
			{
				int index = RNG.Next(list.Count);
				list2.Add(list[index]);
				list.RemoveAt(index);
			}
			DicGlodChests.Add(list2[0], new SpawnCardStruct(new Vector3(-127.7178f, -23.5346f, -60.0732f), new Vector3(350f, 0f, 0f)));
			DicGlodChests.Add(list2[1], new SpawnCardStruct(new Vector3(-129.2f, -22.7723f, -63.2481f), new Vector3(350f, 150f, 350f)));
			DicGlodChests.Add(list2[2], new SpawnCardStruct(new Vector3(-126.5934f, -22.815f, -62.1658f), new Vector3(357.8401f, 341.0997f, 330f)));
			list = new List<int> { 0, 1, 2, 3 };
			list2 = new List<int>();
			while (list.Count > 0)
			{
				int index2 = RNG.Next(list.Count);
				list2.Add(list[index2]);
				list.RemoveAt(index2);
			}
			DicBigChests.Add(list2[0], new SpawnCardStruct(new Vector3(-134.5802f, -25.3546f, -68.1701f), new Vector3(333.3292f, 136.2832f, 335.803f)));
			DicBigChests.Add(list2[1], new SpawnCardStruct(new Vector3(-134.7337f, -26.2325f, -67.6419f), new Vector3(333.3292f, 136.2832f, 335.803f)));
			DicBigChests.Add(list2[2], new SpawnCardStruct(new Vector3(-132.4877f, -25.2405f, -66.5167f), new Vector3(22.3718f, 143.4671f, 327.6613f)));
			DicBigChests.Add(list2[3], new SpawnCardStruct(new Vector3(-132.7968f, -25.409f, -65.5423f), new Vector3(22.3718f, 143.4671f, 327.6613f)));
			list = new List<int> { 0, 1, 2, 3, 4, 5 };
			list2 = new List<int>();
			while (list.Count > 0)
			{
				int index3 = RNG.Next(list.Count);
				list2.Add(list[index3]);
				list.RemoveAt(index3);
			}
			DicSmallChests.Add(list2[0], new SpawnCardStruct(new Vector3(-133.4579f, -25.3303f, -68.7228f), new Vector3(9.6318f, 138.4325f, 358.917f)));
			DicSmallChests.Add(list2[1], new SpawnCardStruct(new Vector3(-135.1821f, -25.4367f, -70.568f), new Vector3(18.5215f, 90.3934f, 352.1391f)));
			DicSmallChests.Add(list2[2], new SpawnCardStruct(new Vector3(-136.5309f, -25.5333f, -70.1181f), new Vector3(2.2523f, 116.0182f, 18.9676f)));
			DicSmallChests.Add(list2[3], new SpawnCardStruct(new Vector3(-137.627f, -25.5271f, -69.0357f), new Vector3(15.987f, 225.1928f, 1.5787f)));
			DicSmallChests.Add(list2[4], new SpawnCardStruct(new Vector3(-137.2342f, -25.4021f, -66.4729f), new Vector3(28.129f, 313.1049f, 21.9359f)));
			DicSmallChests.Add(list2[5], new SpawnCardStruct(new Vector3(-140.2227f, -25.6923f, -67.7525f), new Vector3(9.4325f, 192.0851f, 17.5428f)));
		}

		private void SpawnDecorate()
		{
			//IL_002f: 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_00b1: Unknown result type (might be due to invalid IL or missing references)
			DicGlodChests.Clear();
			DicBigChests.Clear();
			DicSmallChests.Clear();
			SetDecorate();
			DoSpawnCard(DicGlodChests, iscGoldChest, DicGlodChests.Count).ForEach(delegate(GameObject gameObject)
			{
				gameObject.GetComponent<PurchaseInteraction>().SetAvailable(false);
			});
			DoSpawnCard(DicBigChests, iscChest2, DicBigChests.Count).ForEach(delegate(GameObject gameObject)
			{
				gameObject.GetComponent<PurchaseInteraction>().SetAvailable(false);
			});
			DoSpawnCard(DicSmallChests, iscChest1, DicSmallChests.Count).ForEach(delegate(GameObject gameObject)
			{
				gameObject.GetComponent<PurchaseInteraction>().SetAvailable(false);
			});
		}
	}
	public class BazaarDonate : BazaarBase
	{
		private AsyncOperationHandle<GameObject> BlueprintStation;

		private AsyncOperationHandle<GameObject> LevelUpEffect;

		private AsyncOperationHandle<GameObject> MoneyPackPickupEffect;

		private AsyncOperationHandle<GameObject> TeamWarCryActivation;

		private AsyncOperationHandle<GameObject> ShrineUseEffect;

		private readonly Dictionary<PlayerCharacterMasterController, int> donationsDuringRun = new Dictionary<PlayerCharacterMasterController, int>();

		public override void Preload()
		{
			//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_001b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0026: Unknown result type (might be due to invalid IL or missing references)
			//IL_002b: Unknown result type (might be due to invalid IL or missing references)
			//IL_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_0046: 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)
			BlueprintStation = Addressables.LoadAssetAsync<GameObject>((object)"RoR2/Junk/BlueprintStation.prefab");
			LevelUpEffect = Addressables.LoadAssetAsync<GameObject>((object)"RoR2/Base/Common/VFX/LevelUpEffect.prefab");
			MoneyPackPickupEffect = Addressables.LoadAssetAsync<GameObject>((object)"RoR2/Base/BonusGoldPackOnKill/MoneyPackPickupEffect.prefab");
			TeamWarCryActivation = Addressables.LoadAssetAsync<GameObject>((object)"RoR2/Base/TeamWarCry/TeamWarCryActivation.prefab");
			ShrineUseEffect = Addressables.LoadAssetAsync<GameObject>((object)"RoR2/Base/Common/VFX/ShrineUseEffect.prefab");
		}

		public override void Hook()
		{
			//IL_0007: Unknown result type (might be due to invalid IL or missing references)
			//IL_0011: Expected O, but got Unknown
			//IL_0018: Unknown result type (might be due to invalid IL or missing references)
			//IL_0022: Expected O, but got Unknown
			PurchaseInteraction.OnInteractionBegin += new hook_OnInteractionBegin(PurchaseInteraction_OnInteractionBegin);
			BlueprintTerminal.Rebuild += new hook_Rebuild(BlueprintTerminal_Rebuild);
		}

		public override void RunStart()
		{
			donationsDuringRun.Clear();
		}

		public override void SetupBazaar()
		{
			if (ModConfig.DonateSectionEnabled.Value)
			{
				SpawnDonateAltar();
			}
		}

		public void BlueprintTerminal_Rebuild(orig_Rebuild orig, BlueprintTerminal self)
		{
			if ((ModConfig.EnableMod.Value & ModConfig.DonateSectionEnabled.Value) && IsCurrentMapInBazaar() && NetworkServer.active && ((Object)self).name.StartsWith("BlueprintStation"))
			{
				PurchaseInteraction component = ((Component)self).GetComponent<PurchaseInteraction>();
				if ((Object)(object)component != (Object)null)
				{
					component.cost = ModConfig.DonateCost.Value;
					component.Networkcost = ModConfig.DonateCost.Value;
				}
			}
			else
			{
				orig.Invoke(self);
			}
		}

		private void PurchaseInteraction_OnInteractionBegin(orig_OnInteractionBegin orig, PurchaseInteraction self, Interactor activator)
		{
			//IL_00ea: 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_0108: Unknown result type (might be due to invalid IL or missing references)
			if ((ModConfig.EnableMod.Value & ModConfig.DonateSectionEnabled.Value) && IsCurrentMapInBazaar() && NetworkServer.active && ((Object)self).name.StartsWith("BlueprintStation"))
			{
				NetworkUser val = Util.LookUpBodyNetworkUser(((Component)activator).gameObject);
				CharacterMaster master = ((Component)activator).GetComponent<CharacterBody>().master;
				CharacterBody component = ((Component)activator).GetComponent<CharacterBody>();
				Inventory inventory = component.inventory;
				PlayerCharacterMasterController playerCharacterMasterController = master.playerCharacterMasterController;
				PlayerStruct playerStruct = Main.instance.GetPlayerStruct(playerCharacterMasterController);
				if (playerStruct.RewardCount < ModConfig.DonateRewardLimitPerVisit.Value && donationsDuringRun.GetValueOrDefault(playerCharacterMasterController) < ModConfig.DonateRewardLimitPerRun.Value)
				{
					GiftReward(self, val, component, inventory, donationsDuringRun.GetValueOrDefault(playerCharacterMasterController));
					playerStruct.RewardCount++;
					donationsDuringRun[playerCharacterMasterController] = donationsDuringRun.GetValueOrDefault(playerCharacterMasterController) + 1;
					BazaarBase.SpawnEffect(ShrineUseEffect, ((Component)self).transform.position, new Color32((byte)64, (byte)127, byte.MaxValue, byte.MaxValue), 5f);
					val.DeductLunarCoins((uint)self.Networkcost);
				}
			}
			else
			{
				orig.Invoke(self, activator);
			}
		}

		private void GiftReward(PurchaseInteraction self, NetworkUser networkUser, CharacterBody characterBody, Inventory inventory, int donations)
		{
			//IL_01b6: 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_01e5: 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_01f4: 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_0274: 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_029d: Unknown result type (might be due to invalid IL or missing references)
			//IL_02a8: Unknown result type (might be due to invalid IL or missing references)
			//IL_02c1: Unknown result type (might be due to invalid IL or missing references)
			//IL_02d1: Unknown result type (might be due to invalid IL or missing references)
			//IL_02dc: 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)
			int num = 0;
			if (ModConfig.DonateSequentialRewardLists.Value)
			{
				List<(float, int)> list = new List<(float, int)>
				{
					(ModConfig.DonateRewardList1Weight.Value, 1),
					(ModConfig.DonateRewardList2Weight.Value, 2),
					(ModConfig.DonateRewardList3Weight.Value, 3),
					(ModConfig.DonateRewardListCharacterWeight.Value, 4)
				};
				list.RemoveAll(((float weight, int tier) item) => item.weight == 0f);
				list.Sort(((float weight, int tier) a, (float weight, int tier) b) => b.weight.CompareTo(a.weight));
				num = list[donations % list.Count].Item2;
			}
			else
			{
				float value = ModConfig.DonateRewardList1Weight.Value;
				float value2 = ModConfig.DonateRewardList2Weight.Value;
				float value3 = ModConfig.DonateRewardList3Weight.Value;
				float value4 = ModConfig.DonateRewardListCharacterWeight.Value;
				double num2 = RNG.NextDouble() * (double)(value + value2 + value3 + value4);
				num = ((num2 <= (double)value) ? 1 : ((num2 <= (double)(value + value2)) ? 2 : ((!(num2 <= (double)(value + value2 + value3))) ? 4 : 3)));
			}
			Dictionary<PickupIndex, int> dictionary = new Dictionary<PickupIndex, int>();
			switch (num)
			{
			case 1:
				ItemStringParser.ParseItemString(ModConfig.DonateRewardList1.Value, dictionary, Log.GetSource(), false, -1);
				break;
			case 2:
				ItemStringParser.ParseItemString(ModConfig.DonateRewardList2.Value, dictionary, Log.GetSource(), false, -1);
				break;
			case 3:
				ItemStringParser.ParseItemString(ModConfig.DonateRewardList3.Value, dictionary, Log.GetSource(), false, -1);
				break;
			case 4:
				ItemStringParser.ParseItemString(ModConfig.DonateRewardListCharacters.GetValueOrDefault(characterBody.bodyIndex, ModConfig.DonateRewardListCharacterDefault).Value, dictionary, Log.GetSource(), false, -1);
				break;
			}
			Helper.GivePickups(characterBody, dictionary, ((Component)self).transform.position + Vector3.up * 6f, dropReplacedEquipmentsAsPickupDroplets: true);
			switch (num)
			{
			case 1:
				ChatHelper.ThanksTipNormal(networkUser, characterBody.master.playerCharacterMasterController, dictionary);
				break;
			case 2:
				ChatHelper.ThanksTipElite(networkUser, characterBody.master.playerCharacterMasterController, dictionary);
				break;
			case 3:
				ChatHelper.ThanksTipPeculiar(networkUser, characterBody.master.playerCharacterMasterController, dictionary);
				break;
			case 4:
				ChatHelper.ThanksTipCharacter(networkUser, characterBody.master.playerCharacterMasterController, dictionary);
				break;
			}
			BazaarBase.SpawnEffect(LevelUpEffect, ((Component)self).transform.position, new Color32(byte.MaxValue, byte.MaxValue, byte.MaxValue, byte.MaxValue), 3f);
			BazaarBase.SpawnEffect(MoneyPackPickupEffect, ((Component)self).transform.position, new Color32(byte.MaxValue, byte.MaxValue, byte.MaxValue, byte.MaxValue), 3f);
			BazaarBase.SpawnEffect(TeamWarCryActivation, ((Component)self).transform.position, new Color32(byte.MaxValue, byte.MaxValue, byte.MaxValue, byte.MaxValue), 3f);
		}

		private void SpawnDonateAltar()
		{
			//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_003e: Unknown result type (might be due to invalid IL or missing references)
			GameObject obj = Object.Instantiate<GameObject>(BlueprintStation.WaitForCompletion(), new Vector3(-117.1011f, -24.1373f, -48.4219f), Quaternion.identity);
			obj.transform.eulerAngles = new Vector3(0f, 300f, 0f);
			obj.GetComponent<PurchaseInteraction>().cost = ModConfig.DonateCost.Value;
			obj.GetComponent<PurchaseInteraction>().Networkcost = ModConfig.DonateCost.Value;
			obj.GetComponent<PurchaseInteraction>().contextToken = "NEWT_STATUE_CONTEXT";
			obj.GetComponent<PurchaseInteraction>().NetworkcontextToken = "NEWT_STATUE_CONTEXT";
			NetworkServer.Spawn(obj);
		}
	}
	public class BazaarEquipment : BazaarBase
	{
		private AsyncOperationHandle<GameObject> multiShopEquipmentTerminal;

		private Dictionary<int, SpawnCardStruct> DicEquipments = new Dictionary<int, SpawnCardStruct>();

		private PlayerCharacterMasterController currentActivator;

		public override void Preload()
		{
			//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)
			multiShopEquipmentTerminal = Addressables.LoadAssetAsync<GameObject>((object)"RoR2/Base/MultiShopEquipmentTerminal/MultiShopEquipmentTerminal.prefab");
		}

		public override void Hook()
		{
			//IL_0007: Unknown result type (might be due to invalid IL or missing references)
			//IL_0011: Expected O, but got Unknown
			//IL_0018: Unknown result type (might be due to invalid IL or missing references)
			//IL_0022: Expected O, but got Unknown
			//IL_0029: Unknown result type (might be due to invalid IL or missing references)
			//IL_0033: Expected O, but got Unknown
			//IL_003a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0044: Expected O, but got Unknown
			PurchaseInteraction.Awake += new hook_Awake(PurchaseInteraction_Awake);
			PurchaseInteraction.OnInteractionBegin += new hook_OnInteractionBegin(PurchaseInteraction_OnInteractionBegin);
			ShopTerminalBehavior.DropPickup += new hook_DropPickup(ShopTerminalBehavior_DropPickup);
			ShopTerminalBehavior.GenerateNewPickupServer_bool += new hook_GenerateNewPickupServer_bool(ShopTerminalBehavior_GenerateNewPickupServer_bool);
		}

		public override void RunStart()
		{
		}

		public override void SetupBazaar()
		{
			if (ModConfig.EquipmentSectionEnabled.Value)
			{
				SpawnEquipment();
			}
		}

		public void PurchaseInteraction_Awake(orig_Awake orig, PurchaseInteraction self)
		{
			orig.Invoke(self);
			if (ModConfig.EnableMod.Value && ModConfig.EquipmentSectionEnabled.Value && IsCurrentMapInBazaar() && NetworkServer.active && ModConfig.EquipmentAmount.Value > 0 && ((Object)self).name.StartsWith("MultiShopEquipmentTerminal"))
			{
				self.cost = ModConfig.EquipmentCost.Value;
				self.Networkcost = ModConfig.EquipmentCost.Value;
			}
		}

		private void PurchaseInteraction_OnInteractionBegin(orig_OnInteractionBegin orig, PurchaseInteraction self, Interactor activator)
		{
			if (ModConfig.EnableMod.Value && ModConfig.EquipmentSectionEnabled.Value && IsCurrentMapInBazaar() && NetworkServer.active && ((Object)self).name.StartsWith("MultiShopEquipmentTerminal"))
			{
				PlayerCharacterMasterController playerCharacterMasterController = ((Component)activator).GetComponent<CharacterBody>().master.playerCharacterMasterController;
				try
				{
					currentActivator = playerCharacterMasterController;
					orig.Invoke(self, activator);
					return;
				}
				finally
				{
					currentActivator = null;
				}
			}
			orig.Invoke(self, activator);
		}

		private void ShopTerminalBehavior_DropPickup(orig_DropPickup orig, ShopTerminalBehavior self)
		{
			//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_0080: 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_008b: 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_008e: Invalid comparison between Unknown and I4
			//IL_0091: Unknown result type (might be due to invalid IL or missing references)
			//IL_0092: Unknown result type (might be due to invalid IL or missing references)
			//IL_0097: Unknown result type (might be due to invalid IL or missing references)
			if (ModConfig.EnableMod.Value && ModConfig.EquipmentSectionEnabled.Value && IsCurrentMapInBazaar() && NetworkServer.active && ((Object)self).name.StartsWith("MultiShopEquipmentTerminal"))
			{
				if (ModConfig.EquipmentBuyToInventory.Value)
				{
					CharacterBody body = currentActivator.master.GetBody();
					if ((Object)(object)body != (Object)null)
					{
						EquipmentIndex val = Helper.GivePickup(body, self.CurrentPickup().pickupIndex, ((Component)self).transform.position, dropReplacedEquipmentAsPickupDroplet: false);
						if ((int)val != -1)
						{
							self.SetPickup(new UniquePickup(PickupCatalog.FindPickupIndex(val)), false);
							((Component)self).GetComponent<PurchaseInteraction>().SetAvailable(true);
						}
						else
						{
							self.SetHasBeenPurchased(true);
							self.SetNoPickup();
						}
					}
				}
				else
				{
					orig.Invoke(self);
					self.SetNoPickup();
				}
			}
			else
			{
				orig.Invoke(self);
			}
		}

		private void ShopTerminalBehavior_GenerateNewPickupServer_bool(orig_GenerateNewPickupServer_bool orig, ShopTerminalBehavior self, bool newHidden)
		{
			//IL_00a3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ac: 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)
			if (ModConfig.EnableMod.Value && ModConfig.EquipmentSectionEnabled.Value && IsCurrentMapInBazaar() && NetworkServer.active && ((Object)self).name.StartsWith("MultiShopEquipmentTerminal") && Run.instance.stageRng.nextNormalizedFloat < ModConfig.EquipmentReplaceWithEliteChance.Value)
			{
				Dictionary<PickupIndex, int> dictionary = new Dictionary<PickupIndex, int>();
				ItemStringParser.ParseItemString(ModConfig.EquipmentReplaceWithEliteList.Value, dictionary, Log.GetSource(), false, -1);
				bool flag = false;
				foreach (var (val2, num2) in dictionary)
				{
					if (num2 > 0)
					{
						self.SetPickup(new UniquePickup(val2), newHidden);
						flag = true;
						return;
					}
				}
				if (!flag)
				{
					Log.LogError("Could not get a proper pickup index from EquipmentReplaceWithEliteList: " + ModConfig.EquipmentReplaceWithEliteList.Value);
				}
			}
			orig.Invoke(self, newHidden);
		}

		private void SetEquipment()
		{
			//IL_005b: 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_009d: 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_011c: 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_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)
			//IL_01ac: 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)
			List<int> list = new List<int> { 0, 1, 2 };
			if (ModConfig.EquipmentReplaceLunarSeersWithEquipment.Value)
			{
				list = new List<int> { 2, 3, 4 };
				DicEquipments.Add(0, new SpawnCardStruct(new Vector3(-133.9731f, -23.4f, -10.71112f), new Vector3(0f, 120f, 0f)));
				DicEquipments.Add(1, new SpawnCardStruct(new Vector3(-128.0793f, -23.4f, -7.056283f), new Vector3(0f, 160f, 0f)));
			}
			List<int> list2 = new List<int>();
			while (list.Count > 0)
			{
				int index = RNG.Next(list.Count);
				list2.Add(list[index]);
				list.RemoveAt(index);
			}
			DicEquipments.Add(list2[0], new SpawnCardStruct(new Vector3(-139.5818f, -23.561f, -1.7491f), new Vector3(0f, 175f, 0f)));
			DicEquipments.Add(list2[1], new SpawnCardStruct(new Vector3(-136.5639f, -23.7163f, -0.5618f), new Vector3(0f, 145f, 0f)));
			DicEquipments.Add(list2[2], new SpawnCardStruct(new Vector3(-134.82f, -23.36f, 1.85f), new Vector3(0f, 105f, 0f)));
		}

		private void SpawnEquipment()
		{
			//IL_0055: Unknown result type (might be due to invalid IL or missing references)
			if (ModConfig.EquipmentAmount.Value <= 0)
			{
				return;
			}
			DicEquipments.Clear();
			SetEquipment();
			int num = ModConfig.EquipmentAmount.Value;
			if (!ModConfig.EquipmentReplaceLunarSeersWithEquipment.Value && num > 3)
			{
				num = 3;
			}
			if (ModConfig.EquipmentReplaceLunarSeersWithEquipment.Value && num > 5)
			{
				num = 5;
			}
			DoSpawnGameObject(DicEquipments, multiShopEquipmentTerminal, num).ForEach(delegate(GameObject gameObject)
			{
				//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)
				PurchaseInteraction component = gameObject.GetComponent<PurchaseInteraction>();
				ShopTerminalBehavior component2 = gameObject.GetComponent<ShopTerminalBehavior>();
				if (ModConfig.EquipmentInstancedPurchases.Value)
				{
					InstancedPurchase instancedPurchase = gameObject.AddComponent<InstancedPurchase>();
					instancedPurchase.original.available = component.available;
					instancedPurchase.original.pickup = component2.pickup;
					instancedPurchase.original.hasBeenPurchased = component2.hasBeenPurchased;
				}
			});
		}
	}
	public class BazaarLunarShop : BazaarBase
	{
		[CompilerGenerated]
		private sealed class <DelayRerollEffect>d__20 : IEnumerator<object>, IEnumerator, IDisposable
		{
			private int <>1__state;

			private object <>2__current;

			public float time;

			public BazaarLunarShop <>4__this;

			public int itemIndex;

			public GameObject lunarShopTerminal;

			object IEnumerator<object>.Current
			{
				[DebuggerHidden]
				get
				{
					return <>2__current;
				}
			}

			object IEnumerator.Current
			{
				[DebuggerHidden]
				get
				{
					return <>2__current;
				}
			}

			[DebuggerHidden]
			public <DelayRerollEffect>d__20(int <>1__state)
			{
				this.<>1__state = <>1__state;
			}

			[DebuggerHidden]
			void IDisposable.Dispose()
			{
				<>1__state = -2;
			}

			private bool MoveNext()
			{
				//IL_0025: Unknown result type (might be due to invalid IL or missing references)
				//IL_002f: Expected O, but got Unknown
				//IL_005c: 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_0071: 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_0080: 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)
				int num = <>1__state;
				BazaarLunarShop bazaarLunarShop = <>4__this;
				switch (num)
				{
				default:
					return false;
				case 0:
					<>1__state = -1;
					<>2__current = (object)new WaitForSeconds(time);
					<>1__state = 1;
					return true;
				case 1:
					<>1__state = -1;
					bazaarLunarShop.generateNewPickupIndex = itemIndex;
					lunarShopTerminal.GetComponent<ShopTerminalBehavior>().GenerateNewPickupServer();
					BazaarBase.SpawnEffect(bazaarLunarShop.LunarRerollEffect, lunarShopTerminal.transform.position - Vector3.up * 2.5f, new Color32(byte.MaxValue, byte.MaxValue, byte.MaxValue, byte.MaxValue), 2f);
					return false;
				}
			}

			bool IEnumerator.MoveNext()
			{
				//ILSpy generated this explicit interface implementation from .override directive in MoveNext
				return this.MoveNext();
			}

			[DebuggerHidden]
			void IEnumerator.Reset()
			{
				throw new NotSupportedException();
			}
		}

		private AsyncOperationHandle<GameObject> lunarShopTerminal;

		private AsyncOperationHandle<GameObject> LunarRerollEffect;

		private Dictionary<int, SpawnCardStruct> DicLunarShopTerminals = new Dictionary<int, SpawnCardStruct>();

		private int currentLunarShopStaticItemIndex;

		private int generateNewPickupIndex;

		private int lunarRecyclerRerolledCount;

		private List<GameObject> ObjectLunarShopTerminals_Spawn = new List<GameObject>();

		private PlayerCharacterMasterController currentActivator;

		private Dictionary<PurchaseInteraction, List<PlayerCharacterMasterController>> whichStallsHaveBeenBoughtOnce = new Dictionary<PurchaseInteraction, List<PlayerCharacterMasterController>>();

		public override void Preload()
		{
			//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_001b: Unknown result type (might be due to invalid IL or missing references)
			lunarShopTerminal = Addressables.LoadAssetAsync<GameObject>((object)"RoR2/DLC1/FreeChestTerminalShippingDrone/FreeChestTerminalShippingDrone.prefab");
			LunarRerollEffect = Addressables.LoadAssetAsync<GameObject>((object)"RoR2/Base/LunarRecycler/LunarRerollEffect.prefab");
		}

		public override void Hook()
		{
			//IL_0007: Unknown result type (might be due to invalid IL or missing references)
			//IL_0011: Expected O, but got Unknown
			//IL_0018: Unknown result type (might be due to invalid IL or missing references)
			//IL_0022: Expected O, but got Unknown
			//IL_0029: Unknown result type (might be due to invalid IL or missing references)
			//IL_0033: Expected O, but got Unknown
			//IL_003a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0044: Expected O, but got Unknown
			//IL_004b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0055: Expected O, but got Unknown
			//IL_005c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0066: Expected O, but got Unknown
			//IL_006d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0077: Expected O, but got Unknown
			PurchaseInteraction.Awake += new hook_Awake(PurchaseInteraction_Awake);
			PurchaseInteraction.OnInteractionBegin += new hook_OnInteractionBegin(PurchaseInteraction_OnInteractionBegin);
			PurchaseInteraction.OnInteractionBegin += new Manipulator(PurchaseInteraction_OnInteractionEnd);
			PurchaseInteraction.ScaleCost += new hook_ScaleCost(PurchaseInteraction_ScaleCost);
			PurchaseInteraction.SetAvailable += new hook_SetAvailable(PurchaseInteraction_SetAvailable);
			ShopTerminalBehavior.DropPickup += new hook_DropPickup(ShopTerminalBehavior_DropPickup);
			ShopTerminalBehavior.GenerateNewPickupServer_bool += new hook_GenerateNewPickupServer_bool(ShopTerminalBehavior_GenerateNewPickupServer_bool);
		}

		public override void RunStart()
		{
		}

		public override void SetupBazaar()
		{
			if (ModConfig.LunarRecyclerSectionEnabled.Value)
			{
				lunarRecyclerRerolledCount = 0;
			}
			if (ModConfig.LunarShopSectionEnabled.Value)
			{
				currentLunarShopStaticItemIndex = 0;
				whichStallsHaveBeenBoughtOnce.Clear();
				SpawnLunarShopTerminal();
			}
		}

		public void PurchaseInteraction_Awake(orig_Awake orig, PurchaseInteraction self)
		{
			orig.Invoke(self);
			if (!ModConfig.EnableMod.Value || !IsCurrentMapInBazaar() || !NetworkServer.active)
			{
				return;
			}
			if (ModConfig.LunarShopSectionEnabled.Value && ModConfig.LunarShopCost.Value >= 0 && ((Object)self).name.StartsWith("LunarShopTerminal"))
			{
				self.cost = ModConfig.LunarShopCost.Value;
				self.Networkcost = ModConfig.LunarShopCost.Value;
			}
			if (ModConfig.LunarRecyclerSectionEnabled.Value && ((Object)self).name.StartsWith("LunarRecycler"))
			{
				if (ModConfig.LunarRecyclerAvailable.Value && ModConfig.LunarRecyclerCost.Value >= 0)
				{
					self.cost = ModConfig.LunarRecyclerCost.Value;
					self.Networkcost = ModConfig.LunarRecyclerCost.Value;
				}
				else
				{
					NetworkServer.Destroy(((Component)self).gameObject);
				}
			}
		}

		public void PurchaseInteraction_OnInteractionBegin(orig_OnInteractionBegin orig, PurchaseInteraction self, Interactor activator)
		{
			if (ModConfig.EnableMod.Value && ModConfig.LunarShopSectionEnabled.Value && IsCurrentMapInBazaar() && NetworkServer.active && ((Object)self).name.StartsWith("LunarShopTerminal"))
			{
				PlayerCharacterMasterController playerCharacterMasterController = ((Component)activator).GetComponent<CharacterBody>().master.playerCharacterMasterController;
				PlayerStruct playerStruct = Main.instance.GetPlayerStruct(playerCharacterMasterController);
				int num = ModConfig.LunarShopBuyLimit.Value - playerStruct.LunarShopUseCount;
				if (num > 0 || ModConfig.LunarShopBuyLimit.Value < 0)
				{
					try
					{
						currentActivator = playerCharacterMasterController;
						orig.Invoke(self, activator);
						return;
					}
					finally
					{
						currentActivator = null;
					}
				}
				ChatHelper.LunarShopTerminalUsesLeft(playerCharacterMasterController, num);
			}
			else
			{
				orig.Invoke(self, activator);
			}
		}

		private void PurchaseInteraction_OnInteractionEnd(ILContext il)
		{
			HookHelper.HookEndOfMethod(il, delegate(PurchaseInteraction self, Interactor activator)
			{
				if (ModConfig.EnableMod.Value && ModConfig.LunarShopSectionEnabled.Value && IsCurrentMapInBazaar() && NetworkServer.active)
				{
					PlayerCharacterMasterController playerCharacterMasterController = ((Component)activator).GetComponent<CharacterBody>().master.playerCharacterMasterController;
					PlayerStruct playerStruct = Main.instance.GetPlayerStruct(playerCharacterMasterController);
					if (((Object)self).name.StartsWith("LunarShopTerminal") && (!whichStallsHaveBeenBoughtOnce.TryGetValue(self, out var value) || !value.Contains(playerCharacterMasterController)))
					{
						playerStruct.LunarShopUseCount++;
						if (ModConfig.LunarShopBuyLimit.Value >= 0)
						{
							int usesLeft = ModConfig.LunarShopBuyLimit.Value - playerStruct.LunarShopUseCount;
							ChatHelper.LunarShopTerminalUsesLeft(playerCharacterMasterController, usesLeft);
						}
						whichStallsHaveBeenBoughtOnce[self].Add(playerCharacterMasterController);
					}
					if (((Object)self).name.StartsWith("LunarRecycler") && ModConfig.LunarShopReplaceLunarBudsWithTerminals.Value)
					{
						float num = 0f;
						foreach (GameObject item in ObjectLunarShopTerminals_Spawn)
						{
							((MonoBehaviour)Main.instance).StartCoroutine(DelayRerollEffect(item, num, currentLunarShopStaticItemIndex));
							currentLunarShopStaticItemIndex++;
							num += 0.1f;
						}
					}
				}
				if (ModConfig.EnableMod.Value && ModConfig.LunarRecyclerSectionEnabled.Value && ModConfig.LunarRecyclerRerollLimit.Value >= 0 && IsCurrentMapInBazaar() && NetworkServer.active && ((Object)self).name.StartsWith("LunarRecycler"))
				{
					lunarRecyclerRerolledCount++;
					ChatHelper.LunarRecyclerUsesLeft(ModConfig.LunarRecyclerRerollLimit.Value - lunarRecyclerRerolledCount);
				}
			});
		}

		private void PurchaseInteraction_ScaleCost(orig_ScaleCost orig, PurchaseInteraction self, float scalar)
		{
			if (ModConfig.EnableMod.Value && ModConfig.LunarRecyclerSectionEnabled.Value && ModConfig.LunarRecyclerAvailable.Value && IsCurrentMapInBazaar() && NetworkServer.active && ((Object)self).name.StartsWith("LunarRecycler"))
			{
				scalar = ModConfig.LunarRecyclerCostMultiplier.Value;
			}
			orig.Invoke(self, scalar);
		}

		private void PurchaseInteraction_SetAvailable(orig_SetAvailable orig, PurchaseInteraction self, bool newAvailable)
		{
			if (ModConfig.EnableMod.Value && ModConfig.LunarRecyclerSectionEnabled.Value && ModConfig.LunarRecyclerAvailable.Value && IsCurrentMapInBazaar() && NetworkServer.active && ((Object)self).name.StartsWith("LunarRecycler"))
			{
				newAvailable = ModConfig.LunarRecyclerRerollLimit.Value < 0 || lunarRecyclerRerolledCount < ModConfig.LunarRecyclerRerollLimit.Value;
			}
			orig.Invoke(self, newAvailable);
		}

		private void ShopTerminalBehavior_DropPickup(orig_DropPickup orig, ShopTerminalBehavior self)
		{
			//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_0080: 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_008b: 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_008e: Invalid comparison between Unknown and I4
			//IL_0091: Unknown result type (might be due to invalid IL or missing references)
			//IL_0092: Unknown result type (might be due to invalid IL or missing references)
			//IL_0097: Unknown result type (might be due to invalid IL or missing references)
			if (ModConfig.EnableMod.Value && ModConfig.LunarShopSectionEnabled.Value && IsCurrentMapInBazaar() && NetworkServer.active && ((Object)self).name.StartsWith("LunarShopTerminal"))
			{
				if (ModConfig.LunarShopBuyToInventory.Value)
				{
					CharacterBody body = currentActivator.master.GetBody();
					if ((Object)(object)body != (Object)null)
					{
						EquipmentIndex val = Helper.GivePickup(body, self.CurrentPickup().pickupIndex, ((Component)self).transform.position, dropReplacedEquipmentAsPickupDroplet: false);
						if ((int)val != -1)
						{
							self.SetPickup(new UniquePickup(PickupCatalog.FindPickupIndex(val)), false);
							((Component)self).GetComponent<PurchaseInteraction>().SetAvailable(true);
						}
						else
						{
							self.SetHasBeenPurchased(true);
							self.SetNoPickup();
						}
					}
				}
				else
				{
					orig.Invoke(self);
					self.SetNoPickup();
				}
			}
			else
			{
				orig.Invoke(self);
			}
		}

		private void ShopTerminalBehavior_GenerateNewPickupServer_bool(orig_GenerateNewPickupServer_bool orig, ShopTerminalBehavior self, bool newHidden)
		{
			//IL_009d: 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_00a7: Unknown result type (might be due to invalid IL or missing references)
			if (ModConfig.EnableMod.Value && ModConfig.LunarShopSectionEnabled.Value && IsCurrentMapInBazaar() && NetworkServer.active && ((Object)self).name.StartsWith("LunarShopTerminal"))
			{
				if (!ModConfig.LunarShopSequentialItems.Value)
				{
					generateNewPickupIndex = -1;
				}
				Dictionary<PickupIndex, int> dictionary = new Dictionary<PickupIndex, int>();
				ItemStringParser.ParseItemString(ModConfig.LunarShopItemList.Value, dictionary, Log.GetSource(), false, generateNewPickupIndex);
				bool flag = false;
				foreach (var (val2, num2) in dictionary)
				{
					if (num2 > 0)
					{
						self.SetPickup(new UniquePickup(val2), newHidden);
						flag = true;
						generateNewPickupIndex++;
						break;
					}
				}
				if (!flag)
				{
					Log.LogError("Could not get a proper pickup index from EquipmentReplaceWithEliteList: " + ModConfig.EquipmentReplaceWithEliteList.Value);
				}
			}
			else
			{
				orig.Invoke(self, newHidden);
			}
		}

		[IteratorStateMachine(typeof(<DelayRerollEffect>d__20))]
		private IEnumerator DelayRerollEffect(GameObject lunarShopTerminal, float time, int itemIndex)
		{
			//yield-return decompiler failed: Unexpected instruction in Iterator.Dispose()
			return new <DelayRerollEffect>d__20(0)
			{
				<>4__this = this,
				lunarShopTerminal = lunarShopTerminal,
				time = time,
				itemIndex = itemIndex
			};
		}

		public static List<Vector2> GenerateCirclePoints(float radius, float startAngle, float endAngle, float orientation, int numberOfPoints)
		{
			//IL_0047: Unknown result type (might be due to invalid IL or missing references)
			List<Vector2> list = new List<Vector2>();
			float num = (endAngle - startAngle) / (float)(numberOfPoints - 1);
			if (numberOfPoints <= 1)
			{
				num = 0f;
			}
			for (int i = 0; i < numberOfPoints; i++)
			{
				float num2 = (startAngle + (float)i * num + orientation) * (MathF.PI / 180f);
				float num3 = radius * Mathf.Cos(num2);
				float num4 = radius * Mathf.Sin(num2);
				list.Add(new Vector2(num3, num4));
			}
			return list;
		}

		private void SetLunarShopTerminal()
		{
			//IL_002b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0245: 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_0264: 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_026e: Unknown result type (might be due to invalid IL or missing references)
			//IL_02cf: Unknown result type (might be due to invalid IL or missing references)
			//IL_02d4: 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_02d8: Unknown result type (might be due to invalid IL or missing references)
			//IL_02da: Unknown result type (might be due to invalid IL or missing references)
			//IL_02df: Unknown result type (might be due to invalid IL or missing references)
			//IL_02e3: Unknown result type (might be due to invalid IL or missing references)
			//IL_02ed: Unknown result type (might be due to invalid IL or missing references)
			//IL_02f8: Unknown result type (might be due to invalid IL or missing references)
			//IL_0304: Unknown result type (might be due to invalid IL or missing references)
			//IL_030e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0326: Unknown result type (might be due to invalid IL or missing references)
			//IL_032a: Unknown result type (might be due to invalid IL or missing references)
			//IL_027e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0283: Unknown result type (might be due to invalid IL or missing references)
			//IL_0297: Unknown result type (might be due to invalid IL or missing references)
			//IL_02aa: Unknown result type (might be due to invalid IL or missing references)
			//IL_02b4: Unknown result type (might be due to invalid IL or missing references)
			//IL_02b9: Unknown result type (might be due to invalid IL or missing references)
			//IL_02be: Unknown result type (might be due to invalid IL or missing references)
			Vector3 val = default(Vector3);
			((Vector3)(ref val))..ctor(-76.6438f, -24.0468f, -41.6449f);
			float orientation = 280f;
			new Vector3(-139.8156f, -21.8568f, 2.9263f);
			float num = 140f;
			float num2 = 135f;
			float num3 = 123f;
			float num4 = 330f;
			float num5 = 325f;
			float num6 = 339f;
			List<Vector2> list = new List<Vector2>();
			int num7 = 0;
			num7 = ((!ModConfig.SpawnCountByStage.Value) ? ModConfig.LunarShopAmount.Value : SetCountbyGameStage(ModConfig.LunarShopAmount.Value, ModConfig.SpawnCountOffset.Value));
			if ((float)num7 <= 10f)
			{
				if ((float)num7 < 10f)
				{
					float num8 = num5 - num2;
					num2 += num8 / ((float)num7 + 1f);
					num5 -= num8 / ((float)num7 + 1f);
				}
				list = GenerateCirclePoints(4f, num2, num5, orientation, num7);
				list.Reverse();
			}
			else
			{
				new List<Vector2>();
				float num9 = (float)num7 * 3f / 8f;
				float num10 = (float)num7 * 5f / 8f;
				int num11 = Mathf.RoundToInt(num9);
				int num12 = Mathf.RoundToInt(num10);
				if (num11 + num12 != num7)
				{
					float num13 = MathF.PI * 2f + 3f / (float)num11;
					float num14 = MathF.PI * 2f + 5f / (float)(num7 - num11);
					float num15 = MathF.PI * 2f + 3f / (float)num12;
					float num16 = MathF.PI * 2f + 5f / (float)(num7 - num12);
					if (Math.Abs(num13 - num14) < Math.Abs(num15 - num16))
					{
						num12 = num7 - num11;
					}
					else
					{
						num11 = num7 - num12;
					}
				}
				if ((float)num7 < 20f)
				{
					float num17 = num6 - num3;
					num3 += num17 / ((float)num12 + 1f);
					num6 -= num17 / ((float)num12 + 1f);
					num17 = num4 - num;
					num += num17 / ((float)num11 + 1f);
					num4 -= num17 / ((float)num11 + 1f);
				}
				List<Vector2> collection = GenerateCirclePoints(3f, num, num4, orientation, num11);
				List<Vector2> list2 = GenerateCirclePoints(5f, num3, num6, orientation, num12);
				list2.Reverse();
				list.AddRange(list2);
				list.AddRange(collection);
			}
			Vector3 position = default(Vector3);
			for (int i = 0; i < list.Count; i++)
			{
				Quaternion val2 = Quaternion.LookRotation(new Vector3(0f - list[i].x, 0f, 0f - list[i].y));
				if ((float)num7 > 10f)
				{
					Vector2 val3 = list[i];
					if (((Vector2)(ref val3)).magnitude < 4f)
					{
						val2 = Quaternion.LookRotation(new Vector3(list[i].x, 0f, list[i].y));
					}
				}
				Quaternion val4 = Quaternion.Euler(180f, 0f, 0f);
				val2 *= val4;
				((Vector3)(ref position))..ctor(val.x + list[i].x, val.y + 4f, val.z + list[i].y);
				DicLunarShopTerminals.Add(i, new SpawnCardStruct(position, ((Quaternion)(ref val2)).eulerAngles));
			}
		}

		private void SpawnLunarShopTerminal()
		{
			//IL_008f: 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_0187: Unknown result type (might be due to invalid IL or missing references)
			//IL_018c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0193: 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_01c5: Unknown result type (might be due to invalid IL or missing references)
			ObjectLunarShopTerminals_Spawn.Clear();
			currentLunarShopStaticItemIndex = 0;
			DicLunarShopTerminals.Clear();
			SetLunarShopTerminal();
			List<GameObject> list = new List<GameObject>();
			GameObject[] array = Object.FindObjectsOfType<GameObject>();
			foreach (GameObject val in array)
			{
				if (((Object)val).name.StartsWith("LunarShopTerminal"))
				{
					list.Add(val);
				}
			}
			if (ModConfig.LunarShopReplaceLunarBudsWithTerminals.Value)
			{
				list.ForEach((Action<GameObject>)NetworkServer.Destroy);
				list = DoSpawnGameObject(DicLunarShopTerminals, lunarShopTerminal, ModConfig.LunarShopAmount.Value);
				ObjectLunarShopTerminals_Spawn.AddRange(list);
			}
			for (int j = 0; j < list.Count; j++)
			{
				GameObject val2 = list[j];
				((Object)val2).name = "LunarShopTerminal";
				PurchaseInteraction component = val2.GetComponent<PurchaseInteraction>();
				ShopTerminalBehavior component2 = val2.GetComponent<ShopTerminalBehavior>();
				if (ModConfig.LunarShopInstancedPurchases.Value)
				{
					InstancedPurchase instancedPurchase = val2.AddComponent<InstancedPurchase>();
					instancedPurchase.original.available = component.available;
					instancedPurchase.original.pickup = component2.pickup;
					instancedPurchase.original.hasBeenPurchased = component2.hasBeenPurchased;
					foreach (PlayerCharacterMasterController instance in PlayerCharacterMasterController.instances)
					{
						if ((Object)(object)instance != (Object)null && (Object)(object)instance.master != (Object)null && (Object)(object)instance.master.bodyPrefab != (Object)null)
						{
							BodyIndex key = BodyCatalog.FindBodyIndex(instance.master.bodyPrefab);
							int valueOrDefault = ModConfig.LunarShopAmountDependingOnCharacterParsed.GetValueOrDefault(key, -1);
							if (valueOrDefault > 0 && j >= valueOrDefault)
							{
								instancedPurchase.GetOrCreate(instance).available = false;
								instancedPurchase.GetOrCreate(instance).pickup = UniquePickup.none;
								instancedPurchase.GetOrCreate(instance).hasBeenPurchased = true;
								InstancedPurchases.UpdateShop(val2, instance);
							}
						}
					}
				}
				whichStallsHaveBeenBoughtOnce.Add(component, new List<PlayerCharacterMasterController>());
			}
		}
	}
	public class BazaarPrinter : BazaarBase
	{
		private AsyncOperationHandle<InteractableSpawnCard> iscDuplicator;

		private AsyncOperationHandle<InteractableSpawnCard> iscDuplicatorLarge;

		private AsyncOperationHandle<InteractableSpawnCard> iscDuplicatorMilitary;

		private AsyncOperationHandle<InteractableSpawnCard> iscDuplicatorWild;

		private AsyncOperationHandle<InteractableSpawnCard>[] PrintersCode;

		private Dictionary<int, SpawnCardStruct> DicPrinters = new Dictionary<int, SpawnCardStruct>();

		public override void Preload()
		{
			//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_001b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0026: Unknown result type (might be due to invalid IL or missing references)
			//IL_002b: Unknown result type (might be due to invalid IL or missing references)
			//IL_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_004a: 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_0057: 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_0064: 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_0071: Unknown result type (might be due to invalid IL or missing references)
			//IL_0076: Unknown result type (might be due to invalid IL or missing references)
			iscDuplicator = Addressables.LoadAssetAsync<InteractableSpawnCard>((object)"RoR2/Base/Duplicator/iscDuplicator.asset");
			iscDuplicatorLarge = Addressables.LoadAssetAsync<InteractableSpawnCard>((object)"RoR2/Base/DuplicatorLarge/iscDuplicatorLarge.asset");
			iscDuplicatorMilitary = Addressables.LoadAssetAsync<InteractableSpawnCard>((object)"RoR2/Base/DuplicatorMilitary/iscDuplicatorMilitary.asset");
			iscDuplicatorWild = Addressables.LoadAssetAsync<InteractableSpawnCard>((object)"RoR2/Base/DuplicatorWild/iscDuplicatorWild.asset");
			PrintersCode = new AsyncOperationHandle<InteractableSpawnCard>[4] { iscDuplicator, iscDuplicatorLarge, iscDuplicatorMilitary, iscDuplicatorWild };
		}

		public override void Hook()
		{
			//IL_0007: Unknown result type (might be due to invalid IL or missing references)
			//IL_0011: Expected O, but got Unknown
			ShopTerminalBehavior.SetPickup += new hook_SetPickup(ShopTerminalBehavior_SetPickup);
		}

		public override void RunStart()
		{
		}

		public override void SetupBazaar()
		{
			if (ModConfig.PrinterSectionEnabled.Value)
			{
				SpawnPrinters();
			}
		}

		private void ShopTerminalBehavior_SetPickup(orig_SetPickup orig, ShopTerminalBehavior self, UniquePickup newPickup, bool newHidden)
		{
			//IL_016e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0070: Unknown result type (might be due to invalid IL or missing references)
			//IL_0072: Unknown result type (might be due to invalid IL or missing references)
			//IL_008c: Expected I4, but got Unknown
			//IL_0162: 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)
			if (ModConfig.EnableMod.Value && ModConfig.PrinterSectionEnabled.Value && IsCurrentMapInBazaar() && NetworkServer.active && ((Object)self).name.StartsWith("Duplicator") && Enum.TryParse<ItemTier>(((Object)self).name.Substring("Duplicator".Length), out ItemTier result))
			{
				WeightedSelection<List<PickupIndex>> val = new WeightedSelection<List<PickupIndex>>(8);
				switch (result - 5)
				{
				case 1:
					val.AddChoice(Run.instance.availableVoidTier1DropList, 25f);
					break;
				case 2:
					val.AddChoice(Run.instance.availableVoidTier2DropList, 25f);
					break;
				case 3:
					val.AddChoice(Run.instance.availableVoidTier3DropList, 25f);
					break;
				case 4:
					val.AddChoice(Run.instance.availableVoidBossDropList, 25f);
					break;
				case 0:
					val.AddChoice(Run.instance.availableVoidTier1DropList, 25f);
					val.AddChoice(Run.instance.availableVoidTier2DropList, 25f);
					val.AddChoice(Run.instance.availableVoidTier3DropList, 25f);
					val.AddChoice(Run.instance.availableVoidBossDropList, 25f);
					break;
				}
				List<PickupIndex> list = val.Evaluate(Random.value);
				newPickup.pickupIndex = list[Random.Range(0, list.Count)];
			}
			orig.Invoke(self, newPickup, newHidden);
		}

		private void SpawnPrinters()
		{
			//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_006a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0098: Expected I4, but got Unknown
			//IL_0119: Unknown result type (might be due to invalid IL or missing references)
			//IL_011e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0134: Unknown result type (might be due to invalid IL or missing references)
			//IL_013e: Expected O, but got Unknown
			//IL_0139: 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)
			if (ModConfig.PrinterAmount.Value <= 0)
			{
				return;
			}
			DicPrinters.Clear();
			SetPrinter();
			int num = 0;
			num = ((!ModConfig.SpawnCountByStage.Value) ? ModConfig.PrinterAmount.Value : SetCountbyGameStage(ModConfig.PrinterAmount.Value, ModConfig.SpawnCountOffset.Value));
			for (int i = 0; i < num; i++)
			{
				ItemTier randomPrinterTier = GetRandomPrinterTier();
				SpawnCard val = null;
				string text = null;
				switch ((int)randomPrinterTier)
				{
				case 0:
					val = (SpawnCard)(object)iscDuplicator.WaitForCompletion();
					break;
				case 1:
					val = (SpawnCard)(object)iscDuplicatorLarge.WaitForCompletion();
					break;
				case 2:
					val = (SpawnCard)(object)iscDuplicatorMilitary.WaitForCompletion();
					break;
				case 4:
					val = (SpawnCard)(object)iscDuplicatorWild.WaitForCompletion();
					break;
				case 6:
				case 7:
				case 8:
				case 9:
					val = (SpawnCard)(object)iscDuplicatorMilitary.WaitForCompletion();
					text = "Duplicator" + ((object)(ItemTier)(ref randomPrinterTier)).ToString();
					break;
				case 5:
					val = (SpawnCard)(object)iscDuplicatorMilitary.WaitForCompletion();
					text = "DuplicatorVoid";
					break;
				}
				GameObject spawnedInstance = val.DoSpawn(DicPrinters[i].Position, Quaternion.identity, new DirectorSpawnRequest(val, DirectPlacement, Run.instance.runRNG)).spawnedInstance;
				if (text != null)
				{
					((Object)spawnedInstance).name = text;
				}
				spawnedInstance.transform.eulerAngles = DicPrinters[i].Rotation;
			}
		}

		private void SetPrinter()
		{
			//IL_0098: 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_00e0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f4: Unknown result type (might be due to invalid IL or missing references)
			//IL_0128: 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_0170: 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_01b8: Unknown result type (might be due to invalid IL or missing references)
			//IL_01cc: 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_0214: 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_025c: 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_02a4: 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_02ec: Unknown result type (might be due to invalid IL or missing references)
			List<int> list = new List<int> { 0, 1, 2, 3, 4, 5, 6, 7, 8 };
			List<int> list2 = new List<int>();
			while (list.Count > 0)
			{
				int index = RNG.Next(list.Count);
				list2.Add(list[index]);
				list.RemoveAt(index);
			}
			DicPrinters.Add(list2[0], new SpawnCardStruct(new Vector3(-112f, -26.8f, -46f), new Vector3(0f, 32.2f, 0f)));
			DicPrinters.Add(list2[1], new SpawnCardStruct(new Vector3(-108f, -26.8f, -48.5f), new Vector3(0f, 32.2f, 0f)));
			DicPrinters.Add(list2[2], new SpawnCardStruct(new Vector3(-104f, -26.7f, -51f), new Vector3(0f, 32.2f, 0f)));
			DicPrinters.Add(list2[3], new SpawnCardStruct(new Vector3(-127f, -26f, -34.5f), new Vector3(0f, 32.2f, 0f)));
			DicPrinters.Add(list2[4], new SpawnCardStruct(new Vector3(-131f, -26f, -31.8f), new Vector3(0f, 32.2f, 0f)));
			DicPrinters.Add(list2[5], new SpawnCardStruct(new Vector3(-135f, -26f, -29f), new Vector3(0f, 32.2f, 0f)));
			DicPrinters.Add(list2[6], new SpawnCardStruct(new Vector3(-144f, -24.7f, -24f), new Vector3(0f, 60.2f, 0f)));
			DicPrinters.Add(list2[7], new SpawnCardStruct(new Vector3(-145f, -25f, -20f), new Vector3(0f, 80f, 0f)));
			DicPrinters.Add(list2[8], new SpawnCardStruct(new Vector3(-146f, -25.3f, -16f), new Vector3(0f, 100f, 0f)));
		}

		private ItemTier GetRandomPrinterTier()
		{
			//IL_00a5: Unknown result type (might be due to invalid IL or missing references)
			WeightedSelection<ItemTier> obj = new WeightedSelection<ItemTier>(8);
			obj.AddChoice((ItemTier)0, ModConfig.PrinterTier1Weight.Value);
			obj.AddChoice((ItemTier)1, ModConfig.PrinterTier2Weight.Value);
			obj.AddChoice((ItemTier)2, ModConfig.PrinterTier3Weight.Value);
			obj.AddChoice((ItemTier)4, ModConfig.PrinterTierBossWeight.Value);
			obj.AddChoice((ItemTier)6, ModConfig.PrinterTierVoid1Weight.Value);
			obj.AddChoice((ItemTier)7, ModConfig.PrinterTierVoid2Weight.Value);
			obj.AddChoice((ItemTier)8, ModConfig.PrinterTierVoid3Weight.Value);
			obj.AddChoice((ItemTier)9, ModConfig.PrinterTierVoidBossWeight.Value);
			obj.AddChoice((ItemTier)5, ModConfig.PrinterTierVoidAnyWeight.Value);
			return obj.Evaluate(Random.value);
		}
	}
	public class BazaarRestack : BazaarBase
	{
		private AsyncOperationHandle<InteractableSpawnCard> iscShrineRestack;

		public override void Preload()
		{
			//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)
			iscShrineRestack = Addressables.LoadAssetAsync<InteractableSpawnCard>((object)"RoR2/Base/ShrineRestack/iscShrineRestack.asset");
		}

		public override void Hook()
		{
			//IL_0007: Unknown result type (might be due to invalid IL or missing references)
			//IL_0011: Expected O, but got Unknown
			PurchaseInteraction.ScaleCost += new hook_ScaleCost(PurchaseInteraction_ScaleCost);
		}

		public override void RunStart()
		{
		}

		public override void SetupBazaar()
		{
			if (ModConfig.ShrineOfOrderSectionEnabled.Value)
			{
				SpawnShrineRestack();
			}
		}

		private void PurchaseInteraction_ScaleCost(orig_ScaleCost orig, PurchaseInteraction self, float scalar)
		{
			if (ModConfig.EnableMod.Value && ModConfig.ShrineOfOrderSectionEnabled.Value && IsCurrentMapInBazaar() && NetworkServer.active && ((Object)self).name.StartsWith("ShrineRestack"))
			{
				scalar = ModConfig.ShrineOfOrderCostMultiplier.Value;
			}
			orig.Invoke(self, scalar);
		}

		private void SpawnShrineRestack()
		{
			//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_0037: Unknown result type (might be due to invalid IL or missing references)
			//IL_0041: Expected O, but got Unknown
			//IL_003c: 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)
			SpawnCard val = (SpawnCard)(object)iscShrineRestack.WaitForCompletion();
			GameObject spawnedInstance = val.DoSpawn(new Vector3(-130f, -24f, -40f), Quaternion.identity, new DirectorSpawnRequest(val, DirectPlacement, Run.instance.runRNG)).spawnedInstance;
			spawnedInstance.transform.eulerAngles = new Vector3(0f, 220f, 0f);
			if (ModConfig.ShrineOfOrderUseLimit.Value >= 0)
			{
				spawnedInstance.GetComponent<ShrineRestackBehavior>().maxPurchaseCount = ModConfig.ShrineOfOrderUseLimit.Value;
			}
			else
			{
				spawnedInstance.GetComponent<ShrineRestackBehavior>().maxPurchaseCount = int.MaxValue;
			}
			spawnedInstance.GetComponent<PurchaseInteraction>().cost = ModConfig.ShrineOfOrderCost.Value;
			spawnedInstance.GetComponent<PurchaseInteraction>().Networkcost = ModConfig.ShrineOfOrderCost.Value;
		}
	}
	public class BazaarScrapper : BazaarBase
	{
		private AsyncOperationHandle<InteractableSpawnCard> iscScrapper;

		private Dictionary<int, SpawnCardStruct> DicScrapers = new Dictionary<int, SpawnCardStruct>();

		public override void Preload()
		{
			//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)
			iscScrapper = Addressables.LoadAssetAsync<InteractableSpawnCard>((object)"RoR2/Base/Scrapper/iscScrapper.asset");
		}

		public override void Hook()
		{
		}

		public override void RunStart()
		{
		}

		public override void SetupBazaar()
		{
			if (ModConfig.ScrapperSectionEnabled.Value)
			{
				SpawnScrapper();
			}
		}

		private void SpawnScrapper()
		{
			//IL_0026: Unknown result type (might be due to invalid IL or missing references)
			if (ModConfig.ScrapperAmount.Value > 0)
			{
				DicScrapers.Clear();
				SetScraper();
				DoSpawnCard(DicScrapers, iscScrapper, ModConfig.ScrapperAmount.Value);
			}
		}

		private void SetScraper()
		{
			//IL_0075: 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_00bd: 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_0105: 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_014d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0161: Unknown result type (might be due to invalid IL or missing references)
			List<int> list = new List<int> { 0, 1, 2, 3 };
			List<int> list2 = new List<int>();
			while (list.Count > 0)
			{
				int index = RNG.Next(list.Count);
				list2.Add(list[index]);
				list.RemoveAt(index);
			}
			DicScrapers.Add(list2[0], new SpawnCardStruct(new Vector3(-95f, -25.5f, -45f), new Vector3(0f, 72f, 0f)));
			DicScrapers.Add(list2[1], new SpawnCardStruct(new Vector3(-100f, -25f, -40f), new Vector3(0f, 72f, 0f)));
			DicScrapers.Add(list2[2], new SpawnCardStruct(new Vector3(-90f, -25.5f, -40f), new Vector3(0f, 72f, 0f)));
			DicScrapers.Add(list2[3], new SpawnCardStruct(new Vector3(-95f, -25.5f, -35f), new Vector3(0f, 72f, 0f)));
		}
	}
	public class BazaarWanderingChef : BazaarBase
	{
		private AsyncOperationHandle<GameObject> mealPrep;

		private AsyncOperationHandle<GameObject> ChefWok_WhitesAndGreens;

		private Dictionary<PickupIndex, List<RecipeEntry>> allAvailableRecipes;

		private PickupIndex[] allAvailableTargetPickupIndexes;

		private int randomTargetPickupIndex;

		private List<RecipeEntry> possibleRecipes;

		private ShopTerminalBehavior cauldron;

		public override void Preload()
		{
			//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_001b: Unknown result type (might be due to invalid IL or missing references)
			mealPrep = Addressables.LoadAssetAsync<GameObject>((object)"RoR2/DLC3/MealPrep/MealPrep.prefab");
			ChefWok_WhitesAndGreens = Addressables.LoadAssetAsync<GameObject>((object)"RoR2/DLC3/MealPrep/ChefWok, WhitesAndGreens.prefab");
		}

		public override void Hook()
		{
			//IL_0007: Unknown result type (might be due to invalid IL or missing references)
			//IL_0011: Expected O, but got Unknown
			//IL_0018: Unknown result type (might be due to invalid IL or missing references)
			//IL_0022: Expected O, but got Unknown
			//IL_0029: Unknown result type (might be due to invalid IL or missing references)
			//IL_0033: Expected O, but got Unknown
			//IL_003a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0044: Expected O, but got Unknown
			//IL_004b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0055: Expected O, but got Unknown
			ShopTerminalBehavior.SetPickup += new hook_SetPickup(ShopTerminalBehavior_SetPickup);
			CraftingController.AttemptFindPossibleRecipes += new hook_AttemptFindPossibleRecipes(CraftingController_AttemptFindPossibleRecipes);
			CraftingController.GetGeneratedOptionsFromInteractor += new hook_GetGeneratedOptionsFromInteractor(CraftingController_GetGeneratedOptionsFromInteractor);
			CraftingController.CanTakePickupAfterUseByIngredientSlots += new hook_CanTakePickupAfterUseByIngredientSlots(CraftingController_CanTakePickupAfterUseByIngredientSlots);
			MealPrepController.BeginCookingServer += new hook_BeginCookingServer(MealPrepController_BeginCookingServer);
		}

		public override void RunStart()
		{
			if (ModConfig.WanderingChefSectionEnabled.Value && !ModConfig.WanderingChefUnrestrictedCrafting.Value)
			{
				allAvailableRecipes = GetAvailableRecipes();
				allAvailableTargetPickupIndexes = allAvailableRecipes.Keys.ToArray();
				randomTargetPickupIndex = RNG.Next(allAvailableTargetPickupIndexes.Length);
			}
		}

		public override void SetupBazaar()
		{
			if (ModConfig.WanderingChefSectionEnabled.Value)
			{
				SpawnWanderingChef();
			}
		}

		private void ShopTerminalBehavior_SetPickup(orig_SetPickup orig, ShopTerminalBehavior self, UniquePickup newPickup, bool newHidden)
		{
			//IL_0076: 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_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)
			if (ModConfig.EnableMod.Value && ModConfig.WanderingChefSectionEnabled.Value && IsCurrentMapInBazaar() && NetworkServer.active && ((Object)self).name.StartsWith("CookingCauldron"))
			{
				if (possibleRecipes == null || possibleRecipes.Count == 0)
				{
					newPickup.pickupIndex = PickupIndex.none;
				}
				else
				{
					newPickup.pickupIndex = possibleRecipes[0].result;
				}
			}
			orig.Invoke(self, newPickup, newHidden);
		}

		private void CraftingController_AttemptFindPossibleRecipes(orig_AttemptFindPossibleRecipes orig, CraftingController self)
		{
			//IL_00fb: 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)
			if (ModConfig.EnableMod.Value && ModConfig.WanderingChefSectionEnabled.Value && !ModConfig.WanderingChefUnrestrictedCrafting.Value && IsCurrentMapInBazaar() && NetworkServer.active && ((Object)self).name.StartsWith("WanderingChef") && possibleRecipes != null && possibleRecipes.Count > 0)
			{
				self._possibleRecipes = possibleRecipes.ToArray();
				if (!self.AllSlotsEmpty())
				{
					self._possibleRecipes = FindRecipesThatCanAcceptIngredients(self.ingredients);
				}
				CraftableCatalog.FilterByEntitlement(ref self._possibleRecipes);
				if (!self.AllSlotsFilled())
				{
					return;
				}
				self.bestFitRecipe = null;
				for (int i = 0; i < self._possibleRecipes.Length; i++)
				{
					RecipeEntry val = self._possibleRecipes[i];
					if (val != null && CraftableCatalog.ValidateRecipe(val, self.ingredients))
					{
						self.bestFitRecipe = val;
					}
				}
				if (self.bestFitRecipe != null)
				{
					self.result = self.bestFitRecipe.result;
					self.amountToDrop = self.bestFitRecipe.amountToDrop;
					((NetworkBehaviour)self).SetDirtyBit(CraftingController.resultDirtyBit);
				}
			}
			else
			{
				orig.Invoke(self);
			}
		}

		private List<Option> CraftingController_GetGeneratedOptionsFromInteractor(orig_GetGeneratedOptionsFromInteractor orig, CraftingController self, Interactor activator)
		{
			//IL_00d2: 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_00da: 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_0128: Unknown result type (might be due to invalid IL or missing references)
			//IL_012d: Unknown result type (might be due to invalid IL or missing references)
			//IL_013c: 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_014c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0151: 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)
			List<Option> result = orig.Invoke(self, activator);
			if (ModConfig.EnableMod.Value && ModConfig.WanderingChefSectionEnabled.Value && !ModConfig.WanderingChefUnrestrictedCrafting.Value && IsCurrentMapInBazaar() && NetworkServer.active && ((Object)self).name.StartsWith("WanderingChef") && possibleRecipes != null && possibleRecipes.Count > 0)
			{
				CharacterBody component = ((Component)activator).GetComponent<CharacterBody>();
				if ((Object)(object)component != (Object)null)
				{
					List<Option> list = new List<Option>();
					HashSet<PickupIndex> hashSet = new HashSet<PickupIndex>();
					foreach (RecipeEntry possibleRecipe in possibleRecipes)
					{
						IngredientSlotEntry[] possibleIngredients = possibleRecipe.possibleIngredients;
						for (int i = 0; i < possibleIngredients.Length; i++)
						{
							PickupIndex[] pickups = possibleIngredients[i].pickups;
							foreach (PickupIndex item in pickups)
							{
								hashSet.Add(item);
							}
						}
					}
					{
						foreach (PickupIndex item2 in hashSet)
						{
							list.Add(new Option
							{
								available = InventoryContainsPickup(component.inventory, item2),
								pickup = new UniquePickup(item2)
							});
						}
						return list;
					}
				}
			}
			return result;
		}

		private bool CraftingController_CanTakePickupAfterUseByIngredientSlots(orig_CanTakePickupAfterUseByIngredientSlots orig, CraftingController self, PickupIndex pickupIndex, PickupIndex[] consumedIngredients)
		{
			//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_00de: 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_008c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0092: Invalid comparison between Unknown and I4
			//IL_00c3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c9: Invalid comparison between Unknown and I4
			//IL_00ce: 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)
			if (ModConfig.EnableMod.Value && ModConfig.WanderingChefSectionEnabled.Value && !ModConfig.WanderingChefUnrestrictedCrafting.Value && IsCurrentMapInBazaar() && NetworkServer.active && ((Object)self).name.StartsWith("WanderingChef"))
			{
				CharacterMaster currentParticipantMaster = ((PickupPickerController)self).networkUIPromptController.currentParticipantMaster;
				if (Object.op_Implicit((Object)(object)currentParticipantMaster))
				{
					PickupDef pickupDef = PickupCatalog.GetPickupDef(pickupIndex);
					if (pickupDef != null)
					{
						Inventory inventory = currentParticipantMaster