Decompiled source of StageAesthetic v1.1.1

StageAesthetic.dll

Decompiled 2 hours ago
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;
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 FRCSharp;
using HG;
using HG.Reflection;
using HarmonyLib;
using IL;
using Microsoft.CodeAnalysis;
using Mono.Cecil.Cil;
using MonoMod.Cil;
using Newtonsoft.Json;
using On.RoR2;
using On.RoR2.UI;
using R2API;
using RiskOfOptions;
using RiskOfOptions.OptionConfigs;
using RiskOfOptions.Options;
using RoR2;
using RoR2.UI;
using StageAesthetic.Variants;
using StageAesthetic.Variants.Stage5.SkyMeadow;
using TMPro;
using UnityEngine;
using UnityEngine.AddressableAssets;
using UnityEngine.Rendering.PostProcessing;
using UnityEngine.SceneManagement;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: OptIn]
[assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")]
[assembly: AssemblyCompany("StageAesthetic")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0+39b2eb5d79dc381b178e03ea00536a1d4a6ac50d")]
[assembly: AssemblyProduct("StageAesthetic")]
[assembly: AssemblyTitle("StageAesthetic")]
[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 StageAesthetic
{
	public class Assets
	{
		public class ReplaceInstance<T> where T : Component
		{
			public Func<T, bool> Condition;

			public Action<T> Action;

			public ReplaceInstance(Func<T, bool> condition, Action<T> action)
			{
				Condition = condition;
				Action = action;
				base..ctor();
			}

			public ReplaceInstance(string[] keys, Action<T> action)
				: this((Func<T, bool>)((T x) => keys.Any(((Object)((Component)x).gameObject).name.Contains)), action)
			{
			}
		}

		public static ConfigEntry<string> VariantsLoaded;

		public static ConfigEntry<string> ResourcesLoaded;

		public static Dictionary<string, List<string>> PreloadedVariants = new Dictionary<string, List<string>>();

		public static Dictionary<KeyValuePair<string, Type>, object> Cache = new Dictionary<KeyValuePair<string, Type>, object>();

		public static Dictionary<KeyValuePair<string, Color32>, Material> CacheRecolor = new Dictionary<KeyValuePair<string, Color32>, Material>();

		public static int _temp = 0;

		public static Shader CloudRemap;

		public static Shader SnowTopped;

		public static PostProcessProfile GooLakeProfile;

		public static bool DisableLoad = false;

		public static Dictionary<Material, Material> CacheMaterial = new Dictionary<Material, Material>();

		public static void Init()
		{
			VariantsLoaded = ConfigManager.BackupConfig.Bind<string>("General", "Variants Loaded", "{}", "do not change this");
			ResourcesLoaded = ConfigManager.BackupConfig.Bind<string>("General", "Resources To Load", "{}", "do not change this");
			PreloadedVariants = JsonConvert.DeserializeObject<Dictionary<string, List<string>>>(VariantsLoaded.Value);
			Dictionary<Type, List<string>> dictionary = new Dictionary<Type, List<string>>();
			Dictionary<string, List<string>> dictionary2 = JsonConvert.DeserializeObject<Dictionary<string, List<string>>>(ResourcesLoaded.Value);
			foreach (string key2 in dictionary2.Keys)
			{
				Type type = Type.GetType(key2);
				MethodInfo method = typeof(Assets).GetMethod("Load", BindingFlags.Static | BindingFlags.Public);
				method = method.MakeGenericMethod(type);
				foreach (string item in dictionary2[key2])
				{
					method.Invoke(null, new object[1] { item });
				}
			}
			Dictionary<string, List<string>> VariantsToLoad = new Dictionary<string, List<string>>();
			int num = 0;
			foreach (Variant variant in Variant.Variants)
			{
				string[] stages = variant.Stages;
				foreach (string key in stages)
				{
					if (!PreloadedVariants.ContainsKey(key) || !PreloadedVariants[key].Contains(variant.Name))
					{
						if (!VariantsToLoad.ContainsKey(key))
						{
							VariantsToLoad[key] = new List<string>();
						}
						VariantsToLoad[key].Add(variant.Name);
						num++;
					}
				}
			}
			Main.Log.LogInfo((object)$"[initial load :3] Preloading {num} variants across {VariantsToLoad.Count} stages");
			_temp = VariantsToLoad.Count;
			Main.Harmony.PatchAll(typeof(RemoveLogsDuringPreload));
			foreach (string s in VariantsToLoad.Keys)
			{
				SceneAssetAPI.AddAssetRequest(s, (Action<GameObject[]>)delegate
				{
					DisableLoad = true;
					foreach (string item2 in VariantsToLoad[s])
					{
						try
						{
							Hooks.RollVariantInternal(s, item2);
						}
						catch
						{
							Main.Log.LogWarning((object)"Failed to load this variant fully, some ourple may occur the first time you load this variant");
						}
						if (!PreloadedVariants.ContainsKey(s))
						{
							PreloadedVariants[s] = new List<string>();
						}
						PreloadedVariants[s].Add(item2);
					}
					Tick();
				});
			}
		}

		public static void Tick()
		{
			//IL_0031: Unknown result type (might be due to invalid IL or missing references)
			//IL_0036: Unknown result type (might be due to invalid IL or missing references)
			_temp--;
			if (_temp == 0)
			{
				Main.Log.LogInfo((object)"Done Preloading");
				PostProcessVolume.localVolumes = new List<PostProcessVolume>();
				SaveResourceList();
				Scene activeScene = SceneManager.GetActiveScene();
				SceneManager.LoadScene(((Scene)(ref activeScene)).name);
			}
		}

		public static void SaveResourceList()
		{
			Main.Log.LogInfo((object)"Saving Resource List");
			DisableLoad = false;
			Dictionary<string, List<string>> dictionary = new Dictionary<string, List<string>>();
			foreach (KeyValuePair<string, Type> key in Cache.Keys)
			{
				if (!dictionary.ContainsKey(key.Value.AssemblyQualifiedName))
				{
					dictionary[key.Value.AssemblyQualifiedName] = new List<string>();
				}
				dictionary[key.Value.AssemblyQualifiedName].Add(key.Key);
			}
			ResourcesLoaded.Value = JsonConvert.SerializeObject((object)dictionary);
			VariantsLoaded.Value = JsonConvert.SerializeObject((object)PreloadedVariants);
		}

		public static T Load<T>(string path)
		{
			//IL_0045: Unknown result type (might be due to invalid IL or missing references)
			//IL_004a: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00bb: Expected O, but got Unknown
			//IL_00b6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e8: Unknown result type (might be due to invalid IL or missing references)
			KeyValuePair<string, Type> key = new KeyValuePair<string, Type>(path, typeof(T));
			if (Cache.ContainsKey(key) && Cache[key] != null)
			{
				return (T)Cache[key];
			}
			T val = (DisableLoad ? default(T) : Addressables.LoadAssetAsync<T>((object)path).WaitForCompletion());
			if (!string.IsNullOrWhiteSpace(Hooks.currentVariantName) && !Cache.ContainsKey(key))
			{
				Main.Log.LogWarning((object)"Un-preloaded asset detected, fixing");
				SaveResourceList();
			}
			Cache[key] = val;
			if (val == null)
			{
				if (val is Material)
				{
					return (T)(object)new Material(new Shader());
				}
				if (val is Texture2D)
				{
					return (T)(object)new Texture2D(1, 1);
				}
				if (val is GameObject)
				{
					return (T)(object)new GameObject();
				}
			}
			return val;
		}

		public static Material LoadRecolor(string path, Color32 color)
		{
			//IL_0003: Unknown result type (might be due to invalid IL or missing references)
			//IL_003b: Unknown result type (might be due to invalid IL or missing references)
			//IL_003c: Unknown result type (might be due to invalid IL or missing references)
			KeyValuePair<string, Color32> key = new KeyValuePair<string, Color32>(path, color);
			if (CacheRecolor.ContainsKey(key))
			{
				return CacheRecolor[key];
			}
			Material val = Load<Material>(path);
			if (!Object.op_Implicit((Object)(object)val))
			{
				return val;
			}
			Material val2 = Object.Instantiate<Material>(val);
			val2.color = Color32.op_Implicit(color);
			if (Cache[new KeyValuePair<string, Type>(path, typeof(Material))] != null)
			{
				CacheRecolor[key] = val2;
			}
			return val2;
		}

		public static void TryDestroy(string path)
		{
			GameObject val = GameObject.Find(path);
			if (Object.op_Implicit((Object)(object)val))
			{
				Object.Destroy((Object)(object)val);
			}
		}

		public static void TryDestroy(Transform parent, string path)
		{
			Transform val = parent.Find(path);
			if (Object.op_Implicit((Object)(object)val))
			{
				Object.Destroy((Object)(object)((Component)val).gameObject);
			}
		}

		public static void MeshReplaceAll(params ReplaceInstance<MeshRenderer>[] actions)
		{
			//IL_0072: Unknown result type (might be due to invalid IL or missing references)
			//IL_007c: Expected O, but got Unknown
			//IL_0077: Unknown result type (might be due to invalid IL or missing references)
			//IL_007e: Expected O, but got Unknown
			MeshRenderer[] array = Object.FindObjectsOfType(typeof(MeshRenderer)) as MeshRenderer[];
			MeshRenderer[] array2 = array;
			foreach (MeshRenderer val in array2)
			{
				if (!Object.op_Implicit((Object)(object)((Component)val).gameObject))
				{
					continue;
				}
				foreach (ReplaceInstance<MeshRenderer> replaceInstance in actions)
				{
					if (!replaceInstance.Condition(val))
					{
						continue;
					}
					for (int k = 0; k < ((Renderer)val).sharedMaterials.Length; k++)
					{
						Material val2 = ((Renderer)val).sharedMaterials[k];
						Material val3 = null;
						if (!Object.op_Implicit((Object)(object)val2))
						{
							val2 = new Material(new Shader());
						}
						if (CacheMaterial.ContainsKey(val2))
						{
							val3 = CacheMaterial[val2];
						}
						else
						{
							val3 = Object.Instantiate<Material>(val2);
							CacheMaterial[val2] = val3;
						}
						((Renderer)val).sharedMaterials[k] = val3;
					}
					replaceInstance.Action(val);
				}
			}
		}

		public static void MeshReplaceAll(MeshRenderer mr, Material material)
		{
			Material[] sharedMaterials = ((Renderer)mr).sharedMaterials;
			for (int i = 0; i < sharedMaterials.Length; i++)
			{
				sharedMaterials[i] = material;
			}
			((Renderer)mr).sharedMaterials = sharedMaterials;
		}

		public static void TryMeshReplace(MeshRenderer mr, Material material)
		{
			if (Object.op_Implicit((Object)(object)((mr != null) ? ((Renderer)mr).sharedMaterial : null)))
			{
				((Renderer)mr).sharedMaterial = material;
			}
		}

		public static void ReplaceAll<T>(params ReplaceInstance<T>[] actions) where T : Component
		{
			T[] array = Object.FindObjectsOfType(typeof(T)) as T[];
			T[] array2 = array;
			foreach (T val in array2)
			{
				if (!Object.op_Implicit((Object)(object)((Component)val).gameObject))
				{
					continue;
				}
				foreach (ReplaceInstance<T> replaceInstance in actions)
				{
					if (replaceInstance.Condition(val))
					{
						replaceInstance.Action(val);
					}
				}
			}
		}
	}
	[HarmonyPatch(typeof(SceneAssetAPI), "PrepareRequests")]
	public class RemoveLogsDuringPreload
	{
		public static void ILManipulator(ILContext il, MethodBase original, ILLabel retLabel)
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_0007: Expected O, but got Unknown
			//IL_00f2: Unknown result type (might be due to invalid IL or missing references)
			ILCursor val = new ILCursor(il);
			val.GotoNext(new Func<Instruction, bool>[1]
			{
				(Instruction x) => ILPatternMatchingExt.MatchLdstr(x, " doesnt exist, available scene names:")
			});
			ILLabel val3 = default(ILLabel);
			val.GotoNext(new Func<Instruction, bool>[1]
			{
				(Instruction x) => ILPatternMatchingExt.MatchLeaveS(x, ref val3)
			});
			ILLabel val2 = val.MarkLabel();
			val.GotoPrev(new Func<Instruction, bool>[1]
			{
				(Instruction x) => ILPatternMatchingExt.MatchLdstr(x, " doesnt exist, available scene names:")
			});
			val.GotoPrev((MoveType)1, new Func<Instruction, bool>[1]
			{
				(Instruction x) => ILPatternMatchingExt.MatchCallOrCallvirt<SceneAssetPlugin>(x, "get_Logger")
			});
			val.EmitDelegate<Func<bool>>((Func<bool>)delegate
			{
				if (Assets._temp == 0)
				{
					return false;
				}
				Assets.Tick();
				return true;
			});
			val.Emit(OpCodes.Brtrue, (object)val2);
		}
	}
	public class ConfigManager
	{
		public static ConfigFile Config;

		public static ConfigFile BackupConfig;

		public static ConfigEntry<bool> AutoUpdate;

		public static void Init()
		{
			//IL_0010: Unknown result type (might be due to invalid IL or missing references)
			//IL_001a: Expected O, but got Unknown
			//IL_002a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0034: Expected O, but got Unknown
			Config = new ConfigFile(Path.Combine(Paths.ConfigPath, "HIFU.StageAesthetic.cfg"), true);
			BackupConfig = new ConfigFile(Path.Combine(Paths.ConfigPath, "HIFU.StageAesthetic.Backup.cfg"), true);
			AutoUpdate = Config.Bind<bool>("Config", "Enable Auto Config Sync", true, "disable this to keep all default value as is instead of auto updating to future versions (manually changed value will not change regardless)");
			BackupConfig.Bind<string>(": DO NOT MODIFY THIS FILES CONTENTS :", ": DO NOT MODIFY THIS FILES CONTENTS :", ": DO NOT MODIFY THIS FILES CONTENTS :", ": DO NOT MODIFY THIS FILES CONTENTS :");
			Sprite val = Main.AssetBundle.LoadAsset<Sprite>("texModIcon.png");
			ModSettingsManager.SetModIcon(val, "StageAesthetic.TabID", "Stage Aesthetics");
			foreach (object value in Enum.GetValues(typeof(Stage)))
			{
				Stage stage = (Stage)value;
				ModSettingsManager.SetModIcon(val, $"StageAesthetic.TabID.{(int)stage}", $"SA: {stage}");
			}
		}

		public static ConfigEntry<T> Bind<T>(string category, string name, T def, string desc)
		{
			//IL_0105: Unknown result type (might be due to invalid IL or missing references)
			//IL_010a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0116: Expected O, but got Unknown
			//IL_0111: Unknown result type (might be due to invalid IL or missing references)
			//IL_0118: Expected O, but got Unknown
			//IL_011c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0121: Unknown result type (might be due to invalid IL or missing references)
			//IL_012c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0137: Unknown result type (might be due to invalid IL or missing references)
			//IL_013e: Unknown result type (might be due to invalid IL or missing references)
			//IL_014e: Expected O, but got Unknown
			//IL_0149: Unknown result type (might be due to invalid IL or missing references)
			//IL_0150: Expected O, but got Unknown
			//IL_0154: Unknown result type (might be due to invalid IL or missing references)
			//IL_0159: Unknown result type (might be due to invalid IL or missing references)
			//IL_0165: Expected O, but got Unknown
			//IL_0160: Unknown result type (might be due to invalid IL or missing references)
			//IL_0167: Expected O, but got Unknown
			ConfigEntry<T> val = Config.Bind<T>(Util.ConfigSafe(category), Util.ConfigSafe(name), def, desc);
			ConfigEntry<T> val2 = BackupConfig.Bind<T>(Util.ConfigSafe(category), Util.ConfigSafe(name), def, desc);
			if (AutoUpdate.Value && ((ConfigEntryBase)val2).BoxedValue == ((ConfigEntryBase)val).BoxedValue && ((ConfigEntryBase)val2).DefaultValue != ((ConfigEntryBase)val2).BoxedValue)
			{
				Main.Log.LogInfo((object)("Default Config Auto-Updated for " + (object)val));
				((ConfigEntryBase)val).BoxedValue = ((ConfigEntryBase)val).DefaultValue;
				((ConfigEntryBase)val2).BoxedValue = ((ConfigEntryBase)val2).DefaultValue;
			}
			int num = category.Occurance(':');
			string text = "StageAesthetic.TabID";
			string text2 = "Stage Aesthetics";
			if (num != 0)
			{
				Stage stage = (Stage)num;
				text = "StageAesthetic.TabID." + num;
				text2 = "SA: " + stage;
			}
			BaseOption val3 = null;
			if (!(val is ConfigEntry<bool> val4))
			{
				if (!(val is ConfigEntry<float> val5))
				{
					if (val is ConfigEntry<EnableConfig> val6)
					{
						val3 = (BaseOption)new ChoiceOption((ConfigEntryBase)(object)val6, new ChoiceConfig
						{
							restartRequired = true
						});
					}
					else
					{
						Main.Log.LogWarning((object)("Undefined Config Type " + typeof(T).Name + ", not added to ROO"));
					}
				}
				else
				{
					val3 = (BaseOption)new SliderOption(val5, new SliderConfig
					{
						min = 0f,
						max = 10f,
						restartRequired = true,
						FormatString = "{0:2}"
					});
				}
			}
			else
			{
				val3 = (BaseOption)new CheckBoxOption(val4, new CheckBoxConfig
				{
					restartRequired = true
				});
			}
			if (val3 != null)
			{
				ModSettingsManager.AddOption(val3, text, text2);
			}
			return val;
		}
	}
	public class Hooks
	{
		public static Dictionary<string, string> SceneNames = new Dictionary<string, string>();

		public static Dictionary<string, Stage> SceneStage = new Dictionary<string, Stage>();

		public static ConfigEntry<bool> DisplayVariantName;

		public static ConfigEntry<bool> AvoidDuplicateVariants;

		public static string currentVariantName = "";

		public static void Init()
		{
			Main.Log.LogInfo((object)"init");
			Assets.CloudRemap = Assets.Load<Shader>("RoR2/Base/Shaders/HGCloudRemap.shader");
			Assets.SnowTopped = Assets.Load<Shader>("RoR2/Base/Shaders/HGSnowTopped.shader");
			Assets.GooLakeProfile = Assets.Load<PostProcessProfile>("RoR2/Base/title/PostProcessing/ppSceneGoolake.asset");
			TitleScreen.Init();
			Weather.Init();
			DisplayVariantName = ConfigManager.Bind("General", "Display Variant Name", def: true, "Display the variant name in the stage text.");
			AvoidDuplicateVariants = ConfigManager.Bind("General", "Avoid Duplicate Variants", def: true, "Remove the variant from the pool once it is rolled until all variant for that stage is rolled.");
			Common.AddHook();
			foreach (Type item in Util.FindAllDerivedTypes<Variant>())
			{
				item.GetConstructor(Array.Empty<Type>()).Invoke(null);
			}
			Assets.Init();
		}

		public static void PostInit()
		{
			//IL_0036: Unknown result type (might be due to invalid IL or missing references)
			//IL_003b: Unknown result type (might be due to invalid IL or missing references)
			//IL_003e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0043: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00eb: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ef: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f4: Unknown result type (might be due to invalid IL or missing references)
			//IL_0048: Unknown result type (might be due to invalid IL or missing references)
			//IL_004d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0054: Unknown result type (might be due to invalid IL or missing references)
			Main.Log.LogInfo((object)"Postinit");
			Assets.DisableLoad = false;
			for (int i = 1; i <= 5; i++)
			{
				SceneCollection val = Assets.Load<SceneCollection>("RoR2/Base/SceneGroups/sgStage" + i + ".asset");
				Enumerator<SceneEntry> enumerator = val.sceneEntries.GetEnumerator();
				try
				{
					while (enumerator.MoveNext())
					{
						SceneEntry current = enumerator.Current;
						SceneStage[current.sceneDef.cachedName] = (Stage)i;
					}
				}
				finally
				{
					((IDisposable)enumerator).Dispose();
				}
			}
			string[] array = new string[6] { "moon", "moon2", "voidraid", "mysteryspace", "limbo", "BulwarksHaunt_GhostWave" };
			foreach (string key in array)
			{
				SceneStage[key] = Stage.Ending;
			}
			Enumerator<SceneDef> enumerator2 = SceneCatalog.allStageSceneDefs.GetEnumerator();
			try
			{
				while (enumerator2.MoveNext())
				{
					SceneDef current2 = enumerator2.Current;
					SceneNames[current2.cachedName] = Language.GetString(current2.nameToken).Replace(": ", " - ");
					if (!SceneStage.ContainsKey(current2.cachedName))
					{
						SceneStage[current2.cachedName] = Stage.Special;
					}
				}
			}
			finally
			{
				((IDisposable)enumerator2).Dispose();
			}
			foreach (Variant variant in Variant.Variants)
			{
				variant.InitConfig();
			}
		}

		public static void RollVariant(orig_Start orig, SceneDirector self)
		{
			Variant variant = RollVariantInternal();
			orig.Invoke(self);
			currentVariantName = (Object.op_Implicit((Object)(object)self.teleporterInstance) ? variant.Name : "");
		}

		public static Variant RollVariantInternal(string forceScene = "", string forceVariant = "")
		{
			//IL_006b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0070: Unknown result type (might be due to invalid IL or missing references)
			currentVariantName = "";
			Common.MaulingRockOverride = null;
			Common.Rocks = new Dictionary<GameObject, GameObject>();
			foreach (Material value in Assets.CacheMaterial.Values)
			{
				Object.Destroy((Object)(object)value);
			}
			Assets.CacheMaterial.Clear();
			string text;
			if (!string.IsNullOrWhiteSpace(forceScene))
			{
				text = forceScene;
			}
			else
			{
				Scene activeScene = SceneManager.GetActiveScene();
				text = ((Scene)(ref activeScene)).name;
			}
			string text2 = text;
			SceneInfo instance = SceneInfo.instance;
			PostProcessVolume val = ((instance != null) ? ((Component)instance).GetComponent<PostProcessVolume>() : null);
			string[] array = new string[4] { "PP + Amb", "PP, Global", "GlobalPostProcessVolume, Base", "PP+Amb" };
			string[] array2 = array;
			foreach (string name in array2)
			{
				val = TryAlternative(val, name);
			}
			PostProcessVolume volume = val;
			GameObject obj = GameObject.Find("MapZones");
			object alt;
			if (obj == null)
			{
				alt = null;
			}
			else
			{
				Transform transform = obj.transform;
				if (transform == null)
				{
					alt = null;
				}
				else
				{
					Transform obj2 = transform.Find("PostProcess Zones");
					if (obj2 == null)
					{
						alt = null;
					}
					else
					{
						Transform obj3 = obj2.Find("SandOvercast");
						alt = ((obj3 != null) ? ((Component)obj3).gameObject : null);
					}
				}
			}
			val = TryAlternative(volume, (GameObject)alt);
			PostProcessVolume volume2 = val;
			GameObject obj4 = GameObject.Find("MapZones");
			object alt2;
			if (obj4 == null)
			{
				alt2 = null;
			}
			else
			{
				Transform transform2 = obj4.transform;
				if (transform2 == null)
				{
					alt2 = null;
				}
				else
				{
					Transform obj5 = transform2.Find("PostProcess Zones");
					if (obj5 == null)
					{
						alt2 = null;
					}
					else
					{
						Transform obj6 = obj5.Find("Sandstorm");
						alt2 = ((obj6 != null) ? ((Component)obj6).gameObject : null);
					}
				}
			}
			val = TryAlternative(volume2, (GameObject)alt2);
			if (text2 == "moon2")
			{
				val = ((Component)instance).gameObject.AddComponent<PostProcessVolume>();
				val.profile.AddSettings<RampFog>();
				((Behaviour)val).enabled = true;
				val.isGlobal = true;
				val.priority = 9999f;
			}
			if (!Object.op_Implicit((Object)(object)val) || !((Behaviour)val).isActiveAndEnabled)
			{
				Main.Log.LogWarning((object)"PPV Not Found, skipping");
				return Variant.Vanilla;
			}
			RampFog setting = val.profile.GetSetting<RampFog>();
			ColorGrading cgrade = val.profile.GetSetting<ColorGrading>() ?? val.profile.AddSettings<ColorGrading>();
			Run instance2 = Run.instance;
			bool loop = ((instance2 != null && instance2.loopClearCount != 0) ? 1 : 0) > (false ? 1 : 0);
			Variant variant = (string.IsNullOrWhiteSpace(forceVariant) ? Variant.GetVariant(text2, loop) : Variant.GetVariant(text2, forceVariant));
			if (string.IsNullOrWhiteSpace(forceVariant))
			{
				currentVariantName = variant.Name;
				((Object)val.profile).name = "SA Profile (" + variant.Name + ")";
				if (!Assets.PreloadedVariants.ContainsKey(text2))
				{
					Assets.PreloadedVariants[text2] = new List<string>();
				}
				if (!Assets.PreloadedVariants[text2].Contains(variant.Name))
				{
					Assets.PreloadedVariants[text2].Add(variant.Name);
				}
			}
			variant.Apply(text2, setting, cgrade, val, loop);
			return variant;
		}

		public static void AppendStageToken(orig_Start orig, AssignStageToken self)
		{
			orig.Invoke(self);
			if (DisplayVariantName.Value && currentVariantName != "")
			{
				TextMeshProUGUI titleText = self.titleText;
				((TMP_Text)titleText).text = ((TMP_Text)titleText).text + " (" + currentVariantName + ")";
			}
		}

		public static PostProcessVolume TryAlternative(PostProcessVolume volume, string name)
		{
			return TryAlternative(volume, GameObject.Find(name));
		}

		public static PostProcessVolume TryAlternative(PostProcessVolume volume, GameObject alt)
		{
			if (Object.op_Implicit((Object)(object)volume) && ((Behaviour)volume).isActiveAndEnabled)
			{
				return volume;
			}
			if (Object.op_Implicit((Object)(object)alt))
			{
				return alt.GetComponent<PostProcessVolume>();
			}
			return null;
		}
	}
	[BepInPlugin("HIFU", "StageAesthetic", "1.1.1")]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	public class Main : BaseUnityPlugin
	{
		[CompilerGenerated]
		private static class <>O
		{
			public static Action <0>__PostInit;

			public static hook_Start <1>__RollVariant;

			public static hook_Start <2>__AppendStageToken;
		}

		public const string PluginGUID = "HIFU.StageAesthetic";

		public const string PluginAuthor = "HIFU";

		public const string PluginName = "StageAesthetic";

		public const string PluginVersion = "1.1.1";

		public static ManualLogSource Log;

		public static PluginInfo pluginInfo;

		public static ConfigFile Config;

		public static Harmony Harmony;

		public static Main Instance;

		private static AssetBundle _assetBundle;

		public static AssetBundle AssetBundle
		{
			get
			{
				if ((Object)(object)_assetBundle == (Object)null)
				{
					_assetBundle = AssetBundle.LoadFromFile(Path.Combine(Path.GetDirectoryName(pluginInfo.Location), "stageaesthetic"));
				}
				return _assetBundle;
			}
		}

		public void Awake()
		{
			//IL_0021: Unknown result type (might be due to invalid IL or missing references)
			//IL_002b: Expected O, but got Unknown
			//IL_0074: Unknown result type (might be due to invalid IL or missing references)
			//IL_0079: Unknown result type (might be due to invalid IL or missing references)
			//IL_007f: Expected O, but got Unknown
			//IL_0094: Unknown result type (might be due to invalid IL or missing references)
			//IL_0099: Unknown result type (might be due to invalid IL or missing references)
			//IL_009f: Expected O, but got Unknown
			Instance = this;
			pluginInfo = ((BaseUnityPlugin)this).Info;
			Log = ((BaseUnityPlugin)this).Logger;
			Harmony = new Harmony("HIFU.StageAesthetic");
			ConfigManager.Init();
			Hooks.Init();
			RoR2Application.onLoad = (Action)Delegate.Combine(RoR2Application.onLoad, new Action(Hooks.PostInit));
			object obj = <>O.<1>__RollVariant;
			if (obj == null)
			{
				hook_Start val = Hooks.RollVariant;
				<>O.<1>__RollVariant = val;
				obj = (object)val;
			}
			SceneDirector.Start += (hook_Start)obj;
			object obj2 = <>O.<2>__AppendStageToken;
			if (obj2 == null)
			{
				hook_Start val2 = Hooks.AppendStageToken;
				<>O.<2>__AppendStageToken = val2;
				obj2 = (object)val2;
			}
			AssignStageToken.Start += (hook_Start)obj2;
		}
	}
	public class Skybox
	{
		private static readonly PostProcessProfile ppHelminth = Addressables.LoadAssetAsync<PostProcessProfile>((object)"RoR2/DLC2/helminthroost/ppSceneHelminth.asset").WaitForCompletion();

		private static readonly PostProcessProfile ppScorched = Addressables.LoadAssetAsync<PostProcessProfile>((object)"RoR2/Base/title/PostProcessing/ppSceneWispGraveyard.asset").WaitForCompletion();

		private static readonly PostProcessProfile ppPlainsRoost = Object.Instantiate<PostProcessProfile>(Addressables.LoadAssetAsync<PostProcessProfile>((object)"RoR2/Base/title/PostProcessing/ppSceneGolemplainsFoggy.asset").WaitForCompletion());

		private static readonly PostProcessProfile ppSunset = Addressables.LoadAssetAsync<PostProcessProfile>((object)"RoR2/Base/title/PostProcessing/ppSceneWispGraveyard.asset").WaitForCompletion();

		private static readonly PostProcessProfile ppSick = Addressables.LoadAssetAsync<PostProcessProfile>((object)"RoR2/Base/title/PostProcessing/ppSceneMysterySpace.asset").WaitForCompletion();

		public static readonly Material sunMat = Addressables.LoadAssetAsync<Material>((object)"RoR2/DLC1/ancientloft/matAncientLoft_Sun.mat").WaitForCompletion();

		private static readonly Material sunsetSkyboxMat = Addressables.LoadAssetAsync<Material>((object)"RoR2/Base/bazaar/matSkybox4.mat").WaitForCompletion();

		private static readonly Material spaceSkyboxMat = Addressables.LoadAssetAsync<Material>((object)"RoR2/DLC1/sulfurpools/matSkyboxSP.mat").WaitForCompletion();

		private static readonly Material spaceStarsMat2 = Addressables.LoadAssetAsync<Material>((object)"RoR2/Base/eclipseworld/matEclipseStarsSpheres.mat").WaitForCompletion();

		private static readonly GameObject eclipseSkybox = PrefabAPI.InstantiateClone(Addressables.LoadAssetAsync<GameObject>((object)"RoR2/Base/eclipseworld/Weather, Eclipse.prefab").WaitForCompletion(), "SAEclipseSkybox", false);

		private static readonly GameObject noBullshitSkybox = PrefabAPI.InstantiateClone(Addressables.LoadAssetAsync<GameObject>((object)"RoR2/Base/eclipseworld/Weather, Eclipse.prefab").WaitForCompletion(), "SAEclipseSkybox", false);

		private static readonly GameObject planetariumSkybox = PrefabAPI.InstantiateClone(Addressables.LoadAssetAsync<GameObject>((object)"RoR2/DLC1/voidraid/Weather, Void Raid Starry Night Variant.prefab").WaitForCompletion(), "SADaySkybox", false);

		private static readonly GameObject voidStageSkybox = PrefabAPI.InstantiateClone(Addressables.LoadAssetAsync<GameObject>((object)"RoR2/DLC1/voidstage/Weather, Void Stage.prefab").WaitForCompletion(), "SAVoidSkybox", false);

		public static readonly GameObject sun = PrefabAPI.InstantiateClone(((Component)Addressables.LoadAssetAsync<GameObject>((object)"RoR2/DLC1/ancientloft/mdlAncientLoft_Terrain.fbx").WaitForCompletion().transform.GetChild(5).GetChild(0)).gameObject, "SASun", false);

		public static void Init()
		{
			Main.Log.LogDebug((object)new object[14]
			{
				ppHelminth, ppScorched, ppPlainsRoost, ppSunset, ppSick, sunMat, sunsetSkyboxMat, spaceSkyboxMat, spaceStarsMat2, eclipseSkybox,
				noBullshitSkybox, planetariumSkybox, voidStageSkybox, sun
			});
		}

		public static void SunnyDistantRoostSky()
		{
			//IL_0005: Unknown result type (might be due to invalid IL or missing references)
			//IL_000a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0035: Unknown result type (might be due to invalid IL or missing references)
			//IL_003a: Unknown result type (might be due to invalid IL or missing references)
			//IL_003f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0055: Unknown result type (might be due to invalid IL or missing references)
			//IL_005a: Unknown result type (might be due to invalid IL or missing references)
			//IL_005f: Unknown result type (might be due to invalid IL or missing references)
			//IL_007e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0083: Unknown result type (might be due to invalid IL or missing references)
			//IL_0088: Unknown result type (might be due to invalid IL or missing references)
			//IL_01e1: Unknown result type (might be due to invalid IL or missing references)
			//IL_01e8: Expected O, but got Unknown
			//IL_01fa: Unknown result type (might be due to invalid IL or missing references)
			//IL_0201: Expected O, but got Unknown
			GameObject val = Object.Instantiate<GameObject>(planetariumSkybox, Vector3.zero, Quaternion.identity);
			PostProcessProfile val2 = Object.Instantiate<PostProcessProfile>(ppPlainsRoost);
			RampFog setting = val2.GetSetting<RampFog>();
			((ParameterOverride<Color>)(object)setting.fogColorStart).value = Color32.op_Implicit(new Color32((byte)53, (byte)66, (byte)82, (byte)18));
			((ParameterOverride<Color>)(object)setting.fogColorMid).value = Color32.op_Implicit(new Color32((byte)103, (byte)67, (byte)64, (byte)154));
			((ParameterOverride<Color>)(object)setting.fogColorEnd).value = Color32.op_Implicit(new Color32((byte)146, (byte)176, byte.MaxValue, byte.MaxValue));
			((ParameterOverride<float>)(object)setting.fogOne).value = 0.2f;
			((ParameterOverride<float>)(object)setting.fogZero).value = -0.05f;
			((Component)val.transform.GetChild(0)).GetComponent<PostProcessVolume>().profile = val2;
			SetAmbientLight component = ((Component)val.transform.GetChild(0)).GetComponent<SetAmbientLight>();
			component.skyboxMaterial = spaceSkyboxMat;
			component.ambientIntensity = 0.75f;
			component.ApplyLighting();
			((Component)val.transform.GetChild(1)).gameObject.SetActive(false);
			((Component)val.transform.GetChild(4).GetChild(0).GetChild(2)).gameObject.SetActive(false);
			((Renderer)((Component)val.transform.GetChild(4).GetChild(0)).GetComponent<MeshRenderer>()).sharedMaterials = (Material[])(object)new Material[2] { spaceSkyboxMat, spaceStarsMat2 };
			((Component)val.transform.GetChild(4).GetChild(0).GetChild(1)
				.GetChild(6)).gameObject.SetActive(false);
			((Component)val.transform.GetChild(4).GetChild(0).GetChild(1)
				.GetChild(11)).gameObject.SetActive(false);
			foreach (Transform item in ((Component)val.transform.GetChild(4).GetChild(0).GetChild(1)).transform)
			{
				Transform val3 = item;
				foreach (Transform item2 in val3)
				{
					Transform val4 = item2;
					if (((Object)((Component)val4).gameObject).name.Contains("Opaque") || ((Object)((Component)val4).gameObject).name.Contains("Moon") || ((Object)((Component)val4).gameObject).name.Contains("Rings"))
					{
						((Component)val4).gameObject.SetActive(false);
					}
				}
			}
		}

		public static void DaySky()
		{
			//IL_0005: Unknown result type (might be due to invalid IL or missing references)
			//IL_000a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0015: Unknown result type (might be due to invalid IL or missing references)
			//IL_001a: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0033: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c8: Unknown result type (might be due to invalid IL or missing references)
			//IL_00cd: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ea: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ef: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f4: Unknown result type (might be due to invalid IL or missing references)
			//IL_0109: Unknown result type (might be due to invalid IL or missing references)
			//IL_010e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0113: Unknown result type (might be due to invalid IL or missing references)
			//IL_0047: Unknown result type (might be due to invalid IL or missing references)
			//IL_004c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0060: Unknown result type (might be due to invalid IL or missing references)
			//IL_0065: Unknown result type (might be due to invalid IL or missing references)
			//IL_0275: Unknown result type (might be due to invalid IL or missing references)
			//IL_027c: Expected O, but got Unknown
			//IL_028e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0295: Expected O, but got Unknown
			GameObject val = Object.Instantiate<GameObject>(planetariumSkybox, Vector3.zero, Quaternion.identity);
			Scene activeScene = SceneManager.GetActiveScene();
			if (!(((Scene)(ref activeScene)).name == "snowyforest"))
			{
				activeScene = SceneManager.GetActiveScene();
				if (!(((Scene)(ref activeScene)).name == "foggyswamp"))
				{
					activeScene = SceneManager.GetActiveScene();
					if (!(((Scene)(ref activeScene)).name == "frozenwall"))
					{
						activeScene = SceneManager.GetActiveScene();
						if (!(((Scene)(ref activeScene)).name == "skymeadow"))
						{
							((Component)val.transform.GetChild(0)).GetComponent<PostProcessVolume>().profile = ppPlainsRoost;
							goto IL_00ac;
						}
					}
				}
			}
			Object.Destroy((Object)(object)((Component)val.transform.GetChild(0)).GetComponent<PostProcessVolume>());
			goto IL_00ac;
			IL_00ac:
			RampFog setting = ppPlainsRoost.GetSetting<RampFog>();
			((ParameterOverride<Color>)(object)setting.fogColorStart).value = Color32.op_Implicit(new Color32((byte)127, (byte)127, (byte)153, (byte)25));
			((ParameterOverride<Color>)(object)setting.fogColorMid).value = Color32.op_Implicit(new Color32((byte)0, (byte)106, (byte)145, (byte)150));
			((ParameterOverride<Color>)(object)setting.fogColorEnd).value = Color32.op_Implicit(new Color32((byte)0, (byte)115, (byte)119, byte.MaxValue));
			((ParameterOverride<float>)(object)setting.fogZero).value = -0.01f;
			((ParameterOverride<float>)(object)setting.fogOne).value = 0.15f;
			((ParameterOverride<float>)(object)setting.fogPower).value = 2f;
			((ParameterOverride<float>)(object)setting.skyboxStrength).value = 0.1f;
			SetAmbientLight component = ((Component)val.transform.GetChild(0)).GetComponent<SetAmbientLight>();
			component.skyboxMaterial = spaceSkyboxMat;
			component.ambientIntensity = 1f;
			component.ApplyLighting();
			((Component)val.transform.GetChild(1)).gameObject.SetActive(false);
			((Component)val.transform.GetChild(4).GetChild(0).GetChild(2)).gameObject.SetActive(false);
			((Renderer)((Component)val.transform.GetChild(4).GetChild(0)).GetComponent<MeshRenderer>()).sharedMaterials = (Material[])(object)new Material[2] { spaceSkyboxMat, spaceStarsMat2 };
			((Component)val.transform.GetChild(4).GetChild(0).GetChild(1)
				.GetChild(6)).gameObject.SetActive(false);
			((Component)val.transform.GetChild(4).GetChild(0).GetChild(1)
				.GetChild(11)).gameObject.SetActive(false);
			foreach (Transform item in ((Component)val.transform.GetChild(4).GetChild(0).GetChild(1)).transform)
			{
				Transform val2 = item;
				foreach (Transform item2 in val2)
				{
					Transform val3 = item2;
					if (((Object)((Component)val3).gameObject).name.Contains("Opaque") || ((Object)((Component)val3).gameObject).name.Contains("Moon") || ((Object)((Component)val3).gameObject).name.Contains("Rings"))
					{
						((Component)val3).gameObject.SetActive(false);
					}
				}
			}
		}

		public static void SunsetSky()
		{
			//IL_0019: Unknown result type (might be due to invalid IL or missing references)
			//IL_001e: Unknown result type (might be due to invalid IL or missing references)
			//IL_002b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0030: Unknown result type (might be due to invalid IL or missing references)
			//IL_0071: Unknown result type (might be due to invalid IL or missing references)
			//IL_0076: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00bc: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ab: Unknown result type (might be due to invalid IL or missing references)
			//IL_011d: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f1: Unknown result type (might be due to invalid IL or missing references)
			//IL_0142: Unknown result type (might be due to invalid IL or missing references)
			//IL_0147: Unknown result type (might be due to invalid IL or missing references)
			//IL_0457: Unknown result type (might be due to invalid IL or missing references)
			//IL_0476: Unknown result type (might be due to invalid IL or missing references)
			//IL_0495: Unknown result type (might be due to invalid IL or missing references)
			//IL_03ef: Unknown result type (might be due to invalid IL or missing references)
			//IL_040e: Unknown result type (might be due to invalid IL or missing references)
			//IL_042d: 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_04ef: Unknown result type (might be due to invalid IL or missing references)
			//IL_05bc: Unknown result type (might be due to invalid IL or missing references)
			//IL_05fe: Unknown result type (might be due to invalid IL or missing references)
			//IL_061d: Unknown result type (might be due to invalid IL or missing references)
			//IL_063c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0554: Unknown result type (might be due to invalid IL or missing references)
			//IL_0573: Unknown result type (might be due to invalid IL or missing references)
			//IL_0592: Unknown result type (might be due to invalid IL or missing references)
			//IL_0351: Unknown result type (might be due to invalid IL or missing references)
			//IL_0370: Unknown result type (might be due to invalid IL or missing references)
			//IL_038f: 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_02f1: Unknown result type (might be due to invalid IL or missing references)
			((Renderer)sun.GetComponent<MeshRenderer>()).sharedMaterial = sunMat;
			GameObject val = Object.Instantiate<GameObject>(planetariumSkybox, Vector3.zero, Quaternion.identity);
			GameObject val2 = null;
			Scene activeScene = SceneManager.GetActiveScene();
			if (((Scene)(ref activeScene)).name != "ancientloft")
			{
				val2 = Object.Instantiate<GameObject>(sun, val.transform);
			}
			((Component)val.transform.GetChild(0)).GetComponent<PostProcessVolume>().profile = ppScorched;
			activeScene = SceneManager.GetActiveScene();
			if (((Scene)(ref activeScene)).name == "ancientloft")
			{
				((Component)val.transform.GetChild(1)).GetComponent<Light>().color = new Color(0.75f, 0.25f, 0.25f);
			}
			else
			{
				activeScene = SceneManager.GetActiveScene();
				if (((Scene)(ref activeScene)).name == "shipgraveyard")
				{
					((Component)val.transform.GetChild(1)).GetComponent<Light>().color = new Color(1f, 0.75f, 0.75f);
				}
				else
				{
					((Component)val.transform.GetChild(1)).GetComponent<Light>().color = new Color(1f, 0.5f, 0.5f);
				}
			}
			((Component)val.transform.GetChild(1)).GetComponent<Light>().intensity = 2f;
			activeScene = SceneManager.GetActiveScene();
			switch (((Scene)(ref activeScene)).name)
			{
			case "snowyforest":
				((Component)val.transform.GetChild(1)).gameObject.SetActive(false);
				val2.transform.localPosition = new Vector3(-225f, 600f, -500f);
				val2.transform.rotation = Quaternion.Euler(0f, 90f, 0f);
				break;
			case "golemplains":
				((Component)val.transform.GetChild(1)).GetComponent<Light>().intensity = 3f;
				((Component)val.transform.GetChild(1)).GetComponent<Light>().shadowStrength = 0.75f;
				val.transform.GetChild(1).rotation = Quaternion.Euler(40f, 90f, 211f);
				val2.transform.localPosition = new Vector3(-500f, 0f, -500f);
				val2.transform.rotation = Quaternion.Euler(0f, 180f, 0f);
				break;
			case "golemplains2":
				((Component)val.transform.GetChild(1)).GetComponent<Light>().intensity = 3f;
				((Component)val.transform.GetChild(1)).GetComponent<Light>().shadowStrength = 0.75f;
				val.transform.GetChild(1).rotation = Quaternion.Euler(40f, 180f, 211f);
				val2.transform.localPosition = new Vector3(500f, 300f, 2000f);
				val2.transform.rotation = Quaternion.Euler(0f, 270f, 0f);
				break;
			case "goolake":
				val.transform.GetChild(1).rotation = Quaternion.Euler(40f, 330f, 211f);
				val2.transform.localPosition = new Vector3(500f, 100f, -250f);
				val2.transform.rotation = Quaternion.Euler(0f, 30f, 0f);
				break;
			case "foggyswamp":
				((Component)val.transform.GetChild(1)).gameObject.SetActive(false);
				val2.transform.localPosition = new Vector3(1000f, 0f, -1000f);
				val2.transform.rotation = Quaternion.Euler(0f, 80f, 0f);
				break;
			case "wispgraveyard":
				((Component)val.transform.GetChild(1)).GetComponent<Light>().intensity = 3f;
				((Component)val.transform.GetChild(1)).GetComponent<Light>().shadowStrength = 0.75f;
				break;
			case "frozenwall":
				val.transform.GetChild(1).rotation = Quaternion.Euler(40f, 90f, 211f);
				val2.transform.localPosition = new Vector3(-3000f, 100f, -30f);
				val2.transform.rotation = Quaternion.Euler(0f, 180f, 0f);
				break;
			case "ancientloft":
				val.transform.GetChild(1).eulerAngles = new Vector3(60f, 90f, 0f);
				((Component)val.transform.GetChild(1)).GetComponent<Light>().intensity = 3f;
				break;
			case "shipgraveyard":
				val.transform.GetChild(1).rotation = Quaternion.Euler(30f, 0f, 0f);
				val2.transform.localPosition = new Vector3(-1000f, 350f, -1000f);
				val2.transform.rotation = Quaternion.Euler(0f, 80f, 0f);
				break;
			}
			SetAmbientLight component = ((Component)val.transform.GetChild(0)).GetComponent<SetAmbientLight>();
			component.skyboxMaterial = sunsetSkyboxMat;
			component.ambientIntensity = 1f;
			component.ApplyLighting();
			((Component)val.transform.GetChild(4).GetChild(0).GetChild(2)).gameObject.SetActive(false);
			((Renderer)((Component)val.transform.GetChild(4).GetChild(0)).GetComponent<MeshRenderer>()).sharedMaterials = (Material[])(object)new Material[1] { sunsetSkyboxMat };
			((Component)val.transform.GetChild(4).GetChild(0).GetChild(1)
				.GetChild(6)).gameObject.SetActive(false);
			((Component)val.transform.GetChild(4).GetChild(0).GetChild(1)
				.GetChild(11)).gameObject.SetActive(false);
			((Component)val.transform.GetChild(4).GetChild(0).GetChild(1)).gameObject.SetActive(false);
		}

		public static void NightSkyNoBullshit(bool moon = true)
		{
			//IL_0005: Unknown result type (might be due to invalid IL or missing references)
			//IL_000a: Unknown result type (might be due to invalid IL or missing references)
			GameObject val = Object.Instantiate<GameObject>(noBullshitSkybox, Vector3.zero, Quaternion.identity);
			Transform transform = val.transform;
			((Component)transform.GetChild(0)).gameObject.SetActive(false);
			((Component)transform.GetChild(1)).gameObject.SetActive(false);
			((Component)transform.GetChild(2)).gameObject.SetActive(false);
			((Component)transform.GetChild(3).Find("Sphere, Moon")).gameObject.SetActive(moon);
		}

		public static void NightSky(bool fuckOffPP = false, bool fuckOffLight = false, float sunLightIntensity = 100f)
		{
			//IL_0005: Unknown result type (might be due to invalid IL or missing references)
			//IL_000a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0074: Unknown result type (might be due to invalid IL or missing references)
			//IL_007e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0083: Unknown result type (might be due to invalid IL or missing references)
			GameObject val = Object.Instantiate<GameObject>(eclipseSkybox, Vector3.zero, Quaternion.identity);
			Light component = ((Component)val.transform.GetChild(1)).GetComponent<Light>();
			if (fuckOffPP)
			{
				((Component)val.transform.GetChild(2)).GetComponent<PostProcessVolume>().weight = 0f;
			}
			if (fuckOffLight)
			{
				((Component)val.transform.GetChild(1)).gameObject.SetActive(false);
			}
			component.color = new Color(0.8f, 0.8f, 1f, 1f);
			Scene activeScene = SceneManager.GetActiveScene();
			string name = ((Scene)(ref activeScene)).name;
			if (name == "dampcavesimple")
			{
				component.intensity = 1.25f;
			}
			else if (name == "moon2")
			{
				component.intensity = 0.25f;
			}
			else
			{
				component.intensity = 1f;
			}
			component.shadowStrength = 0.5f;
			((Component)val.transform.GetChild(2)).GetComponent<PostProcessVolume>().profile = ppSick;
			if (name == "moon2")
			{
				((Component)val.transform.GetChild(2)).GetComponent<PostProcessVolume>().priority = 9999f;
			}
			SetAmbientLight component2 = ((Component)val.transform.GetChild(2)).GetComponent<SetAmbientLight>();
			if (name == "blackbeach" || name == "blackbeach2")
			{
				component2.ambientIntensity = 1.25f;
			}
			else
			{
				component2.ambientIntensity = 1f;
			}
			switch (name)
			{
			case "frozenwall":
			case "snowyforest":
			case "moon2":
				component2.ambientIntensity = 0.5f;
				break;
			}
			if (sunLightIntensity <= 5f)
			{
				component.intensity = sunLightIntensity;
			}
			component2.ApplyLighting();
			((Component)val.transform.GetChild(0)).GetComponent<ReflectionProbe>().Reset();
			((Component)val.transform.GetChild(3).GetChild(2)).gameObject.SetActive(true);
		}

		public static void VoidSky()
		{
			//IL_0034: Unknown result type (might be due to invalid IL or missing references)
			//IL_0039: Unknown result type (might be due to invalid IL or missing references)
			//IL_0048: Unknown result type (might be due to invalid IL or missing references)
			//IL_004d: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ca: Unknown result type (might be due to invalid IL or missing references)
			//IL_00eb: Unknown result type (might be due to invalid IL or missing references)
			//IL_01d1: Unknown result type (might be due to invalid IL or missing references)
			//IL_01d6: Unknown result type (might be due to invalid IL or missing references)
			//IL_010c: Unknown result type (might be due to invalid IL or missing references)
			//IL_01eb: Unknown result type (might be due to invalid IL or missing references)
			//IL_01f0: Unknown result type (might be due to invalid IL or missing references)
			//IL_012d: Unknown result type (might be due to invalid IL or missing references)
			GameObject val = GameObject.Find("Directional Light (SUN)");
			GameObject val2 = GameObject.Find("Reflection Probe");
			if (Object.op_Implicit((Object)(object)val))
			{
				val.SetActive(false);
			}
			if (Object.op_Implicit((Object)(object)val2))
			{
				val2.SetActive(false);
			}
			Scene activeScene = SceneManager.GetActiveScene();
			string name = ((Scene)(ref activeScene)).name;
			GameObject val3 = Object.Instantiate<GameObject>(voidStageSkybox, Vector3.zero, Quaternion.identity);
			switch (name)
			{
			case "lakes":
				val3.transform.eulerAngles = new Vector3(45f, 180f, 180f);
				break;
			case "blackbeach":
				val3.transform.eulerAngles = new Vector3(30f, 0f, 220f);
				break;
			case "snowyforest":
				val3.transform.eulerAngles = new Vector3(0f, 100f, 140f);
				break;
			case "sulfurpools":
				val3.transform.eulerAngles = new Vector3(0f, 180f, 140f);
				break;
			default:
				val3.transform.Rotate(new Vector3(180f, 0f, 0f));
				break;
			}
			if (name == "goolake")
			{
				((Component)val3.transform.GetChild(0).GetChild(1)).GetComponent<Light>().intensity = 3f;
			}
			else if (name == "sulfurpools")
			{
				((Component)val3.transform.GetChild(0).GetChild(1)).GetComponent<Light>().intensity = 1.5f;
			}
			else
			{
				((Component)val3.transform.GetChild(0).GetChild(1)).GetComponent<Light>().intensity = 1f;
			}
			SetAmbientLight component = ((Component)val3.transform.GetChild(0).GetChild(0)).GetComponent<SetAmbientLight>();
			activeScene = SceneManager.GetActiveScene();
			if (((Scene)(ref activeScene)).name != "frozenwall")
			{
				activeScene = SceneManager.GetActiveScene();
				if (((Scene)(ref activeScene)).name != "snowyforest")
				{
					component.ambientIntensity = 0.75f;
					goto IL_021f;
				}
			}
			component.ambientIntensity = 1f;
			goto IL_021f;
			IL_021f:
			component.ApplyLighting();
		}

		public static void SingularitySky()
		{
			//IL_0039: Unknown result type (might be due to invalid IL or missing references)
			//IL_003e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0049: Unknown result type (might be due to invalid IL or missing references)
			//IL_004e: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ef: Unknown result type (might be due to invalid IL or missing references)
			//IL_0078: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a3: Unknown result type (might be due to invalid IL or missing references)
			GameObject val = GameObject.Find("Directional Light (SUN)");
			GameObject val2 = GameObject.Find("Reflection Probe");
			if (Object.op_Implicit((Object)(object)val))
			{
				val.SetActive(false);
			}
			if (Object.op_Implicit((Object)(object)val2))
			{
				val2.SetActive(false);
			}
			GameObject val3 = Object.Instantiate<GameObject>(voidStageSkybox, Vector3.zero, Quaternion.identity);
			Scene activeScene = SceneManager.GetActiveScene();
			if (((Scene)(ref activeScene)).name != "wispgraveyard")
			{
				val3.transform.Rotate(new Vector3(0f, 0f, 70f));
				val3.transform.GetChild(0).GetChild(1).localRotation = Quaternion.Euler(0f, 280f, 180f);
			}
			else
			{
				val3.transform.Rotate(new Vector3(60f, 0f, 0f));
				val3.transform.GetChild(0).GetChild(1).localRotation = Quaternion.Euler(60f, 0f, 0f);
			}
			((Component)val3.transform.GetChild(0).GetChild(1)).GetComponent<Light>().intensity = 2f;
			SetAmbientLight component = ((Component)val3.transform.GetChild(0).GetChild(0)).GetComponent<SetAmbientLight>();
			component.ambientIntensity = 1f;
			component.ApplyLighting();
		}
	}
	public class TitleScreen
	{
		public static ConfigEntry<bool> Enable;

		public static void Init()
		{
			Enable = ConfigManager.Bind("General", "Alter title screen?", def: true, "Adds rain, patches of grass, particles and brings a Commando closer to focus.");
			SceneManager.sceneLoaded += Hook;
		}

		public static void Hook(Scene scene, LoadSceneMode mode)
		{
			//IL_00a1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a9: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ae: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b4: Unknown result type (might be due to invalid IL or missing references)
			//IL_011a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0124: Unknown result type (might be due to invalid IL or missing references)
			//IL_012c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0131: Unknown result type (might be due to invalid IL or missing references)
			//IL_0173: Unknown result type (might be due to invalid IL or missing references)
			if (!(((Scene)(ref scene)).name != "title") && Enable.Value)
			{
				Transform transform = GameObject.Find("MainMenu").transform;
				Transform transform2 = GameObject.Find("HOLDER: Title Background").transform;
				((Component)transform2.Find("Terrain")).gameObject.SetActive(true);
				((Component)transform2.Find("CamDust")).gameObject.SetActive(true);
				ParticleSystem component = ((Component)transform.Find("MENU: Title").Find("World Position").Find("CameraPositionMarker")
					.Find("Rain")).gameObject.GetComponent<ParticleSystem>();
				EmissionModule emission = component.emission;
				MinMaxCurve rateOverTime = ((EmissionModule)(ref emission)).rateOverTime;
				MinMaxCurve rateOverTime2 = default(MinMaxCurve);
				((MinMaxCurve)(ref rateOverTime2)).constant = 100f;
				((MinMaxCurve)(ref rateOverTime2)).constantMax = 100f;
				((MinMaxCurve)(ref rateOverTime2)).constantMin = 60f;
				((MinMaxCurve)(ref rateOverTime2)).curve = ((MinMaxCurve)(ref rateOverTime)).curve;
				((MinMaxCurve)(ref rateOverTime2)).curveMax = ((MinMaxCurve)(ref rateOverTime)).curveMax;
				((MinMaxCurve)(ref rateOverTime2)).curveMin = ((MinMaxCurve)(ref rateOverTime)).curveMax;
				((MinMaxCurve)(ref rateOverTime2)).curveMultiplier = ((MinMaxCurve)(ref rateOverTime)).curveMultiplier;
				((MinMaxCurve)(ref rateOverTime2)).mode = ((MinMaxCurve)(ref rateOverTime)).mode;
				((EmissionModule)(ref emission)).rateOverTime = rateOverTime2;
				ColorOverLifetimeModule colorOverLifetime = component.colorOverLifetime;
				((ColorOverLifetimeModule)(ref colorOverLifetime)).enabled = false;
				transform.Find("MENU: Title").Find("World Position").Find("CameraPositionMarker")
					.Find("Rain")
					.eulerAngles = new Vector3(80f, 90f, 0f);
				WindZone component2 = ((Component)GameObject.Find("HOLDER: Title Background").transform.Find("FX").Find("WindZone")).gameObject.GetComponent<WindZone>();
				component2.windMain = 0.5f;
				component2.windTurbulence = 1f;
				Weather.StopSounds();
				Weather.PlaySound(SoundType.Wind);
			}
		}
	}
	public static class Util
	{
		public static T? TryFind<T>(this IEnumerable<T> arr, Predicate<T> match)
		{
			List<T> list = arr.ToList();
			int num = list.FindIndex(match);
			if (num == -1)
			{
				return default(T);
			}
			return list[num];
		}

		public static int Occurance(this string str, char c)
		{
			return str.Occurance(c.ToString());
		}

		public static int Occurance(this string str, string substr)
		{
			int num = 0;
			int num2 = str.IndexOf(substr);
			int num3 = 0;
			while (num2 != -1)
			{
				num3 = num2 + 1;
				num++;
				num2 = str.IndexOf(substr, num3);
			}
			return num;
		}

		public static List<Type> FindAllDerivedTypes<T>()
		{
			return FindAllDerivedTypes<T>(Assembly.GetAssembly(typeof(T)));
		}

		public static List<Type> FindAllDerivedTypes<T>(Assembly assembly)
		{
			Type baseType = typeof(T);
			return (from t in assembly.GetTypes()
				where t != baseType && baseType.IsAssignableFrom(t)
				select t).ToList();
		}

		public static Transform GetDescendant(this Transform parent, params int[] idx)
		{
			Transform val = parent;
			foreach (int num in idx)
			{
				val = val.GetChild(num);
			}
			return val;
		}

		public static string ConfigSafe(string e)
		{
			return e.Replace("\n", " ").Replace("\t", " ").Replace("\n", "")
				.Replace("\\", "/")
				.Replace("\"", "``")
				.Replace("'", "`")
				.Replace("[", "(")
				.Replace("]", ")");
		}
	}
	public enum Stage
	{
		Stage1 = 1,
		Stage2,
		Stage3,
		Stage4,
		Stage5,
		Special,
		Ending
	}
	public class Weather
	{
		public struct WeatherData
		{
			public float magnitudeMin;

			public float magnitudeMax;

			public float speedMin;

			public float speedMax;

			public float angleMin;

			public float angleMax;

			public readonly float Magnitude => Run.instance.runRNG.RangeFloat(magnitudeMin, magnitudeMax);

			public readonly float Speed => Run.instance.runRNG.RangeFloat(speedMin, speedMax);

			public readonly float Angle => Run.instance.runRNG.RangeFloat(angleMin, angleMax);

			public WeatherData(float magnitudeMin, float magnitudeMax, float speedMin, float speedMax, float angle)
			{
				this.magnitudeMin = magnitudeMin;
				this.magnitudeMax = magnitudeMax;
				this.speedMin = speedMin;
				this.speedMax = speedMax;
				angleMin = angle;
				angleMax = angle;
			}
		}

		public static GameObject Rain;

		public static GameObject Snow;

		public static GameObject Sand;

		public static ConfigEntry<EnableConfig> WeatherEnable;

		public static ConfigEntry<bool> WeatherSound;

		public static void Init()
		{
			//IL_002d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0064: Unknown result type (might be due to invalid IL or missing references)
			Rain = Main.AssetBundle.LoadAsset<GameObject>("Stage Aesthetic Rain.prefab");
			Rain.transform.eulerAngles = new Vector3(90f, 0f, 0f);
			Snow = Main.AssetBundle.LoadAsset<GameObject>("Stage Aesthetic Snow.prefab");
			Snow.transform.eulerAngles = new Vector3(90f, 0f, 0f);
			Sand = Main.AssetBundle.LoadAsset<GameObject>("Stage Aesthetic Sand.prefab");
			WeatherEnable = ConfigManager.Bind("General", "Global Weather Enable", EnableConfig.Enable, "Adds/swaps rain/snow/sand for stages. Disabling this is recommended if performance is a big issue. Starstorm 2 compatibility coming soon.");
			WeatherSound = ConfigManager.Bind("General", "Use weather sound effects?", def: true, "Adds sound effects for weather.");
		}

		public static void PlaySound(SoundType soundType)
		{
			if (WeatherSound.Value)
			{
				string text;
				switch (soundType)
				{
				case SoundType.None:
					return;
				case SoundType.DayNature:
					text = "Play_SA_birds";
					break;
				case SoundType.Rain:
					text = "Play_SA_rain";
					break;
				case SoundType.Thunder:
					text = "Play_SA_thunder";
					break;
				case SoundType.NightNature:
					text = "Play_SA_night";
					break;
				case SoundType.WaterStream:
					text = "Play_SA_water";
					break;
				case SoundType.Wind:
					text = "Play_SA_wind";
					break;
				case SoundType.Void:
					text = "Play_SA_void";
					break;
				default:
					text = "Play_SA_wind";
					break;
				}
				string text2 = text;
				Util.PlaySound(text2, ((Component)RoR2Application.instance).gameObject);
			}
		}

		public static void StopSounds()
		{
			Util.PlaySound("Stop_SA_birds", ((Component)RoR2Application.instance).gameObject);
			Util.PlaySound("Stop_SA_rain", ((Component)RoR2Application.instance).gameObject);
			Util.PlaySound("Stop_SA_thunder", ((Component)RoR2Application.instance).gameObject);
			Util.PlaySound("Stop_SA_night", ((Component)RoR2Application.instance).gameObject);
			Util.PlaySound("Stop_SA_water", ((Component)RoR2Application.instance).gameObject);
			Util.PlaySound("Stop_SA_wind", ((Component)RoR2Application.instance).gameObject);
			Util.PlaySound("Stop_SA_void", ((Component)RoR2Application.instance).gameObject);
		}

		public static void AddRain(Intensity intensity, bool bloodRain = false)
		{
			//IL_00be: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ac: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c3: Unknown result type (might be due to invalid IL or missing references)
			//IL_0186: Unknown result type (might be due to invalid IL or missing references)
			//IL_01f7: Unknown result type (might be due to invalid IL or missing references)
			//IL_01fc: Unknown result type (might be due to invalid IL or missing references)
			//IL_020c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0238: Unknown result type (might be due to invalid IL or missing references)
			//IL_023d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0241: Unknown result type (might be due to invalid IL or missing references)
			//IL_0246: Unknown result type (might be due to invalid IL or missing references)
			//IL_026b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0270: Unknown result type (might be due to invalid IL or missing references)
			//IL_0287: Unknown result type (might be due to invalid IL or missing references)
			//IL_0296: Unknown result type (might be due to invalid IL or missing references)
			//IL_029b: Unknown result type (might be due to invalid IL or missing references)
			if (Object.op_Implicit((Object)(object)Rain) && Object.op_Implicit((Object)(object)Run.instance))
			{
				if (!Object.op_Implicit((Object)(object)Rain.GetComponent<StageAestheticWeatherController>()))
				{
					Rain.AddComponent<StageAestheticWeatherController>();
				}
				GameObject gameObject = ((Component)Rain.transform.GetChild(0)).gameObject;
				ParticleSystemRenderer component = gameObject.GetComponent<ParticleSystemRenderer>();
				Material material = ((Renderer)component).material;
				material.shader = Assets.CloudRemap;
				material.EnableKeyword("DISABLEREMAP");
				material.SetFloat("_DstBlend", 10f);
				material.SetFloat("_SrcBlend", 5f);
				material.SetColor("_TintColor", Color32.op_Implicit(bloodRain ? new Color32((byte)72, (byte)36, (byte)36, byte.MaxValue) : new Color32((byte)166, (byte)166, (byte)166, byte.MaxValue)));
				WeatherData weatherData = intensity switch
				{
					Intensity.Mild => new WeatherData(270f, 300f, 110f, 120f, 6f), 
					Intensity.Medium => new WeatherData(310f, 340f, 130f, 140f, 10f), 
					Intensity.Heavy => new WeatherData(350f, 380f, 150f, 160f, 14f), 
					Intensity.Extreme => new WeatherData(390f, 420f, 170f, 180f, 19f), 
					_ => default(WeatherData), 
				};
				float scalingValue = DifficultyCatalog.GetDifficultyDef(Run.instance.selectedDifficulty).scalingValue;
				float difficultyCoefficient = Run.instance.difficultyCoefficient;
				float num = weatherData.Magnitude + Mathf.Sqrt(scalingValue * 2500f) + Mathf.Sqrt(difficultyCoefficient * 20f);
				float num2 = weatherData.Speed + Mathf.Sqrt(scalingValue * 2500f) + Mathf.Sqrt(difficultyCoefficient * 20f);
				ParticleSystem component2 = gameObject.GetComponent<ParticleSystem>();
				MainModule main = component2.main;
				((MainModule)(ref main)).startSpeed = MinMaxCurve.op_Implicit(Mathf.Min(1000f, num2));
				((MainModule)(ref main)).maxParticles = Mathf.Min(5000000, 100000 + (int)(num * 30f));
				EmissionModule emission = component2.emission;
				MinMaxCurve rateOverTime = ((EmissionModule)(ref emission)).rateOverTime;
				((MinMaxCurve)(ref rateOverTime)).mode = (ParticleSystemCurveMode)0;
				((MinMaxCurve)(ref rateOverTime)).constant = Mathf.Min(10000f, 800f + num);
				ShapeModule shape = component2.shape;
				((ShapeModule)(ref shape)).rotation = new Vector3(weatherData.Angle, 0f, weatherData.Angle);
				Object.Instantiate<GameObject>(Rain, Vector3.zero, Quaternion.identity);
			}
		}

		public static void AddSnow(Intensity intensity, float heightOverride = 150f)
		{
			//IL_005c: Unknown result type (might be due to invalid IL or missing references)
			//IL_01b6: Unknown result type (might be due to invalid IL or missing references)
			//IL_021b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0220: Unknown result type (might be due to invalid IL or missing references)
			//IL_0230: Unknown result type (might be due to invalid IL or missing references)
			//IL_025c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0261: Unknown result type (might be due to invalid IL or missing references)
			//IL_0265: Unknown result type (might be due to invalid IL or missing references)
			//IL_026a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0289: Unknown result type (might be due to invalid IL or missing references)
			//IL_028e: Unknown result type (might be due to invalid IL or missing references)
			//IL_02a5: Unknown result type (might be due to invalid IL or missing references)
			//IL_02b4: Unknown result type (might be due to invalid IL or missing references)
			//IL_02b9: Unknown result type (might be due to invalid IL or missing references)
			if (Object.op_Implicit((Object)(object)Snow) && Object.op_Implicit((Object)(object)Run.instance))
			{
				if (!Object.op_Implicit((Object)(object)Snow.GetComponent<StageAestheticWeatherController>()))
				{
					Snow.AddComponent<StageAestheticWeatherController>();
				}
				GameObject gameObject = ((Component)Snow.transform.GetChild(0)).gameObject;
				gameObject.transform.localPosition = new Vector3(0f, heightOverride, 0f);
				GameObject gameObject2 = ((Component)gameObject.transform.GetChild(0)).gameObject;
				Material material = ((Renderer)gameObject.GetComponent<ParticleSystemRenderer>()).material;
				material.shader = Assets.CloudRemap;
				material.EnableKeyword("DISABLEREMAP");
				material.SetFloat("_DstBlend", 10f);
				material.SetFloat("_SrcBlend", 5f);
				Material material2 = ((Renderer)gameObject2.GetComponent<ParticleSystemRenderer>()).material;
				material2.shader = Assets.CloudRemap;
				material2.EnableKeyword("DISABLEREMAP");
				material2.SetFloat("_DstBlend", 10f);
				material2.SetFloat("_SrcBlend", 5f);
				WeatherData weatherData = intensity switch
				{
					Intensity.Mild => new WeatherData(600f, 800f, 12f, 16f, 7f), 
					Intensity.Medium => new WeatherData(1400f, 1700f, 17f, 21f, 12f), 
					Intensity.Heavy => new WeatherData(2300f, 2800f, 22f, 28f, 17f), 
					Intensity.Extreme => new WeatherData(3400f, 3800f, 29f, 33f, 25f), 
					_ => default(WeatherData), 
				};
				float scalingValue = DifficultyCatalog.GetDifficultyDef(Run.instance.selectedDifficulty).scalingValue;
				float difficultyCoefficient = Run.instance.difficultyCoefficient;
				float num = weatherData.Magnitude + Mathf.Sqrt(scalingValue * 2500f) + Mathf.Sqrt(difficultyCoefficient * 20f);
				float num2 = weatherData.Speed + Mathf.Sqrt(scalingValue) + Mathf.Sqrt(difficultyCoefficient);
				ParticleSystem component = gameObject.GetComponent<ParticleSystem>();
				MainModule main = component.main;
				((MainModule)(ref main)).startSpeed = MinMaxCurve.op_Implicit(Mathf.Min(1000f, num2));
				((MainModule)(ref main)).maxParticles = Mathf.Min(5000000, 100000 + (int)(num * 5f));
				EmissionModule emission = component.emission;
				MinMaxCurve rateOverTime = ((EmissionModule)(ref emission)).rateOverTime;
				((MinMaxCurve)(ref rateOverTime)).mode = (ParticleSystemCurveMode)0;
				((MinMaxCurve)(ref rateOverTime)).constant = Mathf.Min(10000f, num);
				ShapeModule shape = component.shape;
				((ShapeModule)(ref shape)).rotation = new Vector3(weatherData.Angle, 0f, weatherData.Angle);
				Object.Instantiate<GameObject>(Snow, Vector3.zero, Quaternion.identity);
			}
		}

		public static void AddSand(Intensity intensity)
		{
			//IL_0146: Unknown result type (might be due to invalid IL or missing references)
			//IL_01b4: Unknown result type (might be due to invalid IL or missing references)
			//IL_01b9: Unknown result type (might be due to invalid IL or missing references)
			//IL_01c9: Unknown result type (might be due to invalid IL or missing references)
			//IL_01f5: Unknown result type (might be due to invalid IL or missing references)
			//IL_01fa: Unknown result type (might be due to invalid IL or missing references)
			//IL_01fe: Unknown result type (might be due to invalid IL or missing references)
			//IL_0203: Unknown result type (might be due to invalid IL or missing references)
			//IL_0222: Unknown result type (might be due to invalid IL or missing references)
			//IL_0227: Unknown result type (might be due to invalid IL or missing references)
			//IL_023e: Unknown result type (might be due to invalid IL or missing references)
			//IL_024d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0252: Unknown result type (might be due to invalid IL or missing references)
			if (Object.op_Implicit((Object)(object)Sand) && Object.op_Implicit((Object)(object)Run.instance))
			{
				if (!Object.op_Implicit((Object)(object)Sand.GetComponent<StageAestheticWeatherController>()))
				{
					Sand.AddComponent<StageAestheticWeatherController>();
				}
				GameObject gameObject = ((Component)Sand.transform.GetChild(0)).gameObject;
				Material material = ((Renderer)gameObject.GetComponent<ParticleSystemRenderer>()).material;
				material.shader = Assets.CloudRemap;
				material.EnableKeyword("DISABLEREMAP");
				material.SetFloat("_DstBlend", 10f);
				material.SetFloat("_SrcBlend", 5f);
				WeatherData weatherData = intensity switch
				{
					Intensity.Mild => new WeatherData(2500f, 3000f, 20f, 25f, 7f), 
					Intensity.Medium => new WeatherData(3000f, 3500f, 25f, 30f, 12f), 
					Intensity.Heavy => new WeatherData(3500f, 4000f, 25f, 30f, 17f), 
					Intensity.Extreme => new WeatherData(4500f, 5000f, 25f, 30f, 25f), 
					_ => default(WeatherData), 
				};
				float scalingValue = DifficultyCatalog.GetDifficultyDef(Run.instance.selectedDifficulty).scalingValue;
				float difficultyCoefficient = Run.instance.difficultyCoefficient;
				float num = weatherData.Magnitude + Mathf.Sqrt(scalingValue * 2500f) + Mathf.Sqrt(difficultyCoefficient * 20f);
				float num2 = weatherData.Speed + Mathf.Sqrt(scalingValue * 5f) + Mathf.Sqrt(difficultyCoefficient / 2f);
				ParticleSystem component = gameObject.GetComponent<ParticleSystem>();
				MainModule main = component.main;
				((MainModule)(ref main)).startSpeed = MinMaxCurve.op_Implicit(Mathf.Min(1100f, num2));
				((MainModule)(ref main)).maxParticles = Mathf.Min(5000000, 100000 + (int)(num * 5f));
				EmissionModule emission = component.emission;
				MinMaxCurve rateOverTime = ((EmissionModule)(ref emission)).rateOverTime;
				((MinMaxCurve)(ref rateOverTime)).mode = (ParticleSystemCurveMode)0;
				((MinMaxCurve)(ref rateOverTime)).constant = Mathf.Min(10000f, num);
				ShapeModule shape = component.shape;
				((ShapeModule)(ref shape)).rotation = new Vector3(weatherData.Angle, 0f, weatherData.Angle);
				Object.Instantiate<GameObject>(Sand, Vector3.zero, Quaternion.identity);
			}
		}
	}
	public enum SoundType
	{
		None,
		DayNature,
		Rain,
		Thunder,
		NightNature,
		WaterStream,
		Wind,
		Void
	}
	public enum Intensity
	{
		None,
		Mild,
		Medium,
		Heavy,
		Extreme
	}
	public class StageAestheticWeatherController : MonoBehaviour
	{
		public GameObject particleSystem;

		public bool disable;

		public float timer;

		public float interval = 0.1f;

		public void Start()
		{
			particleSystem = ((Component)((Component)this).transform.GetChild(0)).gameObject;
		}

		public void FixedUpdate()
		{
			timer += Time.fixedDeltaTime;
			if (timer >= interval)
			{
				if (disable)
				{
					particleSystem.SetActive(false);
				}
				else
				{
					particleSystem.SetActive(true);
				}
				timer = 0f;
			}
		}
	}
}
namespace StageAesthetic.Variants
{
	public class FRVariant : Variant
	{
		public override void Apply(string scenename, RampFog fog, ColorGrading cgrade, PostProcessVolume volume, bool loop)
		{
			base.Apply(scenename, fog, cgrade, volume, loop);
			Apply(scenename, ((Component)volume).GetComponent<TheCoolerRampFog>(), fog, cgrade, volume, loop);
		}

		public virtual void Apply(string scenename, TheCoolerRampFog fog, RampFog fog2, ColorGrading cgrade, PostProcessVolume volume, bool loop)
		{
		}
	}
	public abstract class Variant
	{
		public ConfigEntry<float> PreLoopWeight;

		public ConfigEntry<float> LoopWeight;

		public ConfigEntry<EnableConfig> WeatherCondition;

		public static List<Variant> Variants = new List<Variant>();

		public static Dictionary<string, List<Variant>> VariantsRolled = new Dictionary<string, List<Variant>>();

		public virtual float PreLoopWeightDefault => 1f;

		public virtual float LoopWeightDefault => 1f;

		public virtual string[] Stages => Array.Empty<string>();

		public virtual string Name => "";

		public virtual string Description => "";

		public virtual SoundType Ambience => SoundType.None;

		public static Variant Vanilla => Variants.Find((Variant x) => x.Stages.Length == 0 && x.Name == "Vanilla");

		public virtual void Init(string category)
		{
		}

		public virtual void Apply(string scenename, RampFog fog, ColorGrading cgrade, PostProcessVolume volume, bool loop)
		{
			Main.Log.LogInfo((object)("Loading " + Hooks.SceneNames[scenename] + " (" + Name + ")"));
			Weather.StopSounds();
			Weather.PlaySound(Ambience);
			if (WeatherCondition.Value switch
			{
				EnableConfig.Enable => true, 
				EnableConfig.PreLoopOnly => !loop, 
				EnableConfig.LoopOnly => loop, 
				EnableConfig.Disable => false, 
				_ => false, 
			})
			{
				DoWeather(scenename, fog, cgrade, volume, loop);
			}
		}

		public virtual void DoWeather(string scenename, RampFog fog, ColorGrading cgrade, PostProcessVolume volume, bool loop)
		{
		}

		public Variant()
		{
			Variants.Add(this);
		}

		public void InitConfig()
		{
			if (Stages.Length != 0 && Hooks.SceneNames.ContainsKey(Stages[0]))
			{
				string category = "Stages " + new string(':', (int)Hooks.SceneStage[Stages[0]]) + " " + Hooks.SceneNames[Stages[0]];
				PreLoopWeight = ConfigManager.Bind(category, Name + " - Pre-Loop Weight", PreLoopWeightDefault, Description);
				LoopWeight = ConfigManager.Bind(category, Name + " - Post-Loop Weight", LoopWeightDefault, Description);
				WeatherCondition = ConfigManager.Bind(category, Name + " - Weather Effect", EnableConfig.Enable, Description);
				Init(category);
			}
		}

		public static Variant GetVariant(string stage, bool loop = false)
		{
			//IL_0113: Unknown result type (might be due to invalid IL or missing references)
			WeightedSelection<Variant> val = new WeightedSelection<Variant>(8);
			foreach (Variant variant in Variants)
			{
				if (variant.Stages.Contains(stage))
				{
					float num = (loop ? variant.LoopWeight.Value : variant.PreLoopWeight.Value);
					if (!(num <= 0f))
					{
						val.AddChoice(variant, num);
					}
				}
			}
			if (val.choices.Length == 0)
			{
				return Vanilla;
			}
			if (!Hooks.AvoidDuplicateVariants.Value)
			{
				return val.Evaluate(Run.instance.stageRng.nextNormalizedFloat);
			}
			if (!VariantsRolled.ContainsKey(stage) || VariantsRolled[stage].Count == val.choices.Length)
			{
				VariantsRolled[stage] = new List<Variant>();
			}
			WeightedSelection<Variant> val2 = new WeightedSelection<Variant>(8);
			for (int i = 0; i < val.Count; i++)
			{
				if (!VariantsRolled[stage].Contains(val.choices[i].value))
				{
					val2.AddChoice(val.choices[i]);
				}
			}
			return val2.Evaluate(Run.instance.stageRng.nextNormalizedFloat);
		}

		public static Variant GetVariant(string stage, string name)
		{
			return Variants.TryFind((Variant x) => x.Stages.Contains(stage) && x.Name.ToLower() == name.ToLower()) ?? Vanilla;
		}
	}
	public class Vanilla : Variant
	{
		public override string Name => "Vanilla";

		public override void Apply(string scenename, RampFog fog, ColorGrading cgrade, PostProcessVolume volume, bool loop)
		{
			base.Apply(scenename, fog, cgrade, volume, loop);
		}
	}
	public enum EnableConfig
	{
		Enable,
		PreLoopOnly,
		LoopOnly,
		Disable
	}
}
namespace StageAesthetic.Variants.Stage5.SlumberingSatellite
{
	public class Blue : FRVariant
	{
		public override string[] Stages => new string[1] { "slumberingsatellite" };

		public override string Name => "Blue";

		public override string Description => "BLUE!";

		public override SoundType Ambience => SoundType.DayNature;

		public override void Apply(string scenename, TheCoolerRampFog fog, RampFog fog2, ColorGrading cgrade, PostProcessVolume volume, bool loop)
		{
			//IL_0034: Unknown result type (might be due to invalid IL or missing references)
			//IL_0039: Unknown result type (might be due to invalid IL or missing references)
			//IL_0091: Unknown result type (might be due to invalid IL or missing references)
			//IL_0096: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a9: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ae: Unknown result type (might be due to invalid IL or missing references)
			//IL_00bf: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c4: Unknown result type (might be due to invalid IL or missing references)
			//IL_0125: Unknown result type (might be due to invalid IL or missing references)
			//IL_012a: Unknown result type (might be due to invalid IL or missing references)
			//IL_012f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0147: Unknown result type (might be due to invalid IL or missing references)
			//IL_014c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0151: Unknown result type (might be due to invalid IL or missing references)
			//IL_0167: Unknown result type (might be due to invalid IL or missing references)
			//IL_016c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0171: Unknown result type (might be due to invalid IL or missing references)
			base.Apply(scenename, fog, fog2, cgrade, volume, loop);
			Light component = GameObject.Find("Directional Light (SUN)").GetComponent<Light>();
			component.color = Color32.op_Implicit(new Color32((byte)160, byte.MaxValue, (byte)208, byte.MaxValue));
			component.intensity = 1f;
			component.shadowStrength = 0.6f;
			fog.intensity = 1f;
			fog.power = 1f;
			fog.fogZero = -0.07f;
			fog.fogOne = 0.15f;
			fog.startColor = new Color32((byte)69, (byte)107, (byte)134, (byte)50);
			fog.middleColor = new Color32((byte)94, (byte)140, (byte)135, (byte)6);
			fog.endColor = new Color32((byte)66, (byte)84, (byte)87, byte.MaxValue);
			fog.skyboxPower = 0f;
			((ParameterOverride<float>)(object)fog2.fogIntensity).value = 1f;
			((ParameterOverride<float>)(object)fog2.fogPower).value = 1f;
			((ParameterOverride<float>)(object)fog2.fogZero).value = -0.07f;
			((ParameterOverride<float>)(object)fog2.fogOne).value = 0.15f;
			((ParameterOverride<Color>)(object)fog2.fogColorStart).value = Color32.op_Implicit(new Color32((byte)69, (byte)107, (byte)134, (byte)50));
			((ParameterOverride<Color>)(object)fog2.fogColorMid).value = Color32.op_Implicit(new Color32((byte)94, (byte)140, (byte)135, (byte)6));
			((ParameterOverride<Color>)(object)fog2.fogColorEnd).value = Color32.op_Implicit(new Color32((byte)66, (byte)84, (byte)87, byte.MaxValue));
			((ParameterOverride<float>)(object)fog2.skyboxStrength).value = 0f;
			Common.VanillaFoliage();
		}
	}
	public static class Common
	{
		public static void VanillaFoliage()
		{
			Assets.MeshReplaceAll(new Assets.ReplaceInstance<MeshRenderer>(new string[1] { "Edge Clouds" }, delegate(MeshRenderer mr)
			{
				((Component)mr).gameObject.SetActive(false);
			}), new Assets.ReplaceInstance<MeshRenderer>(new string[1] { "spmSMGrass" }, delegate(MeshRenderer mr)
			{
				//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_0050: Unknown result type (might be due to invalid IL or missing references)
				//IL_0055: Unknown result type (might be due to invalid IL or missing references)
				((Renderer)mr).sharedMaterial.color = Color32.op_Implicit(new Color32((byte)236, (byte)161, (byte)182, byte.MaxValue));
				if (((Renderer)mr).sharedMaterials.Length >= 2)
				{
					((Renderer)mr).sharedMaterials[1].color = Color32.op_Implicit(new Color32((byte)236, (byte)161, (byte)182, byte.MaxValue));
				}
			}), new Assets.ReplaceInstance<MeshRenderer>(new string[1] { "SMVineBody" }, delegate(MeshRenderer mr)
			{
				//IL_0017: Unknown result type (might be due to invalid IL or missing references)
				//IL_001c: Unknown result type (might be due to invalid IL or missing references)
				((Renderer)mr).sharedMaterial.color = Color32.op_Implicit(new Color32((byte)144, (byte)158, (byte)70, byte.MaxValue));
			}), new Assets.ReplaceInstance<MeshRenderer>(new string[1] { "spmSMHangingVinesCluster_LOD0" }, delegate(MeshRenderer mr)
			{
				//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)
				((Renderer)mr).sharedMaterial.color = Color32.op_Implicit(new Color32((byte)130, (byte)150, (byte)171, byte.MaxValue));
			}), new Assets.ReplaceInstance<MeshRenderer>(new string[1] { "spmBbDryBush_LOD0" }, delegate(MeshRenderer mr)
			{
				//IL_0014: Unknown result type (might be due to invalid IL or missing references)
				//IL_0019: Unknown result type (might be due to invalid IL or missing references)
				//IL_0044: Unknown result type (might be due to invalid IL or missing references)
				//IL_0049: Unknown result type (might be due to invalid IL or missing references)
				((Renderer)mr).sharedMaterial.color = Color32.op_Implicit(new Color32((byte)125, (byte)125, (byte)128, byte.MaxValue));
				if (((Renderer)mr).sharedMaterials.Length >= 2)
				{
					((Renderer)mr).sharedMaterials[1].color = Color32.op_Implicit(new Color32((byte)125, (byte)125, (byte)128, byte.MaxValue));
				}
			}), new Assets.ReplaceInstance<MeshRenderer>(new string[1] { "spmSMHangingVinesCluster_LOD0" }, delegate(MeshRenderer mr)
			{
				//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)
				((Renderer)mr).sharedMaterial.color = Color32.op_Implicit(new Color32(byte.MaxValue, byte.MaxValue, byte.MaxValue, byte.MaxValue));
			}));
		}
	}
	public class Morning : FRVariant
	{
		public override string[] Stages => new string[1] { "slumberingsatellite" };

		public override string Name => "Morning";

		public override string Description => "Blue and yellow.";

		public override SoundType Ambience => SoundType.DayNature;

		public override void Apply(string scenename, TheCoolerRampFog fog, RampFog fog2, ColorGrading cgrade, PostProcessVolume volume, bool loop)
		{
			//IL_0034: Unknown result type (might be due to invalid IL or missing references)
			//IL_0039: Unknown result type (might be due to invalid IL or missing references)
			base.Apply(scenename, fog, fog2, cgrade, volume, loop);
			Light component = GameObject.Find("Directional Light (SUN)").GetComponent<Light>();
			component.color = Color32.op_Implicit(new Color32(byte.MaxValue, (byte)219, (byte)160, byte.MaxValue));
			component.intensity = 2f;
			component.shadowStrength = 0.85f;
			Common.VanillaFoliage();
		}
	}
	public class Overcast : FRVariant
	{
		public override string[] Stages => new string[1] { "slumberingsatellite" };

		public override string Name => "Overcast";

		public override string Description => "Rainy with more fog.";

		public override SoundType Ambience => SoundType.Thunder;

		public override void Apply(string scenename, TheCoolerRampFog fog, RampFog fog2, ColorGrading cgrade, PostProcessVolume volume, bool loop)
		{
			//IL_0034: Unknown result type (might be due to invalid IL or missing references)
			//IL_0039: Unknown result type (might be due to invalid IL or missing references)
			//IL_0091: Unknown result type (might be due to invalid IL or missing references)
			//IL_0096: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ab: Unknown result type (might be due to invalid IL or missing references)
			//IL_00bc: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c1: Unknown result type (might be due to invalid IL or missing references)
			//IL_0122: Unknown result type (might be due to invalid IL or missing references)
			//IL_0127: Unknown result type (might be due to invalid IL or missing references)
			//IL_012c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0141: Unknown result type (might be due to invalid IL or missing references)
			//IL_0146: Unknown result type (might be due to invalid IL or missing references)
			//IL_014b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0161: Unknown result type (might be due to invalid IL or missing references)
			//IL_0166: Unknown result type (might be due to invalid IL or missing references)
			//IL_016b: Unknown result type (might be due to invalid IL or missing references)
			base.Apply(scenename, fog, fog2, cgrade, volume, loop);
			Light component = GameObject.Find("Directional Light (SUN)").GetComponent<Light>();
			component.color = Color32.op_Implicit(new Color32((byte)160, byte.MaxValue, (byte)208, byte.MaxValue));
			component.intensity = 1f;
			component.shadowStrength = 0.6f;
			fog.intensity = 1f;
			fog.power = 1f;
			fog.fogZero = -0.07f;
			fog.fogOne = 0.1f;
			fog.startColor = new Color32((byte)134, (byte)99, (byte)69, (byte)50);
			fog.middleColor = new Color32((byte)140, (byte)115, (byte)94, (byte)6);
			fog.endColor = new Color32((byte)87, (byte)74, (byte)66, byte.MaxValue);
			fog.skyboxPower = 0f;
			((ParameterOverride<float>)(object)fog2.fogIntensity).value = 1f;
			((ParameterOverride<float>)(object)fog2.fogPower).value = 1f;
			((ParameterOverride<float>)(object)fog2.fogZero).value = -0.07f;
			((ParameterOverride<float>)(object)fog2.fogOne).value = 0.1f;
			((ParameterOverride<Color>)(object)fog2.fogColorStart).value = Color32.op_Implicit(new Color32((byte)134, (byte)99, (byte)69, (byte)50));
			((ParameterOverride<Color>)(object)fog2.fogColorMid).value = Color32.op_Implicit(new Color32((byte)140, (byte)115, (byte)94, (byte)6));
			((ParameterOverride<Color>)(object)fog2.fogColorEnd).value = Color32.op_Implicit(new Color32((byte)87, (byte)74, (byte)66, byte.MaxValue));
			((ParameterOverride<float>)(object)fog2.skyboxStrength).value = 0f;
			Common.VanillaFoliage();
		}

		public override void DoWeather(string scenename, RampFog fog, ColorGrading cgrade, PostProcessVolume volume, bool loop)
		{
			Weather.AddRain(Intensity.Extreme);
		}
	}
	public class Vanilla : FRVariant
	{
		public override string[] Stages => new string[1] { "slumberingsatellite" };

		public override string Name => "Vanilla";

		public override string Description => "Disabling removes vanilla from getting picked.";

		public override SoundType Ambience => SoundType.NightNature;

		public override void Apply(string scenename, TheCoolerRampFog fog, RampFog fog2, ColorGrading cgrade, PostProcessVolume volume, bool loop)
		{
			base.Apply(scenename, fog, fog2, cgrade, volume, loop);
			Common.VanillaFoliage();
		}
	}
}
namespace StageAesthetic.Variants.Stage5.SkyMeadow
{
	public class Abandoned : Variant
	{
		public override string[] Stages => new string[1] { "skymeadow" };

		public override string Name => "Abandoned";

		public override string Description => "Texture swap to Yellow Abandoned Aqueduct.";

		public override SoundType Ambience => SoundType.Wind;

		public override void Apply(string scenename, RampFog fog, ColorGrading cgrade, PostProcessVolume volume, bool loop)
		{
			//IL_001b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0020: Unknown result type (might be due to invalid IL or missing references)
			//IL_0025: Unknown result type (might be due to invalid IL or missing references)
			//IL_003e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0043: Unknown result type (might be due to invalid IL or missing references)
			//IL_0048: Unknown result type (might be due to invalid IL or missing references)
			//IL_0061: Unknown result type (might be due to invalid IL or missing references)
			//IL_0066: Unknown result type (might be due to invalid IL or missing references)
			//IL_006b: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d9: Unknown result type (might be due to invalid IL or missing references)
			//IL_00fc: Unknown result type (might be due to invalid IL or missing references)
			//IL_0133: Unknown result type (might be due to invalid IL or missing references)
			//IL_0156: Unknown result type (might be due to invalid IL or missing references)
			//IL_01c0: Unknown result type (might be due to invalid IL or missing references)
			//IL_01e0: Unknown result type (might be due to invalid IL or missing references)
			base.Apply(scenename, fog, cgrade, volume, loop);
			((ParameterOverride<Color>)(object)fog.fogColorStart).value = Color32.op_Implicit(new Color32((byte)113, (byte)42, (byte)109, (byte)97));
			((ParameterOverride<Color>)(object)fog.fogColorMid).value = Color32.op_Implicit(new Color32((byte)174, (byte)135, (byte)66, (byte)60));
			((ParameterOverride<Color>)(object)fog.fogColorEnd).value = Color32.op_Implicit(new Color32((byte)128, (byte)101, (byte)59, byte.MaxValue));
			((ParameterOverride<float>)(object)fog.fogZero).value = -0.05f;
			((ParameterOverride<float>)(object)fog.fogIntensity).value = 1f;
			((ParameterOverride<float>)(object)fog.fogPower).value = 0.7f;
			((ParameterOverride<float>)(object)fog.fogOne).value = 0.25f;
			((ParameterOverride<float>)(object)fog.skyboxStrength).value = 0f;
			Common.ReplaceMaterials(Assets.LoadRecolor("RoR2/Base/goolake/matGoolakeTerrain.mat", new Color32((byte)230, (byte)223, (byte)174, (byte)219)), Assets.LoadRecolor("RoR2/Base/goolake/matGoolakeStoneTrimLightSand.mat", new Color32(byte.MaxValue, (byte)188, (byte)160, (byte)223)), Assets.Load<Material>("RoR2/Base/goolake/matGoolakeStoneTrimSandy.mat"), Assets.Load<Material>("RoR2/Base/goolake/matGoolakeStoneTrimLightSand.mat"), Assets.LoadRecolor("RoR2/Base/Common/TrimSheets/matTrimSheetConstructionWild.mat", new Color32((byte)248, (byte)219, (byte)175, byte.MaxValue)), Assets.LoadRecolor("RoR2/Base/Common/TrimSheets/matTrimSheetSwampyRuinsProjectedLight.mat", new Color32((byte)217, (byte)191, (byte)168, byte.MaxValue)), Assets.Load<Material>("RoR2/DLC1/MajorAndMinorConstruct/matMajorConstructDefenseMatrixEdges.mat"));
			Transform transform = GameObject.Find("Cloud Floor").transform;
			((Renderer)((Component)transform.GetChild(0)).GetComponent<MeshRenderer>()).sharedMaterial = Assets.Load<Material>("RoR2/Base/Common/matClayGooDebuff.mat");
			GameObject.Find("Hard Floor").SetActive(false);
			transform.GetChild(0).localPosition = new Vector3(0f, 30f, 0f);
			transform.GetChild(0).localScale = new Vector3(600f, 600f, 600f);
			((Component)transform.GetChild(1)).gameObject.SetActive(false);
			((Component)transform.GetChild(2)).gameObject.SetActive(false);
			((Component)transform.GetChild(3)).gameObject.SetActive(false);
			Assets.MeshReplaceAll(new Assets.ReplaceInstance<MeshRenderer>(new string[1] { "BbRuinPillar" }, delegate(MeshRenderer mr)
			{
				Assets.TryMeshReplace(mr, Assets.Load<Material>("RoR2/Base/Common/TrimSheets/matTrimSheetClayPots.mat"));
			}), new Assets.ReplaceInstance<MeshRenderer>(new string[1] { "BbRuinArch" }, delegate(MeshRenderer mr)
			{
				//IL_001a: Unknown result type (might be due to invalid IL or missing references)
				Assets.TryMeshReplace(mr, Assets.LoadRecolor("RoR2/Base/goolake/matGoolakeTerrain.mat", new Color32((byte)230, (byte)223, (byte)174, (byte)219)));
			}));
			SandyFoliage();
		}

		public override void DoWeather(string scenename, RampFog fog, ColorGrading cgrade, PostProcessVolume volume, bool loop)
		{
			Weather.AddSand(Intensity.Extreme);
		}

		public static void SandyFoliage()
		{
			Assets.MeshReplaceAll(new Assets.ReplaceInstance<MeshRenderer>(new string[1] { "spmSMGrass" }, delegate(MeshRenderer mr)
			{
				//IL_0017: Unknown result type (might be due to invalid IL or missing references)
				//IL_001c: Unknown result type (might be due to invalid IL or missing references)
				//IL_004a: Unknown result type (might be due to invalid IL or missing references)
				//IL_004f: Unknown result type (might be due to invalid IL or missing references)
				((Renderer)mr).sharedMaterial.color = Color32.op_Implicit(new Color32(byte.MaxValue, (byte)186, (byte)95, byte.MaxValue));
				if (((Renderer)mr).sharedMaterials.Length >= 2)
				{
					((Renderer)mr).sharedMaterials[1].color = Color32.op_Implicit(new Color32((byte)216, (byte)171, (byte)88, byte.MaxValue));
				}
			}), new Assets.ReplaceInstance<MeshRenderer>(new string[2] { "SMVineBody", "spmSMHangingVinesCluster_LOD0" }, delegate(MeshRenderer mr)
			{
				//IL_0017: Unknown result type (might be due to invalid IL or missing references)
				//IL_001c: Unknown result type (might be due to invalid IL or missing references)
				((Renderer)mr).sharedMaterial.color = Color32.op_Implicit(new Color32((byte)213, (byte)158, (byte)70, byte.MaxValue));
			}), new Assets.ReplaceInstance<MeshRenderer>(new string[1] { "spmBbDryBush_LOD0" }, delegate(MeshRenderer mr)
			{
				//IL_0011: Unknown result type (might be due to invalid IL or missing references)
				//IL_0016: Unknown result type (might be due to invalid IL or missing references)
				//IL_003e: Unknown result type (might be due to invalid IL or missing references)
				//IL_0043: Unknown result type (might be due to invalid IL or missing references)
				((Renderer)mr).sharedMaterial.color = Color32.op_Implicit(new Color32((byte)73, (byte)58, (byte)42, byte.MaxValue));
				if (((Renderer)mr).sharedMaterials.Length >= 2)
				{
					((Renderer)mr).sharedMaterials[1].color = Color32.op_Implicit(new Color32((byte)84, (byte)68, (byte)49, byte.MaxValue));
				}
			}), new Assets.ReplaceInstance<MeshRenderer>(new string[1] { "SGMushroom" }, delegate(MeshRenderer mr)
			{
				//IL_0013: Unknown result type (might be due to invalid IL or missing references)
				//IL_0018: Unknown result type (might be due to invalid IL or missing references)
				((Renderer)mr).sharedMaterial.color = Color32.op_Implicit(new Color32(byte.MaxValue, (byte)90, (byte)0, byte.MaxValue));
			}));
		}
	}
	public class Abyssal : Variant
	{
		public override string[] Stages => new string[1] { "skymeadow" };

		public override string Name => "Abyssal";

		public override string Description => "Texture swap to Red Abyssal Depths.";

		public override SoundType Ambience => SoundType.Rain;

		public override void Apply(string scenename, RampFog fog, ColorGrading cgrade, PostProcessVolume volume, bool loop)
		{
			//IL_0026: Unknown result type (might be due to invalid IL or missing references)
			//IL_002b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0030: Unknown result type (might be due to invalid IL or missing references)
			//IL_0053: Unknown result type (might be due to invalid IL or missing references)
			//IL_0058: Unknown result type (might be due to invalid IL or missing references)
			//IL_005d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0070: Unknown result type (might be due to invalid IL or missing references)
			//IL_0075: Unknown result type (might be due to invalid IL or missing references)
			//IL_007a: 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_009a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0152: Unknown result type (might be due to invalid IL or missing references)
			//IL_0157: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ad: Unknown result type (might be due to invalid IL or missing references)
			//IL_01d8: Unknown result type (might be due to invalid IL or missing references)
			//IL_0254: Unknown result type (might be due to invalid IL or missing references)
			//IL_026f: Unknown result type (might be due to invalid IL or missing references)
			//IL_02a3: Unknown result type (might be due to invalid IL or missing references)
			//IL_02c9: Unknown result type (might be due to invalid IL or missing references)
			//IL_0303: Unknown result type (might be due to invalid IL or missing references)
			base.Apply(scenename, fog, cgrade, volume, loop);
			((PostProcessEffectSettings)cgrade).SetAllOverridesTo(true, true);
			((ParameterOverride<Color>)(object)cgrade.colorFilter).value = Color32.op_Implicit(new Color32((byte)79, (byte)79, (byte)103, byte.MaxValue));
			((ParameterOverride<float>)(object)cgrade.saturation).value = -8f;
			((ParameterOverride<Color>)(object)fog.fogColorStart).value = Color32.op_Implicit(new Color32((byte)106, (byte)22, (byte)107, (byte)50));
			((ParameterOverride<Color>)(object)fog.fogColorMid).value = Color32.op_Implicit(new Color32((byte)39, (byte)85, (byte)97, (byte)44));
			((ParameterOverride<Color>)(object)fog.fogColorEnd).value = Color32.op_Implicit(new Color32((byte)35, (byte)76, (byte)73, byte.MaxValue));
			((ParameterOverride<float>)(object)fog.fogZero).value = -0.1f;
			((ParameterOverride<float>)(object)fog.fogOne).value = 0.2f;
			((ParameterOverride<float>)(object)fog.fogIntensity).value = 1f;
			((Parameter