Decompiled source of StageTweakerReborn v1.0.0

stageTweakerReborn.dll

Decompiled 10 months ago
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using BepInEx;
using BepInEx.Configuration;
using BepInEx.Logging;
using HarmonyLib;
using LLBML.Utils;
using LLHandlers;
using StageBackground;
using UnityEngine;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: AssemblyTitle("FixedCameraPlusPlus")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("FixedCameraPlusPlus")]
[assembly: AssemblyCopyright("Copyright ©  2023")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("664de4af-aa69-4f3a-9e6b-dd07c879adf5")]
[assembly: AssemblyFileVersion("1.0.1.0")]
[assembly: TargetFramework(".NETFramework,Version=v4.5", FrameworkDisplayName = ".NET Framework 4.5")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.1.0")]
[module: UnverifiableCode]
namespace stageTweakerReborn;

[BepInPlugin("us.wallace.plugins.llb.stageTweakerReborn", "stageTweakerReborn Plug-In", "1.0.1.0")]
[BepInDependency(/*Could not decode attribute arguments.*/)]
[BepInDependency(/*Could not decode attribute arguments.*/)]
[BepInProcess("LLBlaze.exe")]
public class Plugin : BaseUnityPlugin
{
	private class TrainScriptStartPatch
	{
		[HarmonyPatch(typeof(TrainScript), "Start")]
		[HarmonyPrefix]
		public static bool Start_Prefix(TrainScript __instance)
		{
			if (subwayTrainStop.Value)
			{
				__instance.stationIdleTimer = float.MaxValue;
			}
			else
			{
				__instance._idleTimer = __instance.stationIdleTimer;
			}
			__instance.anim = ((Component)__instance).GetComponent<Animation>();
			if (subwayTrainStopState.Value == 0)
			{
				__instance.SetState((TrainAnimationType)0);
			}
			if (subwayTrainStopState.Value >= 1)
			{
				__instance.SetState((TrainAnimationType)19);
			}
			__instance.tunnelRend = __instance.tunnel.GetComponent<Renderer>();
			return false;
		}
	}

	private class TrainScriptAwakePatch
	{
		[HarmonyPatch(typeof(TrainScript), "Awake")]
		[HarmonyPrefix]
		public static bool Awake_Prefix(TrainScript __instance)
		{
			TrainScript instance = TrainScript.instance;
			if (subwayTrainStop.Value)
			{
				instance.stationIdleTimer = float.MaxValue;
				__instance.SetState((TrainAnimationType)18);
			}
			return false;
		}
	}

	public static ConfigEntry<bool> elevator;

	public static ConfigEntry<bool> elevatorLockToFloor;

	public static ConfigEntry<int> elevatorLockToFloorNum;

	public static ConfigEntry<int> elevatorFallSpeed;

	public static ConfigEntry<bool> elevatorEclipseFallBlur;

	public static ConfigEntry<bool> elevatorWorkerRobots;

	public static ConfigEntry<bool> sewersRemoveSubmarine;

	public static ConfigEntry<bool> junkyardNormalSmoke;

	public static ConfigEntry<bool> junkyardDustStorm;

	public static ConfigEntry<bool> factoryNormalHeatwave;

	public static ConfigEntry<bool> factoryEclipseHeatwave;

	public static ConfigEntry<bool> factoryEclipseFlowingLava;

	public static ConfigEntry<bool> factoryAssembly;

	public static ConfigEntry<bool> factoryBuckets;

	public static ConfigEntry<bool> subwayNormalPassengers;

	public static ConfigEntry<bool> subwayTrainStop;

	public static ConfigEntry<int> subwayTrainStopState;

	public static ConfigEntry<bool> stadiumNormalActionScreen;

	public static ConfigEntry<bool> stadiumEclipseFlames;

	public static ConfigEntry<bool> stadiumEclipseFireworks;

	public static ConfigEntry<bool> stadiumEclipseBlinkingArena;

	public static ConfigEntry<bool> stadiumBlinkingSkyline;

	public static ConfigEntry<bool> stadiumEclipseCrowd;

	public static ConfigEntry<bool> stadiumEclipseSpotlights;

	public static ConfigEntry<bool> stadiumEclipseActionScreen;

	public static ConfigEntry<bool> streetsPoliceCars;

	public static ConfigEntry<bool> streetsNormalPedestrians;

	public static ConfigEntry<bool> streetsNormalPoliceDrones;

	public static ConfigEntry<bool> streetsEclipsePoliceLight;

	public static ConfigEntry<bool> poolNormalWater;

	public static ConfigEntry<bool> poolNormalBlimps;

	public static ConfigEntry<bool> poolEclipseWater;

	public static ConfigEntry<bool> poolEclipseLightning;

	public static ConfigEntry<bool> poolEclipseWind;

	public static ConfigEntry<bool> poolEclipseRain;

	public static ConfigEntry<bool> roomEclipseStopBlinking;

	public static ConfigEntry<int> roomLightR;

	public static ConfigEntry<int> roomLightG;

	public static ConfigEntry<int> roomLightB;

	public static ConfigEntry<bool> sewersSubmarine;

	public bool hasSetNormalVisuals = false;

	public bool hasSetEclipseVisuals = false;

	public List<GameObject> reEnableOnStockReset = new List<GameObject>();

	public static ManualLogSource Log { get; private set; }

	private void Awake()
	{
		//IL_002a: Unknown result type (might be due to invalid IL or missing references)
		//IL_0034: Expected O, but got Unknown
		//IL_005e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0068: Expected O, but got Unknown
		//IL_00a8: Unknown result type (might be due to invalid IL or missing references)
		//IL_00b2: Expected O, but got Unknown
		//IL_00f9: Unknown result type (might be due to invalid IL or missing references)
		//IL_0103: Expected O, but got Unknown
		//IL_012d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0137: Expected O, but got Unknown
		//IL_017a: Unknown result type (might be due to invalid IL or missing references)
		//IL_0184: Expected O, but got Unknown
		//IL_01ae: Unknown result type (might be due to invalid IL or missing references)
		//IL_01b8: Expected O, but got Unknown
		//IL_0217: Unknown result type (might be due to invalid IL or missing references)
		//IL_0221: Expected O, but got Unknown
		//IL_024b: Unknown result type (might be due to invalid IL or missing references)
		//IL_0255: Expected O, but got Unknown
		//IL_0308: Unknown result type (might be due to invalid IL or missing references)
		//IL_0312: Expected O, but got Unknown
		//IL_033c: Unknown result type (might be due to invalid IL or missing references)
		//IL_0346: Expected O, but got Unknown
		//IL_03a2: Unknown result type (might be due to invalid IL or missing references)
		//IL_03ac: Expected O, but got Unknown
		//IL_03d7: Unknown result type (might be due to invalid IL or missing references)
		//IL_03e1: Expected O, but got Unknown
		//IL_040b: Unknown result type (might be due to invalid IL or missing references)
		//IL_0415: Expected O, but got Unknown
		//IL_051c: Unknown result type (might be due to invalid IL or missing references)
		//IL_0526: Expected O, but got Unknown
		//IL_0550: Unknown result type (might be due to invalid IL or missing references)
		//IL_055a: Expected O, but got Unknown
		//IL_05f1: Unknown result type (might be due to invalid IL or missing references)
		//IL_05fb: Expected O, but got Unknown
		//IL_0625: Unknown result type (might be due to invalid IL or missing references)
		//IL_062f: Expected O, but got Unknown
		//IL_06fe: Unknown result type (might be due to invalid IL or missing references)
		//IL_0708: Expected O, but got Unknown
		//IL_0732: Unknown result type (might be due to invalid IL or missing references)
		//IL_073c: Expected O, but got Unknown
		//IL_0782: Unknown result type (might be due to invalid IL or missing references)
		//IL_078c: Expected O, but got Unknown
		//IL_07b8: Unknown result type (might be due to invalid IL or missing references)
		//IL_07c2: Expected O, but got Unknown
		//IL_07ee: Unknown result type (might be due to invalid IL or missing references)
		//IL_07f8: Expected O, but got Unknown
		//IL_0824: Unknown result type (might be due to invalid IL or missing references)
		//IL_082e: Expected O, but got Unknown
		//IL_0855: Unknown result type (might be due to invalid IL or missing references)
		//IL_085b: Expected O, but got Unknown
		((BaseUnityPlugin)this).Config.Bind<string>("Stage Tweaker", "mm_header_qol", "Stage Tweaker", new ConfigDescription("", (AcceptableValueBase)null, new object[1] { "modmenu_header" }));
		((BaseUnityPlugin)this).Config.Bind<string>("elevator", "mm_header_qol", "Elevator", new ConfigDescription("", (AcceptableValueBase)null, new object[1] { "modmenu_header" }));
		elevatorLockToFloor = ((BaseUnityPlugin)this).Config.Bind<bool>("elevator", "elevatorLockToFloor", true, (ConfigDescription)null);
		elevatorLockToFloorNum = ((BaseUnityPlugin)this).Config.Bind<int>("elevator", "elevatorFloor", 1, new ConfigDescription("", (AcceptableValueBase)(object)new AcceptableValueRange<int>(1, 5), new object[0]));
		elevatorEclipseFallBlur = ((BaseUnityPlugin)this).Config.Bind<bool>("elevator", "disableElevatorEclipseFallBlur", true, (ConfigDescription)null);
		((BaseUnityPlugin)this).Config.Bind<int>("gap", "mm_header_gap", 50, new ConfigDescription("", (AcceptableValueBase)null, new object[1] { "modmenu_gap" }));
		((BaseUnityPlugin)this).Config.Bind<string>("sewers", "mm_header_qol", "Sewers", new ConfigDescription("", (AcceptableValueBase)null, new object[1] { "modmenu_header" }));
		sewersRemoveSubmarine = ((BaseUnityPlugin)this).Config.Bind<bool>("sewers", "disableSewersSubmarine", true, (ConfigDescription)null);
		((BaseUnityPlugin)this).Config.Bind<int>("gap1", "mm_header_gap", 50, new ConfigDescription("", (AcceptableValueBase)null, new object[1] { "modmenu_gap" }));
		((BaseUnityPlugin)this).Config.Bind<string>("junkyard", "mm_header_qol", "Junkyard", new ConfigDescription("", (AcceptableValueBase)null, new object[1] { "modmenu_header" }));
		junkyardNormalSmoke = ((BaseUnityPlugin)this).Config.Bind<bool>("junkyard", "disableJunkyardNormalSmoke", true, (ConfigDescription)null);
		junkyardDustStorm = ((BaseUnityPlugin)this).Config.Bind<bool>("junkyard", "disableJunkyardDustStorm", true, (ConfigDescription)null);
		((BaseUnityPlugin)this).Config.Bind<int>("gap2", "mm_header_gap", 50, new ConfigDescription("", (AcceptableValueBase)null, new object[1] { "modmenu_gap" }));
		((BaseUnityPlugin)this).Config.Bind<string>("factory", "mm_header_qol", "Factory", new ConfigDescription("", (AcceptableValueBase)null, new object[1] { "modmenu_header" }));
		factoryNormalHeatwave = ((BaseUnityPlugin)this).Config.Bind<bool>("factory", "disableFactoryNormalHeatwave", true, (ConfigDescription)null);
		factoryEclipseHeatwave = ((BaseUnityPlugin)this).Config.Bind<bool>("factory", "disableFactoryEclipseHeatwave", true, (ConfigDescription)null);
		factoryEclipseFlowingLava = ((BaseUnityPlugin)this).Config.Bind<bool>("factory", "disableFactoryEclipseFlowingLava", true, (ConfigDescription)null);
		factoryAssembly = ((BaseUnityPlugin)this).Config.Bind<bool>("factory", "factoryAssembly", true, (ConfigDescription)null);
		factoryBuckets = ((BaseUnityPlugin)this).Config.Bind<bool>("factory", "factoryBuckets", true, (ConfigDescription)null);
		((BaseUnityPlugin)this).Config.Bind<int>("gap3", "mm_header_gap", 50, new ConfigDescription("", (AcceptableValueBase)null, new object[1] { "modmenu_gap" }));
		((BaseUnityPlugin)this).Config.Bind<string>("subway", "mm_header_qol", "Subway", new ConfigDescription("", (AcceptableValueBase)null, new object[1] { "modmenu_header" }));
		subwayNormalPassengers = ((BaseUnityPlugin)this).Config.Bind<bool>("subway", "disableSubwayNormalPassengers", true, (ConfigDescription)null);
		subwayTrainStop = ((BaseUnityPlugin)this).Config.Bind<bool>("subway", "subwayTrainStop", true, (ConfigDescription)null);
		subwayTrainStopState = ((BaseUnityPlugin)this).Config.Bind<int>("subway", "subwayState", 1, new ConfigDescription("", (AcceptableValueBase)(object)new AcceptableValueRange<int>(0, 2), new object[0]));
		((BaseUnityPlugin)this).Config.Bind<int>("gap4", "mm_header_gap", 50, new ConfigDescription("", (AcceptableValueBase)null, new object[1] { "modmenu_gap" }));
		((BaseUnityPlugin)this).Config.Bind<string>("stadium", "mm_header_qol", "Stadium", new ConfigDescription("", (AcceptableValueBase)null, new object[1] { "modmenu_header" }));
		stadiumNormalActionScreen = ((BaseUnityPlugin)this).Config.Bind<bool>("stadium", "disableStadiumNormalActionScreen", true, (ConfigDescription)null);
		stadiumEclipseFlames = ((BaseUnityPlugin)this).Config.Bind<bool>("stadium", "disableStadiumEclipseFlames", true, (ConfigDescription)null);
		stadiumEclipseFireworks = ((BaseUnityPlugin)this).Config.Bind<bool>("stadium", "disableStadiumEclipseFireworks", true, (ConfigDescription)null);
		stadiumEclipseBlinkingArena = ((BaseUnityPlugin)this).Config.Bind<bool>("stadium", "disableStadiumEclipseBlinkingArena", true, (ConfigDescription)null);
		stadiumBlinkingSkyline = ((BaseUnityPlugin)this).Config.Bind<bool>("stadium", "disableStadiumBlinkingSkyline", true, (ConfigDescription)null);
		stadiumEclipseCrowd = ((BaseUnityPlugin)this).Config.Bind<bool>("stadium", "disableStadiumEclipseCrowd", true, (ConfigDescription)null);
		stadiumEclipseSpotlights = ((BaseUnityPlugin)this).Config.Bind<bool>("stadium", "disableStadiumEclipseSpotlights", true, (ConfigDescription)null);
		stadiumEclipseActionScreen = ((BaseUnityPlugin)this).Config.Bind<bool>("stadium", "disableStadiumEclipseActionScreen", true, (ConfigDescription)null);
		((BaseUnityPlugin)this).Config.Bind<int>("gap5", "mm_header_gap", 50, new ConfigDescription("", (AcceptableValueBase)null, new object[1] { "modmenu_gap" }));
		((BaseUnityPlugin)this).Config.Bind<string>("streets", "mm_header_qol", "Streets", new ConfigDescription("", (AcceptableValueBase)null, new object[1] { "modmenu_header" }));
		streetsPoliceCars = ((BaseUnityPlugin)this).Config.Bind<bool>("streets", "streetsPoliceCars", true, (ConfigDescription)null);
		streetsNormalPedestrians = ((BaseUnityPlugin)this).Config.Bind<bool>("streets", "disableStreetsNormalPedestrians", true, (ConfigDescription)null);
		streetsNormalPoliceDrones = ((BaseUnityPlugin)this).Config.Bind<bool>("streets", "disableStreetsNormalPoliceDrones", true, (ConfigDescription)null);
		streetsEclipsePoliceLight = ((BaseUnityPlugin)this).Config.Bind<bool>("streets", "disableStreetsEclipsePoliceLight", true, (ConfigDescription)null);
		((BaseUnityPlugin)this).Config.Bind<int>("gap6", "mm_header_gap", 50, new ConfigDescription("", (AcceptableValueBase)null, new object[1] { "modmenu_gap" }));
		((BaseUnityPlugin)this).Config.Bind<string>("pool", "mm_header_qol", "Pool", new ConfigDescription("", (AcceptableValueBase)null, new object[1] { "modmenu_header" }));
		poolNormalWater = ((BaseUnityPlugin)this).Config.Bind<bool>("pool", "disablePoolNormalWater", true, (ConfigDescription)null);
		poolNormalBlimps = ((BaseUnityPlugin)this).Config.Bind<bool>("pool", "disablePoolNormalBlimps", true, (ConfigDescription)null);
		poolEclipseWater = ((BaseUnityPlugin)this).Config.Bind<bool>("pool", "disablePoolEclipseWater", true, (ConfigDescription)null);
		poolEclipseLightning = ((BaseUnityPlugin)this).Config.Bind<bool>("pool", "disablePoolEclipseLightning", true, (ConfigDescription)null);
		poolEclipseWind = ((BaseUnityPlugin)this).Config.Bind<bool>("pool", "disablePoolEclipseWind", true, (ConfigDescription)null);
		poolEclipseRain = ((BaseUnityPlugin)this).Config.Bind<bool>("pool", "disablePoolEclipseRain", true, (ConfigDescription)null);
		((BaseUnityPlugin)this).Config.Bind<int>("gap7", "mm_header_gap", 50, new ConfigDescription("", (AcceptableValueBase)null, new object[1] { "modmenu_gap" }));
		((BaseUnityPlugin)this).Config.Bind<string>("room", "mm_header_qol", "Room 21", new ConfigDescription("", (AcceptableValueBase)null, new object[1] { "modmenu_header" }));
		roomEclipseStopBlinking = ((BaseUnityPlugin)this).Config.Bind<bool>("room", "disableRoomEclipseStopBlinking", true, (ConfigDescription)null);
		((BaseUnityPlugin)this).Config.Bind<string>("Room 21 Eclipse Lights Color", "mm_header_qol", "Room 21 Eclipse Lights Color", new ConfigDescription("", (AcceptableValueBase)null, new object[1] { "modmenu_header" }));
		roomLightR = ((BaseUnityPlugin)this).Config.Bind<int>("13. roomColors", "colorR", 255, new ConfigDescription("", (AcceptableValueBase)(object)new AcceptableValueRange<int>(0, 255), new object[0]));
		roomLightG = ((BaseUnityPlugin)this).Config.Bind<int>("13. roomColors", "colorG", 0, new ConfigDescription("", (AcceptableValueBase)(object)new AcceptableValueRange<int>(0, 255), new object[0]));
		roomLightB = ((BaseUnityPlugin)this).Config.Bind<int>("13. roomColors", "colorB", 0, new ConfigDescription("", (AcceptableValueBase)(object)new AcceptableValueRange<int>(0, 255), new object[0]));
		Log = ((BaseUnityPlugin)this).Logger;
		((BaseUnityPlugin)this).Logger.LogDebug((object)"Patching effects settings...");
		Harmony val = new Harmony("us.wallace.plugins.llb.stageTweakerReborn");
		val.PatchAll(typeof(TrainScriptStartPatch));
		((BaseUnityPlugin)this).Logger.LogDebug((object)"stageTweakerReborn is loaded");
	}

	private void Start()
	{
		ModDependenciesUtils.RegisterToModMenu(((BaseUnityPlugin)this).Info, (List<string>)null);
	}

	private void Update()
	{
		//IL_0029: Unknown result type (might be due to invalid IL or missing references)
		//IL_002f: Invalid comparison between Unknown and I4
		//IL_0edd: Unknown result type (might be due to invalid IL or missing references)
		//IL_0ee3: Invalid comparison between Unknown and I4
		//IL_0dbc: Unknown result type (might be due to invalid IL or missing references)
		//IL_0dc1: Unknown result type (might be due to invalid IL or missing references)
		//IL_0dc2: Unknown result type (might be due to invalid IL or missing references)
		//IL_0dc3: Unknown result type (might be due to invalid IL or missing references)
		//IL_0dc4: Unknown result type (might be due to invalid IL or missing references)
		//IL_0dc6: Invalid comparison between Unknown and I4
		//IL_006f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0074: Unknown result type (might be due to invalid IL or missing references)
		//IL_0076: Unknown result type (might be due to invalid IL or missing references)
		//IL_0078: Unknown result type (might be due to invalid IL or missing references)
		//IL_007a: Unknown result type (might be due to invalid IL or missing references)
		//IL_007d: Unknown result type (might be due to invalid IL or missing references)
		//IL_00a7: Expected I4, but got Unknown
		//IL_1a2e: Unknown result type (might be due to invalid IL or missing references)
		//IL_1a33: Unknown result type (might be due to invalid IL or missing references)
		//IL_1a35: Unknown result type (might be due to invalid IL or missing references)
		//IL_1a37: Unknown result type (might be due to invalid IL or missing references)
		//IL_1a39: Unknown result type (might be due to invalid IL or missing references)
		//IL_1a3c: Invalid comparison between Unknown and I4
		//IL_0f25: Unknown result type (might be due to invalid IL or missing references)
		//IL_0f2a: Unknown result type (might be due to invalid IL or missing references)
		//IL_0f2c: Unknown result type (might be due to invalid IL or missing references)
		//IL_0f2e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0f30: Unknown result type (might be due to invalid IL or missing references)
		//IL_0f33: Unknown result type (might be due to invalid IL or missing references)
		//IL_0f59: Expected I4, but got Unknown
		//IL_0d61: Unknown result type (might be due to invalid IL or missing references)
		//IL_0d66: Unknown result type (might be due to invalid IL or missing references)
		if ((Object)(object)BG.instance != (Object)null && (Object)(object)PlayerHandler.instance != (Object)null)
		{
			if ((int)BG.instance.bgState == 2)
			{
				hasSetNormalVisuals = false;
				if (!hasSetEclipseVisuals)
				{
					List<GameObject> normalEnable = new List<GameObject>();
					List<GameObject> normalDisable = new List<GameObject>();
					List<GameObject> list = new List<GameObject>();
					List<GameObject> eclipseEnable = new List<GameObject>();
					Stage curStage = StageHandler.curStage;
					Stage val = curStage;
					switch (val - 4)
					{
					case 0:
						if (sewersRemoveSubmarine.Value)
						{
							SubmarineScript val4 = Object.FindObjectOfType<SubmarineScript>();
							if ((Object)(object)val4 != (Object)null)
							{
								((Component)val4).gameObject.SetActive(false);
							}
						}
						break;
					case 1:
					{
						GameObject[] obsEclipse5 = BG.instance.obsEclipse;
						foreach (GameObject val11 in obsEclipse5)
						{
							Component[] componentsInChildren5 = val11.GetComponentsInChildren(typeof(Component));
							foreach (Component val12 in componentsInChildren5)
							{
								if (junkyardDustStorm.Value)
								{
									if (((Object)val12).name == "DustPlane_Cycle")
									{
										list.Add(val12.gameObject);
									}
									if (((Object)val12).name == "DustPlane_Cycle (3)")
									{
										list.Add(val12.gameObject);
									}
								}
							}
						}
						break;
					}
					case 3:
					{
						GameObject[] obsEclipse3 = BG.instance.obsEclipse;
						foreach (GameObject val7 in obsEclipse3)
						{
							Component[] componentsInChildren3 = val7.GetComponentsInChildren(typeof(Component));
							foreach (Component val8 in componentsInChildren3)
							{
								if (factoryEclipseHeatwave.Value && ((Object)val8).name == "Factory_Heatbox_eclipse")
								{
									list.Add(val8.gameObject);
								}
								if (factoryEclipseFlowingLava.Value && ((Object)val8).name == "Factory_LavaOptimized")
								{
									list.Add(val8.gameObject);
								}
								if (factoryBuckets.Value && ((Object)val8).name == "bucket")
								{
									list.Add(val8.gameObject);
								}
								if (factoryAssembly.Value)
								{
									if (((Object)val8).name == "robotHead1")
									{
										list.Add(val8.gameObject);
									}
									if (((Object)val8).name == "robotHead2")
									{
										list.Add(val8.gameObject);
									}
									if (((Object)val8).name == "robotHead3")
									{
										list.Add(val8.gameObject);
									}
									if (((Object)val8).name == "robotStage1_1")
									{
										list.Add(val8.gameObject);
									}
									if (((Object)val8).name == "robotStage1_2")
									{
										list.Add(val8.gameObject);
									}
									if (((Object)val8).name == "robotStage1_3")
									{
										list.Add(val8.gameObject);
									}
									if (((Object)val8).name == "robotStage1_4")
									{
										list.Add(val8.gameObject);
									}
									if (((Object)val8).name == "robotStage1_5")
									{
										list.Add(val8.gameObject);
									}
									if (((Object)val8).name == "robotStage1_6")
									{
										list.Add(val8.gameObject);
									}
									if (((Object)val8).name == "robotStage2_1")
									{
										list.Add(val8.gameObject);
									}
									if (((Object)val8).name == "robotStage2_2")
									{
										list.Add(val8.gameObject);
									}
									if (((Object)val8).name == "robotStage2_3")
									{
										list.Add(val8.gameObject);
									}
									if (((Object)val8).name == "robotStage2_4")
									{
										list.Add(val8.gameObject);
									}
									if (((Object)val8).name == "robotStage3_1")
									{
										list.Add(val8.gameObject);
									}
									if (((Object)val8).name == "robotStage3_2")
									{
										list.Add(val8.gameObject);
									}
									if (((Object)val8).name == "robotStage3_3")
									{
										list.Add(val8.gameObject);
									}
									if (((Object)val8).name == "robotStage3_4")
									{
										list.Add(val8.gameObject);
									}
									if (((Object)val8).name == "robotStage3_5")
									{
										list.Add(val8.gameObject);
									}
									if (((Object)val8).name == "robotStage3_6")
									{
										list.Add(val8.gameObject);
									}
									if (((Object)val8).name == "robotStage3_7")
									{
										list.Add(val8.gameObject);
									}
									if (((Object)val8).name == "weldParticle1")
									{
										list.Add(val8.gameObject);
									}
									if (((Object)val8).name == "weldParticle2")
									{
										list.Add(val8.gameObject);
									}
									if (((Object)val8).name == "assemblyConveyor")
									{
										list.Add(val8.gameObject);
									}
									if (((Object)val8).name == "assemblyStage3")
									{
										list.Add(val8.gameObject);
									}
								}
							}
						}
						break;
					}
					case 5:
					{
						if (stadiumEclipseActionScreen.Value)
						{
							Stadium_ScreenCamController val13 = Object.FindObjectOfType<Stadium_ScreenCamController>();
							val13.OnEclipse(false);
						}
						GameObject[] obsEclipse6 = BG.instance.obsEclipse;
						foreach (GameObject val14 in obsEclipse6)
						{
							Component[] componentsInChildren6 = val14.GetComponentsInChildren(typeof(Component));
							foreach (Component val15 in componentsInChildren6)
							{
								if (stadiumEclipseFlames.Value && ((Object)val15).name == "Flames")
								{
									list.Add(val15.gameObject);
								}
								if (stadiumEclipseFireworks.Value && ((Object)val15).name == "fireworks_eclipse")
								{
									list.Add(val15.gameObject);
								}
								if (stadiumEclipseBlinkingArena.Value && ((Object)val15).name == "Cage_Eclipse_NEW")
								{
									Component[] componentsInChildren7 = val15.GetComponentsInChildren(typeof(Component));
									foreach (Component val16 in componentsInChildren7)
									{
										if (((object)val15).GetType().ToString() == typeof(TextureCycleScript).ToString())
										{
											SetTextureCycleRate(val15);
										}
									}
								}
								if (stadiumBlinkingSkyline.Value && ((Object)val15).name == "SkylineQuad_eclipse_rimlight")
								{
									list.Add(val15.gameObject);
								}
								if (stadiumEclipseCrowd.Value && ((Object)val15).name == "Stadium_Crowd_Eclipse")
								{
									list.Add(val15.gameObject);
								}
								if (stadiumEclipseSpotlights.Value)
								{
									if (((Object)val15).name == "Spotlight")
									{
										list.Add(val15.gameObject);
									}
									if (((Object)val15).name == "Stadium_Ray")
									{
										list.Add(val15.gameObject);
									}
								}
							}
						}
						break;
					}
					case 6:
					{
						GameObject[] obsEclipse4 = BG.instance.obsEclipse;
						foreach (GameObject val9 in obsEclipse4)
						{
							Component[] componentsInChildren4 = val9.GetComponentsInChildren(typeof(Component));
							foreach (Component val10 in componentsInChildren4)
							{
								if (streetsEclipsePoliceLight.Value && ((Object)val10).name == "PoliceLight")
								{
									list.Add(val10.gameObject);
								}
							}
						}
						break;
					}
					case 7:
					{
						GameObject[] obsEclipse2 = BG.instance.obsEclipse;
						foreach (GameObject val5 in obsEclipse2)
						{
							Component[] componentsInChildren2 = val5.GetComponentsInChildren(typeof(Component));
							foreach (Component val6 in componentsInChildren2)
							{
								if (poolEclipseWater.Value)
								{
									if (((Object)val6).name == "WaterPlane")
									{
										list.Add(val6.gameObject);
									}
									if (((Object)val6).name == "RainFloor_new")
									{
										list.Add(val6.gameObject);
									}
									if (((Object)val6).name == "RainFloor_new (1)")
									{
										list.Add(val6.gameObject);
									}
									if (((Object)val6).name == "Reflection_Probe")
									{
										list.Add(val6.gameObject);
									}
								}
								if (poolEclipseLightning.Value)
								{
									if (((Object)val6).name == "Lightning")
									{
										list.Add(val6.gameObject);
									}
									if (((Object)val6).name == "Lightning_SingleStrike")
									{
										list.Add(val6.gameObject);
									}
									if (((Object)val6).name == "Lightning_BuildUpStrike")
									{
										list.Add(val6.gameObject);
									}
								}
								if (poolEclipseWind.Value)
								{
									if (((Object)val6).name == "Wind")
									{
										list.Add(val6.gameObject);
									}
									if (((Object)val6).name == "Wind_Back")
									{
										list.Add(val6.gameObject);
									}
									if (((Object)val6).name == "Wind_Front")
									{
										list.Add(val6.gameObject);
									}
								}
								if (poolEclipseRain.Value)
								{
									if (((Object)val6).name == "Rain")
									{
										list.Add(val6.gameObject);
									}
									if (((Object)val6).name == "Splatter Side")
									{
										list.Add(val6.gameObject);
									}
									if (((Object)val6).name == "Eclipse_Rain_Triple")
									{
										list.Add(val6.gameObject);
									}
									if (((Object)val6).name == "RainFloor_new")
									{
										list.Add(val6.gameObject);
									}
									if (((Object)val6).name == "RainFloor_new (1)")
									{
										list.Add(val6.gameObject);
									}
								}
							}
						}
						break;
					}
					case 8:
					{
						GameObject[] obsEclipse = BG.instance.obsEclipse;
						foreach (GameObject val2 in obsEclipse)
						{
							Component[] componentsInChildren = val2.GetComponentsInChildren(typeof(Component));
							foreach (Component val3 in componentsInChildren)
							{
								if (((Object)val3).name == "Point light")
								{
									if (roomEclipseStopBlinking.Value)
									{
										BlinkingLight componentInChildren = val3.gameObject.GetComponentInChildren<BlinkingLight>();
										Object.Destroy((Object)(object)componentInChildren);
									}
									Light componentInChildren2 = val3.gameObject.GetComponentInChildren<Light>();
									componentInChildren2.color = Color32.op_Implicit(new Color32((byte)roomLightR.Value, (byte)roomLightG.Value, (byte)roomLightB.Value, byte.MaxValue));
									componentInChildren2.intensity = 1f;
								}
							}
						}
						break;
					}
					}
					SetVisuals(normalEnable, normalDisable, eclipseEnable, list);
					hasSetEclipseVisuals = true;
				}
				Stage curStage2 = StageHandler.curStage;
				Stage val17 = curStage2;
				if ((int)val17 != 6)
				{
					return;
				}
				if (elevatorEclipseFallBlur.Value)
				{
					if (elevatorLockToFloor.Value)
					{
						StopElevatorBlur();
					}
					else
					{
						LockElevatorToFloor();
					}
				}
				List<GameObject> list2 = new List<GameObject>();
				GameObject[] obsEclipse7 = BG.instance.obsEclipse;
				foreach (GameObject val18 in obsEclipse7)
				{
					Component[] componentsInChildren8 = val18.GetComponentsInChildren(typeof(Component));
					foreach (Component val19 in componentsInChildren8)
					{
						if (elevatorWorkerRobots.Value)
						{
							if (((Object)val19).name == "workerRobot")
							{
								list2.Add(val19.gameObject);
							}
							if (((Object)val19).name == "workerRobots")
							{
								list2.Add(val19.gameObject);
							}
						}
					}
				}
			}
			else
			{
				if ((int)BG.instance.bgState != 1)
				{
					return;
				}
				hasSetEclipseVisuals = false;
				if (!hasSetNormalVisuals)
				{
					List<GameObject> normalEnable2 = new List<GameObject>();
					List<GameObject> list3 = new List<GameObject>();
					List<GameObject> eclipseDisable = new List<GameObject>();
					List<GameObject> eclipseEnable2 = new List<GameObject>();
					Stage curStage3 = StageHandler.curStage;
					Stage val20 = curStage3;
					switch (val20 - 4)
					{
					case 0:
						if (sewersRemoveSubmarine.Value)
						{
							SubmarineScript val31 = Object.FindObjectOfType<SubmarineScript>();
							if ((Object)(object)val31 != (Object)null)
							{
								((Component)val31).gameObject.SetActive(false);
							}
						}
						break;
					case 1:
					{
						GameObject[] obsNormal4 = BG.instance.obsNormal;
						foreach (GameObject val29 in obsNormal4)
						{
							Component[] componentsInChildren12 = val29.GetComponentsInChildren(typeof(Component));
							foreach (Component val30 in componentsInChildren12)
							{
								if (junkyardNormalSmoke.Value)
								{
									if (((Object)val30).name == "ChimneySmoke_001 (1)")
									{
										list3.Add(val30.gameObject);
									}
									if (((Object)val30).name == "ChimneySmoke_002 (1)")
									{
										list3.Add(val30.gameObject);
									}
									if (((Object)val30).name == "ChimneySmoke_003 (1)")
									{
										list3.Add(val30.gameObject);
									}
									if (((Object)val30).name == "ChimneySmoke_004 (1)")
									{
										list3.Add(val30.gameObject);
									}
									if (((Object)val30).name == "ChimneySmoke_005 (1)")
									{
										list3.Add(val30.gameObject);
									}
									if (((Object)val30).name == "ChimneySmoke_006 (1)")
									{
										list3.Add(val30.gameObject);
									}
									if (((Object)val30).name == "ChimneySmoke_007 (1)")
									{
										list3.Add(val30.gameObject);
									}
								}
							}
						}
						break;
					}
					case 3:
					{
						GameObject[] obsNormal5 = BG.instance.obsNormal;
						foreach (GameObject val32 in obsNormal5)
						{
							Component[] componentsInChildren13 = val32.GetComponentsInChildren(typeof(Component));
							foreach (Component val33 in componentsInChildren13)
							{
								if (factoryNormalHeatwave.Value && ((Object)val33).name == "Factory_Heatbox")
								{
									list3.Add(val33.gameObject);
								}
							}
						}
						break;
					}
					case 4:
					{
						GameObject[] obsNormal3 = BG.instance.obsNormal;
						foreach (GameObject val27 in obsNormal3)
						{
							Component[] componentsInChildren11 = val27.GetComponentsInChildren(typeof(Component));
							foreach (Component val28 in componentsInChildren11)
							{
								if (subwayNormalPassengers.Value)
								{
									if (((Object)val28).name == "Passengers")
									{
										list3.Add(val28.gameObject);
									}
									if (((Object)val28).name == "Passengers (1)")
									{
										list3.Add(val28.gameObject);
									}
									if (((Object)val28).name == "Passengers (2)")
									{
										list3.Add(val28.gameObject);
									}
									if (((Object)val28).name == "Passengers (3)")
									{
										list3.Add(val28.gameObject);
									}
									if (((Object)val28).name == "Passengers (4)")
									{
										list3.Add(val28.gameObject);
									}
									if (((Object)val28).name == "Passengers (5)")
									{
										list3.Add(val28.gameObject);
									}
									if (((Object)val28).name == "Passengers (6)")
									{
										list3.Add(val28.gameObject);
									}
									if (((Object)val28).name == "Passengers (7)")
									{
										list3.Add(val28.gameObject);
									}
									if (((Object)val28).name == "Passengers (8)")
									{
										list3.Add(val28.gameObject);
									}
									if (((Object)val28).name == "Passengers (9)")
									{
										list3.Add(val28.gameObject);
									}
									if (((Object)val28).name == "Passengers (10)")
									{
										list3.Add(val28.gameObject);
									}
									if (((Object)val28).name == "Passengers (11)")
									{
										list3.Add(val28.gameObject);
									}
									if (((Object)val28).name == "Passengers (12)")
									{
										list3.Add(val28.gameObject);
									}
									if (((Object)val28).name == "Passengers (13)")
									{
										list3.Add(val28.gameObject);
									}
									if (((Object)val28).name == "Passengers (14)")
									{
										list3.Add(val28.gameObject);
									}
									if (((Object)val28).name == "Passengers (15)")
									{
										list3.Add(val28.gameObject);
									}
								}
								if (subwayTrainStopState.Value == 2 && ((Object)val28).name == "Subway_SmallPlatform")
								{
									list3.Add(val28.gameObject);
								}
							}
						}
						break;
					}
					case 5:
						if (stadiumNormalActionScreen.Value)
						{
							Stadium_ScreenCamController val23 = Object.FindObjectOfType<Stadium_ScreenCamController>();
							val23.OnEclipse(true);
						}
						break;
					case 6:
					{
						if (streetsPoliceCars.Value)
						{
							PoliceCarsScript val24 = Object.FindObjectOfType<PoliceCarsScript>();
							if ((Object)(object)val24 != (Object)null)
							{
								((Component)val24).gameObject.SetActive(false);
							}
						}
						GameObject[] obsNormal2 = BG.instance.obsNormal;
						foreach (GameObject val25 in obsNormal2)
						{
							Component[] componentsInChildren10 = val25.GetComponentsInChildren(typeof(Component));
							foreach (Component val26 in componentsInChildren10)
							{
								if (streetsNormalPoliceDrones.Value && ((Object)val26).name == "policeDrones")
								{
									list3.Add(val26.gameObject);
								}
								if (streetsNormalPedestrians.Value)
								{
									if (((Object)val26).name == "Pedestrians")
									{
										list3.Add(val26.gameObject);
									}
									if (((Object)val26).name == "Pedestrians (1)")
									{
										list3.Add(val26.gameObject);
									}
									if (((Object)val26).name == "Pedestrians (2)")
									{
										list3.Add(val26.gameObject);
									}
									if (((Object)val26).name == "Pedestrians (3)")
									{
										list3.Add(val26.gameObject);
									}
									if (((Object)val26).name == "Pedestrians (4)")
									{
										list3.Add(val26.gameObject);
									}
									if (((Object)val26).name == "Pedestrians (5)")
									{
										list3.Add(val26.gameObject);
									}
									if (((Object)val26).name == "Pedestrians (6)")
									{
										list3.Add(val26.gameObject);
									}
									if (((Object)val26).name == "Pedestrians (7)")
									{
										list3.Add(val26.gameObject);
									}
									if (((Object)val26).name == "Pedestrians (8)")
									{
										list3.Add(val26.gameObject);
									}
									if (((Object)val26).name == "Pedestrians (9)")
									{
										list3.Add(val26.gameObject);
									}
									if (((Object)val26).name == "Pedestrians (10)")
									{
										list3.Add(val26.gameObject);
									}
									if (((Object)val26).name == "Pedestrians (11)")
									{
										list3.Add(val26.gameObject);
									}
									if (((Object)val26).name == "Pedestrians (12)")
									{
										list3.Add(val26.gameObject);
									}
									if (((Object)val26).name == "Pedestrians (13)")
									{
										list3.Add(val26.gameObject);
									}
									if (((Object)val26).name == "Pedestrians (14)")
									{
										list3.Add(val26.gameObject);
									}
									if (((Object)val26).name == "Pedestrians (15)")
									{
										list3.Add(val26.gameObject);
									}
									if (((Object)val26).name == "Pedestrians (16)")
									{
										list3.Add(val26.gameObject);
									}
									if (((Object)val26).name == "Pedestrians (17)")
									{
										list3.Add(val26.gameObject);
									}
									if (((Object)val26).name == "PedestriansLayer")
									{
										list3.Add(val26.gameObject);
									}
								}
							}
						}
						break;
					}
					case 7:
					{
						GameObject[] obsNormal = BG.instance.obsNormal;
						foreach (GameObject val21 in obsNormal)
						{
							Component[] componentsInChildren9 = val21.GetComponentsInChildren(typeof(Component));
							foreach (Component val22 in componentsInChildren9)
							{
								if (poolNormalWater.Value)
								{
									if (((Object)val22).name == "WaterPlane")
									{
										list3.Add(val22.gameObject);
									}
									if (((Object)val22).name == "Reflection_Probe")
									{
										list3.Add(val22.gameObject);
									}
								}
								if (poolNormalBlimps.Value && ((Object)val22).name == "airship")
								{
									list3.Add(val22.gameObject);
								}
							}
						}
						break;
					}
					}
					SetVisuals(normalEnable2, list3, eclipseEnable2, eclipseDisable);
					hasSetNormalVisuals = true;
				}
				Stage curStage4 = StageHandler.curStage;
				Stage val34 = curStage4;
				if ((int)val34 == 6 && elevatorLockToFloor.Value)
				{
					LockElevatorToFloor();
				}
			}
		}
		else
		{
			hasSetNormalVisuals = false;
			hasSetEclipseVisuals = false;
		}
	}

	public void SetTextureCycleRate(Component c)
	{
		//IL_0002: Unknown result type (might be due to invalid IL or missing references)
		//IL_0008: Expected O, but got Unknown
		TextureCycleScript val = (TextureCycleScript)c;
		val.switchRate = float.MaxValue;
	}

	public void StopElevatorBlur()
	{
		//IL_0019: Unknown result type (might be due to invalid IL or missing references)
		//IL_001f: Invalid comparison between Unknown and I4
		//IL_0055: Unknown result type (might be due to invalid IL or missing references)
		//IL_006f: Unknown result type (might be due to invalid IL or missing references)
		if ((Object)(object)ElevatorScript.instance != (Object)null && (int)ElevatorScript.instance.state == 8)
		{
			ElevatorScript.instance.currentFloor = 5;
			ElevatorScript.instance.targetFloor = 5;
			ElevatorScript.instance.SetState((ElevatorState)1);
			ElevatorScript.instance.worldTf.position = Vector3.up * ElevatorScript.instance.floorPos[ElevatorScript.instance.targetFloor];
			ElevatorScript.instance.velocity.y = Mathf.Min(ElevatorScript.instance.velocity.y, 25f);
			if (((Behaviour)ElevatorScript.instance).enabled)
			{
				ElevatorScript.instance.eclipseBlur.SetActive(false);
			}
			ElevatorScript.instance.timer = ElevatorScript.instance.stayOnFloorDuration;
		}
	}

	public void SetVisuals(List<GameObject> normalEnable, List<GameObject> normalDisable, List<GameObject> eclipseEnable, List<GameObject> eclipseDisable)
	{
		if (eclipseEnable.Count() > 0)
		{
			for (int i = 0; i < eclipseEnable.Count(); i++)
			{
				eclipseEnable[i].SetActive(true);
			}
		}
		if (eclipseDisable.Count() > 0)
		{
			for (int j = 0; j < eclipseDisable.Count(); j++)
			{
				eclipseDisable[j].SetActive(false);
			}
		}
		if (normalDisable.Count() > 0)
		{
			for (int k = 0; k < normalDisable.Count(); k++)
			{
				reEnableOnStockReset.Add(normalDisable[k]);
				normalDisable[k].SetActive(false);
			}
		}
		if (normalEnable.Count() > 0)
		{
			for (int l = 0; l < normalEnable.Count(); l++)
			{
				normalEnable[l].SetActive(true);
			}
		}
	}

	public void LockElevatorToFloor()
	{
		//IL_004f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0069: Unknown result type (might be due to invalid IL or missing references)
		if ((Object)(object)ElevatorScript.instance != (Object)null)
		{
			ElevatorScript.instance.currentFloor = elevatorLockToFloorNum.Value;
			ElevatorScript.instance.targetFloor = elevatorLockToFloorNum.Value;
			ElevatorScript.instance.SetState((ElevatorState)1);
			ElevatorScript.instance.worldTf.position = Vector3.up * ElevatorScript.instance.floorPos[ElevatorScript.instance.targetFloor];
			ElevatorScript.instance.timer = ElevatorScript.instance.stayOnFloorDuration;
		}
	}

	private void ReEnableNormalEffectsOnStockReset()
	{
		if (reEnableOnStockReset.Count() > 0)
		{
			for (int i = 0; i < reEnableOnStockReset.Count(); i++)
			{
				reEnableOnStockReset[i].SetActive(true);
			}
			reEnableOnStockReset.Clear();
		}
	}
}