Decompiled source of WhatKindOfParryableIsThis v1.0.0

WhatKindOfParryableIsThis.dll

Decompiled 2 days ago
using System;
using System.Diagnostics;
using System.IO;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using BepInEx;
using BepInEx.Logging;
using Configgy;
using HarmonyLib;
using Microsoft.CodeAnalysis;
using UnityEngine;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")]
[assembly: IgnoresAccessChecksTo("Assembly-CSharp")]
[assembly: AssemblyCompany("WhatKindOfParryableIsThis")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("WhatKindOfParryableIsThis")]
[assembly: AssemblyTitle("WhatKindOfParryableIsThis")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.0.0")]
[module: UnverifiableCode]
[module: RefSafetyRules(11)]
namespace Microsoft.CodeAnalysis
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	internal sealed class EmbeddedAttribute : Attribute
	{
	}
}
namespace System.Runtime.CompilerServices
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	[AttributeUsage(AttributeTargets.Class | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Parameter | AttributeTargets.ReturnValue | AttributeTargets.GenericParameter, AllowMultiple = false, Inherited = false)]
	internal sealed class NullableAttribute : Attribute
	{
		public readonly byte[] NullableFlags;

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

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

		public NullableContextAttribute(byte P_0)
		{
			Flag = P_0;
		}
	}
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	[AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)]
	internal sealed class RefSafetyRulesAttribute : Attribute
	{
		public readonly int Version;

		public RefSafetyRulesAttribute(int P_0)
		{
			Version = P_0;
		}
	}
}
namespace WhatKindOfParryableIsThis
{
	[BepInPlugin("doomahreal.ultrakill.vibecheck", "WhatKindOfParryableIsThis", "1.0.0")]
	public class Plugin : BaseUnityPlugin
	{
		private Texture2D onTex;

		private Texture2D offTex;

		private ConfigBuilder config;

		internal static bool showIndicator;

		[Configgable("", "X axis alignment (Can use decimals)", 0, null)]
		[Range(0f, 1f)]
		private static ConfigInputField<float> XAxis = new ConfigInputField<float>(1f, (Func<float, bool>)null, (Func<string, ValueTuple<bool, float>>)null);

		[Configgable("", "Y axis alignment (Can use decimals)", 0, null)]
		[Range(0f, 1f)]
		private static ConfigInputField<float> YAxis = new ConfigInputField<float>(1f, (Func<float, bool>)null, (Func<string, ValueTuple<bool, float>>)null);

		[Configgable("", "Width size (Can use decimals)", 0, null)]
		private static ConfigInputField<float> SizeX = new ConfigInputField<float>(64f, (Func<float, bool>)null, (Func<string, ValueTuple<bool, float>>)null);

		[Configgable("", "Height size (Can use decimals)", 0, null)]
		private static ConfigInputField<float> SizeY = new ConfigInputField<float>(64f, (Func<float, bool>)null, (Func<string, ValueTuple<bool, float>>)null);

		[Configgable("", "Change indicators images (keep the same names)", 0, null)]
		public static ConfigButton OpenModFolderButton = new ConfigButton((Action)delegate
		{
			HEYPALDIDYOUKNOWTHISRESTAURANTSERVESCOKETHEOLDFASHIONEDWAY();
		}, (string)null);

		internal static ManualLogSource Logger { get; private set; }

		internal static Plugin Instance { get; private set; }

		private void Awake()
		{
			//IL_0060: Unknown result type (might be due to invalid IL or missing references)
			//IL_006a: Expected O, but got Unknown
			//IL_007b: Unknown result type (might be due to invalid IL or missing references)
			Instance = this;
			Logger = ((BaseUnityPlugin)this).Logger;
			string directoryName = Path.GetDirectoryName(((BaseUnityPlugin)this).Info.Location);
			onTex = LoadTexture(Path.Combine(directoryName, "on.png"), fallbackWhite: true);
			offTex = LoadTexture(Path.Combine(directoryName, "off.png"), fallbackWhite: false);
			config = new ConfigBuilder("doomahreal.ultrakill.vibecheck", "WhatKindOfParryableIsThis");
			config.BuildAll();
			new Harmony("doomahreal.ultrakill.vibecheck").PatchAll();
		}

		private void OnGUI()
		{
			//IL_00ab: Unknown result type (might be due to invalid IL or missing references)
			GunControl instance = MonoSingleton<GunControl>.Instance;
			if (instance != null && ((Behaviour)instance).enabled)
			{
				Texture2D val = (showIndicator ? onTex : offTex);
				float num = Mathf.Lerp(10f, (float)Screen.width - ((ConfigValueElement<float>)(object)SizeX).Value - 10f, ((ConfigValueElement<float>)(object)XAxis).Value);
				float num2 = Mathf.Lerp(10f, (float)Screen.height - ((ConfigValueElement<float>)(object)SizeY).Value - 10f, ((ConfigValueElement<float>)(object)YAxis).Value);
				Rect val2 = default(Rect);
				((Rect)(ref val2))..ctor(num, num2, ((ConfigValueElement<float>)(object)SizeX).Value, ((ConfigValueElement<float>)(object)SizeY).Value);
				GUI.DrawTexture(val2, (Texture)(object)val);
			}
		}

		private Texture2D LoadTexture(string path, bool fallbackWhite)
		{
			//IL_0058: Unknown result type (might be due to invalid IL or missing references)
			//IL_005e: Expected O, but got Unknown
			//IL_0013: Unknown result type (might be due to invalid IL or missing references)
			//IL_0019: Expected O, but got Unknown
			//IL_0026: Unknown result type (might be due to invalid IL or missing references)
			//IL_001f: Unknown result type (might be due to invalid IL or missing references)
			if (!File.Exists(path))
			{
				Texture2D val = new Texture2D(1, 1, (TextureFormat)4, false);
				val.SetPixel(0, 0, fallbackWhite ? Color.white : Color.black);
				val.Apply();
				((Texture)val).filterMode = (FilterMode)0;
				((Texture)val).wrapMode = (TextureWrapMode)1;
				return val;
			}
			byte[] array = File.ReadAllBytes(path);
			Texture2D val2 = new Texture2D(2, 2, (TextureFormat)4, false);
			ImageConversion.LoadImage(val2, array);
			((Texture)val2).filterMode = (FilterMode)0;
			((Texture)val2).wrapMode = (TextureWrapMode)1;
			return val2;
		}

		internal static void CheckParryables()
		{
			//IL_0011: Unknown result type (might be due to invalid IL or missing references)
			showIndicator = false;
			Collider[] array = Physics.OverlapSphere(((Component)Camera.main).transform.position, 8f);
			Collider[] array2 = array;
			int num = 0;
			while (num < array2.Length)
			{
				Collider val = array2[num];
				Projectile component = ((Component)val).GetComponent<Projectile>();
				if (component == null || component.unparryable || component.undeflectable)
				{
					Enemy component2 = ((Component)val).GetComponent<Enemy>();
					if (component2 == null || !component2.parryable)
					{
						Cannonball component3 = ((Component)val).GetComponent<Cannonball>();
						if ((component3 == null || !component3.parry) && ((Component)val).GetComponent<MassSpear>() == null && ((Component)val).GetComponent<ThrownSword>() == null && ((Component)val).GetComponent<Landmine>() == null && ((Component)val).GetComponent<Chainsaw>() == null)
						{
							num++;
							continue;
						}
					}
				}
				showIndicator = true;
				break;
			}
		}

		internal static void HEYPALDIDYOUKNOWTHISRESTAURANTSERVESCOKETHEOLDFASHIONEDWAY()
		{
			string directoryName = Path.GetDirectoryName(((BaseUnityPlugin)Instance).Info.Location);
			if (Directory.Exists(directoryName))
			{
				Application.OpenURL(directoryName);
			}
		}
	}
	[HarmonyPatch(typeof(GunControl), "Update")]
	public class skibidirizza
	{
		private static void Postfix(NewMovement __instance)
		{
			if (((Behaviour)__instance).enabled)
			{
				Plugin.CheckParryables();
			}
		}
	}
	internal static class MyPluginInfo
	{
		public const string PLUGIN_GUID = "doomahreal.ultrakill.vibecheck";

		public const string PLUGIN_NAME = "WhatKindOfParryableIsThis";

		public const string PLUGIN_VERSION = "1.0.0";
	}
}
namespace System.Runtime.CompilerServices
{
	[AttributeUsage(AttributeTargets.Assembly, AllowMultiple = true)]
	internal sealed class IgnoresAccessChecksToAttribute : Attribute
	{
		internal IgnoresAccessChecksToAttribute(string assemblyName)
		{
		}
	}
}