Decompiled source of Boss Rush v1.1.0

plugins/BossRush.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.InteropServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using System.Xml;
using System.Xml.Serialization;
using BepInEx;
using BepInEx.Configuration;
using BepInEx.Logging;
using HarmonyLib;
using SideLoader;
using SideLoader.SaveData;
using UnityEngine;
using UnityEngine.SceneManagement;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: AssemblyTitle("OutwardModTemplate")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("OutwardModTemplate")]
[assembly: AssemblyCopyright("Copyright ©  2021")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("c5450fe0-edcf-483f-b9ea-4b1ef9d36da7")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: TargetFramework(".NETFramework,Version=v4.7.2", FrameworkDisplayName = ".NET Framework 4.7.2")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.0.0")]
[module: UnverifiableCode]
namespace BossRush;

public class PublicBossDictionary
{
	public Dictionary<string, DataValue> BossDictionary = new Dictionary<string, DataValue>();

	public PublicBossDictionary()
	{
		BossDictionary = new Dictionary<string, DataValue>();
		BossDictionary.Add("Troglodyte Queen", new DataValue((AreaEnum)151, 0));
		BossDictionary.Add("Elite Mantis Shrimp", new DataValue((AreaEnum)151, 1));
		BossDictionary.Add("Brand Squire", new DataValue((AreaEnum)151, 2));
		BossDictionary.Add("Ash Giant Highmonk", new DataValue((AreaEnum)251, 0));
		BossDictionary.Add("Elite Ash Giants", new DataValue((AreaEnum)251, 1));
		BossDictionary.Add("Elite Alpha Tuanosaur", new DataValue((AreaEnum)251, 2));
		BossDictionary.Add("Light Mender and Plague Doctor", new DataValue((AreaEnum)553, 0));
		BossDictionary.Add("Elite Burning Man", new DataValue((AreaEnum)553, 1));
		BossDictionary.Add("Immaculate Dreamer", new DataValue((AreaEnum)553, 2));
		BossDictionary.Add("Calixa (boss)", new DataValue((AreaEnum)351, 0));
		BossDictionary.Add("Elite Beast Golem", new DataValue((AreaEnum)351, 1));
		BossDictionary.Add("Elite Crescent Sharks", new DataValue((AreaEnum)351, 2));
		BossDictionary.Add("Immaculate's Bird", new DataValue((AreaEnum)451, 0));
		BossDictionary.Add("Elite Sublime Shell", new DataValue((AreaEnum)451, 1));
		BossDictionary.Add("Elite Boozu", new DataValue((AreaEnum)451, 2));
		BossDictionary.Add("Grandmother", new DataValue((AreaEnum)651, 1));
		BossDictionary.Add("Elite Crimson Avatar", new DataValue((AreaEnum)651, 2));
		BossDictionary.Add("Elite Gargoyles", new DataValue((AreaEnum)651, 3));
		BossDictionary.Add("Elite Torcrab", new DataValue((AreaEnum)651, 4));
	}
}
[Serializable]
public struct DataValue
{
	public AreaEnum area;

	public int spawnpointindex;

	public DataValue(AreaEnum area, int spawnpointindex)
	{
		//IL_0002: 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)
		this.area = area;
		this.spawnpointindex = spawnpointindex;
	}
}
public class BossesQE_Collection
{
	public Dictionary<string, int> onDeathStackRequirement = new Dictionary<string, int>();

	public BossesQE_Collection()
	{
		onDeathStackRequirement.Add("Bosses_BrandHeroDefeat", 1);
		onDeathStackRequirement.Add("Bosses_EliteShrimpDefeat", 1);
		onDeathStackRequirement.Add("Bosses_TrogQueenDefeat", 7);
		onDeathStackRequirement.Add("Bosses_EliteBurnManDefeat", 3);
		onDeathStackRequirement.Add("Bosses_EliteLichesDefeat", 2);
		onDeathStackRequirement.Add("Bosses_EliteImmaculateDefeat", 1);
		onDeathStackRequirement.Add("Bosses_CalixaDefeat", 1);
		onDeathStackRequirement.Add("Bosses_EliteSharkDefeat", 3);
		onDeathStackRequirement.Add("Bosses_EliteBeasGolemDefeat", 1);
		onDeathStackRequirement.Add("Bosses_ElitePriestDefeat", 1);
		onDeathStackRequirement.Add("Bosses_EliteGiantsDefeat", 3);
		onDeathStackRequirement.Add("Bosses_EliteTuanoDefeat", 1);
		onDeathStackRequirement.Add("BossesDLC2_GrandmotherDefeat", 1);
		onDeathStackRequirement.Add("BossesDLC2_CrimsonDefeat", 1);
		onDeathStackRequirement.Add("BossesDLC2_GargoylesDefeat", 3);
		onDeathStackRequirement.Add("BossesDLC2_TorcrabDefeat", 1);
	}
}
public class BossRushManager
{
	private Dictionary<string, DefeatedBossData> CurrentlyBeatenBosses = new Dictionary<string, DefeatedBossData>();

	public BossRushManager()
	{
		BossRushPlugin.Log.LogMessage((object)"Running Boss Rush Manager");
		FindXMLDefinitions();
	}

	private void FindXMLDefinitions()
	{
	}

	public void RecordVictory(Character player, Character foe)
	{
		//IL_0003: Unknown result type (might be due to invalid IL or missing references)
		//IL_000e: Unknown result type (might be due to invalid IL or missing references)
		RecordVictory(UID.op_Implicit(player.UID), UID.op_Implicit(foe.UID));
	}

	public void RecordVictory(string playerUID, string foeUID)
	{
		BossRushPlugin.Log.LogMessage((object)("Recording Victory for " + playerUID + "(player) against " + foeUID));
		if (CurrentlyBeatenBosses.ContainsKey(playerUID))
		{
			DefeatedBossData defeatedBossData = CurrentlyBeatenBosses[playerUID];
			if (defeatedBossData != null)
			{
				if (defeatedBossData.DefeatedFoes == null)
				{
					defeatedBossData.DefeatedFoes = new List<string>();
				}
				defeatedBossData.DefeatedFoes.Add(foeUID);
			}
		}
		else
		{
			CurrentlyBeatenBosses.Add(playerUID, new DefeatedBossData
			{
				CharacterUID = playerUID,
				DefeatedFoes = new List<string> { foeUID }
			});
		}
	}

	public void ClearRecord(string playerUID)
	{
		if (CurrentlyBeatenBosses.ContainsKey(playerUID))
		{
			CurrentlyBeatenBosses.Remove(playerUID);
		}
	}

	public bool HasRecord(string playerUID)
	{
		if (CurrentlyBeatenBosses.ContainsKey(playerUID))
		{
			return CurrentlyBeatenBosses[playerUID].DefeatedFoes != null && CurrentlyBeatenBosses[playerUID].DefeatedFoes.Count > 0;
		}
		return false;
	}

	public List<string> GetDefeatedFoesFor(string playerUID)
	{
		if (CurrentlyBeatenBosses.ContainsKey(playerUID))
		{
			return CurrentlyBeatenBosses[playerUID].DefeatedFoes.ToList();
		}
		return new List<string>();
	}

	private bool TestDocument(string path, Type objType)
	{
		Stream stream = new FileStream(path, FileMode.Open);
		XmlReader xmlReader = new XmlTextReader(stream);
		XmlSerializer xmlSerializer = new XmlSerializer(objType);
		bool result = false;
		if (xmlSerializer.CanDeserialize(xmlReader))
		{
			result = true;
		}
		stream.Close();
		return result;
	}

	public void ApplySaveData(BossRushSaveExtension SaveExtension)
	{
		CurrentlyBeatenBosses = new Dictionary<string, DefeatedBossData>();
		foreach (string defeatedBoss in SaveExtension.BossRushData.DefeatedBosses)
		{
			RecordVictory(SaveExtension.BossRushData.playerUID, defeatedBoss);
		}
	}

	private bool HasFolder(string FolderLocation)
	{
		BossRushPlugin.Log.LogMessage((object)$"Has Folder ({FolderLocation}):{Directory.Exists(FolderLocation)}");
		return Directory.Exists(FolderLocation);
	}
}
public class BossRushSaveExtension : PlayerSaveExtension
{
	public BossRushSaveData BossRushData = new BossRushSaveData();

	public override void Save(Character character, bool isWorldHost)
	{
		//IL_0052: Unknown result type (might be due to invalid IL or missing references)
		if ((Object)(object)BossRushPlugin.Instance != (Object)null)
		{
			BossRushData.BossOrder = BossRushPlugin.teleportArray;
			BossRushData.BossIndex = BossRushPlugin.teleportindex;
			BossRushData.Activated = BossRushPlugin.activated;
			BossRushData.DefeatedBosses = BossRushPlugin.Instance.BossRushManager.GetDefeatedFoesFor(UID.op_Implicit(character.UID));
		}
	}

	public override void ApplyLoadedSave(Character character, bool isWorldHost)
	{
		if ((Object)(object)BossRushPlugin.Instance != (Object)null)
		{
			BossRushPlugin.teleportArray = BossRushData.BossOrder;
			BossRushPlugin.teleportindex = BossRushData.BossIndex;
			BossRushPlugin.activated = BossRushData.Activated;
			BossRushPlugin.Instance.BossRushManager.ApplySaveData(this);
		}
	}
}
[Serializable]
public class BossRushSaveData
{
	public string playerUID;

	public string[] BossOrder;

	public int BossIndex;

	public bool Activated;

	public List<string> DefeatedBosses;
}
[HarmonyPatch(typeof(QuestEventOnDeath), "OnDeath")]
public class BossRush_OnDeath_Patch
{
	private static void Postfix(QuestEventOnDeath __instance, QuestEventReference ___m_questEventRef, bool _loadedDead = false)
	{
		//IL_0122: Unknown result type (might be due to invalid IL or missing references)
		//IL_012e: Unknown result type (might be due to invalid IL or missing references)
		if (!((Object)(object)__instance != (Object)null) || ___m_questEventRef == null)
		{
			return;
		}
		QuestEventManager instance = QuestEventManager.Instance;
		if (!((Object)(object)instance != (Object)null))
		{
			return;
		}
		string eventUID = ___m_questEventRef.EventUID;
		QuestEventSignature questEvent = QuestEventDictionary.GetQuestEvent(eventUID);
		if (questEvent == null)
		{
			return;
		}
		string eventName = questEvent.EventName;
		int eventCurrentStack = instance.GetEventCurrentStack(eventUID);
		Dictionary<string, int> onDeathStackRequirement = BossRushPlugin.bossesQE_Collection.onDeathStackRequirement;
		if (!onDeathStackRequirement.TryGetValue(eventName, out var value) || eventCurrentStack < value || BossRushPlugin.Instance.BossRushManager == null || !BossRushPlugin.activated)
		{
			return;
		}
		Character worldHostCharacter = CharacterManager.Instance.GetWorldHostCharacter();
		if (!((Object)(object)worldHostCharacter != (Object)null) || _loadedDead)
		{
			return;
		}
		GameObject gameObject = ((Component)__instance).gameObject;
		if ((Object)(object)gameObject != (Object)null)
		{
			Character component = gameObject.GetComponent<Character>();
			if ((Object)(object)component != (Object)null)
			{
				BossRushPlugin.Instance.BossRushManager.RecordVictory(UID.op_Implicit(worldHostCharacter.UID), UID.op_Implicit(component.UID));
			}
			else
			{
				BossRushPlugin.Log.LogError((object)"Character component not found on the instance of QuestEventOnDeath.");
			}
		}
		BossRushPlugin.Instance.ProgressDisplay(1);
	}
}
[HarmonyPatch(typeof(Character), "Die")]
public class BossRush_Die_Patch
{
	private static void Prefix(Character __instance, Vector3 _hitVec, bool _loadedDead = false)
	{
		//IL_00b7: Unknown result type (might be due to invalid IL or missing references)
		//IL_00c2: Unknown result type (might be due to invalid IL or missing references)
		if ((Object)(object)__instance != (Object)null && __instance.IsAI && BossRushPlugin.Instance.BossRushManager != null)
		{
			Character worldHostCharacter = CharacterManager.Instance.GetWorldHostCharacter();
			if ((Object)(object)worldHostCharacter != (Object)null && !_loadedDead && (__instance.m_name == "BoozuProudBeast" || __instance.m_name == "CageArmorBoss (1)" || __instance.m_name == "EliteSupremeShell (1)" || __instance.m_name == "Grandmother") && BossRushPlugin.activated)
			{
				BossRushPlugin.Instance.BossRushManager.RecordVictory(UID.op_Implicit(worldHostCharacter.UID), UID.op_Implicit(__instance.UID));
				BossRushPlugin.Instance.ProgressDisplay(1);
			}
		}
	}
}
public static class ConfigElements
{
	public static ConfigEntry<bool> includeProgressMessage;

	public static ConfigEntry<bool> allowTents;

	public static void Init(ConfigFile config)
	{
		includeProgressMessage = config.Bind<bool>("Boss Rush", "Display Progress Messages", true, (ConfigDescription)null);
		allowTents = config.Bind<bool>("Boss Rush", "Allow tents", true, (ConfigDescription)null);
	}
}
[Serializable]
public class DefeatedBossData
{
	public string CharacterUID;

	public List<string> DefeatedFoes;

	public bool HasDeafeated(string CharacterUID)
	{
		return DefeatedFoes.Contains(CharacterUID);
	}
}
public class InteractionFunctionality : InteractionBase
{
	private static Character targetCharacter;

	public override void Activate(Character _character)
	{
		//IL_0007: 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_032b: Unknown result type (might be due to invalid IL or missing references)
		//IL_0330: Unknown result type (might be due to invalid IL or missing references)
		//IL_0341: Unknown result type (might be due to invalid IL or missing references)
		//IL_01be: Unknown result type (might be due to invalid IL or missing references)
		//IL_01c4: Invalid comparison between Unknown and I4
		//IL_0239: Unknown result type (might be due to invalid IL or missing references)
		//IL_023f: Invalid comparison between Unknown and I4
		//IL_02a5: Unknown result type (might be due to invalid IL or missing references)
		targetCharacter = _character;
		Scene activeScene = SceneManager.GetActiveScene();
		string name = ((Scene)(ref activeScene)).name;
		PublicBossDictionary publicBossDictionary = new PublicBossDictionary();
		if (publicBossDictionary != null)
		{
			Dictionary<string, DataValue> bossDictionary = publicBossDictionary.BossDictionary;
			if (bossDictionary != null)
			{
				BossRushPlugin.portalManager = new PortalManager();
				if (BossRushPlugin.portalManager == null)
				{
					return;
				}
				if (name == "Emercar")
				{
					BossRushPlugin.teleportindex = 0;
					if (!BossRushPlugin.activated)
					{
						RelicItems relicItems = new RelicItems();
						foreach (int relic in relicItems.relicList)
						{
							if (_character.Inventory.OwnsItem(relic, 1))
							{
								_character.Inventory.RemoveItem(relic, 1);
								BossRushPlugin.activated = true;
								List<string> list = bossDictionary.Keys.ToList();
								List<string> source = list;
								source = source.OrderBy((string x) => Random.value).ToList();
								BossRushPlugin.teleportArray = source.ToArray();
								BossRushPlugin.lightAltar();
								Animator animator = _character.Animator;
								animator.Play("PaulPickUpGround");
								((InteractionBase)this).PlaySound((Sounds)12250);
								break;
							}
						}
						if (!BossRushPlugin.activated)
						{
							_character.CharacterUI.ShowInfoNotification("Bringing a Relic might do something...");
						}
					}
					else if (BossRushPlugin.activated)
					{
						Animator animator2 = _character.Animator;
						animator2.Play("Death Indirect");
						List<Sounds> list2 = new List<Sounds>();
						if ((int)_character.Sex == 0)
						{
							list2.Add((Sounds)50421);
							list2.Add((Sounds)50421);
							list2.Add((Sounds)50422);
							list2.Add((Sounds)50423);
							list2.Add((Sounds)50424);
							list2.Add((Sounds)50427);
							list2.Add((Sounds)50418);
							list2.Add((Sounds)50420);
						}
						else if ((int)_character.Sex == 1)
						{
							list2.Add((Sounds)51222);
							list2.Add((Sounds)51223);
						}
						else
						{
							list2.Add((Sounds)51097);
						}
						list2 = list2.OrderBy((Sounds x) => Random.value).ToList();
						((InteractionBase)this).PlaySound(list2[0]);
						BossRushPlugin.delayTeleport(_character);
					}
				}
				else
				{
					BossRushPlugin.teleportindex++;
					BossRushPlugin.resetAllowed = true;
					if (BossRushPlugin.teleportindex >= 19)
					{
						BossRushPlugin.portalManager.StartAreaSwitchAndSetPosition(_character, (AreaEnum)501, 1);
						BossRushPlugin.activated = false;
						BossRushPlugin.defeatReset = false;
						BossRushPlugin.Instance.interfaceBootUpDelayedProgressDisplay();
					}
					else
					{
						string key = BossRushPlugin.teleportArray[BossRushPlugin.teleportindex];
						DataValue dataValue = bossDictionary[key];
						AreaEnum area = dataValue.area;
						int spawnpointindex = dataValue.spawnpointindex;
						BossRushPlugin.portalManager.StartAreaSwitchAndSetPosition(_character, area, spawnpointindex);
					}
					BossRushPlugin.displayProgress = true;
				}
			}
			else
			{
				BossRushPlugin.Log.LogMessage((object)"Dictionary is null");
			}
		}
		else
		{
			BossRushPlugin.Log.LogMessage((object)"EntityManager is null!");
		}
	}

	private void printStatus(string occurance)
	{
		BossRushPlugin.Log.LogMessage((object)$"{occurance}:\nInfo: Activated = {BossRushPlugin.activated}, Teleport index = {BossRushPlugin.teleportindex}. Printing teleport array...");
		if (BossRushPlugin.teleportArray != null)
		{
			if (BossRushPlugin.teleportArray.Length != 0)
			{
				printStringArray(BossRushPlugin.teleportArray);
			}
			else
			{
				BossRushPlugin.Log.LogMessage((object)"Teleport array is empty");
			}
		}
		else
		{
			BossRushPlugin.Log.LogMessage((object)"Teleprot array is null");
		}
		BossRushPlugin.Log.LogMessage((object)"Teleport Array finished printing.");
	}

	public void printStringArray(string[] array)
	{
		foreach (string text in array)
		{
			BossRushPlugin.Log.LogMessage((object)text);
		}
	}
}
[BepInPlugin("johbenji.bossrush", "Boss Rush", "1.0.0")]
public class BossRushPlugin : BaseUnityPlugin
{
	[HarmonyPatch(typeof(EnvironmentSave), "ApplyData")]
	private class resetEnterParameters
	{
		private static void Prefix(EnvironmentSave __instance, ref double _gameTime)
		{
			string[] array = new string[6] { "ChersoneseDungeonsBosses", "HallowedDungeonsBosses", "EmercarDungeonsBosses", "AbrassarDungeonsBosses", "AntiqueFieldDungeonsBosses", "CalderaDungeonsBosses" };
			if (UnityEngineExtensions.Contains<string>(array, __instance.AreaName) && activated && resetAllowed)
			{
				_gameTime = (double)AreaManager.Instance.GetAreaFromSceneName(__instance.AreaName).ResetTime + __instance.GameTime + 1.0;
				resetAllowed = false;
			}
		}
	}

	[HarmonyPatch(typeof(EnvironmentSave), "ApplyData")]
	private class resetExitParameters
	{
		private static void Postfix(ref bool __result, string ___AreaName)
		{
			if (__result && ___AreaName == "Emercar")
			{
				resetBossRush();
			}
		}
	}

	[HarmonyPatch(typeof(DefeatScenariosManager), "ActivateDefeatScenario")]
	private class resetBossRushSession
	{
		private static void Postfix()
		{
			resetBossRush();
			defeatReset = true;
		}
	}

	[HarmonyPatch(typeof(AreaManager), "IsNoBedArea")]
	private class AreaManagerPatch
	{
		private static void Postfix(AreaManager __instance, Area _area, ref bool __result)
		{
			if (_area != null && ConfigElements.allowTents.Value)
			{
				int[] array = new int[6] { 351, 451, 651, 151, 553, 251 };
				if (Extensions.Contains(array, _area.ID))
				{
					__result = false;
				}
			}
		}
	}

	[HarmonyPatch(typeof(DefeatScenariosManager), "SendDefeatLoadScene")]
	private class DefeatReturnToBergPatch
	{
		private static bool Prefix(DefeatScenariosManager __instance)
		{
			Log.LogMessage((object)$"DefeatReturnToBergPatch Prefix called. BossRushPlugin.activated = {activated}");
			if (defeatReset)
			{
				defeatReset = false;
				__instance.m_loadedSceneForDefeat = true;
				__instance.m_loadedSceneForDefeatUID = "32";
				if (PhotonNetwork.isMasterClient)
				{
					NetworkLevelLoader.Instance.RequestSwitchArea("Berg", 32, 1.5f, false);
				}
				return false;
			}
			return true;
		}
	}

	[CompilerGenerated]
	private sealed class <DelaySceneHandlingMethod>d__27 : IEnumerator<object>, IDisposable, IEnumerator
	{
		private int <>1__state;

		private object <>2__current;

		public BossRushPlugin <>4__this;

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

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

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

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

		private bool MoveNext()
		{
			//IL_0026: Unknown result type (might be due to invalid IL or missing references)
			//IL_0030: Expected O, but got Unknown
			switch (<>1__state)
			{
			default:
				return false;
			case 0:
				<>1__state = -1;
				<>2__current = (object)new WaitForSeconds(5f);
				<>1__state = 1;
				return true;
			case 1:
				<>1__state = -1;
				<>4__this.SceneHandlingMethod();
				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();
		}
	}

	[CompilerGenerated]
	private sealed class <DelayTeleport>d__35 : IEnumerator<object>, IDisposable, IEnumerator
	{
		private int <>1__state;

		private object <>2__current;

		private PublicBossDictionary <publicBossDictionary>5__1;

		private Dictionary<string, DataValue> <dictionary>5__2;

		private string <key>5__3;

		private DataValue <dataValue>5__4;

		private AreaEnum <area>5__5;

		private int <spawnPointIndex>5__6;

		private Character <character>5__7;

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

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

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

		[DebuggerHidden]
		void IDisposable.Dispose()
		{
			<publicBossDictionary>5__1 = null;
			<dictionary>5__2 = null;
			<key>5__3 = null;
			<character>5__7 = null;
			<>1__state = -2;
		}

		private bool MoveNext()
		{
			//IL_0026: Unknown result type (might be due to invalid IL or missing references)
			//IL_0030: Expected O, but got Unknown
			//IL_009c: 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_00ef: Unknown result type (might be due to invalid IL or missing references)
			switch (<>1__state)
			{
			default:
				return false;
			case 0:
				<>1__state = -1;
				<>2__current = (object)new WaitForSeconds(1.3f);
				<>1__state = 1;
				return true;
			case 1:
				<>1__state = -1;
				<publicBossDictionary>5__1 = new PublicBossDictionary();
				if (<publicBossDictionary>5__1 != null)
				{
					<dictionary>5__2 = <publicBossDictionary>5__1.BossDictionary;
					<key>5__3 = teleportArray[teleportindex];
					<dataValue>5__4 = <dictionary>5__2[<key>5__3];
					<area>5__5 = <dataValue>5__4.area;
					<spawnPointIndex>5__6 = <dataValue>5__4.spawnpointindex;
					if ((Object)(object)portalCharacter != (Object)null)
					{
						<character>5__7 = portalCharacter;
						if ((Object)(object)<character>5__7 != (Object)null)
						{
							portalManager.StartAreaSwitchAndSetPosition(<character>5__7, <area>5__5, <spawnPointIndex>5__6);
						}
						<character>5__7 = null;
					}
					displayProgress = true;
					<dictionary>5__2 = null;
					<key>5__3 = null;
				}
				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();
		}
	}

	[CompilerGenerated]
	private sealed class <DelayedProgressDisplay>d__33 : IEnumerator<object>, IDisposable, IEnumerator
	{
		private int <>1__state;

		private object <>2__current;

		public float waitTime;

		public BossRushPlugin <>4__this;

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

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

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

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

		private bool MoveNext()
		{
			//IL_0027: Unknown result type (might be due to invalid IL or missing references)
			//IL_0031: Expected O, but got Unknown
			switch (<>1__state)
			{
			default:
				return false;
			case 0:
				<>1__state = -1;
				<>2__current = (object)new WaitForSeconds(waitTime);
				<>1__state = 1;
				return true;
			case 1:
				<>1__state = -1;
				<>4__this.ProgressDisplay();
				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();
		}
	}

	public const string GUID = "johbenji.bossrush";

	public const string NAME = "Boss Rush";

	public const string VERSION = "1.0.0";

	public static int teleportindex = 0;

	public static bool activated = false;

	public static string[] teleportArray;

	public static bool displayProgress = false;

	public static bool resetAllowed = false;

	public static bool defeatReset = false;

	public static PortalManager portalManager;

	public static Character portalCharacter;

	internal static ManualLogSource Log;

	public static ConfigEntry<bool> ExampleConfig;

	public BossRushManager BossRushManager { get; private set; }

	public static BossRushPlugin Instance { get; private set; }

	public static BossesQE_Collection bossesQE_Collection { get; private set; } = new BossesQE_Collection();


	internal void Awake()
	{
		//IL_004c: Unknown result type (might be due to invalid IL or missing references)
		Instance = this;
		Log = ((BaseUnityPlugin)this).Logger;
		BossRushManager = new BossRushManager();
		portalManager = new PortalManager();
		ConfigElements.Init(((BaseUnityPlugin)this).Config);
		SL.OnSceneLoaded += SceneManager_sceneLoaded;
		new Harmony("johbenji.bossrush").PatchAll();
	}

	internal void SceneManager_sceneLoaded()
	{
		SceneHandlingMethod();
	}

	[IteratorStateMachine(typeof(<DelaySceneHandlingMethod>d__27))]
	private IEnumerator DelaySceneHandlingMethod()
	{
		//yield-return decompiler failed: Unexpected instruction in Iterator.Dispose()
		return new <DelaySceneHandlingMethod>d__27(0)
		{
			<>4__this = this
		};
	}

	private void SceneHandlingMethod()
	{
		//IL_0060: Unknown result type (might be due to invalid IL or missing references)
		//IL_0074: Unknown result type (might be due to invalid IL or missing references)
		//IL_0088: 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)
		//IL_00bd: 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_00f2: 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_011a: 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_0172: 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_01a7: Unknown result type (might be due to invalid IL or missing references)
		//IL_01bb: Unknown result type (might be due to invalid IL or missing references)
		//IL_01cf: Unknown result type (might be due to invalid IL or missing references)
		//IL_01f0: Unknown result type (might be due to invalid IL or missing references)
		//IL_0204: Unknown result type (might be due to invalid IL or missing references)
		//IL_0218: Unknown result type (might be due to invalid IL or missing references)
		//IL_025e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0272: Unknown result type (might be due to invalid IL or missing references)
		//IL_0286: Unknown result type (might be due to invalid IL or missing references)
		//IL_02a7: Unknown result type (might be due to invalid IL or missing references)
		//IL_02bb: Unknown result type (might be due to invalid IL or missing references)
		//IL_02cf: Unknown result type (might be due to invalid IL or missing references)
		//IL_02f0: Unknown result type (might be due to invalid IL or missing references)
		//IL_0304: Unknown result type (might be due to invalid IL or missing references)
		//IL_0318: Unknown result type (might be due to invalid IL or missing references)
		//IL_035e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0372: Unknown result type (might be due to invalid IL or missing references)
		//IL_0386: Unknown result type (might be due to invalid IL or missing references)
		//IL_03a7: Unknown result type (might be due to invalid IL or missing references)
		//IL_03bb: Unknown result type (might be due to invalid IL or missing references)
		//IL_03cf: Unknown result type (might be due to invalid IL or missing references)
		//IL_03f0: Unknown result type (might be due to invalid IL or missing references)
		//IL_0404: Unknown result type (might be due to invalid IL or missing references)
		//IL_0418: Unknown result type (might be due to invalid IL or missing references)
		//IL_045e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0472: Unknown result type (might be due to invalid IL or missing references)
		//IL_0486: Unknown result type (might be due to invalid IL or missing references)
		//IL_04a7: Unknown result type (might be due to invalid IL or missing references)
		//IL_04bb: Unknown result type (might be due to invalid IL or missing references)
		//IL_04cf: Unknown result type (might be due to invalid IL or missing references)
		//IL_04f0: Unknown result type (might be due to invalid IL or missing references)
		//IL_0504: Unknown result type (might be due to invalid IL or missing references)
		//IL_0518: Unknown result type (might be due to invalid IL or missing references)
		//IL_055e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0572: Unknown result type (might be due to invalid IL or missing references)
		//IL_0586: Unknown result type (might be due to invalid IL or missing references)
		//IL_05a7: Unknown result type (might be due to invalid IL or missing references)
		//IL_05bb: Unknown result type (might be due to invalid IL or missing references)
		//IL_05cf: Unknown result type (might be due to invalid IL or missing references)
		//IL_05f0: Unknown result type (might be due to invalid IL or missing references)
		//IL_0604: Unknown result type (might be due to invalid IL or missing references)
		//IL_0618: Unknown result type (might be due to invalid IL or missing references)
		//IL_0639: Unknown result type (might be due to invalid IL or missing references)
		//IL_064d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0661: Unknown result type (might be due to invalid IL or missing references)
		string sceneName = AreaManager.Instance.CurrentArea.SceneName;
		if (sceneName == "Emercar")
		{
			setupBossRush();
		}
		else if (sceneName == "ChersoneseDungeonsBosses" && activated)
		{
			TeleportTweaker("Environment/Spawns/ZSpawn1/AreaSwitchQueen/Trigger", new Vector3(0f, 1.25f, -3.1167f), new Vector3(1.445f, 1.645f, 2.3633f), new Vector3(2.89f, 3.29f, 4.7266f), offerItemText: false);
			TeleportTweaker("Environment/Spawns/ZSpawn2/AreaSwitchShrimp/Trigger", new Vector3(0f, 1.25f, -3.58f), new Vector3(1.445f, 1.645f, 1.9f), new Vector3(2.89f, 3.29f, 3.8f), offerItemText: false);
			TeleportTweaker("Environment/Spawns/ZSpawn3/AreaSwitchSquire/Trigger", new Vector3(0f, 1.25f, -2.1925f), new Vector3(1.445f, 1.645f, 3.2875f), new Vector3(2.89f, 3.29f, 6.575f), offerItemText: false);
		}
		else if (sceneName == "AbrassarDungeonsBosses" && activated)
		{
			TeleportTweaker("Environment/Spawns/ZSpawn1/AreaSwitchCalixa/Trigger", new Vector3(0f, 1.25f, -3.1167f), new Vector3(1.445f, 1.645f, 2.3633f), new Vector3(2.89f, 3.29f, 4.7266f), offerItemText: false);
			TeleportTweaker("Environment/Spawns/ZSpawn2/AreaSwitchGolem/Trigger", new Vector3(0f, 1.25f, -3.58f), new Vector3(1.445f, 1.645f, 1.9f), new Vector3(2.89f, 3.29f, 3.8f), offerItemText: false);
			TeleportTweaker("Environment/Spawns/ZSpawn3/AreaSwitchShark/Trigger", new Vector3(0f, 1.25f, -3.58f), new Vector3(1.445f, 1.645f, 1.9f), new Vector3(2.89f, 3.29f, 3.8f), offerItemText: false);
		}
		else if (sceneName == "AntiqueFieldDungeonsBosses" && activated)
		{
			TeleportTweaker("Environment/Spawns/ZSpawn1/AreaSwitchBird/Trigger", new Vector3(-0.0687f, 1.25f, -1.3934f), new Vector3(1.1325f, 1.645f, 1.0054f), new Vector3(2.265f, 3.29f, 2.0109f), offerItemText: false);
			TeleportTweaker("Environment/Spawns/ZSpawn2/AreaSwitchOpulence/Trigger", new Vector3(0f, 1.25f, -4.23f), new Vector3(1.445f, 1.645f, 1.25f), new Vector3(2.89f, 3.29f, 2.5f), offerItemText: false);
			TeleportTweaker("Environment/Spawns/ZSpawn3/AreaSwitchBoozu/Trigger", new Vector3(0.0824f, 1.25f, -3.2298f), new Vector3(1.5274f, 1.645f, 1.7033f), new Vector3(3.0547f, 3.29f, 3.4066f), offerItemText: false);
		}
		else if (sceneName == "EmercarDungeonsBosses" && activated)
		{
			TeleportTweaker("Environment/Spawns/ZSpawn1/AreaSwitchLiches/Trigger", new Vector3(0f, 1.25f, -3.58f), new Vector3(1.445f, 1.645f, 1.9f), new Vector3(2.89f, 3.29f, 3.8f), offerItemText: false);
			TeleportTweaker("Environment/Spawns/ZSpawn2/AreaSwitchBurnBob/Trigger", new Vector3(0f, 1.25f, -3.58f), new Vector3(1.445f, 1.645f, 1.9f), new Vector3(2.89f, 3.29f, 3.8f), offerItemText: false);
			TeleportTweaker("Environment/Spawns/ZSpawn3/AreaSwitchImmaculate/Trigger", new Vector3(0f, 1.25f, -3.58f), new Vector3(1.445f, 1.645f, 1.9f), new Vector3(2.89f, 3.29f, 3.8f), offerItemText: false);
		}
		else if (sceneName == "HallowedDungeonsBosses" && activated)
		{
			TeleportTweaker("Environment/Spawns/ZSpawn1/AreaSwitchPriest/Trigger", new Vector3(0f, 1.25f, -3.58f), new Vector3(1.445f, 1.645f, 1.9f), new Vector3(2.89f, 3.29f, 3.8f), offerItemText: false);
			TeleportTweaker("Environment/Spawns/ZSpawn2/AreaSwitchGiant/Trigger", new Vector3(0f, 1.25f, -3.58f), new Vector3(1.445f, 1.645f, 1.9f), new Vector3(2.89f, 3.29f, 3.8f), offerItemText: false);
			TeleportTweaker("Environment/Spawns/ZSpawn3/AreaSwitchTuano/Trigger", new Vector3(0f, 1.25f, -3.58f), new Vector3(1.445f, 1.645f, 1.9f), new Vector3(2.89f, 3.29f, 3.8f), offerItemText: false);
		}
		else if (sceneName == "CalderaDungeonsBosses" && activated)
		{
			TeleportTweaker("Environment/AreaSwitches/AreaSwitch_GrandMother/Trigger", new Vector3(-0.1121f, 0.3876f, 0.3471f), new Vector3(1.575f, 0.8876f, 0.847f), new Vector3(3.1499f, 1.7752f, 1.6941f), offerItemText: false);
			TeleportTweaker("Environment/AreaSwitches/AreaSwitch_TorcrabFireIce/Trigger", new Vector3(0.184f, 0.5281f, -1.5924f), new Vector3(1.554f, 1.0281f, 3.2116f), new Vector3(3.1079f, 2.0563f, 6.4233f), offerItemText: false);
			TeleportTweaker("Environment/AreaSwitches/AreaSwitch_CrimsoneElite/Trigger", new Vector3(0.1079f, -0.7207f, 0.2016f), new Vector3(1.0021f, 1.2207f, 0.7016f), new Vector3(2.0042f, 2.4414f, 1.4032f), offerItemText: false);
			TeleportTweaker("Interactions/Caldera_Bosses/InteractionGargoylesBosses/prf_env_gargoyleFake/", new Vector3(-0.0546f, 0.1773f, -0.4812f), new Vector3(1.645f, 0.7258f, 1.3162f), new Vector3(3.2899f, 1.4516f, 2.6323f), offerItemText: false);
			GameObject val = FindByFuzzyPath("Environment/AreaSwitches/AreaSwitch_Gargoyles/Trigger");
			if ((Object)(object)val != (Object)null)
			{
				altarFunctionalityDeny(val);
			}
			else
			{
				Log.LogMessage((object)"gargoyleDenyTeleporter not found");
			}
		}
		if (!activated || !displayProgress)
		{
			return;
		}
		switch (sceneName)
		{
		default:
			if (!(sceneName == "CalderaDungeonsBosses"))
			{
				break;
			}
			goto case "Emercar";
		case "Emercar":
		case "ChersoneseDungeonsBosses":
		case "AbrassarDungeonsBosses":
		case "AntiqueFieldDungeonsBosses":
		case "EmercarDungeonsBosses":
		case "HallowedDungeonsBosses":
			((MonoBehaviour)Instance).StartCoroutine(DelayedProgressDisplay(3f));
			displayProgress = false;
			break;
		}
	}

	private void TeleportTweaker(string teleporterPath, Vector3 center, Vector3 extent, Vector3 size, bool offerItemText)
	{
		//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_002d: Unknown result type (might be due to invalid IL or missing references)
		GameObject val = FindByFuzzyPath(teleporterPath);
		if ((Object)(object)val != (Object)null)
		{
			Log.LogMessage((object)("Changing alter functionality of teleporter found at path: " + teleporterPath));
			altarFunctionality(val, center, extent, size, offerItemText);
		}
	}

	private static void setupBossRush()
	{
		//IL_0001: Unknown result type (might be due to invalid IL or missing references)
		//IL_0007: Expected O, but got Unknown
		//IL_0028: 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_00cf: Unknown result type (might be due to invalid IL or missing references)
		//IL_01dd: Unknown result type (might be due to invalid IL or missing references)
		//IL_01e7: Unknown result type (might be due to invalid IL or missing references)
		GameObject val = new GameObject();
		((Object)val).name = "JOHBENJI_DLC";
		val.transform.position = new Vector3(855.2936f, -11.3909f, 1589.459f);
		if ((Object)(object)GameObject.Find("CentralTreeBossRush") == (Object)null)
		{
			GameObject val2 = GameObject.Find("Environment/Assets/Foliage/Tree/mdl_env_treeKapokBergB (29)");
			if ((Object)(object)val2 != (Object)null)
			{
				GameObject val3 = Object.Instantiate<GameObject>(val2);
				val3.transform.parent = val.transform;
				((Object)val3).name = "CentralTreeBossRush";
				Vector3 localPosition = default(Vector3);
				((Vector3)(ref localPosition))..ctor(0f, 0f, 0f);
				Vector3 localScale = default(Vector3);
				((Vector3)(ref localScale))..ctor(0.1f, 0.1f, 0.1f);
				Transform transform = val3.transform;
				transform.localPosition = localPosition;
				transform.localScale = localScale;
				GameObject treeParent = FindChild(val3, "tree_kapokBergB");
				CentralGatherableAccessPoint component = val3.GetComponent<CentralGatherableAccessPoint>();
				if ((Object)(object)component != (Object)null)
				{
					Object.Destroy((Object)(object)component);
				}
				fixTreeColorVisuals(treeParent);
				fixTreeVFX(val3);
				addAltar(val);
			}
		}
		else if ((Object)(object)GameObject.Find("CentralTreeBossRush") != (Object)null && !activated)
		{
			GameObject val4 = GameObject.Find("CentralTreeBossRush");
			Object.Destroy((Object)(object)val4);
			GameObject val5 = GameObject.Find("Environment/Assets/Foliage/Tree/mdl_env_treeKapokBergB (29)");
			if ((Object)(object)val5 != (Object)null)
			{
				GameObject val6 = Object.Instantiate<GameObject>(val5);
				val6.transform.parent = val.transform;
				((Object)val6).name = "CentralTreeBossRush";
				Vector3 localPosition2 = default(Vector3);
				((Vector3)(ref localPosition2))..ctor(0f, 0f, 0f);
				Vector3 localScale2 = default(Vector3);
				((Vector3)(ref localScale2))..ctor(0.1f, 0.1f, 0.1f);
				Transform transform2 = val6.transform;
				transform2.localPosition = localPosition2;
				transform2.localScale = localScale2;
				GameObject treeParent2 = FindChild(val6, "tree_kapokBergB");
				CentralGatherableAccessPoint component2 = val6.GetComponent<CentralGatherableAccessPoint>();
				if ((Object)(object)component2 != (Object)null)
				{
					Object.Destroy((Object)(object)component2);
				}
				fixTreeColorVisuals(treeParent2);
				fixTreeVFX(val6);
				addAltar(val);
			}
		}
		else
		{
			Log.LogMessage((object)"Tree not found.");
		}
	}

	private static void resetBossRush()
	{
		Log.LogMessage((object)"Resetting boss rush.");
		activated = false;
	}

	public void interfaceBootUpDelayedProgressDisplay()
	{
		((MonoBehaviour)Instance).StartCoroutine(DelayedProgressDisplay(10f));
		displayProgress = false;
	}

	[IteratorStateMachine(typeof(<DelayedProgressDisplay>d__33))]
	private IEnumerator DelayedProgressDisplay(float waitTime)
	{
		//yield-return decompiler failed: Unexpected instruction in Iterator.Dispose()
		return new <DelayedProgressDisplay>d__33(0)
		{
			<>4__this = this,
			waitTime = waitTime
		};
	}

	public void ProgressDisplay(int incrementedindex = 0)
	{
		if (!ConfigElements.includeProgressMessage.Value)
		{
			return;
		}
		int num = Mathf.RoundToInt((float)Mathf.Clamp(100 * (teleportindex + incrementedindex) / 19, 0, 100));
		CharacterManager instance = CharacterManager.Instance;
		for (int i = 0; i < instance.m_playerCharacters.Count; i++)
		{
			Character val = instance.m_characters[instance.m_playerCharacters.Values[i]];
			if ((Object)(object)val != (Object)null)
			{
				val.CharacterUI.NotificationPanel.ShowNotification($"Boss Rush Progress: {num}%");
			}
		}
	}

	[IteratorStateMachine(typeof(<DelayTeleport>d__35))]
	private static IEnumerator DelayTeleport()
	{
		//yield-return decompiler failed: Unexpected instruction in Iterator.Dispose()
		return new <DelayTeleport>d__35(0);
	}

	public static void delayTeleport(Character character)
	{
		portalCharacter = character;
		if ((Object)(object)character != (Object)null && (Object)(object)portalCharacter != (Object)null && portalManager != null)
		{
			((MonoBehaviour)Instance).StartCoroutine(DelayTeleport());
		}
	}

	private static GameObject FindChild(GameObject parent, string name)
	{
		//IL_0022: Unknown result type (might be due to invalid IL or missing references)
		//IL_0028: Expected O, but got Unknown
		if ((Object)(object)parent != (Object)null)
		{
			foreach (Transform item in parent.transform)
			{
				Transform val = item;
				if (((Object)val).name == name)
				{
					return ((Component)val).gameObject;
				}
			}
			Log.LogMessage((object)("Child with name " + name + " not found under " + ((Object)parent).name));
		}
		else
		{
			Log.LogMessage((object)"Parent is null");
		}
		return null;
	}

	private static GameObject FindChildContains(GameObject parent, string name)
	{
		//IL_0022: Unknown result type (might be due to invalid IL or missing references)
		//IL_0028: Expected O, but got Unknown
		if ((Object)(object)parent != (Object)null)
		{
			foreach (Transform item in parent.transform)
			{
				Transform val = item;
				if (((Object)val).name.Contains(name))
				{
					return ((Component)val).gameObject;
				}
			}
			Log.LogMessage((object)("Child with name " + name + " not found under " + ((Object)parent).name));
		}
		else
		{
			Log.LogMessage((object)"Parent is null");
		}
		return null;
	}

	private static void PrintAllChildren(GameObject parent)
	{
		//IL_0025: Unknown result type (might be due to invalid IL or missing references)
		//IL_002b: Expected O, but got Unknown
		if ((Object)(object)parent != (Object)null)
		{
			foreach (Transform item in parent.transform)
			{
				Transform val = item;
				Log.LogMessage((object)$"Child={((Object)val).name}, child of parent {((Object)parent).name}, child is null = {(Object)(object)val == (Object)null} ");
			}
			if (parent.transform.childCount == 0)
			{
				Log.LogMessage((object)(((Object)parent).name + " has 0 children"));
			}
		}
		else
		{
			Log.LogMessage((object)"Parent is null");
		}
	}

	private static void PrintAllComponents(GameObject gameobject)
	{
		if ((Object)(object)gameobject == (Object)null)
		{
			Log.LogMessage((object)"GameObject is null. Please provide a valid GameObject.");
			return;
		}
		Component[] components = gameobject.GetComponents<Component>();
		if (components.Length == 0)
		{
			Log.LogMessage((object)"No components attached to the GameObject.");
			return;
		}
		Log.LogMessage((object)("Components attached to GameObject '" + ((Object)gameobject).name + "':"));
		Component[] array = components;
		foreach (Component val in array)
		{
			Log.LogMessage((object)((object)val).GetType().Name);
		}
	}

	private static void fixTreeColorVisuals(GameObject treeParent)
	{
		//IL_01c5: Unknown result type (might be due to invalid IL or missing references)
		//IL_00d0: Unknown result type (might be due to invalid IL or missing references)
		//IL_010c: Unknown result type (might be due to invalid IL or missing references)
		GameObject item = FindChild(treeParent, "tree_kapokBergB_LOD0");
		GameObject item2 = FindChild(treeParent, "tree_kapokBergB_LOD1");
		GameObject item3 = FindChild(treeParent, "tree_kapokBergB_LOD2");
		List<GameObject> list = new List<GameObject>();
		list.Add(item);
		list.Add(item2);
		list.Add(item3);
		foreach (GameObject item4 in list)
		{
			if (!((Object)(object)item4 != (Object)null))
			{
				continue;
			}
			MeshRenderer component = item4.GetComponent<MeshRenderer>();
			if (!((Object)(object)component != (Object)null))
			{
				continue;
			}
			Material[] materials = ((Renderer)component).materials;
			foreach (Material val in materials)
			{
				if (((Object)val).name == "KapokLeavesSummer (Instance)")
				{
					val.color = new Color(0.5f, 0.5f, 1f, 1f);
				}
				else if (((Object)val).name == "KapokBark (Instance)")
				{
					val.color = new Color(0.75f, 0.75f, 1f, 1f);
				}
				else
				{
					Log.LogMessage((object)"Weird material found which is incompatible");
				}
			}
		}
		GameObject val2 = FindChild(treeParent, "tree_kapokBergB_Billboard");
		if (!((Object)(object)val2 != (Object)null))
		{
			return;
		}
		BillboardRenderer component2 = val2.GetComponent<BillboardRenderer>();
		if ((Object)(object)component2 != (Object)null)
		{
			BillboardAsset billboard = component2.billboard;
			if ((Object)(object)billboard != (Object)null)
			{
				billboard.material.color = new Color(0.5f, 0.5f, 1f, 1f);
			}
		}
	}

	private static void fixTreeVFX(GameObject treeParent)
	{
		//IL_0050: Unknown result type (might be due to invalid IL or missing references)
		//IL_012d: Unknown result type (might be due to invalid IL or missing references)
		//IL_014e: Unknown result type (might be due to invalid IL or missing references)
		//IL_00eb: Unknown result type (might be due to invalid IL or missing references)
		//IL_0187: Unknown result type (might be due to invalid IL or missing references)
		GameObject val = GameObject.Find("Environment/Assets/FX/Prefab_fx_fire1x4/FireClose");
		if (!((Object)(object)val != (Object)null))
		{
			return;
		}
		GameObject val2 = Object.Instantiate<GameObject>(val);
		Vector3 localPosition = default(Vector3);
		((Vector3)(ref localPosition))..ctor(0f, 0f, 0f);
		val2.transform.parent = treeParent.transform;
		val2.transform.localPosition = localPosition;
		ParticleSystemRenderer component = val2.GetComponent<ParticleSystemRenderer>();
		ParticleSystem component2 = val2.GetComponent<ParticleSystem>();
		if ((Object)(object)component != (Object)null && (Object)(object)component2 != (Object)null)
		{
			Object.Destroy((Object)(object)component);
			Object.Destroy((Object)(object)component2);
		}
		GameObject val3 = FindChild(val2, "SmokeVolumetric");
		if ((Object)(object)val3 != (Object)null)
		{
			ParticleSystem component3 = val3.GetComponent<ParticleSystem>();
			if ((Object)(object)component3 != (Object)null)
			{
				component3.playbackSpeed = 0.03f;
				component3.startColor = new Color(0.4608f, 0.4558f, 10f, 0.2f);
			}
		}
		GameObject val4 = FindChild(val2, "Embers");
		if ((Object)(object)val4 != (Object)null)
		{
			val4.transform.localScale = new Vector3(0.1f, 0.1f, 0.1f);
			val4.transform.localPosition = new Vector3(0f, 0f, 0f);
			ParticleSystem component4 = val4.GetComponent<ParticleSystem>();
			if ((Object)(object)component4 != (Object)null)
			{
				component4.startColor = new Color(0.01f, 0.01f, 10f, 1f);
				component4.playbackSpeed = 0.3f;
			}
		}
	}

	private static void addAltar(GameObject parent)
	{
		//IL_0066: 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_010e: Unknown result type (might be due to invalid IL or missing references)
		//IL_012e: Unknown result type (might be due to invalid IL or missing references)
		//IL_046f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0490: Unknown result type (might be due to invalid IL or missing references)
		//IL_03cd: 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_0405: Unknown result type (might be due to invalid IL or missing references)
		//IL_065a: Unknown result type (might be due to invalid IL or missing references)
		//IL_066e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0682: Unknown result type (might be due to invalid IL or missing references)
		//IL_02d2: Unknown result type (might be due to invalid IL or missing references)
		Mesh val = null;
		Mesh val2 = null;
		Material val3 = null;
		GameObject val4 = null;
		GameObject val5 = GameObject.Find("Environment/Assets/Foliage/Tree/mdl_env_natureTrunkCutA (1)");
		if (!((Object)(object)val5 != (Object)null))
		{
			return;
		}
		GameObject val6 = Object.Instantiate<GameObject>(val5);
		((Object)val6).name = "altar";
		val6.transform.parent = parent.transform;
		val6.transform.localPosition = new Vector3(-2f, -0.5345f, -0.6f);
		val6.transform.localScale = new Vector3(0.5f, 0.5f, 0.5f);
		LODGroup component = val6.GetComponent<LODGroup>();
		AdvancedMover component2 = val6.GetComponent<AdvancedMover>();
		if ((Object)(object)component != (Object)null && (Object)(object)component2 != (Object)null)
		{
			Object.Destroy((Object)(object)component);
			Object.Destroy((Object)(object)component2);
			val4 = Object.Instantiate<GameObject>(val6);
			((Object)val4).name = "templateitem";
			val4.transform.parent = parent.transform;
			val4.transform.localPosition = new Vector3(-2f, -5.345f, -0.6f);
			val4.transform.localScale = new Vector3(1f, 1f, 1f);
			Item itemPrefab = ResourcesPrefabManager.Instance.GetItemPrefab(-65007);
			GameObject gameObject = ((Component)itemPrefab.GetItemVisual(itemPrefab.HasSpecialVisualPrefab)).gameObject;
			if ((Object)(object)gameObject != (Object)null)
			{
				GameObject val7 = FindChild(gameObject, "firepit(Clone)");
				if ((Object)(object)val7 != (Object)null)
				{
					MeshFilter component3 = val7.GetComponent<MeshFilter>();
					if ((Object)(object)component3 != (Object)null)
					{
						val = component3.mesh;
					}
				}
			}
			MeshFilter component4 = val6.GetComponent<MeshFilter>();
			MeshRenderer component5 = val6.GetComponent<MeshRenderer>();
			if ((Object)(object)component4 != (Object)null && (Object)(object)component5 != (Object)null && (Object)(object)val != (Object)null)
			{
				component4.mesh = val;
				GameObject val8 = GameObject.Find("Environment/Assets/Structures/mdl_env_buildingRuinsFirepitA/mdl_env_buildingRuinsFirepitA_LOD0");
				if ((Object)(object)val8 != (Object)null)
				{
					MeshRenderer component6 = val8.GetComponent<MeshRenderer>();
					if ((Object)(object)component6 != (Object)null)
					{
						Material[] materials = ((Renderer)component6).materials;
						Material[] materials2 = ((Renderer)component5).materials;
						List<Material> list = new List<Material>(materials2);
						foreach (Material val9 in materials)
						{
							if (((Object)val9).name == "mat_env_rockCharcoal (Instance)")
							{
								for (int j = 0; j < materials2.Length; j++)
								{
									Material val10 = materials2[j];
									if (((Object)val10).name == "mat_env_buildingLogWoodSculptVertex (Instance)")
									{
										list[j] = val9;
									}
									else if (((Object)val10).name == "ConiferCierzoNeedlesSeason (Instance)")
									{
										val10.color = new Color(0f, 0f, 0f, 0f);
										list[j] = val10;
									}
								}
							}
							else
							{
								if (!(((Object)val9).name == "mat_env_ruinsStoneUnevenRockyGrassSculptStone (Instance)"))
								{
									continue;
								}
								for (int k = 0; k < materials2.Length; k++)
								{
									Material val11 = materials2[k];
									if (((Object)val11).name == "ConiferCierzoBark (Instance)")
									{
										list[k] = val9;
									}
								}
							}
						}
						Material[] materials3 = list.ToArray();
						((Renderer)component5).materials = materials3;
					}
				}
			}
			MeshCollider component7 = val6.GetComponent<MeshCollider>();
			if ((Object)(object)component7 != (Object)null)
			{
				Object.Destroy((Object)(object)component7);
				BoxCollider val12 = val6.AddComponent<BoxCollider>();
				val12.center = new Vector3(0.0615f, 1.4725f, -0.0576f);
				val12.extents = new Vector3(1.5f, 1.5215f, 1.5f);
				val12.size = new Vector3(2f, 2.0429f, 2f);
			}
		}
		if (!((Object)(object)val6 != (Object)null) || !((Object)(object)val4 != (Object)null))
		{
			return;
		}
		GameObject val13 = Object.Instantiate<GameObject>(val4);
		((Object)val13).name = "pot";
		val13.transform.parent = val6.transform;
		val13.transform.localPosition = new Vector3(0f, -0.6f, -0.04f);
		val13.transform.eulerAngles = new Vector3(0f, 28f, 0f);
		MeshFilter component8 = val13.GetComponent<MeshFilter>();
		MeshRenderer component9 = val13.GetComponent<MeshRenderer>();
		Item itemPrefab2 = ResourcesPrefabManager.Instance.GetItemPrefab(-65008);
		GameObject gameObject2 = ((Component)itemPrefab2.GetItemVisual(itemPrefab2.HasSpecialVisualPrefab)).gameObject;
		if ((Object)(object)gameObject2 != (Object)null)
		{
			GameObject val14 = FindChild(gameObject2, "pot(Clone)");
			if ((Object)(object)val14 != (Object)null)
			{
				MeshFilter component10 = val14.GetComponent<MeshFilter>();
				if ((Object)(object)component10 != (Object)null)
				{
					val2 = component10.mesh;
				}
			}
		}
		Item itemPrefab3 = ResourcesPrefabManager.Instance.GetItemPrefab(5010100);
		GameObject gameObject3 = ((Component)itemPrefab3.GetItemVisual(itemPrefab3.HasSpecialVisualPrefab)).gameObject;
		if ((Object)(object)gameObject3 != (Object)null)
		{
			GameObject val15 = FindChild(gameObject3, "mdl_env_propPotLargeA");
			if ((Object)(object)val15 != (Object)null)
			{
				MeshRenderer component11 = val15.GetComponent<MeshRenderer>();
				if ((Object)(object)component11 != (Object)null)
				{
					val3 = ((Renderer)component11).material;
				}
			}
		}
		if ((Object)(object)val13 != (Object)null)
		{
			Object.Destroy((Object)(object)val13.GetComponent<MeshCollider>());
			Object.Destroy((Object)(object)val13.GetComponent<AdvancedMover>());
			Object.Destroy((Object)(object)val13.GetComponent<LODGroup>());
			if ((Object)(object)component9 != (Object)null && (Object)(object)component8 != (Object)null && (Object)(object)val2 != (Object)null && (Object)(object)val3 != (Object)null)
			{
				component8.mesh = val2;
				List<Material> list2 = new List<Material>();
				list2.Add(val3);
				list2.Add(val3);
				list2.Add(val3);
				((Renderer)component9).materials = list2.ToArray();
			}
		}
		if ((Object)(object)val13 != (Object)null)
		{
			altarFunctionality(val13, new Vector3(0.0615f, 1.4725f, -0.0576f), new Vector3(1.5f, 1.5215f, 1.5f), new Vector3(4f, 4.0429f, 4f), offerItemText: true);
		}
		if ((Object)(object)val13 != (Object)null)
		{
			lightAltar();
		}
	}

	public static void altarFunctionality(GameObject gameObject, Vector3 centerIn, Vector3 extentsIn, Vector3 sizeIn, bool offerItemText)
	{
		//IL_0071: 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_008a: 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_0090: 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)
		if ((Object)(object)gameObject != (Object)null)
		{
			InteractionTriggerBase component = gameObject.GetComponent<InteractionTriggerBase>();
			InteractionFunctionality component2 = gameObject.GetComponent<InteractionFunctionality>();
			InteractionActivator component3 = gameObject.GetComponent<InteractionActivator>();
			if ((Object)(object)component != (Object)null)
			{
				Object.Destroy((Object)(object)component);
			}
			if ((Object)(object)component2 != (Object)null)
			{
				Object.Destroy((Object)(object)component);
			}
			if ((Object)(object)component3 != (Object)null)
			{
				Object.Destroy((Object)(object)component3);
			}
			BoxCollider val = gameObject.AddComponent<BoxCollider>();
			val.center = centerIn;
			val.extents = extentsIn;
			float num = 1.1f;
			Vector3 size = num * sizeIn;
			val.size = size;
			((Collider)val).isTrigger = true;
			component3 = gameObject.AddComponent<InteractionActivator>();
			component = gameObject.AddComponent<InteractionTriggerBase>();
			component2 = gameObject.AddComponent<InteractionFunctionality>();
			((EventActivator)component3).AutoTogglePauseTime = 0.5f;
			component3.BasicInteraction = (IInteraction)(object)component2;
			if (offerItemText)
			{
				((EventActivator)component3).m_overrideBasicText = "Offer Item";
			}
			else
			{
				((EventActivator)component3).m_overrideBasicText = "Interact";
			}
		}
	}

	public static void altarFunctionalityDeny(GameObject gameObject)
	{
		if ((Object)(object)gameObject != (Object)null)
		{
			Object.Destroy((Object)(object)gameObject);
		}
	}

	public static void lightAltar()
	{
		//IL_00a2: Unknown result type (might be due to invalid IL or missing references)
		//IL_0153: Unknown result type (might be due to invalid IL or missing references)
		//IL_0174: 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_0131: Unknown result type (might be due to invalid IL or missing references)
		//IL_01fe: Unknown result type (might be due to invalid IL or missing references)
		//IL_01d3: Unknown result type (might be due to invalid IL or missing references)
		//IL_027f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0250: Unknown result type (might be due to invalid IL or missing references)
		GameObject val = GameObject.Find("JOHBENJI_DLC/altar");
		if (!((Object)(object)val != (Object)null))
		{
			return;
		}
		GameObject val2 = GameObject.Find("JOHBENJI_DLC/altar/fire");
		if (!activated)
		{
			return;
		}
		GameObject val3 = GameObject.Find("Environment/Assets/FX/Prefab_fx_fire1x3Far");
		if (!((Object)(object)val3 != (Object)null))
		{
			return;
		}
		GameObject val4 = Object.Instantiate<GameObject>(val3);
		if (!((Object)(object)val4 != (Object)null))
		{
			return;
		}
		((Object)val4).name = "fire";
		val4.transform.parent = val.transform;
		val4.transform.localPosition = new Vector3(-0.3f, 0.6f, 0.02f);
		GameObject val5 = FindChild(val4, "SmokeVolumetric");
		GameObject val6 = FindChild(val4, "Bonfire Point light");
		GameObject val7 = FindChild(val4, "FireFar");
		if ((Object)(object)val5 != (Object)null)
		{
			ParticleSystem component = val5.GetComponent<ParticleSystem>();
			if ((Object)(object)component != (Object)null)
			{
				component.scalingMode = (ParticleSystemScalingMode)1;
				component.playbackSpeed = 0.8f;
				ShapeModule shape = component.shape;
				((ShapeModule)(ref shape)).box = new Vector3(0.1f, 0.1f, 0.1f);
			}
			val5.transform.localScale = new Vector3(0.4f, 0.4f, 0.4f);
			val5.transform.localPosition = new Vector3(0.4f, 0f, 0f);
			val5.SetActive(true);
		}
		if ((Object)(object)val7 != (Object)null)
		{
			ParticleSystem component2 = val7.GetComponent<ParticleSystem>();
			if ((Object)(object)component2 != (Object)null)
			{
				component2.emissionRate = 25f;
				component2.startColor = new Color(0.05f, 0.035f, 1f, 1f);
				component2.scalingMode = (ParticleSystemScalingMode)1;
			}
			val7.transform.localScale = new Vector3(0.1f, 0.1f, 0.1f);
			val7.SetActive(true);
		}
		if ((Object)(object)val6 != (Object)null)
		{
			Light component3 = val6.GetComponent<Light>();
			if ((Object)(object)component3 != (Object)null)
			{
				component3.color = new Color(0.8f, 0.8f, 1f, 1f);
				component3.range = 5f;
			}
			val6.transform.localPosition = new Vector3(0f, 0f, 0f);
			val6.SetActive(true);
		}
		GameObject val8 = FindChildContains(val, "pot");
		if ((Object)(object)val8 != (Object)null)
		{
			InteractionActivator component4 = val8.GetComponent<InteractionActivator>();
			if ((Object)(object)component4 != (Object)null)
			{
				((EventActivator)component4).m_overrideBasicText = "Inhale Fumes";
			}
		}
	}

	public static GameObject FindByFuzzyPath(string fuzzyPath)
	{
		//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_00f5: Unknown result type (might be due to invalid IL or missing references)
		//IL_00fc: Expected O, but got Unknown
		if (string.IsNullOrEmpty(fuzzyPath))
		{
			Log.LogError((object)"Path is null or empty.");
			return null;
		}
		string[] segments = fuzzyPath.Split(new char[1] { '/' });
		if (segments.Length == 0)
		{
			return null;
		}
		Scene activeScene = SceneManager.GetActiveScene();
		GameObject[] rootGameObjects = ((Scene)(ref activeScene)).GetRootGameObjects();
		Transform val = rootGameObjects.Select((GameObject r) => r.transform).FirstOrDefault((Func<Transform, bool>)((Transform t) => ((Object)t).name.StartsWith(segments[0])));
		if ((Object)(object)val == (Object)null)
		{
			Log.LogError((object)("No root object starting with '" + segments[0] + "' found."));
			return null;
		}
		for (int i = 1; i < segments.Length; i++)
		{
			bool flag = false;
			foreach (Transform item in val)
			{
				Transform val2 = item;
				if (((Object)val2).name.StartsWith(segments[i]))
				{
					val = val2;
					flag = true;
					break;
				}
			}
			if (!flag)
			{
				Log.LogError((object)("No child starting with '" + segments[i] + "' found under '" + ((Object)val).name + "'"));
				return null;
			}
		}
		return ((Component)val).gameObject;
	}

	public static void PrintPathChildren(string path)
	{
		//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)
		if (string.IsNullOrEmpty(path))
		{
			Log.LogError((object)"Path is null or empty.");
			return;
		}
		string[] array = path.Split(new char[1] { '/' });
		if (array.Length == 0)
		{
			Log.LogError((object)"Invalid path format.");
			return;
		}
		Transform val = null;
		Scene activeScene = SceneManager.GetActiveScene();
		GameObject[] rootGameObjects = ((Scene)(ref activeScene)).GetRootGameObjects();
		GameObject[] array2 = rootGameObjects;
		foreach (GameObject val2 in array2)
		{
			if (((Object)val2).name == array[0])
			{
				val = val2.transform;
				break;
			}
		}
		if ((Object)(object)val == (Object)null)
		{
			Log.LogError((object)("Root GameObject '" + array[0] + "' not found."));
			return;
		}
		PrintChildren(val);
		for (int j = 1; j < array.Length; j++)
		{
			Transform val3 = val.Find(array[j]);
			if ((Object)(object)val3 == (Object)null)
			{
				Log.LogError((object)("'" + array[j] + "' not found under '" + ((Object)val).name + "'."));
				break;
			}
			val = val3;
			PrintChildren(val);
		}
	}

	private static void PrintChildren(Transform parent)
	{
		//IL_0031: Unknown result type (might be due to invalid IL or missing references)
		//IL_0037: Expected O, but got Unknown
		Log.LogMessage((object)("Children of '" + ((Object)parent).name + "':"));
		foreach (Transform item in parent)
		{
			Transform val = item;
			Log.LogMessage((object)(" - " + ((Object)val).name));
		}
	}
}
public class PortalManager
{
	private bool AreaSwitchInProgress = false;

	private AreaEnum targetArea = (AreaEnum)500;

	private Character targetCharacter;

	private int spawnpointindex;

	public void StartAreaSwitchAndSetPosition(Character Character, AreaEnum areaEnum, int SpawnPointIndex)
	{
		//IL_0002: 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_001b: Unknown result type (might be due to invalid IL or missing references)
		//IL_0029: Unknown result type (might be due to invalid IL or missing references)
		if (CanStartAreaSwitch(areaEnum))
		{
			spawnpointindex = SpawnPointIndex;
			targetArea = areaEnum;
			targetCharacter = Character;
			StartAreaSwitch(Character, areaEnum, spawnpointindex);
		}
	}

	public void StartAreaSwitch(Character Character, AreaEnum areaEnum, int spawnPointIndex, bool moveBag = true)
	{
		//IL_0002: Unknown result type (might be due to invalid IL or missing references)
		//IL_002e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0065: Unknown result type (might be due to invalid IL or missing references)
		if (CanStartAreaSwitch(areaEnum))
		{
			BossRushPlugin.Log.LogMessage((object)"Starting area switch teleport");
			AreaSwitchInProgress = true;
			Area area = AreaManager.Instance.GetArea(areaEnum);
			if (area != null)
			{
				NetworkLevelLoader.Instance.RequestSwitchArea(area.SceneName, spawnPointIndex, 1.5f, moveBag);
			}
			else
			{
				BossRushPlugin.Log.LogError((object)$"Failed to start Teleport to {areaEnum} Area could not be found");
			}
		}
	}

	private bool CanStartAreaSwitch(AreaEnum targetArea)
	{
		//IL_0009: Unknown result type (might be due to invalid IL or missing references)
		//IL_000b: Invalid comparison between Unknown and I4
		return !AreaSwitchInProgress && (int)targetArea != 2;
	}
}
public class RelicItems
{
	public List<int> relicList = new List<int>();

	public RelicItems()
	{
		relicList = new List<int>();
		relicList.Add(6600225);
		relicList.Add(6600222);
		relicList.Add(6600220);
		relicList.Add(6600224);
		relicList.Add(6600226);
		relicList.Add(6600221);
		relicList.Add(6600223);
		relicList.Add(6600227);
		relicList.Add(6600228);
		relicList.Add(6600230);
		relicList.Add(6600229);
		relicList.Add(6600232);
		relicList.Add(6600231);
		relicList.Add(6600233);
	}
}