Decompiled source of Chameleon v1.1.3

Chameleon.dll

Decompiled a week ago
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using BepInEx;
using BepInEx.Bootstrap;
using BepInEx.Configuration;
using BepInEx.Logging;
using Chameleon.Info;
using DunGen;
using HarmonyLib;
using Microsoft.CodeAnalysis;
using UnityEngine;
using UnityEngine.SceneManagement;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")]
[assembly: AssemblyCompany("Chameleon")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyDescription("Changes visual elements of interiors for more variety")]
[assembly: AssemblyFileVersion("1.1.3.0")]
[assembly: AssemblyInformationalVersion("1.1.3+471ec87217653142109c620e3f1386fc4f3490b8")]
[assembly: AssemblyProduct("Chameleon")]
[assembly: AssemblyTitle("Chameleon")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.1.3.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 Chameleon
{
	internal enum GordionStorms
	{
		Never = -1,
		Chance,
		Always
	}
	[BepInPlugin("butterystancakes.lethalcompany.chameleon", "Chameleon", "1.1.3")]
	public class Plugin : BaseUnityPlugin
	{
		private const string PLUGIN_GUID = "butterystancakes.lethalcompany.chameleon";

		private const string PLUGIN_NAME = "Chameleon";

		private const string PLUGIN_VERSION = "1.1.3";

		internal static ManualLogSource Logger;

		internal static ConfigEntry<bool> configFancyEntranceDoors;

		internal static ConfigEntry<bool> configRecolorRandomRocks;

		internal static ConfigEntry<bool> configDoorLightColors;

		internal static ConfigEntry<bool> configIceCaves;

		internal static ConfigEntry<bool> configAmethystCave;

		internal static ConfigEntry<bool> configDesertCaves;

		internal static ConfigEntry<bool> configMesaCave;

		internal static ConfigEntry<bool> configRainyMarch;

		internal static ConfigEntry<bool> configAdaptiveArtifice;

		internal static ConfigEntry<bool> configIcyTitan;

		internal static ConfigEntry<GordionStorms> configStormyGordion;

		private void Awake()
		{
			//IL_0170: Unknown result type (might be due to invalid IL or missing references)
			configFancyEntranceDoors = ((BaseUnityPlugin)this).Config.Bind<bool>("Exterior", "FancyEntranceDoors", true, "Changes the front doors to match how they look on the inside when a manor interior generates. (Works for ONLY vanilla levels!)");
			configRecolorRandomRocks = ((BaseUnityPlugin)this).Config.Bind<bool>("Exterior", "RecolorRandomRocks", true, "Recolors random boulders to be white on snowy moons so they blend in better.");
			configRainyMarch = ((BaseUnityPlugin)this).Config.Bind<bool>("Exterior", "RainyMarch", true, "March is constantly rainy, as described in its terminal page. This is purely visual and does not affect quicksand generation.");
			configStormyGordion = ((BaseUnityPlugin)this).Config.Bind<GordionStorms>("Exterior", "StormyGordion", GordionStorms.Chance, "Allows for storms on Gordion, as described in its terminal page. This is purely visual and lightning does not strike at The Company.");
			configDoorLightColors = ((BaseUnityPlugin)this).Config.Bind<bool>("Interior", "DoorLightColors", true, "Dynamically adjust the color of the light behind the entrance doors depending on where you land and the current weather.");
			configIceCaves = ((BaseUnityPlugin)this).Config.Bind<bool>("Interior", "IceCaves", true, "Enable ice caves on blizzard moons.");
			configAmethystCave = ((BaseUnityPlugin)this).Config.Bind<bool>("Interior", "AmethystCave", true, "Enable amethyst caves on Embrion.");
			configDesertCaves = ((BaseUnityPlugin)this).Config.Bind<bool>("Interior", "DesertCave", true, "Enable desert caves on Assurance and Offense.");
			configMesaCave = ((BaseUnityPlugin)this).Config.Bind<bool>("Interior", "MesaCave", true, "Enable \"mesa\" caves on Experimentation and Titan.");
			configIcyTitan = ((BaseUnityPlugin)this).Config.Bind<bool>("Interior", "IcyTitan", false, "Enabling this will make Titan generate ice caves instead of mesa caves.");
			configAdaptiveArtifice = ((BaseUnityPlugin)this).Config.Bind<bool>("Interior", "AdaptiveArtifice", true, "If you have also installed ArtificeBlizzard, you can disable this to force Artifice to use rock caverns even when the surface is snowy.");
			Logger = ((BaseUnityPlugin)this).Logger;
			new Harmony("butterystancakes.lethalcompany.chameleon").PatchAll();
			SceneManager.sceneUnloaded += delegate
			{
				SceneOverrides.done = false;
				SceneOverrides.forceRainy = false;
				SceneOverrides.forceStormy = false;
			};
			Logger.LogInfo((object)"Chameleon v1.1.3 loaded");
		}
	}
	[HarmonyPatch]
	internal class ChameleonPatches
	{
		[HarmonyPatch(typeof(RoundManager), "FinishGeneratingNewLevelClientRpc")]
		[HarmonyPostfix]
		private static void PostFinishGeneratingNewLevelClientRpc(RoundManager __instance)
		{
			if (!SceneOverrides.done)
			{
				SceneOverrides.done = true;
				SceneOverrides.SetupCompatibility();
				SceneOverrides.ExteriorOverrides();
				SceneOverrides.InteriorOverrides();
			}
		}

		[HarmonyPatch(typeof(TimeOfDay), "Update")]
		[HarmonyPostfix]
		private static void TimeOfDayPostUpdate(TimeOfDay __instance)
		{
			//IL_00b0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b5: 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_00d3: Unknown result type (might be due to invalid IL or missing references)
			if (SceneOverrides.forceRainy)
			{
				if ((!GameNetworkManager.Instance.localPlayerController.isInsideFactory && !GameNetworkManager.Instance.localPlayerController.isPlayerDead) || ((Object)(object)GameNetworkManager.Instance.localPlayerController.spectatedPlayerScript != (Object)null && !GameNetworkManager.Instance.localPlayerController.spectatedPlayerScript.isInsideFactory))
				{
					__instance.effects[1].effectEnabled = true;
				}
			}
			else if (SceneOverrides.forceStormy)
			{
				GameObject effectObject = __instance.effects[2].effectObject;
				Vector3 position = (GameNetworkManager.Instance.localPlayerController.isPlayerDead ? ((Component)StartOfRound.Instance.spectateCamera).transform : ((Component)GameNetworkManager.Instance.localPlayerController).transform).position;
				position.y = Mathf.Max(position.y, -24f);
				effectObject.transform.position = position;
				effectObject.SetActive(true);
			}
		}

		[HarmonyPatch(typeof(TimeOfDay), "PlayTimeMusicDelayed")]
		[HarmonyPostfix]
		private static void PostPlayTimeMusicDelayed(TimeOfDay __instance, AudioClip clip)
		{
			if ((Object)(object)clip == (Object)(object)StartOfRound.Instance.companyVisitMusic && SceneOverrides.forceStormy)
			{
				__instance.TimeOfDayMusic.volume = 1f;
			}
		}
	}
	internal static class SceneOverrides
	{
		internal static bool done;

		internal static bool forceRainy;

		internal static bool forceStormy;

		private static GameObject artificeBlizzard;

		internal static void ExteriorOverrides()
		{
			//IL_038a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0390: Invalid comparison between Unknown and I4
			//IL_039c: Unknown result type (might be due to invalid IL or missing references)
			//IL_03a2: Invalid comparison between Unknown and I4
			//IL_0071: Unknown result type (might be due to invalid IL or missing references)
			//IL_0077: Expected O, but got Unknown
			if (Plugin.configRecolorRandomRocks.Value && IsSnowLevel())
			{
				if ((Object)(object)RoundManager.Instance.mapPropsContainer == (Object)null)
				{
					RoundManager.Instance.mapPropsContainer = GameObject.FindGameObjectWithTag("MapPropsContainer");
				}
				if ((Object)(object)RoundManager.Instance.mapPropsContainer != (Object)null)
				{
					foreach (Transform item in RoundManager.Instance.mapPropsContainer.transform)
					{
						Transform val = item;
						if (((Object)val).name.StartsWith("LargeRock"))
						{
							Renderer[] componentsInChildren = ((Component)val).GetComponentsInChildren<Renderer>();
							foreach (Renderer obj in componentsInChildren)
							{
								obj.material.SetTexture("_MainTex", (Texture)null);
								obj.material.SetTexture("_BaseColorMap", (Texture)null);
							}
						}
					}
				}
			}
			if (((Object)StartOfRound.Instance.currentLevel).name == "CompanyBuildingLevel")
			{
				GameObject obj2 = GameObject.Find("/Environment/Map");
				Transform val2 = ((obj2 != null) ? obj2.transform : null);
				string[] array = new string[17]
				{
					"CompanyPlanet/Cube/Colliders/Cube", "CompanyPlanet/Cube/Colliders/Cube (2)", "CompanyPlanet/Cube/Colliders/Cube (3)", "CompanyPlanet/Elbow Joint.001", "CompanyPlanet/Cube.003", "ShippingContainers/ShippingContainer", "ShippingContainers/ShippingContainer (1)", "ShippingContainers/ShippingContainer (2)", "ShippingContainers/ShippingContainer (3)", "ShippingContainers/ShippingContainer (4)",
					"ShippingContainers/ShippingContainer (5)", "ShippingContainers/ShippingContainer (6)", "ShippingContainers/ShippingContainer (7)", "ShippingContainers/ShippingContainer (8)", "ShippingContainers/ShippingContainer (9)", "ShippingContainers/ShippingContainer (10)", "CompanyPlanet/Cube.005"
				};
				foreach (string text in array)
				{
					Transform val3 = val2.Find(text);
					if ((Object)(object)val3 != (Object)null)
					{
						((Component)val3).gameObject.layer = 8;
						Renderer component = ((Component)val3).GetComponent<Renderer>();
						if ((Object)(object)component != (Object)null && ((Object)component.sharedMaterial).name.StartsWith("testTrigger"))
						{
							component.enabled = false;
						}
					}
				}
				if (Plugin.configStormyGordion.Value == GordionStorms.Always)
				{
					forceStormy = true;
				}
				else
				{
					if (Plugin.configStormyGordion.Value != 0 || TimeOfDay.Instance.profitQuota <= 130)
					{
						return;
					}
					float num = 0.7f;
					int num2 = 0;
					GrabbableObject[] array2 = Object.FindObjectsOfType<GrabbableObject>();
					foreach (GrabbableObject val4 in array2)
					{
						if (val4.itemProperties.isScrap)
						{
							num2 += val4.scrapValue;
						}
					}
					if (TimeOfDay.Instance.daysUntilDeadline < 1)
					{
						if (num2 < 1)
						{
							num = 0.98f;
						}
						else if (num2 < TimeOfDay.Instance.profitQuota)
						{
							num += 0.17f;
						}
						else if (Mathf.FloorToInt((float)(num2 - TimeOfDay.Instance.profitQuota - 75) * 1.2f) + TimeOfDay.Instance.profitQuota >= 1500)
						{
							num = 0.6f;
						}
					}
					if (num2 > 0 && !StartOfRound.Instance.levels.Any((SelectableLevel level) => (int)level.currentWeather != -1))
					{
						num *= 0.55f;
					}
					if (new Random(StartOfRound.Instance.randomMapSeed).NextDouble() <= (double)num)
					{
						forceStormy = true;
					}
				}
			}
			else if (((Object)StartOfRound.Instance.currentLevel).name == "MarchLevel" && Plugin.configRainyMarch.Value && (int)StartOfRound.Instance.currentLevel.currentWeather != 2 && (int)StartOfRound.Instance.currentLevel.currentWeather != 4 && new Random(StartOfRound.Instance.randomMapSeed).NextDouble() <= 0.6600000262260437)
			{
				forceRainy = true;
			}
		}

		internal static void InteriorOverrides()
		{
			//IL_0100: Unknown result type (might be due to invalid IL or missing references)
			//IL_0106: Invalid comparison between Unknown and I4
			//IL_0109: Unknown result type (might be due to invalid IL or missing references)
			//IL_011d: Unknown result type (might be due to invalid IL or missing references)
			//IL_012e: Unknown result type (might be due to invalid IL or missing references)
			VanillaLevelsInfo.predefinedLevels.TryGetValue(((Object)StartOfRound.Instance.currentLevel).name, out var value);
			if ((Object)(object)RoundManager.Instance?.dungeonGenerator?.Generator?.DungeonFlow == (Object)null)
			{
				return;
			}
			if (((Object)RoundManager.Instance.dungeonGenerator.Generator.DungeonFlow).name == "Level2Flow" || ((Object)RoundManager.Instance.dungeonGenerator.Generator.DungeonFlow).name == "SDMLevel")
			{
				if (Plugin.configFancyEntranceDoors.Value && value != null)
				{
					SetUpFancyEntranceDoors(value);
				}
				return;
			}
			if (Plugin.configDoorLightColors.Value)
			{
				SpriteRenderer val = ((IEnumerable<SpriteRenderer>)Object.FindObjectsOfType<SpriteRenderer>()).FirstOrDefault((Func<SpriteRenderer, bool>)((SpriteRenderer spriteRenderer) => ((Object)spriteRenderer).name == "LightBehindDoor"));
				if ((Object)(object)val != (Object)null)
				{
					if ((int)StartOfRound.Instance.currentLevel.currentWeather == 5)
					{
						val.color = DoorLightPalette.ECLIPSE_BACKGROUND;
					}
					else if (IsSnowLevel())
					{
						val.color = DoorLightPalette.BLIZZARD_BACKGROUND;
					}
					else if (value != null)
					{
						val.color = value.doorLightColor;
					}
					else
					{
						Plugin.Logger.LogWarning((object)"Could not recolor door light - No information exists for the current level (Are you playing a custom moon?)");
					}
				}
				else
				{
					Plugin.Logger.LogWarning((object)"Could not recolor door light - GameObject \"LightBehindDoor\" was not found (Are you playing a custom interior?)");
				}
			}
			if (((Object)RoundManager.Instance.dungeonGenerator.Generator.DungeonFlow).name == "Level3Flow")
			{
				if (IsSnowLevel() && (value == null || value.cavernType <= CavernType.Ice || (((Object)StartOfRound.Instance.currentLevel).name == "TitanLevel" && Plugin.configIcyTitan.Value)) && (((Object)StartOfRound.Instance.currentLevel).name != "ArtificeLevel" || Plugin.configAdaptiveArtifice.Value))
				{
					RetextureCaverns(CavernType.Ice);
				}
				else
				{
					RetextureCaverns(value?.cavernType ?? CavernType.Vanilla);
				}
			}
		}

		private static void SetUpFancyEntranceDoors(LevelCosmeticInfo levelCosmeticInfo)
		{
			//IL_0174: Unknown result type (might be due to invalid IL or missing references)
			//IL_017a: Unknown result type (might be due to invalid IL or missing references)
			//IL_019b: Unknown result type (might be due to invalid IL or missing references)
			//IL_01a0: Unknown result type (might be due to invalid IL or missing references)
			//IL_01b0: Unknown result type (might be due to invalid IL or missing references)
			//IL_01b6: Unknown result type (might be due to invalid IL or missing references)
			//IL_01bb: Unknown result type (might be due to invalid IL or missing references)
			//IL_01d0: Unknown result type (might be due to invalid IL or missing references)
			//IL_01db: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ec: Unknown result type (might be due to invalid IL or missing references)
			//IL_01f6: Unknown result type (might be due to invalid IL or missing references)
			//IL_020b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0211: Unknown result type (might be due to invalid IL or missing references)
			//IL_0216: Unknown result type (might be due to invalid IL or missing references)
			//IL_0222: Unknown result type (might be due to invalid IL or missing references)
			//IL_0233: Unknown result type (might be due to invalid IL or missing references)
			//IL_023e: Unknown result type (might be due to invalid IL or missing references)
			//IL_024e: Unknown result type (might be due to invalid IL or missing references)
			GameObject val = GameObject.Find(levelCosmeticInfo.fakeDoor1Path);
			GameObject val2 = GameObject.Find(levelCosmeticInfo.fakeDoor2Path);
			object obj2;
			if (!string.IsNullOrEmpty(levelCosmeticInfo.planePath))
			{
				GameObject obj = GameObject.Find(levelCosmeticInfo.planePath);
				obj2 = ((obj != null) ? obj.transform : null);
			}
			else
			{
				obj2 = null;
			}
			Transform val3 = (Transform)obj2;
			object obj4;
			if (!string.IsNullOrEmpty(levelCosmeticInfo.framePath))
			{
				GameObject obj3 = GameObject.Find(levelCosmeticInfo.framePath);
				obj4 = ((obj3 != null) ? obj3.transform : null);
			}
			else
			{
				obj4 = null;
			}
			Transform val4 = (Transform)obj4;
			if ((Object)(object)val == (Object)null || (Object)(object)val2 == (Object)null || (!string.IsNullOrEmpty(levelCosmeticInfo.planePath) && (Object)(object)val3 == (Object)null) || (!string.IsNullOrEmpty(levelCosmeticInfo.framePath) && (Object)(object)val4 == (Object)null))
			{
				Plugin.Logger.LogWarning((object)"\"FancyEntranceDoors\" skipped because some GameObjects were missing.");
				return;
			}
			GameObject val5 = null;
			try
			{
				AssetBundle obj5 = AssetBundle.LoadFromFile(Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), "fancyentrancedoors"));
				val5 = obj5.LoadAsset<GameObject>("WideDoorFrame");
				obj5.Unload(false);
			}
			catch
			{
				Plugin.Logger.LogError((object)"Encountered some error loading assets from bundle \"fancyentrancedoors\". Did you install the plugin correctly?");
				return;
			}
			if ((Object)(object)val5 == (Object)null)
			{
				Plugin.Logger.LogWarning((object)"\"FancyEntranceDoors\" skipped because fancy door asset was missing.");
				return;
			}
			if ((Object)(object)RoundManager.Instance.mapPropsContainer == (Object)null)
			{
				RoundManager.Instance.mapPropsContainer = GameObject.FindGameObjectWithTag("MapPropsContainer");
			}
			if ((Object)(object)RoundManager.Instance.mapPropsContainer == (Object)null)
			{
				Plugin.Logger.LogWarning((object)"\"FancyEntranceDoors\" skipped because disposable prop container did not exist in scene.");
				return;
			}
			val.SetActive(false);
			val2.SetActive(false);
			Transform transform = Object.Instantiate<GameObject>(val5, levelCosmeticInfo.fancyDoorPos, levelCosmeticInfo.fancyDoorRot, RoundManager.Instance.mapPropsContainer.transform).transform;
			if (levelCosmeticInfo.fancyDoorScalar != Vector3.one)
			{
				transform.localScale = Vector3.Scale(transform.localScale, levelCosmeticInfo.fancyDoorScalar);
			}
			if ((Object)(object)val4 != (Object)null)
			{
				val4.localScale = new Vector3(val4.localScale.x, val4.localScale.y + 0.05f, val4.localScale.z);
			}
			if ((Object)(object)val3 != (Object)null)
			{
				val3.localPosition += levelCosmeticInfo.planeOffset;
				val3.localScale = new Vector3(val3.localScale.x + 0.047f, val3.localScale.y, val3.localScale.z + 0.237f);
			}
		}

		private static void RetextureCaverns(CavernType type)
		{
			//IL_020c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0224: Unknown result type (might be due to invalid IL or missing references)
			switch (type)
			{
			case CavernType.Vanilla:
				break;
			case CavernType.Ice:
				if (!Plugin.configIceCaves.Value)
				{
					break;
				}
				goto default;
			default:
			{
				if ((type == CavernType.Amethyst && !Plugin.configAmethystCave.Value) || (type == CavernType.Desert && !Plugin.configDesertCaves.Value) || (type == CavernType.Mesa && !Plugin.configMesaCave.Value))
				{
					break;
				}
				string text = type.ToString().ToLower() + "cave";
				Material val = null;
				Material val2 = null;
				try
				{
					AssetBundle obj = AssetBundle.LoadFromFile(Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), text));
					val = obj.LoadAsset<Material>("CaveRocks1");
					val2 = obj.LoadAsset<Material>("CoalMat");
					obj.Unload(false);
				}
				catch
				{
					Plugin.Logger.LogError((object)("Encountered some error loading assets from bundle \"" + text + "\". Did you install the plugin correctly?"));
				}
				if ((Object)(object)val == (Object)null)
				{
					Plugin.Logger.LogWarning((object)"Skipping mineshaft retexture because there was an error loading the replacement material.");
					break;
				}
				GameObject val3 = GameObject.Find("/Systems/LevelGeneration/LevelGenerationRoot");
				if ((Object)(object)val3 == (Object)null)
				{
					Plugin.Logger.LogWarning((object)"Skipping mineshaft retexture because there was an error finding the dungeon object tree.");
					break;
				}
				VanillaLevelsInfo.predefinedCaverns.TryGetValue(type, out var value);
				if (value == null)
				{
					Plugin.Logger.LogWarning((object)"Skipping mineshaft retexture because there was an error finding cavern specifications.");
					break;
				}
				Renderer[] componentsInChildren = val3.GetComponentsInChildren<Renderer>();
				foreach (Renderer val4 in componentsInChildren)
				{
					if (((Object)val4).name == "MineshaftStartTileMesh")
					{
						Material[] materials = val4.materials;
						materials[3] = val;
						val4.materials = materials;
					}
					else
					{
						if (!((Object)(object)val4.sharedMaterial != (Object)null))
						{
							continue;
						}
						if (((Object)val4.sharedMaterial).name.StartsWith(((Object)val).name))
						{
							val4.material = val;
							if (((Component)val4).CompareTag("Rock") && !string.IsNullOrEmpty(value.tag))
							{
								((Component)val4).tag = value.tag;
							}
						}
						else if (value.waterColor && ((Object)val4).name == "Water (1)" && ((Object)val4.sharedMaterial).name.StartsWith("CaveWater"))
						{
							val4.material.SetColor("Color_6a9a916e2c84442984edc20c082efe79", value.waterColor1);
							val4.material.SetColor("Color_c9a840f2115c4802ba54d713194f761d", value.waterColor2);
						}
						else if ((Object)(object)val2 != (Object)null && ((Object)val4.sharedMaterial).name.StartsWith(((Object)val2).name))
						{
							val4.material = val2;
						}
					}
				}
				if (!value.noDrips)
				{
					break;
				}
				LocalPropSet[] componentsInChildren2 = val3.GetComponentsInChildren<LocalPropSet>();
				foreach (LocalPropSet val5 in componentsInChildren2)
				{
					if (((Object)val5).name.StartsWith("WaterDrips"))
					{
						((Component)val5).gameObject.SetActive(false);
						Plugin.Logger.LogDebug((object)"Disabled water drips");
					}
				}
				break;
			}
			}
		}

		internal static void SetupCompatibility()
		{
			if (((Object)StartOfRound.Instance.currentLevel).name == "ArtificeLevel" && Chainloader.PluginInfos.ContainsKey("butterystancakes.lethalcompany.artificeblizzard"))
			{
				artificeBlizzard = GameObject.Find("/Systems/Audio/BlizzardAmbience");
				if ((Object)(object)artificeBlizzard != (Object)null && Plugin.configAdaptiveArtifice.Value)
				{
					Plugin.Logger.LogInfo((object)"Artifice Blizzard compatibility success");
				}
			}
		}

		internal static bool IsSnowLevel()
		{
			if (StartOfRound.Instance.currentLevel.levelIncludesSnowFootprints)
			{
				if (!((Object)(object)artificeBlizzard == (Object)null))
				{
					return artificeBlizzard.activeSelf;
				}
				return true;
			}
			return false;
		}
	}
	public static class PluginInfo
	{
		public const string PLUGIN_GUID = "Chameleon";

		public const string PLUGIN_NAME = "Chameleon";

		public const string PLUGIN_VERSION = "1.1.3";
	}
}
namespace Chameleon.Info
{
	internal enum CavernType
	{
		Vanilla = -1,
		Ice,
		Amethyst,
		Desert,
		Mesa
	}
	internal class CavernInfo
	{
		internal string tag = string.Empty;

		internal bool waterColor;

		internal Color waterColor1 = new Color(0.3018868f, 0.24540168f, 0.22926308f, 0.972549f);

		internal Color waterColor2 = new Color(27f / 106f, 0.2132654f, 0.17181382f, 84f / 85f);

		internal bool noDrips;
	}
	internal static class DoorLightPalette
	{
		internal static readonly Color WITCHES_BACKGROUND = new Color(0.4901961f, 0.4693464f, 32f / 85f);

		internal static readonly Color BLIZZARD_BACKGROUND = new Color(0.4845f, 0.4986666f, 0.51f);

		internal static readonly Color AMETHYST_BACKGROUND = new Color(0.4901961f, 0.3714178f, 0.3578431f);

		internal static readonly Color ECLIPSE_BACKGROUND = new Color(0.4901961f, 0.3336095f, 23f / 102f);
	}
	internal class LevelCosmeticInfo
	{
		internal string fakeDoor1Path = "/Environment/SteelDoorFake";

		internal string fakeDoor2Path = "/Environment/SteelDoorFake (1)";

		internal string framePath = "/Environment/DoorFrame (1)";

		internal string planePath = "/Environment/Plane";

		internal Vector3 fancyDoorPos;

		internal Quaternion fancyDoorRot;

		internal Vector3 fancyDoorScalar = Vector3.one;

		internal Vector3 planeOffset = new Vector3(0f, -1f, 0f);

		internal Color doorLightColor = new Color(0.490566f, 0.4165709f, 0.3355286f);

		internal CavernType cavernType = CavernType.Vanilla;
	}
	internal static class VanillaLevelsInfo
	{
		internal static Dictionary<string, LevelCosmeticInfo> predefinedLevels = new Dictionary<string, LevelCosmeticInfo>
		{
			{
				"ExperimentationLevel",
				new LevelCosmeticInfo
				{
					fakeDoor1Path = "/Environment/SteelDoor (6)",
					fakeDoor2Path = "/Environment/SteelDoor (5)",
					framePath = string.Empty,
					planePath = string.Empty,
					fancyDoorPos = new Vector3(-113.911f, 2.895f, -17.67f),
					fancyDoorRot = Quaternion.Euler(-90f, 0f, 0f),
					fancyDoorScalar = new Vector3(1f, 1.07f, 1f),
					cavernType = CavernType.Mesa
				}
			},
			{
				"AssuranceLevel",
				new LevelCosmeticInfo
				{
					fancyDoorPos = new Vector3(135.249f, 6.452f, 74.49f),
					fancyDoorRot = Quaternion.Euler(-90f, 180f, 0f),
					planeOffset = new Vector3(0.075f, -1f, 0f),
					cavernType = CavernType.Desert
				}
			},
			{
				"VowLevel",
				new LevelCosmeticInfo
				{
					fancyDoorPos = new Vector3(-29.279f, -1.176f, 151.069f),
					fancyDoorRot = Quaternion.Euler(-90f, 90f, 0f),
					planeOffset = new Vector3(0.075f, -1f, 0f)
				}
			},
			{
				"OffenseLevel",
				new LevelCosmeticInfo
				{
					fancyDoorPos = new Vector3(128.936f, 16.35f, -53.713f),
					fancyDoorRot = Quaternion.Euler(-90f, 180f, -73.621f),
					planeOffset = new Vector3(0f, -1f, -0.075f),
					cavernType = CavernType.Desert
				}
			},
			{
				"MarchLevel",
				new LevelCosmeticInfo
				{
					fancyDoorPos = new Vector3(-158.18f, -3.953f, 21.708f),
					fancyDoorRot = Quaternion.Euler(-90f, 0f, 0f),
					planeOffset = new Vector3(0f, -1f, -0.075f)
				}
			},
			{
				"EmbrionLevel",
				new LevelCosmeticInfo
				{
					fancyDoorPos = new Vector3(-195.47f, 6.357f, -7.83f),
					fancyDoorRot = Quaternion.Euler(-90f, 0f, 39.517f),
					planeOffset = new Vector3(-0.045f, -1f, -0.05513f),
					doorLightColor = DoorLightPalette.AMETHYST_BACKGROUND,
					cavernType = CavernType.Amethyst
				}
			},
			{
				"AdamanceLevel",
				new LevelCosmeticInfo
				{
					fakeDoor1Path = "/Environment/Teleports/EntranceTeleportA/SteelDoorFake",
					fakeDoor2Path = "/Environment/Teleports/EntranceTeleportA/SteelDoorFake (1)",
					framePath = "/Environment/Teleports/EntranceTeleportA/DoorFrame (1)",
					planePath = "/Environment/Teleports/EntranceTeleportA/Plane",
					fancyDoorPos = new Vector3(-122.032f, 1.843f, -3.617f),
					fancyDoorRot = Quaternion.Euler(-90f, 0f, 0f),
					planeOffset = new Vector3(-0.0033637f, -0.069986f, -1.0246016f),
					doorLightColor = DoorLightPalette.WITCHES_BACKGROUND
				}
			},
			{
				"RendLevel",
				new LevelCosmeticInfo
				{
					fancyDoorPos = new Vector3(50.545f, -16.822502f, -152.71658f),
					fancyDoorRot = Quaternion.Euler(-90f, 180f, 64.342f),
					doorLightColor = DoorLightPalette.BLIZZARD_BACKGROUND,
					cavernType = CavernType.Ice
				}
			},
			{
				"DineLevel",
				new LevelCosmeticInfo
				{
					fancyDoorPos = new Vector3(-120.70987f, -16.337002f, -4.2681026f),
					fancyDoorRot = Quaternion.Euler(-90f, 0f, 90.836f),
					doorLightColor = DoorLightPalette.BLIZZARD_BACKGROUND,
					cavernType = CavernType.Ice
				}
			},
			{
				"TitanLevel",
				new LevelCosmeticInfo
				{
					fancyDoorPos = new Vector3(-35.877f, 47.64f, 8.939f),
					fancyDoorRot = Quaternion.Euler(-90f, 0f, 35.333f),
					planeOffset = new Vector3(0.03f, -1f, 0.036f),
					doorLightColor = DoorLightPalette.BLIZZARD_BACKGROUND,
					cavernType = CavernType.Mesa
				}
			},
			{
				"ArtificeLevel",
				new LevelCosmeticInfo
				{
					fakeDoor1Path = "/Environment/MainFactory/SteelDoorFake",
					fakeDoor2Path = "/Environment/MainFactory/SteelDoorFake (1)",
					framePath = "/Environment/MainFactory/DoorFrame (1)",
					planePath = "/Environment/MainFactory/Plane",
					fancyDoorPos = new Vector3(52.32f, -0.665f, -156.146f),
					fancyDoorRot = Quaternion.Euler(-90f, -90f, 0f)
				}
			}
		};

		internal static Dictionary<CavernType, CavernInfo> predefinedCaverns = new Dictionary<CavernType, CavernInfo>
		{
			{
				CavernType.Ice,
				new CavernInfo
				{
					tag = "Snow",
					waterColor = true,
					waterColor1 = new Color(0f, 0.18982977f, 0.20754719f, 0.972549f),
					waterColor2 = new Color(0.12259702f, 0.1792453f, 0.16491137f, 84f / 85f)
				}
			},
			{
				CavernType.Amethyst,
				new CavernInfo
				{
					noDrips = true
				}
			},
			{
				CavernType.Desert,
				new CavernInfo()
			},
			{
				CavernType.Mesa,
				new CavernInfo
				{
					tag = "Gravel"
				}
			}
		};
	}
}