Decompiled source of FullCleaning v1.0.2

FullCleaningReal.dll

Decompiled 8 months ago
using System.Diagnostics;
using System.IO;
using System.Reflection;
using System.Resources;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using BepInEx;
using HarmonyLib;
using UnityEngine;
using UnityEngine.AddressableAssets;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: AssemblyTitle("ThundergunRevised")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("ThundergunRevised")]
[assembly: AssemblyCopyright("Copyright ©  2024")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("5711e2a0-d5a7-4ddf-b8d4-00f355fe9397")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: NeutralResourcesLanguage("en-FI")]
[assembly: TargetFramework(".NETFramework,Version=v4.7.2", FrameworkDisplayName = ".NET Framework 4.7.2")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.0.0")]
[module: UnverifiableCode]
namespace FullCleaningReal;

internal class PatchIdentifier : MonoBehaviour
{
	public bool isBloodStain = false;

	public bool isDestroyed = false;

	private Transform obj;

	private void Start()
	{
		if (isBloodStain)
		{
			obj = ((Component)this).transform.GetChild(0);
		}
	}

	private void Update()
	{
		//IL_0012: Unknown result type (might be due to invalid IL or missing references)
		if (isBloodStain && obj.localScale.x < 0f)
		{
			Object.Destroy((Object)(object)((Component)this).gameObject);
		}
	}

	private void FixedUpdate()
	{
		if (isDestroyed)
		{
			DecreaseScale();
		}
	}

	public void DecreaseScale()
	{
		//IL_000c: Unknown result type (might be due to invalid IL or missing references)
		//IL_0011: Unknown result type (might be due to invalid IL or missing references)
		//IL_0036: Unknown result type (might be due to invalid IL or missing references)
		//IL_0062: Unknown result type (might be due to invalid IL or missing references)
		//IL_0067: Unknown result type (might be due to invalid IL or missing references)
		Vector3 localScale = obj.localScale;
		float num = 1f - Mathf.Clamp(((Vector3)(ref localScale)).magnitude, 0f, 1f);
		obj.localScale -= new Vector3(0.075f + num / 10f, 0.075f + num / 10f, 0.075f + num / 10f);
	}
}
[BepInPlugin("plonk.fullClean", "Full Cleaning", "1.0.0")]
public class WeaponMakerScript : BaseUnityPlugin
{
	public enum GunType
	{
		Pierce = 1,
		Marksman,
		Sharpshooter
	}

	[HarmonyPatch]
	public class Patches
	{
		[HarmonyPrefix]
		[HarmonyPatch(typeof(Vacuum), "SuckObjects")]
		public static bool SuckObjectsFix(Vacuum __instance)
		{
			//IL_0127: Unknown result type (might be due to invalid IL or missing references)
			//IL_012e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0133: Unknown result type (might be due to invalid IL or missing references)
			//IL_0138: Unknown result type (might be due to invalid IL or missing references)
			//IL_013c: 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_015d: 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_0163: 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_01ba: Unknown result type (might be due to invalid IL or missing references)
			//IL_01be: Unknown result type (might be due to invalid IL or missing references)
			//IL_01c9: Unknown result type (might be due to invalid IL or missing references)
			//IL_01d3: Unknown result type (might be due to invalid IL or missing references)
			//IL_017e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0185: Unknown result type (might be due to invalid IL or missing references)
			//IL_018a: Unknown result type (might be due to invalid IL or missing references)
			//IL_018f: 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_01e9: Unknown result type (might be due to invalid IL or missing references)
			//IL_01f4: 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)
			if (Object.op_Implicit((Object)(object)((Component)__instance).GetComponentInParent<PatchIdentifier>()))
			{
				if ((!__instance._isSucking && !__instance._isBlowing) || (Object)(object)__instance._stuckObject.rigidbody != (Object)null)
				{
					return false;
				}
				__instance.UpdateColliders();
				int i = __instance._colliders.Offset;
				NewMovement val2 = default(NewMovement);
				Cork val3 = default(Cork);
				TerribleTasteBook val4 = default(TerribleTasteBook);
				GoreSplatter val7 = default(GoreSplatter);
				for (int num = i + __instance._colliders.Count; i < num; i++)
				{
					Collider val = __instance._colliders.Array[i];
					if ((Object)(object)val == (Object)null || (Object)(object)val.attachedRigidbody == (Object)null || ((Component)val.attachedRigidbody).TryGetComponent<NewMovement>(ref val2))
					{
						continue;
					}
					Rigidbody attachedRigidbody = val.attachedRigidbody;
					if (__instance._isSucking && ((Component)attachedRigidbody).TryGetComponent<Cork>(ref val3))
					{
						val3.StartWiggle();
					}
					if (__instance._isSucking && ((Component)val).TryGetComponent<TerribleTasteBook>(ref val4))
					{
						val4.ActivateBookShelf();
					}
					GhostDrone val5 = null;
					if (__instance._isSucking && ((Component)attachedRigidbody).TryGetComponent<GhostDrone>(ref val5))
					{
						Vector3 val6 = __instance._suckPoint.position - attachedRigidbody.position;
						Vector3 vacuumVelocity = ((Vector3)(ref val6)).normalized * Mathf.Max(1f / ((Vector3)(ref val6)).sqrMagnitude, 2f);
						val5.vacuumVelocity = vacuumVelocity;
					}
					if (__instance._isSucking)
					{
						attachedRigidbody.velocity = Vector3.Normalize(__instance._suckPoint.position - attachedRigidbody.worldCenterOfMass) * __instance._suckStrength;
					}
					else
					{
						Vector3 forward = ((Component)MonoSingleton<CameraController>.Instance).transform.forward;
						attachedRigidbody.velocity = ((Vector3)(ref forward)).normalized * __instance._suckStrength * 2f;
					}
					if (__instance._isBlowing || !(Vector3.Distance(attachedRigidbody.worldCenterOfMass, __instance._suckPoint.position) < __instance._stuckDistance))
					{
						continue;
					}
					if (!((Component)attachedRigidbody).TryGetComponent<GoreSplatter>(ref val7))
					{
						if (!Object.op_Implicit((Object)(object)val5))
						{
							bool flag = false;
							EnemyIdentifier val8 = null;
							if (!((Component)attachedRigidbody).TryGetComponent<EnemyIdentifier>(ref val8) && !attachedRigidbody.isKinematic)
							{
								if ((Object)(object)((Component)attachedRigidbody).GetComponentInParent<Streetcleaner>() == (Object)null)
								{
									if ((Object)(object)((Component)attachedRigidbody).GetComponentInParent<Mannequin>() == (Object)null && (Object)(object)((Component)attachedRigidbody).GetComponentInParent<Guttertank>() == (Object)null && (Object)(object)((Component)attachedRigidbody).GetComponentInParent<Sisyphus>() == (Object)null && (Object)(object)((Component)attachedRigidbody).GetComponent<ItemIdentifier>() == (Object)null)
									{
										Object.Destroy((Object)(object)((Component)attachedRigidbody).gameObject);
										if (((Object)(object)((Component)attachedRigidbody).GetComponent<Landmine>() != (Object)null) | ((Object)(object)((Component)attachedRigidbody).GetComponent<Projectile>() != (Object)null) | ((Object)(object)((Component)attachedRigidbody).GetComponent<Grenade>() != (Object)null))
										{
											MonoSingleton<StyleHUD>.Instance.AddPoints(50, "<color=orange>FWOOP</color>", (GameObject)null, (EnemyIdentifier)null, 1, "", "");
										}
									}
									else
									{
										flag = true;
									}
								}
								else
								{
									Object.Destroy((Object)(object)((Component)attachedRigidbody).GetComponent<Joint>());
									((Component)attachedRigidbody).transform.localScale = Vector3.zero;
									Object.Destroy((Object)(object)attachedRigidbody);
									Object.Destroy((Object)(object)((Component)attachedRigidbody).GetComponent<Light>());
									Object.Destroy((Object)(object)((Component)attachedRigidbody).GetComponentInParent<Light>());
									Object.Destroy((Object)(object)((Component)attachedRigidbody).GetComponentInChildren<Light>());
								}
								if (!flag)
								{
									__instance._consumeSound.pitch = Random.Range(0.9f, 1.1f);
									__instance._consumeSound.PlayOneShot(__instance._consumeSound.clip);
								}
								return false;
							}
						}
						val5.KillGhost();
						continue;
					}
					if (!__instance.musicStarted)
					{
						if (Object.op_Implicit((Object)(object)__instance.music))
						{
							__instance.music.SetActive(true);
						}
						__instance.musicStarted = true;
					}
					__instance._consumeSound.pitch = Random.Range(0.9f, 1.1f);
					__instance._consumeSound.PlayOneShot(__instance._consumeSound.clip);
					val7.Repool();
				}
				return false;
			}
			return true;
		}

		[HarmonyPrefix]
		[HarmonyPatch(typeof(Washer), "OnParticleCollision")]
		public static bool WasherFix(Washer __instance, GameObject other)
		{
			//IL_00bb: Unknown result type (might be due to invalid IL or missing references)
			//IL_00fb: Unknown result type (might be due to invalid IL or missing references)
			//IL_01af: Unknown result type (might be due to invalid IL or missing references)
			//IL_01b4: Unknown result type (might be due to invalid IL or missing references)
			//IL_01d1: Unknown result type (might be due to invalid IL or missing references)
			//IL_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_0256: Unknown result type (might be due to invalid IL or missing references)
			if (SceneHelper.CurrentScene != "Level 7-S" && Object.op_Implicit((Object)(object)((Component)__instance).GetComponentInParent<PatchIdentifier>()))
			{
				__instance.correctCameraView.LateUpdate();
				GameObject gameObject = other.gameObject;
				PatchIdentifier patchIdentifier = null;
				if (gameObject.TryGetComponent<PatchIdentifier>(ref patchIdentifier) && patchIdentifier.isBloodStain)
				{
					patchIdentifier.isDestroyed = true;
					((Component)patchIdentifier).GetComponent<Collider>().enabled = false;
				}
				EnemyIdentifierIdentifier val = default(EnemyIdentifierIdentifier);
				EnemyIdentifier eid = default(EnemyIdentifier);
				if (gameObject.TryGetComponent<EnemyIdentifierIdentifier>(ref val))
				{
					eid = val.eid;
				}
				if (gameObject.layer == 12 && (gameObject.TryGetComponent<EnemyIdentifier>(ref eid) || (Object)(object)eid != (Object)null) && !eid.dead)
				{
					if (CheckForMachine(eid.enemyType))
					{
						eid.AfterShock();
						eid.InstaKill();
						MonoSingleton<StyleHUD>.Instance.AddPoints(50, "<color=orange>SHORT CIRCUIT</color>", (GameObject)null, eid, 1, "", "");
					}
					if (CheckForDemon(eid.enemyType))
					{
						Flammable[] componentsInChildren = gameObject.GetComponentsInChildren<Flammable>();
						foreach (Flammable val2 in componentsInChildren)
						{
							val2.Burn(1f, false);
						}
					}
				}
				Flammable val3 = null;
				if (gameObject.TryGetComponent<Flammable>(ref val3))
				{
					val3.PutOut(false);
				}
				BloodAbsorber val4 = default(BloodAbsorber);
				BloodAbsorberChild val5 = default(BloodAbsorberChild);
				if (other.TryGetComponent<BloodAbsorber>(ref val4))
				{
					if (!__instance.musicStarted)
					{
						if (Object.op_Implicit((Object)(object)__instance.music))
						{
							__instance.music.SetActive(true);
						}
						__instance.musicStarted = true;
					}
					Vector3 position = ((Component)__instance.part).transform.position;
					ParticlePhysicsExtensions.GetCollisionEvents(__instance.part, other, __instance.collisionEvents);
					val4.ProcessWasherSpray(ref __instance.collisionEvents, position);
				}
				else if (other.TryGetComponent<BloodAbsorberChild>(ref val5))
				{
					if (!__instance.musicStarted)
					{
						if (Object.op_Implicit((Object)(object)__instance.music))
						{
							__instance.music.SetActive(true);
						}
						__instance.musicStarted = true;
					}
					Vector3 position2 = ((Component)__instance.part).transform.position;
					ParticlePhysicsExtensions.GetCollisionEvents(__instance.part, other, __instance.collisionEvents);
					val5.ProcessWasherSpray(ref __instance.collisionEvents, position2);
					SpinFromForce val6 = default(SpinFromForce);
					if (other.TryGetComponent<SpinFromForce>(ref val6))
					{
						val6.AddSpin(ref __instance.collisionEvents);
					}
				}
				return false;
			}
			return true;
		}

		[HarmonyPrefix]
		[HarmonyPatch(typeof(CorrectCameraView), "LateUpdate")]
		public static bool CameraFix(CorrectCameraView __instance)
		{
			//IL_0021: Unknown result type (might be due to invalid IL or missing references)
			//IL_0058: Unknown result type (might be due to invalid IL or missing references)
			//IL_005d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0062: Unknown result type (might be due to invalid IL or missing references)
			//IL_0069: Unknown result type (might be due to invalid IL or missing references)
			//IL_006a: Unknown result type (might be due to invalid IL or missing references)
			//IL_006f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0076: Unknown result type (might be due to invalid IL or missing references)
			if (Object.op_Implicit((Object)(object)((Component)__instance).GetComponentInParent<PatchIdentifier>()))
			{
				__instance.targetObject.rotation = ((Component)MonoSingleton<CameraController>.instance).transform.rotation;
				__instance.mainCam = MonoSingleton<CameraController>.Instance.cam;
				__instance.hudCam = MonoSingleton<PostProcessV2_Handler>.Instance.hudCam;
				Vector3 val = __instance.hudCam.WorldToScreenPoint(((Component)__instance).transform.position);
				val = __instance.mainCam.ScreenToWorldPoint(val);
				__instance.targetObject.position = val;
				return false;
			}
			return true;
		}

		[HarmonyPrefix]
		[HarmonyPatch(typeof(CorrectCameraView), "OnPostRenderCallback")]
		public static bool CameraFix1(CorrectCameraView __instance)
		{
			if (Object.op_Implicit((Object)(object)((Component)__instance).GetComponentInParent<PatchIdentifier>()))
			{
				return false;
			}
			return true;
		}

		[HarmonyPrefix]
		[HarmonyPatch(typeof(Washer), "SwitchNozzle")]
		public static bool FixWasherChangeNozzle(Washer __instance)
		{
			//IL_0099: Unknown result type (might be due to invalid IL or missing references)
			//IL_009e: Unknown result type (might be due to invalid IL or missing references)
			//IL_00aa: Unknown result type (might be due to invalid IL or missing references)
			//IL_00af: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ba: Unknown result type (might be due to invalid IL or missing references)
			//IL_00bf: Unknown result type (might be due to invalid IL or missing references)
			//IL_00de: 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_0106: Unknown result type (might be due to invalid IL or missing references)
			//IL_0137: Unknown result type (might be due to invalid IL or missing references)
			//IL_0157: Unknown result type (might be due to invalid IL or missing references)
			//IL_0181: Unknown result type (might be due to invalid IL or missing references)
			//IL_0197: Unknown result type (might be due to invalid IL or missing references)
			//IL_01a9: 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_01fa: Unknown result type (might be due to invalid IL or missing references)
			//IL_0221: Unknown result type (might be due to invalid IL or missing references)
			//IL_0237: 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_026b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0292: Unknown result type (might be due to invalid IL or missing references)
			//IL_02a8: Unknown result type (might be due to invalid IL or missing references)
			//IL_02ba: 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)
			if (Object.op_Implicit((Object)(object)((Component)__instance).GetComponentInParent<PatchIdentifier>()))
			{
				__instance.aud.pitch = Random.Range(0.9f, 1.1f);
				__instance.aud.PlayOneShot(__instance.click);
				__instance.nozzleMode = (__instance.nozzleMode + 1) % 4;
				Debug.Log((object)__instance.nozzleMode);
				for (int i = 0; i < __instance.nozzles.Length; i++)
				{
					__instance.nozzles[i].SetActive(i == __instance.nozzleMode);
				}
				__instance.shapeModule = __instance.part.shape;
				__instance.mainModule = __instance.part.main;
				EmissionModule emission = __instance.part.emission;
				if (__instance.nozzleMode == 0)
				{
					((MainModule)(ref __instance.mainModule)).startLifetime = MinMaxCurve.op_Implicit(0.5f);
					((MainModule)(ref __instance.mainModule)).startSpeed = MinMaxCurve.op_Implicit(100f);
					((EmissionModule)(ref emission)).rateOverTime = MinMaxCurve.op_Implicit(1000f);
					((ShapeModule)(ref __instance.shapeModule)).angle = 11f;
					((ShapeModule)(ref __instance.shapeModule)).rotation = new Vector3(0f, 0f, 0f);
					((ShapeModule)(ref __instance.shapeModule)).scale = new Vector3(0.1f, 1f, 1f);
				}
				if (__instance.nozzleMode == 1)
				{
					((MainModule)(ref __instance.mainModule)).startLifetime = MinMaxCurve.op_Implicit(0.5f);
					((MainModule)(ref __instance.mainModule)).startSpeed = MinMaxCurve.op_Implicit(100f);
					((EmissionModule)(ref emission)).rateOverTime = MinMaxCurve.op_Implicit(1000f);
					((ShapeModule)(ref __instance.shapeModule)).angle = 11f;
					((ShapeModule)(ref __instance.shapeModule)).rotation = new Vector3(0f, 0f, 90f);
					((ShapeModule)(ref __instance.shapeModule)).scale = new Vector3(0.1f, 1f, 1f);
				}
				if (__instance.nozzleMode == 2)
				{
					((MainModule)(ref __instance.mainModule)).startLifetime = MinMaxCurve.op_Implicit(1.2f);
					((MainModule)(ref __instance.mainModule)).startSpeed = MinMaxCurve.op_Implicit(100f);
					((EmissionModule)(ref emission)).rateOverTime = MinMaxCurve.op_Implicit(700f);
					((ShapeModule)(ref __instance.shapeModule)).angle = 0.75f;
					((ShapeModule)(ref __instance.shapeModule)).scale = Vector3.one;
				}
				if (__instance.nozzleMode == 3)
				{
					((MainModule)(ref __instance.mainModule)).startLifetime = MinMaxCurve.op_Implicit(0.5f);
					((MainModule)(ref __instance.mainModule)).startSpeed = MinMaxCurve.op_Implicit(100f);
					((EmissionModule)(ref emission)).rateOverTime = MinMaxCurve.op_Implicit(850f);
					((ShapeModule)(ref __instance.shapeModule)).angle = 15f;
					((ShapeModule)(ref __instance.shapeModule)).scale = Vector3.one;
				}
				return false;
			}
			return true;
		}

		[HarmonyPrefix]
		[HarmonyPatch(typeof(Bloodsplatter), "CreateBloodstain")]
		public static bool BSObject(Bloodsplatter __instance, ref RaycastHit hit, BloodsplatterManager bsman)
		{
			//IL_0062: Unknown result type (might be due to invalid IL or missing references)
			//IL_0067: Unknown result type (might be due to invalid IL or missing references)
			//IL_0092: 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_017e: 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_01b0: 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_01b9: Unknown result type (might be due to invalid IL or missing references)
			//IL_01be: 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_02a7: Unknown result type (might be due to invalid IL or missing references)
			//IL_02ac: 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_0252: Unknown result type (might be due to invalid IL or missing references)
			//IL_0257: Unknown result type (might be due to invalid IL or missing references)
			//IL_0233: 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)
			__instance.bsm = bsman;
			if (SceneHelper.CurrentScene != "Endless")
			{
				__instance.bsm = bsman;
				Collider collider = ((RaycastHit)(ref hit)).collider;
				if ((Object)(object)collider == (Object)null)
				{
					return false;
				}
				Rigidbody rigidbody = ((RaycastHit)(ref hit)).rigidbody;
				GameObject val = (Object.op_Implicit((Object)(object)rigidbody) ? ((Component)rigidbody).gameObject : ((Component)collider).gameObject);
				Vector3 point = ((RaycastHit)(ref hit)).point;
				IBloodstainReceiver val2 = default(IBloodstainReceiver);
				if (((MapInfoBase)StockMapInfo.Instance).continuousGibCollisions && val.TryGetComponent<IBloodstainReceiver>(ref val2) && val2.HandleBloodstainHit(ref hit))
				{
					__instance.PlayBloodSound(point);
					return false;
				}
				if (__instance.ready && __instance.hpOnParticleCollision && val.CompareTag("Player"))
				{
					MonoSingleton<NewMovement>.Instance.GetHealth(3, false, __instance.fromExplosion);
					return false;
				}
				Transform transform = val.transform;
				float bloodstainChance = __instance.bsm.GetBloodstainChance();
				bloodstainChance = (__instance.halfChance ? (bloodstainChance / 2f) : bloodstainChance);
				if ((float)Random.Range(0, 100) < bloodstainChance && (val.CompareTag("Wall") || val.CompareTag("Floor") || val.CompareTag("Moving") || ((val.CompareTag("Glass") || val.CompareTag("GlassFloor")) && transform.childCount > 0)))
				{
					Vector3 normal = ((RaycastHit)(ref hit)).normal;
					if (!Object.op_Implicit((Object)(object)__instance.gz))
					{
						__instance.gz = GoreZone.ResolveGoreZone(((Component)__instance).transform);
					}
					__instance.PlayBloodSound(point);
					Vector3 v = point + normal * 0.2f;
					if (val.CompareTag("Moving") || (Object.op_Implicit((Object)(object)__instance.cdatabase) && __instance.cdatabase.scrollers.Contains(transform)))
					{
						ScrollingTexture val3 = default(ScrollingTexture);
						if (Object.op_Implicit((Object)(object)__instance.cdatabase) && __instance.cdatabase.scrollers.Contains(transform) && ((Component)transform).TryGetComponent<ScrollingTexture>(ref val3))
						{
							CreateBloodstain(hit, v, ((Component)val3).transform.parent);
							return false;
						}
						CreateBloodstain(hit, v, val.transform);
						return false;
					}
					if (val.CompareTag("Glass") || val.CompareTag("GlassFloor"))
					{
						CreateBloodstain(hit, v, val.transform);
						return false;
					}
					CreateBloodstain(hit, v, null);
				}
				return false;
			}
			return true;
		}
	}

	public static GameObject bluetc;

	public static GameObject greentc;

	public static GameObject stain;

	public static AssetBundle tcbundle;

	private static bool candoshit;

	private static bool canswitchstate = true;

	public static void SendHudMessage(string msg, int delay, bool silent)
	{
		MonoSingleton<HudMessageReceiver>.Instance.SendHudMessage(msg, "", "", delay, silent);
	}

	public static Type Fetch<Type>(string name)
	{
		//IL_0002: Unknown result type (might be due to invalid IL or missing references)
		//IL_0007: Unknown result type (might be due to invalid IL or missing references)
		return Addressables.LoadAssetAsync<Type>((object)name).WaitForCompletion();
	}

	public static Type FetchFromBundle<Type>(string name, bool autofill = false) where Type : Object
	{
		if (!autofill)
		{
			return tcbundle.LoadAsset<Type>(name);
		}
		return tcbundle.LoadAsset<Type>("assets/formods/fullcleaning/" + name);
	}

	public static void SetLayerRecursive(GameObject gobject, string layername)
	{
		//IL_0023: Unknown result type (might be due to invalid IL or missing references)
		//IL_0029: Expected O, but got Unknown
		gobject.layer = LayerMask.NameToLayer(layername);
		foreach (Transform item in gobject.transform)
		{
			Transform val = item;
			((Component)val).gameObject.layer = LayerMask.NameToLayer(layername);
			Transform componentInChildren = ((Component)val).GetComponentInChildren<Transform>();
			if ((Object)(object)componentInChildren != (Object)null)
			{
				SetLayerRecursive(((Component)val).gameObject, layername);
			}
		}
	}

	public Vector3 Shake(Vector3 originpos, Vector3 pos, float shakeamt)
	{
		//IL_0001: Unknown result type (might be due to invalid IL or missing references)
		//IL_0006: Unknown result type (might be due to invalid IL or missing references)
		//IL_0007: Unknown result type (might be due to invalid IL or missing references)
		//IL_0020: Unknown result type (might be due to invalid IL or missing references)
		//IL_0025: Unknown result type (might be due to invalid IL or missing references)
		//IL_002a: Unknown result type (might be due to invalid IL or missing references)
		//IL_002d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0033: Unknown result type (might be due to invalid IL or missing references)
		//IL_003f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0050: Unknown result type (might be due to invalid IL or missing references)
		//IL_0056: Unknown result type (might be due to invalid IL or missing references)
		//IL_0062: Unknown result type (might be due to invalid IL or missing references)
		//IL_0073: Unknown result type (might be due to invalid IL or missing references)
		//IL_0079: Unknown result type (might be due to invalid IL or missing references)
		//IL_0085: Unknown result type (might be due to invalid IL or missing references)
		//IL_009b: Unknown result type (might be due to invalid IL or missing references)
		//IL_009c: Unknown result type (might be due to invalid IL or missing references)
		//IL_009f: Unknown result type (might be due to invalid IL or missing references)
		Vector3 val = Vector3.zero;
		val = pos + new Vector3(Random.Range(0f - shakeamt, shakeamt), Random.Range(0f - shakeamt, shakeamt), Random.Range(0f - shakeamt, shakeamt));
		((Vector3)(ref val))..ctor(Mathf.Clamp(val.x, originpos.x - 0.01f, originpos.x + 0.01f), Mathf.Clamp(val.y, originpos.y - 0.01f, originpos.y + 0.01f), Mathf.Clamp(val.z, originpos.z - 0.01f, originpos.z + 0.01f));
		return val;
	}

	public static void Log(string log, int type = 1)
	{
		switch (type)
		{
		case 1:
			Debug.Log((object)log);
			break;
		case 2:
			Debug.LogWarning((object)log);
			break;
		case 3:
			Debug.LogError((object)log);
			break;
		}
	}

	public void Awake()
	{
		((Object)((Component)this).gameObject).hideFlags = (HideFlags)61;
		if ((Object)(object)tcbundle == (Object)null)
		{
			string directoryName = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location);
			tcbundle = AssetBundle.LoadFromFile(Path.Combine(directoryName, "fullcleaning"));
			Log("Got bundle " + (object)tcbundle);
			for (int i = 0; i < tcbundle.GetAllAssetNames().Length; i++)
			{
				Log(tcbundle.GetAllAssetNames()[i].ToString());
			}
		}
		Log("kaboom (fullclean loaded)");
	}

	public static void ResetRevolver()
	{
	}

	public void Start()
	{
		//IL_0006: Unknown result type (might be due to invalid IL or missing references)
		//IL_000c: Expected O, but got Unknown
		Harmony val = new Harmony("plonk.fullclean");
		val.PatchAll();
	}

	public void Update()
	{
		if (!candoshit && SceneHelper.CurrentScene == "Main Menu")
		{
			if ((Object)(object)tcbundle != (Object)null)
			{
				candoshit = true;
			}
			else
			{
				SendHudMessage("FullClean mod failed to load.\r\n<color=green>The asset bundle (filename \"fullcleaning\") is missing or in the wrong place. please place it where the mod's .dll is located.</color>", 0, silent: true);
			}
		}
		if (!candoshit || !(SceneHelper.CurrentScene != "Main Menu"))
		{
			return;
		}
		if ((Object)(object)stain == (Object)null)
		{
			stain = WeaponMakerScript.FetchFromBundle<GameObject>("bloodstain.prefab", autofill: true);
		}
		if (SceneHelper.CurrentScene != "Level 7-S" && SceneHelper.CurrentScene != "Endless")
		{
			if ((Object)(object)bluetc == (Object)null)
			{
				bluetc = MakeGun(1);
			}
			if ((Object)(object)greentc == (Object)null)
			{
				greentc = MakeGun(2);
			}
		}
		if (SceneHelper.CurrentScene == "Level 7-S")
		{
			if ((Object)(object)GameObject.Find("FakeExit/WasherPickup") != (Object)null && (Object)(object)GameObject.Find("FakeExit/WasherPickup").GetComponent<WeaponPickUp>().weapon != (Object)(object)WeaponMakerScript.FetchFromBundle<GameObject>("Washer Weapon.prefab", autofill: true))
			{
				GameObject.Find("FakeExit/WasherPickup").GetComponent<WeaponPickUp>().weapon = WeaponMakerScript.FetchFromBundle<GameObject>("Washer Weapon.prefab", autofill: true);
				Log("Tweaked Washer pickup");
			}
			if ((Object)(object)GameObject.Find("FakeExit/VacuumPickup") != (Object)null && (Object)(object)GameObject.Find("FakeExit/VacuumPickup").GetComponent<WeaponPickUp>().weapon != (Object)(object)WeaponMakerScript.FetchFromBundle<GameObject>("VacuumWeapon.prefab", autofill: true))
			{
				GameObject.Find("FakeExit/VacuumPickup").GetComponent<WeaponPickUp>().weapon = WeaponMakerScript.FetchFromBundle<GameObject>("VacuumWeapon.prefab", autofill: true);
				Log("Tweaked Vacuum pickup");
			}
		}
	}

	public static GameObject MakeGun(int var)
	{
		//IL_00a6: 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)
		int num = 6;
		if ((Object)(object)MonoSingleton<GunControl>.Instance != (Object)null && (Object)(object)MonoSingleton<StyleHUD>.Instance != (Object)null)
		{
			if (((Behaviour)MonoSingleton<GunControl>.Instance).enabled && ((Behaviour)MonoSingleton<StyleHUD>.Instance).enabled)
			{
				GameObject val = null;
				GameObject val2 = ((var == 1) ? WeaponMakerScript.FetchFromBundle<GameObject>("Washer Weapon.prefab", autofill: true) : WeaponMakerScript.FetchFromBundle<GameObject>("VacuumWeapon.prefab", autofill: true));
				val = Object.Instantiate<GameObject>(val2);
				if ((Object)(object)val != (Object)null)
				{
					val.transform.parent = ((Component)MonoSingleton<GunControl>.Instance).transform;
					val.transform.position = ((Component)MonoSingleton<GunControl>.Instance).transform.position;
					val.transform.localRotation = Quaternion.Euler(0f, 0f, 0f);
					MonoSingleton<GunControl>.Instance.slots[num - 1].Add(val);
					MonoSingleton<GunControl>.Instance.allWeapons.Add(val);
					MonoSingleton<GunControl>.Instance.slotDict.Add(val, num - 1);
					MonoSingleton<StyleHUD>.Instance.weaponFreshness.Add(val, 10f);
					val.SetActive(false);
					MonoSingleton<GunControl>.instance.noWeapons = false;
					MonoSingleton<GunControl>.instance.YesWeapon();
					canswitchstate = true;
					Debug.Log((object)"made cleaning gun");
					for (int i = 0; i < ((Component)MonoSingleton<GunControl>.instance).transform.childCount; i++)
					{
						((Component)((Component)MonoSingleton<GunControl>.instance).transform.GetChild(i)).gameObject.SetActive(false);
					}
					val.AddComponent<PatchIdentifier>();
					return val;
				}
				Debug.LogError((object)"Failed to create Cleaning gun. Prefab not found.");
				return null;
			}
			return null;
		}
		return null;
	}

	public static void CreateBloodstain(RaycastHit hit, Vector3 v, Transform parent)
	{
		//IL_0006: Unknown result type (might be due to invalid IL or missing references)
		//IL_0007: Unknown result type (might be due to invalid IL or missing references)
		//IL_001a: Unknown result type (might be due to invalid IL or missing references)
		//IL_001f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0042: 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_006e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0088: Unknown result type (might be due to invalid IL or missing references)
		GameObject val = Object.Instantiate<GameObject>(stain, v, Quaternion.identity);
		val.transform.forward = -((RaycastHit)(ref hit)).normal;
		val.transform.GetChild(0).localRotation = Quaternion.Euler(val.transform.GetChild(0).localRotation.x, val.transform.GetChild(0).localRotation.y, val.transform.GetChild(0).localRotation.z + Random.Range(-360f, 360f));
		GameObjectExtensions.GetOrAddComponent<PatchIdentifier>(val).isBloodStain = true;
		if ((Object)(object)parent != (Object)null)
		{
			val.transform.parent = parent;
		}
	}

	public static bool CheckForMachine(EnemyType type)
	{
		//IL_0001: Unknown result type (might be due to invalid IL or missing references)
		//IL_0003: Invalid comparison between Unknown and I4
		//IL_0005: Unknown result type (might be due to invalid IL or missing references)
		//IL_0007: Invalid comparison between Unknown and I4
		//IL_000a: Unknown result type (might be due to invalid IL or missing references)
		//IL_000d: Invalid comparison between Unknown and I4
		//IL_0010: Unknown result type (might be due to invalid IL or missing references)
		//IL_0013: Invalid comparison between Unknown and I4
		//IL_0016: Unknown result type (might be due to invalid IL or missing references)
		//IL_0019: Invalid comparison between Unknown and I4
		if ((int)type == 1 || (int)type == 6 || (int)type == 37 || (int)type == 35 || (int)type == 20)
		{
			return true;
		}
		return false;
	}

	public static bool CheckForDemon(EnemyType type)
	{
		//IL_0001: Unknown result type (might be due to invalid IL or missing references)
		//IL_0004: Invalid comparison between Unknown and I4
		//IL_0006: Unknown result type (might be due to invalid IL or missing references)
		//IL_0008: Invalid comparison between Unknown and I4
		//IL_000b: Unknown result type (might be due to invalid IL or missing references)
		//IL_000d: Invalid comparison between Unknown and I4
		//IL_0010: Unknown result type (might be due to invalid IL or missing references)
		//IL_0012: Invalid comparison between Unknown and I4
		//IL_0015: Unknown result type (might be due to invalid IL or missing references)
		//IL_0018: Invalid comparison between Unknown and I4
		//IL_001b: Unknown result type (might be due to invalid IL or missing references)
		//IL_001e: Invalid comparison between Unknown and I4
		//IL_0021: Unknown result type (might be due to invalid IL or missing references)
		//IL_0024: Invalid comparison between Unknown and I4
		if ((int)type == 32 || (int)type == 4 || (int)type == 2 || (int)type == 0 || (int)type == 31 || (int)type == 23 || (int)type == 24)
		{
			return true;
		}
		return false;
	}
}