Decompiled source of KnockoutBars v1.0.2

Mods/KnockoutBarsML.dll

Decompiled 2 months ago
using System;
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using HarmonyLib;
using Il2CppFemur;
using KnockoutBarsML;
using MelonLoader;
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: AssemblyTitle(null)]
[assembly: AssemblyDescription(null)]
[assembly: AssemblyCompany(null)]
[assembly: AssemblyProduct("KnockoutBarsML")]
[assembly: AssemblyCopyright("Created by TheUltimateNuke")]
[assembly: AssemblyTrademark(null)]
[assembly: AssemblyFileVersion("1.0.2")]
[assembly: MelonInfo(typeof(Mod), "KnockoutBarsML", "1.0.2", "TheUltimateNuke", null)]
[assembly: MelonColor(255, 222, 103, 84)]
[assembly: MelonGame("Boneloaf", "Gang Beasts")]
[assembly: TargetFramework(".NETCoreApp,Version=v6.0", FrameworkDisplayName = ".NET 6.0")]
[assembly: AssemblyVersion("1.0.2.0")]
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;
		}
	}
}
namespace KnockoutBarsML
{
	public static class BuildInfo
	{
		public const string Name = "KnockoutBarsML";

		public const string Author = "TheUltimateNuke";

		public const string Description = null;

		public const string Company = null;

		public const string Version = "1.0.2";

		public const string DownloadLink = null;
	}
	public class Mod : MelonMod
	{
		public override void OnInitializeMelon()
		{
			((MelonBase)this).HarmonyInstance.PatchAll();
		}

		public static void EnableKnockoutBar(Actor actor)
		{
			actor.statusHandeler.displayTimer = float.MaxValue;
			actor.statusHandeler.showStatusBar = true;
			((Component)actor.statusHandeler.statusBarTransform).gameObject.SetActive(true);
			((Component)actor.statusHandeler.statusBarTransform.Find("healthBarBack")).gameObject.SetActive(false);
			((Component)actor.statusHandeler.statusBarTransform.Find("staminaBarBack")).gameObject.SetActive(false);
		}

		public static void DisableKnockoutBar(Actor actor)
		{
			actor.statusHandeler.displayTimer = 0f;
			actor.statusHandeler.showStatusBar = false;
			((Component)actor.statusHandeler.statusBarTransform).gameObject.SetActive(false);
			((Component)actor.statusHandeler.statusBarTransform.Find("healthBarBack")).gameObject.SetActive(true);
			((Component)actor.statusHandeler.statusBarTransform.Find("staminaBarBack")).gameObject.SetActive(true);
		}
	}
}
namespace KnockoutBarsML.Patches
{
	public static class ActorPatch
	{
		[HarmonyPatch(typeof(Actor), "OnClientStateChange")]
		private static class StatePatch
		{
			[HarmonyPostfix]
			private static void StateChanged_Postfix(Actor __instance)
			{
				//IL_0002: Unknown result type (might be due to invalid IL or missing references)
				//IL_0007: Unknown result type (might be due to invalid IL or missing references)
				//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)
				//IL_000a: Unknown result type (might be due to invalid IL or missing references)
				//IL_000b: 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_000e: Invalid comparison between Unknown and I4
				ActorState actorState = __instance.actorState;
				ActorState val = actorState;
				ActorState val2 = val;
				if ((int)val2 == 2)
				{
					Mod.EnableKnockoutBar(__instance);
				}
				else
				{
					Mod.DisableKnockoutBar(__instance);
				}
			}
		}
	}
}