Decompiled source of FogRemover v1.0.4

FogRemover.dll

Decompiled 2 weeks ago
using System;
using System.Collections;
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using BepInEx;
using BepInEx.Configuration;
using BepInEx.Logging;
using HarmonyLib;
using Microsoft.CodeAnalysis;
using UnityEngine;
using UnityEngine.SceneManagement;

[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: AssemblyCompany("FogRemover")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyDescription("Mod for removing fog in PEAK")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0+d2d866fd73d0e86b799bd7475b8582103b6a59b8")]
[assembly: AssemblyProduct("FogRemover")]
[assembly: AssemblyTitle("FogRemover")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.0.0")]
[module: UnverifiableCode]
[module: RefSafetyRules(11)]
namespace Microsoft.CodeAnalysis
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	internal sealed class EmbeddedAttribute : Attribute
	{
	}
}
namespace System.Runtime.CompilerServices
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	[AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)]
	internal sealed class RefSafetyRulesAttribute : Attribute
	{
		public readonly int Version;

		public RefSafetyRulesAttribute(int P_0)
		{
			Version = P_0;
		}
	}
}
namespace DisableFogPostMod
{
	[BepInPlugin("com.coddingcat.disablefogpost", "FogRemover", "1.0.0")]
	public class DisableFogPostPlugin : BaseUnityPlugin
	{
		internal static ManualLogSource Log;

		private ConfigEntry<bool> disablePostFog;

		private ConfigEntry<bool> disableSphereFog;

		private void Awake()
		{
			//IL_0075: Unknown result type (might be due to invalid IL or missing references)
			//IL_007b: Expected O, but got Unknown
			Log = ((BaseUnityPlugin)this).Logger;
			Log.LogInfo((object)"Disable FogPost Plugin loaded");
			disablePostFog = ((BaseUnityPlugin)this).Config.Bind<bool>("Fog Options", "DisablePostFog", true, "Disable the 'Post Fog' visual fog.");
			disableSphereFog = ((BaseUnityPlugin)this).Config.Bind<bool>("Fog Options", "DisableSphereFog", false, "Disable the damaging 'Sphere Fog', the one that rises with progress");
			SceneManager.sceneLoaded += OnSceneLoaded;
			Harmony val = new Harmony("com.chatgpt.disablefogpost");
			val.PatchAll();
		}

		private void OnSceneLoaded(Scene scene, LoadSceneMode mode)
		{
			Log.LogInfo((object)("Scene loaded: " + ((Scene)(ref scene)).name));
			DisableFogObjects();
		}

		private void DisableFogObjects()
		{
			if (disablePostFog.Value)
			{
				DisablePostFog();
			}
			if (disableSphereFog.Value)
			{
				((MonoBehaviour)this).StartCoroutine(DisableSphereFogCoroutine());
			}
		}

		private void DisablePostFog()
		{
			GameObject val = GameObject.Find("Post Fog");
			if ((Object)(object)val != (Object)null)
			{
				val.SetActive(false);
				Log.LogInfo((object)"bye bye fog!");
			}
			else
			{
				Log.LogWarning((object)"No Post Fog Found in this scene lol");
			}
		}

		private IEnumerator DisableSphereFogCoroutine()
		{
			while (true)
			{
				GameObject sphereFog = GameObject.Find("Sphere Fog");
				GameObject sphereFog2 = GameObject.Find("FogSphereSystem");
				if ((Object)(object)sphereFog != (Object)null)
				{
					if (sphereFog.activeSelf)
					{
						sphereFog.SetActive(false);
						sphereFog2.SetActive(false);
						Log.LogInfo((object)"you are not going to hurt no one anymore");
					}
				}
				else
				{
					Log.LogWarning((object)"bye bye");
				}
				yield return (object)new WaitForSeconds(10f);
			}
		}
	}
}