Decompiled source of BotFriends v1.3.1

BotFriends.dll

Decompiled 3 weeks ago
using System;
using System.Collections;
using System.Collections.Concurrent;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using System.Threading;
using BepInEx;
using BepInEx.Configuration;
using BepInEx.Logging;
using HarmonyLib;
using Microsoft.CodeAnalysis;
using UnityEngine;
using UnityEngine.AI;
using UnityEngine.SceneManagement;

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

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

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

		public NullableContextAttribute(byte P_0)
		{
			Flag = P_0;
		}
	}
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	[AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)]
	internal sealed class RefSafetyRulesAttribute : Attribute
	{
		public readonly int Version;

		public RefSafetyRulesAttribute(int P_0)
		{
			Version = P_0;
		}
	}
}
namespace Empress.StupidBots
{
	internal class BotChatterAgent : MonoBehaviour
	{
		public enum BotState
		{
			Idle,
			Moving,
			Carrying,
			Ragdoll
		}

		private NavMeshAgent _agent;

		private Rigidbody _rb;

		private AudioSource _src;

		private readonly List<PhysGrabObject> _buf = new List<PhysGrabObject>();

		private float _lastLocalSpeak;

		private bool _lastCarrying;

		private string _lastCarriedName;

		public BotState State { get; private set; }

		public bool IsCarrying { get; private set; }

		public string CarriedLabel { get; private set; }

		private void Awake()
		{
			_agent = ((Component)this).GetComponent<NavMeshAgent>();
			_rb = ((Component)this).GetComponent<Rigidbody>();
			_src = ((Component)this).GetComponent<AudioSource>();
			if (!Object.op_Implicit((Object)(object)_src))
			{
				_src = ((Component)this).gameObject.AddComponent<AudioSource>();
			}
			_src.spatialBlend = 1f;
			_src.rolloffMode = (AudioRolloffMode)0;
			_src.minDistance = 2f;
			_src.maxDistance = 18f;
		}

		private void OnEnable()
		{
			BotChatterManager.Register(this);
		}

		private void OnDisable()
		{
			BotChatterManager.Unregister(this);
		}

		private void Update()
		{
			UpdateState();
		}

		private void UpdateState()
		{
			//IL_002b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0030: Unknown result type (might be due to invalid IL or missing references)
			bool flag = false;
			if (Object.op_Implicit((Object)(object)_agent) && ((Behaviour)_agent).enabled)
			{
				Vector3 velocity = _agent.velocity;
				flag = ((Vector3)(ref velocity)).sqrMagnitude > 0.04f;
			}
			bool flag2 = false;
			if (Object.op_Implicit((Object)(object)_rb))
			{
				flag2 = !_rb.isKinematic && !((Behaviour)_agent).enabled;
			}
			DetectCarry(out bool carrying, out string label);
			IsCarrying = carrying;
			CarriedLabel = label;
			if (flag2)
			{
				State = BotState.Ragdoll;
			}
			else if (carrying)
			{
				State = BotState.Carrying;
			}
			else if (flag)
			{
				State = BotState.Moving;
			}
			else
			{
				State = BotState.Idle;
			}
		}

		private void DetectCarry(out bool carrying, out string label)
		{
			//IL_006f: Unknown result type (might be due to invalid IL or missing references)
			//IL_007a: Unknown result type (might be due to invalid IL or missing references)
			//IL_007f: 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)
			carrying = false;
			label = "";
			_buf.Clear();
			((Component)this).GetComponentsInChildren<PhysGrabObject>(true, _buf);
			PhysGrabObject val = null;
			float num = float.PositiveInfinity;
			for (int i = 0; i < _buf.Count; i++)
			{
				PhysGrabObject val2 = _buf[i];
				if (!Object.op_Implicit((Object)(object)val2))
				{
					continue;
				}
				Transform transform = ((Component)val2).transform;
				if (!((Object)(object)transform == (Object)(object)((Component)this).transform))
				{
					Vector3 val3 = transform.position - ((Component)this).transform.position;
					float sqrMagnitude = ((Vector3)(ref val3)).sqrMagnitude;
					if (sqrMagnitude < num)
					{
						num = sqrMagnitude;
						val = val2;
					}
				}
			}
			if (Object.op_Implicit((Object)(object)val))
			{
				carrying = true;
				label = ((Object)((Component)val).gameObject).name;
			}
		}

		internal void PlayClip(DecTalkSynth.Clip clip, float volume)
		{
			if (Object.op_Implicit((Object)(object)_src))
			{
				AudioClip val = AudioClip.Create("BotChat", clip.Samples.Length / clip.Channels, clip.Channels, clip.SampleRate, false);
				val.SetData(clip.Samples, 0);
				_src.Stop();
				_src.clip = val;
				_src.loop = false;
				_src.volume = Mathf.Clamp01(volume);
				_src.Play();
			}
		}

		internal bool TickLocal(float now, bool canSpeak)
		{
			if (!canSpeak)
			{
				return false;
			}
			if (now < _lastLocalSpeak)
			{
				return false;
			}
			bool flag = false;
			if (IsCarrying && !_lastCarrying)
			{
				flag = true;
			}
			_lastCarrying = IsCarrying;
			if (!flag)
			{
				return false;
			}
			string text = (IsCarrying ? "Moving with package." : "Moving.");
			if (BotFriendsChatterPlugin.UseDECtalk.Value)
			{
				DecTalkSynth.Enqueue(this, text);
				_lastLocalSpeak = now + BotFriendsChatterPlugin.SelfCooldown.Value;
				return true;
			}
			return false;
		}
	}
	internal class BotRagdoll : MonoBehaviour
	{
		[CompilerGenerated]
		private sealed class <EnableAgent>d__14 : IEnumerator<object>, IEnumerator, IDisposable
		{
			private int <>1__state;

			private object <>2__current;

			public BotRagdoll <>4__this;

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

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

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

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

			private bool MoveNext()
			{
				//IL_0061: Unknown result type (might be due to invalid IL or missing references)
				switch (<>1__state)
				{
				default:
					return false;
				case 0:
					<>1__state = -1;
					<>2__current = null;
					<>1__state = 1;
					return true;
				case 1:
					<>1__state = -1;
					if (Object.op_Implicit((Object)(object)<>4__this._agent))
					{
						<>4__this._agent.Warp(((Component)<>4__this).transform.position);
					}
					if (Object.op_Implicit((Object)(object)<>4__this._agent))
					{
						((Behaviour)<>4__this._agent).enabled = true;
					}
					if (Object.op_Implicit((Object)(object)<>4__this._brain))
					{
						<>4__this._brain.SetExternalControl(on: false);
					}
					if (Object.op_Implicit((Object)(object)<>4__this._carrier) && <>4__this._carrierPrevEnabled)
					{
						((Behaviour)<>4__this._carrier).enabled = true;
					}
					return false;
				}
			}

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

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

		private bool _feature;

		private float _thresholdSqr;

		private float _recover;

		private Rigidbody _rb;

		private NavMeshAgent _agent;

		private StupidBotBrain _brain;

		private StupidBotCarrier _carrier;

		private bool _active;

		private bool _carrierPrevEnabled;

		private float _timer;

		internal void Init(NavMeshAgent agent, StupidBotBrain brain, StupidBotCarrier carrier, Rigidbody rb, bool enabled, float threshold, float recover)
		{
			_agent = agent;
			_brain = brain;
			_carrier = carrier;
			_rb = rb;
			_feature = enabled;
			_thresholdSqr = Mathf.Max(0.01f, threshold * threshold);
			_recover = Mathf.Max(0.5f, recover);
		}

		private void OnCollisionEnter(Collision c)
		{
			//IL_0019: Unknown result type (might be due to invalid IL or missing references)
			//IL_001e: Unknown result type (might be due to invalid IL or missing references)
			if (_feature && !_active)
			{
				Vector3 relativeVelocity = c.relativeVelocity;
				if (((Vector3)(ref relativeVelocity)).sqrMagnitude >= _thresholdSqr)
				{
					Activate();
				}
			}
		}

		private void Activate()
		{
			_active = true;
			_timer = 0f;
			if (Object.op_Implicit((Object)(object)_carrier))
			{
				_carrierPrevEnabled = ((Behaviour)_carrier).enabled;
				((Behaviour)_carrier).enabled = false;
			}
			if (Object.op_Implicit((Object)(object)_agent))
			{
				((Behaviour)_agent).enabled = false;
			}
			if (Object.op_Implicit((Object)(object)_brain))
			{
				_brain.SetExternalControl(on: true);
			}
			if (Object.op_Implicit((Object)(object)_rb))
			{
				_rb.isKinematic = false;
			}
		}

		private void Deactivate()
		{
			//IL_001e: Unknown result type (might be due to invalid IL or missing references)
			//IL_002f: Unknown result type (might be due to invalid IL or missing references)
			_active = false;
			if (Object.op_Implicit((Object)(object)_rb))
			{
				_rb.velocity = Vector3.zero;
				_rb.angularVelocity = Vector3.zero;
				_rb.isKinematic = true;
			}
			if (Object.op_Implicit((Object)(object)_agent))
			{
				((MonoBehaviour)this).StartCoroutine(EnableAgent());
				return;
			}
			if (Object.op_Implicit((Object)(object)_brain))
			{
				_brain.SetExternalControl(on: false);
			}
			if (Object.op_Implicit((Object)(object)_carrier) && _carrierPrevEnabled)
			{
				((Behaviour)_carrier).enabled = true;
			}
		}

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

		private void Update()
		{
			//IL_0054: Unknown result type (might be due to invalid IL or missing references)
			//IL_0059: Unknown result type (might be due to invalid IL or missing references)
			if (!_feature || !_active)
			{
				return;
			}
			_timer += Time.deltaTime;
			if (!(_timer < _recover) && Object.op_Implicit((Object)(object)_rb))
			{
				Vector3 velocity = _rb.velocity;
				if (((Vector3)(ref velocity)).sqrMagnitude < 0.16f)
				{
					Deactivate();
				}
			}
		}

		internal void SetEnabled(bool on)
		{
			_feature = on;
		}

		internal void Reconfigure(float threshold, float recover)
		{
			_thresholdSqr = Mathf.Max(0.01f, threshold * threshold);
			_recover = Mathf.Max(0.5f, recover);
		}
	}
	internal static class BotUtils
	{
		private static readonly Dictionary<int, StupidBotCarrier> Claims = new Dictionary<int, StupidBotCarrier>();

		private static readonly Dictionary<int, float> IgnoreUntil = new Dictionary<int, float>();

		internal static List<PhysGrabObject> FindNearbyValuables(Vector3 position, float range)
		{
			//IL_0009: Unknown result type (might be due to invalid IL or missing references)
			//IL_000d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0013: Unknown result type (might be due to invalid IL or missing references)
			List<PhysGrabObject> list = new List<PhysGrabObject>();
			try
			{
				List<PhysGrabObject> list2 = SemiFunc.PhysGrabObjectGetAllWithinRange(range, position, true, default(LayerMask), (PhysGrabObject)null);
				for (int i = 0; i < list2.Count; i++)
				{
					PhysGrabObject val = list2[i];
					if (Object.op_Implicit((Object)(object)val) && Object.op_Implicit((Object)(object)((Component)val).GetComponent<ValuableObject>()))
					{
						list.Add(val);
					}
				}
			}
			catch
			{
			}
			return list;
		}

		internal static bool TryClaim(PhysGrabObject pgo, StupidBotCarrier owner)
		{
			if (!Object.op_Implicit((Object)(object)pgo))
			{
				return false;
			}
			int instanceID = ((Object)pgo).GetInstanceID();
			if (IsIgnored(pgo))
			{
				return false;
			}
			if (Claims.TryGetValue(instanceID, out StupidBotCarrier value) && Object.op_Implicit((Object)(object)value) && (Object)(object)value != (Object)(object)owner)
			{
				return false;
			}
			Claims[instanceID] = owner;
			return true;
		}

		internal static void ReleaseClaim(PhysGrabObject pgo, StupidBotCarrier owner)
		{
			if (Object.op_Implicit((Object)(object)pgo))
			{
				int instanceID = ((Object)pgo).GetInstanceID();
				if (Claims.TryGetValue(instanceID, out StupidBotCarrier value) && (Object)(object)value == (Object)(object)owner)
				{
					Claims.Remove(instanceID);
				}
			}
		}

		internal static bool IsClaimedByOther(PhysGrabObject pgo, StupidBotCarrier owner)
		{
			if (!Object.op_Implicit((Object)(object)pgo))
			{
				return false;
			}
			int instanceID = ((Object)pgo).GetInstanceID();
			if (!Claims.TryGetValue(instanceID, out StupidBotCarrier value))
			{
				return false;
			}
			return Object.op_Implicit((Object)(object)value) && (Object)(object)value != (Object)(object)owner;
		}

		internal static void IgnoreFor(PhysGrabObject pgo, float seconds)
		{
			if (Object.op_Implicit((Object)(object)pgo))
			{
				int instanceID = ((Object)pgo).GetInstanceID();
				IgnoreUntil[instanceID] = Time.time + Mathf.Max(0f, seconds);
				Claims.Remove(instanceID);
			}
		}

		internal static bool IsIgnored(PhysGrabObject pgo)
		{
			if (!Object.op_Implicit((Object)(object)pgo))
			{
				return false;
			}
			int instanceID = ((Object)pgo).GetInstanceID();
			if (!IgnoreUntil.TryGetValue(instanceID, out var value))
			{
				return false;
			}
			return value > Time.time;
		}

		internal static Vector3 WithY(this Vector3 v, float y)
		{
			//IL_0009: Unknown result type (might be due to invalid IL or missing references)
			//IL_000a: Unknown result type (might be due to invalid IL or missing references)
			//IL_000d: Unknown result type (might be due to invalid IL or missing references)
			v.y = y;
			return v;
		}
	}
	internal static class DecTalkSynth
	{
		internal struct Clip
		{
			public float[] Samples;

			public int Channels;

			public int SampleRate;
		}

		private struct Job
		{
			public BotChatterAgent Agent;

			public string Text;
		}

		private struct Ready
		{
			public BotChatterAgent Agent;

			public Clip Clip;
		}

		private static class Wav
		{
			internal static bool TryLoad(string path, out float[] data, out int channels, out int sampleRate)
			{
				data = Array.Empty<float>();
				channels = 0;
				sampleRate = 0;
				using FileStream input = File.OpenRead(path);
				using BinaryReader binaryReader = new BinaryReader(input);
				if (new string(binaryReader.ReadChars(4)) != "RIFF")
				{
					return false;
				}
				binaryReader.ReadInt32();
				if (new string(binaryReader.ReadChars(4)) != "WAVE")
				{
					return false;
				}
				short num = 1;
				short num2 = 16;
				bool flag = false;
				while (binaryReader.BaseStream.Position < binaryReader.BaseStream.Length)
				{
					string text = new string(binaryReader.ReadChars(4));
					int num3 = binaryReader.ReadInt32();
					if (text == "fmt ")
					{
						flag = true;
						num = binaryReader.ReadInt16();
						channels = binaryReader.ReadInt16();
						sampleRate = binaryReader.ReadInt32();
						binaryReader.ReadInt32();
						binaryReader.ReadInt16();
						num2 = binaryReader.ReadInt16();
						int num4 = num3 - 16;
						if (num4 > 0)
						{
							binaryReader.ReadBytes(num4);
						}
						continue;
					}
					if (text == "data")
					{
						if (!flag)
						{
							return false;
						}
						byte[] array = binaryReader.ReadBytes(num3);
						if (num != 1)
						{
							return false;
						}
						switch (num2)
						{
						case 16:
						{
							int num6 = array.Length / 2;
							float[] array3 = new float[num6];
							int num7 = 0;
							int num8 = 0;
							while (num7 < num6)
							{
								short num9 = (short)(array[num8] | (array[num8 + 1] << 8));
								array3[num7] = (float)num9 / 32768f;
								num7++;
								num8 += 2;
							}
							data = array3;
							return true;
						}
						case 8:
						{
							int num5 = array.Length;
							float[] array2 = new float[num5];
							for (int i = 0; i < num5; i++)
							{
								array2[i] = (float)(array[i] - 128) / 128f;
							}
							data = array2;
							return true;
						}
						default:
							return false;
						}
					}
					binaryReader.ReadBytes(num3);
				}
				return false;
			}

			internal static float[] ResampleLinear(float[] interleaved, int channels, int srcRate, int dstRate)
			{
				if (srcRate == dstRate)
				{
					return interleaved;
				}
				int num = interleaved.Length / channels;
				double num2 = (double)dstRate / (double)srcRate;
				int num3 = Mathf.Max(1, (int)Math.Round((double)num * num2));
				float[] array = new float[num3 * channels];
				for (int i = 0; i < channels; i++)
				{
					for (int j = 0; j < num3; j++)
					{
						double num4 = (double)j / num2;
						int num5 = (int)Math.Floor(num4);
						int num6 = Math.Min(num - 1, num5 + 1);
						double num7 = num4 - (double)num5;
						float num8 = interleaved[num5 * channels + i];
						float num9 = interleaved[num6 * channels + i];
						array[j * channels + i] = (float)((double)num8 + (double)(num9 - num8) * num7);
					}
				}
				return array;
			}
		}

		private static string _exe;

		private static string _voice;

		private static int _rate;

		private static string _dict;

		private static readonly ConcurrentQueue<Job> _jobs = new ConcurrentQueue<Job>();

		private static readonly ConcurrentQueue<Ready> _ready = new ConcurrentQueue<Ready>();

		private static readonly Dictionary<string, Clip> _cache = new Dictionary<string, Clip>(64);

		private static readonly LinkedList<string> _lru = new LinkedList<string>();

		private static Thread _worker;

		private static volatile bool _run;

		internal static void Configure(string exe, string voice, int sampleRate, string dictionaryPath)
		{
			_exe = ResolvePath(exe);
			_voice = (string.IsNullOrWhiteSpace(voice) ? "Paul" : voice.Trim());
			_rate = Mathf.Clamp(sampleRate, 8000, 48000);
			_dict = (string.IsNullOrWhiteSpace(dictionaryPath) ? "" : ResolvePath(dictionaryPath.Trim()));
			StartWorker();
		}

		internal static void Enqueue(BotChatterAgent who, string text)
		{
			if (!((Object)(object)who == (Object)null) && !string.IsNullOrWhiteSpace(text))
			{
				_jobs.Enqueue(new Job
				{
					Agent = who,
					Text = text
				});
				StartWorker();
			}
		}

		internal static bool TryDequeueReady(out BotChatterAgent who, out Clip clip)
		{
			who = null;
			clip = default(Clip);
			if (_ready.TryDequeue(out var result))
			{
				who = result.Agent;
				clip = result.Clip;
				return true;
			}
			return false;
		}

		internal static bool TrySynthesize(string text, out Clip clip)
		{
			clip = default(Clip);
			if (!TrySynthesizeInternal(text, out clip))
			{
				return false;
			}
			return true;
		}

		private static void StartWorker()
		{
			if (_worker == null || !_worker.IsAlive)
			{
				_run = true;
				_worker = new Thread(WorkerLoop)
				{
					IsBackground = true,
					Name = "DecTalkSynthWorker"
				};
				_worker.Start();
			}
		}

		private static void WorkerLoop()
		{
			while (_run)
			{
				Clip clip;
				if (!_jobs.TryDequeue(out var result))
				{
					Thread.Sleep(1);
				}
				else if (!((Object)(object)result.Agent == (Object)null) && TrySynthesizeInternal(result.Text, out clip))
				{
					_ready.Enqueue(new Ready
					{
						Agent = result.Agent,
						Clip = clip
					});
				}
			}
		}

		private static bool TrySynthesizeInternal(string text, out Clip clip)
		{
			clip = default(Clip);
			if (string.IsNullOrEmpty(_exe) || !File.Exists(_exe))
			{
				return false;
			}
			if (TryGetCache(text, out clip))
			{
				return true;
			}
			try
			{
				string text2 = "[:name " + _voice + "] " + text;
				string text3 = Path.GetDirectoryName(_exe) ?? Directory.GetCurrentDirectory();
				string text4 = Path.Combine(text3, "out");
				Directory.CreateDirectory(text4);
				string text5 = DateTime.UtcNow.Ticks.ToString("x");
				string text6 = Path.Combine(text4, "dt_" + text5 + ".wav");
				string text7 = "";
				if (!string.IsNullOrEmpty(_dict) && File.Exists(_dict))
				{
					text7 = "-d \"" + _dict + "\" ";
				}
				ProcessStartInfo processStartInfo = new ProcessStartInfo();
				processStartInfo.FileName = _exe;
				processStartInfo.Arguments = "-w \"" + text6 + "\" " + text7 + "\"" + text2 + "\"";
				processStartInfo.WorkingDirectory = text3;
				processStartInfo.CreateNoWindow = true;
				processStartInfo.UseShellExecute = false;
				processStartInfo.RedirectStandardOutput = true;
				processStartInfo.RedirectStandardError = true;
				ProcessStartInfo startInfo = processStartInfo;
				using (Process process = Process.Start(startInfo))
				{
					process?.WaitForExit(15000);
				}
				if (!File.Exists(text6))
				{
					return false;
				}
				if (!Wav.TryLoad(text6, out float[] data, out int channels, out int sampleRate))
				{
					return false;
				}
				if (sampleRate != _rate)
				{
					data = Wav.ResampleLinear(data, channels, sampleRate, _rate);
					sampleRate = _rate;
				}
				clip = new Clip
				{
					Samples = data,
					Channels = channels,
					SampleRate = sampleRate
				};
				try
				{
					File.Delete(text6);
				}
				catch
				{
				}
				PutCache(text, clip);
				return true;
			}
			catch
			{
				return false;
			}
		}

		private static bool TryGetCache(string text, out Clip clip)
		{
			if (_cache.TryGetValue(text, out clip))
			{
				LinkedListNode<string> linkedListNode = _lru.Find(text);
				if (linkedListNode != null)
				{
					_lru.Remove(linkedListNode);
					_lru.AddFirst(linkedListNode);
				}
				return true;
			}
			return false;
		}

		private static void PutCache(string text, Clip clip)
		{
			if (_cache.ContainsKey(text))
			{
				return;
			}
			_cache[text] = clip;
			_lru.AddFirst(text);
			if (_lru.Count > 64)
			{
				LinkedListNode<string> last = _lru.Last;
				if (last != null)
				{
					_cache.Remove(last.Value);
					_lru.RemoveLast();
				}
			}
		}

		private static string ResolvePath(string p)
		{
			if (Path.IsPathRooted(p))
			{
				return p;
			}
			string location = Assembly.GetExecutingAssembly().Location;
			string path = (string.IsNullOrEmpty(location) ? Directory.GetCurrentDirectory() : (Path.GetDirectoryName(location) ?? Directory.GetCurrentDirectory()));
			return Path.GetFullPath(Path.Combine(path, p));
		}
	}
	internal class StupidBotBrain : MonoBehaviour
	{
		internal struct Config
		{
			public bool FollowPlayer;

			public float WanderRadius;

			public float Speed;
		}

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

			private object <>2__current;

			public StupidBotBrain <>4__this;

			private float <start>5__1;

			private float <peak>5__2;

			private float <t>5__3;

			private float <up>5__4;

			private float <down>5__5;

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

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

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

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

			private bool MoveNext()
			{
				switch (<>1__state)
				{
				default:
					return false;
				case 0:
					<>1__state = -1;
					<>4__this._hopping = true;
					<start>5__1 = <>4__this._agent.baseOffset;
					<peak>5__2 = <start>5__1 + 0.6f;
					<t>5__3 = 0f;
					<up>5__4 = 0.15f;
					goto IL_00d7;
				case 1:
					<>1__state = -1;
					goto IL_00d7;
				case 2:
					{
						<>1__state = -1;
						break;
					}
					IL_00d7:
					if (<t>5__3 < <up>5__4)
					{
						<t>5__3 += Time.deltaTime;
						<>4__this._agent.baseOffset = Mathf.Lerp(<start>5__1, <peak>5__2, <t>5__3 / <up>5__4);
						<>2__current = null;
						<>1__state = 1;
						return true;
					}
					<t>5__3 = 0f;
					<down>5__5 = 0.2f;
					break;
				}
				if (<t>5__3 < <down>5__5)
				{
					<t>5__3 += Time.deltaTime;
					<>4__this._agent.baseOffset = Mathf.Lerp(<peak>5__2, <start>5__1, <t>5__3 / <down>5__5);
					<>2__current = null;
					<>1__state = 2;
					return true;
				}
				<>4__this._agent.baseOffset = <start>5__1;
				<>4__this._hopping = false;
				return false;
			}

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

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

		private const float FollowOrbitRadius = 12f;

		private Config _cfg;

		private NavMeshAgent? _agent;

		private Transform? _player;

		private Vector3 _homePos;

		private float _retargetTimer;

		private float _emoteTimer;

		private Vector3 _lastPos;

		private float _stuckTimer;

		private bool _hopping;

		private readonly List<Vector3> _globalTargets = new List<Vector3>();

		private bool _haveGlobal;

		internal bool ExternalControl { get; private set; }

		internal void SetExternalControl(bool on)
		{
			ExternalControl = on;
		}

		internal void Init(Config cfg)
		{
			_cfg = cfg;
		}

		private void Start()
		{
			//IL_0075: Unknown result type (might be due to invalid IL or missing references)
			//IL_007a: Unknown result type (might be due to invalid IL or missing references)
			//IL_00bc: 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_003b: Unknown result type (might be due to invalid IL or missing references)
			_agent = ((Component)this).GetComponent<NavMeshAgent>();
			if (Object.op_Implicit((Object)(object)_agent))
			{
				if (!_agent.isOnNavMesh)
				{
					TryPlaceOnNavMesh(_agent, ((Component)this).transform.position);
				}
				_agent.isStopped = false;
				_agent.updateRotation = true;
				_agent.autoBraking = true;
			}
			_homePos = ((Component)this).transform.position;
			TryGetPlayer(out _player);
			_retargetTimer = Random.Range(0.25f, 1.25f);
			_emoteTimer = Random.Range(2.5f, 7.5f);
			_lastPos = ((Component)this).transform.position;
			BuildGlobalTargets();
		}

		private void Update()
		{
			//IL_00b0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b6: Invalid comparison between Unknown and I4
			//IL_01c7: Unknown result type (might be due to invalid IL or missing references)
			//IL_01cc: Unknown result type (might be due to invalid IL or missing references)
			//IL_0250: Unknown result type (might be due to invalid IL or missing references)
			//IL_0256: Unknown result type (might be due to invalid IL or missing references)
			//IL_025b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0260: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ec: Unknown result type (might be due to invalid IL or missing references)
			//IL_01f1: Unknown result type (might be due to invalid IL or missing references)
			//IL_01f5: Unknown result type (might be due to invalid IL or missing references)
			//IL_01fa: Unknown result type (might be due to invalid IL or missing references)
			//IL_0211: Unknown result type (might be due to invalid IL or missing references)
			//IL_0213: Unknown result type (might be due to invalid IL or missing references)
			//IL_0218: Unknown result type (might be due to invalid IL or missing references)
			//IL_021d: Unknown result type (might be due to invalid IL or missing references)
			//IL_022b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0230: 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_0292: Unknown result type (might be due to invalid IL or missing references)
			//IL_0297: Unknown result type (might be due to invalid IL or missing references)
			//IL_02ee: Unknown result type (might be due to invalid IL or missing references)
			if (Object.op_Implicit((Object)(object)_agent) && ((Behaviour)_agent).enabled)
			{
				_agent.speed = _cfg.Speed;
			}
			if ((Object)(object)_player == (Object)null)
			{
				TryGetPlayer(out _player);
			}
			if (ExternalControl)
			{
				return;
			}
			_retargetTimer -= Time.deltaTime;
			bool flag = false;
			if (Object.op_Implicit((Object)(object)_agent) && _agent.isOnNavMesh)
			{
				bool flag2 = !_agent.hasPath || (int)_agent.pathStatus > 0;
				bool flag3 = _agent.hasPath && !_agent.pathPending && _agent.remainingDistance <= _agent.stoppingDistance + 0.1f;
				if (flag2 || flag3 || _retargetTimer <= 0f)
				{
					flag = true;
				}
			}
			else if (_retargetTimer <= 0f)
			{
				flag = true;
			}
			if (flag)
			{
				_retargetTimer = Random.Range(1.6f, 3.2f);
				PickNextDestination();
			}
			_emoteTimer -= Time.deltaTime;
			if (_emoteTimer <= 0f)
			{
				_emoteTimer = Random.Range(4f, 10f);
				TryHop();
			}
			Vector3 val;
			if (Object.op_Implicit((Object)(object)_agent) && _agent.hasPath)
			{
				val = _agent.velocity;
				if (((Vector3)(ref val)).sqrMagnitude > 0.01f)
				{
					val = _agent.velocity;
					Vector3 normalized = ((Vector3)(ref val)).normalized;
					if (((Vector3)(ref normalized)).sqrMagnitude > 0.001f)
					{
						Quaternion val2 = Quaternion.LookRotation(normalized, Vector3.up);
						((Component)this).transform.rotation = Quaternion.Slerp(((Component)this).transform.rotation, val2, Time.deltaTime * 5f);
					}
				}
			}
			val = ((Component)this).transform.position - _lastPos;
			float sqrMagnitude = ((Vector3)(ref val)).sqrMagnitude;
			_stuckTimer = ((sqrMagnitude < 0.0009f) ? (_stuckTimer + Time.deltaTime) : 0f);
			_lastPos = ((Component)this).transform.position;
			if (_stuckTimer > 1.5f && Object.op_Implicit((Object)(object)_agent) && _agent.isOnNavMesh)
			{
				_stuckTimer = 0f;
				_agent.ResetPath();
				_agent.Warp(((Component)this).transform.position);
			}
		}

		private void PickNextDestination()
		{
			//IL_0002: 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_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_00b9: Unknown result type (might be due to invalid IL or missing references)
			//IL_00be: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c8: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d7: 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_00ae: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b3: Unknown result type (might be due to invalid IL or missing references)
			//IL_005a: 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_0075: Unknown result type (might be due to invalid IL or missing references)
			//IL_007a: Unknown result type (might be due to invalid IL or missing references)
			//IL_007f: 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_0081: 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_0053: 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_0142: Unknown result type (might be due to invalid IL or missing references)
			//IL_0147: Unknown result type (might be due to invalid IL or missing references)
			//IL_014c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0101: Unknown result type (might be due to invalid IL or missing references)
			//IL_0195: Unknown result type (might be due to invalid IL or missing references)
			//IL_019c: Unknown result type (might be due to invalid IL or missing references)
			//IL_01a3: Unknown result type (might be due to invalid IL or missing references)
			//IL_01a8: Unknown result type (might be due to invalid IL or missing references)
			//IL_0130: Unknown result type (might be due to invalid IL or missing references)
			//IL_011d: Unknown result type (might be due to invalid IL or missing references)
			Vector3 homePos = _homePos;
			if (_cfg.FollowPlayer && Object.op_Implicit((Object)(object)_player))
			{
				Vector3 val = Random.insideUnitSphere;
				val.y = 0f;
				if (((Vector3)(ref val)).sqrMagnitude < 0.0001f)
				{
					val = Vector3.forward;
				}
				Vector3 val2 = _player.position + ((Vector3)(ref val)).normalized * Random.Range(2.5f, 12f);
				homePos = val2;
			}
			else if (_haveGlobal)
			{
				int index = Random.Range(0, _globalTargets.Count);
				homePos = _globalTargets[index];
			}
			else
			{
				homePos = _homePos + Random.insideUnitSphere.WithY(0f) * 25f;
			}
			if (Object.op_Implicit((Object)(object)_agent) && _agent.isOnNavMesh)
			{
				NavMeshHit val3 = default(NavMeshHit);
				if (NavMesh.SamplePosition(homePos, ref val3, 3f, -1))
				{
					_agent.SetDestination(((NavMeshHit)(ref val3)).position);
				}
				else
				{
					_agent.SetDestination(homePos);
				}
				return;
			}
			Vector3 val4 = homePos - ((Component)this).transform.position;
			val4.y = 0f;
			float num = Mathf.Min(_cfg.Speed * 0.5f * Time.deltaTime, ((Vector3)(ref val4)).magnitude);
			if (num > 0f)
			{
				Transform transform = ((Component)this).transform;
				transform.position += ((Vector3)(ref val4)).normalized * num;
			}
		}

		private void TryHop()
		{
			if (!((Object)(object)_agent == (Object)null) && !_hopping)
			{
				((MonoBehaviour)this).StartCoroutine(HopCR());
			}
		}

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

		private static bool TryGetPlayer(out Transform? player)
		{
			player = null;
			try
			{
				if (Object.op_Implicit((Object)(object)PlayerController.instance))
				{
					player = ((Component)PlayerController.instance).transform;
					return true;
				}
			}
			catch
			{
			}
			try
			{
				PlayerAvatar[] array = Object.FindObjectsOfType<PlayerAvatar>();
				if (array != null && array.Length != 0)
				{
					player = ((Component)array[0]).transform;
					return true;
				}
			}
			catch
			{
			}
			return false;
		}

		private static bool TryPlaceOnNavMesh(NavMeshAgent agent, Vector3 desired)
		{
			//IL_0001: 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_0016: Unknown result type (might be due to invalid IL or missing references)
			NavMeshHit val = default(NavMeshHit);
			if (NavMesh.SamplePosition(desired, ref val, 6f, -1))
			{
				return agent.Warp(((NavMeshHit)(ref val)).position);
			}
			return agent.Warp(desired);
		}

		private void BuildGlobalTargets()
		{
			//IL_00c0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c7: 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_00ee: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f0: Unknown result type (might be due to invalid IL or missing references)
			//IL_010d: 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_0065: 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)
			_globalTargets.Clear();
			try
			{
				if (Object.op_Implicit((Object)(object)LevelGenerator.Instance) && LevelGenerator.Instance.LevelPathPoints != null)
				{
					List<LevelPoint> levelPathPoints = LevelGenerator.Instance.LevelPathPoints;
					NavMeshHit val2 = default(NavMeshHit);
					for (int i = 0; i < levelPathPoints.Count; i++)
					{
						LevelPoint val = levelPathPoints[i];
						if (Object.op_Implicit((Object)(object)val))
						{
							Vector3 position = ((Component)val).transform.position;
							if (NavMesh.SamplePosition(position, ref val2, 3f, -1))
							{
								_globalTargets.Add(((NavMeshHit)(ref val2)).position);
							}
						}
					}
				}
			}
			catch
			{
			}
			if (_globalTargets.Count == 0)
			{
				try
				{
					NavMeshTriangulation val3 = NavMesh.CalculateTriangulation();
					Vector3[] vertices = val3.vertices;
					int num = Mathf.Max(1, vertices.Length / 64);
					NavMeshHit val5 = default(NavMeshHit);
					for (int j = 0; j < vertices.Length; j += num)
					{
						Vector3 val4 = vertices[j];
						if (NavMesh.SamplePosition(val4, ref val5, 3f, -1))
						{
							_globalTargets.Add(((NavMeshHit)(ref val5)).position);
						}
					}
				}
				catch
				{
				}
			}
			_haveGlobal = _globalTargets.Count > 0;
		}
	}
	internal class StupidBotCarrier : MonoBehaviour
	{
		internal struct Cfg
		{
			public float SearchRadius;

			public float ExtractorStopDistance;

			public float GentleDropTime;
		}

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

			private object <>2__current;

			public PhysGrabObject target;

			public StupidBotCarrier <>4__this;

			private float <preStop>5__1;

			private float <prevStop>5__2;

			private float <giveUp>5__3;

			private bool <blocked>5__4;

			private RaycastHit <hitInfo>5__5;

			private Vector3 <a>5__6;

			private Vector3 <b>5__7;

			private Transform <ht>5__8;

			private Vector3 <dir>5__9;

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

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

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

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

			private bool MoveNext()
			{
				//IL_057d: Unknown result type (might be due to invalid IL or missing references)
				//IL_0587: Expected O, but got Unknown
				//IL_060c: Unknown result type (might be due to invalid IL or missing references)
				//IL_0622: Unknown result type (might be due to invalid IL or missing references)
				//IL_033a: Unknown result type (might be due to invalid IL or missing references)
				//IL_0314: Unknown result type (might be due to invalid IL or missing references)
				//IL_0319: Unknown result type (might be due to invalid IL or missing references)
				//IL_0323: Unknown result type (might be due to invalid IL or missing references)
				//IL_0328: Unknown result type (might be due to invalid IL or missing references)
				//IL_033f: Unknown result type (might be due to invalid IL or missing references)
				//IL_0350: Unknown result type (might be due to invalid IL or missing references)
				//IL_0355: Unknown result type (might be due to invalid IL or missing references)
				//IL_035f: Unknown result type (might be due to invalid IL or missing references)
				//IL_0364: Unknown result type (might be due to invalid IL or missing references)
				//IL_0369: Unknown result type (might be due to invalid IL or missing references)
				//IL_036f: Unknown result type (might be due to invalid IL or missing references)
				//IL_0375: Unknown result type (might be due to invalid IL or missing references)
				//IL_04d7: Unknown result type (might be due to invalid IL or missing references)
				//IL_04e7: Unknown result type (might be due to invalid IL or missing references)
				//IL_04ec: Unknown result type (might be due to invalid IL or missing references)
				//IL_04f6: Unknown result type (might be due to invalid IL or missing references)
				//IL_04fb: Unknown result type (might be due to invalid IL or missing references)
				//IL_04ff: Unknown result type (might be due to invalid IL or missing references)
				//IL_0504: Unknown result type (might be due to invalid IL or missing references)
				//IL_052d: Unknown result type (might be due to invalid IL or missing references)
				//IL_0532: Unknown result type (might be due to invalid IL or missing references)
				//IL_0545: Unknown result type (might be due to invalid IL or missing references)
				//IL_054f: Unknown result type (might be due to invalid IL or missing references)
				//IL_0554: Unknown result type (might be due to invalid IL or missing references)
				//IL_055e: Unknown result type (might be due to invalid IL or missing references)
				//IL_0563: Unknown result type (might be due to invalid IL or missing references)
				switch (<>1__state)
				{
				default:
					return false;
				case 0:
					<>1__state = -1;
					<preStop>5__1 = 0.15f;
					<prevStop>5__2 = (Object.op_Implicit((Object)(object)<>4__this._agent) ? <>4__this._agent.stoppingDistance : 0f);
					if (Object.op_Implicit((Object)(object)<>4__this._agent))
					{
						<>4__this._agent.stoppingDistance = <preStop>5__1;
					}
					<giveUp>5__3 = 10f;
					goto IL_013d;
				case 1:
					<>1__state = -1;
					goto IL_013d;
				case 2:
					{
						<>1__state = -1;
						break;
					}
					IL_013d:
					if (<giveUp>5__3 > 0f && Object.op_Implicit((Object)(object)target) && Object.op_Implicit((Object)(object)<>4__this._agent) && <>4__this._agent.isOnNavMesh)
					{
						<giveUp>5__3 -= Time.deltaTime;
						if (BotUtils.IsClaimedByOther(target, <>4__this))
						{
							BotUtils.ReleaseClaim(target, <>4__this);
						}
						else if (!<>4__this.CanReachByHold(target) && !<>4__this.CanTouchTarget(target))
						{
							<>4__this.TryJumpAssist(target);
							<>2__current = null;
							<>1__state = 1;
							return true;
						}
					}
					if (Object.op_Implicit((Object)(object)<>4__this._agent))
					{
						<>4__this._agent.stoppingDistance = <prevStop>5__2;
					}
					if (!Object.op_Implicit((Object)(object)target))
					{
						<>4__this._busy = false;
						<>4__this._brain.SetExternalControl(on: false);
						return false;
					}
					if (!Object.op_Implicit((Object)(object)<>4__this._agent) || !<>4__this._agent.isOnNavMesh)
					{
						BotUtils.ReleaseClaim(target, <>4__this);
						<>4__this._busy = false;
						<>4__this._brain.SetExternalControl(on: false);
						return false;
					}
					if (SemiFunc.PhysGrabObjectIsGrabbed(target))
					{
						BotUtils.ReleaseClaim(target, <>4__this);
						<>4__this._busy = false;
						<>4__this._brain.SetExternalControl(on: false);
						return false;
					}
					if (!<>4__this.CanReachByHold(target) && !<>4__this.CanTouchTarget(target))
					{
						BotUtils.ReleaseClaim(target, <>4__this);
						<>4__this._busy = false;
						<>4__this._brain.SetExternalControl(on: false);
						return false;
					}
					<blocked>5__4 = false;
					<a>5__6 = (Object.op_Implicit((Object)(object)<>4__this._hold) ? <>4__this._hold.position : (((Component)<>4__this).transform.position + Vector3.up * 1.5f));
					<b>5__7 = ((Component)target).transform.position + Vector3.up * 0.1f;
					if (Physics.Linecast(<a>5__6, <b>5__7, ref <hitInfo>5__5, -1, (QueryTriggerInteraction)1))
					{
						<ht>5__8 = ((RaycastHit)(ref <hitInfo>5__5)).transform;
						if (Object.op_Implicit((Object)(object)<ht>5__8) && (Object)(object)<ht>5__8 != (Object)(object)((Component)target).transform && !<ht>5__8.IsChildOf(((Component)target).transform))
						{
							<blocked>5__4 = true;
						}
						<ht>5__8 = null;
					}
					if (<blocked>5__4 && (<>4__this.CanReachByHold(target) || <>4__this.CanTouchTarget(target)))
					{
						<blocked>5__4 = false;
					}
					if (<blocked>5__4)
					{
						BotUtils.ReleaseClaim(target, <>4__this);
						<>4__this._busy = false;
						<>4__this._brain.SetExternalControl(on: false);
						return false;
					}
					if (Object.op_Implicit((Object)(object)target.rb) && !target.rb.isKinematic && (<>4__this.CanReachByHold(target) || <>4__this.CanTouchTarget(target)))
					{
						Vector3 val = (((Component)target).transform.position - ((Component)<>4__this).transform.position).WithY(0f);
						<dir>5__9 = ((Vector3)(ref val)).normalized;
						if (((Vector3)(ref <dir>5__9)).sqrMagnitude < 0.0001f)
						{
							<dir>5__9 = ((Component)<>4__this).transform.forward;
						}
						try
						{
							target.rb.AddForce(<dir>5__9 * 1.25f + Vector3.down * 2f, (ForceMode)1);
						}
						catch
						{
						}
						<>2__current = (object)new WaitForSeconds(0.05f);
						<>1__state = 2;
						return true;
					}
					break;
				}
				<>4__this.DetachExternalLinks(target);
				<>4__this._carried = target;
				<>4__this._carriedRB = target.rb;
				try
				{
					((Component)<>4__this._carried).transform.SetParent((Transform)null, true);
					if (Object.op_Implicit((Object)(object)<>4__this._carriedRB))
					{
						<>4__this._carriedRB.velocity = Vector3.zero;
						<>4__this._carriedRB.angularVelocity = Vector3.zero;
						<>4__this._carriedRB.isKinematic = true;
					}
					target.OverrideKnockOutOfGrabDisable(2f);
				}
				catch
				{
				}
				<>4__this.SetCarryCollisionIgnore(ignore: true);
				if (Object.op_Implicit((Object)(object)<>4__this._agent))
				{
					<>4__this._savedStopDist = <>4__this._agent.stoppingDistance;
				}
				<>4__this._carryTimer = 0f;
				return false;
			}

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

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

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

			private object <>2__current;

			public StupidBotCarrier <>4__this;

			private Transform <tform>5__1;

			private Vector3 <start>5__2;

			private ExtractionPoint <ex>5__3;

			private Vector3 <fwd>5__4;

			private Vector3 <end>5__5;

			private float <t>5__6;

			private float <dur>5__7;

			private float <a>5__8;

			private Vector3 <aside>5__9;

			private NavMeshHit <hit>5__10;

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

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

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

			[DebuggerHidden]
			void IDisposable.Dispose()
			{
				<tform>5__1 = null;
				<ex>5__3 = null;
				<>1__state = -2;
			}

			private bool MoveNext()
			{
				//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_00a1: Unknown result type (might be due to invalid IL or missing references)
				//IL_0335: Unknown result type (might be due to invalid IL or missing references)
				//IL_00db: Unknown result type (might be due to invalid IL or missing references)
				//IL_00eb: Unknown result type (might be due to invalid IL or missing references)
				//IL_00f0: Unknown result type (might be due to invalid IL or missing references)
				//IL_00fa: Unknown result type (might be due to invalid IL or missing references)
				//IL_00ff: Unknown result type (might be due to invalid IL or missing references)
				//IL_0102: 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_0107: Unknown result type (might be due to invalid IL or missing references)
				//IL_013a: 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_014f: Unknown result type (might be due to invalid IL or missing references)
				//IL_0154: Unknown result type (might be due to invalid IL or missing references)
				//IL_015e: Unknown result type (might be due to invalid IL or missing references)
				//IL_0163: Unknown result type (might be due to invalid IL or missing references)
				//IL_0168: Unknown result type (might be due to invalid IL or missing references)
				//IL_012e: Unknown result type (might be due to invalid IL or missing references)
				//IL_0133: Unknown result type (might be due to invalid IL or missing references)
				//IL_01cf: Unknown result type (might be due to invalid IL or missing references)
				//IL_01d5: Unknown result type (might be due to invalid IL or missing references)
				//IL_01e0: Unknown result type (might be due to invalid IL or missing references)
				//IL_01f7: Unknown result type (might be due to invalid IL or missing references)
				//IL_01fc: Unknown result type (might be due to invalid IL or missing references)
				//IL_020d: Unknown result type (might be due to invalid IL or missing references)
				//IL_030a: Unknown result type (might be due to invalid IL or missing references)
				//IL_0314: Expected O, but got Unknown
				//IL_029f: Unknown result type (might be due to invalid IL or missing references)
				//IL_02a4: Unknown result type (might be due to invalid IL or missing references)
				//IL_02ae: Unknown result type (might be due to invalid IL or missing references)
				//IL_02b3: Unknown result type (might be due to invalid IL or missing references)
				//IL_02b6: Unknown result type (might be due to invalid IL or missing references)
				//IL_02c0: Unknown result type (might be due to invalid IL or missing references)
				//IL_02c5: Unknown result type (might be due to invalid IL or missing references)
				//IL_02ca: Unknown result type (might be due to invalid IL or missing references)
				//IL_02d0: Unknown result type (might be due to invalid IL or missing references)
				//IL_02fd: Unknown result type (might be due to invalid IL or missing references)
				Vector3 val2;
				switch (<>1__state)
				{
				default:
					return false;
				case 0:
				{
					<>1__state = -1;
					if (!Object.op_Implicit((Object)(object)<>4__this._carried))
					{
						<>4__this._dropping = false;
						return false;
					}
					<tform>5__1 = ((Component)<>4__this._carried).transform;
					try
					{
						<tform>5__1.SetParent((Transform)null, true);
					}
					catch
					{
					}
					<start>5__2 = <tform>5__1.position;
					<ex>5__3 = SemiFunc.ExtractionPointGetNearest(((Component)<>4__this).transform.position);
					Vector3 val;
					if (!Object.op_Implicit((Object)(object)<ex>5__3))
					{
						val = ((Component)<>4__this).transform.forward;
					}
					else
					{
						val2 = (((Component)<ex>5__3).transform.position - ((Component)<>4__this).transform.position).WithY(0f);
						val = ((Vector3)(ref val2)).normalized;
					}
					<fwd>5__4 = val;
					if (((Vector3)(ref <fwd>5__4)).sqrMagnitude < 0.0001f)
					{
						<fwd>5__4 = ((Component)<>4__this).transform.forward;
					}
					<end>5__5 = <start>5__2 + <fwd>5__4 * 0.6f + Vector3.down * 0.3f;
					<t>5__6 = 0f;
					<dur>5__7 = Mathf.Max(0.05f, <>4__this._cfg.GentleDropTime);
					goto IL_0230;
				}
				case 1:
					<>1__state = -1;
					goto IL_0230;
				case 2:
					{
						<>1__state = -1;
						<>4__this.HardReleaseAndSeparate(((Component)<>4__this).transform.position);
						<>4__this.FinalizeDropCommon();
						<>4__this._dropping = false;
						return false;
					}
					IL_0230:
					if (<t>5__6 < <dur>5__7 && Object.op_Implicit((Object)(object)<>4__this._carried))
					{
						<t>5__6 += Time.deltaTime;
						<a>5__8 = Mathf.Clamp01(<t>5__6 / <dur>5__7);
						<tform>5__1.position = Vector3.Lerp(<start>5__2, <end>5__5, <a>5__8);
						<tform>5__1.rotation = Quaternion.Slerp(<tform>5__1.rotation, Quaternion.identity, <a>5__8 * 0.5f);
						<>2__current = null;
						<>1__state = 1;
						return true;
					}
					<>4__this.ForceDropInternal(reenableCollision: false);
					if (Object.op_Implicit((Object)(object)<>4__this._agent) && <>4__this._agent.isOnNavMesh)
					{
						Vector3 position = ((Component)<>4__this).transform.position;
						val2 = Random.insideUnitSphere.WithY(0f);
						<aside>5__9 = position + ((Vector3)(ref val2)).normalized * 1.2f;
						if (NavMesh.SamplePosition(<aside>5__9, ref <hit>5__10, 2f, -1))
						{
							<>4__this._agent.SetDestination(((NavMeshHit)(ref <hit>5__10)).position);
						}
					}
					<>2__current = (object)new WaitForFixedUpdate();
					<>1__state = 2;
					return true;
				}
			}

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

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

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

			private object <>2__current;

			public Vector3 dir;

			public float forwardDist;

			public float height;

			public StupidBotCarrier <>4__this;

			private Vector3 <start>5__1;

			private Vector3 <end>5__2;

			private NavMeshHit <hit>5__3;

			private Vector3 <apex>5__4;

			private float <dur>5__5;

			private Vector3 <destCache>5__6;

			private Vector3 <holdPrev>5__7;

			private float <reachY>5__8;

			private float <reachZ>5__9;

			private float <t>5__10;

			private float <u>5__11;

			private Vector3 <p1>5__12;

			private Vector3 <p2>5__13;

			private Vector3 <p>5__14;

			private NavMeshHit <hit2>5__15;

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

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

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

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

			private bool MoveNext()
			{
				//IL_003b: Unknown result type (might be due to invalid IL or missing references)
				//IL_0040: Unknown result type (might be due to invalid IL or missing references)
				//IL_0047: 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_0058: 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_0062: 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_0095: 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_00a5: Unknown result type (might be due to invalid IL or missing references)
				//IL_00aa: Unknown result type (might be due to invalid IL or missing references)
				//IL_00b5: Unknown result type (might be due to invalid IL or missing references)
				//IL_00ba: Unknown result type (might be due to invalid IL or missing references)
				//IL_00bf: 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_008e: Unknown result type (might be due to invalid IL or missing references)
				//IL_0114: Unknown result type (might be due to invalid IL or missing references)
				//IL_012b: Unknown result type (might be due to invalid IL or missing references)
				//IL_0126: Unknown result type (might be due to invalid IL or missing references)
				//IL_0155: Unknown result type (might be due to invalid IL or missing references)
				//IL_0143: Unknown result type (might be due to invalid IL or missing references)
				//IL_0221: Unknown result type (might be due to invalid IL or missing references)
				//IL_0227: Unknown result type (might be due to invalid IL or missing references)
				//IL_0232: Unknown result type (might be due to invalid IL or missing references)
				//IL_0237: Unknown result type (might be due to invalid IL or missing references)
				//IL_023e: Unknown result type (might be due to invalid IL or missing references)
				//IL_0244: Unknown result type (might be due to invalid IL or missing references)
				//IL_024f: Unknown result type (might be due to invalid IL or missing references)
				//IL_0254: Unknown result type (might be due to invalid IL or missing references)
				//IL_025b: Unknown result type (might be due to invalid IL or missing references)
				//IL_0261: Unknown result type (might be due to invalid IL or missing references)
				//IL_026c: Unknown result type (might be due to invalid IL or missing references)
				//IL_0271: Unknown result type (might be due to invalid IL or missing references)
				//IL_015a: Unknown result type (might be due to invalid IL or missing references)
				//IL_02af: Unknown result type (might be due to invalid IL or missing references)
				//IL_0296: Unknown result type (might be due to invalid IL or missing references)
				//IL_01d9: Unknown result type (might be due to invalid IL or missing references)
				//IL_0321: Unknown result type (might be due to invalid IL or missing references)
				//IL_032d: Unknown result type (might be due to invalid IL or missing references)
				//IL_0388: Unknown result type (might be due to invalid IL or missing references)
				//IL_035a: Unknown result type (might be due to invalid IL or missing references)
				switch (<>1__state)
				{
				default:
					return false;
				case 0:
					<>1__state = -1;
					<>4__this._isJumping = true;
					<start>5__1 = ((Component)<>4__this).transform.position;
					<end>5__2 = <start>5__1 + dir * forwardDist;
					if (NavMesh.SamplePosition(<end>5__2, ref <hit>5__3, 2f, -1))
					{
						<end>5__2 = ((NavMeshHit)(ref <hit>5__3)).position;
					}
					<apex>5__4 = Vector3.Lerp(<start>5__1, <end>5__2, 0.5f) + Vector3.up * height;
					<dur>5__5 = Mathf.Lerp(0.3f, 0.6f, Mathf.InverseLerp(1f, 4.2f, height));
					<destCache>5__6 = ((Object.op_Implicit((Object)(object)<>4__this._agent) && <>4__this._agent.hasPath) ? <>4__this._agent.destination : <end>5__2);
					<holdPrev>5__7 = (Object.op_Implicit((Object)(object)<>4__this._hold) ? <>4__this._hold.localPosition : Vector3.zero);
					<reachY>5__8 = Mathf.Clamp(height * 0.75f, 0.5f, 3f);
					<reachZ>5__9 = 0.35f;
					if (Object.op_Implicit((Object)(object)<>4__this._hold))
					{
						<>4__this._hold.localPosition = new Vector3(<holdPrev>5__7.x, <holdPrev>5__7.y + <reachY>5__8, <holdPrev>5__7.z + <reachZ>5__9);
					}
					<t>5__10 = 0f;
					break;
				case 1:
					<>1__state = -1;
					break;
				}
				if (<t>5__10 < <dur>5__5)
				{
					<t>5__10 += Time.deltaTime;
					<u>5__11 = Mathf.Clamp01(<t>5__10 / <dur>5__5);
					<p1>5__12 = Vector3.Lerp(<start>5__1, <apex>5__4, <u>5__11);
					<p2>5__13 = Vector3.Lerp(<apex>5__4, <end>5__2, <u>5__11);
					<p>5__14 = Vector3.Lerp(<p1>5__12, <p2>5__13, <u>5__11);
					if (Object.op_Implicit((Object)(object)<>4__this._agent))
					{
						<>4__this._agent.Warp(<p>5__14);
					}
					else
					{
						((Component)<>4__this).transform.position = <p>5__14;
					}
					<>2__current = null;
					<>1__state = 1;
					return true;
				}
				if (Object.op_Implicit((Object)(object)<>4__this._agent) && <>4__this._agent.isOnNavMesh)
				{
					<>4__this._agent.Warp(<end>5__2);
					if (NavMesh.SamplePosition(<destCache>5__6, ref <hit2>5__15, 2.5f, -1))
					{
						<>4__this._agent.SetDestination(((NavMeshHit)(ref <hit2>5__15)).position);
					}
				}
				if (Object.op_Implicit((Object)(object)<>4__this._hold))
				{
					<>4__this._hold.localPosition = <holdPrev>5__7;
				}
				<>4__this._jumpCD = Time.time + 0.45f;
				<>4__this._isJumping = false;
				return false;
			}

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

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

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

			private object <>2__current;

			public float height;

			public StupidBotCarrier <>4__this;

			private Vector3 <holdPrev>5__1;

			private float <reachY>5__2;

			private float <up>5__3;

			private float <hang>5__4;

			private float <down>5__5;

			private float <t>5__6;

			private float <ht>5__7;

			private float <a>5__8;

			private float <a>5__9;

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

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

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

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

			private bool MoveNext()
			{
				//IL_006b: 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_0070: Unknown result type (might be due to invalid IL or missing references)
				//IL_0160: Unknown result type (might be due to invalid IL or missing references)
				//IL_01ff: Unknown result type (might be due to invalid IL or missing references)
				//IL_02ca: Unknown result type (might be due to invalid IL or missing references)
				//IL_0326: Unknown result type (might be due to invalid IL or missing references)
				switch (<>1__state)
				{
				default:
					return false;
				case 0:
					<>1__state = -1;
					<>4__this._isJumping = true;
					<holdPrev>5__1 = (Object.op_Implicit((Object)(object)<>4__this._hold) ? <>4__this._hold.localPosition : Vector3.zero);
					<reachY>5__2 = Mathf.Clamp(height, 0.8f, 3.6f);
					<up>5__3 = Mathf.Lerp(0.12f, 0.3f, Mathf.InverseLerp(0.8f, 3.6f, <reachY>5__2));
					<hang>5__4 = 0.12f;
					<down>5__5 = <up>5__3 * 1f;
					<t>5__6 = 0f;
					goto IL_0183;
				case 1:
					<>1__state = -1;
					goto IL_0183;
				case 2:
					<>1__state = -1;
					goto IL_0222;
				case 3:
					{
						<>1__state = -1;
						break;
					}
					IL_0222:
					if (<ht>5__7 < <hang>5__4)
					{
						<ht>5__7 += Time.deltaTime;
						if (Object.op_Implicit((Object)(object)<>4__this._hold))
						{
							<>4__this._hold.localPosition = new Vector3(<holdPrev>5__1.x, <holdPrev>5__1.y + <reachY>5__2, <holdPrev>5__1.z);
						}
						<>2__current = null;
						<>1__state = 2;
						return true;
					}
					<t>5__6 = 0f;
					break;
					IL_0183:
					if (<t>5__6 < <up>5__3)
					{
						<t>5__6 += Time.deltaTime;
						<a>5__8 = Mathf.Clamp01(<t>5__6 / <up>5__3);
						if (Object.op_Implicit((Object)(object)<>4__this._hold))
						{
							<>4__this._hold.localPosition = new Vector3(<holdPrev>5__1.x, <holdPrev>5__1.y + <reachY>5__2 * <a>5__8, <holdPrev>5__1.z);
						}
						<>2__current = null;
						<>1__state = 1;
						return true;
					}
					<ht>5__7 = 0f;
					goto IL_0222;
				}
				if (<t>5__6 < <down>5__5)
				{
					<t>5__6 += Time.deltaTime;
					<a>5__9 = 1f - Mathf.Clamp01(<t>5__6 / <down>5__5);
					if (Object.op_Implicit((Object)(object)<>4__this._hold))
					{
						<>4__this._hold.localPosition = new Vector3(<holdPrev>5__1.x, <holdPrev>5__1.y + <reachY>5__2 * <a>5__9, <holdPrev>5__1.z);
					}
					<>2__current = null;
					<>1__state = 3;
					return true;
				}
				if (Object.op_Implicit((Object)(object)<>4__this._hold))
				{
					<>4__this._hold.localPosition = <holdPrev>5__1;
				}
				<>4__this._jumpCD = Time.time + 0.25f;
				<>4__this._isJumping = false;
				return false;
			}

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

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

		private Cfg _cfg;

		private NavMeshAgent _agent = null;

		private Transform _hold = null;

		private StupidBotBrain _brain = null;

		private int _lastActivateId;

		private float _lastActivateTime;

		private Vector3 _truckDestination;

		private bool _truckCached;

		private PhysGrabObject _carried;

		private Rigidbody _carriedRB;

		private bool _busy;

		private bool _dropping;

		private float _retargetTimer;

		private float _savedStopDist;

		private Collider[] _myCols;

		private readonly List<Collider> _carriedCols = new List<Collider>();

		private readonly HashSet<int> _ignoreIds = new HashSet<int>();

		private float _activationGraceUntil;

		private float _carryTimer;

		private bool _isJumping;

		private float _jumpCD;

		private readonly Collider[] _overlap = (Collider[])(object)new Collider[32];

		private void OnDisable()
		{
			if (Object.op_Implicit((Object)(object)_carried))
			{
				ForceDrop(immediate: true);
			}
		}

		internal void Init(Cfg cfg, NavMeshAgent agent, Transform holdPoint, StupidBotBrain brain)
		{
			_myCols = ((Component)this).GetComponentsInChildren<Collider>(true);
			_cfg = cfg;
			_agent = agent;
			_hold = holdPoint;
			_brain = brain;
			_retargetTimer = Random.Range(0.25f, 0.75f);
			_activationGraceUntil = 0f;
			_carryTimer = 0f;
			_isJumping = false;
			_jumpCD = 0f;
		}

		private void Update()
		{
			//IL_025b: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ea: Unknown result type (might be due to invalid IL or missing references)
			//IL_01dc: Unknown result type (might be due to invalid IL or missing references)
			//IL_01e9: 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_0088: 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_00aa: Unknown result type (might be due to invalid IL or missing references)
			//IL_03d0: Unknown result type (might be due to invalid IL or missing references)
			//IL_03d5: Unknown result type (might be due to invalid IL or missing references)
			//IL_03d7: Unknown result type (might be due to invalid IL or missing references)
			//IL_0407: Unknown result type (might be due to invalid IL or missing references)
			//IL_03f4: Unknown result type (might be due to invalid IL or missing references)
			//IL_031e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0329: Unknown result type (might be due to invalid IL or missing references)
			//IL_032e: Unknown result type (might be due to invalid IL or missing references)
			if (Object.op_Implicit((Object)(object)_carried))
			{
				_brain.SetExternalControl(on: true);
				_carryTimer += Time.deltaTime;
				ExtractionPoint targetEP = null;
				if (TryResolveDeliveryTarget(out Vector3 goal, out targetEP))
				{
					if (Object.op_Implicit((Object)(object)_agent) && _agent.isOnNavMesh)
					{
						if (!_agent.hasPath || Vector3.SqrMagnitude(_agent.destination - goal) > 0.25f)
						{
							_agent.SetDestination(goal);
						}
						_agent.stoppingDistance = Mathf.Clamp(_cfg.ExtractorStopDistance * 0.5f, 0.2f, 1f);
					}
					float num = Vector3.Distance(((Component)this).transform.position, goal);
					if (!_dropping && num <= Mathf.Max(0.5f, _cfg.ExtractorStopDistance + 0.25f))
					{
						if (IsDeliveryDropAllowed(targetEP) || Time.time < _activationGraceUntil || _carryTimer > 12f)
						{
							_dropping = true;
							((MonoBehaviour)this).StartCoroutine(DropGently());
						}
						else if (Object.op_Implicit((Object)(object)targetEP))
						{
							TryActivateExtraction(targetEP);
						}
					}
				}
				if (Object.op_Implicit((Object)(object)_carried) && !_dropping)
				{
					Transform transform = ((Component)_carried).transform;
					if ((Object)(object)transform.parent != (Object)(object)_hold)
					{
						transform.SetParent(_hold, false);
					}
					transform.localPosition = Vector3.zero;
					transform.localRotation = Quaternion.identity;
				}
				return;
			}
			_carryTimer = 0f;
			if (_busy)
			{
				return;
			}
			_retargetTimer -= Time.deltaTime;
			if (_retargetTimer > 0f)
			{
				return;
			}
			_retargetTimer = Random.Range(0.9f, 1.4f);
			List<PhysGrabObject> list = BotUtils.FindNearbyValuables(((Component)this).transform.position, _cfg.SearchRadius);
			PhysGrabObject val = null;
			float num2 = float.PositiveInfinity;
			foreach (PhysGrabObject item in list)
			{
				if (Object.op_Implicit((Object)(object)item) && !SemiFunc.PhysGrabObjectIsGrabbed(item) && Object.op_Implicit((Object)(object)((Component)item).GetComponent<ValuableObject>()) && !_ignoreIds.Contains(((Object)item).GetInstanceID()) && !BotUtils.IsIgnored(item) && !BotUtils.IsClaimedByOther(item, this) && !IsLikelyInsideExtractor(((Component)item).transform))
				{
					float num3 = Vector3.SqrMagnitude(((Component)item).transform.position - ((Component)this).transform.position);
					if (num3 < num2)
					{
						num2 = num3;
						val = item;
					}
				}
			}
			if (!Object.op_Implicit((Object)(object)val) || !BotUtils.TryClaim(val, this))
			{
				return;
			}
			_brain.SetExternalControl(on: true);
			_busy = true;
			if (Object.op_Implicit((Object)(object)_agent) && _agent.isOnNavMesh)
			{
				Vector3 position = ((Component)val).transform.position;
				NavMeshHit val2 = default(NavMeshHit);
				if (NavMesh.SamplePosition(position, ref val2, 2.5f, -1))
				{
					_agent.SetDestination(((NavMeshHit)(ref val2)).position);
				}
				else
				{
					_agent.SetDestination(position);
				}
			}
			((MonoBehaviour)this).StartCoroutine(ApproachAndPick(val));
		}

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

		private bool CanReachByHold(PhysGrabObject target)
		{
			//IL_0035: Unknown result type (might be due to invalid IL or missing references)
			//IL_0014: Unknown result type (might be due to invalid IL or missing references)
			//IL_0019: Unknown result type (might be due to invalid IL or missing references)
			//IL_0023: 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_003a: 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_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_0092: Unknown result type (might be due to invalid IL or missing references)
			//IL_0093: Unknown result type (might be due to invalid IL or missing references)
			//IL_012f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0134: Unknown result type (might be due to invalid IL or missing references)
			//IL_0147: Unknown result type (might be due to invalid IL or missing references)
			//IL_014c: Unknown result type (might be due to invalid IL or missing references)
			//IL_015a: 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_00f9: Unknown result type (might be due to invalid IL or missing references)
			//IL_0100: 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_011b: Unknown result type (might be due to invalid IL or missing references)
			//IL_00aa: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b1: Unknown result type (might be due to invalid IL or missing references)
			Vector3 val = (Object.op_Implicit((Object)(object)_hold) ? _hold.position : (((Component)this).transform.position + Vector3.up * 1.5f));
			float num = float.PositiveInfinity;
			float num2 = float.PositiveInfinity;
			_carriedCols.Clear();
			((Component)target).GetComponentsInChildren<Collider>(true, _carriedCols);
			for (int i = 0; i < _carriedCols.Count; i++)
			{
				Collider val2 = _carriedCols[i];
				if (Object.op_Implicit((Object)(object)val2))
				{
					Vector3 val3 = val2.ClosestPoint(val);
					float num3 = Vector3.Distance(val, val3);
					if (num3 < num)
					{
						num = num3;
					}
					float num4 = Mathf.Abs(val3.y - val.y);
					if (num4 < num2)
					{
						num2 = num4;
					}
				}
			}
			if (float.IsInfinity(num))
			{
				num = Vector3.Distance(val, ((Component)target).transform.position);
				num2 = Mathf.Abs(((Component)target).transform.position.y - val.y);
			}
			Vector3 position = ((Component)this).transform.position;
			position.y = 0f;
			Vector3 position2 = ((Component)target).transform.position;
			position2.y = 0f;
			float num5 = Vector3.Distance(position, position2);
			if (num <= 1.5f && num5 <= 2.2f)
			{
				return true;
			}
			if (num5 <= 2.5f && num2 <= 2.2f)
			{
				return true;
			}
			return false;
		}

		private bool CanTouchTarget(PhysGrabObject target)
		{
			//IL_0035: Unknown result type (might be due to invalid IL or missing references)
			//IL_0014: Unknown result type (might be due to invalid IL or missing references)
			//IL_0019: Unknown result type (might be due to invalid IL or missing references)
			//IL_0023: 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_003a: Unknown result type (might be due to invalid IL or missing references)
			//IL_003b: Unknown result type (might be due to invalid IL or missing references)
			Vector3 val = (Object.op_Implicit((Object)(object)_hold) ? _hold.position : (((Component)this).transform.position + Vector3.up * 1.5f));
			int num = Physics.OverlapSphereNonAlloc(val, 0.5f, _overlap, -1, (QueryTriggerInteraction)2);
			for (int i = 0; i < num; i++)
			{
				Collider obj = _overlap[i];
				Transform val2 = ((obj != null) ? ((Component)obj).transform : null);
				if (Object.op_Implicit((Object)(object)val2) && ((Object)(object)val2 == (Object)(object)((Component)target).transform || val2.IsChildOf(((Component)target).transform)))
				{
					return true;
				}
			}
			return false;
		}

		private void DetachExternalLinks(PhysGrabObject target)
		{
			try
			{
				Joint[] componentsInChildren = ((Component)target).GetComponentsInChildren<Joint>(true);
				foreach (Joint val in componentsInChildren)
				{
					if (!Object.op_Implicit((Object)(object)val))
					{
						continue;
					}
					Rigidbody connectedBody = val.connectedBody;
					if (!Object.op_Implicit((Object)(object)connectedBody))
					{
						continue;
					}
					Transform transform = ((Component)connectedBody).transform;
					if (Object.op_Implicit((Object)(object)transform) && !transform.IsChildOf(((Component)target).transform) && (Object)(object)transform != (Object)(object)((Component)target).transform)
					{
						try
						{
							Object.Destroy((Object)(object)val);
						}
						catch
						{
						}
					}
				}
			}
			catch
			{
			}
			try
			{
				((Component)target).transform.SetParent((Transform)null, true);
			}
			catch
			{
			}
		}

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

		private void HardReleaseAndSeparate(Vector3 awayFrom, float minSeparation = 0.9f)
		{
			//IL_0191: Unknown result type (might be due to invalid IL or missing references)
			//IL_0196: Unknown result type (might be due to invalid IL or missing references)
			//IL_0197: Unknown result type (might be due to invalid IL or missing references)
			//IL_01a1: Unknown result type (might be due to invalid IL or missing references)
			//IL_01a6: Unknown result type (might be due to invalid IL or missing references)
			//IL_01c9: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ce: Unknown result type (might be due to invalid IL or missing references)
			//IL_01da: Unknown result type (might be due to invalid IL or missing references)
			//IL_01df: Unknown result type (might be due to invalid IL or missing references)
			//IL_01e1: Unknown result type (might be due to invalid IL or missing references)
			//IL_01e6: Unknown result type (might be due to invalid IL or missing references)
			//IL_01eb: Unknown result type (might be due to invalid IL or missing references)
			//IL_01f7: Unknown result type (might be due to invalid IL or missing references)
			//IL_01fc: Unknown result type (might be due to invalid IL or missing references)
			//IL_0206: Unknown result type (might be due to invalid IL or missing references)
			//IL_020b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0210: Unknown result type (might be due to invalid IL or missing references)
			//IL_01c1: Unknown result type (might be due to invalid IL or missing references)
			//IL_01c6: 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_007e: Invalid comparison between Unknown and I4
			//IL_0246: Unknown result type (might be due to invalid IL or missing references)
			//IL_0224: Unknown result type (might be due to invalid IL or missing references)
			//IL_0229: Unknown result type (might be due to invalid IL or missing references)
			//IL_022f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0234: Unknown result type (might be due to invalid IL or missing references)
			//IL_0239: Unknown result type (might be due to invalid IL or missing references)
			//IL_0099: Unknown result type (might be due to invalid IL or missing references)
			//IL_00aa: Unknown result type (might be due to invalid IL or missing references)
			//IL_026b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0271: Unknown result type (might be due to invalid IL or missing references)
			if ((Object)(object)_carried == (Object)null)
			{
				return;
			}
			try
			{
				((Component)_carried).transform.SetParent((Transform)null, true);
			}
			catch
			{
			}
			try
			{
				SetCarryCollisionIgnore(ignore: false);
			}
			catch
			{
			}
			if (Object.op_Implicit((Object)(object)_carriedRB))
			{
				try
				{
					_carriedRB.isKinematic = false;
					_carriedRB.detectCollisions = true;
					if ((int)_carriedRB.collisionDetectionMode == 0)
					{
						_carriedRB.collisionDetectionMode = (CollisionDetectionMode)2;
					}
					_carriedRB.velocity = Vector3.zero;
					_carriedRB.angularVelocity = Vector3.zero;
				}
				catch
				{
				}
			}
			try
			{
				Joint[] components = ((Component)((Component)_carried).transform).GetComponents<Joint>();
				foreach (Joint val in components)
				{
					if (!Object.op_Implicit((Object)(object)val))
					{
						continue;
					}
					Rigidbody connectedBody = val.connectedBody;
					if (Object.op_Implicit((Object)(object)connectedBody) && !((Object)(object)((Component)connectedBody).transform == (Object)null) && ((Object)(object)((Component)connectedBody).transform == (Object)(object)((Component)this).transform || ((Component)connectedBody).transform.IsChildOf(((Component)this).transform)))
					{
						try
						{
							Object.Destroy((Object)(object)val);
						}
						catch
						{
						}
					}
				}
			}
			catch
			{
			}
			Vector3 val2 = (((Component)_carried).transform.position - awayFrom).WithY(0f);
			if (((Vector3)(ref val2)).sqrMagnitude < 0.0001f)
			{
				val2 = ((Component)this).transform.forward;
			}
			val2 = ((Vector3)(ref val2)).normalized;
			Vector3 position = ((Component)_carried).transform.position + val2 * minSeparation;
			RaycastHit val3 = default(RaycastHit);
			if (Physics.Raycast(((Component)_carried).transform.position + Vector3.up * 0.1f, val2, ref val3, minSeparation, -1, (QueryTriggerInteraction)1))
			{
				position = ((RaycastHit)(ref val3)).point - val2 * 0.05f;
			}
			((Component)_carried).transform.position = position;
			Physics.SyncTransforms();
			try
			{
				if (Object.op_Implicit((Object)(object)_carriedRB))
				{
					_carriedRB.AddForce(val2 * 1.25f, (ForceMode)1);
				}
			}
			catch
			{
			}
		}

		private void ForceDrop(bool immediate)
		{
			//IL_0032: 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_0049: Unknown result type (might be due to invalid IL or missing references)
			//IL_0053: Unknown result type (might be due to invalid IL or missing references)
			//IL_0058: 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_005e: Unknown result type (might be due to invalid IL or missing references)
			//IL_007a: Unknown result type (might be due to invalid IL or missing references)
			ForceDropInternal(reenableCollision: true);
			if (!immediate && Object.op_Implicit((Object)(object)_agent) && _agent.isOnNavMesh)
			{
				Vector3 position = ((Component)this).transform.position;
				Vector3 val = Random.insideUnitSphere.WithY(0f);
				Vector3 val2 = position + ((Vector3)(ref val)).normalized * 1.2f;
				NavMeshHit val3 = default(NavMeshHit);
				if (NavMesh.SamplePosition(val2, ref val3, 2f, -1))
				{
					_agent.SetDestination(((NavMeshHit)(ref val3)).position);
				}
			}
		}

		private void ForceDropInternal(bool reenableCollision)
		{
			//IL_0085: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ae: Unknown result type (might be due to invalid IL or missing references)
			//IL_0059: 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)
			if (!Object.op_Implicit((Object)(object)_carried))
			{
				return;
			}
			PhysGrabObject carried = _carried;
			try
			{
				((Component)carried).transform.SetParent((Transform)null, true);
				if (Object.op_Implicit((Object)(object)_carriedRB) && reenableCollision)
				{
					_carriedRB.isKinematic = false;
					_carriedRB.velocity = Vector3.zero;
					_carriedRB.angularVelocity = Vector3.zero;
				}
			}
			catch
			{
			}
			ExtractionPoint val = SemiFunc.ExtractionPointGetNearest(((Component)this).transform.position);
			if (Object.op_Implicit((Object)(object)val))
			{
				float num = Vector3.Distance(((Component)carried).transform.position, ((Component)val).transform.position);
				if (num <= Mathf.Max(0.75f, _cfg.ExtractorStopDistance + 0.25f))
				{
					_ignoreIds.Add(((Object)carried).GetInstanceID());
					BotUtils.IgnoreFor(carried, 3.5f);
				}
			}
			if (!reenableCollision)
			{
				return;
			}
			try
			{
				SetCarryCollisionIgnore(ignore: false);
			}
			catch
			{
			}
			try
			{
				if (Object.op_Implicit((Object)(object)_carriedRB))
				{
					_carriedRB.isKinematic = false;
				}
			}
			catch
			{
			}
			FinalizeDropCommon();
		}

		private void FinalizeDropCommon()
		{
			PhysGrabObject carried = _carried;
			BotUtils.ReleaseClaim(carried, this);
			_carried = null;
			_carriedRB = null;
			_busy = false;
			_brain.SetExternalControl(on: false);
			_activationGraceUntil = 0f;
			_carryTimer = 0f;
			if (Object.op_Implicit((Object)(object)_agent))
			{
				_agent.stoppingDistance = _savedStopDist;
			}
		}

		private bool IsLikelyInsideExtractor(Transform t)
		{
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			//IL_001f: Unknown result type (might be due to invalid IL or missing references)
			//IL_002a: Unknown result type (might be due to invalid IL or missing references)
			ExtractionPoint val = SemiFunc.ExtractionPointGetNearest(t.position);
			if (!Object.op_Implicit((Object)(object)val))
			{
				return false;
			}
			float num = Vector3.Distance(t.position, ((Component)val).transform.position);
			return num <= Mathf.Max(1f, _cfg.ExtractorStopDistance + 0.25f);
		}

		private void SetCarryCollisionIgnore(bool ignore)
		{
			if ((Object)(object)_carried == (Object)null)
			{
				return;
			}
			_carriedCols.Clear();
			((Component)_carried).GetComponentsInChildren<Collider>(true, _carriedCols);
			if (_myCols == null || _myCols.Length == 0)
			{
				_myCols = ((Component)this).GetComponentsInChildren<Collider>(true);
			}
			for (int i = 0; i < _myCols.Length; i++)
			{
				Collider val = _myCols[i];
				if (!Object.op_Implicit((Object)(object)val))
				{
					continue;
				}
				for (int j = 0; j < _carriedCols.Count; j++)
				{
					Collider val2 = _carriedCols[j];
					if (Object.op_Implicit((Object)(object)val2))
					{
						try
						{
							Physics.IgnoreCollision(val, val2, ignore);
						}
						catch
						{
						}
					}
				}
			}
		}

		private bool TryResolveDeliveryTarget(out Vector3 goal, out ExtractionPoint targetEP)
		{
			//IL_0008: Unknown result type (might be due to invalid IL or missing references)
			//IL_000d: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d9: Unknown result type (might be due to invalid IL or missing references)
			//IL_00fb: Unknown result type (might be due to invalid IL or missing references)
			//IL_0100: 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_0099: 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_00bb: 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)
			goal = ((Component)this).transform.position;
			targetEP = null;
			try
			{
				if (Object.op_Implicit((Object)(object)RoundDirector.instance))
				{
					if (RoundDirector.instance.allExtractionPointsCompleted)
					{
						goal = GetTruckDestination();
						return true;
					}
					if (RoundDirector.instance.extractionPointActive && Object.op_Implicit((Object)(object)RoundDirector.instance.extractionPointCurrent))
					{
						targetEP = RoundDirector.instance.extractionPointCurrent;
						goal = ((Component)targetEP).transform.position;
						return true;
					}
					ExtractionPoint val = SemiFunc.ExtractionPointGetNearestNotActivated(((Component)this).transform.position);
					if (Object.op_Implicit((Object)(object)val))
					{
						targetEP = val;
						goal = ((Component)val).transform.position;
						return true;
					}
				}
			}
			catch
			{
			}
			ExtractionPoint val2 = SemiFunc.ExtractionPointGetNearest(((Component)this).transform.position);
			if (Object.op_Implicit((Object)(object)val2))
			{
				targetEP = val2;
				goal = ((Component)val2).transform.position;
				return true;
			}
			return false;
		}

		private bool IsDeliveryDropAllowed(ExtractionPoint targetEP)
		{
			try
			{
				if (Object.op_Implicit((Object)(object)RoundDirector.instance))
				{
					if (RoundDirector.instance.allExtractionPointsCompleted)
					{
						return true;
					}
					if ((Object)(object)targetEP == (Object)null)
					{
						return false;
					}
					return RoundDirector.instance.extractionPointActive && (Object)(object)RoundDirector.instance.extractionPointCurrent == (Object)(object)targetEP;
				}
			}
			catch
			{
			}
			return true;
		}

		private void TryActivateExtraction(ExtractionPoint ep)
		{
			if (!Object.op_Implicit((Object)(object)ep))
			{
				return;
			}
			int instanceID = ((Object)ep).GetInstanceID();
			if (_lastActivateId == instanceID && Time.time - _lastActivateTime < 0.75f)
			{
				return;
			}
			_lastActivateId = instanceID;
			_lastActivateTime = Time.time;
			_activationGraceUntil = Time.time + 2f;
			try
			{
				ep.ButtonPress();
			}
			catch
			{
			}
		}

		private Vector3 GetTruckDestination()
		{
			//IL_001e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0023: 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_00d9: Unknown result type (might be due to invalid IL or missing references)
			//IL_00de: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e1: 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_00aa: Unknown result type (might be due to invalid IL or missing references)
			if (_truckCached)
			{
				return _truckDestination;
			}
			_truckDestination = ((Component)this).transform.position;
			try
			{
				if (Object.op_Implicit((Object)(object)LevelGenerator.Instance) && LevelGenerator.Instance.LevelPathPoints != null)
				{
					List<LevelPoint> levelPathPoints = LevelGenerator.Instance.LevelPathPoints;
					for (int i = 0; i < levelPathPoints.Count; i++)
					{
						LevelPoint val = levelPathPoints[i];
						if (Object.op_Implicit((Object)(object)val))
						{
							RoomVolume room = val.Room;
							if (Object.op_Implicit((Object)(object)room) && room.Truck)
							{
								_truckDestination = ((Component)val).transform.position;
								_truckCached = true;
								break;
							}
						}
					}
				}
			}
			catch
			{
			}
			return _truckDestination;
		}

		internal void AddHeadCleanup(GameObject root)
		{
			//IL_002d: 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_0057: Unknown result type (might be due to invalid IL or missing references)
			GameObject val = GameObject.CreatePrimitive((PrimitiveType)0);
			((Object)val).name = "Head";
			val.transform.SetParent(root.transform, false);
			val.transform.localScale = Vector3.one * 0.35f;
			val.transform.localPosition = new Vector3(0f, 1.6f, 0f);
			Collider component = val.GetComponent<Collider>();
			if (Object.op_Implicit((Object)(object)component))
			{
				Object.Destroy((Object)(object)component);
			}
		}

		private void TryJumpAssist(PhysGrabObject target)
		{
			//IL_005c: Unknown result type (might be due to invalid IL or missing references)
			//IL_003b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0040: Unknown result type (might be due to invalid IL or missing references)
			//IL_004a: 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_0061: 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_0102: Unknown result type (might be due to invalid IL or missing references)
			//IL_00bc: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00da: Unknown result type (might be due to invalid IL or missing references)
			if (_isJumping || _jumpCD > Time.time)
			{
				return;
			}
			Vector3 val = (Object.op_Implicit((Object)(object)_hold) ? _hold.position : (((Component)this).transform.position + Vector3.up * 1.5f));
			float num = ((Component)target).transform.position.y + 0.5f;
			_carriedCols.Clear();
			((Component)target).GetComponentsInChildren<Collider>(true, _carriedCols);
			for (int i = 0; i < _carriedCols.Count; i++)
			{
				Collider val2 = _carriedCols[i];
				if (Object.op_Implicit((Object)(object)val2))
				{
					Bounds bounds = val2.bounds;
					if (((Bounds)(ref bounds)).max.y > num)
					{
						num = ((Bounds)(ref bounds)).max.y;
					}
				}
			}
			float height = Mathf.Clamp(num - val.y + 0.25f, 0.8f, 4f);
			((MonoBehaviour)this).StartCoroutine(JumpVertical(height));
		}

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

		[IteratorStateMachine(typeof(<JumpArc>d__44))]
		private IEnumerator JumpArc(Vector3 dir, float forwardDist, float height)
		{
			//IL_000e: Unknown result type (might be due to invalid IL or missing references)
			//IL_000f: Unknown result type (might be due to invalid IL or missing references)
			//yield-return decompiler failed: Unexpected instruction in Iterator.Dispose()
			return new <JumpArc>d__44(0)
			{
				<>4__this = this,
				dir = dir,
				forwardDist = forwardDist,
				height = height
			};
		}
	}
	[BepInPlugin("Empress.BotFriends.Chatter", "BotFriendsChatter", "1.0.0")]
	public class BotFriendsChatterPlugin : BaseUnityPlugin
	{
		internal static BotFriendsChatterPlugin Instance;

		internal static ConfigEntry<bool> Enabled;

		internal static ConfigEntry<float> TalkRadius;

		internal static ConfigEntry<float> PairCooldown;

		internal static ConfigEntry<float> SelfCooldown;

		internal static ConfigEntry<int> MaxConcurrent;

		internal static ConfigEntry<float> Volume;

		internal static ConfigEntry<bool> UseDECtalk;

		internal static ConfigEntry<string> ExePath;

		internal static ConfigEntry<string> Voice;

		internal static ConfigEntry<int> SampleRate;

		internal static ConfigEntry<string> DictionaryPath;

		internal static ManualLogSource Logger => Instance._logger;

		private ManualLogSource _logger => ((BaseUnityPlugin)this).Logger;

		private void Awake()
		{
			//IL_01ba: Unknown result type (might be due to invalid IL or missing references)
			//IL_01c0: Expected O, but got Unknown
			Instance = this;
			Enabled = ((BaseUnityPlugin)this).Config.Bind<bool>("Chatter", "Enabled", false, "on");
			TalkRadius = ((BaseUnityPlugin)this).Config.Bind<float>("Chatter", "TalkRadius", 1f, "m");
			PairCooldown = ((BaseUnityPlugin)this).Config.Bind<float>("Chatter", "PairCooldown", 10f, "s");
			SelfCooldown = ((BaseUnityPlugin)this).Config.Bind<float>("Chatter", "SelfCooldown", 6f, "s");
			MaxConcurrent = ((BaseUnityPlugin)this).Config.Bind<int>("Chatter", "MaxConcurrent", 1, "voices");
			Volume = ((BaseUnityPlugin)this).Config.Bind<float>("Chatter", "Volume", 0.6f, "0..1");
			UseDECtalk = ((BaseUnityPlugin)this).Config.Bind<bool>("DECtalk", "UseDECtalk", true, "on");
			ExePath = ((BaseUnityPlugin)this).Config.Bind<string>("DECtalk", "ExePath", "say.exe", "path");
			Voice = ((BaseUnityPlugin)this).Config.Bind<string>("DECtalk", "Voice", "Paul", "name");
			SampleRate = ((BaseUnityPlugin)this).Config.Bind<int>("DECtalk", "SampleRate", 22050, "Hz");
			DictionaryPath = ((BaseUnityPlugin)this).Config.Bind<string>("DECtalk", "DictionaryPath", "dtalk_us.dic", "path or blank");
			DecTalkSynth.Configure(ExePath.Value, Voice.Value, SampleRate.Value, DictionaryPath.Value);
			GameObject val = new GameObject("BotChatterManager");
			((Object)val).hideFlags = (HideFlags)61;
			val.AddComponent<BotChatterManager>();
			Logger.LogInfo((object)"StupidBotsChatter ready");
		}
	}
	internal class BotChatterManager : MonoBehaviour
	{
		private static readonly List<BotChatterAgent> Agents = new List<BotChatterAgent>();

		private static readonly Dictionary<BotChatterAgent, float> SelfCD = new Dictionary<BotChatterAgent, float>();

		private static readonly Dictionary<ulong, float> PairCD = new Dictionary<ulong, float>();

		private static int _voicesPlaying;

		private static readonly string[] greetings = new string[41]
		{
			"Eyes up.", "Stay sharp.", "You good.", "Keep moving.", "We move.", "Copy.", "On route.", "Heads on a swivel.", "Focus up. No sightseeing.", "Don’t get cute—move.",
			"Keep it tight.", "We are burning daylight.", "Quit gawking and hustle.", "Stay frosty.", "Watch your damn corners.", "Steady hands, steady feet.", "Less chatter, more ladder.", "Walk like you mean it.", "No hero plays. Not today.", "We’re ghosts—be loud later.",
			"If it moves, clock it. Twice.", "This place gives me the creeps—keep pace.", "Control your breathing.", "Don’t make me babysit you.", "We’re not lost… we’re exploring aggressively.", "Move smart, not pretty.", "Keep the line clean.", "Comms clear unless it’s critical.", "Don’t trip over your own ego.", "We’re here to work, not decorate the floor.",
			"If it bites, bite back harder.", "We’re fine. Act like it.", "Heads down, wallets up.", "No panic. Panic is expensive.", "Shut it and strut it.", "Grip it and zip it.", "Keep your soul inside your body.", "Clock’s ticking. Move your ass.", "Don’t test me—I will turn this run around.", "Game faces, criminals.",
			"Eyes, ears, all of it. On."
		};

		private static readonly string[] movePair = new string[38]
		{
			"Form up.", "Stay with me.", "Hold pace.", "On your six.", "Push up.", "Stack up.", "Anchor left.", "Peel right.", "Crossing!", "Bounding—go!",
			"Don’t lag. I swear.", "Hold the line.", "Break contact if it gets stupid.", "Tight corners—no heroics.", "Don’t step on the loud things.", "Feet light, brain heavier.", "Keep the spacing, geniuses.", "Eyes high, eyes low—cover both.", "Switching lanes—don’t collide.", "Check your flanks, then check mine.",
			"On your shoulder—don’t stop.", "You lead, I bully.", "Move like rent’s due.", "Silent running—save the drama.", "We glide. We don’t stumble.", "If you clatter, I yell.", "Shuffle faster. Yes, that’s a thing.", "Doors ahead—don’t faceplant.", "I’m pacing you—don’t make me sprint.", "Breach and breathe.",
			"Keep momentum—friction kills.", "I step, you step. Rhythm, people.", "No zig-zagging like a drunk drone.", "Heel-toe, not heel-whoops.", "Stay latched.", "Trail tight. No wandering.", "Clear lanes.