Decompiled source of DiluvianArtifact v1.2.0

plugins/DiluvianArtifact/DiluvianArtifact.dll

Decompiled 2 months ago
using System;
using System.CodeDom.Compiler;
using System.Collections;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.ComponentModel;
using System.Diagnostics;
using System.Globalization;
using System.Linq;
using System.Reflection;
using System.Resources;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using BepInEx;
using BepInEx.Bootstrap;
using BepInEx.Configuration;
using EntityStates.BrotherHaunt;
using EntityStates.LunarExploderMonster;
using EntityStates.VagrantMonster;
using IL.RoR2;
using Mono.Cecil.Cil;
using MonoMod.Cil;
using On.EntityStates.BrotherHaunt;
using On.RoR2;
using On.RoR2.UI;
using RoR2;
using RoR2.ContentManagement;
using RoR2.Navigation;
using RoR2.Projectile;
using RoR2.UI;
using TMPro;
using TPDespair.DiluvianArtifact.Properties;
using UnityEngine;
using UnityEngine.Networking;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = "")]
[assembly: AssemblyCompany("DiluvianArtifact")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("DiluvianArtifact")]
[assembly: AssemblyTitle("DiluvianArtifact")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.0.0")]
[module: UnverifiableCode]
namespace TPDespair.DiluvianArtifact
{
	public class DiluvianArtifactContent : IContentPackProvider
	{
		public static class Artifacts
		{
			public static ArtifactDef Diluvifact;

			public static ArtifactDef ZetEclifact;

			public static ArtifactDef ZetUnstabifact;

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

			public static void Create()
			{
				//IL_0055: Unknown result type (might be due to invalid IL or missing references)
				//IL_006e: Unknown result type (might be due to invalid IL or missing references)
				//IL_00e2: Unknown result type (might be due to invalid IL or missing references)
				//IL_00fb: Unknown result type (might be due to invalid IL or missing references)
				//IL_016f: Unknown result type (might be due to invalid IL or missing references)
				//IL_0188: Unknown result type (might be due to invalid IL or missing references)
				if (DiluvianArtifactPlugin.DiluvifactEnable.Value == 1)
				{
					Diluvifact = ScriptableObject.CreateInstance<ArtifactDef>();
					Diluvifact.cachedName = "ARTIFACT_DILUVIFACT";
					Diluvifact.nameToken = "ARTIFACT_DILUVIFACT_NAME";
					Diluvifact.descriptionToken = "ARTIFACT_DILUVIFACT_DESC";
					Diluvifact.smallIconSelectedSprite = DiluvianArtifactPlugin.CreateSprite(Resources.zetdiluvianabstract_selected, Color.magenta);
					Diluvifact.smallIconDeselectedSprite = DiluvianArtifactPlugin.CreateSprite(Resources.zetdiluvianabstract_deselected, Color.gray);
					artifactDefs.Add(Diluvifact);
				}
				if (DiluvianArtifactPlugin.UnstabifactEnable.Value == 1)
				{
					ZetUnstabifact = ScriptableObject.CreateInstance<ArtifactDef>();
					ZetUnstabifact.cachedName = "ARTIFACT_ZETUNSTABIFACT";
					ZetUnstabifact.nameToken = "ARTIFACT_ZETUNSTABIFACT_NAME";
					ZetUnstabifact.descriptionToken = "ARTIFACT_ZETUNSTABIFACT_DESC";
					ZetUnstabifact.smallIconSelectedSprite = DiluvianArtifactPlugin.CreateSprite(Resources.zetunstable_selected, Color.magenta);
					ZetUnstabifact.smallIconDeselectedSprite = DiluvianArtifactPlugin.CreateSprite(Resources.zetunstable_deselected, Color.gray);
					artifactDefs.Add(ZetUnstabifact);
				}
				if (DiluvianArtifactPlugin.EclifactEnable.Value == 1)
				{
					ZetEclifact = ScriptableObject.CreateInstance<ArtifactDef>();
					ZetEclifact.cachedName = "ARTIFACT_ZETECLIFACT";
					ZetEclifact.nameToken = "ARTIFACT_ZETECLIFACT_NAME";
					ZetEclifact.descriptionToken = "ARTIFACT_ZETECLIFACT_DESC";
					ZetEclifact.smallIconSelectedSprite = DiluvianArtifactPlugin.CreateSprite(Resources.zeteclipse_selected, Color.magenta);
					ZetEclifact.smallIconDeselectedSprite = DiluvianArtifactPlugin.CreateSprite(Resources.zeteclipse_deselected, Color.gray);
					artifactDefs.Add(ZetEclifact);
				}
			}
		}

		public static class Buffs
		{
			public static BuffDef ZetLunarBleed;

			public static List<BuffDef> buffDefs = new List<BuffDef>();

			public static void Create()
			{
				//IL_0041: 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)
				if (DiluvianArtifactPlugin.UnstabifactEnable.Value > 0)
				{
					ZetLunarBleed = ScriptableObject.CreateInstance<BuffDef>();
					((Object)ZetLunarBleed).name = "ZetLunarBleed";
					ZetLunarBleed.buffColor = new Color(0.3f, 0.6f, 1f);
					ZetLunarBleed.canStack = true;
					ZetLunarBleed.isDebuff = true;
					ZetLunarBleed.iconSprite = LegacyResourcesAPI.Load<BuffDef>("BuffDefs/Bleeding").iconSprite;
					buffDefs.Add(ZetLunarBleed);
				}
			}
		}

		public ContentPack contentPack = new ContentPack();

		public string identifier => "DiluvianArtifactContent";

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

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

		public IEnumerator FinalizeAsync(FinalizeAsyncArgs args)
		{
			args.ReportProgress(1f);
			yield break;
		}
	}
	[BepInPlugin("com.TPDespair.DiluvianArtifact", "DiluvianArtifact", "1.2.0")]
	public class DiluvianArtifactPlugin : BaseUnityPlugin
	{
		[Serializable]
		[CompilerGenerated]
		private sealed class <>c
		{
			public static readonly <>c <>9 = new <>c();

			public static hook_TokenIsRegistered <>9__53_0;

			public static hook_GetString_string <>9__53_1;

			internal bool <LanguageOverride>b__53_0(orig_TokenIsRegistered orig, Language self, string token)
			{
				if (token != null)
				{
					if (TriggerSyzygyText() && SyzygyTokens.ContainsKey(token))
					{
						return true;
					}
					if (LangTokens.ContainsKey(token))
					{
						return true;
					}
				}
				return orig.Invoke(self, token);
			}

			internal string <LanguageOverride>b__53_1(orig_GetString_string orig, string token)
			{
				if (token != null)
				{
					if (TriggerSyzygyText() && SyzygyTokens.ContainsKey(token))
					{
						return SyzygyTokens[token];
					}
					if (LangTokens.ContainsKey(token))
					{
						return LangTokens[token];
					}
				}
				return orig.Invoke(token);
			}
		}

		public const string ModVer = "1.2.0";

		public const string ModName = "DiluvianArtifact";

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

		public static Dictionary<string, string> LangTokens = new Dictionary<string, string>();

		public static Dictionary<string, string> SyzygyTokens = new Dictionary<string, string>();

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

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

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

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

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

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

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

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

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

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

		public void Awake()
		{
			//IL_002f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0039: Expected O, but got Unknown
			RoR2Application.isModded = true;
			NetworkModCompatibilityHelper.networkModList = NetworkModCompatibilityHelper.networkModList.Append("com.TPDespair.DiluvianArtifact:1.2.0");
			ConfigSetup(((BaseUnityPlugin)this).Config);
			ContentManager.collectContentPackProviders += new CollectContentPackProvidersDelegate(ContentManager_collectContentPackProviders);
			LanguageOverride();
			Diluvifact.Init();
			ZetUnstabifact.Init();
			ZetEclifact.Init();
			RoR2Application.onLoad = (Action)Delegate.Combine(RoR2Application.onLoad, new Action(LateSetup));
		}

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

		private static void LateSetup()
		{
			Diluvifact.LateSetup();
			ZetUnstabifact.LateSetup();
		}

		private static void ConfigSetup(ConfigFile Config)
		{
			DiluvifactEnable = Config.Bind<int>("Artifacts", "diluvifactEnable", 1, "Artifact of Diluvian. 0 = Disabled, 1 = Artifact Available, 2 = Always Active");
			SyzygyText = Config.Bind<bool>("Artifacts", "syzygyText", true, "Diluvian and Eclipse 8 change some text.");
			SyzygyHideScore = Config.Bind<bool>("Artifacts", "syzygyHideScore", false, "Diluvian and Eclipse 8 hides scores on run report.");
			DiluvifactDifficulty = Config.Bind<float>("Artifacts", "diluvifactDifficultyMult", 1.2f, "Diluvian difficulty multiplier. Set to 1 or lower to disable.");
			DiluvifactAntiHeal = Config.Bind<bool>("Artifacts", "diluvifactAntiHeal", true, "Diluvian causes BloodShrines to disable healing for 8 seconds.");
			UnstabifactEnable = Config.Bind<int>("Artifacts", "unstabifactEnable", 1, "Artifact of Instability. 0 = Disabled, 1 = Artifact Available, 2 = Always Active");
			UnstabifactDisplayDifficulty = Config.Bind<bool>("Artifacts", "unstabifactDisplayDifficulty", false, "Show Difficulty of Instability on HUD.");
			UnstabifactBaseTimer = Config.Bind<float>("Artifacts", "unstabifactBaseTime", 360f, "Instability base timer. Timer for first stage of lunar storm.");
			UnstabifactPhaseTimer = Config.Bind<float>("Artifacts", "unstabifactPhaseTime", 60f, "Instability phase timer. Timer for each phase of lunar storm after the first.");
			EclifactEnable = Config.Bind<int>("Artifacts", "eclifactEnable", 1, "Artifact of the Eclipse. 0 = Disabled, 1 = Artifact Available, 2 = Always Active");
		}

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

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

		public static Texture2D FillTexture(Texture2D tex, Color color)
		{
			//IL_000f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0010: Unknown result type (might be due to invalid IL or missing references)
			Color[] pixels = tex.GetPixels();
			for (int i = 0; i < pixels.Length; i++)
			{
				pixels[i] = color;
			}
			tex.SetPixels(pixels);
			tex.Apply();
			return tex;
		}

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

		private static void LanguageOverride()
		{
			//IL_0015: Unknown result type (might be due to invalid IL or missing references)
			//IL_001a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0020: Expected O, but got Unknown
			//IL_003a: Unknown result type (might be due to invalid IL or missing references)
			//IL_003f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0045: Expected O, but got Unknown
			object obj = <>c.<>9__53_0;
			if (obj == null)
			{
				hook_TokenIsRegistered val = delegate(orig_TokenIsRegistered orig, Language self, string token)
				{
					if (token != null)
					{
						if (TriggerSyzygyText() && SyzygyTokens.ContainsKey(token))
						{
							return true;
						}
						if (LangTokens.ContainsKey(token))
						{
							return true;
						}
					}
					return orig.Invoke(self, token);
				};
				<>c.<>9__53_0 = val;
				obj = (object)val;
			}
			Language.TokenIsRegistered += (hook_TokenIsRegistered)obj;
			object obj2 = <>c.<>9__53_1;
			if (obj2 == null)
			{
				hook_GetString_string val2 = delegate(orig_GetString_string orig, string token)
				{
					if (token != null)
					{
						if (TriggerSyzygyText() && SyzygyTokens.ContainsKey(token))
						{
							return SyzygyTokens[token];
						}
						if (LangTokens.ContainsKey(token))
						{
							return LangTokens[token];
						}
					}
					return orig.Invoke(token);
				};
				<>c.<>9__53_1 = val2;
				obj2 = (object)val2;
			}
			Language.GetString_string += (hook_GetString_string)obj2;
		}

		private static bool TriggerSyzygyText()
		{
			//IL_0034: Unknown result type (might be due to invalid IL or missing references)
			//IL_003b: Invalid comparison between Unknown and I4
			if (!SyzygyText.Value)
			{
				return false;
			}
			if (Object.op_Implicit((Object)(object)Run.instance) && Diluvifact.Enabled)
			{
				if ((int)Run.instance.selectedDifficulty >= 10)
				{
					return true;
				}
				if (ZetEclifact.Enabled)
				{
					return true;
				}
			}
			return false;
		}

		public static void RegisterLanguageToken(string token, string text)
		{
			if (!LangTokens.ContainsKey(token))
			{
				LangTokens.Add(token, text);
			}
			else
			{
				LangTokens[token] = text;
			}
		}

		public static void RegisterSyzygyToken(string token, string text)
		{
			if (!SyzygyTokens.ContainsKey(token))
			{
				SyzygyTokens.Add(token, text);
			}
			else
			{
				SyzygyTokens[token] = text;
			}
		}
	}
	public static class Diluvifact
	{
		private static BodyIndex artifactShellBodyIndex = (BodyIndex)(-1);

		private static BodyIndex goldenTitanBodyIndex = (BodyIndex)(-1);

		private static int state = 0;

		public static bool Enabled
		{
			get
			{
				if (state < 1)
				{
					return false;
				}
				if (state > 1)
				{
					return true;
				}
				if (Object.op_Implicit((Object)(object)RunArtifactManager.instance) && RunArtifactManager.instance.IsArtifactEnabled(DiluvianArtifactContent.Artifacts.Diluvifact))
				{
					return true;
				}
				return false;
			}
		}

		private static void EnableEffects()
		{
			//IL_0008: Unknown result type (might be due to invalid IL or missing references)
			//IL_0012: Expected O, but got Unknown
			//IL_001a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0024: Expected O, but got Unknown
			//IL_002c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0036: Expected O, but got Unknown
			//IL_003e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0048: Expected O, but got Unknown
			//IL_0050: Unknown result type (might be due to invalid IL or missing references)
			//IL_005a: Expected O, but got Unknown
			//IL_0062: Unknown result type (might be due to invalid IL or missing references)
			//IL_006c: Expected O, but got Unknown
			//IL_0074: Unknown result type (might be due to invalid IL or missing references)
			//IL_007e: Expected O, but got Unknown
			//IL_0086: Unknown result type (might be due to invalid IL or missing references)
			//IL_0090: Expected O, but got Unknown
			Run.RecalculateDifficultyCoefficentInternal += new Manipulator(DifficultyHook);
			HealthComponent.Heal += new hook_Heal(HealMultHook);
			HealthComponent.TakeDamageProcess += new Manipulator(BlockChanceHook);
			CharacterBody.RecalculateStats += new hook_RecalculateStats(OneshotHook);
			CombatDirector.AttemptSpawnOnTarget += new Manipulator(EliteCostHook);
			SetStateOnHurt.Start += new hook_Start(HitStunHook);
			CharacterBody.RecalculateStats += new hook_RecalculateStats(MonsterRegenHook);
			ShrineBloodBehavior.AddShrineStack += new Manipulator(BloodShrineHook);
		}

		private static void DisableEffects()
		{
			//IL_0008: Unknown result type (might be due to invalid IL or missing references)
			//IL_0012: Expected O, but got Unknown
			//IL_001a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0024: Expected O, but got Unknown
			//IL_002c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0036: Expected O, but got Unknown
			//IL_003e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0048: Expected O, but got Unknown
			//IL_0050: Unknown result type (might be due to invalid IL or missing references)
			//IL_005a: Expected O, but got Unknown
			//IL_0062: Unknown result type (might be due to invalid IL or missing references)
			//IL_006c: Expected O, but got Unknown
			//IL_0074: Unknown result type (might be due to invalid IL or missing references)
			//IL_007e: Expected O, but got Unknown
			//IL_0086: Unknown result type (might be due to invalid IL or missing references)
			//IL_0090: Expected O, but got Unknown
			Run.RecalculateDifficultyCoefficentInternal -= new Manipulator(DifficultyHook);
			HealthComponent.Heal -= new hook_Heal(HealMultHook);
			HealthComponent.TakeDamageProcess -= new Manipulator(BlockChanceHook);
			CharacterBody.RecalculateStats -= new hook_RecalculateStats(OneshotHook);
			CombatDirector.AttemptSpawnOnTarget -= new Manipulator(EliteCostHook);
			SetStateOnHurt.Start -= new hook_Start(HitStunHook);
			CharacterBody.RecalculateStats -= new hook_RecalculateStats(MonsterRegenHook);
			ShrineBloodBehavior.AddShrineStack -= new Manipulator(BloodShrineHook);
		}

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

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

		internal static void Init()
		{
			//IL_0089: Unknown result type (might be due to invalid IL or missing references)
			//IL_0093: Expected O, but got Unknown
			//IL_009b: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a5: Expected O, but got Unknown
			state = DiluvianArtifactPlugin.DiluvifactEnable.Value;
			if (state >= 1)
			{
				DiluvianArtifactPlugin.RegisterLanguageToken("ARTIFACT_DILUVIFACT_NAME", "Artifact of Diluvian");
				DiluvianArtifactPlugin.RegisterLanguageToken("ARTIFACT_DILUVIFACT_DESC", "Enables all Diluvian modifiers.\n" + GetDifficultyMultText() + "\n<style=cStack>>Ally Healing: <style=cDeath>-20%</style>\n>Ally Block Chance: <style=cDeath>Halved</style>\n>Oneshot Protection: <style=cDeath>Disabled</style>\n>Elite Cost: <style=cDeath>-20%</style>\n>Enemies <style=cDeath>cannot be stunned</style> from damage taken.\n>Enemies <style=cDeath>regenerate 2% HP/s</style> outside of combat." + GetBloodShrineText() + "</style>");
				SetupSyzygyTokens();
				if (state == 1)
				{
					RunArtifactManager.onArtifactEnabledGlobal += new ArtifactStateChangeDelegate(OnArtifactEnabled);
					RunArtifactManager.onArtifactDisabledGlobal += new ArtifactStateChangeDelegate(OnArtifactDisabled);
				}
				else
				{
					EnableEffects();
				}
			}
		}

		private static string GetDifficultyMultText()
		{
			float value = DiluvianArtifactPlugin.DiluvifactDifficulty.Value;
			if (value > 1f)
			{
				return "\n<style=cStack>>Difficulty Multiplier: <style=cDeath>+" + ((value - 1f) * 100f).ToString("0.##") + "%</style>";
			}
			return "";
		}

		private static string GetBloodShrineText()
		{
			if (DiluvianArtifactPlugin.DiluvifactAntiHeal.Value)
			{
				return "\n>Blood Shrines <style=cDeath>disable healing</style> for <style=cDeath>8s</style>.";
			}
			return "";
		}

		internal static void LateSetup()
		{
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			//IL_000b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0015: Unknown result type (might be due to invalid IL or missing references)
			//IL_001a: Unknown result type (might be due to invalid IL or missing references)
			artifactShellBodyIndex = BodyCatalog.FindBodyIndex("ArtifactShellBody");
			goldenTitanBodyIndex = BodyCatalog.FindBodyIndex("TitanGoldBody");
		}

		private static void SetupSyzygyTokens()
		{
			DiluvianArtifactPlugin.RegisterSyzygyToken("MSOBELISK_CONTEXT", "Escape the madness.");
			DiluvianArtifactPlugin.RegisterSyzygyToken("MSOBELISK_CONTEXT_CONFIRMATION", "Take the cowards way out.");
			DiluvianArtifactPlugin.RegisterSyzygyToken("COST_PERCENTHEALTH_FORMAT", "?");
			DiluvianArtifactPlugin.RegisterSyzygyToken("SHRINE_BLOOD_USE_MESSAGE_2P", "<color=#c66>Look, it hurt itself. </color><style=cShrine>You have gained {1} gold.</color>");
			DiluvianArtifactPlugin.RegisterSyzygyToken("SHRINE_BLOOD_USE_MESSAGE", "<color=#c66>{0} has shown us their blood. </color><style=cShrine>They gained {1} gold.</color>");
			DiluvianArtifactPlugin.RegisterSyzygyToken("SHRINE_HEALING_USE_MESSAGE_2P", "<color=#6c6>A beacon? To the woods. </color><color=#96c>Primitive. Effective.</color>");
			DiluvianArtifactPlugin.RegisterSyzygyToken("SHRINE_HEALING_USE_MESSAGE", "<color=#6c6>A haven for {0}. </color><color=#96c>Curious.</color>");
			DiluvianArtifactPlugin.RegisterSyzygyToken("SHRINE_BOSS_BEGIN_TRIAL", "<color=#c66>Time to see what their mettle is worth.</color>");
			DiluvianArtifactPlugin.RegisterSyzygyToken("SHRINE_BOSS_END_TRIAL", "<color=#96c> And our test goes on.</color>");
			DiluvianArtifactPlugin.RegisterSyzygyToken("SHRINE_RESTACK_USE_MESSAGE_2P", "<color=#96c>Refined. Sharpened. Aligned.</color>");
			DiluvianArtifactPlugin.RegisterSyzygyToken("SHRINE_RESTACK_USE_MESSAGE", "<color=#96c>{0} is one step closer.</color>");
			DiluvianArtifactPlugin.RegisterSyzygyToken("SHRINE_COMBAT_USE_MESSAGE_2P", "<color=#c66>The threat widens. The struggle tightens.</color>");
			DiluvianArtifactPlugin.RegisterSyzygyToken("SHRINE_COMBAT_USE_MESSAGE", "<color=#c66>{0} is acting odd. Inviting {1}s, vexing.</color>");
			DiluvianArtifactPlugin.RegisterSyzygyToken("PAUSE_RESUME", "Continue");
			DiluvianArtifactPlugin.RegisterSyzygyToken("PAUSE_SETTINGS", "Calibrate your senses");
			DiluvianArtifactPlugin.RegisterSyzygyToken("PAUSE_QUIT_TO_MENU", "Stop the simulation");
			DiluvianArtifactPlugin.RegisterSyzygyToken("PAUSE_QUIT_TO_DESKTOP", "End the universe");
			DiluvianArtifactPlugin.RegisterSyzygyToken("QUIT_RUN_CONFIRM_DIALOG_BODY_SINGLEPLAYER", "Boring.");
			DiluvianArtifactPlugin.RegisterSyzygyToken("QUIT_RUN_CONFIRM_DIALOG_BODY_CLIENT", "A figment of our imagination. It will continue without you.");
			DiluvianArtifactPlugin.RegisterSyzygyToken("QUIT_RUN_CONFIRM_DIALOG_BODY_HOST", "With you, this world ends. The others aren't real.");
			DiluvianArtifactPlugin.RegisterSyzygyToken("OBJECTIVE_FIND_TELEPORTER", "Continue the simulation.");
			DiluvianArtifactPlugin.RegisterSyzygyToken("OBJECTIVE_DEFEAT_BOSS", "Complete the Act!");
			DiluvianArtifactPlugin.RegisterSyzygyToken("STAT_KILLER_NAME_FORMAT", "Simulation ended by: <color=#FFFF7F>{0}</color>.");
			if (DiluvianArtifactPlugin.SyzygyHideScore.Value)
			{
				DiluvianArtifactPlugin.RegisterSyzygyToken("STAT_POINTS_FORMAT", "");
				DiluvianArtifactPlugin.RegisterSyzygyToken("STAT_TOTAL", "");
			}
			DiluvianArtifactPlugin.RegisterSyzygyToken("STATNAME_TOTALTIMEALIVE", "Screentime");
			DiluvianArtifactPlugin.RegisterSyzygyToken("STATNAME_TOTALDEATHS", "Disruptions");
			DiluvianArtifactPlugin.RegisterSyzygyToken("STATNAME_HIGHESTLEVEL", "Evolution");
			DiluvianArtifactPlugin.RegisterSyzygyToken("STATNAME_TOTALGOLDCOLLECTED", "Wealth gotten");
			DiluvianArtifactPlugin.RegisterSyzygyToken("STATNAME_TOTALITEMSCOLLECTED", "Props worn");
			DiluvianArtifactPlugin.RegisterSyzygyToken("STATNAME_TOTALSTAGESCOMPLETED", "Acts progressed");
			DiluvianArtifactPlugin.RegisterSyzygyToken("STATNAME_TOTALPURCHASES", "Assets acquired");
			DiluvianArtifactPlugin.RegisterSyzygyToken("GAME_RESULT_LOST", "DISAPPOINTING.");
			DiluvianArtifactPlugin.RegisterSyzygyToken("GAME_RESULT_WON", "TIME REPEATS.");
			DiluvianArtifactPlugin.RegisterSyzygyToken("GAME_RESULT_UNKNOWN", "WELCOME.");
		}

		private static void DifficultyHook(ILContext il)
		{
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			//IL_0008: Expected O, but got Unknown
			//IL_0076: Unknown result type (might be due to invalid IL or missing references)
			//IL_0082: Unknown result type (might be due to invalid IL or missing references)
			//IL_008f: Unknown result type (might be due to invalid IL or missing references)
			//IL_009b: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a8: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c1: Unknown result type (might be due to invalid IL or missing references)
			ILCursor val = new ILCursor(il);
			if (val.TryGotoNext(new Func<Instruction, bool>[1]
			{
				(Instruction x) => ILPatternMatchingExt.MatchStloc(x, 9)
			}))
			{
				val.Index += 1;
				val.EmitDelegate<Func<float>>((Func<float>)(() => DiluvianArtifactPlugin.DiluvifactDifficulty.Value));
				val.Emit(OpCodes.Dup);
				val.Emit(OpCodes.Ldloc, 7);
				val.Emit(OpCodes.Mul);
				val.Emit(OpCodes.Stloc, 7);
				val.Emit(OpCodes.Ldloc, 8);
				val.Emit(OpCodes.Mul);
				val.Emit(OpCodes.Stloc, 8);
			}
			else
			{
				Debug.LogWarning((object)"DifficultyHook Failed");
			}
		}

		private static float HealMultHook(orig_Heal orig, HealthComponent self, float amount, ProcChainMask procChainMask, bool nonRegen)
		{
			//IL_0065: Unknown result type (might be due to invalid IL or missing references)
			//IL_0023: Unknown result type (might be due to invalid IL or missing references)
			//IL_0029: Invalid comparison between Unknown and I4
			//IL_0034: Unknown result type (might be due to invalid IL or missing references)
			//IL_003e: Unknown result type (might be due to invalid IL or missing references)
			if (NetworkServer.active && Object.op_Implicit((Object)(object)self.body) && (int)self.body.teamComponent.teamIndex == 1 && (self.currentEquipmentIndex != Equipment.LunarPotion.equipmentIndex || ((ProcChainMask)(ref procChainMask)).HasProc((ProcType)11)))
			{
				amount *= 0.8f;
			}
			return orig.Invoke(self, amount, procChainMask, nonRegen);
		}

		private static void BlockChanceHook(ILContext il)
		{
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			//IL_0008: Expected O, but got Unknown
			//IL_00b3: Unknown result type (might be due to invalid IL or missing references)
			ILCursor val = new ILCursor(il);
			if (val.TryGotoNext(new Func<Instruction, bool>[4]
			{
				(Instruction x) => ILPatternMatchingExt.MatchLdfld(x, "RoR2.HealthComponent/ItemCounts", "bear"),
				(Instruction x) => ILPatternMatchingExt.MatchConvR4(x),
				(Instruction x) => ILPatternMatchingExt.MatchMul(x),
				(Instruction x) => ILPatternMatchingExt.MatchCall(x, "RoR2.Util", "ConvertAmplificationPercentageIntoReductionPercentage")
			}))
			{
				val.Index += 4;
				val.Emit(OpCodes.Ldarg, 0);
				val.EmitDelegate<Func<float, HealthComponent, float>>((Func<float, HealthComponent, float>)delegate(float chance, HealthComponent healthComponent)
				{
					//IL_0019: Unknown result type (might be due to invalid IL or missing references)
					//IL_001f: Invalid comparison between Unknown and I4
					if (Object.op_Implicit((Object)(object)healthComponent.body) && (int)healthComponent.body.teamComponent.teamIndex == 1)
					{
						chance *= 0.5f;
					}
					return chance;
				});
			}
			else
			{
				Debug.LogWarning((object)"BlockChanceHook Failed");
			}
		}

		private static void OneshotHook(orig_RecalculateStats orig, CharacterBody self)
		{
			orig.Invoke(self);
			self.hasOneShotProtection = false;
			self.oneShotProtectionFraction = 0f;
		}

		private static void EliteCostHook(ILContext il)
		{
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			//IL_0008: Expected O, but got Unknown
			ILCursor val = new ILCursor(il);
			if (val.TryGotoNext(new Func<Instruction, bool>[4]
			{
				(Instruction x) => ILPatternMatchingExt.MatchConvR4(x),
				(Instruction x) => ILPatternMatchingExt.MatchLdarg(x, 0),
				(Instruction x) => ILPatternMatchingExt.MatchLdfld<CombatDirector>(x, "currentActiveEliteTier"),
				(Instruction x) => ILPatternMatchingExt.MatchLdfld(x, typeof(EliteTierDef).GetField("costMultiplier"))
			}))
			{
				val.Index += 4;
				val.EmitDelegate<Func<float, float>>((Func<float, float>)delegate(float mult)
				{
					if (Object.op_Implicit((Object)(object)Run.instance))
					{
						float num = mult - 1f;
						mult -= num * 0.2f;
					}
					return mult;
				});
			}
			else
			{
				Debug.LogWarning((object)"EliteCostHook Failed");
			}
		}

		private static void HitStunHook(orig_Start orig, SetStateOnHurt self)
		{
			orig.Invoke(self);
			self.canBeHitStunned = false;
		}

		private static void MonsterRegenHook(orig_RecalculateStats orig, CharacterBody self)
		{
			//IL_0017: Unknown result type (might be due to invalid IL or missing references)
			//IL_001d: Invalid comparison between Unknown and I4
			//IL_0036: Unknown result type (might be due to invalid IL or missing references)
			//IL_003b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0043: Unknown result type (might be due to invalid IL or missing references)
			//IL_0048: Unknown result type (might be due to invalid IL or missing references)
			orig.Invoke(self);
			if (self.outOfDanger && (int)self.teamComponent.teamIndex == 2 && !ZetUnstabifact.HasInvulnBuff(self) && self.bodyIndex != artifactShellBodyIndex && self.bodyIndex != goldenTitanBodyIndex)
			{
				self.regen += self.maxHealth * 0.02f;
			}
		}

		private static void BloodShrineHook(ILContext il)
		{
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			//IL_0008: Expected O, but got Unknown
			//IL_004d: Unknown result type (might be due to invalid IL or missing references)
			ILCursor val = new ILCursor(il);
			if (val.TryGotoNext(new Func<Instruction, bool>[1]
			{
				(Instruction x) => ILPatternMatchingExt.MatchStloc(x, 0)
			}))
			{
				val.Index += 1;
				val.Emit(OpCodes.Ldloc, 0);
				val.EmitDelegate<Action<CharacterBody>>((Action<CharacterBody>)delegate(CharacterBody self)
				{
					if (Object.op_Implicit((Object)(object)self) && DiluvianArtifactPlugin.DiluvifactAntiHeal.Value)
					{
						self.AddTimedBuff(Buffs.HealingDisabled, 8f);
					}
				});
			}
			else
			{
				Debug.LogWarning((object)"BloodShrineHook Failed");
			}
		}
	}
	public static class InstabilityController
	{
		private class Blocker
		{
			internal float timer = 5f;

			internal Vector3 position;
		}

		internal static class Display
		{
			private static GameObject displayPanel;

			private static GameObject displayTimeText;

			private static HGTextMeshProUGUI timeTextMesh;

			private static GameObject displayDiffText;

			private static HGTextMeshProUGUI diffTextMesh;

			internal static bool sendSyncTime = false;

			internal static float syncTime = 0f;

			internal static float difficulty = 0f;

			private static string currentTimeText = "";

			private static string currentDiffText = "";

			private static float timeSinceSync = 0f;

			internal static void ResetServerSyncTime()
			{
				//IL_001b: Unknown result type (might be due to invalid IL or missing references)
				//IL_0020: Unknown result type (might be due to invalid IL or missing references)
				//IL_0027: Unknown result type (might be due to invalid IL or missing references)
				//IL_0034: Expected O, but got Unknown
				float runStopwatch = Run.instance.GetRunStopwatch();
				timeSinceSync = 0f;
				EffectManager.SpawnEffect((EffectIndex)1758000, new EffectData
				{
					genericUInt = 2u,
					genericFloat = runStopwatch
				}, true);
			}

			internal static void SetServerSyncTime(float offset)
			{
				//IL_0027: Unknown result type (might be due to invalid IL or missing references)
				//IL_002c: Unknown result type (might be due to invalid IL or missing references)
				//IL_0033: Unknown result type (might be due to invalid IL or missing references)
				//IL_0040: Expected O, but got Unknown
				if (sendSyncTime)
				{
					float genericFloat = Run.instance.GetRunStopwatch() + offset;
					timeSinceSync = 0f;
					EffectManager.SpawnEffect((EffectIndex)1758000, new EffectData
					{
						genericUInt = 2u,
						genericFloat = genericFloat
					}, true);
				}
			}

			internal static void ServerSendSyncTime(float offset)
			{
				//IL_0027: Unknown result type (might be due to invalid IL or missing references)
				//IL_002c: Unknown result type (might be due to invalid IL or missing references)
				//IL_0033: Unknown result type (might be due to invalid IL or missing references)
				//IL_0040: Expected O, but got Unknown
				if (sendSyncTime)
				{
					float genericFloat = Run.instance.GetRunStopwatch() + offset;
					timeSinceSync = 0f;
					EffectManager.SpawnEffect((EffectIndex)1758000, new EffectData
					{
						genericUInt = 4u,
						genericFloat = genericFloat
					}, true);
				}
			}

			internal static void SetServerDifficulty(float value)
			{
				//IL_0006: Unknown result type (might be due to invalid IL or missing references)
				//IL_000b: Unknown result type (might be due to invalid IL or missing references)
				//IL_0012: Unknown result type (might be due to invalid IL or missing references)
				//IL_001f: Expected O, but got Unknown
				EffectManager.SpawnEffect((EffectIndex)1758000, new EffectData
				{
					genericUInt = 3u,
					genericFloat = value
				}, true);
			}

			internal static void InitializeUI(HUD hud)
			{
				//IL_0006: Unknown result type (might be due to invalid IL or missing references)
				//IL_0010: Expected O, but got Unknown
				//IL_004b: Unknown result type (might be due to invalid IL or missing references)
				//IL_0055: Expected O, but got Unknown
				//IL_008e: Unknown result type (might be due to invalid IL or missing references)
				//IL_0098: Expected O, but got Unknown
				//IL_00dc: Unknown result type (might be due to invalid IL or missing references)
				//IL_00f2: Unknown result type (might be due to invalid IL or missing references)
				//IL_0108: Unknown result type (might be due to invalid IL or missing references)
				//IL_0114: Unknown result type (might be due to invalid IL or missing references)
				//IL_012a: Unknown result type (might be due to invalid IL or missing references)
				//IL_0140: Unknown result type (might be due to invalid IL or missing references)
				//IL_0156: Unknown result type (might be due to invalid IL or missing references)
				//IL_0171: 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_0189: Unknown result type (might be due to invalid IL or missing references)
				//IL_0195: Unknown result type (might be due to invalid IL or missing references)
				//IL_01a1: Unknown result type (might be due to invalid IL or missing references)
				//IL_01b7: Unknown result type (might be due to invalid IL or missing references)
				//IL_01c3: Unknown result type (might be due to invalid IL or missing references)
				//IL_01fe: Unknown result type (might be due to invalid IL or missing references)
				//IL_0203: Unknown result type (might be due to invalid IL or missing references)
				//IL_023c: Unknown result type (might be due to invalid IL or missing references)
				//IL_0248: Unknown result type (might be due to invalid IL or missing references)
				//IL_0254: Unknown result type (might be due to invalid IL or missing references)
				//IL_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_0282: Unknown result type (might be due to invalid IL or missing references)
				//IL_02bd: Unknown result type (might be due to invalid IL or missing references)
				//IL_02c2: Unknown result type (might be due to invalid IL or missing references)
				displayPanel = new GameObject("UnstabifactPanel");
				RectTransform val = displayPanel.AddComponent<RectTransform>();
				displayPanel.transform.SetParent(hud.gameModeUiInstance.transform);
				displayPanel.transform.SetAsLastSibling();
				displayTimeText = new GameObject("UnstabifactTimeText");
				RectTransform val2 = displayTimeText.AddComponent<RectTransform>();
				timeTextMesh = displayTimeText.AddComponent<HGTextMeshProUGUI>();
				displayTimeText.transform.SetParent(displayPanel.transform);
				displayDiffText = new GameObject("UnstabifactDiffText");
				RectTransform val3 = displayDiffText.AddComponent<RectTransform>();
				diffTextMesh = displayDiffText.AddComponent<HGTextMeshProUGUI>();
				displayDiffText.transform.SetParent(displayPanel.transform);
				((Transform)val).localPosition = new Vector3(0f, 0f, 0f);
				val.anchorMin = new Vector2(0f, 0f);
				val.anchorMax = new Vector2(0f, 0f);
				((Transform)val).localScale = Vector3.one;
				val.pivot = new Vector2(0f, 1f);
				val.sizeDelta = new Vector2(80f, 40f);
				val.anchoredPosition = new Vector2(32f, 48f);
				((Transform)val).eulerAngles = new Vector3(0f, 5f, 0f);
				((Transform)val2).localPosition = Vector3.zero;
				val2.anchorMin = Vector2.zero;
				val2.anchorMax = Vector2.one;
				((Transform)val2).localScale = Vector3.one;
				val2.sizeDelta = new Vector2(-12f, -12f);
				val2.anchoredPosition = Vector2.zero;
				((TMP_Text)timeTextMesh).enableAutoSizing = false;
				((TMP_Text)timeTextMesh).fontSize = 12f;
				((TMP_Text)timeTextMesh).faceColor = Color32.op_Implicit(new Color(0.875f, 0.75f, 1f));
				((TMP_Text)timeTextMesh).alignment = (TextAlignmentOptions)4100;
				((TMP_Text)timeTextMesh).richText = true;
				((TMP_Text)timeTextMesh).SetText("", true);
				((Transform)val3).localPosition = Vector3.zero;
				val3.anchorMin = Vector2.zero;
				val3.anchorMax = Vector2.one;
				((Transform)val3).localScale = Vector3.one;
				val3.sizeDelta = new Vector2(-12f, -12f);
				val3.anchoredPosition = Vector2.zero;
				((TMP_Text)diffTextMesh).enableAutoSizing = false;
				((TMP_Text)diffTextMesh).fontSize = 10f;
				((TMP_Text)diffTextMesh).faceColor = Color32.op_Implicit(new Color(0.65f, 0.65f, 0.65f));
				((TMP_Text)diffTextMesh).alignment = (TextAlignmentOptions)4097;
				((TMP_Text)diffTextMesh).richText = true;
				((TMP_Text)diffTextMesh).SetText("", true);
			}

			internal static void SyncTimer()
			{
				if (!(syncTime > 0f) || !Object.op_Implicit((Object)(object)Run.instance))
				{
					return;
				}
				timeSinceSync += Time.fixedDeltaTime;
				if (!(timeSinceSync >= 10f))
				{
					return;
				}
				float runStopwatch = Run.instance.GetRunStopwatch();
				if (runStopwatch < syncTime)
				{
					float num = syncTime - runStopwatch;
					if (num >= 10f)
					{
						timeSinceSync = 0f;
						ServerSendSyncTime(num);
					}
				}
			}

			internal static void UpdateUI()
			{
				if ((Object)(object)timeTextMesh != (Object)null)
				{
					string text = "";
					if (syncTime > 0f && Object.op_Implicit((Object)(object)Run.instance))
					{
						float runStopwatch = Run.instance.GetRunStopwatch();
						if (runStopwatch < syncTime)
						{
							float time = syncTime - runStopwatch;
							text = FormatTimer(time);
						}
					}
					if (text != currentTimeText)
					{
						currentTimeText = text;
						((TMP_Text)timeTextMesh).SetText("<mspace=6.6>" + text + "</mspace>", true);
					}
				}
				if ((Object)(object)diffTextMesh != (Object)null)
				{
					string text2 = "";
					float num = (DiluvianArtifactPlugin.UnstabifactDisplayDifficulty.Value ? difficulty : 0f);
					if (num > 0f)
					{
						text2 = FormatDifficulty(num);
					}
					if (text2 != currentDiffText)
					{
						currentDiffText = text2;
						((TMP_Text)diffTextMesh).SetText("<mspace=5.5>" + text2 + "</mspace>", true);
					}
				}
			}

			private static string FormatTimer(float time)
			{
				time = Mathf.Ceil(time * 100f);
				float num;
				float num2;
				if (time >= 6000f)
				{
					num = Mathf.Floor(time / 6000f);
					num2 = Mathf.Floor(time % 6000f / 100f);
					return num + ":" + num2.ToString("00");
				}
				num = Mathf.Floor(time / 100f);
				num2 = Mathf.Floor(time % 100f);
				return num + "." + num2.ToString("00");
			}

			private static string FormatDifficulty(float value)
			{
				if (value < 10f)
				{
					return value.ToString("0.00");
				}
				if (value < 100f)
				{
					return value.ToString("0.0");
				}
				return Mathf.RoundToInt(difficulty).ToString();
			}

			internal static void SetSyncTime(float time)
			{
				syncTime = time;
			}

			internal static void SetDifficulty(float value)
			{
				difficulty = value;
			}
		}

		public static class MeteorState
		{
			public static bool activated = false;

			public static float activation = 360f;

			public static bool activated2 = false;

			public static float activation2 = 600f;

			public static bool activated3 = false;

			public static float activation3 = 720f;

			private static int extraCharges = 0;

			private static float extraChargeTimer = 0f;

			private static float extraChargeInterval = 1f;

			private static float extraChargeFireChance = 0.05f;

			internal static MeteorStormController controller;

			internal static void StartStorm()
			{
				//IL_000b: Unknown result type (might be due to invalid IL or missing references)
				//IL_0010: Unknown result type (might be due to invalid IL or missing references)
				GameObject val = Object.Instantiate<GameObject>(LegacyResourcesAPI.Load<GameObject>("Prefabs/NetworkedObjects/MeteorStorm"), Vector3.zero, Quaternion.identity);
				controller = val.GetComponent<MeteorStormController>();
				controller.ownerDamage = baseDamage;
				controller.waveCount = 9999999;
				NetworkServer.Spawn(((Component)controller).gameObject);
			}

			internal static void UpdateDamage()
			{
				if (Object.op_Implicit((Object)(object)controller))
				{
					controller.ownerDamage = baseDamage;
				}
			}

			internal static void ResetState()
			{
				extraCharges = 0;
				extraChargeTimer = 0f;
				extraChargeInterval = 1f;
				extraChargeFireChance = 0.05f;
			}

			internal static void Hasten()
			{
				extraChargeInterval = 0.8f;
				extraChargeFireChance = 0.075f;
			}

			internal static void FixedUpdate()
			{
				if (enabled && activated && Object.op_Implicit((Object)(object)controller) && activated2)
				{
					extraChargeTimer -= Time.fixedDeltaTime;
					if (extraChargeTimer <= 0f)
					{
						extraChargeTimer += extraChargeInterval;
						extraCharges = Mathf.Min(extraCharges + 1, 10);
					}
					if (extraCharges > 0 && Random.value < extraChargeFireChance)
					{
						extraCharges--;
						MeteorActivePlayers();
					}
				}
			}

			private static void MeteorActivePlayers()
			{
				//IL_00d6: Unknown result type (might be due to invalid IL or missing references)
				//IL_00db: Unknown result type (might be due to invalid IL or missing references)
				//IL_00de: Unknown result type (might be due to invalid IL or missing references)
				//IL_00e9: Unknown result type (might be due to invalid IL or missing references)
				//IL_00ff: Expected O, but got Unknown
				List<CharacterBody> list = new List<CharacterBody>();
				ReadOnlyCollection<TeamComponent> teamMembers = TeamComponent.GetTeamMembers((TeamIndex)1);
				for (int i = 0; i < teamMembers.Count; i++)
				{
					CharacterBody body = teamMembers[i].body;
					if (Object.op_Implicit((Object)(object)body) && body.isPlayerControlled)
					{
						list.Add(body);
					}
				}
				if (list.Count <= 0)
				{
					return;
				}
				foreach (CharacterBody item in list)
				{
					HealthComponent healthComponent = item.healthComponent;
					if (Object.op_Implicit((Object)(object)healthComponent) && healthComponent.alive)
					{
						Meteor val = CreateMeteor(item);
						if (val.valid)
						{
							controller.meteorList.Add(val);
							EffectManager.SpawnEffect(controller.warningEffectPrefab, new EffectData
							{
								origin = val.impactPosition,
								scale = controller.blastRadius
							}, true);
						}
					}
				}
			}

			private static Meteor CreateMeteor(CharacterBody body)
			{
				//IL_0001: Unknown result type (might be due to invalid IL or missing references)
				//IL_0007: Expected O, but got Unknown
				//IL_0016: Unknown result type (might be due to invalid IL or missing references)
				//IL_001b: Unknown result type (might be due to invalid IL or missing references)
				//IL_0020: Unknown result type (might be due to invalid IL or missing references)
				//IL_0040: 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_0036: 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_004b: Unknown result type (might be due to invalid IL or missing references)
				//IL_0050: Unknown result type (might be due to invalid IL or missing references)
				//IL_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_0064: Unknown result type (might be due to invalid IL or missing references)
				//IL_0065: Unknown result type (might be due to invalid IL or missing references)
				//IL_006a: Unknown result type (might be due to invalid IL or missing references)
				//IL_0078: Unknown result type (might be due to invalid IL or missing references)
				//IL_0079: Unknown result type (might be due to invalid IL or missing references)
				//IL_0087: Unknown result type (might be due to invalid IL or missing references)
				//IL_00af: Unknown result type (might be due to invalid IL or missing references)
				//IL_00b4: Unknown result type (might be due to invalid IL or missing references)
				//IL_00c5: 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_00df: Unknown result type (might be due to invalid IL or missing references)
				//IL_00e4: Unknown result type (might be due to invalid IL or missing references)
				Meteor val = new Meteor();
				if (Object.op_Implicit((Object)(object)body))
				{
					Vector3 nearbyGroundNodePosition = GetNearbyGroundNodePosition(body.corePosition);
					if (((Vector3)(ref nearbyGroundNodePosition)).sqrMagnitude > 1f)
					{
						val.impactPosition = nearbyGroundNodePosition;
					}
					else
					{
						val.impactPosition = body.corePosition;
					}
					Vector3 val2 = val.impactPosition + Vector3.up * 6f;
					Vector3 onUnitSphere = Random.onUnitSphere;
					onUnitSphere.y = -1f;
					RaycastHit val3 = default(RaycastHit);
					if (Physics.Raycast(val2, onUnitSphere, ref val3, 12f, LayerMask.op_Implicit(((LayerIndex)(ref LayerIndex.world)).mask), (QueryTriggerInteraction)1))
					{
						val.impactPosition = ((RaycastHit)(ref val3)).point;
					}
					else if (Physics.Raycast(val.impactPosition, Vector3.down, ref val3, float.PositiveInfinity, LayerMask.op_Implicit(((LayerIndex)(ref LayerIndex.world)).mask), (QueryTriggerInteraction)1))
					{
						val.impactPosition = ((RaycastHit)(ref val3)).point;
					}
				}
				else
				{
					val.valid = false;
				}
				val.startTime = Run.instance.time;
				return val;
			}
		}

		public static class FissureState
		{
			public static bool activated = false;

			public static float activation = 420f;

			public static bool activated2 = false;

			public static float activation2 = 540f;

			public static bool activated3 = false;

			public static float activation3 = 660f;

			private static int charges = 0;

			private static float chargeTimer = 0f;

			private static float chargeInterval = 0.125f;

			private static float chargeFireChance = 0.1f;

			private static int extraCharges = 0;

			private static float extraChargeTimer = 0f;

			private static float extraChargeInterval = 1f;

			private static float extraChargeFireChance = 0.05f;

			internal static void ResetState()
			{
				charges = 0;
				chargeTimer = 0f;
				extraCharges = 0;
				extraChargeTimer = 0f;
				extraChargeInterval = 1f;
				extraChargeFireChance = 0.05f;
			}

			internal static void Hasten()
			{
				extraChargeInterval = 0.8f;
				extraChargeFireChance = 0.075f;
			}

			internal static void FixedUpdate()
			{
				//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_00a7: Unknown result type (might be due to invalid IL or missing references)
				if (!enabled || !activated)
				{
					return;
				}
				chargeTimer -= Time.fixedDeltaTime;
				if (chargeTimer <= 0f)
				{
					chargeTimer += chargeInterval;
					charges = Mathf.Min(charges + 1, 40);
				}
				if (charges > 0 && Random.value < chargeFireChance)
				{
					Vector3 position = FindFissureTarget();
					if (((Vector3)(ref position)).sqrMagnitude > 1f)
					{
						charges--;
						FireFissure(position);
					}
				}
				if (activated2)
				{
					extraChargeTimer -= Time.fixedDeltaTime;
					if (extraChargeTimer <= 0f)
					{
						extraChargeTimer += extraChargeInterval;
						extraCharges = Mathf.Min(extraCharges + 1, 10);
					}
					if (extraCharges > 0 && Random.value < extraChargeFireChance)
					{
						extraCharges--;
						FissureActivePlayers();
					}
				}
			}

			private static Vector3 FindFissureTarget()
			{
				//IL_0057: Unknown result type (might be due to invalid IL or missing references)
				//IL_005c: Unknown result type (might be due to invalid IL or missing references)
				//IL_0060: 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_0043: 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_0050: Unknown result type (might be due to invalid IL or missing references)
				//IL_0052: Unknown result type (might be due to invalid IL or missing references)
				NodeGraph groundNodes = SceneInfo.instance.groundNodes;
				if (Object.op_Implicit((Object)(object)groundNodes))
				{
					List<NodeIndex> activeNodesForHullMaskWithFlagConditions = groundNodes.GetActiveNodesForHullMaskWithFlagConditions((HullMask)2, (NodeFlags)0, (NodeFlags)4);
					if (activeNodesForHullMaskWithFlagConditions.Count > 0)
					{
						NodeIndex val = activeNodesForHullMaskWithFlagConditions[Random.Range(0, activeNodesForHullMaskWithFlagConditions.Count - 1)];
						Vector3 result = default(Vector3);
						groundNodes.GetNodePosition(val, ref result);
						return result;
					}
				}
				return Vector3.zero;
			}

			private static void FireFissure(Vector3 position)
			{
				//IL_0008: Unknown result type (might be due to invalid IL or missing references)
				//IL_0036: Unknown result type (might be due to invalid IL or missing references)
				//IL_0037: Unknown result type (might be due to invalid IL or missing references)
				//IL_0041: Unknown result type (might be due to invalid IL or missing references)
				//IL_0046: Unknown result type (might be due to invalid IL or missing references)
				//IL_004b: Unknown result type (might be due to invalid IL or missing references)
				//IL_006b: Unknown result type (might be due to invalid IL or missing references)
				//IL_0070: Unknown result type (might be due to invalid IL or missing references)
				//IL_0075: Unknown result type (might be due to invalid IL or missing references)
				ProjectileManager.instance.FireProjectile(new FireProjectileInfo
				{
					projectilePrefab = fissurePrefab,
					owner = null,
					damage = baseDamage * 2f,
					position = position + Vector3.up * 3f,
					rotation = Quaternion.Euler(0f, Random.Range(0f, 360f), 0f)
				});
			}

			private static void FissureActivePlayers()
			{
				//IL_00a2: 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_00ac: Unknown result type (might be due to invalid IL or missing references)
				//IL_00ce: Unknown result type (might be due to invalid IL or missing references)
				//IL_00c2: Unknown result type (might be due to invalid IL or missing references)
				List<CharacterBody> list = new List<CharacterBody>();
				ReadOnlyCollection<TeamComponent> teamMembers = TeamComponent.GetTeamMembers((TeamIndex)1);
				for (int i = 0; i < teamMembers.Count; i++)
				{
					CharacterBody body = teamMembers[i].body;
					if (Object.op_Implicit((Object)(object)body) && body.isPlayerControlled)
					{
						list.Add(body);
					}
				}
				if (list.Count <= 0)
				{
					return;
				}
				foreach (CharacterBody item in list)
				{
					HealthComponent healthComponent = item.healthComponent;
					if (Object.op_Implicit((Object)(object)healthComponent) && healthComponent.alive)
					{
						Vector3 nearbyGroundNodePosition = GetNearbyGroundNodePosition(item.corePosition);
						if (((Vector3)(ref nearbyGroundNodePosition)).sqrMagnitude > 1f)
						{
							FireFissure(nearbyGroundNodePosition);
						}
						else
						{
							FireFissure(item.corePosition);
						}
					}
				}
			}
		}

		public static class ScorchState
		{
			public static bool activated = false;

			public static float activation = 480f;

			internal static void SpawnScorch(Vector3 position)
			{
				//IL_0001: Unknown result type (might be due to invalid IL or missing references)
				//IL_0006: Unknown result type (might be due to invalid IL or missing references)
				//IL_0029: Unknown result type (might be due to invalid IL or missing references)
				//IL_002e: Unknown result type (might be due to invalid IL or missing references)
				//IL_0033: Unknown result type (might be due to invalid IL or missing references)
				//IL_0036: Unknown result type (might be due to invalid IL or missing references)
				//IL_004a: Unknown result type (might be due to invalid IL or missing references)
				//IL_004b: Unknown result type (might be due to invalid IL or missing references)
				//IL_0052: Unknown result type (might be due to invalid IL or missing references)
				//IL_0053: Unknown result type (might be due to invalid IL or missing references)
				//IL_0058: Unknown result type (might be due to invalid IL or missing references)
				//IL_0084: Unknown result type (might be due to invalid IL or missing references)
				//IL_009e: Unknown result type (might be due to invalid IL or missing references)
				//IL_00a3: Unknown result type (might be due to invalid IL or missing references)
				//IL_00a4: Unknown result type (might be due to invalid IL or missing references)
				//IL_00ab: Unknown result type (might be due to invalid IL or missing references)
				//IL_00bc: Expected O, but got Unknown
				Vector3 val = Quaternion.identity * Util.ApplySpread(Vector3.forward, 0f, 0f, 1f, 1f, 0f, 0f);
				FireProjectileInfo val2 = default(FireProjectileInfo);
				val2.projectilePrefab = scorchPrefab;
				val2.position = position;
				val2.rotation = Util.QuaternionSafeLookRotation(val);
				val2.owner = null;
				val2.damage = baseDamage * 1.5f;
				val2.crit = false;
				ProjectileManager.instance.FireProjectile(val2);
				if (Object.op_Implicit((Object)(object)deathExplosionEffect))
				{
					EffectManager.SpawnEffect(deathExplosionEffect, new EffectData
					{
						origin = position,
						scale = 12.5f
					}, true);
				}
			}
		}

		public static class NovaState
		{
			private class Nova
			{
				private float stopwatch = 0f;

				private bool charge = false;

				internal bool fired = false;

				internal Vector3 position;

				private GameObject chargeVfxInstance;

				private GameObject areaIndicatorVfxInstance;

				internal void Update()
				{
					//IL_007a: Unknown result type (might be due to invalid IL or missing references)
					if (fired)
					{
						return;
					}
					stopwatch += Time.fixedDeltaTime;
					if (clearNovaList)
					{
						DestroyNovaVfx();
						fired = true;
					}
					else if (stopwatch >= 7f)
					{
						DestroyNovaVfx();
						fired = true;
						if (NetworkServer.active && enabled && activated)
						{
							FireNovaBlast(position);
						}
					}
					else if (stopwatch >= 5f && !charge)
					{
						SetupNovaVfx();
					}
				}

				private void DestroyNovaVfx()
				{
					if (Object.op_Implicit((Object)(object)chargeVfxInstance))
					{
						Object.Destroy((Object)(object)chargeVfxInstance);
						chargeVfxInstance = null;
					}
					if (Object.op_Implicit((Object)(object)areaIndicatorVfxInstance))
					{
						Object.Destroy((Object)(object)areaIndicatorVfxInstance);
						areaIndicatorVfxInstance = null;
					}
				}

				private void SetupNovaVfx()
				{
					//IL_0022: Unknown result type (might be due to invalid IL or missing references)
					//IL_0027: Unknown result type (might be due to invalid IL or missing references)
					//IL_0041: Unknown result type (might be due to invalid IL or missing references)
					//IL_004b: Unknown result type (might be due to invalid IL or missing references)
					//IL_0071: Unknown result type (might be due to invalid IL or missing references)
					//IL_0076: Unknown result type (might be due to invalid IL or missing references)
					//IL_009d: 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)
					charge = true;
					if (!Object.op_Implicit((Object)(object)chargeVfxInstance))
					{
						chargeVfxInstance = Object.Instantiate<GameObject>(chargingEffectPrefab, position, Quaternion.identity);
						chargeVfxInstance.transform.localScale = Vector3.one * 0.125f;
					}
					if (!Object.op_Implicit((Object)(object)areaIndicatorVfxInstance))
					{
						areaIndicatorVfxInstance = Object.Instantiate<GameObject>(areaIndicatorPrefab, position, Quaternion.identity);
						ObjectScaleCurve component = areaIndicatorVfxInstance.GetComponent<ObjectScaleCurve>();
						component.timeMax = 2f;
						component.baseScale = Vector3.one * 25f;
						areaIndicatorVfxInstance.GetComponent<AnimateShaderAlpha>().timeMax = 2f;
					}
				}
			}

			public static bool activated = false;

			public static float activation = 480f;

			private static List<Nova> activeNova = new List<Nova>();

			internal static bool clearNovaList = false;

			internal static void ServerSendNovaEffect(Vector3 position)
			{
				//IL_0006: Unknown result type (might be due to invalid IL or missing references)
				//IL_000b: Unknown result type (might be due to invalid IL or missing references)
				//IL_0012: Unknown result type (might be due to invalid IL or missing references)
				//IL_0013: Unknown result type (might be due to invalid IL or missing references)
				//IL_0020: Expected O, but got Unknown
				EffectManager.SpawnEffect((EffectIndex)1758000, new EffectData
				{
					genericUInt = 1u,
					origin = position
				}, true);
			}

			internal static void FixedUpdate()
			{
				for (int i = 0; i < activeNova.Count; i++)
				{
					Nova nova = activeNova[i];
					if (nova != null)
					{
						nova.Update();
						if (nova.fired)
						{
							activeNova.RemoveAt(i);
							i--;
						}
					}
				}
				clearNovaList = false;
			}

			internal static void CreateNova(Vector3 position)
			{
				//IL_000c: Unknown result type (might be due to invalid IL or missing references)
				//IL_000d: Unknown result type (might be due to invalid IL or missing references)
				activeNova.Add(new Nova
				{
					position = position
				});
			}

			private static void FireNovaBlast(Vector3 position)
			{
				//IL_0001: Unknown result type (might be due to invalid IL or missing references)
				//IL_0006: Unknown result type (might be due to invalid IL or missing references)
				//IL_000d: Unknown result type (might be due to invalid IL or missing references)
				//IL_0014: Unknown result type (might be due to invalid IL or missing references)
				//IL_0016: Unknown result type (might be due to invalid IL or missing references)
				//IL_001b: Unknown result type (might be due to invalid IL or missing references)
				//IL_002c: Unknown result type (might be due to invalid IL or missing references)
				//IL_0033: 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_003f: Unknown result type (might be due to invalid IL or missing references)
				//IL_0044: Unknown result type (might be due to invalid IL or missing references)
				//IL_0049: Unknown result type (might be due to invalid IL or missing references)
				//IL_004b: Unknown result type (might be due to invalid IL or missing references)
				//IL_0050: Unknown result type (might be due to invalid IL or missing references)
				//IL_0052: Unknown result type (might be due to invalid IL or missing references)
				//IL_0057: Unknown result type (might be due to invalid IL or missing references)
				//IL_005d: Unknown result type (might be due to invalid IL or missing references)
				//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_0072: Unknown result type (might be due to invalid IL or missing references)
				//IL_0073: Unknown result type (might be due to invalid IL or missing references)
				//IL_0074: Unknown result type (might be due to invalid IL or missing references)
				//IL_0079: Unknown result type (might be due to invalid IL or missing references)
				//IL_0084: Unknown result type (might be due to invalid IL or missing references)
				new BlastAttack
				{
					attacker = null,
					inflictor = null,
					teamIndex = (TeamIndex)(-1),
					baseDamage = baseDamage * 3f,
					crit = false,
					baseForce = 0f,
					bonusForce = Vector3.zero,
					attackerFiltering = (AttackerFiltering)2,
					damageColorIndex = (DamageColorIndex)0,
					damageType = DamageTypeCombo.op_Implicit((DamageType)4194304),
					procCoefficient = 0f,
					position = position,
					radius = 12.5f
				}.Fire();
			}
		}

		public static class LunarState
		{
			public static bool activated = false;

			public static float activation = 540f;

			public static bool activated2 = false;

			public static float activation2 = 720f;

			public static bool activated3 = false;

			public static float activation3 = 900f;

			private static int chimeraCount = 0;

			private static int chimeraLimit = 1;

			private static int failedSpawnAttempts = 0;

			private static float spawnInterval = 30f;

			private static float countStopwatch = 0f;

			private static float spawnStopwatch = 0f;

			private static float leashStopwatch = 0f;

			private static bool uberChimera = false;

			private static bool updateDelayed = false;

			internal static void ResetState(int count)
			{
				chimeraCount = GetActiveUberChimeraCount();
				chimeraLimit = (RunArtifactManager.instance.IsArtifactEnabled(Artifacts.Swarms) ? (count * 2) : count);
				failedSpawnAttempts = 0;
				spawnInterval = 30f * timeFactor;
				countStopwatch = 0f;
				spawnStopwatch = ((chimeraCount >= chimeraLimit) ? 0f : spawnInterval);
				leashStopwatch = 0f;
				uberChimera = false;
			}

			internal static void DelayUpdate()
			{
				countStopwatch = 0f;
				leashStopwatch = 0f;
				updateDelayed = true;
			}

			internal static void FixedUpdate()
			{
				if (!enabled || !activated)
				{
					return;
				}
				if (updateDelayed || chimeraCount >= chimeraLimit)
				{
					countStopwatch += Time.fixedDeltaTime;
					if (countStopwatch >= 2.5f)
					{
						updateDelayed = false;
						countStopwatch = 0f;
						chimeraCount = GetActiveUberChimeraCount();
					}
				}
				else
				{
					spawnStopwatch += Time.fixedDeltaTime;
					if (spawnStopwatch >= spawnInterval)
					{
						DelayUpdate();
						spawnStopwatch = 0f;
						SummonUberChimera();
					}
				}
				if (!updateDelayed && chimeraCount > 0)
				{
					leashStopwatch += Time.fixedDeltaTime;
					if (leashStopwatch >= 10f)
					{
						leashStopwatch = 0f;
						LeashUberChimera();
					}
				}
				else
				{
					leashStopwatch = 0f;
				}
			}

			private static int GetActiveUberChimeraCount()
			{
				int num = 0;
				ReadOnlyCollection<TeamComponent> teamMembers = TeamComponent.GetTeamMembers((TeamIndex)2);
				for (int i = 0; i < teamMembers.Count; i++)
				{
					CharacterBody body = teamMembers[i].body;
					if (Object.op_Implicit((Object)(object)body) && IsUberChimera(body))
					{
						num++;
					}
				}
				return num;
			}

			internal static bool IsUberChimera(CharacterBody body)
			{
				//IL_0002: Unknown result type (might be due to invalid IL or missing references)
				//IL_0007: Unknown result type (might be due to invalid IL or missing references)
				//IL_002c: Unknown result type (might be due to invalid IL or missing references)
				//IL_0036: Unknown result type (might be due to invalid IL or missing references)
				if (body.bodyIndex != lunarChimeraBodyIndex)
				{
					return false;
				}
				Inventory inventory = body.inventory;
				if (Object.op_Implicit((Object)(object)inventory))
				{
					if (inventory.currentEquipmentIndex != Equipment.AffixLunar.equipmentIndex)
					{
						return false;
					}
					if (inventory.GetItemCount(Items.ShieldOnly) > 0 && inventory.GetItemCount(Items.Knurl) > 0)
					{
						return true;
					}
				}
				return false;
			}

			private static void SummonUberChimera()
			{
				//IL_0027: Unknown result type (might be due to invalid IL or missing references)
				//IL_002c: Unknown result type (might be due to invalid IL or missing references)
				//IL_002e: Unknown result type (might be due to invalid IL or missing references)
				//IL_0033: 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_0060: Unknown result type (might be due to invalid IL or missing references)
				//IL_006d: Expected O, but got Unknown
				//IL_0078: Unknown result type (might be due to invalid IL or missing references)
				//IL_007d: Unknown result type (might be due to invalid IL or missing references)
				//IL_0089: Unknown result type (might be due to invalid IL or missing references)
				//IL_0092: Expected O, but got Unknown
				if (!Object.op_Implicit((Object)(object)lunarChimeraSpawnCard))
				{
					return;
				}
				CharacterBody randomControlledPlayer = GetRandomControlledPlayer();
				if (!Object.op_Implicit((Object)(object)randomControlledPlayer))
				{
					return;
				}
				DirectorPlacementRule val = new DirectorPlacementRule
				{
					placementMode = (PlacementMode)1,
					minDistance = 45f,
					maxDistance = 90f + Mathf.Min(30f * (float)failedSpawnAttempts, 90f),
					spawnOnTarget = randomControlledPlayer.transform
				};
				DirectorSpawnRequest val2 = new DirectorSpawnRequest(lunarChimeraSpawnCard, val, RoR2Application.rng)
				{
					teamIndexOverride = (TeamIndex)2,
					ignoreTeamMemberLimit = true
				};
				uberChimera = true;
				GameObject val3 = DirectorCore.instance.TrySpawnObject(val2);
				if (Object.op_Implicit((Object)(object)val3))
				{
					failedSpawnAttempts = 0;
				}
				else
				{
					failedSpawnAttempts++;
					if (failedSpawnAttempts < 4)
					{
						spawnStopwatch = spawnInterval - 2.5f;
					}
				}
				uberChimera = false;
			}

			internal static void UberifyChimera(CharacterMaster master)
			{
				//IL_003c: Unknown result type (might be due to invalid IL or missing references)
				if (enabled && activated && uberChimera)
				{
					Inventory inventory = master.inventory;
					float num = damageFactor / 2f;
					inventory.SetEquipmentIndex(Equipment.AffixLunar.equipmentIndex);
					inventory.GiveItem(Items.ShieldOnly, 1);
					inventory.GiveItem(Items.Knurl, 1);
					inventory.GiveItem(Items.LunarBadLuck, 1);
					inventory.GiveItem(Items.BoostAttackSpeed, Mathf.RoundToInt(num));
					inventory.GiveItem(Items.BoostDamage, Mathf.RoundToInt(3f * num));
					inventory.GiveItem(Items.BoostHp, Mathf.RoundToInt(5f * num));
				}
			}

			private static void LeashUberChimera()
			{
				//IL_0085: Unknown result type (might be due to invalid IL or missing references)
				//IL_008d: Unknown result type (might be due to invalid IL or missing references)
				//IL_0031: Unknown result type (might be due to invalid IL or missing references)
				//IL_00d3: 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_00da: Unknown result type (might be due to invalid IL or missing references)
				//IL_00df: Unknown result type (might be due to invalid IL or missing references)
				//IL_00ea: Unknown result type (might be due to invalid IL or missing references)
				//IL_00f5: Unknown result type (might be due to invalid IL or missing references)
				//IL_0104: Expected O, but got Unknown
				//IL_0112: Unknown result type (might be due to invalid IL or missing references)
				//IL_011c: Expected O, but got Unknown
				//IL_0133: Unknown result type (might be due to invalid IL or missing references)
				//IL_0138: Unknown result type (might be due to invalid IL or missing references)
				//IL_013a: Unknown result type (might be due to invalid IL or missing references)
				//IL_013e: Unknown result type (might be due to invalid IL or missing references)
				//IL_0143: Unknown result type (might be due to invalid IL or missing references)
				//IL_0148: Unknown result type (might be due to invalid IL or missing references)
				//IL_0161: Unknown result type (might be due to invalid IL or missing references)
				List<CharacterBody> list = new List<CharacterBody>();
				ReadOnlyCollection<TeamComponent> teamMembers = TeamComponent.GetTeamMembers((TeamIndex)2);
				for (int i = 0; i < teamMembers.Count; i++)
				{
					CharacterBody body = teamMembers[i].body;
					if (Object.op_Implicit((Object)(object)body) && IsUberChimera(body) && !PlayerWithinRange(body.corePosition, 180f))
					{
						list.Add(body);
					}
				}
				if (list.Count <= 0)
				{
					return;
				}
				SpawnCard val = ScriptableObject.CreateInstance<SpawnCard>();
				val.hullSize = (HullClassification)0;
				val.nodeGraphType = (GraphType)0;
				val.prefab = LegacyResourcesAPI.Load<GameObject>("SpawnCards/HelperPrefab");
				foreach (CharacterBody item in list)
				{
					CharacterBody randomControlledPlayer = GetRandomControlledPlayer();
					if (!Object.op_Implicit((Object)(object)randomControlledPlayer))
					{
						continue;
					}
					DirectorPlacementRule val2 = new DirectorPlacementRule
					{
						placementMode = (PlacementMode)1,
						minDistance = 45f,
						maxDistance = 90f,
						spawnOnTarget = randomControlledPlayer.transform
					};
					GameObject val3 = DirectorCore.instance.TrySpawnObject(new DirectorSpawnRequest(val, val2, RoR2Application.rng));
					if (Object.op_Implicit((Object)(object)val3))
					{
						Vector3 position = val3.transform.position;
						Vector3 val4 = position - randomControlledPlayer.corePosition;
						if (((Vector3)(ref val4)).sqrMagnitude < 14400f)
						{
							TeleportHelper.TeleportBody(item, position);
						}
						Object.Destroy((Object)(object)val3);
					}
				}
				Object.Destroy((Object)(object)val);
			}
		}

		public static class BleedState
		{
			public static bool activated = false;

			public static float activation = 600f;

			public static bool activated2 = false;

			public static float activation2 = 900f;
		}

		internal static bool disableFixedUpdate = true;

		public static bool enabled = false;

		public static bool reset = false;

		public static float timer = 99999f;

		public static float stopwatch = -99999f;

		public static float baseDamage = 24f;

		public static float baseTime = 360f;

		public static float phaseInterval = 60f;

		public static float damageFactor = 1f;

		public static float timeFactor = 1f;

		private static List<Blocker> activeBlocker = new List<Blocker>();

		internal static bool clearBlockerList = false;

		public static bool cachedEffectData = false;

		public static GameObject fissurePrefab;

		public static GameObject scorchPrefab;

		public static GameObject deathExplosionEffect;

		public static GameObject chargingEffectPrefab;

		public static GameObject areaIndicatorPrefab;

		public static BodyIndex lunarChimeraBodyIndex = (BodyIndex)(-1);

		public static SpawnCard lunarChimeraSpawnCard;

		private static void BlockerFixedUpdate()
		{
			for (int i = 0; i < activeBlocker.Count; i++)
			{
				Blocker blocker = activeBlocker[i];
				if (blocker != null)
				{
					blocker.timer -= Time.fixedDeltaTime;
					if (blocker.timer <= 0f || clearBlockerList)
					{
						activeBlocker.RemoveAt(i);
						i--;
					}
				}
			}
			clearBlockerList = false;
		}

		internal static void OnMeteorImpact(Vector3 position)
		{
			//IL_0023: Unknown result type (might be due to invalid IL or missing references)
			//IL_0030: Unknown result type (might be due to invalid IL or missing references)
			//IL_0049: Unknown result type (might be due to invalid IL or missing references)
			//IL_004a: Unknown result type (might be due to invalid IL or missing references)
			//IL_005e: Unknown result type (might be due to invalid IL or missing references)
			//IL_006e: Unknown result type (might be due to invalid IL or missing references)
			if ((ScorchState.activated || NovaState.activated) && activeBlocker.Count < 40 && PlayerWithinRange(position, 120f) && SpaceAvailable(position))
			{
				activeBlocker.Add(new Blocker
				{
					position = position
				});
				if (ScorchState.activated)
				{
					ScorchState.SpawnScorch(position);
				}
				if (NovaState.activated)
				{
					NovaState.ServerSendNovaEffect(position);
				}
			}
		}

		private static bool SpaceAvailable(Vector3 position)
		{
			//IL_0059: 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_0061: Unknown result type (might be due to invalid IL or missing references)
			//IL_0066: Unknown result type (might be due to invalid IL or missing references)
			float num = ((activeBlocker.Count < 21) ? 225f : ((activeBlocker.Count >= 31) ? 625f : 400f));
			for (int i = 0; i < activeBlocker.Count; i++)
			{
				Blocker blocker = activeBlocker[i];
				if (blocker != null)
				{
					Vector3 val = position - blocker.position;
					float sqrMagnitude = ((Vector3)(ref val)).sqrMagnitude;
					if (sqrMagnitude <= num)
					{
						return false;
					}
				}
			}
			return true;
		}

		private static bool PlayerWithinRange(Vector3 position, float radius)
		{
			//IL_0036: Unknown result type (might be due to invalid IL or missing references)
			//IL_0038: Unknown result type (might be due to invalid IL or missing references)
			//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)
			float num = radius * radius;
			ReadOnlyCollection<TeamComponent> teamMembers = TeamComponent.GetTeamMembers((TeamIndex)1);
			for (int i = 0; i < teamMembers.Count; i++)
			{
				CharacterBody body = teamMembers[i].body;
				if (Object.op_Implicit((Object)(object)body) && body.isPlayerControlled)
				{
					Vector3 val = position - body.corePosition;
					float sqrMagnitude = ((Vector3)(ref val)).sqrMagnitude;
					if (sqrMagnitude <= num)
					{
						return true;
					}
				}
			}
			return false;
		}

		private static CharacterBody GetRandomControlledPlayer()
		{
			List<CharacterBody> list = new List<CharacterBody>();
			ReadOnlyCollection<TeamComponent> teamMembers = TeamComponent.GetTeamMembers((TeamIndex)1);
			for (int i = 0; i < teamMembers.Count; i++)
			{
				CharacterBody body = teamMembers[i].body;
				if (Object.op_Implicit((Object)(object)body) && body.isPlayerControlled)
				{
					list.Add(body);
				}
			}
			if (list.Count > 0)
			{
				int index = Random.Range(0, list.Count - 1);
				return list[index];
			}
			return null;
		}

		private static Vector3 GetNearbyGroundNodePosition(Vector3 origin)
		{
			//IL_0063: Unknown result type (might be due to invalid IL or missing references)
			//IL_0068: Unknown result type (might be due to invalid IL or missing references)
			//IL_0018: Unknown result type (might be due to invalid IL or missing references)
			//IL_006c: Unknown result type (might be due to invalid IL or missing references)
			//IL_004a: Unknown result type (might be due to invalid IL or missing references)
			//IL_004f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0052: 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_005e: Unknown result type (might be due to invalid IL or missing references)
			NodeGraph groundNodes = SceneInfo.instance.groundNodes;
			if (Object.op_Implicit((Object)(object)groundNodes))
			{
				List<NodeIndex> list = groundNodes.FindNodesInRangeWithFlagConditions(origin, 10f, 45f, (HullMask)2, (NodeFlags)0, (NodeFlags)0, false);
				if (list.Count > 0)
				{
					NodeIndex val = list[Random.Range(0, list.Count - 1)];
					Vector3 result = default(Vector3);
					groundNodes.GetNodePosition(val, ref result);
					return result;
				}
			}
			return Vector3.zero;
		}

		internal static void MarkListsForClearing()
		{
			clearBlockerList = true;
			NovaState.clearNovaList = true;
		}

		internal static void MoonActivation()
		{
			if (!enabled && NetworkServer.active)
			{
				Display.sendSyncTime = false;
				enabled = true;
				reset = false;
				timer = 5f;
				stopwatch = 3600f;
				SetupValues();
				Display.SetServerDifficulty(damageFactor);
				LunarState.activation2 = 3600f + 30f * timeFactor;
				LunarState.activation3 = 3600f + 60f * timeFactor;
				BleedState.activation2 = 3600f + 120f * timeFactor;
			}
		}

		internal static void Reset()
		{
			Display.sendSyncTime = false;
			enabled = false;
			reset = true;
			timer = 5f;
			stopwatch = -99999f;
			MeteorState.activated = false;
			MeteorState.activated2 = false;
			MeteorState.activated3 = false;
			MeteorState.controller = null;
			FissureState.activated = false;
			FissureState.activated2 = false;
			FissureState.activated3 = false;
			ScorchState.activated = false;
			NovaState.activated = false;
			LunarState.activated = false;
			LunarState.activated2 = false;
			LunarState.activated3 = false;
			BleedState.activated = false;
			BleedState.activated2 = false;
		}

		internal static void Disable()
		{
			Display.sendSyncTime = false;
			enabled = false;
			reset = false;
			timer = 99999f;
			stopwatch = -99999f;
		}

		private static void SetupValues()
		{
			damageFactor = Mathf.Pow(Run.instance.difficultyCoefficient, 0.75f);
			timeFactor = (1f + 2f * Mathf.Pow(0.9f, (float)Run.instance.loopClearCount)) / 3f;
			baseTime = DiluvianArtifactPlugin.UnstabifactBaseTimer.Value;
			phaseInterval = DiluvianArtifactPlugin.UnstabifactPhaseTimer.Value;
			baseDamage = 24f * damageFactor;
			baseTime *= timeFactor;
			phaseInterval *= timeFactor;
			MeteorState.activation = GetPhaseTime(0);
			FissureState.activation = GetPhaseTime(1);
			ScorchState.activation = GetPhaseTime(2);
			NovaState.activation = GetPhaseTime(2);
			FissureState.activation2 = GetPhaseTime(3);
			LunarState.activation = GetPhaseTime(3);
			MeteorState.activation2 = GetPhaseTime(4);
			BleedState.activation = GetPhaseTime(4);
			FissureState.activation3 = GetPhaseTime(5);
			MeteorState.activation3 = GetPhaseTime(6);
			LunarState.activation2 = GetPhaseTime(6);
			LunarState.activation3 = GetPhaseTime(9);
			BleedState.activation2 = GetPhaseTime(9);
		}

		private static float GetPhaseTime(int phase)
		{
			return baseTime + (float)phase * phaseInterval;
		}

		private static void RecalcDamageValue()
		{
			float num = Mathf.Pow(Run.instance.difficultyCoefficient, 0.75f);
			if (damageFactor != num)
			{
				damageFactor = num;
				baseDamage = 24f * damageFactor;
				MeteorState.UpdateDamage();
				Display.SetServerDifficulty(damageFactor);
			}
		}

		internal static void OnFixedUpdate()
		{
			if (!disableFixedUpdate && Object.op_Implicit((Object)(object)Run.instance))
			{
				CacheEffectData();
				if (NetworkServer.active)
				{
					ServerUpdateTimer();
					BlockerFixedUpdate();
					MeteorState.FixedUpdate();
					FissureState.FixedUpdate();
					LunarState.FixedUpdate();
				}
				NovaState.FixedUpdate();
			}
		}

		private static void ServerUpdateTimer()
		{
			if (!Run.instance.isRunStopwatchPaused)
			{
				timer -= Time.fixedDeltaTime;
				stopwatch += Time.fixedDeltaTime;
				Display.SyncTimer();
			}
			if (timer < 0f)
			{
				timer = 0.333f;
				ResetState();
				if (enabled)
				{
					RecalcDamageValue();
					AdvanceState();
				}
			}
		}

		private static void ResetState()
		{
			if (reset)
			{
				reset = false;
				stopwatch = 0f;
				SetupValues();
				Display.sendSyncTime = false;
				if (ZetUnstabifact.Enabled && Object.op_Implicit((Object)(object)TeleporterInteraction.instance))
				{
					enabled = true;
					Display.sendSyncTime = true;
					Display.SetServerSyncTime(MeteorState.activation);
					Display.SetServerDifficulty(damageFactor);
				}
			}
		}

		private static void AdvanceState()
		{
			if (!MeteorState.activated && stopwatch > MeteorState.activation)
			{
				MeteorState.activated = true;
				MeteorState.ResetState();
				MeteorState.StartStorm();
				Display.SetServerSyncTime(FissureState.activation - stopwatch);
			}
			if (!FissureState.activated && stopwatch > FissureState.activation)
			{
				FissureState.activated = true;
				FissureState.ResetState();
				Display.SetServerSyncTime(ScorchState.activation - stopwatch);
			}
			if (!ScorchState.activated && stopwatch > ScorchState.activation)
			{
				ScorchState.activated = true;
			}
			if (!NovaState.activated && stopwatch > NovaState.activation)
			{
				NovaState.activated = true;
				Display.SetServerSyncTime(LunarState.activation - stopwatch);
			}
			if (FissureState.activated && !FissureState.activated2 && stopwatch > FissureState.activation2)
			{
				FissureState.activated2 = true;
			}
			if (!LunarState.activated && stopwatch > LunarState.activation)
			{
				LunarState.activated = true;
				LunarState.ResetState(1);
				Display.SetServerSyncTime(BleedState.activation - stopwatch);
			}
			if (MeteorState.activated && !MeteorState.activated2 && stopwatch > MeteorState.activation2)
			{
				MeteorState.activated2 = true;
			}
			if (!BleedState.activated && stopwatch > BleedState.activation)
			{
				BleedState.activated = true;
			}
			if (FissureState.activated2 && !FissureState.activated3 && stopwatch > FissureState.activation3)
			{
				FissureState.activated3 = true;
				FissureState.Hasten();
			}
			if (MeteorState.activated2 && !MeteorState.activated3 && stopwatch > MeteorState.activation3)
			{
				MeteorState.activated3 = true;
				MeteorState.Hasten();
			}
			if (LunarState.activated && !LunarState.activated2 && stopwatch > LunarState.activation2)
			{
				LunarState.activated2 = true;
				LunarState.ResetState(2);
			}
			if (LunarState.activated2 && !LunarState.activated3 && stopwatch > LunarState.activation3)
			{
				LunarState.activated3 = true;
				LunarState.ResetState(3);
			}
			if (BleedState.activated && !BleedState.activated2 && stopwatch > BleedState.activation2)
			{
				BleedState.activated2 = true;
			}
		}

		private static void CacheEffectData()
		{
			//IL_004b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0050: Unknown result type (might be due to invalid IL or missing references)
			if (!cachedEffectData)
			{
				cachedEffectData = true;
				fissurePrefab = FireRandomProjectiles.projectilePrefab;
				scorchPrefab = DeathState.projectilePrefab;
				deathExplosionEffect = DeathState.deathExplosionEffect;
				chargingEffectPrefab = ChargeMegaNova.chargingEffectPrefab;
				areaIndicatorPrefab = ChargeMegaNova.areaIndicatorPrefab;
				lunarChimeraBodyIndex = BodyCatalog.FindBodyIndex("LunarGolemBody");
				lunarChimeraSpawnCard = LegacyResourcesAPI.Load<SpawnCard>("SpawnCards/CharacterSpawnCards/cscLunarGolem");
			}
		}
	}
	public static class ZetEclifact
	{
		private static int state;

		public static bool Enabled
		{
			get
			{
				if (state < 1)
				{
					return false;
				}
				if (state > 1)
				{
					return true;
				}
				if (Object.op_Implicit((Object)(object)RunArtifactManager.instance) && RunArtifactManager.instance.IsArtifactEnabled(DiluvianArtifactContent.Artifacts.ZetEclifact))
				{
					return true;
				}
				return false;
			}
		}

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

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

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

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

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

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

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

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

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

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

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