Decompiled source of LethalChaos v1.0.1

LC_Cutea.dll

Decompiled 3 weeks ago
using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
using BepInEx;
using BepInEx.Logging;
using GameNetcodeStuff;
using HarmonyLib;
using LC_Cutea.NetcodePatcher;
using LethalLib.Modules;
using Unity.Netcode;
using UnityEngine;
using UnityEngine.AI;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: AssemblyTitle("LC_Cutea")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("LC_Cutea")]
[assembly: AssemblyCopyright("Copyright ©  2024")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("b305ba02-86ae-4d0f-bc13-3439417618b3")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: TargetFramework(".NETFramework,Version=v4.7.2", FrameworkDisplayName = ".NET Framework 4.7.2")]
[assembly: AssemblyVersion("1.0.0.0")]
[module: NetcodePatchedAssembly]
internal class <Module>
{
	static <Module>()
	{
	}
}
public class ShadowHat : GrabbableObject
{
	public override void Start()
	{
		((GrabbableObject)this).Start();
		((MonoBehaviour)this).StartCoroutine(SetText());
	}

	public IEnumerator SetText()
	{
		yield return (object)new WaitForSeconds(2f);
		((Component)this).gameObject.GetComponentInChildren<ScanNodeProperties>().subText = "Owned by TheInvertedShadow";
	}

	[HarmonyPatch(typeof(ShadowHat), "SetScrapValue")]
	[HarmonyPostfix]
	public static void SetScrapValuePatch(ShadowHat __instance)
	{
		((Component)__instance).GetComponentInChildren<ScanNodeProperties>().subText = "Owned by TheInvertedShadow";
	}

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

	protected internal override string __getTypeName()
	{
		return "ShadowHat";
	}
}
public class CookieJar : GrabbableObject
{
	private bool fullyEaten = false;

	public int cookies = 5;

	public Transform[] cookieTransforms;

	private int healingPerCookie = 20;

	private float healingSpeed = 20f;

	public static AudioClip eatSFX;

	private Transform cookieContainer;

	public ParticleSystem eatParticles;

	private AudioSource audioSource;

	private Animator animator;

	private const string eatAnimation = "HoldMask";

	private PlayerControllerB previousPlayerHeldBy;

	public override void Start()
	{
		((GrabbableObject)this).Start();
		animator = ((Component)this).GetComponent<Animator>();
		audioSource = ((Component)this).gameObject.GetComponent<AudioSource>();
		eatParticles = ((Component)this).GetComponentInChildren<ParticleSystem>();
		cookieContainer = ((Component)this).transform.Find("JarMesh/Cookies");
		List<Transform> list = new List<Transform>();
		foreach (Transform item in ((Component)cookieContainer).GetComponentsInChildren<Transform>().ToList())
		{
			if (((Object)item).name.Contains("Cookie") && (Object)(object)item != (Object)(object)cookieContainer)
			{
				list.Add(item);
			}
		}
		list.Reverse();
		cookieTransforms = list.ToArray();
		base.useCooldown = 0.3f;
		if (!((NetworkBehaviour)this).IsServer)
		{
			RequestStateServerRpc();
		}
	}

	public override void ItemActivate(bool used, bool buttonDown = true)
	{
		((GrabbableObject)this).ItemActivate(used, buttonDown);
		if (fullyEaten)
		{
			previousPlayerHeldBy.playerBodyAnimator.SetTrigger("shakeItem");
		}
		else if (buttonDown)
		{
			base.isBeingUsed = true;
			previousPlayerHeldBy.activatingItem = true;
			((MonoBehaviour)this).StartCoroutine(StartEating());
		}
	}

	public IEnumerator StartEating()
	{
		if (((NetworkBehaviour)this).IsOwner)
		{
			SendEatingServerRpc();
		}
		previousPlayerHeldBy.playerBodyAnimator.SetBool("HoldMask", true);
		animator.SetTrigger("Eat");
		yield return (object)new WaitForSeconds(0.75f);
		eatParticles.Play();
		audioSource.PlayOneShot(eatSFX);
		yield return (object)new WaitForSeconds(1.2f);
		eatParticles.Stop();
		cookies--;
		SendCookieAmount();
		((MonoBehaviour)this).StartCoroutine(healOverTime(previousPlayerHeldBy));
		((Component)cookieTransforms[cookies]).gameObject.SetActive(false);
		previousPlayerHeldBy.playerBodyAnimator.SetBool("HoldMask", false);
		if (cookies <= 0)
		{
			FinishedEating();
		}
		else
		{
			Stop();
		}
	}

	public IEnumerator SendServerEating()
	{
		animator.SetTrigger("Eat");
		yield return (object)new WaitForSeconds(0.25f);
		eatParticles.Play();
		yield return (object)new WaitForSeconds(0.5f);
		eatParticles.Stop();
	}

	public override void GrabItem()
	{
		((GrabbableObject)this).GrabItem();
		previousPlayerHeldBy = base.playerHeldBy;
	}

	public override void DiscardItem()
	{
		((GrabbableObject)this).DiscardItem();
		SendCookieAmount();
		Stop();
	}

	public void SendCookieAmount()
	{
		if (((NetworkBehaviour)this).IsOwner)
		{
			SendCookieServerRpc(cookies);
		}
	}

	public void FinishedEating()
	{
		fullyEaten = true;
		Stop();
	}

	public IEnumerator healOverTime(PlayerControllerB player)
	{
		for (int i = 0; i < healingPerCookie; i++)
		{
			yield return (object)new WaitForSeconds(1f / healingSpeed);
			player.health = (int)Mathf.MoveTowards((float)player.health, 100f, 1f);
			HUDManager.Instance.UpdateHealthUI(player.health, false);
		}
		player.criticallyInjured = false;
		HUDManager.Instance.UpdateHealthUI(player.health, false);
	}

	public void Stop()
	{
		if ((Object)(object)previousPlayerHeldBy != (Object)null)
		{
			base.isBeingUsed = false;
			previousPlayerHeldBy.activatingItem = false;
			previousPlayerHeldBy.playerBodyAnimator.SetBool("HoldMask", false);
		}
	}

	[ServerRpc(RequireOwnership = false)]
	public void SendCookieServerRpc(int cookies)
	{
		//IL_0024: Unknown result type (might be due to invalid IL or missing references)
		//IL_002e: Invalid comparison between Unknown and I4
		//IL_0099: Unknown result type (might be due to invalid IL or missing references)
		//IL_00a3: Invalid comparison between Unknown and I4
		//IL_005f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0068: Unknown result type (might be due to invalid IL or missing references)
		//IL_006d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0071: Unknown result type (might be due to invalid IL or missing references)
		//IL_0089: Unknown result type (might be due to invalid IL or missing references)
		NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
		if (networkManager != null && networkManager.IsListening)
		{
			if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1 && (networkManager.IsClient || networkManager.IsHost))
			{
				ServerRpcParams val = default(ServerRpcParams);
				FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendServerRpc(1698813393u, val, (RpcDelivery)0);
				BytePacker.WriteValueBitPacked(val2, cookies);
				((NetworkBehaviour)this).__endSendServerRpc(ref val2, 1698813393u, val, (RpcDelivery)0);
			}
			if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost))
			{
				SendCookieClientRpc(cookies);
			}
		}
	}

	[ClientRpc]
	public void SendCookieClientRpc(int amount)
	{
		//IL_0024: Unknown result type (might be due to invalid IL or missing references)
		//IL_002e: Invalid comparison between Unknown and I4
		//IL_0099: Unknown result type (might be due to invalid IL or missing references)
		//IL_00a3: Invalid comparison between Unknown and I4
		//IL_005f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0068: Unknown result type (might be due to invalid IL or missing references)
		//IL_006d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0071: Unknown result type (might be due to invalid IL or missing references)
		//IL_0089: Unknown result type (might be due to invalid IL or missing references)
		NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
		if (networkManager == null || !networkManager.IsListening)
		{
			return;
		}
		if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 2 && (networkManager.IsServer || networkManager.IsHost))
		{
			ClientRpcParams val = default(ClientRpcParams);
			FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(222697835u, val, (RpcDelivery)0);
			BytePacker.WriteValueBitPacked(val2, amount);
			((NetworkBehaviour)this).__endSendClientRpc(ref val2, 222697835u, val, (RpcDelivery)0);
		}
		if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 2 && (networkManager.IsClient || networkManager.IsHost))
		{
			cookies = amount;
			for (int i = 0; i < cookieTransforms.Length; i++)
			{
				((Component)cookieTransforms[i]).gameObject.SetActive(cookies > i);
			}
			if (cookies <= 0)
			{
				fullyEaten = true;
			}
		}
	}

	[ServerRpc(RequireOwnership = false)]
	public void RequestStateServerRpc()
	{
		//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)
		NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
		if (networkManager != null && networkManager.IsListening)
		{
			if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1 && (networkManager.IsClient || networkManager.IsHost))
			{
				ServerRpcParams val = default(ServerRpcParams);
				FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendServerRpc(4282543262u, val, (RpcDelivery)0);
				((NetworkBehaviour)this).__endSendServerRpc(ref val2, 4282543262u, val, (RpcDelivery)0);
			}
			if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost))
			{
				RequestStateClientRpc();
			}
		}
	}

	[ClientRpc]
	public void RequestStateClientRpc()
	{
		//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)
		NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
		if (networkManager != null && networkManager.IsListening)
		{
			if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 2 && (networkManager.IsServer || networkManager.IsHost))
			{
				ClientRpcParams val = default(ClientRpcParams);
				FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(3414504546u, val, (RpcDelivery)0);
				((NetworkBehaviour)this).__endSendClientRpc(ref val2, 3414504546u, val, (RpcDelivery)0);
			}
			if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 2 && (networkManager.IsClient || networkManager.IsHost) && ((NetworkBehaviour)this).IsServer)
			{
				SendCookieServerRpc(cookies);
			}
		}
	}

	[ServerRpc(RequireOwnership = true)]
	public void SendEatingServerRpc()
	{
		//IL_0024: Unknown result type (might be due to invalid IL or missing references)
		//IL_002e: Invalid comparison between Unknown and I4
		//IL_00d2: Unknown result type (might be due to invalid IL or missing references)
		//IL_00dc: Invalid comparison between Unknown and I4
		//IL_00a5: 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_00b3: Unknown result type (might be due to invalid IL or missing references)
		//IL_00c2: 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_0084: Invalid comparison between Unknown and I4
		NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
		if (networkManager == null || !networkManager.IsListening)
		{
			return;
		}
		if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1 && (networkManager.IsClient || networkManager.IsHost))
		{
			if (((NetworkBehaviour)this).OwnerClientId != networkManager.LocalClientId)
			{
				if ((int)networkManager.LogLevel <= 1)
				{
					Debug.LogError((object)"Only the owner can invoke a ServerRpc that requires ownership!");
				}
				return;
			}
			ServerRpcParams val = default(ServerRpcParams);
			FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendServerRpc(2300776769u, val, (RpcDelivery)0);
			((NetworkBehaviour)this).__endSendServerRpc(ref val2, 2300776769u, val, (RpcDelivery)0);
		}
		if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost))
		{
			SendEatingClientRpc();
		}
	}

	[ClientRpc]
	public void SendEatingClientRpc()
	{
		//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)
		NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
		if (networkManager != null && networkManager.IsListening)
		{
			if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 2 && (networkManager.IsServer || networkManager.IsHost))
			{
				ClientRpcParams val = default(ClientRpcParams);
				FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(1122607531u, val, (RpcDelivery)0);
				((NetworkBehaviour)this).__endSendClientRpc(ref val2, 1122607531u, val, (RpcDelivery)0);
			}
			if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 2 && (networkManager.IsClient || networkManager.IsHost) && !((NetworkBehaviour)this).IsOwner)
			{
				((MonoBehaviour)this).StartCoroutine(SendServerEating());
			}
		}
	}

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

	[RuntimeInitializeOnLoadMethod]
	internal static void InitializeRPCS_CookieJar()
	{
		//IL_0011: Unknown result type (might be due to invalid IL or missing references)
		//IL_001b: Expected O, but got Unknown
		//IL_002c: Unknown result type (might be due to invalid IL or missing references)
		//IL_0036: Expected O, but got Unknown
		//IL_0047: Unknown result type (might be due to invalid IL or missing references)
		//IL_0051: Expected O, but got Unknown
		//IL_0062: Unknown result type (might be due to invalid IL or missing references)
		//IL_006c: Expected O, but got Unknown
		//IL_007d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0087: Expected O, but got Unknown
		//IL_0098: Unknown result type (might be due to invalid IL or missing references)
		//IL_00a2: Expected O, but got Unknown
		NetworkManager.__rpc_func_table.Add(1698813393u, new RpcReceiveHandler(__rpc_handler_1698813393));
		NetworkManager.__rpc_func_table.Add(222697835u, new RpcReceiveHandler(__rpc_handler_222697835));
		NetworkManager.__rpc_func_table.Add(4282543262u, new RpcReceiveHandler(__rpc_handler_4282543262));
		NetworkManager.__rpc_func_table.Add(3414504546u, new RpcReceiveHandler(__rpc_handler_3414504546));
		NetworkManager.__rpc_func_table.Add(2300776769u, new RpcReceiveHandler(__rpc_handler_2300776769));
		NetworkManager.__rpc_func_table.Add(1122607531u, new RpcReceiveHandler(__rpc_handler_1122607531));
	}

	private static void __rpc_handler_1698813393(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 num = default(int);
			ByteUnpacker.ReadValueBitPacked(reader, ref num);
			target.__rpc_exec_stage = (__RpcExecStage)1;
			((CookieJar)(object)target).SendCookieServerRpc(num);
			target.__rpc_exec_stage = (__RpcExecStage)0;
		}
	}

	private static void __rpc_handler_222697835(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 amount = default(int);
			ByteUnpacker.ReadValueBitPacked(reader, ref amount);
			target.__rpc_exec_stage = (__RpcExecStage)2;
			((CookieJar)(object)target).SendCookieClientRpc(amount);
			target.__rpc_exec_stage = (__RpcExecStage)0;
		}
	}

	private static void __rpc_handler_4282543262(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;
			((CookieJar)(object)target).RequestStateServerRpc();
			target.__rpc_exec_stage = (__RpcExecStage)0;
		}
	}

	private static void __rpc_handler_3414504546(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)2;
			((CookieJar)(object)target).RequestStateClientRpc();
			target.__rpc_exec_stage = (__RpcExecStage)0;
		}
	}

	private static void __rpc_handler_2300776769(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams)
	{
		//IL_0023: Unknown result type (might be due to invalid IL or missing references)
		//IL_0024: Unknown result type (might be due to invalid IL or missing references)
		//IL_0029: Unknown result type (might be due to invalid IL or missing references)
		//IL_0076: Unknown result type (might be due to invalid IL or missing references)
		//IL_008c: Unknown result type (might be due to invalid IL or missing references)
		//IL_004b: Unknown result type (might be due to invalid IL or missing references)
		//IL_0055: Invalid comparison between Unknown and I4
		NetworkManager networkManager = target.NetworkManager;
		if (networkManager == null || !networkManager.IsListening)
		{
			return;
		}
		if (rpcParams.Server.Receive.SenderClientId != target.OwnerClientId)
		{
			if ((int)networkManager.LogLevel <= 1)
			{
				Debug.LogError((object)"Only the owner can invoke a ServerRpc that requires ownership!");
			}
		}
		else
		{
			target.__rpc_exec_stage = (__RpcExecStage)1;
			((CookieJar)(object)target).SendEatingServerRpc();
			target.__rpc_exec_stage = (__RpcExecStage)0;
		}
	}

	private static void __rpc_handler_1122607531(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)2;
			((CookieJar)(object)target).SendEatingClientRpc();
			target.__rpc_exec_stage = (__RpcExecStage)0;
		}
	}

	protected internal override string __getTypeName()
	{
		return "CookieJar";
	}
}
public class Mango : GrabbableObject
{
	public float eat = 0f;

	private float eatSpeed = 1f;

	private int healingPerBite = 200;

	private float healingSpeed = 20f;

	private int fullyEatenValue = 8;

	private bool fullyEaten = false;

	private bool eating = false;

	private Coroutine startEating;

	public static AudioClip finishedSFX;

	public static AudioClip eatSFX;

	private AudioSource audioSource;

	private PlayerControllerB previousPlayerHeldBy;

	private Material shader;

	private MeshFilter mesh;

	public override void Start()
	{
		((GrabbableObject)this).Start();
		shader = ((Renderer)((Component)this).gameObject.GetComponent<MeshRenderer>()).material;
		mesh = ((Component)this).GetComponent<MeshFilter>();
		audioSource = ((Component)this).gameObject.GetComponent<AudioSource>();
		if (!((NetworkBehaviour)this).IsServer)
		{
			RequestStateServerRpc();
		}
	}

	public override void Update()
	{
		((GrabbableObject)this).Update();
		if (eating)
		{
			if ((Object)(object)previousPlayerHeldBy == (Object)null || !base.isHeld || eat >= 1f)
			{
				eating = false;
			}
			float oldValue = eat;
			eat = Mathf.MoveTowards(eat, 1f, Time.deltaTime / eatSpeed);
			UpdateShader(oldValue);
		}
	}

	public override void ItemActivate(bool used, bool buttonDown = true)
	{
		((GrabbableObject)this).ItemActivate(used, buttonDown);
		if (!fullyEaten)
		{
			if (buttonDown)
			{
				base.isBeingUsed = true;
				previousPlayerHeldBy.activatingItem = true;
				previousPlayerHeldBy.playerBodyAnimator.SetBool("useTZPItem", true);
				startEating = ((MonoBehaviour)this).StartCoroutine(StartEating());
			}
			else
			{
				base.isBeingUsed = false;
				Stop();
			}
		}
	}

	public IEnumerator StartEating()
	{
		yield return (object)new WaitForSeconds(0.5f);
		eating = true;
		audioSource.PlayOneShot(eatSFX);
	}

	public override void GrabItem()
	{
		((GrabbableObject)this).GrabItem();
		previousPlayerHeldBy = base.playerHeldBy;
	}

	public override void DiscardItem()
	{
		((GrabbableObject)this).DiscardItem();
		SendEat();
		Stop();
	}

	public void SendEat()
	{
		if (((NetworkBehaviour)this).IsOwner)
		{
			SendEatServerRpc(fullyEaten);
		}
	}

	public void UpdateShader(float oldValue)
	{
		if (!fullyEaten)
		{
			shader.SetFloat("_Eat", eat);
			if (((NetworkBehaviour)this).IsOwner && Mathf.Floor(eat) != Mathf.Floor(oldValue))
			{
				Stop();
				((MonoBehaviour)this).StartCoroutine(healOverTime(previousPlayerHeldBy));
				FinishedEating();
				SendEat();
			}
		}
	}

	public void FinishedEating()
	{
		fullyEaten = true;
		audioSource.PlayOneShot(finishedSFX);
		mesh.mesh = null;
		((GrabbableObject)this).SetScrapValue(fullyEatenValue);
		Stop();
	}

	public IEnumerator healOverTime(PlayerControllerB player)
	{
		player.criticallyInjured = false;
		for (int i = 0; i < healingPerBite; i++)
		{
			yield return (object)new WaitForSeconds(1f / healingSpeed);
			player.health = (int)Mathf.MoveTowards((float)player.health, 100f, 1f);
			HUDManager.Instance.UpdateHealthUI(player.health, false);
		}
		player.criticallyInjured = false;
		HUDManager.Instance.UpdateHealthUI(player.health, false);
	}

	public void Stop()
	{
		if (startEating != null)
		{
			((MonoBehaviour)this).StopCoroutine(startEating);
		}
		eating = false;
		if ((Object)(object)previousPlayerHeldBy != (Object)null)
		{
			previousPlayerHeldBy.activatingItem = false;
			previousPlayerHeldBy.playerBodyAnimator.SetBool("useTZPItem", false);
		}
	}

	[ServerRpc(RequireOwnership = false)]
	public void SendEatServerRpc(bool finished)
	{
		//IL_0024: Unknown result type (might be due to invalid IL or missing references)
		//IL_002e: Invalid comparison between Unknown and I4
		//IL_00a7: Unknown result type (might be due to invalid IL or missing references)
		//IL_00b1: Invalid comparison between Unknown and I4
		//IL_005f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0068: Unknown result type (might be due to invalid IL or missing references)
		//IL_006d: Unknown result type (might be due to invalid IL or missing references)
		//IL_007d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0083: Unknown result type (might be due to invalid IL or missing references)
		//IL_0097: Unknown result type (might be due to invalid IL or missing references)
		NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
		if (networkManager != null && networkManager.IsListening)
		{
			if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1 && (networkManager.IsClient || networkManager.IsHost))
			{
				ServerRpcParams val = default(ServerRpcParams);
				FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendServerRpc(4095707459u, val, (RpcDelivery)0);
				((FastBufferWriter)(ref val2)).WriteValueSafe<bool>(ref finished, default(ForPrimitives));
				((NetworkBehaviour)this).__endSendServerRpc(ref val2, 4095707459u, val, (RpcDelivery)0);
			}
			if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost))
			{
				SetEatClientRpc(finished);
			}
		}
	}

	[ClientRpc]
	public void SetEatClientRpc(bool finished)
	{
		//IL_0024: Unknown result type (might be due to invalid IL or missing references)
		//IL_002e: Invalid comparison between Unknown and I4
		//IL_00a7: Unknown result type (might be due to invalid IL or missing references)
		//IL_00b1: Invalid comparison between Unknown and I4
		//IL_005f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0068: Unknown result type (might be due to invalid IL or missing references)
		//IL_006d: Unknown result type (might be due to invalid IL or missing references)
		//IL_007d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0083: Unknown result type (might be due to invalid IL or missing references)
		//IL_0097: Unknown result type (might be due to invalid IL or missing references)
		NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
		if (networkManager != null && networkManager.IsListening)
		{
			if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 2 && (networkManager.IsServer || networkManager.IsHost))
			{
				ClientRpcParams val = default(ClientRpcParams);
				FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(2553325489u, val, (RpcDelivery)0);
				((FastBufferWriter)(ref val2)).WriteValueSafe<bool>(ref finished, default(ForPrimitives));
				((NetworkBehaviour)this).__endSendClientRpc(ref val2, 2553325489u, val, (RpcDelivery)0);
			}
			if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 2 && (networkManager.IsClient || networkManager.IsHost) && finished)
			{
				FinishedEating();
			}
		}
	}

	[ServerRpc(RequireOwnership = false)]
	public void RequestStateServerRpc()
	{
		//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)
		NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
		if (networkManager != null && networkManager.IsListening)
		{
			if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1 && (networkManager.IsClient || networkManager.IsHost))
			{
				ServerRpcParams val = default(ServerRpcParams);
				FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendServerRpc(17809223u, val, (RpcDelivery)0);
				((NetworkBehaviour)this).__endSendServerRpc(ref val2, 17809223u, val, (RpcDelivery)0);
			}
			if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost))
			{
				RequestStateClientRpc();
			}
		}
	}

	[ClientRpc]
	public void RequestStateClientRpc()
	{
		//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)
		NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
		if (networkManager != null && networkManager.IsListening)
		{
			if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 2 && (networkManager.IsServer || networkManager.IsHost))
			{
				ClientRpcParams val = default(ClientRpcParams);
				FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(1997154150u, val, (RpcDelivery)0);
				((NetworkBehaviour)this).__endSendClientRpc(ref val2, 1997154150u, val, (RpcDelivery)0);
			}
			if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 2 && (networkManager.IsClient || networkManager.IsHost) && ((NetworkBehaviour)this).IsServer)
			{
				SendEatServerRpc(fullyEaten);
			}
		}
	}

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

	[RuntimeInitializeOnLoadMethod]
	internal static void InitializeRPCS_Mango()
	{
		//IL_0011: Unknown result type (might be due to invalid IL or missing references)
		//IL_001b: Expected O, but got Unknown
		//IL_002c: Unknown result type (might be due to invalid IL or missing references)
		//IL_0036: Expected O, but got Unknown
		//IL_0047: Unknown result type (might be due to invalid IL or missing references)
		//IL_0051: Expected O, but got Unknown
		//IL_0062: Unknown result type (might be due to invalid IL or missing references)
		//IL_006c: Expected O, but got Unknown
		NetworkManager.__rpc_func_table.Add(4095707459u, new RpcReceiveHandler(__rpc_handler_4095707459));
		NetworkManager.__rpc_func_table.Add(2553325489u, new RpcReceiveHandler(__rpc_handler_2553325489));
		NetworkManager.__rpc_func_table.Add(17809223u, new RpcReceiveHandler(__rpc_handler_17809223));
		NetworkManager.__rpc_func_table.Add(1997154150u, new RpcReceiveHandler(__rpc_handler_1997154150));
	}

	private static void __rpc_handler_4095707459(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_005e: Unknown result type (might be due to invalid IL or missing references)
		NetworkManager networkManager = target.NetworkManager;
		if (networkManager != null && networkManager.IsListening)
		{
			bool finished = default(bool);
			((FastBufferReader)(ref reader)).ReadValueSafe<bool>(ref finished, default(ForPrimitives));
			target.__rpc_exec_stage = (__RpcExecStage)1;
			((Mango)(object)target).SendEatServerRpc(finished);
			target.__rpc_exec_stage = (__RpcExecStage)0;
		}
	}

	private static void __rpc_handler_2553325489(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_005e: Unknown result type (might be due to invalid IL or missing references)
		NetworkManager networkManager = target.NetworkManager;
		if (networkManager != null && networkManager.IsListening)
		{
			bool eatClientRpc = default(bool);
			((FastBufferReader)(ref reader)).ReadValueSafe<bool>(ref eatClientRpc, default(ForPrimitives));
			target.__rpc_exec_stage = (__RpcExecStage)2;
			((Mango)(object)target).SetEatClientRpc(eatClientRpc);
			target.__rpc_exec_stage = (__RpcExecStage)0;
		}
	}

	private static void __rpc_handler_17809223(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;
			((Mango)(object)target).RequestStateServerRpc();
			target.__rpc_exec_stage = (__RpcExecStage)0;
		}
	}

	private static void __rpc_handler_1997154150(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)2;
			((Mango)(object)target).RequestStateClientRpc();
			target.__rpc_exec_stage = (__RpcExecStage)0;
		}
	}

	protected internal override string __getTypeName()
	{
		return "Mango";
	}
}
public class PonyBase : GrabbableObject
{
	public enum AnimationState
	{
		Idle,
		Walking,
		Sitting,
		Held
	}

	private AudioSource audio;

	public static AudioClip squeak;

	public float walkDistance = 10f;

	public float updatePath = 0f;

	public bool finishedLoading = false;

	public bool canMove = true;

	public NavMeshAgent agent;

	public NavMeshPath navmeshPath;

	public Vector3 destination;

	public float speed = 5f;

	public float moveTime;

	public Vector2 moveInterval = new Vector2(1f, 6f);

	public Vector2 waitInbetweenMoveCycles = new Vector2(0.5f, 1f);

	public int heldType = 1;

	private bool walking = false;

	private Animator ani;

	public static Collider shipCollider;

	public override void Start()
	{
		((GrabbableObject)this).Start();
		base.useCooldown = 0.2f;
		ani = ((Component)this).GetComponent<Animator>();
		ani.SetInteger("HeldType", heldType);
		audio = ((Component)this).GetComponent<AudioSource>();
		((MonoBehaviour)this).StartCoroutine(CheckAgent());
	}

	public override void ItemActivate(bool used, bool buttonDown = true)
	{
		((GrabbableObject)this).ItemActivate(used, buttonDown);
		ani.SetTrigger("Squish");
		audio.Stop();
		audio.PlayOneShot(squeak);
	}

	public override void Update()
	{
		//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_00ad: Unknown result type (might be due to invalid IL or missing references)
		baseUpdateFunction();
		if (!finishedLoading)
		{
			return;
		}
		Animator obj = ani;
		Vector3 velocity = agent.velocity;
		obj.SetBool("Walking", ((Vector3)(ref velocity)).magnitude > 0.01f && walking && canMove && !base.isHeld && agent.isOnNavMesh);
		if (!canMove || base.isHeld || !agent.isOnNavMesh)
		{
			return;
		}
		if (updatePath <= 0f)
		{
			agent.SetDestination(destination);
			updatePath = 0.2f + Random.Range(0f, 0.1f);
		}
		else
		{
			updatePath -= Time.deltaTime;
		}
		if (isHostOrServer())
		{
			if (moveTime <= 0f)
			{
				((MonoBehaviour)this).StartCoroutine(NextMove());
			}
			moveTime -= Time.deltaTime;
		}
	}

	public void baseUpdateFunction()
	{
		//IL_0170: Unknown result type (might be due to invalid IL or missing references)
		//IL_0262: Unknown result type (might be due to invalid IL or missing references)
		//IL_01fa: Unknown result type (might be due to invalid IL or missing references)
		//IL_0214: Unknown result type (might be due to invalid IL or missing references)
		if (base.currentUseCooldown >= 0f)
		{
			base.currentUseCooldown -= Time.deltaTime;
		}
		if (((NetworkBehaviour)this).IsOwner)
		{
			if (base.isBeingUsed && base.itemProperties.requiresBattery)
			{
				if (base.insertedBattery.charge > 0f)
				{
					if (!base.itemProperties.itemIsTrigger)
					{
						Battery insertedBattery = base.insertedBattery;
						insertedBattery.charge -= Time.deltaTime / base.itemProperties.batteryUsage;
					}
				}
				else if (!base.insertedBattery.empty)
				{
					base.insertedBattery.empty = true;
					if (base.isBeingUsed)
					{
						Debug.Log((object)"Use up batteries local");
						base.isBeingUsed = false;
						((GrabbableObject)this).UseUpBatteries();
					}
				}
			}
			if (!base.wasOwnerLastFrame)
			{
				base.wasOwnerLastFrame = true;
			}
		}
		else if (base.wasOwnerLastFrame)
		{
			base.wasOwnerLastFrame = false;
		}
		if (base.isHeld || !((Object)(object)base.parentObject == (Object)null))
		{
			return;
		}
		if (base.fallTime < 1f)
		{
			base.reachedFloorTarget = false;
			((GrabbableObject)this).FallWithCurve();
			if (((Component)this).transform.localPosition.y - base.targetFloorPosition.y < 0.1f && !base.hasHitGround)
			{
				((GrabbableObject)this).PlayDropSFX();
				((GrabbableObject)this).OnHitGround();
			}
		}
		else if (!base.reachedFloorTarget)
		{
			base.reachedFloorTarget = true;
			if (base.floorYRot == -1)
			{
				((Component)this).transform.rotation = Quaternion.Euler(base.itemProperties.restingRotation.x, ((Component)this).transform.eulerAngles.y, base.itemProperties.restingRotation.z);
			}
			else
			{
				((Component)this).transform.rotation = Quaternion.Euler(base.itemProperties.restingRotation.x, (float)(base.floorYRot + base.itemProperties.floorYOffset) + 90f, base.itemProperties.restingRotation.z);
			}
		}
	}

	public override void DiscardItem()
	{
		//IL_000f: Unknown result type (might be due to invalid IL or missing references)
		((GrabbableObject)this).DiscardItem();
		bool flag = !isInShip(((Component)this).transform.position);
		AbleAgent(move: false);
		if (flag)
		{
			((MonoBehaviour)this).StartCoroutine(NextMove());
		}
		else
		{
			UpdateState(AnimationState.Sitting, ignoreServer: true);
		}
	}

	public override void GrabItem()
	{
		((GrabbableObject)this).GrabItem();
		((MonoBehaviour)this).StopAllCoroutines();
		UpdateState(AnimationState.Held, ignoreServer: true);
		AbleAgent(move: false);
	}

	public void UpdateState(AnimationState newState, bool ignoreServer = false)
	{
		if (isHostOrServer())
		{
			SendAnimationServerRpc(newState);
		}
		ani.SetBool("Sitting", false);
		ani.SetBool("Walking", false);
		ani.SetBool("Held", false);
		walking = false;
		switch (newState)
		{
		case AnimationState.Walking:
			walking = true;
			break;
		case AnimationState.Sitting:
			ani.SetBool("Sitting", true);
			break;
		case AnimationState.Held:
			ani.SetBool("Held", true);
			break;
		case AnimationState.Idle:
			ani.SetTrigger("Idle");
			break;
		}
	}

	public void AbleAgent(bool move)
	{
		if (isHostOrServer())
		{
			SendAgentMoveServerRpc(move);
		}
		agent.updatePosition = move;
		agent.updateRotation = move;
		canMove = move;
	}

	public IEnumerator CheckAgent()
	{
		yield return (object)new WaitForSeconds(0.2f);
		agent = ((Component)this).gameObject.AddComponent<NavMeshAgent>();
		agent.areaMask = -1;
		((Behaviour)agent).enabled = false;
		AbleAgent(move: false);
		agent.speed = 3.5f;
		agent.angularSpeed = 720f;
		agent.acceleration = 8f;
		agent.stoppingDistance = 0.5f;
		agent.autoBraking = true;
		agent.autoRepath = true;
		agent.height = 1f;
		agent.baseOffset = 1.5f;
		yield return (object)new WaitForSeconds(0.5f);
		bool isinship = isInShip(((Component)this).transform.position);
		((Behaviour)agent).enabled = true;
		if (isinship)
		{
			AbleAgent(move: false);
			UpdateState(AnimationState.Sitting);
		}
		else
		{
			AbleAgent(move: true);
			if (isHostOrServer())
			{
				((MonoBehaviour)this).StartCoroutine(NextMove());
			}
		}
		finishedLoading = true;
	}

	public IEnumerator NextMove()
	{
		AbleAgent(move: false);
		UpdateState(AnimationState.Idle);
		yield return (object)new WaitForSeconds(Random.Range(waitInbetweenMoveCycles.x, waitInbetweenMoveCycles.y));
		Vector3 pos = RoundManager.Instance.GetNavMeshPosition(((Component)this).transform.position, RoundManager.Instance.navHit, -1f, -1);
		SetRandomDestination();
		SendDestinationServerRpc(pos, destination);
	}

	public bool FindPath(Vector3 position)
	{
		//IL_0007: Unknown result type (might be due to invalid IL or missing references)
		//IL_000d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0018: Unknown result type (might be due to invalid IL or missing references)
		//IL_001d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0029: Unknown result type (might be due to invalid IL or missing references)
		destination = RoundManager.Instance.GetNavMeshPosition(position, RoundManager.Instance.navHit, 5f, -1);
		agent.SetDestination(destination);
		return true;
	}

	public bool isInShip(Vector3 point)
	{
		//IL_0024: Unknown result type (might be due to invalid IL or missing references)
		//IL_0029: Unknown result type (might be due to invalid IL or missing references)
		//IL_002c: Unknown result type (might be due to invalid IL or missing references)
		if ((Object)(object)shipCollider == (Object)null)
		{
			shipCollider = StartOfRound.Instance.shipBounds;
		}
		Bounds bounds = shipCollider.bounds;
		return ((Bounds)(ref bounds)).Contains(point);
	}

	public void SetRandomDestination()
	{
		//IL_000c: Unknown result type (might be due to invalid IL or missing references)
		//IL_0011: Unknown result type (might be due to invalid IL or missing references)
		//IL_0016: Unknown result type (might be due to invalid IL or missing references)
		//IL_0021: Unknown result type (might be due to invalid IL or missing references)
		//IL_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_002d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0049: Unknown result type (might be due to invalid IL or missing references)
		for (int num = 5; num > 0; num--)
		{
			Vector3 position = ((Component)this).transform.position + Vector2.op_Implicit(Random.insideUnitCircle) * walkDistance;
			if (FindPath(position))
			{
				break;
			}
		}
		if (isInShip(destination))
		{
			GetIntoShipServerRpc(agent.remainingDistance / agent.speed + 1f);
		}
	}

	public IEnumerator GetIntoShip(float wait)
	{
		canMove = false;
		yield return (object)new WaitForSeconds(wait);
		UpdateState(AnimationState.Sitting);
		AbleAgent(move: false);
		((Component)this).transform.SetParent(StartOfRound.Instance.elevatorTransform, true);
	}

	public bool isHostOrServer()
	{
		return ((NetworkBehaviour)this).IsOwner;
	}

	[ServerRpc]
	public void SendDestinationServerRpc(Vector3 position, Vector3 destination)
	{
		//IL_0024: Unknown result type (might be due to invalid IL or missing references)
		//IL_002e: Invalid comparison between Unknown and I4
		//IL_00ec: Unknown result type (might be due to invalid IL or missing references)
		//IL_00f6: Invalid comparison between Unknown and I4
		//IL_011d: 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_00a5: 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_00b3: 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_007a: Unknown result type (might be due to invalid IL or missing references)
		//IL_0084: Invalid comparison between Unknown and I4
		NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
		if (networkManager == null || !networkManager.IsListening)
		{
			return;
		}
		if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1 && (networkManager.IsClient || networkManager.IsHost))
		{
			if (((NetworkBehaviour)this).OwnerClientId != networkManager.LocalClientId)
			{
				if ((int)networkManager.LogLevel <= 1)
				{
					Debug.LogError((object)"Only the owner can invoke a ServerRpc that requires ownership!");
				}
				return;
			}
			ServerRpcParams val = default(ServerRpcParams);
			FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendServerRpc(4061055872u, val, (RpcDelivery)0);
			((FastBufferWriter)(ref val2)).WriteValueSafe(ref position);
			((FastBufferWriter)(ref val2)).WriteValueSafe(ref destination);
			((NetworkBehaviour)this).__endSendServerRpc(ref val2, 4061055872u, val, (RpcDelivery)0);
		}
		if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost))
		{
			SetDestinationClientRpc(position, destination);
		}
	}

	[ClientRpc]
	public void SetDestinationClientRpc(Vector3 position, Vector3 dest)
	{
		//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_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_0096: 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_00f7: 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_0108: Unknown result type (might be due to invalid IL or missing references)
		NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
		if (networkManager != null && networkManager.IsListening)
		{
			if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 2 && (networkManager.IsServer || networkManager.IsHost))
			{
				ClientRpcParams val = default(ClientRpcParams);
				FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(1275489729u, val, (RpcDelivery)0);
				((FastBufferWriter)(ref val2)).WriteValueSafe(ref position);
				((FastBufferWriter)(ref val2)).WriteValueSafe(ref dest);
				((NetworkBehaviour)this).__endSendClientRpc(ref val2, 1275489729u, val, (RpcDelivery)0);
			}
			if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 2 && (networkManager.IsClient || networkManager.IsHost) && finishedLoading)
			{
				destination = dest;
				agent.Warp(RoundManager.Instance.GetNavMeshPosition(position, RoundManager.Instance.navHit, 3f, -1));
				AbleAgent(move: true);
				UpdateState(AnimationState.Walking, ignoreServer: true);
				((Behaviour)agent).enabled = true;
				moveTime = Random.Range(moveInterval.x, moveInterval.y);
			}
		}
	}

	[ServerRpc]
	public void GetIntoShipServerRpc(float time)
	{
		//IL_0024: Unknown result type (might be due to invalid IL or missing references)
		//IL_002e: Invalid comparison between Unknown and I4
		//IL_00ed: Unknown result type (might be due to invalid IL or missing references)
		//IL_00f7: Invalid comparison between Unknown and I4
		//IL_00a5: 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_00b3: Unknown result type (might be due to invalid IL or missing references)
		//IL_00c3: Unknown result type (might be due to invalid IL or missing references)
		//IL_00c9: Unknown result type (might be due to invalid IL or missing references)
		//IL_00dd: 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_0084: Invalid comparison between Unknown and I4
		NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
		if (networkManager == null || !networkManager.IsListening)
		{
			return;
		}
		if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1 && (networkManager.IsClient || networkManager.IsHost))
		{
			if (((NetworkBehaviour)this).OwnerClientId != networkManager.LocalClientId)
			{
				if ((int)networkManager.LogLevel <= 1)
				{
					Debug.LogError((object)"Only the owner can invoke a ServerRpc that requires ownership!");
				}
				return;
			}
			ServerRpcParams val = default(ServerRpcParams);
			FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendServerRpc(435443565u, val, (RpcDelivery)0);
			((FastBufferWriter)(ref val2)).WriteValueSafe<float>(ref time, default(ForPrimitives));
			((NetworkBehaviour)this).__endSendServerRpc(ref val2, 435443565u, val, (RpcDelivery)0);
		}
		if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost))
		{
			GetIntoShipClientRpc(time);
		}
	}

	[ClientRpc]
	public void GetIntoShipClientRpc(float time)
	{
		//IL_0024: Unknown result type (might be due to invalid IL or missing references)
		//IL_002e: Invalid comparison between Unknown and I4
		//IL_00a7: Unknown result type (might be due to invalid IL or missing references)
		//IL_00b1: Invalid comparison between Unknown and I4
		//IL_005f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0068: Unknown result type (might be due to invalid IL or missing references)
		//IL_006d: Unknown result type (might be due to invalid IL or missing references)
		//IL_007d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0083: Unknown result type (might be due to invalid IL or missing references)
		//IL_0097: Unknown result type (might be due to invalid IL or missing references)
		NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
		if (networkManager != null && networkManager.IsListening)
		{
			if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 2 && (networkManager.IsServer || networkManager.IsHost))
			{
				ClientRpcParams val = default(ClientRpcParams);
				FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(795301819u, val, (RpcDelivery)0);
				((FastBufferWriter)(ref val2)).WriteValueSafe<float>(ref time, default(ForPrimitives));
				((NetworkBehaviour)this).__endSendClientRpc(ref val2, 795301819u, val, (RpcDelivery)0);
			}
			if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 2 && (networkManager.IsClient || networkManager.IsHost))
			{
				((MonoBehaviour)this).StartCoroutine(GetIntoShip(time));
			}
		}
	}

	[ServerRpc]
	public void SendAnimationServerRpc(AnimationState animationState)
	{
		//IL_0024: Unknown result type (might be due to invalid IL or missing references)
		//IL_002e: Invalid comparison between Unknown and I4
		//IL_00ed: Unknown result type (might be due to invalid IL or missing references)
		//IL_00f7: Invalid comparison between Unknown and I4
		//IL_00a5: 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_00b3: Unknown result type (might be due to invalid IL or missing references)
		//IL_00c3: Unknown result type (might be due to invalid IL or missing references)
		//IL_00c9: Unknown result type (might be due to invalid IL or missing references)
		//IL_00dd: 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_0084: Invalid comparison between Unknown and I4
		NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
		if (networkManager == null || !networkManager.IsListening)
		{
			return;
		}
		if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1 && (networkManager.IsClient || networkManager.IsHost))
		{
			if (((NetworkBehaviour)this).OwnerClientId != networkManager.LocalClientId)
			{
				if ((int)networkManager.LogLevel <= 1)
				{
					Debug.LogError((object)"Only the owner can invoke a ServerRpc that requires ownership!");
				}
				return;
			}
			ServerRpcParams val = default(ServerRpcParams);
			FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendServerRpc(1581355396u, val, (RpcDelivery)0);
			((FastBufferWriter)(ref val2)).WriteValueSafe<AnimationState>(ref animationState, default(ForEnums));
			((NetworkBehaviour)this).__endSendServerRpc(ref val2, 1581355396u, val, (RpcDelivery)0);
		}
		if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost))
		{
			SetAnimationClientRpc(animationState);
		}
	}

	[ClientRpc]
	public void SetAnimationClientRpc(AnimationState animationState)
	{
		//IL_0024: Unknown result type (might be due to invalid IL or missing references)
		//IL_002e: Invalid comparison between Unknown and I4
		//IL_00a7: Unknown result type (might be due to invalid IL or missing references)
		//IL_00b1: Invalid comparison between Unknown and I4
		//IL_005f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0068: Unknown result type (might be due to invalid IL or missing references)
		//IL_006d: Unknown result type (might be due to invalid IL or missing references)
		//IL_007d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0083: Unknown result type (might be due to invalid IL or missing references)
		//IL_0097: Unknown result type (might be due to invalid IL or missing references)
		NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
		if (networkManager != null && networkManager.IsListening)
		{
			if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 2 && (networkManager.IsServer || networkManager.IsHost))
			{
				ClientRpcParams val = default(ClientRpcParams);
				FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(1977017807u, val, (RpcDelivery)0);
				((FastBufferWriter)(ref val2)).WriteValueSafe<AnimationState>(ref animationState, default(ForEnums));
				((NetworkBehaviour)this).__endSendClientRpc(ref val2, 1977017807u, val, (RpcDelivery)0);
			}
			if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 2 && (networkManager.IsClient || networkManager.IsHost) && !isHostOrServer())
			{
				UpdateState(animationState);
			}
		}
	}

	[ServerRpc]
	public void SendAgentMoveServerRpc(bool canMove)
	{
		//IL_0024: Unknown result type (might be due to invalid IL or missing references)
		//IL_002e: Invalid comparison between Unknown and I4
		//IL_00ed: Unknown result type (might be due to invalid IL or missing references)
		//IL_00f7: Invalid comparison between Unknown and I4
		//IL_00a5: 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_00b3: Unknown result type (might be due to invalid IL or missing references)
		//IL_00c3: Unknown result type (might be due to invalid IL or missing references)
		//IL_00c9: Unknown result type (might be due to invalid IL or missing references)
		//IL_00dd: 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_0084: Invalid comparison between Unknown and I4
		NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
		if (networkManager == null || !networkManager.IsListening)
		{
			return;
		}
		if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1 && (networkManager.IsClient || networkManager.IsHost))
		{
			if (((NetworkBehaviour)this).OwnerClientId != networkManager.LocalClientId)
			{
				if ((int)networkManager.LogLevel <= 1)
				{
					Debug.LogError((object)"Only the owner can invoke a ServerRpc that requires ownership!");
				}
				return;
			}
			ServerRpcParams val = default(ServerRpcParams);
			FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendServerRpc(3857219060u, val, (RpcDelivery)0);
			((FastBufferWriter)(ref val2)).WriteValueSafe<bool>(ref canMove, default(ForPrimitives));
			((NetworkBehaviour)this).__endSendServerRpc(ref val2, 3857219060u, val, (RpcDelivery)0);
		}
		if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost))
		{
			SetAgentMoveClientRpc(canMove);
		}
	}

	[ClientRpc]
	public void SetAgentMoveClientRpc(bool canMove)
	{
		//IL_0024: Unknown result type (might be due to invalid IL or missing references)
		//IL_002e: Invalid comparison between Unknown and I4
		//IL_00a7: Unknown result type (might be due to invalid IL or missing references)
		//IL_00b1: Invalid comparison between Unknown and I4
		//IL_005f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0068: Unknown result type (might be due to invalid IL or missing references)
		//IL_006d: Unknown result type (might be due to invalid IL or missing references)
		//IL_007d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0083: Unknown result type (might be due to invalid IL or missing references)
		//IL_0097: Unknown result type (might be due to invalid IL or missing references)
		NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
		if (networkManager != null && networkManager.IsListening)
		{
			if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 2 && (networkManager.IsServer || networkManager.IsHost))
			{
				ClientRpcParams val = default(ClientRpcParams);
				FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(1254120907u, val, (RpcDelivery)0);
				((FastBufferWriter)(ref val2)).WriteValueSafe<bool>(ref canMove, default(ForPrimitives));
				((NetworkBehaviour)this).__endSendClientRpc(ref val2, 1254120907u, val, (RpcDelivery)0);
			}
			if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 2 && (networkManager.IsClient || networkManager.IsHost) && !isHostOrServer() && finishedLoading)
			{
				AbleAgent(canMove);
			}
		}
	}

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

	[RuntimeInitializeOnLoadMethod]
	internal static void InitializeRPCS_PonyBase()
	{
		//IL_0011: Unknown result type (might be due to invalid IL or missing references)
		//IL_001b: Expected O, but got Unknown
		//IL_002c: Unknown result type (might be due to invalid IL or missing references)
		//IL_0036: Expected O, but got Unknown
		//IL_0047: Unknown result type (might be due to invalid IL or missing references)
		//IL_0051: Expected O, but got Unknown
		//IL_0062: Unknown result type (might be due to invalid IL or missing references)
		//IL_006c: Expected O, but got Unknown
		//IL_007d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0087: Expected O, but got Unknown
		//IL_0098: Unknown result type (might be due to invalid IL or missing references)
		//IL_00a2: Expected O, but got Unknown
		//IL_00b3: Unknown result type (might be due to invalid IL or missing references)
		//IL_00bd: Expected O, but got Unknown
		//IL_00ce: Unknown result type (might be due to invalid IL or missing references)
		//IL_00d8: Expected O, but got Unknown
		NetworkManager.__rpc_func_table.Add(4061055872u, new RpcReceiveHandler(__rpc_handler_4061055872));
		NetworkManager.__rpc_func_table.Add(1275489729u, new RpcReceiveHandler(__rpc_handler_1275489729));
		NetworkManager.__rpc_func_table.Add(435443565u, new RpcReceiveHandler(__rpc_handler_435443565));
		NetworkManager.__rpc_func_table.Add(795301819u, new RpcReceiveHandler(__rpc_handler_795301819));
		NetworkManager.__rpc_func_table.Add(1581355396u, new RpcReceiveHandler(__rpc_handler_1581355396));
		NetworkManager.__rpc_func_table.Add(1977017807u, new RpcReceiveHandler(__rpc_handler_1977017807));
		NetworkManager.__rpc_func_table.Add(3857219060u, new RpcReceiveHandler(__rpc_handler_3857219060));
		NetworkManager.__rpc_func_table.Add(1254120907u, new RpcReceiveHandler(__rpc_handler_1254120907));
	}

	private static void __rpc_handler_4061055872(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams)
	{
		//IL_0023: Unknown result type (might be due to invalid IL or missing references)
		//IL_0024: Unknown result type (might be due to invalid IL or missing references)
		//IL_0029: Unknown result type (might be due to invalid IL or missing references)
		//IL_0090: Unknown result type (might be due to invalid IL or missing references)
		//IL_009b: Unknown result type (might be due to invalid IL or missing references)
		//IL_009f: 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_004b: Unknown result type (might be due to invalid IL or missing references)
		//IL_0055: Invalid comparison between Unknown and I4
		NetworkManager networkManager = target.NetworkManager;
		if (networkManager == null || !networkManager.IsListening)
		{
			return;
		}
		if (rpcParams.Server.Receive.SenderClientId != target.OwnerClientId)
		{
			if ((int)networkManager.LogLevel <= 1)
			{
				Debug.LogError((object)"Only the owner can invoke a ServerRpc that requires ownership!");
			}
		}
		else
		{
			Vector3 position = default(Vector3);
			((FastBufferReader)(ref reader)).ReadValueSafe(ref position);
			Vector3 val = default(Vector3);
			((FastBufferReader)(ref reader)).ReadValueSafe(ref val);
			target.__rpc_exec_stage = (__RpcExecStage)1;
			((PonyBase)(object)target).SendDestinationServerRpc(position, val);
			target.__rpc_exec_stage = (__RpcExecStage)0;
		}
	}

	private static void __rpc_handler_1275489729(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 position = default(Vector3);
			((FastBufferReader)(ref reader)).ReadValueSafe(ref position);
			Vector3 dest = default(Vector3);
			((FastBufferReader)(ref reader)).ReadValueSafe(ref dest);
			target.__rpc_exec_stage = (__RpcExecStage)2;
			((PonyBase)(object)target).SetDestinationClientRpc(position, dest);
			target.__rpc_exec_stage = (__RpcExecStage)0;
		}
	}

	private static void __rpc_handler_435443565(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams)
	{
		//IL_0023: Unknown result type (might be due to invalid IL or missing references)
		//IL_0024: Unknown result type (might be due to invalid IL or missing references)
		//IL_0029: Unknown result type (might be due to invalid IL or missing references)
		//IL_007c: Unknown result type (might be due to invalid IL or missing references)
		//IL_0082: 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_00ab: 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_0055: Invalid comparison between Unknown and I4
		NetworkManager networkManager = target.NetworkManager;
		if (networkManager == null || !networkManager.IsListening)
		{
			return;
		}
		if (rpcParams.Server.Receive.SenderClientId != target.OwnerClientId)
		{
			if ((int)networkManager.LogLevel <= 1)
			{
				Debug.LogError((object)"Only the owner can invoke a ServerRpc that requires ownership!");
			}
		}
		else
		{
			float time = default(float);
			((FastBufferReader)(ref reader)).ReadValueSafe<float>(ref time, default(ForPrimitives));
			target.__rpc_exec_stage = (__RpcExecStage)1;
			((PonyBase)(object)target).GetIntoShipServerRpc(time);
			target.__rpc_exec_stage = (__RpcExecStage)0;
		}
	}

	private static void __rpc_handler_795301819(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_005e: Unknown result type (might be due to invalid IL or missing references)
		NetworkManager networkManager = target.NetworkManager;
		if (networkManager != null && networkManager.IsListening)
		{
			float time = default(float);
			((FastBufferReader)(ref reader)).ReadValueSafe<float>(ref time, default(ForPrimitives));
			target.__rpc_exec_stage = (__RpcExecStage)2;
			((PonyBase)(object)target).GetIntoShipClientRpc(time);
			target.__rpc_exec_stage = (__RpcExecStage)0;
		}
	}

	private static void __rpc_handler_1581355396(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams)
	{
		//IL_0023: Unknown result type (might be due to invalid IL or missing references)
		//IL_0024: Unknown result type (might be due to invalid IL or missing references)
		//IL_0029: Unknown result type (might be due to invalid IL or missing references)
		//IL_007c: Unknown result type (might be due to invalid IL or missing references)
		//IL_0082: 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_00ab: 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_0055: Invalid comparison between Unknown and I4
		NetworkManager networkManager = target.NetworkManager;
		if (networkManager == null || !networkManager.IsListening)
		{
			return;
		}
		if (rpcParams.Server.Receive.SenderClientId != target.OwnerClientId)
		{
			if ((int)networkManager.LogLevel <= 1)
			{
				Debug.LogError((object)"Only the owner can invoke a ServerRpc that requires ownership!");
			}
		}
		else
		{
			AnimationState animationState = default(AnimationState);
			((FastBufferReader)(ref reader)).ReadValueSafe<AnimationState>(ref animationState, default(ForEnums));
			target.__rpc_exec_stage = (__RpcExecStage)1;
			((PonyBase)(object)target).SendAnimationServerRpc(animationState);
			target.__rpc_exec_stage = (__RpcExecStage)0;
		}
	}

	private static void __rpc_handler_1977017807(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_005e: Unknown result type (might be due to invalid IL or missing references)
		NetworkManager networkManager = target.NetworkManager;
		if (networkManager != null && networkManager.IsListening)
		{
			AnimationState animationClientRpc = default(AnimationState);
			((FastBufferReader)(ref reader)).ReadValueSafe<AnimationState>(ref animationClientRpc, default(ForEnums));
			target.__rpc_exec_stage = (__RpcExecStage)2;
			((PonyBase)(object)target).SetAnimationClientRpc(animationClientRpc);
			target.__rpc_exec_stage = (__RpcExecStage)0;
		}
	}

	private static void __rpc_handler_3857219060(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams)
	{
		//IL_0023: Unknown result type (might be due to invalid IL or missing references)
		//IL_0024: Unknown result type (might be due to invalid IL or missing references)
		//IL_0029: Unknown result type (might be due to invalid IL or missing references)
		//IL_007c: Unknown result type (might be due to invalid IL or missing references)
		//IL_0082: 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_00ab: 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_0055: Invalid comparison between Unknown and I4
		NetworkManager networkManager = target.NetworkManager;
		if (networkManager == null || !networkManager.IsListening)
		{
			return;
		}
		if (rpcParams.Server.Receive.SenderClientId != target.OwnerClientId)
		{
			if ((int)networkManager.LogLevel <= 1)
			{
				Debug.LogError((object)"Only the owner can invoke a ServerRpc that requires ownership!");
			}
		}
		else
		{
			bool flag = default(bool);
			((FastBufferReader)(ref reader)).ReadValueSafe<bool>(ref flag, default(ForPrimitives));
			target.__rpc_exec_stage = (__RpcExecStage)1;
			((PonyBase)(object)target).SendAgentMoveServerRpc(flag);
			target.__rpc_exec_stage = (__RpcExecStage)0;
		}
	}

	private static void __rpc_handler_1254120907(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_005e: Unknown result type (might be due to invalid IL or missing references)
		NetworkManager networkManager = target.NetworkManager;
		if (networkManager != null && networkManager.IsListening)
		{
			bool agentMoveClientRpc = default(bool);
			((FastBufferReader)(ref reader)).ReadValueSafe<bool>(ref agentMoveClientRpc, default(ForPrimitives));
			target.__rpc_exec_stage = (__RpcExecStage)2;
			((PonyBase)(object)target).SetAgentMoveClientRpc(agentMoveClientRpc);
			target.__rpc_exec_stage = (__RpcExecStage)0;
		}
	}

	protected internal override string __getTypeName()
	{
		return "PonyBase";
	}
}
[BepInPlugin("Mellowdy.CuteaMod_Comission", "CuteaMod_Comission", "1.0.0")]
public class CuteaMod : BaseUnityPlugin
{
	private const string modName = "CuteaMod_Comission";

	private const string modGUID = "Mellowdy.CuteaMod_Comission";

	private const string modVersion = "1.0.0";

	private readonly Harmony harmony = new Harmony("Mellowdy.CuteaMod_Comission");

	public static ManualLogSource mls;

	private static CuteaMod instance;

	public static string assetName = "cutea.lc";

	public static AssetBundle assets;

	public static bool runonce = false;

	public const bool debug = false;

	private void Awake()
	{
		if (!runonce)
		{
			RunNetcodePatcher();
		}
		if ((Object)(object)instance == (Object)null)
		{
			instance = this;
		}
		mls = Logger.CreateLogSource("Mellowdy.CuteaMod_Comission");
		string directoryName = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location);
		string text = Path.Combine(directoryName, assetName).Replace("\\", "/");
		assets = AssetBundle.LoadFromFile(text);
		LevelRarity levelRarity = new LevelRarity(15);
		levelRarity.Experimentation = 0;
		LoadItem("Cutea", levelRarity);
		LoadItem("Ellie", levelRarity);
		LoadItem("StormStar", levelRarity);
		PonyBase.squeak = CuteaMod.LoadAsset<AudioClip>("Squeak.wav");
		levelRarity = new LevelRarity(0);
		levelRarity.SetDesertMoons(0);
		levelRarity.SetForestMoons(40);
		levelRarity.SetWinterMoons(20);
		levelRarity.Modded = 15;
		LoadGrabbableObject("Mango", levelRarity, typeof(Mango));
		Mango.eatSFX = CuteaMod.LoadAsset<AudioClip>("Eat.wav");
		Mango.finishedSFX = CuteaMod.LoadAsset<AudioClip>("FinishEating.wav");
		levelRarity = new LevelRarity(35);
		LoadGrabbableObject("CookieJar", levelRarity, typeof(CookieJar));
		CookieJar.eatSFX = Mango.eatSFX;
		levelRarity = new LevelRarity();
		LoadGrabbableObject("ShadowHat", levelRarity, typeof(ShadowHat));
		harmony.PatchAll();
		mls.LogInfo((object)"CuteaMod_Comission has been loaded");
	}

	public static Item LoadGrabbableObject(string name, LevelRarity rarity, Type componentType)
	{
		//IL_0019: Unknown result type (might be due to invalid IL or missing references)
		//IL_001f: Expected O, but got Unknown
		GameObject val = CuteaMod.LoadAsset<GameObject>(name + ".prefab");
		GrabbableObject val2 = (GrabbableObject)val.AddComponent(componentType);
		val2.grabbable = true;
		val2.itemProperties = CuteaMod.LoadAsset<Item>(name + ".asset");
		NetworkPrefabs.RegisterNetworkPrefab(val);
		SetItemRarity(val2.itemProperties, rarity);
		return val2.itemProperties;
	}

	public void RunNetcodePatcher()
	{
		runonce = true;
		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 static T LoadAsset<T>(string name) where T : Object
	{
		return assets.LoadAsset<T>(name);
	}

	public static void LoadItem(string name, LevelRarity rarity)
	{
		GameObject val = CuteaMod.LoadAsset<GameObject>(name + "Prefab.prefab");
		PonyBase ponyBase = val.AddComponent<PonyBase>();
		((GrabbableObject)ponyBase).itemProperties = CuteaMod.LoadAsset<Item>(name + "Item.asset");
		((GrabbableObject)ponyBase).itemProperties.spawnPrefab = val;
		((GrabbableObject)ponyBase).grabbable = true;
		((GrabbableObject)ponyBase).grabbableToEnemies = true;
		NetworkPrefabs.RegisterNetworkPrefab(val);
		SetItemRarity(((GrabbableObject)ponyBase).itemProperties, rarity);
	}

	public static void SetItemRarity(Item item, LevelRarity rarity)
	{
		Items.RegisterScrap(item, rarity.Experimentation, (LevelTypes)4);
		Items.RegisterScrap(item, rarity.Assurance, (LevelTypes)8);
		Items.RegisterScrap(item, rarity.Vow, (LevelTypes)16);
		Items.RegisterScrap(item, rarity.Offense, (LevelTypes)32);
		Items.RegisterScrap(item, rarity.March, (LevelTypes)64);
		Items.RegisterScrap(item, rarity.Adamance, (LevelTypes)2048);
		Items.RegisterScrap(item, rarity.Embrion, (LevelTypes)8192);
		Items.RegisterScrap(item, rarity.Dine, (LevelTypes)256);
		Items.RegisterScrap(item, rarity.Rend, (LevelTypes)128);
		Items.RegisterScrap(item, rarity.Titan, (LevelTypes)512);
		Items.RegisterScrap(item, rarity.Artifice, (LevelTypes)4096);
		Items.RegisterScrap(item, rarity.Modded, (LevelTypes)1024);
	}
}
public class LevelRarity
{
	public int Experimentation;

	public int Assurance;

	public int Vow;

	public int Offense;

	public int March;

	public int Adamance;

	public int Embrion;

	public int Dine;

	public int Rend;

	public int Titan;

	public int Artifice;

	public int Modded;

	public LevelRarity(int baseRarity = 1)
	{
		bool flag = false;
		Experimentation = baseRarity;
		Assurance = baseRarity;
		Vow = baseRarity;
		Offense = baseRarity;
		March = baseRarity;
		Adamance = baseRarity;
		Embrion = baseRarity;
		Dine = baseRarity;
		Rend = baseRarity;
		Titan = baseRarity;
		Artifice = baseRarity;
		Modded = baseRarity;
	}

	public void SetEasyMoons(int rarity)
	{
		Experimentation = rarity;
		Assurance = rarity;
		Vow = rarity;
	}

	public void SetMediumMoons(int rarity)
	{
		Offense = rarity;
		March = rarity;
		Adamance = rarity;
	}

	public void SetHardMoons(int rarity)
	{
		Embrion = rarity;
		Dine = rarity;
		Rend = rarity;
		Titan = rarity;
		Artifice = rarity;
	}

	public void SetDesertMoons(int rarity)
	{
		Experimentation = rarity;
		Embrion = rarity;
		Assurance = rarity;
		Offense = rarity;
	}

	public void SetForestMoons(int rarity)
	{
		Artifice = rarity;
		Vow = rarity;
		March = rarity;
	}

	public void SetWinterMoons(int rarity)
	{
		Dine = rarity;
		Rend = rarity;
		Titan = rarity;
	}
}
namespace LC_Cutea.NetcodePatcher;

[AttributeUsage(AttributeTargets.Module)]
internal class NetcodePatchedAssemblyAttribute : Attribute
{
}