Decompiled source of v1ultrakill v0.60.0

BepInEx/plugins/Garra.v1ultrakill-DEV/Garra.v1ultrakill.dll

Decompiled 3 months ago
#define DEBUG
using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using BepInEx;
using BepInEx.Configuration;
using BepInEx.Logging;
using GameNetcodeStuff;
using Garra.v1ultrakill.NetcodePatcher;
using LethalLib.Modules;
using Microsoft.CodeAnalysis;
using Unity.Netcode;
using UnityEngine;
using UnityEngine.Networking;
using v1ultrakill.Configuration;

[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: AssemblyCompany("Garra.v1ultrakill")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0+6e947be527a5ed5ef4dc503842c615626448d28b")]
[assembly: AssemblyProduct("v1ultrakill")]
[assembly: AssemblyTitle("Garra.v1ultrakill")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.0.0")]
[module: UnverifiableCode]
[module: RefSafetyRules(11)]
[module: NetcodePatchedAssembly]
internal class <Module>
{
	static <Module>()
	{
	}
}
namespace Microsoft.CodeAnalysis
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	internal sealed class EmbeddedAttribute : Attribute
	{
	}
}
namespace System.Runtime.CompilerServices
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.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]
	[Microsoft.CodeAnalysis.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;
		}
	}
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	[AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)]
	internal sealed class RefSafetyRulesAttribute : Attribute
	{
		public readonly int Version;

		public RefSafetyRulesAttribute(int P_0)
		{
			Version = P_0;
		}
	}
}
namespace v1ultrakill
{
	[BepInPlugin("Garra.v1ultrakill", "v1ultrakill", "1.0.0")]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	public class Plugin : BaseUnityPlugin
	{
		public static class Paths
		{
		}

		internal static ManualLogSource Logger;

		public static AssetBundle? ModAssets;

		public string folderPathkys;

		internal static PluginConfig BoundConfig { get; private set; }

		public static string BepInExAssemblyDirectory { get; }

		private void Awake()
		{
			Logger = ((BaseUnityPlugin)this).Logger;
			folderPathkys = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location);
			BoundConfig = new PluginConfig(((BaseUnityPlugin)this).Config);
			InitializeNetworkBehaviours();
			string path = "v1ultrakill";
			ModAssets = AssetBundle.LoadFromFile(Path.Combine(Path.GetDirectoryName(((BaseUnityPlugin)this).Info.Location), path));
			if ((Object)(object)ModAssets == (Object)null)
			{
				Logger.LogError((object)"Failed to load custom assets.");
				return;
			}
			EnemyType val = ModAssets.LoadAsset<EnemyType>("v1ultrakill");
			TerminalNode val2 = ModAssets.LoadAsset<TerminalNode>("v1ultrakillTN");
			TerminalKeyword val3 = ModAssets.LoadAsset<TerminalKeyword>("v1ultrakillTK");
			NetworkPrefabs.RegisterNetworkPrefab(val.enemyPrefab);
			Enemies.RegisterEnemy(val, BoundConfig.SpawnWeight.Value, (LevelTypes)(-1), val2, val3);
			Logger.LogInfo((object)"Plugin Garra.v1ultrakill is loaded!");
		}

		private static void InitializeNetworkBehaviours()
		{
			Type[] types = Assembly.GetExecutingAssembly().GetTypes();
			Type[] array = types;
			foreach (Type type in array)
			{
				MethodInfo[] methods = type.GetMethods(BindingFlags.Instance | BindingFlags.Static | BindingFlags.NonPublic);
				MethodInfo[] array2 = methods;
				foreach (MethodInfo methodInfo in array2)
				{
					object[] customAttributes = methodInfo.GetCustomAttributes(typeof(RuntimeInitializeOnLoadMethodAttribute), inherit: false);
					if (customAttributes.Length != 0)
					{
						methodInfo.Invoke(null, null);
					}
				}
			}
		}
	}
	internal class v1ultrakillAI : EnemyAI
	{
		public static class Paths
		{
		}

		private enum State
		{
			SearchingForPlayer,
			FollowPlayer,
			DashingAttack
		}

		public Transform turnCompass = null;

		public Transform attackArea = null;

		private float timeSinceHittingLocalPlayer;

		private float timeSinceNewRandPos;

		private float timeSinceLastYap;

		private float timeSinceLastDash;

		private Vector3 positionRandomness;

		private Vector3 PreDashPos;

		private Vector3 AttackPos;

		private Random enemyRandom = null;

		private bool isDeadAnimationDone;

		public AudioClip[] audioKill;

		private AudioSource audioSource;

		private string modDir = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location);

		public float detectionRange = 15f;

		public float dashSpeed = 33f;

		public float dashDuration = 0.8f;

		public float cooldownTime = 1f;

		private bool isDashing = false;

		private bool onCooldown = false;

		private float startTime;

		public Rigidbody rb;

		private bool isEnemyDead;

		public Animator m_Animator;

		private Vector3 lastPosition;

		private bool isMoving;

		internal static List<object> Assets;

		[Conditional("DEBUG")]
		private void LogIfDebugBuild(string text)
		{
			Plugin.Logger.LogInfo((object)text);
		}

		public override void Start()
		{
			//IL_003b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0040: Unknown result type (might be due to invalid IL or missing references)
			//IL_007d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0082: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b8: Unknown result type (might be due to invalid IL or missing references)
			((EnemyAI)this).Start();
			isEnemyDead = false;
			LogIfDebugBuild("v1ultrakill Spawned");
			audioSource = ((Component)this).GetComponent<AudioSource>();
			((MonoBehaviour)this).StartCoroutine(SpawnAudio());
			lastPosition = ((Component)this).transform.position;
			isMoving = true;
			timeSinceNewRandPos = 0f;
			timeSinceLastYap = 0f;
			timeSinceLastDash = 0f;
			positionRandomness = new Vector3(0f, 0f, 0f);
			enemyRandom = new Random(StartOfRound.Instance.randomMapSeed + base.thisEnemyIndex);
			isDeadAnimationDone = false;
			base.currentBehaviourStateIndex = 0;
			((EnemyAI)this).StartSearch(((Component)this).transform.position, (AISearchRoutine)null);
		}

		public override void Update()
		{
			//IL_0039: Unknown result type (might be due to invalid IL or missing references)
			//IL_003f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0084: Unknown result type (might be due to invalid IL or missing references)
			//IL_0089: Unknown result type (might be due to invalid IL or missing references)
			((EnemyAI)this).Update();
			if (timeSinceLastYap > 10f)
			{
				timeSinceLastYap = 0f;
				((MonoBehaviour)this).StartCoroutine(YapAudio());
			}
			if (((Component)this).transform.position != lastPosition)
			{
				isMoving = true;
				LogIfDebugBuild("Object is moving");
			}
			m_Animator.SetBool("running", isMoving);
			lastPosition = ((Component)this).transform.position;
			if (isEnemyDead)
			{
				if (!isDeadAnimationDone)
				{
					LogIfDebugBuild("Stopping enemy voice with janky code.");
					isDeadAnimationDone = true;
					base.creatureVoice.Stop();
					((MonoBehaviour)this).StartCoroutine(DieAudio());
					m_Animator.SetBool("running", false);
					m_Animator.ResetTrigger("die");
					m_Animator.SetTrigger("die");
					Object.Destroy((Object)(object)((Component)this).gameObject, 5f);
				}
			}
			else
			{
				m_Animator.SetTrigger("startWalk");
				timeSinceHittingLocalPlayer += Time.deltaTime;
				timeSinceNewRandPos += Time.deltaTime;
				timeSinceLastYap += Time.deltaTime;
				timeSinceLastDash += Time.deltaTime;
				int currentBehaviourStateIndex = base.currentBehaviourStateIndex;
				if (base.stunNormalizedTimer > 0f)
				{
					base.agent.speed = 4f;
				}
			}
		}

		public override void DoAIInterval()
		{
			//IL_00b5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e2: Unknown result type (might be due to invalid IL or missing references)
			//IL_011c: Unknown result type (might be due to invalid IL or missing references)
			((EnemyAI)this).DoAIInterval();
			if (isEnemyDead || StartOfRound.Instance.allPlayersDead)
			{
				return;
			}
			switch (base.currentBehaviourStateIndex)
			{
			case 0:
				base.agent.speed = 20f;
				if (FoundClosestPlayerInRange(25f, 3f))
				{
					LogIfDebugBuild("Start Target Player");
					((EnemyAI)this).StopSearch(base.currentSearch, true);
					((EnemyAI)this).SwitchToBehaviourClientRpc(1);
				}
				break;
			case 1:
				base.agent.speed = 20f;
				if (!TargetClosestPlayerInAnyCase() || (Vector3.Distance(((Component)this).transform.position, ((Component)base.targetPlayer).transform.position) > 20f && !((EnemyAI)this).CheckLineOfSightForPosition(((Component)base.targetPlayer).transform.position, 45f, 60, -1f, (Transform)null)))
				{
					LogIfDebugBuild("Stop Target Player");
					((EnemyAI)this).StartSearch(((Component)this).transform.position, (AISearchRoutine)null);
					((EnemyAI)this).SwitchToBehaviourClientRpc(0);
				}
				else
				{
					FollowPlayer();
				}
				break;
			case 2:
				break;
			default:
				LogIfDebugBuild("This Behavior State doesn't exist!");
				break;
			}
		}

		public override void OnCollideWithPlayer(Collider other)
		{
			//IL_005c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0062: Unknown result type (might be due to invalid IL or missing references)
			if (!(timeSinceHittingLocalPlayer < 1f))
			{
				PlayerControllerB val = ((EnemyAI)this).MeetsStandardPlayerCollisionConditions(other, false, false);
				if ((Object)(object)val != (Object)null)
				{
					LogIfDebugBuild("v1ultrakill Collision with Player!");
					timeSinceHittingLocalPlayer = 0f;
					((MonoBehaviour)this).StartCoroutine(KillAudio());
					val.DamagePlayer(580, true, true, (CauseOfDeath)0, 0, false, default(Vector3));
				}
			}
		}

		public override void HitEnemy(int force = 1, PlayerControllerB? playerWhoHit = null, bool playHitSFX = true, int hitID = -1)
		{
			((EnemyAI)this).HitEnemy(force, playerWhoHit, playHitSFX, hitID);
			if (isEnemyDead)
			{
				return;
			}
			base.enemyHP -= force;
			if (((NetworkBehaviour)this).IsOwner)
			{
				if (base.enemyHP <= 0 && !isEnemyDead)
				{
					((MonoBehaviour)this).StartCoroutine(DieAudio());
					((MonoBehaviour)this).StopCoroutine(DashAttack());
					isEnemyDead = true;
					((MonoBehaviour)this).StopCoroutine(base.searchCoroutine);
					((EnemyAI)this).KillEnemyOnOwnerClient(false);
				}
				else
				{
					((MonoBehaviour)this).StartCoroutine(HurtAudio());
				}
			}
		}

		private bool FoundClosestPlayerInRange(float range, float senseRange)
		{
			//IL_004e: Unknown result type (might be due to invalid IL or missing references)
			//IL_005e: Unknown result type (might be due to invalid IL or missing references)
			((EnemyAI)this).TargetClosestPlayer(1.5f, true, 70f);
			if ((Object)(object)base.targetPlayer == (Object)null)
			{
				((EnemyAI)this).TargetClosestPlayer(1.5f, false, 70f);
				range = senseRange;
			}
			return (Object)(object)base.targetPlayer != (Object)null && Vector3.Distance(((Component)this).transform.position, ((Component)base.targetPlayer).transform.position) < range;
		}

		private bool TargetClosestPlayerInAnyCase()
		{
			//IL_001f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0035: Unknown result type (might be due to invalid IL or missing references)
			base.mostOptimalDistance = 2000f;
			base.targetPlayer = null;
			for (int i = 0; i < StartOfRound.Instance.connectedPlayersAmount + 1; i++)
			{
				base.tempDist = Vector3.Distance(((Component)this).transform.position, ((Component)StartOfRound.Instance.allPlayerScripts[i]).transform.position);
				if (base.tempDist < base.mostOptimalDistance)
				{
					base.mostOptimalDistance = base.tempDist;
					base.targetPlayer = StartOfRound.Instance.allPlayerScripts[i];
				}
			}
			if ((Object)(object)base.targetPlayer == (Object)null)
			{
				return false;
			}
			return true;
		}

		private void FollowPlayer()
		{
			//IL_008f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0094: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ab: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00bd: Unknown result type (might be due to invalid IL or missing references)
			if (!((Object)(object)base.targetPlayer == (Object)null) && ((NetworkBehaviour)this).IsOwner && timeSinceNewRandPos > 0.7f)
			{
				timeSinceNewRandPos = 0f;
				if (enemyRandom.Next(0, 3) == 0)
				{
					((MonoBehaviour)this).StartCoroutine(DashAttack());
				}
				else
				{
					positionRandomness = new Vector3((float)enemyRandom.Next(-2, 2), 0f, (float)enemyRandom.Next(-2, 2));
					AttackPos = ((Component)base.targetPlayer).transform.position + positionRandomness;
				}
				((EnemyAI)this).SetDestinationToPosition(AttackPos, false);
			}
		}

		private IEnumerator DashAttack()
		{
			((EnemyAI)this).SwitchToBehaviourClientRpc(2);
			AttackPos = ((Component)base.targetPlayer).transform.position;
			((EnemyAI)this).SetDestinationToPosition(AttackPos, false);
			yield return (object)new WaitForSeconds(0.3f);
			if (!isEnemyDead)
			{
				((MonoBehaviour)this).StartCoroutine(ChargeAudio());
				yield return (object)new WaitForSeconds(0.95f);
				((MonoBehaviour)this).StartCoroutine(DashAudio());
				((Component)this).transform.LookAt(((Component)base.targetPlayer).transform.position);
				LogIfDebugBuild("Pre Attack ");
				DashAttackHitClientRpc();
				if (base.currentBehaviourStateIndex == 2)
				{
					((EnemyAI)this).SwitchToBehaviourClientRpc(1);
				}
			}
		}

		[ClientRpc]
		public void DashAttackHitClientRpc()
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Invalid comparison between Unknown and I4
			//IL_008c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0096: Invalid comparison between Unknown and I4
			//IL_005f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0068: Unknown result type (might be due to invalid IL or missing references)
			//IL_006d: Unknown result type (might be due to invalid IL or missing references)
			//IL_007c: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e9: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00fb: Unknown result type (might be due to invalid IL or missing references)
			//IL_0100: Unknown result type (might be due to invalid IL or missing references)
			//IL_0105: Unknown result type (might be due to invalid IL or missing references)
			//IL_010d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0118: Unknown result type (might be due to invalid IL or missing references)
			//IL_011f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0124: Unknown result type (might be due to invalid IL or missing references)
			//IL_0129: Unknown result type (might be due to invalid IL or missing references)
			//IL_0137: Unknown result type (might be due to invalid IL or missing references)
			//IL_013c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0145: Unknown result type (might be due to invalid IL or missing references)
			NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
			if (networkManager != null && networkManager.IsListening)
			{
				if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 2 && (networkManager.IsServer || networkManager.IsHost))
				{
					ClientRpcParams val = default(ClientRpcParams);
					FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(1095952273u, val, (RpcDelivery)0);
					((NetworkBehaviour)this).__endSendClientRpc(ref val2, 1095952273u, val, (RpcDelivery)0);
				}
				if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 2 && (networkManager.IsClient || networkManager.IsHost))
				{
					LogIfDebugBuild("Attacking ...");
					int num = 8;
					float num2 = 0f;
					float num3 = 0.8f;
					float num4 = 300f;
					float num5 = 45f;
					Vector3 val3 = ((Component)this).transform.position + ((Component)this).transform.forward * num5;
					Vector3 val4 = ((Component)this).transform.position + ((Component)this).transform.forward * num5;
					((Component)this).transform.position = Vector3.MoveTowards(((Component)this).transform.position, val4, num4 * Time.deltaTime);
					LogIfDebugBuild("Stopped Dash");
				}
			}
		}

		private IEnumerator KillAudio()
		{
			string[] audioFiles = Directory.GetFiles(modDir, "voice/kill/*.wav");
			if (audioFiles.Length != 0)
			{
				string randomAudioFilePath = audioFiles[Random.Range(0, audioFiles.Length)];
				string fileUrl = "file://" + randomAudioFilePath;
				UnityWebRequest www = UnityWebRequestMultimedia.GetAudioClip(fileUrl, (AudioType)20);
				yield return www.SendWebRequest();
				if ((int)www.result == 2 || (int)www.result == 3)
				{
					LogIfDebugBuild(www.error);
					yield break;
				}
				AudioClip clip = DownloadHandlerAudioClip.GetContent(www);
				base.creatureVoice.PlayOneShot(clip);
			}
		}

		private IEnumerator ChargeAudio()
		{
			string[] audioFiles = Directory.GetFiles(modDir, "voice/charging_dash/*.wav");
			if (audioFiles.Length != 0)
			{
				string randomAudioFilePath = audioFiles[Random.Range(0, audioFiles.Length)];
				string fileUrl = "file://" + randomAudioFilePath;
				UnityWebRequest www = UnityWebRequestMultimedia.GetAudioClip(fileUrl, (AudioType)20);
				yield return www.SendWebRequest();
				if ((int)www.result == 2 || (int)www.result == 3)
				{
					LogIfDebugBuild(www.error);
					yield break;
				}
				AudioClip clip = DownloadHandlerAudioClip.GetContent(www);
				base.creatureVoice.PlayOneShot(clip);
			}
		}

		private IEnumerator DieAudio()
		{
			string[] audioFiles = Directory.GetFiles(modDir, "voice/die/*.wav");
			if (audioFiles.Length != 0)
			{
				string randomAudioFilePath = audioFiles[Random.Range(0, audioFiles.Length)];
				string fileUrl = "file://" + randomAudioFilePath;
				UnityWebRequest www = UnityWebRequestMultimedia.GetAudioClip(fileUrl, (AudioType)20);
				yield return www.SendWebRequest();
				if ((int)www.result == 2 || (int)www.result == 3)
				{
					LogIfDebugBuild(www.error);
					yield break;
				}
				AudioClip clip = DownloadHandlerAudioClip.GetContent(www);
				base.creatureVoice.PlayOneShot(clip);
			}
		}

		private IEnumerator SpawnAudio()
		{
			string[] audioFiles = Directory.GetFiles(modDir, "voice/spawn/*.wav");
			if (audioFiles.Length == 0)
			{
				LogIfDebugBuild("No .wav files found in the folder.");
				yield break;
			}
			string randomAudioFilePath = audioFiles[Random.Range(0, audioFiles.Length)];
			string fileUrl = "file://" + randomAudioFilePath;
			UnityWebRequest www = UnityWebRequestMultimedia.GetAudioClip(fileUrl, (AudioType)20);
			yield return www.SendWebRequest();
			if ((int)www.result == 2 || (int)www.result == 3)
			{
				LogIfDebugBuild(www.error);
				yield break;
			}
			AudioClip clip = DownloadHandlerAudioClip.GetContent(www);
			base.creatureVoice.PlayOneShot(clip);
		}

		private IEnumerator FoundAudio()
		{
			string[] audioFiles = Directory.GetFiles(modDir, "voice/found/*.wav");
			if (audioFiles.Length == 0)
			{
				LogIfDebugBuild("No .wav files found in the folder.");
				yield break;
			}
			string randomAudioFilePath = audioFiles[Random.Range(0, audioFiles.Length)];
			string fileUrl = "file://" + randomAudioFilePath;
			UnityWebRequest www = UnityWebRequestMultimedia.GetAudioClip(fileUrl, (AudioType)20);
			yield return www.SendWebRequest();
			if ((int)www.result == 2 || (int)www.result == 3)
			{
				LogIfDebugBuild(www.error);
				yield break;
			}
			AudioClip clip = DownloadHandlerAudioClip.GetContent(www);
			base.creatureVoice.PlayOneShot(clip);
		}

		private IEnumerator YapAudio()
		{
			string[] audioFiles = Directory.GetFiles(modDir, "voice/yap/*.wav");
			if (audioFiles.Length == 0)
			{
				LogIfDebugBuild("No .wav files found in the folder.");
				yield break;
			}
			string randomAudioFilePath = audioFiles[Random.Range(0, audioFiles.Length)];
			string fileUrl = "file://" + randomAudioFilePath;
			UnityWebRequest www = UnityWebRequestMultimedia.GetAudioClip(fileUrl, (AudioType)20);
			yield return www.SendWebRequest();
			if ((int)www.result == 2 || (int)www.result == 3)
			{
				LogIfDebugBuild(www.error);
			}
			else if (!base.creatureVoice.isPlaying)
			{
				AudioClip clip = DownloadHandlerAudioClip.GetContent(www);
				base.creatureVoice.PlayOneShot(clip);
			}
		}

		private IEnumerator HurtAudio()
		{
			string[] audioFiles = Directory.GetFiles(modDir, "voice/hurt/*.wav");
			if (audioFiles.Length == 0)
			{
				LogIfDebugBuild("No .wav files found in the folder.");
				yield break;
			}
			string randomAudioFilePath = audioFiles[Random.Range(0, audioFiles.Length)];
			string fileUrl = "file://" + randomAudioFilePath;
			UnityWebRequest www = UnityWebRequestMultimedia.GetAudioClip(fileUrl, (AudioType)20);
			yield return www.SendWebRequest();
			if ((int)www.result == 2 || (int)www.result == 3)
			{
				LogIfDebugBuild(www.error);
				yield break;
			}
			AudioClip clip = DownloadHandlerAudioClip.GetContent(www);
			base.creatureVoice.PlayOneShot(clip);
		}

		private IEnumerator DashAudio()
		{
			string[] audioFiles = Directory.GetFiles(modDir, "voice/dash/*.wav");
			if (audioFiles.Length == 0)
			{
				LogIfDebugBuild("No .wav files found in the folder.");
				yield break;
			}
			string randomAudioFilePath = audioFiles[Random.Range(0, audioFiles.Length)];
			string fileUrl = "file://" + randomAudioFilePath;
			UnityWebRequest www = UnityWebRequestMultimedia.GetAudioClip(fileUrl, (AudioType)20);
			yield return www.SendWebRequest();
			if ((int)www.result == 2 || (int)www.result == 3)
			{
				LogIfDebugBuild(www.error);
				yield break;
			}
			AudioClip clip = DownloadHandlerAudioClip.GetContent(www);
			base.creatureVoice.PlayOneShot(clip);
		}

		protected override void __initializeVariables()
		{
			((EnemyAI)this).__initializeVariables();
		}

		[RuntimeInitializeOnLoadMethod]
		internal static void InitializeRPCS_v1ultrakillAI()
		{
			//IL_0011: Unknown result type (might be due to invalid IL or missing references)
			//IL_001b: Expected O, but got Unknown
			NetworkManager.__rpc_func_table.Add(1095952273u, new RpcReceiveHandler(__rpc_handler_1095952273));
		}

		private static void __rpc_handler_1095952273(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams)
		{
			//IL_0029: Unknown result type (might be due to invalid IL or missing references)
			//IL_003f: Unknown result type (might be due to invalid IL or missing references)
			NetworkManager networkManager = target.NetworkManager;
			if (networkManager != null && networkManager.IsListening)
			{
				target.__rpc_exec_stage = (__RpcExecStage)2;
				((v1ultrakillAI)(object)target).DashAttackHitClientRpc();
				target.__rpc_exec_stage = (__RpcExecStage)0;
			}
		}

		protected internal override string __getTypeName()
		{
			return "v1ultrakillAI";
		}
	}
	public static class PluginInfo
	{
		public const string PLUGIN_GUID = "Garra.v1ultrakill";

		public const string PLUGIN_NAME = "v1ultrakill";

		public const string PLUGIN_VERSION = "1.0.0";
	}
}
namespace v1ultrakill.Configuration
{
	public class PluginConfig
	{
		public ConfigEntry<int> SpawnWeight;

		public PluginConfig(ConfigFile cfg)
		{
			SpawnWeight = cfg.Bind<int>("General", "Spawn weight", 20, "The spawn chance weight for v1ultrakill, relative to other existing enemies.\nGoes up from 0, lower is more rare, 100 and up is very common.");
			ClearUnusedEntries(cfg);
		}

		private void ClearUnusedEntries(ConfigFile cfg)
		{
			PropertyInfo property = ((object)cfg).GetType().GetProperty("OrphanedEntries", BindingFlags.Instance | BindingFlags.NonPublic);
			Dictionary<ConfigDefinition, string> dictionary = (Dictionary<ConfigDefinition, string>)property.GetValue(cfg, null);
			dictionary.Clear();
			cfg.Save();
		}
	}
}
namespace Garra.v1ultrakill.NetcodePatcher
{
	[AttributeUsage(AttributeTargets.Module)]
	internal class NetcodePatchedAssemblyAttribute : Attribute
	{
	}
}