Decompiled source of LethalMin v0.1.0

NoteBoxz.LethalMin.dll

Decompiled 4 hours 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 BepInEx;
using BepInEx.Bootstrap;
using BepInEx.Configuration;
using BepInEx.Logging;
using GameNetcodeStuff;
using HarmonyLib;
using LethalConfig;
using LethalConfig.ConfigItems;
using LethalConfig.ConfigItems.Options;
using LethalLib.Extras;
using LethalLib.Modules;
using LethalMin.Patches;
using LethalMon;
using LethalMon.Behaviours;
using Microsoft.CodeAnalysis;
using Newtonsoft.Json;
using NoteBoxz.LethalMin.NetcodePatcher;
using TMPro;
using Unity.Netcode;
using Unity.Netcode.Components;
using UnityEngine;
using UnityEngine.AI;
using UnityEngine.EventSystems;
using UnityEngine.Events;
using UnityEngine.InputSystem;
using UnityEngine.InputSystem.Utilities;
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(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")]
[assembly: IgnoresAccessChecksTo("AmazingAssets.TerrainToMesh")]
[assembly: IgnoresAccessChecksTo("Assembly-CSharp-firstpass")]
[assembly: IgnoresAccessChecksTo("Assembly-CSharp")]
[assembly: IgnoresAccessChecksTo("ClientNetworkTransform")]
[assembly: IgnoresAccessChecksTo("DissonanceVoip")]
[assembly: IgnoresAccessChecksTo("Facepunch Transport for Netcode for GameObjects")]
[assembly: IgnoresAccessChecksTo("Facepunch.Steamworks.Win64")]
[assembly: IgnoresAccessChecksTo("Unity.AI.Navigation")]
[assembly: IgnoresAccessChecksTo("Unity.Animation.Rigging")]
[assembly: IgnoresAccessChecksTo("Unity.Animation.Rigging.DocCodeExamples")]
[assembly: IgnoresAccessChecksTo("Unity.Burst")]
[assembly: IgnoresAccessChecksTo("Unity.Burst.Unsafe")]
[assembly: IgnoresAccessChecksTo("Unity.Collections")]
[assembly: IgnoresAccessChecksTo("Unity.Collections.LowLevel.ILSupport")]
[assembly: IgnoresAccessChecksTo("Unity.InputSystem")]
[assembly: IgnoresAccessChecksTo("Unity.InputSystem.ForUI")]
[assembly: IgnoresAccessChecksTo("Unity.Jobs")]
[assembly: IgnoresAccessChecksTo("Unity.Mathematics")]
[assembly: IgnoresAccessChecksTo("Unity.Multiplayer.Tools.Common")]
[assembly: IgnoresAccessChecksTo("Unity.Multiplayer.Tools.MetricTypes")]
[assembly: IgnoresAccessChecksTo("Unity.Multiplayer.Tools.NetStats")]
[assembly: IgnoresAccessChecksTo("Unity.Multiplayer.Tools.NetStatsMonitor.Component")]
[assembly: IgnoresAccessChecksTo("Unity.Multiplayer.Tools.NetStatsMonitor.Configuration")]
[assembly: IgnoresAccessChecksTo("Unity.Multiplayer.Tools.NetStatsMonitor.Implementation")]
[assembly: IgnoresAccessChecksTo("Unity.Multiplayer.Tools.NetStatsReporting")]
[assembly: IgnoresAccessChecksTo("Unity.Multiplayer.Tools.NetworkProfiler.Runtime")]
[assembly: IgnoresAccessChecksTo("Unity.Multiplayer.Tools.NetworkSolutionInterface")]
[assembly: IgnoresAccessChecksTo("Unity.Netcode.Components")]
[assembly: IgnoresAccessChecksTo("Unity.Netcode.Runtime")]
[assembly: IgnoresAccessChecksTo("Unity.Networking.Transport")]
[assembly: IgnoresAccessChecksTo("Unity.ProBuilder.Csg")]
[assembly: IgnoresAccessChecksTo("Unity.ProBuilder")]
[assembly: IgnoresAccessChecksTo("Unity.ProBuilder.KdTree")]
[assembly: IgnoresAccessChecksTo("Unity.ProBuilder.Poly2Tri")]
[assembly: IgnoresAccessChecksTo("Unity.ProBuilder.Stl")]
[assembly: IgnoresAccessChecksTo("Unity.Profiling.Core")]
[assembly: IgnoresAccessChecksTo("Unity.RenderPipelines.Core.Runtime")]
[assembly: IgnoresAccessChecksTo("Unity.RenderPipelines.Core.ShaderLibrary")]
[assembly: IgnoresAccessChecksTo("Unity.RenderPipelines.HighDefinition.Config.Runtime")]
[assembly: IgnoresAccessChecksTo("Unity.RenderPipelines.HighDefinition.Runtime")]
[assembly: IgnoresAccessChecksTo("Unity.RenderPipelines.ShaderGraph.ShaderGraphLibrary")]
[assembly: IgnoresAccessChecksTo("Unity.Services.Authentication")]
[assembly: IgnoresAccessChecksTo("Unity.Services.Core.Analytics")]
[assembly: IgnoresAccessChecksTo("Unity.Services.Core.Configuration")]
[assembly: IgnoresAccessChecksTo("Unity.Services.Core.Device")]
[assembly: IgnoresAccessChecksTo("Unity.Services.Core")]
[assembly: IgnoresAccessChecksTo("Unity.Services.Core.Environments")]
[assembly: IgnoresAccessChecksTo("Unity.Services.Core.Environments.Internal")]
[assembly: IgnoresAccessChecksTo("Unity.Services.Core.Internal")]
[assembly: IgnoresAccessChecksTo("Unity.Services.Core.Networking")]
[assembly: IgnoresAccessChecksTo("Unity.Services.Core.Registration")]
[assembly: IgnoresAccessChecksTo("Unity.Services.Core.Scheduler")]
[assembly: IgnoresAccessChecksTo("Unity.Services.Core.Telemetry")]
[assembly: IgnoresAccessChecksTo("Unity.Services.Core.Threading")]
[assembly: IgnoresAccessChecksTo("Unity.Services.QoS")]
[assembly: IgnoresAccessChecksTo("Unity.Services.Relay")]
[assembly: IgnoresAccessChecksTo("Unity.TextMeshPro")]
[assembly: IgnoresAccessChecksTo("Unity.Timeline")]
[assembly: IgnoresAccessChecksTo("Unity.VisualEffectGraph.Runtime")]
[assembly: IgnoresAccessChecksTo("UnityEngine.ARModule")]
[assembly: IgnoresAccessChecksTo("UnityEngine.NVIDIAModule")]
[assembly: IgnoresAccessChecksTo("UnityEngine.UI")]
[assembly: AssemblyCompany("NoteBoxz.LethalMin")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("0.1.0.0")]
[assembly: AssemblyInformationalVersion("0.1.0+1b83fd6f90a6f44f08a26479e2bdedd341f4e561")]
[assembly: AssemblyProduct("LethalMin")]
[assembly: AssemblyTitle("NoteBoxz.LethalMin")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("0.1.0.0")]
[module: UnverifiableCode]
[module: RefSafetyRules(11)]
[module: NetcodePatchedAssembly]
internal class <Module>
{
	static <Module>()
	{
		NetworkVariableSerializationTypes.InitializeSerializer_UnmanagedByMemcpy<bool>();
		NetworkVariableSerializationTypes.InitializeEqualityChecker_UnmanagedIEquatable<bool>();
	}
}
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;
		}
	}
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	[AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)]
	internal sealed class RefSafetyRulesAttribute : Attribute
	{
		public readonly int Version;

		public RefSafetyRulesAttribute(int P_0)
		{
			Version = P_0;
		}
	}
}
[RequireComponent(typeof(MeshFilter))]
[RequireComponent(typeof(MeshRenderer))]
public class MeshGroundWrapper : MonoBehaviour
{
	public enum UpdateMode
	{
		Manual,
		Update,
		LateUpdate,
		FixedUpdate
	}

	[Header("Wrapping Settings")]
	[Tooltip("Layer mask for ground detection")]
	public LayerMask groundLayer = LayerMask.op_Implicit(1375734017);

	[Tooltip("Maximum distance to check for ground")]
	public float maxGroundDistance = 100f;

	[Tooltip("Offset from the ground")]
	public float heightOffset = 0.2f;

	[Header("Performance Settings")]
	[Tooltip("Update method for the mesh wrapping")]
	public UpdateMode updateMode = UpdateMode.LateUpdate;

	[Tooltip("Number of vertices to process per frame")]
	[Range(1f, 100f)]
	public int verticesPerFrame = 50;

	[Tooltip("Only update vertices if they've moved more than this distance")]
	public float updateThreshold = 0.01f;

	private MeshFilter meshFilter;

	private Vector3[] originalVertices;

	private Vector3[] wrappedVertices;

	private Vector3[] lastWorldPositions;

	private Mesh deformedMesh;

	private int currentVertexIndex;

	private Vector3 lastPosition;

	private Quaternion lastRotation;

	private bool needsFullUpdate;

	private void Start()
	{
		Initialize();
		needsFullUpdate = true;
	}

	private void Initialize()
	{
		//IL_002e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0038: Expected O, but got Unknown
		//IL_0125: Unknown result type (might be due to invalid IL or missing references)
		//IL_012a: Unknown result type (might be due to invalid IL or missing references)
		//IL_012f: Unknown result type (might be due to invalid IL or missing references)
		//IL_014f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0154: Unknown result type (might be due to invalid IL or missing references)
		//IL_0160: Unknown result type (might be due to invalid IL or missing references)
		//IL_0165: Unknown result type (might be due to invalid IL or missing references)
		if ((Object)(object)meshFilter == (Object)null)
		{
			meshFilter = ((Component)this).GetComponent<MeshFilter>();
			Mesh sharedMesh = meshFilter.sharedMesh;
			deformedMesh = new Mesh();
			((Object)deformedMesh).name = "Wrapped " + ((Object)sharedMesh).name;
			deformedMesh.vertices = sharedMesh.vertices;
			deformedMesh.triangles = sharedMesh.triangles;
			deformedMesh.uv = sharedMesh.uv;
			deformedMesh.normals = sharedMesh.normals;
			deformedMesh.tangents = sharedMesh.tangents;
			meshFilter.mesh = deformedMesh;
			originalVertices = sharedMesh.vertices;
			wrappedVertices = (Vector3[])(object)new Vector3[originalVertices.Length];
			lastWorldPositions = (Vector3[])(object)new Vector3[originalVertices.Length];
			Array.Copy(originalVertices, wrappedVertices, originalVertices.Length);
			for (int i = 0; i < originalVertices.Length; i++)
			{
				lastWorldPositions[i] = ((Component)this).transform.TransformPoint(originalVertices[i]);
			}
			lastPosition = ((Component)this).transform.position;
			lastRotation = ((Component)this).transform.rotation;
		}
	}

	private void Update()
	{
		if (updateMode == UpdateMode.Update)
		{
			UpdateWrapper();
		}
	}

	private void LateUpdate()
	{
		if (updateMode == UpdateMode.LateUpdate)
		{
			UpdateWrapper();
		}
	}

	private void FixedUpdate()
	{
		if (updateMode == UpdateMode.FixedUpdate)
		{
			UpdateWrapper();
		}
	}

	private void UpdateWrapper()
	{
		//IL_0017: 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_0035: Unknown result type (might be due to invalid IL or missing references)
		//IL_0040: 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_0133: Unknown result type (might be due to invalid IL or missing references)
		//IL_013f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0144: Unknown result type (might be due to invalid IL or missing references)
		if ((Object)(object)meshFilter == (Object)null)
		{
			return;
		}
		if (Vector3.Distance(lastPosition, ((Component)this).transform.position) > updateThreshold || Quaternion.Angle(lastRotation, ((Component)this).transform.rotation) > updateThreshold)
		{
			needsFullUpdate = true;
		}
		int i;
		for (i = 0; i < verticesPerFrame; i++)
		{
			if (!needsFullUpdate && currentVertexIndex >= originalVertices.Length)
			{
				break;
			}
			if (currentVertexIndex >= originalVertices.Length)
			{
				if (!needsFullUpdate)
				{
					break;
				}
				currentVertexIndex = 0;
				needsFullUpdate = false;
			}
			ProcessVertex(currentVertexIndex);
			currentVertexIndex++;
		}
		if (i > 0)
		{
			deformedMesh.vertices = wrappedVertices;
			deformedMesh.RecalculateNormals();
			deformedMesh.RecalculateBounds();
		}
		lastPosition = ((Component)this).transform.position;
		lastRotation = ((Component)this).transform.rotation;
	}

	private void ProcessVertex(int index)
	{
		//IL_000e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0013: 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_0021: Unknown result type (might be due to invalid IL or missing references)
		//IL_0029: Unknown result type (might be due to invalid IL or missing references)
		//IL_004a: Unknown result type (might be due to invalid IL or missing references)
		//IL_004b: Unknown result type (might be due to invalid IL or missing references)
		//IL_0056: Unknown result type (might be due to invalid IL or missing references)
		//IL_005b: Unknown result type (might be due to invalid IL or missing references)
		//IL_0060: Unknown result type (might be due to invalid IL or missing references)
		//IL_006a: Unknown result type (might be due to invalid IL or missing references)
		//IL_007a: Unknown result type (might be due to invalid IL or missing references)
		//IL_00f7: Unknown result type (might be due to invalid IL or missing references)
		//IL_00fc: Unknown result type (might be due to invalid IL or missing references)
		//IL_0098: Unknown result type (might be due to invalid IL or missing references)
		//IL_009d: Unknown result type (might be due to invalid IL or missing references)
		//IL_00a2: Unknown result type (might be due to invalid IL or missing references)
		//IL_00bc: Unknown result type (might be due to invalid IL or missing references)
		//IL_00db: Unknown result type (might be due to invalid IL or missing references)
		//IL_00e0: Unknown result type (might be due to invalid IL or missing references)
		//IL_0109: Unknown result type (might be due to invalid IL or missing references)
		//IL_010a: Unknown result type (might be due to invalid IL or missing references)
		Vector3 val = ((Component)this).transform.TransformPoint(originalVertices[index]);
		if (needsFullUpdate || !(Vector3.Distance(val, lastWorldPositions[index]) < updateThreshold))
		{
			Ray val2 = default(Ray);
			((Ray)(ref val2))..ctor(val + Vector3.up * maxGroundDistance, Vector3.down);
			RaycastHit val3 = default(RaycastHit);
			if (Physics.Raycast(val2, ref val3, maxGroundDistance * 2f, LayerMask.op_Implicit(groundLayer)))
			{
				Vector3 val4 = ((Component)this).transform.InverseTransformPoint(((RaycastHit)(ref val3)).point);
				wrappedVertices[index] = new Vector3(originalVertices[index].x, val4.y + heightOffset, originalVertices[index].z);
			}
			else
			{
				wrappedVertices[index] = originalVertices[index];
			}
			lastWorldPositions[index] = val;
		}
	}

	public void ForceFullUpdate()
	{
		needsFullUpdate = true;
		currentVertexIndex = 0;
	}

	private void OnValidate()
	{
		if (Application.isPlaying && (Object)(object)meshFilter != (Object)null)
		{
			ForceFullUpdate();
		}
	}
}
public struct PikminData : INetworkSerializable
{
	public int GrowStage;

	public ulong NetworkObjectId;

	public int PikminTypeID;

	public unsafe void NetworkSerialize<T>(BufferSerializer<T> serializer) where T : IReaderWriter
	{
		//IL_000b: Unknown result type (might be due to invalid IL or missing references)
		//IL_0011: Unknown result type (might be due to invalid IL or missing references)
		//IL_0022: Unknown result type (might be due to invalid IL or missing references)
		//IL_0028: Unknown result type (might be due to invalid IL or missing references)
		//IL_0039: Unknown result type (might be due to invalid IL or missing references)
		//IL_003f: Unknown result type (might be due to invalid IL or missing references)
		((BufferSerializer<int>*)(&serializer))->SerializeValue<int>(ref GrowStage, default(ForPrimitives));
		((BufferSerializer<ulong>*)(&serializer))->SerializeValue<ulong>(ref NetworkObjectId, default(ForPrimitives));
		((BufferSerializer<int>*)(&serializer))->SerializeValue<int>(ref PikminTypeID, default(ForPrimitives));
	}
}
namespace LethalMin
{
	public class AnimatedOnion : Onion
	{
		public GameObject RealMesh;

		public GameObject FunniMesh;

		public GameObject Beam;

		public bool FunniMode = false;

		private Animator onionAnimator;

		public override void Start()
		{
			base.Start();
			SetupMeshes();
			SetupAnimator();
			SetupBeam();
		}

		private void SetupBeam()
		{
			Beam = ((Component)((Component)this).transform.Find("BeamZone")).gameObject;
			Beam.SetActive(false);
			((MonoBehaviour)this).StartCoroutine(ShowBeam());
		}

		private IEnumerator ShowBeam()
		{
			yield return (object)new WaitForSeconds(6.3f);
			Beam.SetActive(true);
		}

		private IEnumerator HideBeam()
		{
			yield return (object)new WaitForSeconds(1.1f);
			Beam.SetActive(false);
		}

		private void SetupMeshes()
		{
			//IL_007d: Unknown result type (might be due to invalid IL or missing references)
			RealMesh = ((Component)((Component)this).transform.Find("mesh/RealMesh")).gameObject;
			FunniMesh = ((Component)((Component)this).transform.Find("mesh/TempMesh")).gameObject;
			AnimPos = ((Component)this).transform.Find("PikminAnimPos");
			((Component)((Component)this).transform.Find("mesh")).transform.rotation = Quaternion.Euler(0f, (float)OnionRandom.Next(360), 0f);
		}

		private void SetupAnimator()
		{
			onionAnimator = ((Component)this).GetComponentInChildren<Animator>();
			if ((Object)(object)onionAnimator == (Object)null)
			{
				LethalMin.Logger.LogError((object)"Animator component not found in children of Onion object.");
			}
		}

		[ClientRpc]
		public void SyncOnionTypeClientRpc(int newType)
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Invalid comparison between Unknown and I4
			//IL_0099: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a3: Invalid comparison between Unknown and I4
			//IL_005f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0068: Unknown result type (might be due to invalid IL or missing references)
			//IL_006d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0071: Unknown result type (might be due to invalid IL or missing references)
			//IL_0089: Unknown result type (might be due to invalid IL or missing references)
			NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
			if (networkManager != null && networkManager.IsListening)
			{
				if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 2 && (networkManager.IsServer || networkManager.IsHost))
				{
					ClientRpcParams val = default(ClientRpcParams);
					FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(2460038460u, val, (RpcDelivery)0);
					BytePacker.WriteValueBitPacked(val2, newType);
					((NetworkBehaviour)this).__endSendClientRpc(ref val2, 2460038460u, val, (RpcDelivery)0);
				}
				if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 2 && (networkManager.IsClient || networkManager.IsHost))
				{
					type = LethalMin.GetOnionTypeById(newType);
					UpdateOnionVisuals();
				}
			}
		}

		[ClientRpc]
		public void SyncOnionTypeClientRpc(int[] newTypes)
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Invalid comparison between Unknown and I4
			//IL_00d7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e1: Invalid comparison between Unknown and I4
			//IL_005f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0068: Unknown result type (might be due to invalid IL or missing references)
			//IL_006d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0088: Unknown result type (might be due to invalid IL or missing references)
			//IL_008e: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ac: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b2: Unknown result type (might be due to invalid IL or missing references)
			NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
			if (networkManager == null || !networkManager.IsListening)
			{
				return;
			}
			if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 2 && (networkManager.IsServer || networkManager.IsHost))
			{
				ClientRpcParams val = default(ClientRpcParams);
				FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(756600624u, val, (RpcDelivery)0);
				bool flag = newTypes != null;
				((FastBufferWriter)(ref val2)).WriteValueSafe<bool>(ref flag, default(ForPrimitives));
				if (flag)
				{
					((FastBufferWriter)(ref val2)).WriteValueSafe<int>(newTypes, default(ForPrimitives));
				}
				((NetworkBehaviour)this).__endSendClientRpc(ref val2, 756600624u, val, (RpcDelivery)0);
			}
			if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 2 && (networkManager.IsClient || networkManager.IsHost))
			{
				OnionType onionType = LethalMin.RegisteredOnionTypes[newTypes[0]];
				OnionType onionType2 = ScriptableObject.CreateInstance(typeof(OnionType)) as OnionType;
				((Object)onionType2).name = "Fusion of " + string.Join(", ", newTypes);
				onionType2.OnionTypeID = onionType.OnionTypeID;
				onionType2.TypeName = "Fused " + onionType.TypeName;
				onionType2.OnionPrefab = onionType.OnionPrefab;
				onionType2.OnionMaterial = onionType.OnionMaterial;
				onionType2.TypesCanHold = new PikminType[0];
				List<PikminType> list = new List<PikminType>();
				foreach (int id in newTypes)
				{
					OnionType onionTypeById = LethalMin.GetOnionTypeById(id);
					list.AddRange(onionTypeById.TypesCanHold);
					FusedTypes.Add(onionTypeById);
					LethalMin.Logger.LogInfo((object)("mixing onions " + onionTypeById.TypeName + " and " + onionType.TypeName));
				}
				onionType2.TypesCanHold = list.ToArray();
				type = onionType2;
				PikminAI[] array = Object.FindObjectsOfType<PikminAI>();
				foreach (PikminAI pikminAI in array)
				{
					pikminAI.CheckForOnion(Object.FindObjectsOfType<Onion>());
				}
				UpdateFusionOnionVisuals();
			}
		}

		public void UpdateOnionVisuals()
		{
			//IL_00f7: Unknown result type (might be due to invalid IL or missing references)
			//IL_0122: Unknown result type (might be due to invalid IL or missing references)
			if ((Object)(object)((Component)this).transform.Find("mesh/RealMesh/SK_stg_Onyon.021") == (Object)null)
			{
				LethalMin.Logger.LogError((object)"Onion mesh not found. Make sure the hierarchy is correct.");
				return;
			}
			Renderer component = ((Component)((Component)this).transform.Find("mesh/RealMesh/SK_stg_Onyon.021")).GetComponent<Renderer>();
			if ((Object)(object)component == (Object)null)
			{
				LethalMin.Logger.LogError((object)"Renderer component not found on Onion mesh.");
				return;
			}
			Material val = null;
			Texture2D val2 = null;
			if ((Object)(object)type.OnionMaterial != (Object)null)
			{
				val = type.OnionMaterial;
			}
			if ((Object)(object)type.OnionTexture != (Object)null)
			{
				val2 = type.OnionTexture;
			}
			if ((Object)(object)val != (Object)null)
			{
				component.material = val;
			}
			if ((Object)(object)val2 != (Object)null)
			{
				component.material.mainTexture = (Texture)(object)val2;
			}
			component.material.color = type.OnionColor;
			((Component)((Component)this).transform.Find("mesh/SK_stg_Onyon/root/S_j000/S_j001/S_j030/MapDot")).GetComponent<Renderer>().material.color = LethalMin.GetColorFromPType(type);
		}

		public void UpdateFusionOnionVisuals()
		{
			//IL_01bb: Unknown result type (might be due to invalid IL or missing references)
			//IL_01e3: Unknown result type (might be due to invalid IL or missing references)
			//IL_024c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0283: Unknown result type (might be due to invalid IL or missing references)
			Renderer component = ((Component)((Component)this).transform.Find("mesh/RealMesh/SK_stg_Onyon.021")).GetComponent<Renderer>();
			switch (FusedTypes.Count)
			{
			case 2:
				((Component)((Component)this).transform.Find("mesh/RealMesh/SK_stg_Onyon.021")).GetComponent<SkinnedMeshRenderer>().sharedMesh = LethalMin.TwoSideOnion;
				break;
			case 3:
				((Component)((Component)this).transform.Find("mesh/RealMesh/SK_stg_Onyon.021")).GetComponent<SkinnedMeshRenderer>().sharedMesh = LethalMin.ThreeSideOnion;
				break;
			case 4:
				((Component)((Component)this).transform.Find("mesh/RealMesh/SK_stg_Onyon.021")).GetComponent<SkinnedMeshRenderer>().sharedMesh = LethalMin.FourSideOnion;
				break;
			case 5:
				((Component)((Component)this).transform.Find("mesh/RealMesh/SK_stg_Onyon.021")).GetComponent<SkinnedMeshRenderer>().sharedMesh = LethalMin.FiveSideOnion;
				break;
			case 6:
				((Component)((Component)this).transform.Find("mesh/RealMesh/SK_stg_Onyon.021")).GetComponent<SkinnedMeshRenderer>().sharedMesh = LethalMin.SixSideOnion;
				break;
			case 7:
				((Component)((Component)this).transform.Find("mesh/RealMesh/SK_stg_Onyon.021")).GetComponent<SkinnedMeshRenderer>().sharedMesh = LethalMin.SevenSideOnion;
				break;
			case 8:
				((Component)((Component)this).transform.Find("mesh/RealMesh/SK_stg_Onyon.021")).GetComponent<SkinnedMeshRenderer>().sharedMesh = LethalMin.EightSideOnion;
				break;
			default:
				if (FusedTypes.Count > 2)
				{
					((Component)((Component)this).transform.Find("mesh/RealMesh/SK_stg_Onyon.021")).GetComponent<SkinnedMeshRenderer>().sharedMesh = LethalMin.EightSideOnion;
				}
				LethalMin.Logger.LogWarning((object)$"Unsupported number of fused onions: {FusedTypes.Count}");
				break;
			}
			List<Color> list = new List<Color>();
			list.Add(FusedTypes[0].OnionColor);
			foreach (OnionType fusedType in FusedTypes)
			{
				list.Add(fusedType.OnionColor);
			}
			Texture2D val = GradientTextureGenerator.Generate90DegreeGradient(list, 0.1f);
			if (LethalMin.DebugMode)
			{
				byte[] bytes = ImageConversion.EncodeToPNG(val);
				File.WriteAllBytes(Path.Combine(Application.persistentDataPath, "graident.png"), bytes);
			}
			component.material.color = Color.white;
			component.material.SetTexture("_BaseColorMap", (Texture)(object)val);
			((Component)((Component)this).transform.Find("mesh/SK_stg_Onyon/root/S_j000/S_j001/S_j030/MapDot")).GetComponent<Renderer>().material.color = Color.white;
			((Component)((Component)this).transform.Find("mesh/SK_stg_Onyon/root/S_j000/S_j001/S_j030/MapDot")).GetComponent<Renderer>().material.SetTexture("_UnlitColorMap", (Texture)(object)val);
		}

		public override void LateUpdate()
		{
			base.LateUpdate();
			UpdateMeshVisibility();
			CheckForShipLeaving();
		}

		private void UpdateMeshVisibility()
		{
			RealMesh.SetActive(!LethalMin.FunniOnion);
			FunniMesh.SetActive(LethalMin.FunniOnion);
		}

		private void CheckForShipLeaving()
		{
			if (StartOfRound.Instance.shipIsLeaving && !HasDecidedToLeave && PikminInField.Values.Count <= 0)
			{
				HasDecidedToLeave = true;
				onionAnimator.SetTrigger("Leave");
				((Component)((Component)this).transform.Find("BeamZone/Cone")).gameObject.GetComponent<Animator>().Play("HideCone");
				((MonoBehaviour)this).StartCoroutine(HideBeam());
			}
		}

		protected override void __initializeVariables()
		{
			base.__initializeVariables();
		}

		[RuntimeInitializeOnLoadMethod]
		internal static void InitializeRPCS_AnimatedOnion()
		{
			//IL_0011: Unknown result type (might be due to invalid IL or missing references)
			//IL_001b: Expected O, but got Unknown
			//IL_002c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0036: Expected O, but got Unknown
			NetworkManager.__rpc_func_table.Add(2460038460u, new RpcReceiveHandler(__rpc_handler_2460038460));
			NetworkManager.__rpc_func_table.Add(756600624u, new RpcReceiveHandler(__rpc_handler_756600624));
		}

		private static void __rpc_handler_2460038460(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams)
		{
			//IL_0023: Unknown result type (might be due to invalid IL or missing references)
			//IL_0036: Unknown result type (might be due to invalid IL or missing references)
			//IL_0050: Unknown result type (might be due to invalid IL or missing references)
			NetworkManager networkManager = target.NetworkManager;
			if (networkManager != null && networkManager.IsListening)
			{
				int newType = default(int);
				ByteUnpacker.ReadValueBitPacked(reader, ref newType);
				target.__rpc_exec_stage = (__RpcExecStage)2;
				((AnimatedOnion)(object)target).SyncOnionTypeClientRpc(newType);
				target.__rpc_exec_stage = (__RpcExecStage)0;
			}
		}

		private static void __rpc_handler_756600624(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams)
		{
			//IL_002f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0035: Unknown result type (might be due to invalid IL or missing references)
			//IL_006e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0088: Unknown result type (might be due to invalid IL or missing references)
			//IL_0058: Unknown result type (might be due to invalid IL or missing references)
			//IL_005e: Unknown result type (might be due to invalid IL or missing references)
			NetworkManager networkManager = target.NetworkManager;
			if (networkManager != null && networkManager.IsListening)
			{
				bool flag = default(bool);
				((FastBufferReader)(ref reader)).ReadValueSafe<bool>(ref flag, default(ForPrimitives));
				int[] newTypes = null;
				if (flag)
				{
					((FastBufferReader)(ref reader)).ReadValueSafe<int>(ref newTypes, default(ForPrimitives));
				}
				target.__rpc_exec_stage = (__RpcExecStage)2;
				((AnimatedOnion)(object)target).SyncOnionTypeClientRpc(newTypes);
				target.__rpc_exec_stage = (__RpcExecStage)0;
			}
		}

		protected internal override string __getTypeName()
		{
			return "AnimatedOnion";
		}
	}
	public class AssetBundleLoader : MonoBehaviour
	{
		public static AssetBundleLoader instance;

		private const string BUNDLE_EXTENSION = "*.lethalmin";

		internal static DirectoryInfo lethalMinFile = new DirectoryInfo(Assembly.GetExecutingAssembly().Location);

		internal static DirectoryInfo? lethalMinFolder;

		internal static DirectoryInfo? pluginsFolder;

		private Dictionary<string, AssetBundle> loadedBundles = new Dictionary<string, AssetBundle>();

		private void Awake()
		{
			if ((Object)(object)instance == (Object)null)
			{
				instance = this;
				Object.DontDestroyOnLoad((Object)(object)((Component)this).gameObject);
				LoadLethalMinBundles();
			}
			else
			{
				Object.Destroy((Object)(object)((Component)this).gameObject);
			}
		}

		private void LoadLethalMinBundles()
		{
			lethalMinFolder = lethalMinFile.Parent;
			pluginsFolder = lethalMinFolder?.Parent;
			if (pluginsFolder == null || !pluginsFolder.Exists)
			{
				LethalMin.Logger.LogError((object)("Plugins folder not found: " + pluginsFolder?.FullName));
				return;
			}
			string[] files = Directory.GetFiles(pluginsFolder.FullName, "*.lethalmin", SearchOption.AllDirectories);
			string[] array = files;
			foreach (string bundlePath in array)
			{
				((MonoBehaviour)this).StartCoroutine(LoadBundleCoroutine(bundlePath));
			}
			switch (files.Length)
			{
			case 0:
				if (LethalMin.DebugMode)
				{
					LethalMin.Logger.LogInfo((object)"No LethalMin bundles found in the plugins folder");
				}
				break;
			case 1:
				LethalMin.Logger.LogInfo((object)"Loaded 1 LethalMin bundle");
				break;
			default:
				LethalMin.Logger.LogInfo((object)$"Loaded {files.Length} LethalMin bundles");
				break;
			}
		}

		private IEnumerator LoadBundleCoroutine(string bundlePath)
		{
			AssetBundleCreateRequest request = AssetBundle.LoadFromFileAsync(bundlePath);
			yield return request;
			if ((Object)(object)request.assetBundle != (Object)null)
			{
				string bundleName = Path.GetFileNameWithoutExtension(bundlePath);
				loadedBundles[bundleName] = request.assetBundle;
				LethalMin.Logger.LogInfo((object)("Loaded bundle: " + bundleName));
				ProcessLoadedBundle(request.assetBundle);
			}
			else
			{
				LethalMin.Logger.LogError((object)("Failed to load bundle: " + bundlePath));
			}
		}

		private void ProcessLoadedBundle(AssetBundle bundle)
		{
			bool flag = false;
			PikminType[] array = bundle.LoadAllAssets<PikminType>();
			PikminType[] array2 = array;
			foreach (PikminType type in array2)
			{
				LethalMin.RegisterPikminType(type);
				flag = true;
			}
			OnionType[] array3 = bundle.LoadAllAssets<OnionType>();
			OnionType[] array4 = array3;
			foreach (OnionType type2 in array4)
			{
				LethalMin.RegisterOnionType(type2);
				flag = true;
			}
			OnionFuseRules[] array5 = bundle.LoadAllAssets<OnionFuseRules>();
			OnionFuseRules[] array6 = array5;
			foreach (OnionFuseRules fuseRule in array6)
			{
				LethalMin.RegisterFuseRule(fuseRule);
				flag = true;
			}
			if (!flag)
			{
				LethalMin.Logger.LogWarning((object)("Bundle does not contain any valid LethalMin assets: " + ((Object)bundle).name));
			}
		}
	}
	public static class AssetLoader
	{
		private static AssetBundle? _assetBundle;

		public static AssetBundle LoadAssetBundle()
		{
			if ((Object)(object)_assetBundle == (Object)null)
			{
				string directoryName = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location);
				if (directoryName == null)
				{
					throw new InvalidOperationException("Unable to determine assembly location.");
				}
				string text = Path.Combine(directoryName, "lethalminassets");
				_assetBundle = AssetBundle.LoadFromFile(text);
				if ((Object)(object)_assetBundle == (Object)null)
				{
					throw new InvalidOperationException("Failed to load LethalMin AssetBundle.");
				}
			}
			return _assetBundle;
		}

		public static T LoadAsset<T>(string assetName) where T : Object
		{
			if (!assetName.EndsWith(".asset") && !assetName.EndsWith(".prefab") && !assetName.EndsWith(".wav") && !assetName.EndsWith(".mat") && !assetName.EndsWith(".ogg") && !assetName.EndsWith(".mp3") && !assetName.EndsWith(".mp4") && !assetName.EndsWith(".anim") && !assetName.EndsWith(".png") && !assetName.EndsWith(".jpg") && !assetName.EndsWith(".mesh"))
			{
				assetName += ".asset";
			}
			AssetBundle val = LoadAssetBundle();
			T val2 = val.LoadAsset<T>(assetName);
			if (!val.Contains(assetName))
			{
				throw new InvalidOperationException("Asset not found in bundle: " + assetName);
			}
			if ((Object)(object)val2 == (Object)null)
			{
				throw new InvalidOperationException("Failed to load asset: " + assetName + ". Asset exists in bundle but couldn't be loaded.");
			}
			if (LethalMin.DebugMode)
			{
				LethalMin.Logger.LogInfo((object)("ASSETLOADER: Loaded " + assetName));
			}
			return val2;
		}
	}
	public class CustomPikminScriptExample : NetworkBehaviour
	{
		public PikminAI BaseScript = null;

		public override void OnNetworkSpawn()
		{
			((NetworkBehaviour)this).OnNetworkSpawn();
			((MonoBehaviour)this).StartCoroutine(WaitToParent());
		}

		private IEnumerator WaitToParent()
		{
			yield return (object)new WaitUntil((Func<bool>)(() => (Object)(object)((Component)this).transform.parent != (Object)null));
			BaseScript = ((Component)this).GetComponentInParent<PikminAI>();
			if ((Object)(object)BaseScript != (Object)null)
			{
				SubscribeToEvents();
			}
			if (LethalMin.DebugMode)
			{
				LethalMin.Logger.LogInfo((object)("Custom Pikmin script attached to " + BaseScript?.uniqueDebugId));
			}
		}

		public override void OnNetworkDespawn()
		{
			((NetworkBehaviour)this).OnNetworkSpawn();
			if ((Object)(object)BaseScript != (Object)null)
			{
				UnSubscribeToEvents();
			}
		}

		private void SubscribeToEvents()
		{
			//IL_0013: Unknown result type (might be due to invalid IL or missing references)
			//IL_001d: Expected O, but got Unknown
			//IL_0030: Unknown result type (might be due to invalid IL or missing references)
			//IL_003a: Expected O, but got Unknown
			//IL_004d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0057: Expected O, but got Unknown
			//IL_006a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0074: Expected O, but got Unknown
			//IL_0087: Unknown result type (might be due to invalid IL or missing references)
			//IL_0091: Expected O, but got Unknown
			//IL_00a4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ae: Expected O, but got Unknown
			//IL_00c1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00cb: Expected O, but got Unknown
			//IL_00de: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e8: Expected O, but got Unknown
			//IL_00fb: Unknown result type (might be due to invalid IL or missing references)
			//IL_0105: Expected O, but got Unknown
			//IL_0118: Unknown result type (might be due to invalid IL or missing references)
			//IL_0122: Expected O, but got Unknown
			//IL_0135: Unknown result type (might be due to invalid IL or missing references)
			//IL_013f: Expected O, but got Unknown
			//IL_0152: Unknown result type (might be due to invalid IL or missing references)
			//IL_015c: Expected O, but got Unknown
			//IL_016f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0179: Expected O, but got Unknown
			//IL_018c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0196: Expected O, but got Unknown
			//IL_01a9: Unknown result type (might be due to invalid IL or missing references)
			//IL_01b3: Expected O, but got Unknown
			//IL_01c6: Unknown result type (might be due to invalid IL or missing references)
			//IL_01d0: Expected O, but got Unknown
			//IL_01e3: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ed: Expected O, but got Unknown
			//IL_0200: Unknown result type (might be due to invalid IL or missing references)
			//IL_020a: Expected O, but got Unknown
			//IL_021d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0227: Expected O, but got Unknown
			//IL_023a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0244: Expected O, but got Unknown
			//IL_0257: Unknown result type (might be due to invalid IL or missing references)
			//IL_0261: Expected O, but got Unknown
			//IL_0274: Unknown result type (might be due to invalid IL or missing references)
			//IL_027e: Expected O, but got Unknown
			//IL_0291: Unknown result type (might be due to invalid IL or missing references)
			//IL_029b: Expected O, but got Unknown
			//IL_02ae: Unknown result type (might be due to invalid IL or missing references)
			//IL_02b8: Expected O, but got Unknown
			//IL_02cb: Unknown result type (might be due to invalid IL or missing references)
			//IL_02d5: Expected O, but got Unknown
			//IL_02e8: Unknown result type (might be due to invalid IL or missing references)
			//IL_02f2: Expected O, but got Unknown
			//IL_0305: Unknown result type (might be due to invalid IL or missing references)
			//IL_030f: Expected O, but got Unknown
			//IL_0322: Unknown result type (might be due to invalid IL or missing references)
			//IL_032c: Expected O, but got Unknown
			//IL_033f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0349: Expected O, but got Unknown
			//IL_035c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0366: Expected O, but got Unknown
			//IL_0379: Unknown result type (might be due to invalid IL or missing references)
			//IL_0383: Expected O, but got Unknown
			//IL_0396: Unknown result type (might be due to invalid IL or missing references)
			//IL_03a0: Expected O, but got Unknown
			//IL_03b3: Unknown result type (might be due to invalid IL or missing references)
			//IL_03bd: Expected O, but got Unknown
			//IL_03d0: Unknown result type (might be due to invalid IL or missing references)
			//IL_03da: Expected O, but got Unknown
			//IL_03ed: Unknown result type (might be due to invalid IL or missing references)
			//IL_03f7: Expected O, but got Unknown
			//IL_040a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0414: Expected O, but got Unknown
			//IL_0427: Unknown result type (might be due to invalid IL or missing references)
			//IL_0431: Expected O, but got Unknown
			//IL_0444: Unknown result type (might be due to invalid IL or missing references)
			//IL_044e: Expected O, but got Unknown
			//IL_0461: Unknown result type (might be due to invalid IL or missing references)
			//IL_046b: Expected O, but got Unknown
			//IL_047e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0488: Expected O, but got Unknown
			//IL_049b: Unknown result type (might be due to invalid IL or missing references)
			//IL_04a5: Expected O, but got Unknown
			//IL_04b8: Unknown result type (might be due to invalid IL or missing references)
			//IL_04c2: Expected O, but got Unknown
			//IL_04d5: Unknown result type (might be due to invalid IL or missing references)
			//IL_04df: Expected O, but got Unknown
			//IL_04f2: Unknown result type (might be due to invalid IL or missing references)
			//IL_04fc: Expected O, but got Unknown
			//IL_050f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0519: Expected O, but got Unknown
			//IL_052c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0536: Expected O, but got Unknown
			//IL_0549: Unknown result type (might be due to invalid IL or missing references)
			//IL_0553: Expected O, but got Unknown
			//IL_0566: Unknown result type (might be due to invalid IL or missing references)
			//IL_0570: Expected O, but got Unknown
			//IL_0583: Unknown result type (might be due to invalid IL or missing references)
			//IL_058d: Expected O, but got Unknown
			//IL_05a0: Unknown result type (might be due to invalid IL or missing references)
			//IL_05aa: Expected O, but got Unknown
			//IL_05bd: Unknown result type (might be due to invalid IL or missing references)
			//IL_05c7: Expected O, but got Unknown
			//IL_05da: Unknown result type (might be due to invalid IL or missing references)
			//IL_05e4: Expected O, but got Unknown
			BaseScript.OnDoAIInterval.AddListener(new UnityAction(OnDoAIIntervalHandler));
			BaseScript.OnHandleIdleState.AddListener(new UnityAction(OnHandleIdleStateHandler));
			BaseScript.OnHandleFollowingState.AddListener(new UnityAction(OnHandleFollowingStateHandler));
			BaseScript.OnHandleAirbornState.AddListener(new UnityAction(OnHandleAirbornStateHandler));
			BaseScript.OnHandleDrowningState.AddListener(new UnityAction(OnHandleDrowningStateHandler));
			BaseScript.OnHandleWorkingState.AddListener(new UnityAction(OnHandleWorkingStateHandler));
			BaseScript.OnHandleAttackingState.AddListener(new UnityAction(OnHandleAttackingStateHandler));
			BaseScript.OnHandleLeavingState.AddListener(new UnityAction(OnHandleLeavingStateHandler));
			BaseScript.OnHandleLeaderLost.AddListener(new UnityAction(OnHandleLeaderLostHandler));
			BaseScript.OnCheckForNearbyPlayers.AddListener(new UnityAction(OnCheckForNearbyPlayersHandler));
			BaseScript.OnAssignLeader.AddListener(new UnityAction(OnAssignLeaderHandler));
			BaseScript.OnAssignLeaderServerRpc.AddListener(new UnityAction(OnAssignLeaderServerRpcHandler));
			BaseScript.OnAssignLeaderResponseClientRpc.AddListener(new UnityAction(OnAssignLeaderResponseClientRpcHandler));
			BaseScript.OnFindLeaderManagerForPlayer.AddListener(new UnityAction(OnFindLeaderManagerForPlayerHandler));
			BaseScript.OnSetDrowningClientRpc.AddListener(new UnityAction(OnSetDrowningClientRpcHandler));
			BaseScript.OnStopDrowningClientRpc.AddListener(new UnityAction(OnStopDrowningClientRpcHandler));
			BaseScript.OnIsNearDestination.AddListener(new UnityAction(OnIsNearDestinationHandler));
			BaseScript.OnRemoveFromItemServerRpc.AddListener(new UnityAction(OnRemoveFromItemServerRpcHandler));
			BaseScript.OnSetTargetItemServerRpc.AddListener(new UnityAction(OnSetTargetItemServerRpcHandler));
			BaseScript.OnSetTargetItemClientRpc.AddListener(new UnityAction(OnSetTargetItemClientRpcHandler));
			BaseScript.OnDetectNearbyItems.AddListener(new UnityAction(OnDetectNearbyItemsHandler));
			BaseScript.OnMoveTowardsItem.AddListener(new UnityAction(OnMoveTowardsItemHandler));
			BaseScript.OnCheckLineOfSightForItem.AddListener(new UnityAction(OnCheckLineOfSightForItemHandler));
			BaseScript.OnLandPikminClientRpc.AddListener(new UnityAction(OnLandPikminClientRpcHandler));
			BaseScript.OnLatchOntoEnemyClientRpc.AddListener(new UnityAction(OnLatchOntoEnemyClientRpcHandler));
			BaseScript.OnOnCollideWithEnemy.AddListener(new UnityAction(OnCollideWithEnemyHandler));
			BaseScript.OnDoAIIntervalEnd.AddListener(new UnityAction(OnDoAIIntervalEndHandler));
			BaseScript.OnHandleIdleStateEnd.AddListener(new UnityAction(OnHandleIdleStateEndHandler));
			BaseScript.OnHandleFollowingStateEnd.AddListener(new UnityAction(OnHandleFollowingStateEndHandler));
			BaseScript.OnHandleAirbornStateEnd.AddListener(new UnityAction(OnHandleAirbornStateEndHandler));
			BaseScript.OnHandleDrowningStateEnd.AddListener(new UnityAction(OnHandleDrowningStateEndHandler));
			BaseScript.OnHandleWorkingStateEnd.AddListener(new UnityAction(OnHandleWorkingStateEndHandler));
			BaseScript.OnHandleAttackingStateEnd.AddListener(new UnityAction(OnHandleAttackingStateEndHandler));
			BaseScript.OnHandleLeavingStateEnd.AddListener(new UnityAction(OnHandleLeavingStateEndHandler));
			BaseScript.OnHandleLeaderLostEnd.AddListener(new UnityAction(OnHandleLeaderLostEndHandler));
			BaseScript.OnCheckForNearbyPlayersEnd.AddListener(new UnityAction(OnCheckForNearbyPlayersEndHandler));
			BaseScript.OnAssignLeaderEnd.AddListener(new UnityAction(OnAssignLeaderEndHandler));
			BaseScript.OnAssignLeaderServerRpcEnd.AddListener(new UnityAction(OnAssignLeaderServerRpcEndHandler));
			BaseScript.OnAssignLeaderResponseClientRpcEnd.AddListener(new UnityAction(OnAssignLeaderResponseClientRpcEndHandler));
			BaseScript.OnFindLeaderManagerForPlayerEnd.AddListener(new UnityAction(OnFindLeaderManagerForPlayerEndHandler));
			BaseScript.OnSetDrowningClientRpcEnd.AddListener(new UnityAction(OnSetDrowningClientRpcEndHandler));
			BaseScript.OnStopDrowningClientRpcEnd.AddListener(new UnityAction(OnStopDrowningClientRpcEndHandler));
			BaseScript.OnIsNearDestinationEnd.AddListener(new UnityAction(OnIsNearDestinationEndHandler));
			BaseScript.OnRemoveFromItemServerRpcEnd.AddListener(new UnityAction(OnRemoveFromItemServerRpcEndHandler));
			BaseScript.OnSetTargetItemServerRpcEnd.AddListener(new UnityAction(OnSetTargetItemServerRpcEndHandler));
			BaseScript.OnSetTargetItemClientRpcEnd.AddListener(new UnityAction(OnSetTargetItemClientRpcEndHandler));
			BaseScript.OnDetectNearbyItemsEnd.AddListener(new UnityAction(OnDetectNearbyItemsEndHandler));
			BaseScript.OnMoveTowardsItemEnd.AddListener(new UnityAction(OnMoveTowardsItemEndHandler));
			BaseScript.OnCheckLineOfSightForItemEnd.AddListener(new UnityAction(OnCheckLineOfSightForItemEndHandler));
			BaseScript.OnLandPikminEnd.AddListener(new UnityAction(OnLandPikminClientRpcEndHandler));
			BaseScript.OnLatchOntoEnemyEnd.AddListener(new UnityAction(OnLatchOntoEnemyClientRpcEndHandler));
			BaseScript.OnOnCollideWithEnemyEnd.AddListener(new UnityAction(OnCollideWithEnemyEndHandler));
		}

		private void UnSubscribeToEvents()
		{
			//IL_0013: Unknown result type (might be due to invalid IL or missing references)
			//IL_001d: Expected O, but got Unknown
			//IL_0030: Unknown result type (might be due to invalid IL or missing references)
			//IL_003a: Expected O, but got Unknown
			//IL_004d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0057: Expected O, but got Unknown
			//IL_006a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0074: Expected O, but got Unknown
			//IL_0087: Unknown result type (might be due to invalid IL or missing references)
			//IL_0091: Expected O, but got Unknown
			//IL_00a4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ae: Expected O, but got Unknown
			//IL_00c1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00cb: Expected O, but got Unknown
			//IL_00de: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e8: Expected O, but got Unknown
			//IL_00fb: Unknown result type (might be due to invalid IL or missing references)
			//IL_0105: Expected O, but got Unknown
			//IL_0118: Unknown result type (might be due to invalid IL or missing references)
			//IL_0122: Expected O, but got Unknown
			//IL_0135: Unknown result type (might be due to invalid IL or missing references)
			//IL_013f: Expected O, but got Unknown
			//IL_0152: Unknown result type (might be due to invalid IL or missing references)
			//IL_015c: Expected O, but got Unknown
			//IL_016f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0179: Expected O, but got Unknown
			//IL_018c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0196: Expected O, but got Unknown
			//IL_01a9: Unknown result type (might be due to invalid IL or missing references)
			//IL_01b3: Expected O, but got Unknown
			//IL_01c6: Unknown result type (might be due to invalid IL or missing references)
			//IL_01d0: Expected O, but got Unknown
			//IL_01e3: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ed: Expected O, but got Unknown
			//IL_0200: Unknown result type (might be due to invalid IL or missing references)
			//IL_020a: Expected O, but got Unknown
			//IL_021d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0227: Expected O, but got Unknown
			//IL_023a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0244: Expected O, but got Unknown
			//IL_0257: Unknown result type (might be due to invalid IL or missing references)
			//IL_0261: Expected O, but got Unknown
			//IL_0274: Unknown result type (might be due to invalid IL or missing references)
			//IL_027e: Expected O, but got Unknown
			//IL_0291: Unknown result type (might be due to invalid IL or missing references)
			//IL_029b: Expected O, but got Unknown
			//IL_02ae: Unknown result type (might be due to invalid IL or missing references)
			//IL_02b8: Expected O, but got Unknown
			//IL_02cb: Unknown result type (might be due to invalid IL or missing references)
			//IL_02d5: Expected O, but got Unknown
			//IL_02e8: Unknown result type (might be due to invalid IL or missing references)
			//IL_02f2: Expected O, but got Unknown
			//IL_0305: Unknown result type (might be due to invalid IL or missing references)
			//IL_030f: Expected O, but got Unknown
			//IL_0322: Unknown result type (might be due to invalid IL or missing references)
			//IL_032c: Expected O, but got Unknown
			//IL_033f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0349: Expected O, but got Unknown
			//IL_035c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0366: Expected O, but got Unknown
			//IL_0379: Unknown result type (might be due to invalid IL or missing references)
			//IL_0383: Expected O, but got Unknown
			//IL_0396: Unknown result type (might be due to invalid IL or missing references)
			//IL_03a0: Expected O, but got Unknown
			//IL_03b3: Unknown result type (might be due to invalid IL or missing references)
			//IL_03bd: Expected O, but got Unknown
			//IL_03d0: Unknown result type (might be due to invalid IL or missing references)
			//IL_03da: Expected O, but got Unknown
			//IL_03ed: Unknown result type (might be due to invalid IL or missing references)
			//IL_03f7: Expected O, but got Unknown
			//IL_040a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0414: Expected O, but got Unknown
			//IL_0427: Unknown result type (might be due to invalid IL or missing references)
			//IL_0431: Expected O, but got Unknown
			//IL_0444: Unknown result type (might be due to invalid IL or missing references)
			//IL_044e: Expected O, but got Unknown
			//IL_0461: Unknown result type (might be due to invalid IL or missing references)
			//IL_046b: Expected O, but got Unknown
			//IL_047e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0488: Expected O, but got Unknown
			//IL_049b: Unknown result type (might be due to invalid IL or missing references)
			//IL_04a5: Expected O, but got Unknown
			//IL_04b8: Unknown result type (might be due to invalid IL or missing references)
			//IL_04c2: Expected O, but got Unknown
			//IL_04d5: Unknown result type (might be due to invalid IL or missing references)
			//IL_04df: Expected O, but got Unknown
			//IL_04f2: Unknown result type (might be due to invalid IL or missing references)
			//IL_04fc: Expected O, but got Unknown
			//IL_050f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0519: Expected O, but got Unknown
			//IL_052c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0536: Expected O, but got Unknown
			//IL_0549: Unknown result type (might be due to invalid IL or missing references)
			//IL_0553: Expected O, but got Unknown
			//IL_0566: Unknown result type (might be due to invalid IL or missing references)
			//IL_0570: Expected O, but got Unknown
			//IL_0583: Unknown result type (might be due to invalid IL or missing references)
			//IL_058d: Expected O, but got Unknown
			//IL_05a0: Unknown result type (might be due to invalid IL or missing references)
			//IL_05aa: Expected O, but got Unknown
			//IL_05bd: Unknown result type (might be due to invalid IL or missing references)
			//IL_05c7: Expected O, but got Unknown
			//IL_05da: Unknown result type (might be due to invalid IL or missing references)
			//IL_05e4: Expected O, but got Unknown
			BaseScript.OnDoAIInterval.RemoveListener(new UnityAction(OnDoAIIntervalHandler));
			BaseScript.OnHandleIdleState.RemoveListener(new UnityAction(OnHandleIdleStateHandler));
			BaseScript.OnHandleFollowingState.RemoveListener(new UnityAction(OnHandleFollowingStateHandler));
			BaseScript.OnHandleAirbornState.RemoveListener(new UnityAction(OnHandleAirbornStateHandler));
			BaseScript.OnHandleDrowningState.RemoveListener(new UnityAction(OnHandleDrowningStateHandler));
			BaseScript.OnHandleWorkingState.RemoveListener(new UnityAction(OnHandleWorkingStateHandler));
			BaseScript.OnHandleAttackingState.RemoveListener(new UnityAction(OnHandleAttackingStateHandler));
			BaseScript.OnHandleLeavingState.RemoveListener(new UnityAction(OnHandleLeavingStateHandler));
			BaseScript.OnHandleLeaderLost.RemoveListener(new UnityAction(OnHandleLeaderLostHandler));
			BaseScript.OnCheckForNearbyPlayers.RemoveListener(new UnityAction(OnCheckForNearbyPlayersHandler));
			BaseScript.OnAssignLeader.RemoveListener(new UnityAction(OnAssignLeaderHandler));
			BaseScript.OnAssignLeaderServerRpc.RemoveListener(new UnityAction(OnAssignLeaderServerRpcHandler));
			BaseScript.OnAssignLeaderResponseClientRpc.RemoveListener(new UnityAction(OnAssignLeaderResponseClientRpcHandler));
			BaseScript.OnFindLeaderManagerForPlayer.RemoveListener(new UnityAction(OnFindLeaderManagerForPlayerHandler));
			BaseScript.OnSetDrowningClientRpc.RemoveListener(new UnityAction(OnSetDrowningClientRpcHandler));
			BaseScript.OnStopDrowningClientRpc.RemoveListener(new UnityAction(OnStopDrowningClientRpcHandler));
			BaseScript.OnIsNearDestination.RemoveListener(new UnityAction(OnIsNearDestinationHandler));
			BaseScript.OnRemoveFromItemServerRpc.RemoveListener(new UnityAction(OnRemoveFromItemServerRpcHandler));
			BaseScript.OnSetTargetItemServerRpc.RemoveListener(new UnityAction(OnSetTargetItemServerRpcHandler));
			BaseScript.OnSetTargetItemClientRpc.RemoveListener(new UnityAction(OnSetTargetItemClientRpcHandler));
			BaseScript.OnDetectNearbyItems.RemoveListener(new UnityAction(OnDetectNearbyItemsHandler));
			BaseScript.OnMoveTowardsItem.RemoveListener(new UnityAction(OnMoveTowardsItemHandler));
			BaseScript.OnCheckLineOfSightForItem.RemoveListener(new UnityAction(OnCheckLineOfSightForItemHandler));
			BaseScript.OnLandPikminClientRpc.RemoveListener(new UnityAction(OnLandPikminClientRpcHandler));
			BaseScript.OnLatchOntoEnemyClientRpc.RemoveListener(new UnityAction(OnLatchOntoEnemyClientRpcHandler));
			BaseScript.OnOnCollideWithEnemy.RemoveListener(new UnityAction(OnCollideWithEnemyHandler));
			BaseScript.OnDoAIIntervalEnd.RemoveListener(new UnityAction(OnDoAIIntervalEndHandler));
			BaseScript.OnHandleIdleStateEnd.RemoveListener(new UnityAction(OnHandleIdleStateEndHandler));
			BaseScript.OnHandleFollowingStateEnd.RemoveListener(new UnityAction(OnHandleFollowingStateEndHandler));
			BaseScript.OnHandleAirbornStateEnd.RemoveListener(new UnityAction(OnHandleAirbornStateEndHandler));
			BaseScript.OnHandleDrowningStateEnd.RemoveListener(new UnityAction(OnHandleDrowningStateEndHandler));
			BaseScript.OnHandleWorkingStateEnd.RemoveListener(new UnityAction(OnHandleWorkingStateEndHandler));
			BaseScript.OnHandleAttackingStateEnd.RemoveListener(new UnityAction(OnHandleAttackingStateEndHandler));
			BaseScript.OnHandleLeavingStateEnd.RemoveListener(new UnityAction(OnHandleLeavingStateEndHandler));
			BaseScript.OnHandleLeaderLostEnd.RemoveListener(new UnityAction(OnHandleLeaderLostEndHandler));
			BaseScript.OnCheckForNearbyPlayersEnd.RemoveListener(new UnityAction(OnCheckForNearbyPlayersEndHandler));
			BaseScript.OnAssignLeaderEnd.RemoveListener(new UnityAction(OnAssignLeaderEndHandler));
			BaseScript.OnAssignLeaderServerRpcEnd.RemoveListener(new UnityAction(OnAssignLeaderServerRpcEndHandler));
			BaseScript.OnAssignLeaderResponseClientRpcEnd.RemoveListener(new UnityAction(OnAssignLeaderResponseClientRpcEndHandler));
			BaseScript.OnFindLeaderManagerForPlayerEnd.RemoveListener(new UnityAction(OnFindLeaderManagerForPlayerEndHandler));
			BaseScript.OnSetDrowningClientRpcEnd.RemoveListener(new UnityAction(OnSetDrowningClientRpcEndHandler));
			BaseScript.OnStopDrowningClientRpcEnd.RemoveListener(new UnityAction(OnStopDrowningClientRpcEndHandler));
			BaseScript.OnIsNearDestinationEnd.RemoveListener(new UnityAction(OnIsNearDestinationEndHandler));
			BaseScript.OnRemoveFromItemServerRpcEnd.RemoveListener(new UnityAction(OnRemoveFromItemServerRpcEndHandler));
			BaseScript.OnSetTargetItemServerRpcEnd.RemoveListener(new UnityAction(OnSetTargetItemServerRpcEndHandler));
			BaseScript.OnSetTargetItemClientRpcEnd.RemoveListener(new UnityAction(OnSetTargetItemClientRpcEndHandler));
			BaseScript.OnDetectNearbyItemsEnd.RemoveListener(new UnityAction(OnDetectNearbyItemsEndHandler));
			BaseScript.OnMoveTowardsItemEnd.RemoveListener(new UnityAction(OnMoveTowardsItemEndHandler));
			BaseScript.OnCheckLineOfSightForItemEnd.RemoveListener(new UnityAction(OnCheckLineOfSightForItemEndHandler));
			BaseScript.OnLandPikminEnd.RemoveListener(new UnityAction(OnLandPikminClientRpcEndHandler));
			BaseScript.OnLatchOntoEnemyEnd.RemoveListener(new UnityAction(OnLatchOntoEnemyClientRpcEndHandler));
			BaseScript.OnOnCollideWithEnemyEnd.RemoveListener(new UnityAction(OnCollideWithEnemyEndHandler));
		}

		private void OnDoAIIntervalHandler()
		{
		}

		private void OnHandleIdleStateHandler()
		{
		}

		private void OnHandleFollowingStateHandler()
		{
		}

		private void OnHandleAirbornStateHandler()
		{
		}

		private void OnHandleDrowningStateHandler()
		{
		}

		private void OnHandleWorkingStateHandler()
		{
		}

		private void OnHandleAttackingStateHandler()
		{
		}

		private void OnHandleLeavingStateHandler()
		{
		}

		private void OnHandleLeaderLostHandler()
		{
		}

		private void OnCheckForNearbyPlayersHandler()
		{
		}

		private void OnAssignLeaderHandler()
		{
		}

		private void OnAssignLeaderServerRpcHandler()
		{
		}

		private void OnAssignLeaderResponseClientRpcHandler()
		{
		}

		private void OnFindLeaderManagerForPlayerHandler()
		{
		}

		private void OnSetDrowningClientRpcHandler()
		{
		}

		private void OnStopDrowningClientRpcHandler()
		{
		}

		private void OnIsNearDestinationHandler()
		{
		}

		private void OnRemoveFromItemServerRpcHandler()
		{
		}

		private void OnSetTargetItemServerRpcHandler()
		{
		}

		private void OnSetTargetItemClientRpcHandler()
		{
		}

		private void OnDetectNearbyItemsHandler()
		{
		}

		private void OnMoveTowardsItemHandler()
		{
		}

		private void OnCheckLineOfSightForItemHandler()
		{
		}

		private void OnLandPikminClientRpcHandler()
		{
		}

		private void OnLatchOntoEnemyClientRpcHandler()
		{
		}

		private void OnDoAIIntervalEndHandler()
		{
		}

		private void OnHandleIdleStateEndHandler()
		{
		}

		private void OnHandleFollowingStateEndHandler()
		{
		}

		private void OnHandleAirbornStateEndHandler()
		{
		}

		private void OnHandleDrowningStateEndHandler()
		{
		}

		private void OnHandleWorkingStateEndHandler()
		{
		}

		private void OnHandleAttackingStateEndHandler()
		{
		}

		private void OnHandleLeavingStateEndHandler()
		{
		}

		private void OnHandleLeaderLostEndHandler()
		{
		}

		private void OnCheckForNearbyPlayersEndHandler()
		{
		}

		private void OnAssignLeaderEndHandler()
		{
		}

		private void OnAssignLeaderServerRpcEndHandler()
		{
		}

		private void OnAssignLeaderResponseClientRpcEndHandler()
		{
		}

		private void OnFindLeaderManagerForPlayerEndHandler()
		{
		}

		private void OnSetDrowningClientRpcEndHandler()
		{
		}

		private void OnStopDrowningClientRpcEndHandler()
		{
		}

		private void OnIsNearDestinationEndHandler()
		{
		}

		private void OnRemoveFromItemServerRpcEndHandler()
		{
		}

		private void OnSetTargetItemServerRpcEndHandler()
		{
		}

		private void OnSetTargetItemClientRpcEndHandler()
		{
		}

		private void OnDetectNearbyItemsEndHandler()
		{
		}

		private void OnMoveTowardsItemEndHandler()
		{
		}

		private void OnCheckLineOfSightForItemEndHandler()
		{
		}

		private void OnLandPikminClientRpcEndHandler()
		{
		}

		private void OnLatchOntoEnemyClientRpcEndHandler()
		{
		}

		private void OnCollideWithEnemyEndHandler()
		{
		}

		private void OnCollideWithEnemyHandler()
		{
		}

		protected override void __initializeVariables()
		{
			((NetworkBehaviour)this).__initializeVariables();
		}

		protected internal override string __getTypeName()
		{
			return "CustomPikminScriptExample";
		}
	}
	public interface IDebuggable
	{
		[AttributeUsage(AttributeTargets.Property | AttributeTargets.Field, Inherited = true, AllowMultiple = false)]
		public class DebugAttribute : Attribute
		{
		}
	}
	public class DebugMenu : MonoBehaviour
	{
		private Dictionary<string, List<(GameObject gameObject, List<(string name, FieldInfo field, PropertyInfo property, object target)> items)>> debugItems = new Dictionary<string, List<(GameObject, List<(string, FieldInfo, PropertyInfo, object)>)>>();

		private Vector2 mainScrollPosition;

		private Dictionary<string, Vector2> classScrollPositions = new Dictionary<string, Vector2>();

		private bool showDebugMenu = false;

		private string selectedClassName = null;

		private float classContentHeight = 0f;

		private const float MenuWidth = 400f;

		private const float MenuHeight = 600f;

		private const float ClassViewHeight = 400f;

		private void Start()
		{
			CollectDebuggableItems();
		}

		private void Update()
		{
			//IL_0008: Unknown result type (might be due to invalid IL or missing references)
			//IL_000d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0021: Unknown result type (might be due to invalid IL or missing references)
			//IL_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)
			Vector3 pos = Vector3.zero;
			_ = ((Component)StartOfRound.Instance.localPlayerController).transform.position;
			if (true)
			{
				pos = ((Component)StartOfRound.Instance.localPlayerController).transform.position;
			}
			foreach (string item in debugItems.Keys.ToList())
			{
				if (debugItems[item].Count == 0)
				{
					debugItems.Remove(item);
					continue;
				}
				debugItems[item] = (from item in debugItems[item]
					where (Object)(object)item.gameObject != (Object)null
					orderby Vector3.Distance(item.gameObject.transform.position, pos)
					select item).ToList();
			}
			if (!showDebugMenu)
			{
			}
		}

		private void CollectDebuggableItems()
		{
			debugItems.Clear();
			IDebuggable[] array = Object.FindObjectsOfType<MonoBehaviour>().OfType<IDebuggable>().ToArray();
			IDebuggable[] array2 = array;
			foreach (IDebuggable debuggable in array2)
			{
				if (debuggable == null)
				{
					continue;
				}
				MonoBehaviour val = (MonoBehaviour)((debuggable is MonoBehaviour) ? debuggable : null);
				if ((Object)(object)val == (Object)null)
				{
					continue;
				}
				string name = ((object)val).GetType().Name;
				if (!debugItems.ContainsKey(name))
				{
					debugItems[name] = new List<(GameObject, List<(string, FieldInfo, PropertyInfo, object)>)>();
				}
				List<(string, FieldInfo, PropertyInfo, object)> list = new List<(string, FieldInfo, PropertyInfo, object)>();
				list.Add(("Position", null, ((object)((Component)val).transform).GetType().GetProperty("position"), ((Component)val).transform));
				FieldInfo[] fields = ((object)val).GetType().GetFields(BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic);
				PropertyInfo[] properties = ((object)val).GetType().GetProperties(BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic);
				FieldInfo[] array3 = fields;
				foreach (FieldInfo fieldInfo in array3)
				{
					if (Attribute.GetCustomAttribute(fieldInfo, typeof(IDebuggable.DebugAttribute)) != null)
					{
						list.Add((fieldInfo.Name, fieldInfo, null, val));
					}
				}
				PropertyInfo[] array4 = properties;
				foreach (PropertyInfo propertyInfo in array4)
				{
					if (Attribute.GetCustomAttribute(propertyInfo, typeof(IDebuggable.DebugAttribute)) != null)
					{
						list.Add((propertyInfo.Name, null, propertyInfo, val));
					}
				}
				debugItems[name].Add((((Component)val).gameObject, list));
			}
			using Dictionary<string, List<(GameObject, List<(string, FieldInfo, PropertyInfo, object)>)>>.KeyCollection.Enumerator enumerator = debugItems.Keys.GetEnumerator();
			if (enumerator.MoveNext())
			{
				string current = enumerator.Current;
			}
		}

		private void OnGUI()
		{
			//IL_0015: Unknown result type (might be due to invalid IL or missing references)
			//IL_0357: Unknown result type (might be due to invalid IL or missing references)
			//IL_006e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0093: Unknown result type (might be due to invalid IL or missing references)
			//IL_0099: 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_00b8: Unknown result type (might be due to invalid IL or missing references)
			//IL_00bd: Unknown result type (might be due to invalid IL or missing references)
			//IL_0105: Unknown result type (might be due to invalid IL or missing references)
			//IL_0261: Unknown result type (might be due to invalid IL or missing references)
			//IL_01f1: Unknown result type (might be due to invalid IL or missing references)
			//IL_01fb: Unknown result type (might be due to invalid IL or missing references)
			//IL_0200: Unknown result type (might be due to invalid IL or missing references)
			//IL_0202: 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)
			if (GUI.Button(new Rect(10f, 10f, 100f, 30f), "Debug Menu"))
			{
				showDebugMenu = !showDebugMenu;
				if (showDebugMenu)
				{
					CollectDebuggableItems();
				}
			}
			if (!showDebugMenu)
			{
				return;
			}
			GUI.Box(new Rect(10f, 50f, 400f, 600f), "Debug Menu");
			mainScrollPosition = GUI.BeginScrollView(new Rect(10f, 80f, 400f, 570f), mainScrollPosition, new Rect(0f, 0f, 370f, classContentHeight));
			float num = 0f;
			classContentHeight = 0f;
			Rect val = default(Rect);
			Rect val2 = default(Rect);
			foreach (string key in debugItems.Keys)
			{
				if (GUI.Button(new Rect(10f, num, 360f, 30f), $"{key} ({debugItems[key].Count})"))
				{
					selectedClassName = ((selectedClassName == key) ? null : key);
				}
				num += 35f;
				classContentHeight += 35f;
				if (!(selectedClassName == key))
				{
					continue;
				}
				if (!classScrollPositions.ContainsKey(key))
				{
					classScrollPositions[key] = Vector2.zero;
				}
				float num2 = CalculateClassContentHeight(key);
				((Rect)(ref val))..ctor(20f, num, 340f, 400f);
				((Rect)(ref val2))..ctor(0f, 0f, 320f, num2);
				classScrollPositions[key] = GUI.BeginScrollView(val, classScrollPositions[key], val2);
				float num3 = 0f;
				foreach (var item in debugItems[key])
				{
					if ((Object)(object)item.gameObject == (Object)null)
					{
						continue;
					}
					GUI.Label(new Rect(0f, num3, 320f, 25f), ((Object)item.gameObject).name, GUI.skin.button);
					num3 += 30f;
					foreach (var item2 in item.items)
					{
						string text = "N/A";
						try
						{
							text = ((!(item2.field != null)) ? (item2.property.GetValue(item2.target)?.ToString() ?? "null") : (item2.field.GetValue(item2.target)?.ToString() ?? "null"));
						}
						catch (Exception ex)
						{
							LethalMin.Logger.LogError((object)("Error getting value for " + item2.name + ": " + ex.Message));
						}
						GUI.Label(new Rect(10f, num3, 310f, 20f), item2.name + ": " + text);
						num3 += 25f;
					}
					num3 += 10f;
				}
				GUI.EndScrollView();
				num += 410f;
				num2 += 410f;
			}
			GUI.EndScrollView();
		}

		private float CalculateClassContentHeight(string className)
		{
			float num = 0f;
			foreach (var item in debugItems[className])
			{
				if (!((Object)(object)item.gameObject == (Object)null))
				{
					num += (float)(30 + item.items.Count * 25 + 10);
				}
			}
			return num;
		}
	}
	public class DictionaryIntArrayConverter : JsonConverter
	{
		public override void WriteJson(JsonWriter writer, object value, JsonSerializer serializer)
		{
			Dictionary<int, int[]> dictionary = (Dictionary<int, int[]>)value;
			writer.WriteStartObject();
			foreach (KeyValuePair<int, int[]> item in dictionary)
			{
				writer.WritePropertyName(item.Key.ToString());
				serializer.Serialize(writer, (object)item.Value);
			}
			writer.WriteEndObject();
		}

		public override object ReadJson(JsonReader reader, Type objectType, object existingValue, JsonSerializer serializer)
		{
			//IL_000b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0012: Invalid comparison between Unknown and I4
			//IL_001b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0021: Invalid comparison between Unknown and I4
			Dictionary<int, int[]> dictionary = new Dictionary<int, int[]>();
			while (reader.Read() && (int)reader.TokenType != 13)
			{
				if ((int)reader.TokenType == 4)
				{
					int key = int.Parse((string)reader.Value);
					reader.Read();
					int[] value = serializer.Deserialize<int[]>(reader);
					dictionary.Add(key, value);
				}
			}
			return dictionary;
		}

		public override bool CanConvert(Type objectType)
		{
			return objectType == typeof(Dictionary<int, int[]>);
		}
	}
	public class DualOnion : Onion
	{
		public GameObject MainMesh;

		public GameObject Beam;

		public GameObject Cone;

		public bool IsBeamOut;

		public bool InteractionSetup;

		public override void Start()
		{
			AnimPos = ((Component)this).transform.Find("PikminAnimPos");
			SetupMesh();
			SetupBeam();
			Cone = ((Component)((Component)this).transform.Find("BeamZone/Cone")).gameObject;
			HideCone();
			Beam.SetActive(false);
			base.Start();
		}

		protected override void SetupInteractTrigger()
		{
			base.SetupInteractTrigger();
			InteractionSetup = true;
		}

		public void Update()
		{
			if ((Object)(object)Beam == (Object)null)
			{
				Beam = ((Component)((Component)this).transform.Find("BeamZone")).gameObject;
			}
			if ((Object)(object)Cone == (Object)null)
			{
				Cone = ((Component)((Component)this).transform.Find("BeamZone/Cone")).gameObject;
			}
			bool flag = StartOfRound.Instance.inShipPhase || StartOfRound.Instance.shipIsLeaving || !StartOfRound.Instance.shipHasLanded;
			if (flag && IsBeamOut)
			{
				IsBeamOut = false;
				HideCone();
			}
			else if (!flag && !Beam.activeSelf && (!(RoundManager.Instance.currentLevel.sceneName == "CompanyBuilding") || LethalMin.CanWalkAtCompany()))
			{
				IsBeamOut = true;
				ShowCone();
				Beam.SetActive(true);
			}
		}

		private void SetupBeam()
		{
			Beam = ((Component)((Component)this).transform.Find("BeamZone")).gameObject;
			Beam.SetActive(false);
		}

		private void ShowCone()
		{
			LethalMin.Logger.LogInfo((object)"ShowCalled");
			if ((Object)(object)Cone != (Object)null)
			{
				Beam.SetActive(true);
				Cone.GetComponent<Animator>().Play("ShowCone");
			}
		}

		private void HideCone()
		{
			LethalMin.Logger.LogInfo((object)"HideCalled");
			if ((Object)(object)Cone != (Object)null)
			{
				Cone.GetComponent<Animator>().Play("HideCone");
				((MonoBehaviour)this).StartCoroutine(DisableConeAfterAnimation());
			}
		}

		private IEnumerator DisableConeAfterAnimation()
		{
			yield return (object)new WaitForSeconds(1.1f);
			Beam.SetActive(false);
		}

		private void SetupMesh()
		{
			MainMesh = ((Component)((Component)this).transform.Find("PikminContainerNew")).gameObject;
			if ((Object)(object)MainMesh == (Object)null)
			{
				LethalMin.Logger.LogError((object)"MainMesh not found in DualOnion.");
			}
		}

		protected override void __initializeVariables()
		{
			base.__initializeVariables();
		}

		protected internal override string __getTypeName()
		{
			return "DualOnion";
		}
	}
	public class EaterBehavior : NetworkBehaviour
	{
		public CaveDwellerAI __instance;

		public PikminType FavoritePikminType;

		public bool IsHeldByPikmin;

		public PikminAI[] CarriedByPikmins = new PikminAI[0];

		public override void OnNetworkDespawn()
		{
			((NetworkBehaviour)this).OnNetworkDespawn();
		}

		public void IntervalledUpdate()
		{
			//IL_005d: Unknown result type (might be due to invalid IL or missing references)
			//IL_006f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0074: Unknown result type (might be due to invalid IL or missing references)
			if ((Object)(object)FavoritePikminType == (Object)null)
			{
				PlayerControllerB[] allPlayersInLineOfSight = ((EnemyAI)__instance).GetAllPlayersInLineOfSight(120f, 30, __instance.BabyEye, 3f, -1);
				if (allPlayersInLineOfSight == null)
				{
					return;
				}
				for (int i = 0; i < allPlayersInLineOfSight.Length; i++)
				{
					Debug.DrawLine(((Component)__instance.BabyEye).transform.position, ((Component)allPlayersInLineOfSight[i].gameplayCamera).transform.position, Color.blue, 1f);
					BabyPlayerMemory babyMemoryOfPlayer = __instance.GetBabyMemoryOfPlayer(allPlayersInLineOfSight[i]);
					if (babyMemoryOfPlayer != null)
					{
						if (Time.realtimeSinceStartup - babyMemoryOfPlayer.timeAtLastSighting > 4f)
						{
							babyMemoryOfPlayer.timeAtLastNoticing = Time.realtimeSinceStartup;
						}
						babyMemoryOfPlayer.timeAtLastSighting = Time.realtimeSinceStartup;
						if (babyMemoryOfPlayer.orderSeen == -1)
						{
							FavoritePikminType = ((Component)allPlayersInLineOfSight[i]).GetComponentInChildren<LeaderManager>().GetCurrentSelectedType();
							LethalMin.Logger.LogInfo((object)("Favorite Pikmin Type: " + FavoritePikminType.GetName()));
						}
					}
				}
			}
			else
			{
				if (!LethalMin.CalmableManeater)
				{
					return;
				}
				if (!LethalMin.NonRasistManEater)
				{
					if (IsHeldByPikmin && CarriedByPikmins.Length != 0 && (Object)(object)GetMajorityType(CarriedByPikmins) == (Object)(object)FavoritePikminType)
					{
						__instance.rockingBaby = 1;
					}
				}
				else if (IsHeldByPikmin && CarriedByPikmins.Length != 0)
				{
					__instance.rockingBaby = 1;
				}
			}
		}

		public void CarriedByPikmin(PikminAI[] pikmins)
		{
			//IL_0255: Unknown result type (might be due to invalid IL or missing references)
			//IL_025b: Invalid comparison between Unknown and I4
			//IL_026e: Unknown result type (might be due to invalid IL or missing references)
			//IL_019d: Unknown result type (might be due to invalid IL or missing references)
			//IL_01a3: Invalid comparison between Unknown and I4
			//IL_01b6: Unknown result type (might be due to invalid IL or missing references)
			((GrabbableObject)__instance.propScript).EnableItemMeshes(true);
			((GrabbableObject)__instance.propScript).isPocketed = false;
			if (!((GrabbableObject)__instance.propScript).hasBeenHeld)
			{
				((GrabbableObject)__instance.propScript).hasBeenHeld = true;
			}
			PikminAI pikminAI = FindPikminOfType(GetMajorityType(pikmins), pikmins);
			PlayerControllerB val = null;
			if ((Object)(object)pikminAI != (Object)null)
			{
				if ((Object)(object)pikminAI.previousLeader != (Object)null)
				{
					val = pikminAI.previousLeader.Controller;
				}
				else if ((Object)(object)pikminAI.currentLeader != (Object)null)
				{
					val = pikminAI.currentLeader.Controller;
				}
				else if ((Object)(object)pikmins[0].previousLeader != (Object)null)
				{
					val = pikmins[0].previousLeader.Controller;
				}
				else if ((Object)(object)pikmins[0].currentLeader != (Object)null)
				{
					val = pikmins[0].currentLeader.Controller;
				}
				if ((Object)(object)val == (Object)null)
				{
					LethalMin.Logger.LogWarning((object)"No player controller found for pikmin");
					val = StartOfRound.Instance.localPlayerController;
				}
				((EnemyAI)__instance).currentOwnershipOnThisClient = (int)val.playerClientId;
				((EnemyAI)__instance).inSpecialAnimation = true;
				((Behaviour)((EnemyAI)__instance).agent).enabled = false;
				__instance.holdingBaby = true;
				if (__instance.dropBabyCoroutine != null)
				{
					((MonoBehaviour)this).StopCoroutine(__instance.dropBabyCoroutine);
				}
				if (((NetworkBehaviour)__instance).IsServer && (int)__instance.babyState == 2)
				{
					__instance.babyState = (BabyState)0;
				}
				__instance.SetRolledOverLocalClient(false, false);
				__instance.playerHolding = val;
				IsHeldByPikmin = true;
			}
			((EnemyAI)__instance).currentOwnershipOnThisClient = (int)val.playerClientId;
			((EnemyAI)__instance).inSpecialAnimation = true;
			((Behaviour)((EnemyAI)__instance).agent).enabled = false;
			__instance.holdingBaby = true;
			if (__instance.dropBabyCoroutine != null)
			{
				((MonoBehaviour)this).StopCoroutine(__instance.dropBabyCoroutine);
			}
			if (((NetworkBehaviour)__instance).IsServer && (int)__instance.babyState == 2)
			{
				__instance.babyState = (BabyState)0;
			}
			__instance.SetRolledOverLocalClient(false, false);
			__instance.playerHolding = val;
			CarriedByPikmins = pikmins;
			IsHeldByPikmin = true;
		}

		public void DroppedByPikmin(PikminAI FirstMin)
		{
			//IL_009f: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a4: 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_00c6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00da: Unknown result type (might be due to invalid IL or missing references)
			//IL_00df: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e8: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ee: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00fb: Unknown result type (might be due to invalid IL or missing references)
			//IL_0101: 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_0122: Unknown result type (might be due to invalid IL or missing references)
			//IL_012c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0131: Unknown result type (might be due to invalid IL or missing references)
			//IL_0141: Unknown result type (might be due to invalid IL or missing references)
			//IL_0142: 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_0151: Unknown result type (might be due to invalid IL or missing references)
			//IL_0192: Unknown result type (might be due to invalid IL or missing references)
			//IL_0197: Unknown result type (might be due to invalid IL or missing references)
			//IL_01a8: Unknown result type (might be due to invalid IL or missing references)
			//IL_032e: Unknown result type (might be due to invalid IL or missing references)
			//IL_032f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0334: Unknown result type (might be due to invalid IL or missing references)
			//IL_0304: Unknown result type (might be due to invalid IL or missing references)
			//IL_0305: Unknown result type (might be due to invalid IL or missing references)
			//IL_021b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0236: Unknown result type (might be due to invalid IL or missing references)
			//IL_024a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0251: Unknown result type (might be due to invalid IL or missing references)
			//IL_0257: Unknown result type (might be due to invalid IL or missing references)
			//IL_025f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0264: Unknown result type (might be due to invalid IL or missing references)
			//IL_0279: Unknown result type (might be due to invalid IL or missing references)
			//IL_0285: Unknown result type (might be due to invalid IL or missing references)
			//IL_0291: Unknown result type (might be due to invalid IL or missing references)
			//IL_02ab: Unknown result type (might be due to invalid IL or missing references)
			//IL_02ac: Unknown result type (might be due to invalid IL or missing references)
			//IL_02b6: Unknown result type (might be due to invalid IL or missing references)
			//IL_02bb: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ff: Unknown result type (might be due to invalid IL or missing references)
			//IL_0204: Unknown result type (might be due to invalid IL or missing references)
			//IL_0209: Unknown result type (might be due to invalid IL or missing references)
			//IL_0345: Unknown result type (might be due to invalid IL or missing references)
			//IL_034a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0354: Unknown result type (might be due to invalid IL or missing references)
			//IL_0359: Unknown result type (might be due to invalid IL or missing references)
			//IL_03bf: Unknown result type (might be due to invalid IL or missing references)
			//IL_03d6: Unknown result type (might be due to invalid IL or missing references)
			//IL_03a6: Unknown result type (might be due to invalid IL or missing references)
			__instance.holdingBaby = false;
			__instance.rockingBaby = 0;
			__instance.playerHolding = null;
			Debug.Log((object)"Drop baby A");
			if (((EnemyAI)__instance).currentBehaviourStateIndex != 0)
			{
				return;
			}
			if (((NetworkBehaviour)this).IsOwner)
			{
				Debug.Log((object)$"Set ownership of creature. Currentownershiponthisclient: {((EnemyAI)__instance).currentOwnershipOnThisClient}");
				((EnemyAI)__instance).ChangeOwnershipOfEnemy(StartOfRound.Instance.allPlayerScripts[0].actualClientId);
			}
			((EnemyAI)__instance).serverPosition = ((Component)this).transform.position;
			bool flag = true;
			Vector3 itemFloorPosition = ((GrabbableObject)__instance.propScript).GetItemFloorPosition(((Component)FirstMin.HoldPos).transform.position + Vector3.up * 0.5f);
			Vector3 navMeshPosition = RoundManager.Instance.GetNavMeshPosition(itemFloorPosition, default(NavMeshHit), 10f, -1);
			Debug.Log((object)$"Drop on position: {navMeshPosition}");
			Debug.DrawRay(((GrabbableObject)__instance.propScript).startFallingPosition, Vector3.up * 1f, Color.white, 10f);
			Debug.DrawRay(navMeshPosition, Vector3.up * 0.75f, Color.red, 10f);
			if (!RoundManager.Instance.GotNavMeshPositionResult || ((EnemyAI)__instance).DebugEnemy)
			{
				flag = false;
				itemFloorPosition = ((GrabbableObject)__instance.propScript).startFallingPosition;
				Debug.Log((object)$"Drop Baby C; {((GrabbableObject)__instance.propScript).startFallingPosition}");
				if ((Object)(object)((Component)__instance.propScript).transform.parent != (Object)null)
				{
					itemFloorPosition = ((Component)__instance.propScript).transform.parent.TransformPoint(((GrabbableObject)__instance.propScript).startFallingPosition);
				}
				Debug.Log((object)$"Drop Baby C global; {((GrabbableObject)__instance.propScript).startFallingPosition}");
				Transform val = __instance.ChooseClosestNodeToPositionNoPathCheck(itemFloorPosition);
				navMeshPosition = RoundManager.Instance.GetNavMeshPosition(((Component)val).transform.position, default(NavMeshHit), 5f, -1);
				Debug.Log((object)$"Got nav mesh position : {RoundManager.Instance.GotNavMeshPositionResult}; {navMeshPosition}; dist: {Vector3.Distance(((Component)this).transform.position, ((Component)val).transform.position)}");
				Debug.DrawRay(navMeshPosition, Vector3.up * 1.2f, Color.magenta, 10f);
			}
			Debug.Log((object)"Drop baby D");
			if ((Object)(object)((Component)__instance.propScript).transform.parent == (Object)null)
			{
				((GrabbableObject)__instance.propScript).targetFloorPosition = navMeshPosition;
			}
			else
			{
				((GrabbableObject)__instance.propScript).targetFloorPosition = ((Component)__instance.propScript).transform.parent.InverseTransformPoint(navMeshPosition);
			}
			Debug.DrawRay(((GrabbableObject)__instance.propScript).targetFloorPosition, Vector3.up * 2f, Color.yellow, 5f);
			if (flag)
			{
				if (__instance.dropBabyCoroutine != null)
				{
					((MonoBehaviour)this).StopCoroutine(__instance.dropBabyCoroutine);
				}
				__instance.dropBabyCoroutine = ((MonoBehaviour)this).StartCoroutine(__instance.DropBabyAnimation(navMeshPosition));
			}
			else
			{
				Debug.Log((object)$"Drop baby F; got no floor target; drop pos: {navMeshPosition}");
				((Component)this).transform.position = navMeshPosition;
				((EnemyAI)__instance).inSpecialAnimation = false;
			}
			CarriedByPikmins = new PikminAI[0];
			IsHeldByPikmin = false;
		}

		public PikminType GetMajorityType(PikminAI[] pikmins)
		{
			Dictionary<PikminType, int> dictionary = new Dictionary<PikminType, int>();
			foreach (PikminType value in LethalMin.RegisteredPikminTypes.Values)
			{
				dictionary[value] = 0;
			}
			foreach (PikminAI pikminAI in pikmins)
			{
				if (dictionary.ContainsKey(pikminAI.PminType))
				{
					dictionary[pikminAI.PminType]++;
				}
				else
				{
					dictionary[pikminAI.PminType] = 1;
				}
			}
			int num = 0;
			PikminType result = null;
			foreach (KeyValuePair<PikminType, int> item in dictionary)
			{
				if (item.Value > num)
				{
					num = item.Value;
					result = item.Key;
				}
			}
			return result;
		}

		public PikminAI FindPikminOfType(PikminType type, PikminAI[] pikmins)
		{
			foreach (PikminAI pikminAI in pikmins)
			{
				if ((Object)(object)pikminAI.PminType == (Object)(object)type)
				{
					return pikminAI;
				}
			}
			return null;
		}

		private void LateUpdate()
		{
			CheckAndDespawnIfParentDestroyed();
		}

		private void CheckAndDespawnIfParentDestroyed()
		{
			if ((Object)(object)((NetworkBehaviour)this).NetworkObject != (Object)null && ((NetworkBehaviour)this).NetworkObject.IsSpawned && ((Object)(object)((Component)this).transform.parent == (Object)null || (Object)(object)((Component)((Component)this).transform.parent).gameObject == (Object)null))
			{
				if (((NetworkBehaviour)this).IsServer)
				{
					((NetworkBehaviour)this).NetworkObject.Despawn(true);
				}
				Object.Destroy((Object)(object)((Component)this).gameObject);
				LethalMin.Logger.LogInfo((object)"EaterBehavior despawned due to destroyed parent");
			}
		}

		protected override void __initializeVariables()
		{
			((NetworkBehaviour)this).__initializeVariables();
		}

		protected internal override string __getTypeName()
		{
			return "EaterBehavior";
		}
	}
	public static class GradientTextureGenerator
	{
		public static Texture2D Generate90DegreeGradient(List<Color> colors, float smoothness, int textureSize = 256)
		{
			//IL_002b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0031: Expected O, but got Unknown
			//IL_0082: Unknown result type (might be due to invalid IL or missing references)
			//IL_0087: Unknown result type (might be due to invalid IL or missing references)
			//IL_008e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0093: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ab: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ad: 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_00b6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00bd: Unknown result type (might be due to invalid IL or missing references)
			if (colors == null || colors.Count < 2)
			{
				Debug.LogError((object)"At least two colors are required to create a gradient.");
				return null;
			}
			Texture2D val = new Texture2D(textureSize, textureSize, (TextureFormat)4, false);
			((Texture)val).wrapMode = (TextureWrapMode)1;
			float num = 1f / (float)(colors.Count - 1);
			for (int i = 0; i < textureSize; i++)
			{
				for (int j = 0; j < textureSize; j++)
				{
					float num2 = (float)j / (float)(textureSize - 1);
					int num3 = Mathf.FloorToInt(num2 / num);
					num3 = Mathf.Clamp(num3, 0, colors.Count - 2);
					Color val2 = colors[num3];
					Color val3 = colors[num3 + 1];
					float num4 = (num2 - (float)num3 * num) / num;
					num4 = Mathf.Pow(num4, smoothness);
					Color val4 = Color.Lerp(val2, val3, num4);
					val.SetPixel(j, i, val4);
				}
			}
			val.Apply();
			return val;
		}
	}
	public class LeaderManager : NetworkBehaviour
	{
		public List<PikminAI> followingPikmin = new List<PikminAI>();

		private TrajectoryPredictor trajectoryPredictor;

		private PikminAI selectedPikmin;

		private bool isAiming;

		private bool isPlayer;

		private bool isHoldingThrowButton = false;

		private float currentThrowForce;

		private InputAction throwAction;

		private InputAction switchPikminTypeAction;

		private InputAction switchPikminPrevTypeAction;

		private Transform throwOrigin;

		private Transform holdPosition;

		private Camera mainCamera;

		[SerializeField]
		private float columnSpacing = 1.5f;

		[SerializeField]
		private float rowSpacing = 0.5f;

		[SerializeField]
		private int pikminPerRow = 5;

		private Dictionary<PikminType, List<PikminAI>> pikminByType = new Dictionary<PikminType, List<PikminAI>>();

		private NoticeZone noticeZoneInstance;

		private int initattempts = 0;

		private bool HasPlayerBeenDefined;

		private float lastSyncTime = 0f;

		private const float syncInterval = 0.1f;

		private bool previousBooleanState = false;

		private List<GameObject> debugCubes = new List<GameObject>();

		private bool showDebugCubes = false;

		public PlayerControllerB Controller { get; set; }

		public List<PikminType> AvailableTypes { get; private set; } = new List<PikminType>();


		public int CurTypeSelectionIndex { get; private set; } = 0;


		public void Init()
		{
			//IL_0046: Unknown result type (might be due to invalid IL or missing references)
			CreateDebugCubes();
			InitializeController();
			InitializeTrajectoryPredictor();
			LogNetworkInfo();
			InitializeThrowOrigin();
			InitializeHoldPosition();
			InitializeInputAction();
			((MonoBehaviour)this).StartCoroutine(CheckBooleanValueCoroutine());
			InitalizeNoticeZonesServerRpc(new NetworkObjectReference(((NetworkBehaviour)this).NetworkObject));
		}

		[ServerRpc(RequireOwnership = false)]
		private void InitalizeNoticeZonesServerRpc(NetworkObjectReference leaderRef)
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Invalid comparison between Unknown and I4
			//IL_00a7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b1: Invalid comparison between Unknown and I4
			//IL_005f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0068: Unknown result type (might be due to invalid IL or missing references)
			//IL_006d: Unknown result type (might be due to invalid IL or missing references)
			//IL_007d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0083: Unknown result type (might be due to invalid IL or missing references)
			//IL_0097: Unknown result type (might be due to invalid IL or missing references)
			//IL_0171: Unknown result type (might be due to invalid IL or missing references)
			//IL_0176: Unknown result type (might be due to invalid IL or missing references)
			NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
			if (networkManager == null || !networkManager.IsListening)
			{
				return;
			}
			if ((int)base.__rpc_exec_stage != 1 && (networkManager.IsClient || networkManager.IsHost))
			{
				ServerRpcParams val = default(ServerRpcParams);
				FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendServerRpc(1197491330u, val, (RpcDelivery)0);
				((FastBufferWriter)(ref val2)).WriteValueSafe<NetworkObjectReference>(ref leaderRef, default(ForNetworkSerializable));
				((NetworkBehaviour)this).__endSendServerRpc(ref val2, 1197491330u, val, (RpcDelivery)0);
			}
			NetworkObject val3 = default(NetworkObject);
			if ((int)base.__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost) && ((NetworkObjectReference)(ref leaderRef)).TryGet(ref val3, (NetworkManager)null))
			{
				LeaderManager component = ((Component)val3).GetComponent<LeaderManager>();
				if ((Object)(object)noticeZoneInstance == (Object)null)
				{
					GameObject val4 = Object.Instantiate<GameObject>(LethalMin.NoticeZone, ((Component)component.Controller).transform);
					noticeZoneInstance = val4.GetComponent<NoticeZone>();
					noticeZoneInstance.leader = component.Controller;
					((NetworkBehaviour)noticeZoneInstance).NetworkObject.Spawn(false);
					((Component)noticeZoneInstance).transform.SetParent(((Component)component.Controller).transform);
				}
				SyncNoticeZoneClientRpc(new NetworkObjectReference(((NetworkBehaviour)noticeZoneInstance).NetworkObject), leaderRef);
			}
		}

		[ClientRpc]
		private void SyncNoticeZoneClientRpc(NetworkObjectReference noticeZoneRef, NetworkObjectReference leaderRef)
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Invalid comparison between Unknown and I4
			//IL_00c2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00cc: Invalid comparison between Unknown and I4
			//IL_005f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0068: Unknown result type (might be due to invalid IL or missing references)
			//IL_006d: Unknown result type (might be due to invalid IL or missing references)
			//IL_007d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0083: Unknown result type (might be due to invalid IL or missing references)
			//IL_0098: Unknown result type (might be due to invalid IL or missing references)
			//IL_009e: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b2: Unknown result type (might be due to invalid IL or missing references)
			NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
			if (networkManager == null || !networkManager.IsListening)
			{
				return;
			}
			if ((int)base.__rpc_exec_stage != 2 && (networkManager.IsServer || networkManager.IsHost))
			{
				ClientRpcParams val = default(ClientRpcParams);
				FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(2847157383u, val, (RpcDelivery)0);
				((FastBufferWriter)(ref val2)).WriteValueSafe<NetworkObjectReference>(ref noticeZoneRef, default(ForNetworkSerializable));
				((FastBufferWriter)(ref val2)).WriteValueSafe<NetworkObjectReference>(ref leaderRef, default(ForNetworkSerializable));
				((NetworkBehaviour)this).__endSendClientRpc(ref val2, 2847157383u, val, (RpcDelivery)0);
			}
			NetworkObject val3 = default(NetworkObject);
			NetworkObject val4 = default(NetworkObject);
			if ((int)base.__rpc_exec_stage == 2 && (networkManager.IsClient || networkManager.IsHost) && ((NetworkObjectReference)(ref noticeZoneRef)).TryGet(ref val3, (NetworkManager)null) && ((NetworkObjectReference)(ref leaderRef)).TryGet(ref val4, (NetworkManager)null))
			{
				NoticeZone component = ((Component)val3).GetComponent<NoticeZone>();
				LeaderManager component2 = ((Component)val4).GetComponent<LeaderManager>();
				if ((Object)(object)component != (Object)null)
				{
					component2.noticeZoneInstance = component;
					component.leader = component2.Controller;
					((Object)component).name = ((Object)component2.Controller).name + "'s NoticeZone";
					Object.Destroy((Object)(object)((Component)component).GetComponent<MeshRenderer>());
				}
			}
		}

		private void InitializeController()
		{
			Controller = ((Component)((Component)this).transform.parent).GetComponent<PlayerControllerB>();
			if ((Object)(object)Controller == (Object)null)
			{
				LethalMin.Logger.LogError((object)"LeaderManager: PlayerControllerB not found on this GameObject.");
				Object.Destroy((Object)(object)this);
			}
		}

		private void InitializeTrajectoryPredictor()
		{
			trajectoryPredictor = ((Component)this).GetComponent<TrajectoryPredictor>() ?? ((Component)this).gameObject.AddComponent<TrajectoryPredictor>();
			trajectoryPredictor.SetThrowOrigin(throwOrigin);
		}

		private void LogNetworkInfo()
		{
			if (LethalMin.DebugMode)
			{
				LethalMin.Logger.LogInfo((object)$"{((Object)this).name} IsOwner: {((NetworkBehaviour)this).IsOwner}, IsLocalPlayer: {((NetworkBehaviour)this).IsLocalPlayer}, OwnerClientId: {((NetworkBehaviour)this).OwnerClientId}, NetworkObjectId: {((NetworkBehaviour)this).NetworkObjectId}");
			}
			if (LethalMin.DebugMode)
			{
				LethalMin.Logger.LogInfo((object)$"{((Object)this).name} IsOwner: {((NetworkBehaviour)Controller).IsOwner}, IsLocalPlayer: {((NetworkBehaviour)Controller).IsLocalPlayer}, OwnerClientId: {((NetworkBehaviour)Controller).OwnerClientId}, NetworkObjectId: {((NetworkBehaviour)Controller).NetworkObjectId}");
			}
			if (LethalMin.DebugMode)
			{
				LethalMin.Logger.LogInfo((object)((NetworkBehaviour)this).HasNetworkObject);
			}
		}

		private void InitializeThrowOrigin()
		{
			//IL_0017: Unknown result type (might be due to invalid IL or missing references)
			//IL_001d: Expected O, but got Unknown
			//IL_00ca: Unknown result type (might be due to invalid IL or missing references)
			//IL_004b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0066: 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_0085: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a6: Unknown result type (might be due to invalid IL or missing references)
			mainCamera = Controller.gameplayCamera;
			GameObject val = new GameObject("ThrowOrigin");
			throwOrigin = val.transform;
			if ((Object)(object)mainCamera != (Object)null)
			{
				throwOrigin.localPosition = new Vector3(((Component)mainCamera).transform.position.x - 0.15f, ((Component)mainCamera).transform.position.y, ((Component)mainCamera).transform.position.z);
				((Component)throwOrigin).transform.rotation = ((Component)mainCamera).transform.rotation;
			}
			else
			{
				throwOrigin.localPosition = new Vector3(0f, 1.6f, 0.5f);
			}
			((Component)throwOrigin).transform.SetParent(((Component)mainCamera).transform, true);
			trajectoryPredictor.SetThrowOrigin(throwOrigin);
		}

		private void InitializeHoldPosition()
		{
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			//IL_