Decompiled source of ZetArtifacts v1.4.8

ZetArtifacts.dll

Decompiled 5 months ago
using System;
using System.CodeDom.Compiler;
using System.Collections;
using System.Collections.Generic;
using System.ComponentModel;
using System.Diagnostics;
using System.Globalization;
using System.Linq;
using System.Reflection;
using System.Resources;
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 HG;
using IL.RoR2;
using IL.RoR2.UI;
using Mono.Cecil.Cil;
using MonoMod.Cil;
using MonoMod.RuntimeDetour;
using MonoMod.RuntimeDetour.HookGen;
using On.RoR2;
using On.RoR2.UI;
using R2API;
using R2API.Networking;
using R2API.Networking.Interfaces;
using R2API.Utils;
using RoR2;
using RoR2.ContentManagement;
using RoR2.UI;
using TMPro;
using TPDespair.ZetArtifacts.Properties;
using UnityEngine;
using UnityEngine.EventSystems;
using UnityEngine.Networking;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: TargetFramework(".NETStandard,Version=v2.0", FrameworkDisplayName = "")]
[assembly: AssemblyCompany("ZetArtifacts")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("ZetArtifacts")]
[assembly: AssemblyTitle("ZetArtifacts")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.0.0")]
[module: UnverifiableCode]
namespace TPDespair.ZetArtifacts
{
	public static class DirectorCardManipulator
	{
		private delegate int DirectorCardReturnInt(DirectorCard self);

		[CompilerGenerated]
		private sealed class <>c__DisplayClass16_0
		{
			public int index;

			internal bool <IteractableCreditExpenditureHook>b__1(Instruction x)
			{
				return ILPatternMatchingExt.MatchLdloc(x, ref index);
			}
		}

		[Serializable]
		[CompilerGenerated]
		private sealed class <>c
		{
			public static readonly <>c <>9 = new <>c();

			public static Func<Instruction, bool> <>9__16_2;

			public static Action<int, SceneDirector, DirectorCard> <>9__16_3;

			public static Manipulator <>9__16_0;

			internal void <IteractableCreditExpenditureHook>b__16_0(ILContext il)
			{
				//IL_0008: Unknown result type (might be due to invalid IL or missing references)
				//IL_000e: Expected O, but got Unknown
				//IL_0069: 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_0082: Unknown result type (might be due to invalid IL or missing references)
				<>c__DisplayClass16_0 CS$<>8__locals0 = new <>c__DisplayClass16_0();
				ILCursor val = new ILCursor(il);
				CS$<>8__locals0.index = -1;
				if (val.TryGotoNext(new Func<Instruction, bool>[2]
				{
					(Instruction x) => ILPatternMatchingExt.MatchLdloc(x, ref CS$<>8__locals0.index),
					(Instruction x) => ILPatternMatchingExt.MatchCallvirt<DirectorCard>(x, "get_cost")
				}))
				{
					val.Index += 2;
					val.Emit(OpCodes.Dup);
					val.Emit(OpCodes.Ldarg, 0);
					val.Emit(OpCodes.Ldloc, CS$<>8__locals0.index);
					val.EmitDelegate<Action<int, SceneDirector, DirectorCard>>((Action<int, SceneDirector, DirectorCard>)delegate(int cost, SceneDirector director, DirectorCard card)
					{
						ZetArtifactsPlugin.LogInfo("[Manipulator] - SceneDirector : Spending " + cost + " of " + director.interactableCredit + " credits on " + ((Object)card.spawnCard).name);
					});
				}
				else
				{
					ZetArtifactsPlugin.LogWarn("[Manipulator] - IteractableCreditExpenditureHook failed!");
				}
			}

			internal bool <IteractableCreditExpenditureHook>b__16_2(Instruction x)
			{
				return ILPatternMatchingExt.MatchCallvirt<DirectorCard>(x, "get_cost");
			}

			internal void <IteractableCreditExpenditureHook>b__16_3(int cost, SceneDirector director, DirectorCard card)
			{
				ZetArtifactsPlugin.LogInfo("[Manipulator] - SceneDirector : Spending " + cost + " of " + director.interactableCredit + " credits on " + ((Object)card.spawnCard).name);
			}
		}

		public static bool Active = false;

		private static readonly BindingFlags flags = BindingFlags.Instance | BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic;

		private static DirectorCardReturnInt origDirectorCardCostGetter;

		private static readonly List<string> MonsterCardNames = new List<string>();

		private static readonly List<string> InteractableCardNames = new List<string>();

		private static readonly Dictionary<int, int> MonsterCostCache = new Dictionary<int, int>();

		private static readonly Dictionary<int, int> InteractableCostCache = new Dictionary<int, int>();

		internal static void Init()
		{
			Active = ZetHoardifact.State > 0 || ZetLoopifact.State > 0;
			if (Active)
			{
				SceneDirector.onPrePopulateSceneServer += OnPrePopScene;
				Run.onRunDestroyGlobal += OnRunDestroyed;
				DirectorCardCostHook();
				IteractableCreditExpenditureHook();
			}
		}

		internal static void LateSetup()
		{
			//IL_0023: Unknown result type (might be due to invalid IL or missing references)
			//IL_002d: Expected O, but got Unknown
			if (Active)
			{
				if (ZetLoopifact.State > 0)
				{
					ClassicStageInfo.RebuildCards += new hook_RebuildCards(GatherMonsterCardsHook);
				}
				if (ZetHoardifact.State > 0)
				{
					SceneDirector.onGenerateInteractableCardSelection += GatherInteractableCards;
				}
			}
		}

		private static void OnPrePopScene(SceneDirector director)
		{
			MonsterCostCache.Clear();
			InteractableCostCache.Clear();
		}

		private static void OnRunDestroyed(Run run)
		{
			MonsterCostCache.Clear();
			InteractableCostCache.Clear();
		}

		private static void DirectorCardCostHook()
		{
			//IL_0037: Unknown result type (might be due to invalid IL or missing references)
			//IL_003d: Expected O, but got Unknown
			MethodInfo method = typeof(DirectorCard).GetMethod("get_cost", flags);
			MethodInfo method2 = typeof(DirectorCardManipulator).GetMethod("GetCostHook", flags);
			Hook val = new Hook((MethodBase)method, method2);
			origDirectorCardCostGetter = val.GenerateTrampoline<DirectorCardReturnInt>();
		}

		private static int GetCostHook(DirectorCard directorCard)
		{
			int num = origDirectorCardCostGetter(directorCard);
			if (Active)
			{
				string name = ((Object)directorCard.spawnCard).name;
				if (ZetLoopifact.Enabled && MonsterCardNames.Contains(name))
				{
					return GetMonsterCostOverride(num);
				}
				if (ZetHoardifact.Enabled && InteractableCardNames.Contains(name))
				{
					return GetInteractableCostOverride(num);
				}
			}
			return num;
		}

		private static int GetMonsterCostOverride(int cost)
		{
			if (MonsterCostCache.ContainsKey(cost))
			{
				return MonsterCostCache[cost];
			}
			Run instance = Run.instance;
			if (Object.op_Implicit((Object)(object)instance) && instance.loopClearCount >= 2)
			{
				MonsterCostCache.Add(cost, cost);
				return cost;
			}
			int num = Mathf.RoundToInt(Mathf.Max(ZetArtifactsPlugin.LoopifactMonsterCostTarget.Value, 1f));
			float num2 = Mathf.Clamp(ZetArtifactsPlugin.LoopifactMonsterCostFactor.Value, 0f, 1f);
			if (num2 > 0f && cost > num)
			{
				int num3 = Mathf.FloorToInt(Mathf.Lerp((float)cost, (float)num, num2));
				ZetArtifactsPlugin.LogInfo("[Manipulator] - Override Monster DirectorCost : " + cost + " => " + num3);
				MonsterCostCache.Add(cost, num3);
				return num3;
			}
			MonsterCostCache.Add(cost, cost);
			return cost;
		}

		private static int GetInteractableCostOverride(int cost)
		{
			if (InteractableCostCache.ContainsKey(cost))
			{
				return InteractableCostCache[cost];
			}
			Run instance = Run.instance;
			if (Object.op_Implicit((Object)(object)instance) && instance.loopClearCount >= 2)
			{
				InteractableCostCache.Add(cost, cost);
				return cost;
			}
			int num = Mathf.RoundToInt(Mathf.Max(ZetArtifactsPlugin.HoardifactInteractableCostTarget.Value, 1f));
			float num2 = Mathf.Clamp(ZetArtifactsPlugin.HoardifactInteractableCostFactor.Value, 0f, 1f);
			if (num2 > 0f && cost > num)
			{
				int num3 = Mathf.FloorToInt(Mathf.Lerp((float)cost, (float)num, num2));
				ZetArtifactsPlugin.LogInfo("[Manipulator] - Override Interactable DirectorCost : " + cost + " => " + num3);
				InteractableCostCache.Add(cost, num3);
				return num3;
			}
			InteractableCostCache.Add(cost, cost);
			return cost;
		}

		private static void IteractableCreditExpenditureHook()
		{
			//IL_0015: Unknown result type (might be due to invalid IL or missing references)
			//IL_001a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0020: Expected O, but got Unknown
			object obj = <>c.<>9__16_0;
			if (obj == null)
			{
				Manipulator val = delegate(ILContext il)
				{
					//IL_0008: Unknown result type (might be due to invalid IL or missing references)
					//IL_000e: Expected O, but got Unknown
					//IL_0069: 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_0082: Unknown result type (might be due to invalid IL or missing references)
					ILCursor val2 = new ILCursor(il);
					int index = -1;
					if (val2.TryGotoNext(new Func<Instruction, bool>[2]
					{
						(Instruction x) => ILPatternMatchingExt.MatchLdloc(x, ref index),
						(Instruction x) => ILPatternMatchingExt.MatchCallvirt<DirectorCard>(x, "get_cost")
					}))
					{
						val2.Index += 2;
						val2.Emit(OpCodes.Dup);
						val2.Emit(OpCodes.Ldarg, 0);
						val2.Emit(OpCodes.Ldloc, index);
						val2.EmitDelegate<Action<int, SceneDirector, DirectorCard>>((Action<int, SceneDirector, DirectorCard>)delegate(int cost, SceneDirector director, DirectorCard card)
						{
							ZetArtifactsPlugin.LogInfo("[Manipulator] - SceneDirector : Spending " + cost + " of " + director.interactableCredit + " credits on " + ((Object)card.spawnCard).name);
						});
					}
					else
					{
						ZetArtifactsPlugin.LogWarn("[Manipulator] - IteractableCreditExpenditureHook failed!");
					}
				};
				<>c.<>9__16_0 = val;
				obj = (object)val;
			}
			SceneDirector.PopulateScene += (Manipulator)obj;
		}

		private static void GatherMonsterCardsHook(orig_RebuildCards orig, ClassicStageInfo self)
		{
			orig.Invoke(self);
			GatherMonsterCards(self);
		}

		private static void GatherMonsterCards(ClassicStageInfo stageInfo)
		{
			//IL_0018: Unknown result type (might be due to invalid IL or missing references)
			//IL_001d: Unknown result type (might be due to invalid IL or missing references)
			//IL_001e: Unknown result type (might be due to invalid IL or missing references)
			WeightedSelection<DirectorCard> monsterSelection = stageInfo.monsterSelection;
			if (monsterSelection == null)
			{
				return;
			}
			for (int i = 0; i < monsterSelection.Count; i++)
			{
				DirectorCard value = monsterSelection.GetChoice(i).value;
				SpawnCard spawnCard = value.spawnCard;
				if (!MonsterCardNames.Contains(((Object)spawnCard).name))
				{
					MonsterCardNames.Add(((Object)spawnCard).name);
				}
			}
		}

		private static void GatherInteractableCards(SceneDirector sceneDirector, DirectorCardCategorySelection dccs)
		{
			//IL_0010: Unknown result type (might be due to invalid IL or missing references)
			//IL_0015: Unknown result type (might be due to invalid IL or missing references)
			//IL_0016: Unknown result type (might be due to invalid IL or missing references)
			//IL_0028: Unknown result type (might be due to invalid IL or missing references)
			//IL_0037: Unknown result type (might be due to invalid IL or missing references)
			for (int i = 0; i < dccs.categories.Length; i++)
			{
				Category val = dccs.categories[i];
				string name = val.name;
				if (!ApplyToCategory(name))
				{
					continue;
				}
				for (int num = val.cards.Length - 1; num >= 0; num--)
				{
					DirectorCard val2 = val.cards[num];
					SpawnCard spawnCard = val2.spawnCard;
					if (!InteractableCardNames.Contains(((Object)spawnCard).name))
					{
						InteractableCardNames.Add(((Object)spawnCard).name);
					}
				}
			}
		}

		private static bool ApplyToCategory(string name)
		{
			return name switch
			{
				"Chests" => true, 
				"Shrines" => true, 
				"Drones" => true, 
				"Misc" => true, 
				"Rare" => true, 
				"Duplicator" => true, 
				"Void Stuff" => true, 
				_ => false, 
			};
		}
	}
	public class ZetArtifactsContent : IContentPackProvider
	{
		public static class Artifacts
		{
			public static ArtifactDef ZetBazaarifact;

			public static ArtifactDef ZetRevivifact;

			public static ArtifactDef ZetMultifact;

			public static ArtifactDef ZetHoardifact;

			public static ArtifactDef ZetDropifact;

			public static ArtifactDef ZetLoopifact;

			public static ArtifactDef ZetEarlifact;

			public static ArtifactDef ZetEclifact;

			public static List<ArtifactDef> artifactDefs = new List<ArtifactDef>();

			public static void Create()
			{
				//IL_0055: 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_00e2: 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_016f: Unknown result type (might be due to invalid IL or missing references)
				//IL_0188: Unknown result type (might be due to invalid IL or missing references)
				//IL_020c: Unknown result type (might be due to invalid IL or missing references)
				//IL_0225: Unknown result type (might be due to invalid IL or missing references)
				//IL_029b: Unknown result type (might be due to invalid IL or missing references)
				//IL_02b4: 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_0343: Unknown result type (might be due to invalid IL or missing references)
				//IL_03c9: 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_0468: Unknown result type (might be due to invalid IL or missing references)
				//IL_0481: Unknown result type (might be due to invalid IL or missing references)
				if (ZetArtifactsPlugin.BazaarifactEnable.Value == 1)
				{
					ZetBazaarifact = ScriptableObject.CreateInstance<ArtifactDef>();
					ZetBazaarifact.cachedName = "ARTIFACT_ZETBAZAARIFACT";
					ZetBazaarifact.nameToken = "ARTIFACT_ZETBAZAARIFACT_NAME";
					ZetBazaarifact.descriptionToken = "ARTIFACT_ZETBAZAARIFACT_DESC";
					ZetBazaarifact.smallIconSelectedSprite = ZetArtifactsPlugin.CreateSprite(Resources.zetbazaar_selected, Color.magenta);
					ZetBazaarifact.smallIconDeselectedSprite = ZetArtifactsPlugin.CreateSprite(Resources.zetbazaar_deselected, Color.gray);
					artifactDefs.Add(ZetBazaarifact);
				}
				if (ZetArtifactsPlugin.RivivifactEnable.Value == 1)
				{
					ZetRevivifact = ScriptableObject.CreateInstance<ArtifactDef>();
					ZetRevivifact.cachedName = "ARTIFACT_ZETREVIVIFACT";
					ZetRevivifact.nameToken = "ARTIFACT_ZETREVIVIFACT_NAME";
					ZetRevivifact.descriptionToken = "ARTIFACT_ZETREVIVIFACT_DESC";
					ZetRevivifact.smallIconSelectedSprite = ZetArtifactsPlugin.CreateSprite(Resources.zetrevive_selected, Color.magenta);
					ZetRevivifact.smallIconDeselectedSprite = ZetArtifactsPlugin.CreateSprite(Resources.zetrevive_deselected, Color.gray);
					artifactDefs.Add(ZetRevivifact);
				}
				if (ZetArtifactsPlugin.MultifactEnable.Value == 1)
				{
					ZetMultifact = ScriptableObject.CreateInstance<ArtifactDef>();
					ZetMultifact.cachedName = "ARTIFACT_ZETMULTIFACT";
					ZetMultifact.nameToken = "ARTIFACT_ZETMULTIFACT_NAME";
					ZetMultifact.descriptionToken = "ARTIFACT_ZETMULTIFACT_DESC";
					ZetMultifact.smallIconSelectedSprite = ZetArtifactsPlugin.CreateSprite(Resources.zetmultitude_selected, Color.magenta);
					ZetMultifact.smallIconDeselectedSprite = ZetArtifactsPlugin.CreateSprite(Resources.zetmultitude_deselected, Color.gray);
					artifactDefs.Add(ZetMultifact);
				}
				if (ZetArtifactsPlugin.HoardifactEnable.Value == 1 && !ZetArtifactsPlugin.HoardifactMerge.Value)
				{
					ZetHoardifact = ScriptableObject.CreateInstance<ArtifactDef>();
					ZetHoardifact.cachedName = "ARTIFACT_ZETHOARDIFACT";
					ZetHoardifact.nameToken = "ARTIFACT_ZETHOARDIFACT_NAME";
					ZetHoardifact.descriptionToken = "ARTIFACT_ZETHOARDIFACT_DESC";
					ZetHoardifact.smallIconSelectedSprite = ZetArtifactsPlugin.CreateSprite(Resources.zethoard_selected, Color.magenta);
					ZetHoardifact.smallIconDeselectedSprite = ZetArtifactsPlugin.CreateSprite(Resources.zethoard_deselected, Color.gray);
					artifactDefs.Add(ZetHoardifact);
				}
				if (ZetArtifactsPlugin.DropifactEnable.Value == 1)
				{
					ZetDropifact = ScriptableObject.CreateInstance<ArtifactDef>();
					ZetDropifact.cachedName = "ARTIFACT_ZETDROPIFACT";
					ZetDropifact.nameToken = "ARTIFACT_ZETDROPIFACT_NAME";
					ZetDropifact.descriptionToken = "ARTIFACT_ZETDROPIFACT_DESC";
					ZetDropifact.smallIconSelectedSprite = ZetArtifactsPlugin.CreateSprite(Resources.zetdrop_selected, Color.magenta);
					ZetDropifact.smallIconDeselectedSprite = ZetArtifactsPlugin.CreateSprite(Resources.zetdrop_deselected, Color.gray);
					artifactDefs.Add(ZetDropifact);
				}
				if (ZetArtifactsPlugin.LoopifactEnable.Value == 1)
				{
					ZetLoopifact = ScriptableObject.CreateInstance<ArtifactDef>();
					ZetLoopifact.cachedName = "ARTIFACT_ZETLOOPIFACT";
					ZetLoopifact.nameToken = "ARTIFACT_ZETLOOPIFACT_NAME";
					ZetLoopifact.descriptionToken = "ARTIFACT_ZETLOOPIFACT_DESC";
					ZetLoopifact.smallIconSelectedSprite = ZetArtifactsPlugin.CreateSprite(Resources.zetloop_selected, Color.magenta);
					ZetLoopifact.smallIconDeselectedSprite = ZetArtifactsPlugin.CreateSprite(Resources.zetloop_deselected, Color.gray);
					artifactDefs.Add(ZetLoopifact);
				}
				if (ZetArtifactsPlugin.EarlifactEnable.Value == 1 && !ZetArtifactsPlugin.EarlifactMerge.Value)
				{
					ZetEarlifact = ScriptableObject.CreateInstance<ArtifactDef>();
					ZetEarlifact.cachedName = "ARTIFACT_ZETEARLIFACT";
					ZetEarlifact.nameToken = "ARTIFACT_ZETEARLIFACT_NAME";
					ZetEarlifact.descriptionToken = "ARTIFACT_ZETEARLIFACT_DESC";
					ZetEarlifact.smallIconSelectedSprite = ZetArtifactsPlugin.CreateSprite(Resources.zetearly_selected, Color.magenta);
					ZetEarlifact.smallIconDeselectedSprite = ZetArtifactsPlugin.CreateSprite(Resources.zetearly_deselected, Color.gray);
					artifactDefs.Add(ZetEarlifact);
				}
				if (ZetArtifactsPlugin.EclifactEnable.Value == 1 && !ZetArtifactsPlugin.PluginLoaded("com.TPDespair.DiluvianArtifact"))
				{
					ZetEclifact = ScriptableObject.CreateInstance<ArtifactDef>();
					ZetEclifact.cachedName = "ARTIFACT_ZETECLIFACT";
					ZetEclifact.nameToken = "ARTIFACT_ZETECLIFACT_NAME";
					ZetEclifact.descriptionToken = "ARTIFACT_ZETECLIFACT_DESC";
					ZetEclifact.smallIconSelectedSprite = ZetArtifactsPlugin.CreateSprite(Resources.zeteclipse_selected, Color.magenta);
					ZetEclifact.smallIconDeselectedSprite = ZetArtifactsPlugin.CreateSprite(Resources.zeteclipse_deselected, Color.gray);
					artifactDefs.Add(ZetEclifact);
				}
			}
		}

		public static class Elites
		{
			public static EliteDef PoisonEarly;

			public static EliteDef HauntedEarly;

			public static EliteDef LunarEarly;

			public static EliteDef AragonEarly;

			public static EliteDef BlightedEarly;

			public static List<EliteDef> eliteDefs = new List<EliteDef>();

			public static void Create()
			{
				if (ZetArtifactsPlugin.LoopifactEnable.Value != 0)
				{
					PoisonEarly = ScriptableObject.CreateInstance<EliteDef>();
					eliteDefs.Add(PoisonEarly);
					HauntedEarly = ScriptableObject.CreateInstance<EliteDef>();
					eliteDefs.Add(HauntedEarly);
					LunarEarly = ScriptableObject.CreateInstance<EliteDef>();
					eliteDefs.Add(LunarEarly);
					AragonEarly = ScriptableObject.CreateInstance<EliteDef>();
					eliteDefs.Add(AragonEarly);
					BlightedEarly = ScriptableObject.CreateInstance<EliteDef>();
					eliteDefs.Add(BlightedEarly);
				}
			}
		}

		public ContentPack contentPack = new ContentPack();

		public string identifier => "ZetArtifactsContent";

		public IEnumerator LoadStaticContentAsync(LoadStaticContentAsyncArgs args)
		{
			Artifacts.Create();
			Elites.Create();
			AssignInternalArtifactDefReferences();
			contentPack.artifactDefs.Add(Artifacts.artifactDefs.ToArray());
			contentPack.eliteDefs.Add(Elites.eliteDefs.ToArray());
			args.ReportProgress(1f);
			yield break;
		}

		public IEnumerator GenerateContentPackAsync(GetContentPackAsyncArgs args)
		{
			ContentPack.Copy(contentPack, args.output);
			args.ReportProgress(1f);
			yield break;
		}

		public IEnumerator FinalizeAsync(FinalizeAsyncArgs args)
		{
			args.ReportProgress(1f);
			yield break;
		}

		public static void AssignInternalArtifactDefReferences()
		{
			ZetBazaarifact.ArtifactDef = Artifacts.ZetBazaarifact;
			ZetRevivifact.ArtifactDef = Artifacts.ZetRevivifact;
			ZetMultifact.ArtifactDef = Artifacts.ZetMultifact;
			ZetHoardifact.ArtifactDef = ((!ZetArtifactsPlugin.HoardifactMerge.Value) ? Artifacts.ZetHoardifact : Artifacts.ZetMultifact);
			ZetDropifact.ArtifactDef = Artifacts.ZetDropifact;
			ZetLoopifact.ArtifactDef = Artifacts.ZetLoopifact;
			ZetEarlifact.ArtifactDef = ((!ZetArtifactsPlugin.EarlifactMerge.Value) ? Artifacts.ZetEarlifact : Artifacts.ZetLoopifact);
			ZetEclifact.ArtifactDef = Artifacts.ZetEclifact;
		}
	}
	[BepInPlugin("com.TPDespair.ZetArtifacts", "ZetArtifacts", "1.4.8")]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[R2APISubmoduleDependency(new string[] { "LanguageAPI", "EliteAPI", "NetworkingAPI" })]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	public class ZetArtifactsPlugin : BaseUnityPlugin
	{
		public const string ModVer = "1.4.8";

		public const string ModName = "ZetArtifacts";

		public const string ModGuid = "com.TPDespair.ZetArtifacts";

		public static ManualLogSource logSource;

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

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

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

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

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

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

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

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

		public static ConfigEntry<float> HoardifactT1Effect { get; set; }

		public static ConfigEntry<float> HoardifactT2Effect { get; set; }

		public static ConfigEntry<float> HoardifactT3Effect { get; set; }

		public static ConfigEntry<float> HoardifactBossEffect { get; set; }

		public static ConfigEntry<float> HoardifactLunarEffect { get; set; }

		public static ConfigEntry<float> HoardifactPlayerExponent { get; set; }

		public static ConfigEntry<float> HoardifactSetupMoney { get; set; }

		public static ConfigEntry<float> HoardifactInteractableCostTarget { get; set; }

		public static ConfigEntry<float> HoardifactInteractableCostFactor { get; set; }

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

		public static ConfigEntry<float> LoopifactEliteReplacementChance { get; set; }

		public static ConfigEntry<float> LoopifactEliteReplacementFactor { get; set; }

		public static ConfigEntry<float> LoopifactCombatMoney { get; set; }

		public static ConfigEntry<float> LoopifactMonsterCostTarget { get; set; }

		public static ConfigEntry<float> LoopifactMonsterCostFactor { get; set; }

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

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

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

		public void Awake()
		{
			//IL_001f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0029: Expected O, but got Unknown
			ConfigSetup(((BaseUnityPlugin)this).Config);
			logSource = ((BaseUnityPlugin)this).Logger;
			ContentManager.collectContentPackProviders += new CollectContentPackProvidersDelegate(ContentManager_collectContentPackProviders);
			ZetBazaarifact.Init();
			ZetRevivifact.Init();
			ZetMultifact.Init();
			ZetHoardifact.Init();
			ZetDropifact.Init();
			ZetLoopifact.Init();
			ZetEarlifact.Init();
			ZetEclifact.Init();
			DirectorCardManipulator.Init();
			RoR2Application.onLoad = (Action)Delegate.Combine(RoR2Application.onLoad, new Action(LateSetup));
		}

		public void FixedUpdate()
		{
			ZetHoardifact.OnFixedUpdate();
		}

		private static void LateSetup()
		{
			ZetBazaarifact.LateSetup();
			ZetHoardifact.LateSetup();
			ZetDropifact.LateSetup();
			ZetLoopifact.LateSetup();
			DirectorCardManipulator.LateSetup();
		}

		private static void ConfigSetup(ConfigFile Config)
		{
			BazaarifactEnable = Config.Bind<int>("Artifacts", "bazaarifactEnable", 0, "Artifact of the Bazzar. 0 = Disabled, 1 = Artifact Available, 2 = Always Active");
			BazaarHomeExtraCauldrons = Config.Bind<bool>("Artifacts", "bazaarHomeExtraCauldrons", true, "Allow additional cauldrons from BazaarIsMyHome even if artifact is available and not being used.");
			RivivifactEnable = Config.Bind<int>("Artifacts", "rivivifactEnable", 1, "Artifact of Revival. 0 = Disabled, 1 = Artifact Available, 2 = Always Active");
			MultifactEnable = Config.Bind<int>("Artifacts", "multifactEnable", 1, "Artifact of Multitudes. 0 = Disabled, 1 = Artifact Available, 2 = Always Active");
			MultifactMultiplier = Config.Bind<int>("Artifacts", "multifactMultiplier", 2, "Player count multiplier. Whole numbers only.");
			HoardifactEnable = Config.Bind<int>("Artifacts", "hoardifactEnable", 1, "Artifact of Accumulation. 0 = Disabled, 1 = Artifact Available, 2 = Always Active");
			HoardifactMerge = Config.Bind<bool>("Artifacts", "hoardifactMerge", false, "Merge Accumulation into Multitudes. hoardifactEnable is ignored.");
			HoardifactDifficulty = Config.Bind<bool>("Artifacts", "hoardifactDifficulty", true, "Enable difficulty increase from items.");
			HoardifactT1Effect = Config.Bind<float>("Artifacts", "hoardifactT1Effect", 10f, "Amount of added time per T1 item.");
			HoardifactT2Effect = Config.Bind<float>("Artifacts", "hoardifactT2Effect", 20f, "Amount of added time per T2 item.");
			HoardifactT3Effect = Config.Bind<float>("Artifacts", "hoardifactT3Effect", 60f, "Amount of added time per T3 item.");
			HoardifactBossEffect = Config.Bind<float>("Artifacts", "hoardifactBossEffect", 40f, "Amount of added time per Boss item.");
			HoardifactLunarEffect = Config.Bind<float>("Artifacts", "hoardifactLunarEffect", 40f, "Amount of added time per Lunar item.");
			HoardifactPlayerExponent = Config.Bind<float>("Artifacts", "hoardifactPlayerExponent", 0.5f, "Total time is divided by true player count, then is multiplied by playercount to the exponent. Example : (60 seconds / 2 players) * (2 players ^ 0.5 exponent) = 42.4 seconds.");
			HoardifactSetupMoney = Config.Bind<float>("Artifacts", "hoardifactSetupMoney", 0.2f, "Increase scene director interactable credits. 0.2 = 20% increased credits.");
			HoardifactInteractableCostTarget = Config.Bind<float>("Artifacts", "HoardifactInteractableCostTarget", 20f, "Set Interactable SpawnCard DirectorCost target. Will make interactable spawn costs above value cheaper.");
			HoardifactInteractableCostFactor = Config.Bind<float>("Artifacts", "HoardifactInteractableCostFactor", 0.2f, "Modify Interactable SpawnCard DirectorCost towards target. Will only decrease cost. 0 = don't modify cost, 1 = set to target cost.");
			DropifactEnable = Config.Bind<int>("Artifacts", "dropifactEnable", 1, "Artifact of Tossing. 0 = Disabled, 1 = Artifact Available, 2 = Always Active");
			DropifactBypassGround = Config.Bind<bool>("Artifacts", "dropifactBypassGround", false, "Drop items directly on contact with the ground. Bypass onDropletHitGroundServer event, which includes Artifact of Command.");
			DropifactRemoveScrapper = Config.Bind<bool>("Artifacts", "dropifactRemoveScrapper", false, "Prevent scrappers from appearing while artifact is active.");
			DropifactBazaarScrapper = Config.Bind<bool>("Artifacts", "dropifactBazaarScrapper", false, "Adds a scrapper to the bazaar while artifact is active.");
			DropifactAltScrap = Config.Bind<bool>("Artifacts", "dropifactAltScrap", true, "Set to false to scrap with RMB instead of Alt+RMB.");
			DropifactT1 = Config.Bind<bool>("Artifacts", "dropifactT1", true, "Allow dropping non-void T1 items.");
			DropifactT2 = Config.Bind<bool>("Artifacts", "dropifactT2", true, "Allow dropping non-void T2 items.");
			DropifactT3 = Config.Bind<bool>("Artifacts", "dropifactT3", true, "Allow dropping non-void T3 items.");
			DropifactBoss = Config.Bind<bool>("Artifacts", "dropifactBoss", true, "Allow dropping non-void boss items.");
			DropifactLunar = Config.Bind<bool>("Artifacts", "dropifactLunar", true, "Allow dropping non-void lunar items.");
			DropifactVoidT1 = Config.Bind<bool>("Artifacts", "dropifactVoidT1", true, "Allow dropping void T1 items.");
			DropifactVoidT2 = Config.Bind<bool>("Artifacts", "dropifactVoidT2", true, "Allow dropping void T2 items.");
			DropifactVoidT3 = Config.Bind<bool>("Artifacts", "dropifactVoidT3", true, "Allow dropping void T3 items.");
			DropifactVoidBoss = Config.Bind<bool>("Artifacts", "dropifactVoidBoss", true, "Allow dropping void boss items.");
			DropifactVoidLunar = Config.Bind<bool>("Artifacts", "dropifactVoidLunar", true, "Allow dropping void lunar items.");
			DropifactVoid = Config.Bind<bool>("Artifacts", "dropifactVoid", true, "Allow dropping ANY void items. Setting this to false will prevent ALL void items from being dropable.");
			DropifactUnique = Config.Bind<bool>("Artifacts", "dropifactUnique", true, "Allow dropping WorldUnique items.");
			LoopifactEnable = Config.Bind<int>("Artifacts", "loopifactEnable", 1, "Artifact of Escalation. 0 = Disabled, 1 = Artifact Available, 2 = Always Active");
			LoopifactEliteLevel = Config.Bind<int>("Artifacts", "loopifactEliteLevel", 10, "Ambient level for T2 elites to spawn during first loop. -1 to disable early T2 elites.");
			LoopifactEliteClassic = Config.Bind<bool>("Artifacts", "loopifactEliteClassic", true, "Change cost, health, and damage values to 35% towards T2 elite values instead of equal to T1 elite values.");
			LoopifactEliteReplacementChance = Config.Bind<float>("Artifacts", "loopifactEliteReplacementChance", 0.1f, "Base chance that a T1 Elite will be changed into a random early T2 Elite. 0.1 = 10% chance.");
			LoopifactEliteReplacementFactor = Config.Bind<float>("Artifacts", "loopifactEliteReplacementFactor", 0.35f, "Every mod that adds t1 Elites increases replacment chance. Chance = 1 - ((1 - ReplacementChance) ^ (1 + (ModCount * ReplacementFactor)))");
			LoopifactCombatMoney = Config.Bind<float>("Artifacts", "loopifactCombatMoney", 0.1f, "Increase combat director monster credits. 0.1 = 10% increased credits.");
			LoopifactMonsterCostTarget = Config.Bind<float>("Artifacts", "loopifactMonsterCostTarget", 200f, "Set Monster SpawnCard DirectorCost target. Will make monster spawn costs above value cheaper.");
			LoopifactMonsterCostFactor = Config.Bind<float>("Artifacts", "loopifactMonsterCostFactor", 0.2f, "Modify Monster SpawnCard DirectorCost towards target. Will only decrease cost. 0 = don't modify cost, 1 = set to target cost.");
			EarlifactEnable = Config.Bind<int>("Artifacts", "earlifactEnable", 1, "Artifact of Sanction 0 = Disabled, 1 = Artifact Available, 2 = Always Active");
			EarlifactMerge = Config.Bind<bool>("Artifacts", "earlifactMerge", false, "Merge Sanction into Escalation. earlifactEnable is ignored.");
			EclifactEnable = Config.Bind<int>("Artifacts", "eclifactEnable", 1, "Artifact of the Eclipse. 0 = Disabled, 1 = Artifact Available, 2 = Always Active");
		}

		private void ContentManager_collectContentPackProviders(AddContentPackProviderDelegate addContentPackProvider)
		{
			addContentPackProvider.Invoke((IContentPackProvider)(object)new ZetArtifactsContent());
		}

		internal static void LogInfo(object data)
		{
			logSource.LogInfo(data);
		}

		internal static void LogWarn(object data)
		{
			logSource.LogWarning(data);
		}

		internal static void LogError(object data)
		{
			logSource.LogError(data);
		}

		internal static void RegisterToken(string token, string text)
		{
			LanguageAPI.Add(token, text);
		}

		internal static bool ArtifactEnabled(ArtifactDef artifactDef)
		{
			return Object.op_Implicit((Object)(object)RunArtifactManager.instance) && RunArtifactManager.instance.IsArtifactEnabled(artifactDef);
		}

		internal static bool PluginLoaded(string key)
		{
			return Chainloader.PluginInfos.ContainsKey(key);
		}

		internal static Sprite CreateSprite(byte[] resourceBytes, Color fallbackColor)
		{
			//IL_0007: Unknown result type (might be due to invalid IL or missing references)
			//IL_000d: Expected O, but got Unknown
			//IL_004d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0070: Unknown result type (might be due to invalid IL or missing references)
			//IL_007f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0018: Unknown result type (might be due to invalid IL or missing references)
			Texture2D val = new Texture2D(32, 32, (TextureFormat)4, false);
			try
			{
				if (resourceBytes == null)
				{
					FillTexture(val, fallbackColor);
				}
				else
				{
					ImageConversion.LoadImage(val, resourceBytes, false);
					val.Apply();
					CleanAlpha(val);
				}
			}
			catch (Exception ex)
			{
				LogError(ex.ToString());
				FillTexture(val, fallbackColor);
			}
			return Sprite.Create(val, new Rect(0f, 0f, (float)((Texture)val).width, (float)((Texture)val).height), new Vector2(31f, 31f));
		}

		private static Texture2D FillTexture(Texture2D tex, Color color)
		{
			//IL_000f: 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)
			Color[] pixels = tex.GetPixels();
			for (int i = 0; i < pixels.Length; i++)
			{
				pixels[i] = color;
			}
			tex.SetPixels(pixels);
			tex.Apply();
			return tex;
		}

		private static Texture2D CleanAlpha(Texture2D tex)
		{
			//IL_0027: Unknown result type (might be due to invalid IL or missing references)
			//IL_002c: Unknown result type (might be due to invalid IL or missing references)
			Color[] pixels = tex.GetPixels();
			for (int i = 0; i < pixels.Length; i++)
			{
				if (pixels[i].a < 0.05f)
				{
					pixels[i] = Color.clear;
				}
			}
			tex.SetPixels(pixels);
			tex.Apply();
			return tex;
		}
	}
	public static class ZetBazaarifact
	{
		private static readonly BindingFlags Flags = BindingFlags.Instance | BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic;

		private static int State = 0;

		internal static ArtifactDef ArtifactDef;

		public static bool Enabled
		{
			get
			{
				if (State < 1)
				{
					return false;
				}
				if (State > 1)
				{
					return true;
				}
				return ZetArtifactsPlugin.ArtifactEnabled(ArtifactDef);
			}
		}

		internal static void Init()
		{
			State = ZetArtifactsPlugin.BazaarifactEnable.Value;
			if (State >= 1)
			{
				ZetArtifactsPlugin.RegisterToken("ARTIFACT_ZETBAZAARIFACT_NAME", "Artifact of the Bazaar");
				ZetArtifactsPlugin.RegisterToken("ARTIFACT_ZETBAZAARIFACT_DESC", "The Bazaar Between Time contains a larger variety of interactables.");
			}
		}

		internal static void LateSetup()
		{
			if (State == 1)
			{
				if (ZetArtifactsPlugin.PluginLoaded("com.MagnusMagnuson.BiggerBazaar"))
				{
					BiggerBazaar();
				}
				if (ZetArtifactsPlugin.PluginLoaded("com.MagnusMagnuson.BazaarPrinter"))
				{
					BazaarPrinter();
				}
				if (ZetArtifactsPlugin.PluginLoaded("com.NetherCrowCSOLYOO.BazaarExpand"))
				{
					BazaarExpand();
				}
				if (ZetArtifactsPlugin.PluginLoaded("KevinPione.BazaareScrapper"))
				{
					BazaareScrapper();
				}
				if (ZetArtifactsPlugin.PluginLoaded("com.zorp.ConfigurableBazaar"))
				{
					ConfigurableBazaar();
				}
				if (ZetArtifactsPlugin.PluginLoaded("com.Lunzir.BazaarIsMyHome"))
				{
					BazaarIsMyHome();
				}
			}
		}

		private static void BiggerBazaar()
		{
			//IL_0040: Unknown result type (might be due to invalid IL or missing references)
			//IL_004a: Expected O, but got Unknown
			BaseUnityPlugin instance = Chainloader.PluginInfos["com.MagnusMagnuson.BiggerBazaar"].Instance;
			MethodInfo method = ((object)instance).GetType().GetMethod("isCurrentStageBazaar", Flags);
			if (method != null)
			{
				HookEndpointManager.Modify((MethodBase)method, (Delegate)new Manipulator(BiggerBazaarHook));
			}
			else
			{
				ZetArtifactsPlugin.LogWarn("[ZetBazaarifact] - Could Not Find Method : BiggerBazaar.isCurrentStageBazaar");
			}
		}

		private static void BazaarPrinter()
		{
			//IL_0040: Unknown result type (might be due to invalid IL or missing references)
			//IL_004a: Expected O, but got Unknown
			BaseUnityPlugin instance = Chainloader.PluginInfos["com.MagnusMagnuson.BazaarPrinter"].Instance;
			MethodInfo method = ((object)instance).GetType().GetMethod("SpawnPrinters", Flags);
			if (method != null)
			{
				HookEndpointManager.Modify((MethodBase)method, (Delegate)new Manipulator(GenericReturnHook));
			}
			else
			{
				ZetArtifactsPlugin.LogWarn("[ZetBazaarifact] - Could Not Find Method : BazaarPrinter.SpawnPrinters");
			}
		}

		private static void BazaarExpand()
		{
			//IL_0040: Unknown result type (might be due to invalid IL or missing references)
			//IL_004a: Expected O, but got Unknown
			BaseUnityPlugin instance = Chainloader.PluginInfos["com.NetherCrowCSOLYOO.BazaarExpand"].Instance;
			MethodInfo method = ((object)instance).GetType().GetMethod("SpawnExpand", Flags);
			if (method != null)
			{
				HookEndpointManager.Modify((MethodBase)method, (Delegate)new Manipulator(GenericReturnHook));
			}
			else
			{
				ZetArtifactsPlugin.LogWarn("[ZetBazaarifact] - Could Not Find Method : BazaarExpand.SpawnExpand");
			}
		}

		private static void BazaareScrapper()
		{
			//IL_0040: Unknown result type (might be due to invalid IL or missing references)
			//IL_004a: Expected O, but got Unknown
			BaseUnityPlugin instance = Chainloader.PluginInfos["KevinPione.BazaareScrapper"].Instance;
			MethodInfo method = ((object)instance).GetType().GetMethod("SpawnScrapper", Flags);
			if (method != null)
			{
				HookEndpointManager.Modify((MethodBase)method, (Delegate)new Manipulator(GenericReturnHook));
			}
			else
			{
				ZetArtifactsPlugin.LogWarn("[ZetBazaarifact] - Could Not Find Method : BazaareScrapper.SpawnScrapper");
			}
		}

		private static void ConfigurableBazaar()
		{
			//IL_0082: Unknown result type (might be due to invalid IL or missing references)
			//IL_008c: Expected O, but got Unknown
			BaseUnityPlugin instance = Chainloader.PluginInfos["com.zorp.ConfigurableBazaar"].Instance;
			Type type = ((object)instance).GetType();
			List<string> list = new List<string> { "SpawnScrapper", "SpawnCleansingPool", "SpawnPrinters" };
			foreach (string item in list)
			{
				MethodInfo method = type.GetMethod(item, Flags);
				if (method != null)
				{
					HookEndpointManager.Modify((MethodBase)method, (Delegate)new Manipulator(GenericReturnHook));
				}
				else
				{
					ZetArtifactsPlugin.LogWarn("[ZetBazaarifact] - Could Not Find Method : ConfigurableBazaar." + item);
				}
			}
		}

		private static void BazaarIsMyHome()
		{
			//IL_00c6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d0: Expected O, but got Unknown
			BaseUnityPlugin instance = Chainloader.PluginInfos["com.Lunzir.BazaarIsMyHome"].Instance;
			Type type = ((object)instance).GetType();
			List<string> list = new List<string> { "SpawnPrinters", "SpawnScrapper", "SpawnEquipment", "SpawnShrineCleanse", "SpawnShrineRestack", "SpawnShrineHealing" };
			if (!ZetArtifactsPlugin.BazaarHomeExtraCauldrons.Value)
			{
				list.Add("SpawnLunarCauldron");
			}
			foreach (string item in list)
			{
				MethodInfo method = type.GetMethod(item, Flags);
				if (method != null)
				{
					HookEndpointManager.Modify((MethodBase)method, (Delegate)new Manipulator(GenericReturnHook));
				}
				else
				{
					ZetArtifactsPlugin.LogWarn("[ZetBazaarifact] - Could Not Find Method : BazaarIsMyHome." + item);
				}
			}
		}

		private static void BiggerBazaarHook(ILContext il)
		{
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			//IL_0008: Expected O, but got Unknown
			//IL_0097: Unknown result type (might be due to invalid IL or missing references)
			ILCursor val = new ILCursor(il);
			ILLabel val2 = null;
			if (val.TryGotoNext(new Func<Instruction, bool>[2]
			{
				(Instruction x) => ILPatternMatchingExt.MatchLdcI4(x, 0),
				(Instruction x) => ILPatternMatchingExt.MatchRet(x)
			}))
			{
				val2 = val.MarkLabel();
				val.Index = 0;
				val.EmitDelegate<Func<bool>>((Func<bool>)(() => Enabled));
				val.Emit(OpCodes.Brfalse, (object)val2);
			}
			else
			{
				ZetArtifactsPlugin.LogWarn("[ZetBazaarifact] - BiggerBazaarHook Failed");
			}
		}

		private static void GenericReturnHook(ILContext il)
		{
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			//IL_0008: Expected O, but got Unknown
			//IL_0075: Unknown result type (might be due to invalid IL or missing references)
			ILCursor val = new ILCursor(il);
			ILLabel val2 = null;
			if (val.TryGotoNext(new Func<Instruction, bool>[1]
			{
				(Instruction x) => ILPatternMatchingExt.MatchRet(x)
			}))
			{
				val2 = val.MarkLabel();
				val.Index = 0;
				val.EmitDelegate<Func<bool>>((Func<bool>)(() => Enabled));
				val.Emit(OpCodes.Brfalse, (object)val2);
			}
			else
			{
				ZetArtifactsPlugin.LogWarn("[ZetBazaarifact] - GenericReturnHook Failed");
			}
		}
	}
	public class ZetDropHandler : MonoBehaviour, IPointerClickHandler, IEventSystemHandler
	{
		public Func<ItemIndex> GetItemIndex { get; set; }

		public Func<Inventory> GetInventory { get; set; }

		public bool EquipmentIcon { get; set; }

		public void OnPointerClick(PointerEventData eventData)
		{
			ZetDropifact.HandlePointerClick(this, eventData);
		}
	}
	public class ZetDropMarker : MonoBehaviour
	{
	}
	public class ZetDropReply : INetMessage, ISerializableObject
	{
		public CharacterBody Body;

		public int DropType;

		public int Index;

		public void Serialize(NetworkWriter writer)
		{
			writer.Write(((Component)Body).gameObject);
			writer.Write(DropType);
			writer.Write(Index);
		}

		public void Deserialize(NetworkReader reader)
		{
			Body = reader.ReadGameObject().GetComponent<CharacterBody>();
			DropType = reader.ReadInt32();
			Index = reader.ReadInt32();
		}

		public void OnReceived()
		{
			if (!NetworkServer.active)
			{
				ZetDropifact.HandleServerReply(this);
			}
		}
	}
	public class ZetDropRequest : INetMessage, ISerializableObject
	{
		public CharacterBody Body;

		public int DropType;

		public int Index;

		public float Angle;

		public void Serialize(NetworkWriter writer)
		{
			writer.Write(((Component)Body).gameObject);
			writer.Write(DropType);
			writer.Write(Index);
			writer.Write(Angle);
		}

		public void Deserialize(NetworkReader reader)
		{
			Body = reader.ReadGameObject().GetComponent<CharacterBody>();
			DropType = reader.ReadInt32();
			Index = reader.ReadInt32();
			Angle = reader.ReadSingle();
		}

		public void OnReceived()
		{
			if (NetworkServer.active && ZetDropifact.HandleClientRequest(this))
			{
				ZetDropReply zetDropReply = new ZetDropReply
				{
					Body = Body,
					DropType = DropType,
					Index = Index
				};
				NetMessageExtensions.Send((INetMessage)(object)zetDropReply, (NetworkDestination)1);
			}
		}
	}
	public static class ZetDropifact
	{
		[Serializable]
		[CompilerGenerated]
		private sealed class <>c
		{
			public static readonly <>c <>9 = new <>c();

			public static Func<Instruction, bool> <>9__30_1;

			public static Func<Instruction, bool> <>9__30_2;

			public static Func<Instruction, bool> <>9__30_3;

			public static Func<ItemIcon, ItemIcon> <>9__30_4;

			public static Manipulator <>9__30_0;

			public static Func<Instruction, bool> <>9__32_1;

			public static Action<ScoreboardStrip> <>9__32_2;

			public static Manipulator <>9__32_0;

			public static hook_OnCollisionEnter <>9__34_0;

			internal void <ItemIconHook>b__30_0(ILContext il)
			{
				//IL_0002: Unknown result type (might be due to invalid IL or missing references)
				//IL_0008: Expected O, but got Unknown
				ILCursor val = new ILCursor(il);
				val.GotoNext(new Func<Instruction, bool>[3]
				{
					(Instruction x) => ILPatternMatchingExt.MatchStloc(x, 1),
					(Instruction x) => ILPatternMatchingExt.MatchLdarg(x, 0),
					(Instruction x) => ILPatternMatchingExt.MatchLdfld<ItemInventoryDisplay>(x, "itemIcons")
				});
				val.EmitDelegate<Func<ItemIcon, ItemIcon>>((Func<ItemIcon, ItemIcon>)delegate(ItemIcon icon)
				{
					AttachZetDropHandler(icon);
					return icon;
				});
			}

			internal bool <ItemIconHook>b__30_1(Instruction x)
			{
				return ILPatternMatchingExt.MatchStloc(x, 1);
			}

			internal bool <ItemIconHook>b__30_2(Instruction x)
			{
				return ILPatternMatchingExt.MatchLdarg(x, 0);
			}

			internal bool <ItemIconHook>b__30_3(Instruction x)
			{
				return ILPatternMatchingExt.MatchLdfld<ItemInventoryDisplay>(x, "itemIcons");
			}

			internal ItemIcon <ItemIconHook>b__30_4(ItemIcon icon)
			{
				AttachZetDropHandler(icon);
				return icon;
			}

			internal void <EquipmentIconHook>b__32_0(ILContext il)
			{
				//IL_0002: Unknown result type (might be due to invalid IL or missing references)
				//IL_0008: Expected O, but got Unknown
				//IL_0047: Unknown result type (might be due to invalid IL or missing references)
				ILCursor val = new ILCursor(il);
				val.GotoNext(new Func<Instruction, bool>[1]
				{
					(Instruction x) => ILPatternMatchingExt.MatchCallvirt<ItemInventoryDisplay>(x, "SetSubscribedInventory")
				});
				val.Index += 1;
				val.Emit(OpCodes.Ldarg, 0);
				val.EmitDelegate<Action<ScoreboardStrip>>((Action<ScoreboardStrip>)delegate(ScoreboardStrip strip)
				{
					if ((Object)(object)strip.equipmentIcon != (Object)null)
					{
						AttachZetDropHandler(strip.equipmentIcon);
					}
				});
			}

			internal bool <EquipmentIconHook>b__32_1(Instruction x)
			{
				return ILPatternMatchingExt.MatchCallvirt<ItemInventoryDisplay>(x, "SetSubscribedInventory");
			}

			internal void <EquipmentIconHook>b__32_2(ScoreboardStrip strip)
			{
				if ((Object)(object)strip.equipmentIcon != (Object)null)
				{
					AttachZetDropHandler(strip.equipmentIcon);
				}
			}

			internal void <MarkedDropletBypassHook>b__34_0(orig_OnCollisionEnter orig, PickupDropletController self, Collision collision)
			{
				//IL_0048: Unknown result type (might be due to invalid IL or missing references)
				//IL_004d: Unknown result type (might be due to invalid IL or missing references)
				if (NetworkServer.active && self.alive && Object.op_Implicit((Object)(object)((Component)self).GetComponent<ZetDropMarker>()) && ZetArtifactsPlugin.DropifactBypassGround.Value)
				{
					self.alive = false;
					self.createPickupInfo.position = ((Component)self).transform.position;
					GenericPickupController.CreatePickup(ref self.createPickupInfo);
					Object.Destroy((Object)(object)((Component)self).gameObject);
				}
				else
				{
					orig.Invoke(self, collision);
				}
			}
		}

		public static CharacterBody LocalBody;

		public static ItemIndex ArtifactKeyIndex = (ItemIndex)(-1);

		public static ItemIndex LunarScrapIndex = (ItemIndex)(-1);

		public static ItemTier LunarVoidTier = (ItemTier)10;

		public static bool appliedVoidBearFix = false;

		private static int State = 0;

		internal static ArtifactDef ArtifactDef;

		public static bool Enabled
		{
			get
			{
				if (State < 1)
				{
					return false;
				}
				if (State > 1)
				{
					return true;
				}
				return ZetArtifactsPlugin.ArtifactEnabled(ArtifactDef);
			}
		}

		internal static void Init()
		{
			//IL_009a: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a4: Expected O, but got Unknown
			State = ZetArtifactsPlugin.DropifactEnable.Value;
			if (State >= 1)
			{
				ZetArtifactsPlugin.RegisterToken("ARTIFACT_ZETDROPIFACT_NAME", "Artifact of Tossing");
				ZetArtifactsPlugin.RegisterToken("ARTIFACT_ZETDROPIFACT_DESC", "Allows players to drop and scrap items.\n\n<style=cStack>" + (ZetArtifactsPlugin.DropifactAltScrap.Value ? "LeftAlt + " : "") + "RMB to scrap</style>");
				NetworkingAPI.RegisterMessageType<ZetDropReply>();
				NetworkingAPI.RegisterMessageType<ZetDropRequest>();
				ItemIconHook();
				EquipmentIconHook();
				MarkedDropletBypassHook();
				SceneDirector.onGenerateInteractableCardSelection += RemoveScrapperCard;
				BazaarController.Start += new hook_Start(AddBazaarScrapper);
			}
		}

		internal static void LateSetup()
		{
			//IL_0017: Unknown result type (might be due to invalid IL or missing references)
			//IL_001c: Unknown result type (might be due to invalid IL or missing references)
			//IL_001d: Unknown result type (might be due to invalid IL or missing references)
			//IL_001f: Invalid comparison between Unknown and I4
			//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_003b: Unknown result type (might be due to invalid IL or missing references)
			//IL_003d: Invalid comparison between Unknown and I4
			//IL_0029: Unknown result type (might be due to invalid IL or missing references)
			//IL_002a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0049: 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_0069: Unknown result type (might be due to invalid IL or missing references)
			//IL_006e: Unknown result type (might be due to invalid IL or missing references)
			//IL_008f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0099: Expected O, but got Unknown
			//IL_00a1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ab: Expected O, but got Unknown
			if (State >= 1)
			{
				ItemIndex val = ItemCatalog.FindItemIndex("ArtifactKey");
				if ((int)val != -1)
				{
					ArtifactKeyIndex = val;
				}
				val = ItemCatalog.FindItemIndex("ScrapLunar");
				if ((int)val != -1)
				{
					LunarScrapIndex = val;
				}
				ItemTierDef val2 = ItemTierCatalog.FindTierDef("VoidLunarTierDef");
				if (Object.op_Implicit((Object)(object)val2))
				{
					LunarVoidTier = val2.tier;
				}
				if (!ZetArtifactsPlugin.PluginLoaded("com.TPDespair.ZetAspects"))
				{
					CharacterBody.AddTimedBuff_BuffDef_float += new hook_AddTimedBuff_BuffDef_float(VoidBearFix_AddTimedBuff);
					CharacterBody.RemoveBuff_BuffIndex += new hook_RemoveBuff_BuffIndex(VoidBearFix_RemoveBuff);
					appliedVoidBearFix = true;
				}
			}
		}

		internal static void HandlePointerClick(ZetDropHandler handler, PointerEventData eventData)
		{
			//IL_008e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0094: Invalid comparison between Unknown and I4
			//IL_01b9: Unknown result type (might be due to invalid IL or missing references)
			//IL_01be: Unknown result type (might be due to invalid IL or missing references)
			//IL_01c0: Unknown result type (might be due to invalid IL or missing references)
			//IL_017b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0180: Unknown result type (might be due to invalid IL or missing references)
			//IL_0182: Unknown result type (might be due to invalid IL or missing references)
			//IL_010e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0113: 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_00c2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c9: Unknown result type (might be due to invalid IL or missing references)
			//IL_01d5: Unknown result type (might be due to invalid IL or missing references)
			//IL_0197: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00fa: Expected I4, but got Unknown
			//IL_01e6: Unknown result type (might be due to invalid IL or missing references)
			//IL_01a7: 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_014c: Expected I4, but got Unknown
			if (!Enabled)
			{
				return;
			}
			Inventory val = handler.GetInventory();
			if (!Object.op_Implicit((Object)(object)val) || !((NetworkBehaviour)val).hasAuthority)
			{
				return;
			}
			CharacterMaster component = ((Component)val).GetComponent<CharacterMaster>();
			if (!Object.op_Implicit((Object)(object)component))
			{
				return;
			}
			CharacterBody body = component.GetBody();
			if (!Object.op_Implicit((Object)(object)body))
			{
				return;
			}
			bool flag = (!ZetArtifactsPlugin.DropifactAltScrap.Value || Input.GetKey((KeyCode)308)) && (int)eventData.button == 1;
			float aimAngle = GetAimAngle(body);
			if (!NetworkServer.active)
			{
				ZetDropRequest zetDropRequest;
				if (handler.EquipmentIcon)
				{
					EquipmentIndex equipmentIndex = val.GetEquipmentIndex();
					if (!ValidDropRequest(equipmentIndex, flag))
					{
						return;
					}
					zetDropRequest = new ZetDropRequest
					{
						Body = body,
						DropType = 2,
						Index = (int)equipmentIndex,
						Angle = aimAngle
					};
				}
				else
				{
					ItemIndex val2 = handler.GetItemIndex();
					if (!ValidDropRequest(val2, flag))
					{
						return;
					}
					zetDropRequest = new ZetDropRequest
					{
						Body = body,
						DropType = (flag ? 1 : 0),
						Index = (int)val2,
						Angle = aimAngle
					};
				}
				LocalBody = body;
				NetMessageExtensions.Send((INetMessage)(object)zetDropRequest, (NetworkDestination)2);
			}
			else if (handler.EquipmentIcon)
			{
				EquipmentIndex equipmentIndex2 = val.GetEquipmentIndex();
				if (ValidDropRequest(equipmentIndex2, flag) && DropItem(body, val, equipmentIndex2, aimAngle))
				{
					CreateNotification(body, equipmentIndex2);
				}
			}
			else
			{
				ItemIndex index = handler.GetItemIndex();
				if (ValidDropRequest(index, flag) && DropItem(body, val, index, aimAngle, flag))
				{
					CreateNotification(body, index, flag);
				}
			}
		}

		internal static void HandleServerReply(ZetDropReply dropReply)
		{
			//IL_008f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0092: Unknown result type (might be due to invalid IL or missing references)
			//IL_006f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0072: Unknown result type (might be due to invalid IL or missing references)
			if (!Enabled)
			{
				return;
			}
			CharacterBody body = dropReply.Body;
			if (!Object.op_Implicit((Object)(object)body) || !Object.op_Implicit((Object)(object)LocalBody) || (Object)(object)body != (Object)(object)LocalBody)
			{
				return;
			}
			Inventory inventory = body.inventory;
			if (Object.op_Implicit((Object)(object)inventory))
			{
				if (dropReply.DropType == 2)
				{
					EquipmentIndex index = (EquipmentIndex)dropReply.Index;
					CreateNotification(body, index);
				}
				else
				{
					bool scrap = dropReply.DropType == 1;
					ItemIndex index2 = (ItemIndex)dropReply.Index;
					CreateNotification(body, index2, scrap);
				}
			}
		}

		internal static bool HandleClientRequest(ZetDropRequest dropRequest)
		{
			//IL_00a9: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ab: Unknown result type (might be due to invalid IL or missing references)
			//IL_0064: 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_00c3: 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)
			if (!Enabled)
			{
				return false;
			}
			CharacterBody body = dropRequest.Body;
			if (!Object.op_Implicit((Object)(object)body))
			{
				return false;
			}
			Inventory inventory = body.inventory;
			if (!Object.op_Implicit((Object)(object)inventory))
			{
				return false;
			}
			if (dropRequest.DropType == 2)
			{
				EquipmentIndex index = (EquipmentIndex)dropRequest.Index;
				if (!ValidDropRequest(index, scrap: false))
				{
					return false;
				}
				if (DropItem(body, inventory, index, dropRequest.Angle))
				{
					return true;
				}
			}
			else
			{
				bool scrap = dropRequest.DropType == 1;
				ItemIndex index2 = (ItemIndex)dropRequest.Index;
				if (!ValidDropRequest(index2, scrap))
				{
					return false;
				}
				if (DropItem(body, inventory, index2, dropRequest.Angle, scrap))
				{
					return true;
				}
			}
			return false;
		}

		private static bool ValidDropRequest(EquipmentIndex index, bool scrap)
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_0003: Invalid comparison between Unknown and I4
			if ((int)index == -1)
			{
				return false;
			}
			if (scrap)
			{
				return false;
			}
			return true;
		}

		private static bool ValidDropRequest(ItemIndex index, bool scrap)
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_0003: Invalid comparison between Unknown and I4
			//IL_000d: Unknown result type (might be due to invalid IL or missing references)
			//IL_000e: Unknown result type (might be due to invalid IL or missing references)
			//IL_001f: 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_002d: Invalid comparison between Unknown and I4
			//IL_003a: 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 ((int)index == -1)
			{
				return false;
			}
			if (index == ArtifactKeyIndex && scrap)
			{
				return false;
			}
			ItemDef itemDef = ItemCatalog.GetItemDef(index);
			if ((int)itemDef.tier == 5)
			{
				return false;
			}
			if (IsDropRestricted(itemDef.tier))
			{
				return false;
			}
			if (!ZetArtifactsPlugin.DropifactUnique.Value && itemDef.ContainsTag((ItemTag)9))
			{
				return false;
			}
			if (scrap)
			{
				return IsScrapable(itemDef.tier);
			}
			return true;
		}

		private static bool IsScrapable(ItemTier tier)
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_0008: Invalid comparison between Unknown and I4
			//IL_000a: 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_001d: Unknown result type (might be due to invalid IL or missing references)
			//IL_001e: Unknown result type (might be due to invalid IL or missing references)
			//IL_001f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0020: 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_004f: Expected I4, but got Unknown
			//IL_0055: Unknown result type (might be due to invalid IL or missing references)
			//IL_005b: Invalid comparison between Unknown and I4
			if ((int)LunarVoidTier != 10 && tier == LunarVoidTier)
			{
				return false;
			}
			switch ((int)tier)
			{
			case 0:
			case 1:
			case 2:
			case 4:
				return true;
			case 3:
				if ((int)LunarScrapIndex != -1)
				{
					return true;
				}
				return false;
			case 6:
			case 7:
			case 8:
			case 9:
				return false;
			default:
				return false;
			}
		}

		private static bool IsDropRestricted(ItemTier tier)
		{
			//IL_0001: 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_00d4: Invalid comparison between Unknown and I4
			//IL_00ec: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ee: Invalid comparison between Unknown and I4
			//IL_0029: Unknown result type (might be due to invalid IL or missing references)
			//IL_002b: Invalid comparison between Unknown and I4
			//IL_0106: Unknown result type (might be due to invalid IL or missing references)
			//IL_0108: Invalid comparison between Unknown and I4
			//IL_0044: Unknown result type (might be due to invalid IL or missing references)
			//IL_0046: Invalid comparison between Unknown and I4
			//IL_0120: Unknown result type (might be due to invalid IL or missing references)
			//IL_0122: Invalid comparison between Unknown and I4
			//IL_0061: Unknown result type (might be due to invalid IL or missing references)
			//IL_0063: Invalid comparison between Unknown and I4
			//IL_013a: Unknown result type (might be due to invalid IL or missing references)
			//IL_013c: Invalid comparison between Unknown and I4
			//IL_007e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0081: Invalid comparison between Unknown and I4
			//IL_009c: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a3: Invalid comparison between Unknown and I4
			//IL_00a5: 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)
			if (IsVoidTier(tier))
			{
				if (!ZetArtifactsPlugin.DropifactVoid.Value)
				{
					return true;
				}
				if ((int)tier == 6)
				{
					return !ZetArtifactsPlugin.DropifactVoidT1.Value;
				}
				if ((int)tier == 7)
				{
					return !ZetArtifactsPlugin.DropifactVoidT2.Value;
				}
				if ((int)tier == 8)
				{
					return !ZetArtifactsPlugin.DropifactVoidT3.Value;
				}
				if ((int)tier == 9)
				{
					return !ZetArtifactsPlugin.DropifactVoidBoss.Value;
				}
				if ((int)LunarVoidTier != 10 && tier == LunarVoidTier)
				{
					return !ZetArtifactsPlugin.DropifactVoidLunar.Value;
				}
			}
			else
			{
				if ((int)tier == 0)
				{
					return !ZetArtifactsPlugin.DropifactT1.Value;
				}
				if ((int)tier == 1)
				{
					return !ZetArtifactsPlugin.DropifactT2.Value;
				}
				if ((int)tier == 2)
				{
					return !ZetArtifactsPlugin.DropifactT3.Value;
				}
				if ((int)tier == 4)
				{
					return !ZetArtifactsPlugin.DropifactBoss.Value;
				}
				if ((int)tier == 3)
				{
					return !ZetArtifactsPlugin.DropifactLunar.Value;
				}
			}
			return false;
		}

		private static bool IsVoidTier(ItemTier tier)
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_0003: Invalid comparison between Unknown and I4
			//IL_000d: Unknown result type (might be due to invalid IL or missing references)
			//IL_000f: Invalid comparison between Unknown and I4
			//IL_0019: Unknown result type (might be due to invalid IL or missing references)
			//IL_001b: Invalid comparison between Unknown and I4
			//IL_0025: Unknown result type (might be due to invalid IL or missing references)
			//IL_0028: Invalid comparison between Unknown and I4
			//IL_0034: Unknown result type (might be due to invalid IL or missing references)
			//IL_003b: Invalid comparison between Unknown and I4
			//IL_003d: 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)
			if ((int)tier == 6)
			{
				return true;
			}
			if ((int)tier == 7)
			{
				return true;
			}
			if ((int)tier == 8)
			{
				return true;
			}
			if ((int)tier == 9)
			{
				return true;
			}
			if ((int)LunarVoidTier != 10 && tier == LunarVoidTier)
			{
				return true;
			}
			return false;
		}

		private static int GetRealItemCount(Inventory inventory, ItemIndex itemIndex)
		{
			//IL_0007: Unknown result type (might be due to invalid IL or missing references)
			//IL_000d: Expected I4, but got Unknown
			return ArrayUtils.GetSafe<int>(inventory.itemStacks, (int)itemIndex);
		}

		private static bool DropItem(CharacterBody body, Inventory inventory, EquipmentIndex index, float angle)
		{
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			//IL_0007: Unknown result type (might be due to invalid IL or missing references)
			//IL_001d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			if (inventory.GetEquipmentIndex() != index)
			{
				return false;
			}
			inventory.SetEquipmentIndex((EquipmentIndex)(-1));
			CreateDroplet(index, body.transform.position, angle);
			return true;
		}

		private static bool DropItem(CharacterBody body, Inventory inventory, ItemIndex index, float angle, bool scrap)
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			//IL_0004: 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_00a7: Invalid comparison between Unknown and I4
			//IL_0025: Unknown result type (might be due to invalid IL or missing references)
			//IL_002b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0030: Unknown result type (might be due to invalid IL or missing references)
			//IL_0032: Unknown result type (might be due to invalid IL or missing references)
			//IL_0034: Unknown result type (might be due to invalid IL or missing references)
			//IL_0036: Unknown result type (might be due to invalid IL or missing references)
			//IL_0051: Expected I4, but got Unknown
			//IL_00b4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00bc: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c3: Unknown result type (might be due to invalid IL or missing references)
			//IL_0058: Unknown result type (might be due to invalid IL or missing references)
			//IL_005d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0065: Unknown result type (might be due to invalid IL or missing references)
			//IL_006a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0072: Unknown result type (might be due to invalid IL or missing references)
			//IL_0077: Unknown result type (might be due to invalid IL or missing references)
			//IL_0087: Unknown result type (might be due to invalid IL or missing references)
			//IL_008d: Invalid comparison between Unknown and I4
			//IL_007f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0084: Unknown result type (might be due to invalid IL or missing references)
			//IL_0098: Unknown result type (might be due to invalid IL or missing references)
			//IL_009d: Unknown result type (might be due to invalid IL or missing references)
			ItemIndex val = index;
			if (GetRealItemCount(inventory, index) <= 0)
			{
				return false;
			}
			if (scrap)
			{
				ItemTier tier = ItemCatalog.GetItemDef(index).tier;
				ItemTier val2 = tier;
				switch ((int)val2)
				{
				case 0:
					val = Items.ScrapWhite.itemIndex;
					break;
				case 1:
					val = Items.ScrapGreen.itemIndex;
					break;
				case 2:
					val = Items.ScrapRed.itemIndex;
					break;
				case 4:
					val = Items.ScrapYellow.itemIndex;
					break;
				case 3:
					if ((int)LunarScrapIndex != -1)
					{
						val = LunarScrapIndex;
					}
					break;
				default:
					return false;
				}
			}
			if ((int)val == -1)
			{
				return false;
			}
			inventory.RemoveItem(index, 1);
			CreateDroplet(val, body.transform.position, angle);
			return true;
		}

		private static float GetAimAngle(CharacterBody body)
		{
			//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_001c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0027: Unknown result type (might be due to invalid IL or missing references)
			//IL_0032: Unknown result type (might be due to invalid IL or missing references)
			//IL_0037: Unknown result type (might be due to invalid IL or missing references)
			//IL_0038: Unknown result type (might be due to invalid IL or missing references)
			InputBankTest inputBank = body.inputBank;
			if (Object.op_Implicit((Object)(object)inputBank))
			{
				Vector3 aimDirection = inputBank.aimDirection;
				Vector3 val = default(Vector3);
				((Vector3)(ref val))..ctor(aimDirection.x, 0f, aimDirection.z);
				return Vector3.SignedAngle(Vector3.forward, val, Vector3.up);
			}
			return 0f;
		}

		private static void CreateDroplet(EquipmentIndex index, Vector3 pos, float angle)
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			//IL_0007: Unknown result type (might be due to invalid IL or missing references)
			CreateDroplet(PickupCatalog.FindPickupIndex(index), pos, angle);
		}

		private static void CreateDroplet(ItemIndex index, Vector3 pos, float angle)
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			//IL_0007: Unknown result type (might be due to invalid IL or missing references)
			CreateDroplet(PickupCatalog.FindPickupIndex(index), pos, angle);
		}

		private static void CreateDroplet(PickupIndex index, Vector3 pos, float angle)
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			//IL_0003: Unknown result type (might be due to invalid IL or missing references)
			//IL_000d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0013: Unknown result type (might be due to invalid IL or missing references)
			//IL_0018: Unknown result type (might be due to invalid IL or missing references)
			//IL_001d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0027: Unknown result type (might be due to invalid IL or missing references)
			//IL_002c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0031: Unknown result type (might be due to invalid IL or missing references)
			CreateMarkedPickupDroplet(index, pos, Vector3.up * 20f + Quaternion.AngleAxis(angle, Vector3.up) * (Vector3.forward * 10f));
		}

		private static void CreateMarkedPickupDroplet(PickupIndex pickupIndex, Vector3 position, Vector3 velocity)
		{
			//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_001e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0020: Unknown result type (might be due to invalid IL or missing references)
			//IL_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_0064: 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_0047: 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_0050: Unknown result type (might be due to invalid IL or missing references)
			CreatePickupInfo val = default(CreatePickupInfo);
			val.rotation = Quaternion.identity;
			((CreatePickupInfo)(ref val)).pickupIndex = pickupIndex;
			CreatePickupInfo createPickupInfo = val;
			GameObject val2 = Object.Instantiate<GameObject>(PickupDropletController.pickupDropletPrefab, position, Quaternion.identity);
			PickupDropletController component = val2.GetComponent<PickupDropletController>();
			if (Object.op_Implicit((Object)(object)component))
			{
				component.createPickupInfo = createPickupInfo;
				component.NetworkpickupIndex = ((CreatePickupInfo)(ref createPickupInfo)).pickupIndex;
			}
			Rigidbody component2 = val2.GetComponent<Rigidbody>();
			component2.velocity = velocity;
			component2.AddTorque(Random.Range(150f, 120f) * Random.onUnitSphere);
			val2.AddComponent<ZetDropMarker>();
			NetworkServer.Spawn(val2);
		}

		private static void CreateNotification(CharacterBody body, EquipmentIndex index)
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			EquipmentDef equipmentDef = EquipmentCatalog.GetEquipmentDef(index);
			string @string = Language.GetString(equipmentDef.nameToken);
			Texture pickupIconTexture = equipmentDef.pickupIconTexture;
			CreateNotification(body, "Equipment dropped", @string, pickupIconTexture);
		}

		private static void CreateNotification(CharacterBody body, ItemIndex index, bool scrap)
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			ItemDef itemDef = ItemCatalog.GetItemDef(index);
			string title = (scrap ? "Item scrapped" : "Item dropped");
			string @string = Language.GetString(itemDef.nameToken);
			Texture pickupIconTexture = itemDef.pickupIconTexture;
			CreateNotification(body, title, @string, pickupIconTexture);
		}

		private static void CreateNotification(CharacterBody body, string title, string description, Texture texture)
		{
			//IL_0062: Unknown result type (might be due to invalid IL or missing references)
			Notification val = ((Component)body).gameObject.AddComponent<Notification>();
			if (Object.op_Implicit((Object)(object)val))
			{
				((Component)val).transform.SetParent(body.transform);
				float num = (float)Screen.width * 0.8f;
				float num2 = (float)Screen.height * 0.25f;
				val.SetPosition(new Vector3(num, num2, 0f));
				val.SetIcon(texture);
				val.GetTitle = () => title;
				val.GetDescription = () => description;
				Object.Destroy((Object)(object)val, 4.25f);
			}
		}

		private static void ItemIconHook()
		{
			//IL_0015: Unknown result type (might be due to invalid IL or missing references)
			//IL_001a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0020: Expected O, but got Unknown
			object obj = <>c.<>9__30_0;
			if (obj == null)
			{
				Manipulator val = delegate(ILContext il)
				{
					//IL_0002: Unknown result type (might be due to invalid IL or missing references)
					//IL_0008: Expected O, but got Unknown
					ILCursor val2 = new ILCursor(il);
					val2.GotoNext(new Func<Instruction, bool>[3]
					{
						(Instruction x) => ILPatternMatchingExt.MatchStloc(x, 1),
						(Instruction x) => ILPatternMatchingExt.MatchLdarg(x, 0),
						(Instruction x) => ILPatternMatchingExt.MatchLdfld<ItemInventoryDisplay>(x, "itemIcons")
					});
					val2.EmitDelegate<Func<ItemIcon, ItemIcon>>((Func<ItemIcon, ItemIcon>)delegate(ItemIcon icon)
					{
						AttachZetDropHandler(icon);
						return icon;
					});
				};
				<>c.<>9__30_0 = val;
				obj = (object)val;
			}
			ItemInventoryDisplay.AllocateIcons += (Manipulator)obj;
		}

		private static void AttachZetDropHandler(ItemIcon icon)
		{
			if (!((Object)(object)((Component)icon).GetComponent<ZetDropHandler>() != (Object)null))
			{
				ZetDropHandler zetDropHandler = ((Component)((Component)icon).transform).gameObject.AddComponent<ZetDropHandler>();
				zetDropHandler.GetItemIndex = () => Reflection.GetFieldValue<ItemIndex>((object)icon, "itemIndex");
				zetDropHandler.GetInventory = () => Reflection.GetFieldValue<Inventory>((object)((Component)((Transform)icon.rectTransform).parent).GetComponent<ItemInventoryDisplay>(), "inventory");
			}
		}

		private static void EquipmentIconHook()
		{
			//IL_0015: Unknown result type (might be due to invalid IL or missing references)
			//IL_001a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0020: Expected O, but got Unknown
			object obj = <>c.<>9__32_0;
			if (obj == null)
			{
				Manipulator val = delegate(ILContext il)
				{
					//IL_0002: Unknown result type (might be due to invalid IL or missing references)
					//IL_0008: Expected O, but got Unknown
					//IL_0047: Unknown result type (might be due to invalid IL or missing references)
					ILCursor val2 = new ILCursor(il);
					val2.GotoNext(new Func<Instruction, bool>[1]
					{
						(Instruction x) => ILPatternMatchingExt.MatchCallvirt<ItemInventoryDisplay>(x, "SetSubscribedInventory")
					});
					val2.Index += 1;
					val2.Emit(OpCodes.Ldarg, 0);
					val2.EmitDelegate<Action<ScoreboardStrip>>((Action<ScoreboardStrip>)delegate(ScoreboardStrip strip)
					{
						if ((Object)(object)strip.equipmentIcon != (Object)null)
						{
							AttachZetDropHandler(strip.equipmentIcon);
						}
					});
				};
				<>c.<>9__32_0 = val;
				obj = (object)val;
			}
			ScoreboardStrip.SetMaster += (Manipulator)obj;
		}

		private static void AttachZetDropHandler(EquipmentIcon icon)
		{
			if (!((Object)(object)((Component)icon).GetComponent<ZetDropHandler>() != (Object)null))
			{
				ZetDropHandler zetDropHandler = ((Component)((Component)icon).transform).gameObject.AddComponent<ZetDropHandler>();
				zetDropHandler.GetInventory = () => icon.targetInventory;
				zetDropHandler.EquipmentIcon = true;
			}
		}

		private static void MarkedDropletBypassHook()
		{
			//IL_0015: Unknown result type (might be due to invalid IL or missing references)
			//IL_001a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0020: Expected O, but got Unknown
			object obj = <>c.<>9__34_0;
			if (obj == null)
			{
				hook_OnCollisionEnter val = delegate(orig_OnCollisionEnter orig, PickupDropletController self, Collision collision)
				{
					//IL_0048: Unknown result type (might be due to invalid IL or missing references)
					//IL_004d: Unknown result type (might be due to invalid IL or missing references)
					if (NetworkServer.active && self.alive && Object.op_Implicit((Object)(object)((Component)self).GetComponent<ZetDropMarker>()) && ZetArtifactsPlugin.DropifactBypassGround.Value)
					{
						self.alive = false;
						self.createPickupInfo.position = ((Component)self).transform.position;
						GenericPickupController.CreatePickup(ref self.createPickupInfo);
						Object.Destroy((Object)(object)((Component)self).gameObject);
					}
					else
					{
						orig.Invoke(self, collision);
					}
				};
				<>c.<>9__34_0 = val;
				obj = (object)val;
			}
			PickupDropletController.OnCollisionEnter += (hook_OnCollisionEnter)obj;
		}

		private static void RemoveScrapperCard(SceneDirector sceneDirector, DirectorCardCategorySelection dccs)
		{
			if (Enabled && ZetArtifactsPlugin.DropifactRemoveScrapper.Value)
			{
				dccs.RemoveCardsThatFailFilter((Predicate<DirectorCard>)NotScrapper);
			}
		}

		private static bool NotScrapper(DirectorCard card)
		{
			GameObject prefab = card.spawnCard.prefab;
			return !Object.op_Implicit((Object)(object)prefab.GetComponent<ScrapperController>());
		}

		private static void AddBazaarScrapper(orig_Start orig, BazaarController self)
		{
			//IL_0062: Unknown result type (might be due to invalid IL or missing references)
			//IL_0067: Unknown result type (might be due to invalid IL or missing references)
			//IL_0069: Unknown result type (might be due to invalid IL or missing references)
			//IL_0070: Expected O, but got Unknown
			//IL_007d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0084: Expected O, but got Unknown
			//IL_0094: Unknown result type (might be due to invalid IL or missing references)
			//IL_0099: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c2: Unknown result type (might be due to invalid IL or missing references)
			orig.Invoke(self);
			if (NetworkServer.active && Enabled && ZetArtifactsPlugin.DropifactBazaarScrapper.Value)
			{
				ArtifactDef val = ArtifactCatalog.FindArtifactDef("Sacrifice");
				bool flag = RunArtifactManager.instance.IsArtifactEnabled(val);
				if (flag)
				{
					RunArtifactManager.instance.SetArtifactEnabledServer(val, false);
				}
				SpawnCard val2 = LegacyResourcesAPI.Load<SpawnCard>("SpawnCards/InteractableSpawnCard/iscScrapper");
				DirectorPlacementRule val3 = new DirectorPlacementRule
				{
					placementMode = (PlacementMode)0
				};
				DirectorSpawnRequest val4 = new DirectorSpawnRequest(val2, val3, Run.instance.runRNG);
				GameObject spawnedInstance = val2.DoSpawn(new Vector3(-85f, -23.75f, -5f), Quaternion.identity, val4).spawnedInstance;
				spawnedInstance.transform.eulerAngles = new Vector3(0f, 165f, 0f);
				NetworkServer.Spawn(spawnedInstance);
				if (flag)
				{
					RunArtifactManager.instance.SetArtifactEnabledServer(val, true);
				}
			}
		}

		private static void VoidBearFix_AddTimedBuff(orig_AddTimedBuff_BuffDef_float orig, CharacterBody self, BuffDef buffDef, float duration)
		{
			//IL_001d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0022: Unknown result type (might be due to invalid IL or missing references)
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_0029: Unknown result type (might be due to invalid IL or missing references)
			//IL_002d: 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)
			if ((Object)(object)buffDef == (Object)null)
			{
				return;
			}
			if (NetworkServer.active)
			{
				BuffIndex buffIndex = Buffs.BearVoidCooldown.buffIndex;
				if (buffDef.buffIndex == buffIndex && self.GetBuffCount(buffIndex) < 1)
				{
					self.ClearTimedBuffs(buffIndex);
					self.SetBuffCount(buffIndex, 0);
				}
			}
			orig.Invoke(self, buffDef, duration);
		}

		private static void VoidBearFix_RemoveBuff(orig_RemoveBuff_BuffIndex orig, CharacterBody self, BuffIndex buffType)
		{
			//IL_0030: 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_0015: Unknown result type (might be due to invalid IL or missing references)
			//IL_0016: Unknown result type (might be due to invalid IL or missing references)
			//IL_0017: 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)
			if (NetworkServer.active)
			{
				BuffIndex buffIndex = Buffs.BearVoidCooldown.buffIndex;
				if (buffType == buffIndex && self.GetBuffCount(buffIndex) < 1)
				{
					return;
				}
			}
			orig.Invoke(self, buffType);
		}
	}
	public static class ZetEarlifact
	{
		[Serializable]
		[CompilerGenerated]
		private sealed class <>c
		{
			public static readonly <>c <>9 = new <>c();

			public static Func<Instruction, bool> <>9__5_1;

			public static Func<Instruction, bool> <>9__5_2;

			public static Func<int, int> <>9__5_3;

			public static Manipulator <>9__5_0;

			internal void <MinimumStageHook>b__5_0(ILContext il)
			{
				//IL_0002: Unknown result type (might be due to invalid IL or missing references)
				//IL_0008: Expected O, but got Unknown
				ILCursor val = new ILCursor(il);
				if (val.TryGotoNext(new Func<Instruction, bool>[2]
				{
					(Instruction x) => ILPatternMatchingExt.MatchLdarg(x, 0),
					(Instruction x) => ILPatternMatchingExt.MatchLdfld<DirectorCard>(x, "minimumStageCompletions")
				}))
				{
					val.Index += 2;
					val.EmitDelegate<Func<int, int>>((Func<int, int>)((int stage) => (!Enabled) ? stage : 0));
				}
				else
				{
					ZetArtifactsPlugin.LogWarn("[ZetEarlifact] - MinimumStageHook failed!");
				}
			}

			internal bool <MinimumStageHook>b__5_1(Instruction x)
			{
				return ILPatternMatchingExt.MatchLdarg(x, 0);
			}

			internal bool <MinimumStageHook>b__5_2(Instruction x)
			{
				return ILPatternMatchingExt.MatchLdfld<DirectorCard>(x, "minimumStageCompletions");
			}

			internal int <MinimumStageHook>b__5_3(int stage)
			{
				if (Enabled)
				{
					return 0;
				}
				return stage;
			}
		}

		private static int State;

		internal static ArtifactDef ArtifactDef;

		public static bool Enabled
		{
			get
			{
				if (State < 1)
				{
					return false;
				}
				if (State > 1)
				{
					return true;
				}
				return ZetArtifactsPlugin.ArtifactEnabled(ArtifactDef);
			}
		}

		internal static void Init()
		{
			if (!ZetArtifactsPlugin.EarlifactMerge.Value)
			{
				State = ZetArtifactsPlugin.EarlifactEnable.Value;
			}
			else
			{
				State = ZetArtifactsPlugin.LoopifactEnable.Value;
			}
			if (State >= 1)
			{
				ZetArtifactsPlugin.RegisterToken("ARTIFACT_ZETEARLIFACT_NAME", "Artifact of Sanction");
				ZetArtifactsPlugin.RegisterToken("ARTIFACT_ZETEARLIFACT_DESC", "Monster and Interactable types can appear earlier.");
				MinimumStageHook();
			}
		}

		private static void MinimumStageHook()
		{
			//IL_0015: Unknown result type (might be due to invalid IL or missing references)
			//IL_001a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0020: Expected O, but got Unknown
			object obj = <>c.<>9__5_0;
			if (obj == null)
			{
				Manipulator val = delegate(ILContext il)
				{
					//IL_0002: Unknown result type (might be due to invalid IL or missing references)
					//IL_0008: Expected O, but got Unknown
					ILCursor val2 = new ILCursor(il);
					if (val2.TryGotoNext(new Func<Instruction, bool>[2]
					{
						(Instruction x) => ILPatternMatchingExt.MatchLdarg(x, 0),
						(Instruction x) => ILPatternMatchingExt.MatchLdfld<DirectorCard>(x, "minimumStageCompletions")
					}))
					{
						val2.Index += 2;
						val2.EmitDelegate<Func<int, int>>((Func<int, int>)((int stage) => (!Enabled) ? stage : 0));
					}
					else
					{
						ZetArtifactsPlugin.LogWarn("[ZetEarlifact] - MinimumStageHook failed!");
					}
				};
				<>c.<>9__5_0 = val;
				obj = (object)val;
			}
			DirectorCard.IsAvailable += (Manipulator)obj;
		}
	}
	public static class ZetEclifact
	{
		private static int State;

		internal static ArtifactDef ArtifactDef;

		public static bool Enabled
		{
			get
			{
				if (State < 1)
				{
					return false;
				}
				if (State > 1)
				{
					return true;
				}
				return ZetArtifactsPlugin.ArtifactEnabled(ArtifactDef);
			}
		}

		private static void EnableEffects()
		{
			//IL_0008: Unknown result type (might be due to invalid IL or missing references)
			//IL_0012: Expected O, but got Unknown
			//IL_001a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0024: Expected O, but got Unknown
			//IL_002c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0036: Expected O, but got Unknown
			//IL_003e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0048: Expected O, but got Unknown
			//IL_0050: Unknown result type (might be due to invalid IL or missing references)
			//IL_005a: Expected O, but got Unknown
			//IL_0062: Unknown result type (might be due to invalid IL or missing references)
			//IL_006c: Expected O, but got Unknown
			//IL_0074: Unknown result type (might be due to invalid IL or missing references)
			//IL_007e: Expected O, but got Unknown
			//IL_0086: Unknown result type (might be due to invalid IL or missing references)
			//IL_0090: Expected O, but got Unknown
			CharacterMaster.OnBodyStart += new Manipulator(Eclipse1Hook);
			HoldoutZoneController.FixedUpdate += new Manipulator(Eclipse2Hook);
			GlobalEventManager.OnCharacterHitGroundServer += new Manipulator(Eclipse3Hook);
			CharacterBody.RecalculateStats += new Manipulator(Eclipse4Hook);
			HealthComponent.Heal += new Manipulator(Eclipse5Hook);
			DeathRewards.OnKilledServer += new Manipulator(Eclipse6Hook);
			CharacterBody.RecalculateStats += new Manipulator(Eclipse7Hook);
			HealthComponent.TakeDamage += new Manipulator(Eclipse8Hook);
		}

		private static void DisableEffects()
		{
			//IL_0008: Unknown result type (might be due to invalid IL or missing references)
			//IL_0012: Expected O, but got Unknown
			//IL_001a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0024: Expected O, but got Unknown
			//IL_002c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0036: Expected O, but got Unknown
			//IL_003e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0048: Expected O, but got Unknown
			//IL_0050: Unknown result type (might be due to invalid IL or missing references)
			//IL_005a: Expected O, but got Unknown
			//IL_0062: Unknown result type (might be due to invalid IL or missing references)
			//IL_006c: Expected O, but got Unknown
			//IL_0074: Unknown result type (might be due to invalid IL or missing references)
			//IL_007e: Expected O, but got Unknown
			//IL_0086: Unknown result type (might be due to invalid IL or missing references)
			//IL_0090: Expected O, but got Unknown
			CharacterMaster.OnBodyStart -= new Manipulator(Eclipse1Hook);
			HoldoutZoneController.FixedUpdate -= new Manipulator(Eclipse2Hook);
			GlobalEventManager.OnCharacterHitGroundServer -= new Manipulator(Eclipse3Hook);
			CharacterBody.RecalculateStats -= new Manipulator(Eclipse4Hook);
			HealthComponent.Heal -= new Manipulator(Eclipse5Hook);
			DeathRewards.OnKilledServer -= new Manipulator(Eclipse6Hook);
			CharacterBody.RecalculateStats -= new Manipulator(Eclipse7Hook);
			HealthComponent.TakeDamage -= new Manipulator(Eclipse8Hook);
		}

		private static void OnArtifactEnabled(RunArtifactManager runArtifactManager, ArtifactDef artifactDef)
		{
			if ((Object)(object)artifactDef == (Object)(object)ArtifactDef)
			{
				EnableEffects();
			}
		}

		private static void OnArtifactDisabled(RunArtifactManager runArtifactManager, ArtifactDef artifactDef)
		{
			if ((Object)(object)artifactDef == (Object)(object)ArtifactDef)
			{
				DisableEffects();
			}
		}

		internal static void Init()
		{
			//IL_0066: Unknown result type (might be due to invalid IL or missing references)
			//IL_0070: Expected O, but got Unknown
			//IL_0078: Unknown result type (might be due to invalid IL or missing references)
			//IL_0082: Expected O, but got Unknown
			State = ZetArtifactsPlugin.EclifactEnable.Value;
			if (ZetArtifactsPlugin.PluginLoaded("com.TPDespair.DiluvianArtifact"))
			{
				State = 0;
			}
			if (State >= 1)
			{
				ZetArtifactsPlugin.RegisterToken("ARTIFACT_ZETECLIFACT_NAME", "Artifact of the Eclipse");
				ZetArtifactsPlugin.RegisterToken("ARTIFACT_ZETECLIFACT_DESC", "Enables all Eclipse modifiers.\n\n<style=cStack>>Ally Starting Health: <style=cDeath>-50%</style>\n>Teleporter Radius: <style=cDeath>-50%</style>\n>Ally Fall Damage: <style=cDeath>+100% and lethal</style>\n>Enemy Speed: <style=cDeath>+40%</style>\n>Ally Healing: <style=cDeath>-50%</style>\n>Enemy Gold Drops: <style=cDeath>-20%</style>\n>Enemy Cooldowns: <style=cDeath>-50%</style>\n>Allies receive <style=cDeath>permanent damage</style></style>");
				if (State == 1)
				{
					RunArtifactManager.onArtifactEnabledGlobal += new ArtifactStateChangeDelegate(OnArtifactEnabled);
					RunArtifactManager.onArtifactDisabledGlobal += new ArtifactStateChangeDelegate(OnArtifactDisabled);
				}
				else
				{
					EnableEffects();
				}
			}
		}

		private static void Eclipse1Hook(ILContext il)
		{
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			//IL_0008: Expected O, but got Unknown
			ILCursor val = new ILCursor(il);
			bool flag = val.TryGotoNext(new Func<Instruction, bool>[3]
			{
				(Instruction x) => ILPatternMatchingExt.MatchCall<Run>(x, "get_instance"),
				(Instruction x) => ILPatternMatchingExt.MatchCallvirt<Run>(x, "get_selectedDifficulty"),
				(Instruction x) => ILPatternMatchingExt.MatchLdcI4(x, 3)
			});
			if (flag)
			{
				val.Index += 2;
				val.EmitDelegate<Func<DifficultyIndex, DifficultyIndex>>((Func<DifficultyIndex, DifficultyIndex>)((DifficultyIndex diffIndex) => (DifficultyIndex)3));
			}
			else
			{
				flag = val.TryGotoNext(new Func<Instruction, bool>[2]
				{
					(Instruction x) => ILPatternMatchingExt.MatchCall<Run>(x, "get_instance"),
					(Instruction x) => ILPatternMatchingExt.MatchCallvirt<Run>(x, "get_selectedDifficulty")
				});
				if (flag)
				{
					int index = val.Index;
					ILLabel val2 = default(ILLabel);
					flag = val.TryGotoNext(new Func<Instruction, bool>[2]
					{
						(Instruction x) => ILPatternMatchingExt.MatchLdcI4(x, 3),
						(Instruction x) => ILPatternMatchingExt.MatchBlt(x, ref val2)
					});
					if (flag)
					{
						int num = val.Index - index;
						if (num <= 8)
						{
							val.EmitDelegate<Func<DifficultyIndex, DifficultyIndex>>((Func<DifficultyIndex, DifficultyIndex>)((DifficultyIndex diffIndex) => (DifficultyIndex)3));
						}
						else
						{
							ZetArtifactsPlugin.LogWarn("EclipseHook(1) Failed! - LdcI4 Offset [" + num + "]");
						}
					}
				}
			}
			if (!flag)
			{
				ZetArtifactsPlugin.LogWarn("EclipseHook(1) Failed!");
			}
		}

		private static void Eclipse2Hook(ILContext il)
		{
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			//IL_0008: Expected O, but got Unknown
			ILCursor val = new ILCursor(il);
			bool flag = val.TryGotoNext(new Func<Instruction, bool>[3]
			{
				(Instruction x) => ILPatternMatchingExt.MatchCall<Run>(x, "get_instance"),
				(Instruction x) => ILPatternMatchingExt.MatchCallvirt<Run>(x, "get_selectedDifficulty"),
				(Instruction x) => ILPatternMatchingExt.MatchLdcI4(x, 4)
			});
			if (flag)
			{
				val.Index += 2;
				val.EmitDelegate<Func<DifficultyIndex, DifficultyIndex>>((Func<DifficultyIndex, DifficultyIndex>)((DifficultyIndex diffIndex) => (DifficultyIndex)4));
			}
			else
			{
				flag = val.TryGotoNext(new Func<Instruction, bool>[2]
				{
					(Instruction x) => ILPatternMatchingExt.MatchCall<Run>(x, "get_instance"),
					(Instruction x) => ILPatternMatchingExt.MatchCallvirt<Run>(x, "get_selectedDifficulty")
				});
				if (flag)
				{
					int index = val.Index;
					ILLabel val2 = default(ILLabel);
					flag = val.TryGotoNext(new Func<Instruction, bool>[2]
					{
						(Instruction x) => ILPatternMatchingExt.MatchLdcI4(x, 4),
						(Instruction x) => ILPatternMatchingExt.MatchBlt(x, ref val2)
					});
					if (flag)
					{
						int num = val.Index - index;
						if (num <= 8)
						{
							val.EmitDelegate<Func<DifficultyIndex, DifficultyIndex>>((Func<DifficultyIndex, DifficultyIndex>)((DifficultyIndex diffIndex) => (DifficultyIndex)4));
						}
						else
						{
							ZetArtifactsPlugin.LogWarn("EclipseHook(2) Failed! - LdcI4 Offset [" + num + "]");
						}
					}
				}
			}
			if (!flag)
			{
				ZetArtifactsPlugin.LogWarn("EclipseHook(2) Failed!");
			}
		}

		private static void Eclipse3Hook(ILContext il)
		{
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			//IL_0008: Expected O, but got Unknown
			ILCursor val = new ILCursor(il);
			bool flag = val.TryGotoNext(new Func<Instruction, bool>[3]
			{
				(Instruction x) => ILPatternMatchingExt.MatchCall<Run>(x, "get_instance"),
				(Instruction x) => ILPatternMatchingExt.MatchCallvirt<Run>(x, "get_selectedDifficulty"),
				(Instruction x) => ILPatternMatchingExt.MatchLdcI4(x, 5)
			});
			if (flag)
			{
				val.Index += 2;
				val.EmitDelegate<Func<DifficultyIndex, DifficultyIndex>>((Func<DifficultyIndex, DifficultyIndex>)((DifficultyIndex diffIndex) => (DifficultyIndex)5));
			}
			else
			{
				flag = val.TryGotoNext(new Func<Instruction, bool>[2]
				{
					(Instruction x) => ILPatternMatchingExt.MatchCall<Run>(x, "get_instance"),
					(Instruction x) => ILPatternMatchingExt.MatchCallvirt<Run>(x, "get_selectedDifficulty")
				});
				if (flag)
				{
					int index = val.Index;
					ILLabel val2 = default(ILLabel);
					flag = val.TryGotoNext(new Func<Instruction, bool>[2]
					{
						(Instruction x) => ILPatternMatchingExt.MatchLdcI4(x, 5),
						(Instruction x) => ILPatternMatchingExt.MatchBlt(x, ref val2)
					});
					if (flag)
					{
						int num = val.Index - index;
						if (num <= 8)
						{
							val.EmitDelegate<Func<DifficultyIndex, DifficultyIndex>>((Func<DifficultyIndex, DifficultyIndex>)((DifficultyIndex diffIndex) => (DifficultyIndex)5));
						}
						else
						{
							ZetArtifactsPlugin.LogWarn("EclipseHook(3) Failed! - LdcI4 Offset [" + num + "]");
						}
					}
				}
			}
			if (!flag)
			{
				ZetArtifactsPlugin.LogWarn("EclipseHook(3) Failed!");
			}
		}

		private static void Eclipse4Hook(ILContext il)
		{
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			//IL_0008: Expected O, but got Unknown
			ILCursor val = new ILCursor(il);
			bool flag = val.TryGotoNext(new Func<Instruction, bool>[3]
			{
				(Instruction x) => ILPatternMatchingExt.MatchCall<Run>(x, "get_instance"),
				(Instruction x) => ILPatternMatchingExt.MatchCallvirt<Run>(x, "get_selectedDifficulty"),
				(Instruction x) => ILPatternMatchingExt.MatchLdcI4(x, 6)
			});
			if (flag)
			{
				val.Index += 2;
				val.EmitDelegate<Func<DifficultyIndex, DifficultyIndex>>((Func<DifficultyIndex, DifficultyIndex>)((DifficultyIndex diffIndex) => (DifficultyIndex)6));
			}
			else
			{
				flag = val.TryGotoNext(new Func<Instruction, bool>[2]
				{
					(Instruction x) => ILPatternMatchingExt.MatchCall<Run>(x, "get_instance"),
					(Instruction x) => ILPatternMatchingExt.MatchCallvirt<Run>(x, "get_selectedDifficulty")
				});
				if (flag)
				{
					int index = val.Index;
					ILLabel val2 = default(ILLabel);
					flag = val.TryGotoNext(new Func<Instruction, bool>[2]
					{
						(Instruction x) => ILPatternMatchingExt.MatchLdcI4(x, 6),
						(Instruction x) => ILPatternMatchingExt.MatchBlt(x, ref val2)
					});
					if (flag)
					{
						int num = val.Index - index;
						if (num <= 8)
						{
							val.EmitDelegate<Func<DifficultyIndex, DifficultyIndex>>((Func<DifficultyIndex, DifficultyIndex>)((DifficultyIndex diffIndex) => (DifficultyIndex)6));
						}
						else
						{
							ZetArtifactsPlugin.LogWarn("EclipseHook(4) Failed! - LdcI4 Offset [" + num + "]");
						}
					}
				}
			}
			if (!flag)
			{
				ZetArtifactsPlugin.LogWarn("EclipseHook(4) Failed!");
			}
		}

		private static void Eclipse5Hook(ILContext il)
		{
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			//IL_0008: Expected O, but got Unknown
			ILCursor val = new ILCursor(il);
			bool flag = val.TryGotoNext(new Func<Instruction, bool>[3]
			{
				(Instruction x) => ILPatternMatchingExt.MatchCall<Run>(x, "get_instance"),
				(Instruction x) => ILPatternMatchingExt.MatchCallvirt<Run>(x, "get_selectedDifficulty"),
				(Instruction x) => ILPatternMatchingExt.MatchLdcI4(x, 7)
			});
			if (flag)
			{
				val.Index += 2;
				val.EmitDelegate<Func<DifficultyIndex, DifficultyIndex>>((Func<DifficultyIndex, DifficultyIndex>)((DifficultyIndex diffIndex) => (DifficultyIndex)7));
			}
			else
			{
				flag = val.TryGotoNext(new Func<Instruction, bool>[2]
				{
					(Instruct