Decompiled source of DinguPet v0.7.0

BepInEx/plugins/DinguPet.dll

Decompiled a week 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.Cryptography;
using System.Security.Permissions;
using System.Text;
using BepInEx;
using BepInEx.Configuration;
using BepInEx.Logging;
using DinguPet.NetcodePatcher;
using GameNetcodeStuff;
using HarmonyLib;
using LethalCompanyInputUtils.Api;
using LethalLib.Modules;
using Microsoft.CodeAnalysis;
using Unity.Netcode;
using UnityEngine;
using UnityEngine.AI;
using UnityEngine.Audio;
using UnityEngine.Events;
using UnityEngine.InputSystem;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")]
[assembly: IgnoresAccessChecksTo("Assembly-CSharp")]
[assembly: AssemblyCompany("DinguPet")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("DinguPet")]
[assembly: AssemblyTitle("DinguPet")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.0.0")]
[module: UnverifiableCode]
[module: RefSafetyRules(11)]
[module: NetcodePatchedAssembly]
namespace Microsoft.CodeAnalysis
{
	[CompilerGenerated]
	[Embedded]
	internal sealed class EmbeddedAttribute : Attribute
	{
	}
}
namespace System.Runtime.CompilerServices
{
	[CompilerGenerated]
	[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;
		}
	}
}
namespace DinguPet
{
	public class DinguAI : EnemyAI
	{
		private enum Estado
		{
			Procurando,
			Seguindo,
			IndoParaPorta,
			Parado,
			Ficando,
			Caido
		}

		private enum Aviso
		{
			Nenhum,
			Seguindo,
			Ficando,
			Vindo,
			Caiu,
			CaidoChamado,
			Recusou,
			Voltou
		}

		public static DinguAI Current;

		public Transform itemHolder;

		public InteractTrigger interact;

		private const float DistTrote = 7f;

		private const float DistCorrida = 14f;

		private const float VisaoAlcance = 25f;

		private const float VisaoMeioAngulo = 70f;

		private const float VisaoPerto = 4f;

		private const float PortaPerto = 2.2f;

		private const float PesoLento = 1.5f;

		private const float PivoVirar = 0.4f;

		private const float ChamadoLonge = 25f;

		public GrabbableObject heldItem;

		private int guiaIndice = -1;

		private bool ficar;

		private bool caido;

		private Transform ancora;

		private Transform virar;

		private float rolagem;

		private Vector3 posAnterior;

		private float velSuave;

		private static readonly int pVel = Animator.StringToHash("Velocidade");

		private static readonly int pRitmo = Animator.StringToHash("Ritmo");

		private static readonly int pCaido = Animator.StringToHash("Caido");

		private static readonly int pPegar = Animator.StringToHash("Pegar");

		private static readonly int pEntregar = Animator.StringToHash("Entregar");

		private static readonly int pSermao = Animator.StringToHash("Sermao");

		private float passoTimer;

		private float cantoTimer = 12f;

		private bool itemPodiaInimigos;

		private bool ancoraVirada;

		private bool itemNaNave;

		private int ajustarAncora;

		private Estado estado;

		private PlayerControllerB guia;

		private bool jaTeveGuia;

		private bool guiaEstavaDentro;

		private EntranceTeleport porta;

		private EntranceTeleport[] portas;

		private Vector3 posMarcada;

		private float tempoSemProgresso;

		private float esperaTeleporte;

		private float tempoCaido;

		private float tempoDesdeLevantou;

		private float proximaVolta;

		private Coroutine esperaItem;

		private static float Perto => Plugin.stopDistance.Value;

		private static PlayerControllerB[] Jogadores => StartOfRound.Instance.allPlayerScripts;

		public override void Awake()
		{
			((EnemyAI)this).Awake();
			Current = this;
		}

		public override void Start()
		{
			//IL_013b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0140: Unknown result type (might be due to invalid IL or missing references)
			//IL_014b: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ad: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e3: Unknown result type (might be due to invalid IL or missing references)
			//IL_0189: Unknown result type (might be due to invalid IL or missing references)
			//IL_018e: Unknown result type (might be due to invalid IL or missing references)
			//IL_01a3: Unknown result type (might be due to invalid IL or missing references)
			((EnemyAI)this).Start();
			base.removedPowerLevel = true;
			RoundManager.Instance.SpawnedEnemies.Remove((EnemyAI)(object)this);
			if (RoundManager.Instance.numberOfEnemiesInScene > 0)
			{
				RoundManager instance = RoundManager.Instance;
				instance.numberOfEnemiesInScene--;
			}
			((EnemyAI)this).SetEnemyOutside(true);
			((EnemyAI)this).EnableEnemyMesh(true, false, false);
			if ((Object)(object)interact != (Object)null)
			{
				((UnityEvent<PlayerControllerB>)(object)interact.onInteract).AddListener((UnityAction<PlayerControllerB>)OnInteract);
				interact.timeToHold = Mathf.Max(0.1f, Plugin.helpUpSeconds.Value);
			}
			if ((Object)(object)base.creatureAnimator == (Object)null)
			{
				virar = new GameObject("Virar").transform;
				virar.SetParent(((Component)this).transform, false);
				virar.localPosition = new Vector3(0f, 0.4f, 0f);
				Transform val = ((Component)this).transform.Find("Modelo");
				if ((Object)(object)val != (Object)null)
				{
					val.SetParent(virar, true);
				}
				if ((Object)(object)itemHolder != (Object)null)
				{
					itemHolder.SetParent(virar, true);
				}
			}
			posAnterior = ((Component)this).transform.position;
			ancora = new GameObject("ItemAncora").transform;
			ancora.SetParent(((Object)(object)itemHolder != (Object)null) ? itemHolder : ((Component)this).transform, false);
			posMarcada = ((Component)this).transform.position;
			Plugin.Log.LogInfo((object)$"[Dingu] acordou em {((Component)this).transform.position} (host={((NetworkBehaviour)this).IsServer})");
			if (!((NetworkBehaviour)this).IsServer)
			{
				PedirEstadoServerRpc();
			}
		}

		public override void OnDestroy()
		{
			//IL_001a: Unknown result type (might be due to invalid IL or missing references)
			if ((Object)(object)heldItem != (Object)null)
			{
				LargarLocal(((Component)heldItem).transform.position, base.isInsidePlayerShip, levarAte: false);
			}
			((EnemyAI)this).OnDestroy();
			if ((Object)(object)Current == (Object)(object)this)
			{
				Current = null;
			}
		}

		public void Recolher(string motivo, Vector3? chaoDoAltar = null)
		{
			//IL_0057: Unknown result type (might be due to invalid IL or missing references)
			if (!((NetworkBehaviour)this).IsServer || (Object)(object)((NetworkBehaviour)this).NetworkObject == (Object)null || !((NetworkBehaviour)this).NetworkObject.IsSpawned)
			{
				return;
			}
			if ((Object)(object)heldItem != (Object)null)
			{
				if (!base.isInsidePlayerShip && !Plugin.itemLostAtTakeoff.Value && chaoDoAltar.HasValue)
				{
					LargarDoServidor("volta ao altar e leva o item", chaoDoAltar.Value, naNaveForcado: true);
				}
				else
				{
					LargarDoServidor("volta ao altar");
				}
			}
			Plugin.Log.LogInfo((object)("[Dingu] volta ao altar (" + motivo + ")"));
			((NetworkBehaviour)this).NetworkObject.Despawn(true);
		}

		public override void Update()
		{
			//IL_0028: 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_0036: Unknown result type (might be due to invalid IL or missing references)
			((EnemyAI)this).Update();
			StartOfRound instance = StartOfRound.Instance;
			if ((Object)(object)instance == (Object)null)
			{
				return;
			}
			Collider shipInnerRoomBounds = instance.shipInnerRoomBounds;
			int isInsidePlayerShip;
			if ((Object)(object)shipInnerRoomBounds != (Object)null)
			{
				Bounds bounds = shipInnerRoomBounds.bounds;
				isInsidePlayerShip = (((Bounds)(ref bounds)).Contains(((Component)this).transform.position) ? 1 : 0);
			}
			else
			{
				isInsidePlayerShip = 0;
			}
			base.isInsidePlayerShip = (byte)isInsidePlayerShip != 0;
			if ((Object)(object)heldItem != (Object)null)
			{
				if (heldItem.isHeld || heldItem.isPocketed || (Object)(object)heldItem.parentObject != (Object)(object)ancora)
				{
					SoltarPorqueTiraram();
				}
				else
				{
					if (itemNaNave != base.isInsidePlayerShip)
					{
						itemNaNave = base.isInsidePlayerShip;
						EnemyAI.SetItemInElevatorNonPlayer(itemNaNave, itemNaNave, heldItem);
					}
					if (ajustarAncora > 0 && --ajustarAncora == 0)
					{
						AjustarAncora();
					}
				}
			}
			MedirVelocidade();
			Passos();
			if ((Object)(object)base.creatureAnimator != (Object)null)
			{
				AtualizarAnimator();
			}
			else
			{
				AnimarQueda();
			}
			AtualizarDica();
		}

		private void AnimarQueda()
		{
			//IL_007d: Unknown result type (might be due to invalid IL or missing references)
			if (!((Object)(object)virar == (Object)null))
			{
				float num = (caido ? (180f + Mathf.Sin(Time.time * 9f) * 9f) : 0f);
				rolagem = Mathf.MoveTowards(rolagem, num, (caido ? 540f : 360f) * Time.deltaTime);
				virar.localRotation = Quaternion.Euler(0f, 0f, rolagem);
			}
		}

		private void MedirVelocidade()
		{
			//IL_004f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0055: Unknown result type (might be due to invalid IL or missing references)
			//IL_005a: 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_007d: 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_0039: 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)
			float num = Mathf.Max(Time.deltaTime, 0.0001f);
			float num2;
			if (((NetworkBehaviour)this).IsServer && (Object)(object)base.agent != (Object)null && ((Behaviour)base.agent).enabled)
			{
				Vector3 velocity = base.agent.velocity;
				num2 = ((Vector3)(ref velocity)).magnitude;
			}
			else
			{
				Vector3 val = ((Component)this).transform.position - posAnterior;
				val.y = 0f;
				num2 = ((Vector3)(ref val)).magnitude / num;
			}
			posAnterior = ((Component)this).transform.position;
			velSuave = Mathf.Lerp(velSuave, caido ? 0f : num2, 1f - Mathf.Exp(-8f * num));
		}

		private void AtualizarAnimator()
		{
			float num = Mathf.Clamp(velSuave / 4.5f * 1.11f, 0f, 1.11f);
			float num2 = ((num > 0.05f) ? Mathf.Clamp(velSuave / num, 1f, 5f) : 1f);
			base.creatureAnimator.SetFloat(pVel, num);
			base.creatureAnimator.SetFloat(pRitmo, num2);
			base.creatureAnimator.SetBool(pCaido, caido);
		}

		private void Tocar(AudioSource fonte, string grupo, float volume, bool walkie = false, int indice = -1, float variarTom = 0f)
		{
			AudioClip val = Plugin.Som(grupo, indice);
			if (!((Object)(object)fonte == (Object)null) && !((Object)(object)val == (Object)null) && !(volume <= 0f))
			{
				fonte.pitch = ((variarTom > 0f) ? Random.Range(1f - variarTom, 1f + variarTom) : 1f);
				fonte.PlayOneShot(val, volume);
				if (walkie)
				{
					WalkieTalkie.TransmitOneShotAudio(fonte, val, volume);
				}
			}
		}

		private void Passos()
		{
			if (caido || velSuave < 0.4f)
			{
				passoTimer = 0.1f;
				return;
			}
			passoTimer -= Time.deltaTime;
			if (!(passoTimer > 0f))
			{
				Tocar(base.creatureSFX, "passo", Plugin.footstepsVolume.Value, walkie: false, -1, 0.08f);
				passoTimer = Mathf.Clamp(1.2f / velSuave, 0.13f, 0.55f) * Random.Range(0.85f, 1.15f);
			}
		}

		private void TalvezCantar()
		{
			float value = Plugin.chantMinSeconds.Value;
			float value2 = Plugin.chantMaxSeconds.Value;
			if (!(value2 <= 0f) && !caido)
			{
				cantoTimer -= base.AIIntervalTime;
				if (!(cantoTimer > 0f))
				{
					cantoTimer = Random.Range(Mathf.Min(value, value2), Mathf.Max(value, value2));
					bool sermao = !base.moveTowardsDestination && Random.value < 0.5f;
					FalarClientRpc(Random.Range(0, Mathf.Max(1, Plugin.QuantosSons("fala"))), sermao);
				}
			}
		}

		[ClientRpc]
		public void FalarClientRpc(int fala, bool sermao)
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Invalid comparison between Unknown and I4
			//IL_00b4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00be: 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_008a: 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_00a4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e9: 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 != 1 && (networkManager.IsServer || networkManager.IsHost))
			{
				ClientRpcParams val2 = default(ClientRpcParams);
				FastBufferWriter val = ((NetworkBehaviour)this).__beginSendClientRpc(3829323817u, val2, (RpcDelivery)0);
				BytePacker.WriteValueBitPacked(val, fala);
				((FastBufferWriter)(ref val)).WriteValueSafe<bool>(ref sermao, default(ForPrimitives));
				((NetworkBehaviour)this).__endSendClientRpc(ref val, 3829323817u, val2, (RpcDelivery)0);
			}
			if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsClient || networkManager.IsHost))
			{
				((NetworkBehaviour)this).__rpc_exec_stage = (__RpcExecStage)0;
				Tocar(base.creatureVoice, "fala", Plugin.voiceVolume.Value, walkie: true, fala);
				if (sermao && (Object)(object)base.creatureAnimator != (Object)null)
				{
					base.creatureAnimator.SetTrigger(pSermao);
				}
			}
		}

		private void AtualizarDica()
		{
			if ((Object)(object)interact == (Object)null)
			{
				return;
			}
			PlayerControllerB val = GameNetworkManager.Instance?.localPlayerController;
			if (!((Object)(object)val == (Object)null))
			{
				int num = Array.IndexOf(Jogadores, val);
				bool flag = val.isHoldingObject && (Object)(object)val.currentlyHeldObjectServer != (Object)null;
				bool flag2 = num >= 0 && num == guiaIndice;
				string text = (caido ? "Help Dingu up : [E]" : ((flag && (Object)(object)heldItem == (Object)null) ? (Plugin.ItemBloqueado(val.currentlyHeldObjectServer) ? "Dingu won't carry this" : "Give to Dingu : [E]") : ((flag2 && !flag && (Object)(object)heldItem != (Object)null) ? "Dingu, drop it : [E]" : ((flag2 && !flag) ? (ficar ? "Dingu, follow me : [E]" : "Dingu, stay : [E]") : ((!flag2) ? "Lead Dingu : [E]" : "Dingu follows you")))));
				if (interact.hoverTip != text)
				{
					interact.hoverTip = text;
				}
				if (interact.holdInteraction != caido)
				{
					interact.holdInteraction = caido;
				}
				interact.holdTip = "[Helping Dingu up]";
			}
		}

		public override void HitEnemy(int force = 1, PlayerControllerB playerWhoHit = null, bool playHitSFX = false, int hitID = -1)
		{
			Tocar(base.creatureSFX, "sino", Plugin.effectsVolume.Value, walkie: true);
		}

		public override void KillEnemy(bool destroy = false)
		{
		}

		public override void SetEnemyStunned(bool setToStunned, float setToStunTime = 1f, PlayerControllerB setStunnedByPlayer = null)
		{
		}

		public override void HitFromExplosion(float distance)
		{
		}

		public override void DoAIInterval()
		{
			if (base.isEnemyDead || (Object)(object)StartOfRound.Instance == (Object)null)
			{
				return;
			}
			esperaTeleporte -= base.AIIntervalTime;
			if (!((Behaviour)base.agent).enabled || !base.agent.isOnNavMesh)
			{
				base.moveTowardsDestination = false;
				if ((Object)(object)guia != (Object)null && !caido)
				{
					TeleportarAtrasDoGuia("fora do NavMesh");
				}
				((EnemyAI)this).SyncPositionToClients();
				return;
			}
			try
			{
				Pensar();
				TalvezCantar();
			}
			catch (Exception ex)
			{
				Plugin.Log.LogError((object)("[Dingu] IA: " + ex));
			}
			((EnemyAI)this).DoAIInterval();
		}

		private void Pensar()
		{
			//IL_017c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0231: Unknown result type (might be due to invalid IL or missing references)
			//IL_0241: Unknown result type (might be due to invalid IL or missing references)
			//IL_025e: Unknown result type (might be due to invalid IL or missing references)
			if (caido)
			{
				Parar();
				MudarEstado(Estado.Caido);
				tempoCaido += base.AIIntervalTime;
				float value = Plugin.getUpAloneSeconds.Value;
				if (value > 0f && tempoCaido > value)
				{
					Levantar("conseguiu se virar sozinho");
				}
				return;
			}
			tempoDesdeLevantou += base.AIIntervalTime;
			if ((Object)(object)guia != (Object)null && !Vivo(guia))
			{
				string playerUsername = guia.playerUsername;
				guia = null;
				PlayerControllerB val = MaisProximoVivo();
				if ((Object)(object)val != (Object)null)
				{
					DefinirGuia(val, playerUsername + " morreu/saiu: vai até o mais próximo");
				}
			}
			if ((Object)(object)guia == (Object)null)
			{
				PlayerControllerB val2 = (jaTeveGuia ? MaisProximoVivo() : PrimeiroAvistado());
				if ((Object)(object)val2 != (Object)null)
				{
					DefinirGuia(val2, jaTeveGuia ? "mais próximo vivo" : "avistou primeiro");
				}
			}
			if ((Object)(object)guia == (Object)null)
			{
				Parar();
				MudarEstado(jaTeveGuia ? Estado.Parado : Estado.Procurando);
				if (estado == Estado.Procurando)
				{
					((Component)this).transform.Rotate(0f, 35f * base.AIIntervalTime, 0f);
				}
				return;
			}
			bool isInsideFactory = guia.isInsideFactory;
			if (isInsideFactory != guiaEstavaDentro)
			{
				guiaEstavaDentro = isInsideFactory;
				EntranceTeleport val3 = PortaMaisProxima(((Component)guia).transform.position, isInsideFactory);
				porta = (((Object)(object)val3 != (Object)null && ((Object)(object)val3.exitScript != (Object)null || val3.FindExitPoint())) ? val3.exitScript : null);
				Plugin.Log.LogInfo((object)string.Format("[Dingu] {0} foi para {1} pela porta #{2}", guia.playerUsername, isInsideFactory ? "dentro" : "fora", val3?.entranceId));
			}
			if (ficar)
			{
				Parar();
				MudarEstado(Estado.Ficando);
				if (isInsideFactory == !base.isOutside && Vector3.Distance(((Component)this).transform.position, ((Component)guia).transform.position) < 15f)
				{
					OlharPara(((Component)guia).transform.position);
				}
			}
			else
			{
				if (isInsideFactory != !base.isOutside)
				{
					IrPelaPorta();
				}
				else
				{
					Seguir();
				}
				TalvezTropecar();
			}
		}

		private void Seguir()
		{
			//IL_0006: 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_0085: Unknown result type (might be due to invalid IL or missing references)
			//IL_0060: Unknown result type (might be due to invalid IL or missing references)
			float num = Vector3.Distance(((Component)this).transform.position, ((Component)guia).transform.position);
			if (num > Plugin.teleportDistance.Value)
			{
				TeleportarAtrasDoGuia($"longe ({num:F0} m)");
				return;
			}
			if (num <= Perto)
			{
				Parar();
				OlharPara(((Component)guia).transform.position);
				MudarEstado(Estado.Seguindo);
				return;
			}
			MudarEstado(Estado.Seguindo);
			Andar(((Component)guia).transform.position, num, Perto - 0.3f);
			if (Preso() && num > Perto + 3f)
			{
				TeleportarAtrasDoGuia("preso");
			}
		}

		private void IrPelaPorta()
		{
			//IL_002e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0066: Unknown result type (might be due to invalid IL or missing references)
			//IL_0076: 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)
			bool flag = !base.isOutside;
			if ((Object)(object)porta == (Object)null || porta.isEntranceToBuilding == flag)
			{
				porta = PortaMaisProxima(((Component)this).transform.position, flag);
			}
			if ((Object)(object)porta == (Object)null)
			{
				TeleportarAtrasDoGuia("sem porta");
				return;
			}
			MudarEstado(Estado.IndoParaPorta);
			float num = Vector3.Distance(((Component)this).transform.position, porta.entrancePoint.position);
			if (num < 2.2f)
			{
				AtravessarPorta(porta);
				return;
			}
			Andar(porta.entrancePoint.position, Mathf.Max(num, 7.1f), 0.4f);
			if (Preso())
			{
				TeleportarAtrasDoGuia("preso indo para a porta");
			}
		}

		private void AtravessarPorta(EntranceTeleport p)
		{
			//IL_0041: Unknown result type (might be due to invalid IL or missing references)
			//IL_0046: Unknown result type (might be due to invalid IL or missing references)
			//IL_0047: Unknown result type (might be due to invalid IL or missing references)
			//IL_0060: Unknown result type (might be due to invalid IL or missing references)
			//IL_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)
			if (((Object)(object)p.exitScript == (Object)null && !p.FindExitPoint()) || (Object)(object)p.exitScript.entrancePoint == (Object)null)
			{
				TeleportarAtrasDoGuia("porta sem saída");
				return;
			}
			Vector3 position = p.exitScript.entrancePoint.position;
			NavMeshHit val = default(NavMeshHit);
			if (NavMesh.SamplePosition(position, ref val, 3f, -1))
			{
				position = ((NavMeshHit)(ref val)).position;
			}
			Teletransportar(position, !p.isEntranceToBuilding, $"atravessou a porta #{p.entranceId}");
			porta = null;
		}

		private void TeleportarAtrasDoGuia(string motivo, bool ignorarEspera = false)
		{
			//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_0044: 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)
			//IL_0068: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d8: 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_00ad: Unknown result type (might be due to invalid IL or missing references)
			if ((Object)(object)guia == (Object)null || (esperaTeleporte > 0f && !ignorarEspera))
			{
				return;
			}
			NavMeshHit val = default(NavMeshHit);
			if (!NavMesh.SamplePosition(((Component)guia).transform.position - ((Component)guia).transform.forward * 1.8f, ref val, 4f, -1) && !NavMesh.SamplePosition(((Component)guia).transform.position, ref val, 8f, -1))
			{
				esperaTeleporte = 2f;
				return;
			}
			bool flag = !guia.isInsideFactory;
			if (flag == base.isOutside && Vector3.Distance(((NavMeshHit)(ref val)).position, ((Component)this).transform.position) < 3f)
			{
				esperaTeleporte = 4f;
				tempoSemProgresso = 0f;
			}
			else
			{
				Teletransportar(((NavMeshHit)(ref val)).position, flag, "atrás do guia: " + motivo);
			}
		}

		private void Teletransportar(Vector3 pos, bool fora, string motivo)
		{
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			//IL_0013: Unknown result type (might be due to invalid IL or missing references)
			//IL_001a: 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_004e: 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_0072: 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_007d: Unknown result type (might be due to invalid IL or missing references)
			//IL_008f: Unknown result type (might be due to invalid IL or missing references)
			base.agent.Warp(pos);
			((Component)this).transform.position = pos;
			base.serverPosition = pos;
			if (fora != base.isOutside)
			{
				((EnemyAI)this).SetEnemyOutside(fora);
			}
			if ((Object)(object)heldItem != (Object)null)
			{
				heldItem.isInFactory = !fora;
			}
			posMarcada = pos;
			tempoSemProgresso = 0f;
			esperaTeleporte = 5f;
			base.moveTowardsDestination = false;
			base.prevDestination = Vector3.zero;
			TeleportarClientRpc(pos, fora);
			Plugin.Log.LogInfo((object)string.Format("[Dingu] teleporte ({0}) para {1} {2}", motivo, pos, fora ? "fora" : "dentro"));
		}

		[ClientRpc]
		public void TeleportarClientRpc(Vector3 pos, bool fora)
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Invalid comparison between Unknown and I4
			//IL_00b4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00be: 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_008a: 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_00a4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e9: 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_0104: Unknown result type (might be due to invalid IL or missing references)
			//IL_0105: Unknown result type (might be due to invalid IL or missing references)
			NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
			if (networkManager == null || !networkManager.IsListening)
			{
				return;
			}
			if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1 && (networkManager.IsServer || networkManager.IsHost))
			{
				ClientRpcParams val2 = default(ClientRpcParams);
				FastBufferWriter val = ((NetworkBehaviour)this).__beginSendClientRpc(859708793u, val2, (RpcDelivery)0);
				((FastBufferWriter)(ref val)).WriteValueSafe(ref pos);
				((FastBufferWriter)(ref val)).WriteValueSafe<bool>(ref fora, default(ForPrimitives));
				((NetworkBehaviour)this).__endSendClientRpc(ref val, 859708793u, val2, (RpcDelivery)0);
			}
			if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1 || (!networkManager.IsClient && !networkManager.IsHost))
			{
				return;
			}
			((NetworkBehaviour)this).__rpc_exec_stage = (__RpcExecStage)0;
			if (!((NetworkBehaviour)this).IsServer)
			{
				((Component)this).transform.position = pos;
				base.serverPosition = pos;
				if (fora != base.isOutside)
				{
					((EnemyAI)this).SetEnemyOutside(fora);
				}
				if ((Object)(object)heldItem != (Object)null)
				{
					heldItem.isInFactory = !fora;
				}
			}
		}

		private void Andar(Vector3 alvo, float distancia, float parada)
		{
			//IL_00aa: Unknown result type (might be due to invalid IL or missing references)
			base.agent.speed = ((distancia > 14f) ? Plugin.runSpeed.Value : ((distancia > 7f) ? Plugin.trotSpeed.Value : Plugin.walkSpeed.Value));
			if (Plugin.heavySlowdown.Value && (Object)(object)heldItem != (Object)null && (Object)(object)heldItem.itemProperties != (Object)null && heldItem.itemProperties.weight > 1.5f)
			{
				NavMeshAgent agent = base.agent;
				agent.speed *= Plugin.heavyMultiplier.Value;
			}
			base.agent.stoppingDistance = parada;
			((EnemyAI)this).SetDestinationToPosition(alvo, false);
		}

		private void Parar()
		{
			//IL_0028: 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_0044: 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)
			if (base.moveTowardsDestination && base.agent.isOnNavMesh)
			{
				base.agent.ResetPath();
			}
			base.moveTowardsDestination = false;
			base.prevDestination = Vector3.zero;
			tempoSemProgresso = 0f;
			posMarcada = ((Component)this).transform.position;
		}

		private bool Preso()
		{
			//IL_0006: 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_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)
			if (Vector3.Distance(((Component)this).transform.position, posMarcada) > 0.6f)
			{
				posMarcada = ((Component)this).transform.position;
				tempoSemProgresso = 0f;
				return false;
			}
			tempoSemProgresso += base.AIIntervalTime;
			return tempoSemProgresso > Plugin.stuckSeconds.Value;
		}

		private void OlharPara(Vector3 alvo)
		{
			//IL_0000: Unknown result type (might be due to invalid IL or missing references)
			//IL_0007: Unknown result type (might be due to invalid IL or missing references)
			//IL_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_0039: 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_003f: 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)
			Vector3 val = alvo - ((Component)this).transform.position;
			val.y = 0f;
			if (!(((Vector3)(ref val)).sqrMagnitude < 0.01f))
			{
				((Component)this).transform.rotation = Quaternion.RotateTowards(((Component)this).transform.rotation, Quaternion.LookRotation(val), 140f * base.AIIntervalTime);
			}
		}

		private void MudarEstado(Estado e)
		{
			if (e != estado)
			{
				Plugin.Log.LogInfo((object)$"[Dingu] {estado} -> {e}");
				estado = e;
			}
		}

		private void TalvezTropecar()
		{
			//IL_002f: 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_006f: Unknown result type (might be due to invalid IL or missing references)
			float value = Plugin.tripMinutes.Value;
			if (value <= 0f || tempoDesdeLevantou < 60f || !base.moveTowardsDestination)
			{
				return;
			}
			Vector3 velocity = base.agent.velocity;
			if (!(((Vector3)(ref velocity)).magnitude < 0.5f))
			{
				float num = 1f;
				if (base.agent.speed > Plugin.walkSpeed.Value + 0.1f)
				{
					num *= 2f;
				}
				if (velocity.y < -0.5f)
				{
					num *= 3f;
				}
				float num2 = num / (value * 60f) * base.AIIntervalTime;
				if (Random.value < num2)
				{
					Cair();
				}
			}
		}

		private void Cair()
		{
			Parar();
			caido = true;
			tempoCaido = 0f;
			Plugin.Log.LogInfo((object)"[Dingu] tropeçou e caiu de costas");
			EnviarEstado(Aviso.Caiu);
		}

		private void Levantar(string motivo)
		{
			//IL_0022: Unknown result type (might be due to invalid IL or missing references)
			//IL_0027: Unknown result type (might be due to invalid IL or missing references)
			if (caido)
			{
				caido = false;
				tempoDesdeLevantou = 0f;
				posMarcada = ((Component)this).transform.position;
				Plugin.Log.LogInfo((object)("[Dingu] levantou (" + motivo + ")"));
				EnviarEstado(Aviso.Nenhum);
			}
		}

		[ServerRpc(RequireOwnership = false)]
		public void LevantarServerRpc(int jogador)
		{
			//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)
			NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
			if (networkManager != null && networkManager.IsListening)
			{
				if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1 && (networkManager.IsClient || networkManager.IsHost))
				{
					ServerRpcParams val2 = default(ServerRpcParams);
					FastBufferWriter val = ((NetworkBehaviour)this).__beginSendServerRpc(3598552982u, val2, (RpcDelivery)0);
					BytePacker.WriteValueBitPacked(val, jogador);
					((NetworkBehaviour)this).__endSendServerRpc(ref val, 3598552982u, val2, (RpcDelivery)0);
				}
				if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost))
				{
					((NetworkBehaviour)this).__rpc_exec_stage = (__RpcExecStage)0;
					string text = ((jogador >= 0 && jogador < Jogadores.Length) ? Jogadores[jogador].playerUsername : "?");
					Levantar(text + " ajudou");
				}
			}
		}

		private void EnviarEstado(Aviso aviso)
		{
			EstadoClientRpc(((Object)(object)guia != (Object)null) ? Array.IndexOf(Jogadores, guia) : (-1), ficar, caido, (int)aviso);
		}

		[ClientRpc]
		public void EstadoClientRpc(int jogadorGuia, bool ficando, bool deCostas, int aviso)
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Invalid comparison between Unknown and I4
			//IL_00dc: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e6: 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_008a: 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_00a5: 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_00b4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00cc: Unknown result type (might be due to invalid IL or missing references)
			//IL_0111: Unknown result type (might be due to invalid IL or missing references)
			//IL_023d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0248: Unknown result type (might be due to invalid IL or missing references)
			NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
			if (networkManager == null || !networkManager.IsListening)
			{
				return;
			}
			if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1 && (networkManager.IsServer || networkManager.IsHost))
			{
				ClientRpcParams val2 = default(ClientRpcParams);
				FastBufferWriter val = ((NetworkBehaviour)this).__beginSendClientRpc(1503529281u, val2, (RpcDelivery)0);
				BytePacker.WriteValueBitPacked(val, jogadorGuia);
				((FastBufferWriter)(ref val)).WriteValueSafe<bool>(ref ficando, default(ForPrimitives));
				((FastBufferWriter)(ref val)).WriteValueSafe<bool>(ref deCostas, default(ForPrimitives));
				BytePacker.WriteValueBitPacked(val, aviso);
				((NetworkBehaviour)this).__endSendClientRpc(ref val, 1503529281u, val2, (RpcDelivery)0);
			}
			if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1 || (!networkManager.IsClient && !networkManager.IsHost))
			{
				return;
			}
			((NetworkBehaviour)this).__rpc_exec_stage = (__RpcExecStage)0;
			guiaIndice = jogadorGuia;
			ficar = ficando;
			bool num = caido;
			caido = deCostas;
			if (num && !caido)
			{
				Tocar(base.creatureVoice, "levantar", Plugin.effectsVolume.Value, walkie: true);
			}
			switch ((Aviso)aviso)
			{
			case Aviso.Seguindo:
			case Aviso.Ficando:
			case Aviso.Vindo:
			case Aviso.CaidoChamado:
			case Aviso.Voltou:
				Tocar(base.creatureVoice, "fala", Plugin.voiceVolume.Value * 0.85f, walkie: true);
				break;
			case Aviso.Caiu:
				Tocar(base.creatureSFX, "tombo", Plugin.effectsVolume.Value, walkie: true);
				break;
			case Aviso.Recusou:
				Tocar(base.creatureSFX, "mandibula", Plugin.effectsVolume.Value);
				break;
			}
			PlayerControllerB val3 = GameNetworkManager.Instance?.localPlayerController;
			if ((Object)(object)val3 == (Object)null || aviso == 0)
			{
				return;
			}
			bool flag = jogadorGuia >= 0 && jogadorGuia < Jogadores.Length && (Object)(object)Jogadores[jogadorGuia] == (Object)(object)val3;
			bool flag2 = Vector3.Distance(((Component)val3).transform.position, ((Component)this).transform.position) < 15f;
			string text = null;
			switch ((Aviso)aviso)
			{
			case Aviso.Seguindo:
				if (flag)
				{
					text = "Dingu is following you.";
				}
				break;
			case Aviso.Ficando:
				if (flag)
				{
					text = "Dingu will wait here.";
				}
				break;
			case Aviso.Vindo:
				if (flag)
				{
					text = "Dingu is coming.";
				}
				break;
			case Aviso.Caiu:
				if (flag || flag2)
				{
					text = "Dingu fell on his back! Hold [E] on him to help him up.";
				}
				break;
			case Aviso.CaidoChamado:
				if (flag)
				{
					text = "Dingu is on his back! Help him up first.";
				}
				break;
			case Aviso.Recusou:
				if (flag)
				{
					text = "Dingu refuses to carry that.";
				}
				break;
			case Aviso.Voltou:
				if (flag)
				{
					text = "Dingu is back at his altar and waits there. [E] on him: follow me.";
				}
				break;
			}
			if (text != null)
			{
				HUDManager instance = HUDManager.Instance;
				if (instance != null)
				{
					instance.DisplayTip("Dingu", text, false, false, "LC_Tip1");
				}
			}
		}

		[ServerRpc(RequireOwnership = false)]
		public void PedirEstadoServerRpc()
		{
			//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)
			//IL_00e7: 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 != 1 && (networkManager.IsClient || networkManager.IsHost))
			{
				ServerRpcParams val2 = default(ServerRpcParams);
				FastBufferWriter val = ((NetworkBehaviour)this).__beginSendServerRpc(3519646207u, val2, (RpcDelivery)0);
				((NetworkBehaviour)this).__endSendServerRpc(ref val, 3519646207u, val2, (RpcDelivery)0);
			}
			if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost))
			{
				((NetworkBehaviour)this).__rpc_exec_stage = (__RpcExecStage)0;
				EnviarEstado(Aviso.Nenhum);
				if ((Object)(object)heldItem != (Object)null)
				{
					PegarItemClientRpc(NetworkObjectReference.op_Implicit(((NetworkBehaviour)heldItem).NetworkObject));
				}
			}
		}

		private static bool Vivo(PlayerControllerB p)
		{
			if ((Object)(object)p != (Object)null && p.isPlayerControlled)
			{
				return !p.isPlayerDead;
			}
			return false;
		}

		private PlayerControllerB PrimeiroAvistado()
		{
			//IL_0051: Unknown result type (might be due to invalid IL or missing references)
			//IL_0056: Unknown result type (might be due to invalid IL or missing references)
			//IL_005e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0063: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ad: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b2: 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_0089: 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_0096: Unknown result type (might be due to invalid IL or missing references)
			PlayerControllerB result = null;
			float num = float.MaxValue;
			int collidersAndRoomMaskAndDefault = StartOfRound.Instance.collidersAndRoomMaskAndDefault;
			PlayerControllerB[] jogadores = Jogadores;
			foreach (PlayerControllerB val in jogadores)
			{
				if (Vivo(val) && val.isInsideFactory != base.isOutside)
				{
					Vector3 position = ((Component)val.gameplayCamera).transform.position;
					float num2 = Vector3.Distance(base.eye.position, position);
					if (!(num2 > 25f) && (!(num2 > 4f) || !(Vector3.Angle(base.eye.forward, position - base.eye.position) > 70f)) && !Physics.Linecast(base.eye.position, position, collidersAndRoomMaskAndDefault, (QueryTriggerInteraction)1) && num2 < num)
					{
						num = num2;
						result = val;
					}
				}
			}
			return result;
		}

		private PlayerControllerB MaisProximoVivo()
		{
			//IL_0026: Unknown result type (might be due to invalid IL or missing references)
			//IL_0032: Unknown result type (might be due to invalid IL or missing references)
			PlayerControllerB result = null;
			float num = float.MaxValue;
			PlayerControllerB[] jogadores = Jogadores;
			foreach (PlayerControllerB val in jogadores)
			{
				if (Vivo(val))
				{
					float num2 = Vector3.Distance(((Component)this).transform.position, ((Component)val).transform.position);
					if (num2 < num)
					{
						num = num2;
						result = val;
					}
				}
			}
			return result;
		}

		private void DefinirGuia(PlayerControllerB p, string motivo, Aviso aviso = Aviso.Seguindo)
		{
			if (!((Object)(object)p == (Object)(object)guia))
			{
				guia = p;
				jaTeveGuia = true;
				ficar = false;
				guiaEstavaDentro = p.isInsideFactory;
				porta = null;
				tempoSemProgresso = 0f;
				Plugin.Log.LogInfo((object)$"[Dingu] guia = {p.playerUsername} (#{Array.IndexOf(Jogadores, p)}, {motivo})");
				EnviarEstado(aviso);
			}
		}

		private void OnInteract(PlayerControllerB p)
		{
			//IL_005a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0060: Unknown result type (might be due to invalid IL or missing references)
			//IL_006e: Unknown result type (might be due to invalid IL or missing references)
			int num = Array.IndexOf(Jogadores, p);
			if (num < 0)
			{
				return;
			}
			GrabbableObject currentlyHeldObjectServer = p.currentlyHeldObjectServer;
			bool flag = p.isHoldingObject && (Object)(object)currentlyHeldObjectServer != (Object)null;
			if (caido)
			{
				LevantarServerRpc(num);
			}
			else if (flag && (Object)(object)heldItem == (Object)null)
			{
				if (!Plugin.ItemBloqueado(currentlyHeldObjectServer))
				{
					p.DiscardHeldObject(false, (NetworkObject)null, default(Vector3), true);
					DarItemServerRpc(NetworkObjectReference.op_Implicit(((NetworkBehaviour)currentlyHeldObjectServer).NetworkObject), num);
				}
			}
			else if (!flag && num == guiaIndice && (Object)(object)heldItem != (Object)null)
			{
				LargarServerRpc(num);
			}
			else if (!flag && num == guiaIndice)
			{
				FicarServerRpc(num, !ficar);
			}
			else
			{
				GuiarServerRpc(num);
			}
		}

		[ServerRpc(RequireOwnership = false)]
		public void GuiarServerRpc(int jogador)
		{
			//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)
			NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
			if (networkManager == null || !networkManager.IsListening)
			{
				return;
			}
			if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1 && (networkManager.IsClient || networkManager.IsHost))
			{
				ServerRpcParams val2 = default(ServerRpcParams);
				FastBufferWriter val = ((NetworkBehaviour)this).__beginSendServerRpc(629906691u, val2, (RpcDelivery)0);
				BytePacker.WriteValueBitPacked(val, jogador);
				((NetworkBehaviour)this).__endSendServerRpc(ref val, 629906691u, val2, (RpcDelivery)0);
			}
			if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1 || (!networkManager.IsServer && !networkManager.IsHost))
			{
				return;
			}
			((NetworkBehaviour)this).__rpc_exec_stage = (__RpcExecStage)0;
			if (jogador >= 0 && jogador < Jogadores.Length)
			{
				PlayerControllerB p = Jogadores[jogador];
				if (Vivo(p))
				{
					DefinirGuia(p, "[E]");
				}
			}
		}

		[ServerRpc(RequireOwnership = false)]
		public void FicarServerRpc(int jogador, bool ficando)
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Invalid comparison between Unknown and I4
			//IL_00b4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00be: 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_008a: 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_00a4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e9: 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 != 1 && (networkManager.IsClient || networkManager.IsHost))
			{
				ServerRpcParams val2 = default(ServerRpcParams);
				FastBufferWriter val = ((NetworkBehaviour)this).__beginSendServerRpc(1432441955u, val2, (RpcDelivery)0);
				BytePacker.WriteValueBitPacked(val, jogador);
				((FastBufferWriter)(ref val)).WriteValueSafe<bool>(ref ficando, default(ForPrimitives));
				((NetworkBehaviour)this).__endSendServerRpc(ref val, 1432441955u, val2, (RpcDelivery)0);
			}
			if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost))
			{
				((NetworkBehaviour)this).__rpc_exec_stage = (__RpcExecStage)0;
				if (!((Object)(object)guia == (Object)null) && Array.IndexOf(Jogadores, guia) == jogador && !caido)
				{
					ficar = ficando;
					Plugin.Log.LogInfo((object)("[Dingu] " + (ficar ? "fica aqui" : "volta a seguir") + " (" + guia.playerUsername + ")"));
					EnviarEstado((!ficar) ? Aviso.Seguindo : Aviso.Ficando);
				}
			}
		}

		public void ChamarDoLocal(PlayerControllerB local)
		{
			int num = Array.IndexOf(Jogadores, local);
			if (num >= 0)
			{
				ChamarServerRpc(num);
			}
		}

		[ServerRpc(RequireOwnership = false)]
		public void ChamarServerRpc(int jogador)
		{
			//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_013b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0146: 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 != 1 && (networkManager.IsClient || networkManager.IsHost))
			{
				ServerRpcParams val2 = default(ServerRpcParams);
				FastBufferWriter val = ((NetworkBehaviour)this).__beginSendServerRpc(1867461261u, val2, (RpcDelivery)0);
				BytePacker.WriteValueBitPacked(val, jogador);
				((NetworkBehaviour)this).__endSendServerRpc(ref val, 1867461261u, val2, (RpcDelivery)0);
			}
			if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1 || (!networkManager.IsServer && !networkManager.IsHost))
			{
				return;
			}
			((NetworkBehaviour)this).__rpc_exec_stage = (__RpcExecStage)0;
			if (jogador < 0 || jogador >= Jogadores.Length)
			{
				return;
			}
			PlayerControllerB val3 = Jogadores[jogador];
			if (!Vivo(val3))
			{
				return;
			}
			if ((Object)(object)guia != (Object)(object)val3)
			{
				DefinirGuia(val3, "chamou", Aviso.Nenhum);
			}
			ficar = false;
			if (caido)
			{
				EnviarEstado(Aviso.CaidoChamado);
				return;
			}
			if (val3.isInsideFactory == base.isOutside || Vector3.Distance(((Component)this).transform.position, ((Component)val3).transform.position) > 25f)
			{
				TeleportarAtrasDoGuia("chamado", ignorarEspera: true);
			}
			Plugin.Log.LogInfo((object)("[Dingu] " + val3.playerUsername + " chamou"));
			EnviarEstado(Aviso.Vindo);
		}

		[ServerRpc(RequireOwnership = false)]
		public void VoltarAoAltarServerRpc(int jogador)
		{
			//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_01a5: Unknown result type (might be due to invalid IL or missing references)
			//IL_0156: Unknown result type (might be due to invalid IL or missing references)
			//IL_015b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0165: Unknown result type (might be due to invalid IL or missing references)
			//IL_016a: 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 != 1 && (networkManager.IsClient || networkManager.IsHost))
			{
				ServerRpcParams val2 = default(ServerRpcParams);
				FastBufferWriter val = ((NetworkBehaviour)this).__beginSendServerRpc(3110475807u, val2, (RpcDelivery)0);
				BytePacker.WriteValueBitPacked(val, jogador);
				((NetworkBehaviour)this).__endSendServerRpc(ref val, 3110475807u, val2, (RpcDelivery)0);
			}
			if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1 || (!networkManager.IsServer && !networkManager.IsHost))
			{
				return;
			}
			((NetworkBehaviour)this).__rpc_exec_stage = (__RpcExecStage)0;
			DinguAltar instancia = DinguAltar.Instancia;
			if ((Object)(object)instancia == (Object)null || Time.time < proximaVolta)
			{
				return;
			}
			proximaVolta = Time.time + 2f;
			BotaoClientRpc();
			if (!instancia.PontoDeVolta(out var pos))
			{
				Plugin.Log.LogInfo((object)"[Dingu] botão do altar: sem NavMesh perto do altar, não dá para voltar");
				return;
			}
			if (esperaItem != null)
			{
				((MonoBehaviour)this).StopCoroutine(esperaItem);
				esperaItem = null;
			}
			if ((Object)(object)heldItem != (Object)null)
			{
				LargarDoServidor("botão do altar: cai onde ele estava", ((Component)this).transform.position + Vector3.up * 0.3f);
			}
			caido = false;
			tempoCaido = 0f;
			tempoDesdeLevantou = 0f;
			Parar();
			porta = null;
			Teletransportar(pos, fora: true, "botão do altar");
			if (jogador >= 0 && jogador < Jogadores.Length && Vivo(Jogadores[jogador]))
			{
				DefinirGuia(Jogadores[jogador], "apertou o botão do altar", Aviso.Nenhum);
			}
			ficar = true;
			EnviarEstado(Aviso.Voltou);
		}

		[ClientRpc]
		public void BotaoClientRpc()
		{
			//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)
			{
				if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1 && (networkManager.IsServer || networkManager.IsHost))
				{
					ClientRpcParams val2 = default(ClientRpcParams);
					FastBufferWriter val = ((NetworkBehaviour)this).__beginSendClientRpc(619188021u, val2, (RpcDelivery)0);
					((NetworkBehaviour)this).__endSendClientRpc(ref val, 619188021u, val2, (RpcDelivery)0);
				}
				if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsClient || networkManager.IsHost))
				{
					((NetworkBehaviour)this).__rpc_exec_stage = (__RpcExecStage)0;
					DinguAltar.Instancia?.Afundar();
				}
			}
		}

		[ServerRpc(RequireOwnership = false)]
		public void DarItemServerRpc(NetworkObjectReference itemRef, int jogador)
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Invalid comparison between Unknown and I4
			//IL_00b4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00be: 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_008c: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e9: 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 != 1 && (networkManager.IsClient || networkManager.IsHost))
			{
				ServerRpcParams val2 = default(ServerRpcParams);
				FastBufferWriter val = ((NetworkBehaviour)this).__beginSendServerRpc(2909918767u, val2, (RpcDelivery)0);
				((FastBufferWriter)(ref val)).WriteValueSafe<NetworkObjectReference>(ref itemRef, default(ForNetworkSerializable));
				BytePacker.WriteValueBitPacked(val, jogador);
				((NetworkBehaviour)this).__endSendServerRpc(ref val, 2909918767u, val2, (RpcDelivery)0);
			}
			if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1 || (!networkManager.IsServer && !networkManager.IsHost))
			{
				return;
			}
			((NetworkBehaviour)this).__rpc_exec_stage = (__RpcExecStage)0;
			NetworkObject val3 = default(NetworkObject);
			if (!((NetworkObjectReference)(ref itemRef)).TryGet(ref val3, (NetworkManager)null))
			{
				return;
			}
			GrabbableObject component = ((Component)val3).GetComponent<GrabbableObject>();
			if ((Object)(object)component == (Object)null)
			{
				return;
			}
			if (jogador >= 0 && jogador < Jogadores.Length && Vivo(Jogadores[jogador]))
			{
				DefinirGuia(Jogadores[jogador], "deu um item", Aviso.Nenhum);
			}
			if (Plugin.ItemBloqueado(component))
			{
				Plugin.Log.LogInfo((object)("[Dingu] recusou " + component.itemProperties?.itemName + " (Blocked items)"));
				EnviarEstado(Aviso.Recusou);
				return;
			}
			if ((Object)(object)heldItem != (Object)null || caido)
			{
				Plugin.Log.LogInfo((object)("[Dingu] não pegou " + component.itemProperties?.itemName + " (boca cheia ou de costas)"));
				return;
			}
			if (esperaItem != null)
			{
				((MonoBehaviour)this).StopCoroutine(esperaItem);
			}
			esperaItem = ((MonoBehaviour)this).StartCoroutine(PegarQuandoSolto(component));
		}

		private IEnumerator PegarQuandoSolto(GrabbableObject item)
		{
			float t = 0f;
			while ((Object)(object)item != (Object)null && (item.isHeld || item.isPocketed) && t < 1.5f)
			{
				t += Time.deltaTime;
				yield return null;
			}
			esperaItem = null;
			if ((Object)(object)item == (Object)null || item.isHeld || item.isPocketed || item.isHeldByEnemy || item.deactivated || (Object)(object)heldItem != (Object)null || base.isEnemyDead)
			{
				Plugin.Log.LogInfo((object)$"[Dingu] não deu para pegar o item (segurado={item?.isHeld}, inimigo={item?.isHeldByEnemy})");
			}
			else
			{
				PegarItemClientRpc(NetworkObjectReference.op_Implicit(((NetworkBehaviour)item).NetworkObject));
			}
		}

		[ClientRpc]
		public void PegarItemClientRpc(NetworkObjectReference itemRef)
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Invalid comparison between Unknown and I4
			//IL_00a7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b1: Invalid comparison between Unknown and I4
			//IL_005f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0068: Unknown result type (might be due to invalid IL or missing references)
			//IL_006d: Unknown result type (might be due to invalid IL or missing references)
			//IL_007d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0083: Unknown result type (might be due to invalid IL or missing references)
			//IL_0097: Unknown result type (might be due to invalid IL or missing references)
			//IL_00dc: Unknown result type (might be due to invalid IL or missing references)
			//IL_015f: Unknown result type (might be due to invalid IL or missing references)
			//IL_016f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0135: 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 != 1 && (networkManager.IsServer || networkManager.IsHost))
			{
				ClientRpcParams val2 = default(ClientRpcParams);
				FastBufferWriter val = ((NetworkBehaviour)this).__beginSendClientRpc(4052548779u, val2, (RpcDelivery)0);
				((FastBufferWriter)(ref val)).WriteValueSafe<NetworkObjectReference>(ref itemRef, default(ForNetworkSerializable));
				((NetworkBehaviour)this).__endSendClientRpc(ref val, 4052548779u, val2, (RpcDelivery)0);
			}
			if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1 || (!networkManager.IsClient && !networkManager.IsHost))
			{
				return;
			}
			((NetworkBehaviour)this).__rpc_exec_stage = (__RpcExecStage)0;
			NetworkObject val3 = default(NetworkObject);
			if (!((NetworkObjectReference)(ref itemRef)).TryGet(ref val3, (NetworkManager)null))
			{
				return;
			}
			GrabbableObject component = ((Component)val3).GetComponent<GrabbableObject>();
			if (!((Object)(object)component == (Object)null) && !((Object)(object)heldItem == (Object)(object)component) && !((Object)(object)ancora == (Object)null))
			{
				if ((Object)(object)heldItem != (Object)null)
				{
					LargarLocal(((Component)heldItem).transform.position, base.isInsidePlayerShip, levarAte: false);
				}
				heldItem = component;
				itemPodiaInimigos = component.grabbableToEnemies;
				ancora.localPosition = Vector3.zero;
				ancora.localRotation = Quaternion.identity;
				ancoraVirada = false;
				ajustarAncora = 2;
				component.parentObject = ancora;
				component.hasHitGround = false;
				component.isHeldByEnemy = true;
				component.grabbableToEnemies = false;
				if (!(component is ExtensionLadderItem))
				{
					component.GrabItemFromEnemy((EnemyAI)(object)this);
				}
				component.isInFactory = !base.isOutside;
				itemNaNave = component.isInShipRoom;
				component.EnablePhysics(true);
				if ((Object)(object)base.creatureAnimator != (Object)null)
				{
					base.creatureAnimator.SetTrigger(pPegar);
				}
				Tocar(base.creatureSFX, "mandibula", Plugin.effectsVolume.Value);
				if (((NetworkBehaviour)this).IsServer)
				{
					Plugin.Log.LogInfo((object)$"[Dingu] pegou {component.itemProperties?.itemName} (peso {component.itemProperties?.weight:F2}, duas mãos {component.itemProperties?.twoHanded})");
				}
			}
		}

		[ServerRpc(RequireOwnership = false)]
		public void LargarServerRpc(int jogador)
		{
			//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)
			NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
			if (networkManager == null || !networkManager.IsListening)
			{
				return;
			}
			if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1 && (networkManager.IsClient || networkManager.IsHost))
			{
				ServerRpcParams val2 = default(ServerRpcParams);
				FastBufferWriter val = ((NetworkBehaviour)this).__beginSendServerRpc(349993206u, val2, (RpcDelivery)0);
				BytePacker.WriteValueBitPacked(val, jogador);
				((NetworkBehaviour)this).__endSendServerRpc(ref val, 349993206u, val2, (RpcDelivery)0);
			}
			if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost))
			{
				((NetworkBehaviour)this).__rpc_exec_stage = (__RpcExecStage)0;
				if (!((Object)(object)heldItem == (Object)null) && !((Object)(object)guia == (Object)null) && Array.IndexOf(Jogadores, guia) == jogador)
				{
					LargarDoServidor("o guia pediu");
				}
			}
		}

		private void LargarDoServidor(string motivo, Vector3? ponto = null, bool naNaveForcado = false)
		{
			//IL_0065: 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_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_004d: 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_005c: Unknown result type (might be due to invalid IL or missing references)
			//IL_006a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0071: 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_008c: Unknown result type (might be due to invalid IL or missing references)
			//IL_007b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0091: 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_009b: Unknown result type (might be due to invalid IL or missing references)
			//IL_00cc: Unknown result type (might be due to invalid IL or missing references)
			//IL_00fc: Unknown result type (might be due to invalid IL or missing references)
			//IL_0106: Unknown result type (might be due to invalid IL or missing references)
			//IL_010b: Unknown result type (might be due to invalid IL or missing references)
			if (!((Object)(object)heldItem == (Object)null))
			{
				bool flag = naNaveForcado || base.isInsidePlayerShip;
				Vector3 val = (Vector3)(((??)ponto) ?? (((Component)this).transform.position + ((Component)this).transform.forward * 0.9f + Vector3.up * 0.5f));
				Vector3 itemFloorPosition = heldItem.GetItemFloorPosition(val + (ponto.HasValue ? (Vector3.up * 0.5f) : Vector3.zero));
				Plugin.Log.LogInfo((object)string.Format("[Dingu] larga {0} ({1}) em {2} {3}", heldItem.itemProperties?.itemName, motivo, itemFloorPosition, flag ? "na nave" : ""));
				NetworkObject networkObject = ((NetworkBehaviour)heldItem).NetworkObject;
				LargarLocal(itemFloorPosition, flag, naNaveForcado);
				LargarItemClientRpc(NetworkObjectReference.op_Implicit(networkObject), itemFloorPosition, flag, naNaveForcado);
			}
		}

		[ClientRpc]
		public void LargarItemClientRpc(NetworkObjectReference itemRef, Vector3 chao, bool naNave, bool levarAte)
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Invalid comparison between Unknown and I4
			//IL_00ea: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f4: 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_00a5: 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_00c0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00da: Unknown result type (might be due to invalid IL or missing references)
			//IL_011f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0158: 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 != 1 && (networkManager.IsServer || networkManager.IsHost))
			{
				ClientRpcParams val2 = default(ClientRpcParams);
				FastBufferWriter val = ((NetworkBehaviour)this).__beginSendClientRpc(2842701974u, val2, (RpcDelivery)0);
				((FastBufferWriter)(ref val)).WriteValueSafe<NetworkObjectReference>(ref itemRef, default(ForNetworkSerializable));
				((FastBufferWriter)(ref val)).WriteValueSafe(ref chao);
				((FastBufferWriter)(ref val)).WriteValueSafe<bool>(ref naNave, default(ForPrimitives));
				((FastBufferWriter)(ref val)).WriteValueSafe<bool>(ref levarAte, default(ForPrimitives));
				((NetworkBehaviour)this).__endSendClientRpc(ref val, 2842701974u, val2, (RpcDelivery)0);
			}
			if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsClient || networkManager.IsHost))
			{
				((NetworkBehaviour)this).__rpc_exec_stage = (__RpcExecStage)0;
				NetworkObject val3 = default(NetworkObject);
				if (((NetworkObjectReference)(ref itemRef)).TryGet(ref val3, (NetworkManager)null) && !((Object)(object)heldItem == (Object)null) && !((Object)(object)((Component)heldItem).gameObject != (Object)(object)((Component)val3).gameObject))
				{
					LargarLocal(chao, naNave, levarAte);
				}
			}
		}

		private void LargarLocal(Vector3 chao, bool naNave, bool levarAte)
		{
			//IL_0036: Unknown result type (might be due to invalid IL or missing references)
			//IL_0037: Unknown result type (might be due to invalid IL or missing references)
			//IL_0041: Unknown result type (might be due to invalid IL or missing references)
			//IL_0046: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b8: Unknown result type (might be due to invalid IL or missing references)
			//IL_00bd: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ce: 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)
			GrabbableObject val = heldItem;
			heldItem = null;
			ajustarAncora = 0;
			if ((Object)(object)val == (Object)null)
			{
				return;
			}
			try
			{
				StartOfRound instance = StartOfRound.Instance;
				val.parentObject = null;
				if (levarAte)
				{
					((Component)val).transform.position = chao + Vector3.up * 0.3f;
				}
				((Component)val).transform.SetParent(naNave ? instance.elevatorTransform : instance.propsContainer, true);
				EnemyAI.SetItemInElevatorNonPlayer(naNave, naNave, val);
				val.EnablePhysics(true);
				val.isHeldByEnemy = false;
				val.grabbableToEnemies = itemPodiaInimigos;
				val.fallTime = 0f;
				val.hasHitGround = false;
				val.startFallingPosition = ((Component)val).transform.parent.InverseTransformPoint(((Component)val).transform.position);
				val.targetFloorPosition = ((Component)val).transform.parent.InverseTransformPoint(chao);
				val.floorYRot = -1;
				if (!(val is ExtensionLadderItem))
				{
					val.DiscardItemFromEnemy();
				}
				if ((Object)(object)base.creatureAnimator != (Object)null && !levarAte)
				{
					base.creatureAnimator.SetTrigger(pEntregar);
				}
				if (!levarAte)
				{
					Tocar(base.creatureSFX, "mandibula", Plugin.effectsVolume.Value);
				}
			}
			catch (Exception ex)
			{
				Plugin.Log.LogError((object)("[Dingu] largar: " + ex));
			}
		}

		private void SoltarPorqueTiraram()
		{
			GrabbableObject val = heldItem;
			heldItem = null;
			ajustarAncora = 0;
			if (!((Object)(object)val == (Object)null))
			{
				val.isHeldByEnemy = false;
				val.grabbableToEnemies = itemPodiaInimigos;
				if (!(val is ExtensionLadderItem))
				{
					val.DiscardItemFromEnemy();
				}
				if (((NetworkBehaviour)this).IsServer)
				{
					Plugin.Log.LogInfo((object)("[Dingu] alguém pegou " + val.itemProperties?.itemName + " da boca dele"));
				}
			}
		}

		private void AjustarAncora()
		{
			//IL_0020: Unknown result type (might be due to invalid IL or missing references)
			//IL_010b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0117: Unknown result type (might be due to invalid IL or missing references)
			//IL_011c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0121: Unknown result type (might be due to invalid IL or missing references)
			//IL_0128: Unknown result type (might be due to invalid IL or missing references)
			//IL_0140: Unknown result type (might be due to invalid IL or missing references)
			//IL_014a: 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_0078: 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)
			//IL_0066: Unknown result type (might be due to invalid IL or missing references)
			//IL_0180: Unknown result type (might be due to invalid IL or missing references)
			//IL_0185: Unknown result type (might be due to invalid IL or missing references)
			//IL_0186: Unknown result type (might be due to invalid IL or missing references)
			//IL_0165: Unknown result type (might be due to invalid IL or missing references)
			//IL_016f: Unknown result type (might be due to invalid IL or missing references)
			//IL_00bb: Unknown result type (might be due to invalid IL or missing references)
			//IL_00cd: Unknown result type (might be due to invalid IL or missing references)
			if ((Object)(object)heldItem == (Object)null || caido)
			{
				return;
			}
			bool flag = false;
			Bounds b = default(Bounds);
			Renderer[] componentsInChildren = ((Component)heldItem).GetComponentsInChildren<Renderer>();
			foreach (Renderer val in componentsInChildren)
			{
				if (val.enabled && (val is MeshRenderer || val is SkinnedMeshRenderer))
				{
					if (!flag)
					{
						b = val.bounds;
						flag = true;
					}
					else
					{
						((Bounds)(ref b)).Encapsulate(val.bounds);
					}
				}
			}
			if (!flag)
			{
				return;
			}
			if (!ancoraVirada && Ext(((Component)this).transform.forward) > 0.7f && Ext(((Component)this).transform.forward) > Ext(((Component)this).transform.right))
			{
				ancoraVirada = true;
				ancora.Rotate(0f, 90f, 0f, (Space)0);
				ajustarAncora = 2;
				return;
			}
			Vector3 val2 = itemHolder.position - ((Bounds)(ref b)).center;
			float num = ((Component)this).transform.position.y + 0.03f;
			if (((Bounds)(ref b)).min.y + val2.y < num)
			{
				val2.y += num - (((Bounds)(ref b)).min.y + val2.y);
			}
			Transform obj = ancora;
			obj.position += val2;
			float Ext(Vector3 eixo)
			{
				//IL_0000: 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_001c: 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_0039: Unknown result type (might be due to invalid IL or missing references)
				//IL_004a: Unknown result type (might be due to invalid IL or missing references)
				return Mathf.Abs(eixo.x) * ((Bounds)(ref b)).size.x + Mathf.Abs(eixo.y) * ((Bounds)(ref b)).size.y + Mathf.Abs(eixo.z) * ((Bounds)(ref b)).size.z;
			}
		}

		private EntranceTeleport PortaMaisProxima(Vector3 pos, bool ladoDentro)
		{
			//IL_0083: 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)
			if (portas == null || portas.Length == 0 || Array.Exists(portas, (EntranceTeleport x) => (Object)(object)x == (Object)null))
			{
				portas = Object.FindObjectsOfType<EntranceTeleport>();
			}
			EntranceTeleport result = null;
			float num = float.MaxValue;
			EntranceTeleport[] array = portas;
			foreach (EntranceTeleport val in array)
			{
				if (!((Object)(object)val == (Object)null) && !((Object)(object)val.entrancePoint == (Object)null) && val.isEntranceToBuilding != ladoDentro)
				{
					float num3 = Vector3.Distance(pos, val.entrancePoint.position);
					if (num3 < num)
					{
						num = num3;
						result = val;
					}
				}
			}
			return result;
		}

		protected override void __initializeVariables()
		{
			((EnemyAI)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
			//IL_0061: Unknown result type (might be due to invalid IL or missing references)
			//IL_0070: Expected O, but got Unknown
			//IL_007d: Unknown result type (might be due to invalid IL or missing references)
			//IL_008c: Expected O, but got Unknown
			//IL_0099: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a8: Expected O, but got Unknown
			//IL_00b5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c4: Expected O, but got Unknown
			//IL_00d1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e0: Expected O, but got Unknown
			//IL_00ed: Unknown result type (might be due to invalid IL or missing references)
			//IL_00fc: Expected O, but got Unknown
			//IL_0109: Unknown result type (might be due to invalid IL or missing references)
			//IL_0118: Expected O, but got Unknown
			//IL_0125: Unknown result type (might be due to invalid IL or missing references)
			//IL_0134: Expected O, but got Unknown
			//IL_0141: Unknown result type (might be due to invalid IL or missing references)
			//IL_0150: Expected O, but got Unknown
			//IL_015d: Unknown result type (might be due to invalid IL or missing references)
			//IL_016c: Expected O, but got Unknown
			//IL_0179: Unknown result type (might be due to invalid IL or missing references)
			//IL_0188: Expected O, but got Unknown
			((NetworkBehaviour)this).__registerRpc(3829323817u, new RpcReceiveHandler(__rpc_handler_3829323817), "FalarClientRpc");
			((NetworkBehaviour)this).__registerRpc(859708793u, new RpcReceiveHandler(__rpc_handler_859708793), "TeleportarClientRpc");
			((NetworkBehaviour)this).__registerRpc(3598552982u, new RpcReceiveHandler(__rpc_handler_3598552982), "LevantarServerRpc");
			((NetworkBehaviour)this).__registerRpc(1503529281u, new RpcReceiveHandler(__rpc_handler_1503529281), "EstadoClientRpc");
			((NetworkBehaviour)this).__registerRpc(3519646207u, new RpcReceiveHandler(__rpc_handler_3519646207), "PedirEstadoServerRpc");
			((NetworkBehaviour)this).__registerRpc(629906691u, new RpcReceiveHandler(__rpc_handler_629906691), "GuiarServerRpc");
			((NetworkBehaviour)this).__registerRpc(1432441955u, new RpcReceiveHandler(__rpc_handler_1432441955), "FicarServerRpc");
			((NetworkBehaviour)this).__registerRpc(1867461261u, new RpcReceiveHandler(__rpc_handler_1867461261), "ChamarServerRpc");
			((NetworkBehaviour)this).__registerRpc(3110475807u, new RpcReceiveHandler(__rpc_handler_3110475807), "VoltarAoAltarServerRpc");
			((NetworkBehaviour)this).__registerRpc(619188021u, new RpcReceiveHandler(__rpc_handler_619188021), "BotaoClientRpc");
			((NetworkBehaviour)this).__registerRpc(2909918767u, new RpcReceiveHandler(__rpc_handler_2909918767), "DarItemServerRpc");
			((NetworkBehaviour)this).__registerRpc(4052548779u, new RpcReceiveHandler(__rpc_handler_4052548779), "PegarItemClientRpc");
			((NetworkBehaviour)this).__registerRpc(349993206u, new RpcReceiveHandler(__rpc_handler_349993206), "LargarServerRpc");
			((NetworkBehaviour)this).__registerRpc(2842701974u, new RpcReceiveHandler(__rpc_handler_2842701974), "LargarItemClientRpc");
			((EnemyAI)this).__initializeRpcs();
		}

		private static void __rpc_handler_3829323817(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams)
		{
			//IL_0023: Unknown result type (might be due to invalid IL or missing references)
			//IL_003c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0042: Unknown result type (might be due to invalid IL or missing references)
			//IL_0051: Unknown result type (might be due to invalid IL or missing references)
			//IL_006f: Unknown result type (might be due to invalid IL or missing references)
			NetworkManager networkManager = target.NetworkManager;
			if (networkManager != null && networkManager.IsListening)
			{
				int fala = default(int);
				ByteUnpacker.ReadValueBitPacked(reader, ref fala);
				bool sermao = default(bool);
				((FastBufferReader)(ref reader)).ReadValueSafe<bool>(ref sermao, default(ForPrimitives));
				target.__rpc_exec_stage = (__RpcExecStage)1;
				((DinguAI)(object)target).FalarClientRpc(fala, sermao);
				target.__rpc_exec_stage = (__RpcExecStage)0;
			}
		}

		private static void __rpc_handler_859708793(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams)
		{
			//IL_003c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0042: Unknown result type (might be due to invalid IL or missing references)
			//IL_0051: Unknown result type (might be due to invalid IL or missing references)
			//IL_005c: Unknown result type (might be due to invalid IL or missing references)
			//IL_006f: Unknown result type (might be due to invalid IL or missing references)
			NetworkManager networkManager = target.NetworkManager;
			if (networkManager != null && networkManager.IsListening)
			{
				Vector3 pos = default(Vector3);
				((FastBufferReader)(ref reader)).ReadValueSafe(ref pos);
				bool fora = default(bool);
				((FastBufferReader)(ref reader)).ReadValueSafe<bool>(ref fora, default(ForPrimitives));
				target.__rpc_exec_stage = (__RpcExecStage)1;
				((DinguAI)(object)target).TeleportarClientRpc(pos, fora);
				target.__rpc_exec_stage = (__RpcExecStage)0;
			}
		}

		private static void __rpc_handler_3598552982(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 jogador = default(int);
				ByteUnpacker.ReadValueBitPacked(reader, ref jogador);
				target.__rpc_exec_stage = (__RpcExecStage)1;
				((DinguAI)(object)target).LevantarServerRpc(jogador);
				target.__rpc_exec_stage = (__RpcExecStage)0;
			}
		}

		private static void __rpc_handler_1503529281(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams)
		{
			//IL_0023: Unknown result type (might be due to invalid IL or missing references)
			//IL_003c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0042: Unknown result type (might be due to invalid IL or missing references)
			//IL_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_0066: Unknown result type (might be due to invalid IL or missing references)
			//IL_0079: 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)
			NetworkManager networkManager = target.NetworkManager;
			if (networkManager != null && networkManager.IsListening)
			{
				int jogadorGuia = default(int);
				ByteUnpacker.ReadValueBitPacked(reader, ref jogadorGuia);
				bool ficando = default(bool);
				((FastBufferReader)(ref reader)).ReadValueSafe<bool>(ref ficando, default(ForPrimitives));
				bool deCostas = default(bool);
				((FastBufferReader)(ref reader)).ReadValueSafe<bool>(ref deCostas, default(ForPrimitives));
				int aviso = default(int);
				ByteUnpacker.ReadValueBitPacked(reader, ref aviso);
				target.__rpc_exec_stage = (__RpcExecStage)1;
				((DinguAI)(object)target).EstadoClientRpc(jogadorGuia, ficando, deCostas, aviso);
				target.__rpc_exec_stage = (__RpcExecStage)0;
			}
		}

		private static void __rpc_handler_3519646207(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;
				((DinguAI)(object)target).PedirEstadoServerRpc();
				target.__rpc_exec_stage = (__RpcExecStage)0;
			}
		}

		private static void __rpc_handler_629906691(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 jogador = default(int);
				ByteUnpacker.ReadValueBitPacked(reader, ref jogador);
				target.__rpc_exec_stage = (__RpcExecStage)1;
				((DinguAI)(object)target).GuiarServerRpc(jogador);
				target.__rpc_exec_stage = (__RpcExecStage)0;
			}
		}

		private static void __rpc_handler_1432441955(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams)
		{
			//IL_0023: Unknown result type (might be due to invalid IL or missing references)
			//IL_003c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0042: Unknown result type (might be due to invalid IL or missing references)
			//IL_0051: Unknown result type (might be due to invalid IL or missing references)
			//IL_006f: Unknown result type (might be due to invalid IL or missing references)
			NetworkManager networkManager = target.NetworkManager;
			if (networkManager != null && networkManager.IsListening)
			{
				int jogador = default(int);
				ByteUnpacker.ReadValueBitPacked(reader, ref jogador);
				bool ficando = default(bool);
				((FastBufferReader)(ref reader)).ReadValueSafe<bool>(ref ficando, default(ForPrimitives));
				target.__rpc_exec_stage = (__RpcExecStage)1;
				((DinguAI)(object)target).FicarServerRpc(jogador, ficando);
				target.__rpc_exec_stage = (__RpcExecStage)0;
			}
		}

		private static void __rpc_handler_1867461261(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 jogador = default(int);
				ByteUnpacker.ReadValueBitPacked(reader, ref jogador);
				target.__rpc_exec_stage = (__RpcExecStage)1;
				((DinguAI)(object)target).ChamarServerRpc(jogador);
				target.__rpc_exec_stage = (__RpcExecStage)0;
			}
		}

		private static void __rpc_handler_3110475807(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 jogador = default(int);
				ByteUnpacker.ReadValueBitPacked(reader, ref jogador);
				target.__rpc_exec_stage = (__RpcExecStage)1;
				((DinguAI)(object)target).VoltarAoAltarServerRpc(jogador);
				target.__rpc_exec_stage = (__RpcExecStage)0;
			}
		}

		private static void __rpc_handler_619188021(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;
				((DinguAI)(object)target).BotaoClientRpc();
				target.__rpc_exec_stage = (__RpcExecStage)0;
			}
		}

		private static void __rpc_handler_2909918767(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_0051: Unknown result type (might be due to invalid IL or missing references)
			//IL_005c: Unknown result type (might be due to invalid IL or missing references)
			//IL_006f: Unknown result type (might be due to invalid IL or missing references)
			NetworkManager networkManager = target.NetworkManager;
			if (networkManager != null && networkManager.IsListening)
			{
				NetworkObjectReference itemRef = default(NetworkObjectReference);
				((FastBufferReader)(ref reader)).ReadValueSafe<NetworkObjectReference>(ref itemRef, default(ForNetworkSerializable));
				int jogador = default(int);
				ByteUnpacker.ReadValueBitPacked(reader, ref jogador);
				target.__rpc_exec_stage = (__RpcExecStage)1;
				((DinguAI)(object)target).DarItemServerRpc(itemRef, jogador);
				target.__rpc_exec_stage = (__RpcExecStage)0;
			}
		}

		private static void __rpc_handler_4052548779(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 itemRef = default(NetworkObjectReference);
				((FastBufferReader)(ref reader)).ReadValueSafe<NetworkObjectReference>(ref itemRef, default(ForNetworkSerializable));
				target.__rpc_exec_stage = (__RpcExecStage)1;
				((DinguAI)(object)target).PegarItemClientRpc(itemRef);
				target.__rpc_exec_stage = (__RpcExecStage)0;
			}
		}

		private static void __rpc_handler_349993206(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 jogador = default(int);
				ByteUnpacker.ReadValueBitPacked(reader, ref jogador);
				target.__rpc_exec_stage = (__RpcExecStage)1;
				((DinguAI)(object)target).LargarServerRpc(jogador);
				target.__rpc_exec_stage = (__RpcExecStage)0;
			}
		}

		private static void __rpc_handler_2842701974(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_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_0072: Unknown result type (might be due to invalid IL or missing references)
			//IL_0078: 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_0092: 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_00ad: Unknown result type (might be due to invalid IL or missing references)
			NetworkManager networkManager = target.NetworkManager;
			if (networkManager != null && networkManager.IsListening)
			{
				NetworkObjectReference itemRef = default(NetworkObjectReference);
				((FastBufferReader)(ref reader)).ReadValueSafe<NetworkObjectReference>(ref itemRef, default(ForNetworkSerializable));
				Vector3 chao = default(Vector3);
				((FastBufferReader)(ref reader)).ReadValueSafe(ref chao);
				bool naNave = default(bool);
				((FastBufferReader)(ref reader)).ReadValueSafe<bool>(ref naNave, default(ForPrimitives));
				bool levarAte = default(bool);
				((FastBufferReader)(ref reader)).ReadValueSafe<bool>(ref levarAte, default(ForPrimitives));
				target.__rpc_exec_stage = (__RpcExecStage)1;
				((DinguAI)(object)target).LargarItemClientRpc(itemRef, chao, naNave, levarAte);
				target.__rpc_exec_stage = (__RpcExecStage)0;
			}
		}

		protected internal override string __getTypeName()
		{
			return "DinguAI";
		}
	}
	public class DinguAltar : MonoBehaviour
	{
		public const string DicaBotao = "Call Dingu back to his altar : [E]";

		public static DinguAltar Instancia;

		private GameObject dormindo;

		private Transform botao;

		private Transform cabeca;

		private AudioSource somBotao;

		private InteractTrigger gatilho;

		private Vector3 cabecaRepouso;

		private float aperto;

		private AudioSource ronco;

		private Transform topo;

		private AutoParentToShip ap;

		private float timer;

		private float proximaTentativa;

		private bool avisouSemNavMesh;

		private void Start()
		{
			//IL_00b8: Unknown result type (might be due to invalid IL or missing references)
			//IL_00bd: Unknown result type (might be due to invalid IL or missing references)
			Transform obj = ((Component)this).transform.Find("Visual/DinguDormindo");
			dormindo = ((obj != null) ? ((Component)obj).gameObject : null);
			ronco = (((Object)(object)dormindo != (Object)null) ? dormindo.GetComponent<AudioSource>() : null);
			topo = ((Component)this).transform.Find("Topo");
			ap = ((Component)this).GetComponent<AutoParentToShip>();
			botao = ((Component)this).transform.Find("Botao");
			if ((Object)(object)botao != (Object)null)
			{
				cabeca = botao.Find("Cabeca");
				if ((Object)(object)cabeca != (Object)null)
				{
					cabecaRepouso = cabeca.localPosition;
				}
				somBotao = ((Component)botao).GetComponent<AudioSource>();
				gatilho = ((Component)botao).GetComponent<InteractTrigger>();
				if ((Object)(object)gatilho != (Object)null)
				{
					((UnityEvent<PlayerControllerB>)(object)gatilho.onInteract).AddListener((UnityAction<PlayerControllerB>)Apertou);
				}
			}
			Instancia = this;
		}

		private void OnDestroy()
		{
			if ((Object)(object)Instancia == (Object)(object)this)
			{
				Instancia = null;
			}
		}

		private void Apertou(PlayerControllerB p)
		{
			DinguAI current = DinguAI.Current;
			if ((Object)(object)current == (Object)null)
			{
				Afundar();
				HUDManager instance = HUDManager.Instance;
				if (instance != null)
				{
					instance.DisplayTip("Dingu", "Dingu is asleep on his altar.", false, false, "LC_Tip1");
				}
			}
			else
			{
				int num = Array.IndexOf(StartOfRound.Instance.allPlayerScripts, p);
				if (num >= 0)
				{
					current.VoltarAoAltarServerRpc(num);
				}
			}
		}

		public void Afundar()
		{
			aperto = 0.35f;
			AudioClip val = Plugin.Som("sino");
			if ((Object)(object)somBotao != (Object)null && (Object)(object)val != (Object)null && Plugin.effectsVolume.Value > 0f)
			{
				somBotao.pitch = 1.25f;
				somBotao.PlayOneShot(val, Plugin.effectsVolume.Value);
				WalkieTalkie.TransmitOneShotAudio(somBotao, val, Plugin.effectsVolume.Value);
			}
		}

		public bool PontoDeVolta(out Vector3 pos)
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_0028: Unknown result type (might be due to invalid IL or missing references)
			//IL_0033: Unknown result type (might be due to invalid IL or missing references)
			//IL_0038: 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_003d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0067: 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_006c: Unknown result type (might be due to invalid IL or missing references)
			//IL_007b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0080: Unknown result type (might be due to invalid IL or missing references)
			//IL_0086: 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_00b8: 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_00bd: 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_00ce: 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_00fe: 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)
			pos = default(Vector3);
			Vector3 val = (((Object)(object)botao != (Object)null) ? (botao.position - ((Component)this).transform.position) : ((Component)this).transform.forward);
			val.y = 0f;
			val = ((((Vector3)(ref val)).sqrMagnitude > 0.0001f) ? ((Vector3)(ref val)).normalized : ((Component)this).transform.forward);
			Vector3[] array = (Vector3[])(object)new Vector3[2]
			{
				((Component)this).transform.position + val * 1.2f,
				((Object)(object)topo != (Object)null) ? topo.position : ((Component)this).transform.position
			};
			NavMeshHit val3 = default(NavMeshHit);
			foreach (Vector3 val2 in array)
			{
				float[] array2 = new float[3] { 1f, 2.5f, 6f };
				foreach (float num in array2)
				{
					if (NavMesh.SamplePosition(val2, ref val3, num, -1))
					{
						pos = ((NavMeshHit)(ref val3)).position;
						return true;
					}
				}
			}
			return false;
		}

		private void Update()
		{
			//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_0073: Unknown result type (might be due to invalid IL or missing references)
			//IL_0078: Unknown result type (might be due to invalid IL or missing r