using System; using System.Diagnostics; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using BepInEx; using BepInEx.Configuration; using BepInEx.Core.Logging.Interpolation; using BepInEx.Logging; using BepInEx.Unity.IL2CPP; using Il2CppInterop.Runtime.Injection; using UnityEngine; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(/*Could not decode attribute arguments.*/)] [assembly: TargetFramework(".NETCoreApp,Version=v9.0", FrameworkDisplayName = ".NET 9.0")] [assembly: AssemblyCompany("NoseFlashlight")] [assembly: AssemblyConfiguration("Debug")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0")] [assembly: AssemblyProduct("NoseFlashlight")] [assembly: AssemblyTitle("NoseFlashlight")] [assembly: AssemblyVersion("1.0.0.0")] [module: RefSafetyRules(11)] namespace NoseFlashlight; [BepInPlugin("gogogadgetjustice.bigwalk.noseflashlight", "Flashlight", "1.0.0")] public class NoseFlashlightPlugin : BasePlugin { public const string GUID = "gogogadgetjustice.bigwalk.noseflashlight"; public const string PluginName = "Flashlight"; public const string Version = "1.0.0"; internal static ManualLogSource Log; public static ConfigEntry ToggleKey; public static ConfigEntry ColorKey; public static ConfigEntry Range; public static ConfigEntry Intensity; public static ConfigEntry SpotAngle; public static ConfigEntry OffsetForward; public static ConfigEntry OffsetDown; public override void Load() { //IL_011a: Unknown result type (might be due to invalid IL or missing references) //IL_0120: Expected O, but got Unknown Log = ((BasePlugin)this).Log; ToggleKey = ((BasePlugin)this).Config.Bind("General", "ToggleKey", (KeyCode)102, "Press this key to switch the nose flashlight on or off."); ColorKey = ((BasePlugin)this).Config.Bind("General", "ColorKey", (KeyCode)99, "Press this key to cycle through light colors."); Range = ((BasePlugin)this).Config.Bind("General", "Range", 20f, "How far the light reaches, in meters."); Intensity = ((BasePlugin)this).Config.Bind("General", "Intensity", 4f, "Brightness of the light."); SpotAngle = ((BasePlugin)this).Config.Bind("General", "SpotAngle", 50f, "Cone width of the spotlight, in degrees."); OffsetForward = ((BasePlugin)this).Config.Bind("Positioning", "OffsetForward", 0.35f, "How far in front of the camera the light sits, in meters."); OffsetDown = ((BasePlugin)this).Config.Bind("Positioning", "OffsetDown", 0.08f, "How far below the camera the light sits, in meters."); ClassInjector.RegisterTypeInIl2Cpp(); ((BasePlugin)this).AddComponent(); ManualLogSource log = Log; bool flag = default(bool); BepInExInfoLogInterpolatedStringHandler val = new BepInExInfoLogInterpolatedStringHandler(9, 2, ref flag); if (flag) { ((BepInExLogInterpolatedStringHandler)val).AppendFormatted("Flashlight"); ((BepInExLogInterpolatedStringHandler)val).AppendLiteral(" "); ((BepInExLogInterpolatedStringHandler)val).AppendFormatted("1.0.0"); ((BepInExLogInterpolatedStringHandler)val).AppendLiteral(" loaded."); } log.LogInfo(val); } } public class NoseFlashlightController : MonoBehaviour { private Light _noseLight; private Camera _attachedCamera; private bool _isOn; private int _colorIndex = 0; private readonly Color[] _colors = (Color[])(object)new Color[5] { Color.white, Color.red, Color.green, Color.blue, Color.yellow }; public NoseFlashlightController(nint ptr) : base((global::System.IntPtr)ptr) { }//IL_0010: Unknown result type (might be due to invalid IL or missing references) //IL_0015: Unknown result type (might be due to invalid IL or missing references) //IL_001c: Unknown result type (might be due to invalid IL or missing references) //IL_0021: Unknown result type (might be due to invalid IL or missing references) //IL_0028: Unknown result type (might be due to invalid IL or missing references) //IL_002d: Unknown result type (might be due to invalid IL or missing references) //IL_0034: Unknown result type (might be due to invalid IL or missing references) //IL_0039: Unknown result type (might be due to invalid IL or missing references) //IL_0040: Unknown result type (might be due to invalid IL or missing references) //IL_0045: Unknown result type (might be due to invalid IL or missing references) private void Update() { //IL_0032: Unknown result type (might be due to invalid IL or missing references) //IL_004e: Unknown result type (might be due to invalid IL or missing references) Camera main = Camera.main; if ((Object)(object)main != (Object)null && (Object)(object)main != (Object)(object)_attachedCamera) { AttachTo(main); } if (Input.GetKeyDown(NoseFlashlightPlugin.ToggleKey.Value)) { Toggle(); } if (Input.GetKeyDown(NoseFlashlightPlugin.ColorKey.Value)) { CycleColor(); } } private void AttachTo(Camera cam) { _attachedCamera = cam; if ((Object)(object)_noseLight == (Object)null) { CreateLight(); } ((Component)_noseLight).transform.SetParent(((Component)cam).transform, false); ApplyOffset(); } private void CreateLight() { //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Expected O, but got Unknown //IL_0037: Unknown result type (might be due to invalid IL or missing references) GameObject val = new GameObject("NoseFlashlight"); _noseLight = val.AddComponent(); _noseLight.type = (LightType)0; _noseLight.color = _colors[_colorIndex]; _noseLight.shadows = (LightShadows)2; val.SetActive(_isOn); ApplySettings(); } private void CycleColor() { //IL_003c: Unknown result type (might be due to invalid IL or missing references) //IL_0052: Unknown result type (might be due to invalid IL or missing references) //IL_0058: Expected O, but got Unknown if (!((Object)(object)_noseLight == (Object)null)) { _colorIndex = (_colorIndex + 1) % _colors.Length; _noseLight.color = _colors[_colorIndex]; ManualLogSource log = NoseFlashlightPlugin.Log; bool flag = default(bool); BepInExInfoLogInterpolatedStringHandler val = new BepInExInfoLogInterpolatedStringHandler(34, 1, ref flag); if (flag) { ((BepInExLogInterpolatedStringHandler)val).AppendLiteral("Flashlight color changed to index "); ((BepInExLogInterpolatedStringHandler)val).AppendFormatted(_colorIndex); } log.LogInfo(val); } } private void ApplyOffset() { //IL_0038: Unknown result type (might be due to invalid IL or missing references) //IL_004e: Unknown result type (might be due to invalid IL or missing references) if (!((Object)(object)_noseLight == (Object)null)) { ((Component)_noseLight).transform.localPosition = new Vector3(0f, 0f - NoseFlashlightPlugin.OffsetDown.Value, NoseFlashlightPlugin.OffsetForward.Value); ((Component)_noseLight).transform.localRotation = Quaternion.identity; } } private void ApplySettings() { if (!((Object)(object)_noseLight == (Object)null)) { _noseLight.range = NoseFlashlightPlugin.Range.Value; _noseLight.intensity = NoseFlashlightPlugin.Intensity.Value; _noseLight.spotAngle = NoseFlashlightPlugin.SpotAngle.Value; ApplyOffset(); } } private void Toggle() { //IL_0066: Unknown result type (might be due to invalid IL or missing references) //IL_006d: Expected O, but got Unknown if ((Object)(object)_noseLight == (Object)null) { Camera main = Camera.main; if ((Object)(object)main == (Object)null) { return; } AttachTo(main); } ApplySettings(); _isOn = !_isOn; ((Component)_noseLight).gameObject.SetActive(_isOn); ManualLogSource log = NoseFlashlightPlugin.Log; bool flag = default(bool); BepInExInfoLogInterpolatedStringHandler val = new BepInExInfoLogInterpolatedStringHandler(16, 1, ref flag); if (flag) { ((BepInExLogInterpolatedStringHandler)val).AppendLiteral("Nose flashlight "); ((BepInExLogInterpolatedStringHandler)val).AppendFormatted(_isOn ? "ON" : "OFF"); } log.LogInfo(val); } }