Decompiled source of InfDeathHeadEnergy v1.0.5

corpsecontrolf.dll

Decompiled 2 months ago
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
using BepInEx;
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("better item logic")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("better item logic")]
[assembly: AssemblyCopyright("Copyright ©  2025")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("c4363021-4e97-4eae-b884-7916d62cc6a9")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: TargetFramework(".NETFramework,Version=v4.8", FrameworkDisplayName = ".NET Framework 4.8")]
[assembly: AssemblyVersion("1.0.0.0")]
namespace Main;

[BepInPlugin("com.Null_Devz.InfiniteEnergy", "Better Item Logic", "1.0.0")]
public class Plugin : BaseUnityPlugin
{
	public static GameObject ownershipManager;

	public void Awake()
	{
		//IL_0011: Unknown result type (might be due to invalid IL or missing references)
		//IL_0017: Expected O, but got Unknown
		Debug.Log((object)"[Plugin] Awake — patching...");
		Harmony val = new Harmony("com.Null_Devz.InfiniteEnergy");
		val.PatchAll();
		Debug.Log((object)"[Plugin] Harmony patches applied");
	}
}
[HarmonyPatch(typeof(SpectateCamera), "HeadEnergyLogic")]
public class Patch_HeadEnergyLogic
{
	private static void Prefix(SpectateCamera __instance)
	{
		float num = 0f;
		FieldInfo fieldInfo = AccessTools.Field(typeof(SpectateCamera), "headEnergy");
		if (fieldInfo != null)
		{
			num = (float)fieldInfo.GetValue(__instance);
			num += Time.deltaTime;
			num = Mathf.Clamp01(num);
			fieldInfo.SetValue(__instance, num);
		}
		FieldInfo fieldInfo2 = AccessTools.Field(typeof(SpectateCamera), "headEnergyEnough");
		if (fieldInfo2 != null)
		{
			fieldInfo2.SetValue(__instance, (double)num >= 0.25);
		}
	}
}