Decompiled source of TheQuestion2 v1.0.0

plugins/PluginCore/PluginCore.dll

Decompiled a day ago
using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using System.Text;
using AIGraph;
using Agents;
using BepInEx;
using BepInEx.Core.Logging.Interpolation;
using BepInEx.Logging;
using BepInEx.Unity.IL2CPP;
using BepInEx.Unity.IL2CPP.Utils;
using BepInEx.Unity.IL2CPP.Utils.Collections;
using ChainedPuzzles;
using Enemies;
using GTFO.API;
using GameData;
using HarmonyLib;
using Il2CppInterop.Runtime;
using Il2CppInterop.Runtime.Injection;
using Il2CppInterop.Runtime.InteropTypes;
using Il2CppInterop.Runtime.InteropTypes.Arrays;
using Il2CppSystem;
using Il2CppSystem.Collections.Generic;
using Il2CppSystem.Linq;
using LevelGeneration;
using Microsoft.CodeAnalysis;
using Player;
using SNetwork;
using UnityEngine;
using UnityEngine.UI;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: TargetFramework(".NETCoreApp,Version=v6.0", FrameworkDisplayName = ".NET 6.0")]
[assembly: AssemblyCompany("PluginCore")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0+3e397ab05af67170aba2405f68dda4da0d165792")]
[assembly: AssemblyProduct("PluginCore")]
[assembly: AssemblyTitle("PluginCore")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.0.0")]
[module: UnverifiableCode]
namespace Microsoft.CodeAnalysis
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	internal sealed class EmbeddedAttribute : Attribute
	{
	}
}
namespace System.Runtime.CompilerServices
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	[AttributeUsage(AttributeTargets.Class | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Parameter | AttributeTargets.ReturnValue | AttributeTargets.GenericParameter, AllowMultiple = false, Inherited = false)]
	internal sealed class NullableAttribute : Attribute
	{
		public readonly byte[] NullableFlags;

		public NullableAttribute(byte P_0)
		{
			NullableFlags = new byte[1] { P_0 };
		}

		public NullableAttribute(byte[] P_0)
		{
			NullableFlags = P_0;
		}
	}
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	[AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Method | AttributeTargets.Interface | AttributeTargets.Delegate, AllowMultiple = false, Inherited = false)]
	internal sealed class NullableContextAttribute : Attribute
	{
		public readonly byte Flag;

		public NullableContextAttribute(byte P_0)
		{
			Flag = P_0;
		}
	}
}
internal static class BitHelper
{
	public const int SizeOfHalf = 2;

	public const int SizeOfVector3 = 12;

	public const int SizeOfQuaternion = 13;

	public const int SizeOfHalfVector3 = 6;

	public const int SizeOfHalfQuaternion = 7;

	[MethodImpl(MethodImplOptions.AggressiveInlining)]
	private static uint RotateLeft(uint value, int offset)
	{
		return (value << offset) | (value >> 32 - offset);
	}

	[MethodImpl(MethodImplOptions.AggressiveInlining)]
	private static uint RotateRight(uint value, int offset)
	{
		return (value >> offset) | (value << 32 - offset);
	}

	[MethodImpl(MethodImplOptions.AggressiveInlining)]
	public static long ReverseEndianness(long value)
	{
		return (long)ReverseEndianness((ulong)value);
	}

	[MethodImpl(MethodImplOptions.AggressiveInlining)]
	public static int ReverseEndianness(int value)
	{
		return (int)ReverseEndianness((uint)value);
	}

	[MethodImpl(MethodImplOptions.AggressiveInlining)]
	public static short ReverseEndianness(short value)
	{
		return (short)ReverseEndianness((ushort)value);
	}

	[MethodImpl(MethodImplOptions.AggressiveInlining)]
	private static ushort ReverseEndianness(ushort value)
	{
		return (ushort)((value >> 8) + (value << 8));
	}

	[MethodImpl(MethodImplOptions.AggressiveInlining)]
	private static uint ReverseEndianness(uint value)
	{
		return RotateRight(value & 0xFF00FFu, 8) + RotateLeft(value & 0xFF00FF00u, 8);
	}

	[MethodImpl(MethodImplOptions.AggressiveInlining)]
	private static ulong ReverseEndianness(ulong value)
	{
		return ((ulong)ReverseEndianness((uint)value) << 32) + ReverseEndianness((uint)(value >> 32));
	}

	[MethodImpl(MethodImplOptions.AggressiveInlining)]
	private unsafe static void _WriteBytes(byte* source, int size, byte[] destination, ref int index)
	{
		int num = 0;
		while (num < size)
		{
			destination[index++] = source[num++];
		}
	}

	[MethodImpl(MethodImplOptions.AggressiveInlining)]
	public static void WriteBytes(byte value, byte[] destination, ref int index)
	{
		destination[index++] = value;
	}

	[MethodImpl(MethodImplOptions.AggressiveInlining)]
	public static void WriteBytes(bool value, byte[] destination, ref int index)
	{
		destination[index++] = (byte)(value ? 1 : 0);
	}

	[MethodImpl(MethodImplOptions.AggressiveInlining)]
	public unsafe static void WriteBytes(ulong value, byte[] destination, ref int index)
	{
		if (!BitConverter.IsLittleEndian)
		{
			value = ReverseEndianness(value);
		}
		_WriteBytes((byte*)(&value), 8, destination, ref index);
	}

	[MethodImpl(MethodImplOptions.AggressiveInlining)]
	public unsafe static void WriteBytes(uint value, byte[] destination, ref int index)
	{
		if (!BitConverter.IsLittleEndian)
		{
			value = ReverseEndianness(value);
		}
		_WriteBytes((byte*)(&value), 4, destination, ref index);
	}

	[MethodImpl(MethodImplOptions.AggressiveInlining)]
	public unsafe static void WriteBytes(ushort value, byte[] destination, ref int index)
	{
		if (!BitConverter.IsLittleEndian)
		{
			value = ReverseEndianness(value);
		}
		_WriteBytes((byte*)(&value), 2, destination, ref index);
	}

	[MethodImpl(MethodImplOptions.AggressiveInlining)]
	public unsafe static void WriteBytes(long value, byte[] destination, ref int index)
	{
		if (!BitConverter.IsLittleEndian)
		{
			value = ReverseEndianness(value);
		}
		_WriteBytes((byte*)(&value), 8, destination, ref index);
	}

	[MethodImpl(MethodImplOptions.AggressiveInlining)]
	public unsafe static void WriteBytes(int value, byte[] destination, ref int index)
	{
		if (!BitConverter.IsLittleEndian)
		{
			value = ReverseEndianness(value);
		}
		_WriteBytes((byte*)(&value), 4, destination, ref index);
	}

	[MethodImpl(MethodImplOptions.AggressiveInlining)]
	public unsafe static void WriteBytes(short value, byte[] destination, ref int index)
	{
		if (!BitConverter.IsLittleEndian)
		{
			value = ReverseEndianness(value);
		}
		_WriteBytes((byte*)(&value), 2, destination, ref index);
	}

	[MethodImpl(MethodImplOptions.AggressiveInlining)]
	public unsafe static void WriteBytes(float value, byte[] destination, ref int index)
	{
		int value2 = *(int*)(&value);
		if (!BitConverter.IsLittleEndian)
		{
			value2 = ReverseEndianness(value2);
		}
		_WriteBytes((byte*)(&value2), 4, destination, ref index);
	}

	[MethodImpl(MethodImplOptions.AggressiveInlining)]
	public static void WriteBytes(string value, byte[] destination, ref int index)
	{
		byte[] bytes = Encoding.UTF8.GetBytes(value);
		WriteBytes((ushort)bytes.Length, destination, ref index);
		Array.Copy(bytes, 0, destination, index, bytes.Length);
		index += bytes.Length;
	}

	[MethodImpl(MethodImplOptions.AggressiveInlining)]
	public static void WriteBytes(byte[] buffer, byte[] destination, ref int index)
	{
		WriteBytes((ushort)buffer.Length, destination, ref index);
		Array.Copy(buffer, 0, destination, index, buffer.Length);
		index += buffer.Length;
	}

	[MethodImpl(MethodImplOptions.AggressiveInlining)]
	public static void WriteHalf(float value, byte[] destination, ref int index)
	{
		WriteBytes(FloatToHalf(value), destination, ref index);
	}

	[MethodImpl(MethodImplOptions.AggressiveInlining)]
	private unsafe static uint AsUInt(float x)
	{
		return *(uint*)(&x);
	}

	[MethodImpl(MethodImplOptions.AggressiveInlining)]
	private unsafe static float AsFloat(uint x)
	{
		return *(float*)(&x);
	}

	[MethodImpl(MethodImplOptions.AggressiveInlining)]
	public static float HalfToFloat(ushort x)
	{
		int num = (x & 0x7C00) >> 10;
		int num2 = (x & 0x3FF) << 13;
		int num3 = (int)(AsUInt(num2) >> 23);
		return AsFloat((uint)(((x & 0x8000) << 16) | (Convert.ToInt32(num != 0) * ((num + 112 << 23) | num2)) | ((Convert.ToInt32(num == 0) & Convert.ToInt32(num2 != 0)) * ((num3 - 37 << 23) | ((num2 << 150 - num3) & 0x7FE000)))));
	}

	[MethodImpl(MethodImplOptions.AggressiveInlining)]
	public static ushort FloatToHalf(float x)
	{
		uint num = AsUInt(x) + 4096;
		uint num2 = (num & 0x7F800000) >> 23;
		uint num3 = num & 0x7FFFFFu;
		return (ushort)(((num & 0x80000000u) >> 16) | (Convert.ToInt32(num2 > 112) * (((num2 - 112 << 10) & 0x7C00) | (num3 >> 13))) | ((Convert.ToInt32(num2 < 113) & Convert.ToInt32(num2 > 101)) * ((8384512 + num3 >> (int)(125 - num2)) + 1 >> 1)) | (Convert.ToUInt32(num2 > 143) * 32767));
	}

	[MethodImpl(MethodImplOptions.AggressiveInlining)]
	public static byte ReadByte(byte[] source, ref int index)
	{
		return source[index++];
	}

	[MethodImpl(MethodImplOptions.AggressiveInlining)]
	public static bool ReadBool(byte[] source, ref int index)
	{
		return source[index++] != 0;
	}

	[MethodImpl(MethodImplOptions.AggressiveInlining)]
	public unsafe static ulong ReadULong(byte[] source, ref int index)
	{
		fixed (byte* ptr = source)
		{
			byte* ptr2 = ptr + index;
			index += 8;
			ulong num = *(ulong*)ptr2;
			if (!BitConverter.IsLittleEndian)
			{
				num = ReverseEndianness(num);
			}
			return num;
		}
	}

	[MethodImpl(MethodImplOptions.AggressiveInlining)]
	public unsafe static long ReadLong(byte[] source, ref int index)
	{
		fixed (byte* ptr = source)
		{
			byte* ptr2 = ptr + index;
			index += 8;
			long num = *(long*)ptr2;
			if (!BitConverter.IsLittleEndian)
			{
				num = ReverseEndianness(num);
			}
			return num;
		}
	}

	[MethodImpl(MethodImplOptions.AggressiveInlining)]
	public unsafe static uint ReadUInt(byte[] source, ref int index)
	{
		fixed (byte* ptr = source)
		{
			byte* ptr2 = ptr + index;
			index += 4;
			uint num = *(uint*)ptr2;
			if (!BitConverter.IsLittleEndian)
			{
				num = ReverseEndianness(num);
			}
			return num;
		}
	}

	[MethodImpl(MethodImplOptions.AggressiveInlining)]
	public unsafe static int ReadInt(byte[] source, ref int index)
	{
		fixed (byte* ptr = source)
		{
			byte* ptr2 = ptr + index;
			index += 4;
			int num = *(int*)ptr2;
			if (!BitConverter.IsLittleEndian)
			{
				num = ReverseEndianness(num);
			}
			return num;
		}
	}

	[MethodImpl(MethodImplOptions.AggressiveInlining)]
	public unsafe static ushort ReadUShort(byte[] source, ref int index)
	{
		fixed (byte* ptr = source)
		{
			byte* ptr2 = ptr + index;
			index += 2;
			ushort num = *(ushort*)ptr2;
			if (!BitConverter.IsLittleEndian)
			{
				num = ReverseEndianness(num);
			}
			return num;
		}
	}

	[MethodImpl(MethodImplOptions.AggressiveInlining)]
	public unsafe static short ReadShort(byte[] source, ref int index)
	{
		fixed (byte* ptr = source)
		{
			byte* ptr2 = ptr + index;
			index += 2;
			short num = *(short*)ptr2;
			if (!BitConverter.IsLittleEndian)
			{
				num = ReverseEndianness(num);
			}
			return num;
		}
	}

	[MethodImpl(MethodImplOptions.AggressiveInlining)]
	public static float ReadHalf(byte[] source, ref int index)
	{
		return HalfToFloat(ReadUShort(source, ref index));
	}

	[MethodImpl(MethodImplOptions.AggressiveInlining)]
	public unsafe static float ReadFloat(byte[] source, ref int index)
	{
		fixed (byte* ptr = source)
		{
			byte* ptr2 = ptr + index;
			index += 4;
			if (!BitConverter.IsLittleEndian)
			{
				int num = ReverseEndianness(*(int*)ptr2);
				return *(float*)(&num);
			}
			return *(float*)ptr2;
		}
	}

	[MethodImpl(MethodImplOptions.AggressiveInlining)]
	public static string ReadString(byte[] source, ref int index)
	{
		int num = ReadUShort(source, ref index);
		string @string = Encoding.UTF8.GetString(source, index, num);
		index += num;
		return @string;
	}

	[MethodImpl(MethodImplOptions.AggressiveInlining)]
	public static void WriteBytes(Vector3 value, byte[] destination, ref int index)
	{
		//IL_0001: Unknown result type (might be due to invalid IL or missing references)
		//IL_000f: Unknown result type (might be due to invalid IL or missing references)
		//IL_001d: Unknown result type (might be due to invalid IL or missing references)
		WriteBytes(value.x, destination, ref index);
		WriteBytes(value.y, destination, ref index);
		WriteBytes(value.z, destination, ref index);
	}

	public static void WriteBytes(Quaternion value, byte[] destination, ref int index)
	{
		//IL_0001: Unknown result type (might be due to invalid IL or missing references)
		//IL_000a: Unknown result type (might be due to invalid IL or missing references)
		//IL_0022: Unknown result type (might be due to invalid IL or missing references)
		//IL_0018: Unknown result type (might be due to invalid IL or missing references)
		//IL_003a: Unknown result type (might be due to invalid IL or missing references)
		//IL_0030: Unknown result type (might be due to invalid IL or missing references)
		//IL_004a: Unknown result type (might be due to invalid IL or missing references)
		//IL_0080: Unknown result type (might be due to invalid IL or missing references)
		//IL_00f8: Unknown result type (might be due to invalid IL or missing references)
		//IL_0170: Unknown result type (might be due to invalid IL or missing references)
		//IL_01e5: 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_00d4: Unknown result type (might be due to invalid IL or missing references)
		//IL_00e3: 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_00a5: Unknown result type (might be due to invalid IL or missing references)
		//IL_00b3: Unknown result type (might be due to invalid IL or missing references)
		//IL_013d: Unknown result type (might be due to invalid IL or missing references)
		//IL_014c: Unknown result type (might be due to invalid IL or missing references)
		//IL_015b: Unknown result type (might be due to invalid IL or missing references)
		//IL_010f: Unknown result type (might be due to invalid IL or missing references)
		//IL_011d: Unknown result type (might be due to invalid IL or missing references)
		//IL_012b: Unknown result type (might be due to invalid IL or missing references)
		//IL_01b5: Unknown result type (might be due to invalid IL or missing references)
		//IL_01c4: 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_0187: Unknown result type (might be due to invalid IL or missing references)
		//IL_0195: Unknown result type (might be due to invalid IL or missing references)
		//IL_01a3: Unknown result type (might be due to invalid IL or missing references)
		//IL_022a: Unknown result type (might be due to invalid IL or missing references)
		//IL_0239: Unknown result type (might be due to invalid IL or missing references)
		//IL_0248: Unknown result type (might be due to invalid IL or missing references)
		//IL_01fc: 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_0218: Unknown result type (might be due to invalid IL or missing references)
		float num = value.x;
		byte b = 0;
		if (value.y > num)
		{
			num = value.y;
			b = 1;
		}
		if (value.z > num)
		{
			num = value.z;
			b = 2;
		}
		if (value.w > num)
		{
			num = value.w;
			b = 3;
		}
		WriteBytes(b, destination, ref index);
		switch (b)
		{
		case 0:
			if (value.x >= 0f)
			{
				WriteBytes(value.y, destination, ref index);
				WriteBytes(value.z, destination, ref index);
				WriteBytes(value.w, destination, ref index);
			}
			else
			{
				WriteBytes(0f - value.y, destination, ref index);
				WriteBytes(0f - value.z, destination, ref index);
				WriteBytes(0f - value.w, destination, ref index);
			}
			break;
		case 1:
			if (value.y >= 0f)
			{
				WriteBytes(value.x, destination, ref index);
				WriteBytes(value.z, destination, ref index);
				WriteBytes(value.w, destination, ref index);
			}
			else
			{
				WriteBytes(0f - value.x, destination, ref index);
				WriteBytes(0f - value.z, destination, ref index);
				WriteBytes(0f - value.w, destination, ref index);
			}
			break;
		case 2:
			if (value.z >= 0f)
			{
				WriteBytes(value.x, destination, ref index);
				WriteBytes(value.y, destination, ref index);
				WriteBytes(value.w, destination, ref index);
			}
			else
			{
				WriteBytes(0f - value.x, destination, ref index);
				WriteBytes(0f - value.y, destination, ref index);
				WriteBytes(0f - value.w, destination, ref index);
			}
			break;
		case 3:
			if (value.w >= 0f)
			{
				WriteBytes(value.x, destination, ref index);
				WriteBytes(value.y, destination, ref index);
				WriteBytes(value.z, destination, ref index);
			}
			else
			{
				WriteBytes(0f - value.x, destination, ref index);
				WriteBytes(0f - value.y, destination, ref index);
				WriteBytes(0f - value.z, destination, ref index);
			}
			break;
		}
	}

	public static Vector3 ReadVector3(byte[] source, ref int index)
	{
		//IL_0016: 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_001e: Unknown result type (might be due to invalid IL or missing references)
		return new Vector3(ReadFloat(source, ref index), ReadFloat(source, ref index), ReadFloat(source, ref index));
	}

	public static Quaternion ReadQuaternion(byte[] source, ref int index)
	{
		//IL_011b: Unknown result type (might be due to invalid IL or missing references)
		//IL_0120: Unknown result type (might be due to invalid IL or missing references)
		//IL_0124: Unknown result type (might be due to invalid IL or missing references)
		byte b = ReadByte(source, ref index);
		float num = 0f;
		float num2 = 0f;
		float num3 = 0f;
		float num4 = 0f;
		switch (b)
		{
		case 0:
			num2 = ReadFloat(source, ref index);
			num3 = ReadFloat(source, ref index);
			num4 = ReadFloat(source, ref index);
			num = Mathf.Sqrt(1f - num2 * num2 - num3 * num3 - num4 * num4);
			break;
		case 1:
			num = ReadFloat(source, ref index);
			num3 = ReadFloat(source, ref index);
			num4 = ReadFloat(source, ref index);
			num2 = Mathf.Sqrt(1f - num * num - num3 * num3 - num4 * num4);
			break;
		case 2:
			num = ReadFloat(source, ref index);
			num2 = ReadFloat(source, ref index);
			num4 = ReadFloat(source, ref index);
			num3 = Mathf.Sqrt(1f - num * num - num2 * num2 - num4 * num4);
			break;
		case 3:
			num = ReadFloat(source, ref index);
			num2 = ReadFloat(source, ref index);
			num3 = ReadFloat(source, ref index);
			num4 = Mathf.Sqrt(1f - num * num - num2 * num2 - num3 * num3);
			break;
		}
		return new Quaternion(num, num2, num3, num4);
	}

	public static void WriteHalf(Vector3 value, byte[] destination, ref int index)
	{
		//IL_0001: Unknown result type (might be due to invalid IL or missing references)
		//IL_000f: Unknown result type (might be due to invalid IL or missing references)
		//IL_001d: Unknown result type (might be due to invalid IL or missing references)
		WriteHalf(value.x, destination, ref index);
		WriteHalf(value.y, destination, ref index);
		WriteHalf(value.z, destination, ref index);
	}

	public static void WriteHalf(Quaternion value, byte[] destination, ref int index)
	{
		//IL_0001: Unknown result type (might be due to invalid IL or missing references)
		//IL_000a: Unknown result type (might be due to invalid IL or missing references)
		//IL_0022: Unknown result type (might be due to invalid IL or missing references)
		//IL_0018: Unknown result type (might be due to invalid IL or missing references)
		//IL_003a: Unknown result type (might be due to invalid IL or missing references)
		//IL_0030: Unknown result type (might be due to invalid IL or missing references)
		//IL_004a: Unknown result type (might be due to invalid IL or missing references)
		//IL_0080: Unknown result type (might be due to invalid IL or missing references)
		//IL_00f8: Unknown result type (might be due to invalid IL or missing references)
		//IL_0170: Unknown result type (might be due to invalid IL or missing references)
		//IL_01e5: 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_00d4: Unknown result type (might be due to invalid IL or missing references)
		//IL_00e3: 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_00a5: Unknown result type (might be due to invalid IL or missing references)
		//IL_00b3: Unknown result type (might be due to invalid IL or missing references)
		//IL_013d: Unknown result type (might be due to invalid IL or missing references)
		//IL_014c: Unknown result type (might be due to invalid IL or missing references)
		//IL_015b: Unknown result type (might be due to invalid IL or missing references)
		//IL_010f: Unknown result type (might be due to invalid IL or missing references)
		//IL_011d: Unknown result type (might be due to invalid IL or missing references)
		//IL_012b: Unknown result type (might be due to invalid IL or missing references)
		//IL_01b5: Unknown result type (might be due to invalid IL or missing references)
		//IL_01c4: 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_0187: Unknown result type (might be due to invalid IL or missing references)
		//IL_0195: Unknown result type (might be due to invalid IL or missing references)
		//IL_01a3: Unknown result type (might be due to invalid IL or missing references)
		//IL_022a: Unknown result type (might be due to invalid IL or missing references)
		//IL_0239: Unknown result type (might be due to invalid IL or missing references)
		//IL_0248: Unknown result type (might be due to invalid IL or missing references)
		//IL_01fc: 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_0218: Unknown result type (might be due to invalid IL or missing references)
		float num = value.x;
		byte b = 0;
		if (value.y > num)
		{
			num = value.y;
			b = 1;
		}
		if (value.z > num)
		{
			num = value.z;
			b = 2;
		}
		if (value.w > num)
		{
			num = value.w;
			b = 3;
		}
		WriteBytes(b, destination, ref index);
		switch (b)
		{
		case 0:
			if (value.x >= 0f)
			{
				WriteHalf(value.y, destination, ref index);
				WriteHalf(value.z, destination, ref index);
				WriteHalf(value.w, destination, ref index);
			}
			else
			{
				WriteHalf(0f - value.y, destination, ref index);
				WriteHalf(0f - value.z, destination, ref index);
				WriteHalf(0f - value.w, destination, ref index);
			}
			break;
		case 1:
			if (value.y >= 0f)
			{
				WriteHalf(value.x, destination, ref index);
				WriteHalf(value.z, destination, ref index);
				WriteHalf(value.w, destination, ref index);
			}
			else
			{
				WriteHalf(0f - value.x, destination, ref index);
				WriteHalf(0f - value.z, destination, ref index);
				WriteHalf(0f - value.w, destination, ref index);
			}
			break;
		case 2:
			if (value.z >= 0f)
			{
				WriteHalf(value.x, destination, ref index);
				WriteHalf(value.y, destination, ref index);
				WriteHalf(value.w, destination, ref index);
			}
			else
			{
				WriteHalf(0f - value.x, destination, ref index);
				WriteHalf(0f - value.y, destination, ref index);
				WriteHalf(0f - value.w, destination, ref index);
			}
			break;
		case 3:
			if (value.w >= 0f)
			{
				WriteHalf(value.x, destination, ref index);
				WriteHalf(value.y, destination, ref index);
				WriteHalf(value.z, destination, ref index);
			}
			else
			{
				WriteHalf(0f - value.x, destination, ref index);
				WriteHalf(0f - value.y, destination, ref index);
				WriteHalf(0f - value.z, destination, ref index);
			}
			break;
		}
	}

	public static Vector3 ReadHalfVector3(byte[] source, ref int index)
	{
		//IL_0016: 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_001e: Unknown result type (might be due to invalid IL or missing references)
		return new Vector3(ReadHalf(source, ref index), ReadHalf(source, ref index), ReadHalf(source, ref index));
	}

	public static Quaternion ReadHalfQuaternion(byte[] source, ref int index)
	{
		//IL_011b: Unknown result type (might be due to invalid IL or missing references)
		//IL_0120: Unknown result type (might be due to invalid IL or missing references)
		//IL_0124: Unknown result type (might be due to invalid IL or missing references)
		byte b = ReadByte(source, ref index);
		float num = 0f;
		float num2 = 0f;
		float num3 = 0f;
		float num4 = 0f;
		switch (b)
		{
		case 0:
			num2 = ReadHalf(source, ref index);
			num3 = ReadHalf(source, ref index);
			num4 = ReadHalf(source, ref index);
			num = Mathf.Sqrt(1f - num2 * num2 - num3 * num3 - num4 * num4);
			break;
		case 1:
			num = ReadHalf(source, ref index);
			num3 = ReadHalf(source, ref index);
			num4 = ReadHalf(source, ref index);
			num2 = Mathf.Sqrt(1f - num * num - num3 * num3 - num4 * num4);
			break;
		case 2:
			num = ReadHalf(source, ref index);
			num2 = ReadHalf(source, ref index);
			num4 = ReadHalf(source, ref index);
			num3 = Mathf.Sqrt(1f - num * num - num2 * num2 - num4 * num4);
			break;
		case 3:
			num = ReadHalf(source, ref index);
			num2 = ReadHalf(source, ref index);
			num3 = ReadHalf(source, ref index);
			num4 = Mathf.Sqrt(1f - num * num - num2 * num2 - num3 * num3);
			break;
		}
		return new Quaternion(num, num2, num3, num4);
	}
}
namespace PluginCore
{
	public static class BossNetworkManager
	{
		private enum MessageType : byte
		{
			BossStateUpdate = 1,
			WeakspotActivated,
			MechanicTriggered,
			ScoutKilled,
			ScanCompleted
		}

		public struct BossState
		{
			public int ActiveWeakspotIndex;

			public int DestroyedWeakspotsTotal;

			public int CurrentPhase;

			public int ScoutsKilled;

			public int ScansCompleted;

			public byte CurrentMechanic;

			public bool NextGiantScanIsLeft;

			public bool Zone2Opened;
		}

		private static readonly ushort REPLICATOR_KEY = 65530;

		private static readonly uint MAGIC_KEY = 2958416506u;

		private static BossState _currentState;

		public static Action<BossState> OnStateReceived;

		public static void SendBossState(BossState state)
		{
			//IL_0062: Unknown result type (might be due to invalid IL or missing references)
			//IL_0069: Expected O, but got Unknown
			//IL_015e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0165: Expected O, but got Unknown
			//IL_01a4: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ab: Expected O, but got Unknown
			//IL_01f8: Unknown result type (might be due to invalid IL or missing references)
			//IL_0213: Unknown result type (might be due to invalid IL or missing references)
			//IL_021a: Expected O, but got Unknown
			//IL_0261: Unknown result type (might be due to invalid IL or missing references)
			//IL_0278: Unknown result type (might be due to invalid IL or missing references)
			//IL_027f: Expected O, but got Unknown
			//IL_0244: Unknown result type (might be due to invalid IL or missing references)
			if (!SNet.IsMaster)
			{
				PluginCore.LogSource.LogWarning((object)"[BossNet] ⚠\ufe0f Solo el Master puede enviar estado!");
				return;
			}
			_currentState = state;
			List<SNet_Player> targetPlayers = GetTargetPlayers();
			if (targetPlayers.Count == 0)
			{
				PluginCore.LogSource.LogDebug((object)"[BossNet] No hay otros jugadores, skipping network send");
				return;
			}
			ManualLogSource logSource = PluginCore.LogSource;
			bool flag = default(bool);
			BepInExInfoLogInterpolatedStringHandler val = new BepInExInfoLogInterpolatedStringHandler(44, 1, ref flag);
			if (flag)
			{
				((BepInExLogInterpolatedStringHandler)val).AppendLiteral("[BossNet] \ud83d\udce4 Preparando envío a ");
				((BepInExLogInterpolatedStringHandler)val).AppendFormatted<int>(targetPlayers.Count);
				((BepInExLogInterpolatedStringHandler)val).AppendLiteral(" jugador(es)");
			}
			logSource.LogInfo(val);
			byte[] array = new byte[34];
			int index = 0;
			BitHelper.WriteBytes(REPLICATOR_KEY, array, ref index);
			BitHelper.WriteBytes(MAGIC_KEY, array, ref index);
			BitHelper.WriteBytes((byte)1, array, ref index);
			BitHelper.WriteBytes(23, array, ref index);
			BitHelper.WriteBytes(state.ActiveWeakspotIndex, array, ref index);
			BitHelper.WriteBytes(state.DestroyedWeakspotsTotal, array, ref index);
			BitHelper.WriteBytes(state.CurrentPhase, array, ref index);
			BitHelper.WriteBytes(state.ScoutsKilled, array, ref index);
			BitHelper.WriteBytes(state.ScansCompleted, array, ref index);
			BitHelper.WriteBytes(state.CurrentMechanic, array, ref index);
			BitHelper.WriteBytes(state.NextGiantScanIsLeft, array, ref index);
			BitHelper.WriteBytes(state.Zone2Opened, array, ref index);
			ManualLogSource logSource2 = PluginCore.LogSource;
			BepInExDebugLogInterpolatedStringHandler val2 = new BepInExDebugLogInterpolatedStringHandler(29, 1, ref flag);
			if (flag)
			{
				((BepInExLogInterpolatedStringHandler)val2).AppendLiteral("[BossNet] Packet size: ");
				((BepInExLogInterpolatedStringHandler)val2).AppendFormatted<int>(array.Length);
				((BepInExLogInterpolatedStringHandler)val2).AppendLiteral(" bytes");
			}
			logSource2.LogDebug(val2);
			ManualLogSource logSource3 = PluginCore.LogSource;
			val2 = new BepInExDebugLogInterpolatedStringHandler(34, 2, ref flag);
			if (flag)
			{
				((BepInExLogInterpolatedStringHandler)val2).AppendLiteral("[BossNet] RepKey: 0x");
				((BepInExLogInterpolatedStringHandler)val2).AppendFormatted<ushort>(REPLICATOR_KEY, "X4");
				((BepInExLogInterpolatedStringHandler)val2).AppendLiteral(", MagicKey: 0x");
				((BepInExLogInterpolatedStringHandler)val2).AppendFormatted<uint>(MAGIC_KEY, "X8");
			}
			logSource3.LogDebug(val2);
			SNet_ChannelType val3 = (SNet_ChannelType)0;
			SNet_SendGroup val4 = default(SNet_SendGroup);
			SNet_SendQuality val5 = default(SNet_SendQuality);
			int num = default(int);
			SNet.GetSendSettings(ref val3, ref val4, ref val5, ref num);
			ManualLogSource logSource4 = PluginCore.LogSource;
			val2 = new BepInExDebugLogInterpolatedStringHandler(30, 2, ref flag);
			if (flag)
			{
				((BepInExLogInterpolatedStringHandler)val2).AppendLiteral("[BossNet] Channel: ");
				((BepInExLogInterpolatedStringHandler)val2).AppendFormatted<int>(num);
				((BepInExLogInterpolatedStringHandler)val2).AppendLiteral(", Quality: ");
				((BepInExLogInterpolatedStringHandler)val2).AppendFormatted<SNet_SendQuality>(val5);
			}
			logSource4.LogDebug(val2);
			SNet.Core.SendBytes(Il2CppStructArray<byte>.op_Implicit(array), val5, num, targetPlayers);
			ManualLogSource logSource5 = PluginCore.LogSource;
			val = new BepInExInfoLogInterpolatedStringHandler(55, 2, ref flag);
			if (flag)
			{
				((BepInExLogInterpolatedStringHandler)val).AppendLiteral("[BossNet] \ud83d\udce4 Master envió estado: Weakspot=");
				((BepInExLogInterpolatedStringHandler)val).AppendFormatted<int>(state.ActiveWeakspotIndex);
				((BepInExLogInterpolatedStringHandler)val).AppendLiteral(", Destroyed=");
				((BepInExLogInterpolatedStringHandler)val).AppendFormatted<int>(state.DestroyedWeakspotsTotal);
			}
			logSource5.LogInfo(val);
		}

		public static void SendScoutKilled()
		{
			//IL_004d: Unknown result type (might be due to invalid IL or missing references)
			//IL_007b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0092: Unknown result type (might be due to invalid IL or missing references)
			//IL_0099: Expected O, but got Unknown
			if (!SNet.IsMaster)
			{
				byte[] array = new byte[11];
				int index = 0;
				BitHelper.WriteBytes(REPLICATOR_KEY, array, ref index);
				BitHelper.WriteBytes(MAGIC_KEY, array, ref index);
				BitHelper.WriteBytes((byte)4, array, ref index);
				BitHelper.WriteBytes(0, array, ref index);
				SNet_ChannelType val = (SNet_ChannelType)0;
				SNet_SendGroup val2 = default(SNet_SendGroup);
				SNet_SendQuality val3 = default(SNet_SendQuality);
				int num = default(int);
				SNet.GetSendSettings(ref val, ref val2, ref val3, ref num);
				List<SNet_Player> val4 = new List<SNet_Player>();
				val4.Add(SNet.Master);
				SNet.Core.SendBytes(Il2CppStructArray<byte>.op_Implicit(array), val3, num, val4);
				ManualLogSource logSource = PluginCore.LogSource;
				bool flag = default(bool);
				BepInExDebugLogInterpolatedStringHandler val5 = new BepInExDebugLogInterpolatedStringHandler(51, 0, ref flag);
				if (flag)
				{
					((BepInExLogInterpolatedStringHandler)val5).AppendLiteral("[BossNet] \ud83d\udce4 Cliente reportó scout muerto al Master");
				}
				logSource.LogDebug(val5);
			}
		}

		public static void SendScanCompleted()
		{
			//IL_004d: Unknown result type (might be due to invalid IL or missing references)
			//IL_007b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0092: Unknown result type (might be due to invalid IL or missing references)
			//IL_0099: Expected O, but got Unknown
			if (!SNet.IsMaster)
			{
				byte[] array = new byte[11];
				int index = 0;
				BitHelper.WriteBytes(REPLICATOR_KEY, array, ref index);
				BitHelper.WriteBytes(MAGIC_KEY, array, ref index);
				BitHelper.WriteBytes((byte)5, array, ref index);
				BitHelper.WriteBytes(0, array, ref index);
				SNet_ChannelType val = (SNet_ChannelType)0;
				SNet_SendGroup val2 = default(SNet_SendGroup);
				SNet_SendQuality val3 = default(SNet_SendQuality);
				int num = default(int);
				SNet.GetSendSettings(ref val, ref val2, ref val3, ref num);
				List<SNet_Player> val4 = new List<SNet_Player>();
				val4.Add(SNet.Master);
				SNet.Core.SendBytes(Il2CppStructArray<byte>.op_Implicit(array), val3, num, val4);
				ManualLogSource logSource = PluginCore.LogSource;
				bool flag = default(bool);
				BepInExDebugLogInterpolatedStringHandler val5 = new BepInExDebugLogInterpolatedStringHandler(54, 0, ref flag);
				if (flag)
				{
					((BepInExLogInterpolatedStringHandler)val5).AppendLiteral("[BossNet] \ud83d\udce4 Cliente reportó scan completado al Master");
				}
				logSource.LogDebug(val5);
			}
		}

		private static List<SNet_Player> GetTargetPlayers()
		{
			List<SNet_Player> val = new List<SNet_Player>();
			Enumerator<PlayerAgent> enumerator = PlayerManager.PlayerAgentsInLevel.GetEnumerator();
			while (enumerator.MoveNext())
			{
				PlayerAgent current = enumerator.Current;
				if (!current.Owner.IsBot && current.Owner.Lookup != SNet.LocalPlayer.Lookup)
				{
					val.Add(current.Owner);
				}
			}
			return val;
		}

		public static BossState GetState()
		{
			return _currentState;
		}

		public static void Reset()
		{
			BossState currentState = default(BossState);
			currentState.ActiveWeakspotIndex = -1;
			currentState.DestroyedWeakspotsTotal = 0;
			currentState.CurrentPhase = 0;
			currentState.ScoutsKilled = 0;
			currentState.ScansCompleted = 0;
			currentState.CurrentMechanic = 0;
			currentState.NextGiantScanIsLeft = true;
			currentState.Zone2Opened = false;
			_currentState = currentState;
			OnStateReceived = null;
			PluginCore.LogSource.LogInfo((object)"[BossNet] \ud83d\udd04 Network state reset");
		}

		public static void ProcessPacket(byte msgType, byte[] message)
		{
			//IL_0047: Unknown result type (might be due to invalid IL or missing references)
			//IL_004d: Expected O, but got Unknown
			switch ((MessageType)msgType)
			{
			case MessageType.BossStateUpdate:
				HandleBossStateUpdate(message);
				return;
			case MessageType.ScoutKilled:
				HandleScoutKilledReport();
				return;
			case MessageType.ScanCompleted:
				HandleScanCompletedReport();
				return;
			}
			ManualLogSource logSource = PluginCore.LogSource;
			bool flag = default(bool);
			BepInExWarningLogInterpolatedStringHandler val = new BepInExWarningLogInterpolatedStringHandler(42, 1, ref flag);
			if (flag)
			{
				((BepInExLogInterpolatedStringHandler)val).AppendLiteral("[BossNet] ⚠\ufe0f Tipo de mensaje desconocido: ");
				((BepInExLogInterpolatedStringHandler)val).AppendFormatted<byte>(msgType);
			}
			logSource.LogWarning(val);
		}

		private static void HandleBossStateUpdate(byte[] message)
		{
			//IL_00b6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00bd: Expected O, but got Unknown
			if (SNet.IsMaster)
			{
				PluginCore.LogSource.LogWarning((object)"[BossNet] ⚠\ufe0f Master recibió estado (esto no debería pasar)");
				return;
			}
			int index = 0;
			BossState currentState = default(BossState);
			currentState.ActiveWeakspotIndex = BitHelper.ReadInt(message, ref index);
			currentState.DestroyedWeakspotsTotal = BitHelper.ReadInt(message, ref index);
			currentState.CurrentPhase = BitHelper.ReadInt(message, ref index);
			currentState.ScoutsKilled = BitHelper.ReadInt(message, ref index);
			currentState.ScansCompleted = BitHelper.ReadInt(message, ref index);
			currentState.CurrentMechanic = BitHelper.ReadByte(message, ref index);
			currentState.NextGiantScanIsLeft = BitHelper.ReadBool(message, ref index);
			currentState.Zone2Opened = BitHelper.ReadBool(message, ref index);
			BossState obj = (_currentState = currentState);
			ManualLogSource logSource = PluginCore.LogSource;
			bool flag = default(bool);
			BepInExInfoLogInterpolatedStringHandler val = new BepInExInfoLogInterpolatedStringHandler(58, 2, ref flag);
			if (flag)
			{
				((BepInExLogInterpolatedStringHandler)val).AppendLiteral("[BossNet] \ud83d\udce5 Cliente recibió estado: Weakspot=");
				((BepInExLogInterpolatedStringHandler)val).AppendFormatted<int>(obj.ActiveWeakspotIndex);
				((BepInExLogInterpolatedStringHandler)val).AppendLiteral(", Destroyed=");
				((BepInExLogInterpolatedStringHandler)val).AppendFormatted<int>(obj.DestroyedWeakspotsTotal);
			}
			logSource.LogInfo(val);
			OnStateReceived?.Invoke(obj);
		}

		private static void HandleScoutKilledReport()
		{
			if (!SNet.IsMaster)
			{
				PluginCore.LogSource.LogWarning((object)"[BossNet] ⚠\ufe0f Cliente recibió reporte de scout (solo Master debería)");
				return;
			}
			PluginCore.LogSource.LogDebug((object)"[BossNet] \ud83d\udce5 Master recibió: scout muerto");
			BossSystem.OnScoutKilledFromClient();
		}

		private static void HandleScanCompletedReport()
		{
			if (!SNet.IsMaster)
			{
				PluginCore.LogSource.LogWarning((object)"[BossNet] ⚠\ufe0f Cliente recibió reporte de scan (solo Master debería)");
				return;
			}
			PluginCore.LogSource.LogDebug((object)"[BossNet] \ud83d\udce5 Master recibió: scan completado");
			BossSystem.OnScanCompletedFromClient();
		}
	}
	[HarmonyPatch]
	public static class BossNetworkPatches
	{
		private static readonly ushort REPLICATOR_KEY = 65530;

		private static readonly uint MAGIC_KEY = 2958416506u;

		[HarmonyPatch(typeof(SNet_Replication), "RecieveBytes")]
		[HarmonyPrefix]
		private static bool OnReceiveBytes(Il2CppStructArray<byte> bytes, uint size, ulong messagerID)
		{
			//IL_0190: Unknown result type (might be due to invalid IL or missing references)
			//IL_0197: Expected O, but got Unknown
			//IL_01cd: Unknown result type (might be due to invalid IL or missing references)
			//IL_01d4: Expected O, but got Unknown
			//IL_00cd: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d4: Expected O, but got Unknown
			//IL_0089: Unknown result type (might be due to invalid IL or missing references)
			//IL_0090: Expected O, but got Unknown
			//IL_0112: Unknown result type (might be due to invalid IL or missing references)
			//IL_0119: Expected O, but got Unknown
			if (size < 12)
			{
				return true;
			}
			bool flag = default(bool);
			try
			{
				byte[] array = new byte[size];
				for (int i = 0; i < size; i++)
				{
					array[i] = ((Il2CppArrayBase<byte>)(object)bytes)[i];
				}
				ushort num = BitConverter.ToUInt16(array, 0);
				if (num != REPLICATOR_KEY)
				{
					return true;
				}
				uint num2 = BitConverter.ToUInt32(array, 2);
				if (num2 != MAGIC_KEY)
				{
					ManualLogSource logSource = PluginCore.LogSource;
					BepInExWarningLogInterpolatedStringHandler val = new BepInExWarningLogInterpolatedStringHandler(64, 1, ref flag);
					if (flag)
					{
						((BepInExLogInterpolatedStringHandler)val).AppendLiteral("[BossNet] ⚠\ufe0f Replicator key correcto pero magic key incorrecto: ");
						((BepInExLogInterpolatedStringHandler)val).AppendFormatted<uint>(num2, "X");
					}
					logSource.LogWarning(val);
					return true;
				}
				ManualLogSource logSource2 = PluginCore.LogSource;
				BepInExDebugLogInterpolatedStringHandler val2 = new BepInExDebugLogInterpolatedStringHandler(40, 1, ref flag);
				if (flag)
				{
					((BepInExLogInterpolatedStringHandler)val2).AppendLiteral("[BossNet] \ud83d\udce5 Paquete interceptado! Size=");
					((BepInExLogInterpolatedStringHandler)val2).AppendFormatted<uint>(size);
				}
				logSource2.LogDebug(val2);
				byte b = array[6];
				int num3 = BitConverter.ToInt32(array, 7);
				ManualLogSource logSource3 = PluginCore.LogSource;
				val2 = new BepInExDebugLogInterpolatedStringHandler(28, 2, ref flag);
				if (flag)
				{
					((BepInExLogInterpolatedStringHandler)val2).AppendLiteral("[BossNet] MsgType=");
					((BepInExLogInterpolatedStringHandler)val2).AppendFormatted<byte>(b);
					((BepInExLogInterpolatedStringHandler)val2).AppendLiteral(", MsgSize=");
					((BepInExLogInterpolatedStringHandler)val2).AppendFormatted<int>(num3);
				}
				logSource3.LogDebug(val2);
				byte[] array2 = new byte[num3];
				int sourceIndex = 11;
				Array.Copy(array, sourceIndex, array2, 0, num3);
				BossNetworkManager.ProcessPacket(b, array2);
				return false;
			}
			catch (Exception ex)
			{
				ManualLogSource logSource4 = PluginCore.LogSource;
				BepInExErrorLogInterpolatedStringHandler val3 = new BepInExErrorLogInterpolatedStringHandler(38, 1, ref flag);
				if (flag)
				{
					((BepInExLogInterpolatedStringHandler)val3).AppendLiteral("[BossNet] ❌ Error procesando paquete: ");
					((BepInExLogInterpolatedStringHandler)val3).AppendFormatted<string>(ex.Message);
				}
				logSource4.LogError(val3);
				ManualLogSource logSource5 = PluginCore.LogSource;
				val3 = new BepInExErrorLogInterpolatedStringHandler(10, 1, ref flag);
				if (flag)
				{
					((BepInExLogInterpolatedStringHandler)val3).AppendLiteral("   Stack: ");
					((BepInExLogInterpolatedStringHandler)val3).AppendFormatted<string>(ex.StackTrace);
				}
				logSource5.LogError(val3);
				return true;
			}
		}
	}
	public static class BossSystem
	{
		private enum MechanicType
		{
			GroupScans,
			Scouts,
			GiantScan
		}

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

			private object <>2__current;

			private uint <enemyID>5__1;

			private int <>s__2;

			private Vector3[] <>s__3;

			private int <>s__4;

			private Vector3 <spawnPos>5__5;

			private List<AIG_CourseNode> <allNodes>5__6;

			private AIG_CourseNode <closestNode>5__7;

			private float <closestDistance>5__8;

			private EnemyAgent <enemy>5__9;

			private Enumerator<AIG_CourseNode> <>s__10;

			private AIG_CourseNode <node>5__11;

			private float <distance>5__12;

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

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

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

			[DebuggerHidden]
			void IDisposable.Dispose()
			{
				<>s__3 = null;
				<allNodes>5__6 = null;
				<closestNode>5__7 = null;
				<enemy>5__9 = null;
				<>s__10 = null;
				<node>5__11 = null;
				<>1__state = -2;
			}

			private bool MoveNext()
			{
				//IL_008f: Unknown result type (might be due to invalid IL or missing references)
				//IL_0094: Unknown result type (might be due to invalid IL or missing references)
				//IL_0227: Unknown result type (might be due to invalid IL or missing references)
				//IL_0231: Expected O, but got Unknown
				//IL_0112: 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_019f: Unknown result type (might be due to invalid IL or missing references)
				//IL_01a4: Unknown result type (might be due to invalid IL or missing references)
				switch (<>1__state)
				{
				default:
					return false;
				case 0:
					<>1__state = -1;
					break;
				case 1:
					<>1__state = -1;
					break;
				}
				if (_continuousSpawnActive && (Object)(object)_boss != (Object)null && ((Agent)_boss).Alive)
				{
					<>s__2 = _currentPhase;
					<enemyID>5__1 = <>s__2 switch
					{
						0 => 31u, 
						1 => 30u, 
						2 => 39u, 
						_ => 31u, 
					};
					<>s__3 = _continuousSpawnPositions;
					for (<>s__4 = 0; <>s__4 < <>s__3.Length; <>s__4++)
					{
						<spawnPos>5__5 = <>s__3[<>s__4];
						try
						{
							<allNodes>5__6 = AIG_CourseNode.s_allNodes;
							if (<allNodes>5__6 != null && <allNodes>5__6.Count != 0)
							{
								<closestNode>5__7 = null;
								<closestDistance>5__8 = float.MaxValue;
								<>s__10 = <allNodes>5__6.GetEnumerator();
								while (<>s__10.MoveNext())
								{
									<node>5__11 = <>s__10.Current;
									if (<node>5__11 != null)
									{
										<distance>5__12 = Vector3.Distance(<spawnPos>5__5, <node>5__11.Position);
										if (<distance>5__12 < <closestDistance>5__8)
										{
											<closestDistance>5__8 = <distance>5__12;
											<closestNode>5__7 = <node>5__11;
										}
									}
									<node>5__11 = null;
								}
								<>s__10 = null;
								if (<closestNode>5__7 != null)
								{
									<enemy>5__9 = EnemyAllocator.Current.SpawnEnemy(<enemyID>5__1, <closestNode>5__7, (AgentMode)1, <spawnPos>5__5, Quaternion.identity, (EnemyGroup)null, -1);
									if ((Object)(object)<enemy>5__9 != (Object)null)
									{
										((Component)<enemy>5__9).gameObject.SetActive(true);
									}
									<allNodes>5__6 = null;
									<closestNode>5__7 = null;
									<enemy>5__9 = null;
								}
							}
						}
						catch
						{
						}
					}
					<>s__3 = null;
					<>2__current = (object)new WaitForSeconds(4f);
					<>1__state = 1;
					return true;
				}
				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 <DelayedInitialSync>d__66 : IEnumerator<object>, IEnumerator, IDisposable
		{
			private int <>1__state;

			private object <>2__current;

			private ManualLogSource <>s__1;

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

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

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

			[DebuggerHidden]
			void IDisposable.Dispose()
			{
				<>s__1 = 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_0050: Unknown result type (might be due to invalid IL or missing references)
				//IL_0056: Expected O, but got Unknown
				switch (<>1__state)
				{
				default:
					return false;
				case 0:
					<>1__state = -1;
					<>2__current = (object)new WaitForSeconds(0.5f);
					<>1__state = 1;
					return true;
				case 1:
				{
					<>1__state = -1;
					<>s__1 = PluginCore.LogSource;
					bool flag = default(bool);
					BepInExInfoLogInterpolatedStringHandler val = new BepInExInfoLogInterpolatedStringHandler(51, 0, ref flag);
					if (flag)
					{
						((BepInExLogInterpolatedStringHandler)val).AppendLiteral("  \ud83d\udce1 [MASTER] Enviando estado inicial a clientes...");
					}
					<>s__1.LogInfo(val);
					<>s__1 = null;
					SyncStateToClients();
					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 <FatherSpawner>d__90 : IEnumerator<object>, IEnumerator, IDisposable
		{
			private int <>1__state;

			private object <>2__current;

			private float <timeSinceStart>5__1;

			private ManualLogSource <>s__2;

			private bool <spawnGiantFather>5__3;

			private int <normalIndex>5__4;

			private int <giantIndex>5__5;

			private Vector3 <normalPos>5__6;

			private Vector3 <giantPos>5__7;

			private ManualLogSource <>s__8;

			private int <randomIndex>5__9;

			private Vector3 <spawnPos>5__10;

			private ManualLogSource <>s__11;

			private Exception <ex>5__12;

			private ManualLogSource <>s__13;

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

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

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

			[DebuggerHidden]
			void IDisposable.Dispose()
			{
				<>s__2 = null;
				<>s__8 = null;
				<>s__11 = null;
				<ex>5__12 = null;
				<>s__13 = null;
				<>1__state = -2;
			}

			private bool MoveNext()
			{
				//IL_0270: Unknown result type (might be due to invalid IL or missing references)
				//IL_0277: Expected O, but got Unknown
				//IL_003e: Unknown result type (might be due to invalid IL or missing references)
				//IL_0044: Expected O, but got Unknown
				//IL_02b8: Unknown result type (might be due to invalid IL or missing references)
				//IL_02c2: Expected O, but got Unknown
				//IL_006d: Unknown result type (might be due to invalid IL or missing references)
				//IL_0077: Expected O, but got Unknown
				//IL_01e2: 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)
				//IL_01ef: Unknown result type (might be due to invalid IL or missing references)
				//IL_020f: Unknown result type (might be due to invalid IL or missing references)
				//IL_0215: Expected O, but got Unknown
				//IL_010b: Unknown result type (might be due to invalid IL or missing references)
				//IL_0110: Unknown result type (might be due to invalid IL or missing references)
				//IL_0121: Unknown result type (might be due to invalid IL or missing references)
				//IL_0126: 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_0141: Unknown result type (might be due to invalid IL or missing references)
				//IL_0161: Unknown result type (might be due to invalid IL or missing references)
				//IL_0167: Expected O, but got Unknown
				bool flag = default(bool);
				switch (<>1__state)
				{
				default:
					return false;
				case 0:
				{
					<>1__state = -1;
					<>s__2 = PluginCore.LogSource;
					BepInExInfoLogInterpolatedStringHandler val = new BepInExInfoLogInterpolatedStringHandler(39, 0, ref flag);
					if (flag)
					{
						((BepInExLogInterpolatedStringHandler)val).AppendLiteral("  ⏳ Padres aparecerán en 15 segundos...");
					}
					<>s__2.LogInfo(val);
					<>s__2 = null;
					<>2__current = (object)new WaitForSeconds(15f);
					<>1__state = 1;
					return true;
				}
				case 1:
					<>1__state = -1;
					<timeSinceStart>5__1 = 0f;
					break;
				case 2:
					<>1__state = -1;
					<timeSinceStart>5__1 += 120f;
					break;
				}
				if (_fatherSpawnActive && (Object)(object)_boss != (Object)null && ((Agent)_boss).Alive)
				{
					try
					{
						<spawnGiantFather>5__3 = Mathf.FloorToInt(<timeSinceStart>5__1 / 120f) % 3 == 0;
						if (<spawnGiantFather>5__3)
						{
							<normalIndex>5__4 = Random.Range(0, _continuousSpawnPositions.Length);
							do
							{
								<giantIndex>5__5 = Random.Range(0, _continuousSpawnPositions.Length);
							}
							while (<giantIndex>5__5 == <normalIndex>5__4);
							<normalPos>5__6 = _continuousSpawnPositions[<normalIndex>5__4];
							<giantPos>5__7 = _continuousSpawnPositions[<giantIndex>5__5];
							SpawnFatherAtPosition(29u, <normalPos>5__6, "Padre Normal");
							SpawnFatherAtPosition(29u, <giantPos>5__7, "Padre Gigante");
							<>s__8 = PluginCore.LogSource;
							BepInExInfoLogInterpolatedStringHandler val = new BepInExInfoLogInterpolatedStringHandler(61, 2, ref flag);
							if (flag)
							{
								((BepInExLogInterpolatedStringHandler)val).AppendLiteral("  \ud83d\udc79\ud83d\udc79 Spawneados: Padre Normal (pos ");
								((BepInExLogInterpolatedStringHandler)val).AppendFormatted<int>(<normalIndex>5__4);
								((BepInExLogInterpolatedStringHandler)val).AppendLiteral(") + Padre Gigante (pos ");
								((BepInExLogInterpolatedStringHandler)val).AppendFormatted<int>(<giantIndex>5__5);
								((BepInExLogInterpolatedStringHandler)val).AppendLiteral(")");
							}
							<>s__8.LogInfo(val);
							<>s__8 = null;
						}
						else
						{
							<randomIndex>5__9 = Random.Range(0, _continuousSpawnPositions.Length);
							<spawnPos>5__10 = _continuousSpawnPositions[<randomIndex>5__9];
							SpawnFatherAtPosition(29u, <spawnPos>5__10, "Padre Normal");
							<>s__11 = PluginCore.LogSource;
							BepInExInfoLogInterpolatedStringHandler val = new BepInExInfoLogInterpolatedStringHandler(35, 1, ref flag);
							if (flag)
							{
								((BepInExLogInterpolatedStringHandler)val).AppendLiteral("  \ud83d\udc79 Spawneado: Padre Normal (pos ");
								((BepInExLogInterpolatedStringHandler)val).AppendFormatted<int>(<randomIndex>5__9);
								((BepInExLogInterpolatedStringHandler)val).AppendLiteral(")");
							}
							<>s__11.LogInfo(val);
							<>s__11 = null;
						}
					}
					catch (Exception ex)
					{
						<ex>5__12 = ex;
						<>s__13 = PluginCore.LogSource;
						BepInExErrorLogInterpolatedStringHandler val2 = new BepInExErrorLogInterpolatedStringHandler(29, 1, ref flag);
						if (flag)
						{
							((BepInExLogInterpolatedStringHandler)val2).AppendLiteral("  ❌ Error spawneando Padres: ");
							((BepInExLogInterpolatedStringHandler)val2).AppendFormatted<string>(<ex>5__12.Message);
						}
						<>s__13.LogError(val2);
						<>s__13 = null;
					}
					<>2__current = (object)new WaitForSeconds(120f);
					<>1__state = 2;
					return true;
				}
				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 <FlyerSpawner>d__89 : IEnumerator<object>, IEnumerator, IDisposable
		{
			private int <>1__state;

			private object <>2__current;

			private Vector3 <spawnPos>5__1;

			private List<AIG_CourseNode> <allNodes>5__2;

			private AIG_CourseNode <closestNode>5__3;

			private float <closestDistance>5__4;

			private Enumerator<AIG_CourseNode> <>s__5;

			private AIG_CourseNode <node>5__6;

			private float <distance>5__7;

			private EnemyAgent <flyer>5__8;

			private Exception <ex>5__9;

			private ManualLogSource <>s__10;

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

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

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

			[DebuggerHidden]
			void IDisposable.Dispose()
			{
				<allNodes>5__2 = null;
				<closestNode>5__3 = null;
				<>s__5 = null;
				<node>5__6 = null;
				<flyer>5__8 = null;
				<ex>5__9 = null;
				<>s__10 = null;
				<>1__state = -2;
			}

			private bool MoveNext()
			{
				//IL_01af: Unknown result type (might be due to invalid IL or missing references)
				//IL_01b6: Expected O, but got Unknown
				//IL_01f8: Unknown result type (might be due to invalid IL or missing references)
				//IL_0202: Expected O, but got Unknown
				//IL_003d: Unknown result type (might be due to invalid IL or missing references)
				//IL_0042: Unknown result type (might be due to invalid IL or missing references)
				//IL_00bb: Unknown result type (might be due to invalid IL or missing references)
				//IL_00c6: Unknown result type (might be due to invalid IL or missing references)
				//IL_013e: Unknown result type (might be due to invalid IL or missing references)
				//IL_0143: Unknown result type (might be due to invalid IL or missing references)
				switch (<>1__state)
				{
				default:
					return false;
				case 0:
					<>1__state = -1;
					break;
				case 1:
					<>1__state = -1;
					break;
				}
				if (_flyerSpawnActive && (Object)(object)_boss != (Object)null && ((Agent)_boss).Alive)
				{
					try
					{
						<spawnPos>5__1 = _flyerSpawnPositions[Random.Range(0, _flyerSpawnPositions.Length)];
						<allNodes>5__2 = AIG_CourseNode.s_allNodes;
						if (<allNodes>5__2 != null && <allNodes>5__2.Count > 0)
						{
							<closestNode>5__3 = null;
							<closestDistance>5__4 = float.MaxValue;
							<>s__5 = <allNodes>5__2.GetEnumerator();
							while (<>s__5.MoveNext())
							{
								<node>5__6 = <>s__5.Current;
								if (<node>5__6 != null)
								{
									<distance>5__7 = Vector3.Distance(<spawnPos>5__1, <node>5__6.Position);
									if (<distance>5__7 < <closestDistance>5__4)
									{
										<closestDistance>5__4 = <distance>5__7;
										<closestNode>5__3 = <node>5__6;
									}
								}
								<node>5__6 = null;
							}
							<>s__5 = null;
							if (<closestNode>5__3 != null)
							{
								<flyer>5__8 = EnemyAllocator.Current.SpawnEnemy(42u, <closestNode>5__3, (AgentMode)1, <spawnPos>5__1, Quaternion.identity, (EnemyGroup)null, -1);
								if ((Object)(object)<flyer>5__8 != (Object)null)
								{
									((Component)<flyer>5__8).gameObject.SetActive(true);
								}
								<flyer>5__8 = null;
							}
							<closestNode>5__3 = null;
						}
						<allNodes>5__2 = null;
					}
					catch (Exception ex)
					{
						<ex>5__9 = ex;
						<>s__10 = PluginCore.LogSource;
						bool flag = default(bool);
						BepInExErrorLogInterpolatedStringHandler val = new BepInExErrorLogInterpolatedStringHandler(28, 1, ref flag);
						if (flag)
						{
							((BepInExLogInterpolatedStringHandler)val).AppendLiteral("  ❌ Error spawneando Flyer: ");
							((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>(<ex>5__9.Message);
						}
						<>s__10.LogError(val);
						<>s__10 = null;
					}
					<>2__current = (object)new WaitForSeconds(5f);
					<>1__state = 1;
					return true;
				}
				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 <HybridSpawner>d__88 : IEnumerator<object>, IEnumerator, IDisposable
		{
			private int <>1__state;

			private object <>2__current;

			private Vector3[] <>s__1;

			private int <>s__2;

			private Vector3 <spawnPos>5__3;

			private List<AIG_CourseNode> <allNodes>5__4;

			private AIG_CourseNode <closestNode>5__5;

			private float <closestDistance>5__6;

			private EnemyAgent <hybrid>5__7;

			private Enumerator<AIG_CourseNode> <>s__8;

			private AIG_CourseNode <node>5__9;

			private float <distance>5__10;

			private Exception <ex>5__11;

			private ManualLogSource <>s__12;

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

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

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

			[DebuggerHidden]
			void IDisposable.Dispose()
			{
				<>s__1 = null;
				<allNodes>5__4 = null;
				<closestNode>5__5 = null;
				<hybrid>5__7 = null;
				<>s__8 = null;
				<node>5__9 = null;
				<ex>5__11 = null;
				<>s__12 = null;
				<>1__state = -2;
			}

			private bool MoveNext()
			{
				//IL_01c5: Unknown result type (might be due to invalid IL or missing references)
				//IL_01cc: Expected O, but got Unknown
				//IL_004e: Unknown result type (might be due to invalid IL or missing references)
				//IL_0053: Unknown result type (might be due to invalid IL or missing references)
				//IL_0237: Unknown result type (might be due to invalid IL or missing references)
				//IL_0241: Expected O, but got Unknown
				//IL_00cf: Unknown result type (might be due to invalid IL or missing references)
				//IL_00da: Unknown result type (might be due to invalid IL or missing references)
				//IL_0156: Unknown result type (might be due to invalid IL or missing references)
				//IL_015b: Unknown result type (might be due to invalid IL or missing references)
				switch (<>1__state)
				{
				default:
					return false;
				case 0:
					<>1__state = -1;
					break;
				case 1:
					<>1__state = -1;
					break;
				}
				if (_hybridSpawnActive && (Object)(object)_boss != (Object)null && ((Agent)_boss).Alive)
				{
					<>s__1 = _hybridSpawnPositions;
					bool flag = default(bool);
					for (<>s__2 = 0; <>s__2 < <>s__1.Length; <>s__2++)
					{
						<spawnPos>5__3 = <>s__1[<>s__2];
						try
						{
							<allNodes>5__4 = AIG_CourseNode.s_allNodes;
							if (<allNodes>5__4 != null && <allNodes>5__4.Count != 0)
							{
								<closestNode>5__5 = null;
								<closestDistance>5__6 = float.MaxValue;
								<>s__8 = <allNodes>5__4.GetEnumerator();
								while (<>s__8.MoveNext())
								{
									<node>5__9 = <>s__8.Current;
									if (<node>5__9 != null)
									{
										<distance>5__10 = Vector3.Distance(<spawnPos>5__3, <node>5__9.Position);
										if (<distance>5__10 < <closestDistance>5__6)
										{
											<closestDistance>5__6 = <distance>5__10;
											<closestNode>5__5 = <node>5__9;
										}
									}
									<node>5__9 = null;
								}
								<>s__8 = null;
								if (<closestNode>5__5 != null)
								{
									<hybrid>5__7 = EnemyAllocator.Current.SpawnEnemy(33u, <closestNode>5__5, (AgentMode)1, <spawnPos>5__3, Quaternion.identity, (EnemyGroup)null, -1);
									if ((Object)(object)<hybrid>5__7 != (Object)null)
									{
										((Component)<hybrid>5__7).gameObject.SetActive(true);
									}
									<allNodes>5__4 = null;
									<closestNode>5__5 = null;
									<hybrid>5__7 = null;
								}
							}
						}
						catch (Exception ex)
						{
							<ex>5__11 = ex;
							<>s__12 = PluginCore.LogSource;
							BepInExErrorLogInterpolatedStringHandler val = new BepInExErrorLogInterpolatedStringHandler(30, 1, ref flag);
							if (flag)
							{
								((BepInExLogInterpolatedStringHandler)val).AppendLiteral("  ❌ Error spawneando híbrida: ");
								((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>(<ex>5__11.Message);
							}
							<>s__12.LogError(val);
							<>s__12 = null;
						}
					}
					<>s__1 = null;
					<>2__current = (object)new WaitForSeconds(10f);
					<>1__state = 1;
					return true;
				}
				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 <OpenDoorsAfterDelay>d__85 : IEnumerator<object>, IEnumerator, IDisposable
		{
			private int <>1__state;

			private object <>2__current;

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

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

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

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

			private bool MoveNext()
			{
				//IL_0031: Unknown result type (might be due to invalid IL or missing references)
				//IL_003b: Expected O, but got Unknown
				//IL_0057: Unknown result type (might be due to invalid IL or missing references)
				//IL_0061: Expected O, but got Unknown
				switch (<>1__state)
				{
				default:
					return false;
				case 0:
					<>1__state = -1;
					<>2__current = (object)new WaitForSeconds(1f);
					<>1__state = 1;
					return true;
				case 1:
					<>1__state = -1;
					OpenZones3And4();
					<>2__current = (object)new WaitForSeconds(9f);
					<>1__state = 2;
					return true;
				case 2:
					<>1__state = -1;
					StartHybridSpawning();
					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 <SpawnGiantScanAfterDelay>d__80 : IEnumerator<object>, IEnumerator, IDisposable
		{
			private int <>1__state;

			private object <>2__current;

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

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

			[DebuggerHidden]
			public <SpawnGiantScanAfterDelay>d__80(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(30f);
					<>1__state = 1;
					return true;
				case 1:
					<>1__state = -1;
					SpawnGiantScan();
					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 <SpawnScansAfterDelay>d__79 : IEnumerator<object>, IEnumerator, IDisposable
		{
			private int <>1__state;

			private object <>2__current;

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

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

			[DebuggerHidden]
			public <SpawnScansAfterDelay>d__79(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(30f);
					<>1__state = 1;
					return true;
				case 1:
					<>1__state = -1;
					SpawnScans();
					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 <SpawnScoutsManually>d__99 : IEnumerator<object>, IEnumerator, IDisposable
		{
			private int <>1__state;

			private object <>2__current;

			public AIG_CourseNode node;

			public Vector3[] positions;

			private int <scoutsToSpawn>5__1;

			private int <i>5__2;

			private Vector3 <spawnPos>5__3;

			private EnemyAgent <scout>5__4;

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

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

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

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

			private bool MoveNext()
			{
				//IL_00c3: Unknown result type (might be due to invalid IL or missing references)
				//IL_00cd: Expected O, but got Unknown
				//IL_0045: Unknown result type (might be due to invalid IL or missing references)
				//IL_004a: Unknown result type (might be due to invalid IL or missing references)
				//IL_005f: Unknown result type (might be due to invalid IL or missing references)
				//IL_0064: Unknown result type (might be due to invalid IL or missing references)
				int num = <>1__state;
				if (num != 0)
				{
					if (num != 1)
					{
						return false;
					}
					<>1__state = -1;
					goto IL_00de;
				}
				<>1__state = -1;
				<scoutsToSpawn>5__1 = 8;
				<i>5__2 = 0;
				goto IL_00ef;
				IL_00de:
				<i>5__2++;
				goto IL_00ef;
				IL_00ef:
				if (<i>5__2 < <scoutsToSpawn>5__1)
				{
					try
					{
						<spawnPos>5__3 = positions[<i>5__2];
						<scout>5__4 = EnemyAllocator.Current.SpawnEnemy(56u, node, (AgentMode)1, <spawnPos>5__3, Quaternion.identity, (EnemyGroup)null, -1);
						if ((Object)(object)<scout>5__4 != (Object)null)
						{
							((Component)<scout>5__4).gameObject.SetActive(true);
						}
						<scout>5__4 = null;
					}
					catch
					{
					}
					if (<i>5__2 < <scoutsToSpawn>5__1 - 1)
					{
						<>2__current = (object)new WaitForSeconds(0.3f);
						<>1__state = 1;
						return true;
					}
					goto IL_00de;
				}
				return false;
			}

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

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

		private static EnemyAgent _boss = null;

		private static int _currentPhase = 0;

		private static Vector3 _originalGravity;

		private const int BOSS_ID = 67;

		private const float MAX_HEALTH = 10000f;

		private const float PHASE_1_HP = 6667f;

		private const float PHASE_2_HP = 3333f;

		private const float ZONE_2_OPEN_HP = 5000f;

		private const float WEAKSPOT_RESPAWN_TIME = 60f;

		private const int TOTAL_WEAKSPOTS = 7;

		private const int SCOUT_ENEMY_ID = 56;

		private const int SCOUTS_REQUIRED = 16;

		private const float SCOUT_SPAWN_DELAY = 30f;

		private static bool _zone2Opened = false;

		private static MechanicType _currentMechanic = MechanicType.GroupScans;

		private static bool _nextGiantScanIsLeft = true;

		private static ChainedPuzzleInstance _activeGiantScan = null;

		private static readonly Vector3[] _scoutSpawnPositions = (Vector3[])(object)new Vector3[8]
		{
			new Vector3(0.11968851f, 170.06915f, 330.213f),
			new Vector3(-7.335599f, 155.03537f, 330.14874f),
			new Vector3(-9.131945f, 169.94121f, 318.85184f),
			new Vector3(-7.386483f, 155.03784f, 308.2846f),
			new Vector3(0.10566522f, 170.04956f, 308.2671f),
			new Vector3(7.611785f, 155.03795f, 308.27643f),
			new Vector3(7.8927407f, 170.15157f, 318.81732f),
			new Vector3(7.70096f, 155.01633f, 330.1941f)
		};

		private static readonly Vector3[] _scanPositions = (Vector3[])(object)new Vector3[4]
		{
			new Vector3(0.095335364f, 155.00531f, 341.9195f),
			new Vector3(0.212637f, 155.12523f, 299.49402f),
			new Vector3(-18.768436f, 160.07f, 319.9014f),
			new Vector3(18.303532f, 160.07002f, 319.76123f)
		};

		private static readonly Vector3[] _hybridSpawnPositions = (Vector3[])(object)new Vector3[2]
		{
			new Vector3(40.220657f, 160.04204f, 320.4059f),
			new Vector3(-43.179462f, 160.02197f, 319.83096f)
		};

		private const uint HYBRID_ID = 33u;

		private const float HYBRID_SPAWN_INTERVAL = 10f;

		private static bool _hybridSpawnActive = false;

		private static int _scansCompleted = 0;

		private const int SCANS_REQUIRED = 4;

		private const int INSTANCES_PER_POSITION = 4;

		private static List<List<ChainedPuzzleInstance>> _preCreatedScans = new List<List<ChainedPuzzleInstance>>();

		private static List<ChainedPuzzleInstance> _activeScans = new List<ChainedPuzzleInstance>();

		private static int[] _usedInstancesPerPosition = new int[4];

		private static List<ChainedPuzzleInstance> _preCreatedGiantScansLeft = new List<ChainedPuzzleInstance>();

		private static List<ChainedPuzzleInstance> _preCreatedGiantScansRight = new List<ChainedPuzzleInstance>();

		private static int _usedGiantScansLeft = 0;

		private static int _usedGiantScansRight = 0;

		private const int GIANT_SCAN_INSTANCES = 2;

		private static readonly Vector3[] _continuousSpawnPositions = (Vector3[])(object)new Vector3[3]
		{
			new Vector3(24.594513f, 145.12f, 319.79858f),
			new Vector3(-25.62083f, 145.12f, 319.98962f),
			new Vector3(0.30550456f, 160.10101f, 342.73056f)
		};

		private const uint FLYER_ID = 42u;

		private const int FLYERS_PER_WAVE = 3;

		private const float FLYER_SPAWN_INTERVAL = 5f;

		private const float FLYER_SPREAD_DISTANCE = 1f;

		private static bool _flyerSpawnActive = false;

		private static readonly Vector3[] _flyerSpawnPositions = (Vector3[])(object)new Vector3[3]
		{
			new Vector3(0.3f, 165f, 320f),
			new Vector3(15f, 165f, 325f),
			new Vector3(-15f, 165f, 325f)
		};

		private const uint FATHER_ID = 29u;

		private const uint GIANT_FATHER_ID = 29u;

		private const float FATHER_SPAWN_INTERVAL = 120f;

		private const float GIANT_FATHER_SPAWN_INTERVAL = 120f;

		private const float FATHER_INITIAL_DELAY = 15f;

		private static bool _fatherSpawnActive = false;

		private const uint STRIKER_ID = 31u;

		private const uint CHARGER_ID = 30u;

		private const uint BIG_CHARGER_ID = 39u;

		private const float SPAWN_INTERVAL = 4f;

		private static bool _continuousSpawnActive = false;

		private static bool _waitingForScoutKills = false;

		private static int _scoutsKilled = 0;

		private static float _scoutSpawnTime = 0f;

		private static int _activeWeakspots = 0;

		private static int _destroyedWeakspotsTotal = 0;

		private static Queue<float> _weakspotRespawnQueue = new Queue<float>();

		private static List<int> _availableWeakspotIndices = new List<int>();

		private static List<int> _inactiveWeakspotIndices = new List<int>();

		private static HashSet<int> _destroyedWeakspotIndices = new HashSet<int>();

		private static Random _random = new Random();

		private static bool _isInitialized = false;

		public static EnemyAgent Boss => _boss;

		public static int CurrentPhase => _currentPhase;

		public static int ActiveWeakspots => _activeWeakspots;

		public static void RegisterBoss(EnemyAgent enemy)
		{
			//IL_0054: Unknown result type (might be due to invalid IL or missing references)
			//IL_0059: Unknown result type (might be due to invalid IL or missing references)
			if (enemy != null && ((GameDataBlockBase<EnemyDataBlock>)(object)enemy.EnemyData)?.persistentID == 67)
			{
				_boss = enemy;
				_currentPhase = 0;
				_originalGravity = Physics.gravity;
				_activeWeakspots = 1;
				_destroyedWeakspotsTotal = 0;
				_weakspotRespawnQueue.Clear();
				_availableWeakspotIndices.Clear();
				_inactiveWeakspotIndices.Clear();
				_destroyedWeakspotIndices.Clear();
				_waitingForScoutKills = false;
				_scoutsKilled = 0;
				_scoutSpawnTime = 0f;
				_zone2Opened = false;
				_currentMechanic = MechanicType.GroupScans;
				_nextGiantScanIsLeft = Random.value > 0.5f;
				SetupWeakspots();
				if (!_isInitialized)
				{
					BossNetworkManager.OnStateReceived = (Action<BossNetworkManager.BossState>)Delegate.Combine(BossNetworkManager.OnStateReceived, new Action<BossNetworkManager.BossState>(OnNetworkStateReceived));
					_isInitialized = true;
				}
			}
		}

		private static void SetupWeakspots()
		{
			//IL_02e8: Unknown result type (might be due to invalid IL or missing references)
			//IL_02ef: Expected O, but got Unknown
			//IL_0055: Unknown result type (might be due to invalid IL or missing references)
			//IL_005c: Expected O, but got Unknown
			//IL_0140: Unknown result type (might be due to invalid IL or missing references)
			//IL_0147: Expected O, but got Unknown
			//IL_00b2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b9: Expected O, but got Unknown
			//IL_00fc: Unknown result type (might be due to invalid IL or missing references)
			//IL_0102: Invalid comparison between Unknown and I4
			//IL_00e5: Unknown result type (might be due to invalid IL or missing references)
			//IL_0194: Unknown result type (might be due to invalid IL or missing references)
			//IL_019b: Expected O, but got Unknown
			//IL_02b2: Unknown result type (might be due to invalid IL or missing references)
			//IL_02b9: Expected O, but got Unknown
			//IL_0258: Unknown result type (might be due to invalid IL or missing references)
			//IL_025f: Expected O, but got Unknown
			EnemyAgent boss = _boss;
			if ((Object)(object)((boss != null) ? boss.Damage : null) == (Object)null)
			{
				return;
			}
			bool flag = default(bool);
			try
			{
				Il2CppReferenceArray<Dam_EnemyDamageLimb> damageLimbs = _boss.Damage.DamageLimbs;
				if (damageLimbs == null || ((Il2CppArrayBase<Dam_EnemyDamageLimb>)(object)damageLimbs).Count <= 0)
				{
					return;
				}
				ManualLogSource logSource = PluginCore.LogSource;
				BepInExInfoLogInterpolatedStringHandler val = new BepInExInfoLogInterpolatedStringHandler(23, 1, ref flag);
				if (flag)
				{
					((BepInExLogInterpolatedStringHandler)val).AppendLiteral("  \ud83d\udcca Limbs detectados: ");
					((BepInExLogInterpolatedStringHandler)val).AppendFormatted<int>(((Il2CppArrayBase<Dam_EnemyDamageLimb>)(object)damageLimbs).Count);
				}
				logSource.LogInfo(val);
				for (int i = 0; i < ((Il2CppArrayBase<Dam_EnemyDamageLimb>)(object)damageLimbs).Count; i++)
				{
					Dam_EnemyDamageLimb val2 = ((Il2CppArrayBase<Dam_EnemyDamageLimb>)(object)damageLimbs)[i];
					if ((Object)(object)val2 != (Object)null)
					{
						ManualLogSource logSource2 = PluginCore.LogSource;
						val = new BepInExInfoLogInterpolatedStringHandler(13, 2, ref flag);
						if (flag)
						{
							((BepInExLogInterpolatedStringHandler)val).AppendLiteral("    Limb [");
							((BepInExLogInterpolatedStringHandler)val).AppendFormatted<int>(i);
							((BepInExLogInterpolatedStringHandler)val).AppendLiteral("]: ");
							((BepInExLogInterpolatedStringHandler)val).AppendFormatted<eLimbDamageType>(val2.m_type);
						}
						logSource2.LogInfo(val);
						if ((int)val2.m_type == 1)
						{
							_availableWeakspotIndices.Add(i);
						}
					}
				}
				ManualLogSource logSource3 = PluginCore.LogSource;
				val = new BepInExInfoLogInterpolatedStringHandler(34, 1, ref flag);
				if (flag)
				{
					((BepInExLogInterpolatedStringHandler)val).AppendLiteral("  ✅ Weakspots reales encontrados: ");
					((BepInExLogInterpolatedStringHandler)val).AppendFormatted<int>(_availableWeakspotIndices.Count);
				}
				logSource3.LogInfo(val);
				if (_availableWeakspotIndices.Count == 0)
				{
					ManualLogSource logSource4 = PluginCore.LogSource;
					BepInExWarningLogInterpolatedStringHandler val3 = new BepInExWarningLogInterpolatedStringHandler(44, 0, ref flag);
					if (flag)
					{
						((BepInExLogInterpolatedStringHandler)val3).AppendLiteral("  ⚠\ufe0f No se encontraron weakspots en el jefe!");
					}
					logSource4.LogWarning(val3);
					return;
				}
				foreach (int availableWeakspotIndex in _availableWeakspotIndices)
				{
					DeactivateWeakspot(availableWeakspotIndex);
					_inactiveWeakspotIndices.Add(availableWeakspotIndex);
				}
				if (SNet.IsMaster)
				{
					int index = _random.Next(_inactiveWeakspotIndices.Count);
					int num = _inactiveWeakspotIndices[index];
					_inactiveWeakspotIndices.RemoveAt(index);
					ActivateWeakspot(num);
					ManualLogSource logSource5 = PluginCore.LogSource;
					val = new BepInExInfoLogInterpolatedStringHandler(43, 1, ref flag);
					if (flag)
					{
						((BepInExLogInterpolatedStringHandler)val).AppendLiteral("  \ud83c\udfaf [MASTER] Weakspot inicial activado: [");
						((BepInExLogInterpolatedStringHandler)val).AppendFormatted<int>(num);
						((BepInExLogInterpolatedStringHandler)val).AppendLiteral("]");
					}
					logSource5.LogInfo(val);
					CoroutineManager.StartCoroutine(CollectionExtensions.WrapToIl2Cpp(DelayedInitialSync()), (Action)null);
				}
				else
				{
					ManualLogSource logSource6 = PluginCore.LogSource;
					val = new BepInExInfoLogInterpolatedStringHandler(44, 0, ref flag);
					if (flag)
					{
						((BepInExLogInterpolatedStringHandler)val).AppendLiteral("  ⏳ [CLIENTE] Esperando estado del Master...");
					}
					logSource6.LogInfo(val);
				}
			}
			catch (Exception ex)
			{
				ManualLogSource logSource7 = PluginCore.LogSource;
				BepInExErrorLogInterpolatedStringHandler val4 = new BepInExErrorLogInterpolatedStringHandler(38, 1, ref flag);
				if (flag)
				{
					((BepInExLogInterpolatedStringHandler)val4).AppendLiteral("[BossSystem] Error en SetupWeakspots: ");
					((BepInExLogInterpolatedStringHandler)val4).AppendFormatted<string>(ex.Message);
				}
				logSource7.LogError(val4);
			}
		}

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

		private static void SyncStateToClients()
		{
			if (!SNet.IsMaster)
			{
				return;
			}
			int activeWeakspotIndex = -1;
			foreach (int availableWeakspotIndex in _availableWeakspotIndices)
			{
				if (!_inactiveWeakspotIndices.Contains(availableWeakspotIndex) && !_destroyedWeakspotIndices.Contains(availableWeakspotIndex))
				{
					activeWeakspotIndex = availableWeakspotIndex;
					break;
				}
			}
			BossNetworkManager.BossState bossState = default(BossNetworkManager.BossState);
			bossState.ActiveWeakspotIndex = activeWeakspotIndex;
			bossState.DestroyedWeakspotsTotal = _destroyedWeakspotsTotal;
			bossState.CurrentPhase = _currentPhase;
			bossState.ScoutsKilled = _scoutsKilled;
			bossState.ScansCompleted = _scansCompleted;
			bossState.CurrentMechanic = (byte)_currentMechanic;
			bossState.NextGiantScanIsLeft = _nextGiantScanIsLeft;
			bossState.Zone2Opened = _zone2Opened;
			BossNetworkManager.BossState state = bossState;
			BossNetworkManager.SendBossState(state);
		}

		private static void OnNetworkStateReceived(BossNetworkManager.BossState state)
		{
			//IL_002b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0031: Expected O, but got Unknown
			//IL_0112: Unknown result type (might be due to invalid IL or missing references)
			//IL_0118: Expected O, but got Unknown
			if (SNet.IsMaster)
			{
				PluginCore.LogSource.LogWarning((object)"[BossNet] Master recibió estado (ignorando)");
				return;
			}
			ManualLogSource logSource = PluginCore.LogSource;
			bool flag = default(bool);
			BepInExInfoLogInterpolatedStringHandler val = new BepInExInfoLogInterpolatedStringHandler(49, 1, ref flag);
			if (flag)
			{
				((BepInExLogInterpolatedStringHandler)val).AppendLiteral("[BossNet] \ud83d\udce5 Aplicando estado recibido: Weakspot=");
				((BepInExLogInterpolatedStringHandler)val).AppendFormatted<int>(state.ActiveWeakspotIndex);
			}
			logSource.LogInfo(val);
			_destroyedWeakspotsTotal = state.DestroyedWeakspotsTotal;
			_currentPhase = state.CurrentPhase;
			_scoutsKilled = state.ScoutsKilled;
			_scansCompleted = state.ScansCompleted;
			_currentMechanic = (MechanicType)state.CurrentMechanic;
			_nextGiantScanIsLeft = state.NextGiantScanIsLeft;
			_zone2Opened = state.Zone2Opened;
			if (state.ActiveWeakspotIndex >= 0)
			{
				foreach (int availableWeakspotIndex in _availableWeakspotIndices)
				{
					DeactivateWeakspot(availableWeakspotIndex);
				}
				ActivateWeakspot(state.ActiveWeakspotIndex);
				_activeWeakspots = 1;
				ManualLogSource logSource2 = PluginCore.LogSource;
				val = new BepInExInfoLogInterpolatedStringHandler(35, 1, ref flag);
				if (flag)
				{
					((BepInExLogInterpolatedStringHandler)val).AppendLiteral("  ✅ Weakspot [");
					((BepInExLogInterpolatedStringHandler)val).AppendFormatted<int>(state.ActiveWeakspotIndex);
					((BepInExLogInterpolatedStringHandler)val).AppendLiteral("] activado en cliente");
				}
				logSource2.LogInfo(val);
			}
			else
			{
				_activeWeakspots = 0;
			}
		}

		public static void OnScoutKilledFromClient()
		{
			//IL_0029: Unknown result type (might be due to invalid IL or missing references)
			//IL_002f: Expected O, but got Unknown
			if (SNet.IsMaster)
			{
				_scoutsKilled++;
				ManualLogSource logSource = PluginCore.LogSource;
				bool flag = default(bool);
				BepInExInfoLogInterpolatedStringHandler val = new BepInExInfoLogInterpolatedStringHandler(34, 2, ref flag);
				if (flag)
				{
					((BepInExLogInterpolatedStringHandler)val).AppendLiteral("[BossNet] \ud83d\udce5 Scout kill report (");
					((BepInExLogInterpolatedStringHandler)val).AppendFormatted<int>(_scoutsKilled);
					((BepInExLogInterpolatedStringHandler)val).AppendLiteral("/");
					((BepInExLogInterpolatedStringHandler)val).AppendFormatted<int>(16);
					((BepInExLogInterpolatedStringHandler)val).AppendLiteral(")");
				}
				logSource.LogInfo(val);
				if (_scoutsKilled >= 16)
				{
					CheckScoutKillProgress();
				}
				SyncStateToClients();
			}
		}

		public static void OnScanCompletedFromClient()
		{
			//IL_0026: Unknown result type (might be due to invalid IL or missing references)
			//IL_002c: Expected O, but got Unknown
			if (SNet.IsMaster)
			{
				_scansCompleted++;
				ManualLogSource logSource = PluginCore.LogSource;
				bool flag = default(bool);
				BepInExInfoLogInterpolatedStringHandler val = new BepInExInfoLogInterpolatedStringHandler(37, 2, ref flag);
				if (flag)
				{
					((BepInExLogInterpolatedStringHandler)val).AppendLiteral("[BossNet] \ud83d\udce5 Scan complete report (");
					((BepInExLogInterpolatedStringHandler)val).AppendFormatted<int>(_scansCompleted);
					((BepInExLogInterpolatedStringHandler)val).AppendLiteral("/");
					((BepInExLogInterpolatedStringHandler)val).AppendFormatted<int>(_activeScans.Count);
					((BepInExLogInterpolatedStringHandler)val).AppendLiteral(")");
				}
				logSource.LogInfo(val);
				OnScanCompleted();
				SyncStateToClients();
			}
		}

		private static void DeactivateWeakspot(int index)
		{
			//IL_0042: Unknown result type (might be due to invalid IL or missing references)
			//IL_0049: Expected O, but got Unknown
			try
			{
				Dam_EnemyDamageLimb val = ((Il2CppArrayBase<Dam_EnemyDamageLimb>)(object)_boss.Damage.DamageLimbs)[index];
				if ((Object)(object)val != (Object)null)
				{
					((Component)val).gameObject.SetActive(false);
				}
			}
			catch (Exception ex)
			{
				ManualLogSource logSource = PluginCore.LogSource;
				bool flag = default(bool);
				BepInExErrorLogInterpolatedStringHandler val2 = new BepInExErrorLogInterpolatedStringHandler(44, 2, ref flag);
				if (flag)
				{
					((BepInExLogInterpolatedStringHandler)val2).AppendLiteral("[BossSystem] Error al desactivar weakspot ");
					((BepInExLogInterpolatedStringHandler)val2).AppendFormatted<int>(index);
					((BepInExLogInterpolatedStringHandler)val2).AppendLiteral(": ");
					((BepInExLogInterpolatedStringHandler)val2).AppendFormatted<string>(ex.Message);
				}
				logSource.LogError(val2);
			}
		}

		private static void ActivateWeakspot(int index)
		{
			//IL_0081: Unknown result type (might be due to invalid IL or missing references)
			//IL_0088: Expected O, but got Unknown
			//IL_003c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0042: Expected O, but got Unknown
			bool flag = default(bool);
			try
			{
				Dam_EnemyDamageLimb val = ((Il2CppArrayBase<Dam_EnemyDamageLimb>)(object)_boss.Damage.DamageLimbs)[index];
				if ((Object)(object)val != (Object)null)
				{
					((Component)val).gameObject.SetActive(true);
					ManualLogSource logSource = PluginCore.LogSource;
					BepInExInfoLogInterpolatedStringHandler val2 = new BepInExInfoLogInterpolatedStringHandler(24, 1, ref flag);
					if (flag)
					{
						((BepInExLogInterpolatedStringHandler)val2).AppendLiteral("  ✅ Weakspot [");
						((BepInExLogInterpolatedStringHandler)val2).AppendFormatted<int>(index);
						((BepInExLogInterpolatedStringHandler)val2).AppendLiteral("] activado");
					}
					logSource.LogInfo(val2);
				}
			}
			catch (Exception ex)
			{
				ManualLogSource logSource2 = PluginCore.LogSource;
				BepInExErrorLogInterpolatedStringHandler val3 = new BepInExErrorLogInterpolatedStringHandler(41, 2, ref flag);
				if (flag)
				{
					((BepInExLogInterpolatedStringHandler)val3).AppendLiteral("[BossSystem] Error al activar weakspot ");
					((BepInExLogInterpolatedStringHandler)val3).AppendFormatted<int>(index);
					((BepInExLogInterpolatedStringHandler)val3).AppendLiteral(": ");
					((BepInExLogInterpolatedStringHandler)val3).AppendFormatted<string>(ex.Message);
				}
				logSource2.LogError(val3);
			}
		}

		public static void Update()
		{
			//IL_004a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0050: Invalid comparison between Unknown and I4
			//IL_007f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0089: Expected O, but got Unknown
			//IL_0095: Unknown result type (might be due to invalid IL or missing references)
			//IL_009c: Expected O, but got Unknown
			//IL_00be: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c8: Expected O, but got Unknown
			//IL_00ed: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f3: Invalid comparison between Unknown and I4
			//IL_0127: Unknown result type (might be due to invalid IL or missing references)
			//IL_012e: Expected O, but got Unknown
			//IL_0151: Unknown result type (might be due to invalid IL or missing references)
			//IL_015b: Expected O, but got Unknown
			//IL_0180: Unknown result type (might be due to invalid IL or missing references)
			//IL_0186: Invalid comparison between Unknown and I4
			//IL_01ba: Unknown result type (might be due to invalid IL or missing references)
			//IL_01c1: Expected O, but got Unknown
			//IL_01e4: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ee: Expected O, but got Unknown
			if ((Object)(object)_boss == (Object)null || !((Agent)_boss).Alive)
			{
				return;
			}
			bool flag = default(bool);
			if (!_continuousSpawnActive && (Object)(object)_boss.AI != (Object)null && (int)((AgentAI)_boss.AI).Mode == 1 && SNet.IsMaster)
			{
				_continuousSpawnActive = true;
				CoroutineManager.StartCoroutine(CollectionExtensions.WrapToIl2Cpp(ContinuousEnemySpawner()), (Action)null);
				PluginCore.LogSource.LogInfo(new BepInExInfoLogInterpolatedStringHandler(0, 0, ref flag));
				ManualLogSource logSource = PluginCore.LogSource;
				BepInExInfoLogInterpolatedStringHandler val = new BepInExInfoLogInterpolatedStringHandler(56, 0, ref flag);
				if (flag)
				{
					((BepInExLogInterpolatedStringHandler)val).AppendLiteral("  \ud83d\udd04 ¡JEFE DESPIERTO! Sistema de spawn continuo iniciado");
				}
				logSource.LogInfo(val);
				PluginCore.LogSource.LogInfo(new BepInExInfoLogInterpolatedStringHandler(0, 0, ref flag));
			}
			if (!_flyerSpawnActive && (Object)(object)_boss.AI != (Object)null && (int)((AgentAI)_boss.AI).Mode == 1 && SNet.IsMaster)
			{
				_flyerSpawnActive = true;
				CoroutineManager.StartCoroutine(CollectionExtensions.WrapToIl2Cpp(FlyerSpawner()), (Action)null);
				ManualLogSource logSource2 = PluginCore.LogSource;
				BepInExInfoLogInterpolatedStringHandler val = new BepInExInfoLogInterpolatedStringHandler(40, 0, ref flag);
				if (flag)
				{
					((BepInExLogInterpolatedStringHandler)val).AppendLiteral("  \ud83e\udd85 Sistema de spawn de Flyers iniciado");
				}
				logSource2.LogInfo(val);
				PluginCore.LogSource.LogInfo(new BepInExInfoLogInterpolatedStringHandler(0, 0, ref flag));
			}
			if (!_fatherSpawnActive && (Object)(object)_boss.AI != (Object)null && (int)((AgentAI)_boss.AI).Mode == 1 && SNet.IsMaster)
			{
				_fatherSpawnActive = true;
				CoroutineManager.StartCoroutine(CollectionExtensions.WrapToIl2Cpp(FatherSpawner()), (Action)null);
				ManualLogSource logSource3 = PluginCore.LogSource;
				BepInExInfoLogInterpolatedStringHandler val = new BepInExInfoLogInterpolatedStringHandler(52, 0, ref flag);
				if (flag)
				{
					((BepInExLogInterpolatedStringHandler)val).AppendLiteral("  \ud83d\udc79 Sistema de spawn de Padres iniciado (delay 15s)");
				}
				logSource3.LogInfo(val);
				PluginCore.LogSource.LogInfo(new BepInExInfoLogInterpolatedStringHandler(0, 0, ref flag));
			}
			UpdatePhase();
			UpdateWeakspotRespawn();
			CheckZone2Opening();
		}

		private static void CheckZone2Opening()
		{
			if (_zone2Opened)
			{
				return;
			}
			float health = ((Dam_SyncedDamageBase)_boss.Damage).Health;
			if (health <= 5000f)
			{
				_zone2Opened = true;
				OpenZone2();
				if (SNet.IsMaster)
				{
					SyncStateToClients();
				}
			}
		}

		private static void OpenZone2()
		{
			//IL_000a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0014: Expected O, but got Unknown
			//IL_0020: Unknown result type (might be due to invalid IL or missing references)
			//IL_0026: Expected O, but got Unknown
			//IL_0133: Unknown result type (might be due to invalid IL or missing references)
			//IL_013a: Expected O, but got Unknown
			//IL_0048: Unknown result type (might be due to invalid IL or missing references)
			//IL_004e: Expected O, but got Unknown
			//IL_0071: Unknown result type (might be due to invalid IL or missing references)
			//IL_0077: Expected O, but got Unknown
			//IL_0098: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a2: Expected O, but got Unknown
			//IL_00a4: 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_00b1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b9: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c9: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e3: Expected O, but got Unknown
			//IL_00ef: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f5: Expected O, but got Unknown
			//IL_0116: Unknown result type (might be due to invalid IL or missing references)
			//IL_0120: Expected O, but got Unknown
			bool flag = default(bool);
			PluginCore.LogSource.LogInfo(new BepInExInfoLogInterpolatedStringHandler(0, 0, ref flag));
			ManualLogSource logSource = PluginCore.LogSource;
			BepInExInfoLogInterpolatedStringHandler val = new BepInExInfoLogInterpolatedStringHandler(42, 0, ref flag);
			if (flag)
			{
				((BepInExLogInterpolatedStringHandler)val).AppendLiteral("╔════════════════════════════════════════╗");
			}
			logSource.LogInfo(val);
			ManualLogSource logSource2 = PluginCore.LogSource;
			val = new BepInExInfoLogInterpolatedStringHandler(41, 0, ref flag);
			if (flag)
			{
				((BepInExLogInterpolatedStringHandler)val).AppendLiteral("║      \ud83d\udeaa ABRIENDO ZONA 2 (50% HP)      ║");
			}
			logSource2.LogInfo(val);
			ManualLogSource logSource3 = PluginCore.LogSource;
			val = new BepInExInfoLogInterpolatedStringHandler(42, 0, ref flag);
			if (flag)
			{
				((BepInExLogInterpolatedStringHandler)val).AppendLiteral("╚════════════════════════════════════════╝");
			}
			logSource3.LogInfo(val);
			PluginCore.LogSource.LogInfo(new BepInExInfoLogInterpolatedStringHandler(0, 0, ref flag));
			try
			{
				WardenObjectiveEventData val2 = new WardenObjectiveEventData
				{
					Type = (eWardenObjectiveEventType)1,
					Layer = (LG_LayerType)0,
					DimensionIndex = (eDimensionIndex)1,
					LocalIndex = (eLocalZoneIndex)7,
					Delay = 0f,
					Duration = 0f
				};
				ManualLogSource logSource4 = PluginCore.LogSource;
				val = new BepInExInfoLogInterpolatedStringHandler(34, 0, ref flag);
				if (flag)
				{
					((BepInExLogInterpolatedStringHandler)val).AppendLiteral("  ✅ Zona 2 abierta permanentemente");
				}
				logSource4.LogInfo(val);
				PluginCore.LogSource.LogInfo(new BepInExInfoLogInterpolatedStringHandler(0, 0, ref flag));
			}
			catch (Exception ex)
			{
				ManualLogSource logSource5 = PluginCore.LogSource;
				BepInExErrorLogInterpolatedStringHandler val3 = new BepInExErrorLogInterpolatedStringHandler(27, 1, ref flag);
				if (flag)
				{
					((BepInExLogInterpolatedStringHandler)val3).AppendLiteral("  ❌ Error abriendo zona 2: ");
					((BepInExLogInterpolatedStringHandler)val3).AppendFormatted<string>(ex.Message);
				}
				logSource5.LogError(val3);
			}
		}

		private static void UpdateWeakspotRespawn()
		{
			if (_activeWeakspots > 0)
			{
				_weakspotRespawnQueue.Clear();
			}
			else
			{
				if (_waitingForScoutKills)
				{
					return;
				}
				if (_scoutSpawnTime > 0f && Time.time >= _scoutSpawnTime)
				{
					_scoutSpawnTime = 0f;
					if (SNet.IsMaster)
					{
						SpawnScouts();
					}
				}
				else
				{
					_weakspotRespawnQueue.Clear();
				}
			}
		}

		private static void RespawnWeakspot()
		{
			//IL_0043: Unknown result type (might be due to invalid IL or missing references)
			//IL_004a: Expected O, but got Unknown
			//IL_011d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0127: Expected O, but got Unknown
			//IL_0134: Unknown result type (might be due to invalid IL or missing references)
			//IL_013b: Expected O, but got Unknown
			//IL_00b5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00bc: Expected O, but got Unknown
			//IL_0162: Unknown result type (might be due to invalid IL or missing references)
			//IL_0169: Expected O, but got Unknown
			//IL_0190: Unknown result type (might be due to invalid IL or missing references)
			//IL_0197: Expected O, but got Unknown
			//IL_01be: Unknown result type (might be due to invalid IL or missing references)
			//IL_01c5: Expected O, but got Unknown
			//IL_0202: Unknown result type (might be due to invalid IL or missing references)
			//IL_0209: Expected O, but got Unknown
			//IL_022d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0237: Expected O, but got Unknown
			if (!SNet.IsMaster)
			{
				PluginCore.LogSource.LogDebug((object)"[BossNet] Cliente esperando orden de Master para respawn");
				return;
			}
			bool flag = default(bool);
			if (_inactiveWeakspotIndices.Count == 0)
			{
				ManualLogSource logSource = PluginCore.LogSource;
				BepInExWarningLogInterpolatedStringHandler val = new BepInExWarningLogInterpolatedStringHandler(35, 0, ref flag);
				if (flag)
				{
					((BepInExLogInterpolatedStringHandler)val).AppendLiteral("  ⚠\ufe0f No hay más weakspots inactivos");
				}
				logSource.LogWarning(val);
				return;
			}
			List<int> list = _inactiveWeakspotIndices.Where((int index) => !_destroyedWeakspotIndices.Contains(index)).ToList();
			if (list.Count == 0)
			{
				ManualLogSource logSource2 = PluginCore.LogSource;
				BepInExWarningLogInterpolatedStringHandler val = new BepInExWarningLogInterpolatedStringHandler(45, 0, ref flag);
				if (flag)
				{
					((BepInExLogInterpolatedStringHandler)val).AppendLiteral("  ⚠\ufe0f Todos los weakspots ya fueron destruidos");
				}
				logSource2.LogWarning(val);
				return;
			}
			int index2 = _random.Next(list.Count);
			int num = list[index2];
			_inactiveWeakspotIndices.Remove(num);
			ActivateWeakspot(num);
			_activeWeakspots++;
			PluginCore.LogSource.LogInfo(new BepInExInfoLogInterpolatedStringHandler(0, 0,