using System.Diagnostics;
using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
using BepInEx;
using BepInEx.Configuration;
using BepInEx.Logging;
using FogRemover.Components;
using HarmonyLib;
using UnityEngine;
using UnityEngine.Rendering;
using UnityEngine.Rendering.HighDefinition;
[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: AssemblyTitle("GreenScreenMoon")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("GreenScreenMoon")]
[assembly: AssemblyCopyright("Copyright © 2023")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("3ec81793-8592-4289-9a5f-5ceb8ab8ce91")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: TargetFramework(".NETFramework,Version=v4.7.2", FrameworkDisplayName = ".NET Framework 4.7.2")]
[assembly: AssemblyVersion("1.0.0.0")]
namespace FogRemover
{
[BepInPlugin("grug.lethalcompany.fogremover", "Remove fog", "0.1.0.0")]
public class FogRemover : BaseUnityPlugin
{
public const string modGUID = "grug.lethalcompany.fogremover";
public const string modName = "Remove fog";
public const string modVersion = "0.1.0.0";
private readonly Harmony harmony = new Harmony("grug.lethalcompany.fogremover");
public static ManualLogSource mls;
private static FogRemover instance;
public static GameObject bruh;
public static ConfigEntry<bool> disableAll;
public void Awake()
{
//IL_0058: Unknown result type (might be due to invalid IL or missing references)
//IL_0062: Expected O, but got Unknown
disableAll = ((BaseUnityPlugin)this).Config.Bind<bool>("General", "All fog disable?", false, "This may cause major amounts of lag. use at your own risk");
mls = ((BaseUnityPlugin)this).Logger;
if ((Object)(object)instance == (Object)null)
{
instance = this;
}
if ((Object)(object)bruh == (Object)null)
{
bruh = new GameObject("FogRemoverHolder");
Object.DontDestroyOnLoad((Object)(object)bruh);
((Object)bruh).hideFlags = (HideFlags)61;
bruh.AddComponent<RemoveFog>();
}
}
}
}
namespace FogRemover.Components
{
internal class RemoveFog : MonoBehaviour
{
public Volume vol;
public Fog fog;
public void Awake()
{
FogRemover.mls.LogInfo((object)"Removing fog...");
if (FogRemover.disableAll.Value)
{
((MonoBehaviour)this).InvokeRepeating("MassFogRemoval", 10f, 0.3f);
}
}
public void Update()
{
if ((Object)(object)vol == (Object)null)
{
foreach (Volume item in Object.FindObjectsOfType<Volume>().ToList())
{
if (((Object)((Component)item).gameObject).name == "VolumeMain")
{
vol = item;
}
}
if ((Object)(object)fog == (Object)null && (Object)(object)vol != (Object)null)
{
vol.sharedProfile.TryGet<Fog>(ref fog);
}
}
if ((Object)(object)fog != (Object)null && ((VolumeParameter<bool>)(object)fog.enabled).value)
{
FogRemoval(fog);
FogRemover.mls.LogInfo((object)"Fog removed");
}
}
public void MassFogRemoval()
{
Fog val = default(Fog);
foreach (Volume item in Object.FindObjectsOfType<Volume>().ToList())
{
if (item.sharedProfile.TryGet<Fog>(ref val))
{
FogRemoval(val);
}
}
}
public void FogRemoval(Fog fog)
{
if ((Object)(object)fog != (Object)null && ((VolumeParameter<bool>)(object)fog.enabled).value)
{
((VolumeParameter<bool>)(object)fog.enabled).value = false;
((VolumeParameter)fog.enabled).overrideState = false;
((VolumeComponent)fog).active = false;
FogRemover.mls.LogInfo((object)"Fog removed");
}
}
}
}