Decompiled source of UmbralMithrixFork v2.5.6

plugins/UmbralMithrix/UmbralMithrix.dll

Decompiled 3 weeks ago
using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using System.Text;
using BepInEx;
using BepInEx.Bootstrap;
using BepInEx.Configuration;
using BepInEx.Logging;
using EntityStates;
using EntityStates.BrotherMonster;
using EntityStates.BrotherMonster.Weapon;
using EntityStates.Destructible;
using EntityStates.LunarWisp;
using EntityStates.Missions.BrotherEncounter;
using HG;
using IL.RoR2;
using IL.RoR2.CharacterAI;
using KinematicCharacterController;
using Microsoft.CodeAnalysis;
using Mono.Cecil.Cil;
using MonoMod.Cil;
using On.EntityStates;
using On.EntityStates.BrotherMonster;
using On.EntityStates.Destructible;
using On.EntityStates.Missions.BrotherEncounter;
using On.RoR2;
using On.RoR2.CharacterAI;
using R2API;
using Rewired.ComponentControls.Effects;
using RiskOfOptions;
using RiskOfOptions.OptionConfigs;
using RiskOfOptions.Options;
using RoR2;
using RoR2.CharacterAI;
using RoR2.ContentManagement;
using RoR2.Projectile;
using RoR2.Skills;
using RoR2BepInExPack.GameAssetPaths;
using UmbralMithrix.Components;
using UmbralMithrix.EntityStates;
using UnityEngine;
using UnityEngine.AddressableAssets;
using UnityEngine.Networking;
using UnityEngine.ResourceManagement.AsyncOperations;

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

		public RefSafetyRulesAttribute(int P_0)
		{
			Version = P_0;
		}
	}
}
namespace UmbralMithrix
{
	public class ArbitraryCrystalComponent : MonoBehaviour
	{
	}
	public class CloneController : MonoBehaviour
	{
		private List<CharacterBody> playerBodies = new List<CharacterBody>();

		private SpawnCard cloneCard = UmbralMithrix.mithrixGlassCard;

		private float stopwatch;

		private float interval = 8f;

		private void Start()
		{
			//IL_0015: Unknown result type (might be due to invalid IL or missing references)
			//IL_001b: Invalid comparison between Unknown and I4
			foreach (CharacterMaster readOnlyInstances in CharacterMaster.readOnlyInstancesList)
			{
				if ((int)readOnlyInstances.teamIndex == 1)
				{
					CharacterBody body = readOnlyInstances.GetBody();
					if (Object.op_Implicit((Object)(object)body) && body.isPlayerControlled)
					{
						playerBodies.Add(body);
					}
				}
			}
		}

		private void FixedUpdate()
		{
			//IL_0036: Unknown result type (might be due to invalid IL or missing references)
			//IL_003c: Invalid comparison between Unknown and I4
			//IL_008c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0092: Expected O, but got Unknown
			//IL_0094: Unknown result type (might be due to invalid IL or missing references)
			//IL_00cc: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d1: 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_00ee: Unknown result type (might be due to invalid IL or missing references)
			//IL_00fa: Unknown result type (might be due to invalid IL or missing references)
			//IL_0124: Expected O, but got Unknown
			stopwatch += Time.deltaTime;
			if (stopwatch < interval)
			{
				return;
			}
			foreach (CharacterMaster readOnlyInstances in CharacterMaster.readOnlyInstancesList)
			{
				if ((int)readOnlyInstances.teamIndex == 1)
				{
					CharacterBody body = readOnlyInstances.GetBody();
					if (Object.op_Implicit((Object)(object)body) && body.isPlayerControlled)
					{
						playerBodies.Add(body);
					}
				}
			}
			stopwatch %= interval;
			DirectorPlacementRule val = new DirectorPlacementRule();
			val.placementMode = (PlacementMode)3;
			val.minDistance = 8f;
			val.maxDistance = 16f;
			val.position = playerBodies[Random.Range(0, playerBodies.Count)].corePosition;
			Xoroshiro128Plus rng = RoR2Application.rng;
			DirectorCore.instance.TrySpawnObject(new DirectorSpawnRequest(cloneCard, val, rng)
			{
				summonerBodyObject = ((Component)this).gameObject,
				onSpawnedServer = delegate(SpawnResult spawnResult)
				{
					//IL_0000: Unknown result type (might be due to invalid IL or missing references)
					spawnResult.spawnedInstance.GetComponent<Inventory>().GiveItem(Items.HealthDecay, 6);
				}
			});
		}
	}
	public class DeathZoneController : MonoBehaviour
	{
		private SphereZone zone;

		private float stopwatch;

		private float interval = 1f;

		private float zoneRadius = 100f;

		private void Start()
		{
			zone = ((Component)this).GetComponent<SphereZone>();
		}

		private void FixedUpdate()
		{
			stopwatch += Time.deltaTime;
			if (!(stopwatch < interval))
			{
				stopwatch %= interval;
				if (zone.Networkradius > zoneRadius)
				{
					SphereZone obj = zone;
					obj.Networkradius -= 10f;
				}
			}
		}
	}
	public class P4Controller : MonoBehaviour
	{
		public bool finishedItemSteal;

		private CharacterBody body;

		private float shockwaveStopwatch;

		private float pizzaStopwatch;

		private float missileStopwatch;

		private float shockwaveInterval = 3.75f;

		private float pizzaInterval = 1.5f;

		private float missileInterval = 1.25f;

		private readonly List<CharacterBody> _trackedPlayers = new List<CharacterBody>();

		private void Start()
		{
			body = ((Component)this).GetComponent<CharacterBody>();
		}

		private void OnEnable()
		{
			foreach (PlayerCharacterMasterController instance in PlayerCharacterMasterController.instances)
			{
				if (Object.op_Implicit((Object)(object)instance) && instance.isConnected && Object.op_Implicit((Object)(object)instance.master))
				{
					CharacterBody val = instance.master.GetBody();
					if (Object.op_Implicit((Object)(object)val))
					{
						handlePlayerBody(val);
					}
				}
			}
			CharacterBody.onBodyStartGlobal += onBodyStartGlobal;
			CharacterBody.onBodyDestroyGlobal += onBodyDestroyGlobal;
		}

		private void OnDisable()
		{
			CharacterBody.onBodyStartGlobal -= onBodyStartGlobal;
			CharacterBody.onBodyDestroyGlobal -= onBodyDestroyGlobal;
			foreach (CharacterBody trackedPlayer in _trackedPlayers)
			{
				trackedPlayer.RemoveBuff(Buffs.TeamWarCry);
			}
			_trackedPlayers.Clear();
		}

		private void FixedUpdate()
		{
			//IL_01f6: Unknown result type (might be due to invalid IL or missing references)
			//IL_01fb: Unknown result type (might be due to invalid IL or missing references)
			//IL_0200: Unknown result type (might be due to invalid IL or missing references)
			//IL_0205: Unknown result type (might be due to invalid IL or missing references)
			//IL_03bd: Unknown result type (might be due to invalid IL or missing references)
			//IL_03c2: Unknown result type (might be due to invalid IL or missing references)
			//IL_03c7: Unknown result type (might be due to invalid IL or missing references)
			//IL_03cc: Unknown result type (might be due to invalid IL or missing references)
			//IL_03d4: Unknown result type (might be due to invalid IL or missing references)
			//IL_03d9: Unknown result type (might be due to invalid IL or missing references)
			//IL_0284: Unknown result type (might be due to invalid IL or missing references)
			//IL_0289: Unknown result type (might be due to invalid IL or missing references)
			//IL_03e9: Unknown result type (might be due to invalid IL or missing references)
			//IL_03ee: Unknown result type (might be due to invalid IL or missing references)
			//IL_03f3: Unknown result type (might be due to invalid IL or missing references)
			//IL_03f5: Unknown result type (might be due to invalid IL or missing references)
			//IL_03fa: Unknown result type (might be due to invalid IL or missing references)
			//IL_0406: Unknown result type (might be due to invalid IL or missing references)
			//IL_0408: Unknown result type (might be due to invalid IL or missing references)
			//IL_040a: Unknown result type (might be due to invalid IL or missing references)
			//IL_02cc: Unknown result type (might be due to invalid IL or missing references)
			//IL_02ce: Unknown result type (might be due to invalid IL or missing references)
			//IL_02d0: Unknown result type (might be due to invalid IL or missing references)
			//IL_02d5: Unknown result type (might be due to invalid IL or missing references)
			//IL_02b5: Unknown result type (might be due to invalid IL or missing references)
			//IL_02ba: Unknown result type (might be due to invalid IL or missing references)
			//IL_02c8: Unknown result type (might be due to invalid IL or missing references)
			//IL_02ca: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c9: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b7: 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_010f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0110: Unknown result type (might be due to invalid IL or missing references)
			//IL_0115: Unknown result type (might be due to invalid IL or missing references)
			//IL_02e5: Unknown result type (might be due to invalid IL or missing references)
			//IL_02ea: Unknown result type (might be due to invalid IL or missing references)
			//IL_02ef: Unknown result type (might be due to invalid IL or missing references)
			//IL_02f1: Unknown result type (might be due to invalid IL or missing references)
			//IL_02f6: Unknown result type (might be due to invalid IL or missing references)
			//IL_02ff: Unknown result type (might be due to invalid IL or missing references)
			//IL_0301: Unknown result type (might be due to invalid IL or missing references)
			//IL_0303: Unknown result type (might be due to invalid IL or missing references)
			//IL_0125: Unknown result type (might be due to invalid IL or missing references)
			//IL_0144: Unknown result type (might be due to invalid IL or missing references)
			//IL_0145: Unknown result type (might be due to invalid IL or missing references)
			//IL_014a: Unknown result type (might be due to invalid IL or missing references)
			//IL_014f: 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_015b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0160: Unknown result type (might be due to invalid IL or missing references)
			//IL_0169: 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_017f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0186: Unknown result type (might be due to invalid IL or missing references)
			//IL_0188: Unknown result type (might be due to invalid IL or missing references)
			//IL_01af: Unknown result type (might be due to invalid IL or missing references)
			if (!NetworkServer.active)
			{
				return;
			}
			if (finishedItemSteal && Object.op_Implicit((Object)(object)body.healthComponent) && body.healthComponent.alive)
			{
				missileStopwatch += Time.deltaTime;
				pizzaStopwatch += Time.deltaTime;
				shockwaveStopwatch += Time.deltaTime;
				if (missileStopwatch >= missileInterval)
				{
					missileStopwatch %= 1f;
					int num = 8;
					int num2 = 8;
					Vector3 val = (Object.op_Implicit((Object)(object)body.inputBank) ? body.inputBank.aimDirection : body.transform.forward);
					float num3 = 180f / (float)num;
					float num4 = (float)(3.0 + (double)(int)body.radius * 1.0);
					float damage = body.damage * 0.5f;
					Quaternion rotation = Util.QuaternionSafeLookRotation(val);
					for (int i = 0; i < num; i++)
					{
						Vector3 position = body.aimOrigin + Quaternion.AngleAxis((float)((double)(num2 - 1) * (double)num3 - (double)num3 * (double)(num - 1) / 2.0), val) * Vector3.up * num4;
						ProjectileManager.instance.FireProjectile(new FireProjectileInfo
						{
							projectilePrefab = UmbralMithrix.lunarMissile,
							position = position,
							rotation = rotation,
							owner = ((Component)this).gameObject,
							damage = damage,
							force = 100f
						});
						num2--;
					}
				}
			}
			if (pizzaStopwatch >= pizzaInterval)
			{
				pizzaStopwatch %= 1f;
				Vector3 val2 = Vector3.ProjectOnPlane(body.inputBank.aimDirection, Vector3.up);
				float num5 = 40f;
				Vector3 val3 = default(Vector3);
				((Vector3)(ref val3))..ctor((float)Random.Range(-45, -25), 0f, (float)Random.Range(-45, -25));
				if ((double)Random.value <= 0.5)
				{
					((Vector3)(ref val3))..ctor((float)Random.Range(25, 45), 0f, (float)Random.Range(25, 45));
				}
				GameObject val4 = UmbralMithrix.leftP4Line;
				if ((double)Random.value <= 0.5)
				{
					val4 = UmbralMithrix.rightP4Line;
				}
				Vector3 val5 = body.footPosition;
				if (_trackedPlayers.Count > 0)
				{
					Vector3 footPosition = _trackedPlayers[Random.Range(0, _trackedPlayers.Count)].footPosition;
					footPosition.y = 491f;
					val5 = footPosition;
				}
				val5 += val3;
				for (int j = 0; j < 9; j++)
				{
					Vector3 val6 = Quaternion.AngleAxis(num5 * (float)j, Vector3.up) * val2;
					ProjectileManager.instance.FireProjectile(val4, val5, Util.QuaternionSafeLookRotation(val6), ((Component)this).gameObject, body.damage * (UltChannelState.waveProjectileDamageCoefficient * 0.5f), UltChannelState.waveProjectileForce / 8f, Util.CheckRoll(body.crit, body.master), (DamageColorIndex)0, (GameObject)null, -1f, (DamageTypeCombo?)null);
				}
			}
			if (shockwaveStopwatch >= shockwaveInterval)
			{
				shockwaveStopwatch %= 1f;
				Util.PlaySound(ExitSkyLeap.soundString, ((Component)this).gameObject);
				float num6 = 360f / (float)ExitSkyLeap.waveProjectileCount;
				Vector3 val7 = Vector3.ProjectOnPlane(body.inputBank.aimDirection, Vector3.up);
				Vector3 footPosition2 = body.footPosition;
				for (int k = 0; k < ExitSkyLeap.waveProjectileCount; k++)
				{
					Vector3 val8 = Quaternion.AngleAxis(num6 * (float)k, Vector3.up) * val7;
					ProjectileManager.instance.FireProjectile(ExitSkyLeap.waveProjectilePrefab, footPosition2, Util.QuaternionSafeLookRotation(val8), ((Component)this).gameObject, body.damage * (ExitSkyLeap.waveProjectileDamageCoefficient * 0.75f), ExitSkyLeap.waveProjectileForce / 4f, Util.CheckRoll(body.crit, body.master), (DamageColorIndex)0, (GameObject)null, -1f, (DamageTypeCombo?)null);
				}
			}
		}

		private void onBodyStartGlobal(CharacterBody body)
		{
			if (body.isPlayerControlled)
			{
				handlePlayerBody(body);
			}
		}

		private void onBodyDestroyGlobal(CharacterBody body)
		{
			_trackedPlayers.Remove(body);
		}

		private void handlePlayerBody(CharacterBody playerBody)
		{
			if (!_trackedPlayers.Contains(playerBody))
			{
				_trackedPlayers.Add(playerBody);
				playerBody.AddBuff(Buffs.TeamWarCry);
			}
		}
	}
	public class SelfDestructController : MonoBehaviour
	{
		[CompilerGenerated]
		private sealed class <SelfDestruct>d__1 : IEnumerator<object>, IEnumerator, IDisposable
		{
			private int <>1__state;

			private object <>2__current;

			public SelfDestructController <>4__this;

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

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

			[DebuggerHidden]
			public <SelfDestruct>d__1(int <>1__state)
			{
				this.<>1__state = <>1__state;
			}

			[DebuggerHidden]
			void IDisposable.Dispose()
			{
				<>1__state = -2;
			}

			private bool MoveNext()
			{
				//IL_0029: Unknown result type (might be due to invalid IL or missing references)
				//IL_0033: Expected O, but got Unknown
				int num = <>1__state;
				SelfDestructController selfDestructController = <>4__this;
				switch (num)
				{
				default:
					return false;
				case 0:
					<>1__state = -1;
					<>2__current = (object)new WaitForSeconds(ModConfig.CrushingLeap.Value);
					<>1__state = 1;
					return true;
				case 1:
					<>1__state = -1;
					Object.Destroy((Object)(object)((Component)selfDestructController).gameObject);
					return false;
				}
			}

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

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

		private void Start()
		{
			((MonoBehaviour)this).StartCoroutine(SelfDestruct());
		}

		[IteratorStateMachine(typeof(<SelfDestruct>d__1))]
		private IEnumerator SelfDestruct()
		{
			//yield-return decompiler failed: Unexpected instruction in Iterator.Dispose()
			return new <SelfDestruct>d__1(0)
			{
				<>4__this = this
			};
		}
	}
	public class MiscHooks
	{
		[CompilerGenerated]
		private static class <>O
		{
			public static Action<SceneDef> <0>__onMostRecentSceneDefChanged;

			public static Action<Run> <1>__onRunStartGlobal;

			public static Manipulator <2>__TetherVfxOrigin_AddTether;
		}

		public MiscHooks()
		{
			//IL_000d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0017: Expected O, but got Unknown
			//IL_001e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0028: Expected O, but got Unknown
			//IL_002f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0039: Expected O, but got Unknown
			//IL_0040: Unknown result type (might be due to invalid IL or missing references)
			//IL_004a: Expected O, but got Unknown
			//IL_0051: Unknown result type (might be due to invalid IL or missing references)
			//IL_005b: 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_0073: Unknown result type (might be due to invalid IL or missing references)
			//IL_007d: Expected O, but got Unknown
			//IL_0084: Unknown result type (might be due to invalid IL or missing references)
			//IL_008e: Expected O, but got Unknown
			//IL_0095: Unknown result type (might be due to invalid IL or missing references)
			//IL_009f: Expected O, but got Unknown
			//IL_00e6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f0: Expected O, but got Unknown
			//IL_00f7: Unknown result type (might be due to invalid IL or missing references)
			//IL_0101: Expected O, but got Unknown
			//IL_0108: Unknown result type (might be due to invalid IL or missing references)
			//IL_0112: Expected O, but got Unknown
			//IL_0119: Unknown result type (might be due to invalid IL or missing references)
			//IL_0123: Expected O, but got Unknown
			//IL_012a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0134: Expected O, but got Unknown
			//IL_0144: Unknown result type (might be due to invalid IL or missing references)
			//IL_0149: Unknown result type (might be due to invalid IL or missing references)
			//IL_014f: Expected O, but got Unknown
			BaseAI.FindEnemyHurtBox += new Manipulator(TargetOnlyPlayers);
			CharacterBody.UpdateAllTemporaryVisualEffects += new Manipulator(AddUmbralParticles);
			CharacterModel.UpdateOverlays += new Manipulator(AddUmbralOverlay);
			CharacterModel.UpdateOverlays += new Manipulator(AddUmbralOverlayCrystal);
			BaseAI.FindEnemyHurtBox += new hook_FindEnemyHurtBox(ChangeP3CloneTargeting);
			CharacterMaster.OnBodyDeath += new hook_OnBodyDeath(CharacterMaster_OnBodyDeath);
			PurchaseInteraction.OnInteractionBegin += new hook_OnInteractionBegin(PurchaseInteraction_OnInteractionBegin);
			CombatDirector.OnEnable += new hook_OnEnable(CombatDirector_OnEnable);
			HealthComponent.TakeDamage += new hook_TakeDamage(HealthComponent_TakeDamage);
			SceneCatalog.onMostRecentSceneDefChanged += onMostRecentSceneDefChanged;
			Run.onRunStartGlobal += onRunStartGlobal;
			CharacterMaster.OnBodyStart += new hook_OnBodyStart(CharacterMaster_OnBodyStart);
			FrozenState.OnEnter += new hook_OnEnter(FrozenState_OnEnter);
			CharacterBody.AddTimedBuff_BuffDef_float += new hook_AddTimedBuff_BuffDef_float(AddTimedBuff_BuffDef_float);
			TimeCrystalDeath.OnEnter += new hook_OnEnter(RemoveUmbralImmune);
			ItemStealController.BrotherItemFilter += new hook_BrotherItemFilter(ItemStealController_BrotherItemFilter);
			object obj = <>O.<2>__TetherVfxOrigin_AddTether;
			if (obj == null)
			{
				Manipulator val = TetherVfxOrigin_AddTether;
				<>O.<2>__TetherVfxOrigin_AddTether = val;
				obj = (object)val;
			}
			TetherVfxOrigin.AddTether += (Manipulator)obj;
		}

		private static void TetherVfxOrigin_AddTether(ILContext il)
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_0007: Expected O, but got Unknown
			//IL_0050: Unknown result type (might be due to invalid IL or missing references)
			//IL_0063: Unknown result type (might be due to invalid IL or missing references)
			//IL_00bf: Unknown result type (might be due to invalid IL or missing references)
			//IL_00cc: Unknown result type (might be due to invalid IL or missing references)
			ILCursor val = new ILCursor(il);
			if (!val.TryGotoNext((MoveType)2, new Func<Instruction, bool>[1]
			{
				(Instruction x) => ILPatternMatchingExt.MatchLdfld<TetherVfxOrigin>(x, "onTetherAdded")
			}))
			{
				Log.Error("Failed to find onTetherAdded field load", "X:\\Git\\RoR2\\UmbralMithrix\\UmbralMithrix\\Hooks\\MiscHooks.cs", "TetherVfxOrigin_AddTether", 47);
				return;
			}
			val.Emit(OpCodes.Dup);
			ILLabel val2 = val.DefineLabel();
			val.Emit(OpCodes.Brfalse, (object)val2);
			if (!val.TryGotoNext((MoveType)2, new Func<Instruction, bool>[1]
			{
				(Instruction x) => ILPatternMatchingExt.MatchCallOrCallvirt<TetherAddDelegate>(x, "Invoke")
			}))
			{
				Log.Error("Failed to find onTetherAdded Invoke call", "X:\\Git\\RoR2\\UmbralMithrix\\UmbralMithrix\\Hooks\\MiscHooks.cs", "TetherVfxOrigin_AddTether", 58);
				return;
			}
			ILLabel val3 = val.DefineLabel();
			val.Emit(OpCodes.Br, (object)val3);
			val.Emit(OpCodes.Pop);
			val2.Target = val.Prev;
			val.MarkLabel(val3);
		}

		private bool ItemStealController_BrotherItemFilter(orig_BrotherItemFilter orig, ItemIndex itemIndex)
		{
			return false;
		}

		private void RemoveUmbralImmune(orig_OnEnter orig, TimeCrystalDeath self)
		{
			if (Object.op_Implicit((Object)(object)PhaseCounter.instance) && (PhaseCounter.instance.phase == 2 || PhaseCounter.instance.phase == 3))
			{
				TimeCrystalDeath.explosionDamageCoefficient = 0f;
				TimeCrystalDeath.explosionForce = 0f;
				GameObject val = ((PhaseCounter.instance.phase == 2) ? GameObject.Find("BrotherBody(Clone)") : GameObject.Find("BrotherHurtBodyP3(Clone)"));
				if (Object.op_Implicit((Object)(object)val) && val.GetComponent<CharacterBody>().HasBuff(Buffs.Immune) && UmbralMithrix.timeCrystals.Count == 1)
				{
					UmbralMithrix.timeCrystals.RemoveAt(0);
					val.GetComponent<CharacterBody>().RemoveBuff(Buffs.Immune);
				}
				else if (UmbralMithrix.timeCrystals.Count > 0)
				{
					UmbralMithrix.timeCrystals.RemoveAt(0);
				}
			}
			else
			{
				TimeCrystalDeath.explosionForce = 4000f;
				TimeCrystalDeath.explosionDamageCoefficient = 2f;
			}
			orig.Invoke(self);
		}

		private void TargetOnlyPlayers(ILContext il)
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_0007: Expected O, but got Unknown
			//IL_0039: Unknown result type (might be due to invalid IL or missing references)
			ILCursor val = new ILCursor(il);
			if (!val.TryGotoNext((MoveType)2, new Func<Instruction, bool>[1]
			{
				(Instruction x) => ILPatternMatchingExt.MatchCallOrCallvirt<BullseyeSearch>(x, "GetResults")
			}))
			{
				return;
			}
			val.Emit(OpCodes.Ldarg_0);
			val.EmitDelegate<Func<IEnumerable<HurtBox>, BaseAI, IEnumerable<HurtBox>>>((Func<IEnumerable<HurtBox>, BaseAI, IEnumerable<HurtBox>>)delegate(IEnumerable<HurtBox> results, BaseAI instance)
			{
				if (Object.op_Implicit((Object)(object)instance) && (((Object)instance.body).name == "BrotherBody(Clone)" || ((Object)instance.body).name == "BrotherGlassBody(Clone)" || ((Object)instance.body).name == "BrotherHurtBody(Clone)"))
				{
					IEnumerable<HurtBox> enumerable = results.Where(delegate(HurtBox hurtBox)
					{
						GameObject val2 = HurtBox.FindEntityObject(hurtBox);
						CharacterBody val3 = default(CharacterBody);
						return Object.op_Implicit((Object)(object)val2) && val2.TryGetComponent<CharacterBody>(ref val3) && val3.isPlayerControlled;
					});
					if (!enumerable.Any())
					{
						return results;
					}
					return enumerable;
				}
				return results;
			});
		}

		private HurtBox ChangeP3CloneTargeting(orig_FindEnemyHurtBox orig, BaseAI self, float maxDistance, bool full360Vision, bool filterByLoS)
		{
			if (Object.op_Implicit((Object)(object)self) && (((Object)self.body).name == "BrotherBody(Clone)" || ((Object)self.body).name == "BrotherGlassBody(Clone)" || ((Object)self.body).name == "BrotherHurtBody(Clone)") && Object.op_Implicit((Object)(object)PhaseCounter.instance) && PhaseCounter.instance.phase == 3)
			{
				maxDistance = float.PositiveInfinity;
				filterByLoS = false;
				full360Vision = true;
			}
			return orig.Invoke(self, maxDistance, full360Vision, filterByLoS);
		}

		private void AddUmbralParticles(ILContext il)
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_0007: Expected O, but got Unknown
			//IL_0045: Unknown result type (might be due to invalid IL or missing references)
			ILCursor val = new ILCursor(il);
			val.GotoNext(new Func<Instruction, bool>[1]
			{
				(Instruction x) => ILPatternMatchingExt.MatchLdsfld(x, typeof(Items), "InvadingDoppelganger")
			});
			val.Index += 2;
			val.Emit(OpCodes.Ldarg_0);
			val.EmitDelegate<Func<int, CharacterBody, int>>((Func<int, CharacterBody, int>)delegate(int vengeanceCount, CharacterBody self)
			{
				if (((Object)self).name.Contains("Brother") && Object.op_Implicit((Object)(object)self.inventory) && self.inventory.GetItemCount(UmbralMithrix.UmbralItem) > 0 && ModConfig.purpleMithrix.Value)
				{
					vengeanceCount++;
				}
				return vengeanceCount;
			});
		}

		private void AddUmbralOverlay(ILContext il)
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_0007: Expected O, but got Unknown
			//IL_0045: Unknown result type (might be due to invalid IL or missing references)
			ILCursor val = new ILCursor(il);
			val.GotoNext(new Func<Instruction, bool>[1]
			{
				(Instruction x) => ILPatternMatchingExt.MatchLdsfld(x, typeof(Items), "InvadingDoppelganger")
			});
			val.Index += 2;
			val.Emit(OpCodes.Ldarg_0);
			val.EmitDelegate<Func<int, CharacterModel, int>>((Func<int, CharacterModel, int>)delegate(int vengeanceCount, CharacterModel self)
			{
				if (((Object)self.body).name.Contains("Brother") && Object.op_Implicit((Object)(object)self.body.inventory) && self.body.inventory.GetItemCount(UmbralMithrix.UmbralItem) > 0 && ModConfig.purpleMithrix.Value)
				{
					vengeanceCount++;
				}
				return vengeanceCount;
			});
		}

		private void AddUmbralOverlayCrystal(ILContext il)
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_0007: Expected O, but got Unknown
			//IL_0045: Unknown result type (might be due to invalid IL or missing references)
			ILCursor val = new ILCursor(il);
			val.GotoNext(new Func<Instruction, bool>[1]
			{
				(Instruction x) => ILPatternMatchingExt.MatchLdsfld(x, typeof(Items), "InvadingDoppelganger")
			});
			val.Index -= 1;
			val.Emit(OpCodes.Ldarg_0);
			val.EmitDelegate<Func<bool, CharacterModel, bool>>((Func<bool, CharacterModel, bool>)((bool hasInventory, CharacterModel self) => (((Object)self.body).name.Contains("Crystal") && Object.op_Implicit((Object)(object)((Component)self.body).gameObject.GetComponent<ArbitraryCrystalComponent>())) || hasInventory));
		}

		private void HealthComponent_TakeDamage(orig_TakeDamage orig, HealthComponent self, DamageInfo damageInfo)
		{
			CharacterBody body = self.body;
			if (Object.op_Implicit((Object)(object)body) && Object.op_Implicit((Object)(object)self) && ((Object)body).name == "BrotherBody(Clone)" && PhaseCounter.instance.phase == 2 && !UmbralMithrix.p2ThresholdReached && self.health - damageInfo.damage <= self.fullHealth * 0.75f)
			{
				UmbralMithrix.p2ThresholdReached = true;
				P2ThresholdEvent(((Component)body).gameObject);
				self.health = self.fullHealth * 0.75f;
				damageInfo.rejected = true;
				GameObject.Find("BrotherBody(Clone)").GetComponent<CharacterBody>().AddBuff(Buffs.Immune);
			}
			if (Object.op_Implicit((Object)(object)body) && Object.op_Implicit((Object)(object)self) && ((Object)body).name == "BrotherHurtBodyP3(Clone)" && PhaseCounter.instance.phase == 3 && !UmbralMithrix.p3ThresholdReached && self.health - damageInfo.damage <= self.fullHealth * 0.75f)
			{
				UmbralMithrix.p3ThresholdReached = true;
				GameObject.Find("BrotherBody(Clone)").GetComponent<HealthComponent>().health = 1f;
				P3ThresholdEvent(((Component)body).gameObject);
				self.health = self.fullHealth * 0.75f;
				damageInfo.rejected = true;
				GameObject.Find("BrotherHurtBodyP3(Clone)").GetComponent<CharacterBody>().AddBuff(Buffs.Immune);
			}
			orig.Invoke(self, damageInfo);
		}

		private void CharacterMaster_OnBodyStart(orig_OnBodyStart orig, CharacterMaster self, CharacterBody body)
		{
			//IL_01aa: Unknown result type (might be due to invalid IL or missing references)
			//IL_01b4: Expected O, but got Unknown
			//IL_01ba: Unknown result type (might be due to invalid IL or missing references)
			//IL_01c4: Expected O, but got Unknown
			//IL_0153: Unknown result type (might be due to invalid IL or missing references)
			//IL_0159: Unknown result type (might be due to invalid IL or missing references)
			orig.Invoke(self, body);
			if (!Object.op_Implicit((Object)(object)PhaseCounter.instance))
			{
				return;
			}
			if (((Object)body).name == "BrotherHurtBodyP3(Clone)")
			{
				if (ModConfig.purpleMithrix.Value)
				{
					self.inventory.GiveItem(UmbralMithrix.UmbralItem, 1);
				}
				self.inventory.GiveItem(Items.AdaptiveArmor, 1);
			}
			if ((((Object)body).name == "BrotherBody(Clone)" || ((Object)body).name == "BrotherGlassBody(Clone)") && ModConfig.purpleMithrix.Value)
			{
				self.inventory.GiveItem(UmbralMithrix.UmbralItem, 1);
			}
			if (((Object)body).name == "BrotherBody(Clone)")
			{
				if (Object.op_Implicit((Object)(object)PhaseCounter.instance) && PhaseCounter.instance.phase != 3)
				{
					((Component)body).gameObject.AddComponent<CloneController>();
				}
				if (Object.op_Implicit((Object)(object)PhaseCounter.instance) && PhaseCounter.instance.phase == 1)
				{
					ChildLocator component = ((Component)SceneInfo.instance).GetComponent<ChildLocator>();
					if (Object.op_Implicit((Object)(object)component))
					{
						Transform val = component.FindChild("CenterOfArena");
						if (Object.op_Implicit((Object)(object)val))
						{
							Object.Destroy((Object)(object)((Component)val).gameObject);
						}
					}
				}
			}
			if (((Object)body).name == "BrotherHurtBody(Clone)" && PhaseCounter.instance.phase == 4)
			{
				if (ModConfig.skipPhase4.Value)
				{
					body.healthComponent.Suicide((GameObject)null, (GameObject)null, default(DamageTypeCombo));
					return;
				}
				body.levelMoveSpeed = 0f;
				body.baseMoveSpeed = 0f;
				body.inventory.GiveItem(UmbralMithrix.UmbralItem, 1);
				body.AddBuff(Buffs.Immune);
				body.inventory.GiveItem(Items.HealthDecay, 40);
				((Component)body).GetComponent<SkillLocator>().primary = new GenericSkill();
				((Component)body).GetComponent<SkillLocator>().secondary = new GenericSkill();
			}
		}

		private void CharacterMaster_OnBodyDeath(orig_OnBodyDeath orig, CharacterMaster self, CharacterBody body)
		{
			orig.Invoke(self, body);
			if (NetworkServer.active && body.isPlayerControlled && UmbralMithrix.practiceModeEnabled && !self.IsExtraLifePendingServer() && Object.op_Implicit((Object)(object)PhaseCounter.instance))
			{
				self.RespawnExtraLife();
			}
		}

		private void CombatDirector_OnEnable(orig_OnEnable orig, CombatDirector self)
		{
			if (Object.op_Implicit((Object)(object)PhaseCounter.instance) && (PhaseCounter.instance.phase == 2 || PhaseCounter.instance.phase == 3))
			{
				((Component)self).gameObject.SetActive(false);
			}
			else
			{
				orig.Invoke(self);
			}
		}

		private void P2ThresholdEvent(GameObject summoner)
		{
			//IL_0020: Unknown result type (might be due to invalid IL or missing references)
			//IL_0026: Expected O, but got Unknown
			//IL_0028: 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_0068: Unknown result type (might be due to invalid IL or missing references)
			//IL_006d: 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_00a5: Expected O, but got Unknown
			UmbralMithrix.timeCrystals.Clear();
			int num = 4;
			for (int i = 0; i < num; i++)
			{
				DirectorPlacementRule val = new DirectorPlacementRule();
				val.placementMode = (PlacementMode)3;
				val.minDistance = 3f;
				val.maxDistance = 10f;
				val.position = UmbralMithrix.p23PizzaPoints[i];
				Xoroshiro128Plus rng = RoR2Application.rng;
				DirectorCore.instance.TrySpawnObject(new DirectorSpawnRequest(UmbralMithrix.timeCrystalCard, val, rng)
				{
					summonerBodyObject = summoner,
					onSpawnedServer = delegate(SpawnResult spawnResult)
					{
						//IL_0000: Unknown result type (might be due to invalid IL or missing references)
						//IL_000c: Unknown result type (might be due to invalid IL or missing references)
						//IL_001d: Unknown result type (might be due to invalid IL or missing references)
						spawnResult.spawnedInstance.AddComponent<ArbitraryCrystalComponent>();
						spawnResult.spawnedInstance.GetComponent<TeamComponent>().teamIndex = (TeamIndex)2;
						TetherVfxOrigin obj = spawnResult.spawnedInstance.gameObject.AddComponent<TetherVfxOrigin>();
						obj.tetherPrefab = UmbralMithrix.tether;
						obj.AddTether(summoner.transform);
					}
				});
				UmbralMithrix.timeCrystals.Add(summoner);
			}
		}

		private void P3ThresholdEvent(GameObject summoner)
		{
			//IL_0020: Unknown result type (might be due to invalid IL or missing references)
			//IL_0026: Expected O, but got Unknown
			//IL_0028: 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_0068: Unknown result type (might be due to invalid IL or missing references)
			//IL_006d: 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_00a5: Expected O, but got Unknown
			UmbralMithrix.timeCrystals.Clear();
			int num = 4;
			for (int i = 0; i < num; i++)
			{
				DirectorPlacementRule val = new DirectorPlacementRule();
				val.placementMode = (PlacementMode)3;
				val.minDistance = 3f;
				val.maxDistance = 10f;
				val.position = UmbralMithrix.p23PizzaPoints[i];
				Xoroshiro128Plus rng = RoR2Application.rng;
				DirectorCore.instance.TrySpawnObject(new DirectorSpawnRequest(UmbralMithrix.timeCrystalCard, val, rng)
				{
					summonerBodyObject = summoner,
					onSpawnedServer = delegate(SpawnResult spawnResult)
					{
						//IL_0000: Unknown result type (might be due to invalid IL or missing references)
						//IL_000c: Unknown result type (might be due to invalid IL or missing references)
						//IL_001d: Unknown result type (might be due to invalid IL or missing references)
						spawnResult.spawnedInstance.AddComponent<ArbitraryCrystalComponent>();
						spawnResult.spawnedInstance.GetComponent<TeamComponent>().teamIndex = (TeamIndex)2;
						TetherVfxOrigin obj = spawnResult.spawnedInstance.gameObject.AddComponent<TetherVfxOrigin>();
						obj.tetherPrefab = UmbralMithrix.tether;
						obj.AddTether(summoner.transform);
					}
				});
				UmbralMithrix.timeCrystals.Add(summoner);
			}
		}

		private static void onRunStartGlobal(Run run)
		{
			UmbralMithrix.practiceModeEnabled = false;
		}

		private static void onMostRecentSceneDefChanged(SceneDef sceneDef)
		{
			if (sceneDef.cachedName == "moon2")
			{
				UmbralMithrix.ArenaSetup();
				UmbralMithrix.SpawnPracticeModeShrine();
			}
		}

		private void PurchaseInteraction_OnInteractionBegin(orig_OnInteractionBegin orig, PurchaseInteraction self, Interactor activator)
		{
			if (((Object)self).name == "PracticeModeShrine")
			{
				UmbralMithrix.practiceModeEnabled = true;
			}
			orig.Invoke(self, activator);
		}

		private void FrozenState_OnEnter(orig_OnEnter orig, FrozenState self)
		{
			//IL_002a: Unknown result type (might be due to invalid IL or missing references)
			//IL_002f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0054: Unknown result type (might be due to invalid IL or missing references)
			//IL_005b: 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)
			if (((Object)((EntityState)self).characterBody).name == "BrotherBody(Clone)" && Random.value > 0.5f)
			{
				Ray aimRay = ((BaseState)self).GetAimRay();
				for (int i = 0; i < 6; i++)
				{
					Util.PlaySound(FireLunarShards.fireSound, ((EntityState)self).gameObject);
					ProjectileManager.instance.FireProjectile(FireLunarShards.projectilePrefab, ((Ray)(ref aimRay)).origin, Quaternion.LookRotation(((Ray)(ref aimRay)).direction), ((EntityState)self).gameObject, (float)((double)((EntityState)self).characterBody.damage * 0.100000001490116 / 12.0), 0f, Util.CheckRoll(((EntityState)self).characterBody.crit, ((EntityState)self).characterBody.master), (DamageColorIndex)0, (GameObject)null, -1f, (DamageTypeCombo?)null);
				}
			}
			orig.Invoke(self);
		}

		private void AddTimedBuff_BuffDef_float(orig_AddTimedBuff_BuffDef_float orig, CharacterBody self, BuffDef buffDef, float duration)
		{
			//IL_006e: 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_007e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0051: Unknown result type (might be due to invalid IL or missing references)
			//IL_005c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0061: Unknown result type (might be due to invalid IL or missing references)
			//IL_0083: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ac: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b1: Unknown result type (might be due to invalid IL or missing references)
			if (((Object)self).name == "BrotherBody(Clone)" && (Object)(object)buffDef == (Object)(object)Buffs.Nullified && Random.value < 0.25f)
			{
				duration /= 2f;
				Ray val = (Object.op_Implicit((Object)(object)self.inputBank) ? new Ray(self.inputBank.aimOrigin, self.inputBank.aimDirection) : new Ray(self.transform.position, self.transform.forward));
				for (int i = 0; i < 6; i++)
				{
					Util.PlaySound(FireLunarShards.fireSound, ((Component)self).gameObject);
					ProjectileManager.instance.FireProjectile(FireLunarShards.projectilePrefab, ((Ray)(ref val)).origin, Quaternion.LookRotation(((Ray)(ref val)).direction), ((Component)self).gameObject, (float)((double)self.damage * 0.100000001490116 / 12.0), 0f, Util.CheckRoll(self.crit, self.master), (DamageColorIndex)0, (GameObject)null, -1f, (DamageTypeCombo?)null);
				}
			}
			orig.Invoke(self, buffDef, duration);
		}

		private void SetPosition(Vector3 newPosition, CharacterBody body)
		{
			//IL_0019: Unknown result type (might be due to invalid IL or missing references)
			//IL_001a: Unknown result type (might be due to invalid IL or missing references)
			if (Object.op_Implicit((Object)(object)body.characterMotor))
			{
				((BaseCharacterController)body.characterMotor).Motor.SetPositionAndRotation(newPosition, Quaternion.identity, true);
			}
		}
	}
	public class MissionHooks
	{
		public MissionHooks()
		{
			//IL_000d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0017: Expected O, but got Unknown
			//IL_001e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0028: Expected O, but got Unknown
			//IL_002f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0039: Expected O, but got Unknown
			//IL_0040: Unknown result type (might be due to invalid IL or missing references)
			//IL_004a: Expected O, but got Unknown
			//IL_0051: Unknown result type (might be due to invalid IL or missing references)
			//IL_005b: 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
			BrotherEncounterPhaseBaseState.OnEnter += new hook_OnEnter(BrotherEncounterPhaseBaseStateOnEnter);
			Phase1.OnEnter += new hook_OnEnter(Phase1OnEnter);
			Phase2.OnEnter += new hook_OnEnter(Phase2OnEnter);
			Phase3.OnEnter += new hook_OnEnter(Phase3OnEnter);
			Phase4.OnEnter += new hook_OnEnter(Phase4OnEnter);
			BossDeath.OnEnter += new hook_OnEnter(BossDeathOnEnter);
		}

		private void Phase1OnEnter(orig_OnEnter orig, Phase1 self)
		{
			//IL_002c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0031: Unknown result type (might be due to invalid IL or missing references)
			//IL_0077: Unknown result type (might be due to invalid IL or missing references)
			//IL_008b: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a9: Unknown result type (might be due to invalid IL or missing references)
			UmbralMithrix.spawnedClone = false;
			UmbralMithrix.p2ThresholdReached = false;
			UmbralMithrix.p3ThresholdReached = false;
			UmbralMithrix.finishedItemSteal = false;
			UmbralMithrix.mithrix.GetComponent<EntityStateMachine>().initialStateType = new SerializableEntityStateType(typeof(ThroneSpawnState));
			GameObject val = GameObject.Find("EscapeSequenceController");
			if (Object.op_Implicit((Object)(object)val))
			{
				Transform val2 = val.transform.Find("EscapeSequenceObjects/Mega Glows");
				if (Object.op_Implicit((Object)(object)val2))
				{
					Object.Instantiate<GameObject>(((Component)val2).gameObject, new Vector3(-88.5f, 491.5f, -0.3f), Quaternion.Euler(270f, 0f, 0f)).transform.localScale = new Vector3(0.1f, 0.1f, 0.1f);
				}
			}
			orig.Invoke(self);
		}

		private void Phase2OnEnter(orig_OnEnter orig, Phase2 self)
		{
			//IL_0014: Unknown result type (might be due to invalid IL or missing references)
			//IL_0019: Unknown result type (might be due to invalid IL or missing references)
			UmbralMithrix.mithrix.GetComponent<EntityStateMachine>().initialStateType = new SerializableEntityStateType(typeof(SkySpawnState));
			((BrotherEncounterBaseState)self).KillAllMonsters();
			orig.Invoke(self);
		}

		private void Phase3OnEnter(orig_OnEnter orig, Phase3 self)
		{
			((BrotherEncounterBaseState)self).KillAllMonsters();
			orig.Invoke(self);
		}

		private void Phase4OnEnter(orig_OnEnter orig, Phase4 self)
		{
			//IL_0014: Unknown result type (might be due to invalid IL or missing references)
			//IL_0019: Unknown result type (might be due to invalid IL or missing references)
			//IL_0042: Unknown result type (might be due to invalid IL or missing references)
			//IL_004c: Expected O, but got Unknown
			//IL_004d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0057: Expected O, but got Unknown
			//IL_0058: Unknown result type (might be due to invalid IL or missing references)
			//IL_0062: 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
			GameObject obj = Object.Instantiate<GameObject>(UmbralMithrix.voidling, new Vector3(-88.5f, 520f, -0.3f), Quaternion.identity);
			obj.AddComponent<DeathZoneController>();
			obj.GetComponent<TeamComponent>().teamIndex = (TeamIndex)2;
			SkillLocator skillLocator = obj.GetComponent<CharacterBody>().skillLocator;
			skillLocator.primary = new GenericSkill();
			skillLocator.secondary = new GenericSkill();
			skillLocator.utility = new GenericSkill();
			skillLocator.special = new GenericSkill();
			NetworkServer.Spawn(obj);
			orig.Invoke(self);
		}

		private void BossDeathOnEnter(orig_OnEnter orig, BossDeath self)
		{
			//IL_001a: 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)
			orig.Invoke(self);
			GameObject.Find("InactiveVoidling(Clone)").GetComponent<HealthComponent>().Suicide((GameObject)null, (GameObject)null, default(DamageTypeCombo));
		}

		private void BrotherEncounterPhaseBaseStateOnEnter(orig_OnEnter orig, BrotherEncounterPhaseBaseState self)
		{
			//IL_00c1: 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_00ea: Unknown result type (might be due to invalid IL or missing references)
			//IL_0105: Unknown result type (might be due to invalid IL or missing references)
			//IL_0106: Unknown result type (might be due to invalid IL or missing references)
			//IL_0116: Unknown result type (might be due to invalid IL or missing references)
			//IL_0118: Unknown result type (might be due to invalid IL or missing references)
			//IL_012f: Unknown result type (might be due to invalid IL or missing references)
			//IL_014c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0158: Unknown result type (might be due to invalid IL or missing references)
			//IL_0173: Unknown result type (might be due to invalid IL or missing references)
			//IL_0174: Unknown result type (might be due to invalid IL or missing references)
			//IL_0184: Unknown result type (might be due to invalid IL or missing references)
			//IL_0186: Unknown result type (might be due to invalid IL or missing references)
			//IL_019d: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ba: Unknown result type (might be due to invalid IL or missing references)
			//IL_01c6: Unknown result type (might be due to invalid IL or missing references)
			//IL_01e1: Unknown result type (might be due to invalid IL or missing references)
			//IL_01e2: Unknown result type (might be due to invalid IL or missing references)
			//IL_01f2: Unknown result type (might be due to invalid IL or missing references)
			//IL_01f4: Unknown result type (might be due to invalid IL or missing references)
			orig.Invoke(self);
			if (!NetworkServer.active || (Object)(object)self.phaseScriptedCombatEncounter == (Object)null || !Object.op_Implicit((Object)(object)PhaseCounter.instance))
			{
				return;
			}
			((BrotherEncounterBaseState)self).childLocator = ((EntityState)self).GetComponent<ChildLocator>();
			Transform val = ((BrotherEncounterBaseState)self).childLocator.FindChild("ArenaWalls");
			Material doppelMat = UmbralMithrix.doppelMat;
			if (Object.op_Implicit((Object)(object)val))
			{
				((Component)val).gameObject.SetActive(((BrotherEncounterBaseState)self).shouldEnableArenaWalls);
				if (ModConfig.purpleArena.Value)
				{
					Renderer[] componentsInChildren = ((Component)val).GetComponentsInChildren<Renderer>();
					for (int i = 0; i < componentsInChildren.Length; i++)
					{
						componentsInChildren[i].material = doppelMat;
					}
				}
			}
			self.phaseBossGroup.bestObservedName = "Umbral Mithrix";
			self.phaseBossGroup.bestObservedSubtitle = "<sprite name=\"CloudLeft\"> The Collective <sprite name=\"CloudRight\">";
			if (PhaseCounter.instance.phase == 2)
			{
				Transform transform = new GameObject().transform;
				transform.position = new Vector3(-88.5f, 491.5f, -0.3f);
				SpawnInfo val2 = default(SpawnInfo);
				val2.explicitSpawnPosition = transform;
				val2.spawnCard = UmbralMithrix.mithrixCard;
				SpawnInfo val3 = val2;
				self.phaseScriptedCombatEncounter.spawns = (SpawnInfo[])(object)new SpawnInfo[1] { val3 };
			}
			if (PhaseCounter.instance.phase == 3)
			{
				Transform transform2 = new GameObject().transform;
				transform2.position = new Vector3(-88.5f, 491.5f, -0.3f);
				SpawnInfo val2 = default(SpawnInfo);
				val2.explicitSpawnPosition = transform2;
				val2.spawnCard = UmbralMithrix.mithrixHurtP3Card;
				SpawnInfo val4 = val2;
				self.phaseScriptedCombatEncounter.spawns = (SpawnInfo[])(object)new SpawnInfo[1] { val4 };
			}
			if (PhaseCounter.instance.phase == 4)
			{
				Transform transform3 = new GameObject().transform;
				transform3.position = new Vector3(-88.5f, 491.5f, -0.3f);
				SpawnInfo val2 = default(SpawnInfo);
				val2.explicitSpawnPosition = transform3;
				val2.spawnCard = UmbralMithrix.mithrixHurtCard;
				SpawnInfo val5 = val2;
				self.phaseScriptedCombatEncounter.spawns = (SpawnInfo[])(object)new SpawnInfo[1] { val5 };
			}
		}
	}
	public class MithrixMiscHooks
	{
		public MithrixMiscHooks()
		{
			//IL_000d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0017: Expected O, but got Unknown
			//IL_001e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0028: Expected O, but got Unknown
			//IL_002f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0039: Expected O, but got Unknown
			//IL_0040: Unknown result type (might be due to invalid IL or missing references)
			//IL_004a: Expected O, but got Unknown
			SkyLeapDeathState.OnEnter += new hook_OnEnter(SkyLeapDeathState_OnEnter);
			SpellChannelExitState.OnEnter += new hook_OnEnter(SpellChannelExitState_OnEnter);
			StaggerEnter.OnEnter += new hook_OnEnter(StaggerEnter_OnEnter);
			TrueDeathState.OnEnter += new hook_OnEnter(TrueDeathState_OnEnter);
		}

		private void SkyLeapDeathState_OnEnter(orig_OnEnter orig, SkyLeapDeathState self)
		{
			if (((Object)((EntityState)self).characterBody).name == "BrotherGlassBody(Clone)" && Object.op_Implicit((Object)(object)PhaseCounter.instance) && PhaseCounter.instance.phase == 2)
			{
				((GenericCharacterDeath)self).DestroyModel();
				if (NetworkServer.active)
				{
					((GenericCharacterDeath)self).DestroyBodyAsapServer();
				}
			}
			else
			{
				orig.Invoke(self);
			}
		}

		private void SpellChannelExitState_OnEnter(orig_OnEnter orig, SpellChannelExitState self)
		{
			//IL_0033: Unknown result type (might be due to invalid IL or missing references)
			//IL_0039: Invalid comparison between Unknown and I4
			//IL_008d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0092: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a2: Expected O, but got Unknown
			//IL_0069: Unknown result type (might be due to invalid IL or missing references)
			//IL_006f: Unknown result type (might be due to invalid IL or missing references)
			UmbralMithrix.finishedItemSteal = true;
			((Component)((EntityState)self).characterBody).gameObject.GetComponent<P4Controller>().finishedItemSteal = true;
			bool flag = false;
			foreach (CharacterMaster readOnlyInstances in CharacterMaster.readOnlyInstancesList)
			{
				if ((int)readOnlyInstances.teamIndex == 1)
				{
					CharacterBody body = readOnlyInstances.GetBody();
					if (Object.op_Implicit((Object)(object)body) && !body.isPlayerControlled && Object.op_Implicit((Object)(object)body.healthComponent))
					{
						body.healthComponent.Suicide((GameObject)null, (GameObject)null, default(DamageTypeCombo));
					}
				}
			}
			if (flag)
			{
				Chat.SendBroadcastChat((ChatMessageBase)new SimpleChatMessage
				{
					baseToken = "UMBRAL_KILLED_ALL_ALLIES_MESAAGE"
				});
			}
			orig.Invoke(self);
		}

		private void StaggerEnter_OnEnter(orig_OnEnter orig, StaggerEnter self)
		{
			//IL_002a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0034: Expected O, but got Unknown
			//IL_0063: Unknown result type (might be due to invalid IL or missing references)
			//IL_0069: Expected O, but got Unknown
			//IL_006b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0096: Unknown result type (might be due to invalid IL or missing references)
			//IL_009b: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ad: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b3: Expected O, but got Unknown
			((StaggerBaseState)self).duration = 0f;
			if (Object.op_Implicit((Object)(object)PhaseCounter.instance) && PhaseCounter.instance.phase == 4)
			{
				((EntityState)self).outer.SetNextState((EntityState)new SpellChannelEnterState());
			}
			if (Object.op_Implicit((Object)(object)PhaseCounter.instance) && PhaseCounter.instance.phase == 3 && !UmbralMithrix.spawnedClone)
			{
				UmbralMithrix.spawnedClone = true;
				DirectorPlacementRule val = new DirectorPlacementRule();
				val.placementMode = (PlacementMode)3;
				val.minDistance = 3f;
				val.maxDistance = 20f;
				val.position = new Vector3(-88.5f, 491.5f, -0.3f);
				Xoroshiro128Plus rng = RoR2Application.rng;
				DirectorSpawnRequest val2 = new DirectorSpawnRequest(UmbralMithrix.mithrixCard, val, rng);
				val2.summonerBodyObject = ((EntityState)self).gameObject;
				val2.onSpawnedServer = (Action<SpawnResult>)Delegate.Combine(val2.onSpawnedServer, (Action<SpawnResult>)delegate(SpawnResult spawnResult)
				{
					//IL_0000: Unknown result type (might be due to invalid IL or missing references)
					CharacterMaster component = spawnResult.spawnedInstance.GetComponent<CharacterMaster>();
					component.GetBody().AddBuff(Buffs.Immune);
					BaseAI[] components = ((Component)component).GetComponents<BaseAI>();
					foreach (BaseAI val3 in components)
					{
						if (Object.op_Implicit((Object)(object)val3))
						{
							val3.fullVision = true;
							val3.neverRetaliateFriendlies = true;
						}
					}
				});
				DirectorCore.instance.TrySpawnObject(val2);
			}
			orig.Invoke(self);
		}

		private void TrueDeathState_OnEnter(orig_OnEnter orig, TrueDeathState self)
		{
			//IL_0011: 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_002a: Unknown result type (might be due to invalid IL or missing references)
			//IL_002f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0034: Unknown result type (might be due to invalid IL or missing references)
			//IL_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_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_0059: 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_0063: Unknown result type (might be due to invalid IL or missing references)
			TrueDeathState.dissolveDuration = 3f;
			if (!UmbralMithrix.practiceModeEnabled)
			{
				Vector3 val = Vector3.up * 40f + Vector3.forward * 2f;
				PickupDropletController.CreatePickupDroplet(PickupCatalog.FindPickupIndex(UmbralMithrix.UmbralItem.itemIndex), ((EntityState)self).characterBody.footPosition + Vector3.up * 1.5f, val);
			}
			UmbralMithrix.practiceModeEnabled = false;
			orig.Invoke(self);
		}
	}
	internal static class LanguageManager
	{
		public static void Register(string searchFolder, string langFolderName = "lang")
		{
			string langFolderPath = Path.Combine(searchFolder, langFolderName);
			if (Directory.Exists(langFolderPath))
			{
				Language.collectLanguageRootFolders += delegate(List<string> folders)
				{
					folders.Add(langFolderPath);
				};
			}
			else
			{
				Log.Error("Lang folder not found: " + langFolderPath, "X:\\Git\\RoR2\\UmbralMithrix\\UmbralMithrix\\LanguageManager.cs", "Register", 20);
			}
		}
	}
	internal static class Log
	{
		private static readonly StringBuilder _sharedStringBuilder;

		private static readonly int _cachedCallerPathPrefixLength;

		private static ManualLogSource _logSource;

		static Log()
		{
			_sharedStringBuilder = new StringBuilder(256);
			_cachedCallerPathPrefixLength = getCallerPathPrefixLength("X:\\Git\\RoR2\\UmbralMithrix\\UmbralMithrix\\Log.cs");
			static int getCallerPathPrefixLength([CallerFilePath] string callerPath = null)
			{
				int num = callerPath.LastIndexOf("UmbralMithrix\\");
				if (num >= 0)
				{
					return num + "UmbralMithrix\\".Length;
				}
				Debug.LogError((object)"[UmbralMithrix] Logger failed to determine caller path prefix length");
				return 0;
			}
		}

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

		private static StringBuilder AppendCallerPrefix(this StringBuilder stringBuilder, string callerPath, string callerMemberName, int callerLineNumber)
		{
			return stringBuilder.Append(callerPath, _cachedCallerPathPrefixLength, callerPath.Length - _cachedCallerPathPrefixLength).Append(':').Append(callerLineNumber)
				.Append(" (")
				.Append(callerMemberName)
				.Append("):");
		}

		private static StringBuilder buildCallerLogString(string callerPath, string callerMemberName, int callerLineNumber, object data)
		{
			return _sharedStringBuilder.Clear().AppendCallerPrefix(callerPath, callerMemberName, callerLineNumber).Append(' ')
				.Append(data);
		}

		[Conditional("DEBUG")]
		internal static void Debug(object data, [CallerFilePath] string callerPath = "", [CallerMemberName] string callerMemberName = "", [CallerLineNumber] int callerLineNumber = -1)
		{
			_logSource.LogDebug((object)buildCallerLogString(callerPath, callerMemberName, callerLineNumber, data));
		}

		[MethodImpl(MethodImplOptions.AggressiveInlining)]
		[Conditional("DEBUG")]
		internal static void Debug_NoCallerPrefix(object data)
		{
			_logSource.LogDebug(data);
		}

		internal static void Error(object data, [CallerFilePath] string callerPath = "", [CallerMemberName] string callerMemberName = "", [CallerLineNumber] int callerLineNumber = -1)
		{
			_logSource.LogError((object)buildCallerLogString(callerPath, callerMemberName, callerLineNumber, data));
		}

		[MethodImpl(MethodImplOptions.AggressiveInlining)]
		internal static void Error_NoCallerPrefix(object data)
		{
			_logSource.LogError(data);
		}

		internal static void Fatal(object data, [CallerFilePath] string callerPath = "", [CallerMemberName] string callerMemberName = "", [CallerLineNumber] int callerLineNumber = -1)
		{
			_logSource.LogFatal((object)buildCallerLogString(callerPath, callerMemberName, callerLineNumber, data));
		}

		[MethodImpl(MethodImplOptions.AggressiveInlining)]
		internal static void Fatal_NoCallerPrefix(object data)
		{
			_logSource.LogFatal(data);
		}

		internal static void Info(object data, [CallerFilePath] string callerPath = "", [CallerMemberName] string callerMemberName = "", [CallerLineNumber] int callerLineNumber = -1)
		{
			_logSource.LogInfo((object)buildCallerLogString(callerPath, callerMemberName, callerLineNumber, data));
		}

		[MethodImpl(MethodImplOptions.AggressiveInlining)]
		internal static void Info_NoCallerPrefix(object data)
		{
			_logSource.LogInfo(data);
		}

		internal static void Message(object data, [CallerFilePath] string callerPath = "", [CallerMemberName] string callerMemberName = "", [CallerLineNumber] int callerLineNumber = -1)
		{
			_logSource.LogMessage((object)buildCallerLogString(callerPath, callerMemberName, callerLineNumber, data));
		}

		[MethodImpl(MethodImplOptions.AggressiveInlining)]
		internal static void Message_NoCallerPrefix(object data)
		{
			_logSource.LogMessage(data);
		}

		internal static void Warning(object data, [CallerFilePath] string callerPath = "", [CallerMemberName] string callerMemberName = "", [CallerLineNumber] int callerLineNumber = -1)
		{
			_logSource.LogWarning((object)buildCallerLogString(callerPath, callerMemberName, callerLineNumber, data));
		}

		[MethodImpl(MethodImplOptions.AggressiveInlining)]
		internal static void Warning_NoCallerPrefix(object data)
		{
			_logSource.LogWarning(data);
		}

		internal static void LogType(LogLevel level, object data, [CallerFilePath] string callerPath = "", [CallerMemberName] string callerMemberName = "", [CallerLineNumber] int callerLineNumber = -1)
		{
			//IL_0000: Unknown result type (might be due to invalid IL or missing references)
			//IL_0003: Unknown result type (might be due to invalid IL or missing references)
			//IL_000c: Unknown result type (might be due to invalid IL or missing references)
			if ((level & 0x20) == 0)
			{
				_logSource.Log(level, (object)buildCallerLogString(callerPath, callerMemberName, callerLineNumber, data));
			}
		}

		[MethodImpl(MethodImplOptions.AggressiveInlining)]
		internal static void LogType_NoCallerPrefix(LogLevel level, object data)
		{
			//IL_0000: Unknown result type (might be due to invalid IL or missing references)
			//IL_0003: Unknown result type (might be due to invalid IL or missing references)
			//IL_000c: Unknown result type (might be due to invalid IL or missing references)
			if ((level & 0x20) == 0)
			{
				_logSource.Log(level, data);
			}
		}
	}
	public static class ModConfig
	{
		internal static ConfigFile UMConfig;

		public static ConfigEntry<bool> purpleArena;

		public static ConfigEntry<bool> skipPhase4;

		public static ConfigEntry<bool> addShockwave;

		public static ConfigEntry<bool> purpleMithrix;

		public static ConfigEntry<float> basehealth;

		public static ConfigEntry<float> levelhealth;

		public static ConfigEntry<float> basedamage;

		public static ConfigEntry<float> leveldamage;

		public static ConfigEntry<float> basearmor;

		public static ConfigEntry<float> baseattackspeed;

		public static ConfigEntry<float> basespeed;

		public static ConfigEntry<float> mass;

		public static ConfigEntry<float> turningspeed;

		public static ConfigEntry<float> jumpingpower;

		public static ConfigEntry<float> acceleration;

		public static ConfigEntry<float> aircontrol;

		public static ConfigEntry<int> PrimStocks;

		public static ConfigEntry<int> SecStocks;

		public static ConfigEntry<int> UtilStocks;

		public static ConfigEntry<float> PrimCD;

		public static ConfigEntry<float> SecCD;

		public static ConfigEntry<float> UtilCD;

		public static ConfigEntry<float> SpecialCD;

		public static ConfigEntry<float> CrushingLeap;

		public static ConfigEntry<int> SlamOrbProjectileCount;

		public static ConfigEntry<int> LunarShardAdd;

		public static ConfigEntry<int> UltimateWaves;

		public static ConfigEntry<int> UltimateCount;

		public static ConfigEntry<float> UltimateDuration;

		public static ConfigEntry<int> JumpWaveCount;

		public static ConfigEntry<float> ShardHoming;

		public static ConfigEntry<float> ShardRange;

		public static ConfigEntry<float> ShardCone;

		[MethodImpl(MethodImplOptions.NoInlining | MethodImplOptions.NoOptimization)]
		public static void Init()
		{
			//IL_001c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0026: Expected O, but got Unknown
			if (UmbralMithrix.RooInstalled)
			{
				InitRoO();
			}
			UMConfig = new ConfigFile(Paths.ConfigPath + "\\com.Nuxlar.UmbralMithrix.cfg", true);
			purpleMithrix = UMConfig.BindOption("General", "Purple Mithrix", defaultValue: true, "Adds umbral effects to Mithrix (purple when spawning in).");
			purpleArena = UMConfig.BindOption("General", "Purple Arena", defaultValue: false, "Adds swirling purple walls/ceiling to the arena.");
			skipPhase4 = UMConfig.BindOption("General", "Skip Phase 4", defaultValue: false, "Skips Phase 4.");
			addShockwave = UMConfig.BindOption("General", "Add shockwave to Hammer Swipe", defaultValue: false, "Adds a 1 shockwave when Mithrix swipes.");
			basehealth = UMConfig.BindOptionSteppedSlider("Stats", "Base Health", 1000f, 25f, "Vanilla: 1000", 500f, 2500f);
			levelhealth = UMConfig.BindOptionSteppedSlider("Stats", "Level Health", 325f, 25f, "Health gained per level. Vanilla: 300", 100f, 1000f);
			basedamage = UMConfig.BindOptionSteppedSlider("Stats", "Base Damage", 15f, 1f, "Vanilla: 16", 10f, 30f);
			leveldamage = UMConfig.BindOptionSteppedSlider("Stats", "Level Damage", 3f, 0.25f, "Damage gained per level. Vanilla: 3.2", 1f, 6.4f);
			basearmor = UMConfig.BindOptionSteppedSlider("Stats", "Base Armor", 30f, 5f, "Vanilla: 20", 5f, 50f);
			baseattackspeed = UMConfig.BindOptionSteppedSlider("Stats", "Base Attack Speed", 1.25f, 0.25f, "Vanilla: 1", 0.25f, 3f);
			basespeed = UMConfig.BindOptionSteppedSlider("Stats", "Base Move Speed", 15f, 1f, "Vanilla: 15", 10f, 30f);
			mass = UMConfig.BindOptionSteppedSlider("Stats", "Mass", 5000f, 100f, "Recommended to increase if you increase his movement speed. Vanilla: 900", 900f, 10000f);
			turningspeed = UMConfig.BindOptionSteppedSlider("Stats", "Turn Speed", 300f, 10f, "Vanilla: 270", 200f, 1000f);
			jumpingpower = UMConfig.BindOptionSteppedSlider("Stats", "Jump Power", 50f, 5f, "How high Mithrix jumps. Vanilla: 25", 25f, 100f);
			acceleration = UMConfig.BindOptionSteppedSlider("Stats", "Acceleration", 100f, 5f, "Vanilla: 45", 45f, 500f);
			aircontrol = UMConfig.BindOptionSteppedSlider("Stats", "Air Control", 1f, 0.5f, "Vanilla: 0.25", 0.25f, 3f);
			PrimStocks = UMConfig.BindOptionSlider("Skills", "Primary Stocks", 1, "Max Stocks for Mithrix's Weapon Slam. Vanilla: 1", 1f, 5f);
			SecStocks = UMConfig.BindOptionSlider("Skills", "Secondary Stocks", 1, "Max Stocks for Mithrix's Dash Attack. Vanilla: 1", 1f, 5f);
			UtilStocks = UMConfig.BindOptionSlider("Skills", "Util Stocks", 3, "Max Stocks for Mithrix's Dash. Vanilla: 2", 1f, 5f);
			PrimCD = UMConfig.BindOptionSteppedSlider("Skills", "Primary Cooldown", 4f, 0.25f, "Cooldown for Mithrix's Weapon Slam. Vanilla: 4", 1f, 5f);
			SecCD = UMConfig.BindOptionSteppedSlider("Skills", "Secondary Cooldown", 4.5f, 0.25f, "Cooldown for Mithrix's Dash Attack. Vanilla: 5", 1f, 5f);
			UtilCD = UMConfig.BindOptionSteppedSlider("Skills", "Util Cooldown", 2.5f, 0.25f, "Cooldown for Mithrix's Dash. Vanilla: 3", 1f, 5f);
			SpecialCD = UMConfig.BindOptionSteppedSlider("Skills", "Special Cooldown", 30f, 1f, "Cooldown for Mithrix's Jump Attack. Vanilla: 30", 10f, 50f);
			CrushingLeap = UMConfig.BindOptionSteppedSlider("Skill Mods", "Crushing Leap", 3f, 0.1f, "How long Mithrix stays in the air during the crushing leap. Vanilla: 3", 0.1f, 6f);
			SlamOrbProjectileCount = UMConfig.BindOptionSlider("Skill Mods", "Orb Projectile Count", 3, "Orbs fired by weapon slam in a circle. Vanilla: N/A", 0f, 16f);
			LunarShardAdd = UMConfig.BindOptionSlider("Skill Mods", "Shard Add Count", 1, "Bonus shards added to each shot of lunar shards. Vanilla: N/A", 1f, 5f);
			UltimateWaves = UMConfig.BindOptionSlider("Skill Mods", "P3 Ult Lines", 8, "Total lines in ultimate per burst. Vanilla: 4", 4f, 18f);
			UltimateCount = UMConfig.BindOptionSlider("Skill Mods", "P3 Ult Bursts", 6, "Total times the ultimate fires. Vanilla: 4", 4f, 8f);
			UltimateDuration = UMConfig.BindOptionSteppedSlider("Skill Mods", "P3 Ult Duration", 8f, 0.25f, "How long ultimate lasts. Vanilla: 8", 5f, 10f);
			JumpWaveCount = UMConfig.BindOptionSlider("Skill Mods", "Jump Wave Count", 16, "Shockwave count when Mithrix lands after a jump. Vanilla: 12", 12f, 24f);
			ShardHoming = UMConfig.BindOptionSteppedSlider("Skill Mods", "Shard Homing", 25f, 5f, "How strongly lunar shards home in to targets. Vanilla: 20", 10f, 60f);
			ShardRange = UMConfig.BindOptionSteppedSlider("Skill Mods", "Shard Range", 100f, 10f, "Range (distance) in which shards look for targets. Vanilla: 80", 80f, 160f);
			ShardCone = UMConfig.BindOptionSteppedSlider("Skill Mods", "Shard Cone", 120f, 10f, "Cone (Angle) in which shards look for targets. Vanilla: 90", 90f, 180f);
			WipeConfig();
		}

		private static void WipeConfig()
		{
			((Dictionary<ConfigDefinition, string>)typeof(ConfigFile).GetProperty("OrphanedEntries", BindingFlags.Instance | BindingFlags.NonPublic).GetValue(UMConfig)).Clear();
			UMConfig.Save();
		}

		[MethodImpl(MethodImplOptions.NoInlining | MethodImplOptions.NoOptimization)]
		public static void InitRoO()
		{
			//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_005f: Expected O, but got Unknown
			//IL_0074: Unknown result type (might be due to invalid IL or missing references)
			//IL_0083: Unknown result type (might be due to invalid IL or missing references)
			//IL_008d: Expected O, but got Unknown
			try
			{
				ModSettingsManager.SetModDescription("Umbral Mithrix", "com.Nuxlar.UmbralMithrix", "UmbralMithrix");
				string directoryName = Path.GetDirectoryName(((BaseUnityPlugin)UmbralMithrix.Instance).Info.Location);
				byte[] array = File.ReadAllBytes(Path.Combine(directoryName.Substring(0, directoryName.Length - 21), "icon.png"));
				Texture2D val = new Texture2D(256, 256);
				ImageConversion.LoadImage(val, array);
				ModSettingsManager.SetModIcon(Sprite.Create(val, new Rect(0f, 0f, 256f, 256f), new Vector2(0.5f, 0.5f)), "com.Nuxlar.UmbralMithrix", "UmbralMithrix");
			}
			catch (Exception)
			{
			}
		}

		[MethodImpl(MethodImplOptions.NoInlining | MethodImplOptions.NoOptimization)]
		public static ConfigEntry<T> BindOption<T>(this ConfigFile myConfig, string section, string name, T defaultValue, string description = "", bool restartRequired = true)
		{
			//IL_0065: Unknown result type (might be due to invalid IL or missing references)
			//IL_006f: Expected O, but got Unknown
			if ((defaultValue is int || defaultValue is float) ? true : false)
			{
				return myConfig.BindOptionSlider(section, name, defaultValue, description, 0f, 20f, restartRequired);
			}
			if (string.IsNullOrEmpty(description))
			{
				description = name;
			}
			if (restartRequired)
			{
				description += " (restart required)";
			}
			ConfigEntry<T> val = myConfig.Bind<T>(section, name, defaultValue, new ConfigDescription(description, (AcceptableValueBase)null, Array.Empty<object>()));
			if (UmbralMithrix.RooInstalled)
			{
				TryRegisterOption<T>(val, restartRequired);
			}
			return val;
		}

		[MethodImpl(MethodImplOptions.NoInlining | MethodImplOptions.NoOptimization)]
		public static ConfigEntry<T> BindOptionSlider<T>(this ConfigFile myConfig, string section, string name, T defaultValue, string description = "", float min = 0f, float max = 20f, bool restartRequired = true)
		{
			//IL_00b1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00bb: Expected O, but got Unknown
			if (!(defaultValue is int) && !(defaultValue is float))
			{
				return myConfig.BindOption(section, name, defaultValue, description, restartRequired);
			}
			if (string.IsNullOrEmpty(description))
			{
				description = name;
			}
			string text = description;
			T val = defaultValue;
			description = text + " (Default: " + val?.ToString() + ")";
			if (restartRequired)
			{
				description += " (restart required)";
			}
			AcceptableValueBase val2 = (AcceptableValueBase)((typeof(T) == typeof(int)) ? ((object)new AcceptableValueRange<int>((int)min, (int)max)) : ((object)new AcceptableValueRange<float>(min, max)));
			ConfigEntry<T> val3 = myConfig.Bind<T>(section, name, defaultValue, new ConfigDescription(description, val2, Array.Empty<object>()));
			if (UmbralMithrix.RooInstalled)
			{
				TryRegisterOptionSlider<T>(val3, min, max, restartRequired);
			}
			return val3;
		}

		[MethodImpl(MethodImplOptions.NoInlining | MethodImplOptions.NoOptimization)]
		public static ConfigEntry<T> BindOptionSteppedSlider<T>(this ConfigFile myConfig, string section, string name, T defaultValue, float increment = 1f, string description = "", float min = 0f, float max = 20f, bool restartRequired = true)
		{
			//IL_005f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0069: Expected O, but got Unknown
			if (string.IsNullOrEmpty(description))
			{
				description = name;
			}
			string text = description;
			T val = defaultValue;
			description = text + " (Default: " + val?.ToString() + ")";
			if (restartRequired)
			{
				description += " (restart required)";
			}
			ConfigEntry<T> val2 = myConfig.Bind<T>(section, name, defaultValue, new ConfigDescription(description, (AcceptableValueBase)(object)new AcceptableValueRange<float>(min, max), Array.Empty<object>()));
			if (UmbralMithrix.RooInstalled)
			{
				TryRegisterOptionSteppedSlider<T>(val2, increment, min, max, restartRequired);
			}
			return val2;
		}

		[MethodImpl(MethodImplOptions.NoInlining | MethodImplOptions.NoOptimization)]
		public static void TryRegisterOption<T>(ConfigEntry<T> entry, bool restartRequired)
		{
			//IL_000b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0010: Unknown result type (might be due to invalid IL or missing references)
			//IL_0012: Unknown result type (might be due to invalid IL or missing references)
			//IL_0017: Unknown result type (might be due to invalid IL or missing references)
			//IL_0023: Expected O, but got Unknown
			//IL_001e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0032: Expected O, but got Unknown
			//IL_003f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0053: Expected O, but got Unknown
			//IL_0060: Unknown result type (might be due to invalid IL or missing references)
			//IL_0074: Expected O, but got Unknown
			//IL_0088: Unknown result type (might be due to invalid IL or missing references)
			//IL_009c: Expected O, but got Unknown
			if (entry is ConfigEntry<string> val)
			{
				ModSettingsManager.AddOption((BaseOption)new StringInputFieldOption(val, new InputFieldConfig
				{
					submitOn = (SubmitEnum)6,
					restartRequired = restartRequired
				}), "com.Nuxlar.UmbralMithrix", "UmbralMithrix");
			}
			else if (entry is ConfigEntry<bool> val2)
			{
				ModSettingsManager.AddOption((BaseOption)new CheckBoxOption(val2, restartRequired), "com.Nuxlar.UmbralMithrix", "UmbralMithrix");
			}
			else if (entry is ConfigEntry<KeyboardShortcut> val3)
			{
				ModSettingsManager.AddOption((BaseOption)new KeyBindOption(val3, restartRequired), "com.Nuxlar.UmbralMithrix", "UmbralMithrix");
			}
			else if (typeof(T).IsEnum)
			{
				ModSettingsManager.AddOption((BaseOption)new ChoiceOption((ConfigEntryBase)(object)entry, restartRequired), "com.Nuxlar.UmbralMithrix", "UmbralMithrix");
			}
		}

		[MethodImpl(MethodImplOptions.NoInlining | MethodImplOptions.NoOptimization)]
		public static void TryRegisterOptionSlider<T>(ConfigEntry<T> entry, float min, float max, bool restartRequired)
		{
			//IL_000b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0010: Unknown result type (might be due to invalid IL or missing references)
			//IL_0018: Unknown result type (might be due to invalid IL or missing references)
			//IL_0020: Unknown result type (might be due to invalid IL or missing references)
			//IL_002b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0037: Expected O, but got Unknown
			//IL_0032: Unknown result type (might be due to invalid IL or missing references)
			//IL_0046: Expected O, but got Unknown
			//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_005e: 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_0070: Unknown result type (might be due to invalid IL or missing references)
			//IL_007c: Expected O, but got Unknown
			//IL_0077: Unknown result type (might be due to invalid IL or missing references)
			//IL_008b: Expected O, but got Unknown
			if (entry is ConfigEntry<int> val)
			{
				ModSettingsManager.AddOption((BaseOption)new IntSliderOption(val, new IntSliderConfig
				{
					min = (int)min,
					max = (int)max,
					formatString = "{0:0.00}",
					restartRequired = restartRequired
				}), "com.Nuxlar.UmbralMithrix", "UmbralMithrix");
			}
			else if (entry is ConfigEntry<float> val2)
			{
				ModSettingsManager.AddOption((BaseOption)new SliderOption(val2, new SliderConfig
				{
					min = min,
					max = max,
					FormatString = "{0:0.00}",
					restartRequired = restartRequired
				}), "com.Nuxlar.UmbralMithrix", "UmbralMithrix");
			}
		}

		[MethodImpl(MethodImplOptions.NoInlining | MethodImplOptions.NoOptimization)]
		public static void TryRegisterOptionSteppedSlider<T>(ConfigEntry<T> entry, float increment, float min, float max, bool restartRequired)
		{
			//IL_000b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0010: Unknown result type (might be due to invalid IL or missing references)
			//IL_0017: Unknown result type (might be due to invalid IL or missing references)
			//IL_001e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0025: 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_003d: Expected O, but got Unknown
			//IL_0038: Unknown result type (might be due to invalid IL or missing references)
			//IL_004c: Expected O, but got Unknown
			if (entry is ConfigEntry<float> val)
			{
				ModSettingsManager.AddOption((BaseOption)new StepSliderOption(val, new StepSliderConfig
				{
					increment = increment,
					min = min,
					max = max,
					FormatString = "{0:0.00}",
					restartRequired = restartRequired
				}), "com.Nuxlar.UmbralMithrix", "UmbralMithrix");
			}
		}
	}
	[BepInPlugin("com.Nuxlar.UmbralMithrix", "UmbralMithrix", "2.5.6")]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	public class UmbralMithrix : BaseUnityPlugin
	{
		public const string PluginGUID = "com.Nuxlar.UmbralMithrix";

		public const string PluginAuthor = "Nuxlar";

		public const string PluginName = "UmbralMithrix";

		public const string PluginVersion = "2.5.6";

		public static bool practiceModeEnabled;

		public static bool hasfired;

		public static bool spawnedClone = false;

		public static bool finishedItemSteal = false;

		public static bool p2ThresholdReached = false;

		public static bool p3ThresholdReached = false;

		public static List<GameObject> timeCrystals = new List<GameObject>();

		public static Dictionary<int, Vector3> p23PizzaPoints = new Dictionary<int, Vector3>
		{
			{
				0,
				new Vector3(13.5f, 489.7f, -107f)
			},
			{
				1,
				new Vector3(-189f, 489.7f, 107f)
			},
			{
				2,
				new Vector3(16.7f, 489.7f, 101f)
			},
			{
				3,
				new Vector3(-196f, 489.7f, -101f)
			}
		};

		public static Dictionary<int, Vector3> p4PizzaPoints = new Dictionary<int, Vector3>
		{
			{
				0,
				new Vector3(-175f, 489.7f, -0.08f)
			},
			{
				1,
				new Vector3(-0.08f, 489.7f, 0.08f)
			},
			{
				2,
				new Vector3(-91f, 489.7f, -89f)
			},
			{
				3,
				new Vector3(-89f, 489.7f, 89f)
			}
		};

		public static ItemDef UmbralItem;

		public static GameObject umbralSlamImpact;

		public static GameObject umbralSlamProjectile;

		public static GameObject umbralSlamPillar;

		public static GameObject umbralSlamHitEffect;

		public static NetworkSoundEventDef umbralSlamHitSound;

		public static GameObject umbralLeapWave;

		public static GameObject umbralSwingEffect;

		public static GameObject umbralUltMuzzleFlash;

		public static GameObject leapIndicatorPrefab;

		public static GameObject leapIndicator;

		public static SpawnCard timeCrystalCard;

		public static GameObject lunarMissile;

		public static GameObject mithrixHurtP3Master;

		public static GameObject mithrix;

		public static GameObject mithrixHurtP3;

		public static GameObject mithrixHurt;

		public static SpawnCard mithrixCard;

		public static SpawnCard mithrixHurtCard;

		public static GameObject mithrixGlass;

		public static SpawnCard mithrixGlassCard;

		public static GameObject leftP4Line;

		public static GameObject rightP4Line;

		public static GameObject leftUltLine;

		public static GameObject rightUltLine;

		public static GameObject staticUltLine;

		public static GameObject shardProjectile;

		public static Material preBossMat;

		public static Material arenaWallMat;

		public static Material stealAuraMat;

		public static Material moonMat;

		public static Material doppelMat;

		public static GameObject youngTeleporter;

		public static Transform practiceFire;

		public static GameObject implodeEffect;

		public static GameObject tether;

		public static GameObject voidling;

		public static SpawnCard mithrixHurtP3Card = (SpawnCard)(object)ScriptableObject.CreateInstance<CharacterSpawnCard>();

		private static SkillDef shardDef = Addressables.LoadAssetAsync<SkillDef>((object)"RoR2/Base/Brother/FireLunarShards.asset").WaitForCompletion();

		private static SkillDef slamDef = Addressables.LoadAssetAsync<SkillDef>((object)"RoR2/Base/Brother/WeaponSlam.asset").WaitForCompletion();

		private static SkillDef bashDef = Addressables.LoadAssetAsync<SkillDef>((object)"RoR2/Base/Brother/SprintBash.asset").WaitForCompletion();

		private static SkillDef leapDef = Addressables.LoadAssetAsync<SkillDef>((object)"RoR2/Base/Brother/SkyLeap.asset").WaitForCompletion();

		public static SkillDef ultDef = Addressables.LoadAssetAsync<SkillDef>((object)"RoR2/Base/Brother/Ult.asset").WaitForCompletion();

		internal static UmbralMithrix Instance { get; private set; }

		public static bool RooInstalled => Chainloader.PluginInfos.ContainsKey("com.rune580.riskofoptions");

		public void Awake()
		{
			//IL_0037: Unknown result type (might be due to invalid IL or missing references)
			//IL_003c: 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_0055: Unknown result type (might be due to invalid IL or missing references)
			//IL_0069: Unknown result type (might be due to invalid IL or missing references)
			//IL_006e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0082: 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_009b: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a0: Unknown result type (might be due to invalid IL or missing references)
			Instance = this;
			Log.Init(((BaseUnityPlugin)this).Logger);
			ModConfig.Init();
			LoadAssets();
			CloneAssets();
			SetupVoidling();
			shardDef.activationState = new SerializableEntityStateType(typeof(FireUmbralShards));
			slamDef.activationState = new SerializableEntityStateType(typeof(UmbralHammerSlam));
			bashDef.activationState = new SerializableEntityStateType(typeof(UmbralBash));
			leapDef.activationState = new SerializableEntityStateType(typeof(EnterUmbralLeap));
			ultDef.activationState = new SerializableEntityStateType(typeof(EnterUmbralUlt));
			CreateDoppelItem();
			AddEntityStates();
			ChangeVanillaEntityStateValues();
			new MiscHooks();
			new MissionHooks();
			new MithrixMiscHooks();
			LanguageManager.Register(Path.GetDirectoryName(((BaseUnityPlugin)this).Info.Location));
		}

		private void ChangeVanillaEntityStateValues()
		{
			SetVanillaEntityStateField(RoR2_Base_Brother_EntityStates_BrotherMonster.FistSlam_asset, "healthCostFraction", "0");
			SetVanillaEntityStateField(RoR2_Base_Brother_EntityStates_BrotherMonster.SpellChannelEnterState_asset, "duration", "3");
			SetVanillaEntityStateField(RoR2_Base_Brother_EntityStates_BrotherMonster.SpellChannelState_asset, "maxDuration", "5");
		}

		public static void ArenaSetup()
		{
			GameObject val = GameObject.Find("HOLDER: Final Arena");
			if (Object.op_Implicit((Object)(object)val))
			{
				Transform val2 = val.transform.Find("Columns_Inner");
				if (Object.op_Implicit((Object)(object)val2))
				{
					((Component)val2).gameObject.SetActive(false);
				}
				Transform val3 = val.transform.Find("Rocks");
				if (Object.op_Implicit((Object)(object)val3))
				{
					((Component)val3).gameObject.SetActive(false);
				}
			}
			SceneInfo instance = SceneInfo.instance;
			if (Object.op_Implicit((Object)(object)instance))
			{
				Transform val4 = ((Component)instance).transform.Find("BrotherMissionController/BrotherEncounter, Phase 1/PhaseObjects/mdlBrotherThrone");
				if (Object.op_Implicit((Object)(object)val4))
				{
					((Component)val4).gameObject.SetActive(true);
				}
			}
		}

		public static void SpawnPracticeModeShrine()
		{
			//IL_0014: Unknown result type (might be due to invalid IL or missing references)
			//IL_0019: Unknown result type (might be due to invalid IL or missing references)
			//IL_003d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0042: Unknown result type (might be due to invalid IL or missing references)
			//IL_008c: Unknown result type (might be due to invalid IL or missing references)
			GameObject val = Object.Instantiate<GameObject>(youngTeleporter, new Vector3(1090.1f, -283.1f, 1138.6f), Quaternion.identity);
			GameObject obj = Object.Instantiate<GameObject>(((Component)practiceFire).gameObject, new Vector3(1090.1f, -283.1f, 1138.6f), Quaternion.identity);
			val.GetComponent<PurchaseInteraction>().NetworkcontextToken = "UMBRAL_PRACTICE_MODE_CONTEXT";
			((Object)val).name = "PracticeModeShrine";
			obj.transform.parent = val.transform;
			obj.transform.localPosition = new Vector3(0f, 0f, 0f);
			NetworkServer.Spawn(val);
		}

		private void AddEntityStates()
		{
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			//IL_000a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0012: 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_0022: Unknown result type (might be due to invalid IL or missing references)
			//IL_002a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0032: Unknown result type (might be due to invalid IL or missing references)
			bool flag = default(bool);
			ContentAddition.AddEntityState<GlassSpawnState>(ref flag);
			ContentAddition.AddEntityState<FireUmbralShards>(ref flag);
			ContentAddition.AddEntityState<UmbralHammerSlam>(ref flag);
			ContentAddition.AddEntityState<EnterUmbralLeap>(ref flag);
			ContentAddition.AddEntityState<HoldUmbralLeap>(ref flag);
			ContentAddition.AddEntityState<ExitUmbralLeap>(ref flag);
			ContentAddition.AddEntityState<UmbralBash>(ref flag);
		}

		private void CreateDoppelItem()
		{
			//IL_001f: 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_008a: 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_00c3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c8: Unknown result type (might be due to invalid IL or missing references)
			UmbralItem = ScriptableObject.CreateInstance<ItemDef>();
			((Object)UmbralItem).name = "UmbralMithrixUmbralItem";
			UmbralItem.deprecatedTier = (ItemTier)3;
			ItemDef umbralItem = UmbralItem;
			ItemTag[] array = new ItemTag[4];
			RuntimeHelpers.InitializeArray(array, (RuntimeFieldHandle)/*OpCode not supported: LdMemberToken*/);
			umbralItem.tags = (ItemTag[])(object)array;
			UmbralItem.nameToken = "UMBRALMITHRIX_UMBRAL_ITEM_NAME";
			UmbralItem.pickupToken = "UMBRALMITHRIX_UMBRAL_ITEM_PICKUP";
			UmbralItem.descriptionToken = "UMBRALMITHRIX_UMBRAL_ITEM_DESC";
			UmbralItem.loreToken = "UMBRALMITHRIX_UMBRAL_ITEM_LORE";
			UmbralItem.pickupIconSprite = Addressables.LoadAssetAsync<Sprite>((object)"RoR2/Base/TeamDeath/texArtifactDeathDisabled.png").WaitForCompletion();
			UmbralItem.pickupModelPrefab = PrefabAPI.InstantiateClone(Addressables.LoadAssetAsync<GameObject>((object)"RoR2/Base/TeamDeath/PickupTeamDeath.prefab").WaitForCompletion(), "PickupUmbralCore", false);
			Material material = Addressables.LoadAssetAsync<Material>((object)"RoR2/Base/InvadingDoppelganger/matDoppelganger.mat").WaitForCompletion();
			Renderer[] componentsInChildren = UmbralItem.pickupModelPrefab.GetComponentsInChildren<Renderer>();
			for (int i = 0; i < componentsInChildren.Length; i++)
			{
				componentsInChildren[i].material = material;
			}
			ContentAddition.AddItemDef(UmbralItem);
		}

		public static void SetVanillaEntityStateField(string fullEntityStatePath, string fieldName, string value)
		{
			//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)
			AsyncOperationHandle<EntityStateConfiguration> val = AssetAsyncReferenceManager<EntityStateConfiguration>.LoadAsset(new AssetReferenceT<EntityStateConfiguration>(fullEntityStatePath), (AsyncReferenceHandleUnloadType)2);
			val.Completed += delegate(AsyncOperationHandle<EntityStateConfiguration> x)
			{
				EntityStateConfiguration result = x.Result;
				for (int i = 0; i < result.serializedFieldsCollection.serializedFields.Length; i++)
				{
					if (result.serializedFieldsCollection.serializedFields[i].fieldName == fieldName)
					{
						result.serializedFieldsCollection.serializedFields[i].fieldValue.stringValue = value;
					}
				}
			};
		}

		private void SetupVoidling()
		{
			//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)
			AsyncOperationHandle<GameObject> val = AssetAsyncReferenceManager<GameObject>.LoadAsset(new AssetReferenceT<GameObject>(RoR2_DLC1_VoidRaidCrab.MiniVoidRaidCrabBodyPhase3_prefab), (AsyncReferenceHandleUnloadType)2);
			val.Completed += delegate(AsyncOperationHandle<GameObject> x)
			{
				voidling = PrefabAPI.InstantiateClone(x.Result, "InactiveVoidling");
				ModelLocator val2 = default(ModelLocator);
				if (voidling.TryGetComponent<ModelLocator>(ref val2))
				{
					Transform modelTransform = val2.modelTransform;
					if (Object.op_Implicit((Object)(object)modelTransform))
					{
						((Component)modelTransform).gameObject.SetActive(false);
					}
				}
				SphereZone component = voidling.GetComponent<SphereZone>();
				component.radius = 275f;
				if (Object.op_Implicit((Object)(object)component.rangeIndicator))
				{
					MeshRenderer componentInChildren = ((Component)component.rangeIndicator).GetComponentInChildren<MeshRenderer>();
					if (Object.op_Implicit((Object)(object)componentInChildren))
					{
						((Renderer)componentInChildren).sharedMaterials = (Material[])(object)new Material[3] { preBossMat, arenaWallMat, stealAuraMat };
					}
				}
				FogDamageController component2 = voidling.GetComponent<FogDamageController>();
				component2.healthFractionPerSecond = 0.01f;
				component2.healthFractionRampCoefficientPerSecond = 2.5f;
			};
		}

		private void CloneAssets()
		{
			//IL_000b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0010: Unknown result type (might be due to invalid IL or missing references)
			//IL_0042: Unknown result type (might be due to invalid IL or missing references)
			//IL_0047: Unknown result type (might be due to invalid IL or missing references)
			//IL_0079: Unknown result type (might be due to invalid IL or missing references)
			//IL_007e: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b0: 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_00e7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ec: Unknown result type (might be due to invalid IL or missing references)
			//IL_011e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0123: Unknown result type (might be due to invalid IL or missing references)
			//IL_0155: Unknown result type (might be due to invalid IL or missing references)
			//IL_015a: Unknown result type (might be due to invalid IL or missing references)
			//IL_018c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0191: Unknown result type (might be due to invalid IL or missing references)
			AsyncOperationHandle<GameObject> val = AssetAsyncReferenceManager<GameObject>.LoadAsset(new AssetReferenceT<GameObject>(RoR2_Base_Brother.BrotherUltLineProjectileRotateLeft_prefab), (AsyncReferenceHandleUnloadType)2);
			val.Completed += delegate(AsyncOperationHandle<GameObject> x)
			{
				GameObject result2 = x.Result;
				leftUltLine = PrefabAPI.InstantiateClone(result2, "UmbralUltLineLeft");
				leftP4Line = PrefabAPI.InstantiateClone(result2, "P4UltLineLeft");
				staticUltLine = PrefabAPI.InstantiateClone(result2, "StaticUltLine");
				Object.Destroy((Object)(object)staticUltLine.GetComponent<RotateAroundAxis>());
				RotateAroundAxis component5 = leftUltLine.GetComponent<RotateAroundAxis>();
				component5.fastRotationSpeed = 21f;
				component5.slowRotationSpeed = 21f;
				RotateAroundAxis component6 = leftP4Line.GetComponent<RotateAroundAxis>();
				component6.fastRotationSpeed = 10f;
				component6.slowRotationSpeed = 10f;
			};
			val = AssetAsyncReferenceManager<GameObject>.LoadAsset(new AssetReferenceT<GameObject>(RoR2_Base_Brother.BrotherUltLineProjectileRotateRight_prefab), (AsyncReferenceHandleUnloadType)2);
			val.Completed += delegate(AsyncOperationHandle<GameObject> x)
			{
				GameObject result = x.Result;
				rightUltLine = PrefabAPI.InstantiateClone(result, "UmbralUltLineRight");
				rightP4Line = PrefabAPI.InstantiateClone(result, "P4UltLineRight");
				RotateAroundAxis component3 = rightUltLine.GetComponent<RotateAroundAxis>();
				component3.fastRotationSpeed = 21f;
				component3.slowRotationSpeed = 21f;
				RotateAroundAxis component4 = rightP4Line.GetComponent<RotateAroundAxis>();
				component4.fastRotationSpeed = 10f;
				component4.slowRotationSpeed = 10f;
			};
			val = AssetAsyncReferenceManager<GameObject>.LoadAsset(new AssetReferenceT<GameObject>(RoR2_Base_Brother.BrotherHurtBody_prefab), (AsyncReferenceHandleUnloadType)2);
			val.Completed += delegate(AsyncOperationHandle<GameObject> x)
			{
				//IL_002a: Unknown result type (might be due to invalid IL or missing references)
				//IL_002f: 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_0047: Unknown result type (might be due to invalid IL or missing references)
				//IL_0048: Unknown result type (might be due to invalid IL or missing references)
				mithrixHurtP3 = PrefabAPI.InstantiateClone(x.Result, "BrotherHurtBodyP3");
				mithrixHurtP3.GetComponent<EntityStateMachine>().initialStateType = new SerializableEntityStateType(typeof(StaggerEnter));
				CharacterBody component = mithrixHurtP3.GetComponent<CharacterBody>();
				component.bodyFlags = (BodyFlags)(component.bodyFlags | 0x10);
				component.baseMaxHealth = ModConfig.basehealth.Value;
				component.levelMaxHealth = ModConfig.levelhealth.Value;
				component.baseDamage = ModConfig.basedamage.Value / 2f;
				component.levelDamage = ModConfig.leveldamage.Value / 2f;
				ContentAddition.AddBody(mithrixHurtP3);
				mithrixHurt = x.Result;
				mithrixHurt.AddComponent<P4Controller>();
				CharacterBody component2 = mithrixHurt.GetComponent<CharacterBody>();
				component2.baseDamage = ModConfig.basedamage.Value;
				component2.levelDamage = ModConfig.leveldamage.Value;
			};
			val = AssetAsyncReferenceManager<GameObject>.LoadAsset(new AssetReferenceT<GameObject>(RoR2_Base_Brother.BrotherHurtMaster_prefab), (AsyncReferenceHandleUnloadType)2);
			val.Completed += delegate(AsyncOperationHandle<GameObject> x)
			{
				//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_0066: 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_007a: Unknown result type (might be due to invalid IL or missing references)
				//IL_007f: Unknown result type (might be due to invalid IL or missing references)
				//IL_008e: Unknown result type (might be due to invalid IL or missing references)
				//IL_0093: Unknown result type (might be due to invalid IL or missing references)
				mithrixHurtP3Master = PrefabAPI.InstantiateClone(x.Result, "BrotherHurtMasterP3");
				mithrixHurtP3Master.GetComponent<CharacterMaster>().bodyPrefab = mithrixHurtP3;
				((Object)mithrixHurtP3Card).name = "cscBrotherHurtP3";
				mithrixHurtP3Card.prefab = mithrixHurtP3Master;
				mithrixHurtP3Card.hullSize = mithrixHurtCard.hullSize;
				mithrixHurtP3Card.nodeGraphType = mithrixHurtCard.nodeGraphType;
				mithrixHurtP3Card.requiredFlags = mithrixHurtCard.requiredFlags;
				mithrixHurtP3Card.forbiddenFlags = mithrixHurtCard.forbiddenFlags;
				ContentAddition.AddMaster(mithrixHurtP3Master);
			};
			val = AssetAsyncReferenceManager<GameObject>.LoadAsset(new AssetReferenceT<GameObject>(RoR2_Base_bazaar_Bazaar.Light_prefab), (AsyncReferenceHandleUnloadType)2);
			val.Completed += delegate(AsyncOperationHandle<GameObject> x)
			{
				practiceFire = PrefabAPI.InstantiateClone(((Component)x.Result.transform.Find("FireLODLevel")).gameObject, "PracticeFire").transform;
			};
			val = AssetAsyncReferenceManager<GameObject>.LoadAsset(new AssetReferenceT<GameObject>(RoR2_Base_EliteLunar.LunarMissileProjectile_prefab), (AsyncReferenceHandleUnloadType)2);
			val.Completed += delegate(AsyncOperationHandle<GameObject> x)
			{
				lunarMissile = PrefabAPI.InstantiateClone(x.Result, "UmbralLunarMissile", false);
			};
			val = AssetAsyncReferenceManager<GameObject>.LoadAsset(new AssetReferenceT<GameObject>(RoR2_Base_Vagrant.VagrantNovaAreaIndicator_prefab), (AsyncReferenceHandleUnloadType)2);
			val.Completed += delegate(AsyncOperationHandle<GameObject> x)
			{
				leapIndicatorPrefab = PrefabAPI.InstantiateClone(x.Result, "UmbralLeapIndicator");
				leapIndicatorPrefab.AddComponent<NetworkIdentity>();
			};
			val = AssetAsyncReferenceManager<GameObject>.LoadAsset(new AssetReferenceT<GameObject>(RoR2_Base_Brother.BrotherSunderWave_prefab), (AsyncReferenceHandleUnloadType)2);
			val.Completed += delegate(AsyncOperationHandle<GameObject> x)
			{
				umbralLeapWave = PrefabAPI.InstantiateClone(x.Result, "UmbralLeapWave");
			};
		}

		private void LoadAssets()
		{
			//IL_000b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0010: Unknown result type (might be due to invalid IL or missing references)
			//IL_0042: Unknown result type (might be due to invalid IL or missing references)
			//IL_0047: Unknown result type (might be due to invalid IL or missing references)
			//IL_0079: Unknown result type (might be due to invalid IL or missing references)
			//IL_007e: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b0: 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_00e7: Unknown result type (might be due to invalid IL or miss