Please disclose if any significant portion of your mod was created using AI tools by adding the 'AI Generated' category. Failing to do so may result in the mod being removed from Thunderstore.
Decompiled source of NVG Revised v1.0.4
plugins/NVG_Revised.dll
Decompiled a year agousing System; using System.Collections.Generic; using System.Diagnostics; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using System.Security; using System.Security.Permissions; using BepInEx; using BepInEx.Configuration; using BepInEx.Logging; using GameNetcodeStuff; using HarmonyLib; using Microsoft.CodeAnalysis; using UnityEngine; using UnityEngine.Rendering; using UnityEngine.Rendering.HighDefinition; [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 = ".NET Standard 2.1")] [assembly: AssemblyCompany("NVG_Revised")] [assembly: AssemblyConfiguration("Debug")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0+be7d0d750de91edf9f2ca506b35dae286b7abc07")] [assembly: AssemblyProduct("NVG_Revised")] [assembly: AssemblyTitle("NVG_Revised")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.0.0.0")] [module: UnverifiableCode] [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.Class | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Parameter | AttributeTargets.ReturnValue | AttributeTargets.GenericParameter, AllowMultiple = false, Inherited = false)] internal sealed class NullableAttribute : Attribute { public readonly byte[] NullableFlags; public NullableAttribute(byte P_0) { NullableFlags = new byte[1] { P_0 }; } public NullableAttribute(byte[] P_0) { NullableFlags = P_0; } } [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] [AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Method | AttributeTargets.Interface | AttributeTargets.Delegate, AllowMultiple = false, Inherited = false)] internal sealed class NullableContextAttribute : Attribute { public readonly byte Flag; public NullableContextAttribute(byte P_0) { Flag = P_0; } } [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 NVG_Revised { public class NightVisionController : MonoBehaviour { private IInputSystem? _inputManager; private PlayerControllerB? _playerController; private GameObject? _player; private GameObject? _cameraObject; private bool _nightVisionEnabled; private GameObject? _normalFilter; private Volume? _normalVolume; private Volume? _nvVolume; private GameObject? _nightvisionFilter; private Light? _nvAmbient; private float _nvResponseTime; private float _nvTimer; private float _colorCycleTimer; private Color[] _rainbowColors = (Color[])(object)new Color[7] { Color.red, Color.magenta, Color.blue, Color.cyan, Color.green, Color.yellow, Color.red }; private KeyCode _toggleKey; private KeyCode _reloadConfigKey; private void Awake() { //IL_0022: Unknown result type (might be due to invalid IL or missing references) //IL_0027: Unknown result type (might be due to invalid IL or missing references) //IL_0032: Unknown result type (might be due to invalid IL or missing references) //IL_0037: Unknown result type (might be due to invalid IL or missing references) _inputManager = UnityInput.Current; _nvResponseTime = NVG_Revised.NvResponseTimeConfig.Value; _toggleKey = NVG_Revised.ToggleKeyConfig.Value; _reloadConfigKey = NVG_Revised.ReloadConfigKeyConfig.Value; NVG_Revised.LogInfo("NightVisionController initialized."); } private void Update() { //IL_0030: Unknown result type (might be due to invalid IL or missing references) //IL_0084: Unknown result type (might be due to invalid IL or missing references) UpdateNvIntensity(); if ((Object)(object)_player == (Object)null) { InitializePlayerComponents(); } if (_inputManager != null && _inputManager.GetKeyDown(_toggleKey) && (Object)(object)_playerController != (Object)null && !_playerController.inTerminalMenu && !_playerController.isTypingChat) { ToggleNightVision(); } if (_inputManager != null && _inputManager.GetKeyDown(_reloadConfigKey)) { NVG_Revised.Instance.ReloadConfig(); ApplyConfig(); } if (NVG_Revised.RainbowColorConfig.Value) { UpdateRainbowColor(); } UpdateNvTimer(); UpdateVolumeWeights(); } private void UpdateNvIntensity() { if ((Object)(object)_nvAmbient != (Object)null) { _nvAmbient.intensity = NVG_Revised.NvAmbientIntensityConfig.Value * (_nvTimer / _nvResponseTime); } } private void InitializePlayerComponents() { //IL_0126: Unknown result type (might be due to invalid IL or missing references) _player = GameObject.Find("Player"); if ((Object)(object)_player == (Object)null) { return; } Transform obj = _player.transform.Find("ScavengerModel/metarig/CameraContainer/MainCamera"); _cameraObject = ((obj != null) ? ((Component)obj).gameObject : null); _playerController = _player.GetComponent<PlayerControllerB>(); GameObject obj2 = GameObject.Find("PlayerHUDHelmetModel"); if (obj2 != null) { obj2.SetActive(false); } _normalFilter = GameObject.Find("CustomPass"); GameObject obj3 = GameObject.Find("VolumeMain"); _normalVolume = ((obj3 != null) ? obj3.GetComponent<Volume>() : null); GameObject val = GameObject.Find("VolumeMain"); if ((Object)(object)val != (Object)null) { _nightvisionFilter = Object.Instantiate<GameObject>(val); ((Object)_nightvisionFilter).name = "NightVisionVolume"; _nvAmbient = _nightvisionFilter.AddComponent<Light>(); _nvAmbient.type = (LightType)1; _nvAmbient.intensity = NVG_Revised.NvAmbientIntensityConfig.Value; _nightvisionFilter.transform.rotation = Quaternion.Euler(90f, 0f, 0f); _nvVolume = _nightvisionFilter.GetComponent<Volume>(); if ((Object)(object)_nvVolume != (Object)null) { InitializeNvProfile(_nvVolume.profile); } _nightvisionFilter.SetActive(true); _nvVolume.weight = 0f; } } private static void InitializeNvProfile(VolumeProfile profile) { //IL_00a7: Unknown result type (might be due to invalid IL or missing references) ((Object)profile).name = "NVGOptions"; profile.components.Clear(); Bloom val = profile.Add<Bloom>(true); ((VolumeParameter<float>)(object)val.intensity).value = NVG_Revised.BloomIntensityConfig.Value; ((VolumeParameter<float>)(object)val.threshold).value = NVG_Revised.BloomThresholdConfig.Value; ((VolumeComponent)val).active = true; Vignette val2 = profile.Add<Vignette>(true); ((VolumeParameter<float>)(object)val2.intensity).value = NVG_Revised.VignetteIntensityConfig.Value; ((VolumeParameter<float>)(object)val2.smoothness).value = NVG_Revised.VignetteSmoothnessConfig.Value; ((VolumeComponent)val2).active = true; ColorAdjustments val3 = profile.Add<ColorAdjustments>(true); ((VolumeParameter<Color>)(object)val3.colorFilter).value = NVG_Revised.GetColorFromPreset(NVG_Revised.ColorFilterConfig.Value); ((VolumeParameter<float>)(object)val3.postExposure).value = NVG_Revised.PostExposureConfig.Value; ((VolumeComponent)val3).active = true; FilmGrain val4 = profile.Add<FilmGrain>(true); ((VolumeParameter<FilmGrainLookup>)(object)val4.type).value = (FilmGrainLookup)9; ((VolumeParameter<float>)(object)val4.intensity).value = NVG_Revised.FilmGrainIntensityConfig.Value; ((VolumeParameter<float>)(object)val4.response).value = NVG_Revised.FilmGrainResponseConfig.Value; ((VolumeComponent)val4).active = true; } private void ToggleNightVision() { if (!((Object)(object)_player == (Object)null) && !((Object)(object)_cameraObject == (Object)null) && !((Object)(object)_normalFilter == (Object)null)) { _nightVisionEnabled = !_nightVisionEnabled; _normalFilter.SetActive(!_nightVisionEnabled); NVG_Revised.LogInfo($"Night vision toggled: {_nightVisionEnabled}"); } } private void UpdateNvTimer() { _nvTimer += (_nightVisionEnabled ? Time.deltaTime : (0f - Time.deltaTime)); _nvTimer = Mathf.Clamp(_nvTimer, 0f, _nvResponseTime); } private void UpdateVolumeWeights() { if ((Object)(object)_player != (Object)null && (Object)(object)_normalVolume != (Object)null && (Object)(object)_nvVolume != (Object)null) { _normalVolume.weight = (_nvResponseTime - _nvTimer) / _nvResponseTime; _nvVolume.weight = _nvTimer / _nvResponseTime; } } private void UpdateRainbowColor() { //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) //IL_0058: Unknown result type (might be due to invalid IL or missing references) //IL_005d: Unknown result type (might be due to invalid IL or missing references) //IL_005e: Unknown result type (might be due to invalid IL or missing references) //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0070: Unknown result type (might be due to invalid IL or missing references) //IL_0075: Unknown result type (might be due to invalid IL or missing references) //IL_00aa: Unknown result type (might be due to invalid IL or missing references) _colorCycleTimer += Time.deltaTime; float num = _colorCycleTimer % 5f / 5f; int num2 = Mathf.FloorToInt(num * (float)(_rainbowColors.Length - 1)); Color val = _rainbowColors[num2]; Color val2 = _rainbowColors[(num2 + 1) % _rainbowColors.Length]; Color value = Color.Lerp(val, val2, num * (float)(_rainbowColors.Length - 1) - (float)num2); ColorAdjustments val3 = default(ColorAdjustments); if ((Object)(object)_nvVolume != (Object)null && _nvVolume.profile.TryGet<ColorAdjustments>(ref val3)) { ((VolumeParameter<Color>)(object)val3.colorFilter).value = value; } } private void ApplyConfig() { //IL_015b: Unknown result type (might be due to invalid IL or missing references) //IL_0160: Unknown result type (might be due to invalid IL or missing references) //IL_016b: Unknown result type (might be due to invalid IL or missing references) //IL_0170: Unknown result type (might be due to invalid IL or missing references) //IL_00b9: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)_nvVolume != (Object)null) { VolumeProfile profile = _nvVolume.profile; Bloom val = default(Bloom); if (profile.TryGet<Bloom>(ref val)) { ((VolumeParameter<float>)(object)val.intensity).value = NVG_Revised.BloomIntensityConfig.Value; ((VolumeParameter<float>)(object)val.threshold).value = NVG_Revised.BloomThresholdConfig.Value; } Vignette val2 = default(Vignette); if (profile.TryGet<Vignette>(ref val2)) { ((VolumeParameter<float>)(object)val2.intensity).value = NVG_Revised.VignetteIntensityConfig.Value; ((VolumeParameter<float>)(object)val2.smoothness).value = NVG_Revised.VignetteSmoothnessConfig.Value; } ColorAdjustments val3 = default(ColorAdjustments); if (profile.TryGet<ColorAdjustments>(ref val3)) { ((VolumeParameter<Color>)(object)val3.colorFilter).value = NVG_Revised.GetColorFromPreset(NVG_Revised.ColorFilterConfig.Value); ((VolumeParameter<float>)(object)val3.postExposure).value = NVG_Revised.PostExposureConfig.Value; } FilmGrain val4 = default(FilmGrain); if (profile.TryGet<FilmGrain>(ref val4)) { ((VolumeParameter<float>)(object)val4.intensity).value = NVG_Revised.FilmGrainIntensityConfig.Value; ((VolumeParameter<float>)(object)val4.response).value = NVG_Revised.FilmGrainResponseConfig.Value; } } _nvResponseTime = NVG_Revised.NvResponseTimeConfig.Value; if ((Object)(object)_nvAmbient != (Object)null) { _nvAmbient.intensity = NVG_Revised.NvAmbientIntensityConfig.Value; } _toggleKey = NVG_Revised.ToggleKeyConfig.Value; _reloadConfigKey = NVG_Revised.ReloadConfigKeyConfig.Value; } } [BepInPlugin("NVG_Revised", "NVG_Revised", "1.0.0")] public class NVG_Revised : BaseUnityPlugin { public enum ColorPreset { Green, Red, Blue, Purple, Yellow, Orange, Cyan, Magenta, White, Black, Gray } private static readonly Dictionary<ColorPreset, Color> ColorMap = new Dictionary<ColorPreset, Color> { { ColorPreset.Green, new Color(0f, 0.75f, 0.03f) }, { ColorPreset.Red, new Color(1f, 0f, 0f) }, { ColorPreset.Blue, new Color(0f, 0f, 1f) }, { ColorPreset.Purple, new Color(0.5f, 0f, 0.5f) }, { ColorPreset.Yellow, new Color(1f, 1f, 0f) }, { ColorPreset.Orange, new Color(1f, 0.5f, 0f) }, { ColorPreset.Cyan, new Color(0f, 1f, 1f) }, { ColorPreset.Magenta, new Color(1f, 0f, 1f) }, { ColorPreset.White, new Color(1f, 1f, 1f) }, { ColorPreset.Black, new Color(0f, 0f, 0f) }, { ColorPreset.Gray, new Color(0.5f, 0.5f, 0.5f) } }; public static NVG_Revised Instance { get; private set; } = null; internal static ManualLogSource Logger { get; private set; } = null; private static Harmony? Harmony { get; set; } internal static ConfigEntry<ColorPreset> ColorFilterConfig { get; private set; } = null; internal static ConfigEntry<KeyCode> ToggleKeyConfig { get; private set; } = null; internal static ConfigEntry<KeyCode> ReloadConfigKeyConfig { get; private set; } = null; internal static ConfigEntry<float> NvResponseTimeConfig { get; private set; } = null; internal static ConfigEntry<float> NvAmbientIntensityConfig { get; private set; } = null; internal static ConfigEntry<float> BloomIntensityConfig { get; private set; } = null; internal static ConfigEntry<float> BloomThresholdConfig { get; private set; } = null; internal static ConfigEntry<float> VignetteIntensityConfig { get; private set; } = null; internal static ConfigEntry<float> VignetteSmoothnessConfig { get; private set; } = null; internal static ConfigEntry<float> PostExposureConfig { get; private set; } = null; internal static ConfigEntry<float> FilmGrainIntensityConfig { get; private set; } = null; internal static ConfigEntry<float> FilmGrainResponseConfig { get; private set; } = null; internal static ConfigEntry<bool> RainbowColorConfig { get; private set; } = null; internal static ConfigEntry<bool> LoggingEnabledConfig { get; private set; } = null; private void Awake() { //IL_0030: Unknown result type (might be due to invalid IL or missing references) //IL_003a: Expected O, but got Unknown //IL_005d: Unknown result type (might be due to invalid IL or missing references) //IL_0067: Expected O, but got Unknown //IL_008d: Unknown result type (might be due to invalid IL or missing references) //IL_0097: Expected O, but got Unknown //IL_00cb: Unknown result type (might be due to invalid IL or missing references) //IL_00d5: Expected O, but got Unknown //IL_0109: Unknown result type (might be due to invalid IL or missing references) //IL_0113: Expected O, but got Unknown //IL_0147: Unknown result type (might be due to invalid IL or missing references) //IL_0151: Expected O, but got Unknown //IL_0185: Unknown result type (might be due to invalid IL or missing references) //IL_018f: Expected O, but got Unknown //IL_01c3: Unknown result type (might be due to invalid IL or missing references) //IL_01cd: Expected O, but got Unknown //IL_0201: Unknown result type (might be due to invalid IL or missing references) //IL_020b: Expected O, but got Unknown //IL_023f: Unknown result type (might be due to invalid IL or missing references) //IL_0249: Expected O, but got Unknown //IL_027d: Unknown result type (might be due to invalid IL or missing references) //IL_0287: Expected O, but got Unknown //IL_02bb: Unknown result type (might be due to invalid IL or missing references) //IL_02c5: Expected O, but got Unknown //IL_02e7: Unknown result type (might be due to invalid IL or missing references) //IL_02f1: Expected O, but got Unknown //IL_0313: Unknown result type (might be due to invalid IL or missing references) //IL_031d: Expected O, but got Unknown Logger = ((BaseUnityPlugin)this).Logger; Instance = this; ColorFilterConfig = ((BaseUnityPlugin)this).Config.Bind<ColorPreset>("General", "ColorFilter", ColorPreset.Green, new ConfigDescription("Color filter for night vision.", (AcceptableValueBase)null, Array.Empty<object>())); ToggleKeyConfig = ((BaseUnityPlugin)this).Config.Bind<KeyCode>("General", "ToggleKey", (KeyCode)99, new ConfigDescription("Key to toggle night vision.", (AcceptableValueBase)null, Array.Empty<object>())); ReloadConfigKeyConfig = ((BaseUnityPlugin)this).Config.Bind<KeyCode>("General", "ReloadConfigKey", (KeyCode)282, new ConfigDescription("Key to reload configuration settings.", (AcceptableValueBase)null, Array.Empty<object>())); NvResponseTimeConfig = ((BaseUnityPlugin)this).Config.Bind<float>("Advanced", "ResponseTime", 0.1f, new ConfigDescription("Response time for night vision.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0.1f, 10f), Array.Empty<object>())); NvAmbientIntensityConfig = ((BaseUnityPlugin)this).Config.Bind<float>("Advanced", "AmbientIntensity", 0.3f, new ConfigDescription("Ambient light intensity for night vision.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0f, 1f), Array.Empty<object>())); BloomIntensityConfig = ((BaseUnityPlugin)this).Config.Bind<float>("Advanced", "BloomIntensity", 12f, new ConfigDescription("Bloom intensity for night vision.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0f, 100f), Array.Empty<object>())); BloomThresholdConfig = ((BaseUnityPlugin)this).Config.Bind<float>("Advanced", "BloomThreshold", 0.7f, new ConfigDescription("Bloom threshold for night vision.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0f, 1f), Array.Empty<object>())); VignetteIntensityConfig = ((BaseUnityPlugin)this).Config.Bind<float>("Advanced", "VignetteIntensity", 0.5f, new ConfigDescription("Vignette intensity for night vision.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0f, 1f), Array.Empty<object>())); VignetteSmoothnessConfig = ((BaseUnityPlugin)this).Config.Bind<float>("Advanced", "VignetteSmoothness", 1f, new ConfigDescription("Vignette smoothness for night vision.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0f, 1f), Array.Empty<object>())); PostExposureConfig = ((BaseUnityPlugin)this).Config.Bind<float>("Advanced", "PostExposure", 3.5f, new ConfigDescription("Post exposure for night vision.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0f, 10f), Array.Empty<object>())); FilmGrainIntensityConfig = ((BaseUnityPlugin)this).Config.Bind<float>("Advanced", "FilmGrainIntensity", 1f, new ConfigDescription("Film grain intensity for night vision.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0f, 1f), Array.Empty<object>())); FilmGrainResponseConfig = ((BaseUnityPlugin)this).Config.Bind<float>("Advanced", "FilmGrainResponse", 0.8f, new ConfigDescription("Film grain response for night vision.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0f, 1f), Array.Empty<object>())); RainbowColorConfig = ((BaseUnityPlugin)this).Config.Bind<bool>("Extras", "RainbowColor", false, new ConfigDescription("Enable rainbow color mode for night vision.", (AcceptableValueBase)null, Array.Empty<object>())); LoggingEnabledConfig = ((BaseUnityPlugin)this).Config.Bind<bool>("General", "LoggingEnabled", false, new ConfigDescription("Enable or disable logging.", (AcceptableValueBase)null, Array.Empty<object>())); LogInfo("Configuration settings loaded."); Patch(); LogInfo("NVG_Revised v1.0.0 has loaded!"); InitializeNightVision(); } private static void Patch() { //IL_000d: Unknown result type (might be due to invalid IL or missing references) //IL_0012: Unknown result type (might be due to invalid IL or missing references) //IL_0018: Expected O, but got Unknown if (Harmony == null) { Harmony = new Harmony("NVG_Revised"); } LogDebug("Patching..."); Harmony.PatchAll(); LogDebug("Finished patching!"); } internal static void Unpatch() { LogDebug("Unpatching..."); Harmony? harmony = Harmony; if (harmony != null) { harmony.UnpatchSelf(); } LogDebug("Finished unpatching!"); } private static void InitializeNightVision() { //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Expected O, but got Unknown GameObject val = new GameObject("NVG Controller"); val.AddComponent<NightVisionController>(); Object.DontDestroyOnLoad((Object)(object)val); ((Object)val).hideFlags = (HideFlags)61; LogInfo("NVG Revised is loaded!"); } public static Color GetColorFromPreset(ColorPreset preset) { //IL_001d: Unknown result type (might be due to invalid IL or missing references) //IL_0016: Unknown result type (might be due to invalid IL or missing references) //IL_001e: 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) Color value; return ColorMap.TryGetValue(preset, out value) ? value : ColorMap[ColorPreset.Green]; } public void ReloadConfig() { //IL_0031: Unknown result type (might be due to invalid IL or missing references) //IL_003b: Expected O, but got Unknown //IL_0056: Unknown result type (might be due to invalid IL or missing references) //IL_0066: Unknown result type (might be due to invalid IL or missing references) //IL_0070: Expected O, but got Unknown //IL_008b: Unknown result type (might be due to invalid IL or missing references) //IL_009b: Unknown result type (might be due to invalid IL or missing references) //IL_00a5: Expected O, but got Unknown //IL_00de: Unknown result type (might be due to invalid IL or missing references) //IL_00e8: Expected O, but got Unknown //IL_0121: Unknown result type (might be due to invalid IL or missing references) //IL_012b: Expected O, but got Unknown //IL_0164: Unknown result type (might be due to invalid IL or missing references) //IL_016e: Expected O, but got Unknown //IL_01a7: Unknown result type (might be due to invalid IL or missing references) //IL_01b1: Expected O, but got Unknown //IL_01ea: Unknown result type (might be due to invalid IL or missing references) //IL_01f4: Expected O, but got Unknown //IL_022d: Unknown result type (might be due to invalid IL or missing references) //IL_0237: Expected O, but got Unknown //IL_0270: Unknown result type (might be due to invalid IL or missing references) //IL_027a: Expected O, but got Unknown //IL_02b3: Unknown result type (might be due to invalid IL or missing references) //IL_02bd: Expected O, but got Unknown //IL_02f6: Unknown result type (might be due to invalid IL or missing references) //IL_0300: Expected O, but got Unknown //IL_032b: Unknown result type (might be due to invalid IL or missing references) //IL_0335: Expected O, but got Unknown LogInfo("Reloading configuration settings..."); ColorFilterConfig = ((BaseUnityPlugin)this).Config.Bind<ColorPreset>("General", "ColorFilter", ColorFilterConfig.Value, new ConfigDescription("Color filter for night vision.", (AcceptableValueBase)null, Array.Empty<object>())); ToggleKeyConfig = ((BaseUnityPlugin)this).Config.Bind<KeyCode>("General", "ToggleKey", ToggleKeyConfig.Value, new ConfigDescription("Key to toggle night vision.", (AcceptableValueBase)null, Array.Empty<object>())); ReloadConfigKeyConfig = ((BaseUnityPlugin)this).Config.Bind<KeyCode>("General", "ReloadConfigKey", ReloadConfigKeyConfig.Value, new ConfigDescription("Key to reload configuration settings.", (AcceptableValueBase)null, Array.Empty<object>())); NvResponseTimeConfig = ((BaseUnityPlugin)this).Config.Bind<float>("Advanced", "ResponseTime", NvResponseTimeConfig.Value, new ConfigDescription("Response time for night vision.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0.1f, 10f), Array.Empty<object>())); NvAmbientIntensityConfig = ((BaseUnityPlugin)this).Config.Bind<float>("Advanced", "AmbientIntensity", NvAmbientIntensityConfig.Value, new ConfigDescription("Ambient light intensity for night vision.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0f, 1f), Array.Empty<object>())); BloomIntensityConfig = ((BaseUnityPlugin)this).Config.Bind<float>("Advanced", "BloomIntensity", BloomIntensityConfig.Value, new ConfigDescription("Bloom intensity for night vision.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0f, 100f), Array.Empty<object>())); BloomThresholdConfig = ((BaseUnityPlugin)this).Config.Bind<float>("Advanced", "BloomThreshold", BloomThresholdConfig.Value, new ConfigDescription("Bloom threshold for night vision.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0f, 1f), Array.Empty<object>())); VignetteIntensityConfig = ((BaseUnityPlugin)this).Config.Bind<float>("Advanced", "VignetteIntensity", VignetteIntensityConfig.Value, new ConfigDescription("Vignette intensity for night vision.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0f, 1f), Array.Empty<object>())); VignetteSmoothnessConfig = ((BaseUnityPlugin)this).Config.Bind<float>("Advanced", "VignetteSmoothness", VignetteSmoothnessConfig.Value, new ConfigDescription("Vignette smoothness for night vision.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0f, 1f), Array.Empty<object>())); PostExposureConfig = ((BaseUnityPlugin)this).Config.Bind<float>("Advanced", "PostExposure", PostExposureConfig.Value, new ConfigDescription("Post exposure for night vision.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0f, 10f), Array.Empty<object>())); FilmGrainIntensityConfig = ((BaseUnityPlugin)this).Config.Bind<float>("Advanced", "FilmGrainIntensity", FilmGrainIntensityConfig.Value, new ConfigDescription("Film grain intensity for night vision.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0f, 1f), Array.Empty<object>())); FilmGrainResponseConfig = ((BaseUnityPlugin)this).Config.Bind<float>("Advanced", "FilmGrainResponse", FilmGrainResponseConfig.Value, new ConfigDescription("Film grain response for night vision.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0f, 1f), Array.Empty<object>())); RainbowColorConfig = ((BaseUnityPlugin)this).Config.Bind<bool>("Extras", "RainbowColor", RainbowColorConfig.Value, new ConfigDescription("Enable rainbow color mode for night vision.", (AcceptableValueBase)null, Array.Empty<object>())); LogInfo("Configuration settings reloaded."); } private static void Log(LogLevel level, string message) { //IL_0014: 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_0016: Unknown result type (might be due to invalid IL or missing references) //IL_0017: Unknown result type (might be due to invalid IL or missing references) //IL_0018: Unknown result type (might be due to invalid IL or missing references) //IL_001a: Invalid comparison between Unknown and I4 //IL_0028: Unknown result type (might be due to invalid IL or missing references) //IL_002b: Invalid comparison between Unknown and I4 //IL_001c: Unknown result type (might be due to invalid IL or missing references) //IL_001e: Invalid comparison between Unknown and I4 //IL_002f: Unknown result type (might be due to invalid IL or missing references) //IL_0032: Invalid comparison between Unknown and I4 //IL_0022: Unknown result type (might be due to invalid IL or missing references) //IL_0024: Invalid comparison between Unknown and I4 if (!LoggingEnabledConfig.Value) { return; } if ((int)level <= 4) { if ((int)level != 2) { if ((int)level == 4) { Logger.LogWarning((object)message); } } else { Logger.LogError((object)message); } } else if ((int)level != 16) { if ((int)level == 32) { Logger.LogDebug((object)message); } } else { Logger.LogInfo((object)message); } } public static void LogInfo(string message) { Log((LogLevel)16, message); } private static void LogDebug(string message) { Log((LogLevel)32, message); } public static void LogWarning(string message) { Log((LogLevel)4, message); } public static void LogError(string message) { Log((LogLevel)2, message); } } public static class MyPluginInfo { public const string PLUGIN_GUID = "NVG_Revised"; public const string PLUGIN_NAME = "NVG_Revised"; public const string PLUGIN_VERSION = "1.0.0"; } }