Decompiled source of ClaySurgeonOverhaul v1.3.5

ClaySurgeonMod.dll

Decompiled 2 weeks 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 BarberFixes;
using BepInEx;
using BepInEx.Bootstrap;
using BepInEx.Configuration;
using BepInEx.Logging;
using HarmonyLib;
using LethalConfig;
using LethalConfig.ConfigItems;
using Microsoft.CodeAnalysis;
using UnityEngine;
using UnityEngine.Rendering;
using UnityEngine.Rendering.HighDefinition;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")]
[assembly: IgnoresAccessChecksTo("fandovec03.ExperimentalEnemyInteractions")]
[assembly: AssemblyCompany("ClaySurgeonMod")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyDescription("A different take on the Barber")]
[assembly: AssemblyFileVersion("1.3.4.0")]
[assembly: AssemblyInformationalVersion("1.3.4+e49f74ff159a5550473baf92d918a7ec3500d4c1")]
[assembly: AssemblyProduct("ClaySurgeonMod")]
[assembly: AssemblyTitle("ClaySurgeonMod")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.3.4.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 ClaySurgeonMod
{
	[BepInPlugin("dopadream.lethalcompany.ClaySurgeonMod", "Clay Surgeon", "1.3.5")]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	public class Plugin : BaseUnityPlugin
	{
		[HarmonyPatch]
		private class ClaySurgeonPatches
		{
			[HarmonyPatch(typeof(RoundManager), "RefreshEnemiesList")]
			[HarmonyPostfix]
			private static void RoundManagerPostRefresh(RoundManager __instance, ref int ___enemyRushIndex)
			{
				DateTime dateTime = new DateTime(DateTime.Now.Year, 10, 31);
				bool num = DateTime.Today == dateTime;
				Random random = new Random(StartOfRound.Instance.randomMapSeed + 5781);
				if (((num && random.Next(0, 210) < 3) || random.Next(0, 1000) < 15 || configKlayWorld.Value) && ___enemyRushIndex == -1 && configInfestations.Value)
				{
					for (int i = 0; i < __instance.currentLevel.Enemies.Count; i++)
					{
						if (__instance.currentLevel.Enemies[i].enemyType.enemyName == "Clay Surgeon" && __instance.currentLevel.Enemies[i].enemyType.MaxCount > 1)
						{
							Logger.LogDebug((object)"Clay infestation started!");
							((Component)__instance.indoorFog).gameObject.SetActive(random.Next(0, 100) < 20);
							___enemyRushIndex = i;
							__instance.currentMaxInsidePower = __instance.currentLevel.Enemies[i].enemyType.PowerLevel * (float)__instance.currentLevel.Enemies[i].enemyType.MaxCount;
							break;
						}
					}
				}
				clayRandom = new Random(StartOfRound.Instance.randomMapSeed);
			}

			private static Texture getRandomSkin(Random random)
			{
				clayWeightList.Clear();
				int num = random.Next(0, 300);
				int[] array = new int[11]
				{
					(int)configSkin0.Value,
					(int)configSkin1.Value,
					(int)configSkin2.Value,
					(int)configSkin3.Value,
					(int)configSkin4.Value,
					(int)configSkin5.Value,
					(int)configSkin6.Value,
					(int)configSkin7.Value,
					(int)configSkin8.Value,
					(int)configSkin9.Value,
					(int)configSkin10.Value
				};
				Texture[] array2 = (Texture[])(object)new Texture[11]
				{
					claySkinPurple, claySkinRed, claySkinPink, claySkinTeal, claySkinGreen, claySkinYellow, claySkinOrange, claySkinCyan, claySkinMagenta, claySkinWhite,
					claySkinBlack
				};
				List<int> list = new List<int>();
				for (int i = 0; i < array.Length; i++)
				{
					if (array[i] != 0 && num <= array[i])
					{
						list.Add(i);
					}
				}
				if (list.Count > 0)
				{
					return array2[RoundManager.Instance.GetRandomWeightedIndex(array.ToArray(), random)];
				}
				return claySkinPurple;
			}

			[HarmonyPatch(typeof(QuickMenuManager), "Start")]
			[HarmonyPostfix]
			private static void QuickMenuManagerPostStart(QuickMenuManager __instance)
			{
				allEnemiesList.Clear();
				List<SpawnableEnemyWithRarity>[] array = new List<SpawnableEnemyWithRarity>[1] { __instance.testAllEnemiesLevel.Enemies };
				if (!configSpawnOverride.Value)
				{
					return;
				}
				List<SpawnableEnemyWithRarity>[] array2 = array;
				for (int i = 0; i < array2.Length; i++)
				{
					foreach (SpawnableEnemyWithRarity item in array2[i])
					{
						string name = ((Object)item.enemyType).name;
						if (allEnemiesList.ContainsKey(name))
						{
							if ((Object)(object)allEnemiesList[name] == (Object)(object)item.enemyType)
							{
								Logger.LogWarning((object)("allEnemiesList: Tried to cache reference to \"" + name + "\" more than once"));
							}
							else
							{
								Logger.LogWarning((object)("allEnemiesList: Tried to cache two different enemies by same name (" + name + ")"));
							}
						}
						else if (item.enemyType.enemyName == "Clay Surgeon")
						{
							item.enemyType.spawnInGroupsOf = configSpawnInGroupsOf.Value;
							item.enemyType.MaxCount = configMaxCount.Value;
							item.enemyType.PowerLevel = configPowerLevel.Value;
							item.enemyType.probabilityCurve = dummyType.probabilityCurve;
							item.enemyType.numberSpawnedFalloff = dummyType.numberSpawnedFalloff;
							item.enemyType.useNumberSpawnedFalloff = true;
							Logger.LogDebug((object)"Barber spawn settings overridden!");
							return;
						}
					}
				}
			}

			[HarmonyPatch(typeof(ClaySurgeonAI), "Awake")]
			[HarmonyPostfix]
			private static void ClaySurgeonAIPostWake(ClaySurgeonAI __instance)
			{
				//IL_001b: Unknown result type (might be due to invalid IL or missing references)
				//IL_0026: Unknown result type (might be due to invalid IL or missing references)
				Object.Destroy((Object)(object)((Component)((EnemyAI)__instance).creatureAnimator).gameObject);
				Transform transform = Object.Instantiate<GameObject>(clayPrefab, ((Component)__instance).transform.position, ((Component)__instance).transform.rotation, ((Component)__instance).transform.Find("MeshContainer")).transform;
				((EnemyAI)__instance).creatureAnimator = ((Component)transform).GetComponentInChildren<Animator>();
				__instance.skin = ((Component)transform).GetComponentInChildren<SkinnedMeshRenderer>();
				((Component)__instance).gameObject.GetComponentInChildren<ScanNodeProperties>().headerText = "Clay Surgeon";
				((EnemyAI)__instance).skinnedMeshRenderers = ((Component)transform).gameObject.GetComponentsInChildren<SkinnedMeshRenderer>();
				((EnemyAI)__instance).meshRenderers = ((Component)transform).gameObject.GetComponentsInChildren<MeshRenderer>();
				((Renderer)__instance.skin).sharedMaterials[0].mainTexture = getRandomSkin(clayRandom);
				((Component)transform).GetComponentInChildren<EnemyAnimationEvent>().mainScript = ((Component)__instance).gameObject.GetComponentInChildren<EnemyAnimationEvent>().mainScript;
			}

			[HarmonyPatch(typeof(ClaySurgeonAI), "Start")]
			[HarmonyPostfix]
			private static void ClaySurgeonAIPostStart(ClaySurgeonAI __instance)
			{
				Material[] array = (Material[])(object)new Material[((Renderer)__instance.skin).sharedMaterials.Length];
				for (int i = 0; i < array.Length; i++)
				{
					array[i] = Object.Instantiate<Material>(((Renderer)__instance.skin).materials[i]);
				}
				((Renderer)__instance.skin).sharedMaterials = array;
				AudioSource[] componentsInChildren = ((Component)__instance).gameObject.GetComponentsInChildren<AudioSource>();
				foreach (AudioSource val in componentsInChildren)
				{
					if (((Object)val.clip).name == "csambience")
					{
						val.volume = configAmbience.Value;
						break;
					}
				}
				Volume componentInChildren = ((Component)__instance).gameObject.GetComponentInChildren<Volume>();
				if ((Object)(object)componentInChildren == (Object)null)
				{
					throw new NullReferenceException("VolumeProfile");
				}
				componentInChildren.weight = configScreenEffects.Value;
				LensDistortion val2 = default(LensDistortion);
				if (componentInChildren.profile.TryGet<LensDistortion>(ref val2))
				{
					((VolumeParameter<float>)(object)val2.intensity).value = configScreenDistortion.Value;
				}
			}

			[HarmonyPatch(typeof(ClaySurgeonAI), "SetVisibility")]
			[HarmonyPostfix]
			private static void ClaySurgeonAIPostSetVis(ClaySurgeonAI __instance)
			{
				//IL_000f: Unknown result type (might be due to invalid IL or missing references)
				//IL_001a: Unknown result type (might be due to invalid IL or missing references)
				//IL_001f: Unknown result type (might be due to invalid IL or missing references)
				//IL_0029: Unknown result type (might be due to invalid IL or missing references)
				//IL_002e: Unknown result type (might be due to invalid IL or missing references)
				float num = Vector3.Distance(((Component)StartOfRound.Instance.audioListener).transform.position, ((Component)__instance).transform.position + Vector3.up * 0.7f);
				__instance.minDistance = configMinVisibility.Value;
				__instance.maxDistance = configMaxVisibility.Value;
				Material[] sharedMaterials = ((Renderer)__instance.skin).sharedMaterials;
				Material[] array = sharedMaterials;
				for (int i = 0; i < array.Length; i++)
				{
					array[i].SetFloat("_AlphaCutoff", (num - __instance.minDistance) / (__instance.maxDistance - __instance.minDistance));
				}
				((Renderer)__instance.skin).material.SetFloat("_IridescenceMask", configIridescence.Value);
				((Renderer)__instance.skin).sharedMaterials = sharedMaterials;
			}

			[HarmonyPatch(typeof(DanceClock), "Tick")]
			[HarmonyPrefix]
			private static bool DanceClockPreTick()
			{
				if (configCurve.Value)
				{
					float currentInterval = Mathf.Clamp(intervalCurve.Evaluate((float)TimeOfDay.Instance.hour / (float)TimeOfDay.Instance.numberOfHours), 1.25f, 2.75f);
					ClaySurgeonAI[] array = Object.FindObjectsOfType<ClaySurgeonAI>();
					for (int i = 0; i < array.Length; i++)
					{
						array[i].currentInterval = currentInterval;
					}
					return false;
				}
				return true;
			}

			[HarmonyPatch(typeof(Terminal), "Awake")]
			[HarmonyPostfix]
			private static void TerminalPostWake(Terminal __instance)
			{
				TerminalKeyword[] allKeywords = __instance.terminalNodes.allKeywords;
				foreach (TerminalNode enemyFile in __instance.enemyFiles)
				{
					if (enemyFile.creatureFileID != 24)
					{
						continue;
					}
					enemyFile.displayVideo = clayNode.displayVideo;
					enemyFile.displayText = clayNode.displayText;
					enemyFile.creatureName = clayNode.creatureName;
					TerminalKeyword[] array = allKeywords;
					foreach (TerminalKeyword val in array)
					{
						if (val.word == "barber")
						{
							val.word = "clay surgeon";
							return;
						}
					}
					Logger.LogDebug((object)"Barber bestiary entry replaced!");
					break;
				}
			}
		}

		private const string PLUGIN_GUID = "dopadream.lethalcompany.ClaySurgeonMod";

		private const string PLUGIN_NAME = "Clay Surgeon";

		private const string PLUGIN_VERSION = "1.3.5";

		private const string LETHAL_CONFIG = "ainavt.lc.lethalconfig";

		internal static ManualLogSource Logger;

		internal static GameObject clayPrefab;

		internal static TerminalNode clayNode;

		internal static EnemyType dummyType;

		internal static Dictionary<string, EnemyType> allEnemiesList = new Dictionary<string, EnemyType>();

		internal static ConfigEntry<bool> configSpawnOverride;

		internal static ConfigEntry<bool> configInfestations;

		internal static ConfigEntry<bool> configCurve;

		internal static ConfigEntry<bool> configKlayWorld;

		internal static ConfigEntry<int> configMaxCount;

		internal static ConfigEntry<int> configPowerLevel;

		internal static ConfigEntry<int> configSpawnInGroupsOf;

		internal static ConfigEntry<float> configAmbience;

		internal static ConfigEntry<float> configIridescence;

		internal static ConfigEntry<float> configMinVisibility;

		internal static ConfigEntry<float> configMaxVisibility;

		internal static ConfigEntry<float> configScreenEffects;

		internal static ConfigEntry<float> configScreenDistortion;

		internal static ConfigEntry<float> configSkin0;

		internal static ConfigEntry<float> configSkin1;

		internal static ConfigEntry<float> configSkin2;

		internal static ConfigEntry<float> configSkin3;

		internal static ConfigEntry<float> configSkin4;

		internal static ConfigEntry<float> configSkin5;

		internal static ConfigEntry<float> configSkin6;

		internal static ConfigEntry<float> configSkin7;

		internal static ConfigEntry<float> configSkin8;

		internal static ConfigEntry<float> configSkin9;

		internal static ConfigEntry<float> configSkin10;

		internal static Random clayRandom;

		private static Dictionary<Texture, IntWithRarity[]> clayWeightList = new Dictionary<Texture, IntWithRarity[]>();

		internal static Texture claySkinPurple;

		internal static Texture claySkinRed;

		internal static Texture claySkinGreen;

		internal static Texture claySkinYellow;

		internal static Texture claySkinOrange;

		internal static Texture claySkinWhite;

		internal static Texture claySkinBlack;

		internal static Texture claySkinPink;

		internal static Texture claySkinTeal;

		internal static Texture claySkinCyan;

		internal static Texture claySkinMagenta;

		internal static AnimationCurve intervalCurve;

		protected const string anchorPath = "MeshContainer";

		protected const string animPath = "MeshContainer/AnimContainer";

		internal void initLethalConfig()
		{
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			//IL_0010: Expected O, but got Unknown
			//IL_0016: Unknown result type (might be due to invalid IL or missing references)
			//IL_0020: Expected O, but got Unknown
			//IL_0026: Unknown result type (might be due to invalid IL or missing references)
			//IL_0030: Expected O, but got Unknown
			//IL_0036: Unknown result type (might be due to invalid IL or missing references)
			//IL_0040: Expected O, but got Unknown
			//IL_0046: Unknown result type (might be due to invalid IL or missing references)
			//IL_0050: Expected O, but got Unknown
			//IL_0056: Unknown result type (might be due to invalid IL or missing references)
			//IL_0060: Expected O, but got Unknown
			//IL_0066: Unknown result type (might be due to invalid IL or missing references)
			//IL_0070: Expected O, but got Unknown
			//IL_0076: Unknown result type (might be due to invalid IL or missing references)
			//IL_0080: Expected O, but got Unknown
			//IL_0086: Unknown result type (might be due to invalid IL or missing references)
			//IL_0090: Expected O, but got Unknown
			//IL_0096: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a0: Expected O, but got Unknown
			//IL_00a6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b0: Expected O, but got Unknown
			//IL_00b6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c0: Expected O, but got Unknown
			//IL_00c6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d0: Expected O, but got Unknown
			//IL_00d6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e0: Expected O, but got Unknown
			//IL_00e6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f0: Expected O, but got Unknown
			//IL_00f6: Unknown result type (might be due to invalid IL or missing references)
			//IL_0100: Expected O, but got Unknown
			//IL_0106: Unknown result type (might be due to invalid IL or missing references)
			//IL_0110: Expected O, but got Unknown
			//IL_0116: Unknown result type (might be due to invalid IL or missing references)
			//IL_0120: Expected O, but got Unknown
			//IL_0126: Unknown result type (might be due to invalid IL or missing references)
			//IL_0130: Expected O, but got Unknown
			//IL_0136: Unknown result type (might be due to invalid IL or missing references)
			//IL_0140: Expected O, but got Unknown
			//IL_0146: Unknown result type (might be due to invalid IL or missing references)
			//IL_0150: Expected O, but got Unknown
			//IL_0156: Unknown result type (might be due to invalid IL or missing references)
			//IL_0160: Expected O, but got Unknown
			LethalConfigManager.AddConfigItem((BaseConfigItem)new BoolCheckBoxConfigItem(configSpawnOverride, false));
			LethalConfigManager.AddConfigItem((BaseConfigItem)new IntInputFieldConfigItem(configMaxCount, false));
			LethalConfigManager.AddConfigItem((BaseConfigItem)new IntInputFieldConfigItem(configSpawnInGroupsOf, false));
			LethalConfigManager.AddConfigItem((BaseConfigItem)new IntInputFieldConfigItem(configPowerLevel, false));
			LethalConfigManager.AddConfigItem((BaseConfigItem)new FloatSliderConfigItem(configMinVisibility, false));
			LethalConfigManager.AddConfigItem((BaseConfigItem)new FloatSliderConfigItem(configMaxVisibility, false));
			LethalConfigManager.AddConfigItem((BaseConfigItem)new FloatSliderConfigItem(configScreenEffects, false));
			LethalConfigManager.AddConfigItem((BaseConfigItem)new FloatSliderConfigItem(configScreenDistortion, false));
			LethalConfigManager.AddConfigItem((BaseConfigItem)new BoolCheckBoxConfigItem(configInfestations, false));
			LethalConfigManager.AddConfigItem((BaseConfigItem)new BoolCheckBoxConfigItem(configCurve, false));
			LethalConfigManager.AddConfigItem((BaseConfigItem)new FloatSliderConfigItem(configAmbience, false));
			LethalConfigManager.AddConfigItem((BaseConfigItem)new FloatSliderConfigItem(configIridescence, false));
			LethalConfigManager.AddConfigItem((BaseConfigItem)new FloatSliderConfigItem(configSkin0, false));
			LethalConfigManager.AddConfigItem((BaseConfigItem)new FloatSliderConfigItem(configSkin1, false));
			LethalConfigManager.AddConfigItem((BaseConfigItem)new FloatSliderConfigItem(configSkin2, false));
			LethalConfigManager.AddConfigItem((BaseConfigItem)new FloatSliderConfigItem(configSkin3, false));
			LethalConfigManager.AddConfigItem((BaseConfigItem)new FloatSliderConfigItem(configSkin4, false));
			LethalConfigManager.AddConfigItem((BaseConfigItem)new FloatSliderConfigItem(configSkin5, false));
			LethalConfigManager.AddConfigItem((BaseConfigItem)new FloatSliderConfigItem(configSkin6, false));
			LethalConfigManager.AddConfigItem((BaseConfigItem)new FloatSliderConfigItem(configSkin7, false));
			LethalConfigManager.AddConfigItem((BaseConfigItem)new FloatSliderConfigItem(configSkin8, false));
			LethalConfigManager.AddConfigItem((BaseConfigItem)new BoolCheckBoxConfigItem(configKlayWorld, false));
			LethalConfigManager.SkipAutoGen();
		}

		private void Awake()
		{
			//IL_001d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0022: Unknown result type (might be due to invalid IL or missing references)
			//IL_0033: Unknown result type (might be due to invalid IL or missing references)
			//IL_0038: Unknown result type (might be due to invalid IL or missing references)
			//IL_0049: Unknown result type (might be due to invalid IL or missing references)
			//IL_004e: Unknown result type (might be due to invalid IL or missing references)
			//IL_005f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0064: Unknown result type (might be due to invalid IL or missing references)
			//IL_0075: Unknown result type (might be due to invalid IL or missing references)
			//IL_007a: Unknown result type (might be due to invalid IL or missing references)
			//IL_008b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0090: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00bc: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00cb: Expected O, but got Unknown
			//IL_00e7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f1: Expected O, but got Unknown
			//IL_0112: Unknown result type (might be due to invalid IL or missing references)
			//IL_011c: Expected O, but got Unknown
			//IL_013d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0147: Expected O, but got Unknown
			//IL_0168: Unknown result type (might be due to invalid IL or missing references)
			//IL_0172: Expected O, but got Unknown
			//IL_01a5: Unknown result type (might be due to invalid IL or missing references)
			//IL_01af: Expected O, but got Unknown
			//IL_01e2: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ec: Expected O, but got Unknown
			//IL_020d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0217: Expected O, but got Unknown
			//IL_0238: Unknown result type (might be due to invalid IL or missing references)
			//IL_0242: Expected O, but got Unknown
			//IL_0275: Unknown result type (might be due to invalid IL or missing references)
			//IL_027f: Expected O, but got Unknown
			//IL_02b2: Unknown result type (might be due to invalid IL or missing references)
			//IL_02bc: Expected O, but got Unknown
			//IL_02ef: Unknown result type (might be due to invalid IL or missing references)
			//IL_02f9: Expected O, but got Unknown
			//IL_032c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0336: Expected O, but got Unknown
			//IL_0369: Unknown result type (might be due to invalid IL or missing references)
			//IL_0373: Expected O, but got Unknown
			//IL_03a6: Unknown result type (might be due to invalid IL or missing references)
			//IL_03b0: Expected O, but got Unknown
			//IL_03e3: Unknown result type (might be due to invalid IL or missing references)
			//IL_03ed: Expected O, but got Unknown
			//IL_0420: Unknown result type (might be due to invalid IL or missing references)
			//IL_042a: Expected O, but got Unknown
			//IL_045d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0467: Expected O, but got Unknown
			//IL_049a: Unknown result type (might be due to invalid IL or missing references)
			//IL_04a4: Expected O, but got Unknown
			//IL_04d7: Unknown result type (might be due to invalid IL or missing references)
			//IL_04e1: Expected O, but got Unknown
			//IL_0514: Unknown result type (might be due to invalid IL or missing references)
			//IL_051e: Expected O, but got Unknown
			//IL_0551: Unknown result type (might be due to invalid IL or missing references)
			//IL_055b: Expected O, but got Unknown
			//IL_058e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0598: Expected O, but got Unknown
			//IL_05cb: Unknown result type (might be due to invalid IL or missing references)
			//IL_05d5: Expected O, but got Unknown
			//IL_05f6: Unknown result type (might be due to invalid IL or missing references)
			//IL_0600: Expected O, but got Unknown
			//IL_0805: Unknown result type (might be due to invalid IL or missing references)
			Logger = ((BaseUnityPlugin)this).Logger;
			intervalCurve = new AnimationCurve((Keyframe[])(object)new Keyframe[8]
			{
				new Keyframe(0f, 2.75f),
				new Keyframe(0.12f, 2.4f),
				new Keyframe(0.24f, 2.12f),
				new Keyframe(0.42f, 1.76f),
				new Keyframe(0.58f, 1.52f),
				new Keyframe(0.72f, 1.37f),
				new Keyframe(0.87f, 1.27f),
				new Keyframe(1f, 1.25f)
			});
			configSpawnOverride = ((BaseUnityPlugin)this).Config.Bind<bool>("General", "Override Spawn Settings", true, new ConfigDescription("Overrides spawning logic of Clay Surgeons (Barbers). With this enabled, they will spawn in pairs and be more common. Disable if you want to customize their spawning yourself through plugins such as LethalQuantities.", (AcceptableValueBase)null, Array.Empty<object>()));
			configMaxCount = ((BaseUnityPlugin)this).Config.Bind<int>("General", "Max Spawn Count", 6, new ConfigDescription("Defines the max spawn count of Clay Surgeons. Override Spawn Settings must be turned on.", (AcceptableValueBase)null, Array.Empty<object>()));
			configSpawnInGroupsOf = ((BaseUnityPlugin)this).Config.Bind<int>("General", "Spawn Group Count", 2, new ConfigDescription("Defines how many Clay Surgeons spawn in one vent. Override Spawn Settings must be turned on.", (AcceptableValueBase)null, Array.Empty<object>()));
			configPowerLevel = ((BaseUnityPlugin)this).Config.Bind<int>("General", "Power Level", 2, new ConfigDescription("Defines the power level of Clay Surgeons. Override Spawn Settings must be turned on.", (AcceptableValueBase)null, Array.Empty<object>()));
			configMinVisibility = ((BaseUnityPlugin)this).Config.Bind<float>("General", "Minimum Visibility Distance", 5f, new ConfigDescription("Controls the distance at which the Clay Surgeon is fully visible.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(5f, 15f), Array.Empty<object>()));
			configMaxVisibility = ((BaseUnityPlugin)this).Config.Bind<float>("General", "Maximum Visibility Distance", 15f, new ConfigDescription("Controls the distance at which the Clay Surgeon is fully invisible.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(7f, 15f), Array.Empty<object>()));
			configInfestations = ((BaseUnityPlugin)this).Config.Bind<bool>("General", "Clay Infestations", true, new ConfigDescription("Adds a chance for Hoarding bug/Nutcracker infestations to be Clay Surgeon Infestations instead.", (AcceptableValueBase)null, Array.Empty<object>()));
			configCurve = ((BaseUnityPlugin)this).Config.Bind<bool>("General", "Curved Acceleration", true, new ConfigDescription("Makes the Clay Surgeon accelerate at a curve rather than a flat rate per hour.", (AcceptableValueBase)null, Array.Empty<object>()));
			configAmbience = ((BaseUnityPlugin)this).Config.Bind<float>("Aesthetics", "Proximity Ambience Volume", 0.35f, new ConfigDescription("Controls the volume of the Clay Surgeon's proximity ambience.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0f, 1f), Array.Empty<object>()));
			configScreenEffects = ((BaseUnityPlugin)this).Config.Bind<float>("Aesthetics", "Screen Effect Intensity", 0.5f, new ConfigDescription("Controls the intensity of the \"sleepiness\" filter when in proximity with a Clay Surgeon.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0f, 1f), Array.Empty<object>()));
			configScreenDistortion = ((BaseUnityPlugin)this).Config.Bind<float>("Aesthetics", "Screen Distortion Intensity", -1f, new ConfigDescription("Controls the intensity of the \"sleepiness\" filter's lens distortion when in proximity with a Clay Surgeon.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(-1f, 1f), Array.Empty<object>()));
			configIridescence = ((BaseUnityPlugin)this).Config.Bind<float>("Aesthetics", "Iridescence", 0.25f, new ConfigDescription("Controls the iridescence of the Clay Surgeon's clay material.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0f, 1f), Array.Empty<object>()));
			configSkin0 = ((BaseUnityPlugin)this).Config.Bind<float>("Skins", "Default", 300f, new ConfigDescription("Controls the rarity of this skin.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0f, 300f), Array.Empty<object>()));
			configSkin1 = ((BaseUnityPlugin)this).Config.Bind<float>("Skins", "Red Delicious", 300f, new ConfigDescription("Controls the rarity of this skin.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0f, 300f), Array.Empty<object>()));
			configSkin2 = ((BaseUnityPlugin)this).Config.Bind<float>("Skins", "Eraser Pink", 0f, new ConfigDescription("Controls the rarity of this skin.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0f, 300f), Array.Empty<object>()));
			configSkin3 = ((BaseUnityPlugin)this).Config.Bind<float>("Skins", "Snipsy Blue", 0f, new ConfigDescription("Controls the rarity of this skin.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0f, 300f), Array.Empty<object>()));
			configSkin4 = ((BaseUnityPlugin)this).Config.Bind<float>("Skins", "Slimy Green", 300f, new ConfigDescription("Controls the rarity of this skin.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0f, 300f), Array.Empty<object>()));
			configSkin5 = ((BaseUnityPlugin)this).Config.Bind<float>("Skins", "Taffy Yellow", 0f, new ConfigDescription("Controls the rarity of this skin.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0f, 300f), Array.Empty<object>()));
			configSkin6 = ((BaseUnityPlugin)this).Config.Bind<float>("Skins", "Tan Orange", 0f, new ConfigDescription("Controls the rarity of this skin.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0f, 300f), Array.Empty<object>()));
			configSkin7 = ((BaseUnityPlugin)this).Config.Bind<float>("Skins", "Cheery Cyan", 0f, new ConfigDescription("Controls the rarity of this skin.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0f, 300f), Array.Empty<object>()));
			configSkin8 = ((BaseUnityPlugin)this).Config.Bind<float>("Skins", "Merry Magenta", 0f, new ConfigDescription("Controls the rarity of this skin.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0f, 300f), Array.Empty<object>()));
			configSkin9 = ((BaseUnityPlugin)this).Config.Bind<float>("Skins", "Isolated White", 0f, new ConfigDescription("Controls the rarity of this skin.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0f, 300f), Array.Empty<object>()));
			configSkin10 = ((BaseUnityPlugin)this).Config.Bind<float>("Skins", "Ink Black", 0f, new ConfigDescription("Controls the rarity of this skin.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0f, 300f), Array.Empty<object>()));
			configKlayWorld = ((BaseUnityPlugin)this).Config.Bind<bool>("Fun", "Klay World", false, new ConfigDescription("Guarantees clay infestations when possible. Clay infestations must be turned on!", (AcceptableValueBase)null, Array.Empty<object>()));
			if (Chainloader.PluginInfos.ContainsKey("ainavt.lc.lethalconfig"))
			{
				initLethalConfig();
			}
			try
			{
				AssetBundle obj = AssetBundle.LoadFromFile(Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), "claysurgeonmod"));
				Object obj2 = obj.LoadAsset("ClaySurgeonNew", typeof(GameObject));
				clayPrefab = (GameObject)(object)((obj2 is GameObject) ? obj2 : null);
				Object obj3 = obj.LoadAsset("ClaySurgeonFile", typeof(TerminalNode));
				clayNode = (TerminalNode)(object)((obj3 is TerminalNode) ? obj3 : null);
				Object obj4 = obj.LoadAsset("DummyEnemyType", typeof(EnemyType));
				dummyType = (EnemyType)(object)((obj4 is EnemyType) ? obj4 : null);
				Object obj5 = obj.LoadAsset("cs_default", typeof(Texture));
				claySkinPurple = (Texture)(object)((obj5 is Texture) ? obj5 : null);
				Object obj6 = obj.LoadAsset("cs_red_delicious", typeof(Texture));
				claySkinRed = (Texture)(object)((obj6 is Texture) ? obj6 : null);
				Object obj7 = obj.LoadAsset("cs_eraser_pink", typeof(Texture));
				claySkinPink = (Texture)(object)((obj7 is Texture) ? obj7 : null);
				Object obj8 = obj.LoadAsset("cs_snipsy_blue", typeof(Texture));
				claySkinTeal = (Texture)(object)((obj8 is Texture) ? obj8 : null);
				Object obj9 = obj.LoadAsset("cs_slimy_green", typeof(Texture));
				claySkinGreen = (Texture)(object)((obj9 is Texture) ? obj9 : null);
				Object obj10 = obj.LoadAsset("cs_taffy_yellow", typeof(Texture));
				claySkinYellow = (Texture)(object)((obj10 is Texture) ? obj10 : null);
				Object obj11 = obj.LoadAsset("cs_tan_orange", typeof(Texture));
				claySkinOrange = (Texture)(object)((obj11 is Texture) ? obj11 : null);
				Object obj12 = obj.LoadAsset("cs_cheery_cyan", typeof(Texture));
				claySkinCyan = (Texture)(object)((obj12 is Texture) ? obj12 : null);
				Object obj13 = obj.LoadAsset("cs_merry_magenta", typeof(Texture));
				claySkinMagenta = (Texture)(object)((obj13 is Texture) ? obj13 : null);
				Object obj14 = obj.LoadAsset("cs_isolated_white", typeof(Texture));
				claySkinWhite = (Texture)(object)((obj14 is Texture) ? obj14 : null);
				Object obj15 = obj.LoadAsset("cs_shadow_black", typeof(Texture));
				claySkinBlack = (Texture)(object)((obj15 is Texture) ? obj15 : null);
			}
			catch
			{
				Logger.LogError((object)"Encountered some error loading asset bundle. Did you install the plugin correctly?");
				return;
			}
			new Harmony("dopadream.lethalcompany.ClaySurgeonMod").PatchAll();
			Logger.LogInfo((object)"Clay Surgeon v1.3.5 loaded");
		}
	}
	public static class PluginInfo
	{
		public const string PLUGIN_GUID = "ClaySurgeonMod";

		public const string PLUGIN_NAME = "ClaySurgeonMod";

		public const string PLUGIN_VERSION = "1.3.4";
	}
}
namespace System.Runtime.CompilerServices
{
	[AttributeUsage(AttributeTargets.Assembly, AllowMultiple = true)]
	internal sealed class IgnoresAccessChecksToAttribute : Attribute
	{
		public IgnoresAccessChecksToAttribute(string assemblyName)
		{
		}
	}
}