Decompiled source of ScoutmasterX v1.3.0

plugins/ScoutmasterX.dll

Decompiled 4 months ago
using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using BepInEx;
using Microsoft.CodeAnalysis;
using Photon.Pun;
using Photon.Realtime;
using UnityEngine;
using UnityEngine.AI;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: IgnoresAccessChecksTo("Assembly-CSharp")]
[assembly: TargetFramework(".NETFramework,Version=v4.7.2", FrameworkDisplayName = ".NET Framework 4.7.2")]
[assembly: AssemblyCompany("ScoutmasterX")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("ScoutmasterX")]
[assembly: AssemblyTitle("ScoutmasterX")]
[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 BepInEx
{
	[AttributeUsage(AttributeTargets.Class, Inherited = false, AllowMultiple = false)]
	[Conditional("CodeGeneration")]
	internal sealed class BepInAutoPluginAttribute : Attribute
	{
		public BepInAutoPluginAttribute(string? id = null, string? name = null, string? version = null)
		{
		}
	}
}
namespace BepInEx.Preloader.Core.Patching
{
	[AttributeUsage(AttributeTargets.Class, Inherited = false, AllowMultiple = false)]
	[Conditional("CodeGeneration")]
	internal sealed class PatcherAutoPluginAttribute : Attribute
	{
		public PatcherAutoPluginAttribute(string? id = null, string? name = null, string? version = null)
		{
		}
	}
}
namespace ScoutmasterX
{
	[BepInPlugin("com.bitvoid.scoutmasterx", "ScoutmasterX", "1.3.0")]
	public class Plugin : BaseUnityPlugin
	{
		[CompilerGenerated]
		private sealed class <AutoSpawnAggressiveScoutmasters>d__15 : IEnumerator<object>, IDisposable, IEnumerator
		{
			private int <>1__state;

			private object <>2__current;

			public Plugin <>4__this;

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

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

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

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

			private bool MoveNext()
			{
				//IL_008b: Unknown result type (might be due to invalid IL or missing references)
				//IL_0095: Expected O, but got Unknown
				//IL_0047: Unknown result type (might be due to invalid IL or missing references)
				//IL_0051: Expected O, but got Unknown
				switch (<>1__state)
				{
				default:
					return false;
				case 0:
					<>1__state = -1;
					if (<>4__this.autoSpawnEnabled)
					{
						<>2__current = (object)new WaitForSeconds(390f);
						<>1__state = 1;
						return true;
					}
					break;
				case 1:
					<>1__state = -1;
					goto IL_00a6;
				case 2:
					<>1__state = -1;
					<>2__current = (object)new WaitForSeconds(390f);
					<>1__state = 3;
					return true;
				case 3:
					{
						<>1__state = -1;
						goto IL_00a6;
					}
					IL_00a6:
					if (<>4__this.autoSpawnEnabled)
					{
						<>2__current = <>4__this.SpawnSequence();
						<>1__state = 2;
						return true;
					}
					break;
				}
				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 <DelayedPhotonDestroy>d__23 : IEnumerator<object>, IDisposable, IEnumerator
		{
			private int <>1__state;

			private object <>2__current;

			public GameObject obj;

			public float delay;

			public Plugin <>4__this;

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

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

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

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

			private bool MoveNext()
			{
				//IL_0027: Unknown result type (might be due to invalid IL or missing references)
				//IL_0031: Expected O, but got Unknown
				switch (<>1__state)
				{
				default:
					return false;
				case 0:
					<>1__state = -1;
					<>2__current = (object)new WaitForSeconds(delay);
					<>1__state = 1;
					return true;
				case 1:
					<>1__state = -1;
					if ((Object)(object)obj != (Object)null && PhotonNetwork.IsConnected && PhotonNetwork.InRoom)
					{
						PhotonNetwork.Destroy(obj);
						((BaseUnityPlugin)<>4__this).Logger.LogInfo((object)$"Despawned transparent passive Scoutmaster {((Object)obj).name} after {delay} seconds.");
					}
					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 <DespawnAfterDuration>d__24 : IEnumerator<object>, IDisposable, IEnumerator
		{
			private int <>1__state;

			private object <>2__current;

			public GameObject obj;

			public float duration;

			public Plugin <>4__this;

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

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

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

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

			private bool MoveNext()
			{
				//IL_0027: Unknown result type (might be due to invalid IL or missing references)
				//IL_0031: Expected O, but got Unknown
				switch (<>1__state)
				{
				default:
					return false;
				case 0:
					<>1__state = -1;
					<>2__current = (object)new WaitForSeconds(duration);
					<>1__state = 1;
					return true;
				case 1:
					<>1__state = -1;
					if ((Object)(object)obj != (Object)null)
					{
						if (PhotonNetwork.IsConnected && PhotonNetwork.InRoom)
						{
							PhotonNetwork.Destroy(obj);
						}
						else
						{
							Object.Destroy((Object)(object)obj);
						}
						<>4__this.spawnedObjects.Remove(obj);
						((BaseUnityPlugin)<>4__this).Logger.LogInfo((object)$"Despawned visible passive Scoutmaster {((Object)obj).name} after {duration} seconds.");
					}
					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 <DynamiteCountdownCoroutine>d__17 : IEnumerator<object>, IDisposable, IEnumerator
		{
			private int <>1__state;

			private object <>2__current;

			public Plugin <>4__this;

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

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

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

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

			private bool MoveNext()
			{
				//IL_0032: Unknown result type (might be due to invalid IL or missing references)
				//IL_003c: Expected O, but got Unknown
				switch (<>1__state)
				{
				default:
					return false;
				case 0:
					<>1__state = -1;
					<>4__this.dynamiteActive = true;
					<>2__current = (object)new WaitForSeconds(5.5f);
					<>1__state = 1;
					return true;
				case 1:
					<>1__state = -1;
					((BaseUnityPlugin)<>4__this).Logger.LogInfo((object)"BOOOOOOOM!!! Despawning all Scoutmasters...");
					<>4__this.DespawnAllObjects();
					<>4__this.dynamiteActive = 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 <KeepChasing>d__33 : IEnumerator<object>, IDisposable, IEnumerator
		{
			private int <>1__state;

			private object <>2__current;

			public GameObject scoutmasterObj;

			public Character target;

			public Plugin <>4__this;

			private Component <scoutmasterComp>5__1;

			private MethodInfo <setTargetMethod>5__2;

			private MethodInfo[] <>s__3;

			private int <>s__4;

			private MethodInfo <method>5__5;

			private Exception <ex>5__6;

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

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

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

			[DebuggerHidden]
			void IDisposable.Dispose()
			{
				<scoutmasterComp>5__1 = null;
				<setTargetMethod>5__2 = null;
				<>s__3 = null;
				<method>5__5 = null;
				<ex>5__6 = null;
				<>1__state = -2;
			}

			private bool MoveNext()
			{
				//IL_0220: Unknown result type (might be due to invalid IL or missing references)
				//IL_022a: Expected O, but got Unknown
				switch (<>1__state)
				{
				default:
					return false;
				case 0:
					<>1__state = -1;
					<scoutmasterComp>5__1 = scoutmasterObj.GetComponent("Scoutmaster");
					if ((Object)(object)<scoutmasterComp>5__1 == (Object)null)
					{
						((BaseUnityPlugin)<>4__this).Logger.LogError((object)("Scoutmaster component not found on " + ((Object)scoutmasterObj).name + "!"));
						return false;
					}
					<setTargetMethod>5__2 = ((object)<scoutmasterComp>5__1).GetType().GetMethod("SetCurrentTarget", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic);
					if (<setTargetMethod>5__2 == null)
					{
						((BaseUnityPlugin)<>4__this).Logger.LogError((object)"SetCurrentTarget method not found on Scoutmaster component! Available methods:");
						<>s__3 = ((object)<scoutmasterComp>5__1).GetType().GetMethods(BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic);
						for (<>s__4 = 0; <>s__4 < <>s__3.Length; <>s__4++)
						{
							<method>5__5 = <>s__3[<>s__4];
							((BaseUnityPlugin)<>4__this).Logger.LogInfo((object)(" - " + <method>5__5.Name));
							<method>5__5 = null;
						}
						<>s__3 = null;
						return false;
					}
					break;
				case 1:
					<>1__state = -1;
					break;
				}
				if ((Object)(object)scoutmasterObj != (Object)null && (Object)(object)target != (Object)null)
				{
					try
					{
						<setTargetMethod>5__2.Invoke(<scoutmasterComp>5__1, new object[2] { target, 90f });
						((BaseUnityPlugin)<>4__this).Logger.LogInfo((object)$"Refreshing chase on target Character [{target.characterName} : ViewID {((MonoBehaviourPun)target).photonView.ViewID}].");
					}
					catch (Exception ex)
					{
						<ex>5__6 = ex;
						((BaseUnityPlugin)<>4__this).Logger.LogError((object)("Failed to invoke SetCurrentTarget: " + <ex>5__6.Message));
						((BaseUnityPlugin)<>4__this).Logger.LogError((object)("Stack trace: " + <ex>5__6.StackTrace));
						return false;
					}
					<>2__current = (object)new WaitForSeconds(88f);
					<>1__state = 1;
					return true;
				}
				if ((Object)(object)scoutmasterObj != (Object)null)
				{
					if (PhotonNetwork.IsConnected && PhotonNetwork.InRoom)
					{
						PhotonNetwork.Destroy(scoutmasterObj);
					}
					else
					{
						Object.Destroy((Object)(object)scoutmasterObj);
					}
					<>4__this.spawnedObjects.Remove(scoutmasterObj);
					((BaseUnityPlugin)<>4__this).Logger.LogInfo((object)"Scoutmaster despawned after chase.");
				}
				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 <SpawnSequence>d__18 : IEnumerator<object>, IDisposable, IEnumerator
		{
			private int <>1__state;

			private object <>2__current;

			public Plugin <>4__this;

			private GameObject <aggressiveObj>5__1;

			private float <randomValue>5__2;

			private bool <isVisible>5__3;

			private GameObject <passiveObj>5__4;

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

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

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

			[DebuggerHidden]
			void IDisposable.Dispose()
			{
				<aggressiveObj>5__1 = null;
				<passiveObj>5__4 = null;
				<>1__state = -2;
			}

			private bool MoveNext()
			{
				//IL_004a: Unknown result type (might be due to invalid IL or missing references)
				//IL_0054: Expected O, but got Unknown
				switch (<>1__state)
				{
				default:
					return false;
				case 0:
					<>1__state = -1;
					<aggressiveObj>5__1 = <>4__this.SpawnAggressiveScoutmaster();
					if ((Object)(object)<aggressiveObj>5__1 == (Object)null)
					{
						return false;
					}
					<>2__current = (object)new WaitForSeconds(0.5f);
					<>1__state = 1;
					return true;
				case 1:
					<>1__state = -1;
					<randomValue>5__2 = Random.value;
					<isVisible>5__3 = <randomValue>5__2 < 0.15f;
					<passiveObj>5__4 = <>4__this.SpawnPassiveScoutmaster(<aggressiveObj>5__1, <isVisible>5__3);
					if (((Object)(object)<passiveObj>5__4 != (Object)null) & <isVisible>5__3)
					{
						<>4__this.ApplyVisiblePassiveColor(<passiveObj>5__4);
						<>4__this.spawnedObjects.Add(<passiveObj>5__4);
						((MonoBehaviour)<>4__this).StartCoroutine(<>4__this.DespawnAfterDuration(<passiveObj>5__4, 90f));
					}
					else if ((Object)(object)<passiveObj>5__4 != (Object)null)
					{
						<>4__this.ApplyTransparent(<passiveObj>5__4);
						((BaseUnityPlugin)<>4__this).Logger.LogInfo((object)$"Transparent passive Scoutmaster {((Object)<passiveObj>5__4).name} spawned and will despawn after {0.5f} seconds.");
					}
					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 <StartChasingNextFrame>d__32 : IEnumerator<object>, IDisposable, IEnumerator
		{
			private int <>1__state;

			private object <>2__current;

			public GameObject scoutmasterObj;

			public Character target;

			public Plugin <>4__this;

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

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

			[DebuggerHidden]
			public <StartChasingNextFrame>d__32(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;
					<>2__current = null;
					<>1__state = 1;
					return true;
				case 1:
					<>1__state = -1;
					((MonoBehaviour)<>4__this).StartCoroutine(<>4__this.KeepChasing(scoutmasterObj, target));
					return false;
				}
			}

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

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

		private const float ChaseDuration = 90f;

		private const float SpawnRadius = 100f;

		private const float AutoSpawnInterval = 390f;

		private const float DynamiteCountdown = 5.5f;

		private const float TransparentDespawnDelay = 0.5f;

		private readonly List<GameObject> spawnedObjects = new List<GameObject>();

		private bool autoSpawnEnabled = false;

		private Coroutine? autoSpawnCoroutine = null;

		private bool dynamiteActive = false;

		private string toggleMessage = "";

		private float toggleMessageTimer = 0f;

		private const float toggleMessageDuration = 2f;

		private void Awake()
		{
			((BaseUnityPlugin)this).Logger.LogInfo((object)"ScoutmasterX mod loaded successfully!");
			LogToggleStates();
		}

		private void Update()
		{
			if (Input.GetKeyDown((KeyCode)110))
			{
				autoSpawnEnabled = !autoSpawnEnabled;
				toggleMessage = (autoSpawnEnabled ? "autospawn ON" : "autospawn OFF");
				toggleMessageTimer = 2f;
				if (autoSpawnEnabled)
				{
					((BaseUnityPlugin)this).Logger.LogInfo((object)$"Auto-spawn enabled for aggressive Scoutmasters (interval: {390f} seconds).");
					if (autoSpawnCoroutine != null)
					{
						((MonoBehaviour)this).StopCoroutine(autoSpawnCoroutine);
					}
					autoSpawnCoroutine = ((MonoBehaviour)this).StartCoroutine(AutoSpawnAggressiveScoutmasters());
				}
				else
				{
					((BaseUnityPlugin)this).Logger.LogInfo((object)"Auto-spawn disabled for aggressive Scoutmasters.");
					if (autoSpawnCoroutine != null)
					{
						((MonoBehaviour)this).StopCoroutine(autoSpawnCoroutine);
						autoSpawnCoroutine = null;
					}
				}
				LogToggleStates();
			}
			if (Input.GetKeyDown((KeyCode)283))
			{
				((BaseUnityPlugin)this).Logger.LogInfo((object)"F2 pressed! Spawning Scoutmaster sequence...");
				((MonoBehaviour)this).StartCoroutine(SpawnSequence());
			}
			if (Input.GetKeyDown((KeyCode)288))
			{
				((BaseUnityPlugin)this).Logger.LogInfo((object)"F7 pressed! Spawning Dynamite and starting countdown...");
				SpawnItem("Dynamite");
				if (!dynamiteActive)
				{
					((MonoBehaviour)this).StartCoroutine(DynamiteCountdownCoroutine());
				}
			}
			if (toggleMessageTimer > 0f)
			{
				toggleMessageTimer -= Time.deltaTime;
				if (toggleMessageTimer <= 0f)
				{
					toggleMessage = "";
				}
			}
		}

		private void LogToggleStates()
		{
			((BaseUnityPlugin)this).Logger.LogInfo((object)("Current toggle states: Auto-spawn aggressive (N): " + (autoSpawnEnabled ? "ON" : "OFF")));
		}

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

		private void SpawnItem(string itemName)
		{
			if (PhotonNetwork.IsConnected && (Object)(object)Character.localCharacter != (Object)null)
			{
				((BaseUnityPlugin)this).Logger.LogInfo((object)("Spawn item: " + itemName));
				Character.localCharacter.refs.items.SpawnItemInHand(itemName);
			}
			else
			{
				((BaseUnityPlugin)this).Logger.LogWarning((object)("Cannot spawn " + itemName + ": Not connected to Photon or no local character found."));
			}
		}

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

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

		private GameObject? SpawnAggressiveScoutmaster()
		{
			//IL_00e8: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ed: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f4: Unknown result type (might be due to invalid IL or missing references)
			//IL_0138: Unknown result type (might be due to invalid IL or missing references)
			if (!PhotonNetwork.IsConnected || !PhotonNetwork.InRoom)
			{
				((BaseUnityPlugin)this).Logger.LogWarning((object)"Not in Photon room, spawning aggressive Scoutmaster in solo mode...");
				return SpawnAggressiveScoutmasterSolo();
			}
			if (!PhotonNetwork.IsMasterClient)
			{
				((BaseUnityPlugin)this).Logger.LogWarning((object)"Only Master Client can spawn Scoutmaster!");
				return null;
			}
			Player[] playerList = PhotonNetwork.PlayerList;
			if (playerList == null || playerList.Length == 0)
			{
				((BaseUnityPlugin)this).Logger.LogError((object)"No players in the room!");
				return null;
			}
			Player val = playerList[Random.Range(0, playerList.Length)];
			Character val2 = default(Character);
			if (!PlayerHandler.TryGetCharacter(val.ActorNumber, ref val2) || (Object)(object)val2 == (Object)null)
			{
				((BaseUnityPlugin)this).Logger.LogError((object)("Target player character not found for player " + val.NickName + "!"));
				return null;
			}
			Vector3 val3 = CalculateRandomSpawnPosition(val2);
			GameObject val4 = PhotonNetwork.InstantiateRoomObject("Character_Scoutmaster", val3, Quaternion.identity, (byte)0, (object[])null);
			if ((Object)(object)val4 == (Object)null)
			{
				((BaseUnityPlugin)this).Logger.LogError((object)"Failed to instantiate Character_Scoutmaster prefab!");
				return null;
			}
			((BaseUnityPlugin)this).Logger.LogInfo((object)$"Aggressive Scoutmaster spawned near player {val.NickName} at {val3}.");
			spawnedObjects.Add(val4);
			ApplyAggressiveColor(val4);
			SetAggressiveScoutmasterSpeed(val4);
			((MonoBehaviour)this).StartCoroutine(StartChasingNextFrame(val4, val2));
			return val4;
		}

		private GameObject? SpawnPassiveScoutmaster(GameObject aggressiveScoutmaster, bool isVisible)
		{
			//IL_0090: Unknown result type (might be due to invalid IL or missing references)
			//IL_0095: Unknown result type (might be due to invalid IL or missing references)
			//IL_009b: Unknown result type (might be due to invalid IL or missing references)
			//IL_009c: Unknown result type (might be due to invalid IL or missing references)
			//IL_00db: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e7: Unknown result type (might be due to invalid IL or missing references)
			if (!PhotonNetwork.IsConnected || !PhotonNetwork.InRoom)
			{
				((BaseUnityPlugin)this).Logger.LogWarning((object)"Not in Photon room, spawning passive Scoutmaster in solo mode...");
				return SpawnPassiveScoutmasterSolo(aggressiveScoutmaster, isVisible);
			}
			if (!PhotonNetwork.IsMasterClient)
			{
				((BaseUnityPlugin)this).Logger.LogWarning((object)"Only Master Client can spawn Scoutmaster!");
				return null;
			}
			Character localPlayerCharacter = GetLocalPlayerCharacter();
			if ((Object)(object)localPlayerCharacter == (Object)null)
			{
				((BaseUnityPlugin)this).Logger.LogError((object)"No local player character found!");
				return null;
			}
			Vector3 val = CalculateRandomSpawnPosition(localPlayerCharacter);
			GameObject val2 = PhotonNetwork.InstantiateRoomObject("Character_Scoutmaster", val, Quaternion.identity, (byte)0, (object[])null);
			if ((Object)(object)val2 == (Object)null)
			{
				((BaseUnityPlugin)this).Logger.LogError((object)"Failed to instantiate Character_Scoutmaster prefab!");
				return null;
			}
			((BaseUnityPlugin)this).Logger.LogInfo((object)$"Passive Scoutmaster spawned at {val} (player at {((Component)localPlayerCharacter).transform.position}), Visible: {isVisible}.");
			if (!isVisible)
			{
				((MonoBehaviour)this).StartCoroutine(DelayedPhotonDestroy(val2, 0.5f));
			}
			else
			{
				Character component = aggressiveScoutmaster.GetComponent<Character>();
				if ((Object)(object)component != (Object)null)
				{
					((MonoBehaviour)this).StartCoroutine(StartChasingNextFrame(val2, component));
					((BaseUnityPlugin)this).Logger.LogInfo((object)("Visible passive Scoutmaster " + ((Object)val2).name + " set to attack aggressive Scoutmaster " + ((Object)aggressiveScoutmaster).name + "."));
				}
				else
				{
					((BaseUnityPlugin)this).Logger.LogWarning((object)("No Character component found on target aggressive Scoutmaster " + ((Object)aggressiveScoutmaster).name + ". Setting to idle."));
					SetScoutmasterIdle(val2);
				}
			}
			return val2;
		}

		private GameObject? SpawnAggressiveScoutmasterSolo()
		{
			//IL_0031: Unknown result type (might be due to invalid IL or missing references)
			//IL_0036: Unknown result type (might be due to invalid IL or missing references)
			//IL_0067: 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_007e: Unknown result type (might be due to invalid IL or missing references)
			Character localPlayerCharacter = GetLocalPlayerCharacter();
			if ((Object)(object)localPlayerCharacter == (Object)null)
			{
				((BaseUnityPlugin)this).Logger.LogError((object)"No player character found in solo mode!");
				return null;
			}
			Vector3 val = CalculateRandomSpawnPosition(localPlayerCharacter);
			GameObject val2 = Resources.Load<GameObject>("Character_Scoutmaster");
			if ((Object)(object)val2 == (Object)null)
			{
				((BaseUnityPlugin)this).Logger.LogError((object)"Failed to load Character_Scoutmaster prefab!");
				return null;
			}
			GameObject val3 = Object.Instantiate<GameObject>(val2, val, Quaternion.identity);
			((BaseUnityPlugin)this).Logger.LogInfo((object)$"Aggressive Scoutmaster spawned at {val} in solo mode.");
			spawnedObjects.Add(val3);
			ApplyAggressiveColor(val3);
			SetAggressiveScoutmasterSpeed(val3);
			((MonoBehaviour)this).StartCoroutine(StartChasingNextFrame(val3, localPlayerCharacter));
			return val3;
		}

		private GameObject? SpawnPassiveScoutmasterSolo(GameObject aggressiveScoutmaster, bool isVisible)
		{
			//IL_0031: Unknown result type (might be due to invalid IL or missing references)
			//IL_0036: Unknown result type (might be due to invalid IL or missing references)
			//IL_006a: Unknown result type (might be due to invalid IL or missing references)
			//IL_006b: 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_008d: Unknown result type (might be due to invalid IL or missing references)
			Character localPlayerCharacter = GetLocalPlayerCharacter();
			if ((Object)(object)localPlayerCharacter == (Object)null)
			{
				((BaseUnityPlugin)this).Logger.LogError((object)"No player character found in solo mode!");
				return null;
			}
			Vector3 val = CalculateRandomSpawnPosition(localPlayerCharacter);
			GameObject val2 = Resources.Load<GameObject>("Character_Scoutmaster");
			if ((Object)(object)val2 == (Object)null)
			{
				((BaseUnityPlugin)this).Logger.LogError((object)"Failed to load Character_Scoutmaster prefab!");
				return null;
			}
			GameObject val3 = Object.Instantiate<GameObject>(val2, val, Quaternion.identity);
			((BaseUnityPlugin)this).Logger.LogInfo((object)$"Passive Scoutmaster spawned at {val} in solo mode (player at {((Component)localPlayerCharacter).transform.position}), Visible: {isVisible}.");
			if (!isVisible)
			{
				Object.Destroy((Object)(object)val3, 0.5f);
			}
			else
			{
				Character component = aggressiveScoutmaster.GetComponent<Character>();
				if ((Object)(object)component != (Object)null)
				{
					((MonoBehaviour)this).StartCoroutine(StartChasingNextFrame(val3, component));
					((BaseUnityPlugin)this).Logger.LogInfo((object)("Visible passive Scoutmaster " + ((Object)val3).name + " set to attack aggressive Scoutmaster " + ((Object)aggressiveScoutmaster).name + "."));
				}
				else
				{
					((BaseUnityPlugin)this).Logger.LogWarning((object)("No Character component found on target aggressive Scoutmaster " + ((Object)aggressiveScoutmaster).name + ". Setting to idle."));
					SetScoutmasterIdle(val3);
				}
				((MonoBehaviour)this).StartCoroutine(DespawnAfterDuration(val3, 90f));
			}
			return val3;
		}

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

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

		private Character? GetLocalPlayerCharacter()
		{
			//IL_009b: Unknown result type (might be due to invalid IL or missing references)
			Character[] array = Object.FindObjectsByType<Character>((FindObjectsSortMode)0);
			if (array == null || array.Length == 0)
			{
				((BaseUnityPlugin)this).Logger.LogWarning((object)"No characters found in the scene or FindObjectsByType returned null!");
				return null;
			}
			Character[] array2 = array;
			foreach (Character val in array2)
			{
				if ((Object)(object)val != (Object)null && (Object)(object)((MonoBehaviourPun)val).photonView != (Object)null && ((MonoBehaviourPun)val).photonView.IsMine)
				{
					((BaseUnityPlugin)this).Logger.LogInfo((object)$"Found local player character: {val.characterName} (ViewID: {((MonoBehaviourPun)val).photonView.ViewID}) at {((Component)val).transform.position}.");
					return val;
				}
			}
			((BaseUnityPlugin)this).Logger.LogWarning((object)"No local player character found!");
			return null;
		}

		private void ApplyAggressiveColor(GameObject scoutmasterObj)
		{
			//IL_0007: Unknown result type (might be due to invalid IL or missing references)
			//IL_000c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0105: Unknown result type (might be due to invalid IL or missing references)
			//IL_010a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0113: Unknown result type (might be due to invalid IL or missing references)
			//IL_0119: Unknown result type (might be due to invalid IL or missing references)
			//IL_011f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0125: Unknown result type (might be due to invalid IL or missing references)
			//IL_012c: Unknown result type (might be due to invalid IL or missing references)
			//IL_014e: Unknown result type (might be due to invalid IL or missing references)
			//IL_015c: Unknown result type (might be due to invalid IL or missing references)
			//IL_016a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0178: 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_029e: Expected O, but got Unknown
			//IL_01c6: Unknown result type (might be due to invalid IL or missing references)
			//IL_01cb: Unknown result type (might be due to invalid IL or missing references)
			//IL_01d4: 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_01e0: 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_01ed: Unknown result type (might be due to invalid IL or missing references)
			//IL_020f: 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_0239: 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)
			float value = Random.value;
			Color white = Color.white;
			string text = "Normal";
			if (value < 1f / 6f)
			{
				((Color)(ref white))..ctor(0f, 0f, 0f, 1f);
				text = "Black";
			}
			else
			{
				if (!(value < 1f / 3f))
				{
					return;
				}
				((Color)(ref white))..ctor(1f, 0f, 0f, 1f);
				text = "Red";
			}
			Renderer[] componentsInChildren = scoutmasterObj.GetComponentsInChildren<Renderer>(true);
			Renderer[] array = componentsInChildren;
			foreach (Renderer val in array)
			{
				if (!(val is SkinnedMeshRenderer) && !(val is MeshRenderer))
				{
					continue;
				}
				Material[] materials = val.materials;
				foreach (Material val2 in materials)
				{
					if ((Object)(object)val2 == (Object)null)
					{
						continue;
					}
					if (val2.HasProperty("_BaseColor"))
					{
						Color color = val2.GetColor("_BaseColor");
						val2.SetColor("_BaseColor", new Color(white.r, white.g, white.b, color.a));
						((BaseUnityPlugin)this).Logger.LogInfo((object)$"Applied {text} color (R:{white.r}, G:{white.g}, B:{white.b}, A:{color.a}) to {((Object)val).name} on {((Object)scoutmasterObj).name} using _BaseColor.");
						continue;
					}
					if (val2.HasProperty("_Color"))
					{
						Color color2 = val2.GetColor("_Color");
						val2.SetColor("_Color", new Color(white.r, white.g, white.b, color2.a));
						((BaseUnityPlugin)this).Logger.LogInfo((object)$"Applied {text} color (R:{white.r}, G:{white.g}, B:{white.b}, A:{color2.a}) to {((Object)val).name} on {((Object)scoutmasterObj).name} using _Color.");
						continue;
					}
					((BaseUnityPlugin)this).Logger.LogWarning((object)("Material on " + ((Object)val).name + " does not have _BaseColor or _Color property. Creating new material."));
					Material val3 = new Material(Shader.Find("Standard"));
					if ((Object)(object)val3 != (Object)null)
					{
						val3.color = white;
						val.material = val3;
						((BaseUnityPlugin)this).Logger.LogInfo((object)("Applied new " + text + " material to " + ((Object)val).name + " on " + ((Object)scoutmasterObj).name + "."));
					}
				}
			}
		}

		private void ApplyVisiblePassiveColor(GameObject scoutmasterObj)
		{
			//IL_007c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0081: Unknown result type (might be due to invalid IL or missing references)
			//IL_0094: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a7: 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_0190: Unknown result type (might be due to invalid IL or missing references)
			//IL_0197: Expected O, but got Unknown
			//IL_00fd: 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_0115: Unknown result type (might be due to invalid IL or missing references)
			//IL_0128: Unknown result type (might be due to invalid IL or missing references)
			//IL_013b: Unknown result type (might be due to invalid IL or missing references)
			//IL_01bc: Unknown result type (might be due to invalid IL or missing references)
			Renderer[] componentsInChildren = scoutmasterObj.GetComponentsInChildren<Renderer>(true);
			Renderer[] array = componentsInChildren;
			Color val3 = default(Color);
			Color val4 = default(Color);
			foreach (Renderer val in array)
			{
				if (!(val is SkinnedMeshRenderer) && !(val is MeshRenderer))
				{
					continue;
				}
				Material[] materials = val.materials;
				foreach (Material val2 in materials)
				{
					if ((Object)(object)val2 == (Object)null)
					{
						continue;
					}
					if (val2.HasProperty("_BaseColor"))
					{
						Color color = val2.GetColor("_BaseColor");
						((Color)(ref val3))..ctor(0.5f, 0.75f, 1f, color.a);
						val2.SetColor("_BaseColor", val3);
						((BaseUnityPlugin)this).Logger.LogInfo((object)$"Applied light blue tint (R:0.5, G:0.75, B:1, A:{color.a}) to {((Object)val).name} on {((Object)scoutmasterObj).name} using _BaseColor.");
						continue;
					}
					if (val2.HasProperty("_Color"))
					{
						Color color2 = val2.GetColor("_Color");
						((Color)(ref val4))..ctor(0.5f, 0.75f, 1f, color2.a);
						val2.SetColor("_Color", val4);
						((BaseUnityPlugin)this).Logger.LogInfo((object)$"Applied light blue tint (R:0.5, G:0.75, B:1, A:{color2.a}) to {((Object)val).name} on {((Object)scoutmasterObj).name} using _Color.");
						continue;
					}
					((BaseUnityPlugin)this).Logger.LogWarning((object)("Material on " + ((Object)val).name + " does not have _BaseColor or _Color property. Creating new material."));
					Material val5 = new Material(Shader.Find("Standard"));
					if ((Object)(object)val5 != (Object)null)
					{
						val5.color = new Color(0.5f, 0.75f, 1f, 1f);
						val.material = val5;
						((BaseUnityPlugin)this).Logger.LogInfo((object)("Applied new light blue material to " + ((Object)val).name + " on " + ((Object)scoutmasterObj).name + "."));
					}
				}
			}
		}

		private void ApplyTransparent(GameObject scoutmasterObj)
		{
			//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)
			//IL_008d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0094: 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_00a7: Unknown result type (might be due to invalid IL or missing references)
			//IL_01bc: Unknown result type (might be due to invalid IL or missing references)
			//IL_01c3: Expected O, but got Unknown
			//IL_0116: 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_0124: 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_0132: Unknown result type (might be due to invalid IL or missing references)
			//IL_013e: Unknown result type (might be due to invalid IL or missing references)
			//IL_01e8: Unknown result type (might be due to invalid IL or missing references)
			Renderer[] componentsInChildren = scoutmasterObj.GetComponentsInChildren<Renderer>(true);
			Renderer[] array = componentsInChildren;
			foreach (Renderer val in array)
			{
				if (!(val is SkinnedMeshRenderer) && !(val is MeshRenderer))
				{
					continue;
				}
				Material[] materials = val.materials;
				foreach (Material val2 in materials)
				{
					if ((Object)(object)val2 == (Object)null)
					{
						continue;
					}
					if (val2.HasProperty("_BaseColor"))
					{
						Color color = val2.GetColor("_BaseColor");
						val2.SetColor("_BaseColor", new Color(color.r, color.g, color.b, 0f));
						((BaseUnityPlugin)this).Logger.LogInfo((object)("Applied transparent (A:0) to " + ((Object)val).name + " on " + ((Object)scoutmasterObj).name + " using _BaseColor."));
						continue;
					}
					if (val2.HasProperty("_Color"))
					{
						Color color2 = val2.GetColor("_Color");
						val2.SetColor("_Color", new Color(color2.r, color2.g, color2.b, 0f));
						((BaseUnityPlugin)this).Logger.LogInfo((object)("Applied transparent (A:0) to " + ((Object)val).name + " on " + ((Object)scoutmasterObj).name + " using _Color."));
						continue;
					}
					((BaseUnityPlugin)this).Logger.LogWarning((object)("Material on " + ((Object)val).name + " does not have _BaseColor or _Color property. Creating new material."));
					Material val3 = new Material(Shader.Find("Standard"));
					if ((Object)(object)val3 != (Object)null)
					{
						val3.color = new Color(0f, 0f, 0f, 0f);
						val.material = val3;
						((BaseUnityPlugin)this).Logger.LogInfo((object)("Applied new transparent material to " + ((Object)val).name + " on " + ((Object)scoutmasterObj).name + "."));
					}
				}
			}
		}

		private void SetAggressiveScoutmasterSpeed(GameObject scoutmasterObj)
		{
			NavMeshAgent component = scoutmasterObj.GetComponent<NavMeshAgent>();
			if ((Object)(object)component != (Object)null)
			{
				float speed = component.speed;
				component.speed *= 1.5f;
				((BaseUnityPlugin)this).Logger.LogInfo((object)$"Increased speed of {((Object)scoutmasterObj).name} from {speed} to {component.speed} (1.5x).");
			}
			else
			{
				((BaseUnityPlugin)this).Logger.LogWarning((object)("No NavMeshAgent found on " + ((Object)scoutmasterObj).name + ", cannot increase speed."));
			}
		}

		private void SetScoutmasterIdle(GameObject scoutmasterObj)
		{
			NavMeshAgent component = scoutmasterObj.GetComponent<NavMeshAgent>();
			if ((Object)(object)component != (Object)null)
			{
				component.isStopped = true;
				component.ResetPath();
				((BaseUnityPlugin)this).Logger.LogInfo((object)("Stopped NavMeshAgent for " + ((Object)scoutmasterObj).name + " to remain idle."));
			}
			Component component2 = scoutmasterObj.GetComponent("Scoutmaster");
			if ((Object)(object)component2 != (Object)null)
			{
				PropertyInfo property = ((object)component2).GetType().GetProperty("isFleeing", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic);
				if (property != null)
				{
					try
					{
						property.SetValue(component2, false);
						((BaseUnityPlugin)this).Logger.LogInfo((object)("Set isFleeing to false for " + ((Object)scoutmasterObj).name + "."));
					}
					catch (Exception ex)
					{
						((BaseUnityPlugin)this).Logger.LogWarning((object)("Failed to set isFleeing for " + ((Object)scoutmasterObj).name + ": " + ex.Message));
					}
				}
				MethodInfo method = ((object)component2).GetType().GetMethod("DisableAI", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic);
				if (method != null)
				{
					try
					{
						method.Invoke(component2, null);
						((BaseUnityPlugin)this).Logger.LogInfo((object)("Disabled AI for " + ((Object)scoutmasterObj).name + "."));
						return;
					}
					catch (Exception ex2)
					{
						((BaseUnityPlugin)this).Logger.LogWarning((object)("Failed to disable AI for " + ((Object)scoutmasterObj).name + ": " + ex2.Message));
						return;
					}
				}
				((BaseUnityPlugin)this).Logger.LogInfo((object)("No DisableAI method found for " + ((Object)scoutmasterObj).name + ". Relying on NavMeshAgent stop."));
			}
			else
			{
				((BaseUnityPlugin)this).Logger.LogWarning((object)("Scoutmaster component not found on " + ((Object)scoutmasterObj).name + ", cannot ensure idle behavior."));
			}
		}

		private Vector3 CalculateRandomSpawnPosition(Character player)
		{
			//IL_0007: Unknown result type (might be due to invalid IL or missing references)
			//IL_000c: Unknown result type (might be due to invalid IL or missing references)
			//IL_000d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0012: Unknown result type (might be due to invalid IL or missing references)
			//IL_0016: Unknown result type (might be due to invalid IL or missing references)
			//IL_0020: Unknown result type (might be due to invalid IL or missing references)
			//IL_0025: Unknown result type (might be due to invalid IL or missing references)
			//IL_0026: Unknown result type (might be due to invalid IL or missing references)
			//IL_0027: Unknown result type (might be due to invalid IL or missing references)
			//IL_0032: Unknown result type (might be due to invalid IL or missing references)
			//IL_0038: Unknown result type (might be due to invalid IL or missing references)
			//IL_003d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0042: Unknown result type (might be due to invalid IL or missing references)
			//IL_004e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0054: 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_00c9: Unknown result type (might be due to invalid IL or missing references)
			//IL_00cf: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ec: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ed: Unknown result type (might be due to invalid IL or missing references)
			//IL_007c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0081: Unknown result type (might be due to invalid IL or missing references)
			//IL_0096: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b9: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f1: Unknown result type (might be due to invalid IL or missing references)
			Vector3 position = ((Component)player).transform.position;
			Vector2 insideUnitCircle = Random.insideUnitCircle;
			Vector2 val = ((Vector2)(ref insideUnitCircle)).normalized * 100f;
			Vector3 val2 = position + new Vector3(val.x, 0f, val.y);
			((BaseUnityPlugin)this).Logger.LogInfo((object)$"Calculating spawn: Player at {position}, Target: {val2}");
			NavMeshHit val3 = default(NavMeshHit);
			if (NavMesh.SamplePosition(val2, ref val3, 10f, -1))
			{
				float num = Vector3.Distance(((NavMeshHit)(ref val3)).position, position);
				((BaseUnityPlugin)this).Logger.LogInfo((object)$"Valid NavMesh position found at {((NavMeshHit)(ref val3)).position} (distance from player: {num:F2}m).");
				return ((NavMeshHit)(ref val3)).position;
			}
			((BaseUnityPlugin)this).Logger.LogWarning((object)$"No valid NavMesh position found at {val2}, using closest valid position {val2} (distance from player: {Vector3.Distance(val2, position):F2}m).");
			return val2;
		}

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

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

		private void DespawnAllObjects()
		{
			GameObject[] array = spawnedObjects.ToArray();
			foreach (GameObject val in array)
			{
				if ((Object)(object)val != (Object)null)
				{
					if (PhotonNetwork.IsConnected && PhotonNetwork.InRoom)
					{
						PhotonNetwork.Destroy(val);
					}
					else
					{
						Object.Destroy((Object)(object)val);
					}
					((BaseUnityPlugin)this).Logger.LogInfo((object)"Despawned a Scoutmaster.");
				}
			}
			spawnedObjects.Clear();
		}

		private void OnGUI()
		{
			//IL_0021: Unknown result type (might be due to invalid IL or missing references)
			//IL_0026: Unknown result type (might be due to invalid IL or missing references)
			//IL_002f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0044: Unknown result type (might be due to invalid IL or missing references)
			//IL_003d: 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_0057: Unknown result type (might be due to invalid IL or missing references)
			//IL_0060: Expected O, but got Unknown
			//IL_0067: Unknown result type (might be due to invalid IL or missing references)
			//IL_0071: Expected O, but got Unknown
			//IL_006c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0071: Unknown result type (might be due to invalid IL or missing references)
			//IL_0078: Unknown result type (might be due to invalid IL or missing references)
			//IL_008d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0093: Unknown result type (might be due to invalid IL or missing references)
			//IL_0099: Unknown result type (might be due to invalid IL or missing references)
			if (!string.IsNullOrEmpty(toggleMessage))
			{
				GUIStyle val = new GUIStyle(GUI.skin.label)
				{
					fontSize = 24
				};
				val.normal.textColor = (autoSpawnEnabled ? Color.green : Color.red);
				val.fontStyle = (FontStyle)1;
				val.alignment = (TextAnchor)4;
				GUIStyle val2 = val;
				Vector2 val3 = val2.CalcSize(new GUIContent(toggleMessage));
				GUI.Label(new Rect(((float)Screen.width - val3.x) / 2f, (float)(Screen.height / 2), val3.x, val3.y), toggleMessage, val2);
			}
		}
	}
	public static class TransformExtensions
	{
		public static string GetPath(this Transform transform)
		{
			string text = ((Object)transform).name;
			while ((Object)(object)transform.parent != (Object)null)
			{
				transform = transform.parent;
				text = ((Object)transform).name + "/" + text;
			}
			return text;
		}
	}
}
namespace System.Runtime.CompilerServices
{
	[AttributeUsage(AttributeTargets.Assembly, AllowMultiple = true)]
	internal sealed class IgnoresAccessChecksToAttribute : Attribute
	{
		public IgnoresAccessChecksToAttribute(string assemblyName)
		{
		}
	}
}