Decompiled source of DampDepths v1.0.1

DampDepths.dll

Decompiled a month ago
using System;
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using BepInEx;
using RoR2;
using UnityEngine;
using UnityEngine.AddressableAssets;
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.0", FrameworkDisplayName = "")]
[assembly: AssemblyCompany("DampDepths")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("DampDepths")]
[assembly: AssemblyTitle("DampDepths")]
[assembly: AssemblyVersion("1.0.0.0")]
namespace DampDepths;

[BepInPlugin("com.RiskOfBrainrot.DampDepths", "DampDepths", "1.0.0")]
public class DampDepthsPlugin : BaseUnityPlugin
{
	public const string guid = "com.RiskOfBrainrot.DampDepths";

	public const string teamName = "RiskOfBrainrot";

	public const string modName = "DampDepths";

	public const string version = "1.0.0";

	public static PluginInfo PInfo { get; private set; }

	public void Awake()
	{
		PInfo = ((BaseUnityPlugin)this).Info;
		SceneManager.activeSceneChanged += OnSceneChanged;
	}

	private void OnSceneChanged(Scene oldScene, Scene newScene)
	{
		//IL_0111: Unknown result type (might be due to invalid IL or missing references)
		//IL_0116: Unknown result type (might be due to invalid IL or missing references)
		//IL_0093: Unknown result type (might be due to invalid IL or missing references)
		//IL_0098: Unknown result type (might be due to invalid IL or missing references)
		if (!(((Scene)(ref newScene)).name.ToLower() == "dampcavesimple"))
		{
			return;
		}
		GameObject[] rootGameObjects = ((Scene)(ref newScene)).GetRootGameObjects();
		GameObject val = Array.Find(rootGameObjects, (GameObject x) => ((Object)x).name == "HOLDER: Lighting, PP, Wind, Misc");
		if (Object.op_Implicit((Object)(object)val))
		{
			Transform val2 = val.transform.Find("DCPPInTunnels");
			PostProcessVolume val3 = default(PostProcessVolume);
			if ((Object)(object)val2 != (Object)null && ((Component)val2).TryGetComponent<PostProcessVolume>(ref val3))
			{
				PostProcessProfile val4 = Addressables.LoadAssetAsync<PostProcessProfile>((object)"RoR2/Base/title/PostProcessing/ppSceneDampcave.asset").WaitForCompletion();
				if ((Object)(object)val4 != (Object)null)
				{
					val3.sharedProfile = val4;
					RampFog val5 = default(RampFog);
					if (val3.profile.TryGetSettings<RampFog>(ref val5))
					{
						((ParameterOverride<float>)(object)val5.fogPower).Override(0.49f);
						((ParameterOverride<float>)(object)val5.fogOne).Override(0.154f);
					}
				}
			}
		}
		PostProcessVolume val6 = default(PostProcessVolume);
		if (!((Component)SceneInfo.instance).TryGetComponent<PostProcessVolume>(ref val6))
		{
			return;
		}
		PostProcessProfile val7 = Addressables.LoadAssetAsync<PostProcessProfile>((object)"RoR2/Base/title/PostProcessing/ppSceneDampcave.asset").WaitForCompletion();
		if ((Object)(object)val7 != (Object)null)
		{
			val6.sharedProfile = val7;
			RampFog val8 = default(RampFog);
			if (val6.profile.TryGetSettings<RampFog>(ref val8))
			{
				((ParameterOverride<float>)(object)val8.fogPower).Override(1f);
				((ParameterOverride<float>)(object)val8.fogOne).Override(0.3f);
			}
		}
	}
}