Decompiled source of ImprovedCommandEssence v1.4.5

ImprovedCommandEssence.dll

Decompiled 5 months ago
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using BepInEx;
using BepInEx.Configuration;
using EntityStates;
using EntityStates.Scrapper;
using Microsoft.CodeAnalysis;
using On.EntityStates.Scrapper;
using On.RoR2;
using On.RoR2.Artifacts;
using RoR2;
using RoR2.Artifacts;
using UnityEngine;
using UnityEngine.Networking;

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

		public RefSafetyRulesAttribute(int P_0)
		{
			Version = P_0;
		}
	}
}
namespace ImprovedCommandEssence
{
	[BepInPlugin("Cercain.ImprovedCommandEssence", "ImprovedCommandEssence", "1.4.4")]
	public class ImprovedCommandEssence : BaseUnityPlugin
	{
		[CompilerGenerated]
		private static class <>O
		{
			public static hook_OnGenerateInteractableCardSelection <0>__OnGenCommandCards;
		}

		public const string PluginGUID = "Cercain.ImprovedCommandEssence";

		public const string PluginAuthor = "Cercain";

		public const string PluginName = "ImprovedCommandEssence";

		public const string PluginVersion = "1.4.4";

		public static ConfigFile configFile = new ConfigFile(Paths.ConfigPath + "\\ImprovedCommandEssence.cfg", true);

		public static ConfigEntry<int> itemAmountCommon { get; set; }

		public static ConfigEntry<int> itemAmountUncommon { get; set; }

		public static ConfigEntry<int> itemAmountLegendary { get; set; }

		public static ConfigEntry<int> itemAmountLunar { get; set; }

		public static ConfigEntry<int> itemAmountVoid { get; set; }

		public static ConfigEntry<int> itemAmountEquip { get; set; }

		public static ConfigEntry<int> itemAmountAspect { get; set; }

		public static ConfigEntry<int> itemAmountPotential { get; set; }

		public static ConfigEntry<int> itemAmountPotentialCache { get; set; }

		public static ConfigEntry<int> itemAmountBoss { get; set; }

		public static ConfigEntry<bool> keepCategory { get; set; }

		public static ConfigEntry<bool> onInBazaar { get; set; }

		public static ConfigEntry<bool> onInDropShip { get; set; }

		public static ConfigEntry<bool> onForHidden { get; set; }

		public static ConfigEntry<bool> onForAdaptive { get; set; }

		public static ConfigEntry<bool> onForYellowBossDrops { get; set; }

		public static ConfigEntry<bool> onForPotential { get; set; }

		public static ConfigEntry<bool> onForDelusion { get; set; }

		public static ConfigEntry<bool> onForAspect { get; set; }

		public static ConfigEntry<bool> sameBossDrops { get; set; }

		public static ConfigEntry<bool> onForTrophy { get; set; }

		public static ConfigEntry<bool> enableScrappers { get; set; }

		public static ConfigEntry<bool> enablePrinters { get; set; }

		public static ConfigEntry<bool> enableMultishops { get; set; }

		public static ConfigEntry<bool> scrappersDropEssence { get; set; }

		public static ConfigEntry<int> essenceChance { get; set; }

		public static ConfigEntry<string> customCompatibility { get; set; }

		private void ConfigOnSettingChanged(object sender, SettingChangedEventArgs e)
		{
			if (itemAmountCommon.Value <= 0)
			{
				itemAmountCommon.Value = 1;
			}
			if (itemAmountUncommon.Value <= 0)
			{
				itemAmountUncommon.Value = 1;
			}
			if (itemAmountLegendary.Value <= 0)
			{
				itemAmountLegendary.Value = 1;
			}
			if (itemAmountLunar.Value <= 0)
			{
				itemAmountLunar.Value = 1;
			}
			if (itemAmountVoid.Value <= 0)
			{
				itemAmountVoid.Value = 1;
			}
			if (itemAmountEquip.Value <= 0)
			{
				itemAmountEquip.Value = 1;
			}
			if (essenceChance.Value > 100)
			{
				essenceChance.Value = 100;
			}
			if (essenceChance.Value < 0)
			{
				essenceChance.Value = 0;
			}
		}

		public void OnEnable()
		{
			//IL_001b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0025: Expected O, but got Unknown
			//IL_0045: Unknown result type (might be due to invalid IL or missing references)
			//IL_004f: Expected O, but got Unknown
			//IL_006f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0079: Expected O, but got Unknown
			//IL_0099: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a3: Expected O, but got Unknown
			//IL_00c3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00cd: Expected O, but got Unknown
			//IL_00ed: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f7: Expected O, but got Unknown
			//IL_0117: Unknown result type (might be due to invalid IL or missing references)
			//IL_0121: Expected O, but got Unknown
			//IL_0141: Unknown result type (might be due to invalid IL or missing references)
			//IL_014b: Expected O, but got Unknown
			//IL_016b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0175: Expected O, but got Unknown
			//IL_0195: Unknown result type (might be due to invalid IL or missing references)
			//IL_019f: Expected O, but got Unknown
			//IL_01c0: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ca: Expected O, but got Unknown
			//IL_01ea: Unknown result type (might be due to invalid IL or missing references)
			//IL_01f4: Expected O, but got Unknown
			//IL_0214: Unknown result type (might be due to invalid IL or missing references)
			//IL_021e: Expected O, but got Unknown
			//IL_023e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0248: Expected O, but got Unknown
			//IL_0268: Unknown result type (might be due to invalid IL or missing references)
			//IL_0272: Expected O, but got Unknown
			//IL_0292: Unknown result type (might be due to invalid IL or missing references)
			//IL_029c: Expected O, but got Unknown
			//IL_02bc: Unknown result type (might be due to invalid IL or missing references)
			//IL_02c6: Expected O, but got Unknown
			//IL_02e6: Unknown result type (might be due to invalid IL or missing references)
			//IL_02f0: Expected O, but got Unknown
			//IL_0310: Unknown result type (might be due to invalid IL or missing references)
			//IL_031a: Expected O, but got Unknown
			//IL_033a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0344: Expected O, but got Unknown
			//IL_0364: Unknown result type (might be due to invalid IL or missing references)
			//IL_036e: Expected O, but got Unknown
			//IL_038e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0398: Expected O, but got Unknown
			//IL_03b8: Unknown result type (might be due to invalid IL or missing references)
			//IL_03c2: Expected O, but got Unknown
			//IL_03e2: Unknown result type (might be due to invalid IL or missing references)
			//IL_03ec: Expected O, but got Unknown
			//IL_040c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0416: Expected O, but got Unknown
			//IL_0436: Unknown result type (might be due to invalid IL or missing references)
			//IL_0440: Expected O, but got Unknown
			//IL_0463: Unknown result type (might be due to invalid IL or missing references)
			//IL_046d: Expected O, but got Unknown
			//IL_0474: Unknown result type (might be due to invalid IL or missing references)
			//IL_047e: Expected O, but got Unknown
			//IL_0485: Unknown result type (might be due to invalid IL or missing references)
			//IL_048f: Expected O, but got Unknown
			//IL_0496: Unknown result type (might be due to invalid IL or missing references)
			//IL_04a0: Expected O, but got Unknown
			//IL_04b3: Unknown result type (might be due to invalid IL or missing references)
			//IL_04bd: Expected O, but got Unknown
			//IL_04d0: Unknown result type (might be due to invalid IL or missing references)
			//IL_04da: Expected O, but got Unknown
			//IL_04ed: Unknown result type (might be due to invalid IL or missing references)
			//IL_04f7: Expected O, but got Unknown
			//IL_052b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0530: Unknown result type (might be due to invalid IL or missing references)
			//IL_0536: Expected O, but got Unknown
			//IL_054e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0558: Expected O, but got Unknown
			//IL_057c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0586: Expected O, but got Unknown
			//IL_056b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0575: Expected O, but got Unknown
			itemAmountCommon = configFile.Bind<int>("ImprovedCommandEssence", "itemAmountCommon", 6, new ConfigDescription("Set the amount of Common (white) options shown when opening White Command Essences.", (AcceptableValueBase)null, Array.Empty<object>()));
			itemAmountUncommon = configFile.Bind<int>("ImprovedCommandEssence", "itemAmountUncommon", 4, new ConfigDescription("Set the amount of Uncommon (Green) options shown when opening Green Command Essences.", (AcceptableValueBase)null, Array.Empty<object>()));
			itemAmountLegendary = configFile.Bind<int>("ImprovedCommandEssence", "itemAmountLegendary", 2, new ConfigDescription("Set the amount of Legendary (Red) options shown when opening Red Command Essences.", (AcceptableValueBase)null, Array.Empty<object>()));
			itemAmountBoss = configFile.Bind<int>("ImprovedCommandEssence", "itemAmountBoss", 2, new ConfigDescription("Set the amount of Boss (Yellow) items shown when opening Yellow Command Essences with 'onForYellowBossDrops' set to true.", (AcceptableValueBase)null, Array.Empty<object>()));
			itemAmountLunar = configFile.Bind<int>("ImprovedCommandEssence", "itemAmountLunar", 2, new ConfigDescription("Set the amount of Blue items shown when opening Lunar Command Essences.", (AcceptableValueBase)null, Array.Empty<object>()));
			itemAmountVoid = configFile.Bind<int>("ImprovedCommandEssence", "itemAmountVoid", 2, new ConfigDescription("Set the amount of Blue items shown when opening Void Command Essences.", (AcceptableValueBase)null, Array.Empty<object>()));
			itemAmountEquip = configFile.Bind<int>("ImprovedCommandEssence", "itemAmountEquip", 4, new ConfigDescription("Set the amount of Orange items shown when opening Equiptment Command Essences.", (AcceptableValueBase)null, Array.Empty<object>()));
			itemAmountAspect = configFile.Bind<int>("ImprovedCommandEssence", "itemAmountAspect", 2, new ConfigDescription("Set the amount of Aspect items shown when opening Aspect Command Essences.", (AcceptableValueBase)null, Array.Empty<object>()));
			itemAmountPotential = configFile.Bind<int>("ImprovedCommandEssence", "itemAmountPotential", 6, new ConfigDescription("Set the amount of items shown when opening a Void Potential from a Void Cache.", (AcceptableValueBase)null, Array.Empty<object>()));
			itemAmountPotentialCache = configFile.Bind<int>("ImprovedCommandEssence", "itemAmountPotentialCache", 4, new ConfigDescription("Set the amount of items shown when opening a Void Potential from a Void Triple.", (AcceptableValueBase)null, Array.Empty<object>()));
			essenceChance = configFile.Bind<int>("ImprovedCommandEssence", "essenceChance", 100, new ConfigDescription("Set the chance for item drops to drop as a Command Essence (0-100) from non-explicit chests", (AcceptableValueBase)null, Array.Empty<object>()));
			keepCategory = configFile.Bind<bool>("ImprovedCommandEssence", "keepCategory", true, new ConfigDescription("Set if category chests only show items of the corresponding category.", (AcceptableValueBase)null, Array.Empty<object>()));
			onInBazaar = configFile.Bind<bool>("ImprovedCommandEssence", "onInBazaar", false, new ConfigDescription("Set if the Command Artifact is turn on in the Bazaar.", (AcceptableValueBase)null, Array.Empty<object>()));
			onInDropShip = configFile.Bind<bool>("ImprovedCommandEssence", "onInDropShip", false, new ConfigDescription("Set if the Command Artifact is turn on for Drop Ship items.", (AcceptableValueBase)null, Array.Empty<object>()));
			onForHidden = configFile.Bind<bool>("ImprovedCommandEssence", "onForHidden", true, new ConfigDescription("When 'onInDropShip' is false, set if hidden (?) items drop as a Command Essence or the hidden item.", (AcceptableValueBase)null, Array.Empty<object>()));
			onForAdaptive = configFile.Bind<bool>("ImprovedCommandEssence", "onForAdaptive", false, new ConfigDescription("Set if Adaptive Chests will drop a Command Essense (true) or their item (false).", (AcceptableValueBase)null, Array.Empty<object>()));
			onForYellowBossDrops = configFile.Bind<bool>("ImprovedCommandEssence", "onForYellowBossDrops", true, new ConfigDescription("Set if boss items dropped by the teleporter event will drop a Command Essence (true) or their item (false).", (AcceptableValueBase)null, Array.Empty<object>()));
			onForPotential = configFile.Bind<bool>("ImprovedCommandEssence", "onForPotential", false, new ConfigDescription("Set if the Command Artifact is turn on for Void Potentials and Void Caches.", (AcceptableValueBase)null, Array.Empty<object>()));
			onForDelusion = configFile.Bind<bool>("ImprovedCommandEssence", "onForDelusion", false, new ConfigDescription("Set if the items dropped by the Delusion artifact drop as their item or a Command Essence.", (AcceptableValueBase)null, Array.Empty<object>()));
			onForAspect = configFile.Bind<bool>("ImprovedCommandEssence", "onForAspect", false, new ConfigDescription("Set if the Aspects dropped by Elites drop as their item or a Command Essence.", (AcceptableValueBase)null, Array.Empty<object>()));
			sameBossDrops = configFile.Bind<bool>("ImprovedCommandEssence", "sameBossDrops", true, new ConfigDescription("Set if the Command Essences that drop from the Teleporter boss give the same options.", (AcceptableValueBase)null, Array.Empty<object>()));
			onForTrophy = configFile.Bind<bool>("ImprovedCommandEssence", "onForTrophy", false, new ConfigDescription("Set if the item dropped by bosses killed via Trophy Hunter's Tricorn drop as a Command Essence (true) or the boss item (false)", (AcceptableValueBase)null, Array.Empty<object>()));
			enableScrappers = configFile.Bind<bool>("ImprovedCommandEssence", "enableScrappers", false, new ConfigDescription("Set if Scrappers spawn", (AcceptableValueBase)null, Array.Empty<object>()));
			enablePrinters = configFile.Bind<bool>("ImprovedCommandEssence", "enablePrinters", false, new ConfigDescription("Set if Printers spawn (onInDropShip must be on to drop as the item)", (AcceptableValueBase)null, Array.Empty<object>()));
			enableMultishops = configFile.Bind<bool>("ImprovedCommandEssence", "enableTerminals", false, new ConfigDescription("Set if Multishops spawn (onInDropShip must be on to drop as the item)", (AcceptableValueBase)null, Array.Empty<object>()));
			scrappersDropEssence = configFile.Bind<bool>("ImprovedCommandEssence", "scrappersDropEssence", false, new ConfigDescription("Set if Scrappers drop scrap (false) or Command Essence (true)", (AcceptableValueBase)null, Array.Empty<object>()));
			((BaseUnityPlugin)this).Config.SettingChanged += ConfigOnSettingChanged;
			PickupPickerController.SetOptionsFromPickupForCommandArtifact += new hook_SetOptionsFromPickupForCommandArtifact(SetOptions);
			ChestBehavior.BaseItemDrop += new hook_BaseItemDrop(BaseItemDrop);
			PickupDropletController.OnCollisionEnter += new hook_OnCollisionEnter(DropletCollisionEnter);
			BossGroup.DropRewards += new hook_DropRewards(BossGroupDropRewards);
			if (!onInDropShip.Value)
			{
				ShopTerminalBehavior.DropPickup += new hook_DropPickup(TerminalDrop);
			}
			if (!onForAdaptive.Value)
			{
				RouletteChestController.EjectPickupServer += new hook_EjectPickupServer(RouletteEject);
			}
			if (!onForTrophy.Value)
			{
				EquipmentSlot.FireBossHunter += new hook_FireBossHunter(BossHunterDrop);
			}
			if (enableScrappers.Value || enableMultishops.Value || enablePrinters.Value)
			{
				object obj = <>O.<0>__OnGenCommandCards;
				if (obj == null)
				{
					hook_OnGenerateInteractableCardSelection val = OnGenCommandCards;
					<>O.<0>__OnGenCommandCards = val;
					obj = (object)val;
				}
				CommandArtifactManager.OnGenerateInteractableCardSelection += (hook_OnGenerateInteractableCardSelection)obj;
			}
			if (!scrappersDropEssence.Value)
			{
				ScrappingToIdle.OnEnter += new hook_OnEnter(ScrapperDrop);
			}
			if (!onForPotential.Value)
			{
				OptionChestBehavior.Roll += new hook_Roll(PotentialRoll);
			}
			OptionChestBehavior.ItemDrop += new hook_ItemDrop(OptionItemDrop);
		}

		[Server]
		public void PotentialRoll(orig_Roll orig, OptionChestBehavior self)
		{
			if (!RunArtifactManager.instance.IsArtifactEnabled(Artifacts.commandArtifactDef))
			{
				orig.Invoke(self);
			}
			else if (!NetworkServer.active)
			{
				Debug.LogWarning((object)"[Server] function 'System.Void RoR2.OptionChestBehavior::Roll()' called on client");
			}
			else if (((Component)self).gameObject.GetComponent<GenericDisplayNameProvider>().displayToken == "LOCKBOXVOID_NAME")
			{
				self.generatedDrops = self.dropTable.GenerateUniqueDrops(itemAmountPotentialCache.Value, self.rng);
			}
			else
			{
				self.generatedDrops = self.dropTable.GenerateUniqueDrops(itemAmountPotential.Value, self.rng);
			}
		}

		[Server]
		public void OptionItemDrop(orig_ItemDrop orig, OptionChestBehavior self)
		{
			//IL_004d: 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_007f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0086: Unknown result type (might be due to invalid IL or missing references)
			//IL_008b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0093: Unknown result type (might be due to invalid IL or missing references)
			//IL_0098: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ae: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b9: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c9: Unknown result type (might be due to invalid IL or missing references)
			if (!RunArtifactManager.instance.IsArtifactEnabled(Artifacts.commandArtifactDef))
			{
				orig.Invoke(self);
			}
			else if (!NetworkServer.active)
			{
				Debug.LogWarning((object)"[Server] function 'System.Void RoR2.OptionChestBehavior::ItemDrop()' called on client");
			}
			else if (self.generatedDrops != null && self.generatedDrops.Length != 0)
			{
				TrackBehaviour track = new TrackBehaviour
				{
					PickupSource = PickupSource.VoidPotential
				};
				CreatePickupInfo pickupInfo = new CreatePickupInfo
				{
					pickerOptions = PickupPickerController.GenerateOptionsFromArray(self.generatedDrops),
					prefabOverride = self.pickupPrefab,
					position = self.dropTransform.position,
					rotation = Quaternion.identity
				};
				((CreatePickupInfo)(ref pickupInfo)).pickupIndex = PickupCatalog.FindPickupIndex(self.displayTier);
				CreatePickupDroplet(pickupInfo, Vector3.up * self.dropUpVelocityStrength + self.dropTransform.forward * self.dropForwardVelocityStrength, track);
				self.generatedDrops = null;
			}
		}

		private bool BossHunterDrop(orig_FireBossHunter orig, EquipmentSlot self)
		{
			//IL_001f: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d9: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00de: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e8: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ed: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00fb: Unknown result type (might be due to invalid IL or missing references)
			//IL_010a: Unknown result type (might be due to invalid IL or missing references)
			//IL_010f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0111: Unknown result type (might be due to invalid IL or missing references)
			//IL_0118: Unknown result type (might be due to invalid IL or missing references)
			//IL_025d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0264: Expected O, but got Unknown
			//IL_0273: Unknown result type (might be due to invalid IL or missing references)
			//IL_0275: Unknown result type (might be due to invalid IL or missing references)
			//IL_027f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0284: Unknown result type (might be due to invalid IL or missing references)
			//IL_02a2: Unknown result type (might be due to invalid IL or missing references)
			//IL_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_02ae: Unknown result type (might be due to invalid IL or missing references)
			//IL_02b0: Unknown result type (might be due to invalid IL or missing references)
			//IL_02b5: Unknown result type (might be due to invalid IL or missing references)
			//IL_02b6: Unknown result type (might be due to invalid IL or missing references)
			//IL_02bd: 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)
			//IL_02c0: Unknown result type (might be due to invalid IL or missing references)
			//IL_02cb: Expected O, but got Unknown
			//IL_031d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0457: Unknown result type (might be due to invalid IL or missing references)
			//IL_0461: Unknown result type (might be due to invalid IL or missing references)
			//IL_047c: Unknown result type (might be due to invalid IL or missing references)
			//IL_03ab: Unknown result type (might be due to invalid IL or missing references)
			//IL_03b0: Unknown result type (might be due to invalid IL or missing references)
			//IL_03b8: Unknown result type (might be due to invalid IL or missing references)
			//IL_03c2: Unknown result type (might be due to invalid IL or missing references)
			//IL_03c3: 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_03d1: Unknown result type (might be due to invalid IL or missing references)
			//IL_03d6: Unknown result type (might be due to invalid IL or missing references)
			//IL_03db: Unknown result type (might be due to invalid IL or missing references)
			//IL_03e0: Unknown result type (might be due to invalid IL or missing references)
			//IL_03e5: Unknown result type (might be due to invalid IL or missing references)
			//IL_03ed: Unknown result type (might be due to invalid IL or missing references)
			//IL_0402: Expected O, but got Unknown
			//IL_0359: Unknown result type (might be due to invalid IL or missing references)
			//IL_035e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0366: 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_0378: Unknown result type (might be due to invalid IL or missing references)
			//IL_037d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0382: 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_039f: Expected O, but got Unknown
			if (!RunArtifactManager.instance.IsArtifactEnabled(Artifacts.commandArtifactDef))
			{
				return orig.Invoke(self);
			}
			self.UpdateTargets(Equipment.BossHunter.equipmentIndex, true);
			HurtBox hurtBox = self.currentTarget.hurtBox;
			DeathRewards val;
			if ((Object)(object)hurtBox == (Object)null)
			{
				val = null;
			}
			else
			{
				HealthComponent healthComponent = hurtBox.healthComponent;
				if ((Object)(object)healthComponent == (Object)null)
				{
					val = null;
				}
				else
				{
					CharacterBody body = healthComponent.body;
					if ((Object)(object)body == (Object)null)
					{
						val = null;
					}
					else
					{
						GameObject gameObject = ((Component)body).gameObject;
						val = (((Object)(object)gameObject != (Object)null) ? gameObject.GetComponent<DeathRewards>() : null);
					}
				}
			}
			DeathRewards val2 = val;
			if (Object.op_Implicit((Object)(object)hurtBox) && Object.op_Implicit((Object)(object)val2))
			{
				TrackBehaviour trackBehaviour = new TrackBehaviour();
				trackBehaviour.ItemTag = (ItemTag)0;
				trackBehaviour.PickupSource = PickupSource.BossHunter;
				CharacterBody body2 = hurtBox.healthComponent.body;
				Vector3 val3 = (Object.op_Implicit((Object)(object)body2) ? body2.corePosition : Vector3.zero);
				Vector3 val4 = val3 - self.characterBody.corePosition;
				Vector3 normalized = ((Vector3)(ref val4)).normalized;
				CreatePickupDroplet(val2.bossDropTable.GenerateDrop(self.rng), val3, normalized * 15f, trackBehaviour);
				Object val5;
				if ((Object)(object)hurtBox == (Object)null)
				{
					val5 = null;
				}
				else
				{
					HealthComponent healthComponent2 = hurtBox.healthComponent;
					if ((Object)(object)healthComponent2 == (Object)null)
					{
						val5 = null;
					}
					else
					{
						CharacterBody body3 = healthComponent2.body;
						val5 = (Object)(object)(((Object)(object)body3 != (Object)null) ? body3.master : null);
					}
				}
				if (Object.op_Implicit(val5))
				{
					hurtBox.healthComponent.body.master.TrueKill(((Component)this).gameObject, (GameObject)null, (DamageType)0);
				}
				CharacterModel component = ((Component)hurtBox.hurtBoxGroup).GetComponent<CharacterModel>();
				if (Object.op_Implicit((Object)(object)component))
				{
					TemporaryOverlay obj = ((Component)component).gameObject.AddComponent<TemporaryOverlay>();
					obj.duration = 0.1f;
					obj.animateShaderAlpha = true;
					obj.alphaCurve = AnimationCurve.EaseInOut(0f, 1f, 1f, 0f);
					obj.destroyComponentOnEnd = true;
					obj.originalMaterial = LegacyResourcesAPI.Load<Material>("Materials/matHuntressFlashBright");
					obj.AddToCharacerModel(component);
					TemporaryOverlay obj2 = ((Component)component).gameObject.AddComponent<TemporaryOverlay>();
					obj2.duration = 1.2f;
					obj2.animateShaderAlpha = true;
					obj2.alphaCurve = AnimationCurve.EaseInOut(0f, 1f, 1f, 0f);
					obj2.destroyComponentOnEnd = true;
					obj2.originalMaterial = LegacyResourcesAPI.Load<Material>("Materials/matGhostEffect");
					obj2.AddToCharacerModel(component);
				}
				DamageInfo val6 = new DamageInfo();
				val6.attacker = ((Component)this).gameObject;
				val6.force = -normalized * 2500f;
				self.healthComponent.TakeDamageForce(val6, true, false);
				GameObject obj3 = LegacyResourcesAPI.Load<GameObject>("Prefabs/Effects/BossHunterKillEffect");
				Quaternion rotation = Util.QuaternionSafeLookRotation(normalized, Vector3.up);
				EffectManager.SpawnEffect(obj3, new EffectData
				{
					origin = val3,
					rotation = rotation
				}, true);
				ModelLocator component2 = ((Component)this).gameObject.GetComponent<ModelLocator>();
				CharacterModel val7;
				if ((Object)(object)component2 == (Object)null)
				{
					val7 = null;
				}
				else
				{
					Transform modelTransform = component2.modelTransform;
					val7 = (((Object)(object)modelTransform != (Object)null) ? ((Component)modelTransform).GetComponent<CharacterModel>() : null);
				}
				CharacterModel val8 = val7;
				if (Object.op_Implicit((Object)(object)val8))
				{
					foreach (GameObject equipmentDisplayObject in val8.GetEquipmentDisplayObjects(Equipment.BossHunter.equipmentIndex))
					{
						if (((Object)equipmentDisplayObject).name.Contains("DisplayTricorn"))
						{
							EffectManager.SpawnEffect(LegacyResourcesAPI.Load<GameObject>("Prefabs/Effects/BossHunterHatEffect"), new EffectData
							{
								origin = equipmentDisplayObject.transform.position,
								rotation = equipmentDisplayObject.transform.rotation,
								scale = equipmentDisplayObject.transform.localScale.x
							}, true);
						}
						else
						{
							EffectManager.SpawnEffect(LegacyResourcesAPI.Load<GameObject>("Prefabs/Effects/BossHunterGunEffect"), new EffectData
							{
								origin = equipmentDisplayObject.transform.position,
								rotation = Util.QuaternionSafeLookRotation(val3 - equipmentDisplayObject.transform.position, Vector3.up),
								scale = equipmentDisplayObject.transform.localScale.x
							}, true);
						}
					}
				}
				CharacterBody characterBody = self.characterBody;
				if (Object.op_Implicit((Object)(object)(((Object)(object)characterBody != (Object)null) ? characterBody.inventory : null)))
				{
					CharacterMasterNotificationQueue.PushEquipmentTransformNotification(self.characterBody.master, self.characterBody.inventory.currentEquipmentIndex, Equipment.BossHunterConsumed.equipmentIndex, (TransformationType)0);
					self.characterBody.inventory.SetEquipmentIndex(Equipment.BossHunterConsumed.equipmentIndex);
				}
				self.InvalidateCurrentTarget();
				return true;
			}
			return false;
		}

		private void BossGroupDropRewards(orig_DropRewards orig, BossGroup self)
		{
			//IL_0080: Unknown result type (might be due to invalid IL or missing references)
			//IL_0085: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ae: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ef: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f4: 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_0170: Unknown result type (might be due to invalid IL or missing references)
			//IL_0175: Unknown result type (might be due to invalid IL or missing references)
			//IL_017a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0184: Unknown result type (might be due to invalid IL or missing references)
			//IL_0189: Unknown result type (might be due to invalid IL or missing references)
			//IL_0193: Unknown result type (might be due to invalid IL or missing references)
			//IL_0198: Unknown result type (might be due to invalid IL or missing references)
			//IL_019d: Unknown result type (might be due to invalid IL or missing references)
			//IL_01a2: Unknown result type (might be due to invalid IL or missing references)
			//IL_01a4: Unknown result type (might be due to invalid IL or missing references)
			//IL_01a9: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ae: Unknown result type (might be due to invalid IL or missing references)
			//IL_0217: Unknown result type (might be due to invalid IL or missing references)
			//IL_0218: Unknown result type (might be due to invalid IL or missing references)
			//IL_03b8: Unknown result type (might be due to invalid IL or missing references)
			//IL_03c5: Unknown result type (might be due to invalid IL or missing references)
			//IL_03ca: Unknown result type (might be due to invalid IL or missing references)
			//IL_03d9: Unknown result type (might be due to invalid IL or missing references)
			//IL_03db: Unknown result type (might be due to invalid IL or missing references)
			//IL_03dd: Unknown result type (might be due to invalid IL or missing references)
			//IL_03e2: Unknown result type (might be due to invalid IL or missing references)
			//IL_02bd: Unknown result type (might be due to invalid IL or missing references)
			//IL_02c2: Unknown result type (might be due to invalid IL or missing references)
			//IL_029e: 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_037b: 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_0396: Unknown result type (might be due to invalid IL or missing references)
			//IL_0398: Unknown result type (might be due to invalid IL or missing references)
			//IL_039d: Unknown result type (might be due to invalid IL or missing references)
			//IL_039f: 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_02e3: Unknown result type (might be due to invalid IL or missing references)
			if (!RunArtifactManager.instance.IsArtifactEnabled(Artifacts.commandArtifactDef))
			{
				orig.Invoke(self);
				return;
			}
			if (!Object.op_Implicit((Object)(object)Run.instance))
			{
				Debug.LogError((object)"No valid run instance!");
				return;
			}
			if (self.rng == null)
			{
				Debug.LogError((object)"RNG is null!");
				return;
			}
			int participatingPlayerCount = Run.instance.participatingPlayerCount;
			if (participatingPlayerCount == 0)
			{
				return;
			}
			if (Object.op_Implicit((Object)(object)self.dropPosition))
			{
				PickupIndex none = PickupIndex.none;
				Option[] optionsFromPickupIndex;
				if (Object.op_Implicit((Object)(object)self.dropTable))
				{
					none = self.dropTable.GenerateDrop(self.rng);
					optionsFromPickupIndex = PickupPickerController.GetOptionsFromPickupIndex(none);
				}
				else
				{
					List<PickupIndex> list = Run.instance.availableTier2DropList;
					if (self.forceTier3Reward)
					{
						list = Run.instance.availableTier3DropList;
					}
					none = self.rng.NextElementUniform<PickupIndex>(list);
					optionsFromPickupIndex = PickupPickerController.GetOptionsFromPickupIndex(none);
				}
				int itemAmountFromTier = GetItemAmountFromTier(((PickupIndex)(ref optionsFromPickupIndex[0].pickupIndex)).pickupDef);
				optionsFromPickupIndex = (from x in optionsFromPickupIndex.ToList()
					orderby self.rng.Next()
					select x).Take(itemAmountFromTier).ToArray();
				int num = 1 + self.bonusRewardCount;
				if (self.scaleRewardsByPlayerCount)
				{
					num *= participatingPlayerCount;
				}
				float num2 = 360f / (float)num;
				Vector3 val = Quaternion.AngleAxis((float)Random.Range(0, 360), Vector3.up) * (Vector3.up * 40f + Vector3.forward * 5f);
				Quaternion val2 = Quaternion.AngleAxis(num2, Vector3.up);
				bool flag = self.bossDrops != null && self.bossDrops.Count > 0;
				bool flag2 = self.bossDropTables != null && self.bossDropTables.Count > 0;
				int num3 = 0;
				Option[] array = null;
				while (num3 < num)
				{
					TrackBehaviour trackBehaviour = new TrackBehaviour();
					trackBehaviour.PickupSource = PickupSource.Boss;
					Option[] options = optionsFromPickupIndex;
					PickupIndex val3 = none;
					if (self.bossDrops != null && (flag || flag2) && self.rng.nextNormalizedFloat <= self.bossDropChance)
					{
						trackBehaviour.PickupSource = PickupSource.YellowBoss;
						Debug.Log((object)"Generated Boss Rewards");
						if (flag2)
						{
							PickupDropTable val4 = self.rng.NextElementUniform<PickupDropTable>(self.bossDropTables);
							if ((Object)(object)val4 != (Object)null)
							{
								val3 = val4.GenerateDrop(self.rng);
							}
						}
						else
						{
							val3 = self.rng.NextElementUniform<PickupIndex>(self.bossDrops);
						}
						if (onForYellowBossDrops.Value)
						{
							if (sameBossDrops.Value)
							{
								if (array == null)
								{
									array = (from x in PickupPickerController.GetOptionsFromPickupIndex(val3)
										orderby self.rng.Next()
										select x).Take(itemAmountBoss.Value).ToArray();
								}
								options = array;
							}
							else
							{
								options = (from x in PickupPickerController.GetOptionsFromPickupIndex(val3)
									orderby self.rng.Next()
									select x).Take(itemAmountBoss.Value).ToArray();
							}
						}
						else
						{
							options = (Option[])(object)new Option[1]
							{
								new Option
								{
									available = Run.instance.IsPickupAvailable(val3),
									pickupIndex = val3
								}
							};
						}
					}
					trackBehaviour.ItemTag = (ItemTag)0;
					trackBehaviour.Options = options;
					CreatePickupDroplet(val3, self.dropPosition.position, val, trackBehaviour);
					num3++;
					val = val2 * val;
				}
			}
			else
			{
				Debug.LogWarning((object)"dropPosition not set for BossGroup! No item will be spawned.");
			}
		}

		private static void OnGenCommandCards(orig_OnGenerateInteractableCardSelection orig, SceneDirector sceneDirector, DirectorCardCategorySelection dccs)
		{
			dccs.RemoveCardsThatFailFilter((Predicate<DirectorCard>)CheckCardsFilter);
		}

		private static bool CheckCardsFilter(DirectorCard card)
		{
			GameObject prefab = card.spawnCard.prefab;
			if (!enableMultishops.Value && Object.op_Implicit((Object)(object)prefab.GetComponent<MultiShopController>()))
			{
				return false;
			}
			if (!enableScrappers.Value && Object.op_Implicit((Object)(object)prefab.GetComponent<ScrapperController>()))
			{
				return false;
			}
			if (!enablePrinters.Value && Object.op_Implicit((Object)(object)prefab.GetComponent<ShopTerminalBehavior>()))
			{
				return false;
			}
			return true;
		}

		private void ScrapperDrop(orig_OnEnter orig, ScrappingToIdle self)
		{
			//IL_00ef: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00fb: 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_0165: Unknown result type (might be due to invalid IL or missing references)
			//IL_0110: Unknown result type (might be due to invalid IL or missing references)
			//IL_0115: Unknown result type (might be due to invalid IL or missing references)
			//IL_0116: Unknown result type (might be due to invalid IL or missing references)
			//IL_0130: Expected I4, but got Unknown
			//IL_0194: Unknown result type (might be due to invalid IL or missing references)
			//IL_0196: Unknown result type (might be due to invalid IL or missing references)
			//IL_019b: Unknown result type (might be due to invalid IL or missing references)
			//IL_01a5: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ab: Unknown result type (might be due to invalid IL or missing references)
			//IL_01b5: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ba: Unknown result type (might be due to invalid IL or missing references)
			//IL_0137: Unknown result type (might be due to invalid IL or missing references)
			//IL_013c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0144: Unknown result type (might be due to invalid IL or missing references)
			//IL_0149: Unknown result type (might be due to invalid IL or missing references)
			//IL_0151: Unknown result type (might be due to invalid IL or missing references)
			//IL_0156: Unknown result type (might be due to invalid IL or missing references)
			//IL_015e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0163: Unknown result type (might be due to invalid IL or missing references)
			if (!RunArtifactManager.instance.IsArtifactEnabled(Artifacts.commandArtifactDef))
			{
				orig.Invoke(self);
				return;
			}
			if (Object.op_Implicit((Object)(object)((EntityState)self).characterBody))
			{
				((BaseState)self).attackSpeedStat = ((EntityState)self).characterBody.attackSpeed;
				((BaseState)self).damageStat = ((EntityState)self).characterBody.damage;
				((BaseState)self).critStat = ((EntityState)self).characterBody.crit;
				((BaseState)self).moveSpeedStat = ((EntityState)self).characterBody.moveSpeed;
			}
			((ScrapperBaseState)self).pickupPickerController = ((EntityState)self).GetComponent<PickupPickerController>();
			((ScrapperBaseState)self).scrapperController = ((EntityState)self).GetComponent<ScrapperController>();
			((ScrapperBaseState)self).pickupPickerController.SetAvailable(((ScrapperBaseState)self).enableInteraction);
			Util.PlaySound(ScrappingToIdle.enterSoundString, ((EntityState)self).gameObject);
			((EntityState)self).PlayAnimation("Base", "ScrappingToIdle", "Scrapping.playbackRate", ScrappingToIdle.duration);
			if (Object.op_Implicit((Object)(object)ScrappingToIdle.muzzleflashEffectPrefab))
			{
				EffectManager.SimpleMuzzleFlash(ScrappingToIdle.muzzleflashEffectPrefab, ((EntityState)self).gameObject, ScrappingToIdle.muzzleString, false);
			}
			if (!NetworkServer.active)
			{
				return;
			}
			self.foundValidScrap = false;
			PickupIndex val = PickupIndex.none;
			ItemDef itemDef = ItemCatalog.GetItemDef(((ScrapperBaseState)self).scrapperController.lastScrappedItemIndex);
			if ((Object)(object)itemDef != (Object)null)
			{
				ItemTier tier = itemDef.tier;
				switch ((int)tier)
				{
				case 0:
					val = PickupCatalog.FindPickupIndex("ItemIndex.ScrapWhite");
					break;
				case 1:
					val = PickupCatalog.FindPickupIndex("ItemIndex.ScrapGreen");
					break;
				case 2:
					val = PickupCatalog.FindPickupIndex("ItemIndex.ScrapRed");
					break;
				case 4:
					val = PickupCatalog.FindPickupIndex("ItemIndex.ScrapYellow");
					break;
				}
			}
			if (val != PickupIndex.none)
			{
				self.foundValidScrap = true;
				Transform val2 = ((BaseState)self).FindModelChild(ScrappingToIdle.muzzleString);
				TrackBehaviour trackBehaviour = new TrackBehaviour();
				trackBehaviour.PickupSource = PickupSource.Scrapper;
				CreatePickupDroplet(val, val2.position, Vector3.up * ScrappingToIdle.dropUpVelocityStrength + val2.forward * ScrappingToIdle.dropForwardVelocityStrength, trackBehaviour);
				ScrapperController scrapperController = ((ScrapperBaseState)self).scrapperController;
				int itemsEaten = scrapperController.itemsEaten;
				scrapperController.itemsEaten = itemsEaten - 1;
			}
		}

		private void RouletteEject(orig_EjectPickupServer orig, RouletteChestController self, PickupIndex pickupIndex)
		{
			//IL_001a: 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_0013: 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_003d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0048: Unknown result type (might be due to invalid IL or missing references)
			//IL_004e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0053: Unknown result type (might be due to invalid IL or missing references)
			if (!RunArtifactManager.instance.IsArtifactEnabled(Artifacts.commandArtifactDef))
			{
				orig.Invoke(self, pickupIndex);
			}
			else if (!(pickupIndex == PickupIndex.none))
			{
				TrackBehaviour trackBehaviour = new TrackBehaviour();
				trackBehaviour.PickupSource = PickupSource.Roulette;
				CreatePickupDroplet(pickupIndex, self.ejectionTransform.position, self.ejectionTransform.rotation * self.localEjectionVelocity, trackBehaviour);
			}
		}

		[Server]
		public void BaseItemDrop(orig_BaseItemDrop orig, ChestBehavior self)
		{
			//IL_0022: 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_004a: 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_0060: Unknown result type (might be due to invalid IL or missing references)
			//IL_006b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0070: Unknown result type (might be due to invalid IL or missing references)
			//IL_0075: Unknown result type (might be due to invalid IL or missing references)
			//IL_0076: Unknown result type (might be due to invalid IL or missing references)
			//IL_007b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0080: Unknown result type (might be due to invalid IL or missing references)
			//IL_0088: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ad: 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_00c8: Unknown result type (might be due to invalid IL or missing references)
			//IL_00cd: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00dc: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e1: Unknown result type (might be due to invalid IL or missing references)
			//IL_0120: Unknown result type (might be due to invalid IL or missing references)
			//IL_00fc: Unknown result type (might be due to invalid IL or missing references)
			//IL_0101: Unknown result type (might be due to invalid IL or missing references)
			//IL_0103: Unknown result type (might be due to invalid IL or missing references)
			//IL_010a: Unknown result type (might be due to invalid IL or missing references)
			//IL_010b: Unknown result type (might be due to invalid IL or missing references)
			//IL_010c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0111: Unknown result type (might be due to invalid IL or missing references)
			if (!RunArtifactManager.instance.IsArtifactEnabled(Artifacts.commandArtifactDef))
			{
				orig.Invoke(self);
			}
			else if (NetworkServer.active && !(self.dropPickup == PickupIndex.none) && self.dropCount >= 1)
			{
				float num = 360f / (float)self.dropCount;
				Vector3 val = Vector3.up * self.dropUpVelocityStrength + self.dropTransform.forward * self.dropForwardVelocityStrength;
				Quaternion val2 = Quaternion.AngleAxis(num, Vector3.up);
				TrackBehaviour track = new TrackBehaviour
				{
					ItemTag = self.requiredItemTag,
					DropTable = self.dropTable,
					PickupSource = PickupSource.Chest
				};
				for (int i = 0; i < self.dropCount; i++)
				{
					CreatePickupInfo pickupInfo = default(CreatePickupInfo);
					((CreatePickupInfo)(ref pickupInfo)).pickupIndex = self.dropPickup;
					pickupInfo.position = self.dropTransform.position + Vector3.up * 1.5f;
					pickupInfo.chest = self;
					pickupInfo.artifactFlag = (PickupArtifactFlag)(self.isCommandChest ? 1 : 0);
					CreatePickupDroplet(pickupInfo, val, track);
					val = val2 * val;
				}
				self.dropPickup = PickupIndex.none;
			}
		}

		[Server]
		private void TerminalDrop(orig_DropPickup orig, ShopTerminalBehavior self)
		{
			//IL_0055: 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_0081: Unknown result type (might be due to invalid IL or missing references)
			//IL_0086: Unknown result type (might be due to invalid IL or missing references)
			if (!RunArtifactManager.instance.IsArtifactEnabled(Artifacts.commandArtifactDef))
			{
				orig.Invoke(self);
				return;
			}
			if (!NetworkServer.active)
			{
				Debug.LogWarning((object)"[Server] function 'System.Void RoR2.ShopTerminalBehavior::DropPickup()' called on client");
				return;
			}
			TrackBehaviour trackBehaviour = new TrackBehaviour();
			if (!onForHidden.Value || !self.hidden)
			{
				trackBehaviour.PickupSource = PickupSource.Terminal;
			}
			self.SetHasBeenPurchased(true);
			CreatePickupDroplet(self.pickupIndex, (Object.op_Implicit((Object)(object)self.dropTransform) ? self.dropTransform : ((Component)self).transform).position, ((Component)self).transform.TransformVector(self.dropVelocity), trackBehaviour);
		}

		private void CreatePickupDroplet(PickupIndex pickupIndex, Vector3 position, Vector3 velocity, TrackBehaviour track)
		{
			//IL_0003: 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_0010: Unknown result type (might be due to invalid IL or missing references)
			//IL_0017: Unknown result type (might be due to invalid IL or missing references)
			//IL_0018: Unknown result type (might be due to invalid IL or missing references)
			//IL_001f: Unknown result type (might be due to invalid IL or missing references)
			//IL_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)
			CreatePickupInfo pickupInfo = new CreatePickupInfo
			{
				rotation = Quaternion.identity,
				position = position
			};
			((CreatePickupInfo)(ref pickupInfo)).pickupIndex = pickupIndex;
			CreatePickupDroplet(pickupInfo, velocity, track);
		}

		public void CreatePickupDroplet(CreatePickupInfo pickupInfo, Vector3 velocity, TrackBehaviour track)
		{
			//IL_0019: Unknown result type (might be due to invalid IL or missing references)
			//IL_001a: Unknown result type (might be due to invalid IL or missing references)
			//IL_001f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0050: Unknown result type (might be due to invalid IL or missing references)
			//IL_0088: Unknown result type (might be due to invalid IL or missing references)
			//IL_009d: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a2: Unknown result type (might be due to invalid IL or missing references)
			//IL_006e: 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_0077: Unknown result type (might be due to invalid IL or missing references)
			if (CommandArtifactManager.IsCommandArtifactEnabled)
			{
				ref PickupArtifactFlag artifactFlag = ref pickupInfo.artifactFlag;
				artifactFlag = (PickupArtifactFlag)((uint)artifactFlag & 0xFFFFFFFEu);
			}
			GameObject obj = Object.Instantiate<GameObject>(PickupDropletController.pickupDropletPrefab, pickupInfo.position, Quaternion.identity);
			PickupDropletController component = obj.GetComponent<PickupDropletController>();
			TrackBehaviour trackBehaviour = obj.AddComponent<TrackBehaviour>();
			trackBehaviour.PickupSource = track.PickupSource;
			trackBehaviour.DropTable = track.DropTable;
			trackBehaviour.ItemTag = track.ItemTag;
			trackBehaviour.Options = track.Options;
			if (Object.op_Implicit((Object)(object)component))
			{
				component.createPickupInfo = pickupInfo;
				component.NetworkpickupIndex = ((CreatePickupInfo)(ref pickupInfo)).pickupIndex;
			}
			Rigidbody component2 = obj.GetComponent<Rigidbody>();
			component2.velocity = velocity;
			component2.AddTorque(Random.Range(150f, 120f) * Random.onUnitSphere);
			NetworkServer.Spawn(obj);
		}

		public void DropletCollisionEnter(orig_OnCollisionEnter orig, PickupDropletController self, Collision collision)
		{
			//IL_00ba: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ee: Unknown result type (might be due to invalid IL or missing references)
			//IL_0124: Unknown result type (might be due to invalid IL or missing references)
			//IL_0129: Unknown result type (might be due to invalid IL or missing references)
			//IL_0149: Unknown result type (might be due to invalid IL or missing references)
			//IL_015a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0160: Invalid comparison between Unknown and I4
			//IL_0164: Unknown result type (might be due to invalid IL or missing references)
			//IL_01b5: Unknown result type (might be due to invalid IL or missing references)
			//IL_02a0: Unknown result type (might be due to invalid IL or missing references)
			//IL_02a6: Invalid comparison between Unknown and I4
			//IL_02b8: Unknown result type (might be due to invalid IL or missing references)
			//IL_02be: Invalid comparison between Unknown and I4
			//IL_02d0: Unknown result type (might be due to invalid IL or missing references)
			//IL_02d6: Invalid comparison between Unknown and I4
			if (!RunArtifactManager.instance.IsArtifactEnabled(Artifacts.commandArtifactDef))
			{
				orig.Invoke(self, collision);
			}
			else if (NetworkServer.active && self.alive)
			{
				List<EquipmentDef> source = new List<EquipmentDef>
				{
					Equipment.AffixBlue,
					Equipment.AffixHaunted,
					Equipment.AffixLunar,
					Equipment.AffixPoison,
					Equipment.AffixRed,
					Equipment.AffixWhite,
					Equipment.EliteVoidEquipment,
					Elites.Earth.eliteEquipmentDef
				};
				((BaseUnityPlugin)this).Logger.LogInfo((object)$"Droplet {self.pickupIndex}:{((PickupIndex)(ref self.pickupIndex)).pickupDef.itemIndex}:{((PickupIndex)(ref self.pickupIndex)).pickupDef.equipmentIndex}");
				self.alive = false;
				self.createPickupInfo.position = ((Component)self).transform.position;
				bool shouldSpawn = true;
				TrackBehaviour trackBehaviour = default(TrackBehaviour);
				bool flag = ((Component)self).gameObject.TryGetComponent<TrackBehaviour>(ref trackBehaviour);
				PickupDef pickupDef = PickupCatalog.GetPickupDef(self.pickupIndex);
				bool flag2 = false;
				if ((int)pickupDef.itemIndex != -1)
				{
					flag2 = ItemCatalog.GetItemDef(pickupDef.itemIndex).ContainsTag((ItemTag)9);
				}
				if (!(Random.Range(0f, 100f) < (float)essenceChance.Value) || flag2 || (!onForDelusion.Value && ((Enum)self.createPickupInfo.artifactFlag).HasFlag((Enum)(object)(PickupArtifactFlag)2)) || (!onInBazaar.Value && (Object)(object)BazaarController.instance != (Object)null) || (!scrappersDropEssence.Value && flag && trackBehaviour.PickupSource == PickupSource.Scrapper) || (!onForAdaptive.Value && flag && trackBehaviour.PickupSource == PickupSource.Roulette) || (!onInDropShip.Value && flag && trackBehaviour.PickupSource == PickupSource.Terminal) || (!onForTrophy.Value && flag && trackBehaviour.PickupSource == PickupSource.BossHunter) || (!onForPotential.Value && flag && trackBehaviour.PickupSource == PickupSource.VoidPotential) || ((PickupIndex)(ref self.pickupIndex)).pickupDef == null || ((int)((PickupIndex)(ref self.pickupIndex)).pickupDef.itemIndex == -1 && (int)((PickupIndex)(ref self.pickupIndex)).pickupDef.equipmentIndex == -1 && (int)((PickupIndex)(ref self.pickupIndex)).pickupDef.itemTier == 5) || (!onForAspect.Value && source.Any((EquipmentDef x) => x.equipmentIndex == ((PickupIndex)(ref self.pickupIndex)).pickupDef.equipmentIndex)))
				{
					GenericPickupController.CreatePickup(ref self.createPickupInfo);
				}
				else if (flag && trackBehaviour.Options.Count() == 1)
				{
					self.createPickupInfo.pickerOptions = trackBehaviour.Options;
					GenericPickupController.CreatePickup(ref self.createPickupInfo);
				}
				else
				{
					CreateCommandCube(ref self.createPickupInfo, ref shouldSpawn, trackBehaviour);
				}
				Object.Destroy((Object)(object)((Component)self).gameObject);
			}
		}

		private void CreateCommandCube(ref CreatePickupInfo createPickupInfo, ref bool shouldSpawn, TrackBehaviour trackBehaviour = null)
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			//IL_0007: Unknown result type (might be due to invalid IL or missing references)
			//IL_0020: 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_0043: Unknown result type (might be due to invalid IL or missing references)
			//IL_0049: Invalid comparison between Unknown and I4
			//IL_0064: Unknown result type (might be due to invalid IL or missing references)
			//IL_006a: Unknown result type (might be due to invalid IL or missing references)
			//IL_004c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0052: Invalid comparison between Unknown and I4
			//IL_00b9: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c6: Unknown result type (might be due to invalid IL or missing references)
			//IL_0086: 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_005b: Invalid comparison between Unknown and I4
			PickupIndex pickupIndex = ((CreatePickupInfo)(ref createPickupInfo)).pickupIndex;
			PickupDef pickupDef = PickupCatalog.GetPickupDef(pickupIndex);
			((BaseUnityPlugin)this).Logger.LogInfo((object)$"PickupDef {pickupDef.internalName}:{pickupDef.itemTier}:{pickupDef.itemIndex}");
			if (pickupDef != null && ((int)pickupDef.itemIndex != -1 || (int)pickupDef.equipmentIndex != -1 || (int)pickupDef.itemTier != 5))
			{
				GameObject val = Object.Instantiate<GameObject>(CommandArtifactManager.commandCubePrefab, createPickupInfo.position, createPickupInfo.rotation);
				if ((Object)(object)trackBehaviour != (Object)null)
				{
					TrackBehaviour trackBehaviour2 = val.AddComponent<TrackBehaviour>();
					trackBehaviour2.ItemTag = trackBehaviour.ItemTag;
					trackBehaviour2.DropTable = trackBehaviour.DropTable;
					trackBehaviour2.PickupSource = trackBehaviour.PickupSource;
					trackBehaviour2.Options = trackBehaviour.Options;
				}
				val.GetComponent<PickupIndexNetworker>().NetworkpickupIndex = pickupIndex;
				PickupPickerController component = val.GetComponent<PickupPickerController>();
				component.SetOptionsFromPickupForCommandArtifact(pickupIndex);
				component.chestGeneratedFrom = createPickupInfo.chest;
				NetworkServer.Spawn(val);
				shouldSpawn = false;
			}
		}

		[Server]
		private void SetOptions(orig_SetOptionsFromPickupForCommandArtifact orig, PickupPickerController self, PickupIndex pickupIndex)
		{
			//IL_0007: Unknown result type (might be due to invalid IL or missing references)
			//IL_0008: Unknown result type (might be due to invalid IL or missing references)
			//IL_004b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0051: Invalid comparison between Unknown and I4
			//IL_010f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0114: Unknown result type (might be due to invalid IL or missing references)
			//IL_0116: Unknown result type (might be due to invalid IL or missing references)
			//IL_0145: Expected I4, but got Unknown
			//IL_0054: Unknown result type (might be due to invalid IL or missing references)
			//IL_005a: Invalid comparison between Unknown and I4
			//IL_0206: Unknown result type (might be due to invalid IL or missing references)
			//IL_020c: Invalid comparison between Unknown and I4
			//IL_005d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0063: Invalid comparison between Unknown and I4
			//IL_0300: Unknown result type (might be due to invalid IL or missing references)
			//IL_0311: Unknown result type (might be due to invalid IL or missing references)
			//IL_0316: Unknown result type (might be due to invalid IL or missing references)
			//IL_031b: Unknown result type (might be due to invalid IL or missing references)
			//IL_031d: Unknown result type (might be due to invalid IL or missing references)
			//IL_037d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0382: 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_039a: Unknown result type (might be due to invalid IL or missing references)
			//IL_039c: Unknown result type (might be due to invalid IL or missing references)
			//IL_03a1: Unknown result type (might be due to invalid IL or missing references)
			//IL_03a3: Unknown result type (might be due to invalid IL or missing references)
			TrackBehaviour component = ((Component)self).gameObject.GetComponent<TrackBehaviour>();
			if (!NetworkServer.active)
			{
				return;
			}
			int count = GetItemAmountFromTier(((PickupIndex)(ref pickupIndex)).pickupDef);
			PickupIndex[] array = null;
			if ((Object)(object)component != (Object)null && keepCategory.Value && ((int)component.ItemTag == 1 || (int)component.ItemTag == 2 || (int)component.ItemTag == 3))
			{
				PickupDropTable dropTable = component.DropTable;
				array = (from x in ((BasicPickupDropTable)((dropTable is BasicPickupDropTable) ? dropTable : null)).selector.choices
					where ((PickupIndex)(ref x.value)).pickupDef.itemTier == ((PickupIndex)(ref pickupIndex)).pickupDef.itemTier
					select x.value).ToArray();
			}
			else
			{
				if ((Object)(object)component != (Object)null && sameBossDrops.Value && component.PickupSource == PickupSource.Boss)
				{
					self.SetOptionsServer(component.Options);
					return;
				}
				if ((Object)(object)component != (Object)null && component.PickupSource == PickupSource.YellowBoss)
				{
					self.SetOptionsServer(component.Options);
					return;
				}
				ItemTier itemTier = ((PickupIndex)(ref pickupIndex)).pickupDef.itemTier;
				switch ((int)itemTier)
				{
				case 0:
					array = Run.instance.availableTier1DropList.ToArray();
					break;
				case 1:
					array = Run.instance.availableTier2DropList.ToArray();
					break;
				case 2:
					array = Run.instance.availableTier3DropList.ToArray();
					break;
				case 4:
					array = Run.instance.availableBossDropList.ToArray();
					break;
				case 3:
					array = Run.instance.availableLunarItemDropList.ToArray();
					break;
				case 6:
					array = Run.instance.availableVoidTier1DropList.ToArray();
					break;
				case 7:
					array = Run.instance.availableVoidTier2DropList.ToArray();
					break;
				case 8:
					array = Run.instance.availableVoidTier3DropList.ToArray();
					break;
				case 9:
					array = Run.instance.availableVoidBossDropList.ToArray();
					break;
				case 5:
					if ((int)((PickupIndex)(ref pickupIndex)).pickupDef.equipmentIndex != -1)
					{
						array = ((!((PickupIndex)(ref pickupIndex)).pickupDef.isLunar) ? Run.instance.availableEquipmentDropList.ToArray() : Run.instance.availableLunarEquipmentDropList.ToArray());
					}
					break;
				}
			}
			List<EquipmentDef> source = new List<EquipmentDef>
			{
				Equipment.AffixBlue,
				Equipment.AffixHaunted,
				Equipment.AffixLunar,
				Equipment.AffixPoison,
				Equipment.AffixRed,
				Equipment.AffixWhite,
				Elites.Earth.eliteEquipmentDef
			};
			if (onForAspect.Value && source.Any((EquipmentDef x) => x.equipmentIndex == ((PickupIndex)(ref pickupIndex)).pickupDef.equipmentIndex))
			{
				array = source.Select((EquipmentDef x) => PickupCatalog.FindPickupIndex(x.equipmentIndex)).ToArray();
				count = itemAmountAspect.Value;
			}
			Option[] array2;
			if (array == null)
			{
				array2 = (Option[])(object)new Option[1]
				{
					new Option
					{
						available = true,
						pickupIndex = pickupIndex
					}
				};
			}
			else
			{
				Xoroshiro128Plus rng = Run.instance.treasureRng;
				List<PickupIndex> list = (from x in array.ToList()
					orderby rng.Next()
					select x).Take(count).ToList();
				array2 = (Option[])(object)new Option[list.Count];
				for (int i = 0; i < list.Count; i++)
				{
					PickupIndex pickupIndex2 = list[i];
					array2[i] = new Option
					{
						available = true,
						pickupIndex = pickupIndex2
					};
				}
			}
			self.SetOptionsServer(array2);
		}

		public int GetItemAmountFromTier(PickupDef pickup)
		{
			//IL_0003: Unknown result type (might be due to invalid IL or missing references)
			//IL_0008: Unknown result type (might be due to invalid IL or missing references)
			//IL_0009: Unknown result type (might be due to invalid IL or missing references)
			//IL_0037: Expected I4, but got Unknown
			//IL_007b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0081: Invalid comparison between Unknown and I4
			int result = 0;
			ItemTier itemTier = pickup.itemTier;
			switch ((int)itemTier)
			{
			case 0:
				result = itemAmountCommon.Value;
				break;
			case 1:
				result = itemAmountUncommon.Value;
				break;
			case 2:
				result = itemAmountLegendary.Value;
				break;
			case 4:
				result = itemAmountBoss.Value;
				break;
			case 3:
				result = itemAmountLunar.Value;
				break;
			case 5:
				if ((int)pickup.equipmentIndex != -1)
				{
					result = itemAmountEquip.Value;
				}
				break;
			case 6:
			case 7:
			case 8:
			case 9:
				result = itemAmountVoid.Value;
				break;
			default:
				result = itemAmountCommon.Value;
				break;
			}
			return result;
		}
	}
	public class TrackBehaviour : MonoBehaviour
	{
		public ItemTag ItemTag { get; set; }

		public PickupDropTable DropTable { get; set; }

		public PickupSource PickupSource { get; set; }

		public Option[] Options { get; set; }

		public TrackBehaviour()
		{
			Options = (Option[])(object)new Option[0];
		}
	}
	public enum PickupSource
	{
		Chest,
		Terminal,
		Boss,
		YellowBoss,
		BossHunter,
		Roulette,
		Scrapper,
		VoidPotential,
		Cell
	}
}