Decompiled source of InfiniteFlashLightBattery v1.0.0

InfiniteFlashLightBattery.dll

Decompiled 8 months ago
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using BepInEx;
using BepInEx.Logging;
using HarmonyLib;

[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 = "")]
[assembly: AssemblyCompany("InfiniteFlashLightBattery")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("InfiniteFlashLightBattery")]
[assembly: AssemblyTitle("InfiniteFlashLightBattery")]
[assembly: AssemblyVersion("1.0.0.0")]
namespace InfiniteFlashLightBattery;

[BepInPlugin("WDWE.InfiniteFlashLightBattery", "infinite flashlight battery", "1.0.0")]
public class Plugin : BaseUnityPlugin
{
	private readonly Harmony harmony = new Harmony("infinite flashlight battery");

	internal ManualLogSource mls;

	private void Awake()
	{
		mls = Logger.CreateLogSource("infinite flashlight battery");
		mls.LogWarning((object)"this is a warning bro and it's working goodd");
		harmony.PatchAll(typeof(Plugin));
		harmony.PatchAll(typeof(CurrentFlashLightBatteryPatch));
	}
}
[HarmonyPatch(typeof(Flashlight))]
internal class CurrentFlashLightBatteryPatch
{
	[HarmonyPatch("Update")]
	[HarmonyPrefix]
	private static void infiniteFlashLight(ref Flashlight __instance)
	{
		//IL_0020: Unknown result type (might be due to invalid IL or missing references)
		//IL_0026: Expected O, but got Unknown
		FieldInfo field = typeof(Flashlight).GetField("m_batteryEntry", BindingFlags.Instance | BindingFlags.NonPublic);
		BatteryEntry val = (BatteryEntry)field.GetValue(__instance);
		val.m_charge = val.m_maxCharge;
	}
}