Decompiled source of ULTRAFRIED v1.0.6

ULTRAFRIED.dll

Decompiled a week ago
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
using BepInEx;
using BepInEx.Logging;
using Configgy;
using HarmonyLib;
using ULTRAFRIED.Patches;
using UnityEngine;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: AssemblyTitle("RandomFishSize")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("RandomFishSize")]
[assembly: AssemblyCopyright("Copyright ©  2024")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("6e0aa110-5a5f-4959-b449-83336c22864f")]
[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 ULTRAFRIED
{
	[BepInPlugin("D1g1tal.ULTRAFRIED", "ULTRAFRIED", "1.0.5")]
	public class ULTRAFRIEDPLUGIN : BaseUnityPlugin
	{
		private const string modGUID = "D1g1tal.ULTRAFRIED";

		private const string modName = "ULTRAFRIED";

		private const string modVer = "1.0.5";

		private readonly Harmony harmony = new Harmony("D1g1tal.ULTRAFRIED");

		public static ManualLogSource MLS;

		[Configgable("", "Mod enabled", 0, "")]
		public static bool Enabled = true;

		[Configgable("", "Deep fry graphics", 0, "Makes everything look deep fried")]
		public static bool DeepFryVisuals = true;

		[Range(0f, float.PositiveInfinity)]
		[Configgable("", "Deep fry amount", 0, null)]
		public static double FriedAmount = 7.0;

		public static ULTRAFRIEDPLUGIN Instance;

		private void Awake()
		{
			//IL_0031: Unknown result type (might be due to invalid IL or missing references)
			//IL_0037: Expected O, but got Unknown
			if ((Object)(object)Instance == (Object)null)
			{
				Instance = this;
			}
			MLS = Logger.CreateLogSource("ULTRAFRIED");
			ConfigBuilder val = new ConfigBuilder("D1g1tal.ULTRAFRIED", "ULTRAFRIED");
			val.BuildAll();
			harmony.PatchAll(typeof(LOUDTIME));
		}
	}
}
namespace ULTRAFRIED.Patches
{
	[HarmonyPatch(typeof(NewMovement))]
	internal class LOUDTIME
	{
		[HarmonyPatch("Update")]
		[HarmonyPostfix]
		private static void DEEPFRY()
		{
			if (!ULTRAFRIEDPLUGIN.Enabled)
			{
				AudioListener.volume = 1f;
				switch (MonoSingleton<PrefsManager>.Instance.GetInt("colorCompression", 0))
				{
				case 0:
					Shader.SetGlobalInt("_ColorPrecision", 2048);
					break;
				case 1:
					Shader.SetGlobalInt("_ColorPrecision", 64);
					break;
				case 2:
					Shader.SetGlobalInt("_ColorPrecision", 32);
					break;
				case 3:
					Shader.SetGlobalInt("_ColorPrecision", 16);
					break;
				case 4:
					Shader.SetGlobalInt("_ColorPrecision", 8);
					break;
				case 5:
					Shader.SetGlobalInt("_ColorPrecision", 3);
					break;
				}
				Shader.SetGlobalFloat("_Gamma", MonoSingleton<PrefsManager>.Instance.GetFloat("gamma", 0f));
				return;
			}
			AudioListener.volume = (((float)ULTRAFRIEDPLUGIN.FriedAmount > 1f) ? ((float)ULTRAFRIEDPLUGIN.FriedAmount) : 1f);
			if (ULTRAFRIEDPLUGIN.DeepFryVisuals)
			{
				Shader.SetGlobalInt("_ColorPrecision", 0);
				Shader.SetGlobalFloat("_Gamma", ((float)ULTRAFRIEDPLUGIN.FriedAmount < 2f) ? ((float)ULTRAFRIEDPLUGIN.FriedAmount) : 2f);
				return;
			}
			switch (MonoSingleton<PrefsManager>.Instance.GetInt("colorCompression", 0))
			{
			case 0:
				Shader.SetGlobalInt("_ColorPrecision", 2048);
				break;
			case 1:
				Shader.SetGlobalInt("_ColorPrecision", 64);
				break;
			case 2:
				Shader.SetGlobalInt("_ColorPrecision", 32);
				break;
			case 3:
				Shader.SetGlobalInt("_ColorPrecision", 16);
				break;
			case 4:
				Shader.SetGlobalInt("_ColorPrecision", 8);
				break;
			case 5:
				Shader.SetGlobalInt("_ColorPrecision", 3);
				break;
			}
			Shader.SetGlobalFloat("_Gamma", MonoSingleton<PrefsManager>.Instance.GetFloat("gamma", 0f));
		}
	}
}