Decompiled source of BazaarIsMyHaven v2.1.2

BazaarIsMyHaven.dll

Decompiled a week ago
using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using BepInEx;
using BepInEx.Bootstrap;
using BepInEx.Configuration;
using BepInEx.Logging;
using EntityStates;
using EntityStates.NewtMonster;
using HG.Reflection;
using IL.RoR2;
using InLobbyConfig;
using InLobbyConfig.Fields;
using Microsoft.CodeAnalysis;
using Mono.Cecil.Cil;
using MonoMod.Cil;
using On.EntityStates.NewtMonster;
using On.RoR2;
using R2API.Utils;
using RoR2;
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+ee1e2bd1e5b19cff67bd7081611c339d9874df1c")]
[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
		};

		protected static Dictionary<string, AsyncOperationHandle<BasicPickupDropTable>> dropTables = new Dictionary<string, AsyncOperationHandle<BasicPickupDropTable>>();

		public static void InitBazaarBaseDropTables()
		{
			//IL_0019: Unknown result type (might be due to invalid IL or missing references)
			//IL_0032: Unknown result type (might be due to invalid IL or missing references)
			//IL_004b: 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_007d: 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_00af: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c8: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00fa: Unknown result type (might be due to invalid IL or missing references)
			//IL_0113: Unknown result type (might be due to invalid IL or missing references)
			//IL_012c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0145: Unknown result type (might be due to invalid IL or missing references)
			//IL_015e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0177: Unknown result type (might be due to invalid IL or missing references)
			//IL_0190: Unknown result type (might be due to invalid IL or missing references)
			//IL_01a9: Unknown result type (might be due to invalid IL or missing references)
			//IL_01c2: Unknown result type (might be due to invalid IL or missing references)
			//IL_01db: 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_020d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0226: Unknown result type (might be due to invalid IL or missing references)
			//IL_023f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0258: Unknown result type (might be due to invalid IL or missing references)
			//IL_0271: Unknown result type (might be due to invalid IL or missing references)
			//IL_028a: Unknown result type (might be due to invalid IL or missing references)
			//IL_02a3: Unknown result type (might be due to invalid IL or missing references)
			//IL_02bc: Unknown result type (might be due to invalid IL or missing references)
			//IL_02d5: Unknown result type (might be due to invalid IL or missing references)
			//IL_02ee: Unknown result type (might be due to invalid IL or missing references)
			//IL_0307: Unknown result type (might be due to invalid IL or missing references)
			//IL_0320: Unknown result type (might be due to invalid IL or missing references)
			//IL_0339: Unknown result type (might be due to invalid IL or missing references)
			//IL_0352: Unknown result type (might be due to invalid IL or missing references)
			//IL_036b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0384: Unknown result type (might be due to invalid IL or missing references)
			//IL_039d: Unknown result type (might be due to invalid IL or missing references)
			//IL_03b6: Unknown result type (might be due to invalid IL or missing references)
			//IL_03cf: Unknown result type (might be due to invalid IL or missing references)
			//IL_03e8: Unknown result type (might be due to invalid IL or missing references)
			//IL_0401: Unknown result type (might be due to invalid IL or missing references)
			//IL_041a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0433: 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_0465: Unknown result type (might be due to invalid IL or missing references)
			dropTables.Clear();
			dropTables.Add("dtMonsterTeamTier1Item", Addressables.LoadAssetAsync<BasicPickupDropTable>((object)"RoR2/Base/MonsterTeamGainsItems/dtMonsterTeamTier1Item.asset"));
			dropTables.Add("dtMonsterTeamTier2Item", Addressables.LoadAssetAsync<BasicPickupDropTable>((object)"RoR2/Base/MonsterTeamGainsItems/dtMonsterTeamTier2Item.asset"));
			dropTables.Add("dtMonsterTeamTier3Item", Addressables.LoadAssetAsync<BasicPickupDropTable>((object)"RoR2/Base/MonsterTeamGainsItems/dtMonsterTeamTier3Item.asset"));
			dropTables.Add("dtSacrificeArtifact", Addressables.LoadAssetAsync<BasicPickupDropTable>((object)"RoR2/Base/Sacrifice/dtSacrificeArtifact.asset"));
			dropTables.Add("dtAISafeTier1Item", Addressables.LoadAssetAsync<BasicPickupDropTable>((object)"RoR2/Base/Common/dtAISafeTier1Item.asset"));
			dropTables.Add("dtAISafeTier2Item", Addressables.LoadAssetAsync<BasicPickupDropTable>((object)"RoR2/Base/Common/dtAISafeTier2Item.asset"));
			dropTables.Add("dtAISafeTier3Item", Addressables.LoadAssetAsync<BasicPickupDropTable>((object)"RoR2/Base/Common/dtAISafeTier3Item.asset"));
			dropTables.Add("dtEquipment", Addressables.LoadAssetAsync<BasicPickupDropTable>((object)"RoR2/Base/Common/dtEquipment.asset"));
			dropTables.Add("dtTier1Item", Addressables.LoadAssetAsync<BasicPickupDropTable>((object)"RoR2/Base/Common/dtTier1Item.asset"));
			dropTables.Add("dtTier2Item", Addressables.LoadAssetAsync<BasicPickupDropTable>((object)"RoR2/Base/Common/dtTier2Item.asset"));
			dropTables.Add("dtTier3Item", Addressables.LoadAssetAsync<BasicPickupDropTable>((object)"RoR2/Base/Common/dtTier3Item.asset"));
			dropTables.Add("dtVoidChest", Addressables.LoadAssetAsync<BasicPickupDropTable>((object)"RoR2/Base/Common/dtVoidChest.asset"));
			dropTables.Add("dtCasinoChest", Addressables.LoadAssetAsync<BasicPickupDropTable>((object)"RoR2/Base/CasinoChest/dtCasinoChest.asset"));
			dropTables.Add("dtSmallChestDamage", Addressables.LoadAssetAsync<BasicPickupDropTable>((object)"RoR2/Base/CategoryChest/dtSmallChestDamage.asset"));
			dropTables.Add("dtSmallChestHealing", Addressables.LoadAssetAsync<BasicPickupDropTable>((object)"RoR2/Base/CategoryChest/dtSmallChestHealing.asset"));
			dropTables.Add("dtSmallChestUtility", Addressables.LoadAssetAsync<BasicPickupDropTable>((object)"RoR2/Base/CategoryChest/dtSmallChestUtility.asset"));
			dropTables.Add("dtChest1", Addressables.LoadAssetAsync<BasicPickupDropTable>((object)"RoR2/Base/Chest1/dtChest1.asset"));
			dropTables.Add("dtChest2", Addressables.LoadAssetAsync<BasicPickupDropTable>((object)"RoR2/Base/Chest2/dtChest2.asset"));
			dropTables.Add("dtDuplicatorTier1", Addressables.LoadAssetAsync<BasicPickupDropTable>((object)"RoR2/Base/Duplicator/dtDuplicatorTier1.asset"));
			dropTables.Add("dtDuplicatorTier2", Addressables.LoadAssetAsync<BasicPickupDropTable>((object)"RoR2/Base/DuplicatorLarge/dtDuplicatorTier2.asset"));
			dropTables.Add("dtDuplicatorTier3", Addressables.LoadAssetAsync<BasicPickupDropTable>((object)"RoR2/Base/DuplicatorMilitary/dtDuplicatorTier3.asset"));
			dropTables.Add("dtDuplicatorWild", Addressables.LoadAssetAsync<BasicPickupDropTable>((object)"RoR2/Base/DuplicatorWild/dtDuplicatorWild.asset"));
			dropTables.Add("dtGoldChest", Addressables.LoadAssetAsync<BasicPickupDropTable>((object)"RoR2/Base/GoldChest/dtGoldChest.asset"));
			dropTables.Add("dtLunarChest", Addressables.LoadAssetAsync<BasicPickupDropTable>((object)"RoR2/Base/LunarChest/dtLunarChest.asset"));
			dropTables.Add("dtShrineChance", Addressables.LoadAssetAsync<BasicPickupDropTable>((object)"RoR2/Base/ShrineChance/dtShrineChance.asset"));
			dropTables.Add("dtLockbox", Addressables.LoadAssetAsync<BasicPickupDropTable>((object)"RoR2/Base/TreasureCache/dtLockbox.asset"));
			dropTables.Add("dtITBossWave", Addressables.LoadAssetAsync<BasicPickupDropTable>((object)"RoR2/DLC1/GameModes/InfiniteTowerRun/InfiniteTowerAssets/dtITBossWave.asset"));
			dropTables.Add("dtITDefaultWave", Addressables.LoadAssetAsync<BasicPickupDropTable>((object)"RoR2/DLC1/GameModes/InfiniteTowerRun/InfiniteTowerAssets/dtITDefaultWave.asset"));
			dropTables.Add("dtITLunar", Addressables.LoadAssetAsync<BasicPickupDropTable>((object)"RoR2/DLC1/GameModes/InfiniteTowerRun/InfiniteTowerAssets/dtITLunar.asset"));
			dropTables.Add("dtITSpecialBossWave", Addressables.LoadAssetAsync<BasicPickupDropTable>((object)"RoR2/DLC1/GameModes/InfiniteTowerRun/InfiniteTowerAssets/dtITSpecialBossWave.asset"));
			dropTables.Add("dtITVoid", Addressables.LoadAssetAsync<BasicPickupDropTable>((object)"RoR2/DLC1/GameModes/InfiniteTowerRun/InfiniteTowerAssets/dtITVoid.asset"));
			dropTables.Add("dtCategoryChest2Damage", Addressables.LoadAssetAsync<BasicPickupDropTable>((object)"RoR2/DLC1/CategoryChest2/dtCategoryChest2Damage.asset"));
			dropTables.Add("dtCategoryChest2Healing", Addressables.LoadAssetAsync<BasicPickupDropTable>((object)"RoR2/DLC1/CategoryChest2/dtCategoryChest2Healing.asset"));
			dropTables.Add("dtCategoryChest2Utility", Addressables.LoadAssetAsync<BasicPickupDropTable>((object)"RoR2/DLC1/CategoryChest2/dtCategoryChest2Utility.asset"));
			dropTables.Add("dtVoidCamp", Addressables.LoadAssetAsync<BasicPickupDropTable>((object)"RoR2/DLC1/VoidCamp/dtVoidCamp.asset"));
			dropTables.Add("dtVoidTriple", Addressables.LoadAssetAsync<BasicPickupDropTable>((object)"RoR2/DLC1/VoidTriple/dtVoidTriple.asset"));
			dropTables.Add("dtVoidLockbox", Addressables.LoadAssetAsync<BasicPickupDropTable>((object)"RoR2/DLC1/TreasureCacheVoid/dtVoidLockbox.asset"));
			dropTables.Add("AurelioniteHeartPickupDropTable", Addressables.LoadAssetAsync<BasicPickupDropTable>((object)"RoR2/DLC2/AurelioniteHeartPickupDropTable.asset"));
			dropTables.Add("GeodeRewardDropTable", Addressables.LoadAssetAsync<BasicPickupDropTable>((object)"RoR2/DLC2/GeodeRewardDropTable.asset"));
			dropTables.Add("dtShrineHalcyoniteTier1", Addressables.LoadAssetAsync<BasicPickupDropTable>((object)"RoR2/DLC2/dtShrineHalcyoniteTier1.asset"));
			dropTables.Add("dtShrineHalcyoniteTier2", Addressables.LoadAssetAsync<BasicPickupDropTable>((object)"RoR2/DLC2/dtShrineHalcyoniteTier2.asset"));
			dropTables.Add("dtShrineHalcyoniteTier3", Addressables.LoadAssetAsync<BasicPickupDropTable>((object)"RoR2/DLC2/dtShrineHalcyoniteTier3.asset"));
			dropTables.Add("dtChanceDoll", Addressables.LoadAssetAsync<BasicPickupDropTable>((object)"RoR2/DLC2/Items/ExtraShrineItem/dtChanceDoll.asset"));
			dropTables.Add("dtSonorousEcho", Addressables.LoadAssetAsync<BasicPickupDropTable>((object)"RoR2/DLC2/Items/ItemDropChanceOnKill/dtSonorousEcho.asset"));
			dropTables.Add("dtCommandChest", Addressables.LoadAssetAsync<BasicPickupDropTable>((object)"RoR2/CommandChest/dtCommandChest.asset"));
		}

		public static void WriteDropTablesMarkdownFile()
		{
		}

		public abstract void Preload();

		public abstract void Hook();

		public abstract void SetupBazaar();

		protected PickupIndex[] ResolveItemRewardFromStringList(string itemlist, int index = -1)
		{
			//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_02fb: Unknown result type (might be due to invalid IL or missing references)
			//IL_02fc: Unknown result type (might be due to invalid IL or missing references)
			//IL_026f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0274: Unknown result type (might be due to invalid IL or missing references)
			//IL_0279: Unknown result type (might be due to invalid IL or missing references)
			//IL_02e7: Unknown result type (might be due to invalid IL or missing references)
			//IL_02ec: Unknown result type (might be due to invalid IL or missing references)
			//IL_02f1: Unknown result type (might be due to invalid IL or missing references)
			//IL_036d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0372: 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_0377: Invalid comparison between Unknown and I4
			//IL_0342: Unknown result type (might be due to invalid IL or missing references)
			//IL_0347: Unknown result type (might be due to invalid IL or missing references)
			//IL_0360: Unknown result type (might be due to invalid IL or missing references)
			//IL_036a: Expected O, but got Unknown
			//IL_03b6: Unknown result type (might be due to invalid IL or missing references)
			//IL_03b7: Unknown result type (might be due to invalid IL or missing references)
			//IL_021e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0223: Unknown result type (might be due to invalid IL or missing references)
			//IL_0228: Unknown result type (might be due to invalid IL or missing references)
			//IL_0239: Unknown result type (might be due to invalid IL or missing references)
			//IL_023e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0243: Unknown result type (might be due to invalid IL or missing references)
			//IL_0254: Unknown result type (might be due to invalid IL or missing references)
			//IL_0259: Unknown result type (might be due to invalid IL or missing references)
			//IL_025e: Unknown result type (might be due to invalid IL or missing references)
			//IL_029f: 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_02a9: Unknown result type (might be due to invalid IL or missing references)
			//IL_02b7: Unknown result type (might be due to invalid IL or missing references)
			//IL_02bc: 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_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_02d9: Unknown result type (might be due to invalid IL or missing references)
			//IL_0385: Unknown result type (might be due to invalid IL or missing references)
			//IL_038a: Unknown result type (might be due to invalid IL or missing references)
			//IL_038c: Unknown result type (might be due to invalid IL or missing references)
			//IL_038f: Invalid comparison between Unknown and I4
			//IL_0379: Unknown result type (might be due to invalid IL or missing references)
			//IL_037b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0380: Unknown result type (might be due to invalid IL or missing references)
			//IL_03cc: Unknown result type (might be due to invalid IL or missing references)
			//IL_0287: Unknown result type (might be due to invalid IL or missing references)
			//IL_028c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0291: Unknown result type (might be due to invalid IL or missing references)
			//IL_039b: Unknown result type (might be due to invalid IL or missing references)
			//IL_03a0: Unknown result type (might be due to invalid IL or missing references)
			//IL_0391: Unknown result type (might be due to invalid IL or missing references)
			//IL_0393: Unknown result type (might be due to invalid IL or missing references)
			//IL_0398: Unknown result type (might be due to invalid IL or missing references)
			if (Utility.IsNullOrWhiteSpace(itemlist))
			{
				return null;
			}
			List<string> list = itemlist.Split(',').ToList();
			PickupIndex val = PickupIndex.none;
			int result = 1;
			while (true)
			{
				if (list.Count > 0)
				{
					index %= list.Count;
					if (index < 0)
					{
						index = RNG.Next(list.Count);
					}
					string[] array = list[index].Trim().Split("=");
					string text;
					if (array.Length == 1)
					{
						text = array[0];
					}
					else if (array.Length == 2)
					{
						text = array[0].Trim();
						if (!int.TryParse(array[1].Trim(), out result))
						{
							Log.LogError($"Could not properly parse item amount: {array}");
						}
					}
					else
					{
						Log.LogError($"Could not properly parse item key: {array}");
						text = array[0];
					}
					bool flag = true;
					switch (text.ToLower())
					{
					case "tier1":
						val = GetRandom(Run.instance.availableTier1DropList, PickupIndex.none);
						break;
					case "tier2":
						val = GetRandom(Run.instance.availableTier2DropList, PickupIndex.none);
						break;
					case "tier3":
						val = GetRandom(Run.instance.availableTier3DropList, PickupIndex.none);
						break;
					case "boss":
						val = GetRandom(Run.instance.availableBossDropList, PickupIndex.none);
						break;
					case "lunar":
						val = GetRandom(Run.instance.availableLunarCombinedDropList, PickupIndex.none);
						break;
					case "voidtier1":
						val = GetRandom(Run.instance.availableVoidTier1DropList, PickupIndex.none);
						break;
					case "voidtier2":
						val = GetRandom(Run.instance.availableVoidTier2DropList, PickupIndex.none);
						break;
					case "voidtier3":
						val = GetRandom(Run.instance.availableVoidTier3DropList, PickupIndex.none);
						break;
					case "voidboss":
						val = GetRandom(Run.instance.availableVoidBossDropList, PickupIndex.none);
						break;
					default:
						flag = false;
						break;
					}
					if (flag)
					{
						if (!(val == PickupIndex.none))
						{
							break;
						}
						Log.LogWarning("LunarShopItemsList: Could not get pickup from item tier: " + text + ", skipping it.");
						list.RemoveAt(index);
						continue;
					}
					if (dropTables.ContainsKey(text))
					{
						return ((PickupDropTable)dropTables[text].WaitForCompletion()).GenerateUniqueDrops(result, new Xoroshiro128Plus(Run.instance.stageRng.nextUlong));
					}
					ItemIndex val2 = ItemCatalog.FindItemIndex(text);
					if ((int)val2 != -1)
					{
						val = PickupCatalog.FindPickupIndex(val2);
						break;
					}
					EquipmentIndex val3 = EquipmentCatalog.FindEquipmentIndex(text);
					if ((int)val3 != -1)
					{
						val = PickupCatalog.FindPickupIndex(val3);
						break;
					}
					val = PickupIndex.none;
					Log.LogError("LunarShopItemsList: Could not find item key: " + text);
					break;
				}
				return null;
			}
			if (val == PickupIndex.none)
			{
				return null;
			}
			PickupIndex[] array2 = new PickupIndex[result];
			Array.Fill((PickupIndex[])(object)array2, val);
			return (PickupIndex[])(object)array2;
		}

		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.SetPickupIndex += new hook_SetPickupIndex(ShopTerminalBehavior_SetPickupIndex);
		}

		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_006c: 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.GiveItem(PickupCatalog.GetPickupDef(component.CurrentPickupIndex()).itemIndex, 2);
			}
			orig.Invoke(self, activator);
		}

		public void ShopTerminalBehavior_SetPickupIndex(orig_SetPickupIndex orig, ShopTerminalBehavior self, PickupIndex newPickupIndex, bool newHidden)
		{
			//IL_00d4: 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_0066: 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_009b: Unknown result type (might be due to invalid IL or missing references)
			//IL_00cb: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d0: Unknown result type (might be due to invalid IL or missing references)
			if (ModConfig.EnableMod.Value && ModConfig.CauldronSectionEnabled.Value && IsCurrentMapInBazaar() && NetworkServer.active)
			{
				if (((Object)self).name.StartsWith("LunarCauldronGreen"))
				{
					CauldronHacked_SetPickupIndex(self, out var listLunarItem);
					newPickupIndex = listLunarItem[RNG.Next(0, listLunarItem.Count)];
				}
				if (((Object)self).name.StartsWith("LunarCauldronRed"))
				{
					CauldronHacked_SetPickupIndex(self, out var listLunarItem2);
					newPickupIndex = listLunarItem2[RNG.Next(0, listLunarItem2.Count)];
				}
				if (((Object)self).name.StartsWith("LunarCauldronWhite"))
				{
					CauldronHacked_SetPickupIndex(self, out var listLunarItem3);
					newPickupIndex = listLunarItem3[RNG.Next(0, listLunarItem3.Count)];
				}
			}
			orig.Invoke(self, newPickupIndex, 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.SetPickupIndex += new hook_SetPickupIndex(ShopTerminalBehavior_SetPickupIndex);
		}

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

		private void ShopTerminalBehavior_SetPickupIndex(orig_SetPickupIndex orig, ShopTerminalBehavior self, PickupIndex newPickupIndex, bool newHidden)
		{
			//IL_008c: 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_0054: Unknown result type (might be due to invalid IL or missing references)
			//IL_006d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0072: Unknown result type (might be due to invalid IL or missing references)
			//IL_0077: Unknown result type (might be due to invalid IL or missing references)
			if (ModConfig.EnableMod.Value && ModConfig.CleansingPoolSectionEnabled.Value && ModConfig.CleansingPoolRewardsLunarCoins.Value && IsCurrentMapInBazaar() && NetworkServer.active)
			{
				if (((Object)self).name.StartsWith("ShrineCleanse"))
				{
					newPickupIndex = PickupCatalog.FindPickupIndex(MiscPickups.LunarCoin.miscPickupIndex);
				}
				if (((Object)self).name.StartsWith("HoveringLunarCoin"))
				{
					newPickupIndex = PickupCatalog.FindPickupIndex(MiscPickups.LunarCoin.miscPickupIndex);
					((Component)self).gameObject.GetComponent<PurchaseInteraction>().SetAvailable(false);
				}
			}
			orig.Invoke(self, newPickupIndex, 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(-72.4183f, -24.4958f, -28.9289f), new Vector3(6.4123f, 272.6046f, 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 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;

		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 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_00f1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00fc: Unknown result type (might be due to invalid IL or missing references)
			//IL_010f: 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;
				PlayerStruct playerStruct = Main.instance.GetPlayerStruct(master.playerCharacterMasterController);
				if (playerStruct.DonateCount == 0)
				{
					ChatHelper.ThanksTip(val, master.playerCharacterMasterController);
				}
				playerStruct.DonateCount++;
				if (playerStruct.DonateCount % 10 == 0 && playerStruct.RewardCount < ModConfig.DonateRewardLimit.Value)
				{
					GiftReward(self, val, component, inventory, playerStruct);
					playerStruct.RewardCount++;
				}
				if (playerStruct.DonateCount <= ModConfig.DonateRewardLimit.Value * 10)
				{
					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, PlayerStruct playerStruct)
		{
			//IL_01aa: Unknown result type (might be due to invalid IL or missing references)
			//IL_01df: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ed: Unknown result type (might be due to invalid IL or missing references)
			//IL_01f3: Invalid comparison between Unknown and I4
			//IL_0245: Unknown result type (might be due to invalid IL or missing references)
			//IL_024b: Invalid comparison between Unknown and I4
			//IL_0252: Unknown result type (might be due to invalid IL or missing references)
			//IL_025f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0264: Unknown result type (might be due to invalid IL or missing references)
			//IL_0266: Unknown result type (might be due to invalid IL or missing references)
			//IL_0269: Invalid comparison between Unknown and I4
			//IL_0233: 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_0205: Unknown result type (might be due to invalid IL or missing references)
			//IL_020f: 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_0221: Unknown result type (might be due to invalid IL or missing references)
			//IL_034c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0357: Unknown result type (might be due to invalid IL or missing references)
			//IL_0370: Unknown result type (might be due to invalid IL or missing references)
			//IL_0380: Unknown result type (might be due to invalid IL or missing references)
			//IL_038b: Unknown result type (might be due to invalid IL or missing references)
			//IL_03a4: Unknown result type (might be due to invalid IL or missing references)
			//IL_03b4: Unknown result type (might be due to invalid IL or missing references)
			//IL_03bf: Unknown result type (might be due to invalid IL or missing references)
			//IL_03d8: Unknown result type (might be due to invalid IL or missing references)
			//IL_02c8: Unknown result type (might be due to invalid IL or missing references)
			//IL_026b: Unknown result type (might be due to invalid IL or missing references)
			//IL_026d: Unknown result type (might be due to invalid IL or missing references)
			//IL_027d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0282: Unknown result type (might be due to invalid IL or missing references)
			//IL_028c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0291: Unknown result type (might be due to invalid IL or missing references)
			//IL_0296: Unknown result type (might be due to invalid IL or missing references)
			//IL_02a0: Unknown result type (might be due to invalid IL or missing references)
			//IL_02ab: Unknown result type (might be due to invalid IL or missing references)
			//IL_02b5: Unknown result type (might be due to invalid IL or missing references)
			//IL_02ba: Unknown result type (might be due to invalid IL or missing references)
			int num = 0;
			PickupIndex[] array = null;
			if (ModConfig.DonateSequentialRewards.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[playerStruct.RewardCount % 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)));
			}
			switch (num)
			{
			case 1:
				array = ResolveItemRewardFromStringList(ModConfig.DonateRewardList1.Value);
				break;
			case 2:
				array = ResolveItemRewardFromStringList(ModConfig.DonateRewardList2.Value);
				break;
			case 3:
				array = ResolveItemRewardFromStringList(ModConfig.DonateRewardList3.Value);
				break;
			case 4:
			{
				string value5 = ModConfig.DonateRewardListCharacters.GetValueOrDefault(characterBody.bodyIndex, ModConfig.DonateRewardListCharacterDefault).Value;
				array = ResolveItemRewardFromStringList(value5);
				break;
			}
			}
			if (array == null)
			{
				return;
			}
			int num3 = 0;
			PickupIndex[] array2 = array;
			for (int i = 0; i < array2.Length; i++)
			{
				PickupDef pickupDef = PickupCatalog.GetPickupDef(array2[i]);
				if ((int)pickupDef.itemIndex != -1)
				{
					if (num3 < 20)
					{
						PurchaseInteraction.CreateItemTakenOrb(((Component)self).transform.position + Vector3.up * 6f, ((Component)characterBody).gameObject, pickupDef.itemIndex);
						num3++;
					}
					inventory.GiveItem(pickupDef.itemIndex, 1);
				}
				else if ((int)pickupDef.equipmentIndex != -1)
				{
					EquipmentCatalog.GetEquipmentDef(pickupDef.equipmentIndex);
					EquipmentIndex equipmentIndex = inventory.GetEquipmentIndex();
					if ((int)equipmentIndex != -1)
					{
						PickupDropletController.CreatePickupDroplet(PickupCatalog.FindPickupIndex(equipmentIndex), ((Component)characterBody).gameObject.transform.position + Vector3.up * 1.5f, Vector3.up * 20f + ((Component)self).transform.forward * 2f);
					}
					inventory.SetEquipmentIndex(pickupDef.equipmentIndex);
				}
			}
			switch (num)
			{
			case 1:
				ChatHelper.ThanksTipNormal(networkUser, characterBody.master.playerCharacterMasterController, array);
				break;
			case 2:
				ChatHelper.ThanksTipElite(networkUser, characterBody.master.playerCharacterMasterController, array);
				break;
			case 3:
				ChatHelper.ThanksTipPeculiar(networkUser, characterBody.master.playerCharacterMasterController, array);
				break;
			case 4:
				ChatHelper.ThanksTipCharacter(networkUser, characterBody.master.playerCharacterMasterController, array);
				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 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_0075: Unknown result type (might be due to invalid IL or missing references)
			//IL_0081: Unknown result type (might be due to invalid IL or missing references)
			//IL_0087: Invalid comparison between Unknown and I4
			//IL_00da: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e0: Invalid comparison between Unknown and I4
			//IL_008f: Unknown result type (might be due to invalid IL or missing references)
			//IL_009b: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00fb: Invalid comparison between Unknown and I4
			//IL_010d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0112: Unknown result type (might be due to invalid IL or missing references)
			//IL_0117: Unknown result type (might be due to invalid IL or missing references)
			//IL_0119: 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)
			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))
					{
						return;
					}
					PickupDef pickupDef = PickupCatalog.GetPickupDef(self.CurrentPickupIndex());
					if ((int)pickupDef.itemIndex != -1)
					{
						PurchaseInteraction.CreateItemTakenOrb(((Component)self).transform.position, ((Component)body).gameObject, PickupCatalog.GetPickupDef(self.CurrentPickupIndex()).itemIndex);
						currentActivator.master.inventory.GiveItem(pickupDef.itemIndex, 1);
						self.SetHasBeenPurchased(true);
						self.SetNoPickup();
					}
					else if ((int)pickupDef.equipmentIndex != -1)
					{
						if ((int)currentActivator.master.inventory.GetEquipmentIndex() != -1)
						{
							PickupIndex val = PickupCatalog.FindPickupIndex(currentActivator.master.inventory.GetEquipmentIndex());
							self.SetPickupIndex(val, false);
							((Component)self).GetComponent<PurchaseInteraction>().SetAvailable(true);
						}
						else
						{
							self.SetHasBeenPurchased(true);
							self.SetNoPickup();
						}
						currentActivator.master.inventory.SetEquipmentIndex(pickupDef.equipmentIndex);
					}
				}
				else
				{
					orig.Invoke(self);
					self.SetNoPickup();
				}
			}
			else
			{
				orig.Invoke(self);
			}
		}

		private void ShopTerminalBehavior_GenerateNewPickupServer_bool(orig_GenerateNewPickupServer_bool orig, ShopTerminalBehavior self, bool newHidden)
		{
			//IL_005a: Unknown result type (might be due to invalid IL or missing references)
			//IL_005f: Unknown result type (might be due to invalid IL or missing references)
			//IL_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_007e: 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)
			{
				PickupIndex none = PickupIndex.none;
				PickupIndex[] array = ResolveItemRewardFromStringList(ModConfig.EquipmentReplaceWithEliteList.Value);
				if (array != null)
				{
					none = array[0];
					self.SetPickupIndex(none, newHidden);
					return;
				}
				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.pickupIndex = component2.pickupIndex;
					instancedPurchase.original.hasBeenPurchased = component2.hasBeenPurchased;
				}
			});
		}
	}
	public class BazaarLunarShop : BazaarBase
	{
		[CompilerGenerated]
		private sealed class <DelayRerollEffect>d__19 : 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__19(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 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_0075: Unknown result type (might be due to invalid IL or missing references)
			//IL_0081: Unknown result type (might be due to invalid IL or missing references)
			//IL_0087: Invalid comparison between Unknown and I4
			//IL_00d0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d6: Invalid comparison between Unknown and I4
			//IL_008f: Unknown result type (might be due to invalid IL or missing references)
			//IL_009b: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00eb: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f1: Invalid comparison between Unknown and I4
			//IL_0103: Unknown result type (might be due to invalid IL or missing references)
			//IL_0108: Unknown result type (might be due to invalid IL or missing references)
			//IL_010d: Unknown result type (might be due to invalid IL or missing references)
			//IL_010f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0142: 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))
					{
						return;
					}
					PickupDef pickupDef = PickupCatalog.GetPickupDef(self.CurrentPickupIndex());
					if ((int)pickupDef.itemIndex != -1)
					{
						PurchaseInteraction.CreateItemTakenOrb(((Component)self).transform.position, ((Component)body).gameObject, pickupDef.itemIndex);
						currentActivator.master.inventory.GiveItem(pickupDef.itemIndex, 1);
						self.SetHasBeenPurchased(true);
						self.SetNoPickup();
					}
					else if ((int)pickupDef.equipmentIndex != -1)
					{
						if ((int)currentActivator.master.inventory.GetEquipmentIndex() != -1)
						{
							PickupIndex val = PickupCatalog.FindPickupIndex(currentActivator.master.inventory.GetEquipmentIndex());
							self.SetPickupIndex(val, false);
							((Component)self).GetComponent<PurchaseInteraction>().SetAvailable(true);
						}
						else
						{
							self.SetHasBeenPurchased(true);
							self.SetNoPickup();
						}
						currentActivator.master.inventory.SetEquipmentIndex(pickupDef.equipmentIndex);
					}
				}
				else
				{
					orig.Invoke(self);
					self.SetNoPickup();
				}
			}
			else
			{
				orig.Invoke(self);
			}
		}

		private void ShopTerminalBehavior_GenerateNewPickupServer_bool(orig_GenerateNewPickupServer_bool orig, ShopTerminalBehavior self, bool newHidden)
		{
			//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_0079: Unknown result type (might be due to invalid IL or missing references)
			//IL_007e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0071: Unknown result type (might be due to invalid IL or missing references)
			//IL_0076: Unknown result type (might be due to invalid IL or missing references)
			//IL_0080: 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"))
			{
				PickupIndex none = PickupIndex.none;
				if (!ModConfig.LunarShopSequentialItems.Value)
				{
					generateNewPickupIndex = -1;
				}
				PickupIndex[] array = ResolveItemRewardFromStringList(ModConfig.LunarShopItemList.Value, generateNewPickupIndex);
				none = ((array == null) ? PickupIndex.none : array[0]);
				self.SetPickupIndex(none, newHidden);
				generateNewPickupIndex++;
			}
			else
			{
				orig.Invoke(self, newHidden);
			}
		}

		[IteratorStateMachine(typeof(<DelayRerollEffect>d__19))]
		private IEnumerator DelayRerollEffect(GameObject lunarShopTerminal, float time, int itemIndex)
		{
			//yield-return decompiler failed: Unexpected instruction in Iterator.Dispose()
			return new <DelayRerollEffect>d__19(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)
			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);
			}
			list.ForEach(delegate(GameObject gameObject)
			{
				//IL_0043: Unknown result type (might be due to invalid IL or missing references)
				//IL_0048: Unknown result type (might be due to invalid IL or missing references)
				((Object)gameObject).name = "LunarShopTerminal";
				PurchaseInteraction component = gameObject.GetComponent<PurchaseInteraction>();
				ShopTerminalBehavior component2 = gameObject.GetComponent<ShopTerminalBehavior>();
				if (ModConfig.LunarShopInstancedPurchases.Value)
				{
					InstancedPurchase instancedPurchase = gameObject.AddComponent<InstancedPurchase>();
					instancedPurchase.original.available = component.available;
					instancedPurchase.original.pickupIndex = component2.pickupIndex;
					instancedPurchase.original.hasBeenPurchased = component2.hasBeenPurchased;
				}
				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.SetPickupIndex += new hook_SetPickupIndex(ShopTerminalBehavior_SetPickupIndex);
		}

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

		private void ShopTerminalBehavior_SetPickupIndex(orig_SetPickupIndex orig, ShopTerminalBehavior self, PickupIndex newPickupIndex, bool newHidden)
		{
			//IL_0169: 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_0160: Unknown result type (might be due to invalid IL or missing references)
			//IL_0165: Unknown result type (might be due to invalid IL or missing references)
			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: