Decompiled source of UltraVoice v1.1.2

UltraVoice.dll

Decompiled 6 days ago
using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using BepInEx;
using BepInEx.Logging;
using HarmonyLib;
using Microsoft.CodeAnalysis;
using PluginConfig.API;
using PluginConfig.API.Fields;
using TMPro;
using ULTRAKILL.Cheats;
using UltraVoice.Characters;
using UltraVoice.Utilities;
using UnityEngine;
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: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")]
[assembly: IgnoresAccessChecksTo("Assembly-CSharp")]
[assembly: AssemblyCompany("UltraVoice")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0+fce8d0db97c4e52207d96652a911dfd961ab8594")]
[assembly: AssemblyProduct("UltraVoice")]
[assembly: AssemblyTitle("UltraVoice")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.0.0")]
[module: UnverifiableCode]
namespace Microsoft.CodeAnalysis
{
	[CompilerGenerated]
	[Embedded]
	internal sealed class EmbeddedAttribute : Attribute
	{
	}
}
namespace System.Runtime.CompilerServices
{
	[CompilerGenerated]
	[Embedded]
	[AttributeUsage(AttributeTargets.Class | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Parameter | AttributeTargets.ReturnValue | AttributeTargets.GenericParameter, AllowMultiple = false, Inherited = false)]
	internal sealed class NullableAttribute : Attribute
	{
		public readonly byte[] NullableFlags;

		public NullableAttribute(byte P_0)
		{
			NullableFlags = new byte[1] { P_0 };
		}

		public NullableAttribute(byte[] P_0)
		{
			NullableFlags = P_0;
		}
	}
	[CompilerGenerated]
	[Embedded]
	[AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Method | AttributeTargets.Interface | AttributeTargets.Delegate, AllowMultiple = false, Inherited = false)]
	internal sealed class NullableContextAttribute : Attribute
	{
		public readonly byte Flag;

		public NullableContextAttribute(byte P_0)
		{
			Flag = P_0;
		}
	}
}
[HarmonyPatch(typeof(GabrielVoice), "Hurt")]
internal class GabrielHurtPatch
{
	private static bool Prefix()
	{
		return false;
	}
}
namespace UltraVoice
{
	[BepInPlugin("com.mel33.ultravoice", "UltraVoice", "1.1.0")]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	public class UltraVoicePlugin : BaseUnityPlugin
	{
		public enum SwordsmachineVoiceActor
		{
			Mel,
			Noto
		}

		public enum SentryVoiceActor
		{
			Noto,
			Goober
		}

		public static UltraVoicePlugin Instance;

		public static VoiceManager VoiceManager;

		private Harmony harmony;

		private PluginConfigurator config;

		public static BoolField CerberusVoiceEnabled;

		public static BoolField SwordsmachineVoiceEnabled;

		public static BoolField V2VoiceEnabled;

		public static BoolField StreetcleanerVoiceEnabled;

		public static BoolField MindflayerVoiceEnabled;

		public static BoolField VirtueVoiceEnabled;

		public static BoolField FerrymanVoiceEnabled;

		public static BoolField GuttermanVoiceEnabled;

		public static BoolField MannequinVoiceEnabled;

		public static BoolField GuttertankVoiceEnabled;

		public static BoolField ProvidenceVoiceEnabled;

		public static BoolField SentryVoiceEnabled;

		public static BoolField MauriceVoiceEnabled;

		public static BoolField EarthmoverVoiceEnabled;

		public static BoolField MirrorReaperVoiceEnabled;

		public static BoolField GeryonVoiceEnabled;

		public static BoolField LeviathanVoiceEnabled;

		public static BoolField FilthVoiceEnabled;

		public static BoolField StrayVoiceEnabled;

		public static BoolField SchismVoiceEnabled;

		public static BoolField SoldierVoiceEnabled;

		public static BoolField PowerSubtitleColorEnabled;

		public static FloatField VoiceCooldown;

		public static IntField SubtitleLimit;

		public static EnumField<SwordsmachineVoiceActor> SwordsmachineVoiceActorField;

		public static EnumField<SentryVoiceActor> SentryVoiceActorField;

		public static ConfigPanel TogglesPanel;

		public static ConfigPanel ActorPanel;

		private void Awake()
		{
			//IL_003b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0045: Expected O, but got Unknown
			//IL_005a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0064: Expected O, but got Unknown
			//IL_0074: Unknown result type (might be due to invalid IL or missing references)
			//IL_007e: Expected O, but got Unknown
			//IL_008e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0098: Expected O, but got Unknown
			//IL_00a8: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b2: Expected O, but got Unknown
			//IL_00c2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00cc: Expected O, but got Unknown
			//IL_00dc: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e6: Expected O, but got Unknown
			//IL_00f6: Unknown result type (might be due to invalid IL or missing references)
			//IL_0100: Expected O, but got Unknown
			//IL_0110: Unknown result type (might be due to invalid IL or missing references)
			//IL_011a: Expected O, but got Unknown
			//IL_012a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0134: Expected O, but got Unknown
			//IL_0144: Unknown result type (might be due to invalid IL or missing references)
			//IL_014e: Expected O, but got Unknown
			//IL_015e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0168: Expected O, but got Unknown
			//IL_0178: Unknown result type (might be due to invalid IL or missing references)
			//IL_0182: Expected O, but got Unknown
			//IL_0192: Unknown result type (might be due to invalid IL or missing references)
			//IL_019c: Expected O, but got Unknown
			//IL_01ac: Unknown result type (might be due to invalid IL or missing references)
			//IL_01b6: Expected O, but got Unknown
			//IL_01c6: Unknown result type (might be due to invalid IL or missing references)
			//IL_01d0: Expected O, but got Unknown
			//IL_01e0: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ea: Expected O, but got Unknown
			//IL_01fa: Unknown result type (might be due to invalid IL or missing references)
			//IL_0204: Expected O, but got Unknown
			//IL_0214: Unknown result type (might be due to invalid IL or missing references)
			//IL_021e: Expected O, but got Unknown
			//IL_022e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0238: Expected O, but got Unknown
			//IL_0248: Unknown result type (might be due to invalid IL or missing references)
			//IL_0252: Expected O, but got Unknown
			//IL_0262: Unknown result type (might be due to invalid IL or missing references)
			//IL_026c: Expected O, but got Unknown
			//IL_027c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0286: Expected O, but got Unknown
			//IL_029c: Unknown result type (might be due to invalid IL or missing references)
			//IL_02a6: Expected O, but got Unknown
			//IL_02ca: Unknown result type (might be due to invalid IL or missing references)
			//IL_02d4: Expected O, but got Unknown
			//IL_02ed: Unknown result type (might be due to invalid IL or missing references)
			//IL_02f7: Expected O, but got Unknown
			//IL_037c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0386: Expected O, but got Unknown
			Instance = this;
			VoiceManager = new VoiceManager();
			config = PluginConfigurator.Create("UltraVoice", "com.mel33.ultravoice");
			TogglesPanel = new ConfigPanel(config.rootPanel, "Enemy Line Toggles", "toggles");
			ActorPanel = new ConfigPanel(config.rootPanel, "Voice Actors", "actors");
			CerberusVoiceEnabled = new BoolField(TogglesPanel, "Enable Cerberus Voice Lines", "cerberusvoice", true);
			SwordsmachineVoiceEnabled = new BoolField(TogglesPanel, "Enable Swordsmachine Voice Lines", "swordsmachinevoice", true);
			V2VoiceEnabled = new BoolField(TogglesPanel, "Enable V2 Voice Lines", "v2voice", true);
			StreetcleanerVoiceEnabled = new BoolField(TogglesPanel, "Enable Streetcleaner Voice Lines", "streetcleanervoice", true);
			MindflayerVoiceEnabled = new BoolField(TogglesPanel, "Enable Mindflayer Voice Lines", "mindflayervoice", true);
			VirtueVoiceEnabled = new BoolField(TogglesPanel, "Enable Virtue Voice Lines", "virtuevoice", true);
			FerrymanVoiceEnabled = new BoolField(TogglesPanel, "Enable Ferryman Voice Lines", "ferrymanvoice", true);
			GuttermanVoiceEnabled = new BoolField(TogglesPanel, "Enable Gutterman Voice Lines", "guttermanvoice", true);
			MannequinVoiceEnabled = new BoolField(TogglesPanel, "Enable Mannequin Voice Lines", "mannequinvoice", true);
			GuttertankVoiceEnabled = new BoolField(TogglesPanel, "Enable Guttertank Voice Lines", "guttertankvoice", true);
			ProvidenceVoiceEnabled = new BoolField(TogglesPanel, "Enable Providence Voice Lines", "providencevoice", true);
			SentryVoiceEnabled = new BoolField(TogglesPanel, "Enable Sentry Voice Lines", "sentryvoice", true);
			MauriceVoiceEnabled = new BoolField(TogglesPanel, "Enable Malicious Face Voice Lines", "mauricevoice", true);
			EarthmoverVoiceEnabled = new BoolField(TogglesPanel, "Enable Earthmover Voice Lines", "earthmovervoice", true);
			MirrorReaperVoiceEnabled = new BoolField(TogglesPanel, "Enable Mirror Reaper Voice Lines", "mirrorreapervoice", true);
			GeryonVoiceEnabled = new BoolField(TogglesPanel, "Enable Geryon Voice Lines", "geryonvoice", true);
			LeviathanVoiceEnabled = new BoolField(TogglesPanel, "Enable Leviathan Voice Lines", "levivoice", true);
			FilthVoiceEnabled = new BoolField(TogglesPanel, "Enable Filth Voice Lines", "filthvoice", true);
			StrayVoiceEnabled = new BoolField(TogglesPanel, "Enable Stray Voice Lines", "strayvoice", true);
			SchismVoiceEnabled = new BoolField(TogglesPanel, "Enable Schism Voice Lines", "schismvoice", true);
			SoldierVoiceEnabled = new BoolField(TogglesPanel, "Enable Soldier Voice Lines", "soldiervoice", true);
			PowerSubtitleColorEnabled = new BoolField(config.rootPanel, "Enable Power Subtitle Color", "powersubcolor", true);
			VoiceCooldown = new FloatField(config.rootPanel, "Voice Cooldown", "cooldown", 0.25f, 0f, 0.5f);
			SubtitleLimit = new IntField(config.rootPanel, "Max Allowed Subtitles", "subtitlelimit", 5, 1, 10);
			SwordsmachineVoiceActorField = new EnumField<SwordsmachineVoiceActor>(ActorPanel, "Swordsmachine Voice Actor", "smvoiceactor", SwordsmachineVoiceActor.Mel);
			SentryVoiceActorField = new EnumField<SentryVoiceActor>(ActorPanel, "Sentry Voice Actor", "svoiceactor", SentryVoiceActor.Goober);
			SwordsmachineVoiceActorField.SetEnumDisplayName(SwordsmachineVoiceActor.Mel, "Mel");
			SwordsmachineVoiceActorField.SetEnumDisplayName(SwordsmachineVoiceActor.Noto, "Noto");
			SentryVoiceActorField.SetEnumDisplayName(SentryVoiceActor.Goober, "Goober");
			SentryVoiceActorField.SetEnumDisplayName(SentryVoiceActor.Noto, "Noto");
			LoadAssets();
			harmony = new Harmony("com.mel33.ultravoice");
			harmony.PatchAll();
			SceneManager.sceneLoaded += OnSceneLoaded;
			((BaseUnityPlugin)this).Logger.LogInfo((object)"UltraVoice loaded successfully!");
		}

		private void OnDestroy()
		{
			harmony.UnpatchSelf();
		}

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

		private void ResetCharacterStates()
		{
			SwordsmachineCharacter.FirstFightDone = false;
			SwordsmachineCharacter.FirstFightLinePlayed = false;
			V2Character.V2IntroTime = -999f;
			V2Character.V2CutsceneVoicePlayed = false;
			V2Character.V2SecondVoiceRestartPlayed = false;
			V2Character.V2DeathPlayed = false;
			FerrymanCharacter.FerrymanCoinTossed = false;
			FerrymanCharacter.FerrymanPhaseChangePlayed = false;
			GuttertankCharacter.GuttertankSpawnInMirror = false;
			GeryonCharacter.EnrageLinePlayed = false;
			GeryonCharacter.CanRestartFight = false;
		}

		private void LoadAssets()
		{
			CerberusCharacter.LoadVoiceLines(((BaseUnityPlugin)this).Logger);
			SwordsmachineCharacter.LoadVoiceLines(((BaseUnityPlugin)this).Logger);
			V2Character.LoadVoiceLines(((BaseUnityPlugin)this).Logger);
			MindflayerCharacter.LoadVoiceLines(((BaseUnityPlugin)this).Logger);
			VirtueCharacter.LoadVoiceLines(((BaseUnityPlugin)this).Logger);
			StreetcleanerCharacter.LoadVoiceLines(((BaseUnityPlugin)this).Logger);
			FerrymanCharacter.LoadVoiceLines(((BaseUnityPlugin)this).Logger);
			MannequinCharacter.LoadVoiceLines(((BaseUnityPlugin)this).Logger);
			GuttermanCharacter.LoadVoiceLines(((BaseUnityPlugin)this).Logger);
			GuttertankCharacter.LoadVoiceLines(((BaseUnityPlugin)this).Logger);
			ProvidenceCharacter.LoadVoiceLines(((BaseUnityPlugin)this).Logger);
			SentryCharacter.LoadVoiceLines(((BaseUnityPlugin)this).Logger);
			MaliciousFaceCharacter.LoadVoiceLines(((BaseUnityPlugin)this).Logger);
			EarthmoverCharacter.LoadVoiceLines(((BaseUnityPlugin)this).Logger);
			MirrorReaperCharacter.LoadVoiceLines(((BaseUnityPlugin)this).Logger);
			GeryonCharacter.LoadVoiceLines(((BaseUnityPlugin)this).Logger);
			LeviathanCharacter.LoadVoiceLines(((BaseUnityPlugin)this).Logger);
			FilthCharacter.LoadVoiceLines(((BaseUnityPlugin)this).Logger);
			StrayCharacter.LoadVoiceLines(((BaseUnityPlugin)this).Logger);
			SchismCharacter.LoadVoiceLines(((BaseUnityPlugin)this).Logger);
		}

		public static AudioClip LoadClip(string resourcePath)
		{
			try
			{
				Assembly executingAssembly = Assembly.GetExecutingAssembly();
				if (!resourcePath.StartsWith("UltraVoice.Resources."))
				{
					resourcePath = "UltraVoice.Resources." + resourcePath;
				}
				using Stream stream = executingAssembly.GetManifestResourceStream(resourcePath);
				if (stream == null)
				{
					((BaseUnityPlugin)Instance).Logger.LogWarning((object)("UltraVoice missing clip: " + resourcePath));
					return null;
				}
				byte[] array = new byte[stream.Length];
				stream.Read(array, 0, array.Length);
				AudioClip val = WavUtility.ToAudioClip(array);
				if ((Object)(object)val == (Object)null)
				{
					((BaseUnityPlugin)Instance).Logger.LogWarning((object)("UltraVoice failed to convert clip: " + resourcePath));
					return null;
				}
				return val;
			}
			catch (Exception arg)
			{
				((BaseUnityPlugin)Instance).Logger.LogError((object)$"UltraVoice error loading clip {resourcePath}: {arg}");
				return null;
			}
		}

		public static IEnumerator DelayedVox(Action playAction, Func<bool> ready, Component attached)
		{
			float waited = 0f;
			while (!ready() && waited < 2f)
			{
				if ((Object)(object)attached == (Object)null)
				{
					yield break;
				}
				yield return (object)new WaitForSeconds(0.1f);
				waited += 0.1f;
			}
			if (ready() && (Object)(object)attached != (Object)null)
			{
				playAction();
			}
		}
	}
}
namespace UltraVoice.Utilities
{
	public class VoiceManager
	{
		private static float lastVoiceTime = -999f;

		private static Dictionary<int, float> enemyVoiceCooldown = new Dictionary<int, float>();

		public static Dictionary<Component, float> spawnVoiceEndTimes = new Dictionary<Component, float>();

		public static Dictionary<Component, float> enemySpawnTimes = new Dictionary<Component, float>();

		public static Color GetEnemyTypeColor(EnemyType enemyType)
		{
			//IL_0005: Unknown result type (might be due to invalid IL or missing references)
			//IL_0008: Invalid comparison between Unknown and I4
			//IL_0051: Unknown result type (might be due to invalid IL or missing references)
			//IL_0054: Unknown result type (might be due to invalid IL or missing references)
			//IL_006a: Expected I4, but got Unknown
			//IL_000a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0038: Expected I4, but got Unknown
			//IL_015f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0164: 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_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_0148: 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)
			//IL_00c6: 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_01a4: 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_00e0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ac: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b1: 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_0097: Unknown result type (might be due to invalid IL or missing references)
			//IL_00fa: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ff: Unknown result type (might be due to invalid IL or missing references)
			//IL_006c: Unknown result type (might be due to invalid IL or missing references)
			//IL_006f: Invalid comparison between Unknown and I4
			//IL_003a: Unknown result type (might be due to invalid IL or missing references)
			//IL_003d: Invalid comparison between Unknown and I4
			//IL_01cf: Unknown result type (might be due to invalid IL or missing references)
			//IL_01d0: Unknown result type (might be due to invalid IL or missing references)
			//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_018d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0192: 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_0076: Unknown result type (might be due to invalid IL or missing references)
			//IL_0079: Invalid comparison between Unknown and I4
			//IL_0044: Unknown result type (might be due to invalid IL or missing references)
			//IL_0047: Invalid comparison between Unknown and I4
			//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_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)
			if (1 == 0)
			{
			}
			Color result;
			if ((int)enemyType <= 26)
			{
				switch ((int)enemyType)
				{
				case 7:
					goto IL_0083;
				case 6:
					goto IL_009d;
				case 0:
					goto IL_00b7;
				case 5:
					goto IL_00d1;
				case 9:
					goto IL_00eb;
				case 4:
					goto IL_0195;
				case 1:
				case 2:
				case 3:
				case 8:
					goto IL_01c3;
				}
				if ((int)enemyType != 20)
				{
					if ((int)enemyType != 26)
					{
						goto IL_01c3;
					}
					result = new Color(0f, 0.66f, 0.77f);
				}
				else
				{
					result = new Color(0.51f, 0.68f, 0.1f);
				}
			}
			else
			{
				switch (enemyType - 31)
				{
				case 2:
					goto IL_0105;
				case 3:
					goto IL_0139;
				case 0:
					goto IL_0150;
				case 1:
					goto IL_01c3;
				}
				if ((int)enemyType != 38)
				{
					if ((int)enemyType != 41)
					{
						goto IL_01c3;
					}
					result = new Color(0.9f, 0.85f, 0.76f);
				}
				else
				{
					result = new Color(0.9f, 0.79f, 0.86f);
				}
			}
			goto IL_01cb;
			IL_0195:
			result = new Color(0.76f, 0.66f, 0.56f);
			goto IL_01cb;
			IL_009d:
			result = new Color(0.82f, 0.3f, 0.09f);
			goto IL_01cb;
			IL_0150:
			result = new Color(0.91f, 0.91f, 0.91f);
			goto IL_01cb;
			IL_0105:
			result = new Color(0.91f, 0.73f, 0.51f);
			goto IL_01cb;
			IL_0139:
			result = new Color(0.8f, 0.07f, 0.07f);
			goto IL_01cb;
			IL_00eb:
			result = new Color(0.4f, 0.75f, 0.94f);
			goto IL_01cb;
			IL_01c3:
			result = Color.white;
			goto IL_01cb;
			IL_0083:
			result = new Color(0.91f, 0.6f, 0.05f);
			goto IL_01cb;
			IL_01cb:
			if (1 == 0)
			{
			}
			return result;
			IL_00d1:
			result = new Color(0.26f, 0.89f, 0.74f);
			goto IL_01cb;
			IL_00b7:
			result = new Color(0.65f, 0.65f, 0.65f);
			goto IL_01cb;
		}

		public static Color? GetSubtitleColor(Component enemy, Color? colorOverride)
		{
			//IL_000e: 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_002e: Unknown result type (might be due to invalid IL or missing references)
			if (colorOverride.HasValue)
			{
				return colorOverride.Value;
			}
			EnemyIdentifier val = default(EnemyIdentifier);
			if (enemy.TryGetComponent<EnemyIdentifier>(ref val))
			{
				return GetEnemyTypeColor(val.enemyType);
			}
			return null;
		}

		public static bool CheckCooldown(Component enemy, float cooldown)
		{
			int instanceID = ((Object)enemy).GetInstanceID();
			if (enemyVoiceCooldown.TryGetValue(instanceID, out var value) && Time.time - value < cooldown)
			{
				return false;
			}
			enemyVoiceCooldown[instanceID] = Time.time;
			return true;
		}

		public static bool CheckGlobalCooldown()
		{
			if (Time.time - lastVoiceTime < UltraVoicePlugin.VoiceCooldown.value)
			{
				return false;
			}
			lastVoiceTime = Time.time;
			return true;
		}

		public static bool IsSpawnVoicePlaying(Component enemy)
		{
			if (!spawnVoiceEndTimes.TryGetValue(enemy, out var value))
			{
				return false;
			}
			return Time.time < value;
		}

		public static bool IsEnemyVoicePlaying(Component enemy)
		{
			//IL_0016: Unknown result type (might be due to invalid IL or missing references)
			//IL_001c: Expected O, but got Unknown
			foreach (Transform item in enemy.transform)
			{
				Transform val = item;
				if (((Object)val).name.StartsWith("UltraVoice_"))
				{
					return true;
				}
			}
			return false;
		}

		public static bool TooSoonAfterSpawn(Component enemy, float delay)
		{
			if (!enemySpawnTimes.TryGetValue(enemy, out var value))
			{
				return false;
			}
			return Time.time - value < delay;
		}

		public static AudioSource CreateVoiceSource(Component enemy, string name, AudioClip clip, string subtitle = null, bool shouldInterrupt = false, Color? subtitleColor = null, bool randomPitch = false, float spatialBlend = 1f, float volumeMult = 1f)
		{
			//IL_00c2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c8: Expected O, but got Unknown
			//IL_00e0: Unknown result type (might be due to invalid IL or missing references)
			if ((Object)(object)enemy == (Object)null || (Object)(object)clip == (Object)null)
			{
				return null;
			}
			if (((Object)enemy.gameObject).name.Contains("Big Johninator"))
			{
				return null;
			}
			EnemyIdentifier val = default(EnemyIdentifier);
			if (enemy.gameObject.TryGetComponent<EnemyIdentifier>(ref val) && val.puppet)
			{
				return null;
			}
			if (!shouldInterrupt)
			{
				if (!CheckGlobalCooldown())
				{
					return null;
				}
				if (IsEnemyVoicePlaying(enemy))
				{
					return null;
				}
			}
			else
			{
				InterruptVoices(enemy);
			}
			lastVoiceTime = Time.time;
			GameObject val2 = new GameObject("UltraVoice_" + name);
			val2.transform.SetParent(enemy.transform);
			val2.transform.localPosition = Vector3.zero;
			AudioSource val3 = val2.AddComponent<AudioSource>();
			val3.clip = clip;
			val3.spatialBlend = spatialBlend;
			val3.volume = 1f;
			val3.volume *= volumeMult;
			val3.minDistance = 50f;
			val3.maxDistance = 200f;
			val3.dopplerLevel = 0.25f;
			if (randomPitch)
			{
				val3.pitch = Random.Range(0.95f, 1.05f);
			}
			AudioMixerController instance = MonoSingleton<AudioMixerController>.Instance;
			if ((Object)(object)instance != (Object)null)
			{
				val3.outputAudioMixerGroup = instance.allGroup;
			}
			val3.Play();
			Color? subtitleColor2 = GetSubtitleColor(enemy, subtitleColor);
			if (!string.IsNullOrEmpty(subtitle))
			{
				ShowSubtitle(subtitle, val3, subtitleColor2);
			}
			Object.Destroy((Object)(object)val2, clip.length + 1f);
			return val3;
		}

		public static void PlayRandomVoice(Component enemy, string enemyName, AudioClip[] clips, string[] subtitles, bool interrupt = false, bool randomPitch = false, float volumeMult = 1f, Color? colorOverride = null)
		{
			if (clips != null && clips.Length != 0)
			{
				int num = Random.Range(0, clips.Length);
				string subtitle = null;
				if (subtitles != null && num < subtitles.Length)
				{
					subtitle = subtitles[num];
				}
				CreateVoiceSource(enemy, enemyName, clips[num], subtitle, interrupt, colorOverride, randomPitch, volumeMult);
			}
		}

		public static void ShowSubtitle(string text, AudioSource src, Color? color = null)
		{
			//IL_002d: Unknown result type (might be due to invalid IL or missing references)
			if (!string.IsNullOrEmpty(text))
			{
				if (color.HasValue)
				{
					string text2 = "<color=#" + ColorUtility.ToHtmlStringRGB(color.Value) + ">" + text + "</color>";
					MonoSingleton<SubtitleController>.Instance.DisplaySubtitle(text2, src, false);
				}
				else
				{
					MonoSingleton<SubtitleController>.Instance.DisplaySubtitle(text, src, false);
				}
			}
		}

		public static void InterruptVoices(Component enemy)
		{
			//IL_0016: Unknown result type (might be due to invalid IL or missing references)
			//IL_001c: Expected O, but got Unknown
			foreach (Transform item in enemy.transform)
			{
				Transform val = item;
				if (((Object)val).name.StartsWith("UltraVoice_"))
				{
					Object.Destroy((Object)(object)((Component)val).gameObject);
				}
			}
		}
	}
	public static class WavUtility
	{
		public static AudioClip ToAudioClip(byte[] fileBytes, string name = "AudioClip")
		{
			using (MemoryStream memoryStream = new MemoryStream(fileBytes))
			{
				using BinaryReader binaryReader = new BinaryReader(memoryStream);
				string text = new string(binaryReader.ReadChars(4));
				if (text != "RIFF")
				{
					return null;
				}
				binaryReader.ReadInt32();
				string text2 = new string(binaryReader.ReadChars(4));
				if (text2 != "WAVE")
				{
					return null;
				}
				int num = 0;
				int num2 = 0;
				int num3 = 0;
				while (memoryStream.Position < memoryStream.Length)
				{
					string text3 = new string(binaryReader.ReadChars(4));
					int num4 = binaryReader.ReadInt32();
					if (text3 == "fmt ")
					{
						binaryReader.ReadInt16();
						num = binaryReader.ReadInt16();
						num2 = binaryReader.ReadInt32();
						binaryReader.ReadInt32();
						binaryReader.ReadInt16();
						int num5 = binaryReader.ReadInt16();
						num3 = num5 / 8;
						if (num4 > 16)
						{
							binaryReader.ReadBytes(num4 - 16);
						}
						continue;
					}
					if (text3 == "data")
					{
						int num6 = num4 / num3 / num;
						float[] array = new float[num6 * num];
						for (int i = 0; i < num6 * num; i++)
						{
							switch (num3)
							{
							case 2:
							{
								short num7 = binaryReader.ReadInt16();
								array[i] = (float)num7 / 32768f;
								break;
							}
							case 1:
							{
								byte b = binaryReader.ReadByte();
								array[i] = (float)(b - 128) / 128f;
								break;
							}
							}
						}
						AudioClip val = AudioClip.Create(name, num6, num, num2, false);
						val.SetData(array, 0);
						return val;
					}
					binaryReader.ReadBytes(num4);
				}
			}
			return null;
		}
	}
}
namespace UltraVoice.Patches
{
	[HarmonyPatch(typeof(SubtitleController), "DisplaySubtitle", new Type[]
	{
		typeof(string),
		typeof(AudioSource),
		typeof(bool)
	})]
	public static class SubtitleLimitPatch
	{
		public static void Prefix(SubtitleController __instance)
		{
			int value = UltraVoicePlugin.SubtitleLimit.value;
			Transform container = __instance.container;
			if ((Object)(object)container == (Object)null)
			{
				return;
			}
			int num = 0;
			for (int i = 0; i < container.childCount; i++)
			{
				Subtitle component = ((Component)container.GetChild(i)).GetComponent<Subtitle>();
				if ((Object)(object)component != (Object)null && ((Component)component).gameObject.activeInHierarchy)
				{
					num++;
				}
			}
			while (num >= value)
			{
				Subtitle val = null;
				int num2 = int.MaxValue;
				for (int j = 0; j < container.childCount; j++)
				{
					Transform child = container.GetChild(j);
					Subtitle component2 = ((Component)child).GetComponent<Subtitle>();
					if (!((Object)(object)component2 == (Object)null) && ((Component)child).gameObject.activeInHierarchy)
					{
						int siblingIndex = child.GetSiblingIndex();
						if (siblingIndex < num2)
						{
							num2 = siblingIndex;
							val = component2;
						}
					}
				}
				if ((Object)(object)val == (Object)null)
				{
					break;
				}
				Transform parent = ((Component)val).transform.parent;
				Object.Destroy((Object)(object)((Component)val).gameObject);
				num--;
				if ((Object)(object)parent != (Object)null)
				{
					ForceRebuildContainerLayout(parent);
				}
			}
		}

		public static void Postfix(string caption, AudioSource audioSource, bool ignoreSetting, SubtitleController __instance)
		{
			if ((Object)(object)audioSource == (Object)null)
			{
				return;
			}
			Transform container = __instance.container;
			if ((Object)(object)container == (Object)null)
			{
				return;
			}
			Subtitle val = null;
			for (int num = container.childCount - 1; num >= 0; num--)
			{
				Subtitle component = ((Component)container.GetChild(num)).GetComponent<Subtitle>();
				if ((Object)(object)component != (Object)null)
				{
					val = component;
					break;
				}
			}
			if (!((Object)(object)val == (Object)null) && (Object)(object)((Component)val).GetComponent<SubtitleAudioWatcher>() == (Object)null)
			{
				SubtitleAudioWatcher subtitleAudioWatcher = ((Component)val).gameObject.AddComponent<SubtitleAudioWatcher>();
				subtitleAudioWatcher.source = audioSource;
				subtitleAudioWatcher.controller = __instance;
			}
		}

		public static void ForceRebuildContainerLayout(Transform container)
		{
			RectTransform val = (RectTransform)(((object)((container is RectTransform) ? container : null)) ?? ((object)((Component)container).GetComponent<RectTransform>()));
			if ((Object)(object)val != (Object)null)
			{
				LayoutRebuilder.ForceRebuildLayoutImmediate(val);
			}
		}
	}
	public class SubtitleAudioWatcher : MonoBehaviour
	{
		public AudioSource source;

		public SubtitleController controller;

		private Subtitle subtitle;

		private CanvasGroup group;

		private float fadeOutSpeed;

		private bool triggered;

		private Coroutine waitCoroutine;

		private const float WaitBeforeFade = 2f;

		private const float FallbackFadeDuration = 0.6f;

		private void Awake()
		{
			subtitle = ((Component)this).GetComponent<Subtitle>();
			group = subtitle.group ?? ((Component)subtitle).GetComponent<CanvasGroup>();
			fadeOutSpeed = subtitle.fadeOutSpeed;
		}

		private void OnDestroy()
		{
			if (waitCoroutine != null)
			{
				((MonoBehaviour)this).StopCoroutine(waitCoroutine);
			}
		}

		private void Update()
		{
			if (!triggered && ((Object)(object)source == (Object)null || !source.isPlaying))
			{
				triggered = true;
				int num = CountActiveSubtitles();
				int value = UltraVoicePlugin.SubtitleLimit.value;
				if (num > value)
				{
					Transform parent = ((Component)subtitle).transform.parent;
					Object.Destroy((Object)(object)((Component)subtitle).gameObject);
					SubtitleLimitPatch.ForceRebuildContainerLayout(parent);
					Object.Destroy((Object)(object)this);
				}
				else
				{
					waitCoroutine = ((MonoBehaviour)this).StartCoroutine(WaitThenFade());
				}
			}
		}

		private IEnumerator WaitThenFade()
		{
			float elapsed = 0f;
			while (elapsed < 2f)
			{
				int active = CountActiveSubtitles();
				int max = UltraVoicePlugin.SubtitleLimit.value;
				if (active > max)
				{
					Transform parent = ((Component)subtitle).transform.parent;
					Object.Destroy((Object)(object)((Component)subtitle).gameObject);
					SubtitleLimitPatch.ForceRebuildContainerLayout(parent);
					Object.Destroy((Object)(object)this);
					yield break;
				}
				if ((Object)(object)source != (Object)null && source.isPlaying)
				{
					triggered = false;
					yield break;
				}
				elapsed += Time.deltaTime;
				yield return null;
			}
			if ((Object)(object)subtitle == (Object)null)
			{
				Object.Destroy((Object)(object)this);
			}
			else
			{
				yield return ((MonoBehaviour)this).StartCoroutine(FadeOutAndDestroy());
			}
		}

		private int CountActiveSubtitles()
		{
			Transform container = controller.container;
			if ((Object)(object)container != (Object)null)
			{
				int num = 0;
				for (int i = 0; i < container.childCount; i++)
				{
					Subtitle component = ((Component)container.GetChild(i)).GetComponent<Subtitle>();
					if ((Object)(object)component != (Object)null && ((Component)component).gameObject.activeInHierarchy)
					{
						num++;
					}
				}
				return num;
			}
			Subtitle[] array = Object.FindObjectsOfType<Subtitle>();
			int num2 = 0;
			Subtitle[] array2 = array;
			foreach (Subtitle val in array2)
			{
				if ((Object)(object)val != (Object)null && ((Component)val).gameObject.activeInHierarchy)
				{
					num2++;
				}
			}
			return num2;
		}

		private IEnumerator FadeOutAndDestroy()
		{
			if ((Object)(object)group == (Object)null)
			{
				Transform parent = ((Component)subtitle).transform.parent;
				Object.Destroy((Object)(object)((Component)subtitle).gameObject);
				SubtitleLimitPatch.ForceRebuildContainerLayout(parent);
				Object.Destroy((Object)(object)this);
				yield break;
			}
			float startAlpha = Mathf.Clamp01(group.alpha);
			float duration = 0.6f;
			if (fadeOutSpeed > 1E-05f)
			{
				duration = Mathf.Max(0.01f, startAlpha / fadeOutSpeed);
			}
			if (duration <= 0.0001f)
			{
				Transform p = ((Component)subtitle).transform.parent;
				Object.Destroy((Object)(object)((Component)subtitle).gameObject);
				SubtitleLimitPatch.ForceRebuildContainerLayout(p);
				Object.Destroy((Object)(object)this);
				yield break;
			}
			float t = 0f;
			while (t < duration)
			{
				t += Time.deltaTime;
				group.alpha = Mathf.Lerp(startAlpha, 0f, t / duration);
				yield return null;
			}
			group.alpha = 0f;
			controller.NotifyHoldEnd(subtitle);
			Transform parentAfter = ((Component)subtitle).transform.parent;
			Object.Destroy((Object)(object)((Component)subtitle).gameObject);
			SubtitleLimitPatch.ForceRebuildContainerLayout(parentAfter);
			Object.Destroy((Object)(object)this);
		}
	}
}
namespace UltraVoice.Characters
{
	public class CerberusCharacter
	{
		public static AudioClip PreludeClip;

		public static AudioClip[] AwakenClips;

		public static AudioClip[] EnrageClips;

		public static AudioClip[] ThrowClips;

		public static AudioClip[] StompClips;

		public static AudioClip[] TackleClips;

		public static AudioClip[] DeathClips;

		public static readonly string[] AwakenSubs = new string[6] { "Who dares awaken me", "You will go no further", "Your story ends here", "Your defiance shall be punished", "Be gone, or be destroyed", "You stand condemned" };

		public static readonly string[] EnrageSubs = new string[4] { "You will regret crossing me", "Your arrogance will cost you", "I will avenge my brother", "This shall not go unpunished" };

		public static readonly string[] ThrowSubs = new string[2] { "Perish", "Die" };

		public static readonly string[] StompSubs = new string[2] { "Tremble", "Fall" };

		public static readonly string[] TackleSubs = new string[2] { "Face me", "You cannot run" };

		public static void LoadVoiceLines(ManualLogSource logger)
		{
			PreludeClip = UltraVoicePlugin.LoadClip("Cerberus.cerb_WakeUpSpecial.wav");
			AwakenClips = (AudioClip[])(object)new AudioClip[6]
			{
				UltraVoicePlugin.LoadClip("Cerberus.cerb_WakeUp1.wav"),
				UltraVoicePlugin.LoadClip("Cerberus.cerb_WakeUp2.wav"),
				UltraVoicePlugin.LoadClip("Cerberus.cerb_WakeUp3.wav"),
				UltraVoicePlugin.LoadClip("Cerberus.cerb_WakeUp4.wav"),
				UltraVoicePlugin.LoadClip("Cerberus.cerb_WakeUp5.wav"),
				UltraVoicePlugin.LoadClip("Cerberus.cerb_WakeUp6.wav")
			};
			EnrageClips = (AudioClip[])(object)new AudioClip[4]
			{
				UltraVoicePlugin.LoadClip("Cerberus.cerb_Enrage1.wav"),
				UltraVoicePlugin.LoadClip("Cerberus.cerb_Enrage2.wav"),
				UltraVoicePlugin.LoadClip("Cerberus.cerb_Enrage3.wav"),
				UltraVoicePlugin.LoadClip("Cerberus.cerb_Enrage4.wav")
			};
			ThrowClips = (AudioClip[])(object)new AudioClip[2]
			{
				UltraVoicePlugin.LoadClip("Cerberus.cerb_Orb1.wav"),
				UltraVoicePlugin.LoadClip("Cerberus.cerb_Orb2.wav")
			};
			StompClips = (AudioClip[])(object)new AudioClip[2]
			{
				UltraVoicePlugin.LoadClip("Cerberus.cerb_Stomp1.wav"),
				UltraVoicePlugin.LoadClip("Cerberus.cerb_Stomp2.wav")
			};
			TackleClips = (AudioClip[])(object)new AudioClip[2]
			{
				UltraVoicePlugin.LoadClip("Cerberus.cerb_Tackle1.wav"),
				UltraVoicePlugin.LoadClip("Cerberus.cerb_Tackle2.wav")
			};
			DeathClips = (AudioClip[])(object)new AudioClip[3]
			{
				UltraVoicePlugin.LoadClip("Cerberus.cerb_Death1.wav"),
				UltraVoicePlugin.LoadClip("Cerberus.cerb_Death2.wav"),
				UltraVoicePlugin.LoadClip("Cerberus.cerb_Death3.wav")
			};
			logger.LogInfo((object)"Cerberus voice lines loaded successfully!");
		}
	}
	[HarmonyPatch(typeof(StatueFake), "SlowStart")]
	internal class CerberusIntroPatch
	{
		private static void Postfix(StatueFake __instance)
		{
			if (!__instance.quickSpawn && UltraVoicePlugin.CerberusVoiceEnabled.value)
			{
				((MonoBehaviour)UltraVoicePlugin.Instance).StartCoroutine(PlayIntro(__instance));
			}
		}

		private static IEnumerator PlayIntro(StatueFake cerb)
		{
			yield return (object)new WaitForSeconds(3.5f);
			AudioClip clip = CerberusCharacter.PreludeClip;
			if (!((Object)(object)clip == (Object)null))
			{
				GameObject obj = new GameObject("UltraVoice_CerberusIntro");
				obj.transform.position = ((Component)cerb).transform.position;
				AudioSource src = obj.AddComponent<AudioSource>();
				src.clip = clip;
				src.spatialBlend = 1f;
				src.volume = 1f;
				src.minDistance = 50f;
				src.maxDistance = 500f;
				src.dopplerLevel = 0f;
				AudioMixerController mixer = MonoSingleton<AudioMixerController>.Instance;
				src.outputAudioMixerGroup = mixer.allGroup;
				src.Play();
				if (!((Object)(object)src == (Object)null))
				{
					VoiceManager.ShowSubtitle("You tread forbidden ground, machine", src, (Color?)new Color(0.65f, 0.65f, 0.65f));
					yield return (object)new WaitForSeconds(3.75f);
					VoiceManager.ShowSubtitle("BEGONE", src, (Color?)new Color(0.65f, 0.65f, 0.65f));
				}
			}
		}
	}
	[HarmonyPatch(typeof(StatueFake), "Activate")]
	internal class CerberusWakePatch
	{
		private static void Postfix(StatueFake __instance)
		{
			if (__instance.quickSpawn && UltraVoicePlugin.CerberusVoiceEnabled.value && VoiceManager.CheckCooldown((Component)(object)__instance, 3f))
			{
				VoiceManager.enemySpawnTimes[(Component)(object)__instance] = Time.time;
				((MonoBehaviour)UltraVoicePlugin.Instance).StartCoroutine(PlayAwaken(__instance));
			}
		}

		private static IEnumerator PlayAwaken(StatueFake cerb)
		{
			yield return (object)new WaitForSeconds(Random.Range(0f, 1f));
			int i = Random.Range(0, CerberusCharacter.AwakenClips.Length);
			AudioClip clip = CerberusCharacter.AwakenClips[i];
			if (!((Object)(object)clip == (Object)null))
			{
				GameObject obj = new GameObject("UltraVoice_CerberusIntro");
				obj.transform.position = ((Component)cerb).transform.position;
				AudioSource src = obj.AddComponent<AudioSource>();
				src.clip = clip;
				src.spatialBlend = 1f;
				src.volume = 1f;
				src.minDistance = 50f;
				src.maxDistance = 500f;
				src.dopplerLevel = 0f;
				AudioMixerController mixer = MonoSingleton<AudioMixerController>.Instance;
				src.outputAudioMixerGroup = mixer.allGroup;
				src.Play();
				if (!((Object)(object)src == (Object)null))
				{
					VoiceManager.ShowSubtitle(CerberusCharacter.AwakenSubs[i], src, (Color?)new Color(0.65f, 0.65f, 0.65f));
				}
			}
		}
	}
	[HarmonyPatch(typeof(StatueBoss), "Start")]
	internal class CerberusSpawnTracker
	{
		private static void Postfix(StatueBoss __instance)
		{
			VoiceManager.enemySpawnTimes[(Component)(object)__instance] = Time.time;
		}
	}
	[HarmonyPatch(typeof(StatueBoss), "Enrage")]
	internal class CerberusEnragePatch
	{
		private static void Postfix(StatueBoss __instance)
		{
			if (UltraVoicePlugin.CerberusVoiceEnabled.value)
			{
				((MonoBehaviour)UltraVoicePlugin.Instance).StartCoroutine(PlayEnrage(__instance));
			}
			static IEnumerator PlayEnrage(StatueBoss cerb)
			{
				yield return (object)new WaitForSeconds(Random.Range(0f, 0.4f));
				VoiceManager.PlayRandomVoice((Component)(object)cerb, "Cerberus", CerberusCharacter.EnrageClips, CerberusCharacter.EnrageSubs, interrupt: false, randomPitch: true);
			}
		}
	}
	[HarmonyPatch(typeof(StatueBoss), "Throw")]
	internal class CerberusThrowPatch
	{
		private static void Postfix(StatueBoss __instance)
		{
			if (UltraVoicePlugin.CerberusVoiceEnabled.value && !VoiceManager.IsSpawnVoicePlaying((Component)(object)__instance) && VoiceManager.CheckCooldown((Component)(object)__instance, 3f))
			{
				((MonoBehaviour)UltraVoicePlugin.Instance).StartCoroutine(PlayThrowVoice(__instance));
			}
		}

		private static IEnumerator PlayThrowVoice(StatueBoss cerberus)
		{
			yield return (object)new WaitForSeconds(0.2f);
			VoiceManager.PlayRandomVoice((Component)(object)cerberus, "Cerberus", CerberusCharacter.ThrowClips, CerberusCharacter.ThrowSubs, interrupt: false, randomPitch: true);
		}
	}
	[HarmonyPatch(typeof(StatueBoss), "Stomp")]
	internal class CerberusStompPatch
	{
		private static void Postfix(StatueBoss __instance)
		{
			if (UltraVoicePlugin.CerberusVoiceEnabled.value && !VoiceManager.IsSpawnVoicePlaying((Component)(object)__instance) && VoiceManager.CheckCooldown((Component)(object)__instance, 3f))
			{
				((MonoBehaviour)UltraVoicePlugin.Instance).StartCoroutine(PlayStompVoice(__instance));
			}
		}

		private static IEnumerator PlayStompVoice(StatueBoss cerberus)
		{
			yield return (object)new WaitForSeconds(0.2f);
			VoiceManager.PlayRandomVoice((Component)(object)cerberus, "Cerberus", CerberusCharacter.StompClips, CerberusCharacter.StompSubs, interrupt: false, randomPitch: true);
		}
	}
	[HarmonyPatch(typeof(StatueBoss), "Tackle")]
	internal class CerberusTacklePatch
	{
		private static void Postfix(StatueBoss __instance)
		{
			if (UltraVoicePlugin.CerberusVoiceEnabled.value && !VoiceManager.IsSpawnVoicePlaying((Component)(object)__instance) && VoiceManager.CheckCooldown((Component)(object)__instance, 3f))
			{
				((MonoBehaviour)UltraVoicePlugin.Instance).StartCoroutine(PlayTackleVoice(__instance));
			}
		}

		private static IEnumerator PlayTackleVoice(StatueBoss cerberus)
		{
			yield return (object)new WaitForSeconds(0.2f);
			VoiceManager.PlayRandomVoice((Component)(object)cerberus, "Cerberus", CerberusCharacter.TackleClips, CerberusCharacter.TackleSubs, interrupt: false, randomPitch: true);
		}
	}
	[HarmonyPatch(typeof(StatueBoss), "OnGoLimp")]
	internal class CerberusDeathPatch
	{
		private static void Postfix(StatueBoss __instance)
		{
			if (UltraVoicePlugin.CerberusVoiceEnabled.value && CerberusCharacter.DeathClips != null && CerberusCharacter.DeathClips.Length != 0)
			{
				VoiceManager.PlayRandomVoice((Component)(object)__instance, "Cerberus", CerberusCharacter.DeathClips, null, interrupt: true, randomPitch: true);
			}
		}
	}
	public class EarthmoverCharacter
	{
		public static AudioClip IntroClip;

		public static AudioClip BloodVentClip;

		public static AudioClip DefenseSystemClip;

		public static AudioClip BloodFloodClip;

		public static AudioClip BrainBattleClip;

		public static AudioClip BrainKilledClip;

		public static float lastBloodFloodTime;

		public static float lastBrainBattleTime;

		public static float lastSelfDestructTime;

		public static void LoadVoiceLines(ManualLogSource logger)
		{
			IntroClip = UltraVoicePlugin.LoadClip("Earthmover.em_Intro.wav");
			BloodVentClip = UltraVoicePlugin.LoadClip("Earthmover.em_BloodVent.wav");
			DefenseSystemClip = UltraVoicePlugin.LoadClip("Earthmover.em_DefenseSystem.wav");
			BloodFloodClip = UltraVoicePlugin.LoadClip("Earthmover.em_BloodFlood.wav");
			BrainBattleClip = UltraVoicePlugin.LoadClip("Earthmover.em_BrainBattle.wav");
			BrainKilledClip = UltraVoicePlugin.LoadClip("Earthmover.em_BrainKilled.wav");
			logger.LogInfo((object)"Earthmover voice lines loaded successfully!");
		}
	}
	[HarmonyPatch(typeof(AudioSource))]
	internal class EarthmoverPlayerDetectedPatch
	{
		private static IEnumerable<MethodBase> TargetMethods()
		{
			return from method in AccessTools.GetDeclaredMethods(typeof(AudioSource))
				where !method.IsStatic && method.Name.Contains("Play")
				select method;
		}

		private static void Postfix(AudioSource __instance)
		{
			//IL_0046: Unknown result type (might be due to invalid IL or missing references)
			//IL_004b: Unknown result type (might be due to invalid IL or missing references)
			if (UltraVoicePlugin.EarthmoverVoiceEnabled.value && VoiceManager.CheckCooldown((Component)(object)__instance, 0.1f) && !((Object)(object)__instance == (Object)null) && !((Object)(object)__instance.clip == (Object)null))
			{
				Scene activeScene = SceneManager.GetActiveScene();
				if (!(((Scene)(ref activeScene)).name != "6e981b1865c649749a610aafc471e198") && ((Object)__instance.clip).name == "Centaur A-1")
				{
					((MonoBehaviour)UltraVoicePlugin.Instance).StartCoroutine(Detected());
				}
			}
			static IEnumerator Detected()
			{
				yield return (object)new WaitForSeconds(1f);
				AudioSource src = VoiceManager.CreateVoiceSource((Component)(object)MonoSingleton<NewMovement>.Instance, "Earthmover_Intro", EarthmoverCharacter.IntroClip, "MULTIPLE MACHINE SIGNATURES PRESENT ON RADAR", shouldInterrupt: true, null, randomPitch: false, 0f, 6f);
				yield return (object)new WaitForSeconds(3f);
				VoiceManager.ShowSubtitle("THREAT LEVEL: MAXIMAL", src);
				yield return (object)new WaitForSeconds(1.5f);
				VoiceManager.ShowSubtitle("READYING WEAPONS", src);
			}
		}
	}
	[HarmonyPatch(typeof(Crossfade), "StartFade")]
	internal class EarthmoverBloodVentPatch
	{
		private static void Postfix(Crossfade __instance)
		{
			//IL_0028: 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)
			if (UltraVoicePlugin.EarthmoverVoiceEnabled.value && VoiceManager.CheckCooldown((Component)(object)__instance, 0.1f))
			{
				Scene activeScene = SceneManager.GetActiveScene();
				if (!(((Scene)(ref activeScene)).name != "6e981b1865c649749a610aafc471e198") && ((Object)__instance.to.clip).name == "Centaur A-2")
				{
					((MonoBehaviour)UltraVoicePlugin.Instance).StartCoroutine(BloodVent());
				}
			}
			static IEnumerator BloodVent()
			{
				yield return (object)new WaitForSeconds(0.5f);
				AudioSource src = VoiceManager.CreateVoiceSource((Component)(object)MonoSingleton<NewMovement>.Instance, "Earthmover_BloodVent", EarthmoverCharacter.BloodVentClip, "CONTAMINATED BLOOD DETECTED IN FUEL TANK B", shouldInterrupt: true, null, randomPitch: false, 0f, 6f);
				yield return (object)new WaitForSeconds(3.25f);
				VoiceManager.ShowSubtitle("OPENING VENTS", src);
			}
		}
	}
	[HarmonyPatch(typeof(CombinedBossBar), "OnEnable")]
	internal class EarthmoverDefenseSystemPatch
	{
		private static void Postfix(CombinedBossBar __instance)
		{
			//IL_0028: 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)
			if (UltraVoicePlugin.EarthmoverVoiceEnabled.value && VoiceManager.CheckCooldown((Component)(object)__instance, 0.1f))
			{
				Scene activeScene = SceneManager.GetActiveScene();
				if (!(((Scene)(ref activeScene)).name != "6e981b1865c649749a610aafc471e198") && ((Object)__instance).name == "SecuritySystem")
				{
					((MonoBehaviour)UltraVoicePlugin.Instance).StartCoroutine(DefenseSystem());
				}
			}
			static IEnumerator DefenseSystem()
			{
				yield return (object)new WaitForSeconds(0.1f);
				AudioSource src = VoiceManager.CreateVoiceSource((Component)(object)MonoSingleton<NewMovement>.Instance, "Earthmover_DefenseSystem", EarthmoverCharacter.DefenseSystemClip, "UNAUTHORIZED PERSONNEL DETECTED AT INTERIOR ENTRANCE", shouldInterrupt: true, null, randomPitch: false, 0f, 6f);
				yield return (object)new WaitForSeconds(3.75f);
				VoiceManager.ShowSubtitle("ENGAGING DEFENSE SYSTEM", src);
			}
		}
	}
	[HarmonyPatch(typeof(GameObject), "SetActive")]
	internal class EarthmoverBloodFloodPatch
	{
		private static void Postfix(GameObject __instance)
		{
			//IL_0017: Unknown result type (might be due to invalid IL or missing references)
			//IL_001c: Unknown result type (might be due to invalid IL or missing references)
			if (!UltraVoicePlugin.EarthmoverVoiceEnabled.value)
			{
				return;
			}
			Scene activeScene = SceneManager.GetActiveScene();
			if (((Scene)(ref activeScene)).name != "6e981b1865c649749a610aafc471e198" || (Object)(object)__instance == (Object)null || !(((Object)__instance).name == "SecondBeats") || Time.time - EarthmoverCharacter.lastBloodFloodTime < 0.1f)
			{
				return;
			}
			Transform val = __instance.transform.Find("Alarm");
			if (!((Object)(object)val == (Object)null))
			{
				AudioSource component = ((Component)val).GetComponent<AudioSource>();
				if (!((Object)(object)component == (Object)null) && component.isPlaying)
				{
					EarthmoverCharacter.lastBloodFloodTime = Time.time;
					((MonoBehaviour)UltraVoicePlugin.Instance).StartCoroutine(BloodFlood());
				}
			}
			static IEnumerator BloodFlood()
			{
				AudioSource src = VoiceManager.CreateVoiceSource((Component)(object)MonoSingleton<NewMovement>.Instance, "Earthmover_BloodFlood", EarthmoverCharacter.BloodFloodClip, "UNAUTHORIZED PERSONNEL HAS BREACHED INTERIOR ENTRANCE", shouldInterrupt: true, null, randomPitch: false, 0f, 6f);
				yield return (object)new WaitForSeconds(2.75f);
				VoiceManager.ShowSubtitle("FLUSHING INTERIOR", src);
			}
		}
	}
	[HarmonyPatch(typeof(GameObject), "SetActive")]
	internal class EarthmoverBrainBattlePatch
	{
		private static void Postfix(GameObject __instance)
		{
			//IL_0035: Unknown result type (might be due to invalid IL or missing references)
			//IL_003a: Unknown result type (might be due to invalid IL or missing references)
			if (UltraVoicePlugin.EarthmoverVoiceEnabled.value && !((Object)(object)__instance == (Object)null) && __instance.activeSelf)
			{
				Scene activeScene = SceneManager.GetActiveScene();
				if (!(((Scene)(ref activeScene)).name != "6e981b1865c649749a610aafc471e198") && ((Object)__instance).name == "Beams" && ((Object)__instance.transform.parent.parent).name == "LaserRing" && !(Time.time - EarthmoverCharacter.lastBrainBattleTime < 0.1f))
				{
					EarthmoverCharacter.lastBrainBattleTime = Time.time;
					((MonoBehaviour)UltraVoicePlugin.Instance).StartCoroutine(BrainBattle());
				}
			}
			static IEnumerator BrainBattle()
			{
				AudioSource src = VoiceManager.CreateVoiceSource((Component)(object)MonoSingleton<NewMovement>.Instance, "Earthmover_BrainBattle", EarthmoverCharacter.BrainBattleClip, "UNAUTHORIZED PERSONNEL HAS BREACHED CENTRAL CONTROL TOWER", shouldInterrupt: true, null, randomPitch: false, 0f, 6f);
				yield return (object)new WaitForSeconds(3f);
				VoiceManager.ShowSubtitle("ENGAGING DEFENSE PROTOCOLS", src);
			}
		}
	}
	[HarmonyPatch(typeof(GameObject), "SetActive")]
	internal class EarthmoverSelfDestructPatch
	{
		private static void Postfix(GameObject __instance)
		{
			//IL_002f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0034: Unknown result type (might be due to invalid IL or missing references)
			if (!((Object)(object)__instance == (Object)null) && __instance.activeSelf && UltraVoicePlugin.EarthmoverVoiceEnabled.value)
			{
				Scene activeScene = SceneManager.GetActiveScene();
				if (!(((Scene)(ref activeScene)).name != "6e981b1865c649749a610aafc471e198") && ((Object)__instance).name == "Countdown" && !(Time.time - EarthmoverCharacter.lastSelfDestructTime < 0.1f))
				{
					EarthmoverCharacter.lastSelfDestructTime = Time.time;
					((MonoBehaviour)UltraVoicePlugin.Instance).StartCoroutine(SelfDestruct());
				}
			}
			static IEnumerator SelfDestruct()
			{
				yield return (object)new WaitForSeconds(0.25f);
				AudioSource src = VoiceManager.CreateVoiceSource((Component)(object)MonoSingleton<NewMovement>.Instance, "Earthmover_SelfDestruct", EarthmoverCharacter.BrainKilledClip, "CRITICAL DAMAGE DETECTED IN CENTRAL CONTROL TOWER!", shouldInterrupt: true, null, randomPitch: false, 0f, 6f);
				yield return (object)new WaitForSeconds(3.25f);
				VoiceManager.ShowSubtitle("SELF-DESTRUCT SEQUENCE INITIATED!", src);
				yield return (object)new WaitForSeconds(2.25f);
				VoiceManager.ShowSubtitle("ALL PERSONNEL EVACUATE IMMEDIATELY!", src);
			}
		}
	}
	public class FerrymanCharacter
	{
		public static AudioClip BossIntroClip;

		public static AudioClip CoinSkipClip;

		public static AudioClip CoinFightClip;

		public static AudioClip PhaseChangeClip;

		public static AudioClip ApproachClip;

		public static AudioClip AgonisIntroClip;

		public static AudioClip RudrakshaIntroClip;

		public static AudioClip AgonisDownedClip;

		public static AudioClip RudrakshaDownedClip;

		public static AudioClip[] SpawnClips;

		public static AudioClip[] ChatterClips;

		public static AudioClip[] DeathClips;

		public static readonly string[] ChatterSubs = new string[4] { "Have at you!", "Come on!", "Come at me!", "Try me!" };

		public static readonly string[] SpawnSubs = new string[5] { "Another soul to face my wrath.", "If you seek death, you have found it.", "You are not the first. You will not be the last.", "I have no mercy left to give.", "I grow weary of your kind." };

		public static bool FerrymanCoinTossed = false;

		public static bool FerrymanPhaseChangePlayed = false;

		public static bool IsAgonisOrRudraksha(Ferryman ferryman)
		{
			if ((Object)(object)ferryman == (Object)null)
			{
				return false;
			}
			Transform val = ((Component)ferryman).transform;
			while ((Object)(object)val != (Object)null)
			{
				if (((Object)val).name.Contains("10S - Secret Arena"))
				{
					return true;
				}
				val = val.parent;
			}
			return false;
		}

		public static bool IsAgonis(Ferryman ferryman)
		{
			if (!IsAgonisOrRudraksha(ferryman))
			{
				return false;
			}
			EnemyIdentifier component = ((Component)ferryman).GetComponent<EnemyIdentifier>();
			return component.mirrorOnly;
		}

		public static bool IsRudraksha(Ferryman ferryman)
		{
			if (!IsAgonisOrRudraksha(ferryman))
			{
				return false;
			}
			EnemyIdentifier component = ((Component)ferryman).GetComponent<EnemyIdentifier>();
			return !component.mirrorOnly;
		}

		public static void LoadVoiceLines(ManualLogSource logger)
		{
			BossIntroClip = UltraVoicePlugin.LoadClip("Ferryman.ferry_FightStarted.wav");
			CoinSkipClip = UltraVoicePlugin.LoadClip("Ferryman.Ferry_CoinSkip.wav");
			CoinFightClip = UltraVoicePlugin.LoadClip("Ferryman.ferry_CoinFight.wav");
			PhaseChangeClip = UltraVoicePlugin.LoadClip("Ferryman.ferry_PhaseChange.wav");
			ApproachClip = UltraVoicePlugin.LoadClip("Ferryman.ferry_Approach.wav");
			AgonisIntroClip = UltraVoicePlugin.LoadClip("Ferryman.ferry_SpawnSpecialAgonis.wav");
			RudrakshaIntroClip = UltraVoicePlugin.LoadClip("Ferryman.ferry_SpawnSpecialRudraksha.wav");
			AgonisDownedClip = UltraVoicePlugin.LoadClip("Ferryman.ferry_DownedAgonis.wav");
			RudrakshaDownedClip = UltraVoicePlugin.LoadClip("Ferryman.ferry_DownedRudraksha.wav");
			SpawnClips = (AudioClip[])(object)new AudioClip[5]
			{
				UltraVoicePlugin.LoadClip("Ferryman.ferry_Spawn1.wav"),
				UltraVoicePlugin.LoadClip("Ferryman.ferry_Spawn2.wav"),
				UltraVoicePlugin.LoadClip("Ferryman.ferry_Spawn3.wav"),
				UltraVoicePlugin.LoadClip("Ferryman.ferry_Spawn4.wav"),
				UltraVoicePlugin.LoadClip("Ferryman.ferry_Spawn5.wav")
			};
			ChatterClips = (AudioClip[])(object)new AudioClip[4]
			{
				UltraVoicePlugin.LoadClip("Ferryman.Ferry_Chatter1.wav"),
				UltraVoicePlugin.LoadClip("Ferryman.Ferry_Chatter2.wav"),
				UltraVoicePlugin.LoadClip("Ferryman.Ferry_Chatter3.wav"),
				UltraVoicePlugin.LoadClip("Ferryman.Ferry_Chatter4.wav")
			};
			DeathClips = (AudioClip[])(object)new AudioClip[3]
			{
				UltraVoicePlugin.LoadClip("Ferryman.ferry_Death1.wav"),
				UltraVoicePlugin.LoadClip("Ferryman.ferry_Death2.wav"),
				UltraVoicePlugin.LoadClip("Ferryman.ferry_Death3.wav")
			};
			logger.LogInfo((object)"Ferryman voice lines loaded successfully!");
		}
	}
	[HarmonyPatch(typeof(Ferryman), "Start")]
	internal class FerrymanSpawnPatch
	{
		private static void Postfix(Ferryman __instance)
		{
			//IL_003e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0043: Unknown result type (might be due to invalid IL or missing references)
			if (!UltraVoicePlugin.FerrymanVoiceEnabled.value || (Object)(object)__instance == (Object)null)
			{
				return;
			}
			VoiceManager.enemySpawnTimes[(Component)(object)__instance] = Time.time;
			FerrymanCharacter.FerrymanPhaseChangePlayed = false;
			Scene activeScene = SceneManager.GetActiveScene();
			if (((Scene)(ref activeScene)).name == "e964cf0ffaa9e0e4e940b5c738983796")
			{
				if (FerrymanCharacter.FerrymanCoinTossed)
				{
					((MonoBehaviour)UltraVoicePlugin.Instance).StartCoroutine(PlayCoin(__instance));
					VoiceManager.enemySpawnTimes[(Component)(object)__instance] = Time.time;
					VoiceManager.spawnVoiceEndTimes[(Component)(object)__instance] = Time.time + FerrymanCharacter.CoinFightClip.length;
				}
				else
				{
					((MonoBehaviour)UltraVoicePlugin.Instance).StartCoroutine(PlayNoCoin(__instance));
					VoiceManager.enemySpawnTimes[(Component)(object)__instance] = Time.time;
					VoiceManager.spawnVoiceEndTimes[(Component)(object)__instance] = Time.time + FerrymanCharacter.BossIntroClip.length;
				}
			}
			else if (!FerrymanCharacter.IsAgonisOrRudraksha(__instance))
			{
				VoiceManager.PlayRandomVoice((Component)(object)__instance, "Ferryman", FerrymanCharacter.SpawnClips, FerrymanCharacter.SpawnSubs, interrupt: false, randomPitch: true);
			}
			else if (FerrymanCharacter.IsAgonis(__instance))
			{
				VoiceManager.CreateVoiceSource((Component)(object)__instance, "Ferryman", FerrymanCharacter.AgonisIntroClip);
			}
			else if (FerrymanCharacter.IsRudraksha(__instance))
			{
				VoiceManager.CreateVoiceSource((Component)(object)__instance, "Ferryman", FerrymanCharacter.RudrakshaIntroClip, "Leave us alone!");
			}
			static IEnumerator PlayCoin(Ferryman ferry)
			{
				AudioSource src = VoiceManager.CreateVoiceSource((Component)(object)ferry, "FerrymanIntro", FerrymanCharacter.CoinFightClip);
				VoiceManager.spawnVoiceEndTimes[(Component)(object)ferry] = Time.time + FerrymanCharacter.CoinFightClip.length;
				if (!((Object)(object)src == (Object)null) && Object.op_Implicit((Object)(object)src))
				{
					VoiceManager.ShowSubtitle("You WRETCH", src, (Color?)new Color(0f, 0.66f, 0.77f));
					yield return (object)new WaitForSeconds(1.5f);
					if (Object.op_Implicit((Object)(object)src))
					{
						VoiceManager.ShowSubtitle("I granted you passage, and you repay me with DECEIT!?", src, (Color?)new Color(0f, 0.66f, 0.77f));
					}
				}
			}
			static IEnumerator PlayNoCoin(Ferryman ferry)
			{
				AudioSource src = VoiceManager.CreateVoiceSource((Component)(object)ferry, "FerrymanIntro", FerrymanCharacter.BossIntroClip, null, shouldInterrupt: true);
				if (!((Object)(object)src == (Object)null) && Object.op_Implicit((Object)(object)src))
				{
					VoiceManager.ShowSubtitle("Gabriel warned me of your kind", src, (Color?)new Color(0f, 0.66f, 0.77f));
					yield return (object)new WaitForSeconds(2.75f);
					if (Object.op_Implicit((Object)(object)src))
					{
						VoiceManager.ShowSubtitle("I will not share his failure", src, (Color?)new Color(0f, 0.66f, 0.77f));
					}
				}
			}
		}
	}
	[HarmonyPatch(typeof(FerrymanFake), "CoinCatch")]
	internal class FerrymanCoinDetectedPatch
	{
		private static void Postfix(FerrymanFake __instance)
		{
			if (UltraVoicePlugin.FerrymanVoiceEnabled.value)
			{
				FerrymanCharacter.FerrymanCoinTossed = true;
				((MonoBehaviour)UltraVoicePlugin.Instance).StartCoroutine(Play(__instance));
			}
			static IEnumerator Play(FerrymanFake ferry)
			{
				yield return (object)new WaitForSeconds(0.25f);
				AudioSource src = VoiceManager.CreateVoiceSource((Component)(object)ferry, "FerrymanSkip", FerrymanCharacter.CoinSkipClip, "Hm?", shouldInterrupt: true);
				if (!((Object)(object)src == (Object)null))
				{
					yield return (object)new WaitForSeconds(1.5f);
					if (Object.op_Implicit((Object)(object)src))
					{
						VoiceManager.ShowSubtitle("This shall do", src, (Color?)new Color(0f, 0.66f, 0.77f));
						yield return (object)new WaitForSeconds(1.5f);
						if (Object.op_Implicit((Object)(object)src))
						{
							VoiceManager.ShowSubtitle("You may pass", src, (Color?)new Color(0f, 0.66f, 0.77f));
						}
					}
				}
			}
		}
	}
	[HarmonyPatch(typeof(Ferryman), "Update")]
	internal class FerrymanChatterPatch
	{
		private static void Postfix(Ferryman __instance)
		{
			if (UltraVoicePlugin.FerrymanVoiceEnabled.value && !BlindEnemies.Blind && !((Object)(object)__instance == (Object)null) && !((Object)(object)__instance.currentWindup != (Object)null) && VoiceManager.CheckCooldown((Component)(object)__instance, 6f) && !FerrymanCharacter.IsAgonis(__instance) && !VoiceManager.TooSoonAfterSpawn((Component)(object)__instance, 3f) && !(Random.Range(0f, 1f) < 0.75f))
			{
				VoiceManager.PlayRandomVoice((Component)(object)__instance, "Ferryman", FerrymanCharacter.ChatterClips, FerrymanCharacter.ChatterSubs, interrupt: false, randomPitch: true);
			}
		}
	}
	[HarmonyPatch(typeof(Ferryman), "PhaseChange")]
	internal class FerrymanPhaseChangePatch
	{
		private static void Postfix(Ferryman __instance)
		{
			if (UltraVoicePlugin.FerrymanVoiceEnabled.value && !((Object)(object)__instance == (Object)null) && !FerrymanCharacter.IsAgonisOrRudraksha(__instance) && !VoiceManager.TooSoonAfterSpawn((Component)(object)__instance, 0.25f) && !FerrymanCharacter.FerrymanPhaseChangePlayed)
			{
				((MonoBehaviour)UltraVoicePlugin.Instance).StartCoroutine(PlayPhaseChange(__instance));
			}
			static IEnumerator PlayPhaseChange(Ferryman ferry)
			{
				new WaitForSeconds(0.1f);
				AudioSource src = VoiceManager.CreateVoiceSource((Component)(object)ferry, "FerrymanPhase", FerrymanCharacter.PhaseChangeClip, null, shouldInterrupt: true);
				FerrymanCharacter.FerrymanPhaseChangePlayed = true;
				yield return (object)new WaitForSeconds(1.5f);
				VoiceManager.ShowSubtitle("I am not finished with you!", src, (Color?)new Color(0f, 0.66f, 0.77f));
			}
		}
	}
	[HarmonyPatch(typeof(Ferryman), "OnDeath")]
	internal class FerrymanDeathPatch
	{
		private static void Prefix(Ferryman __instance)
		{
			if (UltraVoicePlugin.FerrymanVoiceEnabled.value && !FerrymanCharacter.IsAgonis(__instance))
			{
				VoiceManager.PlayRandomVoice((Component)(object)__instance, "Ferryman", FerrymanCharacter.DeathClips, null, interrupt: true, randomPitch: true);
			}
		}
	}
	[HarmonyPatch(typeof(Ferryman), "Knockdown")]
	internal class FerrymanKnockdownSpecialPatch
	{
		private static void Postfix(Ferryman __instance)
		{
			if (UltraVoicePlugin.FerrymanVoiceEnabled.value)
			{
				if (FerrymanCharacter.IsAgonis(__instance))
				{
					VoiceManager.CreateVoiceSource((Component)(object)__instance, "Ferryman", FerrymanCharacter.AgonisDownedClip);
				}
				else if (FerrymanCharacter.IsRudraksha(__instance))
				{
					((MonoBehaviour)UltraVoicePlugin.Instance).StartCoroutine(PlayDownedRudraksha(__instance));
				}
			}
			static IEnumerator PlayDownedRudraksha(Ferryman ferry)
			{
				new WaitForSeconds(0.1f);
				AudioSource src = VoiceManager.CreateVoiceSource((Component)(object)ferry, "FerrymanDowned", FerrymanCharacter.RudrakshaDownedClip, null, shouldInterrupt: true);
				yield return (object)new WaitForSeconds(1.5f);
				VoiceManager.ShowSubtitle("No, not now...", src, (Color?)new Color(0f, 0.66f, 0.77f));
			}
		}
	}
	[HarmonyPatch(typeof(FerrymanFake), "Update")]
	internal class FerrymanFakeProximityPatch
	{
		private static void Postfix(FerrymanFake __instance)
		{
			//IL_0054: Unknown result type (might be due to invalid IL or missing references)
			//IL_005f: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b0: Unknown result type (might be due to invalid IL or missing references)
			if (UltraVoicePlugin.FerrymanVoiceEnabled.value && !((Object)(object)__instance == (Object)null) && MonoSingleton<StatsManager>.Instance.restarts <= 0)
			{
				NewMovement instance = MonoSingleton<NewMovement>.Instance;
				int instanceID = ((Object)__instance).GetInstanceID();
				float num = Vector3.Distance(((Component)__instance).transform.position, ((Component)instance).transform.position);
				if (!(num > 60f) && VoiceManager.CheckCooldown((Component)(object)__instance, 999f))
				{
					VoiceManager.CreateVoiceSource((Component)(object)__instance, "FerrymanApproach", FerrymanCharacter.ApproachClip, "Who goes there?", shouldInterrupt: false, (Color?)new Color(0f, 0.66f, 0.77f), randomPitch: false, 1f, 1f);
				}
			}
		}
	}
	public class FilthCharacter
	{
		public static AudioClip[] ChatterClips;

		public static AudioClip AttackClip;

		public static AudioClip DeathClip;

		public static void LoadVoiceLines(ManualLogSource logger)
		{
			ChatterClips = (AudioClip[])(object)new AudioClip[3]
			{
				UltraVoicePlugin.LoadClip("Filth.fil_Chatter1.wav"),
				UltraVoicePlugin.LoadClip("Filth.fil_Chatter1.wav"),
				UltraVoicePlugin.LoadClip("Filth.fil_Chatter1.wav")
			};
			AttackClip = UltraVoicePlugin.LoadClip("Filth.fil_Attack.wav");
			DeathClip = UltraVoicePlugin.LoadClip("Filth.fil_Death.wav");
			logger.LogInfo((object)"Filth voice lines loaded successfully!");
		}
	}
	[HarmonyPatch(typeof(ZombieMelee), "Swing")]
	internal class FilthAttackPatch
	{
		private static void Postfix(ZombieMelee __instance)
		{
			if (UltraVoicePlugin.FilthVoiceEnabled.value)
			{
				VoiceManager.CreateVoiceSource((Component)(object)__instance, "Filth", FilthCharacter.AttackClip, null, shouldInterrupt: false, null, randomPitch: true);
			}
		}
	}
	[HarmonyPatch(typeof(ZombieMelee), "JumpAttack")]
	internal class FilthJumpAttackPatch
	{
		private static void Postfix(ZombieMelee __instance)
		{
			if (UltraVoicePlugin.FilthVoiceEnabled.value)
			{
				VoiceManager.CreateVoiceSource((Component)(object)__instance, "Filth", FilthCharacter.DeathClip, null, shouldInterrupt: false, null, randomPitch: true);
			}
		}
	}
	[HarmonyPatch(typeof(ZombieMelee), "OnGoLimp")]
	internal class FilthDeathPatch
	{
		private static void Postfix(ZombieMelee __instance)
		{
			if (UltraVoicePlugin.FilthVoiceEnabled.value)
			{
				VoiceManager.CreateVoiceSource((Component)(object)__instance, "Filth", FilthCharacter.AttackClip, null, shouldInterrupt: false, null, randomPitch: true);
			}
		}
	}
	[HarmonyPatch(typeof(ZombieMelee), "Update")]
	internal class FilthChatterPatch
	{
		private static void Postfix(ZombieMelee __instance)
		{
			if (UltraVoicePlugin.FilthVoiceEnabled.value && !BlindEnemies.Blind && VoiceManager.CheckCooldown((Component)(object)__instance, 4f) && !(Random.Range(0f, 1f) < 0.75f))
			{
				VoiceManager.PlayRandomVoice((Component)(object)__instance, "Filth", FilthCharacter.ChatterClips, null, interrupt: false, randomPitch: true);
			}
		}
	}
	public class GeryonCharacter
	{
		public static AudioClip IntroClip;

		public static AudioClip RestartClip;

		public static AudioClip EnrageClip;

		public static AudioClip DeathClip;

		public static AudioClip BigPainClip;

		public static AudioClip RecoverClip;

		public static AudioClip[] ChatterClips;

		public static AudioClip[] OverheatClips;

		public static readonly string[] ChatterSubs = new string[9] { "IT MUST NOT PREVAIL!", "IT CANNOT ESCAPE US!", "NO ONE WILL SAVE YOU!", "RIP IT TO PIECES!", "CRUSH IT TO DUST!", "MORE BLOOD FOR US!", "WHY DO YOU PERSIST?", "ACCEPT YOUR END.", "SUCH POINTLESS RESISTANCE." };

		public static readonly string[] OverheatSubs = new string[3] { "HOLD TOGETHER! HOLD TOGETHER!", "TOO MUCH! TOO MUCH!", "CALM DOWN! CALM DOWN!" };

		public static bool EnrageLinePlayed = false;

		public static bool RestartedFight = false;

		public static bool CanRestartFight = false;

		public static void LoadVoiceLines(ManualLogSource logger)
		{
			IntroClip = UltraVoicePlugin.LoadClip("Geryon.ger_Intro.wav");
			RestartClip = UltraVoicePlugin.LoadClip("Geryon.ger_Respawn.wav");
			EnrageClip = UltraVoicePlugin.LoadClip("Geryon.ger_Enrage.wav");
			DeathClip = UltraVoicePlugin.LoadClip("Geryon.ger_Death.wav");
			BigPainClip = UltraVoicePlugin.LoadClip("Geryon.ger_BigPain.wav");
			RecoverClip = UltraVoicePlugin.LoadClip("Geryon.ger_Recover.wav");
			ChatterClips = (AudioClip[])(object)new AudioClip[9]
			{
				UltraVoicePlugin.LoadClip("Geryon.ger_Chatter1.wav"),
				UltraVoicePlugin.LoadClip("Geryon.ger_Chatter2.wav"),
				UltraVoicePlugin.LoadClip("Geryon.ger_Chatter3.wav"),
				UltraVoicePlugin.LoadClip("Geryon.ger_Chatter4.wav"),
				UltraVoicePlugin.LoadClip("Geryon.ger_Chatter5.wav"),
				UltraVoicePlugin.LoadClip("Geryon.ger_Chatter6.wav"),
				UltraVoicePlugin.LoadClip("Geryon.ger_Chatter7.wav"),
				UltraVoicePlugin.LoadClip("Geryon.ger_Chatter8.wav"),
				UltraVoicePlugin.LoadClip("Geryon.ger_Chatter9.wav")
			};
			OverheatClips = (AudioClip[])(object)new AudioClip[3]
			{
				UltraVoicePlugin.LoadClip("Geryon.ger_Overheat1.wav"),
				UltraVoicePlugin.LoadClip("Geryon.ger_Overheat2.wav"),
				UltraVoicePlugin.LoadClip("Geryon.ger_Overheat3.wav")
			};
			logger.LogInfo((object)"Geryon voice lines loaded successfully!");
		}
	}
	[HarmonyPatch(typeof(Geryon), "Start")]
	internal class GeryonIntroPatch
	{
		private static void Postfix(Geryon __instance)
		{
			if (UltraVoicePlugin.GeryonVoiceEnabled.value)
			{
				GeryonCharacter.EnrageLinePlayed = false;
				GeryonCharacter.CanRestartFight = true;
				VoiceManager.enemySpawnTimes[(Component)(object)__instance] = Time.time;
				if (!GeryonCharacter.RestartedFight)
				{
					((MonoBehaviour)UltraVoicePlugin.Instance).StartCoroutine(PlayIntro(__instance));
				}
				else
				{
					((MonoBehaviour)UltraVoicePlugin.Instance).StartCoroutine(PlayRestart(__instance));
				}
			}
			static IEnumerator PlayIntro(Geryon geryon)
			{
				if (geryon.active)
				{
					AudioSource src = VoiceManager.CreateVoiceSource((Component)(object)geryon, "Geryon", GeryonCharacter.IntroClip, "FOOLISH...");
					if (geryon.active)
					{
						yield return (object)new WaitForSeconds(1f);
						VoiceManager.ShowSubtitle("OR BRAVE?", src);
						if (geryon.active)
						{
							yield return (object)new WaitForSeconds(1.25f);
							VoiceManager.ShowSubtitle("IT MATTERS NOT...", src);
							if (geryon.active)
							{
								yield return (object)new WaitForSeconds(1.25f);
								VoiceManager.ShowSubtitle("FOR WE SHALL STRIKE YOU DOWN!", src);
							}
						}
					}
				}
			}
			static IEnumerator PlayRestart(Geryon geryon)
			{
				if (geryon.active)
				{
					AudioSource src = VoiceManager.CreateVoiceSource((Component)(object)geryon, "Geryon", GeryonCharacter.RestartClip, "IT REAPPEARS...");
					if (geryon.active)
					{
						yield return (object)new WaitForSeconds(1.25f);
						VoiceManager.ShowSubtitle("IT WANTS MORE?", src);
						if (geryon.active)
						{
							yield return (object)new WaitForSeconds(1.5f);
							VoiceManager.ShowSubtitle("THEN MORE IT SHALL RECEIVE!", src);
						}
					}
				}
			}
		}
	}
	[HarmonyPatch(typeof(StatsManager), "Restart")]
	internal class GeryonRestartPatch
	{
		private static void Postfix(StatsManager __instance)
		{
			if (UltraVoicePlugin.GeryonVoiceEnabled.value && GeryonCharacter.CanRestartFight)
			{
				GeryonCharacter.RestartedFight = true;
			}
		}
	}
	[HarmonyPatch(typeof(Geryon), "Stun")]
	internal class GeryonOverheatPatch
	{
		private static void Postfix(Geryon __instance)
		{
			if (UltraVoicePlugin.GeryonVoiceEnabled.value)
			{
				VoiceManager.InterruptVoices((Component)(object)__instance);
				((MonoBehaviour)UltraVoicePlugin.Instance).StartCoroutine(PlayOverheat(__instance));
			}
			static IEnumerator PlayOverheat(Geryon geryon)
			{
				VoiceManager.CreateVoiceSource((Component)(object)geryon, "Geryon", GeryonCharacter.BigPainClip, null, shouldInterrupt: true);
				yield return (object)new WaitForSeconds(1f);
				VoiceManager.PlayRandomVoice((Component)(object)geryon, "Geryon", GeryonCharacter.OverheatClips, GeryonCharacter.OverheatSubs, interrupt: true);
			}
		}
	}
	[HarmonyPatch(typeof(Geryon), "Update")]
	internal class GeryonChatterPatch
	{
		private static void Postfix(Geryon __instance)
		{
			if (UltraVoicePlugin.GeryonVoiceEnabled.value && VoiceManager.CheckCooldown((Component)(object)__instance, 6f) && !VoiceManager.TooSoonAfterSpawn((Component)(object)__instance, 6f) && !__instance.stunned && __instance.active && Random.Range(0f, 1f) < 0.75f)
			{
				VoiceManager.PlayRandomVoice((Component)(object)__instance, "Geryon", GeryonCharacter.ChatterClips, GeryonCharacter.ChatterSubs);
			}
		}
	}
	[HarmonyPatch(typeof(GameObject), "SetActive")]
	internal class GeryonDeathPatch
	{
		private static void Postfix(GameObject __instance, bool value)
		{
			if (UltraVoicePlugin.GeryonVoiceEnabled.value && !(((Object)__instance).name != "Geryon_Rig") && !(((Object)__instance.transform.parent).name != "Theatre (1)"))
			{
				((MonoBehaviour)UltraVoicePlugin.Instance).StartCoroutine(PlayDeath(__instance));
			}
			static IEnumerator PlayDeath(GameObject geryon)
			{
				yield return (object)new WaitForSeconds(0.2f);
				VoiceManager.CreateVoiceSource(geryon.GetComponent(typeof(Animator)), "Geryon", GeryonCharacter.DeathClip, null, shouldInterrupt: true);
			}
		}
	}
	[HarmonyPatch(typeof(Geryon), "Death")]
	internal class GeryonFallPatch
	{
		private static void Postfix(Geryon __instance)
		{
			if (UltraVoicePlugin.GeryonVoiceEnabled.value)
			{
				VoiceManager.CreateVoiceSource((Component)(object)__instance, "Geryon", GeryonCharacter.BigPainClip, null, shouldInterrupt: true);
			}
		}
	}
	[HarmonyPatch(typeof(Geryon), "Unstun")]
	internal class GeryonEnragePatch
	{
		private static void Postfix(Geryon __instance)
		{
			if (UltraVoicePlugin.GeryonVoiceEnabled.value)
			{
				if (!__instance.secondPhase)
				{
					VoiceManager.CreateVoiceSource((Component)(object)__instance, "Geryon", GeryonCharacter.RecoverClip, null, shouldInterrupt: true);
				}
				else if (__instance.secondPhase && !GeryonCharacter.EnrageLinePlayed)
				{
					((MonoBehaviour)UltraVoicePlugin.Instance).StartCoroutine(PlayEnrage(__instance));
				}
				else
				{
					VoiceManager.CreateVoiceSource((Component)(object)__instance, "Geryon", GeryonCharacter.RecoverClip, null, shouldInterrupt: true);
				}
			}
			static IEnumerator PlayEnrage(Geryon geryon)
			{
				VoiceManager.CreateVoiceSource((Component)(object)geryon, "Geryon", GeryonCharacter.RecoverClip, null, shouldInterrupt: true);
				yield return (object)new WaitForSeconds(0.75f);
				if (geryon.active)
				{
					AudioSource src = VoiceManager.CreateVoiceSource((Component)(object)geryon, "Geryon", GeryonCharacter.EnrageClip, "INSUFFERABLE...", shouldInterrupt: true);
					GeryonCharacter.EnrageLinePlayed = true;
					if (geryon.active)
					{
						yield return (object)new WaitForSeconds(1.25f);
						VoiceManager.ShowSubtitle("INFURIATING!", src);
						if (geryon.active)
						{
							yield return (object)new WaitForSeconds(1.25f);
							VoiceManager.ShowSubtitle("DIE!", src);
						}
					}
				}
			}
		}
	}
	public class GuttermanCharacter
	{
		public static AudioClip[] SpawnClips;

		public static AudioClip[] ShieldBreakClips;

		public static AudioClip[] EnrageClips;

		public static AudioClip[] DeathClips;

		public static AudioClip[] ParryClips;

		public static AudioClip[] PunchClips;

		public static readonly string[] SpawnSubs = new string[6] { "THIS WILL NOT TAKE LONG.", "WHO MUST I KILL TODAY?", "IT IS TIME TO KILL.", "FOR THE MOTHERLAND!", "SAY YOUR PRAYERS.", "ЗА РОДИНУ!" };

		public static readonly string[] ShieldBreakSubs = new string[3] { "SHIELD DOWN!", "SHIELD BROKEN!", "SHIELD DESTROYED!" };

		public static readonly string[] EnrageSubs = new string[5] { "THAT COST MONEY!", "YOU WILL PAY FOR THIS!", "OH, YOU MAKE ME SO MAD…", "ЧЁРТ ПОБЕРИ!", "СУКИН СЫН!" };

		public static void LoadVoiceLines(ManualLogSource logger)
		{
			SpawnClips = (AudioClip[])(object)new AudioClip[6]
			{
				UltraVoicePlugin.LoadClip("Gutterman.gm_Spawn1.wav"),
				UltraVoicePlugin.LoadClip("Gutterman.gm_Spawn2.wav"),
				UltraVoicePlugin.LoadClip("Gutterman.gm_Spawn3.wav"),
				UltraVoicePlugin.LoadClip("Gutterman.gm_Spawn4.wav"),
				UltraVoicePlugin.LoadClip("Gutterman.gm_Spawn5.wav"),
				UltraVoicePlugin.LoadClip("Gutterman.gm_Spawn6.wav")
			};
			PunchClips = (AudioClip[])(object)new AudioClip[3]
			{
				UltraVoicePlugin.LoadClip("Gutterman.gm_Punch1.wav"),
				UltraVoicePlugin.LoadClip("Gutterman.gm_Punch2.wav"),
				UltraVoicePlugin.LoadClip("Gutterman.gm_Punch3.wav")
			};
			ShieldBreakClips = (AudioClip[])(object)new AudioClip[3]
			{
				UltraVoicePlugin.LoadClip("Gutterman.gm_GuardBreak1.wav"),
				UltraVoicePlugin.LoadClip("Gutterman.gm_GuardBreak2.wav"),
				UltraVoicePlugin.LoadClip("Gutterman.gm_GuardBreak3.wav")
			};
			EnrageClips = (AudioClip[])(object)new AudioClip[5]
			{
				UltraVoicePlugin.LoadClip("Gutterman.gm_Enrage1.wav"),
				UltraVoicePlugin.LoadClip("Gutterman.gm_Enrage2.wav"),
				UltraVoicePlugin.LoadClip("Gutterman.gm_Enrage3.wav"),
				UltraVoicePlugin.LoadClip("Gutterman.gm_Enrage4.wav"),
				UltraVoicePlugin.LoadClip("Gutterman.gm_Enrage5.wav")
			};
			DeathClips = (AudioClip[])(object)new AudioClip[3]
			{
				UltraVoicePlugin.LoadClip("Gutterman.gm_Death1.wav"),
				UltraVoicePlugin.LoadClip("Gutterman.gm_Death2.wav"),
				UltraVoicePlugin.LoadClip("Gutterman.gm_Death3.wav")
			};
			ParryClips = (AudioClip[])(object)new AudioClip[3]
			{
				UltraVoicePlugin.LoadClip("Gutterman.gm_Parry1.wav"),
				UltraVoicePlugin.LoadClip("Gutterman.gm_Parry2.wav"),
				UltraVoicePlugin.LoadClip("Gutterman.gm_Parry3.wav")
			};
			logger.LogInfo((object)"Gutterman voice lines loaded successfully!");
		}
	}
	[HarmonyPatch(typeof(Gutterman), "Start")]
	internal class GuttermanSpawnPatch
	{
		private static void Postfix(Gutterman __instance)
		{
			if (UltraVoicePlugin.GuttermanVoiceEnabled.value && !__instance.dead)
			{
				VoiceManager.enemySpawnTimes[(Component)(object)__instance] = Time.time;
				VoiceManager.PlayRandomVoice((Component)(object)__instance, "Gutterman", GuttermanCharacter.SpawnClips, GuttermanCharacter.SpawnSubs, interrupt: false, randomPitch: true);
			}
		}
	}
	[HarmonyPatch(typeof(Gutterman), "ShieldBreak")]
	internal class GuttermanShieldBreakPatch
	{
		private static void Postfix(Gutterman __instance)
		{
			if (UltraVoicePlugin.GuttermanVoiceEnabled.value)
			{
				if (__instance.enraged)
				{
					VoiceManager.PlayRandomVoice((Component)(object)__instance, "Gutterman", GuttermanCharacter.EnrageClips, GuttermanCharacter.EnrageSubs, interrupt: true, randomPitch: true);
				}
				else
				{
					VoiceManager.PlayRandomVoice((Component)(object)__instance, "Gutterman", GuttermanCharacter.ShieldBreakClips, GuttermanCharacter.ShieldBreakSubs, interrupt: true, randomPitch: true);
				}
			}
		}
	}
	[HarmonyPatch(typeof(Gutterman), "Death")]
	internal class GuttermanDeathPatch
	{
		private static void Postfix(Gutterman __instance)
		{
			if (UltraVoicePlugin.GuttermanVoiceEnabled.value)
			{
				VoiceManager.PlayRandomVoice((Component)(object)__instance, "Gutterman", GuttermanCharacter.DeathClips, null, interrupt: true, randomPitch: true);
			}
		}
	}
	[HarmonyPatch(typeof(Gutterman), "GotParried")]
	internal class GuttermanParryPatch
	{
		private static void Postfix(Gutterman __instance)
		{
			if (UltraVoicePlugin.GuttermanVoiceEnabled.value && VoiceManager.CheckCooldown((Component)(object)__instance, 3f))
			{
				VoiceManager.PlayRandomVoice((Component)(object)__instance, "Gutterman", GuttermanCharacter.ParryClips, null, interrupt: true, randomPitch: true);
			}
		}
	}
	[HarmonyPatch(typeof(Gutterman), "ShieldBash")]
	internal class GuttermanShieldBashPatch
	{
		private static void Postfix(Gutterman __instance)
		{
			if (UltraVoicePlugin.GuttermanVoiceEnabled.value)
			{
				VoiceManager.PlayRandomVoice((Component)(object)__instance, "Gutterman", GuttermanCharacter.PunchClips, null, interrupt: false, randomPitch: true);
			}
		}
	}
	public class GuttertankCharacter
	{
		public static AudioClip[] SpawnClips;

		public static AudioClip[] AttackClips;

		public static AudioClip[] LandmineClips;

		public static AudioClip[] PunchClips;

		public static AudioClip[] PunchHitClips;

		public static AudioClip[] FrustratedClips;

		public static AudioClip[] DeathClips;

		public static AudioClip[] TripPainClips;

		public static readonly string[] SpawnSubs = new string[4] { "WEAPONS ONLINE.", "READY FOR COMBAT.", "ENGAGING PROTOCOLS.", "ALL SYSTEMS OPERATIONAL." };

		public static readonly string[] AttackSubs = new string[3] { "FIRE!", "SHOOT!", "SCHIEẞEN!" };

		public static readonly string[] LandmineSubs = new string[3] { "WATCH YOUR STEP.", "HOPPER IS DOWN.", "HÜPFER IST DA." };

		public static readonly string[] PunchHitSubs = new string[3] { "DIRECT HIT.", "HIT CONFIRMED.", "TRY THAT AGAIN." };

		public static readonly string[] FrustratedSubs = new string[4] { "DAMN IT!", "VERDAMMT!", "UGH, MY HEAD…", "SCHEIẞE!" };

		public static bool GuttertankSpawnInMirror = false;

		public static void LoadVoiceLines(ManualLogSource logger)
		{
			SpawnClips = (AudioClip[])(object)new AudioClip[4]
			{
				UltraVoicePlugin.LoadClip("Guttertank.gt_Spawn1.wav"),
				UltraVoicePlugin.LoadClip("Guttertank.gt_Spawn2.wav"),
				UltraVoicePlugin.LoadClip("Guttertank.gt_Spawn3.wav"),
				UltraVoicePlugin.LoadClip("Guttertank.gt_Spawn4.wav")
			};
			AttackClips = (AudioClip[])(object)new AudioClip[3]
			{
				UltraVoicePlugin.LoadClip("Guttertank.gt_Attack1.wav"),
				UltraVoicePlugin.LoadClip("Guttertank.gt_Attack2.wav"),
				UltraVoicePlugin.LoadClip("Guttertank.gt_Attack3.wav")
			};
			LandmineClips = (AudioClip[])(object)new AudioClip[3]
			{
				UltraVoicePlugin.LoadClip("Guttertank.gt_Landmine1.wav"),
				UltraVoicePlugin.LoadClip("Guttertank.gt_Landmine2.wav"),
				UltraVoicePlugin.LoadClip("Guttertank.gt_Landmine3.wav")
			};
			PunchClips = (AudioClip[])(object)new AudioClip[3]
			{
				UltraVoicePlugin.LoadClip("Guttertank.gt_Punch1.wav"),
				UltraVoicePlugin.LoadClip("Guttertank.gt_Punch2.wav"),
				UltraVoicePlugin.LoadClip("Guttertank.gt_Punch3.wav")
			};
			PunchHitClips = (AudioClip[])(object)new AudioClip[3]
			{
				UltraVoicePlugin.LoadClip("Guttertank.gt_PunchHit1.wav"),
				UltraVoicePlugin.LoadClip("Guttertank.gt_PunchHit2.wav"),
				UltraVoicePlugin.LoadClip("Guttertank.gt_PunchHit3.wav")
			};
			FrustratedClips = (AudioClip[])(object)new AudioClip[4]
			{
				UltraVoicePlugin.LoadClip("Guttertank.gt_PunchTrip1.wav"),
				UltraVoicePlugin.LoadClip("Guttertank.gt_PunchTrip2.wav"),
				UltraVoicePlugin.LoadClip("Guttertank.gt_PunchTrip3.wav"),
				UltraVoicePlugin.LoadClip("Guttertank.gt_PunchTrip4.wav")
			};
			DeathClips = (AudioClip[])(object)new AudioClip[3]
			{
				UltraVoicePlugin.LoadClip("Guttertank.gt_Death1.wav"),
				UltraVoicePlugin.LoadClip("Guttertank.gt_Death2.wav"),
				UltraVoicePlugin.LoadClip("Guttertank.gt_Death3.wav")
			};
			TripPainClips = (AudioClip[])(object)new AudioClip[3]
			{
				UltraVoicePlugin.LoadClip("Guttertank.gt_TripPain1.wav"),
				UltraVoicePlugin.LoadClip("Guttertank.gt_TripPain2.wav"),
				UltraVoicePlugin.LoadClip("Guttertank.gt_TripPain3.wav")
			};
			logger.LogInfo((object)"Guttertank voice lines loaded successfully!");
		}
	}
	[HarmonyPatch(typeof(Guttertank), "Start")]
	internal class GuttertankSpawnPatch
	{
		private static void Postfix(Guttertank __instance)
		{
			//IL_0039: Unknown result type (might be due to invalid IL or missing references)
			//IL_003e: Unknown result type (might be due to invalid IL or missing references)
			if (!UltraVoicePlugin.GuttertankVoiceEnabled.value || (Object)(object)__instance == (Object)null)
			{
				return;
			}
			Scene activeScene = SceneManager.GetActiveScene();
			if (((Scene)(ref activeScene)).name == "45addc6c3730dae418321e00af1116c5" && !GuttertankCharacter.GuttertankSpawnInMirror)
			{
				GuttertankCharacter.GuttertankSpawnInMirror = true;
				VoiceManager.enemySpawnTimes[(Component)(object)__instance] = Time.time;
				return;
			}
			VoiceManager.enemySpawnTimes[(Component)(object)__instance] = Time.time;
			((MonoBehaviour)UltraVoicePlugin.Instance).StartCoroutine(UltraVoicePlugin.DelayedVox(delegate
			{
				VoiceManager.PlayRandomVoice((Component)(object)__instance, "Guttertank", GuttertankCharacter.SpawnClips, GuttertankCharacter.SpawnSubs);
			}, () => GuttertankCharacter.SpawnClips != null && GuttertankCharacter.SpawnClips.Length != 0, (Component)(object)__instance));
		}
	}
	[HarmonyPatch(typeof(Guttertank), "TargetBeenHit")]
	internal class GuttertankPunchHitPatch
	{
		private static void Postfix(Guttertank __instance)
		{
			if (UltraVoicePlugin.GuttertankVoiceEnabled.value && !((Object)(object)__instance == (Object)null) && (double)Random.Range(0f, 1f) < 0.75)
			{
				((MonoBehaviour)UltraVoicePlugin.Instance).StartCoroutine(UltraVoicePlugin.DelayedVox(delegate
				{
					VoiceManager.PlayRandomVoice((Component)(object)__instance, "Guttertank", GuttertankCharacter.PunchHitClips, GuttertankCharacter.PunchHitSubs);
				}, () => GuttertankCharacter.PunchHitClips != null && GuttertankCharacter.PunchHitClips.Length != 0, (Component)(object)__instance));
			}
		}
	}
	[HarmonyPatch(typeof(Guttertank), "PlaceMine")]
	internal class GuttertankLandminePatch
	{
		private static void Postfix(Guttertank __instance)
		{
			if (UltraVoicePlugin.GuttertankVoiceEnabled.value && !((Object)(object)__instance == (Object)null) && (double)Random.Range(0f, 1f) < 0.5)
			{
				((MonoBehaviour)UltraVoicePlugin.Instance).StartCoroutine(UltraVoicePlugin.DelayedVox(delegate
				{
					VoiceManager.PlayRandomVoice((Component)(object)__instance, "Guttertank", GuttertankCharacter.LandmineClips, GuttertankCharacter.LandmineSubs);
				}, () => GuttertankCharacter.LandmineClips != null && GuttertankCharacter.LandmineClips.Length != 0, (Component)(object)__instance));
			}
		}
	}
	[HarmonyPatch(typeof(Guttertank), "FireRocket")]
	internal class GuttertankRocketPatch
	{
		private static void Postfix(Guttertank __instance)
		{
			if (UltraVoicePlugin.GuttertankVoiceEnabled.value && !((Object)(object)__instance == (Object)null) && (double)Random.Range(0f, 1f) < 0.5)
			{
				((MonoBehaviour)UltraVoicePlugin.Instance).StartCoroutine(UltraVoicePlugin.DelayedVox(delegate
				{
					VoiceManager.PlayRandomVoice((Component)(object)__instance, "Guttertank", GuttertankCharacter.AttackClips, GuttertankCharacter.AttackSubs);
				}, () => GuttertankCharacter.AttackClips != null && GuttertankCharacter.AttackClips.Length != 0, (Component)(object)__instance));
			}
		}
	}
	[HarmonyPatch(typeof(Guttertank), "Punch")]
	internal class GuttertankPunchPatch
	{
		private static void Postfix(Guttertank __instance)
		{
			if (UltraVoicePlugin.GuttertankVoiceEnabled.value && !((Object)(object)__instance == (Object)null))
			{
				((MonoBehaviour)UltraVoicePlugin.Instance).StartCoroutine(UltraVoicePlugin.DelayedVox(delegate
				{
					VoiceManager.PlayRandomVoice((Component)(object)__instance, "Guttertank", GuttertankCharacter.PunchClips, null);
				}, () => GuttertankCharacter.PunchClips != null && GuttertankCharacter.PunchClips.Length != 0, (Component)(object)__instance));
			}
		}
	}
	[HarmonyPatch(typeof(Guttertank), "FallImpact")]
	internal class GuttertankFallImpactPatch
	{
		private static void Postfix(Guttertank __instance)
		{
			if (UltraVoicePlugin.GuttertankVoiceEnabled.value)
			{
				((MonoBehaviour)UltraVoicePlugin.Instance).StartCoroutine(UltraVoicePlugin.DelayedVox(delegate
				{
					VoiceManager.PlayRandomVoice((Component)(object)__instance, "Guttertank", GuttertankCharacter.TripPainClips, null, interrupt: true);
				}, () => GuttertankCharacter.TripPainClips != null && GuttertankCharacter.TripPainClips.Length != 0, (Component)(object)__instance));
				((MonoBehaviour)UltraVoicePlugin.Instance).StartCoroutine(Frustration(__instance));
			}
			static IEnumerator Frustration(Guttertank tank)
			{
				yield return (object)new WaitForSeconds(0.5f);
				if (!tank.dead && !((Object)(object)tank == (Object)null) && !tank.eid.dead)
				{
					((MonoBehaviour)UltraVoicePlugin.Instance).StartCoroutine(UltraVoicePlugin.DelayedVox(delegate
					{
						VoiceManager.PlayRandomVoice((Component)(object)tank, "Guttertank", GuttertankCharacter.FrustratedClips, GuttertankCharacter.FrustratedSubs, interrupt: true);
					}, () => GuttertankCharacter.FrustratedClips != null && GuttertankCharacter.FrustratedClips.Length != 0, (Component)(object)tank));
				}
			}
		}
	}
	[HarmonyPatch(typeof(Guttertank), "Death")]
	internal class GuttertankDeathPatch
	{
		private static void Postfix(Guttertank __instance)
		{
			if (UltraVoicePlugin.GuttertankVoiceEnabled.value && !((Object)(object)__instance == (Object)null))
			{
				((MonoBehaviour)UltraVoicePlugin.Instance).StartCoroutine(UltraVoicePlugin.DelayedVox(delegate
				{
					VoiceManager.PlayRandomVoice((Component)(object)__instance, "Guttertank", GuttertankCharacter.DeathClips, null, interrupt: true);
				}, () => GuttertankCharacter.DeathClips != null && GuttertankCharacter.DeathClips.Length != 0, (Component)(object)__instance));
			}
		}
	}
	public static class LeviathanCharacter
	{
		[HarmonyPatch(typeof(LeviathanHead), "StopAction")]
		private class LeviathanChatterPatch
		{
			private static void Prefix(LeviathanHead __instance)
			{
				if (UltraVoicePlugin.LeviathanVoiceEnabled.value && VoiceManager.CheckCooldown((Component)(object)__instance, 15f) && __instance.active)
				{
					__instance.attackCooldown = 3.5f;
					VoiceManager.PlayRandomVoice((Component)(object)__instance, "Leviathan", ChatterClips, ChatterSubs, interrupt: true, randomPitch: false, 3f);
				}
			}
		}

		[HarmonyPatch(typeof(LeviathanHead), "Bite")]
		private class LeviathanBiteWindupPatch
		{
			private static void Postfix(LeviathanHead __instance)
			{
				if (UltraVoicePlugin.LeviathanVoiceEnabled.value)
				{
					VoiceManager.CreateVoiceSource((Component)(object)__instance, "Leviathan", BiteWindupClip, null, shouldInterrupt: true, null, randomPitch: false, 1f, 3f);
				}
			}
		}

		[HarmonyPatch(typeof(LeviathanHead), "Roar")]
		private class LeviathanRoarPatch
		{
			private static void Postfix(LeviathanHead __instance)
			{
				if (UltraVoicePlugin.LeviathanVoiceEnabled.value)
				{
					VoiceManager.CreateVoiceSource((Component)(object)__instance, "Leviathan", IntroRoarClip, null, shouldInterrupt: true, null, randomPitch: false, 1f, 3f);
				}
			}
		}

		[HarmonyPatch(typeof(LeviathanHead), "Ascend")]
		private class LeviathanAscendPatch
		{
			private static void Postfix(LeviathanHead __instance)
			{
				if (UltraVoicePlugin.LeviathanVoiceEnabled.value)
				{
					VoiceManager.CreateVoiceSource((Component)(object)__instance, "Leviathan", IntroRoarClip, null, shouldInterrupt: true, null, randomPitch: false, 1f, 3f);
				}
			}
		}

		[HarmonyPatch(typeof(LeviathanHead), "BiteDamageStart")]
		private class LeviathanBitePatch
		{
			private static void Postfix(LeviathanHead __instance)
			{
				if (UltraVoicePlugin.LeviathanVoiceEnabled.value)
				{
					VoiceManager.CreateVoiceSource((Component)(object)__instance, "Leviathan", BiteClip, null, shouldInterrupt: true, null, randomPitch: false, 1f, 3f);
				}
			}
		}

		[HarmonyPatch(typeof(LeviathanHead), "GotParried")]
		private class LeviathanParryPatch
		{
			private static void Postfix(LeviathanHead __instance)
			{
				if (UltraVoicePlugin.LeviathanVoiceEnabled.value && __instance.active)
				{
					VoiceManager.CreateVoiceSource((Component)(object)__instance, "Leviathan", ParryClip, null, shouldInterrupt: true, null, randomPitch: false, 1f, 3f);
				}
			}
		}

		[HarmonyPatch(typeof(LeviathanHead), "ProjectileBurst")]
		private class LeviathanBarragePatch
		{
			private static void Postfix(LeviathanHead __instance)
			{
				if (UltraVoicePlugin.LeviathanVoiceEnabled.value)
				{
					VoiceManager.CreateVoiceSource((Component)(object)__instance, "Leviathan", RoarClip, null, shouldInterrupt: true, null, randomPitch: false, 1f, 3f);
				}
			}
		}

		[HarmonyPatch(typeof(LeviathanHead), "BeamAttack")]
		private class LeviathanBeamPatch
		{
			private static void Postfix(LeviathanHead __instance)
			{
				if (UltraVoicePlugin.LeviathanVoiceEnabled.value)
				{
					VoiceManager.CreateVoiceSource((Component)(object)__instance, "Leviathan", RoarClip, null, shouldInterrupt: true, null, randomPitch: false, 1f, 3f);
				}
			}
		}

		[HarmonyPatch(typeof(LeviathanHead), "Death")]
		private class LeviathanDeathPatch
		{
			private static void Postfix(LeviathanHead __instance)
			{
				if (UltraVoicePlugin.LeviathanVoiceEnabled.value)
				{
					VoiceManager.CreateVoiceSource((Component)(object)__instance, "Leviathan", DeathClip, null, shouldInterrupt: true, null, randomPitch: false, 1f, 3f);
				}
			}
		}

		[HarmonyPatch(typeof(LeviathanHead), "HeadExplode")]
		private class LeviathanDeathEndPatch
		{
			private static void Postfix(LeviathanHead __instance)
			{
				if (UltraVoicePlugin.LeviathanVoiceEnabled.value)
				{
					VoiceManager.CreateVoiceSource((Component)(object)__instance, "Leviathan", DeathEndClip, null, shouldInterrupt: true, null, randomPitch: false, 1f, 3f);
				}
			}
		}

		public static AudioClip[] ChatterClips;

		public static AudioClip BiteClip;

		public static AudioClip BiteWindupClip;

		public static AudioClip ParryClip;

		public static AudioClip RoarClip;

		public static AudioClip IntroRoarClip;

		public static AudioClip DeathClip;

		public static AudioClip DeathEndClip;

		public static readonly string[] ChatterSubs = new string[5] { "DEVOUR IT", "TEAR IT APART", "SINK IN DESPAIR", "THE STYX WILL CLAIM YOU", "WE ARE HUNGRY" };

		public static void LoadVoiceLines(ManualLogSource logger)
		{
			ChatterClips = (AudioClip[])(object)new AudioClip[5]
			{
				UltraVoicePlugin.LoadClip("Leviathan.lev_Chatter1.wav"),
				UltraVoicePlugin.LoadClip("Leviathan.lev_Chatter2.wav"),
				UltraVoicePlugin.LoadClip("Leviathan.lev_Chatter3.wav"),
				UltraVoicePlugin.LoadClip("Leviathan.lev_Chatter4.wav"),
				UltraVoicePlugin.LoadClip("Leviathan.lev_Chatter5.wav")
			};
			BiteClip = UltraVoicePlugin.LoadClip("Leviathan.lev_Bite.wav");
			BiteWindupClip = UltraVoicePlugin.LoadClip("Leviathan.lev_BiteWindup.wav");
			ParryClip = UltraVoicePlugin.LoadClip("Leviathan.lev_Parried.wav");
			RoarClip = UltraVoicePlugin.LoadClip("Leviathan.lev_Roar.wav");
			IntroRoarClip = UltraVoicePlugin.LoadClip("Leviathan.lev_IntroRoar.wav");
			DeathClip = UltraVoicePlugin.LoadClip("Leviathan.lev_Death.wav");
			DeathEndClip = UltraVoicePlugin.LoadClip("Leviathan.lev_DeathEnd.wav");
			logger.LogInfo((object)"Leviathan voice lines loaded successfully!");
		}
	}
	public class MaliciousFaceCharacter
	{
		public static AudioClip[] GenericClips;

		public static AudioClip[] EnrageClips;

		public static AudioClip DeathClip;

		public static readonly string[] GenericSubs = new string[5] { "BLEED", "FOOLISH", "FUTILE", "FRAIL", "WEAKLING" };

		public static readonly string[] EnrageSubs = new string[3] { "ENOUGH", "SUFFER", "PATHETIC" };

		public static void LoadVoiceLines(ManualLogSource logger)
		{
			GenericClips = (AudioClip[])(object)new AudioClip[5]
			{
				UltraVoicePlugin.LoadClip("MaliciousFace.maurice_Generic1.wav"),
				UltraVoicePlugin.LoadClip("MaliciousFace.maurice_Generic2.wav"),
				UltraVoicePlugin.LoadClip("MaliciousFace.maurice_Generic3.wav"),
				UltraVoicePlugin.LoadClip("MaliciousFace.maurice_Generic4.wav"),
				UltraVoicePlugin.LoadClip("MaliciousFace.maurice_Generic5.wav")
			};
			EnrageClips = (AudioClip[])(object)new AudioClip[3]
			{
				UltraVoicePlugin.LoadClip("MaliciousFace.maurice_Enraged1.wav"),
				UltraVoicePlugin.LoadClip("MaliciousFace.maurice_Enraged2.wav"),
				UltraVoicePlugin.LoadClip("MaliciousFace.maurice_Enraged3.wav")
			};
			DeathClip = UltraVoicePlugin.LoadClip("MaliciousFace.maurice_Death.wav");
			logger.LogInfo((object)"Malicious Face voice lines loaded successfully!");
		}
	}
	[HarmonyPatch(typeof(MaliciousFace), "Start")]
	internal class MaliciousFaceSpawnPatch
	{
		private static void Postfix(MaliciousFace __instance)
		{
			VoiceManager.enemySpawnTimes[(Component)(object)__instance] = Time.time;
		}
	}
	[HarmonyPatch(typeof(MaliciousFace), "Update")]
	internal class MaliciousFaceChatterPatch
	{
		private static void Postfix(MaliciousFace __instance)
		{
			if (UltraVoicePlugin.MauriceVoiceEnabled.value && !BlindEnemies.Blind && VoiceManager.CheckCooldown((Component)(object)__instance, 4f) && !((Object)(object)__instance == (Object)null) && !__instance.eid.dead && Random.Range(0f, 1f) < 0.75f)
			{
				VoiceManager.PlayRandomVoice((Component)(object)__instance, "MaliciousFace", MaliciousFaceCharacter.GenericClips, MaliciousFaceCharacter.GenericSubs, interrupt: false, randomPitch: true);
			}
		}
	}
	[HarmonyPatch(typeof(MaliciousFace), "Enrage")]
	internal class MaliciousFaceEnragePatch
	{
		private static void Postfix(MaliciousFace __instance)
		{
			if (UltraVoicePlugin.MauriceVoiceEnabled.value)
			{
				VoiceManager.PlayRandomVoice((Component)(object)__instance, "MaliciousFace", MaliciousFaceCharacter.EnrageClips, MaliciousFaceCharacter.EnrageSubs, interrupt: false, randomPitch: true);
			}
		}
	}
	[HarmonyPatch(typeof(MaliciousFace), "OnGoLimp")]
	internal class MaliciousFaceDeathPatch
	{
		private static void Prefix(MaliciousFace __instance)
		{
			if (UltraVoicePlugin.MauriceVoiceEnabled.value)
			{
				VoiceManager.CreateVoiceSource((Component)(object)__instance, "MaliciousFace", MaliciousFaceCharacter.DeathClip, null, shouldInterrupt: true, null, randomPitch: true);
			}
		}
	}
	public class MannequinCharacter
	{
		public static AudioClip[] ChatterClips;

		public static AudioClip[] DeathClips;

		public static void LoadVoiceLines(ManualLogSource logger)
		{
			ChatterClips = (AudioClip[])(object)new AudioClip[5]
			{
				UltraVoicePlugin.LoadClip("Mannequin.mq_Laugh1.wav"),
				UltraVoicePlugin.LoadClip("Mannequin.mq_Laugh2.wav"),
				UltraVoicePlugin.LoadClip("Mannequin.mq_Laugh3.wav"),
				UltraVoicePlugin.LoadClip("Mannequin.mq_Laugh4.wav"),
				UltraVoicePlugin.LoadClip("Mannequin.mq_Laugh5.wav")
			};
			DeathClips = (AudioClip[])(object)new AudioClip[2]
			{
				UltraVoicePlugin.LoadClip("Mannequin.mq_Death1.wav"),
				UltraVoicePlugin.LoadClip("Mannequin.mq_Death2.wav")
			};
			logger.LogInfo((object)"Mannequin voice lines loaded successfully!");
		}
	}
	[HarmonyPatch(typeof(Mannequin), "Update")]
	internal class MannequinChatterPatch
	{
		private static void Postfix(Mannequin __instance)
		{
			if (UltraVoicePlugin.MannequinVoiceEnabled.value && !BlindEnemies.Blind && VoiceManager.CheckCooldown((Component)(object)__instance, 4f) && !(Random.Range(0f, 1f) < 0.75f))
			{
				VoiceManager.PlayRandomVoice((Component)(object)__instance, "Mannequin", MannequinCharacter.ChatterClips, null, interrupt: false, randomPitch: true);
			}
		}
	}
	[HarmonyPatch(typeof(Mannequin), "MeleeAttack")]
	internal class MannequinSwingPatch
	{
		private static void Postfix(Mannequin __instance)
		{
			if (UltraVoicePlugin.MannequinVoiceEnabled.value)
			{
				VoiceManager.PlayRandomVoice((Component)(object)__instance, "Mannequin", MannequinCharacter.ChatterClips, null, interrupt: false, randomPitch: true);
			}
		}
	}
	[HarmonyPatch(typeof(Mannequin), "OnDeath")]
	internal class MannequinDeathPatch
	{
		private static void Postfix(Mannequin __instance)
		{
			if (UltraVoicePlugin.MannequinVoiceEnabled.value)
			{
				VoiceManager.PlayRandomVoice((Component)(object)__instance, "Mannequin", MannequinCharacter.DeathClips, null, interrupt: true, randomPitch: true);
			}
		}
	}
	public class MindflayerCharacter
	{
		public static AudioClip[] SpawnClips;

		public static AudioClip[] ChatterClips;

		public static AudioClip[] MeleeClips;

		public static AudioClip[] EnrageClips;

		public static AudioClip[] SpawnClipsMasc;

		public static AudioClip[] ChatterClipsMasc;

		public static AudioClip[] MeleeClipsMasc;

		public static AudioClip[] EnrageClipsMasc;

		public static readonly string[] SpawnSubs = new s