Decompiled source of UltraParry v1.0.0

plugins/UltraParry.dll

Decompiled 2 days ago
using System;
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using BepInEx;
using BepInEx.Logging;
using Microsoft.CodeAnalysis;
using On.RoR2;
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: AssemblyCompany("UltraParry")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("UltraParry")]
[assembly: AssemblyTitle("UltraParry")]
[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.Class | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Parameter | AttributeTargets.ReturnValue | AttributeTargets.GenericParameter, AllowMultiple = false, Inherited = false)]
	internal sealed class NullableAttribute : Attribute
	{
		public readonly byte[] NullableFlags;

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

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

		public NullableContextAttribute(byte P_0)
		{
			Flag = P_0;
		}
	}
	[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;
		}
	}
}
[BepInPlugin("com.swiftcham.ultraparry", "UltraParry", "1.0.0")]
public class UltraParry : BaseUnityPlugin
{
	[CompilerGenerated]
	private static class <>O
	{
		public static hook_PlaySound_string_GameObject <0>__OnPlaySound;

		public static hook_PlaySound_string_GameObject_string_float <1>__OnPlaySound2;
	}

	private static ManualLogSource Log;

	private const string ParryEvent = "Play_Char_Enforcer_ProtNServe_Parry";

	private const string MyEvent = "Play_UltraParry";

	private void Awake()
	{
		//IL_001c: 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_0027: Expected O, but got Unknown
		//IL_003d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0042: Unknown result type (might be due to invalid IL or missing references)
		//IL_0048: Expected O, but got Unknown
		Log = ((BaseUnityPlugin)this).Logger;
		object obj = <>O.<0>__OnPlaySound;
		if (obj == null)
		{
			hook_PlaySound_string_GameObject val = OnPlaySound;
			<>O.<0>__OnPlaySound = val;
			obj = (object)val;
		}
		Util.PlaySound_string_GameObject += (hook_PlaySound_string_GameObject)obj;
		object obj2 = <>O.<1>__OnPlaySound2;
		if (obj2 == null)
		{
			hook_PlaySound_string_GameObject_string_float val2 = OnPlaySound2;
			<>O.<1>__OnPlaySound2 = val2;
			obj2 = (object)val2;
		}
		Util.PlaySound_string_GameObject_string_float += (hook_PlaySound_string_GameObject_string_float)obj2;
	}

	private static uint OnPlaySound(orig_PlaySound_string_GameObject orig, string soundString, GameObject obj)
	{
		if (soundString == "Play_Char_Enforcer_ProtNServe_Parry")
		{
			Log.LogWarning((object)"Parry intercepted (A)");
			return orig.Invoke("Play_UltraParry", obj);
		}
		return orig.Invoke(soundString, obj);
	}

	private static uint OnPlaySound2(orig_PlaySound_string_GameObject_string_float orig, string soundString, GameObject obj, string rtpcName, float rtpcValue)
	{
		if (soundString == "Play_Char_Enforcer_ProtNServe_Parry")
		{
			Log.LogWarning((object)"Parry intercepted (B)");
			return orig.Invoke("Play_UltraParry", obj, rtpcName, rtpcValue);
		}
		return orig.Invoke(soundString, obj, rtpcName, rtpcValue);
	}
}