Decompiled source of Public Gauntlet v2.0.0

RoRGauntlet.dll

Decompiled 3 months ago
using System;
using System.Collections;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Net;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using System.Text;
using BepInEx;
using BepInEx.Bootstrap;
using BepInEx.Configuration;
using BepInEx.Logging;
using EntityStates.LunarTeleporter;
using HG;
using HG.Reflection;
using IL.EntityStates.Treebot.Weapon;
using IL.RoR2;
using Microsoft.CodeAnalysis;
using Mono.Cecil;
using Mono.Cecil.Cil;
using MonoMod.Cil;
using On.EntityStates.LunarTeleporter;
using On.RoR2;
using On.RoR2.Artifacts;
using On.RoR2.Items;
using On.RoR2.UI;
using On.RoR2.UI.MainMenu;
using ProperSave;
using ProperSave.Data;
using R2API;
using R2API.Utils;
using RoR2;
using RoR2.Artifacts;
using RoR2.Audio;
using RoR2.Items;
using RoR2.Skills;
using RoR2.Stats;
using RoR2.UI;
using RoR2.UI.MainMenu;
using TMPro;
using UnityEngine;
using UnityEngine.AddressableAssets;
using UnityEngine.Events;
using UnityEngine.Networking;
using UnityEngine.ResourceManagement.AsyncOperations;
using UnityEngine.UI;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: OptIn]
[assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")]
[assembly: AssemblyCompany("RoRGauntlet")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0+d7d7f87adf5ca022f460dfb592817f597bfb855c")]
[assembly: AssemblyProduct("RoRGauntlet")]
[assembly: AssemblyTitle("RoRGauntlet")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.0.0")]
[module: UnverifiableCode]
[module: RefSafetyRules(11)]
namespace Microsoft.CodeAnalysis
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	internal sealed class EmbeddedAttribute : Attribute
	{
	}
}
namespace System.Runtime.CompilerServices
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	[AttributeUsage(AttributeTargets.Class | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Parameter | AttributeTargets.ReturnValue | AttributeTargets.GenericParameter, AllowMultiple = false, Inherited = false)]
	internal sealed class NullableAttribute : Attribute
	{
		public readonly byte[] NullableFlags;

		public NullableAttribute(byte P_0)
		{
			NullableFlags = new byte[1] { P_0 };
		}

		public NullableAttribute(byte[] P_0)
		{
			NullableFlags = P_0;
		}
	}
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	[AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Method | AttributeTargets.Interface | AttributeTargets.Delegate, AllowMultiple = false, Inherited = false)]
	internal sealed class NullableContextAttribute : Attribute
	{
		public readonly byte Flag;

		public NullableContextAttribute(byte P_0)
		{
			Flag = P_0;
		}
	}
	[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 RoRGauntlet
{
	internal static class Assets
	{
		public static AssetBundle MainAssetBundle = null;

		public static GameObject lazarusResurrectionEffect;

		public static List<Material> swappedMaterials = new List<Material>();

		public static void Initialize()
		{
			PopulateBundles();
			PopulateAssets();
		}

		private static void PopulateBundles()
		{
			if ((Object)(object)MainAssetBundle == (Object)null)
			{
				MainAssetBundle = AssetBundle.LoadFromFile(Files.GetPathToFile("riskofresourcesassets"));
			}
		}

		private static void PopulateAssets()
		{
			lazarusResurrectionEffect = MainAssetBundle.LoadAsset<GameObject>("LazarusWingsRez");
			if (!ContentAddition.AddEffect(lazarusResurrectionEffect))
			{
				Log.LogError("lazarusResurrectionEffect is not valid.");
				return;
			}
			Material[] array = (from mat in MainAssetBundle.LoadAllAssets<Material>()
				where ((Object)mat.shader).name.StartsWith("Stubbed")
				select mat).ToArray();
			foreach (Material val in array)
			{
				if (!((Object)val.shader).name.StartsWith("Stubbed"))
				{
					Log.LogWarning($"The material {val} is invalid.");
					continue;
				}
				try
				{
					SwapShader(val);
				}
				catch (Exception arg)
				{
					Log.LogError($"Failed to swap shader of material {val}: {arg}");
				}
			}
		}

		private static void SwapShader(Material material)
		{
			//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_0055: Unknown result type (might be due to invalid IL or missing references)
			//IL_005a: Unknown result type (might be due to invalid IL or missing references)
			Shader shader = Addressables.LoadAssetAsync<Shader>((object)(((Object)material.shader).name.Substring("Stubbed".Length) + ".shader")).WaitForCompletion();
			material.shader = shader;
			if (((Object)material.shader).name.Contains("Cloud Remap"))
			{
				Material val = Addressables.LoadAssetAsync<Material>((object)"RoR2/Base/Common/VFX/matLightningLongBlue.mat").WaitForCompletion();
				RuntimeCloudMaterialMapper runtimeCloudMaterialMapper = new RuntimeCloudMaterialMapper(material);
				material.CopyPropertiesFromMaterial(val);
				runtimeCloudMaterialMapper.SetMaterialValues(ref material);
			}
			swappedMaterials.Add(material);
		}
	}
	public class BadStringToSeed
	{
		public static ulong Convert(string msg)
		{
			ulong num = 0uL;
			List<string> list = new List<string>();
			string text = "";
			for (int i = 0; i < msg.Length; i++)
			{
				text += msg[i];
				if (text.Length == 4)
				{
					list.Add(text);
					text = "";
				}
			}
			if (text.Length > 0)
			{
				list.Add(text);
			}
			foreach (string item in list)
			{
				for (int j = 0; j < item.Length; j++)
				{
					num += (ulong)(((long)item[j] - 48L) * (long)(ulong)Mathf.Pow(10f, (float)(j * 2)));
				}
			}
			return num;
		}
	}
	internal class BugFix
	{
		internal BugFix()
		{
			//IL_000d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0017: Expected O, but got Unknown
			FireSonicBoom.OnEnter += new Manipulator(FixRexCrash);
		}

		private void FixRexCrash(ILContext context)
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_0007: Expected O, but got Unknown
			//IL_0037: Unknown result type (might be due to invalid IL or missing references)
			ILCursor val = new ILCursor(context);
			val.GotoNext(new Func<Instruction, bool>[1]
			{
				(Instruction code) => ILPatternMatchingExt.MatchCallvirt(code, (MethodBase)typeof(CharacterBody).GetProperty("acceleration").GetMethod)
			});
			val.Emit(OpCodes.Dup);
			int index = val.Index + 1;
			val.Index = index;
			val.EmitDelegate<Func<CharacterBody, float, float>>((Func<CharacterBody, float, float>)delegate(CharacterBody target, float acceleration)
			{
				if (float.IsNaN(acceleration) && Object.op_Implicit((Object)(object)((Component)target).GetComponent<Rigidbody>()))
				{
					Object.Destroy((Object)(object)((Component)target).gameObject);
					return 1f;
				}
				return acceleration;
			});
		}
	}
	public class ConcedeRun
	{
		public class Body
		{
			public bool Concede { get; set; }

			public double Time { get; set; }
		}

		public static void ConcedeGame(PauseScreenController pauseScreen, bool concedable)
		{
			//IL_00b5: 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_00e0: 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_006f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0084: Expected O, but got Unknown
			if (concedable)
			{
				if (SimpleDialogBox.instancesList.Count <= 0)
				{
					SimpleDialogBox obj = SimpleDialogBox.Create((MPEventSystem)null);
					obj.headerToken = new TokenParamsPair("Are you sure?", Array.Empty<object>());
					string text = "Are you sure you want to concede this run?";
					if (pauseScreen == null)
					{
						text += " Use info screen button (usually tab/select) to move cursor.";
					}
					obj.descriptionToken = new TokenParamsPair(text, Array.Empty<object>());
					obj.AddActionButton((UnityAction)delegate
					{
						ActuallyConcedeGame(pauseScreen);
					}, "Yes", true, Array.Empty<object>());
					obj.AddCancelButton("Cancel", Array.Empty<object>());
				}
			}
			else if (SimpleDialogBox.instancesList.Count <= 0)
			{
				SimpleDialogBox obj2 = SimpleDialogBox.Create((MPEventSystem)null);
				obj2.headerToken = new TokenParamsPair("No times submitted", Array.Empty<object>());
				string text2 = "You cannot concede as nobody has submitted a time yet";
				if (pauseScreen == null)
				{
					text2 += " Use info screen button (usually tab/select) to move cursor.";
				}
				obj2.descriptionToken = new TokenParamsPair(text2, Array.Empty<object>());
				obj2.AddCancelButton("Cancel", Array.Empty<object>());
			}
		}

		private static void ActuallyConcedeGame(PauseScreenController pauseScreen)
		{
			//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)
			if (pauseScreen != null)
			{
				Reflection.InvokeMethod((object)pauseScreen, "OnDisable");
				Object.Destroy((Object)(object)((Component)pauseScreen).gameObject);
			}
			if (Run.instance != null && ((Component)Run.instance).gameObject != null)
			{
				Main.ConcedeCheck = true;
				GameEndingDef val = ScriptableObject.CreateInstance<GameEndingDef>();
				val.isWin = false;
				val.showCredits = false;
				val.lunarCoinReward = 0u;
				RunReport.Generate(Run.instance, val);
				Run.CCRunEnd(default(ConCommandArgs));
				Main.ConcedeCheck = false;
			}
		}

		public static void ConcedeAPI(PauseScreenController pauseScreen)
		{
			ConcedeGame(pauseScreen, concedable: true);
		}
	}
	public class ConcedeUI
	{
		public static bool speedrunMode = true;

		public ConcedeUI()
		{
			Awake();
			speedrunMode = Main.SpeedrunMode.Value;
		}

		public static void Awake()
		{
			//IL_0011: 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_0025: 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_0039: 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)
			//IL_00a7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00cf: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ec: Unknown result type (might be due to invalid IL or missing references)
			//IL_0102: Unknown result type (might be due to invalid IL or missing references)
			//IL_010c: Expected O, but got Unknown
			//IL_0113: Unknown result type (might be due to invalid IL or missing references)
			//IL_011d: Expected O, but got Unknown
			//IL_0123: Unknown result type (might be due to invalid IL or missing references)
			//IL_012d: Expected O, but got Unknown
			bool IsInChatBox = false;
			Texture2D val = Addressables.LoadAssetAsync<Texture2D>((object)"RoR2/Base/UI/texUICleanButton.png").WaitForCompletion();
			Texture2D val2 = Addressables.LoadAssetAsync<Texture2D>((object)"RoR2/Base/UI/texUIOutlineOnly.png").WaitForCompletion();
			Texture2D val3 = Addressables.LoadAssetAsync<Texture2D>((object)"RoR2/Base/UI/texUIHighlightBoxOutlineThick.png").WaitForCompletion();
			Rect val4 = default(Rect);
			((Rect)(ref val4))..ctor(0f, 0f, (float)((Texture)val).width, (float)((Texture)val).height);
			Rect val5 = default(Rect);
			((Rect)(ref val5))..ctor(0f, 0f, (float)((Texture)val2).width, (float)((Texture)val2).height);
			Rect val6 = default(Rect);
			((Rect)(ref val6))..ctor(0f, 0f, (float)((Texture)val3).width, (float)((Texture)val3).height);
			Sprite buttonSprite = Sprite.Create(val, val4, new Vector2(0f, 0f));
			Sprite buttonBorderSprite = Sprite.Create(val2, val5, new Vector2(0f, 0f));
			Sprite buttonOutlineSprite = Sprite.Create(val3, val6, new Vector2(0f, 0f));
			ChatBox.FocusInputField += (hook_FocusInputField)delegate(orig_FocusInputField orig, ChatBox self)
			{
				orig.Invoke(self);
				IsInChatBox = true;
			};
			ChatBox.UnfocusInputField += (hook_UnfocusInputField)delegate(orig_UnfocusInputField orig, ChatBox self)
			{
				orig.Invoke(self);
				IsInChatBox = false;
			};
			PauseScreenController.Awake += (hook_Awake)delegate(orig_Awake orig, PauseScreenController self)
			{
				//IL_0293: Unknown result type (might be due to invalid IL or missing references)
				//IL_029d: Expected O, but got Unknown
				//IL_0049: Unknown result type (might be due to invalid IL or missing references)
				//IL_004e: Unknown result type (might be due to invalid IL or missing references)
				//IL_0097: Unknown result type (might be due to invalid IL or missing references)
				//IL_00bb: Unknown result type (might be due to invalid IL or missing references)
				//IL_00ca: Unknown result type (might be due to invalid IL or missing references)
				//IL_00d9: Unknown result type (might be due to invalid IL or missing references)
				//IL_00e8: Unknown result type (might be due to invalid IL or missing references)
				//IL_010f: Unknown result type (might be due to invalid IL or missing references)
				//IL_011e: Unknown result type (might be due to invalid IL or missing references)
				//IL_0131: Unknown result type (might be due to invalid IL or missing references)
				//IL_0144: Unknown result type (might be due to invalid IL or missing references)
				//IL_017f: Unknown result type (might be due to invalid IL or missing references)
				//IL_019e: Unknown result type (might be due to invalid IL or missing references)
				//IL_01b1: Unknown result type (might be due to invalid IL or missing references)
				orig.Invoke(self);
				if (Run.instance != null && !Object.op_Implicit((Object)(object)PreGameController.instance))
				{
					Rect rect = ((Component)((Transform)self.mainPanel).GetChild(0).GetChild(0)).GetComponent<RectTransform>().rect;
					float num = Math.Max((float)Screen.width / 1920f, (float)Screen.height / 1080f);
					Vector2 size = default(Vector2);
					((Vector2)(ref size))..ctor(((Rect)(ref rect)).width * num, ((Rect)(ref rect)).height * num);
					GameObject val7 = CreateButton(((Transform)self.mainPanel).GetChild(0), size, buttonSprite);
					SpawnImage(val7, new Color(1f, 1f, 1f, 0.286f), new Vector2(0.5f, 0.5f), new Vector2(0f, 0f), new Vector2(0f, 0f), buttonBorderSprite);
					Image imageOnHover = SpawnImage(val7, new Color(1f, 1f, 1f, 1f), new Vector2(0.5f, 0.5f), new Vector2(-4f * num, -12f * num), new Vector2(14f * num, 4f * num), buttonOutlineSprite);
					val7.GetComponent<HGButton>().imageOnHover = imageOnHover;
					CreateText(new List<TextMeshProUGUI>(), val7, new Color(1f, 1f, 1f, 1f), 24f * num, 0f, new Vector2(12f * num, 4f * num), new Vector2(-12f * num, -4f * num), speedrunMode ? "Quick Reset" : "Concede Run");
					if ("top".Equals(Main.ConcedeButtonPosition.Value, StringComparison.InvariantCultureIgnoreCase))
					{
						val7.transform.SetAsFirstSibling();
					}
					else if ("bottom".Equals(Main.ConcedeButtonPosition.Value, StringComparison.InvariantCultureIgnoreCase))
					{
						val7.transform.SetAsLastSibling();
					}
					else
					{
						try
						{
							int num2 = Convert.ToInt32(Main.ConcedeButtonPosition.Value);
							if (num2 < 0)
							{
								num2 = 0;
							}
							else if (num2 >= val7.transform.parent.childCount)
							{
								num2 = val7.transform.parent.childCount - 1;
							}
							val7.transform.SetSiblingIndex(num2);
						}
						catch (FormatException)
						{
							val7.transform.SetAsLastSibling();
						}
					}
					((UnityEvent)((Button)val7.GetComponent<HGButton>()).onClick).AddListener((UnityAction)delegate
					{
						if (speedrunMode)
						{
							Reflection.InvokeMethod((object)self, "OnDisable");
							Object.Destroy((Object)(object)((Component)self).gameObject);
							SpeedrunVerification.QuickReset();
						}
						else
						{
							ConcedeRun.ConcedeAPI(self);
						}
					});
				}
			};
		}

		public static Image SpawnImage(GameObject parent, Color color, Vector2 pivot, Vector2 offsetMin, Vector2 offsetMax, Sprite sprite)
		{
			//IL_0000: Unknown result type (might be due to invalid IL or missing references)
			//IL_0005: Unknown result type (might be due to invalid IL or missing references)
			//IL_0010: 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_0028: Unknown result type (might be due to invalid IL or missing references)
			//IL_0039: Unknown result type (might be due to invalid IL or missing references)
			//IL_004e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0059: Unknown result type (might be due to invalid IL or missing references)
			//IL_0060: Unknown result type (might be due to invalid IL or missing references)
			//IL_0076: Unknown result type (might be due to invalid IL or missing references)
			//IL_0086: Unknown result type (might be due to invalid IL or missing references)
			GameObject val = new GameObject
			{
				name = "Image"
			};
			val.transform.parent = parent.transform;
			RectTransform obj = val.AddComponent<RectTransform>();
			obj.pivot = pivot;
			obj.anchorMin = new Vector2(0f, 0f);
			obj.anchorMax = new Vector2(1f, 1f);
			obj.offsetMin = offsetMin;
			obj.offsetMax = offsetMax;
			((Transform)obj).localScale = new Vector3(1f, 1f, 1f);
			Image obj2 = val.AddComponent<Image>();
			((Graphic)obj2).color = color;
			obj2.sprite = sprite;
			obj2.type = (Type)1;
			((Graphic)obj2).raycastTarget = false;
			return obj2;
		}

		public static void CreateText(List<TextMeshProUGUI> texts, GameObject parent, Color colour, float size, float textOffset, Vector2 offsetMin, Vector2 offsetMax, string contents)
		{
			//IL_0000: Unknown result type (might be due to invalid IL or missing references)
			//IL_0005: Unknown result type (might be due to invalid IL or missing references)
			//IL_0010: 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_0029: 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_0080: Unknown result type (might be due to invalid IL or missing references)
			//IL_0095: 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_00a7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b1: Unknown result type (might be due to invalid IL or missing references)
			//IL_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_00cd: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e6: Unknown result type (might be due to invalid IL or missing references)
			GameObject val = new GameObject
			{
				name = "Text"
			};
			val.transform.parent = parent.transform;
			TextMeshProUGUI val2 = (TextMeshProUGUI)(object)val.AddComponent<HGTextMeshProUGUI>();
			((Graphic)val2).color = colour;
			((TMP_Text)val2).fontSize = size;
			((TMP_Text)val2).alignment = (TextAlignmentOptions)514;
			((TMP_Text)val2).text = contents;
			((Graphic)val2).raycastTarget = false;
			((TMP_Text)val2).lineSpacing = -25f;
			RectTransform component = val.GetComponent<RectTransform>();
			component.pivot = new Vector2(0f, 1f);
			component.anchorMin = new Vector2(0f, 0f);
			component.anchorMax = new Vector2(1f, 1f);
			component.offsetMin = new Vector2(offsetMin.x, offsetMin.y + textOffset);
			component.offsetMax = new Vector2(offsetMax.x, offsetMax.y + textOffset);
			((Transform)component).localScale = new Vector3(1f, 1f, 1f);
			texts.Add(val2);
		}

		public static GameObject CreateButton(Transform parent, Vector2 size, Sprite sprite)
		{
			//IL_0002: 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_003e: Unknown result type (might be due to invalid IL or missing references)
			//IL_005e: Unknown result type (might be due to invalid IL or missing references)
			//IL_007e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0094: Unknown result type (might be due to invalid IL or missing references)
			//IL_0095: Unknown result type (might be due to invalid IL or missing references)
			//IL_0096: Unknown result type (might be due to invalid IL or missing references)
			//IL_009b: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b9: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f4: Unknown result type (might be due to invalid IL or missing references)
			//IL_0109: 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_0126: Unknown result type (might be due to invalid IL or missing references)
			//IL_013b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0147: Unknown result type (might be due to invalid IL or missing references)
			//IL_0153: Unknown result type (might be due to invalid IL or missing references)
			//IL_015f: Expected O, but got Unknown
			ColorBlock val = default(ColorBlock);
			((ColorBlock)(ref val)).disabledColor = new Color(0.255f, 0.201f, 0.201f, 0.714f);
			((ColorBlock)(ref val)).highlightedColor = new Color(0.988f, 1f, 0.693f, 0.733f);
			((ColorBlock)(ref val)).normalColor = new Color(0.327f, 0.403f, 0.472f, 1f);
			((ColorBlock)(ref val)).pressedColor = new Color(0.74f, 0.755f, 0.445f, 0.984f);
			((ColorBlock)(ref val)).colorMultiplier = 1f;
			ColorBlock colors = val;
			GameObject val2 = new GameObject
			{
				name = "Button"
			};
			val2.transform.parent = parent;
			val2.AddComponent<MPEventSystemLocator>();
			Image val3 = val2.AddComponent<Image>();
			((Graphic)val3).color = new Color(1f, 1f, 1f, 1f);
			val3.type = (Type)1;
			val3.sprite = sprite;
			((Graphic)val3).raycastTarget = true;
			HGButton obj = val2.AddComponent<HGButton>();
			obj.showImageOnHover = true;
			((Selectable)obj).targetGraphic = (Graphic)(object)val3;
			((Selectable)obj).colors = colors;
			((MPButton)obj).disableGamepadClick = true;
			RectTransform component = val2.GetComponent<RectTransform>();
			component.anchorMin = new Vector2(0f, 1f);
			component.anchorMax = new Vector2(0f, 1f);
			component.SetSizeWithCurrentAnchors((Axis)0, size.x);
			component.SetSizeWithCurrentAnchors((Axis)1, size.y);
			return val2;
		}
	}
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	public class DebugCommands
	{
		[ConCommand(/*Could not decode attribute arguments.*/)]
		private static void NextLoadout(ConCommandArgs args)
		{
			if (Main.CurrentLoadout.Value < LoadoutHandler.StoredLoadouts.Count - 1)
			{
				ConfigEntry<int> currentLoadout = Main.CurrentLoadout;
				int value = currentLoadout.Value;
				currentLoadout.Value = value + 1;
			}
			Log.LogInfo("Progressed to loadout " + Main.CurrentLoadout.Value);
		}

		[ConCommand(/*Could not decode attribute arguments.*/)]
		private static void SetWins(ConCommandArgs args)
		{
			Main.CurrentLoadout.Value = ((ConCommandArgs)(ref args)).GetArgInt(0);
			Log.LogInfo("Set Loadout to " + Main.CurrentLoadout.Value);
		}

		[ConCommand(/*Could not decode attribute arguments.*/)]
		private static void SetDifficulty(ConCommandArgs args)
		{
			string argString = ((ConCommandArgs)(ref args)).GetArgString(0);
			string[] obj = new string[12]
			{
				"Eclipse8", "Eclipse7", "Eclipse6", "Eclipse5", "Eclipse4", "Eclipse3", "Eclipse2", "Eclipse1", "Hard", "Normal",
				"Easy", "Any"
			};
			bool flag = false;
			string[] array = obj;
			foreach (string text in array)
			{
				if (argString == text)
				{
					flag = true;
				}
			}
			if (!flag)
			{
				Log.LogDebug("Could not find the difficulty \"" + argString + "\"");
				return;
			}
			Main.DifficultySelect.Value = argString;
			Log.LogInfo("Set difficulty config to to " + argString);
		}
	}
	internal class DLC2
	{
		internal DLC2()
		{
			AddSceneToGroup("RoR2/Base/SceneGroups/sgStage2.asset", "RoR2/DLC2/lemuriantemple/lemuriantemple.asset");
			AddSceneToGroup("RoR2/Base/SceneGroups/sgStage3.asset", "RoR2/DLC2/habitat/habitat.asset");
			AddSceneToGroup("RoR2/Base/SceneGroups/loopSgStage3.asset", "RoR2/DLC2/habitatfall/habitatfall.asset");
			ChangeDestination("RoR2/DLC2/PortalColossus.prefab");
			ReplacePortals("RoR2/DLC2/ShrineHalcyonite.prefab", "RoR2/DLC2/iscColossusPortal.asset");
			Run.onRunStartGlobal += delegate(Run instance)
			{
				instance.SetEventFlag("FalseSonBossComplete");
			};
		}

		private async void AddSceneToGroup(string collection, string stage)
		{
			AsyncOperationHandle<SceneCollection> group = Addressables.LoadAssetAsync<SceneCollection>((object)collection);
			AsyncOperationHandle<SceneDef> scene = Addressables.LoadAssetAsync<SceneDef>((object)stage);
			await group.Task;
			await scene.Task;
			ref SceneEntry[] sceneEntries = ref group.Result._sceneEntries;
			SceneEntry val = new SceneEntry
			{
				sceneDef = scene.Result
			};
			ArrayUtils.ArrayAppend<SceneEntry>(ref sceneEntries, ref val);
		}

		private async void ChangeDestination(string portal)
		{
			AsyncOperationHandle<GameObject> prefab = Addressables.LoadAssetAsync<GameObject>((object)portal);
			await prefab.Task;
			SceneExitController component = prefab.Result.GetComponent<SceneExitController>();
			component.useRunNextStageScene = true;
			component.isAlternatePath = false;
		}

		private async void ReplacePortals(string parent, string replacement)
		{
			AsyncOperationHandle<GameObject> prefab = Addressables.LoadAssetAsync<GameObject>((object)parent);
			AsyncOperationHandle<InteractableSpawnCard> card = Addressables.LoadAssetAsync<InteractableSpawnCard>((object)replacement);
			await prefab.Task;
			await card.Task;
			PortalSpawner[] components = prefab.Result.GetComponents<PortalSpawner>();
			foreach (PortalSpawner obj in components)
			{
				obj.spawnMessageToken = "PORTAL_STORM_OPEN";
				obj.spawnPreviewMessageToken = "PORTAL_STORM_WILL_OPEN";
				obj.portalSpawnCard = card.Result;
				obj.previewChildName = "StormPortalIndicator";
				obj.invalidStages = Array.Empty<string>();
			}
		}
	}
	public class EventHandler
	{
		public static void AddLoadout(string loadoutStr, string seedStr)
		{
			string name = Language.GetString(GauntletCatalog.GetSurvivorNameFromId(loadoutStr[0]));
			if (GauntletCatalog.GetSurvivorNameFromId(loadoutStr[0]) == "VOIDSURVIVOR_BODY_NAME")
			{
				name = "Void Fiend";
			}
			LoadoutHandler.StoredLoadouts.Add(new GauntletLoadout
			{
				id = loadoutStr[0],
				name = name,
				skill1 = loadoutStr[1],
				skill2 = loadoutStr[2],
				skill3 = loadoutStr[3],
				stageSeed = seedStr
			});
		}

		public static void RandomLoadout()
		{
			GauntletGenerator instance = GauntletGenerator.instance;
			AddLoadout(instance.NextLoadout(), instance.NextSeed());
		}
	}
	internal static class Files
	{
		public static PluginInfo PluginInfo;

		internal static string assemblyDir => Path.GetDirectoryName(PluginInfo.Location);

		internal static void Init(PluginInfo info)
		{
			PluginInfo = info;
		}

		internal static string GetPathToFile(string fileName)
		{
			return Path.Combine(assemblyDir, fileName);
		}
	}
	public class ForceRules
	{
		[Serializable]
		[CompilerGenerated]
		private sealed class <>c
		{
			public static readonly <>c <>9 = new <>c();

			public static hook_DoesEveryoneHaveThisUnlockableUnlocked_UnlockableDef <>9__0_0;

			public static hook_CanUnlockableBeGrantedThisRun_UnlockableDef <>9__0_1;

			public static hook_IsUnlockableUnlocked_UnlockableDef <>9__0_2;

			public static hook_AnyUserHasUnlockable <>9__0_3;

			internal bool <.ctor>b__0_0(orig_DoesEveryoneHaveThisUnlockableUnlocked_UnlockableDef orig, Run self, UnlockableDef yes)
			{
				return true;
			}

			internal bool <.ctor>b__0_1(orig_CanUnlockableBeGrantedThisRun_UnlockableDef orig, Run self, UnlockableDef yes)
			{
				return false;
			}

			internal bool <.ctor>b__0_2(orig_IsUnlockableUnlocked_UnlockableDef orig, Run self, UnlockableDef yes)
			{
				return true;
			}

			internal bool <.ctor>b__0_3(orig_AnyUserHasUnlockable _, UnlockableDef _)
			{
				return true;
			}
		}

		public ForceRules()
		{
			//IL_001a: Unknown result type (might be due to invalid IL or missing references)
			//IL_001f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0025: Expected O, but got Unknown
			//IL_003e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0043: Unknown result type (might be due to invalid IL or missing references)
			//IL_0049: Expected O, but got Unknown
			//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_006d: Expected O, but got Unknown
			//IL_009d: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a7: Expected O, but got Unknown
			//IL_0086: Unknown result type (might be due to invalid IL or missing references)
			//IL_008b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0091: Expected O, but got Unknown
			object obj = <>c.<>9__0_0;
			if (obj == null)
			{
				hook_DoesEveryoneHaveThisUnlockableUnlocked_UnlockableDef val = (orig_DoesEveryoneHaveThisUnlockableUnlocked_UnlockableDef orig, Run self, UnlockableDef yes) => true;
				<>c.<>9__0_0 = val;
				obj = (object)val;
			}
			Run.DoesEveryoneHaveThisUnlockableUnlocked_UnlockableDef += (hook_DoesEveryoneHaveThisUnlockableUnlocked_UnlockableDef)obj;
			object obj2 = <>c.<>9__0_1;
			if (obj2 == null)
			{
				hook_CanUnlockableBeGrantedThisRun_UnlockableDef val2 = (orig_CanUnlockableBeGrantedThisRun_UnlockableDef orig, Run self, UnlockableDef yes) => false;
				<>c.<>9__0_1 = val2;
				obj2 = (object)val2;
			}
			Run.CanUnlockableBeGrantedThisRun_UnlockableDef += (hook_CanUnlockableBeGrantedThisRun_UnlockableDef)obj2;
			object obj3 = <>c.<>9__0_2;
			if (obj3 == null)
			{
				hook_IsUnlockableUnlocked_UnlockableDef val3 = (orig_IsUnlockableUnlocked_UnlockableDef orig, Run self, UnlockableDef yes) => true;
				<>c.<>9__0_2 = val3;
				obj3 = (object)val3;
			}
			Run.IsUnlockableUnlocked_UnlockableDef += (hook_IsUnlockableUnlocked_UnlockableDef)obj3;
			object obj4 = <>c.<>9__0_3;
			if (obj4 == null)
			{
				hook_AnyUserHasUnlockable val4 = (orig_AnyUserHasUnlockable _, UnlockableDef _) => true;
				<>c.<>9__0_3 = val4;
				obj4 = (object)val4;
			}
			PreGameController.AnyUserHasUnlockable += (hook_AnyUserHasUnlockable)obj4;
			Run.OverrideRuleChoices += new hook_OverrideRuleChoices(ForceDifficulty);
		}

		private void ForceDifficulty(orig_OverrideRuleChoices orig, Run self, RuleChoiceMask mustInclude, RuleChoiceMask mustExclude, ulong runSeed)
		{
			orig.Invoke(self, mustInclude, mustExclude, runSeed);
			if (Main.DifficultySelect.Value != "Any")
			{
				self.ForceChoice(mustInclude, mustExclude, "Difficulty." + Main.DifficultySelect.Value);
			}
		}
	}
	public static class GauntletCatalog
	{
		private static readonly Dictionary<char, string> _charToString = new Dictionary<char, string>();

		private static readonly Dictionary<string, char> _stringToChar = new Dictionary<string, char>();

		private static bool initialized = false;

		public static void Init()
		{
			if (initialized)
			{
				return;
			}
			char c = 'A';
			foreach (SurvivorDef allSurvivorDef in SurvivorCatalog.allSurvivorDefs)
			{
				string displayNameToken = allSurvivorDef.displayNameToken;
				_stringToChar.Add(displayNameToken, c);
				_charToString.Add(c, displayNameToken);
				c = (char)(c + 1);
			}
			initialized = true;
			LogAll();
		}

		public static string GetSurvivorNameFromId(char id)
		{
			if (!_charToString.ContainsKey(id))
			{
				return " ";
			}
			return _charToString[id];
		}

		public static char GetID(string name)
		{
			if (!_stringToChar.ContainsKey(name))
			{
				return ' ';
			}
			return _stringToChar[name];
		}

		private static void LogAll()
		{
			foreach (char key in _charToString.Keys)
			{
				Log.LogDebug(key + " => " + _charToString[key]);
			}
		}
	}
	public class GauntletGenerator
	{
		public static GauntletGenerator instance;

		public Xoroshiro128Plus mainRng;

		private LoadoutRandomizer _loadoutRandomizer;

		public ulong InitState { get; private set; }

		public GauntletGenerator(ulong seed = 52631129uL)
		{
			//IL_0058: Unknown result type (might be due to invalid IL or missing references)
			//IL_0062: Expected O, but got Unknown
			//IL_006e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0078: Expected O, but got Unknown
			if (seed == 52631129)
			{
				InitState = (ulong)((long)new Random().Next() * 100000000L + new Random().Next());
			}
			else
			{
				InitState = seed;
			}
			Log.LogDebug($"Creating GauntletGenerator with seed {seed}");
			mainRng = new Xoroshiro128Plus(InitState);
			_loadoutRandomizer = new LoadoutRandomizer(new Xoroshiro128Plus(mainRng.nextUlong));
			instance = this;
			LoadoutHandler.StoreLoadouts();
		}

		public List<GauntletLoadout> GenerateGauntlet(int numOfLoadouts)
		{
			Log.LogDebug("Generating a gauntlet");
			_loadoutRandomizer.LoadoutBuilder();
			List<GauntletLoadout> list = new List<GauntletLoadout>();
			for (int i = 0; i < numOfLoadouts; i++)
			{
				GauntletLoadout gauntletLoadout = new GauntletLoadout();
				string text = NextLoadout();
				gauntletLoadout.id = text[0];
				gauntletLoadout.skill1 = text[1] - 48;
				gauntletLoadout.skill2 = text[2] - 48;
				gauntletLoadout.skill3 = text[3] - 48;
				gauntletLoadout.stageSeed = NextSeed();
				gauntletLoadout.name = GauntletCatalog.GetSurvivorNameFromId(gauntletLoadout.id);
				list.Add(gauntletLoadout);
				Log.LogDebug("Generated loadout #" + (i + 1) + ", " + gauntletLoadout.ToString());
			}
			return list;
		}

		public string NextLoadout()
		{
			return _loadoutRandomizer.GetSurvivor().GetIDString();
		}

		public string NextSeed()
		{
			return mainRng.nextUlong.ToString();
		}

		public static void UpdateGenerator(ulong seed = 52631129uL)
		{
			instance = new GauntletGenerator(seed);
			Main.CurrentGauntletSeed.Value = instance.InitState.ToString();
		}

		public static void ReloadGenerator()
		{
			instance = new GauntletGenerator(instance.InitState);
		}
	}
	public class GauntletLoadout : IEquatable<GauntletLoadout>
	{
		public string name;

		public int skill1;

		public int skill2;

		public int skill3;

		public char id;

		public string stageSeed;

		public bool Equals(GauntletLoadout other)
		{
			if (other == null)
			{
				return false;
			}
			if (name == other.name && skill1 == other.skill1 && skill2 == other.skill2 && skill3 == other.skill3 && stageSeed == other.stageSeed && id == other.id)
			{
				return true;
			}
			return false;
		}

		public bool SurvivorCheck(GauntletLoadout other)
		{
			if (other == null)
			{
				return false;
			}
			if (name == other.name)
			{
				return true;
			}
			return false;
		}

		public override string ToString()
		{
			return name + " (" + id + "), " + skill1 + " " + skill2 + " " + skill3 + "; seed: " + stageSeed;
		}
	}
	internal class ItemTransformation
	{
		private CachedGenerator<ItemIndex> input;

		private CachedGenerator<ItemIndex> output;

		private static uint lifetime = 5u;

		[ConCommand(commandName = "cache_lifetime", helpText = "used for Benthic Bloom")]
		private static void SetLifetime(ConCommandArgs argument)
		{
			//IL_0055: Unknown result type (might be due to invalid IL or missing references)
			switch (((ConCommandArgs)(ref argument)).Count)
			{
			case 1:
			{
				uint num = (uint)((ConCommandArgs)(ref argument)).GetArgULong(0);
				if (lifetime == num)
				{
					Debug.Log((object)"no change");
					return;
				}
				if (Object.op_Implicit((Object)(object)Run.instance))
				{
					Debug.Log((object)"please start a new run to load changes");
				}
				lifetime = num;
				break;
			}
			default:
				Debug.Log((object)"too many arguments");
				return;
			case 0:
				break;
			}
			Debug.Log((object)(argument.commandName + " set to " + lifetime));
		}

		internal ItemTransformation()
		{
			//IL_001e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0028: Expected O, but got Unknown
			Run.onRunStartGlobal += OnRunStartGlobal;
			CharacterMaster.TryCloverVoidUpgrades += new hook_TryCloverVoidUpgrades(TryCloverVoidUpgrades);
		}

		private void OnRunStartGlobal(Run instance)
		{
			//IL_0031: Unknown result type (might be due to invalid IL or missing references)
			//IL_0037: Expected I4, but got Unknown
			//IL_003e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0044: Expected I4, but got Unknown
			//IL_0055: Unknown result type (might be due to invalid IL or missing references)
			//IL_005c: Expected O, but got Unknown
			IEnumerable<ItemIndex> first = convert(instance.availableTier1DropList);
			IEnumerable<ItemIndex> enumerable = convert(instance.availableTier2DropList);
			IEnumerable<ItemIndex> second = convert(instance.availableTier3DropList);
			IEnumerable<ItemIndex> second2 = new <>z__ReadOnlyArray<ItemIndex>((ItemIndex[])(object)new ItemIndex[2]
			{
				(ItemIndex)(int)Items.ScrapWhite.itemIndex,
				(ItemIndex)(int)Items.ScrapGreen.itemIndex
			});
			Xoroshiro128Plus val = new Xoroshiro128Plus(instance.runRNG.Next());
			input = new CachedGenerator<ItemIndex>(val.Next(), first.Concat(enumerable).Concat(second2), lifetime);
			output = new CachedGenerator<ItemIndex>(val.Next(), enumerable.Concat(second));
			static IEnumerable<ItemIndex> convert(IEnumerable<PickupIndex> pickup)
			{
				foreach (PickupIndex item in pickup)
				{
					yield return PickupCatalog.GetPickupDef(item).itemIndex;
				}
			}
		}

		private void TryCloverVoidUpgrades(orig_TryCloverVoidUpgrades _, CharacterMaster self)
		{
			//IL_008f: 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_00d0: 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_010d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0112: Unknown result type (might be due to invalid IL or missing references)
			if (!NetworkServer.active)
			{
				return;
			}
			Inventory inventory = self.inventory;
			int num = inventory.GetItemCount(Items.CloverVoid) * 3;
			if (num <= 0 || !input.Any(valid))
			{
				return;
			}
			do
			{
				input.log("input:");
				if (!input.TryGetNext(valid, out var item))
				{
					break;
				}
				int itemCount = inventory.GetItemCount(item);
				output.log("output:");
				ItemIndex next = output.GetNext((ItemIndex index) => CheckTag(item, index));
				inventory.RemoveItem(item, itemCount);
				inventory.GiveItem(next, itemCount);
				input.log("removed:");
				input.Clear();
				CharacterMasterNotificationQueue.SendTransformNotification(self, item, next, (TransformationType)2);
			}
			while (--num > 0);
			GameObject bodyInstanceObject = self.bodyInstanceObject;
			if (Object.op_Implicit((Object)(object)bodyInstanceObject))
			{
				Util.PlaySound("Play_item_proc_extraLife", bodyInstanceObject);
			}
			bool valid(ItemIndex index)
			{
				//IL_0006: Unknown result type (might be due to invalid IL or missing references)
				return inventory.GetItemCount(index) > 0;
			}
		}

		private static bool CheckTag(ItemIndex i, ItemIndex j)
		{
			//IL_0000: 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_000f: 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_001b: 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_0037: Unknown result type (might be due to invalid IL or missing references)
			//IL_0039: Invalid comparison between Unknown and I4
			//IL_003c: Unknown result type (might be due to invalid IL or missing references)
			ItemDef itemDef = ItemCatalog.GetItemDef(i);
			ItemDef itemDef2 = ItemCatalog.GetItemDef(j);
			if (itemDef2.tier != (ItemTier)(itemDef.tier + 1))
			{
				return false;
			}
			bool result = true;
			ItemTag[] tags = itemDef.tags;
			foreach (ItemTag val in tags)
			{
				if (val - 1 <= 2)
				{
					if (itemDef2.ContainsTag(val))
					{
						return true;
					}
					result = false;
				}
			}
			return result;
		}
	}
	public class CachedGenerator<T>
	{
		private record Entry
		{
			internal T type;

			internal uint age;

			public Entry(T type)
			{
				this.type = type;
				base..ctor();
			}

			[CompilerGenerated]
			protected virtual bool PrintMembers(StringBuilder builder)
			{
				return false;
			}

			[CompilerGenerated]
			public void Deconstruct(out T type)
			{
				type = this.type;
			}
		}

		[CompilerGenerated]
		private uint <lifetime>P;

		private readonly Xoroshiro128Plus generator;

		private readonly T[] item;

		private readonly LinkedList<Entry> cache;

		internal Action<object> log;

		public CachedGenerator(ulong seed, IEnumerable<T> item, uint lifetime = 0u)
		{
			//IL_0009: Unknown result type (might be due to invalid IL or missing references)
			//IL_0013: Expected O, but got Unknown
			<lifetime>P = lifetime;
			generator = new Xoroshiro128Plus(seed);
			this.item = item.ToArray();
			cache = new LinkedList<Entry>();
			log = delegate
			{
			};
			base..ctor();
		}

		internal T GetNext(Predicate<T> valid)
		{
			for (LinkedListNode<Entry> linkedListNode = cache.First; linkedListNode != null; linkedListNode = linkedListNode.Next)
			{
				T type = linkedListNode.Value.type;
				log(type);
				if (valid(type))
				{
					cache.Remove(linkedListNode);
					return type;
				}
			}
			log("\t ---- ");
			T val;
			while (true)
			{
				val = generator.NextElementUniform<T>(item);
				log(val);
				if (valid(val))
				{
					break;
				}
				cache.AddLast(new Entry(val));
			}
			return val;
		}

		internal bool Any(Predicate<T> valid)
		{
			T[] array = item;
			foreach (T obj in array)
			{
				if (valid(obj))
				{
					return true;
				}
			}
			return false;
		}

		internal bool TryGetNext(Predicate<T> valid, out T value)
		{
			value = default(T);
			if (Any(valid))
			{
				value = GetNext(valid);
				return true;
			}
			log(null);
			return false;
		}

		internal void Clear()
		{
			LinkedListNode<Entry> linkedListNode = cache.First;
			LinkedListNode<Entry> linkedListNode2 = null;
			while (linkedListNode != null)
			{
				if (++linkedListNode.Value.age > <lifetime>P)
				{
					linkedListNode2 = linkedListNode.Next;
					cache.Remove(linkedListNode);
					log(linkedListNode.Value.type);
					linkedListNode = linkedListNode2;
				}
				else
				{
					linkedListNode = linkedListNode.Next;
				}
			}
			if (linkedListNode2 == null)
			{
				log(null);
			}
		}
	}
	public class LazarusResurrection
	{
		[Serializable]
		[CompilerGenerated]
		private sealed class <>c
		{
			public static readonly <>c <>9 = new <>c();

			public static hook_OnBodyStart <>9__8_0;

			public static hook_IsDeadAndOutOfLivesServer <>9__8_1;

			internal void <InfiniteLives>b__8_0(orig_OnBodyStart orig, CharacterMaster self, CharacterBody body)
			{
				orig.Invoke(self, body);
				if (body.isPlayerControlled)
				{
					ReloadDeaths(body);
				}
			}

			internal bool <InfiniteLives>b__8_1(orig_IsDeadAndOutOfLivesServer orig, CharacterMaster self)
			{
				CharacterBody body = self.GetBody();
				if (orig.Invoke(self))
				{
					if (Object.op_Implicit((Object)(object)body))
					{
						return !body.isPlayerControlled;
					}
					return true;
				}
				return false;
			}
		}

		public static ItemIndex lunarWingsIndex = (ItemIndex)106;

		public static ItemIndex lazarusWingsIndex;

		public static int deathCount = 0;

		private static float timePenaltySeconds = 300f;

		private static GameObject cachedHippoRezEffect;

		private static string playSoundString = "Play_item_proc_deathMark";

		public LazarusResurrection()
		{
			//IL_0022: Unknown result type (might be due to invalid IL or missing references)
			//IL_002c: Expected O, but got Unknown
			//IL_0033: Unknown result type (might be due to invalid IL or missing references)
			//IL_003d: Expected O, but got Unknown
			cachedHippoRezEffect = LegacyResourcesAPI.Load<GameObject>("Prefabs/Effects/HippoRezEffect");
			InfiniteLives();
			RunTimerUIController.Update += new hook_Update(TimeAdd);
			Run.Start += new hook_Start(ResetLazarus);
		}

		public void ResetLazarus(orig_Start orig, Run self)
		{
			deathCount = 0;
			Log.LogInfo("Death count reset");
			orig.Invoke(self);
		}

		public void InfiniteLives()
		{
			//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_001f: Expected O, but got Unknown
			//IL_004f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0059: Expected O, but got Unknown
			//IL_0038: Unknown result type (might be due to invalid IL or missing references)
			//IL_003d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0043: Expected O, but got Unknown
			object obj = <>c.<>9__8_0;
			if (obj == null)
			{
				hook_OnBodyStart val = delegate(orig_OnBodyStart orig, CharacterMaster self, CharacterBody body)
				{
					orig.Invoke(self, body);
					if (body.isPlayerControlled)
					{
						ReloadDeaths(body);
					}
				};
				<>c.<>9__8_0 = val;
				obj = (object)val;
			}
			CharacterMaster.OnBodyStart += (hook_OnBodyStart)obj;
			object obj2 = <>c.<>9__8_1;
			if (obj2 == null)
			{
				hook_IsDeadAndOutOfLivesServer val2 = delegate(orig_IsDeadAndOutOfLivesServer orig, CharacterMaster self)
				{
					CharacterBody body2 = self.GetBody();
					return orig.Invoke(self) && (!Object.op_Implicit((Object)(object)body2) || !body2.isPlayerControlled);
				};
				<>c.<>9__8_1 = val2;
				obj2 = (object)val2;
			}
			CharacterMaster.IsDeadAndOutOfLivesServer += (hook_IsDeadAndOutOfLivesServer)obj2;
			CharacterMaster.OnBodyDeath += (hook_OnBodyDeath)delegate(orig_OnBodyDeath orig, CharacterMaster self, CharacterBody body)
			{
				//IL_0043: 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 || !body.isPlayerControlled || body.HasBuff(Buffs.ExtraLifeBuff) || (Object.op_Implicit((Object)(object)body.equipmentSlot) && body.equipmentSlot.equipmentIndex == Equipment.HealAndRevive.equipmentIndex) || self.inventory.GetItemCount(Items.ExtraLife) > 0 || self.inventory.GetItemCount(Items.ExtraLifeVoid) > 0)
				{
					orig.Invoke(self, body);
				}
				else
				{
					self.destroyOnBodyDeath = false;
					orig.Invoke(self, body);
					self.preventRespawnUntilNextStageServer = false;
					self.preventGameOver = true;
					((MonoBehaviour)Main.instance).StartCoroutine(delay());
				}
				IEnumerator delay()
				{
					yield return (object)new WaitForSeconds(1.5f);
					lazarusWingsIndex = ItemCatalog.FindItemIndex("LazarusWings");
					self.inventory.GiveItem(lazarusWingsIndex, 1);
					CharacterMasterNotificationQueue.PushItemNotification(self, lazarusWingsIndex);
					Vector3 val3 = self.deathFootPosition;
					if (self.killedByUnsafeArea)
					{
						val3 = (Vector3)(((??)TeleportHelper.FindSafeTeleportDestination(self.deathFootPosition, self.bodyPrefab.GetComponent<CharacterBody>(), RoR2Application.rng)) ?? self.deathFootPosition);
					}
					self.Respawn(val3, Quaternion.Euler(0f, Random.Range(0f, 360f), 0f), false);
					self.GetBody().AddTimedBuff(Buffs.Immune, 5f);
					GameObject val4 = ((!Main.UseLazarusDeathEffect.Value) ? cachedHippoRezEffect : Assets.lazarusResurrectionEffect);
					if (Object.op_Implicit((Object)(object)self.bodyInstanceObject))
					{
						EntityStateMachine[] components = self.bodyInstanceObject.GetComponents<EntityStateMachine>();
						foreach (EntityStateMachine obj3 in components)
						{
							obj3.initialStateType = obj3.mainStateType;
						}
						if (Object.op_Implicit((Object)(object)val4))
						{
							EffectManager.SpawnEffect(val4, new EffectData
							{
								origin = val3,
								rotation = self.bodyInstanceObject.transform.rotation
							}, true);
							Util.PlaySound(playSoundString, self.bodyInstanceObject.gameObject);
						}
					}
					deathCount = self.inventory.GetItemCount(lazarusWingsIndex);
					UpdateTimeAlive();
				}
			};
		}

		public void TimeAdd(orig_Update orig, RunTimerUIController self)
		{
			orig.Invoke(self);
			TimerText runStopwatchTimerTextController = self.runStopwatchTimerTextController;
			runStopwatchTimerTextController.seconds += (double)GetTotalPenalty();
		}

		public static float GetTotalPenalty()
		{
			return (float)deathCount * timePenaltySeconds;
		}

		public void UpdateTimeAlive()
		{
			//IL_0002: 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)
			CharacterUpdateEvent val = default(CharacterUpdateEvent);
			val.additionalTimeAlive = timePenaltySeconds;
			val.statsComponent = ((Component)PlayerCharacterMasterController.instances[0].master).GetComponent<PlayerStatsComponent>();
			StatManager.PushCharacterUpdateEvent(val);
		}

		public static void ReloadDeaths(CharacterBody player)
		{
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			deathCount = player.inventory.GetItemCount(lazarusWingsIndex);
			Log.LogDebug("Reloaded player death count");
		}
	}
	public class LazarusWings
	{
		internal static GameObject lunarWingsDisplayPrefab = Addressables.LoadAssetAsync<GameObject>((object)"RoR2/DLC1/LunarWings/DisplayLunarWings.prefab").WaitForCompletion();

		internal static GameObject lunarWingsPickupPrefab = Addressables.LoadAssetAsync<GameObject>((object)"RoR2/DLC1/LunarWings/PickupLunarWings.prefab").WaitForCompletion();

		internal static Sprite lunarWingsIcon = Addressables.LoadAssetAsync<Sprite>((object)"RoR2/DLC1/LunarWings/texLunarWingsIcon.png").WaitForCompletion();

		private static Material wingsMat = Addressables.LoadAssetAsync<Material>((object)"RoR2/Base/PortalShop/matShopPortalEffectEdge.mat").WaitForCompletion();

		public LazarusWings()
		{
			AddLanguageTokens();
			AddLazarusWings();
		}

		private static void AddLanguageTokens()
		{
			LanguageAPI.Add("LAZARUSWINGS_NAME", "Lazarus Wings");
			LanguageAPI.Add("LAZARUSWINGS_PICKUP", "Adds a <style=cIsUtility>5 minute</style> time penalty to the run timer <style=cStack>(+5 minutes per stack)</style>");
			LanguageAPI.Add("LAZARUSWINGS_DESC", "Adds a <style=cIsUtility>5 minute</style> time penalty to the run timer <style=cStack>(+5 minutes per stack)</style>");
			LanguageAPI.Add("LAZARUSWINGS_LORE", "The resurrection is a never-ending cycle, one of ongoing torment and despair. \nLife and death are intertwined in a continuous loop, like two sides of a single blade. We are all given a chance at life, but at what cost? \nWe are cast away from the living, and into the darkness, our souls forever wandering, searching for an escape from the deathly embrace. \nWe are doomed to eternal suffering, unless we can learn to accept the resurrection, and overcome our fear of the unknown.");
		}

		private static void AddLazarusWings()
		{
			//IL_0000: Unknown result type (might be due to invalid IL or missing references)
			//IL_0005: Unknown result type (might be due to invalid IL or missing references)
			//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_0019: Unknown result type (might be due to invalid IL or missing references)
			//IL_001e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0029: 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_003b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0046: Unknown result type (might be due to invalid IL or missing references)
			//IL_0051: Unknown result type (might be due to invalid IL or missing references)
			//IL_005c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0068: Expected O, but got Unknown
			//IL_0078: Unknown result type (might be due to invalid IL or missing references)
			//IL_007e: Expected O, but got Unknown
			//IL_008e: Unknown result type (might be due to invalid IL or missing references)
			//IL_00bd: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d8: Unknown result type (might be due to invalid IL or missing references)
			//IL_00dd: 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_00f8: Unknown result type (might be due to invalid IL or missing references)
			//IL_00fd: Unknown result type (might be due to invalid IL or missing references)
			//IL_00fe: Unknown result type (might be due to invalid IL or missing references)
			//IL_0118: Unknown result type (might be due to invalid IL or missing references)
			//IL_0147: Unknown result type (might be due to invalid IL or missing references)
			//IL_014c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0162: Unknown result type (might be due to invalid IL or missing references)
			//IL_0167: Unknown result type (might be due to invalid IL or missing references)
			//IL_017d: 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_0187: 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_01a2: Unknown result type (might be due to invalid IL or missing references)
			//IL_01d1: Unknown result type (might be due to invalid IL or missing references)
			//IL_01d6: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ec: Unknown result type (might be due to invalid IL or missing references)
			//IL_01f1: Unknown result type (might be due to invalid IL or missing references)
			//IL_0207: 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_0211: Unknown result type (might be due to invalid IL or missing references)
			//IL_0212: Unknown result type (might be due to invalid IL or missing references)
			//IL_022c: Unknown result type (might be due to invalid IL or missing references)
			//IL_025b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0260: Unknown result type (might be due to invalid IL or missing references)
			//IL_0276: Unknown result type (might be due to invalid IL or missing references)
			//IL_027b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0291: Unknown result type (might be due to invalid IL or missing references)
			//IL_0296: Unknown result type (might be due to invalid IL or missing references)
			//IL_029b: Unknown result type (might be due to invalid IL or missing references)
			//IL_029c: Unknown result type (might be due to invalid IL or missing references)
			//IL_02b6: Unknown result type (might be due to invalid IL or missing references)
			//IL_02e5: Unknown result type (might be due to invalid IL or missing references)
			//IL_02ea: Unknown result type (might be due to invalid IL or missing references)
			//IL_0300: Unknown result type (might be due to invalid IL or missing references)
			//IL_0305: Unknown result type (might be due to invalid IL or missing references)
			//IL_031b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0320: Unknown result type (might be due to invalid IL or missing references)
			//IL_0325: Unknown result type (might be due to invalid IL or missing references)
			//IL_0326: Unknown result type (might be due to invalid IL or missing references)
			//IL_0340: Unknown result type (might be due to invalid IL or missing references)
			//IL_036f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0374: Unknown result type (might be due to invalid IL or missing references)
			//IL_038a: Unknown result type (might be due to invalid IL or missing references)
			//IL_038f: Unknown result type (might be due to invalid IL or missing references)
			//IL_03a5: Unknown result type (might be due to invalid IL or missing references)
			//IL_03aa: Unknown result type (might be due to invalid IL or missing references)
			//IL_03af: Unknown result type (might be due to invalid IL or missing references)
			//IL_03b0: Unknown result type (might be due to invalid IL or missing references)
			//IL_03ca: Unknown result type (might be due to invalid IL or missing references)
			//IL_03f9: Unknown result type (might be due to invalid IL or missing references)
			//IL_03fe: Unknown result type (might be due to invalid IL or missing references)
			//IL_0414: Unknown result type (might be due to invalid IL or missing references)
			//IL_0419: Unknown result type (might be due to invalid IL or missing references)
			//IL_042f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0434: Unknown result type (might be due to invalid IL or missing references)
			//IL_0439: Unknown result type (might be due to invalid IL or missing references)
			//IL_043a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0454: Unknown result type (might be due to invalid IL or missing references)
			//IL_0483: Unknown result type (might be due to invalid IL or missing references)
			//IL_0488: Unknown result type (might be due to invalid IL or missing references)
			//IL_049e: Unknown result type (might be due to invalid IL or missing references)
			//IL_04a3: Unknown result type (might be due to invalid IL or missing references)
			//IL_04b9: Unknown result type (might be due to invalid IL or missing references)
			//IL_04be: Unknown result type (might be due to invalid IL or missing references)
			//IL_04c3: Unknown result type (might be due to invalid IL or missing references)
			//IL_04c4: Unknown result type (might be due to invalid IL or missing references)
			//IL_04de: Unknown result type (might be due to invalid IL or missing references)
			//IL_050d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0512: Unknown result type (might be due to invalid IL or missing references)
			//IL_0528: Unknown result type (might be due to invalid IL or missing references)
			//IL_052d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0543: Unknown result type (might be due to invalid IL or missing references)
			//IL_0548: Unknown result type (might be due to invalid IL or missing references)
			//IL_054d: Unknown result type (might be due to invalid IL or missing references)
			//IL_054e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0568: Unknown result type (might be due to invalid IL or missing references)
			//IL_0597: Unknown result type (might be due to invalid IL or missing references)
			//IL_059c: Unknown result type (might be due to invalid IL or missing references)
			//IL_05b2: Unknown result type (might be due to invalid IL or missing references)
			//IL_05b7: Unknown result type (might be due to invalid IL or missing references)
			//IL_05cd: Unknown result type (might be due to invalid IL or missing references)
			//IL_05d2: Unknown result type (might be due to invalid IL or missing references)
			//IL_05d7: Unknown result type (might be due to invalid IL or missing references)
			//IL_05d8: Unknown result type (might be due to invalid IL or missing references)
			//IL_05f2: Unknown result type (might be due to invalid IL or missing references)
			//IL_0621: Unknown result type (might be due to invalid IL or missing references)
			//IL_0626: Unknown result type (might be due to invalid IL or missing references)
			//IL_063c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0641: Unknown result type (might be due to invalid IL or missing references)
			//IL_0657: Unknown result type (might be due to invalid IL or missing references)
			//IL_065c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0661: Unknown result type (might be due to invalid IL or missing references)
			//IL_0662: Unknown result type (might be due to invalid IL or missing references)
			//IL_067c: Unknown result type (might be due to invalid IL or missing references)
			//IL_06ab: Unknown result type (might be due to invalid IL or missing references)
			//IL_06b0: Unknown result type (might be due to invalid IL or missing references)
			//IL_06c6: Unknown result type (might be due to invalid IL or missing references)
			//IL_06cb: Unknown result type (might be due to invalid IL or missing references)
			//IL_06e1: Unknown result type (might be due to invalid IL or missing references)
			//IL_06e6: Unknown result type (might be due to invalid IL or missing references)
			//IL_06eb: Unknown result type (might be due to invalid IL or missing references)
			//IL_06ec: Unknown result type (might be due to invalid IL or missing references)
			//IL_0706: Unknown result type (might be due to invalid IL or missing references)
			//IL_0735: Unknown result type (might be due to invalid IL or missing references)
			//IL_073a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0750: Unknown result type (might be due to invalid IL or missing references)
			//IL_0755: Unknown result type (might be due to invalid IL or missing references)
			//IL_076b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0770: Unknown result type (might be due to invalid IL or missing references)
			//IL_0775: Unknown result type (might be due to invalid IL or missing references)
			//IL_0776: Unknown result type (might be due to invalid IL or missing references)
			//IL_0782: Unknown result type (might be due to invalid IL or missing references)
			//IL_078c: Expected O, but got Unknown
			ItemDef val = new ItemDef
			{
				name = "LazarusWings",
				tier = (ItemTier)5,
				deprecatedTier = (ItemTier)5,
				pickupModelPrefab = lunarWingsPickupPrefab,
				pickupIconSprite = lunarWingsIcon,
				canRemove = false,
				nameToken = "LAZARUSWINGS_NAME",
				pickupToken = "LAZARUSWINGS_PICKUP",
				descriptionToken = "LAZARUSWINGS_DESC",
				loreToken = "LAZARUSWINGS_LORE"
			};
			lunarWingsDisplayPrefab.AddComponent<ItemDisplay>();
			ItemDisplayRuleDict val2 = new ItemDisplayRuleDict(Array.Empty<ItemDisplayRule>());
			val2.Add("mdlCommandoDualies", (ItemDisplayRule[])(object)new ItemDisplayRule[1]
			{
				new ItemDisplayRule
				{
					followerPrefab = lunarWingsDisplayPrefab,
					childName = "Chest",
					localPos = new Vector3(0.00015f, 0.35673f, -0.13908f),
					localAngles = new Vector3(29.83448f, 2.96739f, 1.53991f),
					localScale = new Vector3(0.66405f, 0.66405f, 0.66405f)
				}
			});
			val2.Add("mdlHuntress", (ItemDisplayRule[])(object)new ItemDisplayRule[1]
			{
				new ItemDisplayRule
				{
					followerPrefab = lunarWingsDisplayPrefab,
					childName = "Chest",
					localPos = new Vector3(0.03159f, 0.12506f, -0.11253f),
					localAngles = new Vector3(2.02883f, 320.887f, 2.59241f),
					localScale = new Vector3(0.67117f, 0.67117f, 0.67117f)
				}
			});
			val2.Add("mdlBandit2", (ItemDisplayRule[])(object)new ItemDisplayRule[1]
			{
				new ItemDisplayRule
				{
					followerPrefab = lunarWingsDisplayPrefab,
					childName = "Chest",
					localPos = new Vector3(0.0186f, 0.19022f, -0.17056f),
					localAngles = new Vector3(21.46973f, 4.22358f, 350.7856f),
					localScale = new Vector3(0.63697f, 0.63697f, 0.63697f)
				}
			});
			val2.Add("mdlToolbot", (ItemDisplayRule[])(object)new ItemDisplayRule[1]
			{
				new ItemDisplayRule
				{
					followerPrefab = lunarWingsDisplayPrefab,
					childName = "Chest",
					localPos = new Vector3(0.26714f, 1.0237f, -1.86616f),
					localAngles = new Vector3(19.8663f, 356.4091f, 358.1597f),
					localScale = new Vector3(7.19914f, 7.19914f, 7.19914f)
				}
			});
			val2.Add("mdlEngi", (ItemDisplayRule[])(object)new ItemDisplayRule[1]
			{
				new ItemDisplayRule
				{
					followerPrefab = lunarWingsDisplayPrefab,
					childName = "Chest",
					localPos = new Vector3(-0.00569f, 0.08394f, -0.2341f),
					localAngles = new Vector3(354.0963f, 358.2862f, 358.6038f),
					localScale = new Vector3(0.79185f, 0.79185f, 0.79185f)
				}
			});
			val2.Add("mdlMage", (ItemDisplayRule[])(object)new ItemDisplayRule[1]
			{
				new ItemDisplayRule
				{
					followerPrefab = lunarWingsDisplayPrefab,
					childName = "Chest",
					localPos = new Vector3(-0.00942f, 0.03686f, -0.27844f),
					localAngles = new Vector3(0.14453f, 355.3709f, 1.70079f),
					localScale = new Vector3(0.74458f, 0.74458f, 0.74458f)
				}
			});
			val2.Add("mdlMerc", (ItemDisplayRule[])(object)new ItemDisplayRule[1]
			{
				new ItemDisplayRule
				{
					followerPrefab = lunarWingsDisplayPrefab,
					childName = "Chest",
					localPos = new Vector3(-0.00667f, 0.12215f, -0.21273f),
					localAngles = new Vector3(12.88405f, 355.9306f, 357.45f),
					localScale = new Vector3(0.76865f, 0.76865f, 0.76865f)
				}
			});
			val2.Add("mdlTreebot", (ItemDisplayRule[])(object)new ItemDisplayRule[1]
			{
				new ItemDisplayRule
				{
					followerPrefab = lunarWingsDisplayPrefab,
					childName = "HeadBase",
					localPos = new Vector3(0.02836f, -1.29261f, 0.70876f),
					localAngles = new Vector3(9.15137f, 176.2903f, 182.9521f),
					localScale = new Vector3(1.60994f, 1.60994f, 1.60994f)
				}
			});
			val2.Add("mdlLoader", (ItemDisplayRule[])(object)new ItemDisplayRule[1]
			{
				new ItemDisplayRule
				{
					followerPrefab = lunarWingsDisplayPrefab,
					childName = "Chest",
					localPos = new Vector3(-0.00592f, 0.18198f, -0.26041f),
					localAngles = new Vector3(3.79341f, 3.28101f, 0.27247f),
					localScale = new Vector3(0.85237f, 0.85237f, 0.85237f)
				}
			});
			val2.Add("mdlCroco", (ItemDisplayRule[])(object)new ItemDisplayRule[1]
			{
				new ItemDisplayRule
				{
					followerPrefab = lunarWingsDisplayPrefab,
					childName = "Chest",
					localPos = new Vector3(-0.02597f, 0.34623f, 3.17591f),
					localAngles = new Vector3(335.5031f, 177.2755f, 3.44059f),
					localScale = new Vector3(7.35741f, 7.35741f, 7.35741f)
				}
			});
			val2.Add("mdlCaptain", (ItemDisplayRule[])(object)new ItemDisplayRule[1]
			{
				new ItemDisplayRule
				{
					followerPrefab = lunarWingsDisplayPrefab,
					childName = "Chest",
					localPos = new Vector3(-0.01571f, 0.24481f, -0.16307f),
					localAngles = new Vector3(18.78144f, 7.25192f, 1.65195f),
					localScale = new Vector3(0.89055f, 0.89055f, 0.89055f)
				}
			});
			val2.Add("mdlRailGunner", (ItemDisplayRule[])(object)new ItemDisplayRule[1]
			{
				new ItemDisplayRule
				{
					followerPrefab = lunarWingsDisplayPrefab,
					childName = "Chest",
					localPos = new Vector3(-0.0457f, -0.12092f, -0.27414f),
					localAngles = new Vector3(353.748f, 10.2935f, 349.5002f),
					localScale = new Vector3(0.74962f, 0.74962f, 0.74962f)
				}
			});
			val2.Add("mdlVoidSurvivor", (ItemDisplayRule[])(object)new ItemDisplayRule[1]
			{
				new ItemDisplayRule
				{
					followerPrefab = lunarWingsDisplayPrefab,
					childName = "Chest",
					localPos = new Vector3(0.02643f, 0.0461f, -0.17402f),
					localAngles = new Vector3(353.6433f, 5.13739f, 6.10527f),
					localScale = new Vector3(0.87425f, 0.87425f, 0.87425f)
				}
			});
			ItemAPI.Add(new CustomItem(val, val2));
		}
	}
	public class LoadoutHandler
	{
		public static List<GauntletLoadout> StoredLoadouts = new List<GauntletLoadout>();

		public static GauntletLoadout GetLoadout(int num)
		{
			if (num < StoredLoadouts.Count && num > 0)
			{
				return StoredLoadouts[num];
			}
			if (StoredLoadouts.Count <= 0)
			{
				return null;
			}
			return StoredLoadouts[0];
		}

		public static void StoreLoadouts()
		{
			StoredLoadouts.Clear();
			StoredLoadouts.AddRange(GauntletGenerator.instance.GenerateGauntlet(Main.GauntletSize.Value));
			Debug.Log((object)"Selected loadouts: ");
			foreach (GauntletLoadout storedLoadout in StoredLoadouts)
			{
				Debug.Log((object)storedLoadout);
			}
		}
	}
	public class LoadoutLockIn
	{
		private const bool ORDERED_RACE = true;

		private SurvivorIconController allowedIconController;

		private Dictionary<GenericSkill, Variant[]> ogVariants = new Dictionary<GenericSkill, Variant[]>();

		public LoadoutLockIn()
		{
			//IL_0025: Unknown result type (might be due to invalid IL or missing references)
			//IL_002f: Expected O, but got Unknown
			//IL_0036: Unknown result type (might be due to invalid IL or missing references)
			//IL_0040: Expected O, but got Unknown
			//IL_0047: Unknown result type (might be due to invalid IL or missing references)
			//IL_0051: Expected O, but got Unknown
			if (Main.UnlockCharacterSelect.Value)
			{
				return;
			}
			CharacterSelectBarController.Build += new hook_Build(OnlyBuildAllowedSurvivors);
			SurvivorIconController.UpdateAvailability += (hook_UpdateAvailability)delegate(orig_UpdateAvailability orig, SurvivorIconController self)
			{
				orig.Invoke(self);
				if (!Main.UnlockCharacterSelect.Value)
				{
					self.survivorIsAvailable = (Object)(object)self == (Object)(object)allowedIconController;
				}
			};
			CharacterSelectController.OnEnable += new hook_OnEnable(Boink);
		}

		private void Boink(orig_OnEnable orig, CharacterSelectController self)
		{
			//IL_021b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0225: Expected O, but got Unknown
			//IL_00c6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00cb: Unknown result type (might be due to invalid IL or missing references)
			//IL_0168: Unknown result type (might be due to invalid IL or missing references)
			//IL_016d: Unknown result type (might be due to invalid IL or missing references)
			//IL_01cb: Unknown result type (might be due to invalid IL or missing references)
			//IL_01d0: Unknown result type (might be due to invalid IL or missing references)
			orig.Invoke(self);
			if (Main.UnlockCharacterSelect.Value)
			{
				return;
			}
			GauntletLoadout currentLoadout = LoadoutHandler.GetLoadout(Main.CurrentLoadout.Value);
			SurvivorDef surv = SurvivorCatalog.allSurvivorDefs.FirstOrDefault((Func<SurvivorDef, bool>)((SurvivorDef x) => x.displayNameToken == GauntletCatalog.GetSurvivorNameFromId(currentLoadout.id)));
			Log.LogDebug("boinked");
			if (currentLoadout != null && surv != null)
			{
				int num = 0;
				int[] array = new int[3]
				{
					Convert.ToInt32(currentLoadout.skill1),
					Convert.ToInt32(currentLoadout.skill2),
					Convert.ToInt32(currentLoadout.skill3)
				};
				GenericSkill[] bodyPrefabSkillSlots = BodyCatalog.GetBodyPrefabSkillSlots(SurvivorCatalog.GetBodyIndexFromSurvivorIndex(surv.survivorIndex));
				foreach (GenericSkill val in bodyPrefabSkillSlots)
				{
					Log.LogDebug("Starting to save variants for " + Language.GetString(surv.displayNameToken));
					if (ogVariants.ContainsKey(val))
					{
						val.skillFamily.variants = ogVariants[val];
					}
					else
					{
						Log.LogInfo("Saving original loadout for dupes");
						Variant[] array2 = (Variant[])(object)new Variant[val.skillFamily.variants.Length];
						int num2 = 0;
						while (num2 < array2.Length)
						{
							array2[num2] = val.skillFamily.variants[num2++];
						}
						ogVariants.Add(val, array2);
					}
					if (val.skillFamily.variants.Length > 1 && num < array.Length)
					{
						val.skillFamily.defaultVariantIndex = 0u;
						Variant[] array3 = (Variant[])(object)new Variant[1] { val.skillFamily.variants[array[num++]] };
						val.skillFamily.variants = array3;
						Log.LogDebug("Variant selected: " + array3[0].skillDef.skillName);
					}
				}
			}
			NetworkUser.SetSurvivorPreferenceClient += new hook_SetSurvivorPreferenceClient(UpdateButton);
			void UpdateButton(orig_SetSurvivorPreferenceClient org, NetworkUser slf, SurvivorDef huh)
			{
				//IL_0045: Unknown result type (might be due to invalid IL or missing references)
				//IL_004f: Expected O, but got Unknown
				org.Invoke(slf, huh);
				SetOnes(self.localUser.userProfile, surv);
				self.localUser.userProfile.OnLoadoutChanged();
				NetworkUser.SetSurvivorPreferenceClient -= new hook_SetSurvivorPreferenceClient(UpdateButton);
			}
		}

		private void OnlyBuildAllowedSurvivors(orig_Build orig, CharacterSelectBarController self)
		{
			if (Main.UnlockCharacterSelect.Value)
			{
				orig.Invoke(self);
				return;
			}
			List<GauntletLoadout> survivors = LoadoutHandler.StoredLoadouts;
			int num = 0;
			List<SurvivorDef> list = new List<SurvivorDef>();
			int i;
			for (i = 0; i < survivors.Count; i++)
			{
				Log.LogDebug("Searching for survivor " + survivors[i].id + ", or " + GauntletCatalog.GetSurvivorNameFromId(survivors[i].id));
				int num2 = SurvivorCatalog.allSurvivorDefs.ToList().FindIndex((SurvivorDef x) => GauntletCatalog.GetSurvivorNameFromId(survivors[i].id) == x.displayNameToken);
				SurvivorDef val = null;
				if (num2 != -1)
				{
					val = SurvivorCatalog.allSurvivorDefs.ToList()[num2];
				}
				if (val != null && self.ShouldDisplaySurvivor(val))
				{
					list.Add(val);
					if (i == Main.CurrentLoadout.Value)
					{
						num = i;
					}
					else if (Main.CurrentLoadout.Value >= LoadoutHandler.StoredLoadouts.Count)
					{
						num = 0;
					}
				}
			}
			int count = list.Count;
			int num3 = Math.Max(CharacterSelectBarController.CalcGridCellCount(count, self.iconContainerGrid.constraintCount) - count, 0);
			self.survivorIconControllers.AllocateElements(count);
			self.fillerIcons.AllocateElements(num3);
			self.fillerIcons.MoveElementsToContainerEnd();
			ReadOnlyCollection<SurvivorIconController> elements = self.survivorIconControllers.elements;
			for (int j = 0; j < count; j++)
			{
				SurvivorDef survivorDef = list[j];
				SurvivorIconController val2 = elements[j];
				val2.survivorDef = survivorDef;
				((MPButton)val2.hgButton).defaultFallbackButton = j == num;
				if (j != num)
				{
					Log.LogDebug("Locking Survivor " + list[j].cachedName);
					continue;
				}
				((MPButton)val2.hgButton).InvokeClick();
				allowedIconController = val2;
			}
		}

		private void SetOnes(UserProfile profile, SurvivorDef surv)
		{
			//IL_0038: Unknown result type (might be due to invalid IL or missing references)
			//IL_003d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0042: 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_006c: Unknown result type (might be due to invalid IL or missing references)
			BodyLoadoutManager bodyLoadoutManager = profile.loadout.bodyLoadoutManager;
			if (LoadoutHandler.StoredLoadouts.Find((GauntletLoadout x) => GauntletCatalog.GetSurvivorNameFromId(x.id) == surv.displayNameToken) != null)
			{
				BodyIndex bodyIndexFromSurvivorIndex = SurvivorCatalog.GetBodyIndexFromSurvivorIndex(surv.survivorIndex);
				int num = 0;
				GenericSkill[] bodyPrefabSkillSlots = BodyCatalog.GetBodyPrefabSkillSlots(bodyIndexFromSurvivorIndex);
				for (int i = 0; i < bodyPrefabSkillSlots.Length; i++)
				{
					Log.LogDebug(bodyPrefabSkillSlots[i].skillName + " variant being selected");
					bodyLoadoutManager.SetSkillVariant(bodyIndexFromSurvivorIndex, num, 0u);
					num++;
				}
			}
		}
	}
	public class LoadoutRandomizer
	{
		public class Survivor
		{
			public char id;

			public string name;

			public SurvivorIndex survivorIndex;

			public BodyIndex bodyIndex;

			public List<int> skills;

			public Survivor()
			{
				skills = new List<int>();
			}

			public string GetIDString()
			{
				string text = id.ToString() ?? "";
				for (int i = 0; i < 3; i++)
				{
					text += ((i < skills.Count) ? ((object)skills[i]) : "0");
				}
				return text;
			}
		}

		private static Xoroshiro128Plus rng;

		public static List<Survivor> SurvivorList = new List<Survivor>();

		public static Dictionary<GenericSkill, Variant[]> imdumb = new Dictionary<GenericSkill, Variant[]>();

		public LoadoutRandomizer(Xoroshiro128Plus newRng)
		{
			rng = newRng;
		}

		public void LoadoutBuilder()
		{
			//IL_0051: Unknown result type (might be due to invalid IL or missing references)
			//IL_0056: Unknown result type (might be due to invalid IL or missing references)
			//IL_005b: Unknown result type (might be due to invalid IL or missing references)
			//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_009f: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00fd: Unknown result type (might be due to invalid IL or missing references)
			//IL_0102: Unknown result type (might be due to invalid IL or missing references)
			SurvivorList.Clear();
			Log.LogDebug("Loadout Builder initialised.");
			char c = 'A';
			foreach (SurvivorDef allSurvivorDef in SurvivorCatalog.allSurvivorDefs)
			{
				if (allSurvivorDef.displayNameToken == "HERETIC_BODY_NAME")
				{
					c = (char)(c + 1);
					continue;
				}
				Survivor survivor = new Survivor();
				BodyIndex bodyIndexFromSurvivorIndex = SurvivorCatalog.GetBodyIndexFromSurvivorIndex(allSurvivorDef.survivorIndex);
				survivor.id = c;
				survivor.name = Language.GetString(allSurvivorDef.displayNameToken);
				if (allSurvivorDef.displayNameToken == "VOIDSURVIVOR_BODY_NAME")
				{
					survivor.name = "Void Fiend";
				}
				survivor.survivorIndex = allSurvivorDef.survivorIndex;
				survivor.bodyIndex = bodyIndexFromSurvivorIndex;
				GenericSkill[] bodyPrefabSkillSlots = BodyCatalog.GetBodyPrefabSkillSlots(bodyIndexFromSurvivorIndex);
				foreach (GenericSkill val in bodyPrefabSkillSlots)
				{
					if (!imdumb.ContainsKey(val))
					{
						Variant[] array = (Variant[])(object)new Variant[val.skillFamily.variants.Length];
						int num = 0;
						while (num < array.Length)
						{
							array[num] = val.skillFamily.variants[num++];
						}
						imdumb.Add(val, array);
					}
					else
					{
						val.skillFamily.variants = imdumb[val];
					}
					if (val.skillFamily.variants.Length > 1)
					{
						int item = rng.RangeInt(0, val.skillFamily.variants.Length);
						survivor.skills.Add(item);
					}
				}
				SurvivorList.Add(survivor);
				Log.LogInfo("Survivor: " + survivor.name + " added.");
				c = (char)(c + 1);
			}
			Log.LogInfo($"No of loadouts generated: {SurvivorList.Count}");
		}

		public Survivor GetSurvivor()
		{
			if (Main.AllowDupesBool.Value || SurvivorList.Count == 0)
			{
				LoadoutBuilder();
			}
			int index = rng.RangeInt(0, SurvivorList.Count);
			Survivor result = SurvivorList[index];
			SurvivorList.RemoveAt(index);
			return result;
		}
	}
	internal static class Log
	{
		internal static ManualLogSource _logSource;

		internal static void Init(ManualLogSource logSource)
		{
			_logSource = logSource;
		}

		internal static void LogDebug(object data)
		{
			_logSource.LogDebug(data);
		}

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

		internal static void LogFatal(object data)
		{
			_logSource.LogFatal(data);
		}

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

		internal static void LogMessage(object data)
		{
			_logSource.LogMessage(data);
		}

		internal static void LogWarning(object data)
		{
			_logSource.LogWarning(data);
		}
	}
	internal class Loop
	{
		[Serializable]
		[CompilerGenerated]
		private sealed class <>c
		{
			public static readonly <>c <>9 = new <>c();

			public static hook_OnEnter <>9__0_0;

			public static hook_OnEnter <>9__0_1;

			public static Func<bool, TeleporterInteraction, bool> <>9__1_1;

			internal void <.ctor>b__0_0(orig_OnEnter orig, ActiveToIdle self)
			{
				orig.Invoke(self);
				((LunarTeleporterBaseState)self).teleporterInteraction.locked = true;
			}

			internal void <.ctor>b__0_1(orig_OnEnter orig, IdleToActive self)
			{
				orig.Invoke(self);
				((LunarTeleporterBaseState)self).teleporterInteraction.locked = false;
			}

			internal bool <NoBlueOrb>b__1_1(bool orb, TeleporterInteraction teleporter)
			{
				if (orb)
				{
					return !((Object)teleporter).name.StartsWith("LunarTeleporter");
				}
				return false;
			}
		}

		internal Loop(ConfigFile configuration)
		{
			//IL_005c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0061: Unknown result type (might be due to invalid IL or missing references)
			//IL_0067: Expected O, but got Unknown
			//IL_0097: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a1: Expected O, but got Unknown
			//IL_0080: Unknown result type (might be due to invalid IL or missing references)
			//IL_0085: Unknown result type (might be due to invalid IL or missing references)
			//IL_008b: Expected O, but got Unknown
			if (!(((configuration != null) ? new bool?(configuration.Bind<bool>("Run", "Loop Protection", true, "Keep the player from accidentally looping. Still allowed via Newt/Reliquary.").Value) : null) ?? true))
			{
				return;
			}
			object obj = <>c.<>9__0_0;
			if (obj == null)
			{
				hook_OnEnter val = delegate(orig_OnEnter orig, ActiveToIdle self)
				{
					orig.Invoke(self);
					((LunarTeleporterBaseState)self).teleporterInteraction.locked = true;
				};
				<>c.<>9__0_0 = val;
				obj = (object)val;
			}
			ActiveToIdle.OnEnter += (hook_OnEnter)obj;
			object obj2 = <>c.<>9__0_1;
			if (obj2 == null)
			{
				hook_OnEnter val2 = delegate(orig_OnEnter orig, IdleToActive self)
				{
					orig.Invoke(self);
					((LunarTeleporterBaseState)self).teleporterInteraction.locked = false;
				};
				<>c.<>9__0_1 = val2;
				obj2 = (object)val2;
			}
			IdleToActive.OnEnter += (hook_OnEnter)obj2;
			TeleporterInteraction.Start += new Manipulator(NoBlueOrb);
		}

		private void NoBlueOrb(ILContext context)
		{
			//IL_0026: Unknown result type (might be due to invalid IL or missing references)
			//IL_002c: Expected O, but got Unknown
			//IL_0049: Unknown result type (might be due to invalid IL or missing references)
			MethodInfo method = typeof(TeleporterInteraction).GetProperty("shouldAttemptToSpawnShopPortal").SetMethod;
			ILCursor val = new ILCursor(context);
			val.GotoNext(new Func<Instruction, bool>[1]
			{
				(Instruction i) => ILPatternMatchingExt.MatchCallOrCallvirt(i, (MethodBase)method)
			});
			val.Emit(OpCodes.Ldarg_0);
			val.EmitDelegate<Func<bool, TeleporterInteraction, bool>>((Func<bool, TeleporterInteraction, bool>)((bool orb, TeleporterInteraction teleporter) => orb && !((Object)teleporter).name.StartsWith("LunarTeleporter")));
		}
	}
	public class LunarShopConfiguration
	{
		private bool lunar;

		private bool seer;

		private bool limited;

		public LunarShopConfiguration(ConfigFile configuration)
		{
			//IL_0025: Unknown result type (might be due to invalid IL or missing references)
			//IL_002f: Expected O, but got Unknown
			//IL_0036: Unknown result type (might be due to invalid IL or missing references)
			//IL_0040: Expected O, but got Unknown
			Load(configuration);
			Stage.onServerStageBegin += SetupBazaar;
			Run.RefreshLunarCombinedDropList += (hook_RefreshLunarCombinedDropList)delegate(orig_RefreshLunarCombinedDropList orig, Run self)
			{
				orig.Invoke(self);
				if (limited)
				{
					LimitLunarItems(self);
				}
			};
			SceneExitController.Begin += (hook_Begin)delegate(orig_Begin orig, SceneExitController self)
			{
				if (limited)
				{
					RemoveLunarItems();
				}
				orig.Invoke(self);
			};
		}

		private void Load(ConfigFile configuration)
		{
			lunar = configuration.Bind<bool>("Bazaar & Lunar Items", "Lunar Shop Terminal", false, "Enable to purchase lunar items at the Bazaar Between Time.").Value;
			seer = configuration.Bind<bool>("Bazaar & Lunar Items", "Seer Station", false, "Determines if the next stage can be chosen here.").Value;
			limited = configuration.Bind<bool>("Bazaar & Lunar Items", "Lunar Lockdown", true, "Only valid for use at a Cleansing Pool on the same stage.").Value;
		}

		private void SetupBazaar(Stage stage)
		{
			SceneDef sceneDef = stage.sceneDef;
			if ("bazaar" == ((sceneDef != null) ? sceneDef.baseSceneName : null))
			{
				SetActive("LunarShopTerminal", lunar);
				SetActive("LunarTable", lunar);
				SetActive("LunarRecycler", lunar && !limited);
				SetActive("SeerStation", seer);
			}
		}

		private void LimitLunarItems(Run run)
		{
			//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_000f: 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_0043: Unknown result type (might be due to invalid IL or missing references)
			PickupIndex item = PickupCatalog.FindPickupIndex(Items.LunarTrinket.itemIndex);
			run.availableLunarEquipmentDropList.Clear();
			run.availableLunarItemDropList.Clear();
			run.availableLunarCombinedDropList.Clear();
			run.availableLunarItemDropList.Add(item);
			run.availableLunarCombinedDropList.Add(item);
		}

		private void RemoveLunarItems()
		{
			ItemDef lunarTrinket = Items.LunarTrinket;
			foreach (PlayerCharacterMasterController instance in PlayerCharacterMasterController._instances)
			{
				CharacterBody body = instance.body;
				int itemCount = body.inventory.GetItemCount(lunarTrinket);
				if (itemCount > 0)
				{
					body.inventory.RemoveItem(lunarTrinket, itemCount);
					Debug.Log((object)$"Removed {itemCount} lunars from inventory");
				}
				else
				{
					Debug.Log((object)"No lunars to remove from inventory");
				}
			}
		}

		private static void SetActive(string name, bool state)
		{
			GameObject[] array = Object.FindObjectsOfType<GameObject>();
			foreach (GameObject val in array)
			{
				if (((Object)val).name.StartsWith(name))
				{
					val.SetActive(state);
				}
			}
		}
	}
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInPlugin("RiskOfResources.PublicRoRGauntlet", "PublicRoRGauntlet", "2.0.0")]
	public class Main : BaseUnityPlugin
	{
		[Serializable]
		[CompilerGenerated]
		private sealed class <>c
		{
			public static readonly <>c <>9 = new <>c();

			public static hook_Init <>9__61_0;

			internal void <Awake>b__61_0(orig_Init orig)
			{
				orig.Invoke();
				GauntletCatalog.Init();
				GauntletGenerator.UpdateGenerator(ulong.Parse(CurrentGauntletSeed.Value));
			}
		}

		public const string PluginGUID = "RiskOfResources.PublicRoRGauntlet";

		public const string PluginAuthor = "RiskOfResources";

		public const string PluginName = "PublicRoRGauntlet";

		public const string PluginVersion = "2.0.0";

		public static bool ConcedeCheck;

		private LazarusResurrection _lazarusResurrection;

		private SeerPortalDisable _seerPortalDisable;

		private LazarusWings _lazarusWings;

		private SubmitRun _submitRun;

		private ConcedeUI _concedeUI;

		private StageRNG _stageRNG;

		private LoadoutLockIn _loadoutLockIn;

		private RepurposeMailingList _repurposeMailingList;

		private ForceRules _forceRules;

		private SeededRecycler _seededRecycler;

		private ReconfigurePillars _reconfigurePillars;

		private SpeedrunVerification _speedrunVerification;

		public static Main instance;

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

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

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

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

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

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

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

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

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

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

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

		public void Awake()
		{
			//IL_00f3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f8: Unknown result type (might be due to invalid IL or missing references)
			//IL_00fe: Expected O, but got Unknown
			instance = this;
			Log.Init(((BaseUnityPlugin)this).Logger);
			Files.Init(((BaseUnityPlugin)this).Info);
			_lazarusWings = new LazarusWings();
			InitConfig();
			Assets.Initialize();
			_lazarusResurrection = new LazarusResurrection();
			_submitRun = new SubmitRun();
			_concedeUI = new ConcedeUI();
			_stageRNG = new StageRNG(EnableFullySeeded.Value);
			_seerPortalDisable = new SeerPortalDisable();
			_loadoutLockIn = new LoadoutLockIn();
			_repurposeMailingList = new RepurposeMailingList();
			_forceRules = new ForceRules();
			_seededRecycler = new SeededRecycler();
			_reconfigurePillars = new ReconfigurePillars();
			_speedrunVerification = new SpeedrunVerification();
			new LunarShopConfiguration(((BaseUnityPlugin)this).Config);
			new BugFix();
			new ItemTransformation();
			new Loop(((BaseUnityPlugin)this).Config);
			new DLC2();
			object obj = <>c.<>9__61_0;
			if (obj == null)
			{
				hook_Init val = delegate(orig_Init orig)
				{
					orig.Invoke();
					GauntletCatalog.Init();
					GauntletGenerator.UpdateGenerator(ulong.Parse(CurrentGauntletSeed.Value));
				};
				<>c.<>9__61_0 = val;
				obj = (object)val;
			}
			SurvivorCatalog.Init += (hook_Init)obj;
		}

		public void InitConfig()
		{
			//IL_012b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0135: Expected O, but got Unknown
			//IL_01ca: Unknown result type (might be due to invalid IL or missing references)
			//IL_01d4: Expected O, but got Unknown
			CurrentLoadout = ((BaseUnityPlugin)this).Config.Bind<int>("Player", "Number of victories", 0, "Stored as a config to account for the possibility of power outages - Setting this manually would be cheating.");
			CurrentGauntletSeed = ((BaseUnityPlugin)this).Config.Bind<string>("Player", "The seed for the gauntlet generator", "0", "Stored as a config to allow reloading - Setting this manually would be sus, but it won't reset your wins");
			EnableFullySeeded = ((BaseUnityPlugin)this).Config.Bind<bool>("Run", "Fully seeded runs", true, "Enabling this forces all dropped items to be locked to the run's seed");
			SpeedrunMode = ((BaseUnityPlugin)this).Config.Bind<bool>("Run", "Speedrun Mode", false, "Automatically open the console and list mods after a run, and makes sure your runs are verified - To be used to verify speedruns");
			ConcedeButtonPosition = ((BaseUnityPlugin)this).Config.Bind<string>("UI", "ConcedePosition", "bottom", "The position of the concede button in the pause menu. Options are 'top', 'bottom', or the number of positions away from the top, so '1' would be 1 below the top item and thus second in the list. Falls back to default if you give weird values.");
			AllowDupesBool = ((BaseUnityPlugin)this).Config.Bind<bool>("Game Rules", "Allow duplicate survivors?", false, "Set to false to ensure that no duplicate survivors are added to the loadouts.");
			UnlockCharacterSelect = ((BaseUnityPlugin)this).Config.Bind<bool>("Game Rules", "Unlock Characters", false, "Whether the character select should be fully accessible");
			PillarNum = ((BaseUnityPlugin)this).Config.Bind<int>("Game Rules", "Pillar Num", 2, "Port of RiskyMod's pillar config which lowers the needed amount of pillars in the races");
			GauntletSize = ((BaseUnityPlugin)this).Config.Bind<int>("Game Rules", "Gauntlet Size", 4, new ConfigDescription("How many loadouts you are running in the gauntlet. More than 4 may take... awhile", (AcceptableValueBase)(object)new AcceptableValueRange<int>(1, 20), Array.Empty<object>()));
			string[] array = new string[12]
			{
				"Eclipse8", "Eclipse7", "Eclipse6", "Eclipse5", "Eclipse4", "Eclipse3", "Eclipse2", "Eclipse1", "Hard", "Normal",
				"Easy", "Any"
			};
			DifficultySelect = ((BaseUnityPlugin)this).Config.Bind<string>("Game Rules", "Race Difficulty", "Eclipse8", new ConfigDescription("The difficulty all racers will be forced to play on", (AcceptableValueBase)(object)new AcceptableValueList<string>(array), Array.Empty<object>()));
			UseLazarusDeathEffect = ((BaseUnityPlugin)this).Config.Bind<bool>("Visuals", "Use Unique Lazurus Wings Death Effect?", true, "Set to false if you want to use Dio's death effect instead.");
		}
	}
	public class GetLoadouts
	{
		public int statusCode { get; set; }

		public LoadoutBody body { get; set; }
	}
	public class Item
	{
		public string ID { get; set; }

		public List<List<object>> RaceList { get; set; }
	}
	public class LoadoutBody
	{
		public Item Item { get; set; }
	}
	public class ProperSaveDependencyWrapper
	{
		private const string SAVE_NAME_PATH = "RoRGauntlet.";

		private static bool? _enabled;

		private static StageRNG rngData;

		public static bool enabled
		{
			get
			{
				if (!_enabled.HasValue)
				{
					_enabled = Chainloader.PluginInfos.ContainsKey("com.KingEnderBrine.ProperSave");
				}
				return _enabled.Value;
			}
		}

		public static bool loadingSave { get; set; }

		[MethodImpl(MethodImplOptions.NoInlining | MethodImplOptions.NoOptimization)]
		public static void SaveProperRng()
		{
			SaveFile.OnGatherSaveData += AddLockboxRngs;
			Loading.OnLoadingStarted += ExportRngsToSave;
		}

		[MethodImpl(MethodImplOptions.NoInlining | MethodImplOptions.NoOptimization)]
		private static void ExportRngsToSave(SaveFile obj)
		{
			//IL_0021: Unknown result type (might be due to invalid IL or missing references)
			//IL_0028: Expected O, but got Unknown
			loadingSave = true;
			Dictionary<string, Xoroshiro128Plus> dictionary = new Dictionary<string, Xoroshiro128Plus>();
			string[] namedRngs = rngData.NamedRngs;
			foreach (string text in namedRngs)
			{
				Xoroshiro128Plus value = new Xoroshiro128Plus(0uL);
				obj.GetModdedData<RngData>("RoRGauntlet." + text).LoadDataRef(ref value);
				dictionary.Add(text, value);
			}
			Log.LogDebug("Loaded special RNGS");
			rngData.ImportRNGs(dictionary);
		}

		[MethodImpl(MethodImplOptions.NoInlining | MethodImplOptions.NoOptimization)]
		public static void LoadProperRng(StageRNG rng)
		{
			rngData = rng;
		}

		private static void AddLockboxRngs(Dictionary<string, object> obj)
		{
			//IL_0028: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Expected O, but got Unknown
			Dictionary<string, Xoroshiro128Plus> dictionary = rngData.ExportRNGs();
			foreach (string key in dictionary.Keys)
			{
				RngData value = new RngData(dictionary[key]);
				obj.Add("RoRGauntlet." + key, value);
			}
			Log.LogDebug("Saved special RNGS");
		}
	}
	public class ReconfigurePillars
	{
		public ReconfigurePillars()
		{
			//IL_000d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0017: Expected O, but got Unknown
			MoonBatteryMissionController.OnEnable += new hook_OnEnable(LessPillars);
		}

		private void LessPillars(orig_OnEnable orig, MoonBatteryMissionController self)
		{
			orig.Invoke(self);
			self._numRequiredBatteries = Main.PillarNum.Value;
		}
	}
	public class RepurposeMailingList
	{
		[CompilerGenerated]
		private static class <>O
		{
			public static hook_SignupCompleted <0>__No;

			public static hook_ProcessAppTicketRefresh <1>__No;
		}

		public RepurposeMailingList()
		{
			//IL_000d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0017: Expected O, but got Unknown
			//IL_001e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0028: Expected O, but got Unknown
			//IL_002f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0039: Expected O, but got Unknown
			//IL_0040: Unknown result type (might be due to invalid IL or missing references)
			//IL_004a: Expected O, but got Unknown
			//IL_005a: Unknown result type (might be due to invalid IL or missing references)
			//IL_005f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0065: Expected O, but got Unknown
			//IL_0091: Unknown result type (might be due to invalid IL or missing references)
			//IL_009b: Expected O, but got Unknown
			//IL_007a: Unknown result type (might be due to invalid IL or missing references)
			//IL_007f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0085: Expected O, but got Unknown
			SignupMainMenuScreen.OnEnable += new hook_OnEnable(RewriteText);
			SignupMainMenuScreen.TrySubmit += new hook_TrySubmit(DontSubmitNerd);
			SignupMainMenuScreen.CheckViewable += new hook_CheckViewable(ItIsViewable);
			SignupMainMenuScreen.Update += new hook_Update(AlwaysAllowLeClick);
			object obj = <>O.<0>__No;
			if (obj == null)
			{
				hook_SignupCompleted val = No<orig_SignupCompleted, SignupMainMenuScreen, string, HttpStatusCode>;
				<>O.<0>__No = val;
				obj = (object)val;
			}
			SignupMainMenuScreen.SignupCompleted += (hook_SignupCompleted)obj;
			object obj2 = <>O.<1>__No;
			if (obj2 == null)
			{
				hook_ProcessAppTicketRefresh val2 = No<orig_ProcessAppTicketRefresh, SignupMainMenuScreen, bool, byte[]>;
				<>O.<1>__No = val2;
				obj2 = (object)val2;
			}
			SignupMainMenuScreen.ProcessAppTicketRefresh += (hook_ProcessAppTicketRefresh)obj2;
			MainMenuController.SetDesiredMenuScreen += new hook_SetDesiredMenuScreen(SetDesiredMenuScreen);
			Language.onCurrentLanguageChanged += ChangeCurrentLanguage;
		}

		private void ChangeCurrentLanguage()
		{
			Language currentLanguage = Language.currentLanguage;
			currentLanguage.SetStringByToken("TITLE_MUSIC_DESC", "Select the seed for the gauntlet that you'll be running!");
			currentLanguage.SetStringByToken("TITLE_MUSIC", "Gauntlet Code");
		}

		private void SetDesiredMenuScreen(orig_SetDesiredMenuScreen orig, MainMenuController self, BaseMainMenuScreen target)
		{
			if ((Object)(object)self.moreMenuScreen == (Object)(object)target)
			{
				target = (BaseMainMenuScreen)(object)Object.FindObjectOfType<SignupMainMenuScreen>(true);
			}
			else if (target == null)
			{
				target = self.titleMenuScreen;
			}
			orig.Invoke(self, target);
		}

		private void AlwaysAllowLeClick(orig_Update orig, SignupMainMenuScreen self)
		{
			if (SimpleDialogBox.instancesList.Count == 0)
			{
				FirstSelectedObjectProvider firstSelectedObjectProvider = ((BaseMainMenuScreen)self).firstSelectedObjectProvider;
				if (firstSelectedObjectProvider != null)
				{
					firstSelectedObjectProvider.EnsureSelectedObject();
				}
			}
			if (Object.op_Implicit((Object)(object)self.submitButton))
			{
				((Selectable)self.submitButton).interacta