Decompiled source of InstantCarnage v1.4.0

plugins/Instant Carnage.dll

Decompiled 2 weeks ago
using System.Collections.Generic;
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
using BepInEx;
using BepInEx.Configuration;
using HarmonyLib;
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("SHRAVAN'S EXTREME ONE PUNCH")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("SHRAVAN'S EXTREME ONE PUNCH")]
[assembly: AssemblyCopyright("Copyright ©  2026")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("70251743-3605-4e76-bf7e-cdf045c6a043")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: TargetFramework(".NETFramework,Version=v4.7.2", FrameworkDisplayName = ".NET Framework 4.7.2")]
[assembly: AssemblyVersion("1.0.0.0")]
[BepInPlugin("instant.carnage", "Instant Carnage", "1.4")]
public class Main : BaseUnityPlugin
{
	public static ConfigEntry<bool> InstantDeath;

	public static ConfigEntry<bool> RemoveLimbs;

	public static ConfigEntry<int> LimbCount;

	public static ConfigEntry<bool> Injury;

	public static ConfigEntry<bool> GodMode;

	public static ConfigEntry<bool> ExplosivePunches;

	private static bool ModEnabled = true;

	private string displayMessage = "";

	private float messageTimer = 0f;

	private void Awake()
	{
		InstantDeath = ((BaseUnityPlugin)this).Config.Bind<bool>("General", "InstantDeath", false, "Kill enemy instantly");
		RemoveLimbs = ((BaseUnityPlugin)this).Config.Bind<bool>("General", "RemoveLimbs", true, "Enable limb dismemberment");
		LimbCount = ((BaseUnityPlugin)this).Config.Bind<int>("General", "LimbCount", 2, "Number of limbs to remove per hit");
		Injury = ((BaseUnityPlugin)this).Config.Bind<bool>("General", "Injury", true, "Apply injury");
		GodMode = ((BaseUnityPlugin)this).Config.Bind<bool>("General", "GodMode", false, "Extreme mode");
		ExplosivePunches = ((BaseUnityPlugin)this).Config.Bind<bool>("General", "ExplosivePunches", false, "Enable explosive punches");
		Harmony.CreateAndPatchAll(typeof(Main), (string)null);
		((BaseUnityPlugin)this).Logger.LogInfo((object)"Instant Carnage Loaded v1.4");
	}

	private void Update()
	{
		if (Input.GetKeyDown((KeyCode)105))
		{
			ModEnabled = !ModEnabled;
			ShowMessage(ModEnabled ? "CARNAGE: ON " : "CARNAGE: OFF");
		}
		if (Input.GetKeyDown((KeyCode)103))
		{
			GodMode.Value = !GodMode.Value;
			ShowMessage(GodMode.Value ? "GOD MODE: ON " : "GOD MODE: OFF");
		}
		if (ModEnabled && !InstantDeath.Value)
		{
			for (int i = 0; i < NJBJIIIACEP.OAAMGFLINOB.Length; i++)
			{
				DFOGOCNBECG val = NJBJIIIACEP.OAAMGFLINOB[i];
				if (val != null && val.EMDMDLNJFKP.id != Characters.star)
				{
					if (val.HLGALFAGDGC > 0f && val.HLGALFAGDGC < 50f)
					{
						val.HLGALFAGDGC = 100f;
					}
					if (val.HLGALFAGDGC > 0f)
					{
						val.DMEDPMIPBAO = 0;
						val.OKPAGLBJIOH = 0f;
					}
				}
			}
		}
		if (messageTimer > 0f)
		{
			messageTimer -= Time.deltaTime;
		}
	}

	private void ShowMessage(string msg)
	{
		displayMessage = msg;
		messageTimer = 2.5f;
	}

	private void OnGUI()
	{
		//IL_001d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0023: Expected O, but got Unknown
		//IL_0032: Unknown result type (might be due to invalid IL or missing references)
		//IL_0062: Unknown result type (might be due to invalid IL or missing references)
		if (messageTimer > 0f)
		{
			GUIStyle val = new GUIStyle(GUI.skin.label);
			val.fontSize = 24;
			val.normal.textColor = Color.red;
			val.alignment = (TextAnchor)1;
			GUI.Label(new Rect((float)(Screen.width / 2 - 200), 50f, 400f, 40f), displayMessage, val);
		}
	}

	private static void Explode(DFOGOCNBECG center)
	{
		for (int i = 0; i < NJBJIIIACEP.OAAMGFLINOB.Length; i++)
		{
			DFOGOCNBECG val = NJBJIIIACEP.OAAMGFLINOB[i];
			if (val != null && val != center)
			{
				val.OKPAGLBJIOH = float.MaxValue;
				for (int j = 3; j <= 15; j++)
				{
					val.CMOPOKMFJMG(j, 999999f, 1f);
				}
				if (InstantDeath.Value)
				{
					val.HLGALFAGDGC = 0f;
					val.DMEDPMIPBAO = 1;
				}
			}
		}
	}

	[HarmonyPatch(typeof(DFOGOCNBECG), "DIIMPIPKAFK")]
	[HarmonyPrefix]
	private static void Hit1(DFOGOCNBECG __instance, DFOGOCNBECG __0)
	{
		ApplyEffects(__instance, __0);
	}

	[HarmonyPatch(typeof(DFOGOCNBECG), "MHNNBEOCPGA")]
	[HarmonyPrefix]
	private static void Hit2(DFOGOCNBECG __instance)
	{
		ApplyEffects(__instance, __instance.ELPIOHCPOIJ);
	}

	[HarmonyPatch(typeof(DFOGOCNBECG), "LKGOPCPNDNK")]
	[HarmonyPrefix]
	private static void Hit3(DFOGOCNBECG __instance, DFOGOCNBECG __0)
	{
		ApplyEffects(__instance, __0);
	}

	[HarmonyPatch(typeof(DFOGOCNBECG), "PFGONEIPHLJ")]
	[HarmonyPrefix]
	private static void Hit4(DFOGOCNBECG __instance)
	{
		if (__instance.ELPIOHCPOIJ != null)
		{
			ApplyEffects(__instance, __instance.ELPIOHCPOIJ);
		}
	}

	private static void ApplyEffects(DFOGOCNBECG attacker, DFOGOCNBECG target)
	{
		if (!ModEnabled || attacker == null || target == null || attacker.EMDMDLNJFKP.id != Characters.star)
		{
			return;
		}
		if (Input.GetKey((KeyCode)332) || Input.GetKey((KeyCode)120) || GodMode.Value || InstantDeath.Value)
		{
			if (ExplosivePunches.Value)
			{
				Explode(target);
			}
			target.HLGALFAGDGC = -100f;
			target.DMEDPMIPBAO = 1;
			target.OKPAGLBJIOH = float.MaxValue;
			if (GodMode.Value)
			{
				for (int i = 3; i <= 15; i++)
				{
					target.CMOPOKMFJMG(i, 999999f, 1f);
				}
			}
			else if (RemoveLimbs.Value)
			{
				List<int> list = new List<int>();
				for (int j = 3; j <= 15; j++)
				{
					list.Add(j);
				}
				int num = Mathf.Clamp(LimbCount.Value, 1, list.Count);
				for (int k = 0; k < num; k++)
				{
					int index = Random.Range(0, list.Count);
					int num2 = list[index];
					target.CMOPOKMFJMG(num2, 999999f, 1f);
					list.RemoveAt(index);
				}
			}
			return;
		}
		target.OKPAGLBJIOH = float.MaxValue;
		if (RemoveLimbs.Value)
		{
			List<int> list2 = new List<int>();
			for (int l = 3; l <= 15; l++)
			{
				list2.Add(l);
			}
			int num3 = Mathf.Clamp(LimbCount.Value, 1, list2.Count);
			for (int m = 0; m < num3; m++)
			{
				int index2 = Random.Range(0, list2.Count);
				int num4 = list2[index2];
				target.CMOPOKMFJMG(num4, 999999f, 1f);
				list2.RemoveAt(index2);
			}
		}
		if (Injury.Value)
		{
			target.PGJEOKAEPCL = 30;
			target.EMDMDLNJFKP.injuryTime = 5;
		}
	}
}