Decompiled source of BetterFlashlightMod v1.0.1

BetterFlashlightMod.dll

Decompiled 6 hours ago
using System;
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
using BepInEx;
using BepInEx.Configuration;
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: AssemblyTitle("BetterFlashlightMod")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("BetterFlashlightMod")]
[assembly: AssemblyCopyright("Copyright ©  2025")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("2e52bccc-96fd-43d8-a121-432cce8f6e58")]
[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")]
namespace BetterFlashlight;

[BepInPlugin("Megabyte21.BetterFlashlight", "BetterFlashlight", "1.0.0")]
public class BetterFlashlight : BaseUnityPlugin
{
	[HarmonyPatch(typeof(FlashlightController), "LightOn")]
	public class FlashlightControllerPatch
	{
		[HarmonyPostfix]
		private static void Postfix(FlashlightController __instance)
		{
			FieldInfo field = typeof(FlashlightController).GetField("baseIntensity", BindingFlags.Instance | BindingFlags.NonPublic);
			if (field != null)
			{
				float num = (float)field.GetValue(__instance);
				float num2 = (num *= BrightnessConfig.Value);
				field.SetValue(__instance, num2);
			}
		}
	}

	public const string pluginGUID = "Megabyte21.BetterFlashlight";

	public const string pluginName = "BetterFlashlight";

	public const string pluginVersion = "1.0.0";

	public static ConfigEntry<float> BrightnessConfig;

	internal static ManualLogSource ModLogger;

	private void Awake()
	{
		//IL_005a: Unknown result type (might be due to invalid IL or missing references)
		//IL_0064: Expected O, but got Unknown
		//IL_006e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0074: Expected O, but got Unknown
		ModLogger = ((BaseUnityPlugin)this).Logger;
		ModLogger.LogInfo((object)"Hello, I am Flashlight");
		ModLogger.LogInfo((object)"Setting Flashlight to a bright future");
		BrightnessConfig = ((BaseUnityPlugin)this).Config.Bind<float>("Settings", "Brightness", 7f, new ConfigDescription("Set the brightness of the Flashlight", (AcceptableValueBase)(object)new AcceptableValueRange<float>(1f, 7f), Array.Empty<object>()));
		Harmony val = new Harmony("Megabyte21.BetterFlashlight");
		val.PatchAll();
		ModLogger.LogInfo((object)"Harmony patches applied successfully!");
	}
}