Decompiled source of BetterFog v3.4.1
BepInEx/plugins/BetterFog.dll
Decompiled a month ago
The result has been truncated due to the large size, download it to view full contents!
using System; using System.Collections; using System.Collections.Generic; using System.Diagnostics; using System.Globalization; using System.IO; using System.Linq; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using System.Text.RegularExpressions; using BepInEx; using BepInEx.Configuration; using BepInEx.Logging; using BetterFog.Assets; using BetterFog.Input; using BetterFog.Patches; using GameNetcodeStuff; using HarmonyLib; using LethalCompanyInputUtils.Api; using TMPro; using Unity.Netcode; using UnityEngine; using UnityEngine.Events; using UnityEngine.InputSystem; using UnityEngine.Rendering.HighDefinition; using UnityEngine.SceneManagement; using UnityEngine.UI; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)] [assembly: TargetFramework(".NETFramework,Version=v4.7.2", FrameworkDisplayName = ".NET Framework 4.7.2")] [assembly: AssemblyVersion("0.0.0.0")] [HarmonyPatch(typeof(Fog))] public class FogPatch { [HarmonyPrefix] private static bool Prefix(HDCamera hdCamera, Fog __instance) { return false; } } namespace BetterFog { [BepInPlugin("ironthumb.BetterFog", "BetterFog", "3.4.0")] public class BetterFog : BaseUnityPlugin { [CompilerGenerated] private sealed class <>c__DisplayClass111_0 { public DropdownRowData nextRow; public Func<FogConfigPreset, bool> <>9__1; public Func<FogConfigPreset, bool> <>9__2; internal bool <GradientLoop>b__1(FogConfigPreset p) { return p.PresetName == nextRow.PresetName; } internal bool <GradientLoop>b__2(FogConfigPreset p) { return p.PresetName == nextRow.PresetName; } } [CompilerGenerated] private sealed class <ApplyFogSettingsRepeated>d__89 : IEnumerator<object>, IDisposable, IEnumerator { private int <>1__state; private object <>2__current; public int repeatCount; private int <i>5__1; object IEnumerator<object>.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public <ApplyFogSettingsRepeated>d__89(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { <>1__state = -2; } private bool MoveNext() { //IL_006d: Unknown result type (might be due to invalid IL or missing references) //IL_0077: Expected O, but got Unknown switch (<>1__state) { default: return false; case 0: <>1__state = -1; <i>5__1 = 0; break; case 1: <>1__state = -1; <i>5__1++; break; } if (<i>5__1 < repeatCount) { if (verboseLoggingEnabled) { mls.LogInfo((object)$"Applying fog settings... ({<i>5__1 + 1}/{repeatCount})"); } ApplyFogSettings(activateAutoPresetMode: false); <>2__current = (object)new WaitForSecondsRealtime(1f); <>1__state = 1; return true; } return false; } bool IEnumerator.MoveNext() { //ILSpy generated this explicit interface implementation from .override directive in MoveNext return this.MoveNext(); } [DebuggerHidden] void IEnumerator.Reset() { throw new NotSupportedException(); } } [CompilerGenerated] private sealed class <DelayAndApplySettings>d__105 : IEnumerator<object>, IDisposable, IEnumerator { private int <>1__state; private object <>2__current; public float seconds; public BetterFog <>4__this; object IEnumerator<object>.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public <DelayAndApplySettings>d__105(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { <>1__state = -2; } private bool MoveNext() { //IL_0047: Unknown result type (might be due to invalid IL or missing references) //IL_0051: Expected O, but got Unknown switch (<>1__state) { default: return false; case 0: <>1__state = -1; mls.LogInfo((object)$"Waiting for {seconds} seconds..."); <>2__current = (object)new WaitForSeconds(seconds); <>1__state = 1; return true; case 1: <>1__state = -1; mls.LogInfo((object)$"Waited {seconds} seconds."); if (GameNetworkManager.Instance.gameHasStarted) { mls.LogInfo((object)"Game has started. Applying fog settings to moon."); ApplyFogSettings(activateAutoPresetMode: false); } else { mls.LogInfo((object)"Game has not started yet. Refusing to apply fog settings."); } return false; } } bool IEnumerator.MoveNext() { //ILSpy generated this explicit interface implementation from .override directive in MoveNext return this.MoveNext(); } [DebuggerHidden] void IEnumerator.Reset() { throw new NotSupportedException(); } } [CompilerGenerated] private sealed class <DiscoLoop>d__110 : IEnumerator<object>, IDisposable, IEnumerator { private int <>1__state; private object <>2__current; public BetterFog <>4__this; object IEnumerator<object>.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public <DiscoLoop>d__110(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { <>1__state = -2; } private bool MoveNext() { //IL_0101: Unknown result type (might be due to invalid IL or missing references) //IL_010b: Expected O, but got Unknown int num = <>1__state; if (num != 0) { if (num != 1) { return false; } <>1__state = -1; sequenceIndex++; goto IL_0128; } <>1__state = -1; isLoopRunning = true; goto IL_0149; IL_0128: if (sequenceIndex < discoDropdownDataList.Count) { if (!restartLoop) { currentPreset = fogConfigPresets.FirstOrDefault((FogConfigPreset p) => p.PresetName == discoDropdownDataList[sequenceIndex].PresetName); currentPresetIndex = fogConfigPresets.IndexOf(currentPreset); if (settingsHotkeyEnabled && isFogSettingsActive) { FogSettingsManager.Instance.UpdateSettings(); } ApplyFogSettings(activateAutoPresetMode: false); if (verboseLoggingEnabled) { mls.LogInfo((object)("Disco mode: Switched to preset " + currentPreset.PresetName)); } <>2__current = (object)new WaitForSeconds((float)discoDropdownDataList[sequenceIndex].Delay / 1000f); <>1__state = 1; return true; } restartLoop = false; sequenceIndex = 0; } sequenceIndex = 0; goto IL_0149; IL_0149: if (currentMode.Name == "Disco") { sequenceIndex = 0; goto IL_0128; } return false; } bool IEnumerator.MoveNext() { //ILSpy generated this explicit interface implementation from .override directive in MoveNext return this.MoveNext(); } [DebuggerHidden] void IEnumerator.Reset() { throw new NotSupportedException(); } } [CompilerGenerated] private sealed class <GradientLoop>d__111 : IEnumerator<object>, IDisposable, IEnumerator { private int <>1__state; private object <>2__current; public BetterFog <>4__this; private <>c__DisplayClass111_0 <>8__1; private FogConfigPreset <nextPreset>5__2; private int <updateDelay>5__3; private int <numUpdates>5__4; private int <nextPresetIndex>5__5; private float <redIncrement>5__6; private float <greenIncrement>5__7; private float <blueIncrement>5__8; private float <densityIncrement>5__9; private int <i>5__10; object IEnumerator<object>.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public <GradientLoop>d__111(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { <>8__1 = null; <nextPreset>5__2 = null; <>1__state = -2; } private bool MoveNext() { //IL_03e0: Unknown result type (might be due to invalid IL or missing references) //IL_03ea: Expected O, but got Unknown int num = <>1__state; if (num != 0) { if (num != 1) { return false; } <>1__state = -1; if (restartLoop) { restartLoop = false; tempColorPreset = new FogConfigPreset(currentPreset.PresetName, currentPreset.AlbedoR, currentPreset.AlbedoG, currentPreset.AlbedoB, currentPreset.MeanFreePath); goto IL_0474; } <i>5__10++; goto IL_045d; } <>1__state = -1; <>8__1 = new <>c__DisplayClass111_0(); isLoopRunning = true; tempColorPreset = new FogConfigPreset(currentPreset.PresetName, currentPreset.AlbedoR, currentPreset.AlbedoG, currentPreset.AlbedoB, currentPreset.MeanFreePath); <>8__1.nextRow = ((sequenceIndex == gradientDropdownDataList.Count - 1) ? gradientDropdownDataList[0] : gradientDropdownDataList[sequenceIndex + 1]); goto IL_058c; IL_058c: if (currentMode.Name == "Gradient") { sequenceIndex = 0; goto IL_0571; } return false; IL_0474: sequenceIndex = (sequenceIndex + 1) % gradientDropdownDataList.Count; <>8__1.nextRow = ((sequenceIndex == gradientDropdownDataList.Count - 1) ? gradientDropdownDataList[0] : gradientDropdownDataList[sequenceIndex + 1]); currentPreset = fogConfigPresets.FirstOrDefault((FogConfigPreset p) => p.PresetName == <>8__1.nextRow.PresetName); currentPresetIndex = fogConfigPresets.IndexOf(currentPreset); if (settingsHotkeyEnabled && isFogSettingsActive) { FogSettingsManager.Instance.UpdateSettings(); } ApplyFogSettings(activateAutoPresetMode: false); if (verboseLoggingEnabled) { mls.LogInfo((object)("Gradient mode: Switched to preset " + currentPreset.PresetName)); } <nextPreset>5__2 = null; goto IL_0571; IL_0571: if (sequenceIndex < gradientDropdownDataList.Count) { if (restartLoop) { restartLoop = false; sequenceIndex = 0; tempColorPreset = new FogConfigPreset(currentPreset.PresetName, currentPreset.AlbedoR, currentPreset.AlbedoG, currentPreset.AlbedoB, currentPreset.MeanFreePath); } else { currentPreset = fogConfigPresets.FirstOrDefault((FogConfigPreset p) => p.PresetName == gradientDropdownDataList[sequenceIndex].PresetName); currentPresetIndex = fogConfigPresets.IndexOf(currentPreset); <nextPreset>5__2 = fogConfigPresets.FirstOrDefault((FogConfigPreset p) => p.PresetName == <>8__1.nextRow.PresetName); if (currentPreset != null && <nextPreset>5__2 != null) { <updateDelay>5__3 = 12; <numUpdates>5__4 = Math.Max(1, gradientDropdownDataList[sequenceIndex].Delay / <updateDelay>5__3); <nextPresetIndex>5__5 = fogConfigPresets.IndexOf(<nextPreset>5__2); <redIncrement>5__6 = (<nextPreset>5__2.AlbedoR - currentPreset.AlbedoR) / (float)<numUpdates>5__4; <greenIncrement>5__7 = (<nextPreset>5__2.AlbedoG - currentPreset.AlbedoG) / (float)<numUpdates>5__4; <blueIncrement>5__8 = (<nextPreset>5__2.AlbedoB - currentPreset.AlbedoB) / (float)<numUpdates>5__4; <densityIncrement>5__9 = (<nextPreset>5__2.MeanFreePath - currentPreset.MeanFreePath) / (float)<numUpdates>5__4; <i>5__10 = 0; goto IL_045d; } mls.LogError((object)"One or more presets are null. Skipping gradient step."); } } goto IL_058c; IL_045d: if (<i>5__10 < <numUpdates>5__4) { if (!restartLoop) { if (<i>5__10 == <numUpdates>5__4 - 1) { tempColorPreset.AlbedoR = <nextPreset>5__2.AlbedoR; tempColorPreset.AlbedoG = <nextPreset>5__2.AlbedoG; tempColorPreset.AlbedoB = <nextPreset>5__2.AlbedoB; tempColorPreset.MeanFreePath = <nextPreset>5__2.MeanFreePath; } else { tempColorPreset.AlbedoR += <redIncrement>5__6; tempColorPreset.AlbedoG += <greenIncrement>5__7; tempColorPreset.AlbedoB += <blueIncrement>5__8; tempColorPreset.MeanFreePath += <densityIncrement>5__9; } ApplyFogSettings(activateAutoPresetMode: false); <>2__current = (object)new WaitForSeconds((float)<updateDelay>5__3 / 1000f); <>1__state = 1; return true; } restartLoop = false; tempColorPreset = new FogConfigPreset(currentPreset.PresetName, currentPreset.AlbedoR, currentPreset.AlbedoG, currentPreset.AlbedoB, currentPreset.MeanFreePath); } goto IL_0474; } bool IEnumerator.MoveNext() { //ILSpy generated this explicit interface implementation from .override directive in MoveNext return this.MoveNext(); } [DebuggerHidden] void IEnumerator.Reset() { throw new NotSupportedException(); } } [CompilerGenerated] private sealed class <WaitForGameStartAndApplyFog>d__88 : IEnumerator<object>, IDisposable, IEnumerator { private int <>1__state; private object <>2__current; private int <waitTime>5__1; private int <waitTimeLimit>5__2; object IEnumerator<object>.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public <WaitForGameStartAndApplyFog>d__88(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { <>1__state = -2; } private bool MoveNext() { //IL_0061: Unknown result type (might be due to invalid IL or missing references) //IL_006b: Expected O, but got Unknown switch (<>1__state) { default: return false; case 0: <>1__state = -1; <waitTime>5__1 = 0; <waitTimeLimit>5__2 = 60; if (verboseLoggingEnabled) { mls.LogInfo((object)$"Waiting for game to start... ({<waitTime>5__1}s)"); } break; case 1: <>1__state = -1; <waitTime>5__1++; break; } if ((Object)(object)GameNetworkManager.Instance != (Object)null && !GameNetworkManager.Instance.gameHasStarted && <waitTime>5__1 < <waitTimeLimit>5__2) { <>2__current = (object)new WaitForSecondsRealtime(1f); <>1__state = 1; return true; } if ((Object)(object)GameNetworkManager.Instance != (Object)null && GameNetworkManager.Instance.gameHasStarted) { mls.LogWarning((object)"Game has started. Applying fog settings."); ((MonoBehaviour)Instance).StartCoroutine(ApplyFogSettingsRepeated(8)); } else if (verboseLoggingEnabled) { mls.LogInfo((object)$"{<waitTime>5__1}s Timeout reached, game has not started yet. Fog settings not applied."); } applyingFogSettings = false; return false; } bool IEnumerator.MoveNext() { //ILSpy generated this explicit interface implementation from .override directive in MoveNext return this.MoveNext(); } [DebuggerHidden] void IEnumerator.Reset() { throw new NotSupportedException(); } } public const string modGUID = "ironthumb.BetterFog"; public const string modName = "BetterFog"; public const string modVersion = "3.4.0"; private readonly Harmony harmony = new Harmony("ironthumb.BetterFog"); public static ManualLogSource mls; private static BetterFog instance; public static bool hotkeysEnabled = true; public static ConfigEntry<string> nextPresetHotkeyConfig; public static ConfigEntry<string> nextModeHotkeyConfig; public static ConfigEntry<string> refreshPresetHotkeyConfig; public static ConfigEntry<string> weatherScaleHotkeyConfig; public static ConfigEntry<string> settingsHotkeyConfig; public static ConfigEntry<string> autoPresetModeHotkeyConfig; public static ConfigEntry<bool> excludeShipFogDefault; public static bool excludeShipFogEnabled; public static ConfigEntry<bool> verboseLoggingDefault; public static bool verboseLoggingEnabled; public static ConfigEntry<bool> excludeEnemyFogDefault; public static bool excludeEnemyFogEnabled; public static bool fogRefreshLock = true; private static List<string> weatherScaleBlacklist = new List<string>(); private static List<string> moonScaleBlacklist = new List<string>(); private static ConfigEntry<string> weatherScaleBlacklistConfig; private static ConfigEntry<string> moonScaleBlacklistConfig; private static ConfigEntry<bool> densityScaleEnabledDefault; public static bool densityScaleEnabled; public static string currentWeatherType = "none"; private static float moonDensityScale = 1f; private static float weatherDensityScale = 1f; public static float combinedDensityScale = 1f; public const float maxDensitySliderValue = 1000f; public const float maxColorValue = 3f; public static List<WeatherScale> weatherScales; private static ConfigEntry<string> weatherScalesConfig; public static bool weatherSaveLoaded = false; public static SelectableLevel currentLevelType; public static string currentLevel = ""; public static List<MoonScale> moonScales; private static ConfigEntry<string> moonScalesConfig; private static List<AutoPresetMode> autoPresetModes; private static ConfigEntry<string> autoPresetModeConfig; private static ConfigEntry<bool> autoPresetModeEnabledDefault; public static bool autoPresetModeEnabled; public static bool autoPresetModeMatchFound = false; public static AutoPresetMode matchedPreset = null; public static ConfigEntry<string> discoSequenceConfig; public static ConfigEntry<string> gradientSequenceConfig; public static List<DropdownRowData> discoDropdownDataList; public static List<DropdownRowData> gradientDropdownDataList; public static int sequenceIndex = 0; public const int maxSequencePresets = 12; public const int minSequencePresets = 1; public static bool restartLoop = false; private static FogConfigPreset tempColorPreset; private static bool isLoopRunning = false; public static ConfigEntry<int> presetCountConfig; public static int presetCountNum; private static ConfigEntry<string> defaultPresetName; public static List<FogConfigPreset> defaultFogConfigPresets; public static List<FogConfigPreset> fogConfigPresets; private ConfigEntry<string>[] presetEntries; public static int currentPresetIndex; public static FogConfigPreset currentPreset; public static Dictionary<GameObject, LocalVolumetricFogArtistParameters> fogParameterChanges = new Dictionary<GameObject, LocalVolumetricFogArtistParameters>(); private static ConfigEntry<string> defaultMode; public static List<BetterFogMode> fogModes; public static int currentModeIndex; public static BetterFogMode currentMode; public static bool isFogSettingsActive = false; public static bool settingsHotkeyEnabled; public static bool applyingFogSettings = false; public static bool inTerminal = false; public static bool lockPresetDropdownModification = false; public static bool lockPresetValueModification = false; public static bool lockModeDropdownModification = false; public static bool lockPresetComboModification = false; public static bool lockDensityScaleModification = false; public static bool lockAutoPresetModeModification = false; public static PlayerControllerB player; private static readonly object lockObject = new object(); public static BetterFog Instance { get { //IL_0042: Unknown result type (might be due to invalid IL or missing references) //IL_0049: Expected O, but got Unknown lock (lockObject) { if ((Object)(object)instance == (Object)null) { instance = Object.FindObjectOfType<BetterFog>(); if ((Object)(object)instance == (Object)null) { GameObject val = new GameObject("BetterFog"); Object.DontDestroyOnLoad((Object)(object)val); instance = val.AddComponent<BetterFog>(); } } return instance; } } } public void Awake() { //IL_0f76: Unknown result type (might be due to invalid IL or missing references) //IL_0f83: Expected O, but got Unknown //IL_0fb1: Unknown result type (might be due to invalid IL or missing references) //IL_0fbe: Expected O, but got Unknown //IL_0fec: Unknown result type (might be due to invalid IL or missing references) //IL_0ff9: Expected O, but got Unknown //IL_1027: Unknown result type (might be due to invalid IL or missing references) //IL_1034: Expected O, but got Unknown //IL_1062: Unknown result type (might be due to invalid IL or missing references) //IL_106f: Expected O, but got Unknown //IL_109d: Unknown result type (might be due to invalid IL or missing references) //IL_10aa: Expected O, but got Unknown //IL_10d8: Unknown result type (might be due to invalid IL or missing references) //IL_10e5: Expected O, but got Unknown //IL_1113: Unknown result type (might be due to invalid IL or missing references) //IL_1120: Expected O, but got Unknown //IL_114e: Unknown result type (might be due to invalid IL or missing references) //IL_115b: Expected O, but got Unknown //IL_1189: Unknown result type (might be due to invalid IL or missing references) //IL_1196: Expected O, but got Unknown //IL_11c4: Unknown result type (might be due to invalid IL or missing references) //IL_11d1: Expected O, but got Unknown //IL_121e: Unknown result type (might be due to invalid IL or missing references) //IL_122b: Expected O, but got Unknown if ((Object)(object)instance != (Object)null && (Object)(object)instance != (Object)(object)this) { Object.Destroy((Object)(object)((Component)this).gameObject); return; } instance = this; Object.DontDestroyOnLoad((Object)(object)((Component)this).gameObject); mls = ((BaseUnityPlugin)this).Logger; if (mls == null) { Debug.LogWarning((object)"Logger not initialized in BetterFog."); } CultureInfo.DefaultThreadCurrentCulture = CultureInfo.InvariantCulture; CultureInfo.DefaultThreadCurrentUICulture = CultureInfo.InvariantCulture; fogConfigPresets = new List<FogConfigPreset> { new FogConfigPreset("Default", 735f, 0.19f, 0.28f, 0.37f), new FogConfigPreset("Heavy Fog", 870f, 0.19f, 0.28f, 0.37f), new FogConfigPreset("Light Fog", 620f, 0.19f, 0.28f, 0.37f), new FogConfigPreset("Mist", 0f, 1f, 1f, 1f), new FogConfigPreset("Red Fog", 550f, 0.5f, 0f, 0f), new FogConfigPreset("Thick Red", 735f, 0.5f, 0f, 0f), new FogConfigPreset("Orange Fog", 350f, 1f, 0.5f, 0f), new FogConfigPreset("Thick Orange", 735f, 1f, 0.5f, 0f), new FogConfigPreset("Yellow Fog", 250f, 1f, 0.75f, 0f), new FogConfigPreset("Thick Yellow", 735f, 1f, 0.75f, 0f), new FogConfigPreset("Green Fog", 450f, 0f, 0.5f, 0f), new FogConfigPreset("Thick Green", 735f, 0f, 0.5f, 0f), new FogConfigPreset("Blue Fog", 550f, 0f, 0f, 1f), new FogConfigPreset("Thick Blue", 735f, 0f, 0f, 1f), new FogConfigPreset("Purple Fog", 450f, 0.25f, 0f, 1f), new FogConfigPreset("Thick Purple", 735f, 0.25f, 0f, 1f), new FogConfigPreset("Pink Fog", 300f, 1f, 0f, 0.5f), new FogConfigPreset("Thick Pink", 735f, 1f, 0f, 0.5f), new FogConfigPreset("White Fog", 550f, 1f, 1f, 1f), new FogConfigPreset("Thick White", 735f, 1f, 1f, 1f) }; defaultFogConfigPresets = fogConfigPresets.Select((FogConfigPreset preset) => new FogConfigPreset(preset)).ToList(); mls.LogInfo((object)"fogConfigPresets initialized."); fogModes = new List<BetterFogMode> { new BetterFogMode("Better Fog"), new BetterFogMode("No Fog"), new BetterFogMode("Vanilla"), new BetterFogMode("Gradient"), new BetterFogMode("Disco") }; mls.LogInfo((object)"fogModes initialized"); string text = "Default Fog Settings"; defaultPresetName = ((BaseUnityPlugin)this).Config.Bind<string>(text, "Default Preset Name", "Default", "Name of the default fog preset (No value sets default to first in list).\nOrder of settings: Preset Name, Mean Free Path, Albedo Red, Albedo Green, Albedo Blue\nDensity of fog. The greater the number, the more dense. Values range 0-1000.\n"); defaultMode = ((BaseUnityPlugin)this).Config.Bind<string>(text, "Default Fog Mode", "Better Fog", "Name of the default fog mode. Options: Better Fog, No Fog, Vanilla"); string text2 = "Key Bindings"; settingsHotkeyConfig = ((BaseUnityPlugin)this).Config.Bind<string>(text2, "Settings Hotkey", "f1", "Hotkey to open the BetterFog settings menu."); nextPresetHotkeyConfig = ((BaseUnityPlugin)this).Config.Bind<string>(text2, "Next Preset Hotkey", "n", "Hotkey to switch to the next fog preset."); nextModeHotkeyConfig = ((BaseUnityPlugin)this).Config.Bind<string>(text2, "Next Mode Hotkey", "m", "Hotkey to switch to the next fog mode."); refreshPresetHotkeyConfig = ((BaseUnityPlugin)this).Config.Bind<string>(text2, "Refresh Hotkey", "r", "Hotkey to refresh fog settings."); weatherScaleHotkeyConfig = ((BaseUnityPlugin)this).Config.Bind<string>(text2, "Weather Scale Hotkey", "c", "Hotkey to toggle weather scaling."); autoPresetModeHotkeyConfig = ((BaseUnityPlugin)this).Config.Bind<string>(text2, "Auto Sync Hotkey", "j", "Hotkey to toggle auto sync."); string text3 = "Fog Settings"; excludeShipFogDefault = ((BaseUnityPlugin)this).Config.Bind<bool>(text3, "Exclude Ship", true, "Enable or Disable fog settings to the Fog Exclusion Zone (eg. inside of ship)."); excludeShipFogEnabled = excludeShipFogDefault.Value; densityScaleEnabledDefault = ((BaseUnityPlugin)this).Config.Bind<bool>(text3, "Weather Scale Enabled Default", true, "Enable density scaling for moons and weather by default when booting game."); densityScaleEnabled = densityScaleEnabledDefault.Value; autoPresetModeEnabledDefault = ((BaseUnityPlugin)this).Config.Bind<bool>(text3, "Auto Preset/Mode Enabled", false, "Enable or disable auto preset/mode settings by default."); autoPresetModeEnabled = autoPresetModeEnabledDefault.Value; verboseLoggingDefault = ((BaseUnityPlugin)this).Config.Bind<bool>(text3, "Verbose Logging Enabled", false, "Enable or disable verbose logging for the mod. Can be used for debugging."); verboseLoggingEnabled = verboseLoggingDefault.Value; excludeEnemyFogDefault = ((BaseUnityPlugin)this).Config.Bind<bool>(text3, "Exclude Enemy Fog", true, "Exclude enemy fog when applying better fog settings."); excludeEnemyFogEnabled = excludeEnemyFogDefault.Value; IngameKeybinds.Instance.InitializeKeybindings(nextPresetHotkeyConfig.Value, nextModeHotkeyConfig.Value, refreshPresetHotkeyConfig.Value, weatherScaleHotkeyConfig.Value, settingsHotkeyConfig.Value, autoPresetModeHotkeyConfig.Value); string text4 = "Fog Presets"; presetCountConfig = ((BaseUnityPlugin)this).Config.Bind<int>(text4, "Number of Presets", 20, "Number of presets that can be created is equal to this value. Set this value, then start the game and close to refresh the config. Then enter your presets."); presetCountNum = presetCountConfig.Value; if (presetCountNum < 1) { presetCountNum = 1; } if (fogConfigPresets.Count > presetCountNum) { fogConfigPresets.RemoveRange(presetCountNum, fogConfigPresets.Count - presetCountNum); } else if (fogConfigPresets.Count < presetCountNum) { for (int i = fogConfigPresets.Count; i < presetCountNum; i++) { fogConfigPresets.Add(new FogConfigPreset("Preset " + (i + 1), 735f, 0.19f, 0.28f, 0.37f)); } } presetEntries = new ConfigEntry<string>[fogConfigPresets.Count]; for (int j = 0; j < fogConfigPresets.Count && j < presetCountNum + 1; j++) { FogConfigPreset fogConfigPreset = fogConfigPresets[j]; presetEntries[j] = ((BaseUnityPlugin)this).Config.Bind<string>(text4, "Preset " + j, fogConfigPreset.ToString(), "Preset " + fogConfigPreset.PresetName); string[] array = presetEntries[j].Value.Split(new char[1] { ',' }); string[] array2 = array; foreach (string text5 in array2) { string[] array3 = text5.Split(new char[1] { '=' }); if (array3.Length != 2) { continue; } string text6 = array3[0].Trim(); string text7 = array3[1].Trim(); switch (text6) { case "PresetName": fogConfigPresets[j].PresetName = text7; break; case "Density": { float num3 = float.Parse(text7, CultureInfo.InvariantCulture); if (num3 < 0f) { num3 = 0f; } else if (num3 > 1000f) { num3 = 1000f; } fogConfigPresets[j].MeanFreePath = num3; break; } case "Red Hue": { float num2 = float.Parse(text7, CultureInfo.InvariantCulture); if (num2 < 0f) { num2 = 0f; } else if (num2 > 3f) { num2 = 3f; } fogConfigPresets[j].AlbedoR = num2; break; } case "Green Hue": { float num4 = float.Parse(text7, CultureInfo.InvariantCulture); if (num4 < 0f) { num4 = 0f; } else if (num4 > 3f) { num4 = 3f; } fogConfigPresets[j].AlbedoG = num4; break; } case "Blue Hue": { float num = float.Parse(text7, CultureInfo.InvariantCulture); if (num < 0f) { num = 0f; } else if (num > 3f) { num = 3f; } fogConfigPresets[j].AlbedoB = num; break; } } } } if (verboseLoggingEnabled) { foreach (FogConfigPreset fogConfigPreset2 in fogConfigPresets) { mls.LogInfo((object)$"Preset '{fogConfigPreset2.PresetName}': Density={fogConfigPreset2.MeanFreePath}, AlbedoR={fogConfigPreset2.AlbedoR}, AlbedoG={fogConfigPreset2.AlbedoG}, AlbedoB={fogConfigPreset2.AlbedoB}"); } } string text8 = "Weather and Moon Density Scales"; moonScalesConfig = ((BaseUnityPlugin)this).Config.Bind<string>(text8, "MoonScales", "71 Gordion=1,41 Experimentation=0.95,220 Assurance=0.9,56 Vow=1.05,21 Offense=1,61 March=1.05,20 Adamance=1.05,85 Rend=1.25,7 Dine=1.25,8 Titan=1.165,68 Artifice=1.04,5 Embrion=1.04,44 Liquidation=1,Fallback=1", "Moon scales in the format {71 Gordion=1,41 Experimentation=0.998,220 Assurance=1,...}. When \"Fallback={number}\" is in the list, the density will default to \nthis value if no moon is detected."); moonScales = ParseMoonScales(moonScalesConfig.Value); weatherScalesConfig = ((BaseUnityPlugin)this).Config.Bind<string>(text8, "WeatherScales", "none=1,rainy=1.02,stormy=1.02,foggy=1.07,eclipsed=1.06,dust clouds=1.02,flooded=1.025,Fallback=1", "Weather scales in the format {none=1,rainy=1.01,stormy=1.02,...}. When \"Fallback={number}\" is in the list, the density will default to this value if no moon is detected."); weatherScales = ParseWeatherScales(weatherScalesConfig.Value); foreach (FogConfigPreset fogConfigPreset3 in fogConfigPresets) { foreach (MoonScale moonScale in moonScales) { foreach (WeatherScale weatherScale in weatherScales) { if (fogConfigPreset3.MeanFreePath * moonScale.Scale * weatherScale.Scale > 1000f) { mls.LogWarning((object)("Preset '" + fogConfigPreset3.PresetName + "' exceeds max density slider value with Moon '" + moonScale.MoonName + "' and Weather '" + weatherScale.WeatherName + "'. Decrease the scales or preset fog density to prevent a black screen...")); } } } } weatherScaleBlacklistConfig = ((BaseUnityPlugin)this).Config.Bind<string>(text8, "Weather Scaling Blacklist", "", "Enter weather names or moon names to trigger temporary disablement of fog WEATHER density scaling. This is only effective when WeatherScale is enabled. \nFull moon or weather names must be typed in, comma separated. Example: {eclipsed,20 Adamance,85 Rend}"); moonScaleBlacklistConfig = ((BaseUnityPlugin)this).Config.Bind<string>(text8, "Moon Scaling Blacklist", "", "Enter weather names or moon names to trigger temporary disablement of MOON fog density scaling. This is only effective when WeatherScale is enabled. \nFull moon or weather names must be typed in, comma separated. Example: {eclipsed,20 Adamance,85 Rend}"); weatherScaleBlacklist = ParseDensityScaleBlacklist(weatherScaleBlacklistConfig.Value); moonScaleBlacklist = ParseDensityScaleBlacklist(moonScaleBlacklistConfig.Value); string text9 = "Auto Sync Preset/Mode Settings"; autoPresetModeConfig = ((BaseUnityPlugin)this).Config.Bind<string>(text9, "Auto Sync Preset/Mode Settings", "85 Rend&eclipsed=Thick Red,7 Dine&Eclipsed=Thick Red,8 Titan&eclipsed=Thick Red,eclipsed=Red Fog,All=Default", "Automatically apply presets and modes to moons and weathers. On the left of = enter \na moon and/or weather name, and on the right enter a single preset or mode name. Entering a preset name on the right automatically sets the mode to \"Better Fog\". \nTo have a condition that requires both a moon and weather, enter \"&\" in between entries. This will override single entries if both moon and weather are present. \nIf a preset name is the same as a mode name, the mode will be set to \"Better Fog\" and that preset will be set. \nWarning: If you create different conditions that conflict (such as none=mist,68 Artifice=No Fog and you land on Art with no weather), the leftmost condition will apply. \nFor that reason, put double conditions with the most specific condition first, and single condition last. Keyword \"All\" Matches all moons and whethers. Use this last as \na fallback value in case no matches are found. Example: 61 March=Light Fog,7 Dine&eclipsed=Orange Fog,7 Dine=Heavy Fog,eclipsed=Red Fog,8 Titan=Heavy Fog,none=Mist,none&8 Titan=No Fog,All=Default"); autoPresetModes = ParseAutoPresetMode(autoPresetModeConfig.Value); string text10 = "Special Effects Modes"; discoSequenceConfig = ((BaseUnityPlugin)this).Config.Bind<string>(text10, "Disco Sequence", "Red Fog=500,Orange Fog=500,Yellow Fog=500,Green Fog=500,Blue Fog=500,Purple Fog=500,Pink Fog=500", "Sequence of colors to cycle through for the Disco mode. List is using structure {Preset Name}={Delay (ms)}"); gradientSequenceConfig = ((BaseUnityPlugin)this).Config.Bind<string>(text10, "Gradient Sequence", "Default=2000,Light Fog=750", "Sequence of colors to cycle through for the Gradient mode. List is using structure {Preset Name}={Delay (ms)}"); discoDropdownDataList = ParseSequenceConfig(discoSequenceConfig.Value); gradientDropdownDataList = ParseSequenceConfig(gradientSequenceConfig.Value); mls.LogInfo((object)"Finished parsing config entries"); if (defaultPresetName == null) { currentPreset = fogConfigPresets[0]; currentPresetIndex = 0; mls.LogInfo((object)("Default preset not found. Using the first preset in the list: " + currentPreset.PresetName)); } else { try { currentPreset = fogConfigPresets.Find((FogConfigPreset preset) => preset.PresetName == defaultPresetName.Value); currentPresetIndex = fogConfigPresets.IndexOf(currentPreset); mls.LogInfo((object)("Default preset found: " + currentPreset.PresetName)); } catch (Exception arg) { mls.LogError((object)$"Failed to find the default preset: {arg}"); currentPreset = fogConfigPresets[0]; currentPresetIndex = 0; } } if (defaultMode == null) { currentMode = fogModes[0]; currentModeIndex = 0; } else { try { currentMode = fogModes.Find((BetterFogMode mode) => mode.Name == defaultMode.Value); currentModeIndex = fogModes.IndexOf(currentMode); mls.LogInfo((object)("Default mode found: " + currentMode.Name)); UpdateMode(); } catch (Exception arg2) { mls.LogError((object)$"Failed to find the default mode: {arg2}"); currentMode = fogModes[0]; currentModeIndex = 0; } } try { harmony.Patch((MethodBase)AccessTools.Method(typeof(StartOfRound), "ChangeLevel", (Type[])null, (Type[])null), (HarmonyMethod)null, new HarmonyMethod(typeof(StartOfRoundPatch), "ChangeLevelPatch", (Type[])null), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null); harmony.Patch((MethodBase)AccessTools.Method(typeof(StartOfRound), "SetPlanetsWeather", (Type[])null, (Type[])null), (HarmonyMethod)null, new HarmonyMethod(typeof(StartOfRoundPatch), "SetPlanetsWeatherPatch", (Type[])null), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null); harmony.Patch((MethodBase)AccessTools.Method(typeof(Terminal), "BeginUsingTerminal", (Type[])null, (Type[])null), (HarmonyMethod)null, new HarmonyMethod(typeof(TerminalPatch), "BeginUsingTerminalPatch", (Type[])null), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null); harmony.Patch((MethodBase)AccessTools.Method(typeof(Terminal), "QuitTerminal", (Type[])null, (Type[])null), (HarmonyMethod)null, new HarmonyMethod(typeof(TerminalPatch), "QuitTerminalPatch", (Type[])null), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null); harmony.Patch((MethodBase)AccessTools.Method(typeof(Terminal), "Start", (Type[])null, (Type[])null), (HarmonyMethod)null, new HarmonyMethod(typeof(TerminalPatch), "StartPatch", (Type[])null), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null); harmony.Patch((MethodBase)AccessTools.Method(typeof(QuickMenuManager), "OpenQuickMenu", (Type[])null, (Type[])null), (HarmonyMethod)null, new HarmonyMethod(typeof(QuickMenuManagerPatch), "OpenQuickMenuPatch", (Type[])null), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null); harmony.Patch((MethodBase)AccessTools.Method(typeof(QuickMenuManager), "CloseQuickMenu", (Type[])null, (Type[])null), (HarmonyMethod)null, new HarmonyMethod(typeof(QuickMenuManagerPatch), "CloseQuickMenuPatch", (Type[])null), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null); harmony.Patch((MethodBase)AccessTools.Method(typeof(HUDManager), "EnableChat_performed", (Type[])null, (Type[])null), (HarmonyMethod)null, new HarmonyMethod(typeof(HUDManagerPatch), "EnableChat_performedPatch", (Type[])null), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null); harmony.Patch((MethodBase)AccessTools.Method(typeof(HUDManager), "SubmitChat_performed", (Type[])null, (Type[])null), (HarmonyMethod)null, new HarmonyMethod(typeof(HUDManagerPatch), "SubmitChat_performedPatch", (Type[])null), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null); harmony.Patch((MethodBase)AccessTools.Method(typeof(HUDManager), "OpenMenu_performed", (Type[])null, (Type[])null), (HarmonyMethod)null, new HarmonyMethod(typeof(HUDManagerPatch), "OpenMenu_performedPatch", (Type[])null), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null); harmony.Patch((MethodBase)AccessTools.Method(typeof(LocalVolumetricFog), "OnEnable", (Type[])null, (Type[])null), (HarmonyMethod)null, new HarmonyMethod(typeof(LocalVolumetricFogPatch), "OnEnablePatch", (Type[])null), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null); harmony.Patch((MethodBase)AccessTools.Method(typeof(SceneManager), "LoadScene", new Type[2] { typeof(string), typeof(LoadSceneParameters) }, (Type[])null), (HarmonyMethod)null, new HarmonyMethod(typeof(SceneManagerPatch), "LoadScenePatch", (Type[])null), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null); mls.LogInfo((object)"BetterFog patches applied successfully!"); } catch (Exception arg3) { mls.LogError((object)$"Failed to apply Harmony patches: {arg3}"); throw; } if (settingsHotkeyEnabled) { if ((Object)(object)FogSettingsManager.Instance != (Object)null) { if (verboseLoggingEnabled) { mls.LogInfo((object)"FogSettingsManager instance is valid."); } } else if (verboseLoggingEnabled) { mls.LogError((object)"FogSettingsManager instance is null."); } } else if (verboseLoggingEnabled) { mls.LogInfo((object)"Settings hotkey is disabled. Settings GUI will not be instantiated"); } } public static void ApplyFogSettings(bool activateAutoPresetMode) { if (verboseLoggingEnabled) { mls.LogInfo((object)$"autoPresetModeEnabled: {autoPresetModeEnabled}"); mls.LogInfo((object)$"activateAutoPresetMode: {activateAutoPresetMode}"); } if (fogRefreshLock && !autoPresetModeEnabled) { if (verboseLoggingEnabled) { mls.LogWarning((object)"Fog settings refresh is locked. Skipping fog settings application."); } return; } if (activateAutoPresetMode) { matchedPreset = null; foreach (AutoPresetMode autoPresetMode in autoPresetModes) { if (verboseLoggingEnabled) { mls.LogInfo((object)("Checking Conditions: " + string.Join(", ", autoPresetMode.Conditions) + " against Current weather: " + currentWeatherType + ", Current moon: " + currentLevel)); } if (autoPresetMode.Conditions.All((string condition) => condition.Equals(currentLevel) || condition.Equals(currentWeatherType) || condition.Equals("all"))) { if (verboseLoggingEnabled) { mls.LogInfo((object)("Preset match found between Conditions: " + string.Join(", ", autoPresetMode.Conditions) + " and Current Moon: " + currentLevel + ", Current Weather: " + currentWeatherType)); mls.LogInfo((object)("Effect to apply: " + autoPresetMode.Effect)); } matchedPreset = autoPresetMode; break; } } if (matchedPreset != null) { autoPresetModeMatchFound = true; string effect = matchedPreset.Effect; FogConfigPreset fogConfigPreset = fogConfigPresets.FirstOrDefault((FogConfigPreset p) => p.PresetName.ToLower() == effect); if (fogConfigPreset != null) { currentMode = fogModes.FirstOrDefault((BetterFogMode m) => m.Name == "Better Fog"); currentModeIndex = fogModes.IndexOf(currentMode); currentPreset = fogConfigPreset; currentPresetIndex = fogConfigPresets.IndexOf(currentPreset); Instance.UpdateMode(); if (settingsHotkeyEnabled && isFogSettingsActive) { FogSettingsManager.Instance.UpdateSettings(); } if (verboseLoggingEnabled) { mls.LogInfo((object)$"Preset applied: {currentPreset}, Mode set to {currentMode.Name}"); } } else { BetterFogMode betterFogMode = fogModes.FirstOrDefault((BetterFogMode m) => m.Name.ToLower() == effect); if (betterFogMode != null) { currentMode = betterFogMode; currentModeIndex = fogModes.IndexOf(currentMode); Instance.UpdateMode(); if (settingsHotkeyEnabled && isFogSettingsActive) { FogSettingsManager.Instance.UpdateSettings(); } if (verboseLoggingEnabled) { mls.LogInfo((object)("Mode set to " + currentMode.Name)); } } } } else { autoPresetModeMatchFound = false; } } UpdateLockInteractionSettings(); SetWeatherScale(); List<LocalVolumetricFog> list = Resources.FindObjectsOfTypeAll<LocalVolumetricFog>().ToList(); foreach (LocalVolumetricFog item in list) { ProcessFogObject(item); } } private static void ProcessFogObject(LocalVolumetricFog fogObject) { //IL_0125: Unknown result type (might be due to invalid IL or missing references) //IL_012a: Unknown result type (might be due to invalid IL or missing references) //IL_015a: Unknown result type (might be due to invalid IL or missing references) //IL_0169: Unknown result type (might be due to invalid IL or missing references) //IL_0178: Unknown result type (might be due to invalid IL or missing references) int num = LayerMask.NameToLayer("Enemies"); if ((Object)(object)fogObject != (Object)null && (!(((Object)fogObject).name == "FogExclusionZone") || !excludeShipFogEnabled) && (((Component)fogObject).gameObject.layer != num || !excludeEnemyFogEnabled) && !(currentMode.Name == "Vanilla")) { if (currentMode.Name != "Gradient") { ApplyFogParameters(fogObject, currentPreset); } else { ApplyFogParameters(fogObject, tempColorPreset); } } else if (currentMode.Name == "Vanilla" || ((Object)(object)fogObject != (Object)null && (!(((Object)fogObject).name == "FogExclusionZone") || !excludeShipFogEnabled) && ((Component)fogObject).gameObject.layer == num && excludeEnemyFogEnabled && !(currentMode.Name == "Vanilla"))) { ResetFogToVanilla(((Component)fogObject).gameObject); } if (verboseLoggingEnabled) { Color albedo = fogObject.parameters.albedo; mls.LogInfo((object)$"Found LocalVolumetricFog object: {((Object)fogObject).name}, MeanFreePath: {fogObject.parameters.meanFreePath}, AlbedoR: {albedo.r}, AlbedoG: {albedo.g}, AlbedoB: {albedo.b}"); } } private static void ApplyFogParameters(LocalVolumetricFog fogObject, FogConfigPreset targetPreset) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_0125: Unknown result type (might be due to invalid IL or missing references) //IL_012a: Unknown result type (might be due to invalid IL or missing references) //IL_0130: Unknown result type (might be due to invalid IL or missing references) //IL_0131: Unknown result type (might be due to invalid IL or missing references) LocalVolumetricFogArtistParameters parameters = fogObject.parameters; if (targetPreset.MeanFreePath * combinedDensityScale > 1000f) { parameters.meanFreePath = 0f; } else { parameters.meanFreePath = 0.262f * (1000f - targetPreset.MeanFreePath * combinedDensityScale); } if (targetPreset.AlbedoR > 3f) { targetPreset.AlbedoR = 3f; } else if (targetPreset.AlbedoR < 0f) { targetPreset.AlbedoR = 0f; } if (targetPreset.AlbedoG > 3f) { targetPreset.AlbedoG = 3f; } else if (targetPreset.AlbedoG < 0f) { targetPreset.AlbedoG = 0f; } if (targetPreset.AlbedoB > 3f) { targetPreset.AlbedoB = 3f; } else if (targetPreset.AlbedoB < 0f) { targetPreset.AlbedoB = 0f; } parameters.albedo = new Color(targetPreset.AlbedoR, targetPreset.AlbedoG, targetPreset.AlbedoB, 1f); fogObject.parameters = parameters; } private static void SetWeatherScale() { moonDensityScale = 1f; weatherDensityScale = 1f; if (densityScaleEnabled) { if (!moonScaleBlacklist.Contains(currentLevel) && !moonScaleBlacklist.Contains(currentWeatherType)) { foreach (MoonScale moonScale in moonScales) { if (currentLevel == moonScale.MoonName) { moonDensityScale = moonScale.Scale; if (verboseLoggingEnabled) { mls.LogInfo((object)(currentLevel + " moon detected. Set moon density scale to " + moonDensityScale)); } break; } if (moonScale.MoonName == "Fallback") { moonDensityScale = moonScale.Scale; if (verboseLoggingEnabled) { mls.LogInfo((object)("Fallback moon scale detected. Set moon density scale to " + moonDensityScale)); } } if (moonScale.MoonName == moonScales[moonScales.Count - 1].MoonName && verboseLoggingEnabled) { mls.LogWarning((object)$"{currentLevel} moon not found in records. Using moon scale of {moonDensityScale}."); } } } else { mls.LogInfo((object)"Blacklisted moon or weather detected. Setting moon density scale to 1."); } if (!weatherScaleBlacklist.Contains(currentLevel) && !weatherScaleBlacklist.Contains(currentWeatherType)) { foreach (WeatherScale weatherScale in weatherScales) { if (currentWeatherType == weatherScale.WeatherName) { weatherDensityScale = weatherScale.Scale; if (verboseLoggingEnabled) { mls.LogInfo((object)(currentWeatherType + " weather type detected. Set weather density scale to " + weatherDensityScale)); } break; } if (weatherScale.WeatherName == "Fallback") { weatherDensityScale = weatherScale.Scale; if (verboseLoggingEnabled) { mls.LogInfo((object)("Fallback weather scale detected. Set weather density scale to " + weatherDensityScale)); } } if (weatherScale.WeatherName == weatherScales[weatherScales.Count - 1].WeatherName && verboseLoggingEnabled) { mls.LogWarning((object)$"{currentWeatherType} weather type not found in records. Using scale of {weatherDensityScale}."); } } } else if (verboseLoggingEnabled) { mls.LogInfo((object)"Blacklisted moon or weather detected. Setting weather density scale to 1."); } } combinedDensityScale = moonDensityScale * weatherDensityScale; if (verboseLoggingEnabled) { mls.LogInfo((object)$"Final density scale applied: {moonDensityScale} * {weatherDensityScale} = {combinedDensityScale}"); mls.LogInfo((object)$"Preset original MeanFreePath: {currentPreset.MeanFreePath}"); mls.LogInfo((object)$"Scaled MeanFreePath: 0.262 * ({1000f} - {currentPreset.MeanFreePath * combinedDensityScale}) = {0.262f * (1000f - currentPreset.MeanFreePath * combinedDensityScale)}"); if (currentPreset.MeanFreePath * combinedDensityScale > 1000f) { mls.LogWarning((object)$"MeanFreePath value exceeded max Density SliderValue. Setting density to {1000f}"); } } } public static void ApplyFogSettingsOnGameStart() { applyingFogSettings = true; if ((Object)(object)GameNetworkManager.Instance != (Object)null && GameNetworkManager.Instance.gameHasStarted) { mls.LogInfo((object)"Game has already started. Applying fog settings immediately."); ((MonoBehaviour)Instance).StartCoroutine(ApplyFogSettingsRepeated(8)); applyingFogSettings = false; } else { ((MonoBehaviour)Instance).StartCoroutine(WaitForGameStartAndApplyFog()); } } [IteratorStateMachine(typeof(<WaitForGameStartAndApplyFog>d__88))] private static IEnumerator WaitForGameStartAndApplyFog() { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new <WaitForGameStartAndApplyFog>d__88(0); } [IteratorStateMachine(typeof(<ApplyFogSettingsRepeated>d__89))] private static IEnumerator ApplyFogSettingsRepeated(int repeatCount) { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new <ApplyFogSettingsRepeated>d__89(0) { repeatCount = repeatCount }; } public static void NextPreset() { if (lockPresetDropdownModification) { mls.LogWarning((object)"Cannot switch presets when preset interaction is disabled."); return; } currentPresetIndex = fogConfigPresets.IndexOf(currentPreset); if (currentPresetIndex == fogConfigPresets.Count - 1) { currentPresetIndex = -1; } currentPresetIndex++; currentPreset = fogConfigPresets[currentPresetIndex]; mls.LogInfo((object)("Switched to preset: " + currentPreset.PresetName)); ApplyFogSettings(activateAutoPresetMode: false); if (isFogSettingsActive) { FogSettingsManager.Instance.UpdateSettings(); } } public static void NextMode() { if (lockModeDropdownModification) { mls.LogWarning((object)"Cannot switch modes when mode interaction is disabled."); return; } currentModeIndex = fogModes.IndexOf(currentMode); if (currentModeIndex == fogModes.Count - 1) { currentModeIndex = -1; } currentModeIndex++; currentMode = fogModes[currentModeIndex]; mls.LogInfo((object)("Switched to next mode: " + currentMode.Name)); Instance.UpdateMode(); if (settingsHotkeyEnabled && (currentMode.Name == "No Fog" || currentMode.Name == "Vanilla") && autoPresetModeMatchFound) { lockPresetDropdownModification = true; lockPresetValueModification = true; } else if (settingsHotkeyEnabled) { lockPresetDropdownModification = false; } if (isFogSettingsActive) { FogSettingsManager.Instance.UpdateSettings(); FogSettingsManager.Instance.LockPresetDropdownInteract(lockPresetDropdownModification); FogSettingsManager.Instance.LockPresetButtonInteract(lockPresetValueModification); FogSettingsManager.Instance.LockPresetValueInteract(lockPresetValueModification); } ApplyFogSettings(activateAutoPresetMode: false); } public void UpdateMode() { ((MonoBehaviour)this).StopAllCoroutines(); restartLoop = true; isLoopRunning = false; if (currentMode.Name == "No Fog") { mls.LogInfo((object)"No Fog mode selected."); EnableFogDisablePatch(); fogRefreshLock = true; return; } fogRefreshLock = false; DisableFogPatch(); if (currentMode.Name == "Vanilla") { mls.LogInfo((object)"Vanilla mode selected."); DisableNonVanillaPatches(); return; } EnableNonVanillaPatches(); if (currentMode.Name == "Disco" && !isLoopRunning) { ((MonoBehaviour)this).StartCoroutine(DiscoLoop()); } else if (currentMode.Name == "Gradient" && !isLoopRunning) { ((MonoBehaviour)this).StartCoroutine(GradientLoop()); } } private List<DropdownRowData> ParseSequenceConfig(string configString) { List<DropdownRowData> list = new List<DropdownRowData>(); string[] array = configString.Split(new char[1] { ',' }); string[] array2 = array; foreach (string text in array2) { string[] array3 = text.Split(new char[1] { '=' }); if (array3.Length == 2 && int.TryParse(array3[1], out var result)) { list.Add(new DropdownRowData(array3[0], result)); } } if (list.Count < 1) { while (list.Count < 1) { list.Add(new DropdownRowData(defaultPresetName.Value, 2000)); } } else { while (list.Count > 12) { list.RemoveAt(list.Count - 1); } } return list; } private List<WeatherScale> ParseWeatherScales(string configString) { List<WeatherScale> list = new List<WeatherScale>(); string[] array = configString.Split(new char[1] { ',' }); string[] array2 = array; foreach (string text in array2) { string[] array3 = text.Split(new char[1] { '=' }); if (array3.Length == 2 && float.TryParse(array3[1], out var result)) { string weatherName = Regex.Replace(array3[0].TrimStart(Array.Empty<char>()), "^[\\d\\s]+", "").ToLower(); list.Add(new WeatherScale(weatherName, result)); } } return list; } private List<MoonScale> ParseMoonScales(string configString) { List<MoonScale> list = new List<MoonScale>(); string[] array = configString.Split(new char[1] { ',' }); string[] array2 = array; foreach (string text in array2) { string[] array3 = text.Split(new char[1] { '=' }); if (array3.Length == 2 && float.TryParse(array3[1], out var result)) { if (result < 0f) { result = 0f; } string moonName = Regex.Replace(array3[0].TrimStart(Array.Empty<char>()), "^[\\d\\s]+", "").ToLower(); list.Add(new MoonScale(moonName, result)); } } return list; } private List<string> ParseDensityScaleBlacklist(string configString) { List<string> list = new List<string>(); string[] array = configString.Split(new char[1] { ',' }); string[] array2 = array; foreach (string input in array2) { string item = Regex.Replace(input, "^[\\d\\s]+", "").ToLower(); list.Add(item); } return list; } private List<AutoPresetMode> ParseAutoPresetMode(string configString) { List<AutoPresetMode> list = new List<AutoPresetMode>(); string[] array = configString.Split(new char[1] { ',' }); string[] array2 = array; foreach (string text in array2) { string[] array3 = text.Split(new char[1] { '=' }); if (array3.Length == 2) { list.Add(new AutoPresetMode(array3[0].ToLower(), array3[1].ToLower())); } } return list; } public void EnableFogDisablePatch() { //IL_012b: Unknown result type (might be due to invalid IL or missing references) //IL_0139: Expected O, but got Unknown MethodInfo methodInfo = AccessTools.Method(typeof(Fog), "UpdateShaderVariablesGlobalCBFogParameters", (Type[])null, (Type[])null); Patches patchInfo = Harmony.GetPatchInfo((MethodBase)methodInfo); try { if (patchInfo == null) { if (verboseLoggingEnabled) { mls.LogInfo((object)"Fog disable patch is not active. Patching."); } } else { if (verboseLoggingEnabled) { mls.LogInfo((object)"A fog disable patch list is active. Checking for BetterFog patches."); } if (patchInfo.Prefixes.Any((Patch prefix) => prefix.owner == "ironthumb.BetterFog")) { if (verboseLoggingEnabled) { mls.LogInfo((object)"BetterFog patches are already active. Skipping patching."); } return; } if (verboseLoggingEnabled) { mls.LogInfo((object)"No BetterFog patches detected. Proceeding with patching."); } } } catch (Exception arg) { if (verboseLoggingEnabled) { mls.LogError((object)$"There was an issue in detecting disable fog patch. Skipping patching. {arg}"); } return; } harmony.Patch((MethodBase)AccessTools.Method(typeof(Fog), "UpdateShaderVariablesGlobalCBFogParameters", (Type[])null, (Type[])null), new HarmonyMethod(typeof(FogPatch), "Prefix", (Type[])null), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null); if (verboseLoggingEnabled) { mls.LogInfo((object)"Fog disable patch applied successfully."); } } public void DisableFogPatch() { MethodInfo methodInfo = AccessTools.Method(typeof(Fog), "UpdateShaderVariablesGlobalCBFogParameters", (Type[])null, (Type[])null); Patches patchInfo = Harmony.GetPatchInfo((MethodBase)methodInfo); try { if (patchInfo == null) { if (verboseLoggingEnabled) { mls.LogInfo((object)"Fog disable patch is not active. Skipping unpatching."); } return; } if (verboseLoggingEnabled) { mls.LogInfo((object)"A fog disable patch list is active. Checking for BetterFog patches."); } if (!patchInfo.Prefixes.Any((Patch prefix) => prefix.owner == "ironthumb.BetterFog")) { if (verboseLoggingEnabled) { mls.LogInfo((object)"No BetterFog patches detected. Skipping unpatching."); } return; } if (verboseLoggingEnabled) { mls.LogInfo((object)"BetterFog patches detected. Proceeding with unpatching."); } } catch (Exception arg) { if (verboseLoggingEnabled) { mls.LogError((object)$"There was an issue in detecting disable fog patch. Skipping patching. {arg}"); } return; } harmony.Unpatch((MethodBase)methodInfo, (HarmonyPatchType)0, "ironthumb.BetterFog"); if (verboseLoggingEnabled) { mls.LogInfo((object)"Fog disable patch unpatched successfully."); } } public void EnableNonVanillaPatches() { //IL_012e: Unknown result type (might be due to invalid IL or missing references) //IL_013c: Expected O, but got Unknown //IL_0169: Unknown result type (might be due to invalid IL or missing references) //IL_0177: Expected O, but got Unknown //IL_01a4: Unknown result type (might be due to invalid IL or missing references) //IL_01b2: Expected O, but got Unknown //IL_01df: Unknown result type (might be due to invalid IL or missing references) //IL_01ed: Expected O, but got Unknown //IL_021a: Unknown result type (might be due to invalid IL or missing references) //IL_0228: Expected O, but got Unknown //IL_0256: Unknown result type (might be due to invalid IL or missing references) //IL_0263: Expected O, but got Unknown //IL_0291: Unknown result type (might be due to invalid IL or missing references) //IL_029e: Expected O, but got Unknown //IL_02cc: Unknown result type (might be due to invalid IL or missing references) //IL_02d9: Expected O, but got Unknown //IL_0307: Unknown result type (might be due to invalid IL or missing references) //IL_0314: Expected O, but got Unknown MethodInfo methodInfo = AccessTools.Method(typeof(AudioReverbTrigger), "changeVolume", (Type[])null, (Type[])null); Patches patchInfo = Harmony.GetPatchInfo((MethodBase)methodInfo); try { if (patchInfo == null) { if (verboseLoggingEnabled) { mls.LogInfo((object)"Non-vanilla patch is not active. Patching."); } } else { if (verboseLoggingEnabled) { mls.LogInfo((object)"A non-vanilla patch list is active. Checking for BetterFog patches."); } if (patchInfo.Prefixes.Any((Patch prefix) => prefix.owner == "ironthumb.BetterFog")) { if (verboseLoggingEnabled) { mls.LogInfo((object)"BetterFog patches are already active. Skipping patching."); } return; } if (verboseLoggingEnabled) { mls.LogInfo((object)"No BetterFog patches detected. Proceeding with patching."); } } } catch (Exception arg) { if (verboseLoggingEnabled) { mls.LogError((object)$"There was an issue in detecting non-vanilla patch. Skipping patching. {arg}"); } return; } harmony.Patch((MethodBase)AccessTools.Method(typeof(AudioReverbTrigger), "changeVolume", (Type[])null, (Type[])null), new HarmonyMethod(typeof(AudioReverbTriggerPatch), "changeVolumePrefix", (Type[])null), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null); harmony.Patch((MethodBase)AccessTools.Method(typeof(TimeOfDay), "SetWeatherBasedOnVariables", (Type[])null, (Type[])null), new HarmonyMethod(typeof(TimeOfDayPatch), "SetWeatherBasedOnVariablesPatch", (Type[])null), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null); harmony.Patch((MethodBase)AccessTools.Method(typeof(ToggleFogTrigger), "Update", (Type[])null, (Type[])null), new HarmonyMethod(typeof(ToggleFogTriggerPatch), "UpdatePatch", (Type[])null), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null); harmony.Patch((MethodBase)AccessTools.Method(typeof(ToggleFogTrigger), "OnTriggerEnter", (Type[])null, (Type[])null), new HarmonyMethod(typeof(ToggleFogTriggerPatch), "OnTriggerEnterPatch", (Type[])null), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null); harmony.Patch((MethodBase)AccessTools.Method(typeof(ToggleFogTrigger), "OnTriggerExit", (Type[])null, (Type[])null), new HarmonyMethod(typeof(ToggleFogTriggerPatch), "OnTriggerExitPatch", (Type[])null), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null); harmony.Patch((MethodBase)AccessTools.Method(typeof(EntranceTeleport), "TeleportPlayer", (Type[])null, (Type[])null), (HarmonyMethod)null, new HarmonyMethod(typeof(EntranceTeleportPatch), "TeleportPlayerPatch", (Type[])null), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null); harmony.Patch((MethodBase)AccessTools.Method(typeof(PlayerControllerB), "TeleportPlayer", (Type[])null, (Type[])null), (HarmonyMethod)null, new HarmonyMethod(typeof(PlayerControllerBPatch), "TeleportPlayerPatch", (Type[])null), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null); harmony.Patch((MethodBase)AccessTools.Method(typeof(PlayerControllerB), "SpectateNextPlayer", (Type[])null, (Type[])null), (HarmonyMethod)null, new HarmonyMethod(typeof(PlayerControllerBPatch), "SpectateNextPlayerPatch", (Type[])null), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null); harmony.Patch((MethodBase)AccessTools.Method(typeof(NetworkSceneManager), "OnSceneLoaded", (Type[])null, (Type[])null), (HarmonyMethod)null, new HarmonyMethod(typeof(NetworkSceneManagerPatch), "OnSceneLoadedPatch", (Type[])null), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null); if (verboseLoggingEnabled) { mls.LogInfo((object)"Non-Vanilla patches enabled successfully!"); } } public void DisableNonVanillaPatches() { MethodInfo methodInfo = AccessTools.Method(typeof(AudioReverbTrigger), "changeVolume", (Type[])null, (Type[])null); Patches patchInfo = Harmony.GetPatchInfo((MethodBase)methodInfo); try { if (patchInfo == null) { if (verboseLoggingEnabled) { mls.LogInfo((object)"Non-vanilla patch is not active. Skipping unpatching."); } return; } if (verboseLoggingEnabled) { mls.LogInfo((object)"A non-vanilla patch list is active. Checking for BetterFog patches."); } if (!patchInfo.Prefixes.Any((Patch prefix) => prefix.owner == "ironthumb.BetterFog")) { if (verboseLoggingEnabled) { mls.LogInfo((object)"No BetterFog patches detected. Skipping unpatching."); } return; } if (verboseLoggingEnabled) { mls.LogInfo((object)"BetterFog patches detected. Proceeding with unpatching."); } } catch (Exception arg) { if (verboseLoggingEnabled) { mls.LogError((object)$"There was an issue in detecting non-vanilla patch. Skipping patching. {arg}"); } return; } harmony.Unpatch((MethodBase)methodInfo, (HarmonyPatchType)0, "ironthumb.BetterFog"); methodInfo = AccessTools.Method(typeof(TimeOfDay), "SetWeatherBasedOnVariables", (Type[])null, (Type[])null); harmony.Unpatch((MethodBase)methodInfo, (HarmonyPatchType)0, "ironthumb.BetterFog"); methodInfo = AccessTools.Method(typeof(ToggleFogTrigger), "Update", (Type[])null, (Type[])null); harmony.Unpatch((MethodBase)methodInfo, (HarmonyPatchType)0, "ironthumb.BetterFog"); methodInfo = AccessTools.Method(typeof(ToggleFogTrigger), "OnTriggerEnter", (Type[])null, (Type[])null); harmony.Unpatch((MethodBase)methodInfo, (HarmonyPatchType)0, "ironthumb.BetterFog"); methodInfo = AccessTools.Method(typeof(ToggleFogTrigger), "OnTriggerExit", (Type[])null, (Type[])null); harmony.Unpatch((MethodBase)methodInfo, (HarmonyPatchType)0, "ironthumb.BetterFog"); methodInfo = AccessTools.Method(typeof(EntranceTeleport), "TeleportPlayer", (Type[])null, (Type[])null); harmony.Unpatch((MethodBase)methodInfo, (HarmonyPatchType)0, "ironthumb.BetterFog"); methodInfo = AccessTools.Method(typeof(PlayerControllerB), "TeleportPlayer", (Type[])null, (Type[])null); harmony.Unpatch((MethodBase)methodInfo, (HarmonyPatchType)0, "ironthumb.BetterFog"); methodInfo = AccessTools.Method(typeof(PlayerControllerB), "SpectateNextPlayer", (Type[])null, (Type[])null); harmony.Unpatch((MethodBase)methodInfo, (HarmonyPatchType)0, "ironthumb.BetterFog"); methodInfo = AccessTools.Method(typeof(NetworkSceneManager), "OnSceneLoaded", (Type[])null, (Type[])null); harmony.Unpatch((MethodBase)methodInfo, (HarmonyPatchType)0, "ironthumb.BetterFog"); if (verboseLoggingEnabled) { mls.LogInfo((object)"Non-Vanilla patches disabled successfully!"); } } public static void CollectVanillaValues() { //IL_0023: 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_002f: 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_006f: Unknown result type (might be due to invalid IL or missing references) //IL_007e: Unknown result type (might be due to invalid IL or missing references) //IL_008d: Unknown result type (might be due to invalid IL or missing references) //IL_00ca: Unknown result type (might be due to invalid IL or missing references) List<LocalVolumetricFog> list = Resources.FindObjectsOfTypeAll<LocalVolumetricFog>().ToList(); foreach (LocalVolumetricFog item in list) { LocalVolumetricFogArtistParameters parameters = item.parameters; Color albedo = item.parameters.albedo; if (verboseLoggingEnabled) { mls.LogInfo((object)$"Found LocalVolumetricFog object: {((Object)item).name}, MeanFreePath: {item.parameters.meanFreePath}, AlbedoR: {albedo.r}, AlbedoG: {albedo.g}, AlbedoB: {albedo.b}"); } if (!fogParameterChanges.ContainsKey(((Component)item).gameObject)) { fogParameterChanges[((Component)item).gameObject] = parameters; if (verboseLoggingEnabled) { mls.LogInfo((object)("Captured vanilla fog parameters for " + ((Object)((Component)item).gameObject).name)); } } } } public static void ResetFogToVanilla(GameObject fogObject) { //IL_0027: 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) if (fogParameterChanges.TryGetValue(fogObject, out var value)) { LocalVolumetricFog component = fogObject.GetComponent<LocalVolumetricFog>(); if ((Object)(object)component != (Object)null) { component.parameters = value; } } } public void WaitToApplySettings(float seconds) { ((MonoBehaviour)this).StartCoroutine(DelayAndApplySettings(seconds)); } [IteratorStateMachine(typeof(<DelayAndApplySettings>d__105))] private IEnumerator DelayAndApplySettings(float seconds) { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new <DelayAndApplySettings>d__105(0) { <>4__this = this, seconds = seconds }; } public PlayerControllerB FindLocalPlayer(ulong localClientId) { PlayerControllerB[] array = Object.FindObjectsOfType<PlayerControllerB>(); PlayerControllerB[] array2 = array; foreach (PlayerControllerB val in array2) { if (val.actualClientId == localClientId) { if (verboseLoggingEnabled) { mls.LogInfo((object)("Local player found: " + ((Object)val).name)); } return val; } } mls.LogError((object)"Local player not found!"); return null; } public static void ToggleAutoPresetMode() { autoPresetModeEnabled = !autoPresetModeEnabled; if (autoPresetModeEnabled) { mls.LogInfo((object)"Auto Preset/Mode enabled."); ApplyFogSettings(activateAutoPresetMode: true); } else { mls.LogInfo((object)"Auto Preset/Mode disabled."); ApplyFogSettings(activateAutoPresetMode: false); } if (isFogSettingsActive) { FogSettingsManager.Instance.UpdateSettings(); } } public static void ToggleWeatherScaling() { if (lockPresetDropdownModification) { mls.LogWarning((object)"Cannot toggle weather when preset interaction is disabled."); return; } densityScaleEnabled = !densityScaleEnabled; ApplyFogSettings(activateAutoPresetMode: false); if (isFogSettingsActive) { FogSettingsManager.Instance.UpdateSettings(); } } public static void UpdateLockInteractionSettings() { if (autoPresetModeMatchFound & autoPresetModeEnabled) { if (verboseLoggingEnabled) { mls.LogInfo((object)("AutoPresetMode Match Found: " + matchedPreset.Effect)); } lockModeDropdownModification = true; lockPresetDropdownModification = true; lockPresetValueModification = currentMode.Name == "No Fog" || currentMode.Name == "Vanilla"; lockDensityScaleModification = lockPresetValueModification; } else if (currentMode.Name == "No Fog" || currentMode.Name == "Vanilla") { if (verboseLoggingEnabled) { mls.LogInfo((object)("AutoPresetMode Match Not Found. Mode: " + currentMode.Name)); } lockModeDropdownModification = false; lockPresetDropdownModification = true; lockPresetValueModification = true; lockDensityScaleModification = lockPresetValueModification; } else { if (verboseLoggingEnabled) { mls.LogInfo((object)("AutoPresetMode Match Not Found. Mode: " + currentMode.Name)); } lockModeDropdownModification = false; lockPresetDropdownModification = false; lockPresetValueModification = false; lockDensityScaleModification = lockPresetValueModification; } if (currentMode.Name != "Disco" && currentMode.Name != "Gradient") { lockPresetComboModification = true; lockAutoPresetModeModification = false; } else { lockPresetComboModification = false; lockPresetDropdownModification = true; lockPresetValueModification = true; lockDensityScaleModification = false; } if (isFogSettingsActive) { FogSettingsManager.Instance.LockPresetDropdownInteract(lockPresetDropdownModification); FogSettingsManager.Instance.LockPresetButtonInteract(lockPresetValueModification); FogSettingsManager.Instance.LockPresetValueInteract(lockPresetValueModification); FogSettingsManager.Instance.LockDensityScaleInteract(lockDensityScaleModification); FogSettingsManager.Instance.LockModeDropdownInteract(lockModeDropdownModification); FogSettingsManager.Instance.LockPresetComboInteract(lockPresetComboModification); FogSettingsManager.Instance.LockAutoPresetModeInteract(lockAutoPresetModeModification); } } [IteratorStateMachine(typeof(<DiscoLoop>d__110))] private IEnumerator DiscoLoop() { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new <DiscoLoop>d__110(0) { <>4__this = this }; } [IteratorStateMachine(typeof(<GradientLoop>d__111))] private IEnumerator GradientLoop() { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new <GradientLoop>d__111(0) { <>4__this = this }; } } } namespace BetterFog.Patches { [HarmonyPatch(typeof(HUDManager))] public class HUDManagerPatch { [HarmonyPatch("EnableChat_performed")] [HarmonyPostfix] public static void EnableChat_performedPatch() { IngameKeybinds.DisableHotkeys(); } [HarmonyPatch("SubmitChat_performed")] [HarmonyPostfix] public static void SubmitChat_performedPatch() { if (!BetterFog.inTerminal) { IngameKeybinds.EnableHotkeys(); BetterFog.mls.LogInfo((object)"Chat submitted. Enabling hotkeys."); } else if (BetterFog.verboseLoggingEnabled) { BetterFog.mls.LogInfo((object)"Chat submitted. Hotkeys remain disabled due to terminal being open."); } } [HarmonyPatch("OpenMenu_performed")] [HarmonyPostfix] public static void OpenMenu_performedPatch() { } } [HarmonyPatch(typeof(LocalVolumetricFog))] public static class LocalVolumetricFogPatch { private static void OnEnablePatch(LocalVolumetricFog __instance) { //IL_001b: Unknown result type (might be due to invalid IL or missing references) //IL_0020: Unknown result type (might be due to invalid IL or missing references) //IL_0044: Unknown result type (might be due to invalid IL or missing references) if (BetterFog.verboseLoggingEnabled) { BetterFog.mls.LogInfo((object)"LocalVolumetricFog created, capturing vanilla values."); } LocalVolumetricFogArtistParameters parameters = __instance.parameters; if (!BetterFog.fogParameterChanges.ContainsKey(((Component)__instance).gameObject)) { BetterFog.fogParameterChanges[((Component)__instance).gameObject] = parameters; if (BetterFog.verboseLoggingEnabled) { BetterFog.mls.LogInfo((object)("Captured vanilla fog parameters for " + ((Object)((Component)__instance).gameObject).name)); } } } } [HarmonyPatch(typeof(QuickMenuManager))] public class QuickMenuManagerPatch { [HarmonyPatch("OpenQuickMenu")] [HarmonyPostfix] public static void OpenQuickMenuPatch() { if (BetterFog.verboseLoggingEnabled) { BetterFog.mls.LogInfo((object)"Quick menu opened. Disabling hotkeys"); } IngameKeybinds.DisableHotkeys(); } [HarmonyPatch("CloseQuickMenu")] [HarmonyPostfix] public static void CloseQuickMenuPatch() { if (BetterFog.verboseLoggingEnabled) { BetterFog.mls.LogInfo((object)"Quick menu closed. Enabling hotkeys"); } IngameKeybinds.EnableHotkeys(); } } [HarmonyPatch] public class SceneManagerPatch { private static MethodBase TargetMethod() { return typeof(SceneManager).GetMethod("LoadScene", new Type[2] { typeof(string), typeof(LoadSceneParameters) }); } [HarmonyPostfix] public static void LoadScenePatch(string sceneName, LoadSceneParameters parameters) { BetterFog.mls.LogInfo((object)"LoadScenePatch activated"); BetterFog.CollectVanillaValues(); BetterFog.ApplyFogSettings(activateAutoPresetMode: false); } } [HarmonyPatch(typeof(ToggleFogTrigger))] public class ToggleFogTriggerPatch { [HarmonyPatch("Update")] [HarmonyPrefix] public static bool UpdatePatch() { return false; } [HarmonyPatch("OnTriggerEnter")] [HarmonyPrefix] public static bool OnTriggerEnterPatch() { return false; } [HarmonyPatch("OnTriggerExit")] [HarmonyPrefix] public static bool OnTriggerExitPatch() { return false; } } [HarmonyPatch(typeof(TimeOfDay))] public class TimeOfDayPatch { [HarmonyPrefix] public static bool SetWeatherBasedOnVariablesPatch() { return false; } } [HarmonyPatch(typeof(EntranceTeleport))] public class EntranceTeleportPatch { [HarmonyPatch("TeleportPlayer")] [HarmonyPostfix] public static void TeleportPlayerPatch() { if (GameNetworkManager.Instance.gameHasStarted) { BetterFog.mls.LogInfo((object)"Exited dungeon. Applying fog settings to moon."); BetterFog.ApplyFogSettings(activateAutoPresetMode: false); } } } [HarmonyPatch(typeof(AudioReverbTrigger))] public class AudioReverbTriggerPatch { [CompilerGenerated] private sealed class <CustomChangeVolumeCoroutine>d__1 : IEnumerator<object>, IDisposable, IEnumerator { private int <>1__state; private object <>2__current; public AudioSource aud; public float changeVolumeTo; public LocalVolumetricFog localFog; public float fogEnabledAmount; public bool toggleLocalFog; public PlayerControllerB playerScript; private int <j>5__1; object IEnumerator<object>.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public <CustomChangeVolumeCoroutine>d__1(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { <>1__state = -2; } private bool MoveNext() { //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0069: Expected O, but got Unknown switch (<>1__state) { default: return false; case 0: <>1__state = -1; <j>5__1 = 0; break; case 1: <>1__state = -1; <j>5__1++; break; } if (<j>5__1 < 40) { aud.volume = Mathf.Lerp(aud.volume, changeVolumeTo, (float)<j>5__1 / 40f); <>2__current = (object)new WaitForSeconds(0.004f); <>1__state = 1; return true; } playerScript.audioCoroutines.Remove(aud); playerScript.audioCoroutines2.Remove(aud); return false; } bool IEnumerator.MoveNext() { //ILSpy generated this explicit interface implementation from .override directive in MoveNext return this.MoveNext(); } [DebuggerHidden] void IEnumerator.Reset() { throw new NotSupportedException(); } } [HarmonyPatch("changeVolume")] [HarmonyPrefix] public static bool changeVolumePrefix(ref IEnumerator __result, AudioSource aud, float changeVolumeTo, AudioReverbTrigger __instance) { LocalVolumetricFog localFog = __instance.localFog; float fogEnabledAmount = __instance.fogEnabledAmount; bool toggleLocalFog = __instance.toggleLocalFog; PlayerControllerB playerScript = __instance.playerScript; __result = CustomChangeVolumeCoroutine(aud, changeVolumeTo, localFog, fogEnabledAmount, toggleLocalFog, playerScript); return false; } [IteratorStateMachine(typeof(<CustomChangeVolumeCoroutine>d__1))] private static IEnumerator CustomChangeVolumeCoroutine(AudioSource aud, float changeVolumeTo, LocalVolumetricFog localFog, float fogEnabledAmount, bool toggleLocalFog, PlayerControllerB playerScript) { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new <CustomChangeVolumeCoroutine>d__1(0) { aud = aud, changeVolumeTo = changeVolumeTo, localFog = localFog, fogEnabledAmount = fogEnabledAmount, toggleLocalFog = toggleLocalFog, playerScript = playerScript }; } } [HarmonyPatch(typeof(Terminal))] public class PlayerControllerBPatch { [HarmonyPatch("TeleportPlayer")] [HarmonyPostfix] public static void TeleportPlayerPatch() { if (GameNetworkManager.Instance.gameHasStarted) { BetterFog.mls.LogInfo((object)"Teleported player. Applying fog settings to moon."); BetterFog.ApplyFogSettings(activateAutoPresetMode: false); } } [HarmonyPatch("SpectateNextPlayer")] [HarmonyPostfix] public static void SpectateNextPlayerPatch() { if (GameNetworkManager.Instance.gameHasStarted) { BetterFog.mls.LogInfo((object)"Spectating the next player. Applying fog settings to moon."); BetterFog.ApplyFogSettings(activateAutoPresetMode: false); } } } [HarmonyPatch(typeof(NetworkSceneManager))] public class NetworkSceneManagerPatch { [HarmonyPatch("OnSceneLoaded")] [HarmonyPostfix] public static void OnSceneLoadedPatch() { BetterFog.mls.LogInfo((object)"OnSceneLoaded invoked. Applying fog settings to moon."); BetterFog.ApplyFogSettingsOnGameStart(); } } [HarmonyPatch(typeof(Terminal))] public class TerminalPatch { [HarmonyPatch("BeginUsingTerminal")] [HarmonyPostfix] public static void BeginUsingTerminalPatch() { BetterFog.inTerminal = true; IngameKeybinds.DisableHotkeys(); } [HarmonyPatch("QuitTerminal")] [HarmonyPostfix] public static void QuitTerminalPatch() { BetterFog.inTerminal = false; IngameKeybinds.EnableHotkeys(); BetterFog.mls.LogInfo((object)"Terminal closed. Enabling hotkeys."); } [HarmonyPatch("Start")] [HarmonyPostfix] public static void StartPatch(Terminal __instance) { //IL_0018: Unknown result type (might be due to invalid IL or missing references) //IL_001e: Invalid comparison between Unknown and I4 BetterFog.mls.LogInfo((object)"Terminal Start() has finished!"); SelectableLevel currentLevelType = BetterFog.currentLevelType; string text = (BetterFog.currentWeatherType = (((int)currentLevelType.currentWeather == -1) ? "none" : (((object)(LevelWeatherType)(ref currentLevelType.currentWeather)).ToString() ?? "").ToLower())); if (BetterFog.verboseLoggingEnabled) { BetterFog.mls.LogInfo((object)("Weather pulled from save file: Current level: " + currentLevelType.PlanetName + " | Weather: " + text)); } if (BetterFog.autoPresetModeEnabled) { BetterFog.ApplyFogSettings(activateAutoPresetMode: true); } else { BetterFog.ApplyFogSettings(activateAutoPresetMode: false); } BetterFog.weatherSaveLoaded = true; IngameKeybinds.EnableHotkeys(); } } [HarmonyPatch(typeof(StartOfRound))] public class StartOfRoundPatch { [HarmonyPatch("ChangeLevel")] [HarmonyPostfix] public static void ChangeLevelPatch(StartOfRound __instance, int levelID) { //IL_0057: Unknown result type (might be due to invalid IL or missing references) //IL_005d: Expected I4, but got Unknown //IL_00e5: Unknown result type (might be due to invalid IL or missing references) //IL_0087: Unknown result type (might be due to invalid IL or missing references) BetterFog.mls.LogInfo((object)"ChangeLevelPatch Activated"); BetterFog.currentLevelType = __instance.currentLevel; BetterFog.currentLevel = Regex.Replace(BetterFog.currentLevelType.PlanetName, "^[\\d\\s]+", "").ToLower(); BetterFog.CollectVanillaValues(); if (BetterFog.weatherSaveLoaded) { int num = (int)BetterFog.currentLevelType.currentWeather; if (num >= 0 && num < TimeOfDay.Instance.effects.Length) { WeatherEffect val = TimeOfDay.Instance.effects[BetterFog.currentLevelType.currentWeather]; BetterFog.mls.LogInfo((object)("Weather changed from " + BetterFog.currentWeatherType + " to " + val.name.ToLower())); BetterFog.currentWeatherType = val.name.ToLower(); } else { BetterFog.currentWeatherType = "none"; BetterFog.mls.LogWarning((object)$"Invalid weather index: {BetterFog.currentLevelType.currentWeather}. Set to none"); } if (BetterFog.autoPresetModeEnabled) { BetterFog.ApplyFogSettings(activateAutoPresetMode: true); } else { BetterFog.ApplyFogSettings(activateAutoPresetMode: false); } } } [HarmonyPatch("SetPlanetsWeather")] [HarmonyPostfix] public static void SetPlanetsWeatherPatch(StartOfRound __instance) { //IL_004a: Unknown result type (might be due to invalid IL or missing references) //IL_004f: Unknown result type (might be due to invalid IL or missing references) //IL_0050: Unknown result type (might be due to invalid IL or missing references) //IL_0052: Invalid comparison between Unknown and I4 BetterFog.currentLevelType = __instance.currentLevel; BetterFog.currentLevel = Regex.Replace(BetterFog.currentLevelType.PlanetName, "^[\\d\\s]+", "").ToLower(); BetterFog.CollectVanillaValues(); if ((Object)(object)BetterFog.currentLevelType != (Object)null) { LevelWeatherType currentWeather = BetterFog.currentLevelType.currentWeather; string text = (BetterFog.currentWeatherType = (((int)currentWeather == -1) ? "none" : ((object)(LevelWeatherType)(ref currentWeather)).ToString().ToLower())); if (BetterFog.verboseLoggingEnabled) { BetterFog.mls.LogInfo((object)("[BetterFog] Weather pulled from current level: " + BetterFog.currentLevelType.PlanetName + " | Weather: " + text)); } } else { BetterFog.mls.LogWarning((object)"[BetterFog] currentLevel was null. Could not read weather."); } if (BetterFog.autoPresetModeEnabled) { BetterFog.ApplyFogSettings(activateAutoPresetMode: true); } else { BetterFog.ApplyFogSettings(activateAutoPresetMode: false); } } } } namespace BetterFog.Input { internal class IngameKeybinds : LcInputActions { private static float lastKeyPressTime = 0f; private static readonly float debounceDuration = 0.2f; private static IngameKeybinds _instance; public InputAction nextPresetHotkey { get; set; } public InputAction nextModeHotkey { get; set; } public InputAction refreshPresetHotkey { get; set; } public InputAction weatherScalePresetHotkey { get; set; } public InputAction settingsHotkey { get; set; } public InputAction autoPresetModeHotkey { get; set; } public static IngameKeybinds Instance { get { if (_instance == null) { _instance = new IngameKeybinds(); } return _instance; } } internal void InitializeKeybindings(string nextPresetHotkeyString, string nextModeHotkeyString, string refreshHotkeyString, string weatherScaleHotkeyString, string settingsHotkeyString, string autoPresetModeHotkeyString) { //IL_0069: Unknown result type (might be due to invalid IL or missing references) //IL_0073: Expected O, but got Unknown //IL_013b: Unknown result type (might be due to invalid IL or missing references) //IL_0145: Expected O, but got Unknown //IL_0210: Unknown result type (might be due to invalid IL or missing references) //IL_021a: Expected O, but got Unknown //IL_02e6: Unknown result type (might be due to invalid IL or missing references) //IL_02f0: Expected O, but got Unknown //IL_03bd: Unknown result type (might be due to invalid IL or missing references) //IL_03c7: Expected O, but got Unknown //IL_0494: Unknown result type (might be due to invalid IL or missing references) //IL_049e: Expected O, but got Unknown if (nextPresetHotkey != null && nextPresetHotkey.enabled) { nextPresetHotkey.Disable(); nextPresetHotkey.performed -= delegate { BetterFog.NextPreset(); }; } nextPresetHotkey = new InputAction("Next Fog Preset", (InputActionType)0, "<Keyboard>/" + nextPresetHotkeyString, (string)null, (string)null, (string)null); if (BetterFog.nextPresetHotkeyConfig.Value != "") { nextPresetHotkey.Enable(); nextPresetHotkey.performed += delegate { if (InLobby() && Time.time - lastKeyPressTime > debounceDuration) { lastKeyPressTime = Time.time; BetterFog.mls.LogInfo((object)"Next preset hotkey pressed."); BetterFog.NextPreset(); } else { BetterFog.mls.LogInfo((object)"Next preset hotkey pressed too soon after the last keypress."); } }; } else { nextPresetHotkey.Disable(); } if (nextModeHotkey != null && nextModeHotkey.enabled) { nextModeHotkey.Disable(); nextModeHotkey.performed -= delegate { BetterFog.NextMode(); }; } nextModeHotkey = new InputAction("Next Fog Preset", (InputActionType)0, "<Keyboard>/" + nextModeHotkeyString, (string)null, (string)null, (string)null); if (BetterFog.nextModeHotkeyConfig.Value != "") { nextModeHotkey.Enable(); nextModeHotkey.performed += delegate { if (InLobby() && Time.time - lastKeyPressTime > debounceDuration) { lastKeyPressTime = Time.time; BetterFog.mls.LogInfo((object)"Next mode hotkey pressed."); BetterFog.NextMode(); } else { BetterFog.mls.LogInfo((object)"Next mode hotkey pressed too soon after the last keypress."); } }; } else { nextModeHotkey.Disable(); } if (autoPresetModeHotkey != null && autoPresetModeHotkey.enabled) { autoPresetModeHotkey.Disable(); autoPresetModeHotkey.performed -= delegate { BetterFog.ToggleAutoPresetMode(); }; } autoPresetModeHotkey = new InputAction("Auto Preset Mode", (InputActionType)0, "<Keyboard>/" + autoPresetModeHotkeyString, (string)null, (string)null, (string)null); if (BetterFog.autoPresetModeHotkeyConfig.Value != "") { autoPresetModeHotkey.Enable(); autoPresetModeHotkey.performed += delegate { if (InLobby() && Time.time - lastKeyPressTime > debounceDuration) { lastKeyPressTime = Time.time; BetterFog.mls.LogInfo((object)"Auto preset mode hotkey pressed."); BetterFog.ToggleAutoPresetMode(); } else { BetterFog.mls.LogInfo((object)"Auto preset mode hotkey pressed too soon after the last keypress."); } }; } else { autoPresetModeHotkey.Disable(); } if (refreshPresetHotkey != null && refreshPresetHotkey.enabled) { refreshPresetHotkey.Disable(); refreshPresetHotkey.performed -= delegate { BetterFog.ApplyFogSettings(activateAutoPresetMode: false); }; } refreshPresetHotkey = new InputAction("Refresh Fog Preset", (InputActionType)0, "<Keyboard>/" + refreshHotkeyString, (string)null, (string)null, (string)null); if (BetterFog.refreshPresetHotkeyConfig.Value != "") { refreshPresetHotkey.Enable(); refreshPresetHotkey.performed += delegate { if (InLobby() && Time.time - lastKeyPressTime > debounceDuration) { lastKeyPressTime = Time.time; BetterFog.mls.LogInfo((object)"Refresh preset hotkey pressed."); BetterFog.ApplyFogSettings(activateAutoPresetMode: false); } else { BetterFog.mls.LogInfo((object)"Refresh preset hotkey pressed too soon after the last keypress."); } }; } else { refreshPresetHotkey.Disable(); } if (weatherScalePresetHotkey != null && weatherScalePresetHotkey.enabled) { weatherScalePresetHotkey.Disable(); weatherScalePresetHotkey.performed -= delegate { BetterFog.ToggleWeatherScaling(); }; } weatherScalePresetHotkey = new InputAction("Weather Scale Preset", (InputActionType)0, "<Keyboard>/" + weatherScaleHotkeyString, (string)null, (string)null, (string)null); if (BetterFog.weatherScaleHotkeyConfig.Value != "") { weatherScalePresetHotkey.Enable(); weatherScalePresetHotkey.performed += delegate { if (InLobby() && Time.time - lastKeyPressTime > debounceDuration) { lastKeyPressTime = Time.time; BetterFog.mls.LogInfo((object)"Weather scaling hotkey pressed."); BetterFog.ToggleWeatherScaling(); } else { BetterFog.mls.LogInfo((object)"Weather scaling hotkey pressed too soon after the last keypress."); } }; } else { weatherScalePresetHotkey.Disable(); } if (settingsHotkey != null && settingsHotkey.enabled) { settingsHotkey.Disable(); settingsHotkey.performed -= delegate { FogSettingsManager.Instance.ToggleSettings(); }; } settingsHotkey = new InputAction("Settings", (InputActionType)0, "<Keyboard>/" + settingsHotkeyString, (string)null, (string)null, (string)null); if (BetterFog.settingsHotkeyConfig.Value != "") { settingsHotkey.Enable(); BetterFog.settingsHotkeyEnabled = true; settingsHotkey.performed += delegate { if (InLobby() && Time.time - lastKeyPressTime > debounceDuration) { lastKeyPressTime = Time.time; BetterFog.mls.LogInfo((object)"Settings hotkey pressed."); FogSettingsManager.Instance.ToggleSettings(); } else { BetterFog.mls.LogInfo((object)"Settings hotkey pressed too soon after the last keypress."); } }; } else { settingsHotkey.Disable(); BetterFog.settingsHotkeyEnabled = false; } } private static bool InLobby() { if (!NetworkManager.Singleton.IsHost && !NetworkManager.Singleton.IsClient) { BetterFog.mls.LogError((object)"Hotkeys cannot be used when not in a lobby."); return false; } return true; } public static void DisableHotkeys() { BetterFog.hotkeysEnabled = false; Instance.nextPresetHotkey.Disable(); Instance.nextModeHotkey.Disable(); Instance.refreshPresetHotkey.Disable(); Instance.weatherScalePresetHotkey.Disable(); Instance.settingsHotkey.Disable(); Instance.autoPresetModeHotkey.Disable(); } public static void EnableHotkeys() { BetterFog.hotkeysEnabled = true; Instance.nextPresetHotkey.Enable(); Instance.nextModeHotkey.Enable(); Instance.refreshPresetHotkey.Enable(); Instance.weatherScalePresetHotkey.Enable(); Instance.settingsHotkey.Enable(); Instance.autoPresetModeHotkey.Enable(); } } [HarmonyPatch] public static class KeybindDisplayNames { public static bool usingControllerPrevious = false; public static string[] keyboardKeywords = new string[2] { "keyboard", "mouse" }; public static string[] controllerKeywords = new string[2] { "gamepad", "controller" }; public static bool usingController => StartOfRound.Instance.localPlayerUsingController; public static string GetKeybindDisplayName(InputAction inputAction) { //IL_0029: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Unknown result type (might be due to invalid IL or missing references) //IL_0033: Unknown result type (might be due to invalid IL or missing references) //IL_0038: Unknown result type (might be due to invalid IL or missing references) if (inputAction == null || !inputAction.enabled) { return ""; } int num = (usingController ? 1 : 0); InputBinding val = inputAction.bindings[num]; string effectivePath = ((InputBinding)(ref val)).effectivePath; return GetKeybindDisplayName(effectivePath); } public static string GetKeybindDisplayName(string controlPath) { if (controlPath.Length <= 1) { return ""; } string text = controlPath.ToLower(); int num = text.IndexOf(">/"); text = ((num >= 0) ? text.Substring(num + 2) : text); if (text.Contains("not-bound")) { return ""; } text = text.Replace("leftalt", "Alt"); text = text.Replace("rightalt", "Alt"); text = text.Replace("leftctrl", "Ctrl"); text = text.Replace("rightctrl", "Ctrl"); text = text.Replace("leftshift", "Shift"); text = text.Replace("rightshift", "Shift"); text = text.Replace("leftbutton", "LMB"); text = text.Replace("rightbutton", "RMB"); text = text.Replace("middlebutton", "MMB"); text = text.Replace("lefttrigger", "LT"); text = text.Replace("righttrigger", "RT"); text = text.Replace("leftshoulder", "LB"); text = text.Replace("rightshoulder", "RB"); text = text.Replace("leftstickpress", "LS"); text = text.Replace("rightstickpress", "RS"); text = text.Replace("dpad/", "DPad-"); text = text.Replace("backquote", "`"); try { text = char.ToUpper(text[0]) + text.Substring(1); } catch { } return text; } } } namespace BetterFog.Assets { public class AutoPresetMode { public List<string> Conditions { get; set; } public string Effect { get; set; } public AutoPresetMode(string condition, string effect) { string[] source = condition.Split(new char[1] { '&' }); Conditions = source.Select((string c) => Regex.Replace(c.TrimStart(Array.Empty<char>()), "^[\\d\\s]+", "").ToLower()).ToList(); Effect = effect; } } public class DropdownRowData { public string PresetName { get; set; } public int Delay { get; set; } public DropdownRowData(string presetName, int delay) { PresetName = presetName; Delay = delay; } } public class FogConfigPreset { public string PresetName { get; set; } public float MeanFreePath { get; set; } public float AlbedoR { get; set; } public float AlbedoG { get; set; } public float AlbedoB { get; set; } public FogConfigPreset() { } public FogConfigPreset(string presetName, float meanFreePath, float albedoR, float albedoG, float albedoB) { PresetName = presetName; MeanFreePath = meanFreePath; AlbedoR = albedoR; AlbedoG = albedoG; AlbedoB = albedoB; } public FogConfigPreset(FogConfigPreset other) { PresetName = other.PresetName; MeanFreePath = other.MeanFreePath; AlbedoR = other.AlbedoR; AlbedoG = other.AlbedoG; AlbedoB = other.AlbedoB; } public override string ToString() { return "PresetName=" + PresetName + ",Density=" + MeanFreePath.ToString(CultureInfo.InvariantCulture) + ",Red Hue=" + AlbedoR.ToString(CultureInfo.InvariantCulture) + ",Green Hue=" + AlbedoG.ToString(CultureInfo.InvariantCulture) + ",Blue Hue=" + AlbedoB.ToString(CultureInfo.InvariantCulture); } } public class BetterFogMode { public string Name { get; set; } public string Description { get; set; } public string FogType { get; set; } public BetterFogMode(string name) { Name = name; } } public class FogSettingsManager : MonoBehaviour { [CompilerGenerated] private sealed class <ApplySliderSettingsWhilePressed>d__63 : IEnumerator<object>, IDisposable, IEnumerator { private int <>1__state; private object <>2__current; public FogSettingsManager <>4__this; private Vector2 <mousePreviousPosition>5__1; object IEnumerator<object>.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public <ApplySliderSettingsWhilePressed>d__63(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { <>1__state = -2; } private bool MoveNext() { //IL_0031: Unknown result type (might be due to invalid IL or missing references) //IL_0036: Unknown result type (might be due to invalid IL or missing references) //IL_0041: Unknown result type (might be due to invalid IL or missing references) //IL_004b: Expected O, but got Unknown //IL_0088: Unknown result type (might be due to invalid IL or missing references) //IL_0097: Unknown result type (might be due to invalid IL or missing references) switch (<>1__state) { default: return false; case 0: <>1__state = -1; break; case 1: <>1__state = -1; <>4__this.isMouseDown = InputControlExtensions.IsPressed((InputControl)(object)Mouse.current.leftButton, 0f); if (<>4__this.isMouseDown && !(<mousePreviousPosition>5__1 == ((InputControl<Vector2>)(object)((Pointer)Mouse.current).position).ReadValue())) { Debug.Log((object)"Applying fog settings while mouse is pressed."); BetterFog.ApplyFogSettings(activateAutoPresetMode: false); } break; } if (<>4__this.isMouseDown) { <mousePreviousPosition>5__1 = ((InputControl<Vector2>)(object)((Pointer)Mouse.current).position).ReadValue(); <>2__current = (object)new WaitForSeconds(0.001f); <>1__state = 1; return true; } supressApplyingFogSettings = false; Debug.Log((object)"Stopped applying fog settings. Mouse is no longer down."); return false; } bool IEnumerator.MoveNext() { //ILSpy generated this explicit interface implementation from .override directive in MoveNext return this.MoveNext(); } [DebuggerHidden] void IEnumerator.Reset() { throw new NotSupportedException(); } } private AssetBundle uninstantiatedMainBundle; private GameObject instantiatedMainBundle; private TMP_FontAsset customFont; private AssetBundle uninstantiatedRowBundle; private GameObject instantiatedRowBundle; private GameObject settingsInteractables; private static FogSettingsManager instance; private static readonly object lockO