Decompiled source of VerdantFallsReshaded v1.0.2

VerdantReshade.dll

Decompiled a month ago
using System;
using System.Collections.Generic;
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 Rewired.ComponentControls.Effects;
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("VerdantReshade")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("VerdantReshade")]
[assembly: AssemblyTitle("VerdantReshade")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.0.0")]
[module: UnverifiableCode]
namespace VerdantReshade;

internal class Hook
{
	internal static void Hooks()
	{
		SceneManager.sceneLoaded += SceneManager_sceneLoaded;
	}

	private static void SceneManager_sceneLoaded(Scene scene, LoadSceneMode sceneMode)
	{
		//IL_008f: Unknown result type (might be due to invalid IL or missing references)
		//IL_00c7: Unknown result type (might be due to invalid IL or missing references)
		//IL_00ce: Expected O, but got Unknown
		//IL_00f2: Unknown result type (might be due to invalid IL or missing references)
		//IL_0136: Unknown result type (might be due to invalid IL or missing references)
		//IL_013b: Unknown result type (might be due to invalid IL or missing references)
		//IL_019a: Unknown result type (might be due to invalid IL or missing references)
		//IL_019f: Unknown result type (might be due to invalid IL or missing references)
		//IL_01be: Unknown result type (might be due to invalid IL or missing references)
		//IL_01dd: Unknown result type (might be due to invalid IL or missing references)
		//IL_01e2: Unknown result type (might be due to invalid IL or missing references)
		//IL_0201: Unknown result type (might be due to invalid IL or missing references)
		if (((Scene)(ref scene)).name == "lakes")
		{
			GameObject[] rootGameObjects = ((Scene)(ref scene)).GetRootGameObjects();
			GameObject[] array = rootGameObjects;
			foreach (GameObject val in array)
			{
				Debug.LogWarning((object)val);
			}
			GameObject val2 = rootGameObjects[1];
			Transform child = val2.transform.GetChild(0);
			if (MainPlugin.enableParticles.Value)
			{
				GameObject val3 = Object.Instantiate<GameObject>(Prefabs.particles, child);
				val3.transform.localPosition = new Vector3(10f, 150f, 0f);
			}
			if (MainPlugin.enableLights.Value)
			{
				GameObject val4 = new GameObject("FlowerLight", new Type[1] { typeof(Light) });
				val4.transform.parent = child;
				val4.transform.localPosition = new Vector3(0f, 450f, 0f);
				Light component = val4.GetComponent<Light>();
				component.range = 1000f;
				component.intensity = 0.4f;
				component.color = Color32.op_Implicit(new Color32(byte.MaxValue, (byte)243, (byte)213, byte.MaxValue));
			}
			if (MainPlugin.disableBackground.Value)
			{
				((Component)val2.transform.GetChild(10)).gameObject.SetActive(false);
			}
			if (MainPlugin.enableParticles.Value)
			{
				Object.Instantiate<GameObject>(Prefabs.particles, new Vector3(80f, 80f, -110f), Quaternion.identity, child).transform.localScale = new Vector3(-6f, 6f, 6f);
				Object.Instantiate<GameObject>(Prefabs.particles, new Vector3(-80f, 80f, -110f), Quaternion.identity, child).transform.localScale = new Vector3(8f, 8f, 8f);
			}
			GameObject val5 = rootGameObjects[14];
			PostProcessVolume componentInChildren = val5.GetComponentInChildren<PostProcessVolume>();
			componentInChildren.profile = Prefabs.profile;
			componentInChildren.sharedProfile = Prefabs.profile;
			componentInChildren.priority = 1f;
			Object.Destroy((Object)(object)((Component)componentInChildren).GetComponent<SetAmbientLight>());
			if (MainPlugin.enableClouds.Value)
			{
				GameObject gameObject = ((Component)val5.transform.GetChild(4)).gameObject;
				RotateAroundAxis val6 = gameObject.AddComponent<RotateAroundAxis>();
				val6.speed = (Speed)1;
				val6.slowRotationSpeed = 1f;
				val6.rotateAroundAxis = (RotationAxis)1;
				((Component)componentInChildren).gameObject.SetActive(false);
				((Component)componentInChildren).gameObject.SetActive(true);
			}
		}
	}
}
[BepInPlugin("com.Dragonyck.VerdantReshade", "VerdantReshade", "1.0.0")]
public class MainPlugin : BaseUnityPlugin
{
	public const string MODUID = "com.Dragonyck.VerdantReshade";

	public const string MODNAME = "VerdantReshade";

	public const string VERSION = "1.0.0";

	internal static ConfigEntry<bool> disableBackground;

	internal static ConfigEntry<bool> enableLights;

	internal static ConfigEntry<bool> enableClouds;

	internal static ConfigEntry<bool> enableParticles;

	private void Awake()
	{
		disableBackground = ((BaseUnityPlugin)this).Config.Bind<bool>("General", "Disable Background Terrain", true, "Disables background planes.");
		enableLights = ((BaseUnityPlugin)this).Config.Bind<bool>("General", "Enable Big Flower Subtle Light", true, "Enables lights around the beeg flower.");
		enableClouds = ((BaseUnityPlugin)this).Config.Bind<bool>("General", "Enable Cloud Improvements", true, "Increased Opacity and move slowly.");
		enableParticles = ((BaseUnityPlugin)this).Config.Bind<bool>("General", "Enable Flower Particles", true, "The little fairies flying around it.");
		Prefabs.CreatePrefabs();
		Hook.Hooks();
	}
}
internal class Prefabs
{
	internal static PostProcessProfile profile;

	internal static GameObject particles;

	internal static T Load<T>(string path)
	{
		//IL_0002: Unknown result type (might be due to invalid IL or missing references)
		//IL_0007: Unknown result type (might be due to invalid IL or missing references)
		return Addressables.LoadAssetAsync<T>((object)path).WaitForCompletion();
	}

	internal static void CreatePrefabs()
	{
		//IL_0042: Unknown result type (might be due to invalid IL or missing references)
		//IL_0048: Expected O, but got Unknown
		//IL_008b: Unknown result type (might be due to invalid IL or missing references)
		//IL_0090: Unknown result type (might be due to invalid IL or missing references)
		//IL_0095: Unknown result type (might be due to invalid IL or missing references)
		//IL_00a1: Unknown result type (might be due to invalid IL or missing references)
		//IL_00a7: Expected O, but got Unknown
		//IL_00d9: Unknown result type (might be due to invalid IL or missing references)
		//IL_00de: Unknown result type (might be due to invalid IL or missing references)
		//IL_00e3: Unknown result type (might be due to invalid IL or missing references)
		//IL_01b3: Unknown result type (might be due to invalid IL or missing references)
		//IL_01b8: Unknown result type (might be due to invalid IL or missing references)
		//IL_01bd: Unknown result type (might be due to invalid IL or missing references)
		//IL_01d4: Unknown result type (might be due to invalid IL or missing references)
		//IL_01d9: Unknown result type (might be due to invalid IL or missing references)
		//IL_01de: Unknown result type (might be due to invalid IL or missing references)
		//IL_023f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0246: Expected O, but got Unknown
		//IL_02a5: Unknown result type (might be due to invalid IL or missing references)
		//IL_02af: Expected O, but got Unknown
		//IL_02cd: Unknown result type (might be due to invalid IL or missing references)
		//IL_02d2: Unknown result type (might be due to invalid IL or missing references)
		//IL_0335: Unknown result type (might be due to invalid IL or missing references)
		//IL_033a: Unknown result type (might be due to invalid IL or missing references)
		PostProcessProfile val = Load<PostProcessProfile>("RoR2/CU8/lakes/ppSceneTL.asset");
		profile = Object.Instantiate<PostProcessProfile>(Load<PostProcessProfile>("RoR2/Base/title/ppLocalMagmaWorm.asset"));
		((Object)profile).name = "ppScenePrettyLakes";
		List<PostProcessEffectSettings> settings = profile.settings;
		Bloom val2 = (Bloom)settings[0];
		((ParameterOverride<float>)(object)val2.intensity).value = 1.5f;
		((ParameterOverride)val2.threshold).overrideState = true;
		((ParameterOverride<float>)(object)val2.threshold).value = 0.2f;
		((ParameterOverride<Color>)(object)val2.color).value = Color32.op_Implicit(new Color32((byte)199, (byte)191, (byte)125, byte.MaxValue));
		ColorGrading val3 = (ColorGrading)settings[1];
		((ParameterOverride)val3.temperature).overrideState = false;
		((ParameterOverride)val3.colorFilter).overrideState = true;
		((ParameterOverride<Color>)(object)val3.colorFilter).value = Color32.op_Implicit(new Color32(byte.MaxValue, (byte)171, (byte)204, byte.MaxValue));
		((ParameterOverride)val3.saturation).overrideState = true;
		((ParameterOverride<float>)(object)val3.saturation).value = 5f;
		((ParameterOverride)val3.contrast).overrideState = true;
		((ParameterOverride<float>)(object)val3.contrast).value = 10f;
		RampFog val4 = ScriptableObject.CreateInstance<RampFog>();
		((PostProcessEffectSettings)val4).active = true;
		((ParameterOverride)((PostProcessEffectSettings)val4).enabled).overrideState = true;
		((ParameterOverride<bool>)(object)((PostProcessEffectSettings)val4).enabled).value = true;
		((ParameterOverride)val4.fogPower).overrideState = false;
		((ParameterOverride)val4.fogZero).overrideState = false;
		((ParameterOverride)val4.fogHeightStart).overrideState = false;
		((ParameterOverride)val4.fogHeightEnd).overrideState = false;
		((ParameterOverride)val4.fogHeightIntensity).overrideState = false;
		((ParameterOverride)val4.fogColorStart).overrideState = false;
		((ParameterOverride)val4.skyboxStrength).overrideState = false;
		((ParameterOverride<Color>)(object)val4.fogColorMid).value = Color32.op_Implicit(new Color32((byte)87, (byte)30, (byte)74, (byte)105));
		((ParameterOverride<Color>)(object)val4.fogColorEnd).value = Color32.op_Implicit(new Color32((byte)61, (byte)28, (byte)53, (byte)234));
		((ParameterOverride<float>)(object)val4.fogIntensity).value = 0.3f;
		if (MainPlugin.enableClouds.Value)
		{
			Load<Material>("RoR2/CU8/lakes/matTLCloud.mat").SetFloat("_AlphaBoost", 0.228f);
		}
		Load<Material>("RoR2/CU8/lakes/matTLTerrainCliff.mat").SetFloat("_RedChannelSpecularStrength", 0.1f);
		GameObject val5 = new GameObject("dontDestroyOnLoad");
		val5.SetActive(false);
		Object.DontDestroyOnLoad((Object)(object)val5);
		if (MainPlugin.enableParticles.Value)
		{
			particles = Object.Instantiate<GameObject>(((Component)Load<GameObject>("RoR2/Base/Teleporters/Teleporter1.prefab").GetComponentInChildren<ParticleSystem>()).gameObject, val5.transform);
			ParticleSystemRenderer component = particles.GetComponent<ParticleSystemRenderer>();
			((Renderer)component).material = new Material(((Renderer)component).material);
			((Renderer)component).material.SetColor("_TintColor", Color32.op_Implicit(new Color32((byte)193, (byte)69, (byte)166, (byte)190)));
			((Renderer)component).material.SetTexture("_MainTex", (Texture)(object)Load<Texture2D>("RoR2/Base/Common/VFX/texOmniHitspark2Mask.png"));
			((Renderer)component).material.SetTexture("_RemapTex", (Texture)(object)Load<Texture2D>("RoR2/Base/Common/ColorRamps/texRampAreaIndicator.png"));
			((Renderer)component).material.DisableKeyword("VERTEXCOLOR");
			ParticleSystem component2 = particles.GetComponent<ParticleSystem>();
			MainModule main = component2.main;
			Debug.LogWarning((object)((MainModule)(ref main)).startSizeMultiplier);
			((MainModule)(ref main)).startSizeMultiplier = 0.1f;
		}
	}
}