Decompiled source of Boss Rush v1.1.3

BossRush.dll

Decompiled a week ago
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using BepInEx;
using BepInEx.Bootstrap;
using BepInEx.Configuration;
using BepInEx.Logging;
using BossRush.Gamemode;
using BossRush.Tweaks;
using EntityStates;
using EntityStates.GrandParent;
using EntityStates.VoidRaidCrab;
using HG.Reflection;
using Microsoft.CodeAnalysis;
using On.EntityStates.GrandParent;
using On.RoR2;
using RoR2;
using RoR2.Navigation;
using RoR2.Networking;
using RoR2.UI;
using TMPro;
using UnityEngine;
using UnityEngine.Events;
using UnityEngine.Networking;
using UnityEngine.SceneManagement;
using UnityEngine.UI;
using YAU.AddressableUtils;
using YAU.AddressableUtils.Assets;
using YAU.Content;
using YAU.ContentBases;
using YAU.Extensions.Enumeration;
using YAU.Extensions.Text;
using YAU.Extensions.Unity;
using YAU.Networking;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: OptIn]
[assembly: TargetFramework(".NETStandard,Version=v2.0", FrameworkDisplayName = ".NET Standard 2.0")]
[assembly: AssemblyCompany("BossRush")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("BossRush")]
[assembly: AssemblyTitle("BossRush")]
[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 BossRush
{
	public class WaveManager
	{
		public class BossRushObjective : ObjectiveTracker
		{
			public WaveManager wave = null;

			public override string GenerateString()
			{
				if (wave == null)
				{
					wave = (base.sourceDescriptor.source as BossRushRun).waveManager;
				}
				return $"Complete the <style=cIsDamage>Boss Rush</style> ({wave.waveIndex}/{wave.waves.Count()})";
			}

			public override bool IsDirty()
			{
				return true;
			}
		}

		public List<Wave> waves;

		public int waveIndex = 0;

		public Wave currentWave;

		public PhaseCounter mithrixPhaseCounter;

		public BossRushRun run;

		public static GameObject StackingHealthBarPrefab;

		private bool isInWaveTransition = false;

		public bool isPerfectedWave;

		public bool isVoidtouchedWave;

		public bool wasVoidtouchedWave;

		public bool wasPerfectWave;

		public static WaveManager instance;

		public bool canInteractWithShrines = true;

		public WaveManager()
		{
			instance = this;
		}

		public void Initialize()
		{
			//IL_0031: Unknown result type (might be due to invalid IL or missing references)
			//IL_003b: Expected O, but got Unknown
			//IL_0043: Unknown result type (might be due to invalid IL or missing references)
			//IL_004d: Expected O, but got Unknown
			//IL_00b9: Unknown result type (might be due to invalid IL or missing references)
			SetupWaves();
			mithrixPhaseCounter = ((Component)Run.instance).gameObject.AddComponent<PhaseCounter>();
			mithrixPhaseCounter.phase = 1;
			CharacterMaster.OnBodyDeath += new hook_OnBodyDeath(OnDeath);
			MusicController.PickCurrentTrack += new hook_PickCurrentTrack(PlayWaveTrack);
			if (!Object.op_Implicit((Object)(object)StackingHealthBarPrefab))
			{
				InitHealthBarPrefab();
			}
			isInWaveTransition = true;
			foreach (PlayerCharacterMasterController item in PlayerCharacterMasterController._instancesReadOnly)
			{
				if (Object.op_Implicit((Object)(object)item.master) && Object.op_Implicit((Object)(object)item.master.GetBody()))
				{
					item.master.GetBody().SetBuffCount(GameMode.BossRushSpeed.buffIndex, 10);
				}
			}
		}

		public void PlayWaveTrack(orig_PickCurrentTrack orig, MusicController self, ref MusicTrackDef def)
		{
			if (currentWave != null)
			{
				def = currentWave.Music;
			}
		}

		public void Unhook()
		{
			//IL_0008: Unknown result type (might be due to invalid IL or missing references)
			//IL_0012: Expected O, but got Unknown
			//IL_001a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0024: Expected O, but got Unknown
			CharacterMaster.OnBodyDeath -= new hook_OnBodyDeath(OnDeath);
			MusicController.PickCurrentTrack -= new hook_PickCurrentTrack(PlayWaveTrack);
		}

		public void FixScene()
		{
			//IL_007b: Unknown result type (might be due to invalid IL or missing references)
			//IL_009c: 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_00c6: Expected O, but got Unknown
			//IL_0171: Unknown result type (might be due to invalid IL or missing references)
			//IL_0176: 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)
			//IL_01ad: Unknown result type (might be due to invalid IL or missing references)
			//IL_01b2: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ce: Unknown result type (might be due to invalid IL or missing references)
			//IL_01d3: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ef: 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)
			//IL_0212: Unknown result type (might be due to invalid IL or missing references)
			//IL_0217: Unknown result type (might be due to invalid IL or missing references)
			//IL_0239: Unknown result type (might be due to invalid IL or missing references)
			//IL_02a0: Unknown result type (might be due to invalid IL or missing references)
			//IL_02a5: Unknown result type (might be due to invalid IL or missing references)
			//IL_02c1: Unknown result type (might be due to invalid IL or missing references)
			//IL_02c6: Unknown result type (might be due to invalid IL or missing references)
			//IL_02e2: Unknown result type (might be due to invalid IL or missing references)
			//IL_02e7: Unknown result type (might be due to invalid IL or missing references)
			//IL_0315: Unknown result type (might be due to invalid IL or missing references)
			//IL_0329: Unknown result type (might be due to invalid IL or missing references)
			//IL_0349: Unknown result type (might be due to invalid IL or missing references)
			//IL_035d: Unknown result type (might be due to invalid IL or missing references)
			//IL_037d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0391: Unknown result type (might be due to invalid IL or missing references)
			//IL_03b1: Unknown result type (might be due to invalid IL or missing references)
			//IL_03c5: Unknown result type (might be due to invalid IL or missing references)
			Transform transform = GameObject.Find("HOLDER: Stage").transform;
			Transform val = transform.Find("ArenaWalls");
			MeshCollider component = ((Component)val.Find("Ceiling")).GetComponent<MeshCollider>();
			MeshCollider component2 = ((Component)val.Find("CylinderWall")).GetComponent<MeshCollider>();
			Transform val2 = transform.Find("PowerCore");
			((Collider)component).enabled = true;
			((Collider)component2).enabled = true;
			Transform val3 = val2.Find("ElementalRingVoidBlackHole");
			val3.localScale = new Vector3(5f, 5f, 5f);
			((Component)val2).transform.position = new Vector3(0f, 140f, 0f);
			foreach (Transform item in ((Component)val2).transform)
			{
				Transform val4 = item;
				((Component)val4).gameObject.layer = LayerIndex.world.intVal;
			}
			LightIntensityCurve[] componentsInChildren = ((Component)val3).GetComponentsInChildren<LightIntensityCurve>();
			foreach (LightIntensityCurve val5 in componentsInChildren)
			{
				((Behaviour)val5).enabled = false;
			}
			Light[] componentsInChildren2 = ((Component)val3).GetComponentsInChildren<Light>();
			foreach (Light val6 in componentsInChildren2)
			{
				val6.intensity = 3f;
			}
			Quaternion val7 = Quaternion.Euler(270f, 0f, 0f);
			Object.Instantiate<GameObject>(GameObject.MoonPillarHuge, new Vector3(100f, 1f, -1.3f), val7);
			Object.Instantiate<GameObject>(GameObject.MoonPillarHuge, new Vector3(-100f, 1f, -1.3f), val7);
			Object.Instantiate<GameObject>(GameObject.MoonPillarHuge, new Vector3(-1.3f, 1f, 100f), val7);
			Object.Instantiate<GameObject>(GameObject.MoonPillarHuge, new Vector3(-1.3f, 1f, -100f), val7);
			GameObject val8 = Object.Instantiate<GameObject>(((Component)val2).gameObject, new Vector3(100f, 70f, -1.3f), Quaternion.identity);
			val8.transform.localScale = new Vector3(0.2f, 0.2f, 0.2f);
			Transform val9 = val8.transform.Find("ElementalRingVoidBlackHole");
			Transform val10 = val9.Find("Runes");
			Transform val11 = val9.Find("AreaIndicator");
			((Component)val10).gameObject.SetActive(false);
			((Component)val11).gameObject.SetActive(false);
			Object.Instantiate<GameObject>(val8, new Vector3(-100f, 70f, -1.3f), Quaternion.identity);
			Object.Instantiate<GameObject>(val8, new Vector3(-1.3f, 70f, 100f), Quaternion.identity);
			Object.Instantiate<GameObject>(val8, new Vector3(-1.3f, 70f, -100f), Quaternion.identity);
			if (NetworkServer.active)
			{
				GameObject val12 = Object.Instantiate<GameObject>(GameMode.ProgressionSlab, new Vector3(68f, 3f, -71f), Quaternion.Euler(270f, 0f, 0f));
				GameObject val13 = Object.Instantiate<GameObject>(GameMode.ProgressionSlab, new Vector3(-68f, 3f, 71f), Quaternion.Euler(270f, 180f, 0f));
				GameObject val14 = Object.Instantiate<GameObject>(GameMode.VoidtouchWave, new Vector3(-71f, 3f, -68f), Quaternion.Euler(0f, 0f, 0f));
				GameObject val15 = Object.Instantiate<GameObject>(GameMode.PerfectedWave, new Vector3(71f, 3f, 68f), Quaternion.Euler(0f, 180f, 0f));
				NetworkServer.Spawn(val12);
				NetworkServer.Spawn(val13);
				NetworkServer.Spawn(val14);
				NetworkServer.Spawn(val15);
			}
		}

		public static void InitHealthBarPrefab()
		{
			GameObject hUDSimple = GameObject.HUDSimple;
			GameObject gameObject = ((Component)hUDSimple.transform.Find("MainContainer").Find("MainUIArea").Find("SpringCanvas")
				.Find("TopCenterCluster")
				.Find("BossHealthBarRoot")
				.Find("Container")).gameObject;
			StackingHealthBarPrefab = RuntimePrefabManager.CreatePrefab(gameObject, "StackableBossBar");
			GameObject gameObject2 = ((Component)StackingHealthBarPrefab.transform.Find("BossHealthBarContainer").Find("BackgroundPanel")).gameObject;
			Image component = ((Component)gameObject2.transform.Find("FillPanel")).GetComponent<Image>();
			Image component2 = ((Component)gameObject2.transform.Find("DelayFillPanel")).GetComponent<Image>();
			HGTextMeshProUGUI component3 = ((Component)gameObject2.transform.Find("HealthText")).GetComponent<HGTextMeshProUGUI>();
			GameObject stackingHealthBarPrefab = StackingHealthBarPrefab;
			HGTextMeshProUGUI component4 = ((Component)stackingHealthBarPrefab.transform.Find("BossNameLabel")).GetComponent<HGTextMeshProUGUI>();
			((TMP_Text)component4).text = "this should not be here";
			UnityExtensions.RemoveComponent<LanguageTextMeshController>((Component)(object)component4);
			HGTextMeshProUGUI component5 = ((Component)stackingHealthBarPrefab.transform.Find("BossSubtitleLabel")).GetComponent<HGTextMeshProUGUI>();
			((TMP_Text)component5).text = "this also shouldnt be here";
			StackableHealthBar stackableHealthBar = StackingHealthBarPrefab.AddComponent<StackableHealthBar>();
			stackableHealthBar.FillRect = component;
			stackableHealthBar.HP = component3;
			stackableHealthBar.Name = component4;
			stackableHealthBar.Subtitle = component5;
			stackableHealthBar.DelayFillRect = component2;
		}

		public void OnDeath(orig_OnBodyDeath orig, CharacterMaster self, CharacterBody body)
		{
			//IL_00bc: Unknown result type (might be due to invalid IL or missing references)
			//IL_022a: Unknown result type (might be due to invalid IL or missing references)
			orig.Invoke(self, body);
			int count = currentWave.WaveSpawns.Count;
			int num = (from x in Object.FindObjectsOfType<WaveMarker>()
				where x.body.healthComponent.alive
				select x).Count();
			if (isInWaveTransition || num > 0)
			{
				return;
			}
			foreach (PlayerCharacterMasterController item in PlayerCharacterMasterController._instancesReadOnly)
			{
				if (Object.op_Implicit((Object)(object)item.master) && Object.op_Implicit((Object)(object)item.master.GetBody()))
				{
					item.master.GetBody().SetBuffCount(GameMode.BossRushSpeed.buffIndex, 10);
				}
			}
			canInteractWithShrines = true;
			if (waveIndex >= waves.Count())
			{
				PhaseCounter obj = mithrixPhaseCounter;
				int phase = obj.phase;
				obj.phase = phase + 1;
				if (mithrixPhaseCounter.phase == 2)
				{
					PhaseCounter obj2 = mithrixPhaseCounter;
					phase = obj2.phase;
					obj2.phase = phase + 1;
				}
				if (mithrixPhaseCounter.phase <= 3 || !NetworkServer.active)
				{
					foreach (WaveSpawn waveSpawn in currentWave.WaveSpawns)
					{
						if (NetworkServer.active)
						{
							waveSpawn.DoSpawn();
						}
					}
					{
						foreach (PlayerCharacterMasterController item2 in PlayerCharacterMasterController._instancesReadOnly)
						{
							if (Object.op_Implicit((Object)(object)item2.master) && Object.op_Implicit((Object)(object)item2.master.GetBody()))
							{
								item2.master.GetBody().SetBuffCount(GameMode.BossRushSpeed.buffIndex, currentWave.BuffStacks);
							}
						}
						return;
					}
				}
				((MonoBehaviour)run).Invoke("End", 3f);
			}
			else
			{
				PurchaseInteraction[] array = Object.FindObjectsOfType<PurchaseInteraction>();
				foreach (PurchaseInteraction val in array)
				{
					val.available = true;
				}
				wasPerfectWave = isPerfectedWave;
				wasVoidtouchedWave = isVoidtouchedWave;
				isPerfectedWave = false;
				isVoidtouchedWave = false;
				if (!isInWaveTransition)
				{
					currentWave.OnWaveCompleted();
					isInWaveTransition = true;
				}
			}
		}

		public void SetupWaves()
		{
			waves = new List<Wave>();
			if (BossRush.IsStarstormInstalled)
			{
				waves.Add(new Wave(new List<WaveSpawn>
				{
					new WaveSpawn(MasterCatalog.FindMasterPrefab("LampBossMaster"), 2f, 5f, air: false)
				}, 3, 2, 0, 0, 2, 2, MusicTrackDef.muBossfightDLC110));
			}
			waves.Add(new Wave(new List<WaveSpawn>
			{
				new WaveSpawn(GameObject.TitanMaster, 2f, 1.2f, air: false)
			}, 3, 2, 0, 0, 5, 4, MusicTrackDef.muSong05));
			waves.Add(new Wave(new List<WaveSpawn>
			{
				new WaveSpawn(GameObject.BeetleQueenMaster, 1f, 1f, air: false),
				new WaveSpawn(GameObject.VagrantMaster, 1f, 1f, air: true)
			}, 2, 1, 0, 0, 3, 4, MusicTrackDef.muSong16));
			waves.Add(new Wave(new List<WaveSpawn>
			{
				new WaveSpawn(GameObject.ClayBossMaster, 2f, 2f, air: false)
			}, 3, 2, 1, 0, 3, 2, MusicTrackDef.muBossfightDLC112));
			if (BossRush.IsRARPresent)
			{
				waves.Add(new Wave(new List<WaveSpawn>
				{
					new WaveSpawn(GameObject.MegaConstructMaster, 1f, 2f, air: true),
					new WaveSpawn(GameObject.MajorConstructMaster, 1f, 2f, air: false)
				}, 3, 2, 0, 0, 3, 2, MusicTrackDef.muBossfightDLC110));
			}
			waves.Add(new Wave(new List<WaveSpawn>
			{
				new WaveSpawn(GameObject.GravekeeperMaster, 1.5f, 1.4f, air: false),
				new WaveSpawn(GameObject.ImpBossMaster, 1.5f, 1.4f, air: false)
			}, 2, 1, 0, 0, 3, 3, MusicTrackDef.muBossfightDLC110));
			if (BossRush.IsDireseekerPresent)
			{
				waves.Add(new Wave(new List<WaveSpawn>
				{
					new WaveSpawn(MasterCatalog.FindMasterPrefab("DireseekerBossMaster"), 2f, 2f, air: false)
				}, 3, 2, 1, 0, 3, 2, MusicTrackDef.muBossfightDLC112));
			}
			waves.Add(new Wave(new List<WaveSpawn>
			{
				new WaveSpawn(GameObject.GrandparentMaster, 3f, 3f, air: false)
				{
					noRandomPos = true
				}
			}, 3, 2, 1, 0, 2, 5, MusicTrackDef.muSong22));
			waves.Add(new Wave(new List<WaveSpawn>
			{
				new WaveSpawn(GameObject.MagmaWormMaster, 1f, 3f, air: false),
				new WaveSpawn(GameObject.ElectricWormMaster, 1f, 1f, air: false)
			}, 2, 2, 0, 1, 2, 3, MusicTrackDef.muSong23));
			waves.Add(new Wave(new List<WaveSpawn>
			{
				new WaveSpawn(GameObject.RoboBallBossMaster, 0.6f, 2f, air: true),
				new WaveSpawn(GameObject.SuperRoboBallBossMaster, 1.5f, 5f, air: true),
				new WaveSpawn(GameObject.RoboBallBossMaster, 0.6f, 2f, air: true)
			}, 2, 1, 0, 1, 3, 3, MusicTrackDef.muSong05));
			if (BossRush.IsForgorPresent)
			{
				waves.Add(new Wave(new List<WaveSpawn>
				{
					new WaveSpawn(MasterCatalog.FindMasterPrefab("BrassMonolithMonsterMaster"), 3f, 3f, air: false)
					{
						noRandomPos = true
					}
				}, 3, 2, 0, 0, 3, 2, MusicTrackDef.muSong22));
			}
			waves.Add(new Wave(new List<WaveSpawn>
			{
				new WaveSpawn(GameObject.TitanGoldMaster, 5f, 5f, air: false)
			}, 3, 2, 1, 0, 2, 3, MusicTrackDef.muBossfightDLC110));
			if (BossRush.IsGotcePresent)
			{
				waves.Add(new Wave(new List<WaveSpawn>
				{
					new WaveSpawn(MasterCatalog.FindMasterPrefab("Crowdfunder WoolieMaster"), 8f, 10f, air: false)
				}, 3, 2, 1, 0, 3, 2, MusicTrackDef.muBossfightDLC112));
			}
			waves.Add(new Wave(new List<WaveSpawn>
			{
				new WaveSpawn(GameObject.BrotherMaster, 1f, 5f, air: false)
			}, 3, 2, 1, 0, 2, 4, MusicTrackDef.muSong25));
		}

		public void DoNextWave()
		{
			//IL_00c3: Unknown result type (might be due to invalid IL or missing references)
			//IL_013b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0140: Unknown result type (might be due to invalid IL or missing references)
			//IL_014b: 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_0166: Expected O, but got Unknown
			//IL_01b0: Unknown result type (might be due to invalid IL or missing references)
			isInWaveTransition = false;
			currentWave = waves[waveIndex];
			canInteractWithShrines = false;
			foreach (WaveSpawn waveSpawn in currentWave.WaveSpawns)
			{
				if (NetworkServer.active)
				{
					waveSpawn.DoSpawn();
				}
			}
			foreach (PlayerCharacterMasterController item in PlayerCharacterMasterController._instancesReadOnly)
			{
				if (Object.op_Implicit((Object)(object)item.master) && Object.op_Implicit((Object)(object)item.master.GetBody()))
				{
					item.master.GetBody().SetBuffCount(GameMode.BossRushSpeed.buffIndex, currentWave.BuffStacks);
				}
			}
			waveIndex++;
			GenericPickupController[] array = (from x in Object.FindObjectsOfType<GenericPickupController>()
				where Object.op_Implicit((Object)(object)EquipmentCatalog.GetEquipmentDef(((PickupIndex)(ref x.pickupIndex)).equipmentIndex))
				select x).ToArray();
			for (int i = 0; i < array.Length; i++)
			{
				EffectManager.SpawnEffect(GameObject.ExplosionLunarSun, new EffectData
				{
					scale = 2f,
					origin = ((Component)array[i]).transform.position
				}, false);
				Object.Destroy((Object)(object)((Component)array[i]).gameObject);
			}
			if ((Object)(object)currentWave.Music == (Object)(object)MusicTrackDef.muSong25)
			{
				AkSoundEngine.SetState("bossPhase", "phase1");
			}
		}
	}
	public class WaveSpawn
	{
		public SpawnCard spawnCard;

		public GameObject MasterPrefab;

		public float Scale = 1f;

		public float Health = 1f;

		public Wave wave;

		public string customName = null;

		public bool noRandomPos = false;

		public WaveSpawn(GameObject master, float scale, float hp, bool air)
		{
			//IL_0077: 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)
			MasterPrefab = master;
			Scale = scale;
			Health = hp;
			spawnCard = ScriptableObject.CreateInstance<SpawnCard>();
			spawnCard.directorCreditCost = 0;
			spawnCard.prefab = MasterPrefab;
			spawnCard.nodeGraphType = (GraphType)(air ? 1 : 0);
			spawnCard.hullSize = (HullClassification)2;
			spawnCard.sendOverNetwork = true;
		}

		public void DoSpawn()
		{
			//IL_0013: Unknown result type (might be due to invalid IL or missing references)
			//IL_0019: Expected O, but got Unknown
			//IL_0031: Unknown result type (might be due to invalid IL or missing references)
			//IL_0046: Unknown result type (might be due to invalid IL or missing references)
			//IL_004b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0055: Unknown result type (might be due to invalid IL or missing references)
			//IL_005a: Unknown result type (might be due to invalid IL or missing references)
			//IL_005f: 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_00a1: Expected O, but got Unknown
			//IL_007f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0084: Unknown result type (might be due to invalid IL or missing references)
			if (!NetworkServer.active)
			{
				return;
			}
			DirectorPlacementRule val = new DirectorPlacementRule();
			val.maxDistance = 10f;
			val.minDistance = 0f;
			val.placementMode = (PlacementMode)3;
			val.position = new Vector3(-1.6f, 5.2f, 0.3f) + Random.onUnitSphere * 20f;
			if (noRandomPos)
			{
				val.position = new Vector3(-1.6f, 5.2f, 0.3f);
			}
			DirectorSpawnRequest val2 = new DirectorSpawnRequest(spawnCard, val, Run.instance.runRNG);
			val2.ignoreTeamMemberLimit = true;
			val2.teamIndexOverride = (TeamIndex)2;
			val2.onSpawnedServer = delegate(SpawnResult res)
			{
				//IL_0001: Unknown result type (might be due to invalid IL or missing references)
				//IL_0021: Unknown result type (might be due to invalid IL or missing references)
				//IL_018c: Unknown result type (might be due to invalid IL or missing references)
				//IL_01c8: Unknown result type (might be due to invalid IL or missing references)
				if (Object.op_Implicit((Object)(object)res.spawnedInstance))
				{
					CharacterMaster component = res.spawnedInstance.GetComponent<CharacterMaster>();
					component.SpawnBodyHere();
					Health *= Run.instance.livingPlayerCount;
					if (Run.instance.livingPlayerCount > 1)
					{
						Health += (float)Run.instance.livingPlayerCount * 0.5f;
					}
					int num = Mathf.RoundToInt((Health - 1f) * 10f);
					component.inventory.GiveItem(Items.BoostHp, num);
					component.inventory.GiveItem(Items.UseAmbientLevel, 1);
					CharacterBody body = component.GetBody();
					if (body.baseMoveSpeed == 9f)
					{
						body.baseMoveSpeed = 12f;
					}
					DeathRewards component2 = ((Component)body).GetComponent<DeathRewards>();
					if (Object.op_Implicit((Object)(object)component2))
					{
						float num2 = 300f * ((WaveManager.instance.isPerfectedWave | WaveManager.instance.isVoidtouchedWave) ? 2f : 1f);
						component2.goldReward = (uint)Mathf.Max(1f, num2 * 2f * Run.instance.compensatedDifficultyCoefficient);
					}
					if (WaveManager.instance.isPerfectedWave)
					{
						component.inventory.GiveItem(Items.BoostHp, 5);
						component.inventory.SetEquipmentIndex(Equipment.AffixLunar.equipmentIndex);
					}
					else if (WaveManager.instance.isVoidtouchedWave)
					{
						component.inventory.GiveItem(Items.BoostHp, 5);
						component.inventory.SetEquipmentIndex(Equipment.EliteVoidEquipment.equipmentIndex);
					}
					NetworkWriter val3 = NetworkingHelper.CreateMessage((short)120, (Action<NetworkWriter>)delegate(NetworkWriter x)
					{
						x.Write(((Component)body).gameObject);
						x.Write(Scale);
					});
					NetworkingHelper.ServerSendToAll(val3);
				}
			};
			DirectorCore.instance.TrySpawnObject(val2);
		}

		[NetworkMessageHandler(client = true, msgType = 120)]
		public static void HandleWaveMarker(NetworkMessage netmsg)
		{
			Debug.Log((object)"handling netmessage for wave marker");
			if (Object.op_Implicit((Object)(object)Run.instance) && Run.instance is BossRushRun)
			{
				GameObject val = netmsg.reader.ReadGameObject();
				if (Object.op_Implicit((Object)(object)val))
				{
					WaveMarker waveMarker = val.AddComponent<WaveMarker>();
					waveMarker.scale = netmsg.reader.ReadSingle();
				}
			}
			else
			{
				Debug.Log((object)"not in a boss rush run");
			}
		}
	}
	public class Wave
	{
		public List<WaveSpawn> WaveSpawns;

		public int GreenRewards;

		public int BossRewards;

		public int WhiteRewards;

		public int RedRewards;

		public int LevelRewards;

		public int BuffStacks;

		public MusicTrackDef Music;

		public Wave(List<WaveSpawn> spawns, int whites, int greens, int reds, int yellows, int levels, int buffStacks, MusicTrackDef music)
		{
			WaveSpawns = spawns;
			foreach (WaveSpawn spawn in spawns)
			{
				spawn.wave = this;
			}
			WhiteRewards = whites;
			GreenRewards = greens;
			RedRewards = reds;
			BossRewards = yellows;
			LevelRewards = levels;
			BuffStacks = buffStacks;
			Music = music;
		}

		public void OnWaveCompleted()
		{
			//IL_0044: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ba: 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)
			List<PlayerCharacterMasterController> list = PlayerCharacterMasterController._instancesReadOnly.ToList();
			TeamManager.instance.SetTeamLevel((TeamIndex)1, TeamManager.instance.GetTeamLevel((TeamIndex)1) + (uint)LevelRewards);
			WaveManager.instance.run.bonusAmbientLevel += 5f * (DifficultyCatalog.GetDifficultyDef(Run.instance.selectedDifficulty).scalingValue / 2f);
			if (!NetworkServer.active)
			{
				return;
			}
			foreach (PlayerCharacterMasterController item in PlayerCharacterMasterController._instancesReadOnly)
			{
				if (item.master.IsDeadAndOutOfLivesServer() && item.isConnected)
				{
					item.master.Respawn(item.master.deathFootPosition, Quaternion.identity);
				}
			}
			bool wasPerfectWave = WaveManager.instance.wasPerfectWave;
			bool wasVoidtouchedWave = WaveManager.instance.wasVoidtouchedWave;
			int num = 0;
			foreach (PlayerCharacterMasterController item2 in list)
			{
				CharacterMaster master2 = item2.master;
				if (num < 1 || !BossRush.IsSharesuiteInstalled)
				{
					if (wasPerfectWave)
					{
						SpawnPickups(master2, Run.instance.availableLunarItemDropList, WhiteRewards, (ItemTier)3, sort: false);
					}
					else if (wasVoidtouchedWave)
					{
						SpawnPickups(master2, Run.instance.availableVoidTier1DropList, WhiteRewards, (ItemTier)6, sort: false);
					}
					else
					{
						SpawnPickups(master2, Run.instance.availableTier1DropList, WhiteRewards, (ItemTier)0);
					}
					if (wasVoidtouchedWave)
					{
						SpawnPickups(master2, Run.instance.availableVoidTier2DropList, GreenRewards, (ItemTier)7, sort: false);
					}
					else
					{
						SpawnPickups(master2, Run.instance.availableTier2DropList, GreenRewards, (ItemTier)1);
					}
					SpawnPickups(master2, Run.instance.availableTier3DropList, RedRewards, (ItemTier)2, sort: false);
					SpawnPickups(master2, Run.instance.availableBossDropList, BossRewards, (ItemTier)4, sort: false);
					SpawnRandomEquip(master2, wasPerfectWave ? Run.instance.availableLunarEquipmentDropList : Run.instance.availableEquipmentDropList);
					num++;
				}
			}
			static PickupIndex GetDropFrom(List<PickupIndex> drops, ItemTag reqtag, List<PickupIndex> exclude)
			{
				//IL_0007: Unknown result type (might be due to invalid IL or missing references)
				//IL_0008: 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_0036: Unknown result type (might be due to invalid IL or missing references)
				//IL_0039: Unknown result type (might be due to invalid IL or missing references)
				return EnumeratorExtensions.GetRandom<PickupIndex>(drops.Where((PickupIndex x) => (ItemCatalog.GetItemDef(((PickupIndex)(ref x)).itemIndex).ContainsTag(reqtag) || (int)reqtag == 0) && ItemCatalog.GetItemDef(((PickupIndex)(ref x)).itemIndex).DoesNotContainTag((ItemTag)6) && ItemCatalog.GetItemDef(((PickupIndex)(ref x)).itemIndex).DoesNotContainTag((ItemTag)18) && ItemCatalog.GetItemDef(((PickupIndex)(ref x)).itemIndex).DoesNotContainTag((ItemTag)17) && ItemCatalog.GetItemDef(((PickupIndex)(ref x)).itemIndex).DoesNotContainTag((ItemTag)10) && ItemCatalog.GetItemDef(((PickupIndex)(ref x)).itemIndex).DoesNotContainTag((ItemTag)14) && !exclude.Contains(x)), Run.instance.runRNG);
			}
			static void SpawnPickups(CharacterMaster master, List<PickupIndex> pickups, int amount, ItemTier tier, bool sort = true)
			{
				//IL_003e: Unknown result type (might be due to invalid IL or missing references)
				//IL_0043: Unknown result type (might be due to invalid IL or missing references)
				//IL_0048: Unknown result type (might be due to invalid IL or missing references)
				//IL_0052: Unknown result type (might be due to invalid IL or missing references)
				//IL_0057: Unknown result type (might be due to invalid IL or missing references)
				//IL_0061: Unknown result type (might be due to invalid IL or missing references)
				//IL_0066: Unknown result type (might be due to invalid IL or missing references)
				//IL_006b: Unknown result type (might be due to invalid IL or missing references)
				//IL_0070: Unknown result type (might be due to invalid IL or missing references)
				//IL_0072: Unknown result type (might be due to invalid IL or missing references)
				//IL_0077: Unknown result type (might be due to invalid IL or missing references)
				//IL_007c: 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)
				//IL_0094: Unknown result type (might be due to invalid IL or missing references)
				//IL_009e: Unknown result type (might be due to invalid IL or missing references)
				//IL_009f: Unknown result type (might be due to invalid IL or missing references)
				//IL_00a0: Unknown result type (might be due to invalid IL or missing references)
				//IL_00a5: Unknown result type (might be due to invalid IL or missing references)
				if (Object.op_Implicit((Object)(object)master.GetBody()))
				{
					if (BossRush.IsBasedInstalled)
					{
						sort = false;
					}
					float num2 = 360f / (float)amount;
					Vector3 val2 = Quaternion.AngleAxis((float)Random.Range(0, 360), Vector3.up) * (Vector3.up * 40f + Vector3.forward * 5f);
					Quaternion val3 = Quaternion.AngleAxis(num2, Vector3.up);
					for (int i = 0; i < amount; i++)
					{
						SpawnPotential(master.GetBody().transform.position, val2, tier, pickups, sort);
						val2 = val3 * val2;
					}
				}
			}
			static void SpawnPotential(Vector3 pos, Vector3 vel, ItemTier tier, List<PickupIndex> drops, bool sort)
			{
				//IL_0003: Unknown result type (might be due to invalid IL or missing references)
				//IL_000b: Unknown result type (might be due to invalid IL or missing references)
				//IL_000c: Unknown result type (might be due to invalid IL or missing references)
				//IL_001f: Unknown result type (might be due to invalid IL or missing references)
				//IL_0024: 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_002c: Unknown result type (might be due to invalid IL or missing references)
				//IL_0044: Unknown result type (might be due to invalid IL or missing references)
				//IL_004d: 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_0068: Unknown result type (might be due to invalid IL or missing references)
				//IL_0075: Unknown result type (might be due to invalid IL or missing references)
				//IL_0076: Unknown result type (might be due to invalid IL or missing references)
				//IL_007b: Unknown result type (might be due to invalid IL or missing references)
				//IL_0084: 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_00a7: Unknown result type (might be due to invalid IL or missing references)
				//IL_00b2: Unknown result type (might be due to invalid IL or missing references)
				//IL_00b7: Unknown result type (might be due to invalid IL or missing references)
				//IL_00c4: Unknown result type (might be due to invalid IL or missing references)
				//IL_00c5: Unknown result type (might be due to invalid IL or missing references)
				//IL_00ca: Unknown result type (might be due to invalid IL or missing references)
				//IL_00d3: Unknown result type (might be due to invalid IL or missing references)
				//IL_00ea: Unknown result type (might be due to invalid IL or missing references)
				//IL_00f6: Unknown result type (might be due to invalid IL or missing references)
				//IL_0102: Unknown result type (might be due to invalid IL or missing references)
				//IL_010e: Unknown result type (might be due to invalid IL or missing references)
				//IL_0119: 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_012b: Unknown result type (might be due to invalid IL or missing references)
				//IL_012c: Unknown result type (might be due to invalid IL or missing references)
				//IL_0131: Unknown result type (might be due to invalid IL or missing references)
				//IL_0132: Unknown result type (might be due to invalid IL or missing references)
				//IL_0133: Unknown result type (might be due to invalid IL or missing references)
				CreatePickupInfo val = default(CreatePickupInfo);
				val.position = pos;
				val.prefabOverride = GameObject.OptionPickup;
				val.rotation = Quaternion.identity;
				((CreatePickupInfo)(ref val)).pickupIndex = PickupCatalog.FindPickupIndex(tier);
				val.pickerOptions = (Option[])(object)new Option[3];
				val.pickerOptions[0] = new Option
				{
					pickupIndex = GetDropFrom(drops, (ItemTag)(sort ? 1 : 0), new List<PickupIndex>()),
					available = true
				};
				val.pickerOptions[1] = new Option
				{
					pickupIndex = GetDropFrom(drops, (ItemTag)(sort ? 3 : 0), new List<PickupIndex> { val.pickerOptions[0].pickupIndex }),
					available = true
				};
				val.pickerOptions[2] = new Option
				{
					pickupIndex = GetDropFrom(drops, (ItemTag)(sort ? 2 : 0), new List<PickupIndex>
					{
						val.pickerOptions[0].pickupIndex,
						val.pickerOptions[1].pickupIndex
					}),
					available = true
				};
				PickupDropletController.CreatePickupDroplet(val, pos, vel);
			}
			static void SpawnRandomEquip(CharacterMaster master, List<PickupIndex> pickups)
			{
				//IL_0021: Unknown result type (might be due to invalid IL or missing references)
				//IL_002c: Unknown result type (might be due to invalid IL or missing references)
				//IL_0031: Unknown result type (might be due to invalid IL or missing references)
				//IL_003b: Unknown result type (might be due to invalid IL or missing references)
				if (Object.op_Implicit((Object)(object)master.GetBody()))
				{
					PickupDropletController.CreatePickupDroplet(EnumeratorExtensions.GetRandom<PickupIndex>((IEnumerable<PickupIndex>)pickups, Run.instance.runRNG), master.GetBody().corePosition, Vector3.up * 40f);
				}
			}
		}
	}
	public class WaveMarker : MonoBehaviour
	{
		public Wave wave;

		public float scale;

		public CharacterBody body;

		public void Start()
		{
			body = ((Component)this).GetComponent<CharacterBody>();
			Transform val = GameObject.Find("HUDSimple(Clone)").transform.Find("MainContainer").Find("MainUIArea").Find("SpringCanvas")
				.Find("TopCenterCluster")
				.Find("BossHealthBarRoot");
			GameObject val2 = Object.Instantiate<GameObject>(WaveManager.StackingHealthBarPrefab, val);
			StackableHealthBar component = val2.GetComponent<StackableHealthBar>();
			component.target = body;
			HandleScale();
		}

		public void HandleScale()
		{
			//IL_0012: 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)
			Transform modelTransform = body.modelLocator.modelTransform;
			modelTransform.localScale *= scale;
		}
	}
	[BepInPlugin("pseudopulse.BossRush", "BossRush", "1.0.0")]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	public class BossRush : BaseUnityPlugin
	{
		public const string PluginGUID = "pseudopulse.BossRush";

		public const string PluginAuthor = "pseudopulse";

		public const string PluginName = "BossRush";

		public const string PluginVersion = "1.0.0";

		public static ManualLogSource ModLogger;

		public static YAUContentPack contentPack;

		public const short SpawnMarkerMessage = 120;

		public const short InteractShrineMessage = 121;

		public const short EndlessModeMessage = 122;

		public const short InitCustomShrineMessage = 123;

		public static bool IsEndlessModeEnabled;

		public static bool RandomModeEnabled;

		public static bool IsGotcePresent;

		public static bool IsRARPresent;

		public static bool IsForgorPresent;

		public static bool IsDireseekerPresent;

		public static bool IsBasedInstalled;

		public static bool IsSharesuiteInstalled;

		public static bool IsStarstormInstalled;

		public void Awake()
		{
			ModLogger = ((BaseUnityPlugin)this).Logger;
			contentPack = ContentPackManager.CreateContentPack(Assembly.GetExecutingAssembly(), "BossRush");
			GameMode.Create();
			ContentScanner.ScanTypes<TweakBase>(Assembly.GetExecutingAssembly(), (Action<TweakBase>)delegate(TweakBase x)
			{
				((GenericBase)x).Initialize(contentPack, ((BaseUnityPlugin)this).Config, "BossRush");
			});
			IsGotcePresent = Chainloader.PluginInfos.ContainsKey("com.TheBestAssociatedLargelyLudicrousSillyheadGroup.GOTCE");
			IsForgorPresent = Chainloader.PluginInfos.ContainsKey("PlasmaCore.ForgottenRelics");
			IsRARPresent = Chainloader.PluginInfos.ContainsKey("prodzpod.RecoveredAndReformed");
			IsDireseekerPresent = Chainloader.PluginInfos.ContainsKey("com.rob.Direseeker");
			IsBasedInstalled = Chainloader.PluginInfos.ContainsKey("BALLS.WellRoundedBalance");
			IsSharesuiteInstalled = Chainloader.PluginInfos.ContainsKey("com.funkfrog_sipondo.sharesuite");
			IsStarstormInstalled = Chainloader.PluginInfos.ContainsKey("com.TeamMoonstorm.Starstorm2");
		}
	}
}
namespace BossRush.Gamemode
{
	public class BossRushRun : Run
	{
		private float stopwatch = 0f;

		public WaveManager waveManager;

		public float bonusAmbientLevel;

		public override bool spawnWithPod => false;

		public override bool canFamilyEventTrigger => false;

		public override void OverrideRuleChoices(RuleChoiceMask mustInclude, RuleChoiceMask mustExclude, ulong runSeed)
		{
			((Run)this).OverrideRuleChoices(mustInclude, mustExclude, runSeed);
			bool flag = true;
			for (int i = 0; i < ArtifactCatalog.artifactCount; i++)
			{
				ArtifactDef artifactDef = ArtifactCatalog.GetArtifactDef((ArtifactIndex)i);
				RuleDef val = RuleCatalog.FindRuleDef("Artifacts." + artifactDef.cachedName);
				((Run)this).ForceChoice(mustInclude, mustExclude, val.FindChoice("Off"));
			}
		}

		public override void Start()
		{
			base.startingScenes = (SceneDef[])(object)new SceneDef[1] { SceneDef.itmoon };
			base.startingSceneGroup = null;
			((Run)this).Start();
			((Run)this).SetEventFlag("NoArtifactWorld");
			Stage.onStageStartGlobal += onStageBegin;
		}

		public override void OnDestroy()
		{
			((Run)this).OnDestroy();
			waveManager.Unhook();
			Stage.onStageStartGlobal -= onStageBegin;
			ObjectivePanelController.collectObjectiveSources -= CollectObjectives;
		}

		public void End()
		{
			Run.instance.BeginGameOver(GameEndings.PrismaticTrialEnding);
		}

		public void StartWaves()
		{
			waveManager.run = this;
			waveManager.Initialize();
			ObjectivePanelController.collectObjectiveSources += CollectObjectives;
		}

		public void CollectObjectives(CharacterMaster master, List<ObjectiveSourceDescriptor> objectiveSourcesList)
		{
			//IL_0004: 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)
			objectiveSourcesList.Add(new ObjectiveSourceDescriptor
			{
				master = master,
				objectiveType = typeof(WaveManager.BossRushObjective),
				source = (Object)(object)this
			});
		}

		public void InvokeWave()
		{
			waveManager.DoNextWave();
		}

		public void onStageBegin(Stage stage)
		{
			waveManager = new WaveManager();
			waveManager.FixScene();
			((MonoBehaviour)this).Invoke("StartWaves", 5f);
		}

		public override void FixedUpdate()
		{
			((Run)this).FixedUpdate();
		}

		public override void AdvanceStage(SceneDef nextScene)
		{
			((Run)this).AdvanceStage(nextScene);
		}

		public override void RecalculateDifficultyCoefficentInternal()
		{
			//IL_0009: Unknown result type (might be due to invalid IL or missing references)
			float runStopwatch = ((Run)this).GetRunStopwatch();
			DifficultyDef difficultyDef = DifficultyCatalog.GetDifficultyDef(((Run)this).selectedDifficulty);
			float num = Mathf.Floor(runStopwatch * (1f / 60f));
			float num2 = (float)((Run)this).participatingPlayerCount * 0.3f;
			float num3 = 0.7f + num2;
			float num4 = 0.7f + num2;
			float num5 = Mathf.Pow((float)((Run)this).participatingPlayerCount, 0.2f);
			float num6 = 0.0506f * difficultyDef.scalingValue * num5;
			float num7 = 0.0506f * difficultyDef.scalingValue * num5;
			float num8 = Mathf.Pow(1.15f, (float)base.stageClearCount);
			base.compensatedDifficultyCoefficient = (num4 + num7 * num) * num8;
			base.difficultyCoefficient = (num3 + num6 * num) * num8;
			float num9 = (num3 + num6 * (runStopwatch * (1f / 60f))) * Mathf.Pow(1.15f, (float)base.stageClearCount);
			((Run)this).ambientLevel = Mathf.Min((num9 - num3) / 0.33f + 1f, (float)Run.ambientLevelCap);
			((Run)this).ambientLevel = ((Run)this).ambientLevel + bonusAmbientLevel;
			int ambientLevelFloor = ((Run)this).ambientLevelFloor;
			((Run)this).ambientLevelFloor = Mathf.FloorToInt(((Run)this).ambientLevel);
			if (ambientLevelFloor != ((Run)this).ambientLevelFloor && ambientLevelFloor != 0 && ((Run)this).ambientLevelFloor > ambientLevelFloor)
			{
				((Run)this).OnAmbientLevelUp();
			}
		}
	}
	public static class GameMode
	{
		public enum ShrineType
		{
			Waveskip,
			Perfected,
			Voidtouched
		}

		public class BossRushShrineController : MonoBehaviour
		{
			public bool isVoidtouch = false;

			public bool isPerfected = false;

			public bool isWaveskip = false;

			public PurchaseInteraction interaction;

			public void Start()
			{
				interaction = ((Component)this).GetComponent<PurchaseInteraction>();
				((UnityEvent<Interactor>)(object)((Component)this).GetComponent<PurchaseInteraction>().onPurchase).AddListener((UnityAction<Interactor>)OnInteract);
			}

			public void FixedUpdate()
			{
				WaveManager instance = WaveManager.instance;
				if (!instance.canInteractWithShrines)
				{
					interaction.available = false;
				}
				else if (isPerfected && instance.isVoidtouchedWave)
				{
					interaction.available = false;
				}
				else if (isVoidtouch && instance.isPerfectedWave)
				{
					interaction.available = false;
				}
			}

			public void OnInteract(Interactor interactor)
			{
				((Component)this).GetComponent<PurchaseInteraction>().Networkavailable = false;
				NetworkWriter val = NetworkingHelper.CreateMessage((short)121, (Action<NetworkWriter>)delegate(NetworkWriter x)
				{
					x.Write(isVoidtouch);
					x.Write(isWaveskip);
					x.Write(isPerfected);
				});
				NetworkingHelper.ServerSendToAll(val);
			}

			[NetworkMessageHandler(client = true, msgType = 121)]
			public static void HandleNet(NetworkMessage netmsg)
			{
				if (Object.op_Implicit((Object)(object)Run.instance) && Run.instance is BossRushRun)
				{
					bool flag = netmsg.reader.ReadBoolean();
					bool flag2 = netmsg.reader.ReadBoolean();
					bool flag3 = netmsg.reader.ReadBoolean();
					HandleInteract(flag, flag3, flag2);
					Debug.Log((object)"Handling netmessage");
				}
			}

			public static void HandleInteract(bool isVoidtouch, bool isPerfected, bool isWaveskip)
			{
				if (isVoidtouch)
				{
					WaveManager.instance.isVoidtouchedWave = true;
					Chat.AddMessage("<style=cIsVoid>The Void imbues its power in the wave to come...</style>");
				}
				if (isPerfected)
				{
					WaveManager.instance.isPerfectedWave = true;
					Chat.AddMessage("<style=cIsUtility>The Moon shines its blessing on the wave to come...</style>");
				}
				if (isWaveskip)
				{
					WaveManager.instance.DoNextWave();
					Chat.AddMessage("<style=cIsDamage>Advancing the simulation!</style>");
				}
			}
		}

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

			public static hook_RecalculateStats <>9__7_0;

			internal void <Create>b__7_0(orig_RecalculateStats orig, CharacterBody self)
			{
				orig.Invoke(self);
				if (self.HasBuff(BossRushSpeed))
				{
					self.moveSpeed *= 1f + 0.1f * (float)self.GetBuffCount(BossRushSpeed);
				}
			}
		}

		public static GameObject bossRushPrefab;

		public static BuffDef BossRushSpeed;

		public static GameObject ProgressionSlab;

		public static GameObject VoidtouchWave;

		public static GameObject PerfectedWave;

		public static GameObject HotPooGames;

		public static void Create()
		{
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			//IL_0015: Expected O, but got Unknown
			//IL_0101: 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_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_01a3: Unknown result type (might be due to invalid IL or missing references)
			//IL_0259: 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_03af: Unknown result type (might be due to invalid IL or missing references)
			//IL_03b4: Unknown result type (might be due to invalid IL or missing references)
			//IL_03e2: Unknown result type (might be due to invalid IL or missing references)
			//IL_03e7: Unknown result type (might be due to invalid IL or missing references)
			//IL_03ed: Expected O, but got Unknown
			bossRushPrefab = RuntimePrefabManager.CreatePrefab(new GameObject("bossRushRun"), "bossRushRun");
			GameObject classicRun = GameObject.ClassicRun;
			BossRushRun bossRushRun = bossRushPrefab.AddComponent<BossRushRun>();
			((Run)bossRushRun).lobbyBackgroundPrefab = classicRun.GetComponent<Run>().lobbyBackgroundPrefab;
			((Run)bossRushRun).uiPrefab = classicRun.GetComponent<Run>().uiPrefab;
			((Run)bossRushRun).userPickable = true;
			((Run)bossRushRun).nameToken = "BOSSRUSH_MENU_NAME";
			((Run)bossRushRun).gameOverPrefab = classicRun.GetComponent<Run>().gameOverPrefab;
			((Run)bossRushRun).startingSceneGroup = classicRun.GetComponent<Run>().startingSceneGroup;
			bossRushPrefab.AddComponent<NetworkIdentity>();
			bossRushPrefab.AddComponent<DirectorCore>();
			bossRushPrefab.AddComponent<TeamManager>();
			bossRushPrefab.AddComponent<NetworkRuleBook>();
			bossRushPrefab.AddComponent<RunCameraManager>();
			RuntimePrefabManager.MakeNetworkPrefab(bossRushPrefab);
			BossRushSpeed = ScriptableObject.CreateInstance<BuffDef>();
			BossRushSpeed.canStack = true;
			BossRushSpeed.iconSprite = BuffDef.bdCloakSpeed.iconSprite;
			((Object)BossRushSpeed).name = "Blessing of the Void";
			BossRushSpeed.buffColor = Color.magenta;
			PerfectedWave = RuntimePrefabManager.CreatePrefab(GameObject.ShrineBoss, "PerfectedWave");
			VoidtouchWave = RuntimePrefabManager.CreatePrefab(GameObject.ShrineBoss, "VoidtouchWave");
			ProgressionSlab = RuntimePrefabManager.CreatePrefab(GameObject.LunarRecycler, "SkipWave");
			NetworkHash128 assetId = PerfectedWave.GetComponent<NetworkIdentity>().assetId;
			Debug.Log((object)("PerfectedWave ID pre-reset: " + ((object)(NetworkHash128)(ref assetId)).ToString()));
			UnityExtensions.RemoveComponent<ShrineBossBehavior>(PerfectedWave);
			UnityExtensions.RemoveComponent<ShrineBossBehavior>(VoidtouchWave);
			PurchaseInteraction component = VoidtouchWave.GetComponent<PurchaseInteraction>();
			component.displayNameToken = "BOSSRUSH_VOID_SHRINE";
			component.costType = (CostTypeIndex)0;
			component.contextToken = "BOSSRUSH_VOID_CONTEXT";
			BossRushShrineController bossRushShrineController = VoidtouchWave.AddComponent<BossRushShrineController>();
			bossRushShrineController.isVoidtouch = true;
			MeshRenderer[] componentsInChildren = VoidtouchWave.GetComponentsInChildren<MeshRenderer>();
			foreach (MeshRenderer val in componentsInChildren)
			{
				if (((Object)((Component)val).gameObject).name == "Symbol")
				{
					((Renderer)val).material = Material.matDeepVoidPortalCenter;
				}
				else
				{
					((Renderer)val).material = Material.matDeepVoidPortalOpaque;
				}
			}
			BossRushShrineController bossRushShrineController2 = PerfectedWave.AddComponent<BossRushShrineController>();
			bossRushShrineController2.isPerfected = true;
			PurchaseInteraction component2 = PerfectedWave.GetComponent<PurchaseInteraction>();
			component2.displayNameToken = "BOSSRUSH_PERFECTED_SHRINE";
			component2.costType = (CostTypeIndex)0;
			component2.contextToken = "BOSSRUSH_PERFECTED_CONTEXT";
			MeshRenderer[] componentsInChildren2 = PerfectedWave.GetComponentsInChildren<MeshRenderer>();
			foreach (MeshRenderer val2 in componentsInChildren2)
			{
				if (((Object)((Component)val2).gameObject).name == "Symbol")
				{
					((Renderer)val2).material = Material.matLunarGolemChargeGlow;
				}
				else
				{
					((Renderer)val2).material = Material.matLunarGolem;
				}
			}
			if (!Object.op_Implicit((Object)(object)ProgressionSlab.GetComponent<PurchaseInteraction>()))
			{
				ProgressionSlab.AddComponent<PurchaseInteraction>();
			}
			ProgressionSlab.GetComponent<PurchaseInteraction>().costType = (CostTypeIndex)0;
			ProgressionSlab.GetComponent<PurchaseInteraction>().contextToken = "BOSSRUSH_WAVESKIP_CONTEXT";
			ProgressionSlab.GetComponent<PurchaseInteraction>().displayNameToken = "BOSSRUSH_WAVESKIP_NAME";
			BossRushShrineController bossRushShrineController3 = ProgressionSlab.AddComponent<BossRushShrineController>();
			bossRushShrineController3.isWaveskip = true;
			StringExtensions.Add("BOSSRUSH_PERFECTED_SHRINE", "Shrine of the Moon");
			StringExtensions.Add("BOSSRUSH_PERFECTED_CONTEXT", "Take on the challenge of the Moon?");
			StringExtensions.Add("BOSSRUSH_VOID_SHRINE", "Shrine of the Void");
			StringExtensions.Add("BOSSRUSH_VOID_CONTEXT", "Take on the challenge of the Void?");
			StringExtensions.Add("BOSSRUSH_WAVESKIP_NAME", "...");
			StringExtensions.Add("BOSSRUSH_WAVESKIP_CONTEXT", "Advance the simulation...?");
			assetId = PerfectedWave.GetComponent<NetworkIdentity>().assetId;
			Debug.Log((object)("PerfectedWave ID post-reset: " + ((object)(NetworkHash128)(ref assetId)).ToString()));
			object obj = <>c.<>9__7_0;
			if (obj == null)
			{
				hook_RecalculateStats val3 = delegate(orig_RecalculateStats orig, CharacterBody self)
				{
					orig.Invoke(self);
					if (self.HasBuff(BossRushSpeed))
					{
						self.moveSpeed *= 1f + 0.1f * (float)self.GetBuffCount(BossRushSpeed);
					}
				};
				<>c.<>9__7_0 = val3;
				obj = (object)val3;
			}
			CharacterBody.RecalculateStats += (hook_RecalculateStats)obj;
			BossRush.contentPack.RegisterGameObject(bossRushPrefab);
			BossRush.contentPack.RegisterScriptableObject((ScriptableObject)(object)BossRushSpeed);
			UI.Initalize();
		}

		public static void SetupShrineWaveskip(GameObject ProgressionSlab)
		{
			//IL_0023: Unknown result type (might be due to invalid IL or missing references)
			if (!Object.op_Implicit((Object)(object)ProgressionSlab.GetComponent<PurchaseInteraction>()))
			{
				ProgressionSlab.AddComponent<PurchaseInteraction>();
			}
			ProgressionSlab.GetComponent<PurchaseInteraction>().costType = (CostTypeIndex)0;
			ProgressionSlab.GetComponent<PurchaseInteraction>().contextToken = "BOSSRUSH_WAVESKIP_CONTEXT";
			ProgressionSlab.GetComponent<PurchaseInteraction>().displayNameToken = "BOSSRUSH_WAVESKIP_NAME";
			BossRushShrineController bossRushShrineController = ProgressionSlab.AddComponent<BossRushShrineController>();
			bossRushShrineController.isWaveskip = true;
		}
	}
	public class StackableHealthBar : MonoBehaviour
	{
		public Image FillRect;

		public Image DelayFillRect;

		public HUD HUD;

		public WaveSpawn waveSpawn;

		public HGTextMeshProUGUI HP;

		public HGTextMeshProUGUI Name;

		public HGTextMeshProUGUI Subtitle;

		public CharacterBody target;

		private TimeStamp nextAllowedSourceUpdateTime = TimeStamp.negativeInfinity;

		private float delayedTotalHealthFraction;

		private float healthFractionVelocity;

		public void LateUpdate()
		{
			if (!Object.op_Implicit((Object)(object)target))
			{
				Object.Destroy((Object)(object)((Component)this).gameObject);
			}
			float combinedHealth = target.healthComponent.combinedHealth;
			float fullCombinedHealth = target.healthComponent.fullCombinedHealth;
			float num = ((fullCombinedHealth == 0f) ? 0f : Mathf.Clamp01(combinedHealth / fullCombinedHealth));
			delayedTotalHealthFraction = Mathf.Clamp(Mathf.SmoothDamp(delayedTotalHealthFraction, num, ref healthFractionVelocity, 0.1f, float.PositiveInfinity, Time.deltaTime), num, 1f);
			FillRect.fillAmount = num;
			DelayFillRect.fillAmount = delayedTotalHealthFraction;
			((TMP_Text)HP).SetText($"{(int)combinedHealth} / {(int)fullCombinedHealth}", true);
			((TMP_Text)Name).SetText(Util.GetBestBodyName(((Component)target).gameObject), true);
			((TMP_Text)Subtitle).SetText("<sprite name=\"CloudLeft\" tint=1> " + target.GetSubtitle() + " <sprite name=\"CloudRight\" tint=1>", true);
		}
	}
	public static class UI
	{
		[Serializable]
		[CompilerGenerated]
		private sealed class <>c
		{
			public static readonly <>c <>9 = new <>c();

			public static hook_SubmitCmd <>9__0_0;

			internal void <Initalize>b__0_0(orig_SubmitCmd orig, ConsoleFunctions self, string str)
			{
				if (Object.op_Implicit((Object)(object)((Component)self).GetComponent<HGButton>()) && ((Component)self).GetComponent<HGButton>().hoverToken == "BOSSRUSH_HOVERDESC")
				{
					if (str == "transition_command \"gamemode bossRushRun; host 0;\"")
					{
						orig.Invoke(self, str);
					}
				}
				else
				{
					orig.Invoke(self, str);
				}
			}
		}

		public static void Initalize()
		{
			//IL_0056: Unknown result type (might be due to invalid IL or missing references)
			//IL_005b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0061: Expected O, but got Unknown
			StringExtensions.Add("BOSSRUSH_MENU_NAME", "Boss Rush");
			StringExtensions.Add("BOSSRUSH_HOVERDESC", "Fight through a gauntlet of powered-up versions of every boss!.");
			SceneManager.activeSceneChanged += OnSceneChanged;
			object obj = <>c.<>9__0_0;
			if (obj == null)
			{
				hook_SubmitCmd val = delegate(orig_SubmitCmd orig, ConsoleFunctions self, string str)
				{
					if (Object.op_Implicit((Object)(object)((Component)self).GetComponent<HGButton>()) && ((Component)self).GetComponent<HGButton>().hoverToken == "BOSSRUSH_HOVERDESC")
					{
						if (str == "transition_command \"gamemode bossRushRun; host 0;\"")
						{
							orig.Invoke(self, str);
						}
					}
					else
					{
						orig.Invoke(self, str);
					}
				};
				<>c.<>9__0_0 = val;
				obj = (object)val;
			}
			ConsoleFunctions.SubmitCmd += (hook_SubmitCmd)obj;
		}

		private static void OnSceneChanged(Scene prev, Scene next)
		{
			//IL_00ac: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b6: Expected O, but got Unknown
			if (!(((Scene)(ref next)).name == "title"))
			{
				return;
			}
			GameObject val = GameObject.Find("MainMenu");
			Transform val2 = val.transform.Find("MENU: Extra Game Mode/ExtraGameModeMenu/Main Panel/GenericMenuButtonPanel/JuicePanel/GenericMenuButton (Eclipse)");
			if (Object.op_Implicit((Object)(object)val2))
			{
				GameObject val3 = Object.Instantiate<GameObject>(((Component)val2).gameObject, val2.parent);
				val3.GetComponent<LanguageTextMeshController>().token = "BOSSRUSH_MENU_NAME";
				ConsoleFunctions consoleFunctions = val3.GetComponent<ConsoleFunctions>();
				HGButton component = val3.GetComponent<HGButton>();
				component.hoverToken = "BOSSRUSH_HOVERDESC";
				((UnityEventBase)((Button)component).onClick).RemoveAllListeners();
				((UnityEvent)((Button)component).onClick).AddListener((UnityAction)delegate
				{
					consoleFunctions.SubmitCmd("transition_command \"gamemode bossRushRun; host 0;\"");
				});
			}
			else
			{
				Debug.Log((object)"Could not find transform.");
			}
		}
	}
}
namespace BossRush.Tweaks
{
	public class Grandparent : TweakBase
	{
		public class VoidSunController : MonoBehaviour
		{
			public CharacterBody owner;

			public float stopwatch = 0f;

			public float delay = 0.03f;

			private float angleStopwatch;

			public GameObject beamVfxInstance;

			private float y = 0f;

			private float yDir = 20f;

			public void SpawnVFX()
			{
				//IL_0034: Unknown result type (might be due to invalid IL or missing references)
				//IL_0048: Unknown result type (might be due to invalid IL or missing references)
				//IL_004d: Unknown result type (might be due to invalid IL or missing references)
				beamVfxInstance = Object.Instantiate<GameObject>(GameObject.VoidRaidCrabSpinBeamVFX);
				beamVfxInstance.transform.SetParent(((Component)this).transform);
				Transform transform = beamVfxInstance.transform;
				transform.localScale += new Vector3(0.3f, 0.3f, 0.3f);
			}

			public void FixedUpdate()
			{
				//IL_010c: Unknown result type (might be due to invalid IL or missing references)
				//IL_0117: Unknown result type (might be due to invalid IL or missing references)
				//IL_011c: Unknown result type (might be due to invalid IL or missing references)
				//IL_0121: 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_012a: Unknown result type (might be due to invalid IL or missing references)
				//IL_0132: 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)
				//IL_015e: Unknown result type (might be due to invalid IL or missing references)
				//IL_0163: Unknown result type (might be due to invalid IL or missing references)
				//IL_0164: 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_016c: Unknown result type (might be due to invalid IL or missing references)
				//IL_0178: Unknown result type (might be due to invalid IL or missing references)
				//IL_018e: Unknown result type (might be due to invalid IL or missing references)
				//IL_01a6: Unknown result type (might be due to invalid IL or missing references)
				//IL_01d7: Unknown result type (might be due to invalid IL or missing references)
				//IL_01de: Expected O, but got Unknown
				//IL_01e6: Unknown result type (might be due to invalid IL or missing references)
				//IL_01eb: 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_0221: Unknown result type (might be due to invalid IL or missing references)
				//IL_0226: Unknown result type (might be due to invalid IL or missing references)
				//IL_0242: Unknown result type (might be due to invalid IL or missing references)
				//IL_025a: Unknown result type (might be due to invalid IL or missing references)
				//IL_02a0: Unknown result type (might be due to invalid IL or missing references)
				//IL_02a8: Unknown result type (might be due to invalid IL or missing references)
				//IL_02b0: Unknown result type (might be due to invalid IL or missing references)
				stopwatch += Time.fixedDeltaTime;
				angleStopwatch += 90f * Time.fixedDeltaTime;
				if (angleStopwatch >= 360f)
				{
					angleStopwatch = 0f;
				}
				if (Object.op_Implicit((Object)(object)owner) && !owner.healthComponent.alive)
				{
					owner = null;
				}
				if (!Object.op_Implicit((Object)(object)owner))
				{
					if (Object.op_Implicit((Object)(object)beamVfxInstance))
					{
						VfxKillBehavior.KillVfxObject(beamVfxInstance);
						beamVfxInstance = null;
					}
					return;
				}
				if (Object.op_Implicit((Object)(object)owner) && !Object.op_Implicit((Object)(object)beamVfxInstance))
				{
					SpawnVFX();
				}
				Vector3 val = owner.master.aiComponents[0].currentEnemy.gameObject.transform.position - ((Component)this).transform.position;
				Vector3 normalized = ((Vector3)(ref val)).normalized;
				y = Mathf.Lerp(y, normalized.y, 1.5f * Time.fixedDeltaTime);
				Vector3 val2 = Quaternion.AngleAxis(angleStopwatch, ((Component)this).transform.up) * normalized;
				Vector3 val3 = default(Vector3);
				((Vector3)(ref val3))..ctor(val2.x, y, val2.z);
				beamVfxInstance.transform.forward = val3;
				beamVfxInstance.transform.position = ((Component)this).transform.position;
				if (stopwatch >= delay)
				{
					stopwatch = 0f;
					BulletAttack val4 = new BulletAttack();
					val4.origin = ((Component)this).transform.position;
					val4.aimVector = val3;
					val4.minSpread = 0f;
					val4.maxSpread = 0f;
					val4.maxDistance = 400f;
					val4.stopperMask = LayerMask.op_Implicit(0);
					val4.radius = 4f;
					val4.smartCollision = false;
					val4.queryTriggerInteraction = (QueryTriggerInteraction)1;
					val4.procCoefficient = 1f;
					val4.procChainMask = default(ProcChainMask);
					val4.owner = ((Component)owner).gameObject;
					val4.weapon = ((Component)this).gameObject;
					val4.damage = 6f * owner.damage * 0.03f;
					val4.damageColorIndex = (DamageColorIndex)0;
					val4.damageType = (DamageType)0;
					val4.falloffModel = (FalloffModel)0;
					val4.force = 0f;
					val4.hitEffectPrefab = SpinBeamAttack.beamImpactEffectPrefab;
					val4.isCrit = false;
					val4.HitEffectNormal = false;
					if (NetworkServer.active)
					{
						val4.Fire();
					}
				}
			}
		}

		public override GameObject Body => GameObject.GrandParentBody;

		public override void ProcessTweaks(CharacterBody body, SkillLocator locator)
		{
			base.ProcessTweaks(body, locator);
		}

		public override void Initialize(YAUContentPack pack, ConfigFile config, string identifier)
		{
			//IL_0012: Unknown result type (might be due to invalid IL or missing references)
			//IL_001c: Expected O, but got Unknown
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Expected O, but got Unknown
			base.Initialize(pack, config, identifier);
			ChannelSun.CreateSun += new hook_CreateSun(OverrideSun);
			ChannelSunEnd.OnEnter += new hook_OnEnter(OnChannelExit);
		}

		public GameObject OverrideSun(orig_CreateSun orig, ChannelSun self, Vector3 sunPos)
		{
			//IL_002d: Unknown result type (might be due to invalid IL or missing references)
			Transform transform = GameObject.Find("HOLDER: Stage").transform;
			Transform val = transform.Find("PowerCore");
			if (!Object.op_Implicit((Object)(object)val))
			{
				return orig.Invoke(self, sunPos);
			}
			VoidSunController voidSunController = ((Component)val).GetComponent<VoidSunController>();
			if (!Object.op_Implicit((Object)(object)((Component)val).GetComponent<GenericOwnership>()))
			{
				UnityExtensions.AddComponent<GenericOwnership>((Component)(object)val);
			}
			if (!Object.op_Implicit((Object)(object)voidSunController))
			{
				voidSunController = UnityExtensions.AddComponent<VoidSunController>((Component)(object)val);
			}
			voidSunController.owner = ((EntityState)self).characterBody;
			return ((Component)val).gameObject;
		}

		public void OnChannelExit(orig_OnEnter orig, ChannelSunEnd self)
		{
			Transform transform = GameObject.Find("HOLDER: Stage").transform;
			Transform val = transform.Find("PowerCore");
			if (!Object.op_Implicit((Object)(object)val))
			{
				orig.Invoke(self);
				return;
			}
			VoidSunController component = ((Component)val).GetComponent<VoidSunController>();
			component.owner = null;
			orig.Invoke(self);
		}
	}
	public abstract class TweakBase : GenericBase<TweakBase>
	{
		public abstract GameObject Body { get; }

		public override void Initialize(YAUContentPack pack, ConfigFile config, string identifier)
		{
			//IL_0012: Unknown result type (might be due to invalid IL or missing references)
			//IL_001c: Expected O, but got Unknown
			((GenericBase)this).Initialize(pack, config, identifier);
			CharacterBody.Start += new hook_Start(OnBodyStart);
		}

		private void OnBodyStart(orig_Start orig, CharacterBody body)
		{
			//IL_000a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0015: Unknown result type (might be due to invalid IL or missing references)
			orig.Invoke(body);
			if (body.bodyIndex == BodyCatalog.FindBodyIndex(Body))
			{
				ProcessTweaks(body, body.skillLocator);
			}
		}

		public virtual void ProcessTweaks(CharacterBody body, SkillLocator locator)
		{
		}
	}
}