Decompiled source of NoFoggyBusiness v0.1.1

plugins/NoFoggyBusiness.dll

Decompiled 4 days ago
using System;
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.Logging;
using HarmonyLib;
using Microsoft.CodeAnalysis;
using UnityEngine;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")]
[assembly: AssemblyCompany("NoFoggyBusiness")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyFileVersion("0.1.1.0")]
[assembly: AssemblyInformationalVersion("0.1.1+6b70ecff274160ede199ae5df14e8d5d329cdb2c")]
[assembly: AssemblyProduct("NoFoggyBusiness")]
[assembly: AssemblyTitle("NoFoggyBusiness")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("0.1.1.0")]
[module: UnverifiableCode]
[module: RefSafetyRules(11)]
namespace Microsoft.CodeAnalysis
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	internal sealed class EmbeddedAttribute : Attribute
	{
	}
}
namespace System.Runtime.CompilerServices
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	[AttributeUsage(AttributeTargets.Class | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Parameter | AttributeTargets.ReturnValue | AttributeTargets.GenericParameter, AllowMultiple = false, Inherited = false)]
	internal sealed class NullableAttribute : Attribute
	{
		public readonly byte[] NullableFlags;

		public NullableAttribute(byte P_0)
		{
			NullableFlags = new byte[1] { P_0 };
		}

		public NullableAttribute(byte[] P_0)
		{
			NullableFlags = P_0;
		}
	}
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	[AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Method | AttributeTargets.Interface | AttributeTargets.Delegate, AllowMultiple = false, Inherited = false)]
	internal sealed class NullableContextAttribute : Attribute
	{
		public readonly byte Flag;

		public NullableContextAttribute(byte P_0)
		{
			Flag = P_0;
		}
	}
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	[AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)]
	internal sealed class RefSafetyRulesAttribute : Attribute
	{
		public readonly int Version;

		public RefSafetyRulesAttribute(int P_0)
		{
			Version = P_0;
		}
	}
}
[BepInPlugin("NoFoggyBusiness", "NoFoggyBusiness", "0.1.1")]
public class DisableOrbFogPlugin : BaseUnityPlugin
{
	public static ManualLogSource? StaticLogger;

	private void Awake()
	{
		//IL_0010: Unknown result type (might be due to invalid IL or missing references)
		//IL_0016: Expected O, but got Unknown
		StaticLogger = ((BaseUnityPlugin)this).Logger;
		Harmony val = new Harmony("NoFoggyBusiness");
		val.PatchAll();
		((BaseUnityPlugin)this).Logger.LogInfo((object)"NoFoggyBusiness loaded!");
	}
}
[HarmonyPatch]
public static class OrbFogHandler_Start_Patch
{
	private static MethodBase TargetMethod()
	{
		Type type = AccessTools.TypeByName("OrbFogHandler");
		return AccessTools.Method(type, "Start", (Type[])null, (Type[])null);
	}

	private static void Postfix(object __instance)
	{
		FieldInfo fieldInfo = AccessTools.Field(__instance.GetType(), "sphere");
		object? value = fieldInfo.GetValue(__instance);
		MonoBehaviour val = (MonoBehaviour)((value is MonoBehaviour) ? value : null);
		if ((Object)(object)val != (Object)null)
		{
			((Component)val).gameObject.SetActive(false);
			ManualLogSource? staticLogger = DisableOrbFogPlugin.StaticLogger;
			if (staticLogger != null)
			{
				staticLogger.LogDebug((object)"OrbFogHandler.Start: Disabled fog sphere GameObject.");
			}
		}
	}
}
[HarmonyPatch]
public static class OrbFogHandler_SetFogOrigin_Patch
{
	private static MethodBase TargetMethod()
	{
		Type type = AccessTools.TypeByName("OrbFogHandler");
		return AccessTools.Method(type, "SetFogOrigin", (Type[])null, (Type[])null);
	}

	private static void Prefix(object __instance)
	{
		FieldInfo fieldInfo = AccessTools.Field(__instance.GetType(), "sphere");
		object? value = fieldInfo.GetValue(__instance);
		MonoBehaviour val = (MonoBehaviour)((value is MonoBehaviour) ? value : null);
		if ((Object)(object)val != (Object)null)
		{
			((Component)val).gameObject.SetActive(false);
			ManualLogSource? staticLogger = DisableOrbFogPlugin.StaticLogger;
			if (staticLogger != null)
			{
				staticLogger.LogDebug((object)"OrbFogHandler.SetFogOrigin: Disabled fog sphere GameObject.");
			}
		}
	}
}
[HarmonyPatch]
public static class OrbFogHandler_StartMovingRPC_Patch
{
	private static MethodBase TargetMethod()
	{
		Type type = AccessTools.TypeByName("OrbFogHandler");
		return AccessTools.Method(type, "StartMovingRPC", (Type[])null, (Type[])null);
	}

	private static void Prefix(ref bool __runOriginal)
	{
		ManualLogSource? staticLogger = DisableOrbFogPlugin.StaticLogger;
		if (staticLogger != null)
		{
			staticLogger.LogDebug((object)"OrbFogHandler.StartMovingRPC was intercepted and skipped by NoFoggyBusiness.");
		}
		__runOriginal = false;
	}
}
[HarmonyPatch]
public static class FogSphere_Update_Patch
{
	private static MethodBase TargetMethod()
	{
		Type type = AccessTools.TypeByName("FogSphere");
		return AccessTools.Method(type, "Update", (Type[])null, (Type[])null);
	}

	private static bool Prefix()
	{
		ManualLogSource? staticLogger = DisableOrbFogPlugin.StaticLogger;
		if (staticLogger != null)
		{
			staticLogger.LogDebug((object)"FogSphere.Update was intercepted and skipped by NoFoggyBusiness.");
		}
		return false;
	}
}
[HarmonyPatch]
public static class OrbFogHandler_Update_Patch
{
	private static MethodBase TargetMethod()
	{
		Type type = AccessTools.TypeByName("OrbFogHandler");
		return AccessTools.Method(type, "Update", (Type[])null, (Type[])null);
	}

	private static bool Prefix()
	{
		ManualLogSource? staticLogger = DisableOrbFogPlugin.StaticLogger;
		if (staticLogger != null)
		{
			staticLogger.LogDebug((object)"OrbFogHandler.Update was intercepted and skipped by NoFoggyBusiness.");
		}
		return false;
	}
}
namespace BepInEx
{
	[AttributeUsage(AttributeTargets.Class, Inherited = false, AllowMultiple = false)]
	[Conditional("CodeGeneration")]
	internal sealed class BepInAutoPluginAttribute : Attribute
	{
		public BepInAutoPluginAttribute(string? id = null, string? name = null, string? version = null)
		{
		}
	}
}
namespace BepInEx.Preloader.Core.Patching
{
	[AttributeUsage(AttributeTargets.Class, Inherited = false, AllowMultiple = false)]
	[Conditional("CodeGeneration")]
	internal sealed class PatcherAutoPluginAttribute : Attribute
	{
		public PatcherAutoPluginAttribute(string? id = null, string? name = null, string? version = null)
		{
		}
	}
}
namespace System.Runtime.CompilerServices
{
	[AttributeUsage(AttributeTargets.Assembly, AllowMultiple = true)]
	internal sealed class IgnoresAccessChecksToAttribute : Attribute
	{
		public IgnoresAccessChecksToAttribute(string assemblyName)
		{
		}
	}
}