Decompiled source of CoolerStages v1.9.3

CoolerStages.dll

Decompiled 3 months ago
using System;
using System.Collections.Generic;
using System.Diagnostics;
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 Microsoft.CodeAnalysis;
using On.RoR2;
using RoR2;
using UnityEngine;
using UnityEngine.AddressableAssets;
using UnityEngine.Rendering;
using UnityEngine.Rendering.PostProcessing;
using UnityEngine.SceneManagement;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: TargetFramework(".NETStandard,Version=v2.0", FrameworkDisplayName = ".NET Standard 2.0")]
[assembly: AssemblyCompany("CoolerStages")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0+49b37893755850f4d91372d3909e3f108b8a9258")]
[assembly: AssemblyProduct("CoolerStages")]
[assembly: AssemblyTitle("CoolerStages")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.0.0")]
[module: UnverifiableCode]
[module: RefSafetyRules(11)]
namespace Microsoft.CodeAnalysis
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	internal sealed class EmbeddedAttribute : Attribute
	{
	}
}
namespace System.Runtime.CompilerServices
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	[AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)]
	internal sealed class RefSafetyRulesAttribute : Attribute
	{
		public readonly int Version;

		public RefSafetyRulesAttribute(int P_0)
		{
			Version = P_0;
		}
	}
}
namespace CoolerStages
{
	[BepInPlugin("com.Nuxlar.CoolerStages", "CoolerStages", "1.9.3")]
	public class CoolerStages : BaseUnityPlugin
	{
		private static readonly Material nightTerrainMat = Addressables.LoadAssetAsync<Material>((object)"RoR2/Base/wispgraveyard/matWPTerrain.mat").WaitForCompletion();

		private static readonly Material nightTerrainMat2 = Addressables.LoadAssetAsync<Material>((object)"RoR2/Base/wispgraveyard/matWPTerrainRocky.mat").WaitForCompletion();

		private static readonly Material nightDetailMat = Addressables.LoadAssetAsync<Material>((object)"RoR2/Base/wispgraveyard/matTempleObelisk.mat").WaitForCompletion();

		private static readonly Material nightDetailMat2 = Addressables.LoadAssetAsync<Material>((object)"RoR2/Base/Common/TrimSheets/matTrimsheetGraveyardTempleWhiteGrassy.mat").WaitForCompletion();

		private static readonly Material nightDetailMat3 = Addressables.LoadAssetAsync<Material>((object)"RoR2/Base/foggyswamp/matFSTreeTrunkLightMoss.mat").WaitForCompletion();

		private static readonly Material danTerrain = Addressables.LoadAssetAsync<Material>((object)"RoR2/Base/arena/matArenaTerrainVerySnowy.mat").WaitForCompletion();

		private static readonly Material danDetail = Addressables.LoadAssetAsync<Material>((object)"RoR2/DLC1/voidstage/matVoidFoam.mat").WaitForCompletion();

		private static readonly Material danDetail2 = Addressables.LoadAssetAsync<Material>((object)"RoR2/Base/Common/TrimSheets/matTrimSheetAlien1BossEmission.mat").WaitForCompletion();

		private static readonly Material danDetail3 = Addressables.LoadAssetAsync<Material>((object)"RoR2/DLC1/voidstage/matVoidTrim.mat").WaitForCompletion();

		private static readonly Material ruinTerrainTest = new Material(Addressables.LoadAssetAsync<Material>((object)"RoR2/DLC1/itancientloft/matAncientLoft_TempleProjectedInfiniteTower.mat").WaitForCompletion());

		private static readonly Material ruinTerrain = new Material(Addressables.LoadAssetAsync<Material>((object)"RoR2/DLC1/itancientloft/matAncientLoft_TempleProjectedInfiniteTower.mat").WaitForCompletion());

		private static readonly Material ruinDetail = Addressables.LoadAssetAsync<Material>((object)"RoR2/DLC1/itancientloft/matAncientLoft_BoulderInfiniteTower.mat").WaitForCompletion();

		private static readonly Material ruinDetail2 = Addressables.LoadAssetAsync<Material>((object)"RoR2/DLC1/itancientloft/matAncientLoft_TempleProjectedInfiniteTower.mat").WaitForCompletion();

		private static readonly Material ruinDetail3 = Addressables.LoadAssetAsync<Material>((object)"RoR2/Base/rootjungle/matRJTree.mat").WaitForCompletion();

		private static readonly Material smSimTerrainMat = Addressables.LoadAssetAsync<Material>((object)"RoR2/DLC1/itskymeadow/matSMTerrainInfiniteTower.mat").WaitForCompletion();

		private static readonly Material smSimDetailMat = Addressables.LoadAssetAsync<Material>((object)"RoR2/DLC1/itskymeadow/matSMRockInfiniteTower.mat").WaitForCompletion();

		private static readonly Material smSimDetailMat2 = Addressables.LoadAssetAsync<Material>((object)"RoR2/DLC1/itskymeadow/matTrimSheetMeadowRuinsProjectedInfiniteTower.mat").WaitForCompletion();

		private static readonly Material smSimtDetailMat3 = Addressables.LoadAssetAsync<Material>((object)"RoR2/DLC1/itskymeadow/matSMSpikeBridgeInfinitetower.mat").WaitForCompletion();

		private static readonly Material dcSimTerrainMat = Addressables.LoadAssetAsync<Material>((object)"RoR2/DLC1/itdampcave/matDCTerrainFloorInfiniteTower.mat").WaitForCompletion();

		private static readonly Material dcSimDetailMat = Addressables.LoadAssetAsync<Material>((object)"RoR2/DLC1/itdampcave/matDCBoulderInfiniteTower.mat").WaitForCompletion();

		private static readonly Material dcSimDetailMat2 = Addressables.LoadAssetAsync<Material>((object)"RoR2/DLC1/itdampcave/matTrimSheetLemurianRuinsLightInfiniteTower.mat").WaitForCompletion();

		private static readonly Material dcSimDetailMat3 = Addressables.LoadAssetAsync<Material>((object)"RoR2/DLC1/itdampcave/matDCStalagmiteInfiniteTower.mat").WaitForCompletion();

		private static readonly Material gpSimTerrainMat = Addressables.LoadAssetAsync<Material>((object)"RoR2/DLC1/itgolemplains/matGPTerrainInfiniteTower.mat").WaitForCompletion();

		private static readonly Material gpSimDetailMat = Addressables.LoadAssetAsync<Material>((object)"RoR2/DLC1/itgolemplains/matGPBoulderMossyProjectedInfiniteTower.mat").WaitForCompletion();

		private static readonly Material gpSimDetailMat2 = Addressables.LoadAssetAsync<Material>((object)"RoR2/DLC1/itgolemplains/matTrimSheetMossyProjectedHugeInfiniteTower.mat").WaitForCompletion();

		private static readonly Material gpSimDetailMat3 = Addressables.LoadAssetAsync<Material>((object)"RoR2/Base/foggyswamp/matFSTreeTrunkLightMoss.mat").WaitForCompletion();

		private static readonly Material gooSimTerrainMat = Addressables.LoadAssetAsync<Material>((object)"RoR2/DLC1/itgoolake/matGoolakeTerrainInfiniteTower.mat").WaitForCompletion();

		private static readonly Material gooSimDetailMat = Addressables.LoadAssetAsync<Material>((object)"RoR2/DLC1/itgoolake/matGoolakeRocksInfiniteTower.mat").WaitForCompletion();

		private static readonly Material gooSimDetailMat2 = Addressables.LoadAssetAsync<Material>((object)"RoR2/DLC1/itgoolake/matGoolakeStoneTrimLightSandInfiniteTower.mat").WaitForCompletion();

		private static readonly Material gooSimDetailMat3 = Addressables.LoadAssetAsync<Material>((object)"RoR2/DLC1/itgoolake/matEelSkeleton2InfiniteTower.mat").WaitForCompletion();

		private static readonly Material moonTerrainMat = Addressables.LoadAssetAsync<Material>((object)"RoR2/Base/moon/matMoonTerrain.mat").WaitForCompletion();

		private static readonly Material moonDetailMat = Addressables.LoadAssetAsync<Material>((object)"RoR2/Base/moon/matMoonBoulder.mat").WaitForCompletion();

		private static readonly Material moonDetailMat2 = Addressables.LoadAssetAsync<Material>((object)"RoR2/Base/moon/matMoonBridge.mat").WaitForCompletion();

		private static readonly Material moonDetailMat3 = Addressables.LoadAssetAsync<Material>((object)"RoR2/Base/moon/matMoonBaseStandTriplanar.mat").WaitForCompletion();

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

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

		private static readonly Material bazaarDetailMat2 = Addressables.LoadAssetAsync<Material>((object)"RoR2/Base/intro/matColonyShipStandard.mat").WaitForCompletion();

		private static readonly Material bazaarDetailMat3 = Addressables.LoadAssetAsync<Material>((object)"RoR2/Base/mysteryspace/matMSObeliskHeart.mat").WaitForCompletion();

		private static readonly Material verdantTerrainMat = Addressables.LoadAssetAsync<Material>((object)"RoR2/CU8/lakes/matTLTerrainStone.mat").WaitForCompletion();

		private static readonly Material verdantDetailMat = Addressables.LoadAssetAsync<Material>((object)"RoR2/CU8/lakes/matTLRocks.mat").WaitForCompletion();

		private static readonly Material verdantDetailMat2 = Addressables.LoadAssetAsync<Material>((object)"RoR2/CU8/lakes/matTLShip.mat").WaitForCompletion();

		private static readonly Material verdantDetailMat3 = Addressables.LoadAssetAsync<Material>((object)"RoR2/CU8/lakes/matTLGVine.mat").WaitForCompletion();

		private static readonly List<Material[]> themeMaterials1 = new List<Material[]>
		{
			(Material[])(object)new Material[4] { verdantTerrainMat, verdantDetailMat, verdantDetailMat2, verdantDetailMat3 },
			(Material[])(object)new Material[4] { smSimTerrainMat, smSimDetailMat, smSimDetailMat2, smSimtDetailMat3 },
			(Material[])(object)new Material[4] { danTerrain, danDetail, danDetail2, danDetail3 },
			(Material[])(object)new Material[4] { ruinTerrain, ruinDetail, ruinDetail2, ruinDetail3 },
			(Material[])(object)new Material[4] { dcSimTerrainMat, dcSimDetailMat, dcSimDetailMat2, dcSimDetailMat3 },
			(Material[])(object)new Material[4] { gpSimTerrainMat, gpSimDetailMat, gpSimDetailMat2, gpSimDetailMat3 },
			(Material[])(object)new Material[4] { gooSimTerrainMat, gooSimDetailMat, gooSimDetailMat2, gooSimDetailMat3 },
			(Material[])(object)new Material[4] { moonTerrainMat, moonDetailMat, moonDetailMat2, moonDetailMat3 },
			(Material[])(object)new Material[4] { bazaarTerrainMat, bazaarDetailMat, bazaarDetailMat2, bazaarDetailMat3 }
		};

		private static readonly List<Material[]> themeMaterials2 = new List<Material[]>
		{
			(Material[])(object)new Material[4] { verdantTerrainMat, verdantDetailMat, verdantDetailMat2, verdantDetailMat3 },
			(Material[])(object)new Material[4] { danTerrain, danDetail, danDetail2, danDetail3 },
			(Material[])(object)new Material[4] { ruinTerrain, ruinDetail, ruinDetail2, ruinDetail3 },
			(Material[])(object)new Material[4] { dcSimTerrainMat, dcSimDetailMat, dcSimDetailMat2, dcSimDetailMat3 }
		};

		private Random rng = new Random();

		private static readonly string[] whitelistedMaps = new string[17]
		{
			"lakes", "snowyforest", "blackbeach", "blackbeach2", "golemplains", "golemplains2", "goolake", "foggyswamp", "ancientloft", "frozenwall",
			"wispgraveyard", "sulfurpools", "shipgraveyard", "rootjungle", "dampcavesimple", "skymeadow", "moon2"
		};

		public static ConfigEntry<bool> enableWinter;

		public static ConfigEntry<bool> enableFantasy;

		public static ConfigEntry<bool> enableAuburn;

		public static ConfigEntry<bool> enableAfternoon;

		public static ConfigEntry<bool> enableDrowned;

		public static ConfigEntry<bool> enableDreary;

		private Texture2D tlCliffTex = Addressables.LoadAssetAsync<Texture2D>((object)"RoR2/CU8/lakes/texTLTerrainCliff.tga").WaitForCompletion();

		private Texture2D tlDirtTex = Addressables.LoadAssetAsync<Texture2D>((object)"RoR2/CU8/lakes/texTLTerrainDirt.tga").WaitForCompletion();

		private Texture2D rockNormal = Addressables.LoadAssetAsync<Texture2D>((object)"RoR2/Base/Common/texNormalBumpyRock.jpg").WaitForCompletion();

		private PostProcessProfile pp1 = ScriptableObject.CreateInstance<PostProcessProfile>();

		private PostProcessProfile pp2 = ScriptableObject.CreateInstance<PostProcessProfile>();

		private PostProcessProfile pp3 = ScriptableObject.CreateInstance<PostProcessProfile>();

		private PostProcessProfile pp4 = ScriptableObject.CreateInstance<PostProcessProfile>();

		private PostProcessProfile pp5 = ScriptableObject.CreateInstance<PostProcessProfile>();

		private PostProcessProfile pp6 = ScriptableObject.CreateInstance<PostProcessProfile>();

		private PostProcessProfile ppbb = Addressables.LoadAssetAsync<PostProcessProfile>((object)"RoR2/Base/title/ppSceneGolemplainsFoggy.asset").WaitForCompletion();

		private static ConfigFile CSConfig { get; set; }

		public void Awake()
		{
			//IL_0010: Unknown result type (might be due to invalid IL or missing references)
			//IL_001a: Expected O, but got Unknown
			//IL_00ed: 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_0251: Unknown result type (might be due to invalid IL or missing references)
			//IL_0256: Unknown result type (might be due to invalid IL or missing references)
			//IL_025b: Unknown result type (might be due to invalid IL or missing references)
			//IL_027a: Unknown result type (might be due to invalid IL or missing references)
			//IL_027f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0284: 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_02a8: Unknown result type (might be due to invalid IL or missing references)
			//IL_02ad: Unknown result type (might be due to invalid IL or missing references)
			//IL_0348: Unknown result type (might be due to invalid IL or missing references)
			//IL_034d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0352: Unknown result type (might be due to invalid IL or missing references)
			//IL_0368: Unknown result type (might be due to invalid IL or missing references)
			//IL_036d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0372: Unknown result type (might be due to invalid IL or missing references)
			//IL_0388: Unknown result type (might be due to invalid IL or missing references)
			//IL_038d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0392: Unknown result type (might be due to invalid IL or missing references)
			//IL_042e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0433: Unknown result type (might be due to invalid IL or missing references)
			//IL_0438: Unknown result type (might be due to invalid IL or missing references)
			//IL_044b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0450: Unknown result type (might be due to invalid IL or missing references)
			//IL_0455: Unknown result type (might be due to invalid IL or missing references)
			//IL_046b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0470: Unknown result type (might be due to invalid IL or missing references)
			//IL_0475: Unknown result type (might be due to invalid IL or missing references)
			//IL_0511: Unknown result type (might be due to invalid IL or missing references)
			//IL_0516: Unknown result type (might be due to invalid IL or missing references)
			//IL_051b: Unknown result type (might be due to invalid IL or missing references)
			//IL_053a: Unknown result type (might be due to invalid IL or missing references)
			//IL_053f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0544: Unknown result type (might be due to invalid IL or missing references)
			//IL_0560: Unknown result type (might be due to invalid IL or missing references)
			//IL_0565: Unknown result type (might be due to invalid IL or missing references)
			//IL_056a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0606: Unknown result type (might be due to invalid IL or missing references)
			//IL_060b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0610: Unknown result type (might be due to invalid IL or missing references)
			//IL_0629: Unknown result type (might be due to invalid IL or missing references)
			//IL_062e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0633: Unknown result type (might be due to invalid IL or missing references)
			//IL_064c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0651: Unknown result type (might be due to invalid IL or missing references)
			//IL_0656: Unknown result type (might be due to invalid IL or missing references)
			//IL_06f3: Unknown result type (might be due to invalid IL or missing references)
			//IL_06f8: Unknown result type (might be due to invalid IL or missing references)
			//IL_06fd: Unknown result type (might be due to invalid IL or missing references)
			//IL_0714: Unknown result type (might be due to invalid IL or missing references)
			//IL_0719: Unknown result type (might be due to invalid IL or missing references)
			//IL_071e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0735: Unknown result type (might be due to invalid IL or missing references)
			//IL_073a: Unknown result type (might be due to invalid IL or missing references)
			//IL_073f: Unknown result type (might be due to invalid IL or missing references)
			//IL_07d3: Unknown result type (might be due to invalid IL or missing references)
			//IL_07dd: Expected O, but got Unknown
			CSConfig = new ConfigFile(Paths.ConfigPath + "\\com.Nuxlar.CoolerStages.cfg", true);
			enableWinter = CSConfig.Bind<bool>("General", "Enable Winter Profile", true, "White and Foggy.");
			enableFantasy = CSConfig.Bind<bool>("General", "Enable Fanstasy Profile", true, "Pink");
			enableAuburn = CSConfig.Bind<bool>("General", "Enable Auburn Profile", true, "Red-ish Brown.");
			enableAfternoon = CSConfig.Bind<bool>("General", "Enable Afternoon Profile", true, "Bright, Sunny Blue Skies.");
			enableDrowned = CSConfig.Bind<bool>("General", "Enable Drowned Profile", true, "Soft Purple/Blue.");
			enableDreary = CSConfig.Bind<bool>("General", "Enable Dreary Profile", true, "Dark, Midnight Blue.");
			ruinTerrain.color = new Color(0.701f, 0.623f, 0.403f, 1f);
			ruinTerrain.SetTexture("_SplatmapTex", (Texture)null);
			ruinTerrain.SetTexture("_NormalTex", (Texture)(object)rockNormal);
			ruinTerrain.SetTexture("_RedChannelSideTex", (Texture)(object)tlCliffTex);
			ruinTerrain.SetTexture("_RedChannelTopTex", (Texture)(object)tlDirtTex);
			ruinTerrainTest.color = Color.white;
			((Object)pp1).name = "Winter";
			((Object)pp2).name = "Fantasy";
			((Object)pp3).name = "Auburn";
			((Object)pp4).name = "Afternoon";
			((Object)pp5).name = "Drowned";
			((Object)pp6).name = "Dreary";
			RampFog obj = pp1.AddSettings<RampFog>();
			RampFog val = pp2.AddSettings<RampFog>();
			RampFog val2 = pp3.AddSettings<RampFog>();
			RampFog val3 = pp4.AddSettings<RampFog>();
			RampFog val4 = pp5.AddSettings<RampFog>();
			RampFog val5 = pp6.AddSettings<RampFog>();
			ppbb.GetSetting<RampFog>();
			((PostProcessEffectSettings)obj).SetAllOverridesTo(true, true);
			((PostProcessEffectSettings)val).SetAllOverridesTo(true, true);
			((PostProcessEffectSettings)val2).SetAllOverridesTo(true, true);
			((PostProcessEffectSettings)val3).SetAllOverridesTo(true, true);
			((PostProcessEffectSettings)val4).SetAllOverridesTo(true, true);
			((PostProcessEffectSettings)val5).SetAllOverridesTo(true, true);
			((ParameterOverride<Color>)(object)obj.fogColorStart).value = Color32.op_Implicit(new Color32((byte)225, (byte)225, (byte)225, (byte)15));
			((ParameterOverride<Color>)(object)obj.fogColorMid).value = Color32.op_Implicit(new Color32((byte)160, (byte)207, byte.MaxValue, (byte)150));
			((ParameterOverride<Color>)(object)obj.fogColorEnd).value = Color32.op_Implicit(new Color32((byte)135, (byte)150, (byte)200, byte.MaxValue));
			((ParameterOverride<float>)(object)obj.fogHeightStart).value = 0f;
			((ParameterOverride<float>)(object)obj.fogHeightEnd).value = 100f;
			((ParameterOverride<float>)(object)obj.fogHeightIntensity).value = 0f;
			((ParameterOverride<float>)(object)obj.fogIntensity).value = 0.75f;
			((ParameterOverride<float>)(object)obj.fogOne).value = 0.15f;
			((ParameterOverride<float>)(object)obj.fogPower).value = 1.5f;
			((ParameterOverride<float>)(object)obj.fogZero).value = -0.01f;
			((ParameterOverride<float>)(object)obj.skyboxStrength).value = 0.1f;
			((ParameterOverride<Color>)(object)val.fogColorStart).value = Color32.op_Implicit(new Color32((byte)229, (byte)164, (byte)203, (byte)10));
			((ParameterOverride<Color>)(object)val.fogColorMid).value = Color32.op_Implicit(new Color32((byte)145, (byte)120, (byte)120, (byte)125));
			((ParameterOverride<Color>)(object)val.fogColorEnd).value = Color32.op_Implicit(new Color32((byte)120, (byte)75, (byte)100, (byte)225));
			((ParameterOverride<float>)(object)val.fogHeightStart).value = 0f;
			((ParameterOverride<float>)(object)val.fogHeightEnd).value = 100f;
			((ParameterOverride<float>)(object)val.fogHeightIntensity).value = 0f;
			((ParameterOverride<float>)(object)val.fogIntensity).value = 1f;
			((ParameterOverride<float>)(object)val.fogOne).value = 0.15f;
			((ParameterOverride<float>)(object)val.fogPower).value = 2f;
			((ParameterOverride<float>)(object)val.fogZero).value = -0.01f;
			((ParameterOverride<float>)(object)val.skyboxStrength).value = 0.1f;
			((ParameterOverride<Color>)(object)val2.fogColorStart).value = Color32.op_Implicit(new Color32((byte)190, (byte)154, (byte)150, (byte)15));
			((ParameterOverride<Color>)(object)val2.fogColorMid).value = Color32.op_Implicit(new Color32((byte)110, (byte)73, (byte)69, (byte)100));
			((ParameterOverride<Color>)(object)val2.fogColorEnd).value = Color32.op_Implicit(new Color32((byte)90, (byte)47, (byte)44, (byte)200));
			((ParameterOverride<float>)(object)val2.fogHeightStart).value = 0f;
			((ParameterOverride<float>)(object)val2.fogHeightEnd).value = 100f;
			((ParameterOverride<float>)(object)val2.fogHeightIntensity).value = 0f;
			((ParameterOverride<float>)(object)val2.fogIntensity).value = 1f;
			((ParameterOverride<float>)(object)val2.fogOne).value = 0.15f;
			((ParameterOverride<float>)(object)val2.fogPower).value = 2f;
			((ParameterOverride<float>)(object)val2.fogZero).value = -0.01f;
			((ParameterOverride<float>)(object)val2.skyboxStrength).value = 0f;
			((ParameterOverride<Color>)(object)val3.fogColorStart).value = Color32.op_Implicit(new Color32((byte)235, (byte)235, (byte)205, (byte)25));
			((ParameterOverride<Color>)(object)val3.fogColorMid).value = Color32.op_Implicit(new Color32((byte)252, (byte)253, (byte)196, (byte)150));
			((ParameterOverride<Color>)(object)val3.fogColorEnd).value = Color32.op_Implicit(new Color32((byte)14, (byte)212, byte.MaxValue, (byte)225));
			((ParameterOverride<float>)(object)val3.fogHeightStart).value = 0f;
			((ParameterOverride<float>)(object)val3.fogHeightEnd).value = 100f;
			((ParameterOverride<float>)(object)val3.fogHeightIntensity).value = 0f;
			((ParameterOverride<float>)(object)val3.fogIntensity).value = 0.5f;
			((ParameterOverride<float>)(object)val3.fogOne).value = 0.4f;
			((ParameterOverride<float>)(object)val3.fogPower).value = 2f;
			((ParameterOverride<float>)(object)val3.fogZero).value = 0f;
			((ParameterOverride<float>)(object)val3.skyboxStrength).value = 0.1f;
			((ParameterOverride<Color>)(object)val4.fogColorStart).value = Color32.op_Implicit(new Color32((byte)171, (byte)151, (byte)191, (byte)25));
			((ParameterOverride<Color>)(object)val4.fogColorMid).value = Color32.op_Implicit(new Color32((byte)120, (byte)120, (byte)175, (byte)150));
			((ParameterOverride<Color>)(object)val4.fogColorEnd).value = Color32.op_Implicit(new Color32((byte)100, (byte)75, (byte)150, (byte)225));
			((ParameterOverride<float>)(object)val4.fogHeightStart).value = 0f;
			((ParameterOverride<float>)(object)val4.fogHeightEnd).value = 100f;
			((ParameterOverride<float>)(object)val4.fogHeightIntensity).value = 0f;
			((ParameterOverride<float>)(object)val4.fogIntensity).value = 0.9f;
			((ParameterOverride<float>)(object)val4.fogOne).value = 0.15f;
			((ParameterOverride<float>)(object)val4.fogPower).value = 1.75f;
			((ParameterOverride<float>)(object)val4.fogZero).value = -0.01f;
			((ParameterOverride<float>)(object)val4.skyboxStrength).value = 0.1f;
			((ParameterOverride<Color>)(object)val5.fogColorStart).value = Color32.op_Implicit(new Color32((byte)129, (byte)148, (byte)168, (byte)25));
			((ParameterOverride<Color>)(object)val5.fogColorMid).value = Color32.op_Implicit(new Color32((byte)68, (byte)104, (byte)116, (byte)150));
			((ParameterOverride<Color>)(object)val5.fogColorEnd).value = Color32.op_Implicit(new Color32((byte)55, (byte)63, (byte)81, byte.MaxValue));
			((ParameterOverride<float>)(object)val5.fogHeightStart).value = 0f;
			((ParameterOverride<float>)(object)val5.fogHeightEnd).value = 100f;
			((ParameterOverride<float>)(object)val5.fogHeightIntensity).value = 0f;
			((ParameterOverride<float>)(object)val5.fogIntensity).value = 1f;
			((ParameterOverride<float>)(object)val5.fogOne).value = 0.15f;
			((ParameterOverride<float>)(object)val5.fogPower).value = 1.75f;
			((ParameterOverride<float>)(object)val5.fogZero).value = 0f;
			((ParameterOverride<float>)(object)val5.skyboxStrength).value = 0.1f;
			SceneDirector.Start += new hook_Start(SceneDirector_Start);
		}

		private void SceneDirector_Start(orig_Start orig, SceneDirector self)
		{
			//IL_0000: Unknown result type (might be due to invalid IL or missing references)
			//IL_0005: Unknown result type (might be due to invalid IL or missing references)
			//IL_0396: Unknown result type (might be due to invalid IL or missing references)
			//IL_039b: 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_0411: Unknown result type (might be due to invalid IL or missing references)
			//IL_04b7: Unknown result type (might be due to invalid IL or missing references)
			//IL_04c8: Unknown result type (might be due to invalid IL or missing references)
			//IL_04cd: Unknown result type (might be due to invalid IL or missing references)
			//IL_04d9: Unknown result type (might be due to invalid IL or missing references)
			//IL_04de: Unknown result type (might be due to invalid IL or missing references)
			//IL_04f0: Unknown result type (might be due to invalid IL or missing references)
			//IL_0508: Unknown result type (might be due to invalid IL or missing references)
			//IL_050d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0750: Unknown result type (might be due to invalid IL or missing references)
			//IL_0cca: Unknown result type (might be due to invalid IL or missing references)
			//IL_0af9: Unknown result type (might be due to invalid IL or missing references)
			//IL_0afe: Unknown result type (might be due to invalid IL or missing references)
			//IL_0daf: Unknown result type (might be due to invalid IL or missing references)
			//IL_0db4: Unknown result type (might be due to invalid IL or missing references)
			//IL_0dc6: Unknown result type (might be due to invalid IL or missing references)
			//IL_0dcb: Unknown result type (might be due to invalid IL or missing references)
			//IL_0ddd: Unknown result type (might be due to invalid IL or missing references)
			//IL_0de2: Unknown result type (might be due to invalid IL or missing references)
			//IL_0e9c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0ea1: Unknown result type (might be due to invalid IL or missing references)
			//IL_0eba: Unknown result type (might be due to invalid IL or missing references)
			//IL_0ebf: Unknown result type (might be due to invalid IL or missing references)
			//IL_0c90: Unknown result type (might be due to invalid IL or missing references)
			Scene activeScene = SceneManager.GetActiveScene();
			string name = ((Scene)(ref activeScene)).name;
			SceneInfo instance = SceneInfo.instance;
			PostProcessVolume val;
			GameObject val2;
			if (Object.op_Implicit((Object)(object)instance) && whitelistedMaps.Contains(name))
			{
				val = ((Component)instance).GetComponent<PostProcessVolume>();
				if (!Object.op_Implicit((Object)(object)val) || !((Behaviour)val).isActiveAndEnabled)
				{
					val2 = GameObject.Find("PP + Amb");
					if (Object.op_Implicit((Object)(object)val2))
					{
						bool? obj;
						if (val2 == null)
						{
							obj = null;
						}
						else
						{
							PostProcessVolume component = val2.GetComponent<PostProcessVolume>();
							obj = ((component != null) ? new bool?(!((Behaviour)component).isActiveAndEnabled) : null);
						}
						bool? flag = obj;
						if (!flag.GetValueOrDefault(true))
						{
							goto IL_00aa;
						}
					}
					val2 = GameObject.Find("PP, Global");
					goto IL_00aa;
				}
				goto IL_0232;
			}
			goto IL_0ef3;
			IL_0154:
			if (Object.op_Implicit((Object)(object)val2))
			{
				bool? obj2;
				if (val2 == null)
				{
					obj2 = null;
				}
				else
				{
					PostProcessVolume component2 = val2.GetComponent<PostProcessVolume>();
					obj2 = ((component2 != null) ? new bool?(!((Behaviour)component2).isActiveAndEnabled) : null);
				}
				bool? flag = obj2;
				if (!flag.GetValueOrDefault(true))
				{
					goto IL_01e3;
				}
			}
			GameObject obj3 = GameObject.Find("MapZones");
			object obj4;
			if (obj3 == null)
			{
				obj4 = null;
			}
			else
			{
				Transform transform = obj3.transform;
				if (transform == null)
				{
					obj4 = null;
				}
				else
				{
					Transform obj5 = transform.Find("PostProcess Zones");
					if (obj5 == null)
					{
						obj4 = null;
					}
					else
					{
						Transform obj6 = obj5.Find("SandOvercast");
						obj4 = ((obj6 != null) ? ((Component)obj6).gameObject : null);
					}
				}
			}
			val2 = (GameObject)obj4;
			goto IL_01e3;
			IL_0232:
			if (Object.op_Implicit((Object)(object)val))
			{
				int index = rng.Next(themeMaterials1.Count);
				Material[] array = themeMaterials1[index];
				int index2 = rng.Next(themeMaterials2.Count);
				Material[] array2 = themeMaterials2[index2];
				Material val3 = array[0];
				Material val4 = array[1];
				Material val5 = array[2];
				Material val6 = array[3];
				Material val7 = array2[0];
				Material val8 = array2[1];
				Material val9 = array2[2];
				Material val10 = array2[3];
				List<PostProcessProfile> list = new List<PostProcessProfile>();
				if (enableWinter.Value)
				{
					list.Add(pp1);
				}
				if (enableFantasy.Value)
				{
					list.Add(pp2);
				}
				if (enableAuburn.Value)
				{
					list.Add(pp3);
				}
				if (enableAfternoon.Value)
				{
					list.Add(pp4);
				}
				if (enableDrowned.Value)
				{
					list.Add(pp5);
				}
				if (enableDreary.Value)
				{
					list.Add(pp6);
				}
				int index3 = rng.Next(list.Count);
				PostProcessProfile val11 = list[index3];
				if (name != "moon2")
				{
					val.profile = val11;
				}
				RampFog setting = val11.GetSetting<RampFog>();
				GameObject val12 = GameObject.Find("Directional Light (SUN)");
				Color color = Color.gray;
				if (Object.op_Implicit((Object)(object)val12))
				{
					Light component3 = val12.GetComponent<Light>();
					if (((Object)val11).name == "Midnight Dreary")
					{
						component3.color = new Color(((ParameterOverride<Color>)(object)setting.fogColorStart).value.r + 0.1f, ((ParameterOverride<Color>)(object)setting.fogColorStart).value.g + 0.1f, ((ParameterOverride<Color>)(object)setting.fogColorStart).value.b + 0.1f, 1f);
					}
					else
					{
						component3.color = new Color(((ParameterOverride<Color>)(object)setting.fogColorStart).value.r, ((ParameterOverride<Color>)(object)setting.fogColorStart).value.g, ((ParameterOverride<Color>)(object)setting.fogColorStart).value.b, 1f);
					}
					switch (name)
					{
					case "lakes":
					case "wispgraveyard":
					case "ancientloft":
					case "golemplains":
					case "golemplains2":
					case "goolake":
					{
						SetAmbientLight component4 = ((Component)val).GetComponent<SetAmbientLight>();
						component4.ambientMode = (AmbientMode)3;
						component4.ambientIntensity = 0.75f;
						component4.ambientSkyColor = Color.gray;
						component4.ApplyLighting();
						color = component3.color;
						break;
					}
					default:
					{
						SetAmbientLight obj7 = ((Component)component3).gameObject.AddComponent<SetAmbientLight>();
						obj7.ambientMode = (AmbientMode)3;
						obj7.setAmbientLightColor = true;
						obj7.ambientIntensity = 0.75f;
						obj7.ambientSkyColor = Color.gray;
						obj7.ApplyLighting();
						break;
					}
					}
					component3.shadowStrength = 0.75f;
					bool flag2;
					bool flag3;
					switch (name)
					{
					case "foggyswamp":
					case "sulfurpools":
					case "shipgraveyard":
					case "dampcavesimple":
						flag2 = IsBright(val7);
						flag3 = ((Object)val7).name.Contains("matDC");
						break;
					default:
						flag2 = IsBright(val3);
						flag3 = ((Object)val3).name.Contains("matDC");
						break;
					}
					if (flag2)
					{
						if (name == "snowyforest" || name == "skymeadow" || name.Contains("blackbeach") || name == "shipgraveyard")
						{
							component3.intensity = 1f;
						}
						else if (flag3 && ((Object)val11).name.Contains("void"))
						{
							component3.intensity = 1.25f;
						}
						else if (name == "dampcavesimple" || flag3)
						{
							component3.intensity = (((Object)val7).name.Contains("snowy") ? 0.75f : 1f);
							component3.shadowStrength = 0.5f;
						}
						else
						{
							component3.intensity = 0.5f;
						}
					}
					else if (name == "snowyforest" || name == "skymeadow" || name.Contains("blackbeach") || name == "shipgraveyard")
					{
						component3.intensity = 1.5f;
					}
					else if (name == "dampcavesimple" || flag3)
					{
						component3.intensity = 2f;
						component3.shadowStrength = 0.5f;
					}
					else
					{
						component3.intensity = 1f;
					}
					if (name == "frozenwall")
					{
						component3.intensity = 1f;
					}
					if (((Object)val11).name == "Midnight Dreary")
					{
						component3.intensity *= 1.25f;
						component3.shadowStrength = 0.5f;
					}
					if (name == "goolake" || name == "frozenwall")
					{
						Light component5 = Object.Instantiate<GameObject>(GameObject.Find("Directional Light (SUN)")).GetComponent<Light>();
						component5.color = component3.color;
						component5.intensity = component3.intensity;
						val12.SetActive(false);
						((Object)val12).name = "Fake Sun";
					}
					switch (name)
					{
					case "foggyswamp":
					case "sulfurpools":
					case "shipgraveyard":
					case "dampcavesimple":
						Debug.LogWarning((object)("Terrain Alt Material: " + ((Object)val7).name));
						Debug.LogWarning((object)("Detail Alt (Rocks) Material: " + ((Object)val8).name));
						Debug.LogWarning((object)("Detail2 Alt (Ruins) Material: " + ((Object)val9).name));
						Debug.LogWarning((object)("Detail3 Alt (Trees) Material: " + ((Object)val10).name));
						Debug.LogWarning((object)("Post Process Profile : " + ((Object)val11).name));
						break;
					default:
						Debug.LogWarning((object)("Terrain Material: " + ((Object)val3).name));
						Debug.LogWarning((object)("Detail (Rocks) Material: " + ((Object)val4).name));
						Debug.LogWarning((object)("Detail2 (Ruins) Material: " + ((Object)val5).name));
						Debug.LogWarning((object)("Detail3 (Trees) Material: " + ((Object)val6).name));
						Debug.LogWarning((object)("Post Process Profile: " + ((Object)val11).name));
						break;
					}
					switch (name)
					{
					case "lakes":
						Stage1.Falls(val7, val8, val9, val10, Color32.op_Implicit(component3.color));
						break;
					case "blackbeach":
						Stage1.Roost1(val3, val4, val5);
						break;
					case "blackbeach2":
						Stage1.Roost2(val3, val4, val5);
						break;
					case "golemplains":
						Stage1.Plains(val3, val4, val5);
						break;
					case "golemplains2":
						Stage1.Plains(val3, val4, val5);
						break;
					case "snowyforest":
						Stage1.Forest(val3, val4, val5, val6);
						break;
					case "goolake":
						Stage2.Aqueduct(val3, val4, val5, val6);
						break;
					case "ancientloft":
					{
						GameObject val13 = GameObject.Find("DeepFog");
						if (Object.op_Implicit((Object)(object)val13))
						{
							val13.SetActive(false);
						}
						Stage2.Aphelian(val3, val4, val5, val6);
						break;
					}
					case "foggyswamp":
						Stage2.Wetland(val7, val8, val9, val10);
						break;
					case "frozenwall":
						Stage3.RPD(val3, val4, val5);
						break;
					case "wispgraveyard":
						Stage3.Acres(val3, val4, val5);
						break;
					case "sulfurpools":
						GameObject.Find("SPCavePP").SetActive(false);
						((Component)GameObject.Find("CameraRelative").transform.GetChild(1)).gameObject.SetActive(false);
						Stage3.Pools(val7, val8, val9);
						break;
					case "rootjungle":
						Stage4.Grove(val3, val4, val5, val6);
						break;
					case "shipgraveyard":
						Stage4.Sirens(val7, val8, val9);
						break;
					case "dampcavesimple":
					{
						GameObject val14 = GameObject.Find("Main Camera(Clone)");
						if (Object.op_Implicit((Object)(object)val14))
						{
							((Component)val14.transform.GetChild(0)).GetComponent<PostProcessLayer>().breakBeforeColorGrading = true;
						}
						if (((Object)val7).name.Contains("Snowy"))
						{
							Stage4.Abyssal(val7, val10, val8, val9);
						}
						else
						{
							Stage4.Abyssal(val7, val8, val10, val9);
						}
						AbyssalLighting(color);
						if (Object.op_Implicit((Object)(object)GameObject.Find("DCPPInTunnels")))
						{
							GameObject.Find("DCPPInTunnels").SetActive(false);
						}
						break;
					}
					case "skymeadow":
						Stage5.SkyMeadow(val3, val4, val6, val5, component3.color);
						break;
					case "moon2":
					{
						Transform child = GameObject.Find("EscapeSequenceController").transform.GetChild(0);
						((Component)child.GetChild(0)).GetComponent<PostProcessVolume>().priority = 10001f;
						((Component)child.GetChild(6)).GetComponent<PostProcessVolume>().weight = 0.47f;
						((Component)child.GetChild(6)).GetComponent<PostProcessVolume>().sharedProfile.settings[0].active = false;
						RampFog setting2 = val.profile.GetSetting<RampFog>();
						((ParameterOverride<float>)(object)setting2.fogIntensity).value = ((ParameterOverride<float>)(object)setting.fogIntensity).value;
						((ParameterOverride<float>)(object)setting2.fogPower).value = ((ParameterOverride<float>)(object)setting.fogPower).value;
						((ParameterOverride<float>)(object)setting2.fogZero).value = ((ParameterOverride<float>)(object)setting.fogZero).value;
						((ParameterOverride<float>)(object)setting2.fogOne).value = ((ParameterOverride<float>)(object)setting.fogOne).value;
						((ParameterOverride<Color>)(object)setting2.fogColorStart).value = ((ParameterOverride<Color>)(object)setting.fogColorStart).value;
						((ParameterOverride<Color>)(object)setting2.fogColorMid).value = ((ParameterOverride<Color>)(object)setting.fogColorMid).value;
						((ParameterOverride<Color>)(object)setting2.fogColorEnd).value = ((ParameterOverride<Color>)(object)setting.fogColorEnd).value;
						((ParameterOverride<float>)(object)setting2.skyboxStrength).value = ((ParameterOverride<float>)(object)setting.skyboxStrength).value;
						((Component)GameObject.Find("HOLDER: Gameplay Space").transform.GetChild(0).Find("Quadrant 4: Starting Temple").GetChild(0)
							.GetChild(0)
							.Find("FX")
							.GetChild(0)).GetComponent<PostProcessVolume>().weight = 0.28f;
						HookLightingIntoPostProcessVolume component6 = ((Component)GameObject.Find("HOLDER: Gameplay Space").transform.GetChild(0).Find("Quadrant 4: Starting Temple").GetChild(0)
							.GetChild(0)
							.Find("FX")
							.GetChild(0)).GetComponent<HookLightingIntoPostProcessVolume>();
						component6.overrideAmbientColor = new Color(0.4138f, 0.4086f, 0.45f, 1f);
						component6.overrideDirectionalColor = new Color(0.4012f, 0.4091f, 0.4226f, 1f);
						if (((Object)val3).name.Contains("Snowy"))
						{
							Stage6.Moon(val3, val6, val5, val4);
						}
						else
						{
							Stage6.Moon(val3, val4, val5, val6);
						}
						break;
					}
					}
				}
			}
			goto IL_0ef3;
			IL_00ff:
			if (Object.op_Implicit((Object)(object)val2))
			{
				bool? obj8;
				if (val2 == null)
				{
					obj8 = null;
				}
				else
				{
					PostProcessVolume component7 = val2.GetComponent<PostProcessVolume>();
					obj8 = ((component7 != null) ? new bool?(!((Behaviour)component7).isActiveAndEnabled) : null);
				}
				bool? flag = obj8;
				if (!flag.GetValueOrDefault(true))
				{
					goto IL_0154;
				}
			}
			val2 = GameObject.Find("PP+Amb");
			goto IL_0154;
			IL_01e3:
			if (Object.op_Implicit((Object)(object)val2))
			{
				val = val2.GetComponent<PostProcessVolume>();
			}
			if (name == "moon2")
			{
				val = ((Component)instance).gameObject.AddComponent<PostProcessVolume>();
				val.profile.AddSettings<RampFog>();
				((Behaviour)val).enabled = true;
				val.isGlobal = true;
				val.priority = 9999f;
			}
			goto IL_0232;
			IL_00aa:
			if (Object.op_Implicit((Object)(object)val2))
			{
				bool? obj9;
				if (val2 == null)
				{
					obj9 = null;
				}
				else
				{
					PostProcessVolume component8 = val2.GetComponent<PostProcessVolume>();
					obj9 = ((component8 != null) ? new bool?(!((Behaviour)component8).isActiveAndEnabled) : null);
				}
				bool? flag = obj9;
				if (!flag.GetValueOrDefault(true))
				{
					goto IL_00ff;
				}
			}
			val2 = GameObject.Find("GlobalPostProcessVolume, Base");
			goto IL_00ff;
			IL_0ef3:
			orig.Invoke(self);
		}

		public static void AbyssalLighting(Color color)
		{
			//IL_0117: 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_007c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0081: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b8: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f9: Unknown result type (might be due to invalid IL or missing references)
			Light[] array = Object.FindObjectsOfType(typeof(Light)) as Light[];
			foreach (Light val in array)
			{
				GameObject gameObject = ((Component)val).gameObject;
				if (!((Object)(object)gameObject != (Object)null))
				{
					continue;
				}
				if ((Object)(object)gameObject.transform.parent != (Object)null)
				{
					if (((Object)((Component)((Component)val).gameObject.transform.parent).gameObject).name.Equals("DCCoralPropMediumActive"))
					{
						val.color = color;
						Vector3 localPosition = ((Component)val).transform.localPosition;
						localPosition.z = 4f;
					}
					else if (((Object)((Component)((Component)val).gameObject.transform.parent).gameObject).name.Contains("DCCrystalCluster Variant"))
					{
						val.color = color;
						val.intensity *= 1.5f;
					}
					else if (((Object)((Component)((Component)val).gameObject.transform.parent).gameObject).name.Contains("DCCrystalLarge"))
					{
						val.color = color;
					}
				}
				if (((Object)((Component)val).gameObject).name.Equals("CrystalLight"))
				{
					val.color = color;
				}
			}
		}

		public float CalculateLuminance(Color color)
		{
			//IL_0005: Unknown result type (might be due to invalid IL or missing references)
			//IL_0011: 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)
			return 0.2126f * color.r + 0.7152f * color.g + 0.0722f * color.b;
		}

		public Color BrightenColor(Color color, float brightenAmount)
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_007c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0042: Unknown result type (might be due to invalid IL or missing references)
			//IL_0056: Unknown result type (might be due to invalid IL or missing references)
			//IL_006a: Unknown result type (might be due to invalid IL or missing references)
			float num = CalculateLuminance(color);
			Debug.LogWarning((object)$"Luminance: {num}");
			if (num < 0.7f)
			{
				if (num < 0.6f)
				{
					brightenAmount *= 2f;
				}
				Debug.LogWarning((object)"Too dark, brightening light color");
				color.r = Mathf.Clamp01(color.r + brightenAmount);
				color.g = Mathf.Clamp01(color.g + brightenAmount);
				color.b = Mathf.Clamp01(color.b + brightenAmount);
			}
			return color;
		}

		private bool IsBright(Material material)
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			//IL_000c: 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)
			//IL_0025: Unknown result type (might be due to invalid IL or missing references)
			Color color = material.color;
			if (0.2126f * color.r + 0.7152f * color.g + 0.0722f * color.b < 0.7f)
			{
				return false;
			}
			return true;
		}
	}
	public class Stage1
	{
		private static Texture2D terrainSandTex = Addressables.LoadAssetAsync<Texture2D>((object)"RoR2/CU8/lakes/texTLTerrainSand.tga").WaitForCompletion();

		private static Texture2D tlDirtTex = Addressables.LoadAssetAsync<Texture2D>((object)"RoR2/CU8/lakes/texTLTerrainDirt.tga").WaitForCompletion();

		public static void Falls(Material terrainMat, Material detailMat, Material detailMat2, Material detailMat3, Color32 color)
		{
			//IL_00fe: Unknown result type (might be due to invalid IL or missing references)
			//IL_0100: Unknown result type (might be due to invalid IL or missing references)
			if (!Object.op_Implicit((Object)(object)terrainMat) || !Object.op_Implicit((Object)(object)detailMat) || !Object.op_Implicit((Object)(object)detailMat2) || !Object.op_Implicit((Object)(object)detailMat3))
			{
				return;
			}
			MeshRenderer[] array = Object.FindObjectsOfType(typeof(MeshRenderer)) as MeshRenderer[];
			foreach (MeshRenderer val in array)
			{
				GameObject gameObject = ((Component)val).gameObject;
				if (!((Object)(object)gameObject != (Object)null))
				{
					continue;
				}
				if (((Object)gameObject).name.Contains("TLTerrain") && !((Object)gameObject).name.Contains("Vines") && !((Object)gameObject).name.Contains("GiantFlower") && !((Object)gameObject).name.Contains("Ship") && Object.op_Implicit((Object)(object)((Renderer)val).sharedMaterial))
				{
					((Renderer)val).sharedMaterial = terrainMat;
				}
				if ((((Object)gameObject).name.Contains("TLTerrain_GiantFlower") || ((Object)gameObject).name.Contains("TLTerrain_TreePads")) && Object.op_Implicit((Object)(object)((Renderer)val).sharedMaterial))
				{
					Material[] sharedMaterials = ((Renderer)val).sharedMaterials;
					for (int j = 0; j < sharedMaterials.Length; j++)
					{
						sharedMaterials[j].color = Color32.op_Implicit(color);
					}
				}
				if (((Object)gameObject).name.Contains("Grass") && Object.op_Implicit((Object)(object)((Renderer)val).sharedMaterial))
				{
					Object.Destroy((Object)(object)gameObject);
				}
				if (((Object)gameObject).name.Contains("Vines") || (((Object)gameObject).name.Contains("TLRoot") && Object.op_Implicit((Object)(object)((Renderer)val).sharedMaterial)))
				{
					((Renderer)val).sharedMaterial = detailMat3;
				}
				if ((((Object)gameObject).name.Contains("TLTerrain_Ship") || ((Object)gameObject).name.Contains("TLArchi") || ((Object)gameObject).name.Contains("TLDoor")) && Object.op_Implicit((Object)(object)((Renderer)val).sharedMaterial))
				{
					((Renderer)val).sharedMaterial = detailMat2;
				}
				if (((Object)gameObject).name.Contains("TLRock") && Object.op_Implicit((Object)(object)((Renderer)val).sharedMaterial))
				{
					((Renderer)val).sharedMaterial = detailMat;
				}
			}
		}

		public static void Roost1(Material terrainMat, Material detailMat, Material detailMat2)
		{
			if (!Object.op_Implicit((Object)(object)terrainMat) || !Object.op_Implicit((Object)(object)detailMat) || !Object.op_Implicit((Object)(object)detailMat2))
			{
				return;
			}
			((Renderer)((Component)GameObject.Find("GAMEPLAY SPACE").transform.GetChild(7).GetChild(0)).GetComponent<MeshRenderer>()).sharedMaterial = terrainMat;
			((Renderer)((Component)GameObject.Find("GAMEPLAY SPACE").transform.GetChild(7).GetChild(1)).GetComponent<MeshRenderer>()).sharedMaterial = terrainMat;
			MeshRenderer[] array = Object.FindObjectsOfType(typeof(MeshRenderer)) as MeshRenderer[];
			foreach (MeshRenderer val in array)
			{
				GameObject gameObject = ((Component)val).gameObject;
				if ((Object)(object)gameObject != (Object)null)
				{
					if (((Object)gameObject).name.Contains("Grass") && Object.op_Implicit((Object)(object)((Renderer)val).sharedMaterial))
					{
						Object.Destroy((Object)(object)gameObject);
					}
					if ((((Object)gameObject).name.Contains("Boulder") || ((Object)gameObject).name.Contains("Rock") || ((Object)gameObject).name.Contains("Step") || ((Object)gameObject).name.Contains("Tile") || ((Object)gameObject).name.Contains("mdlGeyser") || ((Object)gameObject).name.Contains("Pebble") || ((Object)gameObject).name.Contains("Detail")) && Object.op_Implicit((Object)(object)((Renderer)val).sharedMaterial))
					{
						((Renderer)val).sharedMaterial = detailMat;
					}
					if ((((Object)gameObject).name.Contains("Bowl") || ((Object)gameObject).name.Contains("Marker") || ((Object)gameObject).name.Contains("RuinPillar") || ((Object)gameObject).name.Contains("RuinArch") || ((Object)gameObject).name.Contains("RuinGate")) && Object.op_Implicit((Object)(object)((Renderer)val).sharedMaterial))
					{
						((Renderer)val).sharedMaterial = detailMat2;
					}
					if ((((Object)gameObject).name.Contains("DistantPillar") || ((Object)gameObject).name.Contains("Cliff") || ((Object)gameObject).name.Contains("ClosePillar")) && Object.op_Implicit((Object)(object)((Renderer)val).sharedMaterial))
					{
						((Renderer)val).sharedMaterial = terrainMat;
					}
				}
			}
		}

		public static void Roost2(Material terrainMat, Material detailMat, Material detailMat2)
		{
			if (!Object.op_Implicit((Object)(object)terrainMat) || !Object.op_Implicit((Object)(object)detailMat) || !Object.op_Implicit((Object)(object)detailMat2))
			{
				return;
			}
			Transform child = GameObject.Find("HOLDER: Terrain").transform.GetChild(0);
			((Renderer)((Component)child.GetChild(0)).GetComponent<MeshRenderer>()).sharedMaterial = terrainMat;
			((Renderer)((Component)child.GetChild(1)).GetComponent<MeshRenderer>()).sharedMaterial = terrainMat;
			((Renderer)((Component)child.GetChild(2)).GetComponent<MeshRenderer>()).sharedMaterial = terrainMat;
			MeshRenderer[] array = Object.FindObjectsOfType(typeof(MeshRenderer)) as MeshRenderer[];
			foreach (MeshRenderer val in array)
			{
				GameObject gameObject = ((Component)val).gameObject;
				if ((Object)(object)gameObject != (Object)null)
				{
					if (((Object)gameObject).name.Contains("Grass") && Object.op_Implicit((Object)(object)((Renderer)val).sharedMaterial))
					{
						Object.Destroy((Object)(object)gameObject);
					}
					if ((((Object)gameObject).name.Contains("Boulder") || ((Object)gameObject).name.Contains("boulder") || ((Object)gameObject).name.Contains("Rock") || ((Object)gameObject).name.Contains("Step") || ((Object)gameObject).name.Contains("Tile") || ((Object)gameObject).name.Contains("mdlGeyser") || ((Object)gameObject).name.Contains("Bowl") || ((Object)gameObject).name.Contains("Marker") || ((Object)gameObject).name.Contains("RuinPillar") || ((Object)gameObject).name.Contains("DistantBridge")) && Object.op_Implicit((Object)(object)((Renderer)val).sharedMaterial))
					{
						((Renderer)val).sharedMaterial = detailMat;
					}
					if ((((Object)gameObject).name.Contains("Bowl") || ((Object)gameObject).name.Contains("Marker") || ((Object)gameObject).name.Contains("RuinPillar") || ((Object)gameObject).name.Contains("RuinArch") || ((Object)gameObject).name.Contains("RuinGate")) && Object.op_Implicit((Object)(object)((Renderer)val).sharedMaterial))
					{
						((Renderer)val).sharedMaterial = detailMat2;
					}
					if ((((Object)gameObject).name.Contains("DistantPillar") || ((Object)gameObject).name.Contains("Cliff") || ((Object)gameObject).name.Contains("ClosePillar")) && Object.op_Implicit((Object)(object)((Renderer)val).sharedMaterial))
					{
						((Renderer)val).sharedMaterial = terrainMat;
					}
				}
			}
		}

		public static void Plains(Material terrainMat, Material detailMat, Material detailMat2)
		{
			if (!Object.op_Implicit((Object)(object)terrainMat) || !Object.op_Implicit((Object)(object)detailMat) || !Object.op_Implicit((Object)(object)detailMat2))
			{
				return;
			}
			MeshRenderer[] array = Object.FindObjectsOfType(typeof(MeshRenderer)) as MeshRenderer[];
			foreach (MeshRenderer val in array)
			{
				GameObject gameObject = ((Component)val).gameObject;
				if ((Object)(object)gameObject != (Object)null)
				{
					if (((Object)gameObject).name.Contains("Grass") && Object.op_Implicit((Object)(object)((Renderer)val).sharedMaterial))
					{
						Object.Destroy((Object)(object)gameObject);
					}
					if ((((Object)gameObject).name.Contains("Terrain") || ((Object)gameObject).name == "Wall North") && Object.op_Implicit((Object)(object)((Renderer)val).sharedMaterial))
					{
						((Renderer)val).sharedMaterial = terrainMat;
					}
					if ((((Object)gameObject).name.Contains("Rock") || ((Object)gameObject).name.Contains("Boulder") || ((Object)gameObject).name.Contains("mdlGeyser")) && Object.op_Implicit((Object)(object)((Renderer)val).sharedMaterial))
					{
						((Renderer)val).sharedMaterial = detailMat;
					}
					if (((Object)gameObject).name.Contains("Ring") && Object.op_Implicit((Object)(object)((Renderer)val).sharedMaterial))
					{
						((Renderer)val).sharedMaterial = detailMat2;
					}
					if ((((Object)gameObject).name.Contains("Block") || ((Object)gameObject).name.Contains("MiniBridge") || ((Object)gameObject).name.Contains("Circle")) && Object.op_Implicit((Object)(object)((Renderer)val).sharedMaterial))
					{
						((Renderer)val).sharedMaterial = detailMat2;
					}
				}
			}
		}

		public static void Forest(Material terrainMat, Material detailMat, Material detailMat2, Material detailMat3)
		{
			if (!Object.op_Implicit((Object)(object)terrainMat) || !Object.op_Implicit((Object)(object)detailMat) || !Object.op_Implicit((Object)(object)detailMat2) || !Object.op_Implicit((Object)(object)detailMat3))
			{
				return;
			}
			MeshRenderer[] array = Object.FindObjectsOfType(typeof(MeshRenderer)) as MeshRenderer[];
			foreach (MeshRenderer val in array)
			{
				GameObject gameObject = ((Component)val).gameObject;
				if ((Object)(object)gameObject != (Object)null)
				{
					if (((Object)gameObject).name.Contains("Grass") && Object.op_Implicit((Object)(object)((Renderer)val).sharedMaterial))
					{
						Object.Destroy((Object)(object)gameObject);
					}
					if (((Object)gameObject).name == "meshSnowyForestGiantTreesTops")
					{
						gameObject.gameObject.SetActive(false);
					}
					if ((((Object)gameObject).name.Contains("Terrain") || ((Object)gameObject).name.Contains("SnowPile")) && Object.op_Implicit((Object)(object)((Renderer)val).sharedMaterial))
					{
						((Renderer)val).sharedMaterial = terrainMat;
					}
					if ((((Object)gameObject).name.Contains("Pebble") || ((Object)gameObject).name.Contains("Rock") || ((Object)gameObject).name.Contains("mdlSFCeilingSpikes")) && Object.op_Implicit((Object)(object)((Renderer)val).sharedMaterial))
					{
						((Renderer)val).sharedMaterial = detailMat;
					}
					if ((((Object)gameObject).name.Contains("RuinGate") || ((Object)gameObject).name.Contains("meshSnowyForestAqueduct") || ((Object)gameObject).name == "meshSnowyForestFirepitFloor" || ((Object)gameObject).name.Contains("meshSnowyForestFirepitRing") || ((Object)gameObject).name.Contains("meshSnowyForestFirepitJar") || (((Object)gameObject).name.Contains("meshSnowyForestPot") && ((Object)gameObject).name != "meshSnowyForestPotSap") || ((Object)gameObject).name.Contains("mdlSFHangingLantern") || ((Object)gameObject).name.Contains("mdlSFBrokenLantern") || ((Object)gameObject).name.Contains("meshSnowyForestCrate")) && Object.op_Implicit((Object)(object)((Renderer)val).sharedMaterial))
					{
						((Renderer)val).sharedMaterial = detailMat2;
					}
					if ((((Object)gameObject).name.Contains("meshSnowyForestTreeLog") || ((Object)gameObject).name.Contains("meshSnowyForestTreeTrunk") || ((Object)gameObject).name.Contains("meshSnowyForestGiantTrees") || ((Object)gameObject).name.Contains("meshSnowyForestSurroundingTrees")) && Object.op_Implicit((Object)(object)((Renderer)val).sharedMaterial))
					{
						((Renderer)val).sharedMaterial = detailMat3;
					}
					if (((Object)gameObject).name.Contains("mdlSnowyForestTreeStump") && Object.op_Implicit((Object)(object)((Renderer)val).sharedMaterial))
					{
						((Renderer)val).sharedMaterial = detailMat3;
						((Renderer)val).sharedMaterials = (Material[])(object)new Material[2] { detailMat3, detailMat3 };
					}
				}
			}
		}
	}
	public class Stage2
	{
		public static void Wetland(Material terrainMat, Material detailMat, Material detailMat2, Material detailMat3)
		{
			Transform transform = GameObject.Find("HOLDER: Hero Assets").transform;
			if (!Object.op_Implicit((Object)(object)terrainMat) || !Object.op_Implicit((Object)(object)detailMat) || !Object.op_Implicit((Object)(object)detailMat2) || !Object.op_Implicit((Object)(object)detailMat3))
			{
				return;
			}
			((Renderer)((Component)transform.GetChild(0)).GetComponent<MeshRenderer>()).sharedMaterial = terrainMat;
			((Renderer)((Component)transform.GetChild(1)).GetComponent<MeshRenderer>()).sharedMaterial = terrainMat;
			((Renderer)((Component)transform.GetChild(2)).GetComponent<MeshRenderer>()).sharedMaterial = terrainMat;
			((Renderer)((Component)transform.GetChild(3).GetChild(2)).GetComponent<MeshRenderer>()).sharedMaterial = terrainMat;
			((Renderer)((Component)transform.GetChild(6)).GetComponent<MeshRenderer>()).sharedMaterial = terrainMat;
			((Renderer)((Component)GameObject.Find("HOLDER: Ruin Pieces").transform.GetChild(6)).gameObject.GetComponent<MeshRenderer>()).sharedMaterial = detailMat;
			MeshRenderer[] array = Object.FindObjectsOfType(typeof(MeshRenderer)) as MeshRenderer[];
			foreach (MeshRenderer val in array)
			{
				GameObject gameObject = ((Component)val).gameObject;
				if (!((Object)(object)gameObject != (Object)null))
				{
					continue;
				}
				if ((((Object)gameObject).name.Contains("Boulder") || ((Object)gameObject).name.Contains("Pebble") || ((Object)gameObject).name.Contains("Blender") || ((Object)gameObject).name.Contains("Trunk")) && Object.op_Implicit((Object)(object)((Renderer)val).sharedMaterial))
				{
					((Renderer)val).sharedMaterial = detailMat;
					if (Object.op_Implicit((Object)(object)((Component)gameObject.transform).GetComponentInChildren<MeshRenderer>()))
					{
						((Renderer)((Component)gameObject.transform).GetComponentInChildren<MeshRenderer>()).sharedMaterial = detailMat;
					}
				}
				Transform parent = gameObject.transform.parent;
				if ((Object)(object)parent != (Object)null)
				{
					if (((Object)gameObject).name.Contains("Mesh") && (((Object)parent).name.Contains("FSTree") || ((Object)parent).name.Contains("FSRootBundle")))
					{
						((Renderer)val).sharedMaterial = detailMat3;
					}
					if (((Object)gameObject).name.Contains("Mesh") && ((Object)parent).name.Contains("FSRuinPillar"))
					{
						((Renderer)val).sharedMaterial = detailMat2;
					}
					if ((((Object)gameObject).name.Contains("RootBundleLargeCards") || ((Object)gameObject).name.Contains("RootBundleSmallCards")) && (((Object)parent).name.Contains("FSRootBundleLarge") || ((Object)parent).name.Contains("FSRootBundleSmall")))
					{
						gameObject.gameObject.SetActive(false);
					}
					if ((((Object)gameObject).name.Contains("RootBundleLarge_LOD0") || ((Object)gameObject).name.Contains("RootBundleLarge_LOD1") || ((Object)gameObject).name.Contains("RootBundleLarge_LOD2") || ((Object)gameObject).name.Contains("RootBundleSmall_LOD0") || ((Object)gameObject).name.Contains("RootBundleSmall_LOD1") || ((Object)gameObject).name.Contains("RootBundleSmall_LOD2")) && (((Object)parent).name.Contains("FSRootBundleLarge") || ((Object)parent).name.Contains("FSRootBundleSmall")))
					{
						((Renderer)val).sharedMaterial = detailMat3;
					}
				}
				if ((((Object)gameObject).name.Contains("Door") || ((Object)gameObject).name.Contains("Frame")) && Object.op_Implicit((Object)(object)((Renderer)val).sharedMaterial))
				{
					((Renderer)val).sharedMaterial = detailMat2;
				}
				if (((Object)gameObject).name.Contains("Ruin") && ((Object)gameObject).name != "FSGiantRuinDoorCollision" && Object.op_Implicit((Object)(object)((Renderer)val).sharedMaterial))
				{
					((Renderer)val).sharedMaterial = detailMat2;
				}
			}
		}

		public static void Aqueduct(Material terrainMat, Material detailMat, Material detailMat2, Material detailMat3)
		{
			if (!Object.op_Implicit((Object)(object)terrainMat) || !Object.op_Implicit((Object)(object)detailMat) || !Object.op_Implicit((Object)(object)detailMat2) || !Object.op_Implicit((Object)(object)detailMat3))
			{
				return;
			}
			MeshRenderer[] array = Object.FindObjectsOfType(typeof(MeshRenderer)) as MeshRenderer[];
			foreach (MeshRenderer val in array)
			{
				GameObject gameObject = ((Component)val).gameObject;
				if (!((Object)(object)gameObject != (Object)null))
				{
					continue;
				}
				if (((Object)gameObject).name.Contains("Grass") && Object.op_Implicit((Object)(object)((Renderer)val).sharedMaterial))
				{
					Object.Destroy((Object)(object)gameObject);
				}
				if (((Object)gameObject).name.Contains("Terrain") && Object.op_Implicit((Object)(object)((Renderer)val).sharedMaterial))
				{
					((Renderer)val).sharedMaterial = terrainMat;
				}
				if (((Object)gameObject).name.Contains("SandDune") && Object.op_Implicit((Object)(object)((Renderer)val).sharedMaterial))
				{
					((Renderer)val).sharedMaterial = terrainMat;
				}
				if ((((Object)gameObject).name.Contains("SandstonePillar") || ((Object)gameObject).name.Contains("Dam") || ((Object)gameObject).name.Contains("AqueductFullLong") || ((Object)gameObject).name.Contains("AqueductPartial") || ((Object)gameObject).name.Contains("RuinGate")) && Object.op_Implicit((Object)(object)((Renderer)val).sharedMaterial))
				{
					((Renderer)val).sharedMaterial = detailMat2;
				}
				if (((((Object)gameObject).name.Contains("Bridge") && !((Object)gameObject).name.Contains("Decal")) || ((Object)gameObject).name.Contains("RuinedRing") || ((Object)gameObject).name.Contains("Boulder") || ((Object)gameObject).name.Contains("Eel")) && Object.op_Implicit((Object)(object)((Renderer)val).sharedMaterial))
				{
					((Renderer)val).sharedMaterial = detailMat;
				}
				if ((((Object)gameObject).name.Contains("FlagPoleMesh") || ((Object)gameObject).name.Contains("RuinTile")) && Object.op_Implicit((Object)(object)((Renderer)val).sharedMaterial))
				{
					((Renderer)val).sharedMaterial = detailMat3;
				}
				if (!((Object)gameObject).name.Contains("AqueductCap"))
				{
					continue;
				}
				try
				{
					Material[] sharedMaterials = ((Renderer)val).sharedMaterials;
					for (int j = 0; j < sharedMaterials.Length; j++)
					{
						sharedMaterials[j] = detailMat2;
					}
					((Renderer)val).sharedMaterials = sharedMaterials;
				}
				catch (Exception ex)
				{
					Debug.LogWarning((object)(ex.Message + "\n" + ex.StackTrace));
				}
			}
		}

		public static void Aphelian(Material terrainMat, Material detailMat, Material detailMat2, Material detailMat3)
		{
			MeshRenderer[] array = Object.FindObjectsOfType(typeof(MeshRenderer)) as MeshRenderer[];
			SkinnedMeshRenderer[] array2 = Object.FindObjectsOfType(typeof(SkinnedMeshRenderer)) as SkinnedMeshRenderer[];
			if (!Object.op_Implicit((Object)(object)terrainMat) || !Object.op_Implicit((Object)(object)detailMat) || !Object.op_Implicit((Object)(object)detailMat2) || !Object.op_Implicit((Object)(object)detailMat3))
			{
				return;
			}
			MeshRenderer[] array3 = array;
			foreach (MeshRenderer val in array3)
			{
				GameObject gameObject = ((Component)val).gameObject;
				Transform parent = gameObject.transform.parent;
				if (!((Object)(object)gameObject != (Object)null))
				{
					continue;
				}
				if ((Object)(object)parent != (Object)null && ((((Object)parent).name.Contains("TempleTop") && ((Object)gameObject).name.Contains("RuinBlock")) || ((Object)gameObject).name.Contains("GPRuinBlockQuarter")) && Object.op_Implicit((Object)(object)((Renderer)val).sharedMaterial))
				{
					((Renderer)val).sharedMaterial = detailMat2;
				}
				if (((Object)gameObject).name.Contains("Grass") && Object.op_Implicit((Object)(object)((Renderer)val).sharedMaterial))
				{
					Object.Destroy((Object)(object)gameObject);
				}
				if (((Object)gameObject).name.Contains("CirclePot"))
				{
					((Renderer)val).sharedMaterials = (Material[])(object)new Material[3] { terrainMat, detailMat3, terrainMat };
				}
				if (((Object)gameObject).name.Equals("Terrain") && ((Renderer)val).sharedMaterials.Length != 0)
				{
					((Renderer)val).sharedMaterials = (Material[])(object)new Material[3] { terrainMat, terrainMat, terrainMat };
				}
				if (((((Object)gameObject).name.Contains("Terrain") && !((Object)gameObject).name.Equals("Terrain")) || ((Object)gameObject).name.Contains("Dirt") || ((Object)gameObject).name.Contains("TerrainPlatform")) && Object.op_Implicit((Object)(object)((Renderer)val).sharedMaterial))
				{
					((Renderer)val).sharedMaterial = terrainMat;
				}
				if ((((Object)gameObject).name.Contains("Platform") || ((Object)gameObject).name.Contains("Temple") || ((Object)gameObject).name.Contains("Bridge")) && Object.op_Implicit((Object)(object)((Renderer)val).sharedMaterial))
				{
					((Renderer)val).sharedMaterials = (Material[])(object)new Material[2] { terrainMat, terrainMat };
				}
				if ((((Object)gameObject).name.Contains("BrokenPot") || ((Object)gameObject).name.Contains("Planter") || ((Object)gameObject).name.Contains("AW_Cube") || ((Object)gameObject).name.Contains("Mesh, Cube") || ((Object)gameObject).name.Contains("AncientLoft_WaterFenceType") || ((Object)gameObject).name.Contains("Pillar") || ((Object)gameObject).name.Equals("LightStatue") || ((Object)gameObject).name.Equals("FountainLG") || ((Object)gameObject).name.Equals("Shrine") || ((Object)gameObject).name.Equals("Sculpture") || ((Object)gameObject).name.Contains("AncientLoft_SculptureSM") || ((Object)gameObject).name.Contains("FountainSM")) && Object.op_Implicit((Object)(object)((Renderer)val).sharedMaterial))
				{
					((Renderer)val).sharedMaterial = detailMat3;
				}
				if ((((Object)gameObject).name.Contains("Tile") || ((Object)gameObject).name.Contains("Step") || ((Object)gameObject).name.Contains("Rock") || ((Object)gameObject).name.Contains("Pebble") || ((Object)gameObject).name.Contains("Rubble") || ((Object)gameObject).name.Contains("Boulder") || ((Object)gameObject).name.Equals("LightStatue_Stone")) && Object.op_Implicit((Object)(object)((Renderer)val).sharedMaterial))
				{
					((Renderer)val).sharedMaterial = detailMat;
				}
				if (!((Object)gameObject).name.Contains("CircleArchwayAnimatedMesh"))
				{
					continue;
				}
				Material[] sharedMaterials = ((Renderer)val).sharedMaterials;
				for (int j = 0; j < ((Renderer)val).sharedMaterials.Length; j++)
				{
					sharedMaterials[j] = detailMat2;
					if (j == 1)
					{
						sharedMaterials[j] = detailMat3;
					}
				}
				((Renderer)val).sharedMaterials = sharedMaterials;
			}
			SkinnedMeshRenderer[] array4 = array2;
			foreach (SkinnedMeshRenderer val2 in array4)
			{
				GameObject gameObject2 = ((Component)val2).gameObject;
				if ((Object)(object)gameObject2 != (Object)null)
				{
					if (((Object)gameObject2).name.Contains("CirclePot") || ((Object)gameObject2).name.Contains("Planter") || ((Object)gameObject2).name.Contains("AW_Cube") || ((Object)gameObject2).name.Contains("Mesh, Cube") || ((Object)gameObject2).name.Contains("AncientLoft_WaterFenceType") || ((Object)gameObject2).name.Contains("Pillar") || ((Object)gameObject2).name.Equals("LightStatue") || ((Object)gameObject2).name.Equals("LightStatue_Stone") || ((Object)gameObject2).name.Equals("FountainLG") || ((Object)gameObject2).name.Equals("Shrine") || ((Object)gameObject2).name.Equals("Sculpture"))
					{
						((Renderer)val2).sharedMaterial = detailMat3;
					}
					if ((((Object)gameObject2).name.Contains("Rock") || ((Object)gameObject2).name.Contains("Tile") || ((Object)gameObject2).name.Contains("Boulder") || ((Object)gameObject2).name.Contains("Step") || ((Object)gameObject2).name.Contains("Pebble") || ((Object)gameObject2).name.Contains("Rubble")) && Object.op_Implicit((Object)(object)((Renderer)val2).sharedMaterial))
					{
						((Renderer)val2).sharedMaterial = detailMat;
					}
				}
			}
		}
	}
	public class Stage3
	{
		public static void RPD(Material terrainMat, Material detailMat, Material detailMat2)
		{
			if (!Object.op_Implicit((Object)(object)terrainMat) || !Object.op_Implicit((Object)(object)detailMat) || !Object.op_Implicit((Object)(object)detailMat2))
			{
				return;
			}
			MeshRenderer[] array = Object.FindObjectsOfType(typeof(MeshRenderer)) as MeshRenderer[];
			foreach (MeshRenderer val in array)
			{
				GameObject gameObject = ((Component)val).gameObject;
				if ((Object)(object)gameObject != (Object)null)
				{
					if ((((Object)gameObject).name.Contains("Terrain") || ((Object)gameObject).name.Contains("Snow")) && Object.op_Implicit((Object)(object)((Renderer)val).sharedMaterial))
					{
						((Renderer)val).sharedMaterial = terrainMat;
					}
					if ((((Object)gameObject).name.Contains("Glacier") || ((Object)gameObject).name.Contains("Stalagmite") || ((Object)gameObject).name.Contains("Boulder") || ((Object)gameObject).name.Contains("CavePillar")) && Object.op_Implicit((Object)(object)((Renderer)val).sharedMaterial))
					{
						((Renderer)val).sharedMaterial = detailMat;
					}
					if ((((Object)gameObject).name.Contains("GroundMesh") || ((Object)gameObject).name.Contains("GroundStairs") || ((Object)gameObject).name.Contains("VerticalPillar") || ((Object)gameObject).name.Contains("Barrier") || (((Object)gameObject).name.Contains("Human") && !((Object)gameObject).name.Contains("ChainLink"))) && Object.op_Implicit((Object)(object)((Renderer)val).sharedMaterial))
					{
						((Renderer)val).sharedMaterial = detailMat2;
					}
				}
			}
		}

		public static void Acres(Material terrainMat, Material detailMat, Material detailMat2)
		{
			if (!Object.op_Implicit((Object)(object)terrainMat) || !Object.op_Implicit((Object)(object)detailMat) || !Object.op_Implicit((Object)(object)detailMat2))
			{
				return;
			}
			MeshRenderer[] array = Object.FindObjectsOfType(typeof(MeshRenderer)) as MeshRenderer[];
			foreach (MeshRenderer val in array)
			{
				GameObject gameObject = ((Component)val).gameObject;
				if ((Object)(object)gameObject != (Object)null)
				{
					if (((Object)gameObject).name.Contains("Grass") && Object.op_Implicit((Object)(object)((Renderer)val).sharedMaterial))
					{
						Object.Destroy((Object)(object)gameObject);
					}
					if ((((Object)gameObject).name.Contains("Terrain") || ((Object)gameObject).name.Contains("Dirt")) && Object.op_Implicit((Object)(object)((Renderer)val).sharedMaterial))
					{
						((Renderer)val).sharedMaterial = terrainMat;
					}
					if ((((Object)gameObject).name.Contains("Rock") || ((Object)gameObject).name.Contains("Boulder") || ((Object)gameObject).name.Contains("Crystal")) && Object.op_Implicit((Object)(object)((Renderer)val).sharedMaterial))
					{
						((Renderer)val).sharedMaterial = detailMat;
					}
					if ((((Object)gameObject).name.Contains("Ring") || ((Object)gameObject).name.Contains("Bridge") || ((Object)gameObject).name.Contains("Platform") || ((Object)gameObject).name.Contains("Planter")) && Object.op_Implicit((Object)(object)((Renderer)val).sharedMaterial))
					{
						((Renderer)val).sharedMaterial = detailMat2;
					}
				}
			}
		}

		public static void Pools(Material terrainMat, Material detailMat, Material detailMat2)
		{
			if (!Object.op_Implicit((Object)(object)terrainMat) || !Object.op_Implicit((Object)(object)detailMat) || !Object.op_Implicit((Object)(object)detailMat2))
			{
				return;
			}
			MeshRenderer[] array = Object.FindObjectsOfType(typeof(MeshRenderer)) as MeshRenderer[];
			foreach (MeshRenderer val in array)
			{
				GameObject gameObject = ((Component)val).gameObject;
				if ((Object)(object)gameObject != (Object)null)
				{
					if (((((Object)gameObject).name.Contains("Terrain") && !((Object)gameObject).name.Contains("Fog")) || ((Object)gameObject).name.Contains("Mountain")) && Object.op_Implicit((Object)(object)((Renderer)val).sharedMaterial))
					{
						((Renderer)val).sharedMaterial = terrainMat;
					}
					if ((((Object)gameObject).name.Contains("meshSPSphere") || ((Object)gameObject).name.Contains("SPHeatVent") || ((Object)gameObject).name.Contains("Crystal") || ((Object)gameObject).name.Contains("Boulder") || ((Object)gameObject).name.Contains("mdlGeyser") || ((Object)gameObject).name.Contains("Pebble") || ((Object)gameObject).name.Contains("Eel")) && Object.op_Implicit((Object)(object)((Renderer)val).sharedMaterial))
					{
						((Renderer)val).sharedMaterial = detailMat;
					}
					if ((((Object)gameObject).name.Contains("Dome") || ((Object)gameObject).name.Contains("Spikes") || ((Object)gameObject).name.Contains("Cave")) && Object.op_Implicit((Object)(object)((Renderer)val).sharedMaterial))
					{
						((Renderer)val).sharedMaterial = detailMat2;
					}
				}
			}
		}
	}
	public class Stage4
	{
		public static void Grove(Material terrainMat, Material detailMat, Material detailMat2, Material detailMat3)
		{
			if (!Object.op_Implicit((Object)(object)terrainMat) || !Object.op_Implicit((Object)(object)detailMat) || !Object.op_Implicit((Object)(object)detailMat2) || !Object.op_Implicit((Object)(object)detailMat3))
			{
				return;
			}
			MeshRenderer[] array = Object.FindObjectsOfType(typeof(MeshRenderer)) as MeshRenderer[];
			foreach (MeshRenderer val in array)
			{
				GameObject gameObject = ((Component)val).gameObject;
				if ((Object)(object)gameObject != (Object)null)
				{
					if (((Object)gameObject).name.Contains("Grass") && Object.op_Implicit((Object)(object)((Renderer)val).sharedMaterial))
					{
						Object.Destroy((Object)(object)gameObject);
					}
					if ((((Object)gameObject).name.Contains("Terrain") || ((Object)gameObject).name.Contains("Rock Holder") || ((Object)gameObject).name.Contains("Vine Tree") || ((Object)gameObject).name.Contains("Gianticus") || ((Object)gameObject).name.Contains("Tree Big Bottom") || ((Object)gameObject).name.Contains("Root Bridge") || ((Object)gameObject).name.Contains("Tree D") || ((Object)gameObject).name.Contains("Wall") || ((Object)gameObject).name.Contains("RJRoot") || ((Object)gameObject).name.Contains("RJShroomShelf")) && Object.op_Implicit((Object)(object)((Renderer)val).sharedMaterial))
					{
						((Renderer)val).sharedMaterial = terrainMat;
					}
					if ((((Object)gameObject).name.Contains("RJTriangle") || ((Object)gameObject).name.Contains("BbRuinArch")) && Object.op_Implicit((Object)(object)((Renderer)val).sharedMaterial))
					{
						((Renderer)val).sharedMaterial = detailMat2;
					}
					if (((((Object)gameObject).name.Contains("Rock") && !((Object)gameObject).name.Contains("Holder")) || ((Object)gameObject).name.Contains("Boulder") || ((Object)gameObject).name.Contains("Pebble")) && Object.op_Implicit((Object)(object)((Renderer)val).sharedMaterial))
					{
						((Renderer)val).sharedMaterial = detailMat;
					}
					if ((((Object)gameObject).name.Contains("Moss Cover") || ((Object)gameObject).name.Contains("RJShroomShelf") || ((Object)gameObject).name.Contains("RJShroomBig") || ((Object)gameObject).name.Contains("RJShroomSmall") || ((Object)gameObject).name.Contains("RJMossPatch")) && Object.op_Implicit((Object)(object)((Renderer)val).sharedMaterial))
					{
						((Renderer)val).sharedMaterial = detailMat3;
					}
				}
			}
		}

		public static void Sirens(Material terrainMat, Material detailMat, Material detailMat2)
		{
			if (!Object.op_Implicit((Object)(object)terrainMat) || !Object.op_Implicit((Object)(object)detailMat) || !Object.op_Implicit((Object)(object)detailMat2))
			{
				return;
			}
			MeshRenderer[] array = Object.FindObjectsOfType(typeof(MeshRenderer)) as MeshRenderer[];
			foreach (MeshRenderer val in array)
			{
				GameObject gameObject = ((Component)val).gameObject;
				Transform parent = gameObject.transform.parent;
				if (!((Object)(object)gameObject != (Object)null))
				{
					continue;
				}
				if ((Object)(object)parent != (Object)null)
				{
					if ((((Object)parent).name.Contains("Terrain") || ((Object)gameObject).name.Contains("Mesh") || ((Object)gameObject).name.Contains("Spikes")) && Object.op_Implicit((Object)(object)((Renderer)val).sharedMaterial))
					{
						((Renderer)val).sharedMaterial = terrainMat;
					}
					if ((((Object)gameObject).name.Contains("Stalactite") || ((Object)gameObject).name.Contains("Stalagmite")) && (((Object)parent).name.Contains("Cave") || ((Object)parent).name.Contains("Stalagmite")) && Object.op_Implicit((Object)(object)((Renderer)val).sharedMaterial))
					{
						((Renderer)val).sharedMaterial = detailMat;
					}
				}
				if (((Object)gameObject).name.Contains("Grass") && Object.op_Implicit((Object)(object)((Renderer)val).sharedMaterial))
				{
					Object.Destroy((Object)(object)gameObject);
				}
				if ((((Object)gameObject).name.Contains("Terrain") || ((Object)gameObject).name.Contains("Stalactite") || ((Object)gameObject).name.Contains("Level Wall") || ((Object)gameObject).name.Contains("Cave") || ((Object)gameObject).name.Contains("Floor") || ((Object)gameObject).name.Contains("Spikes")) && Object.op_Implicit((Object)(object)((Renderer)val).sharedMaterial))
				{
					((Renderer)val).sharedMaterial = terrainMat;
				}
				if ((((Object)gameObject).name.Contains("Ship") || ((Object)gameObject).name.Contains("Stalagmite") || ((Object)gameObject).name.Contains("mdlGeyser")) && Object.op_Implicit((Object)(object)((Renderer)val).sharedMaterial))
				{
					((Renderer)val).sharedMaterial = detailMat2;
				}
				if ((((Object)gameObject).name.Contains("Rock") || ((Object)gameObject).name.Contains("Boulder")) && Object.op_Implicit((Object)(object)((Renderer)val).sharedMaterial))
				{
					((Renderer)val).sharedMaterial = detailMat;
				}
			}
		}

		public static void Abyssal(Material terrainMat, Material detailMat, Material detailMat2, Material detailMat3)
		{
			if (!Object.op_Implicit((Object)(object)terrainMat) || !Object.op_Implicit((Object)(object)detailMat) || !Object.op_Implicit((Object)(object)detailMat2) || !Object.op_Implicit((Object)(object)detailMat3))
			{
				return;
			}
			MeshRenderer[] array = Object.FindObjectsOfType(typeof(MeshRenderer)) as MeshRenderer[];
			foreach (MeshRenderer val in array)
			{
				GameObject gameObject = ((Component)val).gameObject;
				Transform parent = gameObject.transform.parent;
				if (!((Object)(object)gameObject != (Object)null))
				{
					continue;
				}
				if ((Object)(object)parent != (Object)null)
				{
					if (((Object)gameObject).name.Contains("Mesh") && ((Object)parent).name.Contains("Ruin") && Object.op_Implicit((Object)(object)((Renderer)val).sharedMaterial))
					{
						((Renderer)val).sharedMaterial = detailMat3;
					}
					if (((Object)gameObject).name.Contains("RuinBowl") && ((Object)parent).name.Contains("RuinMarker") && Object.op_Implicit((Object)(object)((Renderer)val).sharedMaterial))
					{
						((Renderer)val).sharedMaterial = detailMat3;
					}
				}
				if (((Object)gameObject).name.Contains("Grass") && Object.op_Implicit((Object)(object)((Renderer)val).sharedMaterial))
				{
					Object.Destroy((Object)(object)gameObject);
				}
				if ((((Object)gameObject).name.Contains("Hero") || ((Object)gameObject).name.Contains("Ceiling") || ((Object)gameObject).name.Contains("Column")) && Object.op_Implicit((Object)(object)((Renderer)val).sharedMaterial))
				{
					((Renderer)val).sharedMaterial = terrainMat;
				}
				if ((((Object)gameObject).name.Contains("Boulder") || ((Object)gameObject).name.Contains("mdlGeyser") || ((Object)gameObject).name.Contains("Pebble") || (((Object)gameObject).name.Contains("GiantRock") && !((Object)gameObject).name.Contains("Slab"))) && Object.op_Implicit((Object)(object)((Renderer)val).sharedMaterial))
				{
					((Renderer)val).sharedMaterial = detailMat;
				}
				if (((Object)gameObject).name.Contains("Ruin") && Object.op_Implicit((Object)(object)((Renderer)val).sharedMaterial))
				{
					((Renderer)val).sharedMaterial = detailMat3;
				}
				if (((Object)gameObject).name.Contains("LightMesh") && Object.op_Implicit((Object)(object)((Renderer)val).sharedMaterial) && gameObject.transform.childCount >= 1 && ((Object)gameObject.transform.GetChild(0)).name.Contains("Crystal"))
				{
					((Renderer)((Component)gameObject.transform.GetChild(0)).GetComponent<MeshRenderer>()).sharedMaterial = detailMat2;
				}
				if ((((Object)gameObject).name.Contains("Spike") || ((Object)gameObject).name.Contains("Stalagmite") || ((Object)gameObject).name.Contains("Coral") || ((Object)gameObject).name.Contains("Crystal") || ((Object)gameObject).name.Contains("Heatvent")) && Object.op_Implicit((Object)(object)((Renderer)val).sharedMaterial))
				{
					((Renderer)val).sharedMaterial = detailMat2;
				}
				if ((((Object)gameObject).name.Contains("DCGiantRockSlab") || ((Object)gameObject).name.Contains("GiantStoneSlab") || ((Object)gameObject).name.Contains("TerrainBackwall") || ((Object)gameObject).name.Contains("Chain") || ((Object)gameObject).name.Contains("Wall")) && Object.op_Implicit((Object)(object)((Renderer)val).sharedMaterial))
				{
					((Renderer)val).sharedMaterial = terrainMat;
				}
			}
		}
	}
	public class Stage5
	{
		public static void SkyMeadow(Material terrainMat, Material detailMat, Material detailMat2, Material detailMat3, Color grassColor)
		{
			Transform transform = GameObject.Find("HOLDER: Randomization").transform;
			Transform child = GameObject.Find("PortalDialerEvent").transform.GetChild(0);
			if (!Object.op_Implicit((Object)(object)terrainMat) || !Object.op_Implicit((Object)(object)detailMat) || !Object.op_Implicit((Object)(object)detailMat2) || !Object.op_Implicit((Object)(object)detailMat3))
			{
				return;
			}
			MeshRenderer[] array = Object.FindObjectsOfType(typeof(MeshRenderer)) as MeshRenderer[];
			foreach (MeshRenderer val in array)
			{
				GameObject gameObject = ((Component)val).gameObject;
				Transform parent = gameObject.transform.parent;
				if (!((Object)(object)gameObject != (Object)null))
				{
					continue;
				}
				if ((Object)(object)parent != (Object)null)
				{
					if (((((Object)gameObject).name.Contains("Plateau") && ((Object)parent).name.Contains("skymeadow_terrain")) || (((Object)gameObject).name.Contains("SMRock") && ((Object)parent).name.Contains("FORMATION"))) && Object.op_Implicit((Object)(object)((Renderer)val).sharedMaterial))
					{
						((Renderer)val).sharedMaterial = terrainMat;
					}
					if (((((Object)gameObject).name.Contains("SMRock") && ((Object)parent).name.Contains("HOLDER: Spinning Rocks")) || (((Object)gameObject).name.Contains("SMRock") && ((Object)parent).name.Contains("P13")) || (((Object)gameObject).name.Contains("SMPebble") && ((Object)parent).name.Contains("Underground")) || (((Object)gameObject).name.Contains("Boulder") && ((Object)parent).name.Contains("PortalDialerEvent"))) && Object.op_Implicit((Object)(object)((Renderer)val).sharedMaterial))
					{
						((Renderer)val).sharedMaterial = detailMat;
					}
					if (((((Object)gameObject).name.Contains("SMRock") && ((Object)parent).name.Contains("GROUP: Rocks")) || (((Object)gameObject).name.Contains("SMSpikeBridge") && ((Object)parent).name.Contains("Underground"))) && Object.op_Implicit((Object)(object)((Renderer)val).sharedMaterial))
					{
						((Renderer)val).sharedMaterial = detailMat2;
					}
					if (((((Object)gameObject).name.Contains("Terrain") && ((Object)parent).name.Contains("skymeadow_terrain")) || (((Object)gameObject).name.Contains("Plateau Under") && ((Object)parent).name.Contains("Underground"))) && Object.op_Implicit((Object)(object)((Renderer)val).sharedMaterial))
					{
						((Renderer)val).sharedMaterial = terrainMat;
					}
				}
				if (((Object)gameObject).name.Contains("Grass") && Object.op_Implicit((Object)(object)((Renderer)val).sharedMaterial))
				{
					Object.Destroy((Object)(object)gameObject);
				}
				if ((((Object)gameObject).name.Contains("SMPebble") || ((Object)gameObject).name.Contains("Rock") || ((Object)gameObject).name.Contains("mdlGeyser")) && Object.op_Implicit((Object)(object)((Renderer)val).sharedMaterial))
				{
					((Renderer)val).sharedMaterial = detailMat;
				}
				if (((Object)gameObject).name.Contains("SMSpikeBridge") && Object.op_Implicit((Object)(object)((Renderer)val).sharedMaterial))
				{
					((Renderer)val).sharedMaterial = detailMat2;
				}
				if (((Object)gameObject).name.Contains("Ruin") && Object.op_Implicit((Object)(object)((Renderer)val).sharedMaterial))
				{
					((Renderer)val).sharedMaterial = detailMat3;
				}
			}
			((Renderer)((Component)GameObject.Find("HOLDER: Terrain").transform.GetChild(1)).GetComponent<MeshRenderer>()).sharedMaterial = terrainMat;
			((Renderer)((Component)child.GetChild(0)).GetComponent<MeshRenderer>()).sharedMaterial = terrainMat;
			((Renderer)GameObject.Find("ArtifactFormulaHolderMesh").GetComponent<MeshRenderer>()).sharedMaterial = detailMat2;
			((Renderer)GameObject.Find("Stairway").GetComponent<MeshRenderer>()).sharedMaterial = terrainMat;
			try
			{
				((Renderer)GameObject.Find("Plateau 13 (1)").GetComponent<MeshRenderer>()).sharedMaterial = terrainMat;
			}
			catch
			{
			}
			((Renderer)((Component)transform.GetChild(0).GetChild(0).GetChild(0)).gameObject.GetComponent<MeshRenderer>()).sharedMaterial = terrainMat;
			((Renderer)((Component)transform.GetChild(0).GetChild(0).GetChild(1)).gameObject.GetComponent<MeshRenderer>()).sharedMaterial = detailMat2;
			((Renderer)((Component)transform.GetChild(0).GetChild(1).GetChild(0)).gameObject.GetComponent<MeshRenderer>()).sharedMaterial = terrainMat;
			((Renderer)((Component)transform.GetChild(0).GetChild(1).GetChild(1)).gameObject.GetComponent<MeshRenderer>()).sharedMaterial = detailMat2;
			((Renderer)((Component)transform.GetChild(1).GetChild(0).GetChild(0)).gameObject.GetComponent<MeshRenderer>()).sharedMaterial = terrainMat;
			((Renderer)((Component)transform.GetChild(1).GetChild(0).GetChild(1)).gameObject.GetComponent<MeshRenderer>()).sharedMaterial = detailMat2;
			((Renderer)((Component)transform.GetChild(1).GetChild(0).GetChild(2)).gameObject.GetComponent<MeshRenderer>()).sharedMaterial = detailMat2;
			((Renderer)((Component)transform.GetChild(1).GetChild(1).GetChild(0)).gameObject.GetComponent<MeshRenderer>()).sharedMaterial = terrainMat;
			((Renderer)((Component)transform.GetChild(1).GetChild(1).GetChild(1)).gameObject.GetComponent<MeshRenderer>()).sharedMaterial = detailMat2;
			((Renderer)((Component)transform.GetChild(1).GetChild(1).GetChild(2)).gameObject.GetComponent<MeshRenderer>()).sharedMaterial = detailMat2;
			((Renderer)((Component)transform.GetChild(2).GetChild(0).GetChild(0)).gameObject.GetComponent<MeshRenderer>()).sharedMaterial = terrainMat;
			((Renderer)((Component)transform.GetChild(2).GetChild(0).GetChild(1)).gameObject.GetComponent<MeshRenderer>()).sharedMaterial = detailMat2;
			((Renderer)((Component)transform.GetChild(2).GetChild(0).GetChild(2)).gameObject.GetComponent<MeshRenderer>()).sharedMaterial = detailMat2;
			((Renderer)((Component)transform.GetChild(2).GetChild(1).GetChild(0)).gameObject.GetComponent<MeshRenderer>()).sharedMaterial = detailMat2;
			((Renderer)((Component)transform.GetChild(3).GetChild(0).GetChild(0)).gameObject.GetComponent<MeshRenderer>()).sharedMaterial = terrainMat;
			((Renderer)((Component)transform.GetChild(4).GetChild(1).GetChild(3)).gameObject.GetComponent<MeshRenderer>()).sharedMaterial = terrainMat;
			((Renderer)((Component)transform.GetChild(5).GetChild(0).GetChild(0)).gameObject.GetComponent<MeshRenderer>()).sharedMaterial = terrainMat;
			((Renderer)((Component)transform.GetChild(5).GetChild(0).GetChild(1)).gameObject.GetComponent<MeshRenderer>()).sharedMaterial = detailMat2;
			((Renderer)((Component)transform.GetChild(5).GetChild(0).GetChild(2)).gameObject.GetComponent<MeshRenderer>()).sharedMaterial = detailMat2;
			((Renderer)((Component)transform.GetChild(5).GetChild(1).GetChild(0)).gameObject.GetComponent<MeshRenderer>()).sharedMaterial = terrainMat;
			((Renderer)((Component)transform.GetChild(5).GetChild(1).GetChild(1)).gameObject.GetComponent<MeshRenderer>()).sharedMaterial = detailMat2;
			((Renderer)((Component)transform.GetChild(5).GetChild(1).GetChild(2)).gameObject.GetComponent<MeshRenderer>()).sharedMaterial = detailMat2;
			((Renderer)((Component)transform.GetChild(5).GetChild(2).GetChild(0)).gameObject.GetComponent<MeshRenderer>()).sharedMaterial = detailMat2;
		}
	}
	public class Stage6
	{
		public static void Moon(Material terrainMat, Material detailMat, Material detailMat2, Material detailMat3)
		{
			if (!Object.op_Implicit((Object)(object)terrainMat) || !Object.op_Implicit((Object)(object)detailMat) || !Object.op_Implicit((Object)(object)detailMat2) || !Object.op_Implicit((Object)(object)detailMat3))
			{
				return;
			}
			MeshRenderer[] array = Object.FindObjectsOfType(typeof(MeshRenderer)) as MeshRenderer[];
			foreach (MeshRenderer val in array)
			{
				GameObject gameObject = ((Component)val).gameObject;
				if ((Object)(object)gameObject != (Object)null)
				{
					if (((Object)gameObject).name.Contains("Grass") && Object.op_Implicit((Object)(object)((Renderer)val).sharedMaterial))
					{
						Object.Destroy((Object)(object)gameObject);
					}
					if ((((Object)gameObject).name.Contains("Terrain") || ((Object)gameObject).name.Contains("terrain") || ((Object)gameObject).name.Contains("OuterRing_Cave")) && Object.op_Implicit((Object)(object)((Renderer)val).sharedMaterial))
					{
						((Renderer)val).sharedMaterial = terrainMat;
					}
					if (((Object)gameObject).name.Contains("Rock") && Object.op_Implicit((Object)(object)((Renderer)val).sharedMaterial))
					{
						((Renderer)val).sharedMaterial = detailMat;
					}
					if ((((Object)gameObject).name.Contains("Bridge") || ((Object)gameObject).name.Contains("MoonPillar") || ((Object)gameObject).name.Contains("Roof") || ((Object)gameObject).name.Contains("Chain") || ((Object)gameObject).name.Contains("Arena") || ((Object)gameObject).name.Contains("otherside") || ((Object)gameObject).name.Contains("MoonPlatform") || ((Object)gameObject).name.Equals("ramp up") || ((Object)gameObject).name.Equals("railing") || (((Object)gameObject).name.Contains("Quarry") && !((Object)gameObject).name.Contains("Fog") && !((Object)gameObject).name.Contains("Rock")) || ((Object)gameObject).name.Contains("Connector") || ((Object)gameObject).name.Contains("Octagon") || ((Object)gameObject).name.Contains("Temple") || ((Object)gameObject).name.Contains("Column") || ((Object)gameObject).name.Contains("CoolingBowlLarge") || (((Object)gameObject).name.Contains("Wall") && !((Object)gameObject).name.Contains("CylinderWall") && !((Object)gameObject).name.Contains("Godray")) || ((Object)gameObject).name.Contains("Floor") || ((Object)gameObject).name.Contains("Barrier") || ((Object)gameObject).name.Contains("WaterTrough") || ((Object)gameObject).name.Contains("Busted") || ((Object)gameObject).name.Contains("disc") || ((Object)gameObject).name == "Base") && Object.op_Implicit((Object)(object)((Renderer)val).sharedMaterial))
					{
						((Renderer)val).sharedMaterial = detailMat2;
					}
					if ((((Object)gameObject).name.Contains("mdlroot") || ((Object)gameObject).name.Contains("Stib")) && Object.op_Implicit((Object)(object)((Renderer)val).sharedMaterial))
					{
						((Renderer)val).sharedMaterial = detailMat3;
					}
				}
			}
		}
	}
}