Decompiled source of AntlersDecay v1.2.0

AntlersDecay.dll

Decompiled 2 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.Logging;
using Microsoft.CodeAnalysis;
using On.RoR2;
using RoR2;
using UnityEngine;
using UnityEngine.Rendering.PostProcessing;
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(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")]
[assembly: AssemblyCompany("AntlersDecay")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("AntlersDecay")]
[assembly: AssemblyTitle("AntlersDecay")]
[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 AntlersDecay
{
	[BepInPlugin("HIFU.AntlersDecay", "AntlersDecay", "1.2.0")]
	public class Main : BaseUnityPlugin
	{
		public const string PluginGUID = "HIFU.AntlersDecay";

		public const string PluginAuthor = "HIFU";

		public const string PluginName = "AntlersDecay";

		public const string PluginVersion = "1.2.0";

		public static ManualLogSource adLogger;

		public static GameObject ppHolder;

		public static GameObject ppHolderUI;

		public static Color32 rallypointDeltaColor = new Color32((byte)187, (byte)236, byte.MaxValue, byte.MaxValue);

		public static Color32 titanicPlainsColor = new Color32((byte)238, (byte)238, (byte)238, byte.MaxValue);

		public static Color32 commencementStartColor = new Color32((byte)70, (byte)83, (byte)120, byte.MaxValue);

		public static Color32 commencementMidColor = new Color32((byte)37, (byte)43, (byte)52, (byte)125);

		public static Color32 grayColor = new Color32((byte)174, (byte)174, (byte)174, byte.MaxValue);

		public static Color32 shatteredAbodesNightColor = new Color32((byte)74, (byte)93, (byte)103, byte.MaxValue);

		public static Color32 verdantFallsColor = new Color32((byte)214, (byte)176, (byte)215, byte.MaxValue);

		public void Awake()
		{
			//IL_0029: Unknown result type (might be due to invalid IL or missing references)
			//IL_0033: Expected O, but got Unknown
			adLogger = ((BaseUnityPlugin)this).Logger;
			if (ppHolder == null)
			{
				ppHolder = InitPP("AntlersDecay");
			}
			Highlight.Awake += new hook_Awake(Highlight_Awake);
			SceneManager.sceneLoaded += SceneManager_sceneLoaded;
		}

		private void SceneManager_sceneLoaded(Scene scene, LoadSceneMode arg1)
		{
			string name = ((Scene)(ref scene)).name;
			SwitchPP(name);
		}

		private void Highlight_Awake(orig_Awake orig, Highlight self)
		{
			orig.Invoke(self);
			self.strength = 0.75f;
		}

		public static void SwitchPP(string sceneName)
		{
			//IL_0a7c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0a81: Unknown result type (might be due to invalid IL or missing references)
			//IL_0723: Unknown result type (might be due to invalid IL or missing references)
			//IL_0728: Unknown result type (might be due to invalid IL or missing references)
			//IL_06e9: Unknown result type (might be due to invalid IL or missing references)
			//IL_06ee: Unknown result type (might be due to invalid IL or missing references)
			//IL_06f3: Unknown result type (might be due to invalid IL or missing references)
			//IL_078d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0792: Unknown result type (might be due to invalid IL or missing references)
			//IL_07fc: Unknown result type (might be due to invalid IL or missing references)
			//IL_0801: Unknown result type (might be due to invalid IL or missing references)
			//IL_09e3: Unknown result type (might be due to invalid IL or missing references)
			//IL_09e8: Unknown result type (might be due to invalid IL or missing references)
			//IL_07c2: Unknown result type (might be due to invalid IL or missing references)
			//IL_07c7: Unknown result type (might be due to invalid IL or missing references)
			//IL_07cc: Unknown result type (might be due to invalid IL or missing references)
			//IL_0579: Unknown result type (might be due to invalid IL or missing references)
			//IL_057e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0583: Unknown result type (might be due to invalid IL or missing references)
			//IL_0974: Unknown result type (might be due to invalid IL or missing references)
			//IL_0979: Unknown result type (might be due to invalid IL or missing references)
			//IL_0466: Unknown result type (might be due to invalid IL or missing references)
			//IL_046b: Unknown result type (might be due to invalid IL or missing references)
			//IL_09a9: Unknown result type (might be due to invalid IL or missing references)
			//IL_09ae: Unknown result type (might be due to invalid IL or missing references)
			//IL_09b3: Unknown result type (might be due to invalid IL or missing references)
			//IL_0a4a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0a4f: Unknown result type (might be due to invalid IL or missing references)
			//IL_093f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0944: Unknown result type (might be due to invalid IL or missing references)
			//IL_0831: Unknown result type (might be due to invalid IL or missing references)
			//IL_0836: Unknown result type (might be due to invalid IL or missing references)
			//IL_090a: Unknown result type (might be due to invalid IL or missing references)
			//IL_090f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0758: Unknown result type (might be due to invalid IL or missing references)
			//IL_075d: Unknown result type (might be due to invalid IL or missing references)
			//IL_04d0: Unknown result type (might be due to invalid IL or missing references)
			//IL_04d5: Unknown result type (might be due to invalid IL or missing references)
			//IL_08d0: Unknown result type (might be due to invalid IL or missing references)
			//IL_08d5: Unknown result type (might be due to invalid IL or missing references)
			//IL_08da: Unknown result type (might be due to invalid IL or missing references)
			//IL_089b: Unknown result type (might be due to invalid IL or missing references)
			//IL_08a0: Unknown result type (might be due to invalid IL or missing references)
			//IL_0a18: Unknown result type (might be due to invalid IL or missing references)
			//IL_0a1d: Unknown result type (might be due to invalid IL or missing references)
			//IL_05e4: Unknown result type (might be due to invalid IL or missing references)
			//IL_05e9: Unknown result type (might be due to invalid IL or missing references)
			//IL_05ee: Unknown result type (might be due to invalid IL or missing references)
			//IL_05fa: Unknown result type (might be due to invalid IL or missing references)
			//IL_05ff: Unknown result type (might be due to invalid IL or missing references)
			//IL_0604: Unknown result type (might be due to invalid IL or missing references)
			//IL_0629: Unknown result type (might be due to invalid IL or missing references)
			//IL_062e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0633: Unknown result type (might be due to invalid IL or missing references)
			//IL_0645: Unknown result type (might be due to invalid IL or missing references)
			//IL_064a: Unknown result type (might be due to invalid IL or missing references)
			//IL_064f: Unknown result type (might be due to invalid IL or missing references)
			//IL_067a: Unknown result type (might be due to invalid IL or missing references)
			//IL_067f: Unknown result type (might be due to invalid IL or missing references)
			//IL_06af: Unknown result type (might be due to invalid IL or missing references)
			//IL_06b4: Unknown result type (might be due to invalid IL or missing references)
			//IL_06b9: Unknown result type (might be due to invalid IL or missing references)
			//IL_0866: Unknown result type (might be due to invalid IL or missing references)
			//IL_086b: Unknown result type (might be due to invalid IL or missing references)
			//IL_053f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0544: Unknown result type (might be due to invalid IL or missing references)
			//IL_0549: Unknown result type (might be due to invalid IL or missing references)
			//IL_0505: Unknown result type (might be due to invalid IL or missing references)
			//IL_050a: Unknown result type (might be due to invalid IL or missing references)
			//IL_050f: Unknown result type (might be due to invalid IL or missing references)
			//IL_049b: Unknown result type (might be due to invalid IL or missing references)
			//IL_04a0: Unknown result type (might be due to invalid IL or missing references)
			PostProcessProfile profile = ppHolder.GetComponent<PostProcessVolume>().profile;
			((Object)profile).name = sceneName + " | Antler's Decay";
			ColorGrading setting = profile.GetSetting<ColorGrading>();
			adLogger.LogDebug((object)("color grading is " + (object)setting));
			switch (sceneName)
			{
			case "dampcavesimple":
				((ParameterOverride<float>)(object)setting.saturation).value = -64f;
				((ParameterOverride<float>)(object)setting.contrast).value = 20f;
				((ParameterOverride<Color>)(object)setting.colorFilter).value = Color.white;
				break;
			case "wispgraveyard":
				((ParameterOverride<float>)(object)setting.saturation).value = -30f;
				((ParameterOverride<float>)(object)setting.contrast).value = 5f;
				((ParameterOverride<Color>)(object)setting.colorFilter).value = Color.white;
				break;
			case "rootjungle":
				((ParameterOverride<float>)(object)setting.saturation).value = -40f;
				((ParameterOverride<float>)(object)setting.contrast).value = 0f;
				((ParameterOverride<Color>)(object)setting.colorFilter).value = Color.white;
				break;
			case "frozenwall":
				((ParameterOverride<float>)(object)setting.saturation).value = 0f;
				((ParameterOverride<float>)(object)setting.contrast).value = 15f;
				((ParameterOverride<Color>)(object)setting.colorFilter).value = Color32.op_Implicit(rallypointDeltaColor);
				break;
			case "golemplains":
				((ParameterOverride<float>)(object)setting.contrast).value = 25f;
				((ParameterOverride<float>)(object)setting.saturation).value = -30f;
				((ParameterOverride<Color>)(object)setting.colorFilter).value = Color32.op_Implicit(titanicPlainsColor);
				break;
			case "golemplains2":
				((ParameterOverride<float>)(object)setting.contrast).value = 25f;
				((ParameterOverride<float>)(object)setting.saturation).value = -30f;
				((ParameterOverride<Color>)(object)setting.colorFilter).value = Color32.op_Implicit(titanicPlainsColor);
				break;
			case "moon2":
			{
				Transform child = GameObject.Find("HOLDER: Gameplay Space").transform.GetChild(0).Find("Quadrant 4: Starting Temple").GetChild(0)
					.GetChild(0)
					.Find("FX")
					.GetChild(0);
				PostProcessVolume component = ((Component)child).GetComponent<PostProcessVolume>();
				RampFog setting2 = component.profile.GetSetting<RampFog>();
				((ParameterOverride<Color>)(object)setting2.fogColorStart).value = Color32.op_Implicit(commencementStartColor);
				((ParameterOverride<Color>)(object)setting2.fogColorMid).value = Color32.op_Implicit(commencementMidColor);
				component.weight = 0.68f;
				HookLightingIntoPostProcessVolume component2 = ((Component)child).GetComponent<HookLightingIntoPostProcessVolume>();
				component2.overrideAmbientColor = Color32.op_Implicit(new Color32((byte)71, (byte)71, (byte)81, byte.MaxValue));
				component2.overrideDirectionalColor = Color32.op_Implicit(new Color32((byte)41, (byte)34, (byte)41, byte.MaxValue));
				((ParameterOverride<float>)(object)setting.saturation).value = -10f;
				((ParameterOverride<float>)(object)setting.contrast).value = 15f;
				((ParameterOverride<Color>)(object)setting.colorFilter).value = Color.white;
				break;
			}
			case "arena":
				((ParameterOverride<float>)(object)setting.saturation).value = -30f;
				((ParameterOverride<float>)(object)setting.contrast).value = 15f;
				((ParameterOverride<Color>)(object)setting.colorFilter).value = Color32.op_Implicit(grayColor);
				break;
			case "goolake":
				((ParameterOverride<float>)(object)setting.contrast).value = 15f;
				((ParameterOverride<float>)(object)setting.saturation).value = -20f;
				((ParameterOverride<Color>)(object)setting.colorFilter).value = Color32.op_Implicit(titanicPlainsColor);
				break;
			case "voidraid":
				((ParameterOverride<float>)(object)setting.saturation).value = -30f;
				((ParameterOverride<float>)(object)setting.contrast).value = 15f;
				((ParameterOverride<Color>)(object)setting.colorFilter).value = Color.white;
				break;
			case "voidstage":
				((ParameterOverride<float>)(object)setting.saturation).value = -20f;
				((ParameterOverride<float>)(object)setting.contrast).value = 15f;
				((ParameterOverride<Color>)(object)setting.colorFilter).value = Color.white;
				break;
			case "skymeadow":
				((ParameterOverride<float>)(object)setting.saturation).value = -20f;
				((ParameterOverride<float>)(object)setting.contrast).value = 5f;
				((ParameterOverride<Color>)(object)setting.colorFilter).value = Color.white;
				break;
			case "foggyswamp":
				((ParameterOverride<float>)(object)setting.contrast).value = 5f;
				((ParameterOverride<float>)(object)setting.saturation).value = -30f;
				((ParameterOverride<Color>)(object)setting.colorFilter).value = Color32.op_Implicit(titanicPlainsColor);
				break;
			case "blackbeach":
				((ParameterOverride<float>)(object)setting.saturation).value = -30f;
				((ParameterOverride<float>)(object)setting.contrast).value = 10f;
				((ParameterOverride<Color>)(object)setting.colorFilter).value = Color.white;
				break;
			case "blackbeach2":
				((ParameterOverride<float>)(object)setting.saturation).value = -30f;
				((ParameterOverride<float>)(object)setting.contrast).value = 10f;
				((ParameterOverride<Color>)(object)setting.colorFilter).value = Color.white;
				break;
			case "sulfurpools":
				((ParameterOverride<float>)(object)setting.saturation).value = -30f;
				((ParameterOverride<float>)(object)setting.contrast).value = 5f;
				((ParameterOverride<Color>)(object)setting.colorFilter).value = Color.white;
				break;
			case "shipgraveyard":
				((ParameterOverride<float>)(object)setting.saturation).value = -20f;
				((ParameterOverride<float>)(object)setting.contrast).value = 10f;
				((ParameterOverride<Color>)(object)setting.colorFilter).value = Color.white;
				break;
			case "villagenight":
				((ParameterOverride<float>)(object)setting.saturation).value = -45f;
				((ParameterOverride<float>)(object)setting.contrast).value = 15f;
				((ParameterOverride<Color>)(object)setting.colorFilter).value = Color32.op_Implicit(shatteredAbodesNightColor);
				break;
			case "habitat":
				((ParameterOverride<float>)(object)setting.saturation).value = -35f;
				((ParameterOverride<float>)(object)setting.contrast).value = 33f;
				((ParameterOverride<Color>)(object)setting.colorFilter).value = Color.white;
				break;
			case "habitatfall":
				((ParameterOverride<float>)(object)setting.saturation).value = -25f;
				((ParameterOverride<float>)(object)setting.contrast).value = 40f;
				((ParameterOverride<Color>)(object)setting.colorFilter).value = Color.white;
				break;
			case "helminthroost":
				((ParameterOverride<float>)(object)setting.saturation).value = -30f;
				((ParameterOverride<float>)(object)setting.contrast).value = 20f;
				((ParameterOverride<Color>)(object)setting.colorFilter).value = Color.white;
				break;
			case "lakes":
				((ParameterOverride<float>)(object)setting.saturation).value = -50f;
				((ParameterOverride<float>)(object)setting.contrast).value = 40f;
				((ParameterOverride<Color>)(object)setting.colorFilter).value = Color32.op_Implicit(verdantFallsColor);
				break;
			case "lakesnight":
				((ParameterOverride<float>)(object)setting.saturation).value = -55f;
				((ParameterOverride<float>)(object)setting.contrast).value = 25f;
				((ParameterOverride<Color>)(object)setting.colorFilter).value = Color.white;
				break;
			case "lemuriantemple":
				((ParameterOverride<float>)(object)setting.saturation).value = -35f;
				((ParameterOverride<float>)(object)setting.contrast).value = 20f;
				((ParameterOverride<Color>)(object)setting.colorFilter).value = Color.white;
				break;
			case "lobby":
				((ParameterOverride<float>)(object)setting.saturation).value = -40f;
				((ParameterOverride<float>)(object)setting.contrast).value = 25f;
				((ParameterOverride<Color>)(object)setting.colorFilter).value = Color.white;
				break;
			default:
				((ParameterOverride<float>)(object)setting.saturation).value = -15f;
				((ParameterOverride<float>)(object)setting.contrast).value = 15f;
				((ParameterOverride<Color>)(object)setting.colorFilter).value = Color.white;
				break;
			}
		}

		public static GameObject InitPP(string name)
		{
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			//IL_0008: Expected O, but got Unknown
			//IL_00bb: Unknown result type (might be due to invalid IL or missing references)
			//IL_00fa: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ff: Unknown result type (might be due to invalid IL or missing references)
			//IL_011e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0123: Unknown result type (might be due to invalid IL or missing references)
			GameObject val = new GameObject(name);
			Object.DontDestroyOnLoad((Object)(object)val);
			val.layer = LayerIndex.postProcess.intVal;
			val.AddComponent<AntlersDecayController>();
			PostProcessVolume val2 = val.AddComponent<PostProcessVolume>();
			Object.DontDestroyOnLoad((Object)(object)val2);
			val2.isGlobal = true;
			val2.weight = 1f;
			val2.priority = float.MaxValue;
			PostProcessProfile val3 = ScriptableObject.CreateInstance<PostProcessProfile>();
			Object.DontDestroyOnLoad((Object)(object)val3);
			((Object)val3).name = "pp" + name;
			ColorGrading val4 = val3.AddSettings<ColorGrading>();
			((PostProcessEffectSettings)val4).SetAllOverridesTo(true, true);
			val2.sharedProfile = val3;
			((ParameterOverride<bool>)(object)((PostProcessEffectSettings)val4).enabled).value = true;
			((ParameterOverride<float>)(object)val4.saturation).value = -20f;
			((ParameterOverride<float>)(object)val4.contrast).value = 30f;
			((ParameterOverride<Tonemapper>)(object)val4.tonemapper).value = (Tonemapper)3;
			((ParameterOverride<float>)(object)val4.toneCurveToeStrength).value = 1f;
			((ParameterOverride<float>)(object)val4.toneCurveToeLength).value = 0.15f;
			((ParameterOverride<Vector4>)(object)val4.lift).value = new Vector4(1f, 1f, 1.03f, 0f);
			((ParameterOverride<Vector4>)(object)val4.gamma).value = new Vector4(1.15f, 1f, 1f, 0f);
			Grain val5 = val3.AddSettings<Grain>();
			((PostProcessEffectSettings)val5).SetAllOverridesTo(true, true);
			((ParameterOverride<float>)(object)val5.intensity).value = 0.13f;
			Bloom val6 = val3.AddSettings<Bloom>();
			((PostProcessEffectSettings)val6).SetAllOverridesTo(true, true);
			AmbientOcclusion val7 = val3.AddSettings<AmbientOcclusion>();
			((PostProcessEffectSettings)val7).SetAllOverridesTo(true, true);
			Vignette val8 = val3.AddSettings<Vignette>();
			((PostProcessEffectSettings)val8).SetAllOverridesTo(true, true);
			((ParameterOverride<float>)(object)val7.intensity).value = 0.3f;
			((ParameterOverride<float>)(object)val7.radius).value = 0.25f;
			((ParameterOverride<float>)(object)val7.thicknessModifier).value = 100f;
			((ParameterOverride<float>)(object)val7.upsampleTolerance).value = 0f;
			((ParameterOverride<float>)(object)val8.intensity).value = 0.2f;
			return val;
		}
	}
	public class AntlersDecayController : MonoBehaviour
	{
		public PostProcessVolume volume;

		public void Start()
		{
			volume = ((Component)this).GetComponent<PostProcessVolume>();
		}
	}
}