Decompiled source of LethalMinExtras v0.1.2

NoteBoxz.LethalMinExtras.dll

Decompiled 2 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 BepInEx;
using BepInEx.Logging;
using GameNetcodeStuff;
using HarmonyLib;
using LethalConfig;
using LethalLib.Modules;
using LethalMin;
using LethalMin.Pikmin;
using LethalMin.Utils;
using LethalMinExtras;
using Microsoft.CodeAnalysis;
using NoteBoxz.LethalMinExtras.NetcodePatcher;
using Unity.Netcode;
using UnityEngine;
using UnityEngine.AI;
using UnityEngine.Animations;
using UnityEngine.Events;
using UnityEngine.Serialization;

[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("com.olegknyazev.softmask")]
[assembly: IgnoresAccessChecksTo("DissonanceVoip")]
[assembly: IgnoresAccessChecksTo("DunGen")]
[assembly: IgnoresAccessChecksTo("DunGen.Integration.ASPP")]
[assembly: IgnoresAccessChecksTo("DunGen.Integration.UnityNav")]
[assembly: IgnoresAccessChecksTo("EasyTextEffects")]
[assembly: IgnoresAccessChecksTo("Facepunch Transport for Netcode for GameObjects")]
[assembly: IgnoresAccessChecksTo("Facepunch.Steamworks.Win64")]
[assembly: IgnoresAccessChecksTo("LethalConfig")]
[assembly: IgnoresAccessChecksTo("LethalLib")]
[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.Components")]
[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("Unity.XR.CoreUtils")]
[assembly: IgnoresAccessChecksTo("Unity.XR.Management")]
[assembly: IgnoresAccessChecksTo("Unity.XR.OpenXR")]
[assembly: IgnoresAccessChecksTo("Unity.XR.OpenXR.Features.ConformanceAutomation")]
[assembly: IgnoresAccessChecksTo("Unity.XR.OpenXR.Features.MetaQuestSupport")]
[assembly: IgnoresAccessChecksTo("Unity.XR.OpenXR.Features.MockRuntime")]
[assembly: IgnoresAccessChecksTo("Unity.XR.OpenXR.Features.OculusQuestSupport")]
[assembly: IgnoresAccessChecksTo("Unity.XR.OpenXR.Features.RuntimeDebugger")]
[assembly: IgnoresAccessChecksTo("UnityEngine.ARModule")]
[assembly: IgnoresAccessChecksTo("UnityEngine.NVIDIAModule")]
[assembly: IgnoresAccessChecksTo("UnityEngine.SpatialTracking")]
[assembly: IgnoresAccessChecksTo("UnityEngine.UI")]
[assembly: IgnoresAccessChecksTo("UnityEngine.XR.LegacyInputHelpers")]
[assembly: AssemblyCompany("NoteBoxz.LethalMinExtras")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("0.1.1.0")]
[assembly: AssemblyInformationalVersion("0.1.1")]
[assembly: AssemblyProduct("LethalMinExtras")]
[assembly: AssemblyTitle("NoteBoxz.LethalMinExtras")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("0.1.1.0")]
[module: UnverifiableCode]
[module: RefSafetyRules(11)]
[module: NetcodePatchedAssembly]
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;
		}
	}
}
public class CPBAnimEvent : MonoBehaviour
{
	public CandyPopBud candyPopBud = null;

	public void PlayOpenSfx()
	{
		candyPopBud.PlayOpenSfx();
	}

	public void PlayCloseSfx()
	{
		candyPopBud.PlayCloseSfx();
	}
}
namespace LethalMinExtras
{
	[BepInPlugin("NoteBoxz.LethalMinExtras", "LethalMinExtras", "0.1.1")]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	public class LethalMinExtras : BaseUnityPlugin
	{
		public static LethalMinExtras Instance { get; private set; }

		internal static ManualLogSource Logger { get; private set; }

		internal static Harmony? Harmony { get; set; }

		internal static AssetBundle assetBundle { get; private set; }

		public static ConfigItem<float> PosySpawnRate { get; private set; }

		public static ConfigItem<float> PosyFalloffModifier { get; private set; }

		public static ConfigItem<float> MaxPosyGrowTime { get; private set; }

		public static ConfigItem<float> MinPosyGrowTime { get; private set; }

		public static ConfigItem<float> PosyCycleInterval { get; private set; }

		public static ConfigItem<int> MaxCPBTransforms { get; private set; }

		public static ConfigItem<bool> AllowOnionlessTypesToHaveCPB { get; private set; }

		public static ConfigItem<float> CPBSpawnRate { get; private set; }

		public static ConfigItem<float> CPBFalloffModifier { get; private set; }

		public static ConfigItem<bool> CPBSpawnSprouts { get; private set; }

		public static ConfigItem<SpawnLocation> PosySpawnLocation { get; private set; }

		public static ConfigItem<float> PosyOutdoorBias { get; private set; }

		public static ConfigItem<SpawnLocation> CPBSpawnLocation { get; private set; }

		public static ConfigItem<float> CPBOutdoorBias { get; private set; }

		public static ConfigItem<float> NectarEggSpawnRate { get; private set; }

		public static ConfigItem<float> NectarEggFalloffModifier { get; private set; }

		public static ConfigItem<SpawnLocation> NectarEggSpawnLocation { get; private set; }

		public static ConfigItem<float> NectarEggOutdoorBias { get; private set; }

		private void Awake()
		{
			Logger = ((BaseUnityPlugin)this).Logger;
			Instance = this;
			Logger.LogInfo((object)"LethalMinExtras: Initializing LethalMinExtras");
			Logger.LogInfo((object)"LethalMinExtras: Netcode Patching");
			NetcodePatcher();
			Logger.LogInfo((object)"LethalMinExtras: Patching");
			Patch();
			Logger.LogInfo((object)"LethalMinExtras: Binding Configs");
			BindConfigs();
			Logger.LogInfo((object)"LethalMinExtras: Loading AssetBundle");
			LoadAssetBundle();
			Logger.LogInfo((object)"LethalMinExtras: Registering Map Objects");
			RegisterMapObjects();
			Logger.LogInfo((object)"LethalMinExtras: Registering Pikmin task finders");
			PikminTaskRegistry.RegisterIdleTaskFinder((Func<PikminAI, PikminTask>)DrinkNectarTask.TryCreate);
			if (LethalMin.IsDependencyLoaded("ainavt.lc.lethalconfig"))
			{
				BindLCconfigs();
			}
			Logger.LogInfo((object)"NoteBoxz.LethalMinExtras v0.1.1 has loaded!");
		}

		public void RegisterMapObjects()
		{
			//IL_0011: Unknown result type (might be due to invalid IL or missing references)
			//IL_0017: Expected O, but got Unknown
			//IL_001e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0024: Expected O, but got Unknown
			//IL_0077: Unknown result type (might be due to invalid IL or missing references)
			//IL_007e: Expected O, but got Unknown
			//IL_0086: Unknown result type (might be due to invalid IL or missing references)
			//IL_008d: Expected O, but got Unknown
			//IL_00e7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ee: Expected O, but got Unknown
			//IL_00f7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00fe: Expected O, but got Unknown
			GameObject prefabToSpawn = assetBundle.LoadAsset<GameObject>("Assets/LethalMinExtras/Posie.prefab");
			SpawnableMapObject val = new SpawnableMapObject();
			val.prefabToSpawn = prefabToSpawn;
			AnimationCurve val2 = new AnimationCurve();
			val2.AddKey(0f, 1f);
			val2.AddKey(0.5f, 12f);
			val2.AddKey(1f, 1f);
			val.numberToSpawn = val2;
			MapObjects.RegisterMapObject(val, (LevelTypes)1, (Func<SelectableLevel, AnimationCurve>)null);
			GameObject prefabToSpawn2 = assetBundle.LoadAsset<GameObject>("Assets/LethalMinExtras/CPB.prefab");
			SpawnableMapObject val3 = new SpawnableMapObject();
			val3.prefabToSpawn = prefabToSpawn2;
			AnimationCurve val4 = new AnimationCurve();
			val4.AddKey(0f, 0.5f);
			val4.AddKey(0.5f, 1f);
			val4.AddKey(1f, 0.5f);
			val3.numberToSpawn = val4;
			MapObjects.RegisterMapObject(val3, (LevelTypes)1, (Func<SelectableLevel, AnimationCurve>)null);
			GameObject prefabToSpawn3 = assetBundle.LoadAsset<GameObject>("Assets/LethalMinExtras/NectarEgg.prefab");
			SpawnableMapObject val5 = new SpawnableMapObject();
			val5.prefabToSpawn = prefabToSpawn3;
			AnimationCurve val6 = new AnimationCurve();
			val6.AddKey(0f, 0.5f);
			val6.AddKey(0.5f, 5f);
			val6.AddKey(1f, 0.5f);
			val5.numberToSpawn = val6;
			MapObjects.RegisterMapObject(val5, (LevelTypes)1, (Func<SelectableLevel, AnimationCurve>)null);
		}

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

		public void BindConfigs()
		{
			MaxPosyGrowTime = new ConfigItem<float>("General", "Max Posy Grow Time", 100f, "The maximum time it takes for a Posy to grow from sprout to bloom.", false, (ConfigItemAuthority)0, "");
			MinPosyGrowTime = new ConfigItem<float>("General", "Min Posy Grow Time", 10f, "The minimum time it takes for a Posy to grow from sprout to bloom.", false, (ConfigItemAuthority)0, "");
			PosyCycleInterval = new ConfigItem<float>("General", "Posy Cycle Interval", 5f, "The time it takes for a Posy to cycle between other types.", false, (ConfigItemAuthority)0, "");
			PosySpawnRate = new ConfigItem<float>("General", "Posy Spawn Rate", 0.35f, "The spawn rate of Posies on the map. 1 is the default spawn rate of map objects, so 0.35 means that Posies will spawn at 35% of the normal spawn rate.", false, (ConfigItemAuthority)0, "slider(0,1)");
			PosyFalloffModifier = new ConfigItem<float>("General", "Posy Falloff Modifier", 0.9f, "How much the overall falloff value modifies the spawn rate of posies. 1 Means that full falloff will reduce the spawn rate to 0, 0 means that falloff will not reduce the spawn rate at all.", false, (ConfigItemAuthority)0, "slider(0,1)");
			MaxCPBTransforms = new ConfigItem<int>("General", "Max Candypop Bud Transforms", 5, "The maximum number of times a Candypop Bud can transform pikmin before despawning.", false, (ConfigItemAuthority)0, "");
			AllowOnionlessTypesToHaveCPB = new ConfigItem<bool>("General", "Allow Onionless Types To Have CPB", false, "If true, Pikmin types that don't have registered Onions will have candypop buds still choose them as a random type when spawning.", false, (ConfigItemAuthority)0, "");
			CPBSpawnRate = new ConfigItem<float>("General", "Candypop Bud Spawn Rate", 0.15f, "The spawn rate of Candypop Buds on the map. 1 is the default spawn rate of map objects, so 0.15 means that Candypop Buds will spawn at 15% of the normal spawn rate.", false, (ConfigItemAuthority)0, "slider(0,1)");
			CPBFalloffModifier = new ConfigItem<float>("General", "Candypop Bud Falloff Modifier", 0.5f, "How much the overall falloff value modifies the spawn rate of candypop buds. 1 Means that full falloff will reduce the spawn rate to 0, 0 means that falloff will not reduce the spawn rate at all.", false, (ConfigItemAuthority)0, "slider(0,1)");
			CPBSpawnSprouts = new ConfigItem<bool>("General", "Candypop Bud Spawn Sprouts", false, "If true, Candypop Buds will spawn on sprouts. (Could cause sprouts to clip out of bounds indoors)", false, (ConfigItemAuthority)0, "");
			PosySpawnLocation = new ConfigItem<SpawnLocation>("General", "Posy Spawn Location", SpawnLocation.Outdoor, "Where Pellet Posies can spawn. Indoor = facility only, Outdoor = outside only, Both = either.", false, (ConfigItemAuthority)0, "");
			PosyOutdoorBias = new ConfigItem<float>("General", "Posy Outdoor Spawn Bias", 1f, "When Posy Spawn Location is Both, the probability (0-1) that any given Posy spawns outdoors rather than indoors.", false, (ConfigItemAuthority)0, "slider(0,1)");
			CPBSpawnLocation = new ConfigItem<SpawnLocation>("General", "Candypop Bud Spawn Location", SpawnLocation.Indoor, "Where Candypop Buds can spawn. Indoor = facility only, Outdoor = outside only, Both = either.", false, (ConfigItemAuthority)0, "");
			CPBOutdoorBias = new ConfigItem<float>("General", "Candypop Bud Outdoor Spawn Bias", 0.5f, "When Candypop Bud Spawn Location is Both, the probability (0-1) that any given Candypop Bud spawns outdoors rather than indoors.", false, (ConfigItemAuthority)0, "slider(0,1)");
			NectarEggSpawnRate = new ConfigItem<float>("General", "Nectar Egg Spawn Rate", 0.2f, "The spawn rate of Nectar Eggs on the map. 1 is the default spawn rate, so 0.2 means 20% of the normal rate.", false, (ConfigItemAuthority)0, "slider(0,1)");
			NectarEggFalloffModifier = new ConfigItem<float>("General", "Nectar Egg Falloff Modifier", 0.5f, "How much the overall falloff value reduces Nectar Egg spawn rate. 1 = full falloff reduction, 0 = no reduction.", false, (ConfigItemAuthority)0, "slider(0,1)");
			NectarEggSpawnLocation = new ConfigItem<SpawnLocation>("General", "Nectar Egg Spawn Location", SpawnLocation.Both, "Where Nectar Eggs can spawn. Indoor = facility only, Outdoor = outside only, Both = either.", false, (ConfigItemAuthority)0, "");
			NectarEggOutdoorBias = new ConfigItem<float>("General", "Nectar Egg Outdoor Spawn Bias", 0.5f, "When Nectar Egg Spawn Location is Both, the probability (0-1) that any given Nectar Egg spawns outdoors rather than indoors.", false, (ConfigItemAuthority)0, "slider(0,1)");
		}

		public void BindLCconfigs()
		{
			LethalConfigManager.SetModDescription("An addon mod for LethalMin that adds other content from the Pikmin Games!");
		}

		internal static void Patch()
		{
			//IL_000d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0012: Unknown result type (might be due to invalid IL or missing references)
			//IL_0018: Expected O, but got Unknown
			if (Harmony == null)
			{
				Harmony = new Harmony("NoteBoxz.LethalMinExtras");
			}
			Logger.LogDebug((object)"Patching...");
			Harmony.PatchAll();
			Logger.LogDebug((object)"Finished patching!");
		}

		internal static void Unpatch()
		{
			Logger.LogDebug((object)"Unpatching...");
			Harmony? harmony = Harmony;
			if (harmony != null)
			{
				harmony.UnpatchSelf();
			}
			Logger.LogDebug((object)"Finished unpatching!");
		}

		private void NetcodePatcher()
		{
			Type[] types = Assembly.GetExecutingAssembly().GetTypes();
			Type[] array = types;
			foreach (Type type in array)
			{
				MethodInfo[] methods = type.GetMethods(BindingFlags.Instance | BindingFlags.Static | BindingFlags.NonPublic);
				MethodInfo[] array2 = methods;
				foreach (MethodInfo methodInfo in array2)
				{
					object[] customAttributes = methodInfo.GetCustomAttributes(typeof(RuntimeInitializeOnLoadMethodAttribute), inherit: false);
					if (customAttributes.Length != 0)
					{
						methodInfo.Invoke(null, null);
					}
				}
			}
		}
	}
	public enum SpawnLocation
	{
		Indoor,
		Outdoor,
		Both
	}
	public class CandyPopBud : NetworkBehaviour
	{
		[CompilerGenerated]
		private sealed class <TransformationSequnce>d__28 : IEnumerator<object>, IEnumerator, IDisposable
		{
			private int <>1__state;

			private object <>2__current;

			public CandyPopBud <>4__this;

			private GameObject <prefab>5__1;

			private int <i>5__2;

			private Vector3 <spawnPos>5__3;

			private Quaternion <RandomYRotation>5__4;

			private Sprout <sprout>5__5;

			private PikminSpawnProps <props>5__6;

			private Vector3 <spawnPos>5__7;

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

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

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

			[DebuggerHidden]
			void IDisposable.Dispose()
			{
				//IL_0014: Unknown result type (might be due to invalid IL or missing references)
				<prefab>5__1 = null;
				<sprout>5__5 = null;
				<props>5__6 = default(PikminSpawnProps);
				<>1__state = -2;
			}

			private bool MoveNext()
			{
				//IL_010f: Unknown result type (might be due to invalid IL or missing references)
				//IL_0119: Expected O, but got Unknown
				//IL_0145: Unknown result type (might be due to invalid IL or missing references)
				//IL_014f: Expected O, but got Unknown
				//IL_02f4: Unknown result type (might be due to invalid IL or missing references)
				//IL_02f9: Unknown result type (might be due to invalid IL or missing references)
				//IL_030a: Unknown result type (might be due to invalid IL or missing references)
				//IL_030f: Unknown result type (might be due to invalid IL or missing references)
				//IL_036b: Unknown result type (might be due to invalid IL or missing references)
				//IL_0380: Unknown result type (might be due to invalid IL or missing references)
				//IL_0385: Unknown result type (might be due to invalid IL or missing references)
				//IL_0388: Unknown result type (might be due to invalid IL or missing references)
				//IL_03ae: Unknown result type (might be due to invalid IL or missing references)
				//IL_03be: Unknown result type (might be due to invalid IL or missing references)
				//IL_03c4: Unknown result type (might be due to invalid IL or missing references)
				//IL_03d7: Unknown result type (might be due to invalid IL or missing references)
				//IL_022d: Unknown result type (might be due to invalid IL or missing references)
				//IL_0232: Unknown result type (might be due to invalid IL or missing references)
				//IL_024e: Unknown result type (might be due to invalid IL or missing references)
				//IL_0253: Unknown result type (might be due to invalid IL or missing references)
				//IL_0260: Unknown result type (might be due to invalid IL or missing references)
				//IL_0265: Unknown result type (might be due to invalid IL or missing references)
				//IL_02be: Unknown result type (might be due to invalid IL or missing references)
				//IL_02c4: Unknown result type (might be due to invalid IL or missing references)
				//IL_02ca: Unknown result type (might be due to invalid IL or missing references)
				//IL_0172: Unknown result type (might be due to invalid IL or missing references)
				//IL_017c: Expected O, but got Unknown
				//IL_041c: Unknown result type (might be due to invalid IL or missing references)
				//IL_0426: Expected O, but got Unknown
				switch (<>1__state)
				{
				default:
					return false;
				case 0:
					<>1__state = -1;
					<prefab>5__1 = LethalMin.SproutPrefab;
					LethalMinExtras.Logger.LogInfo((object)$"Transforming {<>4__this.transformCount} Pikmin into {((Object)<>4__this.TransformType).name}, count: {<>4__this.transformCount}/{<>4__this.maxTransformCount}");
					<>4__this.maxTransformCount -= <>4__this.transformCount;
					<>4__this.audioSource.PlayOneShot(<>4__this.EatSfx);
					<>4__this.animator.SetTrigger("Eat");
					<>2__current = (object)new WaitForSeconds(1.5f);
					<>1__state = 1;
					return true;
				case 1:
					<>1__state = -1;
					<>4__this.animator.SetTrigger("Spit");
					<>2__current = (object)new WaitForSeconds(0.38f);
					<>1__state = 2;
					return true;
				case 2:
					<>1__state = -1;
					<i>5__2 = 0;
					goto IL_03ee;
				case 3:
					<>1__state = -1;
					<>4__this.audioSource.PlayOneShot(<>4__this.SpitSfx);
					if (ConfigItem<bool>.op_Implicit(LethalMinExtras.CPBSpawnSprouts))
					{
						LethalMinExtras.Logger.LogInfo((object)$"Spawning sprout {<i>5__2} of {<>4__this.transformCount} for {((Object)<>4__this.TransformType).name} from onion {((Object)((Component)<>4__this).gameObject).name}!");
						<spawnPos>5__3 = <>4__this.GetPositionToSpawnSprout();
						<RandomYRotation>5__4 = Quaternion.Euler(0f, (float)Random.Range(0, 360), 0f);
						<sprout>5__5 = Object.Instantiate<GameObject>(<prefab>5__1, <spawnPos>5__3, Quaternion.identity).GetComponent<Sprout>();
						<sprout>5__5.pikminType = <>4__this.TransformType;
						<sprout>5__5.IsPersistant = true;
						((NetworkBehaviour)<sprout>5__5).NetworkObject.Spawn(false);
						<sprout>5__5.InitalizeClientRpc(<>4__this.SproutSpawnPos.position, <spawnPos>5__3, <RandomYRotation>5__4, <>4__this.TransformType.PikminTypeID);
						<sprout>5__5 = null;
					}
					else
					{
						<props>5__6 = new PikminSpawnProps();
						<spawnPos>5__7 = ((Component)<>4__this).transform.position;
						<props>5__6.SpawnAnimation = "Plucked";
						<props>5__6.SpawnSound = "Born";
						<props>5__6.OverrideVolume = 1f;
						<props>5__6.SpawnSoundDelay = 0f;
						<props>5__6.AddToSpawnCount = true;
						ManualLogSource logger = LethalMinExtras.Logger;
						object arg = <spawnPos>5__7;
						Quaternion rotation = ((Component)<>4__this).transform.rotation;
						logger.LogInfo((object)$"SpawnPosition: {arg} SpawnRotaion: {((Quaternion)(ref rotation)).eulerAngles}");
						PikminManager.instance.SpawnPikminOnServer(<>4__this.TransformType, <spawnPos>5__7, ((Component)<>4__this).transform.rotation, <props>5__6, (Onion)null);
						<props>5__6 = default(PikminSpawnProps);
					}
					<i>5__2++;
					goto IL_03ee;
				case 4:
					{
						<>1__state = -1;
						if (<>4__this.maxTransformCount == 0)
						{
							<>4__this.audioSource.PlayOneShot(<>4__this.DieSfx);
							<>4__this.animator.SetTrigger("Die");
						}
						else
						{
							<>4__this.isTransforming = false;
							<>4__this.animator.SetTrigger("Reset");
						}
						return false;
					}
					IL_03ee:
					if (<i>5__2 < <>4__this.transformCount)
					{
						<>2__current = (object)new WaitForSeconds(0.25f);
						<>1__state = 3;
						return true;
					}
					<>4__this.transformCount = 0;
					<>2__current = (object)new WaitForSeconds(1f);
					<>1__state = 4;
					return true;
				}
			}

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

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

		public PikminType TransformType = null;

		[SerializeField]
		private Renderer rend = null;

		[SerializeField]
		private Animator animator = null;

		[SerializeField]
		private AudioSource audioSource = null;

		[SerializeField]
		private Transform SproutSpawnPos = null;

		[SerializeField]
		private AudioClip OpenSfx = null;

		[SerializeField]
		private AudioClip EatSfx = null;

		[SerializeField]
		private AudioClip[] ConsumeSfx = null;

		[SerializeField]
		private AudioClip SpitSfx = null;

		[SerializeField]
		private AudioClip CloseSfx = null;

		[SerializeField]
		private AudioClip DieSfx = null;

		private int maxTransformCount = 5;

		private int transformCount = 0;

		private float autoCloseTimer = 4f;

		private bool isTransforming = false;

		private bool isNearPlayer = false;

		private float openCheckInterval = 0.5f;

		private List<PikminType> possibleTypes = new List<PikminType>();

		private void Start()
		{
			PikminManager.instance.ExtrasSpawnedObjects.Add(((NetworkBehaviour)this).NetworkObject);
			if (!((NetworkBehaviour)this).IsServer)
			{
				return;
			}
			foreach (PikminType value in LethalMin.RegisteredPikminTypes.Values)
			{
				if ((PikChecks.DoesPikminHaveRegisteredOnion(value) || ConfigItem<bool>.op_Implicit(LethalMinExtras.AllowOnionlessTypesToHaveCPB)) && StartOfRound.Instance.gameStats.daysSpent > value.SpawnAfterDay)
				{
					possibleTypes.Add(value);
				}
			}
			if (possibleTypes.Count == 0)
			{
				Debug.LogWarning((object)"No valid Pikmin types found for Candy Pop Bud! Disabling...");
				((NetworkBehaviour)this).NetworkObject.Despawn(true);
			}
			else
			{
				TransformType = possibleTypes[Random.Range(0, possibleTypes.Count)];
				SetTransformTypeRpc(TransformType.PikminTypeID);
			}
			maxTransformCount = ConfigItem<int>.op_Implicit(LethalMinExtras.MaxCPBTransforms);
		}

		[Rpc(/*Could not decode attribute arguments.*/)]
		public void SetTransformTypeRpc(int typeID)
		{
			//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_0043: 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_0051: Unknown result type (might be due to invalid IL or missing references)
			//IL_005f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0064: Unknown result type (might be due to invalid IL or missing references)
			//IL_0068: Unknown result type (might be due to invalid IL or missing references)
			//IL_0080: Unknown result type (might be due to invalid IL or missing references)
			//IL_0084: 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)
			//IL_03e3: 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)
			{
				RpcAttributeParams val = default(RpcAttributeParams);
				RpcParams val2 = default(RpcParams);
				FastBufferWriter val3 = ((NetworkBehaviour)this).__beginSendRpc(1844728853u, val2, val, (SendTo)7, (RpcDelivery)0);
				BytePacker.WriteValueBitPacked(val3, typeID);
				((NetworkBehaviour)this).__endSendRpc(ref val3, 1844728853u, val2, val, (SendTo)7, (RpcDelivery)0);
			}
			if ((int)base.__rpc_exec_stage != 1)
			{
				return;
			}
			base.__rpc_exec_stage = (__RpcExecStage)0;
			PikminType pikminTypeByID = LethalMin.GetPikminTypeByID(typeID);
			if ((Object)(object)pikminTypeByID == (Object)null)
			{
				Debug.LogError((object)$"Invalid PikminTypeID {typeID} sent to SetTransformTypeRpc!");
				return;
			}
			TransformType = pikminTypeByID;
			switch (TransformType.PikminName)
			{
			case "Red Pikmin":
			{
				Texture2D val11 = LethalMinExtras.assetBundle.LoadAsset<Texture2D>("Assets/LethalMinExtras/T_stg_PongashiRed_RE01_D.png");
				rend.material.SetTexture("_BaseColorMap", (Texture)(object)val11);
				break;
			}
			case "Yellow Pikmin":
			{
				Texture2D val10 = LethalMinExtras.assetBundle.LoadAsset<Texture2D>("Assets/LethalMinExtras/T_stg_PongashiYellow_YE01_D.png");
				rend.material.SetTexture("_BaseColorMap", (Texture)(object)val10);
				break;
			}
			case "Blue Pikmin":
			{
				Texture2D val9 = LethalMinExtras.assetBundle.LoadAsset<Texture2D>("Assets/LethalMinExtras/T_stg_PongashiBlue_BL01_D.png");
				rend.material.SetTexture("_BaseColorMap", (Texture)(object)val9);
				break;
			}
			case "Purple Pikmin":
			{
				Texture2D val8 = LethalMinExtras.assetBundle.LoadAsset<Texture2D>("Assets/LethalMinExtras/T_stg_PongashiPurple_PU01_D.png");
				rend.material.SetTexture("_BaseColorMap", (Texture)(object)val8);
				break;
			}
			case "White Pikmin":
			{
				Texture2D val7 = LethalMinExtras.assetBundle.LoadAsset<Texture2D>("Assets/LethalMinExtras/T_stg_PongashiWhite_WH01_D.png");
				rend.material.SetTexture("_BaseColorMap", (Texture)(object)val7);
				break;
			}
			case "Rock Pikmin":
			{
				Texture2D val6 = LethalMinExtras.assetBundle.LoadAsset<Texture2D>("Assets/LethalMinExtras/T_stg_PongashiStone_DGY01_D.png");
				rend.material.SetTexture("_BaseColorMap", (Texture)(object)val6);
				break;
			}
			case "Winged Pikmin":
			{
				Texture2D val5 = LethalMinExtras.assetBundle.LoadAsset<Texture2D>("Assets/LethalMinExtras/T_stg_PongashiPink_PI01_D.png");
				rend.material.SetTexture("_BaseColorMap", (Texture)(object)val5);
				break;
			}
			case "Ice Pikmin":
			{
				Texture2D val4 = LethalMinExtras.assetBundle.LoadAsset<Texture2D>("Assets/LethalMinExtras/T_stg_PongashiIce_LBL01_D.png");
				rend.material.SetTexture("_BaseColorMap", (Texture)(object)val4);
				break;
			}
			default:
				LethalMinExtras.Logger.LogWarning((object)("No specific texture found for Pikmin type " + TransformType.PikminName + ", using default."));
				rend.material.SetColor("_Color", TransformType.PikminPrimaryColor);
				break;
			}
		}

		public void Update()
		{
			animator.SetBool("Open", isNearPlayer);
			if (((NetworkBehaviour)this).IsServer)
			{
				UpdateIsNearPlayer();
			}
			if (((NetworkBehaviour)this).IsServer && !isTransforming && isNearPlayer && transformCount > 0)
			{
				autoCloseTimer -= Time.deltaTime;
				if (autoCloseTimer <= 0f || maxTransformCount == transformCount)
				{
					DoTransformationSequnce();
					DoTransformationSequnceRpc();
					autoCloseTimer = 4f;
				}
			}
		}

		private void UpdateIsNearPlayer()
		{
			//IL_0078: 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)
			if (isTransforming)
			{
				return;
			}
			if (transformCount < 0)
			{
				isNearPlayer = true;
				return;
			}
			openCheckInterval -= Time.deltaTime;
			if (!(openCheckInterval <= 0f))
			{
				return;
			}
			isNearPlayer = false;
			PlayerControllerB[] allPlayerScripts = StartOfRound.Instance.allPlayerScripts;
			foreach (PlayerControllerB val in allPlayerScripts)
			{
				if (Vector3.Distance(((Component)val).transform.position, ((Component)this).transform.position) < 10f)
				{
					isNearPlayer = true;
					break;
				}
			}
			openCheckInterval = 0.5f;
		}

		public void OnTriggerEnter(Collider other)
		{
			//IL_0083: Unknown result type (might be due to invalid IL or missing references)
			//IL_008a: Invalid comparison between Unknown and I4
			//IL_00be: Unknown result type (might be due to invalid IL or missing references)
			if (!((NetworkBehaviour)this).IsServer || isTransforming || !isNearPlayer || transformCount >= maxTransformCount)
			{
				return;
			}
			PikminCollisionDetect component = ((Component)other).GetComponent<PikminCollisionDetect>();
			if ((Object)(object)component == (Object)null)
			{
				return;
			}
			PikminAI mainPikmin = component.mainPikmin;
			if (!((Object)(object)mainPikmin == (Object)null) && !((Object)(object)mainPikmin.pikminType == (Object)(object)TransformType) && (int)mainPikmin.CurrentIntention == 9)
			{
				SetPikminToTransform(mainPikmin);
				if ((Object)(object)mainPikmin != (Object)null && ((NetworkBehaviour)mainPikmin).IsSpawned)
				{
					SetPikminToTransformRpc(NetworkObjectReference.op_Implicit(((NetworkBehaviour)mainPikmin).NetworkObject));
				}
			}
		}

		public void PlayOpenSfx()
		{
			audioSource.PlayOneShot(OpenSfx);
		}

		public void PlayCloseSfx()
		{
			audioSource.PlayOneShot(CloseSfx);
		}

		private void SetPikminToTransform(PikminAI pikmin)
		{
			//IL_006e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0073: Unknown result type (might be due to invalid IL or missing references)
			LethalMinExtras.Logger.LogInfo((object)("Transforming Pikmin of type " + ((Object)pikmin.pikminType).name + " into " + ((Object)TransformType).name + "!"));
			transformCount++;
			AudioSource creatureVoice = ((EnemyAI)pikmin).creatureVoice;
			AudioClip val = null;
			try
			{
				val = pikmin.pikminType.GetSoundPackByGeneration(PikUtils.ConvertCfgGenerationToPikminGeneration(LethalMin.PikminSoundGeneration.InternalValue)).HurtVoice[0];
			}
			catch
			{
				val = null;
			}
			if ((Object)(object)creatureVoice != (Object)null && (Object)(object)val != (Object)null)
			{
				((Component)creatureVoice).transform.parent = ((Component)this).transform;
				creatureVoice.PlayOneShot(val);
				Object.Destroy((Object)(object)((Component)creatureVoice).gameObject, val.length + 1f);
			}
			audioSource.PlayOneShot(ConsumeSfx[transformCount % ConsumeSfx.Length]);
			pikmin.IncrumentDestoryCountServerRpc();
		}

		[Rpc(/*Could not decode attribute arguments.*/)]
		private void SetPikminToTransformRpc(NetworkObjectReference pikminRef)
		{
			//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_0043: 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_0051: Unknown result type (might be due to invalid IL or missing references)
			//IL_005f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0064: Unknown result type (might be due to invalid IL or missing references)
			//IL_0074: 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_008e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0092: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c0: 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)
			{
				RpcAttributeParams val = default(RpcAttributeParams);
				RpcParams val2 = default(RpcParams);
				FastBufferWriter val3 = ((NetworkBehaviour)this).__beginSendRpc(3999458850u, val2, val, (SendTo)3, (RpcDelivery)0);
				((FastBufferWriter)(ref val3)).WriteValueSafe<NetworkObjectReference>(ref pikminRef, default(ForNetworkSerializable));
				((NetworkBehaviour)this).__endSendRpc(ref val3, 3999458850u, val2, val, (SendTo)3, (RpcDelivery)0);
			}
			if ((int)base.__rpc_exec_stage != 1)
			{
				return;
			}
			base.__rpc_exec_stage = (__RpcExecStage)0;
			NetworkObject val4 = default(NetworkObject);
			if (((NetworkObjectReference)(ref pikminRef)).TryGet(ref val4, (NetworkManager)null))
			{
				PikminAI component = ((Component)val4).GetComponent<PikminAI>();
				if ((Object)(object)component != (Object)null)
				{
					SetPikminToTransform(component);
				}
			}
		}

		private void DoTransformationSequnce()
		{
			isTransforming = true;
			((MonoBehaviour)this).StartCoroutine(TransformationSequnce());
		}

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

		[Rpc(/*Could not decode attribute arguments.*/)]
		private void DoTransformationSequnceRpc()
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Invalid comparison between Unknown and I4
			//IL_008c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0096: Invalid comparison between Unknown and I4
			//IL_0043: 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_0051: Unknown result type (might be due to invalid IL or missing references)
			//IL_005f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0064: Unknown result type (might be due to invalid IL or missing references)
			//IL_0073: Unknown result type (might be due to invalid IL or missing references)
			//IL_0077: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a5: Unknown result type (might be due to invalid IL or missing references)
			NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
			if (networkManager != null && networkManager.IsListening)
			{
				if ((int)base.__rpc_exec_stage != 1)
				{
					RpcAttributeParams val = default(RpcAttributeParams);
					RpcParams val2 = default(RpcParams);
					FastBufferWriter val3 = ((NetworkBehaviour)this).__beginSendRpc(2071504078u, val2, val, (SendTo)3, (RpcDelivery)0);
					((NetworkBehaviour)this).__endSendRpc(ref val3, 2071504078u, val2, val, (SendTo)3, (RpcDelivery)0);
				}
				if ((int)base.__rpc_exec_stage == 1)
				{
					base.__rpc_exec_stage = (__RpcExecStage)0;
					DoTransformationSequnce();
				}
			}
		}

		public virtual Vector3 GetPositionToSpawnSprout(float radius = 8f, float fallbackY = 0f)
		{
			//IL_003e: 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)
			//IL_00f9: 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_00dc: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f5: Unknown result type (might be due to invalid IL or missing references)
			//IL_0087: 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)
			float num = 30f;
			float num2 = Random.Range(0f, 360f);
			float num3 = num2 + (float)LethalMinExtras.MaxCPBTransforms.InternalValue * num % 360f;
			if (TryGetGroundPositionAtAngle(num3, radius, fallbackY, out var groundPosition))
			{
				return groundPosition;
			}
			for (float num4 = num; num4 < 360f; num4 += num)
			{
				float num5 = (num3 + num4) % 360f;
				if (TryGetGroundPositionAtAngle(num5, radius, fallbackY, out groundPosition))
				{
					LethalMinExtras.Logger.LogDebug((object)$"Found ground position for sprout spawn at fallback angle {num5:F1}.");
					return groundPosition;
				}
			}
			LethalMinExtras.Logger.LogWarning((object)"Failed to find ground position for sprout spawn at any angle. Spawning at fallback position.");
			float num6 = num3 * (MathF.PI / 180f);
			return new Vector3(SproutSpawnPos.position.x + Mathf.Sin(num6) * radius, fallbackY, SproutSpawnPos.position.z + Mathf.Cos(num6) * radius);
		}

		private bool TryGetGroundPositionAtAngle(float angle, float radius, float fallbackY, out Vector3 groundPosition)
		{
			//IL_0011: Unknown result type (might be due to invalid IL or missing references)
			//IL_002a: Unknown result type (might be due to invalid IL or missing references)
			//IL_003a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0052: Unknown result type (might be due to invalid IL or missing references)
			//IL_0053: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c0: 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_00cd: Unknown result type (might be due to invalid IL or missing references)
			//IL_0081: Unknown result type (might be due to invalid IL or missing references)
			//IL_009c: 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_011e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0123: 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_00f8: Unknown result type (might be due to invalid IL or missing references)
			//IL_010d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0112: Unknown result type (might be due to invalid IL or missing references)
			float num = angle * (MathF.PI / 180f);
			Vector3 val = default(Vector3);
			((Vector3)(ref val))..ctor(SproutSpawnPos.position.x + Mathf.Sin(num) * radius, SproutSpawnPos.position.y, SproutSpawnPos.position.z + Mathf.Cos(num) * radius);
			RaycastHit val2 = default(RaycastHit);
			if (Physics.Raycast(val, Vector3.down, ref val2, float.PositiveInfinity, StartOfRound.Instance.collidersAndRoomMask))
			{
				LethalMinExtras.Logger.LogDebug((object)$"Found ground position for sprout spawn at {((RaycastHit)(ref val2)).point} (from {((Object)((Component)((RaycastHit)(ref val2)).collider).gameObject).name}) using raycast from {val}");
				groundPosition = ((RaycastHit)(ref val2)).point;
				return true;
			}
			NavMeshHit val3 = default(NavMeshHit);
			if (NavMesh.SamplePosition(new Vector3(val.x, fallbackY, val.z), ref val3, radius, -1))
			{
				LethalMinExtras.Logger.LogDebug((object)$"Found ground position for sprout spawn at {((NavMeshHit)(ref val3)).position} using NavMesh sample from {val}");
				groundPosition = ((NavMeshHit)(ref val3)).position;
				return true;
			}
			groundPosition = Vector3.zero;
			return false;
		}

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

		protected override void __initializeRpcs()
		{
			//IL_000d: Unknown result type (might be due to invalid IL or missing references)
			//IL_001c: Expected O, but got Unknown
			//IL_0029: Unknown result type (might be due to invalid IL or missing references)
			//IL_0038: Expected O, but got Unknown
			//IL_0045: Unknown result type (might be due to invalid IL or missing references)
			//IL_0054: Expected O, but got Unknown
			((NetworkBehaviour)this).__registerRpc(1844728853u, new RpcReceiveHandler(__rpc_handler_1844728853), "SetTransformTypeRpc");
			((NetworkBehaviour)this).__registerRpc(3999458850u, new RpcReceiveHandler(__rpc_handler_3999458850), "SetPikminToTransformRpc");
			((NetworkBehaviour)this).__registerRpc(2071504078u, new RpcReceiveHandler(__rpc_handler_2071504078), "DoTransformationSequnceRpc");
			((NetworkBehaviour)this).__initializeRpcs();
		}

		private static void __rpc_handler_1844728853(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 transformTypeRpc = default(int);
				ByteUnpacker.ReadValueBitPacked(reader, ref transformTypeRpc);
				target.__rpc_exec_stage = (__RpcExecStage)1;
				((CandyPopBud)(object)target).SetTransformTypeRpc(transformTypeRpc);
				target.__rpc_exec_stage = (__RpcExecStage)0;
			}
		}

		private static void __rpc_handler_3999458850(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_0044: Unknown result type (might be due to invalid IL or missing references)
			//IL_004f: 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)
			{
				NetworkObjectReference pikminToTransformRpc = default(NetworkObjectReference);
				((FastBufferReader)(ref reader)).ReadValueSafe<NetworkObjectReference>(ref pikminToTransformRpc, default(ForNetworkSerializable));
				target.__rpc_exec_stage = (__RpcExecStage)1;
				((CandyPopBud)(object)target).SetPikminToTransformRpc(pikminToTransformRpc);
				target.__rpc_exec_stage = (__RpcExecStage)0;
			}
		}

		private static void __rpc_handler_2071504078(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams)
		{
			//IL_0029: 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)
			NetworkManager networkManager = target.NetworkManager;
			if (networkManager != null && networkManager.IsListening)
			{
				target.__rpc_exec_stage = (__RpcExecStage)1;
				((CandyPopBud)(object)target).DoTransformationSequnceRpc();
				target.__rpc_exec_stage = (__RpcExecStage)0;
			}
		}

		[MethodImpl(MethodImplOptions.NoInlining)]
		protected internal override string __getTypeName()
		{
			return "CandyPopBud";
		}
	}
	public class DrinkNectarTask : PikminTask
	{
		private Nectar nectar;

		private bool hasDrunk = false;

		private const float DrinkRange = 1.4f;

		public DrinkNectarTask(PikminAI pikminAssigningTo, Nectar targetNectar)
			: base(pikminAssigningTo)
		{
			nectar = targetNectar;
		}

		public override void IntervaledUpdate()
		{
			//IL_0062: Unknown result type (might be due to invalid IL or missing references)
			//IL_0073: 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)
			if (hasDrunk || (Object)(object)nectar == (Object)null || !nectar.HasDrinksLeft)
			{
				((PikminTask)this).TaskEnd(false, false);
				return;
			}
			((EnemyAI)((PikminTask)this).pikmin).agent.stoppingDistance = 0f;
			((PikminTask)this).pikmin.PathToPosition(((Component)nectar).transform.position);
			if (Vector3.Distance(((PikminTask)this).transform.position, ((Component)nectar).transform.position) <= 1.4f)
			{
				hasDrunk = true;
				((PikminTask)this).pikmin.PlayAnimation(((PikminTask)this).pikmin.animController.AnimPack.EditorDrinkAnim, 0.25f, 0);
				((PikminTask)this).pikmin.PlayAudioOnLocalClient((PikminSoundPackSounds)26, true);
				nectar.ConsumeServerRpc();
				((PikminTask)this).pikmin.SetGrowthServerRpc(((PikminTask)this).pikmin.MaxGrowthStage);
				((PikminTask)this).TaskEnd(true, false);
			}
		}

		public static DrinkNectarTask? TryCreate(PikminAI pikmin)
		{
			//IL_005c: 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)
			if (pikmin.CurrentGrowthStage >= pikmin.MaxGrowthStage)
			{
				return null;
			}
			Nectar nectar = null;
			float num = pikmin.pikminType.ItemDetectionRange;
			foreach (Nectar instance in Nectar.Instances)
			{
				if (instance.HasDrinksLeft)
				{
					float num2 = Vector3.Distance(((Component)pikmin).transform.position, ((Component)instance).transform.position);
					if (num2 < num)
					{
						num = num2;
						nectar = instance;
					}
				}
			}
			return ((Object)(object)nectar != (Object)null) ? new DrinkNectarTask(pikmin, nectar) : null;
		}
	}
	public class Nectar : NetworkBehaviour
	{
		[CompilerGenerated]
		private sealed class <TweenToFloor>d__14 : IEnumerator<object>, IEnumerator, IDisposable
		{
			private int <>1__state;

			private object <>2__current;

			public Vector3 start;

			public Vector3 target;

			public Nectar <>4__this;

			private float <duration>5__1;

			private float <elapsed>5__2;

			private float <t>5__3;

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

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

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

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

			private bool MoveNext()
			{
				//IL_0045: Unknown result type (might be due to invalid IL or missing references)
				//IL_0084: Unknown result type (might be due to invalid IL or missing references)
				//IL_008a: Unknown result type (might be due to invalid IL or missing references)
				//IL_009c: Unknown result type (might be due to invalid IL or missing references)
				//IL_00dd: Unknown result type (might be due to invalid IL or missing references)
				switch (<>1__state)
				{
				default:
					return false;
				case 0:
					<>1__state = -1;
					<duration>5__1 = 0.8f;
					<elapsed>5__2 = 0f;
					((Component)<>4__this).transform.position = start;
					break;
				case 1:
					<>1__state = -1;
					break;
				}
				if (<elapsed>5__2 < <duration>5__1)
				{
					<elapsed>5__2 += Time.deltaTime;
					<t>5__3 = <elapsed>5__2 / <duration>5__1;
					((Component)<>4__this).transform.position = Vector3.Lerp(start, target, <t>5__3 * <t>5__3);
					<>2__current = null;
					<>1__state = 1;
					return true;
				}
				((Component)<>4__this).transform.position = target;
				return false;
			}

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

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

		internal static List<Nectar> Instances = new List<Nectar>();

		public int DrinksLeft = 10;

		public AudioSource audioSource = null;

		public AudioClip spawnSFX = null;

		private int maxDrinks;

		private Vector3 originalScale;

		public bool HasDrinksLeft => DrinksLeft > 0;

		private void Awake()
		{
			Instances.Add(this);
		}

		private void OnDestory()
		{
			Instances.Remove(this);
		}

		public void Start()
		{
			//IL_0014: Unknown result type (might be due to invalid IL or missing references)
			//IL_0019: Unknown result type (might be due to invalid IL or missing references)
			maxDrinks = DrinksLeft;
			originalScale = ((Component)this).transform.localScale;
			audioSource.PlayOneShot(spawnSFX);
		}

		[ServerRpc(RequireOwnership = false)]
		public void ConsumeServerRpc()
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Invalid comparison between Unknown and I4
			//IL_008c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0096: 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_007c: 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)
			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(392338870u, val, (RpcDelivery)0);
				((NetworkBehaviour)this).__endSendServerRpc(ref val2, 392338870u, val, (RpcDelivery)0);
			}
			if ((int)base.__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost))
			{
				base.__rpc_exec_stage = (__RpcExecStage)0;
				DrinksLeft--;
				ConsumeClientRpc(DrinksLeft);
				if (DrinksLeft <= 0)
				{
					((NetworkBehaviour)this).NetworkObject.Despawn(true);
				}
			}
		}

		[ClientRpc]
		private void ConsumeClientRpc(int remaining)
		{
			//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)
			//IL_00ce: Unknown result type (might be due to invalid IL or missing references)
			//IL_00fd: Unknown result type (might be due to invalid IL or missing references)
			//IL_0103: Unknown result type (might be due to invalid IL or missing references)
			NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
			if (networkManager != null && networkManager.IsListening)
			{
				if ((int)base.__rpc_exec_stage != 1 && (networkManager.IsServer || networkManager.IsHost))
				{
					ClientRpcParams val = default(ClientRpcParams);
					FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(3896027134u, val, (RpcDelivery)0);
					BytePacker.WriteValueBitPacked(val2, remaining);
					((NetworkBehaviour)this).__endSendClientRpc(ref val2, 3896027134u, val, (RpcDelivery)0);
				}
				if ((int)base.__rpc_exec_stage == 1 && (networkManager.IsClient || networkManager.IsHost))
				{
					base.__rpc_exec_stage = (__RpcExecStage)0;
					DrinksLeft = remaining;
					float num = ((maxDrinks > 0) ? ((float)remaining / (float)maxDrinks) : 0f);
					((Component)this).transform.localScale = originalScale * num;
				}
			}
		}

		[Rpc(/*Could not decode attribute arguments.*/)]
		public void StartTweenRpc(Vector3 startPos, Vector3 targetPos)
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Invalid comparison between Unknown and I4
			//IL_00a6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b0: Invalid comparison between Unknown and I4
			//IL_0043: 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_0051: Unknown result type (might be due to invalid IL or missing references)
			//IL_005f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0064: Unknown result type (might be due to invalid IL or missing references)
			//IL_008d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0091: Unknown result type (might be due to invalid IL or missing references)
			//IL_00bf: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c8: Unknown result type (might be due to invalid IL or missing references)
			NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
			if (networkManager != null && networkManager.IsListening)
			{
				if ((int)base.__rpc_exec_stage != 1)
				{
					RpcAttributeParams val = default(RpcAttributeParams);
					RpcParams val2 = default(RpcParams);
					FastBufferWriter val3 = ((NetworkBehaviour)this).__beginSendRpc(1814601693u, val2, val, (SendTo)7, (RpcDelivery)0);
					((FastBufferWriter)(ref val3)).WriteValueSafe(ref startPos);
					((FastBufferWriter)(ref val3)).WriteValueSafe(ref targetPos);
					((NetworkBehaviour)this).__endSendRpc(ref val3, 1814601693u, val2, val, (SendTo)7, (RpcDelivery)0);
				}
				if ((int)base.__rpc_exec_stage == 1)
				{
					base.__rpc_exec_stage = (__RpcExecStage)0;
					((MonoBehaviour)this).StartCoroutine(TweenToFloor(startPos, targetPos));
				}
			}
		}

		[IteratorStateMachine(typeof(<TweenToFloor>d__14))]
		private IEnumerator TweenToFloor(Vector3 start, Vector3 target)
		{
			//IL_000e: Unknown result type (might be due to invalid IL or missing references)
			//IL_000f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0015: Unknown result type (might be due to invalid IL or missing references)
			//IL_0016: Unknown result type (might be due to invalid IL or missing references)
			//yield-return decompiler failed: Unexpected instruction in Iterator.Dispose()
			return new <TweenToFloor>d__14(0)
			{
				<>4__this = this,
				start = start,
				target = target
			};
		}

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

		protected override void __initializeRpcs()
		{
			//IL_000d: Unknown result type (might be due to invalid IL or missing references)
			//IL_001c: Expected O, but got Unknown
			//IL_0029: Unknown result type (might be due to invalid IL or missing references)
			//IL_0038: Expected O, but got Unknown
			//IL_0045: Unknown result type (might be due to invalid IL or missing references)
			//IL_0054: Expected O, but got Unknown
			((NetworkBehaviour)this).__registerRpc(392338870u, new RpcReceiveHandler(__rpc_handler_392338870), "ConsumeServerRpc");
			((NetworkBehaviour)this).__registerRpc(3896027134u, new RpcReceiveHandler(__rpc_handler_3896027134), "ConsumeClientRpc");
			((NetworkBehaviour)this).__registerRpc(1814601693u, new RpcReceiveHandler(__rpc_handler_1814601693), "StartTweenRpc");
			((NetworkBehaviour)this).__initializeRpcs();
		}

		private static void __rpc_handler_392338870(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams)
		{
			//IL_0029: 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)
			NetworkManager networkManager = target.NetworkManager;
			if (networkManager != null && networkManager.IsListening)
			{
				target.__rpc_exec_stage = (__RpcExecStage)1;
				((Nectar)(object)target).ConsumeServerRpc();
				target.__rpc_exec_stage = (__RpcExecStage)0;
			}
		}

		private static void __rpc_handler_3896027134(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 remaining = default(int);
				ByteUnpacker.ReadValueBitPacked(reader, ref remaining);
				target.__rpc_exec_stage = (__RpcExecStage)1;
				((Nectar)(object)target).ConsumeClientRpc(remaining);
				target.__rpc_exec_stage = (__RpcExecStage)0;
			}
		}

		private static void __rpc_handler_1814601693(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams)
		{
			//IL_0043: Unknown result type (might be due to invalid IL or missing references)
			//IL_004e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0052: Unknown result type (might be due to invalid IL or missing references)
			//IL_0061: Unknown result type (might be due to invalid IL or missing references)
			NetworkManager networkManager = target.NetworkManager;
			if (networkManager != null && networkManager.IsListening)
			{
				Vector3 startPos = default(Vector3);
				((FastBufferReader)(ref reader)).ReadValueSafe(ref startPos);
				Vector3 targetPos = default(Vector3);
				((FastBufferReader)(ref reader)).ReadValueSafe(ref targetPos);
				target.__rpc_exec_stage = (__RpcExecStage)1;
				((Nectar)(object)target).StartTweenRpc(startPos, targetPos);
				target.__rpc_exec_stage = (__RpcExecStage)0;
			}
		}

		[MethodImpl(MethodImplOptions.NoInlining)]
		protected internal override string __getTypeName()
		{
			return "Nectar";
		}
	}
	public class NectarEgg : NetworkBehaviour, IHittable
	{
		public float HP = 20f;

		public GameObject NectarPrefab = null;

		public SkinnedMeshRenderer Renderer = null;

		[SerializeField]
		private AudioSource audioSource = null;

		[SerializeField]
		private AudioClip[] hitSounds = null;

		private PikminLatchTrigger latchTrigger = null;

		private bool dead = false;

		private float maxHP;

		private int killConfirmCount = 0;

		public bool Hit(int force, Vector3 hitDirection, PlayerControllerB playerWhoHit = null, bool playHitSFX = false, int hitID = -1)
		{
			if (((NetworkBehaviour)this).IsOwner)
			{
				TakeDamageRpc(HP, force, HitViaPlayer: true);
			}
			return true;
		}

		public void Start()
		{
			maxHP = HP;
			latchTrigger = ((Component)this).GetComponentInChildren<PikminLatchTrigger>();
			latchTrigger.OnPikminHit.AddListener((UnityAction<PikminAI>)delegate
			{
				if (((NetworkBehaviour)this).IsOwner)
				{
					TakeDamageRpc(HP, 1, HitViaPlayer: false);
				}
			});
			latchTrigger.OnPikminDirectLatch.AddListener((UnityAction<PikminAI>)delegate
			{
				if (!((NetworkBehaviour)this).IsOwner)
				{
				}
			});
		}

		[Rpc(/*Could not decode attribute arguments.*/)]
		public void TakeDamageRpc(float ownerHP, int damage, bool HitViaPlayer)
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Invalid comparison between Unknown and I4
			//IL_00cf: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d9: Invalid comparison between Unknown and I4
			//IL_0043: 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_0051: Unknown result type (might be due to invalid IL or missing references)
			//IL_005f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0064: Unknown result type (might be due to invalid IL or missing references)
			//IL_0074: 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_0083: Unknown result type (might be due to invalid IL or missing references)
			//IL_009c: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a2: 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_00ba: 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)
			NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
			if (networkManager != null && networkManager.IsListening)
			{
				if ((int)base.__rpc_exec_stage != 1)
				{
					RpcAttributeParams val = default(RpcAttributeParams);
					RpcParams val2 = default(RpcParams);
					FastBufferWriter val3 = ((NetworkBehaviour)this).__beginSendRpc(2661846769u, val2, val, (SendTo)7, (RpcDelivery)0);
					((FastBufferWriter)(ref val3)).WriteValueSafe<float>(ref ownerHP, default(ForPrimitives));
					BytePacker.WriteValueBitPacked(val3, damage);
					((FastBufferWriter)(ref val3)).WriteValueSafe<bool>(ref HitViaPlayer, default(ForPrimitives));
					((NetworkBehaviour)this).__endSendRpc(ref val3, 2661846769u, val2, val, (SendTo)7, (RpcDelivery)0);
				}
				if ((int)base.__rpc_exec_stage == 1)
				{
					base.__rpc_exec_stage = (__RpcExecStage)0;
					HP = ownerHP;
					TakeDamage(damage, HitViaPlayer);
				}
			}
		}

		public void TakeDamage(float damage, bool HitViaPlayer)
		{
			//IL_005d: Unknown result type (might be due to invalid IL or missing references)
			if (!dead)
			{
				HP -= damage;
				if ((Object)(object)Renderer != (Object)null && HP < maxHP * 0.5f)
				{
					((Renderer)Renderer).material.mainTextureOffset = new Vector2(0.5f, 0f);
				}
				if (HP <= 0f && ((NetworkBehaviour)this).IsOwner)
				{
					KillRpc();
				}
				else if ((Object)(object)audioSource != (Object)null && hitSounds != null)
				{
					audioSource.PlayOneShot(hitSounds[Random.Range(0, hitSounds.Length)]);
				}
			}
		}

		[Rpc(/*Could not decode attribute arguments.*/)]
		public void KillRpc()
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Invalid comparison between Unknown and I4
			//IL_008c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0096: Invalid comparison between Unknown and I4
			//IL_0043: 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_0051: Unknown result type (might be due to invalid IL or missing references)
			//IL_005f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0064: Unknown result type (might be due to invalid IL or missing references)
			//IL_0073: Unknown result type (might be due to invalid IL or missing references)
			//IL_0077: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a5: Unknown result type (might be due to invalid IL or missing references)
			NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
			if (networkManager != null && networkManager.IsListening)
			{
				if ((int)base.__rpc_exec_stage != 1)
				{
					RpcAttributeParams val = default(RpcAttributeParams);
					RpcParams val2 = default(RpcParams);
					FastBufferWriter val3 = ((NetworkBehaviour)this).__beginSendRpc(2862365588u, val2, val, (SendTo)7, (RpcDelivery)0);
					((NetworkBehaviour)this).__endSendRpc(ref val3, 2862365588u, val2, val, (SendTo)7, (RpcDelivery)0);
				}
				if ((int)base.__rpc_exec_stage == 1)
				{
					base.__rpc_exec_stage = (__RpcExecStage)0;
					Kill();
					NotifyKillCompleteServerRpc();
				}
			}
		}

		[Rpc(/*Could not decode attribute arguments.*/)]
		private void NotifyKillCompleteServerRpc()
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Invalid comparison between Unknown and I4
			//IL_008c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0096: Invalid comparison between Unknown and I4
			//IL_0043: 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_0051: Unknown result type (might be due to invalid IL or missing references)
			//IL_005f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0064: Unknown result type (might be due to invalid IL or missing references)
			//IL_0073: Unknown result type (might be due to invalid IL or missing references)
			//IL_0077: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a5: Unknown result type (might be due to invalid IL or missing references)
			NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
			if (networkManager == null || !networkManager.IsListening)
			{
				return;
			}
			if ((int)base.__rpc_exec_stage != 1)
			{
				RpcAttributeParams val = default(RpcAttributeParams);
				RpcParams val2 = default(RpcParams);
				FastBufferWriter val3 = ((NetworkBehaviour)this).__beginSendRpc(362879498u, val2, val, (SendTo)2, (RpcDelivery)0);
				((NetworkBehaviour)this).__endSendRpc(ref val3, 362879498u, val2, val, (SendTo)2, (RpcDelivery)0);
			}
			if ((int)base.__rpc_exec_stage == 1)
			{
				base.__rpc_exec_stage = (__RpcExecStage)0;
				killConfirmCount++;
				if (killConfirmCount >= NetworkManager.Singleton.ConnectedClientsIds.Count)
				{
					SpawnNectarAndDespawn();
				}
			}
		}

		private void SpawnNectarAndDespawn()
		{
			//IL_0007: Unknown result type (might be due to invalid IL or missing references)
			//IL_000c: Unknown result type (might be due to invalid IL or missing references)
			//IL_000e: Unknown result type (might be due to invalid IL or missing references)
			//IL_000f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0014: Unknown result type (might be due to invalid IL or missing references)
			//IL_001b: Unknown result type (might be due to invalid IL or missing references)
			//IL_001c: Unknown result type (might be due to invalid IL or missing references)
			Vector3 position = ((Component)this).transform.position;
			Vector3 floorPosition = GetFloorPosition(position);
			GameObject val = Object.Instantiate<GameObject>(NectarPrefab, position, Quaternion.identity);
			NetworkObject component = val.GetComponent<NetworkObject>();
			component.Spawn(false);
			Nectar component2 = val.GetComponent<Nectar>();
			((NetworkBehaviour)this).NetworkObject.Despawn(true);
		}

		public void Kill()
		{
			dead = true;
			List<PikminAI> list = new List<PikminAI>(latchTrigger.PikminOnLatch);
			foreach (PikminAI item in list)
			{
				item.SetToIdle(false);
				item.ApplyPhysics(true);
				item.DoYay(false, false);
			}
			PikminLatchTrigger componentInChildren = ((Component)this).GetComponentInChildren<PikminLatchTrigger>();
			if ((Object)(object)componentInChildren != (Object)null)
			{
				((Component)componentInChildren).gameObject.SetActive(false);
			}
		}

		public Vector3 GetFloorPosition(Vector3 startPosition = default(Vector3))
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			//IL_0033: Unknown result type (might be due to invalid IL or missing references)
			//IL_0034: 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_0043: Unknown result type (might be due to invalid IL or missing references)
			//IL_0048: Unknown result type (might be due to invalid IL or missing references)
			//IL_0058: Unknown result type (might be due to invalid IL or missing references)
			//IL_0059: Unknown result type (might be due to invalid IL or missing references)
			//IL_005e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0017: Unknown result type (might be due to invalid IL or missing references)
			//IL_001c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0026: Unknown result type (might be due to invalid IL or missing references)
			//IL_002b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0030: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f1: 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_0106: Unknown result type (might be due to invalid IL or missing references)
			//IL_0107: Unknown result type (might be due to invalid IL or missing references)
			//IL_007c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0081: Unknown result type (might be due to invalid IL or missing references)
			//IL_008b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0090: Unknown result type (might be due to invalid IL or missing references)
			//IL_0095: Unknown result type (might be due to invalid IL or missing references)
			//IL_009a: Unknown result type (might be due to invalid IL or missing references)
			//IL_009f: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a9: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ae: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00cf: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d9: Unknown result type (might be due to invalid IL or missing references)
			//IL_00de: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e3: Unknown result type (might be due to invalid IL or missing references)
			//IL_010a: Unknown result type (might be due to invalid IL or missing references)
			if (startPosition == Vector3.zero)
			{
				startPosition = ((Component)this).transform.position + Vector3.up * 0.15f;
			}
			Debug.DrawRay(startPosition, -Vector3.up * 10f, Color.yellow, 5f);
			RaycastHit val = default(RaycastHit);
			if (Physics.Raycast(startPosition, -Vector3.up, ref val, 80f, 268437761, (QueryTriggerInteraction)1))
			{
				Debug.DrawRay(((RaycastHit)(ref val)).point + Vector3.up * 0.04f + Vector3.up, Vector3.up * 0.25f, Color.cyan, 5f);
				return ((RaycastHit)(ref val)).point + Vector3.up * 0.04f + Vector3.up;
			}
			Debug.DrawRay(startPosition, Vector3.up * 0.25f, Color.white, 5f);
			return startPosition;
		}

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

		protected override void __initializeRpcs()
		{
			//IL_000d: Unknown result type (might be due to invalid IL or missing references)
			//IL_001c: Expected O, but got Unknown
			//IL_0029: Unknown result type (might be due to invalid IL or missing references)
			//IL_0038: Expected O, but got Unknown
			//IL_0045: Unknown result type (might be due to invalid IL or missing references)
			//IL_0054: Expected O, but got Unknown
			((NetworkBehaviour)this).__registerRpc(2661846769u, new RpcReceiveHandler(__rpc_handler_2661846769), "TakeDamageRpc");
			((NetworkBehaviour)this).__registerRpc(2862365588u, new RpcReceiveHandler(__rpc_handler_2862365588), "KillRpc");
			((NetworkBehaviour)this).__registerRpc(362879498u, new RpcReceiveHandler(__rpc_handler_362879498), "NotifyKillCompleteServerRpc");
			((NetworkBehaviour)this).__initializeRpcs();
		}

		private static void __rpc_handler_2661846769(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_003e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0057: Unknown result type (might be due to invalid IL or missing references)
			//IL_005d: Unknown result type (might be due to invalid IL or missing references)
			//IL_006c: Unknown result type (might be due to invalid IL or missing references)
			//IL_008e: Unknown result type (might be due to invalid IL or missing references)
			NetworkManager networkManager = target.NetworkManager;
			if (networkManager != null && networkManager.IsListening)
			{
				float ownerHP = default(float);
				((FastBufferReader)(ref reader)).ReadValueSafe<float>(ref ownerHP, default(ForPrimitives));
				int damage = default(int);
				ByteUnpacker.ReadValueBitPacked(reader, ref damage);
				bool hitViaPlayer = default(bool);
				((FastBufferReader)(ref reader)).ReadValueSafe<bool>(ref hitViaPlayer, default(ForPrimitives));
				target.__rpc_exec_stage = (__RpcExecStage)1;
				((NectarEgg)(object)target).TakeDamageRpc(ownerHP, damage, hitViaPlayer);
				target.__rpc_exec_stage = (__RpcExecStage)0;
			}
		}

		private static void __rpc_handler_2862365588(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams)
		{
			//IL_0029: 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)
			NetworkManager networkManager = target.NetworkManager;
			if (networkManager != null && networkManager.IsListening)
			{
				target.__rpc_exec_stage = (__RpcExecStage)1;
				((NectarEgg)(object)target).KillRpc();
				target.__rpc_exec_stage = (__RpcExecStage)0;
			}
		}

		private static void __rpc_handler_362879498(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams)
		{
			//IL_0029: 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)
			NetworkManager networkManager = target.NetworkManager;
			if (networkManager != null && networkManager.IsListening)
			{
				target.__rpc_exec_stage = (__RpcExecStage)1;
				((NectarEgg)(object)target).NotifyKillCompleteServerRpc();
				target.__rpc_exec_stage = (__RpcExecStage)0;
			}
		}

		[MethodImpl(MethodImplOptions.NoInlining)]
		protected internal override string __getTypeName()
		{
			return "NectarEgg";
		}
	}
	public class PelletItem : GrabbableObject
	{
		[CompilerGenerated]
		private sealed class <fadeBetweenColors>d__1 : IEnumerator<object>, IEnumerator, IDisposable
		{
			private int <>1__state;

			private object <>2__current;

			public Color startColor;

			public Color endColor;

			public float duration;

			public PelletItem <>4__this;

			private float <elapsed>5__1;

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

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

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

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

			private bool MoveNext()
			{
				//IL_003f: Unknown result type (might be due to invalid IL or missing references)
				//IL_0045: Unknown result type (might be due to invalid IL or missing references)
				//IL_0057: Unknown result type (might be due to invalid IL or missing references)
				//IL_00af: Unknown result type (might be due to invalid IL or missing references)
				switch (<>1__state)
				{
				default:
					return false;
				case 0:
					<>1__state = -1;
					<elapsed>5__1 = 0f;
					break;
				case 1:
					<>1__state = -1;
					break;
				}
				if (<elapsed>5__1 < duration)
				{
					((Renderer)((GrabbableObject)<>4__this).mainObjectRenderer).material.color = Color.Lerp(startColor, endColor, <elapsed>5__1 / duration);
					<elapsed>5__1 += Time.deltaTime;
					<>2__current = null;
					<>1__state = 1;
					return true;
				}
				((Renderer)((GrabbableObject)<>4__this).mainObjectRenderer).material.color = endColor;
				return false;
			}

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

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

		public void SetColorFromType(PikminType type)
		{
			//IL_0016: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0034: Unknown result type (might be due to invalid IL or missing references)
			PikminItemSettings componentInChildren = ((Component)this).GetComponentInChildren<PikminItemSettings>();
			componentInChildren.PerferedType = type;
			((Component)this).GetComponentInChildren<SpriteRenderer>().color = type.PikminPrimaryColor;
			((MonoBehaviour)this).StartCoroutine(fadeBetweenColors(((Renderer)base.mainObjectRenderer).material.color, type.PikminPrimaryColor, 0.5f));
		}

		[IteratorStateMachine(typeof(<fadeBetweenColors>d__1))]
		private IEnumerator fadeBetweenColors(Color startColor, Color endColor, float duration)
		{
			//IL_000e: Unknown result type (might be due to invalid IL or missing references)
			//IL_000f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0015: Unknown result type (might be due to invalid IL or missing references)
			//IL_0016: Unknown result type (might be due to invalid IL or missing references)
			//yield-return decompiler failed: Unexpected instruction in Iterator.Dispose()
			return new <fadeBetweenColors>d__1(0)
			{
				<>4__this = this,
				startColor = startColor,
				endColor = endColor,
				duration = duration
			};
		}

		public void DisableLatch()
		{
			PikminLatchTrigger componentInChildren = ((Component)this).GetComponentInChildren<PikminLatchTrigger>();
			if ((Object)(object)componentInChildren != (Object)null)
			{
				((Component)componentInChildren).gameObject.SetActive(false);
			}
		}

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

		protected override void __initializeRpcs()
		{
			((GrabbableObject)this).__initializeRpcs();
		}

		[MethodImpl(MethodImplOptions.NoInlining)]
		protected internal override string __getTypeName()
		{
			return "PelletItem";
		}
	}
	public class PelletPosy : NetworkBehaviour, IHittable
	{
		[CompilerGenerated]
		private sealed class <PlayBloomSFX>d__30 : IEnumerator<object>, IEnumerator, IDisposable
		{
			private int <>1__state;

			private object <>2__current;

			public PelletPosy <>4__this;

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

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

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

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

			private bool MoveNext()
			{
				//IL_0042: Unknown result type (might be due to invalid IL or missing references)
				//IL_004c: Expected O, but got Unknown
				switch (<>1__state)
				{
				default:
					return false;
				case 0:
					<>1__state = -1;
					<>4__this.audioSource.PlayOneShot(<>4__this.bloomASound);
					<>2__current = (object)new WaitForSeconds(0.5f);
					<>1__state = 1;
					return true;
				case 1:
					<>1__state = -1;
					<>4__this.audioSource.PlayOneShot(<>4__this.bloomBSound);
					return false;
				}
			}

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

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

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

			private object <>2__current;

			public PelletPosy <>4__this;

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

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

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

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

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

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

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

		[FormerlySerializedAs("elletPrefab")]
		[SerializeField]
		private GameObject pelletPrefab = null;

		[SerializeField]
		private Transform pelletSpawnPoint = null;

		[SerializeField]
		private Animator animator = null;

		[SerializeField]
		private AudioSource audioSource = null;

		[SerializeField]
		private AudioClip[] hitSounds = null;

		[SerializeField]
		private AudioClip bloomASound = null;

		[SerializeField]
		private AudioClip bloomBSound = null;

		[SerializeField]
		private AudioClip deathASound = null;

		[SerializeField]
		private AudioClip deathBSound = null;

		[SerializeField]
		private int GrowStage = 0;

		[SerializeField]
		private int HP = 12;

		private PelletItem pellet = null;

		private PikminLatchTrigger latchTrigger = null;

		private PikminType pelletType = null;

		private bool disabled = false;

		private bool dead = false;

		private float GrowTimer = 5f;

		private float CycleTimer = 5f;

		private int CycleIndex;

		public bool Hit(int force, Vector3 hitDirection, PlayerControllerB playerWhoHit = null, bool playHitSFX = false, int hitID = -1)
		{
			if (GrowStage < 2)
			{
				return false;
			}
			if (((NetworkBehaviour)this).IsOwner)
			{
				TakeDamageRpc(HP, force, HitViaPlayer: true);
			}
			return true;
		}

		public void SpawnPellet()
		{
			//IL_0022: Unknown result type (might be due to invalid IL or missing references)
			//IL_002d: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c8: Unknown result type (might be due to invalid IL or missing references)
			if (!((Object)(object)pellet != (Object)null))
			{
				GameObject val = Object.Instantiate<GameObject>(pelletPrefab, pelletSpawnPoint.position, pelletSpawnPoint.rotation);
				val.GetComponent<NetworkObject>().Spawn(false);
				pellet = val.GetComponent<PelletItem>();
				latchTrigger = val.GetComponentInChildren<PikminLatchTrigger>(true);
				List<PikminType> list = LethalMin.RegisteredPikminTypes.Values.Where((PikminType t) => PikChecks.IsPikminValidForPelletSelection(t)).ToList();
				pelletType = list[Random.Range(0, list.Count)];
				CycleIndex = list.IndexOf(pelletType);
				SyncPelletRpc(NetworkObjectReference.op_Implicit(((NetworkBehaviour)pellet).NetworkObject));
				SetPelletTypeRpc(pelletType.PikminTypeID);
			}
		}

		[Rpc(/*Could not decode attribute arguments.*/)]
		public void SyncPelletRpc(NetworkObjectReference pelletRef)
		{
			//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_0043: 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_0051: Unknown result type (might be due to invalid IL or missing references)
			//IL_005f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0064: Unknown result type (might be due to invalid IL or missing references)
			//IL_0074: 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_008e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0092: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c0: Unknown result type (might be due to invalid IL or missing references)
			//IL_0134: Unknown result type (might be due to invalid IL or missing references)
			//IL_0155: Unknown result type (might be due to invalid IL or missing references)
			//IL_0169: Unknown result type (might be due to invalid IL or missing references)
			//IL_018a: 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)
			{
				RpcAttributeParams val = default(RpcAttributeParams);
				RpcParams val2 = default(RpcParams);
				FastBufferWriter val3 = ((NetworkBehaviour)this).__beginSendRpc(2026733955u, val2, val, (SendTo)7, (RpcDelivery)0);
				((FastBufferWriter)(ref val3)).WriteValueSafe<NetworkObjectReference>(ref pelletRef, default(ForNetworkSerializable));
				((NetworkBehaviour)this).__endSendRpc(ref val3, 2026733955u, val2, val, (SendTo)7, (RpcDelivery)0);
			}
			if ((int)base.__rpc_exec_stage != 1)
			{
				return;
			}
			base.__rpc_exec_stage = (__RpcExecStage)0;
			NetworkObject val4 = default(NetworkObject);
			if (!((NetworkObjectReference)(ref pelletRef)).TryGet(ref val4, (NetworkManager)null))
			{
				return;
			}
			pellet = ((Component)val4).GetComponent<PelletItem>();
			latchTrigger = ((Component)val4).GetComponentInChildren<PikminLatchTrigger>(true);
			((Component)latchTrigger).gameObject.SetActive(true);
			((Behaviour)((Component)pellet).GetComponentInChildren<PositionConstraint>()).enabled = true;
			((Behaviour)((Component)pellet).GetComponentInChildren<RotationConstraint>()).enabled = true;
			PositionConstraint componentInChildren = ((Component)pellet).GetComponentInChildren<PositionConstraint>();
			ConstraintSource val5 = default(ConstraintSource);
			((ConstraintSource)(ref val5)).sourceTransform = pelletSpawnPoint;
			((ConstraintSource)(ref val5)).weight = 1f;
			componentInChildren.AddSource(val5);
			RotationConstraint componentInChildren2 = ((Component)pellet).GetComponentInChildren<RotationConstraint>();
			val5 = default(ConstraintSource);
			((ConstraintSource)(ref val5)).sourceTransform = pelletSpawnPoint;
			((ConstraintSource)(ref val5)).weight = 1f;
			componentInChildren2.AddSource(val5);
			((Component)pellet).GetComponentInChildren<PikminItemSettings>().GrabableToPikmin = false;
			latchTrigger.OnPikminHit.AddListener((UnityAction<PikminAI>)delegate
			{
				if (((NetworkBehaviour)this).IsOwner)
				{
					TakeDamageRpc(HP, 1, HitViaPlayer: false);
				}
			});
			latchTrigger.OnPikminDirectLatch.AddListener((UnityAction<PikminAI>)delegate
			{
				if (((NetworkBehaviour)this).IsOwner)
				{
					OnLatchRpc();
				}
			});
		}

		[Rpc(/*Could not decode attribute arguments.*/)]
		public void SetEnablementRpc(bool enable)
		{
			//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_0043: 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_0051: Unknown result type (might be due to invalid IL or missing references)
			//IL_005f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0064: Unknown result type (might be due to invalid IL or missing references)
			//IL_0074: 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_008e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0092: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c0: Unknown result type (might be due to invalid IL or missing references)
			NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
			if (networkManager != null && networkManager.IsListening)
			{
				if ((int)base.__rpc_exec_stage != 1)
				{
					RpcAttributeParams val = default(RpcAttributeParams);
					RpcParams val2 = default(RpcParams);
					FastBufferWriter val3 = ((NetworkBehaviour)this).__beginSendRpc(1697153304u, val2, val, (SendTo)7, (RpcDelivery)0);
					((FastBufferWriter)(ref val3)).WriteValueSafe<bool>(ref enable, default(ForPrimitives));
					((NetworkBehaviour)this).__endSendRpc(ref val3, 1697153304u, val2, val, (SendTo)7, (RpcDelivery)0);
				}
				if ((int)base.__rpc_exec_stage == 1)
				{
					base.__rpc_exec_stage = (__RpcExecStage)0;
					disabled = !enable;
				}
			}
		}

		public void Start()
		{
			PikminManager.instance.ExtrasSpawnedObjects.Add(((NetworkBehaviour)this).NetworkObject);
			if (((NetworkBehaviour)this).IsOwner)
			{
				GrowTimer = Random.Range(LethalMinExtras.MinPosyGrowTime.InternalValue, LethalMinExtras.MaxPosyGrowTime.InternalValue);
				CycleTimer = LethalMinExtras.PosyCycleInterval.InternalValue;
				List<PikminType> list = LethalMin.RegisteredPikminTypes.Values.Where((PikminType t) => PikChecks.IsPikminValidForPelletSelection(t)).ToList();
				if (list.Count == 0)
				{
					LethalMinExtras.Logger.LogWarning((object)"No valid Pikmin types found for pellet spawning!");
					SetEnablementRpc(enable: false);
				}
			}
		}

		public void Update()
		{
			if (!dead)
			{
				if (disabled)
				{
					CheckToRenable();
					return;
				}
				UpdateGrowth();
				UpdateCycle();
			}
		}

		[Rpc(/*Could not decode attribute arguments.*/)]
		public void OnLatchRpc()
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Invalid comparison between Unknown and I4
			//IL_008c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0096: Invalid comparison between Unknown and I4
			//IL_0043: 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_0051: Unknown result type (might be due to invalid IL or missing references)
			//IL_005f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0064: Unknown result type (might be due to invalid IL or missing references)
			//IL_0073: Unknown result type (might be due to invalid IL or missing references)
			//IL_0077: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a5: Unknown result type (might be due to invalid IL or missing references)
			NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
			if (networkManager != null && networkManager.IsListening)
			{
				if ((int)base.__rpc_exec_stage != 1)
				{
					RpcAttributeParams val = default(RpcAttributeParams);
					RpcParams val2 = default(RpcParams);
					FastBufferWriter val3 = ((NetworkBehaviour)this).__beginSendRpc(2288157493u, val2, val, (SendTo)7, (RpcDelivery)0);
					((NetworkBehaviour)this).__endSendRpc(ref val3, 2288157493u, val2, val, (SendTo)7, (RpcDelivery)0);
				}
				if ((int)base.__rpc_exec_stage == 1)
				{
					base.__rpc_exec_stage = (__RpcExecStage)0;
					animator.SetTrigger("Latch");
				}
			}
		}

		public void CheckToRenable()
		{
			if (((NetworkBehaviour)this).IsOwner && disabled)
			{
				List<PikminType> list = LethalMin.RegisteredPikminTypes.Values.Where((PikminType t) => PikChecks.IsPikminValidForPelletSelection(t)).ToList();
				if (list.Count > 0)
				{
					SetEnablementRpc(enable: true);
					LethalMinExtras.Logger.LogDebug((object)"PelletPosy re-enabled as valid Pikmin types are now available.");
				}
			}
		}

		private void UpdateGrowth()
		{
			if (!((NetworkBehaviour)this).IsOwner || GrowStage >= 2)
			{
				return;
			}
			GrowTimer -= Time.deltaTime;
			if (GrowTimer <= 0f)
			{
				GrowStage++;
				GrowTimer = Random.Range(LethalMinExtras.MinPosyGrowTime.InternalValue, LethalMinExtras.MaxPosyGrowTime.InternalValue);
				SyncGrowStageRpc(GrowStage);
				if (GrowStage == 2)
				{
					LethalMinExtras.Logger.LogInfo((object)"PelletPosy has fully bloomed and spawned its pellet!");
					((MonoBehaviour)this).StartCoroutine(WaitSpawnPellet());
				}
			}
		}

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

		[Rpc(/*Could not decode attribute arguments.*/)]
		public void SyncGrowStageRpc(int growStage)
		{
			//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_0043: 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_0051: Unknown result type (might be due to invalid IL or missing references)
			//IL_005f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0064: Unknown result type (might be due to invalid IL or missing references)
			//IL_0068: Unknown result type (might be due to invalid IL or missing references)
			//IL_0080: Unknown result type (might be due to invalid IL or missing references)
			//IL_0084: 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)
			{
				if ((int)base.__rpc_exec_stage != 1)
				{
					RpcAttributeParams val = default(RpcAttributeParams);
					RpcParams val2 = default(RpcParams);
					FastBufferWriter val3 = ((NetworkBehaviour)this).__beginSendRpc(3652360239u, val2, val, (SendTo)7, (RpcDelivery)0);
					BytePacker.WriteValueBitPacked(val3, growStage);
					((NetworkBehaviour)this).__endSendRpc(ref val3, 3652360239u, val2, val