Decompiled source of LunarRework v0.3.0

LunarRework.dll

Decompiled 2 weeks ago
using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.Reflection;
using System.Reflection.Emit;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security.Permissions;
using BepInEx;
using HarmonyLib;
using Microsoft.CodeAnalysis;
using RoR2;
using RoR2.EntityLogic;
using RoR2.Navigation;
using UnityEngine;
using UnityEngine.AddressableAssets;
using UnityEngine.Events;
using UnityEngine.Networking;
using UnityEngine.ResourceManagement.AsyncOperations;
using UnityEngine.SceneManagement;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("0.3.0.0")]
[module: RefSafetyRules(11)]
namespace Microsoft.CodeAnalysis
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	internal sealed class EmbeddedAttribute : Attribute
	{
	}
}
namespace System.Runtime.CompilerServices
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	[AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)]
	internal sealed class RefSafetyRulesAttribute : Attribute
	{
		public readonly int Version;

		public RefSafetyRulesAttribute(int P_0)
		{
			Version = P_0;
		}
	}
}
namespace Prototype
{
	[BepInPlugin("prototype.lunar.rework", "LunarRework", "0.3.0")]
	internal class LunarRework : BaseUnityPlugin
	{
		[CompilerGenerated]
		private sealed class <>c__DisplayClass8_0
		{
			public GameObject obj;
		}

		[CompilerGenerated]
		private sealed class <>c__DisplayClass9_0
		{
			public int count;

			public Action<List<SceneDef>, SceneDef> <>9__0;

			public Func<float, float> <>9__1;

			internal void <SetUpSeerStations>b__0(List<SceneDef> choices, SceneDef stage)
			{
				choices.Add(stage);
				if (choices.Count > 1)
				{
					choices.Remove(Run.instance?.nextStageScene);
				}
				count = choices.Count;
			}

			internal float <SetUpSeerStations>b__1(float roll)
			{
				if (count <= 1)
				{
					return roll * roll * roll;
				}
				return roll;
			}
		}

		[CompilerGenerated]
		private sealed class <ItemDrop>d__11 : IEnumerable<CodeInstruction>, IEnumerable, IEnumerator<CodeInstruction>, IEnumerator, IDisposable
		{
			private int <>1__state;

			private CodeInstruction <>2__current;

			private int <>l__initialThreadId;

			private IEnumerable<CodeInstruction> IL;

			public IEnumerable<CodeInstruction> <>3__IL;

			private IEnumerator<CodeInstruction> <>7__wrap1;

			private CodeInstruction <instruction>5__3;

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

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

			[DebuggerHidden]
			public <ItemDrop>d__11(int <>1__state)
			{
				this.<>1__state = <>1__state;
				<>l__initialThreadId = Environment.CurrentManagedThreadId;
			}

			[DebuggerHidden]
			void IDisposable.Dispose()
			{
				int num = <>1__state;
				if (num == -3 || (uint)(num - 1) <= 4u)
				{
					try
					{
					}
					finally
					{
						<>m__Finally1();
					}
				}
				<>7__wrap1 = null;
				<instruction>5__3 = null;
				<>1__state = -2;
			}

			private bool MoveNext()
			{
				//IL_00f0: Unknown result type (might be due to invalid IL or missing references)
				//IL_00fa: Expected O, but got Unknown
				//IL_00a7: Unknown result type (might be due to invalid IL or missing references)
				//IL_00b1: Expected O, but got Unknown
				try
				{
					switch (<>1__state)
					{
					default:
						return false;
					case 0:
						<>1__state = -1;
						<>7__wrap1 = IL.GetEnumerator();
						<>1__state = -3;
						break;
					case 1:
						<>1__state = -3;
						<>2__current = <instruction>5__3;
						<>1__state = 2;
						return true;
					case 2:
						<>1__state = -3;
						<>2__current = new CodeInstruction(OpCodes.Ldarg_0, (object)null);
						<>1__state = 3;
						return true;
					case 3:
						<>1__state = -3;
						<>2__current = CodeInstruction.Call(typeof(LunarRework), "ChangePickupDroplet", (Type[])null, (Type[])null);
						<>1__state = 4;
						return true;
					case 4:
						<>1__state = -3;
						goto IL_0160;
					case 5:
						{
							<>1__state = -3;
							goto IL_0160;
						}
						IL_0160:
						<instruction>5__3 = null;
						break;
					}
					if (<>7__wrap1.MoveNext())
					{
						<instruction>5__3 = <>7__wrap1.Current;
						if (<instruction>5__3.opcode == OpCodes.Initobj && typeof(CreatePickupInfo) == <instruction>5__3.operand as Type)
						{
							<>2__current = new CodeInstruction(OpCodes.Dup, (object)null);
							<>1__state = 1;
							return true;
						}
						<>2__current = <instruction>5__3;
						<>1__state = 5;
						return true;
					}
					<>m__Finally1();
					<>7__wrap1 = null;
					return false;
				}
				catch
				{
					//try-fault
					((IDisposable)this).Dispose();
					throw;
				}
			}

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

			private void <>m__Finally1()
			{
				<>1__state = -1;
				if (<>7__wrap1 != null)
				{
					<>7__wrap1.Dispose();
				}
			}

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

			[DebuggerHidden]
			IEnumerator<CodeInstruction> IEnumerable<CodeInstruction>.GetEnumerator()
			{
				<ItemDrop>d__11 <ItemDrop>d__;
				if (<>1__state == -2 && <>l__initialThreadId == Environment.CurrentManagedThreadId)
				{
					<>1__state = 0;
					<ItemDrop>d__ = this;
				}
				else
				{
					<ItemDrop>d__ = new <ItemDrop>d__11(0);
				}
				<ItemDrop>d__.IL = <>3__IL;
				return <ItemDrop>d__;
			}

			[DebuggerHidden]
			IEnumerator IEnumerable.GetEnumerator()
			{
				return ((IEnumerable<CodeInstruction>)this).GetEnumerator();
			}
		}

		[CompilerGenerated]
		private sealed class <RepeatHeal>d__13 : IEnumerable<CodeInstruction>, IEnumerable, IEnumerator<CodeInstruction>, IEnumerator, IDisposable
		{
			private int <>1__state;

			private CodeInstruction <>2__current;

			private int <>l__initialThreadId;

			private IEnumerable<CodeInstruction> IL;

			public IEnumerable<CodeInstruction> <>3__IL;

			private MethodInfo <method>5__2;

			private IEnumerator<CodeInstruction> <>7__wrap2;

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

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

			[DebuggerHidden]
			public <RepeatHeal>d__13(int <>1__state)
			{
				this.<>1__state = <>1__state;
				<>l__initialThreadId = Environment.CurrentManagedThreadId;
			}

			[DebuggerHidden]
			void IDisposable.Dispose()
			{
				int num = <>1__state;
				if (num == -3 || (uint)(num - 1) <= 3u)
				{
					try
					{
					}
					finally
					{
						<>m__Finally1();
					}
				}
				<method>5__2 = null;
				<>7__wrap2 = null;
				<>1__state = -2;
			}

			private bool MoveNext()
			{
				//IL_00ef: Unknown result type (might be due to invalid IL or missing references)
				//IL_00f9: Expected O, but got Unknown
				//IL_008b: Unknown result type (might be due to invalid IL or missing references)
				//IL_0095: Expected O, but got Unknown
				try
				{
					switch (<>1__state)
					{
					default:
						return false;
					case 0:
						<>1__state = -1;
						<method>5__2 = typeof(HealthComponent).GetMethod("Heal");
						<>7__wrap2 = IL.GetEnumerator();
						<>1__state = -3;
						break;
					case 1:
						<>1__state = -3;
						<>2__current = Transpilers.EmitDelegate<Action<HealthComponent, float, ProcChainMask>>((Action<HealthComponent, float, ProcChainMask>)delegate(HealthComponent health, float amount, ProcChainMask flag)
						{
							//IL_000b: Unknown result type (might be due to invalid IL or missing references)
							//IL_0011: Invalid comparison between Unknown and I4
							//IL_002b: 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_001e: Invalid comparison between Unknown and I4
							if ((int)health.body.teamComponent.teamIndex == 1 && (int)Run.instance.selectedDifficulty >= 7)
							{
								amount /= 0.5f;
							}
							health.Heal(amount, flag, true);
						});
						<>1__state = 2;
						return true;
					case 2:
						<>1__state = -3;
						<>2__current = new CodeInstruction(OpCodes.Ldc_I4_0, (object)null);
						<>1__state = 3;
						return true;
					case 3:
						<>1__state = -3;
						break;
					case 4:
						<>1__state = -3;
						break;
					}
					if (<>7__wrap2.MoveNext())
					{
						CodeInstruction current = <>7__wrap2.Current;
						if (CodeInstructionExtensions.Calls(current, <method>5__2))
						{
							<>2__current = new CodeInstruction(OpCodes.Pop, (object)null);
							<>1__state = 1;
							return true;
						}
						<>2__current = current;
						<>1__state = 4;
						return true;
					}
					<>m__Finally1();
					<>7__wrap2 = null;
					return false;
				}
				catch
				{
					//try-fault
					((IDisposable)this).Dispose();
					throw;
				}
			}

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

			private void <>m__Finally1()
			{
				<>1__state = -1;
				if (<>7__wrap2 != null)
				{
					<>7__wrap2.Dispose();
				}
			}

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

			[DebuggerHidden]
			IEnumerator<CodeInstruction> IEnumerable<CodeInstruction>.GetEnumerator()
			{
				<RepeatHeal>d__13 <RepeatHeal>d__;
				if (<>1__state == -2 && <>l__initialThreadId == Environment.CurrentManagedThreadId)
				{
					<>1__state = 0;
					<RepeatHeal>d__ = this;
				}
				else
				{
					<RepeatHeal>d__ = new <RepeatHeal>d__13(0);
				}
				<RepeatHeal>d__.IL = <>3__IL;
				return <RepeatHeal>d__;
			}

			[DebuggerHidden]
			IEnumerator IEnumerable.GetEnumerator()
			{
				return ((IEnumerable<CodeInstruction>)this).GetEnumerator();
			}
		}

		[CompilerGenerated]
		private sealed class <SetUpSeerStations>d__9 : IEnumerable<CodeInstruction>, IEnumerable, IEnumerator<CodeInstruction>, IEnumerator, IDisposable
		{
			private int <>1__state;

			private CodeInstruction <>2__current;

			private int <>l__initialThreadId;

			private IEnumerable<CodeInstruction> IL;

			public IEnumerable<CodeInstruction> <>3__IL;

			private <>c__DisplayClass9_0 <>8__1;

			private MethodInfo <method>5__2;

			private MethodInfo <property>5__3;

			private IEnumerator<CodeInstruction> <>7__wrap3;

			private CodeInstruction <instruction>5__5;

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

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

			[DebuggerHidden]
			public <SetUpSeerStations>d__9(int <>1__state)
			{
				this.<>1__state = <>1__state;
				<>l__initialThreadId = Environment.CurrentManagedThreadId;
			}

			[DebuggerHidden]
			void IDisposable.Dispose()
			{
				int num = <>1__state;
				if (num == -3 || (uint)(num - 1) <= 2u)
				{
					try
					{
					}
					finally
					{
						<>m__Finally1();
					}
				}
				<>8__1 = null;
				<method>5__2 = null;
				<property>5__3 = null;
				<>7__wrap3 = null;
				<instruction>5__5 = null;
				<>1__state = -2;
			}

			private bool MoveNext()
			{
				try
				{
					switch (<>1__state)
					{
					default:
						return false;
					case 0:
						<>1__state = -1;
						<>8__1 = new <>c__DisplayClass9_0();
						<method>5__2 = typeof(List<SceneDef>).GetMethod("Add");
						<property>5__3 = typeof(Xoroshiro128Plus).GetProperty("nextNormalizedFloat").GetMethod;
						<>8__1.count = 0;
						<>7__wrap3 = IL.GetEnumerator();
						<>1__state = -3;
						break;
					case 1:
						<>1__state = -3;
						goto IL_0192;
					case 2:
						<>1__state = -3;
						if (CodeInstructionExtensions.Calls(<instruction>5__5, <property>5__3))
						{
							<>2__current = Transpilers.EmitDelegate<Func<float, float>>((Func<float, float>)((float roll) => (<>8__1.count <= 1) ? (roll * roll * roll) : roll));
							<>1__state = 3;
							return true;
						}
						goto IL_0192;
					case 3:
						{
							<>1__state = -3;
							goto IL_0192;
						}
						IL_0192:
						<instruction>5__5 = null;
						break;
					}
					if (<>7__wrap3.MoveNext())
					{
						<instruction>5__5 = <>7__wrap3.Current;
						if (CodeInstructionExtensions.Calls(<instruction>5__5, <method>5__2))
						{
							<>2__current = Transpilers.EmitDelegate<Action<List<SceneDef>, SceneDef>>((Action<List<SceneDef>, SceneDef>)delegate(List<SceneDef> choices, SceneDef stage)
							{
								choices.Add(stage);
								if (choices.Count > 1)
								{
									choices.Remove(Run.instance?.nextStageScene);
								}
								<>8__1.count = choices.Count;
							});
							<>1__state = 1;
							return true;
						}
						<>2__current = <instruction>5__5;
						<>1__state = 2;
						return true;
					}
					<>m__Finally1();
					<>7__wrap3 = null;
					return false;
				}
				catch
				{
					//try-fault
					((IDisposable)this).Dispose();
					throw;
				}
			}

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

			private void <>m__Finally1()
			{
				<>1__state = -1;
				if (<>7__wrap3 != null)
				{
					<>7__wrap3.Dispose();
				}
			}

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

			[DebuggerHidden]
			IEnumerator<CodeInstruction> IEnumerable<CodeInstruction>.GetEnumerator()
			{
				<SetUpSeerStations>d__9 <SetUpSeerStations>d__;
				if (<>1__state == -2 && <>l__initialThreadId == Environment.CurrentManagedThreadId)
				{
					<>1__state = 0;
					<SetUpSeerStations>d__ = this;
				}
				else
				{
					<SetUpSeerStations>d__ = new <SetUpSeerStations>d__9(0);
				}
				<SetUpSeerStations>d__.IL = <>3__IL;
				return <SetUpSeerStations>d__;
			}

			[DebuggerHidden]
			IEnumerator IEnumerable.GetEnumerator()
			{
				return ((IEnumerable<CodeInstruction>)this).GetEnumerator();
			}
		}

		public const string version = "0.3.0";

		public const string identifier = "prototype.lunar.rework";

		private static AsyncOperationHandle<GameObject> shop;

		private static AsyncOperationHandle<GameObject> pickup;

		private static AsyncOperationHandle<GameObject> model;

		protected void Awake()
		{
			//IL_0005: Unknown result type (might be due to invalid IL or missing references)
			//IL_000a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0036: Unknown result type (might be due to invalid IL or missing references)
			//IL_003b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0045: 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_0054: Unknown result type (might be due to invalid IL or missing references)
			//IL_0059: Unknown result type (might be due to invalid IL or missing references)
			AsyncOperationHandle<GameObject> val = load("RoR2/Base/LunarChest/LunarChest.prefab");
			val.Completed += delegate(AsyncOperationHandle<GameObject> operation)
			{
				PurchaseInteraction component = operation.Result.GetComponent<PurchaseInteraction>();
				component.cost++;
			};
			shop = load("RoR2/Base/LunarCauldrons/LunarCauldron, RedToWhite Variant.prefab");
			pickup = load("RoR2/DLC1/OptionPickup/OptionPickup.prefab");
			model = load("RoR2/Base/moon/LunarPod, Opened.prefab");
			SceneDirector.onGenerateInteractableCardSelection += OnGenerateInteractableCardSelection;
			Stage.onStageStartGlobal += OnStageStartGlobal;
			Harmony.CreateAndPatchAll(((object)this).GetType(), (string)null);
			static AsyncOperationHandle<GameObject> load(string key)
			{
				//IL_0001: Unknown result type (might be due to invalid IL or missing references)
				return Addressables.LoadAssetAsync<GameObject>((object)key);
			}
		}

		private void OnGenerateInteractableCardSelection(object _, DirectorCardCategorySelection selection)
		{
			//IL_0010: Unknown result type (might be due to invalid IL or missing references)
			//IL_007e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0088: Unknown result type (might be due to invalid IL or missing references)
			//IL_0089: Unknown result type (might be due to invalid IL or missing references)
			Category[] categories = selection.categories;
			for (int i = 0; i < categories.Length; i++)
			{
				DirectorCard[] cards = categories[i].cards;
				for (int j = 0; j < cards.Length; j++)
				{
					ref SpawnCard spawnCard = ref cards[j].spawnCard;
					SpawnCard obj = spawnCard;
					if (((obj != null) ? ((Object)obj).name : null) == "iscLunarChest")
					{
						spawnCard = Object.Instantiate<SpawnCard>(spawnCard);
						SpawnCard obj2 = spawnCard;
						((InteractableSpawnCard)((obj2 is InteractableSpawnCard) ? obj2 : null)).maxSpawnsPerStage = 1;
						SceneDef currentSceneDef = SceneCatalog.currentSceneDef;
						if (((currentSceneDef != null) ? currentSceneDef.cachedName : null) == "ancientloft")
						{
							SpawnCard obj3 = spawnCard;
							obj3.requiredFlags = (NodeFlags)(obj3.requiredFlags & 0xFE);
						}
					}
				}
			}
		}

		private static void OnStageStartGlobal(Stage __instance)
		{
			//IL_0151: Unknown result type (might be due to invalid IL or missing references)
			//IL_0156: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f1: Unknown result type (might be due to invalid IL or missing references)
			//IL_0105: Unknown result type (might be due to invalid IL or missing references)
			string[] delete = new string[1] { "LunarChest" };
			string replace = "mdlLunarChest";
			SceneDef sceneDef = __instance.sceneDef;
			if (Object.op_Implicit((Object)(object)sceneDef))
			{
				switch (sceneDef.stageOrder)
				{
				case 1:
				case 2:
				case 3:
					return;
				case 4:
				case 5:
				{
					if (RoR2Application.isInMultiPlayer)
					{
						return;
					}
					string[] array = delete;
					int num = 0;
					string[] array2 = new string[1 + array.Length];
					ReadOnlySpan<string> readOnlySpan = new ReadOnlySpan<string>(array);
					readOnlySpan.CopyTo(new Span<string>(array2).Slice(num, readOnlySpan.Length));
					num += readOnlySpan.Length;
					array2[num] = replace;
					delete = array2;
					replace = null;
					break;
				}
				default:
					if (sceneDef.cachedName == "bazaar")
					{
						if (NetworkServer.active)
						{
							NetworkServer.Spawn(Object.Instantiate<GameObject>(shop.WaitForCompletion(), new Vector3(-123f, -23.67f, -6f), Quaternion.Euler(0f, 90f, 0f)));
						}
						delete = new string[6] { "LunarTable", "LunarRecycler", "DisplayLunarChest", "Bazaar_LunarTable", "Bazaar_LunarChest", "LunarShopTerminal" };
					}
					break;
				}
			}
			Scene activeScene = SceneManager.GetActiveScene();
			GameObject[] rootGameObjects = ((Scene)(ref activeScene)).GetRootGameObjects();
			for (int i = 0; i < rootGameObjects.Length; i++)
			{
				disable(rootGameObjects[i].transform);
			}
			void disable(Transform transform)
			{
				//IL_005b: Unknown result type (might be due to invalid IL or missing references)
				//IL_0061: Unknown result type (might be due to invalid IL or missing references)
				//IL_007e: Unknown result type (might be due to invalid IL or missing references)
				//IL_0089: Expected O, but got Unknown
				GameObject gameObject = ((Component)transform).gameObject;
				string[] array3 = delete;
				foreach (string value in array3)
				{
					if (((Object)gameObject).name.StartsWith(value))
					{
						gameObject.SetActive(false);
						return;
					}
				}
				if (((Object)gameObject).name == replace)
				{
					gameObject.SetActive(false);
					Object.Instantiate<GameObject>(model.WaitForCompletion(), transform.position, transform.rotation);
					return;
				}
				foreach (Transform item in transform)
				{
					disable(item);
				}
			}
		}

		[HarmonyPatch(typeof(BazaarController), "OnStartServer")]
		[HarmonyPrefix]
		private static void OnStartServer(BazaarController __instance)
		{
			<>c__DisplayClass8_0 CS$<>8__locals0 = new <>c__DisplayClass8_0();
			int num = __instance.seerStations.Length - 1;
			CS$<>8__locals0.obj = ((Component)__instance.seerStations[num]).gameObject;
			((MonoBehaviour)__instance).StartCoroutine(delay());
			[IteratorStateMachine(typeof(<>c__DisplayClass8_0.<<OnStartServer>g__delay|0>d))]
			IEnumerator delay()
			{
				//yield-return decompiler failed: Unexpected instruction in Iterator.Dispose()
				return new <>c__DisplayClass8_0.<<OnStartServer>g__delay|0>d(0)
				{
					<>4__this = CS$<>8__locals0
				};
			}
		}

		[IteratorStateMachine(typeof(<SetUpSeerStations>d__9))]
		[HarmonyPatch(typeof(BazaarController), "SetUpSeerStations")]
		[HarmonyTranspiler]
		private static IEnumerable<CodeInstruction> SetUpSeerStations(IEnumerable<CodeInstruction> IL)
		{
			//yield-return decompiler failed: Unexpected instruction in Iterator.Dispose()
			return new <SetUpSeerStations>d__9(-2)
			{
				<>3__IL = IL
			};
		}

		[HarmonyPatch(typeof(PurchaseInteraction), "Awake")]
		[HarmonyPostfix]
		private static void Awake(PurchaseInteraction __instance)
		{
			if (((Object)__instance).name.StartsWith(((Object)shop.WaitForCompletion()).name))
			{
				((UnityEventBase)((Component)__instance).GetComponent<DelayedEvent>().action).SetPersistentListenerState(0, (UnityEventCallState)0);
			}
		}

		[IteratorStateMachine(typeof(<ItemDrop>d__11))]
		[HarmonyPatch(typeof(ChestBehavior), "BaseItemDrop")]
		[HarmonyTranspiler]
		private static IEnumerable<CodeInstruction> ItemDrop(IEnumerable<CodeInstruction> IL)
		{
			//yield-return decompiler failed: Unexpected instruction in Iterator.Dispose()
			return new <ItemDrop>d__11(-2)
			{
				<>3__IL = IL
			};
		}

		private static void ChangePickupDroplet(ref CreatePickupInfo info, ChestBehavior chest)
		{
			//IL_0031: Unknown result type (might be due to invalid IL or missing references)
			//IL_0036: Unknown result type (might be due to invalid IL or missing references)
			//IL_003b: Unknown result type (might be due to invalid IL or missing references)
			//IL_003f: 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_004d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0052: Unknown result type (might be due to invalid IL or missing references)
			//IL_005f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0064: Unknown result type (might be due to invalid IL or missing references)
			//IL_0069: Unknown result type (might be due to invalid IL or missing references)
			//IL_006a: Unknown result type (might be due to invalid IL or missing references)
			//IL_006b: Unknown result type (might be due to invalid IL or missing references)
			//IL_008c: Unknown result type (might be due to invalid IL or missing references)
			//IL_008d: 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_0099: Unknown result type (might be due to invalid IL or missing references)
			//IL_009a: Unknown result type (might be due to invalid IL or missing references)
			//IL_009f: Unknown result type (might be due to invalid IL or missing references)
			PickupDropTable dropTable = chest.dropTable;
			if (Object.op_Implicit((Object)(object)dropTable) && ((Object)chest).name.StartsWith("LunarChest") && dropTable.GetPickupCount() > 1)
			{
				PickupIndex pickupIndex = chest.currentPickup.pickupIndex;
				chest.currentPickup = new UniquePickup
				{
					pickupIndex = PickupCatalog.FindPickupIndex((ItemTier)3)
				};
				PickupIndex pickupIndex2;
				do
				{
					pickupIndex2 = dropTable.GeneratePickup(chest.rng).pickupIndex;
				}
				while (pickupIndex == pickupIndex2);
				info.prefabOverride = pickup.WaitForCompletion();
				info.pickerOptions = PickupPickerController.GenerateOptionsFromList<UniquePickup[]>((UniquePickup[])(object)new UniquePickup[2]
				{
					new UniquePickup(pickupIndex),
					new UniquePickup(pickupIndex2)
				});
			}
		}

		[IteratorStateMachine(typeof(<RepeatHeal>d__13))]
		[HarmonyPatch(typeof(RepeatHealComponent), "FixedUpdate")]
		[HarmonyTranspiler]
		private static IEnumerable<CodeInstruction> RepeatHeal(IEnumerable<CodeInstruction> IL)
		{
			//yield-return decompiler failed: Unexpected instruction in Iterator.Dispose()
			return new <RepeatHeal>d__13(-2)
			{
				<>3__IL = IL
			};
		}

		[HarmonyPatch(typeof(EclipseRun), "OverrideRuleChoices")]
		[HarmonyPostfix]
		private static void OverrideRuleChoices(EclipseRun __instance, RuleChoiceMask mustInclude, RuleChoiceMask mustExclude)
		{
			((Run)__instance).ForceChoice(mustInclude, mustExclude, "Items." + ((Object)Items.ShieldOnly).name + ".Off");
		}
	}
}