Decompiled source of BloomSettings v1.0.1

BloomSettings.dll

Decompiled 6 months 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.Configuration;
using HarmonyLib;
using Microsoft.CodeAnalysis;
using UnityEngine;
using UnityEngine.PostProcessing;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: TargetFramework(".NETFramework,Version=v4.0", FrameworkDisplayName = ".NET Framework 4")]
[assembly: AssemblyCompany("BloomSettings")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyDescription("Player nametag tweaks")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("BloomSettings")]
[assembly: AssemblyTitle("BloomSettings")]
[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 BloomSettings
{
	[BepInPlugin("BloomSettings", "BloomSettings", "1.0.0")]
	public class Plugin : BaseUnityPlugin
	{
		private Harmony harmony;

		private ConfigEntry<float> bloomIntensity;

		private ConfigEntry<float> bloomThreshold;

		private ConfigEntry<float> softKnee;

		private static PostProcessingBehaviour postProcessingBehaviour;

		public static Plugin Instance { get; private set; }

		private void Awake()
		{
			//IL_000c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0016: Expected O, but got Unknown
			Instance = this;
			harmony = new Harmony("main");
			harmony.PatchAll(typeof(Plugin));
			bloomIntensity = ((BaseUnityPlugin)this).Config.Bind<float>("General", "Bloom intensity (-1 to skip this setting)", -1f, (ConfigDescription)null);
			bloomThreshold = ((BaseUnityPlugin)this).Config.Bind<float>("General", "Bloom threshold  (-1 to skip this setting)", 1.4f, (ConfigDescription)null);
			softKnee = ((BaseUnityPlugin)this).Config.Bind<float>("General", "Soft Knee (-1 to skip this setting)", 0.3f, (ConfigDescription)null);
		}

		[HarmonyPatch(typeof(CameraEffects), "SetBloom")]
		[HarmonyPostfix]
		private static void SetBloomPostfix(ref CameraEffects __instance, bool enabled)
		{
			//IL_0039: Unknown result type (might be due to invalid IL or missing references)
			//IL_003e: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e1: Unknown result type (might be due to invalid IL or missing references)
			if ((Object)(object)postProcessingBehaviour == (Object)null)
			{
				postProcessingBehaviour = ((Component)__instance).GetComponent<PostProcessingBehaviour>();
			}
			if (!((Object)(object)postProcessingBehaviour == (Object)null) && enabled)
			{
				Settings settings = postProcessingBehaviour.profile.bloom.settings;
				if (Instance.bloomIntensity.Value >= 0f)
				{
					settings.bloom.intensity = Instance.bloomIntensity.Value;
				}
				if (Instance.bloomThreshold.Value >= 0f)
				{
					settings.bloom.threshold = Instance.bloomThreshold.Value;
				}
				if (Instance.softKnee.Value >= 0f)
				{
					settings.bloom.softKnee = Instance.softKnee.Value;
				}
				postProcessingBehaviour.profile.bloom.settings = settings;
			}
		}
	}
	internal class PluginInfo
	{
		public const string PLUGIN_GUID = "BloomSettings";

		public const string PLUGIN_NAME = "BloomSettings";

		public const string PLUGIN_VERSION = "1.0.0";
	}
	public static class MyPluginInfo
	{
		public const string PLUGIN_GUID = "BloomSettings";

		public const string PLUGIN_NAME = "BloomSettings";

		public const string PLUGIN_VERSION = "1.0.0";
	}
}