Decompiled source of HardStyle v1.1.1

HardStyle/HardStyle.dll

Decompiled 2 days ago
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Reflection;
using System.Reflection.Emit;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using BepInEx;
using BepInEx.Logging;
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: AssemblyCompany("HardStyle")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0+96877d4756f16b496707ae000f1f59d5846a2811")]
[assembly: AssemblyProduct("HardStyle")]
[assembly: AssemblyTitle("HardStyle")]
[assembly: AssemblyVersion("1.0.0.0")]
[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 HardStyle
{
	[HarmonyPatch]
	[BepInPlugin("com.blaixenu.hardstyle", "HardStyle", "1.0.0")]
	public class Plugin : BaseUnityPlugin
	{
		internal static ManualLogSource Logger { get; private set; }

		private void Awake()
		{
			Logger = ((BaseUnityPlugin)this).Logger;
			Logger.LogInfo((object)"Plugin com.blaixenu.hardstyle loaded! Yippee!!!");
			((Object)((Component)this).gameObject).hideFlags = (HideFlags)4;
			DoPatching();
		}

		private static void DoPatching()
		{
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			//IL_000c: Expected O, but got Unknown
			Harmony val = new Harmony("com.blaixenu.hardstyle");
			val.PatchAll();
		}

		[HarmonyPostfix]
		[HarmonyPatch(/*Could not decode attribute arguments.*/)]
		private static void ScoresSubmission(ref bool __result)
		{
			__result = false;
		}
	}
	[HarmonyPatch]
	public class HardDamagePatches
	{
		[HarmonyPrefix]
		[HarmonyPatch(typeof(NewMovement), "GetHurt")]
		private static void GetHurtPatch(ref float hardDamageMultiplier)
		{
			hardDamageMultiplier = 0f;
		}

		[HarmonyPrefix]
		[HarmonyPatch(typeof(NewMovement), "ForceAntiHP")]
		private static bool ForceAntiHPPatch()
		{
			return false;
		}
	}
	[HarmonyPatch]
	public class HealingPatches
	{
		private enum Styles
		{
			destructive,
			crazy,
			brutal,
			annihilation,
			supreme,
			ssadistic,
			ssshitstorm,
			ultrakill
		}

		private static readonly float healStep = 1f / 30f;

		private static readonly List<float> healMultipliers = new List<float>(8)
		{
			0.1f,
			0.1f + healStep,
			0.1f + 2f * healStep,
			0.1f + 3f * healStep,
			0.1f + 4f * healStep,
			0.1f + 5f * healStep,
			0.3f,
			0.75f
		};

		[HarmonyPrefix]
		[HarmonyPatch(typeof(NewMovement), "GetHealth")]
		private static void GetHealthPatch(ref int health)
		{
			StyleHUD instance = MonoSingleton<StyleHUD>.Instance;
			float num = healMultipliers[instance.rankIndex];
			int num2 = Mathf.RoundToInt((float)health * num);
			Plugin.Logger.LogInfo((object)"* GetHealth() called!");
			Plugin.Logger.LogInfo((object)$"    Input {health}  output {num2}");
			Plugin.Logger.LogInfo((object)$"    Rank index {instance.rankIndex}  Multiplier {num}");
			Plugin.Logger.LogInfo((object)"\n");
			health = num2;
		}

		[HarmonyTranspiler]
		[HarmonyPatch(typeof(NewMovement), "Parry")]
		private static IEnumerable<CodeInstruction> ParryPatch(IEnumerable<CodeInstruction> instructions, ILGenerator generator)
		{
			//IL_0003: Unknown result type (might be due to invalid IL or missing references)
			//IL_0009: Expected O, but got Unknown
			//IL_0037: Unknown result type (might be due to invalid IL or missing references)
			//IL_003d: Expected O, but got Unknown
			//IL_004b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0051: Expected O, but got Unknown
			//IL_0068: Unknown result type (might be due to invalid IL or missing references)
			//IL_006e: Expected O, but got Unknown
			//IL_0092: Unknown result type (might be due to invalid IL or missing references)
			//IL_0098: Expected O, but got Unknown
			//IL_00a0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a6: Expected O, but got Unknown
			//IL_00c1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c7: Expected O, but got Unknown
			//IL_00cf: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d5: Expected O, but got Unknown
			CodeMatcher val = new CodeMatcher(instructions, generator);
			val.Start().MatchForward(true, (CodeMatch[])(object)new CodeMatch[3]
			{
				new CodeMatch((OpCode?)OpCodes.Stfld, (object)AccessTools.Field(typeof(NewMovement), "exploded"), (string)null),
				new CodeMatch((OpCode?)OpCodes.Ldarg_0, (object)null, (string)null),
				new CodeMatch((OpCode?)OpCodes.Ldc_I4, (object)999, (string)null)
			}).Set(OpCodes.Nop, (object)null)
				.Insert((CodeInstruction[])(object)new CodeInstruction[4]
				{
					new CodeInstruction(OpCodes.Ldc_I4, (object)100),
					new CodeInstruction(OpCodes.Ldarg_0, (object)null),
					new CodeInstruction(OpCodes.Ldfld, (object)AccessTools.Field(typeof(NewMovement), "hp")),
					new CodeInstruction(OpCodes.Sub, (object)null)
				});
			return val.InstructionEnumeration();
		}
	}
	internal static class MyPluginInfo
	{
		public const string PLUGIN_GUID = "com.blaixenu.hardstyle";

		public const string PLUGIN_NAME = "HardStyle";

		public const string PLUGIN_VERSION = "1.0.0";
	}
}