Please disclose if any significant portion of your mod was created using AI tools by adding the 'AI Generated' category. Failing to do so may result in the mod being removed from Thunderstore.
Decompiled source of Black WhiteFX v1.0.0
SpookyFX.dll
Decompiled a year agousing 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 BepInEx.Logging; using HarmonyLib; using Microsoft.CodeAnalysis; using UnityEngine; using UnityEngine.Rendering.PostProcessing; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)] [assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")] [assembly: IgnoresAccessChecksTo("")] [assembly: AssemblyCompany("Omniscye")] [assembly: AssemblyConfiguration("Debug")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0")] [assembly: AssemblyProduct("SpookyFX")] [assembly: AssemblyTitle("SpookyFX")] [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.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; } } } namespace SpookyFX { [BepInPlugin("Omniscye.SpookyFX", "SpookyFX", "1.0")] public class SpookyFX : BaseUnityPlugin { internal static SpookyFX Instance { get; private set; } internal static ManualLogSource Logger => Instance._logger; private ManualLogSource _logger => ((BaseUnityPlugin)this).Logger; internal Harmony? Harmony { get; set; } private void Awake() { Instance = this; ((Component)this).gameObject.transform.parent = null; ((Object)((Component)this).gameObject).hideFlags = (HideFlags)61; Patch(); Logger.LogInfo((object)$"{((BaseUnityPlugin)this).Info.Metadata.GUID} v{((BaseUnityPlugin)this).Info.Metadata.Version} has loaded!"); } internal void Patch() { //IL_001a: Unknown result type (might be due to invalid IL or missing references) //IL_001f: Unknown result type (might be due to invalid IL or missing references) //IL_0021: Expected O, but got Unknown //IL_0026: Expected O, but got Unknown if (Harmony == null) { Harmony val = new Harmony(((BaseUnityPlugin)this).Info.Metadata.GUID); Harmony val2 = val; Harmony = val; } Harmony.PatchAll(); } internal void Unpatch() { Harmony? harmony = Harmony; if (harmony != null) { harmony.UnpatchSelf(); } } private void Update() { } } } namespace Empress.REPO.Halloween { [BepInPlugin("empress.repo.halloweenbw", "Empress Halloween B/W", "1.0.0")] public class EmpressHalloweenBW : BaseUnityPlugin { public const string PluginGuid = "empress.repo.halloweenbw"; public const string PluginName = "Empress Halloween B/W"; public const string PluginVersion = "1.0.0"; internal static ConfigEntry<bool> C_Enabled; internal static ConfigEntry<float> C_Saturation; internal static ConfigEntry<float> C_Contrast; internal static ConfigEntry<float> C_GrainIntensity; internal static ConfigEntry<float> C_GrainSize; internal static ConfigEntry<float> C_VignetteBase; internal static ConfigEntry<float> C_VignetteSmoothness; internal static ConfigEntry<float> C_FlickerAmount; internal static ConfigEntry<float> C_FlickerSpeed; internal static ConfigEntry<float> C_PumpkinR; internal static ConfigEntry<float> C_PumpkinG; internal static ConfigEntry<float> C_PumpkinB; internal static ConfigEntry<float> C_PumpkinA; private Harmony _harmony; private void Awake() { //IL_01d7: Unknown result type (might be due to invalid IL or missing references) //IL_01e1: Expected O, but got Unknown C_Enabled = ((BaseUnityPlugin)this).Config.Bind<bool>("General", "Enabled", true, "Master toggle for the Halloween B/W theme."); C_Saturation = ((BaseUnityPlugin)this).Config.Bind<float>("Grading", "Saturation", -100f, "Target saturation (-100..0). Use -100 for true B/W."); C_Contrast = ((BaseUnityPlugin)this).Config.Bind<float>("Grading", "Contrast", 15f, "Contrast boost (-100..100)."); C_GrainIntensity = ((BaseUnityPlugin)this).Config.Bind<float>("Grain", "Intensity", 0.75f, "Film grain intensity (0..1)."); C_GrainSize = ((BaseUnityPlugin)this).Config.Bind<float>("Grain", "Size", 1.2f, "Film grain size (0.3..3)."); C_VignetteBase = ((BaseUnityPlugin)this).Config.Bind<float>("Vignette", "BaseIntensity", 0.35f, "Base vignette intensity (0..1)."); C_VignetteSmoothness = ((BaseUnityPlugin)this).Config.Bind<float>("Vignette", "Smoothness", 0.45f, "Vignette smoothness (0..1)."); C_FlickerAmount = ((BaseUnityPlugin)this).Config.Bind<float>("Vignette", "FlickerAmount", 0.15f, "Extra intensity added by flicker (0..1)."); C_FlickerSpeed = ((BaseUnityPlugin)this).Config.Bind<float>("Vignette", "FlickerSpeed", 1.2f, "Flicker speed in cycles/sec."); C_PumpkinR = ((BaseUnityPlugin)this).Config.Bind<float>("PumpkinColor", "R", 0.95f, "Pumpkin orange R (0..1)."); C_PumpkinG = ((BaseUnityPlugin)this).Config.Bind<float>("PumpkinColor", "G", 0.45f, "Pumpkin orange G (0..1)."); C_PumpkinB = ((BaseUnityPlugin)this).Config.Bind<float>("PumpkinColor", "B", 0.1f, "Pumpkin orange B (0..1)."); C_PumpkinA = ((BaseUnityPlugin)this).Config.Bind<float>("PumpkinColor", "A", 1f, "Pumpkin color alpha (0..1)."); _harmony = new Harmony("empress.repo.halloweenbw"); try { _harmony.PatchAll(typeof(EmpressHalloweenBW).Assembly); ((BaseUnityPlugin)this).Logger.LogInfo((object)"Empress Halloween B/W v1.0.0 loaded. Time to make it spooky."); } catch (Exception arg) { ((BaseUnityPlugin)this).Logger.LogError((object)string.Format("[{0}] Failed to patch: {1}", "Empress Halloween B/W", arg)); } } private void OnDestroy() { try { Harmony harmony = _harmony; if (harmony != null) { harmony.UnpatchSelf(); } } catch { } } internal static void ApplyTheme(PostProcessing pp, bool perFramePulse) { //IL_024f: Unknown result type (might be due to invalid IL or missing references) //IL_0251: Unknown result type (might be due to invalid IL or missing references) //IL_027b: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)pp == (Object)null || !C_Enabled.Value) { return; } Type typeFromHandle = typeof(PostProcessing); FieldInfo fieldInfo = AccessTools.Field(typeFromHandle, "colorGrading"); FieldInfo fieldInfo2 = AccessTools.Field(typeFromHandle, "grain"); FieldInfo fieldInfo3 = AccessTools.Field(typeFromHandle, "vignette"); FieldInfo fieldInfo4 = AccessTools.Field(typeFromHandle, "colorGradingSaturation"); FieldInfo fieldInfo5 = AccessTools.Field(typeFromHandle, "colorGradingContrast"); FieldInfo fieldInfo6 = AccessTools.Field(typeFromHandle, "vignetteColor"); FieldInfo fieldInfo7 = AccessTools.Field(typeFromHandle, "vignetteIntensity"); FieldInfo fieldInfo8 = AccessTools.Field(typeFromHandle, "vignetteSmoothness"); if (fieldInfo == null || fieldInfo2 == null || fieldInfo3 == null) { return; } object? value = fieldInfo.GetValue(pp); ColorGrading val = (ColorGrading)((value is ColorGrading) ? value : null); object? value2 = fieldInfo2.GetValue(pp); Grain val2 = (Grain)((value2 is Grain) ? value2 : null); object? value3 = fieldInfo3.GetValue(pp); Vignette val3 = (Vignette)((value3 is Vignette) ? value3 : null); if ((Object)(object)val == (Object)null || (Object)(object)val2 == (Object)null || (Object)(object)val3 == (Object)null) { return; } float num = Mathf.Clamp(C_Saturation.Value, -100f, 0f); float num2 = Mathf.Clamp(C_Contrast.Value, -100f, 100f); ((ParameterOverride<float>)(object)val.saturation).value = num; ((ParameterOverride<float>)(object)val.contrast).value = num2; fieldInfo4?.SetValue(pp, num); fieldInfo5?.SetValue(pp, num2); ((PostProcessEffectSettings)val2).active = true; ((ParameterOverride<float>)(object)val2.intensity).value = Mathf.Clamp01(C_GrainIntensity.Value); ((ParameterOverride<float>)(object)val2.size).value = Mathf.Clamp(C_GrainSize.Value, 0.3f, 3f); ((ParameterOverride<bool>)(object)val2.colored).value = false; Color val4 = default(Color); ((Color)(ref val4))..ctor(Mathf.Clamp01(C_PumpkinR.Value), Mathf.Clamp01(C_PumpkinG.Value), Mathf.Clamp01(C_PumpkinB.Value), Mathf.Clamp01(C_PumpkinA.Value)); float num3 = Mathf.Clamp01(C_VignetteBase.Value); float num4 = Mathf.Clamp01(C_VignetteSmoothness.Value); ((ParameterOverride<Color>)(object)val3.color).value = val4; ((ParameterOverride<float>)(object)val3.intensity).value = num3; ((ParameterOverride<float>)(object)val3.smoothness).value = num4; fieldInfo6?.SetValue(pp, val4); fieldInfo7?.SetValue(pp, num3); fieldInfo8?.SetValue(pp, num4); if (perFramePulse) { float num5 = 0f; float num6 = Mathf.Clamp01(C_FlickerAmount.Value); float num7 = Mathf.Max(0f, C_FlickerSpeed.Value); if (num6 > 0f && num7 > 0f) { num5 = (Mathf.Sin(Time.time * num7 * 2f * MathF.PI) * 0.5f + 0.5f) * num6; } float num8 = Mathf.Clamp01(num3 + num5); ((ParameterOverride<float>)(object)val3.intensity).value = num8; fieldInfo7?.SetValue(pp, num8); } } } [HarmonyPatch(typeof(PostProcessing), "Setup")] internal static class Patch_PostProcessing_Setup { private static void Postfix(PostProcessing __instance) { EmpressHalloweenBW.ApplyTheme(__instance, perFramePulse: false); } } [HarmonyPatch(typeof(PostProcessing), "Update")] internal static class Patch_PostProcessing_Update { private static void Postfix(PostProcessing __instance) { EmpressHalloweenBW.ApplyTheme(__instance, perFramePulse: true); } } }