Decompiled source of Boss Rush v0.3.0

plugins/BossRush.dll

Decompiled a month 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.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 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 + " 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_0072: 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.RewardReq1 = BossRushPlugin.rewardReq1;
			BossRushData.RewardReq2 = BossRushPlugin.rewardReq2;
			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.rewardReq1 = BossRushData.RewardReq1;
			BossRushPlugin.rewardReq2 = BossRushData.RewardReq2;
			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;

	public bool RewardReq1;

	public bool RewardReq2;
}
[HarmonyPatch(typeof(Character), "Die")]
public class BossRush_Die_Patch
{
	private static void Prefix(Character __instance, Vector3 _hitVec, bool _loadedDead = false)
	{
		//IL_004c: 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)
		if ((Object)(object)__instance != (Object)null && __instance.IsAI && BossRushPlugin.Instance.BossRushManager != null)
		{
			Character worldHostCharacter = CharacterManager.Instance.GetWorldHostCharacter();
			if ((Object)(object)worldHostCharacter != (Object)null)
			{
				BossRushPlugin.Instance.BossRushManager.RecordVictory(UID.op_Implicit(worldHostCharacter.UID), UID.op_Implicit(__instance.UID));
			}
		}
	}
}
public static class ConfigElements
{
	public static ConfigEntry<bool> includeProgressMessage;

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

	public List<string> DefeatedFoes;

	public bool HasDeafeated(string CharacterUID)
	{
		return DefeatedFoes.Contains(CharacterUID);
	}
}
public static class DropCalculator
{
}
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_037d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0382: Unknown result type (might be due to invalid IL or missing references)
		//IL_0393: 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)
		//IL_0230: Invalid comparison between Unknown and I4
		//IL_02a5: Unknown result type (might be due to invalid IL or missing references)
		//IL_02ab: Invalid comparison between Unknown and I4
		//IL_0311: Unknown result type (might be due to invalid IL or missing references)
		targetCharacter = _character;
		Scene activeScene = SceneManager.GetActiveScene();
		string name = ((Scene)(ref activeScene)).name;
		BossRushPlugin.Log.LogMessage((object)"Pre-state:");
		BossRushPlugin.Log.LogMessage((object)$"Activated = {BossRushPlugin.activated}, Teleport index = {BossRushPlugin.teleportindex}");
		if (BossRushPlugin.teleportArray != null && BossRushPlugin.teleportArray.Length != 0)
		{
			printStringArray(BossRushPlugin.teleportArray);
		}
		PublicBossDictionary publicBossDictionary = new PublicBossDictionary();
		if (publicBossDictionary != null)
		{
			Dictionary<string, DataValue> bossDictionary = publicBossDictionary.BossDictionary;
			if (bossDictionary != null)
			{
				BossRushPlugin.portalManager = new PortalManager();
				if (BossRushPlugin.portalManager != null)
				{
					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;
									BossRushPlugin.rewardReq1 = 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++;
						if (BossRushPlugin.teleportindex >= 18)
						{
							BossRushPlugin.rewardReq2 = true;
							BossRushPlugin.portalManager.StartAreaSwitchAndSetPosition(_character, (AreaEnum)501, 1);
						}
						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!");
		}
		BossRushPlugin.Log.LogMessage((object)"Post-state:");
		BossRushPlugin.Log.LogMessage((object)$"Activated = {BossRushPlugin.activated}, Teleport index = {BossRushPlugin.teleportindex}");
		if (BossRushPlugin.teleportArray != null && BossRushPlugin.teleportArray.Length != 0)
		{
			printStringArray(BossRushPlugin.teleportArray);
		}
	}

	public void printStringArray(string[] array)
	{
		foreach (string text in array)
		{
			BossRushPlugin.Log.LogMessage((object)text);
		}
	}
}
[BepInPlugin("johbenji.bossrush", "Boss Rush", "0.3.0")]
public class BossRushPlugin : BaseUnityPlugin
{
	[HarmonyPatch(typeof(EnvironmentSave), "ApplyData")]
	private class resetParameters
	{
		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();
		}
	}

	public const string GUID = "johbenji.bossrush";

	public const string NAME = "Boss Rush";

	public const string VERSION = "0.3.0";

	public static int teleportindex;

	public static bool activated;

	public static string[] teleportArray;

	public static bool displayProgress;

	public static bool rewardReq1;

	public static bool rewardReq2;

	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; }

	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);
		SceneManager.sceneLoaded += SceneManager_sceneLoaded;
		new Harmony("johbenji.bossrush").PatchAll();
	}

	internal void SceneManager_sceneLoaded(Scene Scene, LoadSceneMode LoadMode)
	{
		//IL_006f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0083: Unknown result type (might be due to invalid IL or missing references)
		//IL_0097: Unknown result type (might be due to invalid IL or missing references)
		//IL_00e1: 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_0109: Unknown result type (might be due to invalid IL or missing references)
		//IL_01f6: Unknown result type (might be due to invalid IL or missing references)
		//IL_020a: Unknown result type (might be due to invalid IL or missing references)
		//IL_021e: 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_016a: Unknown result type (might be due to invalid IL or missing references)
		//IL_017e: Unknown result type (might be due to invalid IL or missing references)
		//IL_026b: 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_0293: Unknown result type (might be due to invalid IL or missing references)
		//IL_0380: Unknown result type (might be due to invalid IL or missing references)
		//IL_0394: Unknown result type (might be due to invalid IL or missing references)
		//IL_03a8: Unknown result type (might be due to invalid IL or missing references)
		//IL_02e0: Unknown result type (might be due to invalid IL or missing references)
		//IL_02f4: Unknown result type (might be due to invalid IL or missing references)
		//IL_0308: Unknown result type (might be due to invalid IL or missing references)
		//IL_03f5: Unknown result type (might be due to invalid IL or missing references)
		//IL_0409: Unknown result type (might be due to invalid IL or missing references)
		//IL_041d: Unknown result type (might be due to invalid IL or missing references)
		//IL_050a: Unknown result type (might be due to invalid IL or missing references)
		//IL_051e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0532: Unknown result type (might be due to invalid IL or missing references)
		//IL_046a: Unknown result type (might be due to invalid IL or missing references)
		//IL_047e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0492: Unknown result type (might be due to invalid IL or missing references)
		//IL_057f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0593: 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_0694: Unknown result type (might be due to invalid IL or missing references)
		//IL_06a8: Unknown result type (might be due to invalid IL or missing references)
		//IL_06bc: Unknown result type (might be due to invalid IL or missing references)
		//IL_05f4: Unknown result type (might be due to invalid IL or missing references)
		//IL_0608: Unknown result type (might be due to invalid IL or missing references)
		//IL_061c: Unknown result type (might be due to invalid IL or missing references)
		//IL_0709: Unknown result type (might be due to invalid IL or missing references)
		//IL_071d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0731: Unknown result type (might be due to invalid IL or missing references)
		//IL_081e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0832: Unknown result type (might be due to invalid IL or missing references)
		//IL_0846: Unknown result type (might be due to invalid IL or missing references)
		//IL_077e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0792: Unknown result type (might be due to invalid IL or missing references)
		//IL_07a6: Unknown result type (might be due to invalid IL or missing references)
		//IL_0893: Unknown result type (might be due to invalid IL or missing references)
		//IL_08a7: Unknown result type (might be due to invalid IL or missing references)
		//IL_08bb: Unknown result type (might be due to invalid IL or missing references)
		//IL_0908: Unknown result type (might be due to invalid IL or missing references)
		//IL_091c: Unknown result type (might be due to invalid IL or missing references)
		//IL_0930: Unknown result type (might be due to invalid IL or missing references)
		//IL_09b5: Unknown result type (might be due to invalid IL or missing references)
		//IL_09c9: Unknown result type (might be due to invalid IL or missing references)
		//IL_09dd: Unknown result type (might be due to invalid IL or missing references)
		if (((Scene)(ref Scene)).name == "Emercar")
		{
			setupBossRush();
		}
		else if (((Scene)(ref Scene)).name == "ChersoneseDungeonsBosses" && activated)
		{
			GameObject val = GameObject.Find("Environment/Spawns/ZSpawn1/AreaSwitchQueen/Trigger");
			if ((Object)(object)val != (Object)null)
			{
				altarFunctionality(val, 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);
			}
			else
			{
				Log.LogMessage((object)"Teleporter not found");
			}
			GameObject val2 = GameObject.Find("Environment/Spawns/ZSpawn2/AreaSwitchShrimp/Trigger");
			if ((Object)(object)val2 != (Object)null)
			{
				altarFunctionality(val2, 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
			{
				Log.LogMessage((object)"Teleporter not found");
			}
			GameObject val3 = GameObject.Find("Environment/Spawns/ZSpawn3/AreaSwitchSquire/Trigger");
			if ((Object)(object)val3 != (Object)null)
			{
				altarFunctionality(val3, 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
			{
				Log.LogMessage((object)"Teleporter not found");
			}
		}
		else if (((Scene)(ref Scene)).name == "AbrassarDungeonsBosses" && activated)
		{
			GameObject val4 = GameObject.Find("Environment/Spawns/ZSpawn1/AreaSwitchCalixa/Trigger");
			if ((Object)(object)val4 != (Object)null)
			{
				altarFunctionality(val4, 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);
			}
			else
			{
				Log.LogMessage((object)"Teleporter not found");
			}
			GameObject val5 = GameObject.Find("Environment/Spawns/ZSpawn2/AreaSwitchGolem/Trigger");
			if ((Object)(object)val5 != (Object)null)
			{
				altarFunctionality(val5, 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
			{
				Log.LogMessage((object)"Teleporter not found");
			}
			GameObject val6 = GameObject.Find("Environment/Spawns/ZSpawn3/AreaSwitchShark/Trigger");
			if ((Object)(object)val6 != (Object)null)
			{
				altarFunctionality(val6, 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
			{
				Log.LogMessage((object)"Teleporter not found");
			}
		}
		else if (((Scene)(ref Scene)).name == "AntiqueFieldDungeonsBosses" && activated)
		{
			GameObject val7 = GameObject.Find("Environment/Spawns/ZSpawn1/AreaSwitchBird/Trigger");
			if ((Object)(object)val7 != (Object)null)
			{
				altarFunctionality(val7, 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);
			}
			else
			{
				Log.LogMessage((object)"Teleporter not found");
			}
			GameObject val8 = GameObject.Find("Environment/Spawns/ZSpawn2/AreaSwitchOpulence/Trigger");
			if ((Object)(object)val8 != (Object)null)
			{
				altarFunctionality(val8, 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);
			}
			else
			{
				Log.LogMessage((object)"Teleporter not found");
			}
			GameObject val9 = GameObject.Find("Environment/Spawns/ZSpawn3/AreaSwitchBoozu/Trigger");
			if ((Object)(object)val9 != (Object)null)
			{
				altarFunctionality(val9, 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
			{
				Log.LogMessage((object)"Teleporter not found");
			}
		}
		else if (((Scene)(ref Scene)).name == "EmercarDungeonsBosses" && activated)
		{
			GameObject val10 = GameObject.Find("Environment/Spawns/ZSpawn1/AreaSwitchLiches/Trigger");
			if ((Object)(object)val10 != (Object)null)
			{
				altarFunctionality(val10, 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
			{
				Log.LogMessage((object)"Teleporter not found");
			}
			GameObject val11 = GameObject.Find("Environment/Spawns/ZSpawn2/AreaSwitchBurnBob/Trigger");
			if ((Object)(object)val11 != (Object)null)
			{
				altarFunctionality(val11, 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
			{
				Log.LogMessage((object)"Teleporter not found");
			}
			GameObject val12 = GameObject.Find("Environment/Spawns/ZSpawn3/AreaSwitchImmaculate/Trigger");
			if ((Object)(object)val12 != (Object)null)
			{
				altarFunctionality(val12, 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
			{
				Log.LogMessage((object)"Teleporter not found");
			}
		}
		else if (((Scene)(ref Scene)).name == "HallowedDungeonsBosses" && activated)
		{
			GameObject val13 = GameObject.Find("Environment/Spawns/ZSpawn1/AreaSwitchPriest/Trigger");
			if ((Object)(object)val13 != (Object)null)
			{
				altarFunctionality(val13, 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
			{
				Log.LogMessage((object)"Teleporter not found");
			}
			GameObject val14 = GameObject.Find("Environment/Spawns/ZSpawn2/AreaSwitchGiant/Trigger");
			if ((Object)(object)val14 != (Object)null)
			{
				altarFunctionality(val14, 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
			{
				Log.LogMessage((object)"Teleporter not found");
			}
			GameObject val15 = GameObject.Find("Environment/Spawns/ZSpawn3/AreaSwitchTuano/Trigger");
			if ((Object)(object)val15 != (Object)null)
			{
				altarFunctionality(val15, 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
			{
				Log.LogMessage((object)"Teleporter not found");
			}
		}
		else if (((Scene)(ref Scene)).name == "CalderaDungeonsBosses" && activated)
		{
			GameObject val16 = GameObject.Find("Environment/AreaSwitches/AreaSwitch_GrandMother/Trigger");
			if ((Object)(object)val16 != (Object)null)
			{
				altarFunctionality(val16, 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);
			}
			else
			{
				Log.LogMessage((object)"Teleporter not found");
			}
			GameObject val17 = GameObject.Find("Environment/AreaSwitches/AreaSwitch_TorcrabFireIce/Trigger");
			if ((Object)(object)val17 != (Object)null)
			{
				altarFunctionality(val17, 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);
			}
			else
			{
				Log.LogMessage((object)"Teleporter not found");
			}
			GameObject val18 = GameObject.Find("Interactions/Caldera_Bosses/InteractionGargoylesBosses/prf_env_gargoyleFake/");
			if ((Object)(object)val18 != (Object)null)
			{
				altarFunctionality(val18, 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);
			}
			else
			{
				Log.LogMessage((object)"Teleporter not found");
			}
			GameObject val19 = GameObject.Find("Environment/AreaSwitches/AreaSwitch_Gargoyles/Trigger");
			if ((Object)(object)val19 != (Object)null)
			{
				altarFunctionalityDeny(val19);
			}
			else
			{
				Log.LogMessage((object)"Teleporter not found");
			}
			GameObject val20 = GameObject.Find("Environment/AreaSwitches/AreaSwitch_CrimsoneElite/Trigger");
			if ((Object)(object)val20 != (Object)null)
			{
				altarFunctionality(val20, 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);
			}
			else
			{
				Log.LogMessage((object)"Teleporter not found");
			}
		}
		if (activated && displayProgress && (((Scene)(ref Scene)).name == "Emercar" || ((Scene)(ref Scene)).name == "ChersoneseDungeonsBosses" || ((Scene)(ref Scene)).name == "AbrassarDungeonsBosses" || ((Scene)(ref Scene)).name == "AntiqueFieldDungeonsBosses" || ((Scene)(ref Scene)).name == "EmercarDungeonsBosses" || ((Scene)(ref Scene)).name == "HallowedDungeonsBosses" || ((Scene)(ref Scene)).name == "CalderaDungeonsBosses"))
		{
			((MonoBehaviour)Instance).StartCoroutine(DelayedProgressDisplay());
			displayProgress = false;
		}
		if (rewardReq1 && rewardReq2 && ((Scene)(ref Scene)).name == "Emercar")
		{
			((MonoBehaviour)Instance).StartCoroutine(GiveBossRushRewardsHub());
			rewardReq1 = false;
			rewardReq2 = false;
		}
	}

	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;
		rewardReq1 = false;
		rewardReq2 = false;
	}

	private IEnumerator DelayedProgressDisplay()
	{
		yield return (object)new WaitForSeconds(5f);
		if (!ConfigElements.includeProgressMessage.Value)
		{
			yield break;
		}
		int progress = Mathf.RoundToInt((float)Mathf.Clamp(100 * teleportindex / 18, 0, 100));
		CharacterManager characterManager = CharacterManager.Instance;
		for (int i = 0; i < characterManager.m_playerCharacters.Count; i++)
		{
			Character character = characterManager.m_characters[characterManager.m_playerCharacters.Values[i]];
			if ((Object)(object)character != (Object)null)
			{
				character.CharacterUI.NotificationPanel.ShowNotification($"Boss Rush Progress: {progress}%");
			}
		}
	}

	private IEnumerator GiveBossRushRewardsHub()
	{
		yield return (object)new WaitForSeconds(5f);
		CharacterManager characterManager = CharacterManager.Instance;
		for (int i = 0; i < characterManager.m_playerCharacters.Count; i++)
		{
			Character character = characterManager.m_characters[characterManager.m_playerCharacters.Values[i]];
			if ((Object)(object)character != (Object)null)
			{
				giveReward(character);
			}
		}
	}

	private static IEnumerator DelayTeleport()
	{
		yield return (object)new WaitForSeconds(1.3f);
		PublicBossDictionary publicBossDictionary = new PublicBossDictionary();
		if (publicBossDictionary == null)
		{
			yield break;
		}
		Dictionary<string, DataValue> dictionary = publicBossDictionary.BossDictionary;
		string key = teleportArray[teleportindex];
		DataValue dataValue = dictionary[key];
		AreaEnum area = dataValue.area;
		int spawnPointIndex = dataValue.spawnpointindex;
		if ((Object)(object)portalCharacter != (Object)null)
		{
			Character character = portalCharacter;
			if ((Object)(object)character != (Object)null)
			{
				portalManager.StartAreaSwitchAndSetPosition(character, area, spawnPointIndex);
			}
		}
		displayProgress = true;
	}

	public void giveReward(Character character)
	{
	}

	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 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);
	}
}