Decompiled source of StadiaJungleBoss v1.1.5

plugins/Moffein-StadiaJungleBoss/StadiaJungleBoss.dll

Decompiled 4 months ago
using System;
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 BepInEx;
using BepInEx.Configuration;
using IL.RoR2;
using Mono.Cecil.Cil;
using MonoMod.Cil;
using On.RoR2;
using R2API;
using R2API.Utils;
using RoR2;
using RoR2.Navigation;
using StadiaJungleBoss.Components;
using StadiaJungleBoss.Setup;
using UnityEngine;
using UnityEngine.AddressableAssets;
using UnityEngine.Networking;
using UnityEngine.SceneManagement;

[assembly: AssemblyProduct("StadiaJungleBoss")]
[assembly: AssemblyCopyright("Copyright ©  2023")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: TargetFramework(".NETFramework,Version=v4.7.2", FrameworkDisplayName = ".NET Framework 4.7.2")]
[assembly: Guid("a6f16744-d914-4f76-ac36-c1e4709acd21")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: CompilationRelaxations(8)]
[assembly: AssemblyTitle("StadiaJungleBoss")]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.0.0")]
[module: UnverifiableCode]
namespace StadiaJungleBoss
{
	public static class Assets
	{
		public static class Prefabs
		{
			public static GameObject Button;

			public static GameObject Encounter;
		}

		public static AssetBundle mainAssetBundle;

		public static void PopulateAssets()
		{
			//IL_00bc: 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_00d5: 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_0121: Unknown result type (might be due to invalid IL or missing references)
			//IL_013a: Unknown result type (might be due to invalid IL or missing references)
			//IL_013f: Unknown result type (might be due to invalid IL or missing references)
			//IL_014d: Unknown result type (might be due to invalid IL or missing references)
			//IL_014f: Unknown result type (might be due to invalid IL or missing references)
			//IL_015b: Unknown result type (might be due to invalid IL or missing references)
			//IL_015d: Unknown result type (might be due to invalid IL or missing references)
			if (!Object.op_Implicit((Object)(object)mainAssetBundle))
			{
				using (Stream stream = Assembly.GetExecutingAssembly().GetManifestResourceStream("StadiaJungleBoss.stadiabossbundle"))
				{
					mainAssetBundle = AssetBundle.LoadFromStream(stream);
				}
				Prefabs.Button = mainAssetBundle.LoadAsset<GameObject>("BossButton");
				Shader shader = LegacyResourcesAPI.Load<Shader>("Shaders/Deferred/hgstandard");
				Material material = ((Renderer)Prefabs.Button.GetComponentInChildren<SkinnedMeshRenderer>()).material;
				material.shader = shader;
				Prefabs.Button.AddComponent<BossButtonController>();
				Prefabs.Button.AddComponent<NetworkIdentity>();
				PrefabAPI.RegisterNetworkPrefab(Prefabs.Button);
				GameObject val = mainAssetBundle.LoadAsset<GameObject>("StadiaJungleEncounter");
				val.AddComponent<NetworkIdentity>();
				TeamFilter val2 = val.AddComponent<TeamFilter>();
				val2.defaultTeam = (TeamIndex)2;
				BossGroup val3 = val.AddComponent<BossGroup>();
				val3.dropTable = Addressables.LoadAssetAsync<PickupDropTable>((object)"RoR2/Base/Common/dtTier3Item.asset").WaitForCompletion();
				val3.bossDropChance = 0f;
				val3.scaleRewardsByPlayerCount = true;
				val3.shouldDisplayHealthBarOnHud = true;
				ScriptedCombatEncounter val4 = val.AddComponent<ScriptedCombatEncounter>();
				val4.grantUniqueBonusScaling = true;
				val4.spawnOnStart = false;
				val4.teamIndex = (TeamIndex)2;
				SpawnInfo val5 = default(SpawnInfo);
				val5.cullChance = 0f;
				val5.spawnCard = (SpawnCard)(object)Addressables.LoadAssetAsync<CharacterSpawnCard>((object)"RoR2/Base/RoboBallBoss/cscSuperRoboBallBoss.asset").WaitForCompletion();
				SpawnInfo val6 = val5;
				val4.spawns = (SpawnInfo[])(object)new SpawnInfo[1] { val6 };
				EncounterController encounterController = val.AddComponent<EncounterController>();
				PrefabAPI.RegisterNetworkPrefab(val);
				Prefabs.Encounter = val;
			}
		}
	}
	internal static class MagmaWormChanges
	{
		public static bool enabled;

		public static bool useStatItem;

		public static ItemDef StatItem;

		private static BodyIndex MagmaWormIndex;

		public static void Initialize()
		{
			//IL_003c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0046: Expected O, but got Unknown
			//IL_004e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0058: Expected O, but got Unknown
			//IL_0060: Unknown result type (might be due to invalid IL or missing references)
			//IL_006a: Expected O, but got Unknown
			if (enabled)
			{
				InitItem();
				RoR2Application.onLoad = (Action)Delegate.Combine(RoR2Application.onLoad, new Action(GetBodyIndex));
				CharacterBody.GetDisplayName += new hook_GetDisplayName(ReplaceName);
				CharacterBody.GetSubtitle += new hook_GetSubtitle(ReplaceSubtitle);
				Util.GetBestBodyName += new Manipulator(SuppressMendingName);
			}
		}

		private static void SuppressMendingName(ILContext il)
		{
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			//IL_0008: Expected O, but got Unknown
			//IL_0038: Unknown result type (might be due to invalid IL or missing references)
			ILCursor val = new ILCursor(il);
			val.GotoNext(new Func<Instruction, bool>[1]
			{
				(Instruction x) => ILPatternMatchingExt.MatchCallvirt(x, typeof(CharacterBody), "HasBuff")
			});
			val.Emit(OpCodes.Ldloc_0);
			val.EmitDelegate<Func<BuffIndex, CharacterBody, BuffIndex>>((Func<BuffIndex, CharacterBody, BuffIndex>)((BuffIndex buffIndex, CharacterBody body) => (buffIndex == Buffs.EliteEarth.buffIndex && CheckForWorm(body)) ? ((BuffIndex)(-1)) : buffIndex));
		}

		private static string ReplaceSubtitle(orig_GetSubtitle orig, CharacterBody self)
		{
			if (CheckForWorm(self))
			{
				return Language.GetString("STADIAJUNGLEBOSS_BODY_SUBTITLE");
			}
			return orig.Invoke(self);
		}

		private static string ReplaceName(orig_GetDisplayName orig, CharacterBody self)
		{
			if (CheckForWorm(self))
			{
				return Language.GetString("STADIAJUNGLEBOSS_BODY_NAME");
			}
			return orig.Invoke(self);
		}

		private static void GetBodyIndex()
		{
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			//IL_000b: Unknown result type (might be due to invalid IL or missing references)
			MagmaWormIndex = BodyCatalog.FindBodyIndex("MagmaWormBody");
		}

		private static void InitItem()
		{
			//IL_0032: Unknown result type (might be due to invalid IL or missing references)
			//IL_008c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0096: Expected O, but got Unknown
			if (useStatItem)
			{
				StatItem = ScriptableObject.CreateInstance<ItemDef>();
				((Object)StatItem).name = "StadiaBossMagmaWormItem";
				StatItem.deprecatedTier = (ItemTier)5;
				StatItem.nameToken = "Stadia Worm";
				StatItem.pickupToken = "Changes the attacks of Magma Worms.";
				StatItem.descriptionToken = "Changes the attacks of Magma Worms.";
				ItemDef statItem = StatItem;
				ItemTag[] array = new ItemTag[3];
				RuntimeHelpers.InitializeArray(array, (RuntimeFieldHandle)/*OpCode not supported: LdMemberToken*/);
				statItem.tags = (ItemTag[])(object)array;
				ItemDisplayRule[] array2 = (ItemDisplayRule[])(object)new ItemDisplayRule[0];
				ItemAPI.Add(new CustomItem(StatItem, array2));
			}
		}

		private static bool CheckForWorm(CharacterBody body)
		{
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			//IL_0007: Unknown result type (might be due to invalid IL or missing references)
			//IL_005b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0065: Unknown result type (might be due to invalid IL or missing references)
			//IL_006c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0071: Unknown result type (might be due to invalid IL or missing references)
			if (body.bodyIndex == MagmaWormIndex && Object.op_Implicit((Object)(object)body.inventory))
			{
				if (useStatItem)
				{
					return body.inventory.GetItemCount(StatItem) > 0;
				}
				if (body.inventory.GetItemCount(Items.TeleportWhenOob) > 0 && body.inventory.GetEquipmentIndex() == StadiaJungleBossPlugin.EliteEarthEquipment.equipmentIndex)
				{
					Scene activeScene = SceneManager.GetActiveScene();
					if (((Scene)(ref activeScene)).name == "rootjungle")
					{
						return true;
					}
				}
			}
			return false;
		}
	}
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[NetworkCompatibility(/*Could not decode attribute arguments.*/)]
	[BepInPlugin("com.Moffein.StadiaJungleBoss", "Stadia Jungle Boss", "1.1.5")]
	[R2APISubmoduleDependency(new string[] { "PrefabAPI", "ContentAddition" })]
	public class StadiaJungleBossPlugin : BaseUnityPlugin
	{
		public static PluginInfo pluginInfo;

		internal static EquipmentDef EliteEarthEquipment = Addressables.LoadAssetAsync<EquipmentDef>((object)"RoR2/DLC1/EliteEarth/EliteEarthEquipment.asset").WaitForCompletion();

		private void Awake()
		{
			//IL_0026: Unknown result type (might be due to invalid IL or missing references)
			//IL_0030: Expected O, but got Unknown
			pluginInfo = ((BaseUnityPlugin)this).Info;
			Assets.PopulateAssets();
			Tokens.LoadLanguage();
			ReadConfig();
			SceneDirector.Start += new hook_Start(StageSetup.SceneDirectorHook);
			RoR2Application.onLoad = (Action)Delegate.Combine(RoR2Application.onLoad, new Action(CreateSpawnCard));
			MagmaWormChanges.Initialize();
		}

		private void ReadConfig()
		{
			//IL_0011: Unknown result type (might be due to invalid IL or missing references)
			//IL_0022: Unknown result type (might be due to invalid IL or missing references)
			//IL_002c: Expected O, but got Unknown
			//IL_002c: Expected O, but got Unknown
			//IL_0046: Unknown result type (might be due to invalid IL or missing references)
			//IL_0057: Unknown result type (might be due to invalid IL or missing references)
			//IL_0061: Expected O, but got Unknown
			//IL_0061: Expected O, but got Unknown
			MagmaWormChanges.enabled = ((BaseUnityPlugin)this).Config.Bind<bool>(new ConfigDefinition("Magma Worm", "Enable Changes"), true, new ConfigDescription("Modify the Mending Magma Worm spawned by this mod.", (AcceptableValueBase)null, Array.Empty<object>())).Value;
			MagmaWormChanges.useStatItem = ((BaseUnityPlugin)this).Config.Bind<bool>(new ConfigDefinition("Magma Worm", "Use Hidden Item"), true, new ConfigDescription("Use a hidden item to determine whether to apply Magma Worm changes. If not, changes will be applied using a hackier method. You should REALLY leave this enabled unless you are using a mod with a config based on raw item indexes.", (AcceptableValueBase)null, Array.Empty<object>())).Value;
		}

		private void CreateSpawnCard()
		{
			//IL_0014: Unknown result type (might be due to invalid IL or missing references)
			//IL_0026: Unknown result type (might be due to invalid IL or missing references)
			//IL_002b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0041: Unknown result type (might be due to invalid IL or missing references)
			//IL_0048: Unknown result type (might be due to invalid IL or missing references)
			//IL_0056: Unknown result type (might be due to invalid IL or missing references)
			//IL_005d: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d9: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f4: Unknown result type (might be due to invalid IL or missing references)
			//IL_0081: Unknown result type (might be due to invalid IL or missing references)
			//IL_009b: Unknown result type (might be due to invalid IL or missing references)
			//IL_009c: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00bf: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c0: Unknown result type (might be due to invalid IL or missing references)
			CharacterSpawnCard val = ScriptableObject.CreateInstance<CharacterSpawnCard>();
			((SpawnCard)val).directorCreditCost = 800;
			((SpawnCard)val).eliteRules = (EliteRules)1;
			val.noElites = false;
			((SpawnCard)val).prefab = Addressables.LoadAssetAsync<GameObject>((object)"RoR2/Base/MagmaWorm/MagmaWormMaster.prefab").WaitForCompletion();
			((SpawnCard)val).sendOverNetwork = true;
			((SpawnCard)val).requiredFlags = (NodeFlags)0;
			((SpawnCard)val).forbiddenFlags = (NodeFlags)2;
			((SpawnCard)val).occupyPosition = false;
			((SpawnCard)val).nodeGraphType = (GraphType)0;
			((SpawnCard)val).hullSize = (HullClassification)1;
			if (MagmaWormChanges.enabled && MagmaWormChanges.useStatItem)
			{
				val.itemsToGrant = (ItemCountPair[])(object)new ItemCountPair[2]
				{
					new ItemCountPair
					{
						itemDef = Items.TeleportWhenOob,
						count = 1
					},
					new ItemCountPair
					{
						itemDef = MagmaWormChanges.StatItem,
						count = 1
					}
				};
			}
			else
			{
				val.itemsToGrant = (ItemCountPair[])(object)new ItemCountPair[1]
				{
					new ItemCountPair
					{
						itemDef = Items.TeleportWhenOob,
						count = 1
					}
				};
			}
			val.equipmentToGrant = (EquipmentDef[])(object)new EquipmentDef[1] { EliteEarthEquipment };
			val.forbiddenAsBoss = true;
			EncounterController.bossCard = val;
		}
	}
}
namespace StadiaJungleBoss.Setup
{
	internal static class StageSetup
	{
		internal static void SceneDirectorHook(orig_Start orig, SceneDirector self)
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			//IL_0109: Unknown result type (might be due to invalid IL or missing references)
			//IL_0113: Unknown result type (might be due to invalid IL or missing references)
			//IL_0118: Unknown result type (might be due to invalid IL or missing references)
			//IL_011d: 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)
			Scene activeScene = SceneManager.GetActiveScene();
			if (((Scene)(ref activeScene)).name == "rootjungle")
			{
				BossButtonController.buttonsPressed = 0;
				BossButtonController.totalButtons = 0;
				GameObject val = GameObject.Find("HOLDER: Randomization");
				if (!Object.op_Implicit((Object)(object)val))
				{
					Debug.LogError((object)"StadiaJungleBoss: Could not find Randomization");
					return;
				}
				Transform val2 = val.transform.Find("GROUP: Large Treasure Chests");
				if (!Object.op_Implicit((Object)(object)val2))
				{
					Debug.LogError((object)"StadiaJungleBoss: Could not find Large Treasure Chests");
					return;
				}
				for (int i = 0; i < val2.childCount; i++)
				{
					Transform child = val2.GetChild(i);
					if (!Object.op_Implicit((Object)(object)child))
					{
						continue;
					}
					((Component)child).gameObject.SetActive(true);
					Transform val3 = child.Find("GoldChest");
					if (Object.op_Implicit((Object)(object)val3))
					{
						if (NetworkServer.active)
						{
							Debug.Log((object)"StadiaJungleBoss: Placing button.");
							GameObject val4 = Object.Instantiate<GameObject>(Assets.Prefabs.Button);
							val4.transform.position = val3.position - 1.2f * Vector3.up;
							val4.transform.rotation = val3.rotation;
							NetworkServer.Spawn(val4);
						}
						Debug.Log((object)"StadiaJungleBoss: Destroying potential gold chest.");
						Object.Destroy((Object)(object)((Component)val3).gameObject);
					}
					else
					{
						Debug.Log((object)("StadiaJungleBoss: No chest found in category " + i));
					}
				}
				GameObject val5 = Object.Instantiate<GameObject>(Assets.Prefabs.Encounter);
				NetworkServer.Spawn(val5);
			}
			orig.Invoke(self);
		}
	}
	internal static class Tokens
	{
		internal static string assemblyDir => Path.GetDirectoryName(StadiaJungleBossPlugin.pluginInfo.Location);

		internal static string languageRoot => Path.Combine(assemblyDir, "language");

		internal static void LoadLanguage()
		{
			//IL_0008: Unknown result type (might be due to invalid IL or missing references)
			//IL_0012: Expected O, but got Unknown
			Language.SetFolders += new hook_SetFolders(fixme);
		}

		private static void fixme(orig_SetFolders orig, Language self, IEnumerable<string> newFolders)
		{
			if (Directory.Exists(languageRoot))
			{
				IEnumerable<string> second = Directory.EnumerateDirectories(Path.Combine(languageRoot), self.name);
				orig.Invoke(self, newFolders.Union(second));
			}
			else
			{
				orig.Invoke(self, newFolders);
			}
		}
	}
}
namespace StadiaJungleBoss.Components
{
	public class BossButtonController : NetworkBehaviour
	{
		public delegate void OnButtonPressed();

		public static OnButtonPressed OnButtonPressedActions;

		public static int totalButtons;

		public static int buttonsPressed;

		[SyncVar]
		public bool isPressedServer = false;

		public bool isPressedLocal = false;

		private bool enableOverlapSphere;

		private float overlapSphereRadius;

		private float overlapSphereStopwatch;

		private float overlapSphereFrequency;

		private Animator animator;

		public bool NetworkisPressedServer
		{
			get
			{
				return isPressedServer;
			}
			[param: In]
			set
			{
				((NetworkBehaviour)this).SetSyncVar<bool>(value, ref isPressedServer, 1u);
			}
		}

		private void Awake()
		{
			animator = ((Component)this).GetComponent<Animator>();
			if (!Object.op_Implicit((Object)(object)animator))
			{
				Debug.LogError((object)"StadiaJungleBoss: Could not find button animator");
			}
			if (NetworkServer.active)
			{
				NetworkisPressedServer = false;
			}
			isPressedLocal = false;
			overlapSphereRadius = 1.5f;
			overlapSphereFrequency = 5f;
			enableOverlapSphere = true;
			if (totalButtons < 4)
			{
				totalButtons++;
			}
		}

		private void FixedUpdate()
		{
			if (NetworkServer.active)
			{
				FixedUpdateServer();
			}
			if (!isPressedLocal && isPressedServer)
			{
				Pressed();
			}
		}

		private void FixedUpdateServer()
		{
			//IL_005e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0069: Unknown result type (might be due to invalid IL or missing references)
			//IL_006e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0072: Unknown result type (might be due to invalid IL or missing references)
			//IL_007c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0081: Unknown result type (might be due to invalid IL or missing references)
			//IL_0085: Unknown result type (might be due to invalid IL or missing references)
			if (isPressedServer || !enableOverlapSphere)
			{
				return;
			}
			float num = 1f / overlapSphereFrequency;
			overlapSphereStopwatch += Time.fixedDeltaTime;
			if (overlapSphereStopwatch >= num)
			{
				overlapSphereStopwatch -= num;
				Vector3 position = ((Component)this).transform.position;
				float num2 = overlapSphereRadius;
				LayerIndex val = LayerIndex.defaultLayer;
				int num3 = LayerMask.op_Implicit(((LayerIndex)(ref val)).mask);
				val = LayerIndex.fakeActor;
				if (Physics.OverlapSphere(position, num2, num3 | LayerMask.op_Implicit(((LayerIndex)(ref val)).mask), (QueryTriggerInteraction)0).Length != 0)
				{
					NetworkisPressedServer = true;
					buttonsPressed++;
					OnButtonPressedActions?.Invoke();
				}
			}
		}

		private void Pressed()
		{
			isPressedLocal = true;
			enableOverlapSphere = false;
			if (Object.op_Implicit((Object)(object)animator))
			{
				animator.SetBool("pressed", true);
			}
			Util.PlaySound("Play_item_proc_bandolierSpawn", ((Component)this).gameObject);
		}

		private void UNetVersion()
		{
		}

		public override bool OnSerialize(NetworkWriter writer, bool forceAll)
		{
			if (forceAll)
			{
				writer.Write(isPressedServer);
				return true;
			}
			bool flag = false;
			if ((((NetworkBehaviour)this).syncVarDirtyBits & (true ? 1u : 0u)) != 0)
			{
				if (!flag)
				{
					writer.WritePackedUInt32(((NetworkBehaviour)this).syncVarDirtyBits);
					flag = true;
				}
				writer.Write(isPressedServer);
			}
			if (!flag)
			{
				writer.WritePackedUInt32(((NetworkBehaviour)this).syncVarDirtyBits);
			}
			return flag;
		}

		public override void OnDeserialize(NetworkReader reader, bool initialState)
		{
			if (initialState)
			{
				isPressedServer = reader.ReadBoolean();
				return;
			}
			int num = (int)reader.ReadPackedUInt32();
			if (((uint)num & (true ? 1u : 0u)) != 0)
			{
				isPressedServer = reader.ReadBoolean();
			}
		}
	}
	public class EncounterController : MonoBehaviour
	{
		public float spawnDelay = 3f;

		public static CharacterSpawnCard bossCard;

		private ScriptedCombatEncounter scriptedCombatEncounter;

		private bool showedWarning = false;

		private bool spawnedBoss = false;

		private float spawnDelayCountdown = 0f;

		private void Awake()
		{
			//IL_006d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0073: Expected O, but got Unknown
			//IL_0099: Unknown result type (might be due to invalid IL or missing references)
			scriptedCombatEncounter = ((Component)this).GetComponent<ScriptedCombatEncounter>();
			for (int i = 0; i < scriptedCombatEncounter.spawns.Length; i++)
			{
				scriptedCombatEncounter.spawns[i].spawnCard = (SpawnCard)(object)bossCard;
			}
			BossButtonController.OnButtonPressedActions = (BossButtonController.OnButtonPressed)Delegate.Combine(BossButtonController.OnButtonPressedActions, new BossButtonController.OnButtonPressed(CheckButtons));
			BossGroup component = ((Component)this).GetComponent<BossGroup>();
			GameObject val = new GameObject();
			val.layer = LayerIndex.noCollision.intVal;
			val.transform.position = new Vector3(-156f, 100f, -152.5f);
			Object.Instantiate<GameObject>(val);
			component.dropPosition = val.transform;
		}

		private void OnDestroy()
		{
			BossButtonController.OnButtonPressedActions = (BossButtonController.OnButtonPressed)Delegate.Remove(BossButtonController.OnButtonPressedActions, new BossButtonController.OnButtonPressed(CheckButtons));
		}

		private void CheckButtons()
		{
			//IL_0026: Unknown result type (might be due to invalid IL or missing references)
			//IL_002b: Unknown result type (might be due to invalid IL or missing references)
			//IL_003b: Expected O, but got Unknown
			//IL_006f: 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_0084: Expected O, but got Unknown
			if (!showedWarning && BossButtonController.buttonsPressed == BossButtonController.totalButtons - 1)
			{
				showedWarning = true;
				Chat.SendBroadcastChat((ChatMessageBase)new SimpleChatMessage
				{
					baseToken = "STADIAJUNGLEBOSS_SPAWN_WARNING"
				});
			}
			if (!spawnedBoss && BossButtonController.buttonsPressed >= BossButtonController.totalButtons)
			{
				spawnedBoss = true;
				spawnDelayCountdown = spawnDelay;
				Chat.SendBroadcastChat((ChatMessageBase)new SimpleChatMessage
				{
					baseToken = "STADIAJUNGLEBOSS_SPAWN_BEGIN"
				});
			}
		}

		private void FixedUpdate()
		{
			if (NetworkServer.active && spawnDelayCountdown > 0f)
			{
				spawnDelayCountdown -= Time.fixedDeltaTime;
				if (spawnDelayCountdown <= 0f)
				{
					DoSpawn();
				}
			}
		}

		private void DoSpawn()
		{
			scriptedCombatEncounter.BeginEncounter();
		}
	}
}