Decompiled source of 21CenturyHumor v1.0.0

TwentyFirstCenturyHumor.dll

Decompiled 2 weeks ago
using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using BepInEx;
using Configgy;
using HarmonyLib;
using UnityEngine;
using UnityEngine.AddressableAssets;
using UnityEngine.ResourceManagement.AsyncOperations;
using UnityEngine.SceneManagement;
using UnityEngine.UI;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: AssemblyTitle("CantStopWinning")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("CantStopWinning")]
[assembly: AssemblyCopyright("Copyright ©  2023")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("28c1fe7a-0b6b-44a6-ad3a-e26c2a4d7974")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[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 TwentyFirstCenturyHumor;

[BepInPlugin("doomahreal.ultrakill.TwentyFirstCenturyHumor", "TwentyFirstCenturyHumor", "1.0.0")]
public class Plugin : BaseUnityPlugin
{
	private const string modGUID = "doomahreal.ultrakill.TwentyFirstCenturyHumor";

	private const string modName = "TwentyFirstCenturyHumor";

	private const string modVersion = "1.0.0";

	private static readonly Harmony Harmony = new Harmony("doomahreal.ultrakill.TwentyFirstCenturyHumor");

	private ConfigBuilder config;

	public static AudioClip[] Penitr = (AudioClip[])(object)new AudioClip[30];

	public static GameObject ThereBeTreasure;

	public static GameObject treasureInstance;

	public static GameObject CoinPrefab;

	private Dictionary<GameObject, Coroutine> activeCoroutines = new Dictionary<GameObject, Coroutine>();

	[Configgable("", "Enable Mod", 0, null)]
	public static ConfigToggle enableMod = new ConfigToggle(true);

	[Configgable("", "Randomize Audio", 0, null)]
	public static ConfigToggle randomizeAudio = new ConfigToggle(false);

	[Configgable("", "Randomize Images", 0, null)]
	public static ConfigToggle randomizeImages = new ConfigToggle(false);

	[Configgable("", "Remove 'Bro Switched His Weapons'", 0, null)]
	public static ConfigToggle removeBroSwitchedWeapons = new ConfigToggle(false);

	[Configgable("", "Volume Slider", 0, null)]
	public static FloatSlider volumeSlider = new FloatSlider(1f, 0f, 2f);

	[Configgable("", "Fade Speed", 0, null)]
	public static ConfigInputField<float> fadeSpeed = new ConfigInputField<float>(1f, (Func<float, bool>)null, (Func<string, ValueTuple<bool, float>>)null);

	public static Plugin Instance { get; private set; }

	private void Awake()
	{
		//IL_0031: Unknown result type (might be due to invalid IL or missing references)
		//IL_0036: Unknown result type (might be due to invalid IL or missing references)
		Harmony.PatchAll();
		Instance = this;
		LOADSOFMONEY();
		SceneManager.sceneLoaded += OnSceneLoaded;
		AsyncOperationHandle<GameObject> val = Addressables.LoadAssetAsync<GameObject>((object)"Assets/Prefabs/Attacks and Projectiles/Coin.prefab");
		val.Completed += delegate(AsyncOperationHandle<GameObject> handle)
		{
			//IL_0003: Unknown result type (might be due to invalid IL or missing references)
			//IL_0009: Invalid comparison between Unknown and I4
			if ((int)handle.Status == 1)
			{
				CoinPrefab = handle.Result;
			}
		};
	}

	private void Start()
	{
		//IL_000c: Unknown result type (might be due to invalid IL or missing references)
		//IL_0016: Expected O, but got Unknown
		config = new ConfigBuilder("doomahreal.ultrakill.TwentyFirstCenturyHumor", "ADHD Be Like:");
		config.BuildAll();
	}

	private void OnSceneLoaded(Scene scene, LoadSceneMode mode)
	{
		InstantiateTreasure();
	}

	private void LOADSOFMONEY()
	{
		try
		{
			Stream manifestResourceStream = Assembly.GetExecutingAssembly().GetManifestResourceStream("TwentyFirstCenturyHumor.guh.bundle");
			if (manifestResourceStream != null)
			{
				byte[] array = new byte[manifestResourceStream.Length];
				manifestResourceStream.Read(array, 0, array.Length);
				AssetBundle val = AssetBundle.LoadFromMemory(array);
				string[] array2 = new string[14]
				{
					"ding", "win", "vine", "ah dang it", "hopemusic", "BALLER", "Get out", "Zelda bell", "damn", "goku",
					"aww", "prowler", "yams", "laugh at you"
				};
				for (int i = 0; i < array2.Length; i++)
				{
					Penitr[i] = val.LoadAsset<AudioClip>(array2[i]);
				}
				ThereBeTreasure = val.LoadAsset<GameObject>("canvas");
			}
		}
		catch (Exception ex)
		{
			Debug.LogError((object)("Error in LOADSOFMONEY: " + ex.Message));
		}
	}

	private void InstantiateTreasure()
	{
		if ((Object)(object)ThereBeTreasure != (Object)null)
		{
			treasureInstance = Object.Instantiate<GameObject>(ThereBeTreasure);
		}
	}

	public void ActivateImageAndAudio(string transformName, int audioClipIndex, float delay = 0f, bool fadeOut = false, bool audioOnly = false, float pitch = 1f)
	{
		if (!((ConfigValueElement<bool>)(object)enableMod).Value || (((ConfigValueElement<bool>)(object)removeBroSwitchedWeapons).Value && transformName == "BroSwitchedWeapons"))
		{
			return;
		}
		if (((ConfigValueElement<bool>)(object)randomizeAudio).Value)
		{
			audioClipIndex = Random.Range(0, 14);
		}
		if (audioClipIndex < 0 || audioClipIndex >= Penitr.Length || (Object)(object)Penitr[audioClipIndex] == (Object)null)
		{
			return;
		}
		AudioClip val = Penitr[audioClipIndex];
		float num = val.length / Mathf.Max(((ConfigValueElement<float>)(object)fadeSpeed).Value, 0.01f);
		if (!audioOnly)
		{
			GameObject obj = treasureInstance;
			Transform val2 = ((obj != null) ? obj.transform : null);
			if ((Object)(object)val2 == (Object)null)
			{
				return;
			}
			if (((ConfigValueElement<bool>)(object)randomizeImages).Value)
			{
				List<Transform> list = (from Transform t in (IEnumerable)val2
					where ((Object)t).name != "Coins"
					select t).ToList();
				if (list.Count == 0)
				{
					return;
				}
				val2 = list[Random.Range(0, list.Count)];
			}
			else
			{
				val2 = val2.Find(transformName);
			}
			if ((Object)(object)val2 == (Object)null)
			{
				return;
			}
			if (activeCoroutines.TryGetValue(((Component)val2).gameObject, out var value))
			{
				((MonoBehaviour)this).StopCoroutine(value);
				activeCoroutines.Remove(((Component)val2).gameObject);
			}
			Image component = ((Component)val2).GetComponent<Image>();
			if (component != null)
			{
				((Graphic)component).canvasRenderer.SetAlpha(1f);
			}
			if (delay <= 0f)
			{
				((Component)val2).gameObject.SetActive(true);
				if (fadeOut && num > 0f)
				{
					Image component2 = ((Component)val2).GetComponent<Image>();
					if (component2 != null)
					{
						((Graphic)component2).CrossFadeAlpha(0f, num, false);
						activeCoroutines[((Component)val2).gameObject] = ((MonoBehaviour)this).StartCoroutine(DeactivateAfterFade(((Component)val2).gameObject, num));
					}
				}
			}
			else
			{
				((MonoBehaviour)this).StartCoroutine(ShowImageWithDelay(((Component)val2).gameObject, delay, fadeOut, num));
			}
		}
		((MonoBehaviour)this).StartCoroutine(PlayAudioWithDelay(audioClipIndex, delay, pitch));
	}

	private IEnumerator ShowImageWithDelay(GameObject target, float delay, bool fadeOut, float fadeDuration)
	{
		yield return (object)new WaitForSeconds(delay);
		target.SetActive(true);
		Image fadeImage = default(Image);
		int num;
		if (fadeOut && fadeDuration > 0f)
		{
			fadeImage = target.GetComponent<Image>();
			num = ((fadeImage != null) ? 1 : 0);
		}
		else
		{
			num = 0;
		}
		if (num != 0)
		{
			fadeDuration /= Mathf.Max(((ConfigValueElement<float>)(object)fadeSpeed).Value, 0.01f);
			((Graphic)fadeImage).CrossFadeAlpha(0f, fadeDuration, false);
			activeCoroutines[target] = ((MonoBehaviour)this).StartCoroutine(DeactivateAfterFade(target, fadeDuration));
		}
	}

	private IEnumerator PlayAudioWithDelay(int audioClipIndex, float delay, float pitch)
	{
		yield return (object)new WaitForSeconds(delay);
		AudioSource audioSource = new GameObject("AudioObject").AddComponent<AudioSource>();
		audioSource.clip = Penitr[audioClipIndex];
		audioSource.volume = ((ConfigValueElement<float>)(object)volumeSlider).Value;
		audioSource.pitch = pitch;
		audioSource.Play();
		Object.Destroy((Object)(object)((Component)audioSource).gameObject, audioSource.clip.length / Mathf.Abs(audioSource.pitch));
	}

	private IEnumerator DeactivateAfterFade(GameObject obj, float duration)
	{
		yield return (object)new WaitForSeconds(duration);
		if ((Object)(object)obj != (Object)null)
		{
			obj.SetActive(false);
			if (activeCoroutines.ContainsKey(obj))
			{
				activeCoroutines.Remove(obj);
			}
		}
	}

	private void OnDestroy()
	{
		SceneManager.sceneLoaded -= OnSceneLoaded;
	}
}
[HarmonyPatch(typeof(Punch), "TryParryProjectile")]
public static class Balls
{
	private static void Postfix(Punch __instance, Transform target, bool canProjectileBoost = false)
	{
		Cannonball val = default(Cannonball);
		if (((Component)target).TryGetComponent<Cannonball>(ref val) && val.launchable)
		{
			Plugin.Instance.ActivateImageAndAudio("GRANDSLAM", 5, 0f, fadeOut: true);
		}
	}
}
[HarmonyPatch(typeof(Punch), "PunchSuccess")]
public static class KBPunch
{
	private static void Postfix(Punch __instance)
	{
		//IL_0002: Unknown result type (might be due to invalid IL or missing references)
		//IL_0008: Invalid comparison between Unknown and I4
		if ((int)__instance.type == 1)
		{
			Plugin.Instance.ActivateImageAndAudio("kbpunch", 8, 0f, fadeOut: true);
		}
	}
}
[HarmonyPatch(typeof(NewMovement), "Update")]
public static class NoStamina
{
	private static bool wasAboveSpeedThreshold;

	private static void Postfix(NewMovement __instance)
	{
		//IL_00ae: Unknown result type (might be due to invalid IL or missing references)
		//IL_00b3: Unknown result type (might be due to invalid IL or missing references)
		if (MonoSingleton<InputManager>.Instance.InputSource.Dodge.WasPerformedThisFrame && __instance.activated && !__instance.slowMode && !GameStateManager.Instance.PlayerInputLocked)
		{
			bool flag = __instance.groundProperties?.canDash ?? true;
			Plugin.Instance.ActivateImageAndAudio((__instance.modNoDashSlide || !flag || __instance.boostCharge < 100f) ? "NoStamina" : "dash", (__instance.modNoDashSlide || !flag || __instance.boostCharge < 100f) ? 2 : 9, 0f, fadeOut: true);
		}
		Vector3 velocity = __instance.rb.velocity;
		float magnitude = ((Vector3)(ref velocity)).magnitude;
		if (magnitude > 200f)
		{
			if (!wasAboveSpeedThreshold)
			{
				Plugin.Instance.ActivateImageAndAudio("ToMuchSpeed", 13, 0f, fadeOut: true);
				wasAboveSpeedThreshold = true;
			}
		}
		else
		{
			wasAboveSpeedThreshold = false;
		}
	}
}
[HarmonyPatch(typeof(NewMovement), "SuperCharge")]
public static class bouttasuperchargeyourmother
{
	private static void Postfix(NewMovement __instance)
	{
		Plugin.Instance.ActivateImageAndAudio("Overheal", 8, 0f, fadeOut: true);
	}
}
[HarmonyPatch(typeof(NewMovement), "Launch")]
public static class launchingdeeznuts
{
	private static void Postfix(NewMovement __instance)
	{
		Plugin.Instance.ActivateImageAndAudio("smth1", 6, 0f, fadeOut: true);
	}
}
[HarmonyPatch(typeof(DualWieldPickup), "PickedUp")]
public static class Dualwieldingtime
{
	private static void Postfix(NewMovement __instance)
	{
		Plugin.Instance.ActivateImageAndAudio("DualWield", 6, 0f, fadeOut: true);
	}
}
[HarmonyPatch(typeof(Revolver), "ThrowCoin")]
public static class PEACHES
{
	private static void Postfix(Revolver __instance)
	{
		Plugin.Instance.ActivateImageAndAudio("coin", 7, 0f, fadeOut: true);
	}
}
[HarmonyPatch(typeof(V2), "SwitchWeapon")]
public static class V2ISALIVEV2ISALIVEV2ISALIVEV2ISALIVEV2ISALIVEV2ISALIVEV2ISALIVEV2ISALIVEV2ISALIVE
{
	private static void Postfix(V2 __instance)
	{
		Plugin.Instance.ActivateImageAndAudio("smth4", 13, 0f, fadeOut: true);
	}
}
[HarmonyPatch(typeof(MinosPrime), "Dropkick")]
public static class JUDGEMENT
{
	private static void Postfix(MinosPrime __instance)
	{
		Plugin.Instance.ActivateImageAndAudio("Dance", 2, 0f, fadeOut: true);
	}
}
[HarmonyPatch(typeof(GunControl))]
internal class OnWeaponSwapTrigger
{
	[HarmonyPatch("SwitchVariant")]
	[HarmonyPatch("SwitchWeapon", new Type[]
	{
		typeof(int),
		typeof(List<GameObject>),
		typeof(bool),
		typeof(bool),
		typeof(bool),
		typeof(bool)
	})]
	public static void Postfix()
	{
		Plugin.Instance.ActivateImageAndAudio("BroSwitchedWeapons", 7, 0f, fadeOut: true);
	}
}
[HarmonyPatch(typeof(Punch), "ActiveFrame")]
public static class ImagineParryingWithKnuckle
{
	private static void Postfix(Punch __instance, bool firstFrame = false)
	{
		//IL_0002: Unknown result type (might be due to invalid IL or missing references)
		//IL_0008: Invalid comparison between Unknown and I4
		//IL_025e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0264: Invalid comparison between Unknown and I4
		//IL_0024: Unknown result type (might be due to invalid IL or missing references)
		//IL_002f: Unknown result type (might be due to invalid IL or missing references)
		//IL_00cb: Unknown result type (might be due to invalid IL or missing references)
		//IL_00db: Unknown result type (might be due to invalid IL or missing references)
		//IL_00ec: Unknown result type (might be due to invalid IL or missing references)
		//IL_010d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0112: 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_012c: Unknown result type (might be due to invalid IL or missing references)
		//IL_0142: Unknown result type (might be due to invalid IL or missing references)
		//IL_014d: Unknown result type (might be due to invalid IL or missing references)
		if ((int)__instance.type == 1 && !__instance.parriedSomething)
		{
			Collider[] array = Physics.OverlapSphere(__instance.cc.GetDefaultPos(), 0.01f, LayerMask.op_Implicit(__instance.deflectionLayerMask), (QueryTriggerInteraction)2);
			List<Transform> list = new List<Transform>();
			Collider[] array2 = array;
			foreach (Collider val in array2)
			{
				list.Add(((Component)val).transform);
				if (TryParryProjectile(__instance, ((Object)(object)val.attachedRigidbody != (Object)null) ? ((Component)val.attachedRigidbody).transform : ((Component)val).transform, firstFrame))
				{
					Plugin.Instance.ActivateImageAndAudio("Hakita", 6, 0f, fadeOut: true);
					break;
				}
			}
			bool flag = Physics.Raycast(__instance.cc.GetDefaultPos(), __instance.camObj.transform.forward, ref __instance.hit, 4f, LayerMask.op_Implicit(__instance.deflectionLayerMask));
			if (!flag)
			{
				flag = Physics.BoxCast(__instance.cc.GetDefaultPos(), Vector3.one * 0.3f, __instance.camObj.transform.forward, ref __instance.hit, __instance.camObj.transform.rotation, 4f, LayerMask.op_Implicit(__instance.deflectionLayerMask));
			}
			if (!flag || list.Contains(((RaycastHit)(ref __instance.hit)).transform) || !TryParryProjectile(__instance, ((RaycastHit)(ref __instance.hit)).transform, firstFrame))
			{
				if ((Object)(object)__instance.ppz == (Object)null)
				{
					__instance.ppz = ((Component)((Component)__instance).transform.parent).GetComponentInChildren<ProjectileParryZone>();
				}
				if ((Object)(object)__instance.ppz != (Object)null)
				{
					Projectile val2 = __instance.ppz.CheckParryZone();
					if ((Object)(object)val2 != (Object)null)
					{
						bool flag2 = !__instance.alreadyBoostedProjectile && firstFrame;
						if (!list.Contains(((Component)val2).transform) && !val2.unparryable && !val2.undeflectable && (flag2 || !val2.playerBullet))
						{
							Plugin.Instance.ActivateImageAndAudio("Hakita", 6, 0f, fadeOut: true);
						}
					}
				}
			}
		}
		if ((int)__instance.type == 0)
		{
			Debug.Log((object)"Standard punch type detected.");
			if (__instance.parriedSomething)
			{
				Debug.Log((object)"Parry success! Activating 'parry success' image and audio.");
				Plugin.Instance.ActivateImageAndAudio("parry success", 7, 0f, fadeOut: true);
			}
			else
			{
				Debug.Log((object)"Parry failed. Activating 'parry fail' image and audio.");
				Plugin.Instance.ActivateImageAndAudio("parry fail", 10, 0f, fadeOut: true);
			}
		}
	}

	private static bool TryParryProjectile(Punch __instance, Transform target, bool canProjectileBoost = false)
	{
		ParryHelper val = default(ParryHelper);
		if (((Component)target).TryGetComponent<ParryHelper>(ref val))
		{
			target = val.target;
		}
		Projectile val2 = default(Projectile);
		if (((Component)target).TryGetComponent<Projectile>(ref val2) && !val2.unparryable && !val2.undeflectable && ((!__instance.alreadyBoostedProjectile && canProjectileBoost) || !val2.playerBullet))
		{
			return true;
		}
		Cannonball val3 = default(Cannonball);
		if (((Component)target).TryGetComponent<Cannonball>(ref val3) && val3.launchable)
		{
			return true;
		}
		ParryReceiver val4 = default(ParryReceiver);
		if (((Component)target).TryGetComponent<ParryReceiver>(ref val4) && ((Behaviour)val4).enabled)
		{
			return true;
		}
		ThrownSword val5 = default(ThrownSword);
		if (((Component)target).TryGetComponent<ThrownSword>(ref val5) && !val5.friendly && val5.active)
		{
			return true;
		}
		MassSpear val6 = default(MassSpear);
		if (((Component)target).TryGetComponent<MassSpear>(ref val6) && (!val6.beenStopped || val6.hittingPlayer))
		{
			return true;
		}
		Landmine val7 = default(Landmine);
		if (((Component)target).TryGetComponent<Landmine>(ref val7))
		{
			return true;
		}
		Chainsaw val8 = default(Chainsaw);
		if (((Component)target).TryGetComponent<Chainsaw>(ref val8))
		{
			return true;
		}
		return false;
	}
}
[HarmonyPatch(typeof(ActivateNextWave), "EndWaves")]
public static class whenyoulowkeysupermanbutyouviolentlytouchbro
{
	private static void Postfix(ActivateNextWave __instance)
	{
		if (__instance.toActivate.Length != 0 && !__instance.objectsActivated && __instance.currentDoor >= __instance.doors.Length && !__instance.forEnemies)
		{
			Plugin.Instance.ActivateImageAndAudio("Hope", 4, 0f, fadeOut: true);
		}
	}
}
[HarmonyPatch(typeof(StyleHUD), "UpdateMeter")]
public static class menaresohot
{
	private static float previousSection;

	private static void Postfix(StyleHUD __instance)
	{
		if (!((Object)(object)__instance == (Object)null) && Plugin.Penitr != null && Plugin.Penitr.Length != 0 && !((Object)(object)Plugin.Penitr[0] == (Object)null))
		{
			float currentMeter = __instance.currentMeter;
			float num = __instance.currentRank.maxMeter;
			float num2 = num / 5f;
			float num3 = currentMeter / num2;
			if (currentMeter != 0f)
			{
				Plugin.Instance.ActivateImageAndAudio("", 0, 0f, fadeOut: false, audioOnly: true, (num3 > previousSection) ? (1f + num3 * 0.1f) : (-1f));
				previousSection = num3;
			}
		}
	}
}
[HarmonyPatch(typeof(StyleHUD), "AscendRank")]
public static class pingmeondiscordifyouseethis
{
	private const float MinForce = 10f;

	private const float MaxForce = 20f;

	private static void Postfix()
	{
		//IL_0055: Unknown result type (might be due to invalid IL or missing references)
		//IL_005c: Expected O, but got Unknown
		//IL_010c: Unknown result type (might be due to invalid IL or missing references)
		//IL_0111: Unknown result type (might be due to invalid IL or missing references)
		//IL_0163: Unknown result type (might be due to invalid IL or missing references)
		//IL_0168: Unknown result type (might be due to invalid IL or missing references)
		//IL_016c: Unknown result type (might be due to invalid IL or missing references)
		//IL_0180: Unknown result type (might be due to invalid IL or missing references)
		Plugin.Instance.ActivateImageAndAudio("", 1, 0f, fadeOut: false, audioOnly: true);
		GameObject treasureInstance = Plugin.treasureInstance;
		Transform val = ((treasureInstance != null) ? treasureInstance.transform.Find("Coins") : null);
		if (val != null)
		{
			foreach (Transform item in val)
			{
				Transform val2 = item;
				if ((Object)(object)((Component)val2).gameObject != (Object)null)
				{
					((Component)val2).gameObject.SetActive(true);
					((Component)val2).GetComponent<MonoBehaviour>().StartCoroutine(DeactivateAfterDelay(((Component)val2).gameObject, 1f + Random.Range(0f, 1f)));
				}
			}
		}
		if ((Object)(object)Plugin.CoinPrefab != (Object)null)
		{
			NewMovement instance = MonoSingleton<NewMovement>.Instance;
			Transform val3 = ((instance != null) ? ((Component)instance).transform : null);
			if (val3 != null)
			{
				for (int i = 0; i < 25; i++)
				{
					GameObject val4 = Object.Instantiate<GameObject>(Plugin.CoinPrefab, val3.position, Quaternion.identity);
					Rigidbody component = val4.GetComponent<Rigidbody>();
					if ((Object)(object)component != (Object)null)
					{
						Vector3 val5 = new Vector3(Random.Range(-1f, 1f), Random.Range(0.5f, 1f), Random.Range(-1f, 1f));
						component.AddForce(((Vector3)(ref val5)).normalized * Random.Range(10f, 20f), (ForceMode)1);
					}
				}
				return;
			}
		}
		Debug.LogError((object)"Failed to find player transform.");
	}

	private static IEnumerator DeactivateAfterDelay(GameObject obj, float delay)
	{
		yield return (object)new WaitForSeconds(delay);
		if ((Object)(object)obj != (Object)null)
		{
			obj.SetActive(false);
		}
	}
}
[HarmonyPatch(typeof(StyleHUD), "DescendRank")]
public static class UncreativeNameNumber99991
{
	private static void Postfix(StyleHUD __instance)
	{
		if (Plugin.Penitr == null || Plugin.Penitr.Length < 4 || !__instance.comboActive || __instance.currentMeter <= 0f)
		{
			return;
		}
		GameObject treasureInstance = Plugin.treasureInstance;
		if ((Object)(object)treasureInstance != (Object)null)
		{
			Transform val = treasureInstance.transform.Find("Concern");
			if ((Object)(object)val != (Object)null && (Object)(object)Plugin.Penitr[2] != (Object)null)
			{
				Plugin.Instance.ActivateImageAndAudio("Concern", 2, 0f, fadeOut: true);
			}
			Plugin.Instance.ActivateImageAndAudio("", 3, 0f, fadeOut: false, audioOnly: true);
		}
	}
}
[HarmonyPatch(typeof(GabrielVoice), "TauntNow")]
public static class GabrielVoiceTauntPatch
{
	private static void Postfix(GabrielVoice __instance, AudioClip[] clips, string[] subs)
	{
		float delay = __instance.aud.clip.length + 0.1f;
		Plugin.Instance.ActivateImageAndAudio("smth2", 6, delay, fadeOut: true);
	}
}
[HarmonyPatch(typeof(Coin), "ReflectRevolver")]
public class ReflectRevolverPatch
{
	private static void Postfix(Coin __instance)
	{
		if ((__instance.hitTimes > 1 && !__instance.shotByEnemy) || __instance.doubled)
		{
			Plugin.Instance.ActivateImageAndAudio("splitshot", 12, Plugin.Penitr[12].length, fadeOut: true);
		}
	}
}
[HarmonyPatch(typeof(IEnrage), "Enrage")]
public static class angrybritishdude
{
	private static void PostFix(IEnrage __instance)
	{
		Plugin.Instance.ActivateImageAndAudio("smth", 11, 0f, fadeOut: true);
	}
}
[HarmonyPatch(typeof(StatueBoss), "OrbSpawn")]
public static class butherestheballer
{
	private static void Postfix(StatueBoss __instance)
	{
		Plugin.Instance.ActivateImageAndAudio("ball", 5, 0f, fadeOut: true);
	}
}
[HarmonyPatch(typeof(StatueBoss), "Stomp")]
public static class bigshoelmfao
{
	private static void Postfix(StatueBoss __instance)
	{
		Plugin.Instance.ActivateImageAndAudio("big shoe", 2, 0f, fadeOut: true);
	}
}
[HarmonyPatch(typeof(Stalker), "SandExplode")]
public static class sandinyoureyes
{
	private static void Postfix(Stalker __instance)
	{
		Plugin.Instance.ActivateImageAndAudio("stalker", 2, 0f, fadeOut: true);
	}
}
[HarmonyPatch(typeof(NewMovement), "GetHurt")]
public class GetHurtPatch
{
	private static void Postfix(NewMovement __instance)
	{
		if (__instance.hp < 25)
		{
			Plugin.Instance.ActivateImageAndAudio("jesus", 7, 0f, fadeOut: true);
		}
	}
}
[HarmonyPatch(typeof(ZombieMelee), "MouthOpen")]
public class GetHurtPatcha
{
	private static void Postfix(ZombieMelee __instance)
	{
		Plugin.Instance.ActivateImageAndAudio("filth bite", 6, 0f, fadeOut: true);
	}
}
[HarmonyPatch(typeof(UnderwaterController), "InWater")]
public class GetHurtPatchb
{
	private static void Postfix(UnderwaterController __instance)
	{
		Plugin.Instance.ActivateImageAndAudio("water_enter", 2, 0f, fadeOut: true);
	}
}
[HarmonyPatch(typeof(HookArm), "Update")]
public class GetHurtPatchc
{
	private static void Postfix(HookArm __instance)
	{
		if (MonoSingleton<InputManager>.Instance.InputSource.Hook.WasPerformedThisFrame)
		{
			Plugin.Instance.ActivateImageAndAudio("whiplash", 6, 0f, fadeOut: true);
		}
	}
}
[HarmonyPatch(typeof(HurtZone), "FixedUpdate")]
public class GetHurtPatchd
{
	private static void Postfix(HurtZone __instance)
	{
		//IL_002c: Unknown result type (might be due to invalid IL or missing references)
		//IL_0031: 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_003b: Unknown result type (might be due to invalid IL or missing references)
		//IL_0040: Unknown result type (might be due to invalid IL or missing references)
		//IL_0044: Unknown result type (might be due to invalid IL or missing references)
		//IL_004f: Unknown result type (might be due to invalid IL or missing references)
		BoxCollider component = ((Component)__instance).GetComponent<BoxCollider>();
		if ((Object)(object)component == (Object)null || __instance.playerHurtCooldown > 0f)
		{
			return;
		}
		Bounds bounds = ((Collider)component).bounds;
		Vector3 center = ((Bounds)(ref bounds)).center;
		bounds = ((Collider)component).bounds;
		Collider[] array = Physics.OverlapBox(center, ((Bounds)(ref bounds)).extents, ((Component)component).transform.rotation);
		foreach (Collider val in array)
		{
			if (((Component)val).CompareTag("Player"))
			{
				Plugin.Instance.ActivateImageAndAudio("fire_damage", 2, 0f, fadeOut: true);
				__instance.playerHurtCooldown = __instance.hurtCooldown;
				break;
			}
		}
	}
}
[HarmonyPatch(typeof(NewMovement), "Respawn")]
public class rerepawned
{
	private static void Postfix(NewMovement __instance)
	{
		Plugin.Instance.ActivateImageAndAudio("player_death", 13, 0f, fadeOut: true);
	}
}
[HarmonyPatch(typeof(Railcannon), "Shoot")]
public class rererepawned
{
	private static void Postfix(Railcannon __instance)
	{
		Plugin.Instance.ActivateImageAndAudio("railcannon_shoot", 8, 0f, fadeOut: true);
	}
}