using System;
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using BepInEx;
using BepInEx.Configuration;
using BepInEx.Logging;
using HarmonyLib;
using Microsoft.CodeAnalysis;
using MonoMod.RuntimeDetour;
using UnityEngine;
[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")]
[assembly: AssemblyCompany("KeepMyFlashlight")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("KeepMyFlashlight")]
[assembly: AssemblyTitle("KeepMyFlashlight")]
[assembly: AssemblyVersion("1.0.0.0")]
[module: RefSafetyRules(11)]
namespace Microsoft.CodeAnalysis
{
[CompilerGenerated]
[Microsoft.CodeAnalysis.Embedded]
internal sealed class EmbeddedAttribute : Attribute
{
}
}
namespace System.Runtime.CompilerServices
{
[CompilerGenerated]
[Microsoft.CodeAnalysis.Embedded]
[AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)]
internal sealed class RefSafetyRulesAttribute : Attribute
{
public readonly int Version;
public RefSafetyRulesAttribute(int P_0)
{
Version = P_0;
}
}
}
namespace KeepMyFlashlight
{
[BepInPlugin("nickklmao.keepmyflashlight", "Keep My Flashlight", "1.0.0")]
internal sealed class Entry : BaseUnityPlugin
{
private static readonly ManualLogSource logger = Logger.CreateLogSource("Keep My Flashlight");
private static ConfigEntry<bool> seeAllPlayersLights;
private static void LightOff_Hook(Action<FlashlightController> orig, FlashlightController self)
{
if (!seeAllPlayersLights.Value && !((Object)(object)self.PlayerAvatar == (Object)(object)PlayerAvatar.instance))
{
orig(self);
}
}
private static void Update_Hook(Action<FlashlightLightAim> orig, FlashlightLightAim self)
{
if (!seeAllPlayersLights.Value)
{
orig(self);
}
}
private void Awake()
{
//IL_005c: Unknown result type (might be due to invalid IL or missing references)
//IL_00a2: Unknown result type (might be due to invalid IL or missing references)
seeAllPlayersLights = ((BaseUnityPlugin)this).Config.Bind<bool>("Gameplay", "SeeAllPlayersLights", false, (ConfigDescription)null);
logger.LogDebug((object)"Hooking `FlashlightController.LightOff`");
new Hook((MethodBase)AccessTools.Method(typeof(FlashlightController), "LightOff", (Type[])null, (Type[])null), (Delegate)new Action<Action<FlashlightController>, FlashlightController>(LightOff_Hook));
logger.LogDebug((object)"Hooking `FlashlightLightAim.Update`");
new Hook((MethodBase)AccessTools.Method(typeof(FlashlightLightAim), "Update", (Type[])null, (Type[])null), (Delegate)new Action<Action<FlashlightLightAim>, FlashlightLightAim>(Update_Hook));
}
}
}