Decompiled source of SpawnerArmExtras v4.0.3

SpawnerArmExtras.dll

Decompiled 2 weeks ago
using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using BepInEx;
using BepInEx.Logging;
using HarmonyLib;
using Microsoft.CodeAnalysis;
using Newtonsoft.Json;
using Sandbox;
using ULTRAKILL.Cheats;
using Unity.AI.Navigation;
using UnityEngine;
using UnityEngine.AI;
using UnityEngine.AddressableAssets;
using UnityEngine.ProBuilder;
using UnityEngine.SceneManagement;
using plog.Models;

[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(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")]
[assembly: AssemblyCompany("SpawnerArmExtras")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("4.0.3.0")]
[assembly: AssemblyInformationalVersion("4.0.3+1625d5d87957fd20bf520152b178e5f8d1235a02")]
[assembly: AssemblyProduct("SpawnerArmExtras")]
[assembly: AssemblyTitle("SpawnerArmExtras")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("4.0.3.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.Module, AllowMultiple = false, Inherited = false)]
	internal sealed class RefSafetyRulesAttribute : Attribute
	{
		public readonly int Version;

		public RefSafetyRulesAttribute(int P_0)
		{
			Version = P_0;
		}
	}
}
namespace SpawnerArmExtras
{
	public class WickedSpawned : MonoBehaviour
	{
		public bool active = true;

		public float freezeTimeMax = 5f;

		public float freezeTime = 0f;

		public bool immune = false;

		public float immuneTimeMax = 5f;

		public float immuneTime = 5f;

		public Animator anim;

		public float defaultAnimSpeed = 1f;

		public void Start()
		{
			anim = ((Component)this).gameObject.GetComponent<Animator>();
			defaultAnimSpeed = anim.speed;
		}

		public void Update()
		{
			if (!active)
			{
				immuneTime = 0f;
				freezeTime += Time.deltaTime;
				if (freezeTime >= freezeTimeMax)
				{
					freezeTime = 0f;
					active = true;
					anim.speed = defaultAnimSpeed;
				}
			}
			else
			{
				immuneTime += Time.deltaTime;
				if (immuneTime < immuneTimeMax)
				{
					immune = true;
				}
				else
				{
					immune = false;
				}
			}
		}
	}
	public class BlackHoleFromMortar : MonoBehaviour
	{
		public EnemyIdentifier source = null;

		public void Update()
		{
			if ((Object)(object)source == (Object)null)
			{
				((Component)this).gameObject.GetComponent<BlackHoleProjectile>().Explode();
			}
		}
	}
	public class DisgraceSpawned : MonoBehaviour
	{
		[CompilerGenerated]
		private sealed class <Dash>d__13 : IEnumerator<object>, IEnumerator, IDisposable
		{
			private int <>1__state;

			private object <>2__current;

			public int times;

			public DisgraceSpawned <>4__this;

			private Vector3 <distance>5__1;

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

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

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

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

			private bool MoveNext()
			{
				//IL_0026: Unknown result type (might be due to invalid IL or missing references)
				//IL_0030: Expected O, but got Unknown
				//IL_00e6: Unknown result type (might be due to invalid IL or missing references)
				//IL_00f6: Unknown result type (might be due to invalid IL or missing references)
				//IL_005f: Unknown result type (might be due to invalid IL or missing references)
				//IL_006e: Unknown result type (might be due to invalid IL or missing references)
				//IL_0073: Unknown result type (might be due to invalid IL or missing references)
				//IL_0078: Unknown result type (might be due to invalid IL or missing references)
				//IL_0089: 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_0099: Unknown result type (might be due to invalid IL or missing references)
				//IL_009e: 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 = (object)new WaitForSeconds(0.01f);
					<>1__state = 1;
					return true;
				case 1:
					<>1__state = -1;
					if (times > 0)
					{
						<distance>5__1 = ((Component)<>4__this.mf).transform.position - ((Component)MonoSingleton<NewMovement>.Instance).transform.position;
						Transform transform = ((Component)<>4__this).transform;
						transform.position -= 0.1f * <distance>5__1;
						((MonoBehaviour)<>4__this).StartCoroutine(<>4__this.Dash(times - 1));
					}
					else
					{
						Object.Instantiate<GameObject>(Plugin.Enemies["Explosion"], ((Component)<>4__this).transform.position, ((Component)<>4__this).transform.rotation);
						<>4__this.dashing = false;
						<>4__this.dashCooldown = 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();
			}
		}

		public bool dashing = false;

		public float dashCooldown = 0f;

		public float dashCooldownMax = 0.6f;

		public float randomizedSpeed;

		public Color red = new Color(0.9f, 0.5f, 0.6f);

		public Color green = new Color(0.5f, 0.9f, 0.6f);

		public Transform mf;

		public Follow follow;

		public AlwaysLookAtCamera looker;

		public SkinnedMeshRenderer renderer;

		public EnemyIdentifier eid;

		public float difficultySpeedModifier;

		public void Start()
		{
			//IL_0063: Unknown result type (might be due to invalid IL or missing references)
			mf = ((Component)this).transform.Find("MaliciousFace");
			follow = ((Component)this).gameObject.AddComponent<Follow>();
			follow.speed = 12f;
			looker = ((Component)mf).gameObject.AddComponent<AlwaysLookAtCamera>();
			mf.localScale = new Vector3(0.1f, 0.0875f, 0.0005f);
			randomizedSpeed = Random.Range(-1.6f, 1.6f);
			renderer = ((Component)this).gameObject.GetComponentInChildren<SkinnedMeshRenderer>();
			eid = ((Component)this).gameObject.GetComponent<EnemyIdentifier>();
			for (int i = 0; i < ((Component)this).transform.parent.childCount; i++)
			{
				Transform child = ((Component)this).transform.parent.GetChild(i);
				if (((Object)child).name.Contains("Leg"))
				{
					((Component)child).gameObject.SetActive(false);
				}
			}
			switch (eid.difficulty)
			{
			case 5:
			case 19:
				difficultySpeedModifier = 1.15f;
				break;
			case 4:
				difficultySpeedModifier = 1f;
				break;
			case 3:
				difficultySpeedModifier = 0.9f;
				break;
			case 2:
				difficultySpeedModifier = 0.75f;
				break;
			case 1:
				difficultySpeedModifier = 0.5f;
				break;
			case 0:
				difficultySpeedModifier = 0.4f;
				break;
			}
			dashCooldownMax /= difficultySpeedModifier;
		}

		[IteratorStateMachine(typeof(<Dash>d__13))]
		public IEnumerator Dash(int times)
		{
			//yield-return decompiler failed: Unexpected instruction in Iterator.Dispose()
			return new <Dash>d__13(0)
			{
				<>4__this = this,
				times = times
			};
		}

		public void Update()
		{
			//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_0065: 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_0159: Unknown result type (might be due to invalid IL or missing references)
			//IL_0120: Unknown result type (might be due to invalid IL or missing references)
			//IL_018d: 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)
			if (eid.dead)
			{
				Object.Destroy((Object)(object)this);
			}
			if (!dashing)
			{
				dashCooldown += Time.deltaTime;
			}
			NewMovement instance = MonoSingleton<NewMovement>.Instance;
			Vector3 val = ((Component)mf).transform.position - ((Component)instance).transform.position;
			float num = Vector3.Dot(((Vector3)(ref val)).normalized, ((Component)instance.cc).transform.forward);
			if (((Vector3)(ref val)).magnitude <= 12f && dashCooldown >= dashCooldownMax && !dashing && !BlindEnemies.Blind && !EnemyIgnorePlayer.Active && !eid.dead)
			{
				dashing = true;
				((MonoBehaviour)this).StartCoroutine(Dash(10));
			}
			if (num > 0.9f)
			{
				follow.speed = (3f + randomizedSpeed * 0.375f) * difficultySpeedModifier;
				((Renderer)renderer).material.color = red;
			}
			else
			{
				follow.speed = (8f + randomizedSpeed) * difficultySpeedModifier;
				((Renderer)renderer).material.color = green;
			}
			if (eid.dead)
			{
				((Renderer)renderer).material.color = ((Renderer)renderer).material.color / 3f;
			}
			if (BlindEnemies.Blind || EnemyIgnorePlayer.Active)
			{
				((Behaviour)follow).enabled = false;
				((Behaviour)looker).enabled = false;
			}
			else
			{
				((Behaviour)follow).enabled = true;
				((Behaviour)looker).enabled = true;
			}
		}
	}
	public class FromOneTimeParry : MonoBehaviour
	{
		public OneTimeParry source;

		public void Awake()
		{
			source = null;
		}
	}
	public class OneTimeParry : MonoBehaviour
	{
		[CompilerGenerated]
		private sealed class <GotParried>d__6 : IEnumerator<object>, IEnumerator, IDisposable
		{
			private int <>1__state;

			private object <>2__current;

			public OneTimeParry <>4__this;

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

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

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

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

			private bool MoveNext()
			{
				//IL_0026: Unknown result type (might be due to invalid IL or missing references)
				//IL_0030: Expected O, but got Unknown
				switch (<>1__state)
				{
				default:
					return false;
				case 0:
					<>1__state = -1;
					<>2__current = (object)new WaitForSeconds(0.1f);
					<>1__state = 1;
					return true;
				case 1:
					<>1__state = -1;
					Object.Destroy((Object)(object)((Component)<>4__this.mine).gameObject);
					<>4__this.disableObject.SetActive(false);
					if ((Object)(object)<>4__this.mach != (Object)null)
					{
						Machine mach = <>4__this.mach;
						((Enemy)mach).health = ((Enemy)mach).health - <>4__this.subtractHealth;
					}
					if ((Object)(object)<>4__this.enemy != (Object)null)
					{
						Enemy enemy = <>4__this.enemy;
						enemy.health -= <>4__this.subtractHealth;
					}
					if (((Enemy)<>4__this.mach).health <= 0f)
					{
						((Component)<>4__this.mach).gameObject.GetComponent<EnemyIdentifier>().SimpleDamage(0f);
					}
					Object.Destroy((Object)(object)<>4__this);
					return false;
				}
			}

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

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

		public Landmine mine;

		public GameObject disableObject;

		public Machine mach;

		public Enemy enemy;

		public float subtractHealth;

		public void Start()
		{
			//IL_0017: Unknown result type (might be due to invalid IL or missing references)
			//IL_0022: Unknown result type (might be due to invalid IL or missing references)
			//IL_0050: Unknown result type (might be due to invalid IL or missing references)
			//IL_0181: Unknown result type (might be due to invalid IL or missing references)
			//IL_018e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0198: Unknown result type (might be due to invalid IL or missing references)
			mine = Object.Instantiate<GameObject>(Plugin.Enemies["Landmine"], ((Component)this).transform.position, ((Component)this).transform.rotation).GetComponent<Landmine>();
			((Component)mine).transform.localScale = new Vector3(1.5f, 1.5f, 1.5f);
			((Component)mine).gameObject.AddComponent<FromOneTimeParry>().source = this;
			Rigidbody component = ((Component)mine).gameObject.GetComponent<Rigidbody>();
			component.isKinematic = true;
			mine.activated = true;
			AudioSource component2 = ((Component)mine).gameObject.GetComponent<AudioSource>();
			component2.volume = 0f;
			mine.activatedBeep = null;
			Object.Destroy((Object)(object)((Component)mine).gameObject.GetComponent<MeshCollider>());
			Object.Destroy((Object)(object)((Component)mine).gameObject.GetComponent<ProBuilderMesh>());
			Object.Destroy((Object)(object)((Component)mine).gameObject.GetComponent<MeshRenderer>());
			Object.Destroy((Object)(object)((Component)mine).gameObject.GetComponent<MeshFilter>());
			Object.Destroy((Object)(object)((Component)((Component)mine).transform.Find("LightCylinder")).gameObject);
			((Component)((Component)mine).transform.Find("ParryZone")).gameObject.SetActive(true);
			Transform val = ((Component)mine).transform.Find("ParryZone/V2Flash");
			((Component)val).gameObject.AddComponent<AlwaysLookAtCamera>();
			val.position = ((Component)this).transform.position;
			val.localScale *= 3f;
		}

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

		public void Update()
		{
			if (mine.parried)
			{
				((MonoBehaviour)this).StartCoroutine(GotParried());
			}
		}
	}
	public class WatchtowerSpawned : MonoBehaviour
	{
		[CompilerGenerated]
		private sealed class <Shoot>d__12 : IEnumerator<object>, IEnumerator, IDisposable
		{
			private int <>1__state;

			private object <>2__current;

			public int times;

			public WatchtowerSpawned <>4__this;

			private Vector3 <playerPosition>5__1;

			private Vector3 <playerVelocity>5__2;

			private Vector3 <projectileOrigin>5__3;

			private Vector3 <toTarget>5__4;

			private float <a>5__5;

			private float <b>5__6;

			private float <c>5__7;

			private float <discriminant>5__8;

			private float <t>5__9;

			private Vector3 <predictedPosition>5__10;

			private float <sqrtDisc>5__11;

			private float <t1>5__12;

			private float <t2>5__13;

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

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

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

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

			private bool MoveNext()
			{
				//IL_003f: Unknown result type (might be due to invalid IL or missing references)
				//IL_0044: Unknown result type (might be due to invalid IL or missing references)
				//IL_0050: Unknown result type (might be due to invalid IL or missing references)
				//IL_0055: Unknown result type (might be due to invalid IL or missing references)
				//IL_0066: Unknown result type (might be due to invalid IL or missing references)
				//IL_006b: Unknown result type (might be due to invalid IL or missing references)
				//IL_0072: Unknown result type (might be due to invalid IL or missing references)
				//IL_0078: Unknown result type (might be due to invalid IL or missing references)
				//IL_007d: Unknown result type (might be due to invalid IL or missing references)
				//IL_0082: Unknown result type (might be due to invalid IL or missing references)
				//IL_0089: Unknown result type (might be due to invalid IL or missing references)
				//IL_008f: Unknown result type (might be due to invalid IL or missing references)
				//IL_00bd: Unknown result type (might be due to invalid IL or missing references)
				//IL_00c3: Unknown result type (might be due to invalid IL or missing references)
				//IL_00d5: 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_01e8: Unknown result type (might be due to invalid IL or missing references)
				//IL_01ee: Unknown result type (might be due to invalid IL or missing references)
				//IL_01f9: Unknown result type (might be due to invalid IL or missing references)
				//IL_01fe: Unknown result type (might be due to invalid IL or missing references)
				//IL_0203: 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_0234: Unknown result type (might be due to invalid IL or missing references)
				//IL_0259: 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_02a3: Unknown result type (might be due to invalid IL or missing references)
				//IL_02ad: Expected O, but got Unknown
				switch (<>1__state)
				{
				default:
					return false;
				case 0:
					<>1__state = -1;
					if (times > 0)
					{
						<playerPosition>5__1 = ((Component)MonoSingleton<NewMovement>.Instance).transform.position;
						<playerVelocity>5__2 = MonoSingleton<PlayerTracker>.Instance.GetPlayerVelocity(false);
						<projectileOrigin>5__3 = <>4__this.shootPoint.position;
						<toTarget>5__4 = <playerPosition>5__1 - <projectileOrigin>5__3;
						<a>5__5 = Vector3.Dot(<playerVelocity>5__2, <playerVelocity>5__2) - <>4__this.projectileSpeed * <>4__this.projectileSpeed;
						<b>5__6 = 2f * Vector3.Dot(<playerVelocity>5__2, <toTarget>5__4);
						<c>5__7 = Vector3.Dot(<toTarget>5__4, <toTarget>5__4);
						<discriminant>5__8 = <b>5__6 * <b>5__6 - 4f * <a>5__5 * <c>5__7;
						<t>5__9 = 0f;
						if (<discriminant>5__8 > 0f)
						{
							<sqrtDisc>5__11 = Mathf.Sqrt(<discriminant>5__8);
							<t1>5__12 = (0f - <b>5__6 + <sqrtDisc>5__11) / (2f * <a>5__5);
							<t2>5__13 = (0f - <b>5__6 - <sqrtDisc>5__11) / (2f * <a>5__5);
							<t>5__9 = Mathf.Max(<t1>5__12, <t2>5__13);
							if (<t>5__9 < 0f)
							{
								<t>5__9 = Mathf.Min(<t1>5__12, <t2>5__13);
							}
							if (<t>5__9 < 0f)
							{
								<t>5__9 = 0f;
							}
						}
						<predictedPosition>5__10 = <playerPosition>5__1 + <playerVelocity>5__2 * <t>5__9;
						<>4__this.currentProjectile = Object.Instantiate<GameObject>(<>4__this.projectile, <>4__this.shootPoint.position, <>4__this.shootPoint.rotation).GetComponent<Projectile>();
						((Component)<>4__this.currentProjectile).transform.LookAt(<predictedPosition>5__10);
						<>4__this.currentProjectile.safeEnemyType = (EnemyType)35;
						<>4__this.currentProjectile.speed = <>4__this.projectileSpeed;
						<>2__current = (object)new WaitForSeconds(0.1f / <>4__this.difficultySpeedModifier);
						<>1__state = 1;
						return true;
					}
					<>4__this.shooting = false;
					<>4__this.shootCooldown = 0f;
					break;
				case 1:
					<>1__state = -1;
					((MonoBehaviour)<>4__this).StartCoroutine(<>4__this.Shoot(times - 1));
					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();
			}
		}

		public bool shooting;

		public Transform shootPoint;

		public EnemyIdentifier eid;

		public OneTimeParry otp;

		public float shootCooldown = 0f;

		public float shootCooldownMax = 1.5f;

		public int shootCount = 6;

		public GameObject projectile = Plugin.Enemies["Projectile"];

		public Projectile currentProjectile;

		public float projectileSpeed = 110f;

		public float difficultySpeedModifier = 1f;

		public void Start()
		{
			shootPoint = ((Component)this).gameObject.GetComponent<MortarLauncher>().shootPoint;
			eid = ((Component)this).gameObject.GetComponent<EnemyIdentifier>();
			otp = ((Component)((Component)shootPoint).transform.Find("Sphere (1)")).gameObject.AddComponent<OneTimeParry>();
			otp.disableObject = ((Component)otp).gameObject;
			otp.mach = ((Component)this).gameObject.GetComponent<Machine>();
			otp.enemy = ((Component)this).gameObject.GetComponent<Enemy>();
			otp.subtractHealth = 10f;
			switch (eid.difficulty)
			{
			case 5:
			case 19:
				difficultySpeedModifier = 1.15f;
				shootCount = 6;
				break;
			case 4:
				difficultySpeedModifier = 1f;
				shootCount = 6;
				break;
			case 3:
				difficultySpeedModifier = 0.85f;
				shootCount = 4;
				break;
			case 2:
				difficultySpeedModifier = 0.65f;
				shootCount = 4;
				break;
			case 1:
				difficultySpeedModifier = 0.4f;
				shootCount = 3;
				break;
			case 0:
				difficultySpeedModifier = 0.3f;
				shootCount = 3;
				break;
			}
			shootCooldownMax /= difficultySpeedModifier;
			projectileSpeed *= difficultySpeedModifier;
		}

		[IteratorStateMachine(typeof(<Shoot>d__12))]
		public IEnumerator Shoot(int times)
		{
			//yield-return decompiler failed: Unexpected instruction in Iterator.Dispose()
			return new <Shoot>d__12(0)
			{
				<>4__this = this,
				times = times
			};
		}

		public void Update()
		{
			if (!shooting)
			{
				shootCooldown += Time.deltaTime;
			}
			if (shootCooldown >= shootCooldownMax && !shooting && !BlindEnemies.Blind && !EnemyIgnorePlayer.Active)
			{
				shooting = true;
				((MonoBehaviour)this).StartCoroutine(Shoot(shootCount));
			}
		}
	}
	public class HidePreviewIfNotInHand : MonoBehaviour
	{
		private Transform parent;

		private GameObject thingToHide;

		public void Start()
		{
			parent = ((Component)this).transform.parent;
			thingToHide = ((Component)((Component)this).transform.GetChild(0)).gameObject;
		}

		public void Update()
		{
			if (Object.op_Implicit((Object)(object)parent) && ((Object)parent).name == "Holder")
			{
				thingToHide.SetActive(true);
			}
			else
			{
				thingToHide.SetActive(false);
			}
		}
	}
	[HarmonyPatch(typeof(KillAllEnemies))]
	public class KillAllEnemiesPatch
	{
		public static void KillEnemy<T>() where T : MonoBehaviour
		{
			T[] array = Object.FindObjectsByType<T>((FindObjectsSortMode)0);
			T[] array2 = array;
			foreach (T val in array2)
			{
				Object.Destroy((Object)(object)((Component)(object)val).gameObject);
			}
		}

		[HarmonyPrefix]
		[HarmonyPatch(typeof(KillAllEnemies), "Enable")]
		public static void EnablePrefix(CheatsManager manager)
		{
			KillAllEnemiesPatch.KillEnemy<Wicked>();
			KillAllEnemiesPatch.KillEnemy<GhostDrone>();
			KillAllEnemiesPatch.KillEnemy<MinosArm>();
			FromOneTimeParry[] array = Object.FindObjectsByType<FromOneTimeParry>((FindObjectsSortMode)0);
			foreach (FromOneTimeParry fromOneTimeParry in array)
			{
				Object.Destroy((Object)(object)((Component)fromOneTimeParry).gameObject);
			}
		}
	}
	[HarmonyPatch(typeof(MinosArm), "Retreat")]
	public class MinosArmPatch
	{
		public static void Prefix(MinosArm __instance)
		{
			if (!((Object)(object)Util.FindParentWithNameContaining("MinosArmSpawned", ((Component)__instance).transform) == (Object)null))
			{
				Object.Destroy((Object)(object)((Component)__instance).gameObject);
			}
		}
	}
	[HarmonyPatch(typeof(Wicked))]
	public class WickedPatch
	{
		[HarmonyPostfix]
		[HarmonyPatch(typeof(Wicked), "Start")]
		public static void StartPostfix(Wicked __instance)
		{
			if (!((Object)(object)Util.FindParentWithNameContaining("WickedSpawned", ((Component)__instance).transform) == (Object)null))
			{
				((Component)__instance).gameObject.AddComponent<WickedSpawned>();
			}
		}

		[HarmonyPrefix]
		[HarmonyPatch(typeof(Wicked), "Update")]
		public static bool UpdatePrefix(Wicked __instance)
		{
			WickedSpawned component = ((Component)__instance).gameObject.GetComponent<WickedSpawned>();
			if ((Object)(object)component != (Object)null && !component.active)
			{
				return false;
			}
			if (BlindEnemies.Blind || EnemyIgnorePlayer.Active)
			{
				return false;
			}
			__instance.playerSpotTime = 999f;
			return true;
		}

		[HarmonyPrefix]
		[HarmonyPatch(typeof(Wicked), "OnCollisionEnter")]
		public static bool OnCollisionEnterPrefix(Wicked __instance)
		{
			if ((Object)(object)Util.FindParentWithNameContaining("WickedSpawned", ((Component)__instance).transform) == (Object)null)
			{
				return true;
			}
			WickedSpawned component = ((Component)__instance).gameObject.GetComponent<WickedSpawned>();
			if (!component.active)
			{
				return false;
			}
			return true;
		}

		[HarmonyPrefix]
		[HarmonyPatch(typeof(Wicked), "GetHit")]
		public static bool GetHitPrefix(Wicked __instance)
		{
			if (!((Component)__instance).gameObject.activeInHierarchy)
			{
				return false;
			}
			WickedSpawned component = ((Component)__instance).gameObject.GetComponent<WickedSpawned>();
			if ((Object)(object)component == (Object)null)
			{
				return true;
			}
			if (!component.immune)
			{
				component.active = false;
				((Component)__instance).gameObject.GetComponent<Animator>().speed = 0f;
				((Component)__instance).gameObject.GetComponent<NavMeshAgent>().speed = 0f;
			}
			return false;
		}
	}
	[HarmonyPatch(typeof(GhostDrone))]
	public class GhostDronePatch
	{
		[HarmonyPostfix]
		[HarmonyPatch(typeof(GhostDrone), "Start")]
		public static void StartPostfix(GhostDrone __instance)
		{
			if (!((Object)(object)Util.FindParentWithNameContaining("DroneGhostSpawned", ((Component)__instance).transform) == (Object)null))
			{
				((Component)((Component)__instance).transform.Find("Armature/Root/GhostDrone_GlowPlane")).gameObject.SetActive(true);
			}
		}
	}
	[HarmonyPatch(typeof(MinotaurChase))]
	public class MinotaurChasePatch
	{
		[HarmonyPrefix]
		[HarmonyPatch(typeof(MinotaurChase), "Start")]
		public static void StartPrefix(MinotaurChase __instance)
		{
			//IL_0025: 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)
			if (!((Object)(object)Util.FindParentWithNameContaining("MinotaurSpawned", ((Component)__instance).transform) == (Object)null))
			{
				__instance.leashPosition = ((Component)__instance).transform.position;
				__instance.trackTarget = false;
				__instance.eid = ((Component)__instance).GetComponent<EnemyIdentifier>();
				__instance.eid.isBoss = false;
			}
		}

		[HarmonyPrefix]
		[HarmonyPatch(typeof(MinotaurChase), "Update")]
		public static bool UpdatePrefix(MinotaurChase __instance)
		{
			if (!((Object)(object)Util.FindParentWithNameContaining("MinotaurSpawned", ((Component)__instance).transform) != (Object)null) || !(__instance.eid.health <= 0f))
			{
				return true;
			}
			Object.Destroy((Object)(object)((Component)((Component)__instance).transform.parent).gameObject);
			return false;
		}
	}
	[HarmonyPatch(typeof(Flammable), "Burn")]
	public class FlammablePatch
	{
		public static void Postfix(Flammable __instance)
		{
			//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_0049: 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_005b: 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_00a6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ab: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00bd: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c9: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d5: Unknown result type (might be due to invalid IL or missing references)
			if ((Object)(object)__instance.currentFire != (Object)null && (Object)(object)Util.FindParentWithNameContaining("DisgraceSpawned", ((Component)__instance).transform) != (Object)null)
			{
				Vector3 localScale = __instance.currentFire.transform.localScale;
				__instance.currentFire.transform.localScale = new Vector3(localScale.x, localScale.y / 200f, localScale.z);
			}
			else if ((Object)(object)__instance.currentFire != (Object)null && (Object)(object)Util.FindParentWithNameContaining("WatchtowerSpawned", ((Component)__instance).transform) != (Object)null)
			{
				Vector3 localScale2 = __instance.currentFire.transform.localScale;
				__instance.currentFire.transform.localScale = new Vector3(localScale2.x, localScale2.y * 0.3f, localScale2.z * 0.3f);
			}
		}
	}
	[HarmonyPatch(typeof(MortarLauncher), "ShootHoming")]
	public class MortarLauncherBlackHolePatch
	{
		public static bool Prefix(MortarLauncher __instance)
		{
			//IL_007a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0085: Unknown result type (might be due to invalid IL or missing references)
			//IL_009c: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a6: 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)
			if ((Object)(object)Util.FindParentWithNameContaining("BlackHoleMortarSpawned", ((Component)__instance).transform) == (Object)null)
			{
				return true;
			}
			BlackHoleFromMortar[] array = Object.FindObjectsByType<BlackHoleFromMortar>((FindObjectsSortMode)0);
			foreach (BlackHoleFromMortar blackHoleFromMortar in array)
			{
				if ((Object)(object)blackHoleFromMortar.source == (Object)(object)__instance.eid)
				{
					return false;
				}
			}
			BlackHoleProjectile component = Object.Instantiate<GameObject>(Plugin.Enemies["BlackHole"], __instance.shootPoint.position, __instance.shootPoint.rotation).GetComponent<BlackHoleProjectile>();
			Transform transform = ((Component)component).transform;
			transform.localScale *= 3f;
			component.safeType = (EnemyType)35;
			component.Activate();
			((Component)component).gameObject.AddComponent<BlackHoleFromMortar>().source = __instance.eid;
			if (Object.op_Implicit((Object)(object)__instance.anim))
			{
				__instance.anim.Play("Shoot", 0, 0f);
			}
			return false;
		}
	}
	[HarmonyPatch(typeof(MaliciousFace))]
	public class MaliciousFacePatch
	{
		[CompilerGenerated]
		private sealed class <DisgraceDeath>d__0 : IEnumerator<object>, IEnumerator, IDisposable
		{
			private int <>1__state;

			private object <>2__current;

			public Transform tr;

			private Vector3 <pos>5__1;

			private Quaternion <rot>5__2;

			private Transform <gib>5__3;

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

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

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

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

			private bool MoveNext()
			{
				//IL_0034: Unknown result type (might be due to invalid IL or missing references)
				//IL_003e: Expected O, but got Unknown
				//IL_0055: Unknown result type (might be due to invalid IL or missing references)
				//IL_005a: Unknown result type (might be due to invalid IL or missing references)
				//IL_0066: 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_0080: Unknown result type (might be due to invalid IL or missing references)
				//IL_0086: Unknown result type (might be due to invalid IL or missing references)
				//IL_0097: Unknown result type (might be due to invalid IL or missing references)
				//IL_00a1: Expected O, but got Unknown
				//IL_00c2: 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_00db: 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_010a: 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 = (object)new WaitForSeconds(1f);
					<>1__state = 1;
					return true;
				case 1:
					<>1__state = -1;
					<pos>5__1 = tr.position;
					<rot>5__2 = tr.rotation;
					Object.Instantiate<GameObject>(Plugin.Enemies["Explosion"], <pos>5__1, <rot>5__2);
					<>2__current = (object)new WaitForSeconds(0.1f);
					<>1__state = 2;
					return true;
				case 2:
					<>1__state = -1;
					<gib>5__3 = Object.Instantiate<GameObject>(Plugin.Enemies["BrainGib"], <pos>5__1 + new Vector3(0f, -3f, 0f), <rot>5__2).transform;
					<gib>5__3.localScale = new Vector3(1.5f, 1.5f, 4.5f);
					Object.Destroy((Object)(object)((Component)tr.parent.parent).gameObject);
					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();
			}
		}

		[IteratorStateMachine(typeof(<DisgraceDeath>d__0))]
		public static IEnumerator DisgraceDeath(Transform tr)
		{
			//yield-return decompiler failed: Unexpected instruction in Iterator.Dispose()
			return new <DisgraceDeath>d__0(0)
			{
				tr = tr
			};
		}

		[HarmonyPostfix]
		[HarmonyPatch(typeof(MaliciousFace), "Start")]
		public static void StartPostfix(MaliciousFace __instance)
		{
			if (!((Object)(object)Util.FindParentWithNameContaining("DisgraceSpawned", ((Component)__instance).transform) == (Object)null))
			{
				__instance.eid.health = 20f;
				__instance.spider.health = 20f;
				((Component)__instance).gameObject.AddComponent<DisgraceSpawned>();
			}
		}

		[HarmonyPrefix]
		[HarmonyPatch(typeof(MaliciousFace), "Die")]
		public static bool DiePrefix(MaliciousFace __instance)
		{
			if ((Object)(object)((Component)__instance).gameObject.GetComponent<DisgraceSpawned>() == (Object)null)
			{
				return true;
			}
			((MonoBehaviour)__instance).StartCoroutine(DisgraceDeath(((Component)__instance).transform));
			return false;
		}

		[HarmonyPrefix]
		[HarmonyPatch(typeof(MaliciousFace), "Update")]
		public static bool UpdatePrefix(MaliciousFace __instance)
		{
			if ((Object)(object)((Component)__instance).gameObject.GetComponent<DisgraceSpawned>() == (Object)null)
			{
				return true;
			}
			return false;
		}
	}
	[HarmonyPatch(typeof(MortarLauncher))]
	public class MortarLauncherWatchtowerPatch
	{
		[CompilerGenerated]
		private sealed class <ShowSphere>d__0 : IEnumerator<object>, IEnumerator, IDisposable
		{
			private int <>1__state;

			private object <>2__current;

			public Transform tr;

			private Transform <objSphere>5__1;

			private Transform <subSphere>5__2;

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

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

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

			[DebuggerHidden]
			void IDisposable.Dispose()
			{
				<objSphere>5__1 = null;
				<subSphere>5__2 = null;
				<>1__state = -2;
			}

			private bool MoveNext()
			{
				//IL_0026: Unknown result type (might be due to invalid IL or missing references)
				//IL_0030: Expected O, but got Unknown
				//IL_007d: Unknown result type (might be due to invalid IL or missing references)
				//IL_009d: 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 = (object)new WaitForSeconds(0.85f);
					<>1__state = 1;
					return true;
				case 1:
					<>1__state = -1;
					<objSphere>5__1 = tr.Find("Armature/Pole_Top/Sphere (1)");
					((Component)<objSphere>5__1).gameObject.SetActive(true);
					<objSphere>5__1.localScale = new Vector3(0.08f, 0.2f, 0.2f);
					<objSphere>5__1.localPosition = new Vector3(-0.45f, 0f, 0f);
					<subSphere>5__2 = <objSphere>5__1.Find("Sphere (1)");
					((Component)<subSphere>5__2).gameObject.SetActive(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();
			}
		}

		[IteratorStateMachine(typeof(<ShowSphere>d__0))]
		public static IEnumerator ShowSphere(Transform tr)
		{
			//yield-return decompiler failed: Unexpected instruction in Iterator.Dispose()
			return new <ShowSphere>d__0(0)
			{
				tr = tr
			};
		}

		[HarmonyPostfix]
		[HarmonyPatch(typeof(MortarLauncher), "Start")]
		public static void StartPostfix(MortarLauncher __instance)
		{
			if ((Object)(object)Util.FindParentWithNameContaining("WatchtowerSpawned", ((Component)__instance).transform) != (Object)null)
			{
				((Enemy)((Component)__instance).gameObject.GetComponent<Machine>()).health = 30f;
				((Component)__instance).gameObject.GetComponent<Enemy>().health = 30f;
				((Component)__instance).gameObject.AddComponent<WatchtowerSpawned>();
				((MonoBehaviour)__instance).StartCoroutine(ShowSphere(((Component)__instance).transform));
			}
		}

		[HarmonyPrefix]
		[HarmonyPatch(typeof(MortarLauncher), "Update")]
		public static bool UpdatePrefix(MortarLauncher __instance)
		{
			if ((Object)(object)((Component)__instance).gameObject.GetComponent<WatchtowerSpawned>() != (Object)null)
			{
				return false;
			}
			return true;
		}
	}
	[HarmonyPatch(typeof(Landmine))]
	public class LandminePatch
	{
		[HarmonyPrefix]
		[HarmonyPatch(typeof(Landmine), "Parry")]
		public static bool SetColorPrefix(Landmine __instance)
		{
			FromOneTimeParry component = ((Component)__instance).gameObject.GetComponent<FromOneTimeParry>();
			if ((Object)(object)component != (Object)null)
			{
				__instance.parried = true;
				return false;
			}
			return true;
		}
	}
	[HarmonyPatch(typeof(DroneFlesh), "Start")]
	public class DroneFleshPatch
	{
		public static void Postfix(DroneFlesh __instance)
		{
			//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)
			//IL_009f: 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)
			string name = ((Object)((Component)__instance).transform.parent).name;
			if (!name.Contains("Spawned") || (!name.Contains("DroneFlesh") && !name.Contains("DroneSkull")))
			{
				return;
			}
			FleshPrison[] array = Object.FindObjectsByType<FleshPrison>((FindObjectsSortMode)0);
			if (array.Length == 0)
			{
				return;
			}
			FleshPrison val = array[0];
			FleshPrison[] array2 = array;
			foreach (FleshPrison val2 in array2)
			{
				float num = Vector3.Distance(((Component)__instance).transform.position, ((Component)val2).transform.position);
				float num2 = Vector3.Distance(((Component)__instance).transform.position, ((Component)val).transform.position);
				if (num < num2)
				{
					val = val2;
				}
			}
			val.currentDrones.Add(__instance);
			if (val.healing)
			{
				LineToPoint val3 = default(LineToPoint);
				if (Object.Instantiate<GameObject>(val.healingTargetEffect, ((Component)__instance).transform).TryGetComponent<LineToPoint>(ref val3))
				{
					val3.targets[1] = val.rotationBone;
				}
				Rigidbody val4 = default(Rigidbody);
				if (((Component)__instance).TryGetComponent<Rigidbody>(ref val4))
				{
					val4.isKinematic = true;
				}
			}
		}
	}
	[HarmonyPatch]
	public class NavMeshStuff
	{
		[HarmonyPrefix]
		[HarmonyPatch(typeof(SandboxNavmesh), "Rebake")]
		public static bool SandboxNavmeshRebakePrefix(SandboxNavmesh __instance)
		{
			if (Util.IsSandbox())
			{
				return true;
			}
			BrushBlock[] array = Object.FindObjectsByType<BrushBlock>((FindObjectsInactive)1, (FindObjectsSortMode)0);
			BrushBlock[] array2 = array;
			foreach (BrushBlock val in array2)
			{
				if (!((Object)(object)((Component)val).transform.parent == (Object)(object)((Component)__instance.surface).transform))
				{
					((Component)val).transform.SetParent(((Component)__instance.surface).transform);
				}
			}
			SandboxProp[] array3 = Object.FindObjectsByType<SandboxProp>((FindObjectsInactive)1, (FindObjectsSortMode)0);
			SandboxProp[] array4 = array3;
			foreach (SandboxProp val2 in array4)
			{
				if (!((Object)(object)((Component)val2).transform.parent == (Object)(object)((Component)__instance.surface).transform))
				{
					((Component)val2).transform.SetParent(((Component)__instance.surface).transform);
				}
			}
			__instance.surface.BuildNavMesh();
			SandboxNavmesh.Log.Info("Navmesh built", (IEnumerable<Tag>)null, (string)null, (object)null);
			__instance.isDirty = false;
			MonoSingleton<SandboxHud>.Instance.HideNavmeshNotice();
			if (__instance.navmeshBuilt != null)
			{
				__instance.navmeshBuilt.Invoke();
			}
			MonoSingleton<CheatsManager>.Instance.RenderCheatsInfo();
			return false;
		}
	}
	[HarmonyPatch(typeof(PresenceController), "SceneManagerOnsceneLoaded")]
	public class PresencePatch
	{
		public static bool Prefix(Scene _, LoadSceneMode mode)
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_0003: Invalid comparison between Unknown and I4
			//IL_00ea: 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_00a8: Unknown result type (might be due to invalid IL or missing references)
			if ((int)mode == 1)
			{
				return false;
			}
			string currentScene = SceneHelper.CurrentScene;
			PresenceController.Log.Info("Scene loaded: " + currentScene, (IEnumerable<Tag>)null, (string)null, (object)null);
			DiscordController.Instance.FetchSceneActivity(currentScene);
			SteamController.Instance.FetchSceneActivity(currentScene);
			if ((Object)(object)MapInfoBase.Instance != (Object)null && currentScene == "uk_construct")
			{
				if (!MonoSingleton<PresenceController>.Instance.trackingTimeInSandbox)
				{
					PresenceController.Log.Info("Starting sandbox time tracking", (IEnumerable<Tag>)null, (string)null, (object)null);
					MonoSingleton<PresenceController>.Instance.trackingTimeInSandbox = true;
					MonoSingleton<PresenceController>.Instance.timeInSandbox = TimeSince.op_Implicit(0f);
				}
			}
			else if (MonoSingleton<PresenceController>.Instance.trackingTimeInSandbox)
			{
				PresenceController.Log.Info("Submitting sandbox time", (IEnumerable<Tag>)null, (string)null, (object)null);
				MonoSingleton<PresenceController>.Instance.trackingTimeInSandbox = false;
				SteamController.Instance.UpdateTimeInSandbox(TimeSince.op_Implicit(MonoSingleton<PresenceController>.Instance.timeInSandbox));
			}
			return false;
		}
	}
	[HarmonyPatch]
	public class SandboxOnlyStuff
	{
		[HarmonyPrefix]
		[HarmonyPatch(typeof(SpawnMenu), "RebuildMenu")]
		public static void SpawnMenuRebuildMenuPrefix()
		{
			MapInfoBase.Instance.sandboxTools = true;
		}

		[HarmonyPrefix]
		[HarmonyPatch(typeof(CheatsManager), "Start")]
		[HarmonyPriority(200)]
		public static bool CheatsManagerStartPrefix(CheatsManager __instance)
		{
			//IL_0009: Unknown result type (might be due to invalid IL or missing references)
			//IL_0018: Expected O, but got Unknown
			//IL_00be: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c4: Expected O, but got Unknown
			//IL_00c6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00cc: Expected O, but got Unknown
			//IL_00ce: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d4: Expected O, but got Unknown
			//IL_00d6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00dc: Expected O, but got Unknown
			//IL_00f0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f6: Expected O, but got Unknown
			//IL_00f8: Unknown result type (might be due to invalid IL or missing references)
			//IL_00fe: Expected O, but got Unknown
			//IL_0100: Unknown result type (might be due to invalid IL or missing references)
			//IL_0106: Expected O, but got Unknown
			//IL_011a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0120: Expected O, but got Unknown
			//IL_0122: Unknown result type (might be due to invalid IL or missing references)
			//IL_0128: Expected O, but got Unknown
			//IL_013c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0142: Expected O, but got Unknown
			//IL_0144: Unknown result type (might be due to invalid IL or missing references)
			//IL_014a: Expected O, but got Unknown
			//IL_014c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0152: Expected O, but got Unknown
			//IL_0154: Unknown result type (might be due to invalid IL or missing references)
			//IL_015a: Expected O, but got Unknown
			//IL_015c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0162: Expected O, but got Unknown
			//IL_0164: Unknown result type (might be due to invalid IL or missing references)
			//IL_016a: Expected O, but got Unknown
			//IL_017e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0184: Expected O, but got Unknown
			//IL_0186: Unknown result type (might be due to invalid IL or missing references)
			//IL_018c: Expected O, but got Unknown
			//IL_002d: Unknown result type (might be due to invalid IL or missing references)
			//IL_003c: Expected O, but got Unknown
			//IL_003e: Unknown result type (might be due to invalid IL or missing references)
			//IL_004d: Expected O, but got Unknown
			//IL_004f: Unknown result type (might be due to invalid IL or missing references)
			//IL_005e: Expected O, but got Unknown
			//IL_0060: Unknown result type (might be due to invalid IL or missing references)
			//IL_006f: Expected O, but got Unknown
			//IL_0071: Unknown result type (might be due to invalid IL or missing references)
			//IL_0080: Expected O, but got Unknown
			//IL_0082: Unknown result type (might be due to invalid IL or missing references)
			//IL_0091: Expected O, but got Unknown
			//IL_009b: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a1: Expected O, but got Unknown
			//IL_00a3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a9: Expected O, but got Unknown
			//IL_01ad: Unknown result type (might be due to invalid IL or missing references)
			//IL_01bc: Expected O, but got Unknown
			//IL_01e3: Unknown result type (might be due to invalid IL or missing references)
			//IL_01e9: Expected O, but got Unknown
			//IL_01eb: Unknown result type (might be due to invalid IL or missing references)
			//IL_01f1: Expected O, but got Unknown
			//IL_01f3: Unknown result type (might be due to invalid IL or missing references)
			//IL_01f9: Expected O, but got Unknown
			//IL_01fb: Unknown result type (might be due to invalid IL or missing references)
			//IL_0201: Expected O, but got Unknown
			//IL_0203: Unknown result type (might be due to invalid IL or missing references)
			//IL_0209: Expected O, but got Unknown
			//IL_020b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0211: Expected O, but got Unknown
			//IL_0213: Unknown result type (might be due to invalid IL or missing references)
			//IL_0219: Expected O, but got Unknown
			//IL_021b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0221: Expected O, but got Unknown
			//IL_022d: Unknown result type (might be due to invalid IL or missing references)
			//IL_023c: Expected O, but got Unknown
			//IL_01c9: Unknown result type (might be due to invalid IL or missing references)
			//IL_01d8: Expected O, but got Unknown
			__instance.RebuildIcons();
			__instance.RegisterCheat((ICheat)new KeepEnabled(), "meta");
			if ((Object)(object)MapInfoBase.Instance != (Object)null)
			{
				__instance.RegisterCheat((ICheat)new ExperimentalArmRotation(), "sandbox");
				__instance.RegisterCheat((ICheat)new QuickSave(), "sandbox");
				__instance.RegisterCheat((ICheat)new QuickLoad(), "sandbox");
				__instance.RegisterCheat((ICheat)new ManageSaves(), "sandbox");
				__instance.RegisterCheat((ICheat)new ClearMap(), "sandbox");
				__instance.RegisterCheat((ICheat)new RebuildNavmesh(), "sandbox");
				__instance.RegisterCheats((ICheat[])(object)new ICheat[2]
				{
					(ICheat)new Snapping(),
					(ICheat)new SpawnPhysics()
				}, "sandbox");
			}
			__instance.RegisterCheats((ICheat[])(object)new ICheat[4]
			{
				(ICheat)new SummonSandboxArm(),
				(ICheat)new TeleportMenu(),
				(ICheat)new FullBright(),
				(ICheat)new Invincibility()
			}, "general");
			__instance.RegisterCheats((ICheat[])(object)new ICheat[3]
			{
				(ICheat)new Noclip(),
				(ICheat)new Flight(),
				(ICheat)new InfiniteWallJumps()
			}, "movement");
			__instance.RegisterCheats((ICheat[])(object)new ICheat[2]
			{
				(ICheat)new NoWeaponCooldown(),
				(ICheat)new InfinitePowerUps()
			}, "weapons");
			__instance.RegisterCheats((ICheat[])(object)new ICheat[6]
			{
				(ICheat)new BlindEnemies(),
				(ICheat)new EnemiesHateEnemies(),
				(ICheat)new EnemyIgnorePlayer(),
				(ICheat)new DisableEnemySpawns(),
				(ICheat)new InvincibleEnemies(),
				(ICheat)new KillAllEnemies()
			}, "enemies");
			__instance.RegisterCheats((ICheat[])(object)new ICheat[2]
			{
				(ICheat)new HideWeapons(),
				(ICheat)new HideUI()
			}, "visual");
			bool flag = false;
			if (GameProgressSaver.GetClashModeUnlocked() && !flag)
			{
				__instance.RegisterCheat((ICheat)new CrashMode(), "special");
			}
			if (GameProgressSaver.GetGhostDroneModeUnlocked())
			{
				__instance.RegisterCheat((ICheat)new GhostDroneMode(), "special");
			}
			__instance.RegisterCheats((ICheat[])(object)new ICheat[8]
			{
				(ICheat)new PlayerParentingDebug(),
				(ICheat)new StateDebug(),
				(ICheat)new GunControlDebug(),
				(ICheat)new SandboxArmDebug(),
				(ICheat)new EnemyIdentifierDebug(),
				(ICheat)new ForceBossBars(),
				(ICheat)new SpreadGasoline(),
				(ICheat)new DeathCatcherDebug()
			}, "debug");
			__instance.RegisterCheat((ICheat)new PauseTimedBombs(), "debug");
			MonoSingleton<CheatBinds>.Instance.RestoreBinds(__instance.allRegisteredCheats);
			__instance.RebuildMenu();
			return false;
		}

		[HarmonyPrefix]
		[HarmonyPatch(typeof(SandboxSaver), "Clear")]
		public static bool SandboxSaverClearPrefix()
		{
			if (Util.IsSandbox())
			{
				return true;
			}
			DefaultSandboxCheckpoint instance = MonoSingleton<DefaultSandboxCheckpoint>.Instance;
			if (!((Object)(object)instance == (Object)null))
			{
				MonoSingleton<StatsManager>.Instance.currentCheckPoint = instance.checkpoint;
			}
			SpawnableInstance[] array = Object.FindObjectsOfType<SpawnableInstance>();
			SpawnableInstance[] array2 = array;
			foreach (SpawnableInstance val in array2)
			{
				if (((Behaviour)val).enabled)
				{
					Object.Destroy((Object)(object)((Component)val).gameObject);
				}
			}
			Resources.UnloadUnusedAssets();
			MonoSingleton<SandboxNavmesh>.Instance.ResetSizeToDefault();
			MonoSingleton<SandboxSaver>.Instance.activeSave = null;
			MonoSingleton<CheatsManager>.Instance.RefreshCheatStates();
			return false;
		}

		[HarmonyPrefix]
		[HarmonyPatch(typeof(SandboxSaver), "Load")]
		public static bool SandboxSaverLoadPrefix(string name, SandboxSaver __instance)
		{
			//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_01b7: 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_014e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0156: Unknown result type (might be due to invalid IL or missing references)
			//IL_0160: 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_0141: Unknown result type (might be due to invalid IL or missing references)
			//IL_017f: Unknown result type (might be due to invalid IL or missing references)
			if (Util.IsSandbox())
			{
				return true;
			}
			SandboxSaver.Log.Info("Loading save: " + name, (IEnumerable<Tag>)null, (string)null, (object)null);
			SandboxSaver.SetupDirs();
			SandboxSaver.Clear();
			__instance.activeSave = name;
			MonoSingleton<CheatsManager>.Instance.RefreshCheatStates();
			__instance.RebuildObjectList();
			SandboxSaveData val = JsonConvert.DeserializeObject<SandboxSaveData>(File.ReadAllText(Path.Combine(SandboxSaver.SavePath, name + ".pitr")));
			SandboxSaver.Log.Fine($"Loaded {val.Blocks.Length} blocks\nLoaded {val.Props.Length} props", (IEnumerable<Tag>)null, (string)null, (object)null);
			SandboxSaver.Log.Fine("Save Version: " + val.SaveVersion, (IEnumerable<Tag>)null, (string)null, (object)null);
			Vector3? val2 = null;
			Vector3 position = ((Component)MonoSingleton<NewMovement>.Instance).transform.position;
			SavedProp[] props = val.Props;
			SavedProp[] array = props;
			foreach (SavedProp val3 in array)
			{
				__instance.RecreateProp(val3, val.SaveVersion > 1);
				if (!(((SavedGeneric)val3).ObjectIdentifier != "ultrakill.spawn-point"))
				{
					if (!val2.HasValue)
					{
						val2 = ((SavedGeneric)val3).Position.ToVector3();
					}
					else if (Vector3.Distance(position, ((SavedGeneric)val3).Position.ToVector3()) < Vector3.Distance(position, val2.Value))
					{
						val2 = ((SavedGeneric)val3).Position.ToVector3();
					}
				}
			}
			if (val2.HasValue)
			{
				((Component)MonoSingleton<NewMovement>.Instance).transform.position = val2.Value;
				MonoSingleton<NewMovement>.Instance.rb.velocity = Vector3.zero;
			}
			SavedBlock[] blocks = val.Blocks;
			SavedBlock[] array2 = blocks;
			foreach (SavedBlock val4 in array2)
			{
				__instance.RecreateBlock(val4);
			}
			MonoSingleton<SandboxNavmesh>.Instance.Rebake();
			List<EnemySpawnableInstance> list = new List<EnemySpawnableInstance>();
			SavedEnemy[] enemies = val.Enemies;
			SavedEnemy[] array3 = enemies;
			foreach (SavedEnemy val5 in array3)
			{
				EnemySpawnableInstance val6 = __instance.RecreateEnemy((SavedGeneric)(object)val5, val.SaveVersion > 1);
				((SpawnableInstance)val6).Pause(false);
				list.Add(val6);
			}
			((MonoBehaviour)__instance).StartCoroutine(__instance.PostLoadAndBake(list));
			return false;
		}
	}
	public class Util
	{
		public static bool IsSandbox()
		{
			return SceneHelper.CurrentScene == "uk_construct";
		}

		public static Texture2D LoadEmbeddedTexture(string resourceName)
		{
			//IL_0055: Unknown result type (might be due to invalid IL or missing references)
			//IL_005b: Expected O, but got Unknown
			Assembly executingAssembly = Assembly.GetExecutingAssembly();
			using Stream stream = executingAssembly.GetManifestResourceStream(resourceName);
			if (stream == null)
			{
				Plugin.Logger.LogError((object)("Embedded resource '" + resourceName + "' not found"));
				return null;
			}
			byte[] array = new byte[stream.Length];
			stream.Read(array, 0, array.Length);
			Texture2D val = new Texture2D(2, 2);
			if (ImageConversion.LoadImage(val, array))
			{
				return val;
			}
			Plugin.Logger.LogError((object)"Failed to load embedded texture");
			return null;
		}

		public static Transform FindParentWithNameContaining(string searchedSubstring, Transform target)
		{
			while ((Object)(object)target.parent != (Object)null)
			{
				if (((Object)target.parent).name.Contains(searchedSubstring))
				{
					return target.parent;
				}
				target = target.parent;
			}
			return null;
		}
	}
	[BepInPlugin("billy.spawnerarmextras", "SpawnerArmExtras", "4.0.3")]
	public class Plugin : BaseUnityPlugin
	{
		[CompilerGenerated]
		private sealed class <AddSandboxNavMesh>d__9 : IEnumerator<object>, IEnumerator, IDisposable
		{
			private int <>1__state;

			private object <>2__current;

			private GameObject <obj>5__1;

			private NavMeshSurface <surface>5__2;

			private SandboxNavmesh <snm>5__3;

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

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

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

			[DebuggerHidden]
			void IDisposable.Dispose()
			{
				<obj>5__1 = null;
				<surface>5__2 = null;
				<snm>5__3 = null;
				<>1__state = -2;
			}

			private bool MoveNext()
			{
				//IL_0034: Unknown result type (might be due to invalid IL or missing references)
				//IL_003e: Expected O, but got Unknown
				//IL_0054: Unknown result type (might be due to invalid IL or missing references)
				//IL_005e: Expected O, but got Unknown
				//IL_00b2: Unknown result type (might be due to invalid IL or missing references)
				//IL_00f2: Unknown result type (might be due to invalid IL or missing references)
				//IL_00fc: Expected O, but got Unknown
				switch (<>1__state)
				{
				default:
					return false;
				case 0:
					<>1__state = -1;
					<>2__current = (object)new WaitForSeconds(1f);
					<>1__state = 1;
					return true;
				case 1:
					<>1__state = -1;
					<obj>5__1 = new GameObject("SandboxNavMesh");
					<obj>5__1.SetActive(false);
					<surface>5__2 = <obj>5__1.AddComponent<NavMeshSurface>();
					<surface>5__2.useGeometry = (NavMeshCollectGeometry)1;
					<surface>5__2.collectObjects = (CollectObjects)2;
					<surface>5__2.voxelSize = 0.1667f;
					<surface>5__2.layerMask = LayerMask.op_Implicit(16777664);
					<snm>5__3 = <obj>5__1.AddComponent<SandboxNavmesh>();
					<snm>5__3.surface = <surface>5__2;
					<obj>5__1.SetActive(true);
					<>2__current = (object)new WaitForSeconds(0.1f);
					<>1__state = 2;
					return true;
				case 2:
					<>1__state = -1;
					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 static readonly Harmony Harmony = new Harmony("billy.spawnerarmextras");

		internal static ManualLogSource Logger;

		public static bool addedEnemies = false;

		public static Dictionary<string, GameObject> Enemies = new Dictionary<string, GameObject>
		{
			["Wicked"] = null,
			["Tundra"] = null,
			["Agony"] = null,
			["Minos"] = null,
			["MinosArm"] = null,
			["Minotaur"] = null,
			["DroneGhost"] = null,
			["DroneFlesh"] = null,
			["DroneFleshCamera"] = null,
			["DroneSkull"] = null,
			["CentaurMortar"] = null,
			["BlackHole"] = null,
			["MaliciousFace"] = null,
			["Explosion"] = null,
			["BrainGib"] = null,
			["CentaurTower"] = null,
			["CentaurTowerPreview"] = null,
			["Projectile"] = null,
			["Landmine"] = null
		};

		public static Dictionary<string, Texture2D> Icons = new Dictionary<string, Texture2D>
		{
			["Wicked"] = null,
			["AgonyTundra"] = null,
			["Tundra"] = null,
			["Agony"] = null,
			["Minos"] = null,
			["MinosArm"] = null,
			["Minotaur"] = null,
			["DroneGhost"] = null,
			["DroneFlesh"] = null,
			["DroneFleshCamera"] = null,
			["DroneSkull"] = null,
			["BlackHoleMortar"] = null,
			["Disgrace"] = null,
			["Watchtower"] = null
		};

		public void Awake()
		{
			Logger = ((BaseUnityPlugin)this).Logger;
			Logger.LogInfo((object)"Plugin SpawnerArmExtras is loaded!");
			LoadAssets();
			Harmony.PatchAll();
			SceneManager.activeSceneChanged += SceneManagerActiveSceneChanged;
		}

		public T Ass<T>(string path)
		{
			//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)
			return Addressables.LoadAssetAsync<T>((object)path).WaitForCompletion();
		}

		public void LoadAssets()
		{
			Enemies["Wicked"] = Ass<GameObject>("Assets/Prefabs/Enemies/Wicked.prefab");
			Icons["Wicked"] = Util.LoadEmbeddedTexture("SpawnerArmExtras.assets.WickedIcon.png");
			Icons["AgonyTundra"] = Util.LoadEmbeddedTexture("SpawnerArmExtras.assets.AgonyTundraIcon.png");
			Enemies["Tundra"] = Ass<GameObject>("Assets/Prefabs/Enemies/SwordsMachine Tundra.prefab");
			Icons["Tundra"] = Util.LoadEmbeddedTexture("SpawnerArmExtras.assets.TundraIcon.png");
			Enemies["Agony"] = Ass<GameObject>("Assets/Prefabs/Enemies/SwordsMachine Agony.prefab");
			Icons["Agony"] = Util.LoadEmbeddedTexture("SpawnerArmExtras.assets.AgonyIcon.png");
			Enemies["Minos"] = Ass<GameObject>("Assets/Prefabs/Enemies/MinosBoss.prefab");
			Icons["Minos"] = Ass<Texture2D>("Assets/Textures/UI/Spawn Menu/Minos.png");
			Enemies["MinosArm"] = Ass<GameObject>("Assets/Prefabs/Enemies/MinosArm.prefab");
			Icons["MinosArm"] = Util.LoadEmbeddedTexture("SpawnerArmExtras.assets.MinosArmIcon.png");
			Enemies["Minotaur"] = Ass<GameObject>("Assets/Prefabs/Enemies/MinotaurChase.prefab");
			Icons["Minotaur"] = Ass<Texture2D>("Assets/Textures/UI/Spawn Menu/Minotaur.png");
			Enemies["DroneGhost"] = Ass<GameObject>("Assets/Prefabs/Enemies/DroneGhostFromCorpse.prefab");
			Icons["DroneGhost"] = Util.LoadEmbeddedTexture("SpawnerArmExtras.assets.DroneGhostIcon.png");
			Enemies["DroneFlesh"] = Ass<GameObject>("Assets/Prefabs/Enemies/DroneFlesh.prefab");
			Icons["DroneFlesh"] = Util.LoadEmbeddedTexture("SpawnerArmExtras.assets.DroneFleshIcon.png");
			Enemies["DroneFleshCamera"] = Ass<GameObject>("Assets/Prefabs/Enemies/DroneFleshCamera Variant.prefab");
			Icons["DroneFleshCamera"] = Util.LoadEmbeddedTexture("SpawnerArmExtras.assets.DroneFleshCameraIcon.png");
			Enemies["DroneSkull"] = Ass<GameObject>("Assets/Prefabs/Enemies/DroneSkull Variant.prefab");
			Icons["DroneSkull"] = Util.LoadEmbeddedTexture("SpawnerArmExtras.assets.DroneSkullIcon.png");
			Enemies["CentaurMortar"] = Ass<GameObject>("Assets/Prefabs/Enemies/CentaurMortar.prefab");
			Icons["BlackHoleMortar"] = Util.LoadEmbeddedTexture("SpawnerArmExtras.assets.BlackHoleMortarIcon.png");
			Enemies["BlackHole"] = Ass<GameObject>("Assets/Prefabs/Attacks and Projectiles/Black Hole Enemy.prefab");
			Enemies["MaliciousFace"] = Ass<GameObject>("Assets/Prefabs/Enemies/Malicious Face.prefab");
			Icons["Disgrace"] = Util.LoadEmbeddedTexture("SpawnerArmExtras.assets.DisgraceIcon.png");
			Enemies["Explosion"] = Ass<GameObject>("Assets/Prefabs/Attacks and Projectiles/Explosions/Explosion.prefab");
			Enemies["BrainGib"] = Ass<GameObject>("Assets/Prefabs/Gibs/Gib_BrainChunk.prefab");
			Enemies["CentaurTower"] = Ass<GameObject>("Assets/Prefabs/Enemies/CentaurTower.prefab");
			Icons["Watchtower"] = Util.LoadEmbeddedTexture("SpawnerArmExtras.assets.WatchtowerIcon.png");
			Enemies["CentaurTowerPreview"] = Ass<GameObject>("Assets/Prefabs/Spawner Previews/CentaurTower Preview.prefab");
			Enemies["Projectile"] = Ass<GameObject>("Assets/Prefabs/Attacks and Projectiles/Projectile.prefab");
			Enemies["Landmine"] = Ass<GameObject>("Assets/Prefabs/Attacks and Projectiles/Landmine.prefab");
		}

		public static void SceneManagerActiveSceneChanged(Scene arg0, Scene arg1)
		{
			if (!Util.IsSandbox())
			{
				SceneHelper instance = MonoSingleton<SceneHelper>.Instance;
				if (instance != null)
				{
					((MonoBehaviour)instance).StartCoroutine(AddSandboxNavMesh());
				}
			}
		}

		[IteratorStateMachine(typeof(<AddSandboxNavMesh>d__9))]
		public static IEnumerator AddSandboxNavMesh()
		{
			//yield-return decompiler failed: Unexpected instruction in Iterator.Dispose()
			return new <AddSandboxNavMesh>d__9(0);
		}
	}
	[HarmonyPatch(typeof(SpawnMenu))]
	public class SpawnMenuPatch
	{
		public static GameObject MakeGameObject(string name, GameObject obj)
		{
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			//IL_0008: Expected O, but got Unknown
			//IL_0044: Unknown result type (might be due to invalid IL or missing references)
			GameObject val = new GameObject(name);
			Object.DontDestroyOnLoad((Object)(object)val);
			val.SetActive(false);
			val.layer = LayerMask.NameToLayer("EnemyTrigger");
			GameObject val2 = Object.Instantiate<GameObject>(obj);
			val2.transform.position = new Vector3(0f, 0f, 0f);
			val2.transform.SetParent(val.transform);
			DisableVertexLighting(val2);
			return val;
		}

		public static GameObject MakeGameObjectCombined(string name, GameObject[] objs)
		{
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			//IL_0008: Expected O, but got Unknown
			//IL_0052: Unknown result type (might be due to invalid IL or missing references)
			GameObject val = new GameObject(name);
			Object.DontDestroyOnLoad((Object)(object)val);
			val.SetActive(false);
			val.layer = LayerMask.NameToLayer("EnemyTrigger");
			foreach (GameObject val2 in objs)
			{
				GameObject val3 = Object.Instantiate<GameObject>(val2);
				val3.transform.position = new Vector3(0f, 0f, 0f);
				val3.transform.SetParent(val.transform);
				DisableVertexLighting(val3);
			}
			return val;
		}

		public static GameObject MakePreview(string name, GameObject obj)
		{
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			//IL_0008: Expected O, but got Unknown
			//IL_0032: Unknown result type (might be due to invalid IL or missing references)
			GameObject val = new GameObject(name);
			Object.DontDestroyOnLoad((Object)(object)val);
			val.AddComponent<HidePreviewIfNotInHand>();
			GameObject val2 = Object.Instantiate<GameObject>(obj);
			val2.transform.position = new Vector3(0f, 0f, 0f);
			val2.transform.SetParent(val.transform);
			DisableVertexLighting(val2);
			return val;
		}

		public static void DisableVertexLighting(GameObject obj)
		{
			SkinnedMeshRenderer[] componentsInChildren = obj.GetComponentsInChildren<SkinnedMeshRenderer>();
			foreach (SkinnedMeshRenderer val in componentsInChildren)
			{
				Material[] materials = ((Renderer)val).materials;
				foreach (Material val2 in materials)
				{
					val2.DisableKeyword("VERTEX_LIGHTING");
				}
			}
			MeshRenderer[] componentsInChildren2 = obj.GetComponentsInChildren<MeshRenderer>();
			foreach (MeshRenderer val3 in componentsInChildren2)
			{
				Material[] materials2 = ((Renderer)val3).materials;
				foreach (Material val4 in materials2)
				{
					val4.DisableKeyword("VERTEX_LIGHTING");
				}
			}
		}

		public static Color MakeColor(string enemy = "")
		{
			//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_00ae: Unknown result type (might be due to invalid IL or missing references)
			//IL_0061: Unknown result type (might be due to invalid IL or missing references)
			//IL_0066: Unknown result type (might be due to invalid IL or missing references)
			//IL_0078: Unknown result type (might be due to invalid IL or missing references)
			//IL_007d: Unknown result type (might be due to invalid IL or missing references)
			//IL_008f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0094: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ab: Unknown result type (might be due to invalid IL or missing references)
			return (Color)(enemy switch
			{
				"husk" => new Color(0.898f, 0.6588f, 0.6588f), 
				"machine" => new Color(0.4784f, 0.6196f, 0.851f), 
				"demon" => new Color(0.5176f, 0.9059f, 0.5098f), 
				"angel" => new Color(1f, 0.9091f, 0.4481f), 
				_ => new Color(0.75f, 0.75f, 0.75f), 
			});
		}

		public static Sprite MakeIcon(Texture2D tex)
		{
			//IL_0016: 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)
			return Sprite.Create(tex, new Rect(0f, 0f, 256f, 256f), new Vector2(0.5f, 0.5f));
		}

		[HarmonyPrefix]
		[HarmonyPatch(typeof(SpawnMenu), "Awake")]
		public static void AwakePrefix(SpawnMenu __instance)
		{
			if (!Plugin.addedEnemies)
			{
				SpawnableObject val = MakeSpawnableWicked();
				SpawnableObject val2 = MakeSpawnableAgonyTundra();
				SpawnableObject val3 = MakeSpawnableAgony();
				SpawnableObject val4 = MakeSpawnableTundra();
				SpawnableObject val5 = MakeSpawnableMinos();
				SpawnableObject val6 = MakeSpawnableMinosArm();
				SpawnableObject val7 = MakeSpawnableMinotaur();
				SpawnableObject val8 = MakeSpawnableDroneGhost();
				SpawnableObject val9 = MakeSpawnableDroneFlesh();
				SpawnableObject val10 = MakeSpawnableDroneFleshCamera();
				SpawnableObject val11 = MakeSpawnableDroneSkull();
				SpawnableObject val12 = MakeSpawnableBlackHoleMortar();
				SpawnableObject val13 = MakeSpawnableDisgrace();
				SpawnableObject val14 = MakeSpawnableWatchtower();
				List<SpawnableObject> list = __instance.objects.enemies.ToList();
				list.AddRange((IEnumerable<SpawnableObject>)(object)new SpawnableObject[14]
				{
					val, val2, val3, val4, val5, val6, val7, val8, val9, val10,
					val11, val12, val13, val14
				});
				__instance.objects.enemies = list.ToArray();
				Plugin.addedEnemies = true;
				SpawnableObject[] sandboxTools = __instance.objects.sandboxTools;
				foreach (SpawnableObject val15 in sandboxTools)
				{
					val15.sandboxOnly = false;
				}
				SpawnableObject[] sandboxObjects = __instance.objects.sandboxObjects;
				foreach (SpawnableObject val16 in sandboxObjects)
				{
					val16.sandboxOnly = false;
				}
				SpawnableObject[] specialSandbox = __instance.objects.specialSandbox;
				foreach (SpawnableObject val17 in specialSandbox)
				{
					val17.sandboxOnly = false;
				}
			}
		}

		public static SpawnableObject MakeSpawnableWicked()
		{
			//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_0044: Unknown result type (might be due to invalid IL or missing references)
			//IL_004c: Unknown result type (might be due to invalid IL or missing references)
			SpawnableObject val = ScriptableObject.CreateInstance<SpawnableObject>();
			((Object)val).name = "Wicked";
			val.gameObject = MakeGameObject("WickedSpawned", Plugin.Enemies["Wicked"]);
			val.backgroundColor = MakeColor();
			val.spawnableObjectType = (SpawnableObjectDataType)1;
			val.enemyType = (EnemyType)10;
			val.gridIcon = MakeIcon(Plugin.Icons["Wicked"]);
			((Object)val.gridIcon).name = "WickedIcon";
			return val;
		}

		public static SpawnableObject MakeSpawnableAgonyTundra()
		{
			//IL_00b1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f1: Unknown result type (might be due to invalid IL or missing references)
			//IL_0102: 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_010e: 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)
			SpawnableObject val = ScriptableObject.CreateInstance<SpawnableObject>();
			((Object)val).name = "AgonyTundra";
			val.gameObject = MakeGameObjectCombined("AgonyTundraSpawned", (GameObject[])(object)new GameObject[2]
			{
				Plugin.Enemies["Agony"],
				Plugin.Enemies["Tundra"]
			});
			Enemy componentInChildren = ((Component)val.gameObject.transform.GetChild(0)).GetComponentInChildren<Enemy>();
			Enemy componentInChildren2 = ((Component)val.gameObject.transform.GetChild(1)).GetComponentInChildren<Enemy>();
			componentInChildren.symbiotic = true;
			componentInChildren2.symbiotic = true;
			componentInChildren.symbiote = componentInChildren2;
			componentInChildren2.symbiote = componentInChildren;
			val.gameObject.transform.rotation = Quaternion.Euler(0f, 90f, 0f);
			((Component)componentInChildren).transform.localPosition = new Vector3(0f, 0f, -2f);
			((Component)componentInChildren2).transform.localPosition = new Vector3(0f, 0f, 2f);
			val.backgroundColor = MakeColor("machine");
			val.spawnableObjectType = (SpawnableObjectDataType)1;
			val.enemyType = (EnemyType)7;
			val.gridIcon = MakeIcon(Plugin.Icons["AgonyTundra"]);
			((Object)val.gridIcon).name = "AgonyTundraIcon";
			return val;
		}

		public static SpawnableObject MakeSpawnableAgony()
		{
			//IL_004c: 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_0069: 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)
			SpawnableObject val = ScriptableObject.CreateInstance<SpawnableObject>();
			((Object)val).name = "Agony";
			val.gameObject = MakeGameObject("AgonySpawned", Plugin.Enemies["Agony"]);
			val.gameObject.transform.rotation = Quaternion.Euler(0f, -45f, 0f);
			val.backgroundColor = MakeColor("machine");
			val.spawnableObjectType = (SpawnableObjectDataType)1;
			val.enemyType = (EnemyType)7;
			val.gridIcon = MakeIcon(Plugin.Icons["Agony"]);
			((Object)val.gridIcon).name = "AgonyIcon";
			return val;
		}

		public static SpawnableObject MakeSpawnableTundra()
		{
			//IL_004c: 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_0069: 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)
			SpawnableObject val = ScriptableObject.CreateInstance<SpawnableObject>();
			((Object)val).name = "Tundra";
			val.gameObject = MakeGameObject("TundraSpawned", Plugin.Enemies["Tundra"]);
			val.gameObject.transform.rotation = Quaternion.Euler(0f, -135f, 0f);
			val.backgroundColor = MakeColor("machine");
			val.spawnableObjectType = (SpawnableObjectDataType)1;
			val.enemyType = (EnemyType)7;
			val.gridIcon = MakeIcon(Plugin.Icons["Tundra"]);
			((Object)val.gridIcon).name = "TundraIcon";
			return val;
		}

		public static SpawnableObject MakeSpawnableMinos()
		{
			//IL_004c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0077: Unknown result type (might be due to invalid IL or missing references)
			//IL_0088: 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_009c: Unknown result type (might be due to invalid IL or missing references)
			SpawnableObject val = ScriptableObject.CreateInstance<SpawnableObject>();
			((Object)val).name = "Minos";
			val.gameObject = MakeGameObject("MinosSpawned", Plugin.Enemies["Minos"]);
			val.gameObject.transform.rotation = Quaternion.Euler(0f, 270f, 0f);
			val.gameObject.transform.GetChild(0).position = new Vector3(150f, -580f, 0f);
			val.backgroundColor = MakeColor("husk");
			val.spawnableObjectType = (SpawnableObjectDataType)1;
			val.enemyType = (EnemyType)11;
			val.gridIcon = MakeIcon(Plugin.Icons["Minos"]);
			((Object)val.gridIcon).name = "MinosIcon";
			return val;
		}

		public static SpawnableObject MakeSpawnableMinosArm()
		{
			//IL_004c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0077: Unknown result type (might be due to invalid IL or missing references)
			//IL_0088: 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_009c: Unknown result type (might be due to invalid IL or missing references)
			SpawnableObject val = ScriptableObject.CreateInstance<SpawnableObject>();
			((Object)val).name = "MinosArm";
			val.gameObject = MakeGameObject("MinosArmSpawned", Plugin.Enemies["MinosArm"]);
			val.gameObject.transform.rotation = Quaternion.Euler(0f, 270f, 0f);
			val.gameObject.transform.GetChild(0).position = new Vector3(165f, 0f, 0f);
			val.backgroundColor = MakeColor("husk");
			val.spawnableObjectType = (SpawnableObjectDataType)1;
			val.enemyType = (EnemyType)11;
			val.spawnOffset = 20f;
			val.gridIcon = MakeIcon(Plugin.Icons["MinosArm"]);
			((Object)val.gridIcon).name = "MinosArmIcon";
			return val;
		}

		public static SpawnableObject MakeSpawnableMinotaur()
		{
			//IL_004c: 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_0069: 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)
			SpawnableObject val = ScriptableObject.CreateInstance<SpawnableObject>();
			((Object)val).name = "Minotaur";
			val.gameObject = MakeGameObject("MinotaurSpawned", Plugin.Enemies["Minotaur"]);
			val.gameObject.transform.rotation = Quaternion.Euler(0f, 180f, 0f);
			val.backgroundColor = MakeColor("demon");
			val.spawnableObjectType = (SpawnableObjectDataType)1;
			val.enemyType = (EnemyType)32;
			val.gridIcon = MakeIcon(Plugin.Icons["Minotaur"]);
			((Object)val.gridIcon).name = "MinotaurIcon";
			return val;
		}

		public static SpawnableObject MakeSpawnableDroneGhost()
		{
			//IL_0059: Unknown result type (might be due to invalid IL or missing references)
			//IL_005e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0065: Unknown result type (might be due to invalid IL or missing references)
			SpawnableObject val = ScriptableObject.CreateInstance<SpawnableObject>();
			((Object)val).name = "DroneGhost";
			val.gameObject = MakeGameObject("DroneGhostSpawned", Plugin.Enemies["DroneGhost"]);
			((Component)val.gameObject.transform.Find("DroneGhostFromCorpse(Clone)/Armature/Root/GhostDrone_GlowPlane")).gameObject.SetActive(false);
			val.backgroundColor = MakeColor("machine");
			val.enemyType = (EnemyType)1;
			val.spawnOffset = 2f;
			val.gridIcon = MakeIcon(Plugin.Icons["DroneGhost"]);
			((Object)val.gridIcon).name = "DroneGhostIcon";
			return val;
		}

		public static SpawnableObject MakeSpawnableDroneFlesh()
		{
			//IL_004c: 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_0069: 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)
			SpawnableObject val = ScriptableObject.CreateInstance<SpawnableObject>();
			((Object)val).name = "DroneFlesh";
			val.gameObject = MakeGameObject("DroneFleshSpawned", Plugin.Enemies["DroneFlesh"]);
			val.gameObject.transform.rotation = Quaternion.Euler(0f, 180f, 0f);
			val.backgroundColor = MakeColor();
			val.spawnableObjectType = (SpawnableObjectDataType)1;
			val.enemyType = (EnemyType)1;
			val.spawnOffset = 2f;
			val.gridIcon = MakeIcon(Plugin.Icons["DroneFlesh"]);
			((Object)val.gridIcon).name = "DroneFleshIcon";
			return val;
		}

		public static SpawnableObject MakeSpawnableDroneFleshCamera()
		{
			//IL_004c: 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_0069: 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)
			SpawnableObject val = ScriptableObject.CreateInstance<SpawnableObject>();
			((Object)val).name = "DroneFleshCamera";
			val.gameObject = MakeGameObject("DroneFleshCameraSpawned", Plugin.Enemies["DroneFleshCamera"]);
			val.gameObject.transform.rotation = Quaternion.Euler(0f, 180f, 0f);
			val.backgroundColor = MakeColor();
			val.spawnableObjectType = (SpawnableObjectDataType)1;
			val.enemyType = (EnemyType)1;
			val.spawnOffset = 2f;
			val.gridIcon = MakeIcon(Plugin.Icons["DroneFleshCamera"]);
			((Object)val.gridIcon).name = "DroneFleshCameraIcon";
			return val;
		}

		public static SpawnableObject MakeSpawnableDroneSkull()
		{
			//IL_004c: 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_0069: 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)
			SpawnableObject val = ScriptableObject.CreateInstance<SpawnableObject>();
			((Object)val).name = "DroneSkull";
			val.gameObject = MakeGameObject("DroneSkullSpawned", Plugin.Enemies["DroneSkull"]);
			val.gameObject.transform.rotation = Quaternion.Euler(0f, 180f, 0f);
			val.backgroundColor = MakeColor();
			val.spawnableObjectType = (SpawnableObjectDataType)1;
			val.enemyType = (EnemyType)1;
			val.spawnOffset = 2f;
			val.gridIcon = MakeIcon(Plugin.Icons["DroneSkull"]);
			((Object)val.gridIcon).name = "DroneSkullIcon";
			return val;
		}

		public static SpawnableObject MakeSpawnableBlackHoleMortar()
		{
			//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_0044: Unknown result type (might be due to invalid IL or missing references)
			//IL_004c: Unknown result type (might be due to invalid IL or missing references)
			SpawnableObject val = ScriptableObject.CreateInstance<SpawnableObject>();
			((Object)val).name = "BlackHoleMortar";
			val.gameObject = MakeGameObject("BlackHoleMortarSpawned", Plugin.Enemies["CentaurMortar"]);
			val.backgroundColor = MakeColor("machine");
			val.spawnableObjectType = (SpawnableObjectDataType)1;
			val.enemyType = (EnemyType)35;
			val.gridIcon = MakeIcon(Plugin.Icons["BlackHoleMortar"]);
			((Object)val.gridIcon).name = "BlackHoleMortarIcon";
			return val;
		}

		public static SpawnableObject MakeSpawnableDisgrace()
		{
			//IL_0056: 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_00ab: 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_00c8: 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)
			SpawnableObject val = ScriptableObject.CreateInstance<SpawnableObject>();
			((Object)val).name = "Disgrace";
			val.gameObject = MakeGameObject("DisgraceSpawned", Plugin.Enemies["MaliciousFace"]);
			val.gameObject.transform.Find("Malicious Face(Clone)/Body/MaliciousFace").localScale = new Vector3(0.1f, 0.0875f, 0.0005f);
			((Renderer)val.gameObject.GetComponentInChildren<SkinnedMeshRenderer>()).material.color = new Color(0.5f, 0.9f, 0.6f);
			val.gameObject.transform.GetChild(0).position = new Vector3(0f, -4f, 0f);
			val.backgroundColor = MakeColor("default");
			val.spawnableObjectType = (SpawnableObjectDataType)1;
			val.enemyType = (EnemyType)4;
			val.gridIcon = MakeIcon(Plugin.Icons["Disgrace"]);
			((Object)val.gridIcon).name = "DisgraceIcon";
			return val;
		}

		public static SpawnableObject MakeSpawnableWatchtower()
		{
			//IL_0052: 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_00df: Unknown result type (might be due to invalid IL or missing references)
			//IL_0106: Unknown result type (might be due to invalid IL or missing references)
			//IL_0117: Unknown result type (might be due to invalid IL or missing references)
			//IL_011c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0123: 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_019a: Unknown result type (might be due to invalid IL or missing references)
			//IL_01d1: 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_021b: Unknown result type (might be due to invalid IL or missing references)
			SpawnableObject val = ScriptableObject.CreateInstance<SpawnableObject>();
			((Object)val).name = "Watchtower";
			val.gameObject = MakeGameObject("WatchtowerSpawned", Plugin.Enemies["CentaurTower"]);
			val.gameObject.transform.GetChild(0).localScale = new Vector3(10f, 25f, 10f);
			Transform val2 = val.gameObject.transform.GetChild(0).Find("Armature/Pole_Top/Sphere (1)");
			val2.localScale = new Vector3(0.2f, 0.2f, 0.2f);
			Object.Destroy((Object)(object)((Component)val2).GetComponent<ObjectActivator>());
			Object.Destroy((Object)(object)((Component)val2).GetComponent<ScaleTransform>());
			((Component)val2).gameObject.SetActive(false);
			Transform val3 = val2.Find("Sphere (1)");
			((Renderer)((Component)val3).GetComponent<MeshRenderer>()).material.color = new Color(1f, 1f, 0f);
			Object.Destroy((Object)(object)((Component)val3).GetComponent<ScaleTransform>());
			val3.localScale = new Vector3(1f, 1f, 1f);
			val.backgroundColor = MakeColor("machine");
			val.spawnableObjectType = (SpawnableObjectDataType)1;
			val.enemyType = (EnemyType)35;
			val.gridIcon = MakeIcon(Plugin.Icons["Watchtower"]);
			((Object)val.gridIcon).name = "WatchtowerIcon";
			val.preview = MakePreview("Watchtower Preview", Plugin.Enemies["CentaurTowerPreview"]);
			val.preview.transform.GetChild(0).localScale = new Vector3(1.5f, 3.75f, 1.5f);
			Transform val4 = val.preview.transform.GetChild(0).Find("Armature/Pole_Top/Sphere (1)");
			val4.localPosition = new Vector3(-0.45f, 0f, 0f);
			val4.localScale = new Vector3(0.08f, 0.2f, 0.2f);
			((Renderer)((Component)val4.Find("Sphere (1)")).GetComponent<MeshRenderer>()).material.color = new Color(1f, 1f, 0f);
			return val;
		}
	}
	public static class MyPluginInfo
	{
		public const string PLUGIN_GUID = "SpawnerArmExtras";

		public const string PLUGIN_NAME = "SpawnerArmExtras";

		public const string PLUGIN_VERSION = "4.0.3";
	}
}
namespace System.Runtime.CompilerServices
{
	[AttributeUsage(AttributeTargets.Assembly, AllowMultiple = true)]
	internal sealed class IgnoresAccessChecksToAttribute : Attribute
	{
		public IgnoresAccessChecksToAttribute(string assemblyName)
		{
		}
	}
}