Decompiled source of UltraSlop v1.0.1

UltraSlop.dll

Decompiled 18 minutes ago
using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.Globalization;
using System.IO;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using System.Text;
using BepInEx;
using BepInEx.Logging;
using HarmonyLib;
using Microsoft.CodeAnalysis;
using PluginConfig.API;
using PluginConfig.API.Decorators;
using PluginConfig.API.Fields;
using ULTRAKILL.Enemy;
using UnityEngine;
using UnityEngine.AI;
using UnityEngine.Rendering;
using UnityEngine.UI;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")]
[assembly: AssemblyCompany("UltraSlop")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("UltraSlop")]
[assembly: AssemblyTitle("UltraSlop")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.0.0")]
[module: UnverifiableCode]
[module: RefSafetyRules(11)]
namespace Microsoft.CodeAnalysis
{
	[CompilerGenerated]
	[Embedded]
	internal sealed class EmbeddedAttribute : Attribute
	{
	}
}
namespace System.Runtime.CompilerServices
{
	[CompilerGenerated]
	[Embedded]
	[AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)]
	internal sealed class RefSafetyRulesAttribute : Attribute
	{
		public readonly int Version;

		public RefSafetyRulesAttribute(int P_0)
		{
			Version = P_0;
		}
	}
}
namespace UltraSlop
{
	public class AnkleSprainController : MonoBehaviour
	{
		private NewMovement nm;

		private Rigidbody rb;

		private CameraController cc;

		private Coroutine sprainCoroutine;

		public static AnkleSprainController Instance { get; private set; }

		public bool IsSprained { get; private set; }

		public bool IsTumbling { get; private set; }

		public bool IsSlamming { get; set; }

		private void Awake()
		{
			Instance = this;
			nm = ((Component)this).GetComponent<NewMovement>();
			if ((Object)(object)nm != (Object)null)
			{
				rb = nm.rb;
				cc = nm.cc;
			}
		}

		private void Update()
		{
			if (IsSlamming && (Object)(object)nm != (Object)null && !nm.falling && ((Object)(object)nm.gc == (Object)null || !nm.gc.onGround))
			{
				IsSlamming = false;
			}
		}

		public void OnSlamStarted()
		{
			if (!IsSprained && !IsTumbling)
			{
				IsSlamming = true;
			}
		}

		public void CheckSlamLanding(NewMovement movement)
		{
			//IL_010e: 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_011d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0122: Unknown result type (might be due to invalid IL or missing references)
			if (!IsSlamming || IsSprained || IsTumbling)
			{
				return;
			}
			IsSlamming = false;
			if (PluginConfig.AnkleSprainMechanic == null || !PluginConfig.AnkleSprainMechanic.value)
			{
				return;
			}
			bool flag = false;
			GroundCheck[] componentsInChildren = ((Component)movement).GetComponentsInChildren<GroundCheck>();
			if (componentsInChildren != null)
			{
				GroundCheck[] array = componentsInChildren;
				foreach (GroundCheck val in array)
				{
					if ((Object)(object)val != (Object)null && val.cols != null)
					{
						foreach (Collider col in val.cols)
						{
							if ((Object)(object)col != (Object)null && (Object)(object)((Component)col).gameObject != (Object)(object)((Component)movement).gameObject && (((Component)col).gameObject.layer == 10 || ((Component)col).gameObject.layer == 11 || (Object)(object)((Component)col).GetComponentInParent<EnemyIdentifier>() != (Object)null))
							{
								flag = true;
								break;
							}
						}
					}
					if (flag)
					{
						break;
					}
				}
			}
			if (!flag)
			{
				Collider[] array2 = Physics.OverlapSphere(((Component)movement).transform.position + Vector3.down * 0.5f, 2.5f);
				foreach (Collider val2 in array2)
				{
					if ((Object)(object)val2 != (Object)null && (Object)(object)((Component)val2).gameObject != (Object)(object)((Component)movement).gameObject && (((Component)val2).gameObject.layer == 10 || ((Component)val2).gameObject.layer == 11 || (Object)(object)((Component)val2).GetComponentInParent<EnemyIdentifier>() != (Object)null))
					{
						flag = true;
						break;
					}
				}
			}
			int num = ((!flag) ? ((PluginConfig.AnkleSprainBaseChance != null) ? PluginConfig.AnkleSprainBaseChance.value : 10) : ((PluginConfig.AnkleSprainEnemyChance != null) ? PluginConfig.AnkleSprainEnemyChance.value : 35));
			if (num > 0 && Random.Range(0, 100) < num)
			{
				float duration = ((PluginConfig.AnkleSprainDuration != null) ? PluginConfig.AnkleSprainDuration.value : 2.5f);
				TriggerSprain(duration, flag);
			}
		}

		public void TriggerSprain(float duration, bool hitEnemy)
		{
			if (!IsSprained && !IsTumbling && !((Object)(object)nm == (Object)null))
			{
				if (sprainCoroutine != null)
				{
					((MonoBehaviour)this).StopCoroutine(sprainCoroutine);
				}
				sprainCoroutine = ((MonoBehaviour)this).StartCoroutine(SprainRoutine(duration, hitEnemy));
			}
		}

		private IEnumerator SprainRoutine(float duration, bool hitEnemy)
		{
			ApplyFiveDamage();
			if (hitEnemy)
			{
				yield return ((MonoBehaviour)this).StartCoroutine(TumblePhase());
			}
			yield return ((MonoBehaviour)this).StartCoroutine(StunPhase(duration, hitEnemy));
			sprainCoroutine = null;
		}

		private void ApplyFiveDamage()
		{
			if (!((Object)(object)nm == (Object)null))
			{
				if (nm.hp > 5)
				{
					nm.GetHurt(5, false, 1f, false, false, 0.35f, false);
				}
				else if (nm.hp > 1)
				{
					nm.GetHurt(nm.hp - 1, false, 1f, false, false, 0.35f, false);
				}
				else
				{
					nm.FakeHurt(false);
				}
			}
		}

		private IEnumerator TumblePhase()
		{
			IsTumbling = true;
			nm.boost = false;
			Traverse.Create((object)nm).Field<float>("boostLeft").Value = 0f;
			nm.sliding = false;
			nm.hurtInvincibility = 1.5f;
			if ((Object)(object)nm.oilSlideEffect != (Object)null)
			{
				nm.oilSlideEffect.Play();
			}
			AudioSource val = Traverse.Create((object)nm).Field<AudioSource>("audWoosh")?.Value;
			if ((Object)(object)val != (Object)null)
			{
				val.Play();
			}
			if ((Object)(object)MonoSingleton<TimeController>.Instance != (Object)null)
			{
				MonoSingleton<TimeController>.Instance.controlPitch = false;
				MonoSingleton<TimeController>.Instance.SetAllPitch(0.65f);
			}
			if ((Object)(object)MonoSingleton<StyleHUD>.Instance != (Object)null)
			{
				string text = ((PluginConfig.Language != null && PluginConfig.Language.value == ModLanguage.Russian) ? "<color=#FF3300>ПОДСКОЛЬЗНУЛСЯ!</color>" : "<color=#FF3300>SLIPPED!</color>");
				MonoSingleton<StyleHUD>.Instance.AddPoints(75, text, (GameObject)null, (EnemyIdentifier)null, -1, "", "");
			}
			Vector3 velocity = -((Component)nm).transform.forward * 18f + ((Component)nm).transform.right * Random.Range(-9f, 9f) + Vector3.up * 1.5f;
			if ((Object)(object)rb != (Object)null)
			{
				rb.velocity = velocity;
			}
			float targetTilt = Random.Range(35f, 50f) * ((Random.value > 0.5f) ? 1f : (-1f));
			float elapsed = 0f;
			float tumbleDuration = 0.85f;
			while (elapsed < tumbleDuration)
			{
				elapsed += Time.unscaledDeltaTime;
				float num = Mathf.Clamp01(elapsed / tumbleDuration);
				if ((Object)(object)cc != (Object)null)
				{
					cc.tiltRotationZ = Mathf.Lerp(0f, targetTilt, Mathf.Sin(num * MathF.PI));
					cc.CameraShake(0.35f);
				}
				yield return null;
			}
			if ((Object)(object)cc != (Object)null)
			{
				cc.tiltRotationZ = 0f;
			}
			if ((Object)(object)MonoSingleton<TimeController>.Instance != (Object)null)
			{
				MonoSingleton<TimeController>.Instance.SetAllPitch(1f);
				MonoSingleton<TimeController>.Instance.controlPitch = true;
			}
			IsTumbling = false;
		}

		private IEnumerator StunPhase(float duration, bool hitEnemy)
		{
			IsSprained = true;
			if ((Object)(object)rb != (Object)null)
			{
				rb.velocity = new Vector3(0f, Mathf.Min(0f, rb.velocity.y), 0f);
			}
			nm.sliding = false;
			nm.boost = false;
			Traverse.Create((object)nm).Field<float>("boostLeft").Value = 0f;
			if (!hitEnemy)
			{
				if ((Object)(object)cc != (Object)null)
				{
					cc.CameraShake(0.6f);
				}
				AudioSource val = Traverse.Create((object)nm).Field<AudioSource>("hurtAud")?.Value;
				if ((Object)(object)val != (Object)null && (Object)(object)val.clip != (Object)null)
				{
					float pitch = val.pitch;
					val.pitch = 0.8f;
					AudioSourceExtensions.PlayOneShot(val, val.clip, true);
					val.pitch = pitch;
				}
				if ((Object)(object)MonoSingleton<StyleHUD>.Instance != (Object)null)
				{
					string text = ((PluginConfig.Language != null && PluginConfig.Language.value == ModLanguage.Russian) ? "<color=#FF6600>ПОДВЕРНУЛ ЛОДЫЖКУ!</color>" : "<color=#FF6600>SPRAINED ANKLE!</color>");
					MonoSingleton<StyleHUD>.Instance.AddPoints(75, text, (GameObject)null, (EnemyIdentifier)null, -1, "", "");
				}
			}
			else
			{
				AudioSource val2 = Traverse.Create((object)nm).Field<AudioSource>("hurtAud")?.Value;
				if ((Object)(object)val2 != (Object)null && (Object)(object)val2.clip != (Object)null)
				{
					float pitch2 = val2.pitch;
					val2.pitch = 0.85f;
					AudioSourceExtensions.PlayOneShot(val2, val2.clip, true);
					val2.pitch = pitch2;
				}
			}
			float elapsed = 0f;
			while (elapsed < duration)
			{
				elapsed += Time.deltaTime;
				nm.sliding = false;
				nm.boost = false;
				bool flag = (Object)(object)MonoSingleton<HookArm>.Instance != (Object)null && MonoSingleton<HookArm>.Instance.beingPulled;
				if ((Object)(object)rb != (Object)null && !flag)
				{
					rb.velocity = new Vector3(0f, rb.velocity.y, 0f);
				}
				yield return null;
			}
			IsSprained = false;
		}

		private void OnDisable()
		{
			Cleanup();
		}

		private void OnDestroy()
		{
			Cleanup();
		}

		private void Cleanup()
		{
			if ((Object)(object)rb != (Object)null)
			{
				rb.constraints = (RigidbodyConstraints)112;
			}
			if ((Object)(object)cc != (Object)null)
			{
				cc.tiltRotationZ = 0f;
				((Behaviour)cc).enabled = true;
				cc.activated = true;
			}
			if ((Object)(object)nm != (Object)null)
			{
				nm.activated = true;
			}
			GunControl instance = MonoSingleton<GunControl>.Instance;
			FistControl instance2 = MonoSingleton<FistControl>.Instance;
			if ((Object)(object)instance != (Object)null && !instance.activated)
			{
				instance.YesWeapon();
			}
			if ((Object)(object)instance2 != (Object)null && !instance2.activated)
			{
				instance2.YesFist();
			}
			if ((Object)(object)MonoSingleton<TimeController>.Instance != (Object)null)
			{
				MonoSingleton<TimeController>.Instance.SetAllPitch(1f);
				MonoSingleton<TimeController>.Instance.controlPitch = true;
			}
			Shader.SetGlobalFloat("_Deathness", 0f);
			Shader.SetGlobalFloat("_Sharpness", 0f);
			IsSprained = false;
			IsTumbling = false;
			IsSlamming = false;
		}
	}
	public static class BankruptExplosionHelper
	{
		public static void Spawn(Vector3 pos)
		{
			//IL_0043: 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_0083: Unknown result type (might be due to invalid IL or missing references)
			try
			{
				GameObject val = null;
				if ((Object)(object)MonoSingleton<DefaultReferenceManager>.Instance != (Object)null)
				{
					val = MonoSingleton<DefaultReferenceManager>.Instance.superExplosion;
				}
				if ((Object)(object)val == (Object)null)
				{
					Grenade val2 = Object.FindObjectOfType<Grenade>();
					if ((Object)(object)val2 != (Object)null)
					{
						val = val2.superExplosion;
					}
				}
				if ((Object)(object)val != (Object)null)
				{
					Explosion[] componentsInChildren = Object.Instantiate<GameObject>(val, pos, Quaternion.identity).GetComponentsInChildren<Explosion>();
					foreach (Explosion obj in componentsInChildren)
					{
						obj.damage = 100;
						obj.playerDamageOverride = 100;
						obj.maxSize = 100f;
						obj.speed = 120f;
						obj.canHit = (AffectedSubjects)0;
						obj.friendlyFire = true;
						obj.enemy = true;
						obj.unblockable = true;
					}
				}
				else if ((Object)(object)MonoSingleton<NewMovement>.Instance != (Object)null)
				{
					MonoSingleton<NewMovement>.Instance.GetHurt(100, true, 1f, false, false, 0.35f, false);
				}
				if ((Object)(object)MonoSingleton<StyleHUD>.Instance != (Object)null)
				{
					string text = ((PluginConfig.Language != null && PluginConfig.Language.value == ModLanguage.Russian) ? "<color=#FFD700>ВЗРЫВ МОНЕТКИ</color>" : "<color=#FFD700>COIN EXPLOSION</color>");
					MonoSingleton<StyleHUD>.Instance.AddPoints(0, text, (GameObject)null, (EnemyIdentifier)null, -1, "", "");
				}
			}
			catch (Exception arg)
			{
				Plugin.Log.LogError((object)$"Error spawning bankrupt explosion: {arg}");
			}
		}
	}
	public static class BrownOilMaterialHelper
	{
		private static Texture _cachedOilTexture;

		public static Texture GetVanillaOilTexture()
		{
			if ((Object)(object)_cachedOilTexture != (Object)null)
			{
				return _cachedOilTexture;
			}
			try
			{
				if ((Object)(object)MonoSingleton<StainVoxelManager>.Instance != (Object)null && (Object)(object)MonoSingleton<StainVoxelManager>.Instance.gasStainMat != (Object)null)
				{
					Material gasStainMat = MonoSingleton<StainVoxelManager>.Instance.gasStainMat;
					if ((Object)(object)gasStainMat.mainTexture != (Object)null)
					{
						_cachedOilTexture = gasStainMat.mainTexture;
						return _cachedOilTexture;
					}
					if (gasStainMat.HasProperty("_MainTex"))
					{
						Texture texture = gasStainMat.GetTexture("_MainTex");
						if ((Object)(object)texture != (Object)null)
						{
							_cachedOilTexture = texture;
							return _cachedOilTexture;
						}
					}
				}
				Texture2D[] array = Resources.FindObjectsOfTypeAll<Texture2D>();
				foreach (Texture2D val in array)
				{
					if (!((Object)(object)val == (Object)null))
					{
						string text = ((Object)val).name.ToLower();
						if (text.Contains("gas") || text.Contains("oil") || text.Contains("gasoline"))
						{
							_cachedOilTexture = (Texture)(object)val;
							return _cachedOilTexture;
						}
					}
				}
			}
			catch
			{
			}
			return null;
		}

		public static Material CreateBrownOilMaterial(bool isPuddle = true)
		{
			//IL_002b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0031: Expected O, but got Unknown
			//IL_00c4: 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_0079: Expected O, but got Unknown
			//IL_00dd: 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_010f: Unknown result type (might be due to invalid IL or missing references)
			Material val = null;
			try
			{
				if ((Object)(object)MonoSingleton<DefaultReferenceManager>.Instance != (Object)null && (Object)(object)MonoSingleton<DefaultReferenceManager>.Instance.blankMaterial != (Object)null)
				{
					val = new Material(MonoSingleton<DefaultReferenceManager>.Instance.blankMaterial);
				}
			}
			catch
			{
			}
			if ((Object)(object)val == (Object)null)
			{
				val = new Material(Shader.Find("Standard") ?? Shader.Find("Sprites/Default") ?? Shader.Find("Unlit/Transparent") ?? Shader.Find("Unlit/Color"));
			}
			Texture vanillaOilTexture = GetVanillaOilTexture();
			if ((Object)(object)vanillaOilTexture != (Object)null)
			{
				val.mainTexture = vanillaOilTexture;
				if (val.HasProperty("_MainTex"))
				{
					val.SetTexture("_MainTex", vanillaOilTexture);
				}
			}
			Color val2 = default(Color);
			((Color)(ref val2))..ctor(0.48f, 0.28f, 0.08f, 0.95f);
			val.color = val2;
			if (val.HasProperty("_Color"))
			{
				val.SetColor("_Color", val2);
			}
			if (val.HasProperty("_TintColor"))
			{
				val.SetColor("_TintColor", val2);
			}
			if (val.HasProperty("_BaseColor"))
			{
				val.SetColor("_BaseColor", val2);
			}
			if (val.HasProperty("_Glossiness"))
			{
				val.SetFloat("_Glossiness", 0.95f);
			}
			if (val.HasProperty("_Smoothness"))
			{
				val.SetFloat("_Smoothness", 0.95f);
			}
			if (val.HasProperty("_Metallic"))
			{
				val.SetFloat("_Metallic", 0.15f);
			}
			return val;
		}
	}
	public class BrownOilProjectile : MonoBehaviour
	{
		private float _lifetime = 3.5f;

		private bool _hit;

		private void Update()
		{
			_lifetime -= Time.deltaTime;
			if (_lifetime <= 0f)
			{
				Object.Destroy((Object)(object)((Component)this).gameObject);
			}
		}

		private void OnTriggerEnter(Collider other)
		{
			//IL_009b: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a6: Unknown result type (might be due to invalid IL or missing references)
			//IL_0052: Unknown result type (might be due to invalid IL or missing references)
			//IL_0057: Unknown result type (might be due to invalid IL or missing references)
			//IL_0064: 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_00b9: 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_007f: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00df: 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_00e4: 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_00f1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f8: Unknown result type (might be due to invalid IL or missing references)
			//IL_00fd: Unknown result type (might be due to invalid IL or missing references)
			//IL_0102: Unknown result type (might be due to invalid IL or missing references)
			//IL_010c: 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_0140: Unknown result type (might be due to invalid IL or missing references)
			//IL_014a: Unknown result type (might be due to invalid IL or missing references)
			//IL_014f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0154: Unknown result type (might be due to invalid IL or missing references)
			//IL_0161: 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_0125: 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_012d: 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_0193: 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_019f: Unknown result type (might be due to invalid IL or missing references)
			//IL_01a4: Unknown result type (might be due to invalid IL or missing references)
			//IL_01a6: Unknown result type (might be due to invalid IL or missing references)
			//IL_0175: Unknown result type (might be due to invalid IL or missing references)
			//IL_017a: Unknown result type (might be due to invalid IL or missing references)
			//IL_017d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0182: Unknown result type (might be due to invalid IL or missing references)
			//IL_01bb: Unknown result type (might be due to invalid IL or missing references)
			//IL_01c0: Unknown result type (might be due to invalid IL or missing references)
			//IL_01c3: Unknown result type (might be due to invalid IL or missing references)
			//IL_01c8: Unknown result type (might be due to invalid IL or missing references)
			//IL_01fc: Unknown result type (might be due to invalid IL or missing references)
			//IL_01fd: Unknown result type (might be due to invalid IL or missing references)
			if (_hit || (Object)(object)other == (Object)null || other.isTrigger || ((Component)other).CompareTag("Player") || (Object)(object)((Component)other).GetComponentInParent<NewMovement>() != (Object)null)
			{
				return;
			}
			_hit = true;
			if ((Object)(object)((Component)other).GetComponentInParent<EnemyIdentifier>() != (Object)null)
			{
				RaycastHit val = default(RaycastHit);
				if (Physics.Raycast(((Component)this).transform.position, Vector3.down, ref val, 6f, LayerMask.op_Implicit(LayerMaskDefaults.Get((LMD)1)), (QueryTriggerInteraction)1))
				{
					UltraLeakManager.PlacePuddleAt(((RaycastHit)(ref val)).point, ((RaycastHit)(ref val)).normal);
				}
				Object.Destroy((Object)(object)((Component)this).gameObject);
				return;
			}
			Vector3 point = ((Component)this).transform.position;
			Vector3 normal = Vector3.up;
			bool flag = false;
			Rigidbody component = ((Component)this).GetComponent<Rigidbody>();
			Vector3 val2 = (((Object)(object)component != (Object)null) ? component.velocity : Vector3.down);
			Vector3 val3 = ((((Vector3)(ref val2)).magnitude > 0.01f) ? ((Vector3)(ref val2)).normalized : Vector3.down);
			RaycastHit val4 = default(RaycastHit);
			RaycastHit val5 = default(RaycastHit);
			RaycastHit val6 = default(RaycastHit);
			if (Physics.Raycast(((Component)this).transform.position - val3 * 2.5f, val3, ref val4, 6f, LayerMask.op_Implicit(LayerMaskDefaults.Get((LMD)1)), (QueryTriggerInteraction)1))
			{
				point = ((RaycastHit)(ref val4)).point;
				normal = ((RaycastHit)(ref val4)).normal;
				flag = true;
			}
			else if (Physics.Raycast(((Component)this).transform.position + Vector3.up * 1.5f, Vector3.down, ref val5, 4f, LayerMask.op_Implicit(LayerMaskDefaults.Get((LMD)1)), (QueryTriggerInteraction)1))
			{
				point = ((RaycastHit)(ref val5)).point;
				normal = ((RaycastHit)(ref val5)).normal;
				flag = true;
			}
			else if (other.Raycast(new Ray(((Component)this).transform.position - val3 * 2f, val3), ref val6, 5f))
			{
				point = ((RaycastHit)(ref val6)).point;
				normal = ((RaycastHit)(ref val6)).normal;
				flag = true;
			}
			if (flag || LayerMaskDefaults.IsMatchingLayer(((Component)other).gameObject.layer, (LMD)1) || ((Component)other).gameObject.layer == 0 || ((Component)other).gameObject.layer == 8)
			{
				UltraLeakManager.PlacePuddleAt(point, normal);
			}
			Object.Destroy((Object)(object)((Component)this).gameObject);
		}
	}
	public class BrownOilPuddle : MonoBehaviour
	{
		public float radius = 2f;

		public float maxRadius = 4.2f;

		public float lifetime = 25f;

		private float _timeRemaining;

		private Renderer _renderer;

		private Material _material;

		private Color _baseColor;

		private void Awake()
		{
			//IL_002f: 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)
			_timeRemaining = lifetime;
			((Component)this).transform.localScale = new Vector3(radius * 2f, 0.025f, radius * 2f);
			_renderer = ((Component)this).GetComponent<Renderer>();
			_material = BrownOilMaterialHelper.CreateBrownOilMaterial();
			_baseColor = _material.color;
			_renderer.material = _material;
			_renderer.shadowCastingMode = (ShadowCastingMode)0;
			_renderer.receiveShadows = false;
		}

		private void OnEnable()
		{
			UltraLeakManager.ActivePuddles.Add(this);
		}

		private void OnDisable()
		{
			UltraLeakManager.ActivePuddles.Remove(this);
		}

		private void OnDestroy()
		{
			UltraLeakManager.ActivePuddles.Remove(this);
			if ((Object)(object)_material != (Object)null)
			{
				Object.Destroy((Object)(object)_material);
			}
		}

		public void Refresh(float growAmount = 0.35f)
		{
			//IL_0056: Unknown result type (might be due to invalid IL or missing references)
			_timeRemaining = lifetime;
			if (radius < maxRadius)
			{
				radius = Mathf.Min(maxRadius, radius + growAmount);
				((Component)this).transform.localScale = new Vector3(radius * 2f, 0.025f, radius * 2f);
			}
		}

		private void Update()
		{
			//IL_0041: Unknown result type (might be due to invalid IL or missing references)
			//IL_0046: Unknown result type (might be due to invalid IL or missing references)
			//IL_0063: 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_00a9: Unknown result type (might be due to invalid IL or missing references)
			_timeRemaining -= Time.deltaTime;
			if (_timeRemaining <= 3f)
			{
				float a = Mathf.Clamp01(_timeRemaining / 3f) * _baseColor.a;
				Color baseColor = _baseColor;
				baseColor.a = a;
				if ((Object)(object)_material != (Object)null)
				{
					_material.color = baseColor;
					if (_material.HasProperty("_Color"))
					{
						_material.SetColor("_Color", baseColor);
					}
					if (_material.HasProperty("_TintColor"))
					{
						_material.SetColor("_TintColor", baseColor);
					}
				}
			}
			if (_timeRemaining <= 0f)
			{
				Object.Destroy((Object)(object)((Component)this).gameObject);
			}
		}
	}
	public static class CleanerModeManager
	{
		private static List<List<GameObject>> savedSlots = new List<List<GameObject>>();

		private static List<GameObject> savedAllWeapons = new List<GameObject>();

		private static GameObject activeWasher = null;

		private static GameObject activeVacuum = null;

		private static GameObject activeVacuumRepel = null;

		public static bool IsActive { get; private set; } = false;

		public static void EnterCleanerMode(MonoBehaviour runner = null)
		{
			if (IsActive)
			{
				return;
			}
			GunControl instance = MonoSingleton<GunControl>.Instance;
			if ((Object)(object)instance == (Object)null || instance.slots == null || instance.slots.Count < 2)
			{
				Debug.LogWarning((object)"[UltraSlop] Cannot enter cleaner mode: GunControl not ready.");
				return;
			}
			savedSlots.Clear();
			for (int i = 0; i < instance.slots.Count; i++)
			{
				savedSlots.Add(new List<GameObject>(instance.slots[i]));
			}
			savedAllWeapons = new List<GameObject>(instance.allWeapons);
			if ((Object)(object)instance.currentWeapon != (Object)null)
			{
				instance.currentWeapon.SetActive(false);
				instance.currentWeapon = null;
			}
			foreach (GameObject savedAllWeapon in savedAllWeapons)
			{
				if ((Object)(object)savedAllWeapon != (Object)null)
				{
					savedAllWeapon.SetActive(false);
				}
			}
			for (int j = 0; j < instance.slots.Count; j++)
			{
				instance.slots[j].Clear();
			}
			instance.allWeapons.Clear();
			activeWasher = CreateCleanerWeapon(instance, "Washer Weapon", isWasher: true);
			activeVacuum = CreateCleanerWeapon(instance, "Vacuum - Suction", isWasher: false);
			activeVacuumRepel = CreateCleanerWeapon(instance, "Vacuum - Repulsion", isWasher: false, isRepulsionVariation: true);
			(activeWasher.GetComponent<WeaponIdentifier>() ?? activeWasher.AddComponent<WeaponIdentifier>()).delay = 0f;
			(activeVacuum.GetComponent<WeaponIdentifier>() ?? activeVacuum.AddComponent<WeaponIdentifier>()).delay = 0f;
			(activeVacuumRepel.GetComponent<WeaponIdentifier>() ?? activeVacuumRepel.AddComponent<WeaponIdentifier>()).delay = 0f;
			instance.slots[0].Add(activeWasher);
			instance.allWeapons.Add(activeWasher);
			instance.slots[1].Add(activeVacuum);
			instance.slots[1].Add(activeVacuumRepel);
			instance.allWeapons.Add(activeVacuum);
			instance.allWeapons.Add(activeVacuumRepel);
			instance.noWeapons = false;
			instance.currentSlotIndex = 1;
			instance.currentVariationIndex = 0;
			instance.ForceWeapon(activeWasher, true);
			instance.UpdateWeaponList(false);
			IsActive = true;
		}

		private static GameObject CreateCleanerWeapon(GunControl gc, string name, bool isWasher, bool isRepulsionVariation = false)
		{
			//IL_02c6: Unknown result type (might be due to invalid IL or missing references)
			//IL_02cc: Expected O, but got Unknown
			GameObject val = null;
			if (savedSlots.Count > 0 && savedSlots[0].Count > 0)
			{
				val = savedSlots[0][0];
			}
			else if (savedAllWeapons.Count > 0)
			{
				val = savedAllWeapons[0];
			}
			Shader shader = null;
			GameObject val2;
			if ((Object)(object)val != (Object)null)
			{
				Renderer componentInChildren = val.GetComponentInChildren<Renderer>(true);
				if ((Object)(object)componentInChildren != (Object)null && (Object)(object)componentInChildren.sharedMaterial != (Object)null)
				{
					shader = componentInChildren.sharedMaterial.shader;
				}
				val2 = Object.Instantiate<GameObject>(val, ((Component)gc).transform);
				MonoBehaviour[] components = val2.GetComponents<MonoBehaviour>();
				foreach (MonoBehaviour val3 in components)
				{
					if (val3 is Revolver || val3 is Shotgun || val3 is Nailgun || val3 is Railcannon || val3 is RocketLauncher)
					{
						((Behaviour)val3).enabled = false;
					}
				}
				Renderer[] componentsInChildren = val2.GetComponentsInChildren<Renderer>(true);
				foreach (Renderer val4 in componentsInChildren)
				{
					string text = ((Object)((Component)val4).gameObject).name.ToLower();
					if (!text.Contains("arm") && !text.Contains("hand"))
					{
						val4.enabled = false;
					}
				}
				Light[] componentsInChildren2 = val2.GetComponentsInChildren<Light>(true);
				for (int i = 0; i < componentsInChildren2.Length; i++)
				{
					((Behaviour)componentsInChildren2[i]).enabled = false;
				}
				ParticleSystem[] componentsInChildren3 = val2.GetComponentsInChildren<ParticleSystem>(true);
				foreach (ParticleSystem obj in componentsInChildren3)
				{
					obj.Stop();
					((Component)obj).gameObject.SetActive(false);
				}
				Canvas[] componentsInChildren4 = val2.GetComponentsInChildren<Canvas>(true);
				foreach (Canvas obj2 in componentsInChildren4)
				{
					((Behaviour)obj2).enabled = false;
					((Component)obj2).gameObject.SetActive(false);
				}
				CanvasRenderer[] componentsInChildren5 = val2.GetComponentsInChildren<CanvasRenderer>(true);
				for (int i = 0; i < componentsInChildren5.Length; i++)
				{
					((Component)componentsInChildren5[i]).gameObject.SetActive(false);
				}
				Graphic[] componentsInChildren6 = val2.GetComponentsInChildren<Graphic>(true);
				foreach (Graphic obj3 in componentsInChildren6)
				{
					((Behaviour)obj3).enabled = false;
					((Component)obj3).gameObject.SetActive(false);
				}
				Transform[] componentsInChildren7 = val2.GetComponentsInChildren<Transform>(true);
				foreach (Transform val5 in componentsInChildren7)
				{
					if (!((Object)(object)val5 == (Object)null))
					{
						string text2 = ((Object)val5).name.ToLower();
						if (text2.Contains("canvas") || text2.Contains("monitor") || text2.Contains("screen") || text2.Contains("coin") || text2.Contains("charge"))
						{
							((Component)val5).gameObject.SetActive(false);
						}
					}
				}
			}
			else
			{
				val2 = new GameObject(name);
				val2.transform.SetParent(((Component)gc).transform, false);
			}
			((Object)val2).name = name;
			val2.SetActive(false);
			Transform val6 = CleaningModelHelper.FindDeepChild(val2.transform, "Hand");
			if (isWasher)
			{
				CleaningWeaponFactory.SetupWasherWeapon(val2, val6 ?? val2.transform, shader);
				val2.AddComponent<CleanerWasherController>();
			}
			else
			{
				CleaningWeaponFactory.SetupVacuumWeapon(val2, val6 ?? val2.transform, shader, isRepulsionVariation);
				val2.AddComponent<CleanerVacuumController>().isRepulsionVariation = isRepulsionVariation;
			}
			WeaponIdentifier val7 = val2.GetComponent<WeaponIdentifier>();
			if ((Object)(object)val7 == (Object)null)
			{
				val7 = val2.AddComponent<WeaponIdentifier>();
			}
			val7.delay = 0f;
			return val2;
		}

		public static void ExitCleanerMode()
		{
			if (!IsActive)
			{
				return;
			}
			GunControl instance = MonoSingleton<GunControl>.Instance;
			if ((Object)(object)instance != (Object)null)
			{
				if ((Object)(object)activeWasher != (Object)null)
				{
					Object.Destroy((Object)(object)activeWasher);
					activeWasher = null;
				}
				if ((Object)(object)activeVacuum != (Object)null)
				{
					Object.Destroy((Object)(object)activeVacuum);
					activeVacuum = null;
				}
				if ((Object)(object)activeVacuumRepel != (Object)null)
				{
					Object.Destroy((Object)(object)activeVacuumRepel);
					activeVacuumRepel = null;
				}
				for (int i = 0; i < instance.slots.Count; i++)
				{
					instance.slots[i].Clear();
					if (i >= savedSlots.Count)
					{
						continue;
					}
					foreach (GameObject item in savedSlots[i])
					{
						if ((Object)(object)item != (Object)null)
						{
							instance.slots[i].Add(item);
						}
					}
				}
				instance.allWeapons.Clear();
				foreach (GameObject savedAllWeapon in savedAllWeapons)
				{
					if ((Object)(object)savedAllWeapon != (Object)null)
					{
						instance.allWeapons.Add(savedAllWeapon);
					}
				}
				instance.noWeapons = instance.allWeapons.Count == 0;
				if (instance.slots[0].Count > 0)
				{
					instance.ForceWeapon(instance.slots[0][0], true);
				}
				instance.UpdateWeaponList(false);
			}
			savedSlots.Clear();
			savedAllWeapons.Clear();
			IsActive = false;
		}
	}
	public class CleanerVacuumController : MonoBehaviour
	{
		public bool isRepulsionVariation;

		private Vacuum vacuum;

		private CameraController cc;

		private NewMovement nm;

		private float shredTickTimer;

		private const float ShredInterval = 0.09f;

		private AudioSource aud;

		private AudioClip shredClip;

		private AudioClip launchClip;

		private void Awake()
		{
			vacuum = ((Component)this).GetComponentInChildren<Vacuum>(true);
			aud = ((Component)this).gameObject.AddComponent<AudioSource>();
			aud.playOnAwake = false;
			aud.spatialBlend = 0f;
			aud.volume = 0.75f;
			shredClip = CleaningAudioHelper.GetOrCreateClip("splat", 0.15f, 400f, isLoop: false);
			launchClip = CleaningAudioHelper.GetOrCreateClip("whoosh", 0.35f, 520f, isLoop: false);
		}

		private void OnEnable()
		{
			nm = MonoSingleton<NewMovement>.Instance;
			if ((Object)(object)nm != (Object)null)
			{
				cc = nm.cc;
			}
		}

		private void Update()
		{
			//IL_0176: Unknown result type (might be due to invalid IL or missing references)
			//IL_017b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0188: 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_0190: Unknown result type (might be due to invalid IL or missing references)
			//IL_019c: Unknown result type (might be due to invalid IL or missing references)
			//IL_019e: Unknown result type (might be due to invalid IL or missing references)
			//IL_01a8: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ad: Unknown result type (might be due to invalid IL or missing references)
			//IL_01d2: Unknown result type (might be due to invalid IL or missing references)
			//IL_01d7: Unknown result type (might be due to invalid IL or missing references)
			//IL_0238: Unknown result type (might be due to invalid IL or missing references)
			//IL_023d: Unknown result type (might be due to invalid IL or missing references)
			//IL_023f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0241: Unknown result type (might be due to invalid IL or missing references)
			//IL_0243: Unknown result type (might be due to invalid IL or missing references)
			//IL_0248: Unknown result type (might be due to invalid IL or missing references)
			//IL_0522: Unknown result type (might be due to invalid IL or missing references)
			//IL_0524: Unknown result type (might be due to invalid IL or missing references)
			//IL_0526: Unknown result type (might be due to invalid IL or missing references)
			//IL_052b: Unknown result type (might be due to invalid IL or missing references)
			//IL_052f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0534: Unknown result type (might be due to invalid IL or missing references)
			//IL_054c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0551: Unknown result type (might be due to invalid IL or missing references)
			//IL_0555: Unknown result type (might be due to invalid IL or missing references)
			//IL_055f: Unknown result type (might be due to invalid IL or missing references)
			//IL_056f: Unknown result type (might be due to invalid IL or missing references)
			//IL_05a2: Unknown result type (might be due to invalid IL or missing references)
			//IL_05a4: Unknown result type (might be due to invalid IL or missing references)
			//IL_05a9: Unknown result type (might be due to invalid IL or missing references)
			//IL_05b3: Unknown result type (might be due to invalid IL or missing references)
			//IL_05b8: Unknown result type (might be due to invalid IL or missing references)
			//IL_05bd: Unknown result type (might be due to invalid IL or missing references)
			//IL_05c1: Unknown result type (might be due to invalid IL or missing references)
			//IL_05c6: Unknown result type (might be due to invalid IL or missing references)
			//IL_05d3: Unknown result type (might be due to invalid IL or missing references)
			//IL_05d7: Unknown result type (might be due to invalid IL or missing references)
			//IL_0268: Unknown result type (might be due to invalid IL or missing references)
			//IL_026a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0278: Unknown result type (might be due to invalid IL or missing references)
			//IL_027c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0286: Unknown result type (might be due to invalid IL or missing references)
			//IL_02d5: Unknown result type (might be due to invalid IL or missing references)
			//IL_02d7: Unknown result type (might be due to invalid IL or missing references)
			//IL_02de: Unknown result type (might be due to invalid IL or missing references)
			//IL_02e3: Unknown result type (might be due to invalid IL or missing references)
			//IL_02e8: Unknown result type (might be due to invalid IL or missing references)
			//IL_02ea: Unknown result type (might be due to invalid IL or missing references)
			//IL_02ef: Unknown result type (might be due to invalid IL or missing references)
			//IL_02f3: Unknown result type (might be due to invalid IL or missing references)
			//IL_02f8: Unknown result type (might be due to invalid IL or missing references)
			//IL_02c6: Unknown result type (might be due to invalid IL or missing references)
			//IL_02c8: Unknown result type (might be due to invalid IL or missing references)
			//IL_043f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0441: Unknown result type (might be due to invalid IL or missing references)
			//IL_044b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0450: Unknown result type (might be due to invalid IL or missing references)
			//IL_0455: Unknown result type (might be due to invalid IL or missing references)
			//IL_0459: Unknown result type (might be due to invalid IL or missing references)
			//IL_045e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0325: Unknown result type (might be due to invalid IL or missing references)
			//IL_032a: Unknown result type (might be due to invalid IL or missing references)
			//IL_032e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0333: Unknown result type (might be due to invalid IL or missing references)
			//IL_033d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0342: Unknown result type (might be due to invalid IL or missing references)
			//IL_0352: Unknown result type (might be due to invalid IL or missing references)
			//IL_0489: Unknown result type (might be due to invalid IL or missing references)
			//IL_0493: Unknown result type (might be due to invalid IL or missing references)
			//IL_037a: Unknown result type (might be due to invalid IL or missing references)
			//IL_037e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0388: Unknown result type (might be due to invalid IL or missing references)
			//IL_04bb: Unknown result type (might be due to invalid IL or missing references)
			//IL_04bf: Unknown result type (might be due to invalid IL or missing references)
			//IL_04c9: Unknown result type (might be due to invalid IL or missing references)
			//IL_03be: Unknown result type (might be due to invalid IL or missing references)
			//IL_03c5: Unknown result type (might be due to invalid IL or missing references)
			//IL_03ca: Unknown result type (might be due to invalid IL or missing references)
			if ((Object)(object)nm == (Object)null || (Object)(object)cc == (Object)null || (Object)(object)vacuum == (Object)null)
			{
				nm = MonoSingleton<NewMovement>.Instance;
				if ((Object)(object)nm != (Object)null)
				{
					cc = nm.cc;
				}
				if ((Object)(object)nm == (Object)null || (Object)(object)cc == (Object)null)
				{
					return;
				}
			}
			if ((Object)(object)MonoSingleton<OptionsManager>.Instance != (Object)null && (MonoSingleton<OptionsManager>.Instance.paused || MonoSingleton<OptionsManager>.Instance.frozen))
			{
				return;
			}
			InputManager instance = MonoSingleton<InputManager>.Instance;
			if ((Object)(object)instance == (Object)null)
			{
				return;
			}
			bool isPressed = instance.InputSource.Fire1.IsPressed;
			bool isPressed2 = instance.InputSource.Fire2.IsPressed;
			if (!isPressed && !isPressed2)
			{
				return;
			}
			bool flag = (!isRepulsionVariation && isPressed && !isPressed2) || (isRepulsionVariation && isPressed2 && !isPressed);
			bool flag2 = (!isRepulsionVariation && isPressed2) || (isRepulsionVariation && isPressed);
			if (!flag && !flag2)
			{
				return;
			}
			shredTickTimer -= Time.deltaTime;
			float num = ((PluginConfig.VacuumPullStrength != null) ? PluginConfig.VacuumPullStrength.value : 42f);
			float num2 = ((PluginConfig.VacuumLaunchSpeed != null) ? PluginConfig.VacuumLaunchSpeed.value : 55f);
			float num3 = 25f;
			float num4 = 36f;
			Vector3 position = ((Component)cc).transform.position;
			Vector3 forward = ((Component)cc).transform.forward;
			int num5 = LayerMask.op_Implicit(LayerMaskDefaults.Get((LMD)3));
			Collider[] array = Physics.OverlapSphere(position + forward * (num3 * 0.5f), num3 * 0.65f, num5);
			HashSet<EnemyIdentifier> hashSet = new HashSet<EnemyIdentifier>();
			EnemyIdentifier val = null;
			float num6 = float.MaxValue;
			Vector3 val2 = Vector3.zero;
			Collider[] array2 = array;
			RaycastHit val5 = default(RaycastHit);
			Vector3 val6;
			foreach (Collider val3 in array2)
			{
				if ((Object)(object)val3 == (Object)null)
				{
					continue;
				}
				EnemyIdentifier componentInParent = ((Component)val3).GetComponentInParent<EnemyIdentifier>();
				if ((Object)(object)componentInParent == (Object)null || componentInParent.dead || hashSet.Contains(componentInParent))
				{
					continue;
				}
				hashSet.Add(componentInParent);
				Vector3 position2 = ((Component)componentInParent).transform.position;
				Vector3 val4 = position2 - position;
				float magnitude = ((Vector3)(ref val4)).magnitude;
				if (magnitude > num3 || magnitude < 0.3f || Vector3.Angle(forward, val4) > num4 || (Physics.Raycast(position, ((Vector3)(ref val4)).normalized, ref val5, magnitude, LayerMask.op_Implicit(LayerMaskDefaults.Get((LMD)1)), (QueryTriggerInteraction)1) && ((RaycastHit)(ref val5)).distance < magnitude - 0.6f))
				{
					continue;
				}
				if (IsHeavyEnemy(componentInParent))
				{
					if (magnitude < num6)
					{
						num6 = magnitude;
						val = componentInParent;
						val2 = position2;
					}
				}
				else if (flag)
				{
					val6 = position + forward * 1.5f - position2;
					Vector3 normalized = ((Vector3)(ref val6)).normalized;
					Rigidbody val7 = ((Component)componentInParent).GetComponent<Rigidbody>() ?? ((Component)componentInParent).GetComponentInChildren<Rigidbody>();
					if ((Object)(object)val7 != (Object)null && !val7.isKinematic)
					{
						val7.velocity = Vector3.MoveTowards(val7.velocity, normalized * num + Vector3.up * 1.5f, 110f * Time.deltaTime);
					}
					NavMeshAgent component = ((Component)componentInParent).GetComponent<NavMeshAgent>();
					if ((Object)(object)component != (Object)null && ((Behaviour)component).enabled)
					{
						component.Move(normalized * num * Time.deltaTime);
					}
					if (magnitude <= 3f && shredTickTimer <= 0f)
					{
						float num7 = 0.45f;
						componentInParent.DeliverDamage(((Component)val3).gameObject, normalized * 4f, position2, num7, false, 0f, ((Component)this).gameObject, false, false);
						if ((Object)(object)aud != (Object)null && (Object)(object)shredClip != (Object)null)
						{
							aud.pitch = Random.Range(0.9f, 1.25f);
							aud.PlayOneShot(shredClip, 0.6f);
						}
					}
				}
				else if (flag2)
				{
					val6 = forward + Vector3.up * 0.18f;
					Vector3 normalized2 = ((Vector3)(ref val6)).normalized;
					Rigidbody val8 = ((Component)componentInParent).GetComponent<Rigidbody>() ?? ((Component)componentInParent).GetComponentInChildren<Rigidbody>();
					if ((Object)(object)val8 != (Object)null && !val8.isKinematic)
					{
						val8.velocity = normalized2 * (num2 * 1.15f);
					}
					NavMeshAgent component2 = ((Component)componentInParent).GetComponent<NavMeshAgent>();
					if ((Object)(object)component2 != (Object)null && ((Behaviour)component2).enabled)
					{
						component2.Move(normalized2 * num2 * Time.deltaTime);
					}
				}
			}
			if (shredTickTimer <= 0f)
			{
				shredTickTimer = 0.09f;
			}
			if (!((Object)(object)val != (Object)null) || !((Object)(object)nm.rb != (Object)null))
			{
				return;
			}
			if (flag)
			{
				val6 = val2 - position;
				Vector3 normalized3 = ((Vector3)(ref val6)).normalized;
				nm.rb.velocity = Vector3.MoveTowards(nm.rb.velocity, normalized3 * num * 1.2f, 130f * Time.deltaTime);
				if ((Object)(object)cc != (Object)null)
				{
					cc.CameraShake(0.12f);
				}
			}
			else if (flag2)
			{
				val6 = -forward + Vector3.up * 0.28f;
				Vector3 normalized4 = ((Vector3)(ref val6)).normalized;
				nm.rb.velocity = normalized4 * num2;
				if ((Object)(object)aud != (Object)null && (Object)(object)launchClip != (Object)null)
				{
					aud.pitch = 1.1f;
					aud.PlayOneShot(launchClip, 0.7f);
				}
				if ((Object)(object)cc != (Object)null)
				{
					cc.CameraShake(0.4f);
				}
			}
		}

		public static bool IsHeavyEnemy(EnemyIdentifier eid)
		{
			//IL_0026: Unknown result type (might be due to invalid IL or missing references)
			//IL_002b: Unknown result type (might be due to invalid IL or missing references)
			//IL_002c: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d2: Expected I4, but got Unknown
			if ((Object)(object)eid == (Object)null)
			{
				return false;
			}
			if (eid.bigEnemy || eid.isBoss || eid.unbounceable)
			{
				return true;
			}
			EnemyType enemyType = eid.enemyType;
			switch ((int)enemyType)
			{
			case 0:
			case 2:
			case 4:
			case 5:
			case 7:
			case 8:
			case 9:
			case 11:
			case 16:
			case 17:
			case 18:
			case 19:
			case 22:
			case 26:
			case 27:
			case 28:
			case 29:
			case 30:
			case 32:
			case 33:
			case 34:
			case 35:
			case 37:
			case 39:
				return true;
			default:
				return false;
			}
		}
	}
	public class CleanerWasherController : MonoBehaviour
	{
		private Washer washer;

		private CameraController cc;

		private NewMovement nm;

		private float tickTimer;

		private const float TickInterval = 0.08f;

		private AudioSource sawAudio;

		private AudioClip sawBuzzClip;

		private AudioClip fleshSliceClip;

		private void Awake()
		{
			washer = ((Component)this).GetComponentInChildren<Washer>(true);
			sawAudio = ((Component)this).gameObject.AddComponent<AudioSource>();
			sawAudio.playOnAwake = false;
			sawAudio.loop = true;
			sawAudio.spatialBlend = 0f;
			sawAudio.volume = 0.65f;
			sawBuzzClip = CleaningAudioHelper.GetOrCreateClip("saw", 1.2f, 650f, isLoop: true);
			fleshSliceClip = CleaningAudioHelper.GetOrCreateClip("splat", 0.15f, 480f, isLoop: false);
			sawAudio.clip = sawBuzzClip;
		}

		private void OnEnable()
		{
			nm = MonoSingleton<NewMovement>.Instance;
			if ((Object)(object)nm != (Object)null)
			{
				cc = nm.cc;
			}
		}

		private void Update()
		{
			//IL_01ae: Unknown result type (might be due to invalid IL or missing references)
			//IL_01b3: Unknown result type (might be due to invalid IL or missing references)
			//IL_01bf: Unknown result type (might be due to invalid IL or missing references)
			//IL_01c4: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ce: Unknown result type (might be due to invalid IL or missing references)
			//IL_01da: Unknown result type (might be due to invalid IL or missing references)
			//IL_01dd: Unknown result type (might be due to invalid IL or missing references)
			//IL_0234: Unknown result type (might be due to invalid IL or missing references)
			//IL_0239: Unknown result type (might be due to invalid IL or missing references)
			//IL_028b: Unknown result type (might be due to invalid IL or missing references)
			//IL_028e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0293: Unknown result type (might be due to invalid IL or missing references)
			//IL_0294: Unknown result type (might be due to invalid IL or missing references)
			//IL_0299: Unknown result type (might be due to invalid IL or missing references)
			//IL_029d: Unknown result type (might be due to invalid IL or missing references)
			//IL_02a7: Unknown result type (might be due to invalid IL or missing references)
			//IL_02dc: Unknown result type (might be due to invalid IL or missing references)
			//IL_02e2: Invalid comparison between Unknown and I4
			//IL_02f0: Unknown result type (might be due to invalid IL or missing references)
			//IL_02f7: Unknown result type (might be due to invalid IL or missing references)
			//IL_02fc: Unknown result type (might be due to invalid IL or missing references)
			//IL_030c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0310: Unknown result type (might be due to invalid IL or missing references)
			//IL_0329: Unknown result type (might be due to invalid IL or missing references)
			//IL_032c: Unknown result type (might be due to invalid IL or missing references)
			if ((Object)(object)nm == (Object)null || (Object)(object)cc == (Object)null || (Object)(object)washer == (Object)null)
			{
				nm = MonoSingleton<NewMovement>.Instance;
				if ((Object)(object)nm != (Object)null)
				{
					cc = nm.cc;
				}
				if ((Object)(object)nm == (Object)null || (Object)(object)cc == (Object)null || (Object)(object)washer == (Object)null)
				{
					return;
				}
			}
			if ((Object)(object)MonoSingleton<OptionsManager>.Instance != (Object)null && (MonoSingleton<OptionsManager>.Instance.paused || MonoSingleton<OptionsManager>.Instance.frozen))
			{
				if ((Object)(object)sawAudio != (Object)null && sawAudio.isPlaying)
				{
					sawAudio.Stop();
				}
				return;
			}
			bool flag = false;
			if ((Object)(object)washer.part != (Object)null && washer.part.isPlaying)
			{
				flag = true;
			}
			else
			{
				InputManager instance = MonoSingleton<InputManager>.Instance;
				if ((Object)(object)instance != (Object)null && instance.InputSource.Fire1.IsPressed)
				{
					flag = true;
				}
			}
			if (!flag)
			{
				if ((Object)(object)sawAudio != (Object)null && sawAudio.isPlaying)
				{
					sawAudio.Stop();
				}
				return;
			}
			tickTimer -= Time.deltaTime;
			if (tickTimer > 0f)
			{
				return;
			}
			tickTimer = 0.08f;
			float num = ((PluginConfig.WasherChainsawRange != null) ? PluginConfig.WasherChainsawRange.value : 12f);
			float num2 = ((PluginConfig.WasherChainsawDamage != null) ? PluginConfig.WasherChainsawDamage.value : 0.35f);
			Vector3 position = ((Component)cc).transform.position;
			Vector3 forward = ((Component)cc).transform.forward;
			float num3 = 1.15f;
			int num4 = LayerMask.op_Implicit(LayerMaskDefaults.Get((LMD)3));
			RaycastHit[] array = Physics.SphereCastAll(position, num3, forward, num, num4, (QueryTriggerInteraction)1);
			if (array == null || array.Length == 0)
			{
				if ((Object)(object)sawAudio != (Object)null && sawAudio.isPlaying)
				{
					sawAudio.Stop();
				}
				return;
			}
			HashSet<EnemyIdentifier> hashSet = new HashSet<EnemyIdentifier>();
			bool flag2 = false;
			RaycastHit[] array2 = array;
			RaycastHit val3 = default(RaycastHit);
			for (int i = 0; i < array2.Length; i++)
			{
				RaycastHit val = array2[i];
				if ((Object)(object)((RaycastHit)(ref val)).collider == (Object)null)
				{
					continue;
				}
				EnemyIdentifier componentInParent = ((Component)((RaycastHit)(ref val)).collider).GetComponentInParent<EnemyIdentifier>();
				if ((Object)(object)componentInParent == (Object)null || componentInParent.dead || hashSet.Contains(componentInParent))
				{
					continue;
				}
				float distance = ((RaycastHit)(ref val)).distance;
				Vector3 val2 = ((RaycastHit)(ref val)).point - position;
				if (Physics.Raycast(position, ((Vector3)(ref val2)).normalized, ref val3, distance, LayerMask.op_Implicit(LayerMaskDefaults.Get((LMD)1)), (QueryTriggerInteraction)1) && ((RaycastHit)(ref val3)).distance < distance - 0.5f)
				{
					continue;
				}
				hashSet.Add(componentInParent);
				flag2 = true;
				if ((int)componentInParent.enemyType == 6)
				{
					componentInParent.InstaKill();
					continue;
				}
				Vector3 val4 = forward * 3.5f;
				componentInParent.DeliverDamage(((Component)((RaycastHit)(ref val)).collider).gameObject, val4, ((RaycastHit)(ref val)).point, num2, false, 0f, ((Component)this).gameObject, false, false);
				if (Vector3.Distance(position, ((RaycastHit)(ref val)).point) <= 8.5f && (Object)(object)nm != (Object)null && nm.hp < 100)
				{
					int num5 = Mathf.Max(1, Mathf.RoundToInt(num2 * 10f));
					nm.GetHealth(num5, false, false, true);
				}
				if ((Object)(object)fleshSliceClip != (Object)null && (Object)(object)sawAudio != (Object)null)
				{
					sawAudio.PlayOneShot(fleshSliceClip, 0.4f);
				}
				cc.CameraShake(0.08f);
			}
			if (flag2)
			{
				if ((Object)(object)sawAudio != (Object)null && !sawAudio.isPlaying)
				{
					sawAudio.Play();
				}
			}
			else if ((Object)(object)sawAudio != (Object)null && sawAudio.isPlaying)
			{
				sawAudio.Stop();
			}
		}

		private void OnDisable()
		{
			if ((Object)(object)sawAudio != (Object)null && sawAudio.isPlaying)
			{
				sawAudio.Stop();
			}
		}
	}
	public static class CleaningAudioHelper
	{
		public static AudioClip GetOrCreateClip(string keyword, float duration, float freq, bool isLoop)
		{
			try
			{
				AudioClip[] array = Resources.FindObjectsOfTypeAll<AudioClip>();
				if (array != null)
				{
					AudioClip[] array2 = array;
					foreach (AudioClip val in array2)
					{
						if ((Object)(object)val != (Object)null && ((Object)val).name.IndexOf(keyword, StringComparison.OrdinalIgnoreCase) >= 0)
						{
							return val;
						}
					}
				}
			}
			catch
			{
			}
			int num = 44100;
			int num2 = Mathf.Max(1, (int)((float)num * duration));
			float[] array3 = new float[num2];
			for (int j = 0; j < num2; j++)
			{
				float num3 = (float)j / (float)num;
				float num4 = (Random.value * 2f - 1f) * 0.35f;
				float num5 = (isLoop ? 1f : Mathf.Clamp01(1f - num3 / duration));
				array3[j] = (num4 + Mathf.Sin(num3 * freq * 6.283185f) * 0.25f) * num5;
			}
			AudioClip obj2 = AudioClip.Create("Clean_" + keyword, num2, 1, num, false);
			obj2.SetData(array3, 0);
			return obj2;
		}
	}
	public static class CleaningModelHelper
	{
		private static Mesh washerMesh;

		private static Mesh nozzle1Mesh;

		private static Mesh nozzle2Mesh;

		private static Mesh nozzle3Mesh;

		private static Mesh vacuumMesh;

		private static Material washerMaterial;

		private static Material vacuumMaterial;

		public static Mesh GetWasherMesh()
		{
			return washerMesh ?? (washerMesh = LoadMeshFromResource("Washer.obj", "Washer"));
		}

		public static Mesh GetNozzle1Mesh()
		{
			return nozzle1Mesh ?? (nozzle1Mesh = LoadMeshFromResource("Nozzle1.obj", "Nozzle1"));
		}

		public static Mesh GetNozzle2Mesh()
		{
			return nozzle2Mesh ?? (nozzle2Mesh = LoadMeshFromResource("Nozzle2.obj", "Nozzle2"));
		}

		public static Mesh GetNozzle3Mesh()
		{
			return nozzle3Mesh ?? (nozzle3Mesh = LoadMeshFromResource("Nozzle3.obj", "Nozzle3"));
		}

		public static Mesh GetVacuumMesh()
		{
			return vacuumMesh ?? (vacuumMesh = LoadMeshFromResource("Vacuum.obj", "Vacuum"));
		}

		public static Material GetWasherMaterial(Shader fallbackShader = null)
		{
			//IL_0030: Unknown result type (might be due to invalid IL or missing references)
			//IL_0035: Unknown result type (might be due to invalid IL or missing references)
			//IL_0040: Unknown result type (might be due to invalid IL or missing references)
			//IL_0055: Expected O, but got Unknown
			if ((Object)(object)washerMaterial != (Object)null)
			{
				return washerMaterial;
			}
			washerMaterial = new Material(fallbackShader ?? Shader.Find("psx/vertexlit") ?? Shader.Find("Standard"))
			{
				name = "M_Washer",
				mainTexture = (Texture)(object)LoadTextureFromResource("T_Washer.png")
			};
			return washerMaterial;
		}

		public static Material GetVacuumMaterial(Shader fallbackShader = null)
		{
			//IL_0030: Unknown result type (might be due to invalid IL or missing references)
			//IL_0035: Unknown result type (might be due to invalid IL or missing references)
			//IL_0040: Unknown result type (might be due to invalid IL or missing references)
			//IL_0055: Expected O, but got Unknown
			if ((Object)(object)vacuumMaterial != (Object)null)
			{
				return vacuumMaterial;
			}
			vacuumMaterial = new Material(fallbackShader ?? Shader.Find("psx/vertexlit") ?? Shader.Find("Standard"))
			{
				name = "M_Vacuum",
				mainTexture = (Texture)(object)LoadTextureFromResource("T_Vacuum.png")
			};
			return vacuumMaterial;
		}

		public static GameObject CreateWasherVisual(Transform handBone, Shader shader = null)
		{
			//IL_000c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0012: Expected O, but got Unknown
			//IL_003d: 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_0080: 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_00bb: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00da: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ea: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f4: Unknown result type (might be due to invalid IL or missing references)
			//IL_0114: Unknown result type (might be due to invalid IL or missing references)
			//IL_0119: 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_0140: Unknown result type (might be due to invalid IL or missing references)
			//IL_014a: Unknown result type (might be due to invalid IL or missing references)
			//IL_015f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0169: Unknown result type (might be due to invalid IL or missing references)
			//IL_016f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0179: Unknown result type (might be due to invalid IL or missing references)
			//IL_0189: Unknown result type (might be due to invalid IL or missing references)
			//IL_01a0: Unknown result type (might be due to invalid IL or missing references)
			//IL_01a5: Unknown result type (might be due to invalid IL or missing references)
			//IL_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_01d6: Unknown result type (might be due to invalid IL or missing references)
			//IL_01dc: Unknown result type (might be due to invalid IL or missing references)
			//IL_01e6: 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_01f6: Unknown result type (might be due to invalid IL or missing references)
			//IL_0206: Unknown result type (might be due to invalid IL or missing references)
			//IL_021d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0222: 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_0249: Unknown result type (might be due to invalid IL or missing references)
			//IL_0253: Unknown result type (might be due to invalid IL or missing references)
			//IL_0268: Unknown result type (might be due to invalid IL or missing references)
			//IL_0272: Unknown result type (might be due to invalid IL or missing references)
			//IL_0278: Unknown result type (might be due to invalid IL or missing references)
			//IL_0282: Unknown result type (might be due to invalid IL or missing references)
			//IL_0292: Unknown result type (might be due to invalid IL or missing references)
			Material sharedMaterial = GetWasherMaterial(shader);
			GameObject val = new GameObject("Cleaner_Washer_Root");
			if ((Object)(object)handBone != (Object)null)
			{
				val.transform.SetParent(handBone, false);
			}
			val.transform.localPosition = new Vector3(-0.00918f, 0.06728f, -0.00381f);
			val.transform.localRotation = new Quaternion(0.05026f, 0.05073f, 0.70205f, -0.70854f);
			val.transform.localScale = new Vector3(-0.2597f, -0.2758f, -0.2758f);
			GameObject val2 = new GameObject("Washer");
			val2.transform.SetParent(val.transform, false);
			val2.transform.localPosition = new Vector3(-0.1087f, -0.0115f, 0f);
			val2.transform.localRotation = Quaternion.Euler(-90f, 0f, 0f);
			val2.transform.localScale = Vector3.one;
			val2.AddComponent<MeshFilter>().sharedMesh = GetWasherMesh();
			((Renderer)val2.AddComponent<MeshRenderer>()).sharedMaterial = sharedMaterial;
			GameObject val3 = new GameObject("Nozzle1");
			val3.transform.SetParent(val.transform, false);
			val3.transform.localPosition = new Vector3(0.14224f, 0.04341f, 0f);
			val3.transform.localRotation = Quaternion.Euler(-90f, 0f, 0f);
			val3.transform.localScale = Vector3.one;
			val3.AddComponent<MeshFilter>().sharedMesh = GetNozzle1Mesh();
			((Renderer)val3.AddComponent<MeshRenderer>()).sharedMaterial = sharedMaterial;
			val3.SetActive(true);
			GameObject val4 = new GameObject("Nozzle2");
			val4.transform.SetParent(val.transform, false);
			val4.transform.localPosition = new Vector3(0.14224f, 0.04341f, 0f);
			val4.transform.localRotation = Quaternion.identity;
			val4.transform.localScale = Vector3.one;
			val4.AddComponent<MeshFilter>().sharedMesh = GetNozzle2Mesh();
			((Renderer)val4.AddComponent<MeshRenderer>()).sharedMaterial = sharedMaterial;
			val4.SetActive(false);
			GameObject val5 = new GameObject("Nozzle3");
			val5.transform.SetParent(val.transform, false);
			val5.transform.localPosition = new Vector3(0.14224f, 0.04341f, 0f);
			val5.transform.localRotation = Quaternion.Euler(-90f, 0f, 0f);
			val5.transform.localScale = Vector3.one;
			val5.AddComponent<MeshFilter>().sharedMesh = GetNozzle3Mesh();
			((Renderer)val5.AddComponent<MeshRenderer>()).sharedMaterial = sharedMaterial;
			val5.SetActive(false);
			return val;
		}

		public static GameObject CreateVacuumVisual(Transform handBone, Shader shader = null)
		{
			//IL_000c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0012: Expected O, but got Unknown
			//IL_003d: 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_0080: 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_00bb: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00da: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ea: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f4: Unknown result type (might be due to invalid IL or missing references)
			Material sharedMaterial = GetVacuumMaterial(shader);
			GameObject val = new GameObject("Cleaner_Vacuum_Root");
			if ((Object)(object)handBone != (Object)null)
			{
				val.transform.SetParent(handBone, false);
			}
			val.transform.localPosition = new Vector3(-0.00918f, 0.06728f, -0.00381f);
			val.transform.localRotation = new Quaternion(0.05026f, 0.05073f, 0.70205f, -0.70854f);
			val.transform.localScale = new Vector3(-0.2597f, -0.2758f, -0.2758f);
			GameObject val2 = new GameObject("Vacuum");
			val2.transform.SetParent(val.transform, false);
			val2.transform.localPosition = new Vector3(-0.05f, -0.012f, 0f);
			val2.transform.localRotation = Quaternion.Euler(-90f, 0f, 0f);
			val2.transform.localScale = Vector3.one;
			val2.AddComponent<MeshFilter>().sharedMesh = GetVacuumMesh();
			((Renderer)val2.AddComponent<MeshRenderer>()).sharedMaterial = sharedMaterial;
			return val;
		}

		public static Transform FindDeepChild(Transform parent, string name)
		{
			//IL_001a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0020: Expected O, but got Unknown
			if ((Object)(object)parent == (Object)null)
			{
				return null;
			}
			foreach (Transform item in parent)
			{
				Transform val = item;
				if (((Object)val).name.Equals(name, StringComparison.OrdinalIgnoreCase))
				{
					return val;
				}
				Transform val2 = FindDeepChild(val, name);
				if ((Object)(object)val2 != (Object)null)
				{
					return val2;
				}
			}
			return null;
		}

		private static Mesh LoadMeshFromResource(string resourceName, string meshName)
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_0029: Unknown result type (might be due to invalid IL or missing references)
			//IL_0031: Expected O, but got Unknown
			string resourceString = GetResourceString(resourceName);
			if (string.IsNullOrEmpty(resourceString))
			{
				Debug.LogError((object)("[UltraSlop] Embedded resource '" + resourceName + "' not found!"));
				return new Mesh
				{
					name = meshName
				};
			}
			return ParseObj(resourceString, meshName);
		}

		private static Texture2D LoadTextureFromResource(string resourceName)
		{
			//IL_002d: 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_0039: Unknown result type (might be due to invalid IL or missing references)
			//IL_0040: Unknown result type (might be due to invalid IL or missing references)
			//IL_0047: Expected O, but got Unknown
			//IL_0049: Expected O, but got Unknown
			byte[] resourceBytes = GetResourceBytes(resourceName);
			if (resourceBytes == null || resourceBytes.Length == 0)
			{
				Debug.LogError((object)("[UltraSlop] Embedded resource '" + resourceName + "' not found!"));
				return Texture2D.whiteTexture;
			}
			Texture2D val = new Texture2D(2, 2, (TextureFormat)4, false)
			{
				filterMode = (FilterMode)0,
				wrapMode = (TextureWrapMode)0
			};
			ImageConversion.LoadImage(val, resourceBytes);
			return val;
		}

		private static byte[] GetResourceBytes(string nameEnding)
		{
			Assembly assembly = typeof(CleaningModelHelper).Assembly;
			string text = null;
			string[] manifestResourceNames = assembly.GetManifestResourceNames();
			foreach (string text2 in manifestResourceNames)
			{
				if (text2.EndsWith(nameEnding, StringComparison.OrdinalIgnoreCase))
				{
					text = text2;
					break;
				}
			}
			if (text == null)
			{
				return null;
			}
			using Stream stream = assembly.GetManifestResourceStream(text);
			if (stream == null)
			{
				return null;
			}
			byte[] array = new byte[stream.Length];
			stream.Read(array, 0, array.Length);
			return array;
		}

		private static string GetResourceString(string nameEnding)
		{
			byte[] resourceBytes = GetResourceBytes(nameEnding);
			if (resourceBytes == null)
			{
				return null;
			}
			return Encoding.UTF8.GetString(resourceBytes);
		}

		public static Mesh ParseObj(string objText, string meshName)
		{
			//IL_033e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0343: Unknown result type (might be due to invalid IL or missing references)
			//IL_034a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0356: Unknown result type (might be due to invalid IL or missing references)
			//IL_0363: Unknown result type (might be due to invalid IL or missing references)
			//IL_0382: Unknown result type (might be due to invalid IL or missing references)
			//IL_0391: Expected O, but got Unknown
			//IL_0105: Unknown result type (might be due to invalid IL or missing references)
			//IL_0143: Unknown result type (might be due to invalid IL or missing references)
			//IL_0194: 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)
			//IL_0225: Unknown result type (might be due to invalid IL or missing references)
			//IL_0277: Unknown result type (might be due to invalid IL or missing references)
			//IL_02c9: Unknown result type (might be due to invalid IL or missing references)
			//IL_025f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0269: Unknown result type (might be due to invalid IL or missing references)
			//IL_02b1: Unknown result type (might be due to invalid IL or missing references)
			//IL_02bb: Unknown result type (might be due to invalid IL or missing references)
			List<Vector3> list = new List<Vector3>();
			List<Vector2> list2 = new List<Vector2>();
			List<Vector3> list3 = new List<Vector3>();
			List<Vector3> list4 = new List<Vector3>();
			List<Vector2> list5 = new List<Vector2>();
			List<Vector3> list6 = new List<Vector3>();
			List<int> list7 = new List<int>();
			Dictionary<string, int> dictionary = new Dictionary<string, int>();
			using (StringReader stringReader = new StringReader(objText))
			{
				string text;
				while ((text = stringReader.ReadLine()) != null)
				{
					text = text.Trim();
					if (text.Length == 0 || text.StartsWith("#"))
					{
						continue;
					}
					string[] array = text.Split((char[]?)null, StringSplitOptions.RemoveEmptyEntries);
					if (array.Length == 0)
					{
						continue;
					}
					switch (array[0])
					{
					case "v":
						if (array.Length >= 4)
						{
							float num10 = float.Parse(array[1], CultureInfo.InvariantCulture);
							float num11 = float.Parse(array[2], CultureInfo.InvariantCulture);
							float num12 = float.Parse(array[3], CultureInfo.InvariantCulture);
							list.Add(new Vector3(0f - num10, num11, num12));
						}
						break;
					case "vt":
						if (array.Length >= 3)
						{
							float num5 = float.Parse(array[1], CultureInfo.InvariantCulture);
							float num6 = float.Parse(array[2], CultureInfo.InvariantCulture);
							list2.Add(new Vector2(num5, num6));
						}
						break;
					case "vn":
						if (array.Length >= 4)
						{
							float num7 = float.Parse(array[1], CultureInfo.InvariantCulture);
							float num8 = float.Parse(array[2], CultureInfo.InvariantCulture);
							float num9 = float.Parse(array[3], CultureInfo.InvariantCulture);
							list3.Add(new Vector3(0f - num7, num8, num9));
						}
						break;
					case "f":
					{
						if (array.Length < 4)
						{
							break;
						}
						int num = array.Length - 1;
						int[] array2 = new int[num];
						for (int i = 0; i < num; i++)
						{
							string text2 = array[i + 1];
							if (!dictionary.TryGetValue(text2, out var value))
							{
								value = (dictionary[text2] = list4.Count);
								string[] array3 = text2.Split('/');
								int num2 = int.Parse(array3[0]) - 1;
								list4.Add((num2 >= 0 && num2 < list.Count) ? list[num2] : Vector3.zero);
								if (array3.Length > 1 && !string.IsNullOrEmpty(array3[1]))
								{
									int num3 = int.Parse(array3[1]) - 1;
									list5.Add((num3 >= 0 && num3 < list2.Count) ? list2[num3] : Vector2.zero);
								}
								else
								{
									list5.Add(Vector2.zero);
								}
								if (array3.Length > 2 && !string.IsNullOrEmpty(array3[2]))
								{
									int num4 = int.Parse(array3[2]) - 1;
									list6.Add((num4 >= 0 && num4 < list3.Count) ? list3[num4] : Vector3.up);
								}
								else
								{
									list6.Add(Vector3.up);
								}
							}
							array2[i] = value;
						}
						for (int j = 1; j < num - 1; j++)
						{
							list7.Add(array2[j + 1]);
							list7.Add(array2[j]);
							list7.Add(array2[0]);
						}
						break;
					}
					}
				}
			}
			Mesh val = new Mesh
			{
				name = meshName,
				vertices = list4.ToArray(),
				uv = list5.ToArray(),
				normals = ((list6.Count == list4.Count) ? list6.ToArray() : null),
				triangles = list7.ToArray()
			};
			if (val.normals == null || val.normals.Length == 0)
			{
				val.RecalculateNormals();
			}
			val.RecalculateBounds();
			return val;
		}
	}
	public static class CleaningWeaponFactory
	{
		private static FieldInfo fWasherClick;

		private static FieldInfo fWasherTriggerOn;

		private static FieldInfo fWasherTriggerOff;

		private static FieldInfo fWasherNozzles;

		private static FieldInfo fWasherMusicStarted;

		private static FieldInfo fVacSuckPoint;

		private static FieldInfo fVacSuckBox;

		private static FieldInfo fVacConsumeSound;

		private static FieldInfo fVacSuckSound;

		private static FieldInfo fVacSuckSystem;

		private static FieldInfo fVacBlowSystem;

		private static FieldInfo fVacSuckStart;

		private static FieldInfo fVacSuckLoop;

		private static FieldInfo fVacSuckStop;

		private static FieldInfo fVacSuckStuck;

		private static FieldInfo fVacSuckStuckLoop;

		private static FieldInfo fVacBlowStart;

		private static FieldInfo fVacBlowLoop;

		private static FieldInfo fVacBlowStop;

		private static FieldInfo fVacMusicStarted;

		static CleaningWeaponFactory()
		{
			BindingFlags bindingAttr = BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic;
			Type? typeFromHandle = typeof(Washer);
			fWasherClick = typeFromHandle.GetField("click", bindingAttr);
			fWasherTriggerOn = typeFromHandle.GetField("triggerOn", bindingAttr);
			fWasherTriggerOff = typeFromHandle.GetField("triggerOff", bindingAttr);
			fWasherNozzles = typeFromHandle.GetField("nozzles", bindingAttr);
			fWasherMusicStarted = typeFromHandle.GetField("musicStarted", bindingAttr);
			Type? typeFromHandle2 = typeof(Vacuum);
			fVacSuckPoint = typeFromHandle2.GetField("_suckPoint", bindingAttr);
			fVacSuckBox = typeFromHandle2.GetField("_suckBox", bindingAttr);
			fVacConsumeSound = typeFromHandle2.GetField("_consumeSound", bindingAttr);
			fVacSuckSound = typeFromHandle2.GetField("_suckSound", bindingAttr);
			fVacSuckSystem = typeFromHandle2.GetField("_suckSystem", bindingAttr);
			fVacBlowSystem = typeFromHandle2.GetField("_blowSystem", bindingAttr);
			fVacSuckStart = typeFromHandle2.GetField("suckStartSound", bindingAttr);
			fVacSuckLoop = typeFromHandle2.GetField("suckLoopSound", bindingAttr);
			fVacSuckStop = typeFromHandle2.GetField("suckStopSound", bindingAttr);
			fVacSuckStuck = typeFromHandle2.GetField("suckStuckSound", bindingAttr);
			fVacSuckStuckLoop = typeFromHandle2.GetField("suckStuckLoopSound", bindingAttr);
			fVacBlowStart = typeFromHandle2.GetField("blowStartSound", bindingAttr);
			fVacBlowLoop = typeFromHandle2.GetField("blowLoopSound", bindingAttr);
			fVacBlowStop = typeFromHandle2.GetField("blowStopSound", bindingAttr);
			fVacMusicStarted = typeFromHandle2.GetField("musicStarted", bindingAttr);
		}

		public static void SetupWasherWeapon(GameObject weaponObj, Transform handBone, Shader shader)
		{
			//IL_0064: Unknown result type (might be due to invalid IL or missing references)
			//IL_006b: Expected O, but got Unknown
			//IL_0094: 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_010e: 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_012c: Unknown result type (might be due to invalid IL or missing references)
			//IL_013d: 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_016e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0173: Unknown result type (might be due to invalid IL or missing references)
			//IL_0193: 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)
			//IL_01a1: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ad: Unknown result type (might be due to invalid IL or missing references)
			//IL_01b2: Unknown result type (might be due to invalid IL or missing references)
			//IL_01d6: Unknown result type (might be due to invalid IL or missing references)
			//IL_01db: Unknown result type (might be due to invalid IL or missing references)
			//IL_01f8: Unknown result type (might be due to invalid IL or missing references)
			//IL_0209: Unknown result type (might be due to invalid IL or missing references)
			//IL_021a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0251: Unknown result type (might be due to invalid IL or missing references)
			//IL_025b: Expected O, but got Unknown
			//IL_0276: Unknown result type (might be due to invalid IL or missing references)
			GameObject val = CleaningModelHelper.CreateWasherVisual(handBone, shader);
			Transform obj = CleaningModelHelper.FindDeepChild(val.transform, "Nozzle1");
			GameObject val2 = ((obj != null) ? ((Component)obj).gameObject : null);
			Transform obj2 = CleaningModelHelper.FindDeepChild(val.transform, "Nozzle2");
			GameObject val3 = ((obj2 != null) ? ((Component)obj2).gameObject : null);
			Transform obj3 = CleaningModelHelper.FindDeepChild(val.transform, "Nozzle3");
			GameObject val4 = ((obj3 != null) ? ((Component)obj3).gameObject : null);
			GameObject val5 = new GameObject("Spray");
			val5.transform.SetParent(val.transform, false);
			val5.transform.localPosition = new Vector3(0.14f, 0.04f, 0f);
			val5.transform.localRotation = Quaternion.Euler(0f, 90f, 0f);
			AudioSource obj4 = val5.AddComponent<AudioSource>();
			obj4.playOnAwake = false;
			obj4.loop = true;
			obj4.spatialBlend = 0f;
			obj4.volume = 0.75f;
			obj4.clip = CleaningAudioHelper.GetOrCreateClip("water", 1.5f, 220f, isLoop: true);
			ParticleSystem val6 = val5.AddComponent<ParticleSystem>();
			MainModule main = val6.main;
			((MainModule)(ref main)).playOnAwake = false;
			((MainModule)(ref main)).loop = true;
			((MainModule)(ref main)).startLifetime = MinMaxCurve.op_Implicit(0.5f);
			((MainModule)(ref main)).startSpeed = MinMaxCurve.op_Implicit(100f);
			((MainModule)(ref main)).startSize = MinMaxCurve.op_Implicit(0.09f);
			((MainModule)(ref main)).startColor = MinMaxGradient.op_Implicit(new Color(0.6f, 0.85f, 1f, 0.7f));
			((MainModule)(ref main)).simulationSpace = (ParticleSystemSimulationSpace)1;
			((MainModule)(ref main)).maxParticles = 1200;
			EmissionModule emission = val6.emission;
			((EmissionModule)(ref emission)).rateOverTime = MinMaxCurve.op_Implicit(1000f);
			ShapeModule shape = val6.shape;
			((ShapeModule)(ref shape)).shapeType = (ParticleSystemShapeType)4;
			((ShapeModule)(ref shape)).angle = 11f;
			((ShapeModule)(ref shape)).radius = 0.04f;
			CollisionModule collision = val6.collision;
			((CollisionModule)(ref collision)).enabled = true;
			((CollisionModule)(ref collision)).type = (ParticleSystemCollisionType)1;
			((CollisionModule)(ref collision)).sendCollisionMessages = true;
			((CollisionModule)(ref collision)).collidesWith = LayerMaskDefaults.Get((LMD)3);
			((CollisionModule)(ref collision)).bounce = MinMaxCurve.op_Implicit(0f);
			((CollisionModule)(ref collision)).lifetimeLoss = MinMaxCurve.op_Implicit(1f);
			ParticleSystemRenderer component = val5.GetComponent<ParticleSystemRenderer>();
			if ((Object)(object)component != (Object)null)
			{
				((Renderer)component).material = new Material(Shader.Find("Particles/Standard Unlit") ?? Shader.Find("Standard"));
				((Renderer)component).material.color = new Color(0.65f, 0.9f, 1f, 0.65f);
			}
			CorrectCameraView val7 = val5.AddComponent<CorrectCameraView>();
			val7.targetObject = val5.transform;
			val7.canModifyTarget = false;
			Washer val8 = val5.AddComponent<Washer>();
			val8.part = val6;
			val8.correctCameraView = val7;
			AudioClip orCreateClip = CleaningAudioHelper.GetOrCreateClip("click", 0.08f, 1200f, isLoop: false);
			AudioClip orCreateClip2 = CleaningAudioHelper.GetOrCreateClip("click", 0.1f, 900f, isLoop: false);
			AudioClip orCreateClip3 = CleaningAudioHelper.GetOrCreateClip("click", 0.1f, 750f, isLoop: false);
			fWasherClick?.SetValue(val8, orCreateClip);
			fWasherTriggerOn?.SetValue(val8, orCreateClip2);
			fWasherTriggerOff?.SetValue(val8, orCreateClip3);
			fWasherMusicStarted?.SetValue(val8, true);
			if ((Object)(object)val2 != (Object)null && (Object)(object)val3 != (Object)null && (Object)(object)val4 != (Object)null)
			{
				fWasherNozzles?.SetValue(val8, new GameObject[3] { val2, val3, val4 });
			}
		}

		public static void SetupVacuumWeapon(GameObject weaponObj, Transform handBone, Shader shader, bool isRepulsionVariation = false)
		{
			//IL_000d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0013: Expected O, but got Unknown
			//IL_003a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0059: Unknown result type (might be due to invalid IL or missing references)
			//IL_0068: Unknown result type (might be due to invalid IL or missing references)
			//IL_006e: Expected O, but got Unknown
			//IL_0095: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a9: Unknown result type (might be due to invalid IL or missing references)
			//IL_00bb: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f0: Unknown result type (might be due to invalid IL or missing references)
			//IL_0182: Unknown result type (might be due to invalid IL or missing references)
			//IL_0187: Unknown result type (might be due to invalid IL or missing references)
			//IL_0199: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ae: Unknown result type (might be due to invalid IL or missing references)
			//IL_01b8: Unknown result type (might be due to invalid IL or missing references)
			//IL_01c2: Unknown result type (might be due to invalid IL or missing references)
			//IL_01c7: 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_01f1: Unknown result type (might be due to invalid IL or missing references)
			//IL_0202: Unknown result type (might be due to invalid IL or missing references)
			//IL_0240: Unknown result type (might be due to invalid IL or missing references)
			//IL_0225: Unknown result type (might be due to invalid IL or missing references)
			//IL_0245: Unknown result type (might be due to invalid IL or missing references)
			//IL_0289: Unknown result type (might be due to invalid IL or missing references)
			//IL_028e: Unknown result type (might be due to invalid IL or missing references)
			//IL_02a0: Unknown result type (might be due to invalid IL or missing references)
			//IL_02b5: Unknown result type (might be due to invalid IL or missing references)
			//IL_02bf: Unknown result type (might be due to invalid IL or missing references)
			//IL_02c9: Unknown result type (might be due to invalid IL or missing references)
			//IL_02ce: Unknown result type (might be due to invalid IL or missing references)
			//IL_02e7: Unknown result type (might be due to invalid IL or missing references)
			//IL_02f8: Unknown result type (might be due to invalid IL or missing references)
			//IL_0309: Unknown result type (might be due to invalid IL or missing references)
			//IL_0347: Unknown result type (might be due to invalid IL or missing references)
			//IL_032c: Unknown result type (might be due to invalid IL or missing references)
			//IL_027a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0284: Expected O, but got Unknown
			//IL_034c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0381: Unknown result type (might be due to invalid IL or missing references)
			//IL_038b: Expected O, but got Unknown
			GameObject val = CleaningModelHelper.CreateVacuumVisual(handBone, shader);
			GameObject val2 = new GameObject("VacuumLogic");
			val2.transform.SetParent(val.transform, false);
			val2.transform.localPosition = new Vector3(0.18f, 0.04f, 0f);
			val2.transform.localRotation = Quaternion.Euler(0f, 90f, 0f);
			GameObject val3 = new GameObject("Succ Point");
			val3.transform.SetParent(val2.transform, false);
			val3.transform.localPosition = new Vector3(0f, 0f, 0.2f);
			GameObject val4 = new GameObject("Succ Zone");
			val4.transform.SetParent(val2.transform, false);
			val4.transform.localPosition = new Vector3(0f, 0f, 3.5f);
			BoxCollider val5 = val4.AddComponent<BoxCollider>();
			val5.size = new Vector3(3f, 3f, 7f);
			((Collider)val5).isTrigger = true;
			AudioSource val6 = val2.AddComponent<AudioSource>();
			val6.playOnAwake = false;
			val6.loop = false;
			val6.spatialBlend = 0f;
			val6.volume = 0.8f;
			AudioSource val7 = val2.AddComponent<AudioSource>();
			val7.playOnAwake = false;
			val7.loop = false;
			val7.spatialBlend = 0f;
			val7.volume = 0.85f;
			val7.clip = CleaningAudioHelper.GetOrCreateClip("splat", 0.3f, 300f, isLoop: false);
			GameObject val8 = new GameObject("SuckSystem");
			val8.transform.SetParent(val2.transform, false);
			val8.transform.localPosition = new Vector3(0f, 0f, 2f);
			ParticleSystem val9 = val8.AddComponent<ParticleSystem>();
			MainModule main = val9.main;
			((MainModule)(ref main)).playOnAwake = false;
			((MainModule)(ref main)).loop = true;
			((MainModule)(ref main)).startLifetime = MinMaxCurve.op_Implicit(0.3f);
			((MainModule)(ref main)).startSpeed = MinMaxCurve.op_Implicit(-15f);
			((MainModule)(ref main)).startSize = MinMaxCurve.op_Implicit(0.12f);
			((MainModule)(ref main)).startColor = MinMaxGradient.op_Implicit(isRepulsionVariation ? new Color(1f, 0.45f, 0.2f, 0.7f) : new Color(0.9f, 0.9f, 0.95f, 0.5f));
			ParticleSystemRenderer component = val8.GetComponent<ParticleSystemRenderer>();
			if ((Object)(object)component != (Object)null)
			{
				((Renderer)component).material = new Material(Shader.Find("Particles/Standard Unlit") ?? Shader.Find("Standard"));
			}
			GameObject val10 = new GameObject("BlowSystem");
			val10.transform.SetParent(val2.transform, false);
			val10.transform.localPosition = new Vector3(0f, 0f, 0.8f);
			ParticleSystem val11 = val10.AddComponent<ParticleSystem>();
			MainModule main2 = val11.main;
			((MainModule)(ref main2)).playOnAwake = false;
			((MainModule)(ref main2)).loop = true;
			((MainModule)(ref main2)).startLifetime = MinMaxCurve.op_Implicit(0.25f);
			((MainModule)(ref main2)).startSpeed = MinMaxCurve.op_Implicit(35f);
			((MainModule)(ref main2)).startSize = MinMaxCurve.op_Implicit(0.18f);
			((MainModule)(ref main2)).startColor = MinMaxGradient.op_Implicit(isRepulsionVariation ? new Color(1f, 0.35f, 0.15f, 0.85f) : new Color(0.85f, 0.95f, 1f, 0.6f));
			ParticleSystemRenderer component2 = val10.GetComponent<ParticleSystemRenderer>();
			if ((Object)(object)component2 != (Object)null)
			{
				((Renderer)component2).material = new Material(Shader.Find("Particles/Standard Unlit") ?? Shader.Find("Standard"));
			}
			Vacuum obj = val2.AddComponent<Vacuum>();
			AudioClip orCreateClip = CleaningAudioHelper.GetOrCreateClip("wind", 0.4f, 400f, isLoop: false);
			AudioClip orCreateClip2 = CleaningAudioHelper.GetOrCreateClip("wind", 1.5f, 350f, isLoop: true);
			AudioClip orCreateClip3 = CleaningAudioHelper.GetOrCreateClip("wind", 0.4f, 250f, isLoop: false);
			AudioClip orCreateClip4 = CleaningAudioHelper.GetOrCreateClip("splat", 0.3f, 500f, isLoop: false);
			AudioClip orCreateClip5 = CleaningAudioHelper.GetOrCreateClip("wind", 1.5f, 500f, isLoop: true);
			AudioClip orCreateClip6 = CleaningAudioHelper.GetOrCreateClip("whoosh", 0.3f, 450f, isLoop: false);
			AudioClip orCreateClip7 = CleaningAudioHelper.GetOrCreateClip("whoosh", 1.5f, 420f, isLoop: true);
			AudioClip orCreateClip8 = CleaningAudioHelper.GetOrCreateClip("whoosh", 0.3f, 300f, isLoop: false);
			fVacSuckPoint?.SetValue(obj, val3.transform);
			fVacSuckBox?.SetValue(obj, val5);
			fVacSuckSound?.SetValue(obj, val6);
			fVacConsumeSound?.SetValue(obj, val7);
			fVacSuckSystem?.SetValue(obj, val9);
			fVacBlowSystem?.SetValue(obj, val11);
			fVacSuckStart?.SetValue(obj, orCreateClip);
			fVacSuckLoop?.SetValue(obj, orCreateClip2);
			fVacSuckStop?.SetValue(obj, orCreateClip3);
			fVacSuckStuck?.SetValue(obj, orCreateClip4);
			fVacSuckStuckLoop?.SetValue(obj, orCreateClip5);
			fVacBlowStart?.SetValue(obj, orCreateClip6);
			fVacBlowLoop?.SetValue(obj, orCreateClip7);
			fVacBlowStop?.SetValue(obj, orCreateClip8);
			fVacMusicStarted?.SetValue(obj, true);
		}
	}
	public class CoinFlightTracker : MonoBehaviour
	{
		public float spawnTime;

		public float FlightTime => Time.time - spawnTime;

		private void Awake()
		{
			spawnTime = Time.time;
		}
	}
	public class CoinRider : MonoBehaviour
	{
		private NewMovement nm;

		private CameraController cc;

		private float mountCooldown;

		private Coin lastRiddenCoin;

		private float lastDismountTime = -10f;

		public const float MountRadius = 1.8f;

		public static CoinRider Instance { get; private set; }

		public Coin CurrentCoin { get; private set; }

		public bool IsRiding => (Object)(object)CurrentCoin != (Object)null;

		private void Awake()
		{
			Instance = this;
			nm = ((Component)this).GetComponent<NewMovement>();
			if ((Object)(object)nm != (Object)null)
			{
				cc = nm.cc;
			}
		}

		private void Update()
		{
			//IL_003b: Unknown result type (might be due to invalid IL or missing references)
			//IL_02e2: Unknown result type (might be due to invalid IL or missing references)
			//IL_02d0: Unknown result type (might be due to invalid IL or missing references)
			//IL_034d: Unknown result type (might be due to invalid IL or missing references)
			//IL_033b: Unknown result type (might be due to invalid IL or missing references)
			//IL_02e7: Unknown result type (might be due to invalid IL or missing references)
			//IL_02f1: Unknown result type (might be due to invalid IL or missing references)
			//IL_02f6: Unknown result type (might be due to invalid IL or missing references)
			//IL_0306: Unknown result type (might be due to invalid IL or missing references)
			//IL_0310: Unknown result type (might be due to invalid IL or missing references)
			//IL_0315: Unknown result type (might be due to invalid IL or missing references)
			//IL_031a: Unknown result type (might be due to invalid IL or missing references)
			//IL_031d: Unknown result type (might be due to invalid IL or missing references)
			//IL_035d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0367: Unknown result type (might be due to invalid IL or missing references)
			//IL_036c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0371: Unknown result type (might be due to invalid IL or missing references)
			//IL_0374: Unknown result type (might be due to invalid IL or missing references)
			//IL_025e: Unknown result type (might be due to invalid IL or missing references)
			//IL_024c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0270: 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_0208: Unknown result type (might be due to invalid IL or missing references)
			//IL_01b5: Unknown result type (might be due to invalid IL or missing references)
			//IL_0275: Unknown result type (might be due to invalid IL or missing references)
			//IL_0278: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ba: Unknown result type (might be due to invalid IL or missing references)
			//IL_01bd: Unknown result type (might be due to invalid IL or missing references)
			//IL_01a3: Unknown result type (might be due to invalid IL or missing references)
			//IL_0191: Unknown result type (might be due to invalid IL or missing references)
			if (mountCooldown > 0f)
			{
				mountCooldown -= Time.deltaTime;
			}
			if (PluginConfig.CoinRiding == null || !PluginConfig.CoinRiding.value)
			{
				if (IsRiding)
				{
					Dismount(Vector3.zero);
				}
			}
			else
			{
				if ((Object)(object)nm == (Object)null)
				{
					return;
				}
				if ((Object)(object)nm.ridingRocket == (Object)null)
				{
					if ((Object)(object)nm.gc != (Object)null && nm.gc.forcedOff > 0)
					{
						for (int i = 0; i < 10; i++)
						{
							if (nm.gc.forcedOff <= 0)
							{
								break;
							}
							nm.gc.StopForceOff();
						}
					}
					if ((Object)(object)nm.slopeCheck != (Object)null && nm.slopeCheck.forcedOff > 0)
					{
						for (int j = 0; j < 10; j++)
						{
							if (nm.slopeCheck.forcedOff <= 0)
							{
								break;
							}
							nm.slopeCheck.StopForceOff();
						}
					}
				}
				if (IsRiding)
				{
					if ((Object)(object)CurrentCoin != (Object)null && (CurrentCoin.shot || CurrentCoin.shotByEnemy))
					{
						RiddenCoinExplosion component = ((Component)CurrentCoin).GetComponent<RiddenCoinExplosion>();
						if ((Object)(object)component != (Object)null)
						{
							component.Disarm();
						}
						Vector3 exitVelocity = (((Object)(object)CurrentCoin.rb != (Object)null) ? CurrentCoin.rb.velocity : (((Object)(object)nm.rb != (Object)null) ? nm.rb.velocity : Vector3.zero));
						Dismount(exitVelocity);
						return;
					}
					if (!((Object)(object)CurrentCoin == (Object)null) && ((Component)CurrentCoin).gameObject.activeInHierarchy && !((Object)(object)CurrentCoin.rb == (Object)null))
					{
						Vector3 velocity = CurrentCoin.rb.velocity;
						if (!(((Vector3)(ref velocity)).sqrMagnitude < 2f))
						{
							bool flag = false;
							bool flag2 = false;
							try
							{
								InputManager instance = MonoSingleton<InputManager>.Instance;
								PlayerInput val = ((instance != null) ? instance.InputSource : null);
								if (val != null)
								{
									flag = val.Jump.WasPerformedThisFrame;
									flag2 = val.Slide.WasPerformedThisFrame;
								}
							}
							catch
							{
							}
							if (flag)
							{
								Vector3 exitVelocity2 = (((Object)(object)CurrentCoin.rb != (Object)null) ? CurrentCoin.rb.velocity : Vector3.zero) + Vector3.up * 18f + ((Component)nm).transform.forward * 8f;
								Dismount(exitVelocity2);
							}
							else if (flag2)
							{
								Vector3 exitVelocity3 = (((Object)(object)CurrentCoin.rb != (Object)null) ? CurrentCoin.rb.velocity : Vector3.zero) + ((Component)nm).transform.forward * 14f;
								Dismount(exitVelocity3);
							}
							return;
						}
					}
					Vector3 exitVelocity4 = (((Object)(object)CurrentCoin != (Object)null && (Object)(object)CurrentCoin.rb != (Object)null) ? CurrentCoin.rb.velocity : (((Object)(object)nm.rb != (Object)null) ? nm.rb.velocity : Vector3.zero));
					Dismount(exitVelocity4);
				}
				else if (mountCooldown <= 0f)
				{
					CheckProximityMount();
				}
			}
		}

		private void LateUpdate()
		{
			//IL_0058: 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_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_0087: 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_00b7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d3: Unknown result type (might be due to invalid IL or missing references)
			if (!IsRiding || (Object)(object)CurrentCoin == (Object)null || (Object)(object)nm == (Object)null)
			{
				return;
			}
			if (CurrentCoin.shot || !((Component)CurrentCoin).gameObject.activeInHierarchy || (Object)(object)CurrentCoin.rb == (Object)null)
			{
				Dismount(Vector3.zero);
				return;
			}
			Vector3 position = ((Component)CurrentCoin).transform.position + Vector3.up * 1.15f;
			((Component)nm).transform.position = position;
			if ((Object)(object)nm.rb != (Object)null)
			{
				nm.rb.position = position;
				nm.rb.velocity = CurrentCoin.rb.velocity;
			}
		}

		private void CheckProximityMount()
		{
			//IL_0023: Unknown result type (might be due to invalid IL or missing references)
			//IL_0028: Unknown result type (might be due to invalid IL or missing references)
			//IL_0032: Unknown result type (might be due to invalid IL or missing references)
			//IL_0037: Unknown result type (might be due to invalid IL or missing references)
			//IL_003c: 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_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_0138: Unknown result type (might be due to invalid IL or missing references)
			//IL_0139: Unknown result type (might be due to invalid IL or missing references)
			//IL_0140: Unknown result type (might be due to invalid IL or missing references)
			//IL_0146: Unknown result type (might be due to invalid IL or missing references)
			//IL_014c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0151: Unknown result type (might be due to invalid IL or missing references)
			//IL_0158: Unknown result type (might be due to invalid IL or missing references)
			//IL_015f: Unknown result type (might be due to invalid IL or missing references)
			//IL_016b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0172: Unknown result type (might be due to invalid IL or missing references)
			CoinTracker instance = MonoSingleton<CoinTracker>.Instance;
			if ((Object)(object)instance == (Object)null || instance.revolverCoinsList == null)
			{
				return;
			}
			Vector3 val = ((Component)nm).transform.position + Vector3.up * 1.1f;
			foreach (Coin revolverCoins in instance.revolverCoinsList)
			{
				if ((Object)(object)revolverCoins == (Object)null || revolverCoins.shot || !((Component)revolverCoins).gameObject.activeInHierarchy || (Object)(obj