Decompiled source of DIO EyesOfHeaven v3.6.4

BepInEx/plugins/DIO_EyesOfHeaven/EyesOfHeavenDio.dll

Decompiled a day ago
using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
using BepInEx;
using BepInEx.Configuration;
using BepInEx.Logging;
using EntityStates;
using KinematicCharacterController;
using Microsoft.CodeAnalysis;
using MonoMod.RuntimeDetour;
using RoR2;
using RoR2.CharacterAI;
using RoR2.ContentManagement;
using RoR2.Projectile;
using RoR2.Skills;
using RoR2.UI;
using UnityEngine;
using UnityEngine.AddressableAssets;
using UnityEngine.Networking;
using UnityEngine.Playables;
using UnityEngine.Rendering;
using UnityEngine.ResourceManagement.AsyncOperations;
using UnityEngine.VFX;

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

		public RefSafetyRulesAttribute(int P_0)
		{
			Version = P_0;
		}
	}
}
namespace EyesOfHeavenDio
{
	public sealed class DioAudioPlayback : MonoBehaviour
	{
		[StructLayout(LayoutKind.Sequential, Pack = 2)]
		private struct Format
		{
			public ushort tag;

			public ushort channels;

			public uint rate;

			public uint bytesPerSecond;

			public ushort alignment;

			public ushort bits;

			public ushort extra;
		}

		private struct Header
		{
			public IntPtr data;

			public uint length;

			public uint recorded;

			public UIntPtr user;

			public uint flags;

			public uint loops;

			public IntPtr next;

			public UIntPtr reserved;
		}

		private struct Position
		{
			public uint type;

			public uint value;

			public uint reserved;
		}

		private IntPtr device;

		private IntPtr header;

		private IntPtr data;

		private uint rate;

		private uint bytesPerSecond;

		private bool prepared;

		private bool paused;

		private float started;

		private float length;

		private static readonly uint HeaderSize = (uint)Marshal.SizeOf<Header>();

		public float PlaybackSeconds
		{
			get
			{
				Position position = new Position
				{
					type = 2u
				};
				if (device != IntPtr.Zero && waveOutGetPosition(device, ref position, (uint)Marshal.SizeOf<Position>()) == 0)
				{
					if (position.type == 2)
					{
						return (float)position.value / (float)rate;
					}
					if (position.type == 4)
					{
						return (float)position.value / (float)bytesPerSecond;
					}
					if (position.type == 1)
					{
						return (float)position.value / 1000f;
					}
				}
				return Time.time - started;
			}
		}

		[DllImport("winmm.dll")]
		private static extern uint waveOutOpen(out IntPtr device, uint id, ref Format format, IntPtr callback, IntPtr instance, uint flags);

		[DllImport("winmm.dll")]
		private static extern uint waveOutPrepareHeader(IntPtr device, IntPtr header, uint size);

		[DllImport("winmm.dll")]
		private static extern uint waveOutWrite(IntPtr device, IntPtr header, uint size);

		[DllImport("winmm.dll")]
		private static extern uint waveOutGetPosition(IntPtr device, ref Position position, uint size);

		[DllImport("winmm.dll")]
		private static extern uint waveOutPause(IntPtr device);

		[DllImport("winmm.dll")]
		private static extern uint waveOutRestart(IntPtr device);

		[DllImport("winmm.dll")]
		private static extern uint waveOutReset(IntPtr device);

		[DllImport("winmm.dll")]
		private static extern uint waveOutUnprepareHeader(IntPtr device, IntPtr header, uint size);

		[DllImport("winmm.dll")]
		private static extern uint waveOutClose(IntPtr device);

		internal bool Begin(byte[] pcm, int channels, int sampleRate, float volume)
		{
			try
			{
				rate = (uint)sampleRate;
				bytesPerSecond = (uint)((int)rate * channels * 2);
				length = (float)pcm.Length / (float)bytesPerSecond;
				started = Time.time;
				Format format = new Format
				{
					tag = 1,
					channels = (ushort)channels,
					rate = rate,
					bytesPerSecond = bytesPerSecond,
					alignment = (ushort)(channels * 2),
					bits = 16
				};
				Check(waveOutOpen(out device, uint.MaxValue, ref format, IntPtr.Zero, IntPtr.Zero, 0u), "open");
				byte[] array = new byte[pcm.Length];
				for (int i = 0; i + 1 < pcm.Length; i += 2)
				{
					short num = (short)Mathf.Clamp(Mathf.RoundToInt((float)(short)(pcm[i] | (pcm[i + 1] << 8)) * volume), -32768, 32767);
					array[i] = (byte)num;
					array[i + 1] = (byte)(num >> 8);
				}
				data = Marshal.AllocHGlobal(array.Length);
				Marshal.Copy(array, 0, data, array.Length);
				header = Marshal.AllocHGlobal((int)HeaderSize);
				Marshal.StructureToPtr(new Header
				{
					data = data,
					length = (uint)array.Length
				}, header, fDeleteOld: false);
				Check(waveOutPrepareHeader(device, header, HeaderSize), "prepare");
				prepared = true;
				Check(waveOutWrite(device, header, HeaderSize), "write");
				DioPlugin.Log.LogInfo((object)("DIO audio playing: " + ((Object)this).name + " duration=" + length + " Windows PCM output"));
				return true;
			}
			catch (Exception ex)
			{
				DioPlugin.Log.LogError((object)("DIO audio playback failed: " + ex.Message));
				Cleanup();
				return false;
			}
		}

		private static void Check(uint result, string operation)
		{
			if (result != 0)
			{
				throw new InvalidOperationException("waveOut " + operation + " error " + result);
			}
		}

		private void Update()
		{
			if (device == IntPtr.Zero)
			{
				Object.Destroy((Object)(object)((Component)this).gameObject);
				return;
			}
			bool flag = Time.timeScale == 0f;
			if (flag != paused)
			{
				if (flag)
				{
					waveOutPause(device);
				}
				else
				{
					waveOutRestart(device);
				}
				paused = flag;
			}
			if ((Marshal.PtrToStructure<Header>(header).flags & 1) != 0 || Time.time - started > length + 5f)
			{
				Object.Destroy((Object)(object)((Component)this).gameObject);
			}
		}

		private void Cleanup()
		{
			if (device != IntPtr.Zero)
			{
				waveOutReset(device);
				if (prepared)
				{
					waveOutUnprepareHeader(device, header, HeaderSize);
				}
				waveOutClose(device);
				device = IntPtr.Zero;
				prepared = false;
			}
			if (header != IntPtr.Zero)
			{
				Marshal.FreeHGlobal(header);
				header = IntPtr.Zero;
			}
			if (data != IntPtr.Zero)
			{
				Marshal.FreeHGlobal(data);
				data = IntPtr.Zero;
			}
		}

		private void OnDestroy()
		{
			Cleanup();
		}

		private void OnApplicationQuit()
		{
			Cleanup();
		}
	}
	public static class DioDashCollision
	{
		public static Vector3 Move(Vector3 from, Vector3 desired, Vector3 center, float radius, float half, float feetOffset, int mask)
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			//IL_0019: Unknown result type (might be due to invalid IL or missing references)
			//IL_001a: Unknown result type (might be due to invalid IL or missing references)
			//IL_002d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0036: Unknown result type (might be due to invalid IL or missing references)
			//IL_003b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0044: Unknown result type (might be due to invalid IL or missing references)
			//IL_0045: Unknown result type (might be due to invalid IL or missing references)
			//IL_004c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0051: Unknown result type (might be due to invalid IL or missing references)
			//IL_0053: Unknown result type (might be due to invalid IL or missing references)
			//IL_005a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0061: Unknown result type (might be due to invalid IL or missing references)
			//IL_0072: Unknown result type (might be due to invalid IL or missing references)
			//IL_0079: Unknown result type (might be due to invalid IL or missing references)
			//IL_007e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0154: Unknown result type (might be due to invalid IL or missing references)
			//IL_00cf: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d7: Unknown result type (might be due to invalid IL or missing references)
			//IL_0096: Unknown result type (might be due to invalid IL or missing references)
			//IL_011c: Unknown result type (might be due to invalid IL or missing references)
			//IL_011e: 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_0125: Unknown result type (might be due to invalid IL or missing references)
			//IL_012a: Unknown result type (might be due to invalid IL or missing references)
			//IL_012c: Unknown result type (might be due to invalid IL or missing references)
			//IL_012d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0132: Unknown result type (might be due to invalid IL or missing references)
			//IL_0133: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e8: 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_00ee: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ef: 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_00f5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00fb: Unknown result type (might be due to invalid IL or missing references)
			//IL_00fc: Unknown result type (might be due to invalid IL or missing references)
			//IL_0104: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a9: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b2: Unknown result type (might be due to invalid IL or missing references)
			//IL_0143: Unknown result type (might be due to invalid IL or missing references)
			//IL_0145: Unknown result type (might be due to invalid IL or missing references)
			int num = Mathf.Max(1, Mathf.CeilToInt(Vector3.Distance(from, desired) / 0.3f));
			Vector3 val = from;
			float num2 = Mathf.Max(0.1f, radius - 0.03f);
			Vector3 val2 = Vector3.up * (half - radius);
			RaycastHit val4 = default(RaycastHit);
			RaycastHit val6 = default(RaycastHit);
			for (int i = 1; i <= num; i++)
			{
				Vector3 val3 = Vector3.Lerp(from, desired, (float)i / (float)num);
				if (Physics.Raycast(new Vector3(val3.x, Mathf.Max(val3.y, val.y) + 1.5f, val3.z), Vector3.down, ref val4, 4f, mask, (QueryTriggerInteraction)1) && ((RaycastHit)(ref val4)).normal.y > 0.5f)
				{
					val3.y = Mathf.Max(val3.y, ((RaycastHit)(ref val4)).point.y + feetOffset + 0.08f);
				}
				Vector3 val5 = val3 - val;
				if ((((Vector3)(ref val5)).sqrMagnitude > 1E-06f && Physics.CapsuleCast(val + center + val2, val + center - val2, num2, ((Vector3)(ref val5)).normalized, ref val6, ((Vector3)(ref val5)).magnitude, mask, (QueryTriggerInteraction)1)) || Physics.CheckCapsule(val3 + center + val2, val3 + center - val2, num2, mask, (QueryTriggerInteraction)1))
				{
					break;
				}
				val = val3;
			}
			return val;
		}
	}
	public sealed class DioDeathVoice : MonoBehaviour
	{
		private CharacterBody body;

		private bool played;

		private void Awake()
		{
			body = ((Component)this).GetComponent<CharacterBody>();
		}

		private void OnEnable()
		{
			GlobalEventManager.onCharacterDeathServer += OnDeath;
		}

		private void OnDisable()
		{
			GlobalEventManager.onCharacterDeathServer -= OnDeath;
		}

		private void OnDeath(DamageReport report)
		{
			if ((Object)(object)report.victimBody == (Object)(object)body)
			{
				PlayOnce();
			}
		}

		private void Update()
		{
			if (Object.op_Implicit((Object)(object)body) && Object.op_Implicit((Object)(object)body.healthComponent) && !body.healthComponent.alive)
			{
				PlayOnce();
			}
		}

		private void PlayOnce()
		{
			if (!played && Object.op_Implicit((Object)(object)body) && body.hasEffectiveAuthority)
			{
				played = true;
				DioFeedback.Sound(((Component)this).gameObject, "death-voice", 1f);
			}
		}
	}
	[DefaultExecutionOrder(50)]
	public sealed class DioDrainPose : MonoBehaviour
	{
		private CharacterBody victim;

		private DioGrabHold hold;

		private Transform space;

		private Transform hand;

		private Transform root;

		private Animation animation;

		private AnimationClip contact;

		private Quaternion rotation;

		private Quaternion localRotation;

		private bool wasEnabled;

		public void Begin(CharacterBody target)
		{
			//IL_0030: Unknown result type (might be due to invalid IL or missing references)
			//IL_0035: Unknown result type (might be due to invalid IL or missing references)
			//IL_0041: Unknown result type (might be due to invalid IL or missing references)
			//IL_0046: Unknown result type (might be due to invalid IL or missing references)
			//IL_008f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0095: Expected O, but got Unknown
			victim = target;
			hold = ((Component)target).GetComponent<DioGrabHold>();
			root = ((Component)this).GetComponent<DioVisualDriver>().dioRoot.transform;
			rotation = root.rotation;
			localRotation = root.localRotation;
			animation = ((Component)root).GetComponentInChildren<Animation>(true);
			if (Object.op_Implicit((Object)(object)animation))
			{
				wasEnabled = ((Behaviour)animation).enabled;
				foreach (AnimationState item in animation)
				{
					AnimationState val = item;
					if (val.name.EndsWith("_atk_l2"))
					{
						contact = val.clip;
						break;
					}
				}
				if (Object.op_Implicit((Object)(object)contact))
				{
					((Behaviour)animation).enabled = false;
				}
			}
			SkinnedMeshRenderer[] componentsInChildren = ((Component)root).GetComponentsInChildren<SkinnedMeshRenderer>(true);
			foreach (SkinnedMeshRenderer val2 in componentsInChildren)
			{
				if (((Object)val2).name.EndsWith(" body"))
				{
					space = ((Component)val2).transform;
					break;
				}
			}
			Transform[] componentsInChildren2 = ((Component)root).GetComponentsInChildren<Transform>(true);
			foreach (Transform val3 in componentsInChildren2)
			{
				if (((Object)val3).name.EndsWith(" l hand"))
				{
					hand = val3;
					break;
				}
			}
			LateUpdate();
		}

		private void LateUpdate()
		{
			//IL_0075: Unknown result type (might be due to invalid IL or missing references)
			//IL_009e: Unknown result type (might be due to invalid IL or missing references)
			if (Object.op_Implicit((Object)(object)victim) && victim.healthComponent.alive && Object.op_Implicit((Object)(object)hand) && Object.op_Implicit((Object)(object)contact) && Object.op_Implicit((Object)(object)animation))
			{
				contact.SampleAnimation(((Component)animation).gameObject, contact.length * 0.25f);
				root.rotation = rotation;
				if (Object.op_Implicit((Object)(object)hold))
				{
					hold.SetContact(DioPoseSolver.VisualPosition(space, hand));
				}
			}
		}

		private void OnDisable()
		{
			//IL_0032: Unknown result type (might be due to invalid IL or missing references)
			if (Object.op_Implicit((Object)(object)animation))
			{
				((Behaviour)animation).enabled = wasEnabled;
			}
			if (Object.op_Implicit((Object)(object)root))
			{
				root.localRotation = localRotation;
			}
			((Component)this).GetComponent<DioVisualDriver>()?.Action("_bas_nut", 0.15f, summon: false);
		}
	}
	public sealed class DioExtraMoves : MonoBehaviour
	{
		private CharacterBody body;

		private EntityStateMachine weapon;

		private float barrageReady;

		private float drainReady;

		private float rollerReady;

		private float exReady;

		private GUIStyle moveStyle;

		private GUIStyle cooldownStyle;

		private readonly List<RectTransform> buffRects = new List<RectTransform>();

		private Vector2 panelAnchor;

		private readonly Vector3[] healthCorners = (Vector3[])(object)new Vector3[4];

		public bool RoadRollerActive
		{
			get
			{
				if (Object.op_Implicit((Object)(object)weapon))
				{
					return weapon.state is DioRoadRoller;
				}
				return false;
			}
		}

		public bool SpecialBusy
		{
			get
			{
				if (Object.op_Implicit((Object)(object)weapon))
				{
					if (!(weapon.state is DioRoadRoller))
					{
						return weapon.state is DioExKnives;
					}
					return true;
				}
				return false;
			}
		}

		public void ExFailed()
		{
			exReady = Time.time + 3f;
		}

		public void RoadRollerFailed()
		{
			rollerReady = Time.time + 1f;
		}

		private void Start()
		{
			body = ((Component)this).GetComponent<CharacterBody>();
			EntityStateMachine[] components = ((Component)this).GetComponents<EntityStateMachine>();
			foreach (EntityStateMachine val in components)
			{
				if (val.customName == "Weapon")
				{
					weapon = val;
				}
			}
		}

		private void Update()
		{
			//IL_0079: Unknown result type (might be due to invalid IL or missing references)
			//IL_009f: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e3: Unknown result type (might be due to invalid IL or missing references)
			//IL_0127: Unknown result type (might be due to invalid IL or missing references)
			//IL_016a: Unknown result type (might be due to invalid IL or missing references)
			if (!DioInput.Allowed(body) || !Object.op_Implicit((Object)(object)body) || !body.hasEffectiveAuthority || !body.healthComponent.alive || !Object.op_Implicit((Object)(object)weapon) || Time.timeScale == 0f || (Object.op_Implicit((Object)(object)MPEventSystemManager.kbmEventSystem) && MPEventSystemManager.kbmEventSystem.isCursorVisible) || SpecialBusy || (DioInput.Pressed(DioPlugin.StandBlockKey.Value, 5) && weapon.SetInterruptState((EntityState)(object)new DioStandBlock(), (InterruptPriority)1)))
			{
				return;
			}
			if (DioInput.Pressed(DioPlugin.RoadRollerKey.Value, 3) && Time.time >= rollerReady && weapon.SetInterruptState((EntityState)(object)new DioRoadRoller(), (InterruptPriority)2))
			{
				rollerReady = Time.time + 45f;
				return;
			}
			if (DioInput.Pressed(DioPlugin.ExKnivesKey.Value, 4) && Time.time >= exReady && weapon.SetInterruptState((EntityState)(object)new DioExKnives(), (InterruptPriority)2))
			{
				exReady = Time.time + 40f;
				return;
			}
			if (DioInput.Pressed(DioPlugin.BarrageKey.Value, 0) && Time.time >= barrageReady && weapon.SetInterruptState((EntityState)(object)new DioBarrage(), (InterruptPriority)1))
			{
				barrageReady = Time.time + 8f;
			}
			if (DioInput.Pressed(DioPlugin.DrainKey.Value, 1) && Time.time >= drainReady && weapon.SetInterruptState((EntityState)(object)new DioBloodDrain(), (InterruptPriority)1))
			{
				drainReady = Time.time + 12f;
			}
		}

		private void OnGUI()
		{
			//IL_0036: Unknown result type (might be due to invalid IL or missing references)
			//IL_003b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0050: Unknown result type (might be due to invalid IL or missing references)
			//IL_0072: 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_00c6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e8: Unknown result type (might be due to invalid IL or missing references)
			//IL_010a: Unknown result type (might be due to invalid IL or missing references)
			if (DioInput.IsLocal(body) && Object.op_Implicit((Object)(object)body) && body.hasEffectiveAuthority && Object.op_Implicit((Object)(object)Run.instance))
			{
				panelAnchor = FindPanelAnchor();
				DrawMove("Barrage", "MUDA barrage", DioPlugin.BarrageKey.Value, 0, barrageReady);
				DrawMove("BloodDrain", "Blood drain", DioPlugin.DrainKey.Value, 1, drainReady);
				DrawMove("StandJump", "Stand jump", DioPlugin.StandJumpKey.Value, 2, ((Component)this).GetComponent<DioStandJump>()?.ReadyAt ?? 0f);
				DrawMove("RoadRoller", "Ultimate: Road Roller", DioPlugin.RoadRollerKey.Value, 3, rollerReady);
				DrawMove("ExKnives", "EX knives", DioPlugin.ExKnivesKey.Value, 4, exReady);
				KeyCode value = DioPlugin.StandBlockKey.Value;
				DioStandGuard component = ((Component)this).GetComponent<DioStandGuard>();
				DrawMove("StandBlock", "Stand block", value, 5, 0f, (component != null && component.Blocking) ? "GUARD" : "HOLD");
			}
		}

		private Vector2 FindPanelAnchor()
		{
			//IL_0214: Unknown result type (might be due to invalid IL or missing references)
			//IL_0224: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f6: 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_00fc: Unknown result type (might be due to invalid IL or missing references)
			//IL_0101: 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_0115: Unknown result type (might be due to invalid IL or missing references)
			//IL_01e6: Unknown result type (might be due to invalid IL or missing references)
			//IL_01eb: Unknown result type (might be due to invalid IL or missing references)
			//IL_0189: Unknown result type (might be due to invalid IL or missing references)
			//IL_018e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0194: Unknown result type (might be due to invalid IL or missing references)
			//IL_0196: Unknown result type (might be due to invalid IL or missing references)
			float num = Mathf.Clamp((float)Screen.height / 1080f, 0.7f, 1.5f);
			Vector2 val = default(Vector2);
			((Vector2)(ref val))..ctor(20f * num, (float)Screen.height - 100f * num);
			foreach (HUD readOnlyInstance in HUD.readOnlyInstanceList)
			{
				if (!Object.op_Implicit((Object)(object)readOnlyInstance) || !((Object)(object)readOnlyInstance.targetBodyObject == (Object)(object)((Component)this).gameObject) || !Object.op_Implicit((Object)(object)readOnlyInstance.healthBar))
				{
					continue;
				}
				Transform transform = ((Component)readOnlyInstance.healthBar).transform;
				RectTransform val2 = (RectTransform)(object)((transform is RectTransform) ? transform : null);
				if (!Object.op_Implicit((Object)(object)val2))
				{
					continue;
				}
				Canvas componentInParent = ((Component)val2).GetComponentInParent<Canvas>();
				Camera val3 = ((Object.op_Implicit((Object)(object)componentInParent) && (int)componentInParent.renderMode != 0) ? componentInParent.worldCamera : null);
				val2.GetWorldCorners(healthCorners);
				float num2 = float.PositiveInfinity;
				float num3 = float.NegativeInfinity;
				Vector3[] array = healthCorners;
				foreach (Vector3 val4 in array)
				{
					Vector2 val5 = RectTransformUtility.WorldToScreenPoint(val3, val4);
					num2 = Mathf.Min(num2, val5.x);
					num3 = Mathf.Max(num3, val5.y);
				}
				float num4 = num3;
				if (Object.op_Implicit((Object)(object)readOnlyInstance.buffDisplay))
				{
					((Component)readOnlyInstance.buffDisplay).GetComponentsInChildren<RectTransform>(false, buffRects);
					foreach (RectTransform buffRect in buffRects)
					{
						buffRect.GetWorldCorners(healthCorners);
						array = healthCorners;
						foreach (Vector3 val6 in array)
						{
							num4 = Mathf.Max(num4, RectTransformUtility.WorldToScreenPoint(val3, val6).y);
						}
					}
				}
				val = new Vector2(16f * num, (float)Screen.height - num4 - 54f * num);
				break;
			}
			val.y = Mathf.Max(204f * num + 28f, val.y);
			return val;
		}

		private unsafe void DrawMove(string icon, string name, KeyCode key, int row, float ready, string status = null)
		{
			//IL_003f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0044: Unknown result type (might be due to invalid IL or missing references)
			//IL_0059: Unknown result type (might be due to invalid IL or missing references)
			//IL_0073: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a6: Unknown result type (might be due to invalid IL or missing references)
			//IL_008b: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ee: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e1: Unknown result type (might be due to invalid IL or missing references)
			//IL_0107: Unknown result type (might be due to invalid IL or missing references)
			//IL_010c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0118: Expected O, but got Unknown
			//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_0130: Expected O, but got Unknown
			//IL_0199: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ef: Unknown result type (might be due to invalid IL or missing references)
			//IL_01d9: Unknown result type (might be due to invalid IL or missing references)
			//IL_0211: Unknown result type (might be due to invalid IL or missing references)
			float num = Mathf.Clamp((float)Screen.height / 1080f, 0.7f, 1.5f);
			float x = panelAnchor.x;
			float num2 = panelAnchor.y - (float)((5 - row) * 34) * num;
			Color color = GUI.color;
			GUI.color = new Color(0.055f, 0.035f, 0.015f, 0.82f);
			GUI.DrawTexture(new Rect(x, num2, 330f * num, 32f * num), (Texture)(object)Texture2D.whiteTexture);
			GUI.color = (Color)((ready > Time.time) ? new Color(0.5f, 0.5f, 0.5f, 0.85f) : Color.white);
			Texture2D val = DioUi.Texture(icon);
			if (Object.op_Implicit((Object)(object)val))
			{
				GUI.DrawTexture(new Rect(x + 3f * num, num2 + 2f * num, 28f * num, 28f * num), (Texture)(object)val, (ScaleMode)2);
			}
			GUI.color = color;
			if (moveStyle == null)
			{
				moveStyle = new GUIStyle(GUI.skin.label)
				{
					alignment = (TextAnchor)3
				};
				cooldownStyle = new GUIStyle(moveStyle)
				{
					alignment = (TextAnchor)5
				};
			}
			GUIStyle obj = moveStyle;
			int fontSize = (cooldownStyle.fontSize = Mathf.RoundToInt(14f * num));
			obj.fontSize = fontSize;
			string text = (ExtraGamepad.RecentlyUsed ? ExtraGamepad.Label(DioPlugin.GamepadMoves[row].Value) : ((object)(*(KeyCode*)(&key))/*cast due to .constrained prefix*/).ToString());
			GUI.Label(new Rect(x + 38f * num, num2, 231f * num, 32f * num), text + "  " + name, moveStyle);
			cooldownStyle.normal.textColor = ((ready > Time.time) ? new Color(1f, 0.45f, 0.45f) : new Color(0.85f, 0.9f, 0.85f));
			GUI.Label(new Rect(x + 270f * num, num2, 52f * num, 32f * num), status ?? ((ready > Time.time) ? (Mathf.CeilToInt(ready - Time.time) + "s") : "READY"), cooldownStyle);
		}
	}
	public sealed class DioBarrage : BaseSkillState
	{
		private int punches;

		private int totalPunches;

		private float duration;

		private float finisherTime;

		private float audioAge;

		private DioAudioPlayback barrageAudio;

		public override void OnEnter()
		{
			//IL_00a1: Unknown result type (might be due to invalid IL or missing references)
			((BaseState)this).OnEnter();
			float num = DioFeedback.ClipDuration("barrage", 4.4f);
			duration = num + 0.25f;
			finisherTime = num + 0.1f;
			totalPunches = Mathf.Max(2, Mathf.RoundToInt((finisherTime - 0.28f) / 0.156f) + 1);
			barrageAudio = DioFeedback.Sound(((EntityState)this).gameObject, "barrage", 1f);
			((EntityState)this).GetComponent<DioVisualDriver>()?.Action("_spa_01_lp", duration + 1f, summon: true, loop: true);
			((EntityState)this).GetComponent<DioVisualDriver>()?.BeginBarrageAim(((BaseState)this).GetAimRay());
			((BaseState)this).StartAimMode(duration + 1f, false);
		}

		public override void Update()
		{
			//IL_0012: Unknown result type (might be due to invalid IL or missing references)
			((EntityState)this).Update();
			((EntityState)this).GetComponent<DioVisualDriver>()?.SetBarrageAim(((BaseState)this).GetAimRay());
		}

		public override void FixedUpdate()
		{
			//IL_00e3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e8: 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_0104: Unknown result type (might be due to invalid IL or missing references)
			//IL_0110: Unknown result type (might be due to invalid IL or missing references)
			//IL_011c: Unknown result type (might be due to invalid IL or missing references)
			//IL_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_012c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0136: Unknown result type (might be due to invalid IL or missing references)
			//IL_0141: Unknown result type (might be due to invalid IL or missing references)
			//IL_014c: Unknown result type (might be due to invalid IL or missing references)
			//IL_016d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0185: Unknown result type (might be due to invalid IL or missing references)
			//IL_0191: Unknown result type (might be due to invalid IL or missing references)
			//IL_019c: Unknown result type (might be due to invalid IL or missing references)
			//IL_01a3: Unknown result type (might be due to invalid IL or missing references)
			//IL_01aa: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ac: Unknown result type (might be due to invalid IL or missing references)
			//IL_01b1: Unknown result type (might be due to invalid IL or missing references)
			//IL_01b9: Unknown result type (might be due to invalid IL or missing references)
			//IL_01c3: Expected O, but got Unknown
			((EntityState)this).FixedUpdate();
			audioAge = (Object.op_Implicit((Object)(object)barrageAudio) ? barrageAudio.PlaybackSeconds : (audioAge + Time.fixedDeltaTime));
			if (((EntityState)this).fixedAge > duration + 1f)
			{
				audioAge = ((EntityState)this).fixedAge;
			}
			float num = Mathf.Lerp(0.28f, finisherTime, (float)punches / (float)(totalPunches - 1));
			if (((EntityState)this).isAuthority && punches < totalPunches && audioAge >= num)
			{
				bool last = ++punches == totalPunches;
				if (last)
				{
					((EntityState)this).GetComponent<DioAttackVoice>()?.Play(finisher: true);
				}
				Ray aimRay = ((BaseState)this).GetAimRay();
				DioFeedback.Sound(((EntityState)this).gameObject, "stand-swing", 0.12f);
				new BulletAttack
				{
					owner = ((EntityState)this).gameObject,
					weapon = ((EntityState)this).gameObject,
					origin = ((Ray)(ref aimRay)).origin,
					aimVector = ((Ray)(ref aimRay)).direction,
					maxDistance = 8f,
					radius = 1.1f,
					damage = ((BaseState)this).damageStat * (last ? 5f : 1.1f),
					force = (last ? 1200 : 30),
					isCrit = ((BaseState)this).RollCrit(),
					procCoefficient = 0.4f,
					bulletCount = 1u,
					hitEffectPrefab = null,
					falloffModel = (FalloffModel)0,
					hitCallback = (HitCallback)delegate(BulletAttack attack, ref BulletHit hit)
					{
						//IL_008b: Unknown result type (might be due to invalid IL or missing references)
						//IL_0096: Unknown result type (might be due to invalid IL or missing references)
						//IL_00c9: Unknown result type (might be due to invalid IL or missing references)
						if (Object.op_Implicit((Object)(object)hit.hitHurtBox) && Object.op_Implicit((Object)(object)hit.hitHurtBox.healthComponent) && hit.hitHurtBox.healthComponent.alive && Object.op_Implicit((Object)(object)hit.hitHurtBox.healthComponent.body) && Object.op_Implicit((Object)(object)hit.hitHurtBox.healthComponent.body.teamComponent) && hit.hitHurtBox.healthComponent.body.teamComponent.teamIndex != ((BaseState)this).GetTeam())
						{
							DioFeedback.Sound(((EntityState)this).gameObject, last ? "impact-heavy" : "impact", 0.55f);
							DioFeedback.Impact(hit.point, last ? 0.8f : 0.35f);
						}
						return BulletAttack.defaultHitCallback.Invoke(attack, ref hit);
					}
				}.Fire();
			}
			if (((EntityState)this).isAuthority && audioAge >= duration)
			{
				((EntityState)this).outer.SetNextStateToMain();
			}
		}

		public override void OnExit()
		{
			if (Object.op_Implicit((Object)(object)barrageAudio))
			{
				Object.Destroy((Object)(object)((Component)barrageAudio).gameObject);
			}
			((EntityState)this).GetComponent<DioVisualDriver>()?.EndBarrageAim();
			((EntityState)this).GetComponent<DioVisualDriver>()?.Action("_spa_01_ed", 0.15f, summon: true);
			((EntityState)this).OnExit();
		}

		public override InterruptPriority GetMinimumInterruptPriority()
		{
			return (InterruptPriority)2;
		}
	}
	public sealed class DioBloodDrain : BaseSkillState
	{
		private bool fired;

		private DioGrabHold hold;

		private DioDrainPose grabPose;

		private float caughtAt;

		private float nextDrain;

		private int ticks;

		private bool crit;

		public override void OnEnter()
		{
			((BaseState)this).OnEnter();
			((BaseState)this).StartAimMode(2.5f, false);
			((EntityState)this).GetComponent<DioVisualDriver>()?.Action("_atk_l2", 2.1f, summon: false);
			DioFeedback.Sound(((EntityState)this).gameObject, "swing", 0.8f);
			crit = ((BaseState)this).RollCrit();
		}

		public override void FixedUpdate()
		{
			//IL_0041: Unknown result type (might be due to invalid IL or missing references)
			//IL_0046: Unknown result type (might be due to invalid IL or missing references)
			//IL_004b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0050: Unknown result type (might be due to invalid IL or missing references)
			//IL_005c: 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_006f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0074: Unknown result type (might be due to invalid IL or missing references)
			//IL_0079: Unknown result type (might be due to invalid IL or missing references)
			//IL_0080: Unknown result type (might be due to invalid IL or missing references)
			//IL_008a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0095: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ab: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b6: 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)
			//IL_00c5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00cf: Expected O, but got Unknown
			//IL_0167: Unknown result type (might be due to invalid IL or missing references)
			//IL_017d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0182: Unknown result type (might be due to invalid IL or missing references)
			//IL_018e: Unknown result type (might be due to invalid IL or missing references)
			//IL_019a: Unknown result type (might be due to invalid IL or missing references)
			//IL_01a6: Unknown result type (might be due to invalid IL or missing references)
			//IL_01b2: Unknown result type (might be due to invalid IL or missing references)
			//IL_01bd: Unknown result type (might be due to invalid IL or missing references)
			//IL_01bf: Unknown result type (might be due to invalid IL or missing references)
			//IL_01c4: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ce: Expected O, but got Unknown
			((EntityState)this).FixedUpdate();
			if (NetworkServer.active && !fired && ((EntityState)this).fixedAge >= 0.3f)
			{
				fired = true;
				Ray ray = ((BaseState)this).GetAimRay();
				new BulletAttack
				{
					owner = ((EntityState)this).gameObject,
					weapon = ((EntityState)this).gameObject,
					origin = ((Ray)(ref ray)).origin,
					aimVector = ((Ray)(ref ray)).direction,
					maxDistance = 8f,
					radius = 0.8f,
					damage = 0f,
					procCoefficient = 0f,
					bulletCount = 1u,
					hitCallback = (HitCallback)delegate(BulletAttack attack, ref BulletHit hit)
					{
						//IL_0067: Unknown result type (might be due to invalid IL or missing references)
						//IL_0072: Unknown result type (might be due to invalid IL or missing references)
						//IL_00bf: Unknown result type (might be due to invalid IL or missing references)
						//IL_014e: Unknown result type (might be due to invalid IL or missing references)
						HealthComponent val = (Object.op_Implicit((Object)(object)hit.hitHurtBox) ? hit.hitHurtBox.healthComponent : null);
						CharacterBody val2 = (Object.op_Implicit((Object)(object)val) ? val.body : null);
						if (Object.op_Implicit((Object)(object)val2) && val.alive && !val2.isPlayerControlled && Object.op_Implicit((Object)(object)val2.teamComponent) && val2.teamComponent.teamIndex != ((BaseState)this).GetTeam() && !Object.op_Implicit((Object)(object)((Component)val2).GetComponent<DioGrabHold>()))
						{
							hold = ((Component)val2).gameObject.AddComponent<DioGrabHold>();
							hold.Begin(((EntityState)this).characterBody, val2, ((Ray)(ref ray)).direction);
							grabPose = ((EntityState)this).gameObject.AddComponent<DioDrainPose>();
							grabPose.Begin(val2);
							caughtAt = ((EntityState)this).fixedAge;
							nextDrain = ((EntityState)this).fixedAge;
							HealToFull();
							DioFeedback.Sound(((EntityState)this).gameObject, "blood-drain-voice", 1f);
							DioFeedback.Impact(val2.corePosition, 1.4f, drain: true);
						}
						return !Object.op_Implicit((Object)(object)hit.collider);
					}
				}.Fire();
			}
			if (NetworkServer.active && Object.op_Implicit((Object)(object)hold) && Object.op_Implicit((Object)(object)hold.Victim) && hold.Victim.healthComponent.alive && ((EntityState)this).fixedAge >= nextDrain && ticks < 6)
			{
				CharacterBody victim = hold.Victim;
				ticks++;
				nextDrain += 0.25f;
				DioFeedback.Impact(victim.corePosition, 0.65f, drain: true);
				victim.healthComponent.TakeDamage(new DamageInfo
				{
					attacker = ((EntityState)this).gameObject,
					inflictor = ((EntityState)this).gameObject,
					damage = ((BaseState)this).damageStat,
					crit = crit,
					procCoefficient = 0.2f,
					position = victim.corePosition
				});
				if (ticks == 6)
				{
					HealToFull();
				}
			}
			if (((EntityState)this).isAuthority && ((Object.op_Implicit((Object)(object)hold) && ((EntityState)this).fixedAge >= caughtAt + 1.5f) || (!Object.op_Implicit((Object)(object)hold) && ((EntityState)this).fixedAge >= 1.1f)))
			{
				((EntityState)this).outer.SetNextStateToMain();
			}
		}

		private void HealToFull()
		{
			//IL_0036: Unknown result type (might be due to invalid IL or missing references)
			//IL_003c: Unknown result type (might be due to invalid IL or missing references)
			HealthComponent healthComponent = ((EntityState)this).characterBody.healthComponent;
			if (Object.op_Implicit((Object)(object)healthComponent) && healthComponent.alive)
			{
				healthComponent.Heal(Mathf.Max(0f, healthComponent.fullHealth - healthComponent.health), default(ProcChainMask), true);
			}
		}

		public override void OnExit()
		{
			if (Object.op_Implicit((Object)(object)grabPose))
			{
				((Behaviour)grabPose).enabled = false;
				Object.Destroy((Object)(object)grabPose);
			}
			if (Object.op_Implicit((Object)(object)hold))
			{
				hold.Release();
				Object.Destroy((Object)(object)hold);
			}
			((EntityState)this).OnExit();
		}

		public override InterruptPriority GetMinimumInterruptPriority()
		{
			return (InterruptPriority)2;
		}
	}
	public sealed class DioKnife : MonoBehaviour
	{
		private GameObject owner;

		private Vector3 direction;

		private float damage;

		private float traveled;

		private float stoppedTravel;

		private DioTimeWorld stopWindow;

		private bool staged;

		private Vector3 stagePoint;

		private float releaseAt;

		private float hitVolume = 0.6f;

		private CharacterBody exTarget;

		private Vector3 targetOffset;

		private bool crit;

		private static Material material;

		private static Mesh mesh;

		public static DioKnife ThrowStaged(GameObject owner, Vector3 hand, Vector3 point, CharacterBody target, float release, float damage, bool crit, Vector3 targetOffset = default(Vector3))
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			//IL_0003: Unknown result type (might be due to invalid IL or missing references)
			//IL_0004: Unknown result type (might be due to invalid IL or missing references)
			//IL_0009: Unknown result type (might be due to invalid IL or missing references)
			//IL_000c: Unknown result type (might be due to invalid IL or missing references)
			//IL_002d: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: 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)
			//IL_0045: Unknown result type (might be due to invalid IL or missing references)
			Vector3 val = point - hand;
			DioKnife dioKnife = Launch(owner, hand, ((Vector3)(ref val)).normalized, damage, crit);
			dioKnife.hitVolume = 0.22f;
			dioKnife.staged = true;
			dioKnife.stagePoint = point;
			dioKnife.releaseAt = release;
			dioKnife.exTarget = target;
			dioKnife.targetOffset = targetOffset;
			return dioKnife;
		}

		public static DioKnife Launch(GameObject owner, Vector3 origin, Vector3 direction, float damage, bool crit)
		{
			//IL_0005: Unknown result type (might be due to invalid IL or missing references)
			//IL_000a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0011: Unknown result type (might be due to invalid IL or missing references)
			//IL_0018: Unknown result type (might be due to invalid IL or missing references)
			//IL_0023: 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_002f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0035: Unknown result type (might be due to invalid IL or missing references)
			//IL_0036: Unknown result type (might be due to invalid IL or missing references)
			//IL_004a: Unknown result type (might be due to invalid IL or missing references)
			//IL_004f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0054: 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)
			//IL_0064: Unknown result type (might be due to invalid IL or missing references)
			//IL_006e: Unknown result type (might be due to invalid IL or missing references)
			//IL_007d: Unknown result type (might be due to invalid IL or missing references)
			//IL_007e: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ad: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ad: Expected O, but got Unknown
			GameObject val = new GameObject("DioKnife");
			val.AddComponent<MeshFilter>();
			val.AddComponent<MeshRenderer>();
			((Object)val).name = "DioKnife";
			val.transform.position = origin;
			val.transform.rotation = Util.QuaternionSafeLookRotation(direction) * Quaternion.AngleAxis(Random.Range(-50f, 50f), Vector3.forward);
			val.transform.localScale = Vector3.one;
			DioKnife dioKnife = val.AddComponent<DioKnife>();
			dioKnife.owner = owner;
			dioKnife.direction = direction;
			dioKnife.damage = damage;
			dioKnife.crit = crit;
			if (!Object.op_Implicit((Object)(object)material))
			{
				material = new Material(DioFeedback.RingShader);
			}
			val.GetComponent<Renderer>().sharedMaterial = material;
			if (!Object.op_Implicit((Object)(object)mesh))
			{
				mesh = DioKnifeMesh.Create();
			}
			val.GetComponent<MeshFilter>().sharedMesh = mesh;
			return dioKnife;
		}

		private void FixedUpdate()
		{
			//IL_0200: Unknown result type (might be due to invalid IL or missing references)
			//IL_0205: Unknown result type (might be due to invalid IL or missing references)
			//IL_0211: Unknown result type (might be due to invalid IL or missing references)
			//IL_021d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0224: Unknown result type (might be due to invalid IL or missing references)
			//IL_0229: Unknown result type (might be due to invalid IL or missing references)
			//IL_022e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0230: Unknown result type (might be due to invalid IL or missing references)
			//IL_023a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0241: Unknown result type (might be due to invalid IL or missing references)
			//IL_024c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0258: Unknown result type (might be due to invalid IL or missing references)
			//IL_0264: Unknown result type (might be due to invalid IL or missing references)
			//IL_026f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0276: Unknown result type (might be due to invalid IL or missing references)
			//IL_027d: Unknown result type (might be due to invalid IL or missing references)
			//IL_027f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0284: Unknown result type (might be due to invalid IL or missing references)
			//IL_028c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0296: Expected O, but got Unknown
			//IL_02a2: Unknown result type (might be due to invalid IL or missing references)
			//IL_02a8: Unknown result type (might be due to invalid IL or missing references)
			//IL_02ae: Unknown result type (might be due to invalid IL or missing references)
			//IL_02b3: Unknown result type (might be due to invalid IL or missing references)
			//IL_0106: Unknown result type (might be due to invalid IL or missing references)
			//IL_0072: Unknown result type (might be due to invalid IL or missing references)
			//IL_0078: Unknown result type (might be due to invalid IL or missing references)
			//IL_0088: Unknown result type (might be due to invalid IL or missing references)
			//IL_008d: Unknown result type (might be due to invalid IL or missing references)
			//IL_008e: Unknown result type (might be due to invalid IL or missing references)
			//IL_012c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0132: 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_0142: Unknown result type (might be due to invalid IL or missing references)
			//IL_0147: Unknown result type (might be due to invalid IL or missing references)
			//IL_014c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0150: Unknown result type (might be due to invalid IL or missing references)
			//IL_0155: Unknown result type (might be due to invalid IL or missing references)
			//IL_0161: Unknown result type (might be due to invalid IL or missing references)
			//IL_0166: Unknown result type (might be due to invalid IL or missing references)
			//IL_009c: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00aa: Unknown result type (might be due to invalid IL or missing references)
			//IL_00cd: Unknown result type (might be due to invalid IL or missing references)
			//IL_00df: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ea: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ef: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f5: Unknown result type (might be due to invalid IL or missing references)
			if (!Object.op_Implicit((Object)(object)owner))
			{
				Object.Destroy((Object)(object)((Component)this).gameObject);
				return;
			}
			if (staged)
			{
				if (!Object.op_Implicit((Object)(object)exTarget) || !exTarget.healthComponent.alive)
				{
					Object.Destroy((Object)(object)((Component)this).gameObject);
					return;
				}
				if (Time.time < releaseAt)
				{
					Vector3 val = Vector3.MoveTowards(((Component)this).transform.position, stagePoint, 65f * Time.fixedDeltaTime);
					if (DioSpecialGeometry.ClearKnife(val))
					{
						Vector3 position = ((Component)this).transform.position;
						LayerIndex world = LayerIndex.world;
						if (!Physics.Linecast(position, val, LayerMask.op_Implicit(((LayerIndex)(ref world)).mask)))
						{
							((Component)this).transform.position = val;
							((Component)this).transform.rotation = Util.QuaternionSafeLookRotation(exTarget.corePosition + targetOffset - val);
							return;
						}
					}
					Object.Destroy((Object)(object)((Component)this).gameObject);
					return;
				}
				if (!DioSpecialGeometry.ClearKnife(((Component)this).transform.position))
				{
					Object.Destroy((Object)(object)((Component)this).gameObject);
					return;
				}
				staged = false;
				Vector3 val2 = exTarget.corePosition + targetOffset - ((Component)this).transform.position;
				direction = ((Vector3)(ref val2)).normalized;
				((Component)this).transform.rotation = Util.QuaternionSafeLookRotation(direction);
			}
			float num = 65f * Time.fixedDeltaTime;
			if (DioTimeWorld.StopsProjectileOf(owner))
			{
				if ((Object)(object)stopWindow != (Object)(object)DioTimeWorld.Active)
				{
					stopWindow = DioTimeWorld.Active;
					stoppedTravel = 0f;
				}
				num = Mathf.Min(num, Mathf.Max(0f, 3f - stoppedTravel));
				if (num <= 0f)
				{
					return;
				}
				stoppedTravel += num;
			}
			else
			{
				stopWindow = null;
				stoppedTravel = 0f;
			}
			bool collided = false;
			new BulletAttack
			{
				owner = owner,
				weapon = owner,
				origin = ((Component)this).transform.position,
				aimVector = direction,
				maxDistance = num,
				radius = 0.18f,
				damage = damage,
				isCrit = crit,
				procCoefficient = 0.7f,
				bulletCount = 1u,
				hitEffectPrefab = null,
				falloffModel = (FalloffModel)0,
				hitCallback = (HitCallback)delegate(BulletAttack attack, ref BulletHit hit)
				{
					//IL_0023: Unknown result type (might be due to invalid IL or missing references)
					if (Object.op_Implicit((Object)(object)hit.collider))
					{
						if (!collided)
						{
							DioFeedback.KnifeImpact(owner, hit.point, hitVolume);
						}
						collided = true;
					}
					return BulletAttack.defaultHitCallback.Invoke(attack, ref hit);
				}
			}.Fire();
			Transform transform = ((Component)this).transform;
			transform.position += direction * num;
			traveled += num;
			if (collided || traveled >= 120f)
			{
				Object.Destroy((Object)(object)((Component)this).gameObject);
			}
		}
	}
	internal static class DioFeedback
	{
		private sealed class PcmClip
		{
			public byte[] Data;

			public int Channels;

			public int Rate;
		}

		private static readonly Dictionary<string, PcmClip> clips = new Dictionary<string, PcmClip>();

		internal static Shader RippleShader;

		internal static Shader RingShader;

		internal static Shader TimeOverlayShader;

		internal static Texture2D StopAtlas;

		internal static Texture2D ResumeAtlas;

		private static float nextKnifeEffect;

		private static float nextKnifeSound;

		internal static float ClipDuration(string name, float fallback)
		{
			if (!clips.TryGetValue(name, out var value))
			{
				return fallback;
			}
			return (float)value.Data.Length / (float)(value.Channels * 2 * value.Rate);
		}

		internal static string RandomTimeStopVoice()
		{
			List<string> list = new List<string>();
			foreach (string key in clips.Keys)
			{
				if (key.StartsWith("za-warudo-voice-", StringComparison.Ordinal))
				{
					list.Add(key);
				}
			}
			list.Sort(StringComparer.Ordinal);
			if (list.Count <= 0)
			{
				return null;
			}
			return list[Random.Range(0, list.Count)];
		}

		internal static void LoadAudio()
		{
			string path = Path.Combine(Path.GetDirectoryName(typeof(DioPlugin).Assembly.Location), "Audio");
			if (!Directory.Exists(path))
			{
				DioPlugin.Log.LogWarning((object)"DIO Audio folder missing.");
				return;
			}
			string[] files = Directory.GetFiles(path, "*.wav");
			foreach (string text in files)
			{
				try
				{
					using BinaryReader binaryReader = new BinaryReader(File.OpenRead(text));
					if (new string(binaryReader.ReadChars(4)) != "RIFF")
					{
						continue;
					}
					binaryReader.ReadInt32();
					if (new string(binaryReader.ReadChars(4)) != "WAVE")
					{
						continue;
					}
					int num = 0;
					int num2 = 0;
					int num3 = 0;
					int num4 = 0;
					byte[] array = null;
					while (binaryReader.BaseStream.Position + 8 <= binaryReader.BaseStream.Length)
					{
						string text2 = new string(binaryReader.ReadChars(4));
						int num5 = binaryReader.ReadInt32();
						long num6 = binaryReader.BaseStream.Position + num5 + (num5 & 1);
						if (num5 < 0 || num6 > binaryReader.BaseStream.Length)
						{
							throw new InvalidDataException("Invalid WAV chunk.");
						}
						if (text2 == "fmt ")
						{
							num4 = binaryReader.ReadInt16();
							num = binaryReader.ReadInt16();
							num2 = binaryReader.ReadInt32();
							binaryReader.ReadInt32();
							binaryReader.ReadInt16();
							num3 = binaryReader.ReadInt16();
						}
						else if (text2 == "data")
						{
							array = binaryReader.ReadBytes(num5);
						}
						binaryReader.BaseStream.Position = num6;
					}
					if (num4 != 1 || num3 != 16 || num < 1 || num2 < 1 || array == null)
					{
						throw new InvalidDataException("Expected PCM16 WAV.");
					}
					if (array.Length == 0 || array.Length % (num * 2) != 0)
					{
						throw new InvalidDataException("Invalid PCM sample alignment.");
					}
					string fileNameWithoutExtension = Path.GetFileNameWithoutExtension(text);
					clips[fileNameWithoutExtension] = new PcmClip
					{
						Data = array,
						Channels = num,
						Rate = num2
					};
				}
				catch (Exception ex)
				{
					DioPlugin.Log.LogWarning((object)("DIO audio: " + text + ": " + ex.Message));
				}
			}
			DioPlugin.Log.LogInfo((object)("Loaded " + clips.Count + " DIO sound clips (EOH and user-provided audio)."));
		}

		internal static void LoadShaders()
		{
			AssetBundle val = AssetBundle.LoadFromFile(Path.Combine(Path.GetDirectoryName(typeof(DioPlugin).Assembly.Location), "diofeedback"));
			if (Object.op_Implicit((Object)(object)val))
			{
				DioUi.Load(val);
				RippleShader = val.LoadAsset<Shader>("Assets/Feedback/DioRipple.shader");
				RingShader = val.LoadAsset<Shader>("Assets/Feedback/DioRing.shader");
				TimeOverlayShader = val.LoadAsset<Shader>("Assets/Feedback/DioTimeOverlay.shader");
				StopAtlas = val.LoadAsset<Texture2D>("Assets/Feedback/DioStopAtlas.png");
				ResumeAtlas = val.LoadAsset<Texture2D>("Assets/Feedback/DioResumeAtlas.png");
				DioPlugin.Log.LogInfo((object)("Time overlay loaded: shader=" + Object.op_Implicit((Object)(object)TimeOverlayShader) + " start=" + Object.op_Implicit((Object)(object)StopAtlas) + " end=" + Object.op_Implicit((Object)(object)ResumeAtlas)));
			}
		}

		internal static DioAudioPlayback Sound(GameObject owner, string name, float volume)
		{
			//IL_0031: Unknown result type (might be due to invalid IL or missing references)
			//IL_0037: Expected O, but got Unknown
			if (!clips.TryGetValue(name, out var value))
			{
				DioPlugin.Log.LogWarning((object)("Missing DIO audio: " + name));
				return null;
			}
			GameObject val = new GameObject("DioSound_" + name);
			DioAudioPlayback dioAudioPlayback = val.AddComponent<DioAudioPlayback>();
			if (dioAudioPlayback.Begin(value.Data, value.Channels, value.Rate, Mathf.Clamp01(volume * DioPlugin.SoundVolume.Value)))
			{
				DioVoiceCaptions.Show(owner, dioAudioPlayback, name, (float)value.Data.Length / (float)(value.Channels * 2 * value.Rate));
				return dioAudioPlayback;
			}
			Object.Destroy((Object)(object)val);
			return null;
		}

		internal static void TimePulse(GameObject owner, Vector3 origin, bool local, bool playSound = true)
		{
			//IL_0014: Unknown result type (might be due to invalid IL or missing references)
			if (playSound)
			{
				Sound(owner, "time-stop", 1f);
			}
			Rings(origin);
			if (!local || !Object.op_Implicit((Object)(object)RippleShader))
			{
				return;
			}
			Camera[] allCameras = Camera.allCameras;
			foreach (Camera val in allCameras)
			{
				if (((Object)val).name == "Scene Camera")
				{
					DioScreenPulse dioScreenPulse = ((Component)val).GetComponent<DioScreenPulse>();
					if (!Object.op_Implicit((Object)(object)dioScreenPulse))
					{
						dioScreenPulse = ((Component)val).gameObject.AddComponent<DioScreenPulse>();
					}
					dioScreenPulse.Trigger();
				}
			}
		}

		internal static void MainTimeTransition(bool ending, bool local, float seconds = 15f, bool replay = true, CharacterBody owner = null)
		{
			if (!local)
			{
				return;
			}
			Camera[] allCameras = Camera.allCameras;
			foreach (Camera val in allCameras)
			{
				if (((Object)val).name == "Scene Camera")
				{
					DioScreenPulse dioScreenPulse = ((Component)val).GetComponent<DioScreenPulse>();
					if (!Object.op_Implicit((Object)(object)dioScreenPulse))
					{
						dioScreenPulse = ((Component)val).gameObject.AddComponent<DioScreenPulse>();
					}
					dioScreenPulse.TriggerMain(ending, seconds, replay, owner);
				}
			}
		}

		internal static void ExTransition(CharacterBody owner, bool ending)
		{
			if (!Object.op_Implicit((Object)(object)owner) || !owner.hasEffectiveAuthority)
			{
				return;
			}
			CameraRigController[] array = Object.FindObjectsOfType<CameraRigController>();
			foreach (CameraRigController val in array)
			{
				if ((Object)(object)val.targetBody == (Object)(object)owner && val.localUserViewer != null && Object.op_Implicit((Object)(object)val.sceneCam))
				{
					DioScreenPulse dioScreenPulse = ((Component)val.sceneCam).GetComponent<DioScreenPulse>();
					if (!Object.op_Implicit((Object)(object)dioScreenPulse))
					{
						dioScreenPulse = ((Component)val.sceneCam).gameObject.AddComponent<DioScreenPulse>();
					}
					dioScreenPulse.TriggerEx(ending);
				}
			}
		}

		internal static void Rings(Vector3 origin)
		{
			//IL_0012: Unknown result type (might be due to invalid IL or missing references)
			//IL_0017: Unknown result type (might be due to invalid IL or missing references)
			//IL_001d: Unknown result type (might be due to invalid IL or missing references)
			if (Object.op_Implicit((Object)(object)RingShader))
			{
				GameObject val = new GameObject("DioTimeRipple");
				val.transform.position = origin;
				val.AddComponent<DioTimeRings>();
			}
		}

		internal static void Impact(Vector3 origin, float scale, bool drain = false)
		{
			//IL_0012: Unknown result type (might be due to invalid IL or missing references)
			//IL_0017: Unknown result type (might be due to invalid IL or missing references)
			//IL_001d: Expected O, but got Unknown
			//IL_001d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0023: Unknown result type (might be due to invalid IL or missing references)
			if (Object.op_Implicit((Object)(object)RingShader))
			{
				GameObject val = new GameObject("DioImpact");
				DioTimeWorld.MarkRollerEffect(val);
				val.transform.position = origin;
				DioImpactBurst dioImpactBurst = val.AddComponent<DioImpactBurst>();
				dioImpactBurst.Size = scale;
				dioImpactBurst.Drain = drain;
			}
		}

		internal static void KnifeImpact(GameObject owner, Vector3 point, float volume)
		{
			//IL_001c: Unknown result type (might be due to invalid IL or missing references)
			if (Time.time >= nextKnifeEffect)
			{
				nextKnifeEffect = Time.time + 0.045f;
				DioStandParticles.Emit(point, impact: true);
			}
			if (Time.time >= nextKnifeSound)
			{
				nextKnifeSound = Time.time + 0.065f;
				Sound(owner, "knife-impact", volume);
			}
		}
	}
	public sealed class DioImpactBurst : MonoBehaviour
	{
		public float Size = 1f;

		public bool Drain;

		private Material material;

		private LineRenderer[] rays;

		private float age;

		private void Start()
		{
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			//IL_0010: Expected O, but got Unknown
			//IL_0029: Unknown result type (might be due to invalid IL or missing references)
			//IL_002f: Expected O, but got Unknown
			//IL_0081: Unknown result type (might be due to invalid IL or missing references)
			//IL_0086: Unknown result type (might be due to invalid IL or missing references)
			//IL_008b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0090: Unknown result type (might be due to invalid IL or missing references)
			//IL_0093: Unknown result type (might be due to invalid IL or missing references)
			//IL_0099: 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_00b7: Unknown result type (might be due to invalid IL or missing references)
			material = new Material(DioFeedback.RingShader);
			rays = (LineRenderer[])(object)new LineRenderer[12];
			for (int i = 0; i < rays.Length; i++)
			{
				GameObject val = new GameObject("ImpactRay");
				val.transform.SetParent(((Component)this).transform, false);
				LineRenderer obj = (rays[i] = val.AddComponent<LineRenderer>());
				((Renderer)obj).sharedMaterial = material;
				obj.useWorldSpace = false;
				obj.positionCount = 2;
				Vector3 val2 = Quaternion.Euler((float)i * 137.5f, (float)i * 73f, 0f) * Vector3.forward;
				obj.SetPosition(0, val2 * 0.15f);
				obj.SetPosition(1, val2 * ((i % 2 == 0) ? 2f : 1.2f));
				obj.startWidth = 0.18f;
				obj.endWidth = 0f;
			}
		}

		private void Update()
		{
			//IL_0053: 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)
			//IL_0073: 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_00a9: 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_00cd: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ce: Unknown result type (might be due to invalid IL or missing references)
			//IL_00cf: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d6: Unknown result type (might be due to invalid IL or missing references)
			if (Object.op_Implicit((Object)(object)DioTimeWorld.Active) && !Object.op_Implicit((Object)(object)((Component)this).GetComponent<DioTimeStopExempt>()))
			{
				return;
			}
			age += Time.deltaTime;
			float num = age / 0.22f;
			if (num >= 1f)
			{
				Object.Destroy((Object)(object)((Component)this).gameObject);
				return;
			}
			((Component)this).transform.localScale = Vector3.one * Size * Mathf.Lerp(0.4f, 1.5f, num);
			LineRenderer[] array = rays;
			foreach (LineRenderer obj in array)
			{
				Color val = (Drain ? new Color(0.9f, 0.05f, 0.2f, 1f - num) : new Color(1f, 0.8f, 0.2f, 1f - num));
				Color startColor = (obj.endColor = val);
				obj.startColor = startColor;
			}
		}

		private void OnDestroy()
		{
			if (Object.op_Implicit((Object)(object)material))
			{
				Object.Destroy((Object)(object)material);
			}
		}
	}
	public sealed class DioScreenPulse : MonoBehaviour
	{
		private Material material;

		private Material overlayMaterial;

		private float started = -100f;

		private float overlayStarted = -100f;

		private bool overlayEnding;

		private bool mainGrey;

		private CharacterBody mainOwner;

		private bool trackedOwner;

		private float mainGreyEnds = float.PositiveInfinity;

		private float overlaySpeed = 1f;

		private float exGreyUntil = -100f;

		public void Trigger()
		{
			started = Time.time;
			((Behaviour)this).enabled = true;
		}

		public void TriggerMain(bool ending, float seconds = 15f, bool replay = true, CharacterBody owner = null)
		{
			if (Object.op_Implicit((Object)(object)owner))
			{
				mainOwner = owner;
				trackedOwner = true;
			}
			overlaySpeed = 1f;
			exGreyUntil = -100f;
			mainGrey = true;
			mainGreyEnds = (ending ? (Time.time + 19f / 24f) : (Time.time + Mathf.Clamp(seconds, 0f, 15f) + 1f));
			if (ending || replay || !((Behaviour)this).enabled || !(Time.time - overlayStarted > 0.01f))
			{
				overlayStarted = Time.time;
				overlayEnding = ending;
				((Behaviour)this).enabled = true;
				started = -100f;
			}
		}

		public void TriggerEx(bool ending)
		{
			overlayStarted = Time.time;
			overlayEnding = ending;
			((Behaviour)this).enabled = true;
			started = -100f;
			overlaySpeed = 6f;
			exGreyUntil = (ending ? (Time.time + 0.06f) : (Time.time + 1.5f));
		}

		private void Update()
		{
			if (!Object.op_Implicit((Object)(object)Run.instance))
			{
				mainGrey = false;
				exGreyUntil = -100f;
				overlayStarted = -100f;
				started = -100f;
			}
			if (mainGrey && !overlayEnding && trackedOwner && (!Object.op_Implicit((Object)(object)mainOwner) || !Object.op_Implicit((Object)(object)mainOwner.healthComponent) || !mainOwner.healthComponent.alive))
			{
				TriggerMain(ending: true);
			}
			if (mainGrey && Time.time >= mainGreyEnds)
			{
				if (!overlayEnding)
				{
					TriggerMain(ending: true);
				}
				else
				{
					mainGrey = false;
				}
			}
			if (Time.time - started > 0.65f && Time.time - overlayStarted >= (overlayEnding ? 19f : 20f) / (24f * overlaySpeed) && Time.time >= exGreyUntil && !mainGrey)
			{
				((Behaviour)this).enabled = false;
			}
		}

		private void OnRenderImage(RenderTexture source, RenderTexture destination)
		{
			//IL_0075: Unknown result type (might be due to invalid IL or missing references)
			//IL_007f: Expected O, but got Unknown
			//IL_01c0: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ca: Expected O, but got Unknown
			//IL_016c: Unknown result type (might be due to invalid IL or missing references)
			int num = Mathf.FloorToInt((Time.time - overlayStarted) * 24f * overlaySpeed);
			bool flag = num >= 0 && num < (overlayEnding ? 19 : 20);
			if ((flag || mainGrey || Time.time < exGreyUntil) && Object.op_Implicit((Object)(object)DioFeedback.TimeOverlayShader))
			{
				if (!Object.op_Implicit((Object)(object)overlayMaterial))
				{
					overlayMaterial = new Material(DioFeedback.TimeOverlayShader);
				}
				Texture2D val = (overlayEnding ? DioFeedback.ResumeAtlas : DioFeedback.StopAtlas);
				overlayMaterial.SetFloat("_Stopped", (float)((flag || mainGrey || Time.time < exGreyUntil) ? 1 : 0));
				overlayMaterial.SetFloat("_HasOverlay", (float)((flag && Object.op_Implicit((Object)(object)val)) ? 1 : 0));
				if (flag && Object.op_Implicit((Object)(object)val))
				{
					overlayMaterial.SetTexture("_OverlayTex", (Texture)(object)val);
					overlayMaterial.SetVector("_FrameRect", new Vector4((float)(num % 5) / 5f + 0.5f / (float)((Texture)val).width, 1f - (float)(num / 5 + 1) / 4f + 0.5f / (float)((Texture)val).height, 0.2f - 1f / (float)((Texture)val).width, 0.25f - 1f / (float)((Texture)val).height));
				}
				Graphics.Blit((Texture)(object)source, destination, overlayMaterial);
				return;
			}
			float num2 = Time.time - started;
			if (num2 > 0.65f || !Object.op_Implicit((Object)(object)DioFeedback.RippleShader))
			{
				Graphics.Blit((Texture)(object)source, destination);
				return;
			}
			if (!Object.op_Implicit((Object)(object)material))
			{
				material = new Material(DioFeedback.RippleShader);
			}
			material.SetFloat("_Progress", Mathf.Clamp01(num2 / 0.65f));
			material.SetFloat("_Stopped", (float)(Object.op_Implicit((Object)(object)DioTimeWorld.Active) ? 1 : 0));
			Graphics.Blit((Texture)(object)source, destination, material);
		}

		private void OnDestroy()
		{
			if (Object.op_Implicit((Object)(object)material))
			{
				Object.Destroy((Object)(object)material);
			}
			if (Object.op_Implicit((Object)(object)overlayMaterial))
			{
				Object.Destroy((Object)(object)overlayMaterial);
			}
		}
	}
	public sealed class DioTimeRings : MonoBehaviour
	{
		private Material material;

		private LineRenderer[] rings;

		private float age;

		private void Awake()
		{
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			//IL_0010: Expected O, but got Unknown
			//IL_0034: Unknown result type (might be due to invalid IL or missing references)
			//IL_003a: Expected O, but got Unknown
			//IL_00d7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00dc: Unknown result type (might be due to invalid IL or missing references)
			//IL_00de: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e3: Unknown result type (might be due to invalid IL or missing references)
			//IL_0109: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f8: Unknown result type (might be due to invalid IL or missing references)
			//IL_00fd: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ff: Unknown result type (might be due to invalid IL or missing references)
			//IL_0104: Unknown result type (might be due to invalid IL or missing references)
			material = new Material(DioFeedback.RingShader);
			rings = (LineRenderer[])(object)new LineRenderer[3];
			Vector3 val3 = default(Vector3);
			for (int i = 0; i < rings.Length; i++)
			{
				GameObject val = new GameObject("Ring" + i);
				val.transform.SetParent(((Component)this).transform, false);
				LineRenderer val2 = (rings[i] = val.AddComponent<LineRenderer>());
				((Renderer)val2).sharedMaterial = material;
				val2.useWorldSpace = false;
				val2.loop = true;
				val2.positionCount = 97;
				val2.widthMultiplier = 0.15f;
				for (int j = 0; j < 97; j++)
				{
					float num = (float)j * MathF.PI * 2f / 97f;
					((Vector3)(ref val3))..ctor(Mathf.Cos(num), Mathf.Sin(num), 0f);
					if (i == 1)
					{
						val3 = Quaternion.Euler(90f, 0f, 0f) * val3;
					}
					if (i == 2)
					{
						val3 = Quaternion.Euler(0f, 90f, 0f) * val3;
					}
					val2.SetPosition(j, val3);
				}
			}
		}

		private void Update()
		{
			//IL_0039: Unknown result type (might be due to invalid IL or missing references)
			//IL_004e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0093: Unknown result type (might be due to invalid IL or missing references)
			//IL_0076: Unknown result type (might be due to invalid IL or missing references)
			//IL_0098: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a9: Unknown result type (might be due to invalid IL or missing references)
			//IL_00aa: 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_00b1: Unknown result type (might be due to invalid IL or missing references)
			age += Time.deltaTime;
			float num = age / 0.6f;
			if (num >= 1f)
			{
				Object.Destroy((Object)(object)((Component)this).gameObject);
				return;
			}
			((Component)this).transform.localScale = Vector3.one * Mathf.Lerp(0.3f, 12f, num);
			for (int i = 0; i < rings.Length; i++)
			{
				Color val = ((i == 1) ? new Color(0.65f, 0.2f, 1f, 1f - num) : new Color(1f, 0.8f, 0.15f, 1f - num));
				LineRenderer obj = rings[i];
				Color startColor = (rings[i].endColor = val);
				obj.startColor = startColor;
			}
		}

		private void OnDestroy()
		{
			if (Object.op_Implicit((Object)(object)material))
			{
				Object.Destroy((Object)(object)material);
			}
		}
	}
	[DefaultExecutionOrder(32001)]
	public sealed class DioGrabHold : MonoBehaviour
	{
		private CharacterBody captor;

		private Vector3 direction;

		private float expires;

		private bool released;

		private bool stationary;

		private Vector3 anchor;

		private bool hasContact;

		private Vector3 contact;

		private readonly HashSet<Behaviour> paused = new HashSet<Behaviour>();

		private readonly List<Action> restore = new List<Action>();

		public CharacterBody Victim { get; private set; }

		public void SetContact(Vector3 point)
		{
			//IL_0008: Unknown result type (might be due to invalid IL or missing references)
			//IL_0009: Unknown result type (might be due to invalid IL or missing references)
			hasContact = true;
			contact = point;
		}

		public void Begin(CharacterBody owner, CharacterBody victim, Vector3 aim, bool stayInPlace = false, float duration = 2f)
		{
			//IL_0011: Unknown result type (might be due to invalid IL or missing references)
			//IL_0016: Unknown result type (might be due to invalid IL or missing references)
			//IL_0038: Unknown result type (might be due to invalid IL or missing references)
			//IL_003d: Unknown result type (might be due to invalid IL or missing references)
			captor = owner;
			Victim = victim;
			direction = ((Vector3)(ref aim)).normalized;
			expires = Time.time + duration;
			stationary = stayInPlace;
			anchor = ((Component)victim).transform.position;
			Suspend();
		}

		private void Pause(Behaviour component)
		{
			if (!Object.op_Implicit((Object)(object)component) || !component.enabled)
			{
				return;
			}
			component.enabled = false;
			if (!paused.Add(component))
			{
				return;
			}
			restore.Add(delegate
			{
				if (Object.op_Implicit((Object)(object)component))
				{
					component.enabled = true;
				}
			});
		}

		private void Suspend()
		{
			EntityStateMachine[] components = ((Component)Victim).GetComponents<EntityStateMachine>();
			foreach (EntityStateMachine component in components)
			{
				Pause((Behaviour)(object)component);
			}
			Transform val = ((Object.op_Implicit((Object)(object)Victim.modelLocator) && Object.op_Implicit((Object)(object)Victim.modelLocator.modelTransform)) ? Victim.modelLocator.modelTransform : ((Component)Victim).transform);
			Animation[] componentsInChildren = ((Component)val).GetComponentsInChildren<Animation>(true);
			foreach (Animation component2 in componentsInChildren)
			{
				Pause((Behaviour)(object)component2);
			}
			Animator[] componentsInChildren2 = ((Component)val).GetComponentsInChildren<Animator>(true);
			foreach (Animator component3 in componentsInChildren2)
			{
				Pause((Behaviour)(object)component3);
			}
			Pause((Behaviour)(object)Victim.characterMotor);
			Pause((Behaviour)(object)((Component)Victim).GetComponent<CharacterDirection>());
			Pause((Behaviour)(object)((Component)Victim).GetComponent<RigidbodyMotor>());
			if (Object.op_Implicit((Object)(object)Victim.master))
			{
				BaseAI[] components2 = ((Component)Victim.master).GetComponents<BaseAI>();
				foreach (BaseAI component4 in components2)
				{
					Pause((Behaviour)(object)component4);
				}
			}
		}

		private void LateUpdate()
		{
			//IL_006d: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a8: 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_00b3: 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)
			//IL_00bc: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ed: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f2: Unknown result type (might be due to invalid IL or missing references)
			//IL_0102: Unknown result type (might be due to invalid IL or missing references)
			//IL_010d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0112: Unknown result type (might be due to invalid IL or missing references)
			//IL_0117: Unknown result type (might be due to invalid IL or missing references)
			//IL_011c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0162: Unknown result type (might be due to invalid IL or missing references)
			//IL_016e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0173: Unknown result type (might be due to invalid IL or missing references)
			//IL_0178: Unknown result type (might be due to invalid IL or missing references)
			//IL_018e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0196: 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_01ad: 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_013e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0149: Unknown result type (might be due to invalid IL or missing references)
			//IL_014e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0152: Unknown result type (might be due to invalid IL or missing references)
			//IL_0157: Unknown result type (might be due to invalid IL or missing references)
			//IL_015c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0161: Unknown result type (might be due to invalid IL or missing references)
			//IL_0201: Unknown result type (might be due to invalid IL or missing references)
			//IL_0206: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ca: Unknown result type (might be due to invalid IL or missing references)
			//IL_01d1: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ed: Unknown result type (might be due to invalid IL or missing references)
			//IL_01f2: Unknown result type (might be due to invalid IL or missing references)
			//IL_01f7: Unknown result type (might be due to invalid IL or missing references)
			//IL_0224: Unknown result type (might be due to invalid IL or missing references)
			//IL_0229: Unknown result type (might be due to invalid IL or missing references)
			//IL_023e: Unknown result type (might be due to invalid IL or missing references)
			//IL_028f: Unknown result type (might be due to invalid IL or missing references)
			//IL_027e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0266: Unknown result type (might be due to invalid IL or missing references)
			//IL_0272: Unknown result type (might be due to invalid IL or missing references)
			if (released)
			{
				return;
			}
			if (!Object.op_Implicit((Object)(object)captor) || !Object.op_Implicit((Object)(object)Victim) || !captor.healthComponent.alive || !Victim.healthComponent.alive || Time.time >= expires)
			{
				Release();
				Object.Destroy((Object)(object)this);
				return;
			}
			Suspend();
			Vector3 corePosition = captor.corePosition;
			float num = Mathf.Max(0.4f, Victim.radius);
			float num2 = Mathf.Max(num + 0.75f, captor.radius + num + 0.1f);
			Vector3 val = direction;
			float num3 = num2;
			LayerIndex world = LayerIndex.world;
			RaycastHit val2 = default(RaycastHit);
			if (Physics.SphereCast(corePosition, num, val, ref val2, num3, LayerMask.op_Implicit(((LayerIndex)(ref world)).mask), (QueryTriggerInteraction)1))
			{
				num2 = Mathf.Max(0f, ((RaycastHit)(ref val2)).distance - 0.1f);
			}
			Vector3 val3 = corePosition + direction * num2 + (((Component)Victim).transform.position - Victim.corePosition);
			if (hasContact && !stationary)
			{
				Vector3 val4 = contact;
				Vector3 position = ((Component)Victim).transform.position;
				Bounds val5 = DioSpecialGeometry.TargetBounds(Victim);
				val3 = val4 + (position - ((Bounds)(ref val5)).center);
			}
			Vector3 val6 = val3 - ((Component)Victim).transform.position;
			if (((Vector3)(ref val6)).sqrMagnitude > 0.0001f)
			{
				Vector3 corePosition2 = Victim.corePosition;
				Vector3 normalized = ((Vector3)(ref val6)).normalized;
				float magnitude = ((Vector3)(ref val6)).magnitude;
				world = LayerIndex.world;
				RaycastHit val7 = default(RaycastHit);
				if (Physics.SphereCast(corePosition2, num, normalized, ref val7, magnitude, LayerMask.op_Implicit(((LayerIndex)(ref world)).mask), (QueryTriggerInteraction)1))
				{
					val3 = ((Component)Victim).transform.position + ((Vector3)(ref val6)).normalized * Mathf.Max(0f, ((RaycastHit)(ref val7)).distance - 0.1f);
				}
			}
			if (stationary)
			{
				val3 = anchor;
			}
			if (Object.op_Implicit((Object)(object)Victim.characterMotor))
			{
				Victim.characterMotor.velocity = Vector3.zero;
				((BaseCharacterController)Victim.characterMotor).Motor.SetPosition(val3, true);
			}
			Rigidbody component = ((Component)Victim).GetComponent<Rigidbody>();
			if (Object.op_Implicit((Object)(object)component))
			{
				if (!component.isKinematic)
				{
					component.velocity = Vector3.zero;
					component.angularVelocity = Vector3.zero;
				}
				component.position = val3;
			}
			((Component)Victim).transform.position = val3;
			DioTimeWorld.UpdateHeldPosition(((Component)Victim).transform);
		}

		public void Release()
		{
			if (released)
			{
				return;
			}
			released = true;
			Action[] actions = restore.ToArray();
			Action action = delegate
			{
				Action[] array = actions;
				for (int i = 0; i < array.Length; i++)
				{
					array[i]();
				}
			};
			if (!DioTimeWorld.RestoreAfterStop(((Component)this).gameObject, action))
			{
				action();
			}
			restore.Clear();
			paused.Clear();
		}

		private void OnDisable()
		{
			Release();
		}

		private void OnDestroy()
		{
			Release();
		}
	}
	internal static class DioGuardMath
	{
		internal const float DamageMultiplier = 0.1f;

		internal static bool InFront(float forwardX, float forwardZ, float sourceX, float sourceZ)
		{
			float num = (float)Math.Sqrt((forwardX * forwardX + forwardZ * forwardZ) * (sourceX * sourceX + sourceZ * sourceZ));
			if (num > 0.0001f)
			{
				return (forwardX * sourceX + forwardZ * sourceZ) / num >= 0.5f;
			}
			return false;
		}
	}
	internal static class DioInput
	{
		internal static bool IsLocal(CharacterBody body)
		{
			if (!Object.op_Implicit((Object)(object)body))
			{
				return false;
			}
			foreach (LocalUser readOnlyLocalUsers in LocalUserManager.readOnlyLocalUsersList)
			{
				if ((Object)(object)readOnlyLocalUsers.cachedBody == (Object)(object)body)
				{
					return true;
				}
			}
			return false;
		}

		internal static bool Allowed(CharacterBody body)
		{
			if (!Object.op_Implicit((Object)(object)body) || !Object.op_Implicit((Object)(object)Run.instance) || !Application.isFocused || body.allSkillsDisabled || Time.timeScale == 0f)
			{
				return false;
			}
			foreach (LocalUser readOnlyLocalUsers in LocalUserManager.readOnlyLocalUsersList)
			{
				if ((Object)(object)readOnlyLocalUsers.cachedBody == (Object)(object)body)
				{
					return !Object.op_Implicit((Object)(object)readOnlyLocalUsers.pauseScreenController) && (!Object.op_Implicit((Object)(object)readOnlyLocalUsers.eventSystem) || !readOnlyLocalUsers.eventSystem.isCursorVisible);
				}
			}
			return false;
		}

		internal static bool Pressed(KeyCode key, int move)
		{
			//IL_0000: Unknown result type (might be due to invalid IL or missing references)
			if (!Input.GetKeyDown(key))
			{
				return ExtraGamepad.Pressed(DioPlugin.GamepadMoves[move].Value);
			}
			return true;
		}

		internal static bool Held(KeyCode key, int move)
		{
			//IL_0000: Unknown result type (might be due to invalid IL or missing references)
			if (!Input.GetKey(key))
			{
				return ExtraGamepad.Held(DioPlugin.GamepadMoves[move].Value);
			}
			return true;
		}
	}
	public static class DioKnifeMesh
	{
		public static Mesh Create()
		{
			//IL_0033: Unknown result type (might be due to invalid IL or missing references)
			//IL_0090: Unknown result type (might be due to invalid IL or missing references)
			//IL_0091: 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_00a2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ae: Unknown result type (might be due to invalid IL or missing references)
			//IL_00af: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b0: 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_00bd: Unknown result type (might be due to invalid IL or missing references)
			//IL_00be: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00dc: Unknown result type (might be due to invalid IL or missing references)
			//IL_00dd: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ee: 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_00fb: Unknown result type (might be due to invalid IL or missing references)
			//IL_00fd: Unknown result type (might be due to invalid IL or missing references)
			//IL_00fe: Unknown result type (might be due to invalid IL or missing references)
			//IL_010a: Unknown result type (might be due to invalid IL or missing references)
			//IL_010b: Unknown result type (might be due to invalid IL or missing references)
			//IL_010c: Unknown result type (might be due to invalid IL or missing references)
			//IL_010e: 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_013d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0151: Unknown result type (might be due to invalid IL or missing references)
			//IL_016c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0180: Unknown result type (might be due to invalid IL or missing references)
			//IL_0194: Unknown result type (might be due to invalid IL or missing references)
			//IL_01be: Unknown result type (might be due to invalid IL or missing references)
			//IL_01d2: Unknown result type (might be due to invalid IL or missing references)
			//IL_01e6: Unknown result type (might be due to invalid IL or missing references)
			//IL_020c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0220: Unknown result type (might be due to invalid IL or missing references)
			//IL_0234: Unknown result type (might be due to invalid IL or missing references)
			//IL_0240: Unknown result type (might be due to invalid IL or missing references)
			//IL_0245: Unknown result type (might be due to invalid IL or missing references)
			//IL_0250: Unknown result type (might be due to invalid IL or missing references)
			//IL_025c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0268: Unknown result type (might be due to invalid IL or missing references)
			//IL_0275: Unknown result type (might be due to invalid IL or missing references)
			//IL_027b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0282: Expected O, but got Unknown
			List<Vector3> vertices = new List<Vector3>();
			List<Color> colors = new List<Color>();
			List<int> triangles = new List<int>();
			Vector3 a = new Vector3(0f, 0f, 0.65f);
			Vector3 val = default(Vector3);
			((Vector3)(ref val))..ctor(-0.09f, 0f, 0.08f);
			Vector3 val2 = default(Vector3);
			((Vector3)(ref val2))..ctor(0.09f, 0f, 0.08f);
			Vector3 val3 = default(Vector3);
			((Vector3)(ref val3))..ctor(0f, 0.035f, 0.12f);
			Vector3 val4 = default(Vector3);
			((Vector3)(ref val4))..ctor(0f, -0.035f, 0.12f);
			Face(a, val, val3, new Color(0.8f, 0.85f, 0.9f));
			Face(a, val3, val2, Color.white);
			Face(a, val4, val, new Color(0.5f, 0.58f, 0.65f));
			Face(a, val2, val4, new Color(0.7f, 0.75f, 0.8f));
			Face(val, val4, val3, Color.gray);
			Face(val2, val3, val4, Color.gray);
			Box(new Vector3(0f, 0f, 0.065f), new Vector3(0.14f, 0.04f, 0.025f), new Color(0.7f, 0.72f, 0.75f));
			Box(new Vector3(0f, 0f, -0.105f), new Vector3(0.047f, 0.038f, 0.14f), new Color(0.12f, 0.09f, 0.07f));
			for (int i = 0; i < 5; i++)
			{
				Box(new Vector3(0f, 0f, -0.22f + (float)i * 0.05f), new Vector3(0.052f, 0.043f, 0.008f), new Color(0.3f, 0.24f, 0.18f));
			}
			Box(new Vector3(0f, 0f, -0.26f), new Vector3(0.06f, 0.045f, 0.025f), new Color(0.65f, 0.68f, 0.72f));
			Mesh val5 = new Mesh
			{
				name = "DioBeveledThrowingKnife"
			};
			val5.SetVertices(vertices);
			val5.SetColors(colors);
			val5.SetTriangles(triangles, 0);
			val5.RecalculateNormals();
			val5.RecalculateBounds();
			return val5;
			void Box(Vector3 center, Vector3 half, Color color)
			{
				//IL_000d: Unknown result type (might be due to invalid IL or missing references)
				//IL_001b: Unknown result type (might be due to invalid IL or missing references)
				//IL_0013: 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_0087: 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_002f: Unknown result type (might be due to invalid IL or missing references)
				//IL_0027: 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)
				//IL_003b: Unknown result type (might be due to invalid IL or missing references)
				//IL_004a: Unknown result type (might be due to invalid IL or missing references)
				//IL_004f: Unknown result type (might be due to invalid IL or missing references)
				//IL_0054: Unknown result type (might be due to invalid IL or missing references)
				Vector3[] array = (Vector3[])(object)new Vector3[8];
				for (int j = 0; j < 8; j++)
				{
					array[j] = center + new Vector3(((j & 1) == 0) ? (0f - half.x) : half.x, ((j & 2) == 0) ? (0f - half.y) : half.y, ((j & 4) == 0) ? (0f - half.z) : half.z);
				}
				int[] array2 = new int[36]
				{
					0, 2, 3, 0, 3, 1, 4, 5, 7, 4,
					7, 6, 0, 4, 6, 0, 6, 2, 1, 3,
					7, 1, 7, 5, 0, 1, 5, 0, 5, 4,
					2, 6, 7, 2, 7, 3
				};
				for (int k = 0; k < array2.Length; k += 3)
				{
					Face(array[array2[k]], array[array2[k + 1]], array[array2[k + 2]], color);
				}
			}
			void Face(Vector3 item, Vector3 b, Vector3 c, Color color)
			{
				//IL_0014: Unknown result type (might be due to invalid IL or missing references)
				//IL_0021: 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)
				//IL_003b: Unknown result type (might be due to invalid IL or missing references)
				//IL_0048: Unknown result type (might be due to invalid IL or missing references)
				//IL_0055: Unknown result type (might be due to invalid IL or missing references)
				int count = vertices.Count;
				vertices.Add(item);
				vertices.Add(b);
				vertices.Add(c);
				colors.Add(color);
				colors.Add(color);
				colors.Add(color);
				triangles.Add(count);
				triangles.Add(count + 1);
				triangles.Add(count + 2);
			}
		}
	}
	public sealed class DioNetworkPresentation : NetworkBehaviour
	{
		private CharacterBody body;

		private bool stopped;

		private bool presented;

		private bool resumePlayed;

		private float ends;

		private void Awake()
		{
			body = ((Component)this).GetComponent<CharacterBody>();
		}

		public void ServerTimeStop(bool active, float seconds = 0f)
		{
			if (NetworkServer.active)
			{
				stopped = active;
				ends = Time.time + Mathf.Clamp(seconds, 0f, 15f);
				((NetworkBehaviour)this).SetDirtyBit(1u);
			}
		}

		public override bool OnSerialize(NetworkWriter writer, bool initialState)
		{
			writer.Write(stopped);
			writer.Write(Mathf.Max(0f, ends - Time.time));
			return true;
		}

		public override void OnDeserialize(NetworkReader reader, bool initialState)
		{
			bool flag = reader.ReadBoolean();
			float num = reader.ReadSingle();
			if (NetworkServer.active)
			{
				return;
			}
			stopped = flag;
			ends = Time.time + Mathf.Clamp(num, 0f, 15f);
			if (Object.op_Implicit((Object)(object)body) && DioInput.IsLocal(body))
			{
				if (flag)
				{
					presented = true;
					resumePlayed = false;
					DioFeedback.MainTimeTransition(ending: false, local: true, num, replay: false, body);
				}
				else if (presented)
				{
					DioFeedback.MainTimeTransition(ending: true, local: true);
					presented = false;
				}
			}
		}

		private void Update()
		{
			if (NetworkServer.active || !presented)
			{
				return;
			}
			if (!Object.op_Implicit((Object)(object)body) || !Object.op_Implicit((Object)(object)body.healthComponent) || !body.healthComponent.alive || !Object.op_Implicit((Object)(object)Run.instance))
			{
				Finish();
				return;
			}
			if (!resumePlayed && Time.time >= ends - DioPlugin.TimeResumeTickTime.Value - 0.15f)
			{
				resumePlayed = true;
				DioFeedback.Sound(((Component)this).gameObject, "time-resume", 1f);
			}
			if (Time.time >= ends + 0.5f)
			{
				Finish();
			}
		}

		private void Finish()
		{
			if (presented)
			{
				DioFeedback.MainTimeTransition(ending: true, local: true);
			}
			presented = false;
			stopped = false;
		}

		private void OnDisable()
		{
			Finish();
		}
	}
	[BepInPlugin("local.eyesofheaven.dio", "Eyes of Heaven DIO — Prototype", "3.6.3")]
	public sealed class DioPlugin : BaseUnityPlugin
	{
		public const string Id = "local.eyesofheaven.dio";

		internal static ManualLogSource Log;

		internal static ConfigEntry<bool> GamepadEnabled;

		internal static ConfigEntry<bool> Subtitles;

		internal static ConfigEntry<int> GamepadIndex;

		internal static ConfigEntry<ushort>[] GamepadMoves;

		internal static ConfigEntry<float> MoveSpeed;

		internal static ConfigEntry<float> TimeSkipRange;

		internal static ConfigEntry<float> TimeStopBassTime;

		internal static ConfigEntry<float> TimeResumeTickTime;

		internal static ConfigEntry<float> SoundVolume;

		internal static ConfigEntry<KeyCode> BarrageKey;

		internal static ConfigEntry<KeyCode> DrainKey;

		internal static ConfigEntry<KeyCode> StandJumpKey;

		internal static ConfigEntry<KeyCode> RoadRollerKey;

		internal static ConfigEntry<KeyCode> ExKnivesKey;

		internal static ConfigEntry<KeyCode> StandBlockKey;

		internal static float MoveDuration(float seconds, float attackSpeed = 1f)
		{
			return seconds / (Mathf.Max(0.1f, attackSpeed) * MoveSpeed.Value);
		}

		private void Awake()
		{
			//IL_004d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0057: Expected O, but got Unknown
			//IL_013c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0146: Expected O, but got Unknown
			//IL_0179: Unknown result type (might be due to invalid IL or missing references)
			//IL_0183: 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_02b9: Unknown result type (might be due to invalid IL or missing references)
			//IL_02c3: Expected O, but got Unknown
			//IL_02f6: Unknown result type (might be due to invalid IL or missing references)
			//IL_0300: Expected O, but got Unknown
			//IL_031c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0326: Expected O, but got Unknown
			Log = ((BaseUnityPlugin)this).Logger;
			GamepadEnabled = ((BaseUnityPlugin)this).Config.Bind<bool>("Gamepad", "Enabled", true, "Enable XInput extra moves, including Steam Input Xbox emulation. Main skills use the game controller settings.");
			GamepadIndex = ((BaseUnityPlugin)this).Config.Bind<int>("Gamepad", "ControllerIndex", 0, new ConfigDescription("XInput controller slot.", (AcceptableValueBase)(object)new AcceptableValueRange<int>(0, 3), Array.Empty<object>()));
			string[] array = new string[6] { "Barrage", "BloodDrain", "StandJump", "RoadRoller", "ExKnives", "StandBlock" };
			ushort[] array2 = new ushort[6] { 4, 8, 2, 192, 1, 130 };
			GamepadMoves = new ConfigEntry<ushort>[array2.Length];
			for (int i = 0; i < array2.Length; i++)
			{
				GamepadMoves[i] = ((BaseUnityPlugin)this).Config.Bind<ushort>("Gamepad", array[i], array2[i], "XInput button mask. Up=1, Down=2, Left=4, Right=8, L3=64, R3=128. Add values for a chord; 0 disables.");
			}
			Subtitles = ((BaseUnityPlugin)this).Config.Bind<bool>("Presentation", "EnglishSubtitles", true, "English captions for DIO voice clips. Unverified speech is marked as Japanese dialogue rather than an invented translation.");
			((Component)this).gameObject.AddComponent<DioVoiceCaptions>();
			MoveSpeed = ((BaseUnityPlugin)this).Config.Bind<float>("Combat", "MoveSpeedMultiplier", 1f, new ConfigDescription("Animation and attack timing speed. 1 uses the slower default timings; 0.75 is 25% slower; 1.25 is 25% faster. Cooldowns are unchanged.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0.25f, 2f), Array.Empty<object>()));
			TimeSkipRange = ((BaseUnityPlugin)this).Config.Bind<float>("Combat", "TimeSkipRange", 80f, new ConfigDescription("Maximum crosshair-aimed teleport distance in meters. Stops before solid terrain.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(10f, 200f), Array.Empty<object>()));
			BarrageKey = ((BaseUnityPlugin)this).Config.Bind<KeyCode>("Controls", "BarrageKey", (KeyCode)118, "Stand barrage; 8 second cooldown.");
			DrainKey = ((BaseUnityPlugin)this).Config.Bind<KeyCode>("Controls", "BloodDrainKey", (KeyCode)98, "Blood drain; 12 second cooldown.");
			StandJumpKey = ((BaseUnityPlugin)this).Config.Bind<KeyCode>("Controls", "StandJumpKey", (KeyCode)99, "Grounded Stand jump; 8 second cooldown. Hold jump in the air afterward to hover indefinitely.");
			RoadRollerKey = ((BaseUnityPlugin)this).Config.Bind<KeyCode>("Controls", "RoadRollerKey", (KeyCode)103, "Road Roller ultimate; 45 second cooldown.");
			ExKnivesKey = ((BaseUnityPlugin)this).Config.Bind<KeyCode>("Controls", "ExKnivesKey", (KeyCode)120, "EX time-skip knife rush; 40 second cooldown. Does not pause the world or take over cameras.");
			StandBlockKey = ((BaseUnityPlugin)this).Config.Bind<KeyCode>("Controls", "StandBlockKey", (KeyCode)102, "Hold to guard with The World. Reduces frontal attack damage by 90%; rear attacks, damage over time and unblockable damage bypass guard.");
			TimeStopBassTime = ((BaseUnityPlugin)this).Config.Bind<float>("Audio", "MainTimeStopSfxFreezeSeconds", 0.16f, new ConfigDescription("Seconds into the main time-stop clip when the first heavy bass impact triggers world suspension and the screen pulse. Independent of attack speed.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0.1f, 3f), Array.Empty<object>()));
			TimeResumeTickTime = ((BaseUnityPlugin)this).Config.Bind<float>("Audio", "MainTimeResumeTickSeco