Decompiled source of RandomEnemiesSize v1.1.7

RandomEnemiesSize.dll

Decompiled 3 days ago
using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.Globalization;
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 HarmonyLib;
using LethalConfig;
using LethalConfig.ConfigItems;
using LethalConfig.ConfigItems.Options;
using LethalLevelLoader;
using Microsoft.CodeAnalysis;
using RandomEnemiesSize.Patches;
using RandomEnemiesSize.SpecialEnemies;
using StaticNetcodeLib;
using Unity.Netcode;
using UnityEngine;
using UnityEngine.VFX;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = "")]
[assembly: AssemblyCompany("RandomEnemiesSize")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyDescription("RandomEnemiesSize")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0+09f744e259f9a910156225aca34f807dd91efd08")]
[assembly: AssemblyProduct("RandomEnemiesSize")]
[assembly: AssemblyTitle("RandomEnemiesSize")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.0.0")]
[module: UnverifiableCode]
[module: RefSafetyRules(11)]
namespace Microsoft.CodeAnalysis
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	internal sealed class EmbeddedAttribute : Attribute
	{
	}
}
namespace System.Runtime.CompilerServices
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	[AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)]
	internal sealed class RefSafetyRulesAttribute : Attribute
	{
		public readonly int Version;

		public RefSafetyRulesAttribute(int P_0)
		{
			Version = P_0;
		}
	}
}
namespace RandomEnemiesSize
{
	public class Influences
	{
		public bool hpInfluence;

		public bool soundInfluence;

		public float soundInfluenceMax;

		public float soundInfluenceMin;

		public void GetInfos()
		{
			hpInfluence = RandomEnemiesSize.instance.influenceHpConfig.Value;
			soundInfluence = RandomEnemiesSize.instance.influenceSoundConfig.Value;
			soundInfluenceMin = RandomEnemiesSize.instance.influenceSoundMinEntry.Value;
			soundInfluenceMax = RandomEnemiesSize.instance.influenceSoundMaxEntry.Value;
		}

		public int InfluenceHp(int baseHp, float multiplier)
		{
			if (!hpInfluence)
			{
				return baseHp;
			}
			int num = (int)Math.Round((float)baseHp * multiplier, 0);
			if (num < 0)
			{
				num = 1;
			}
			return num;
		}

		public void InfluenceSound(EnemyAI enemyAI, float multiplier)
		{
			if (!soundInfluence)
			{
				return;
			}
			List<AudioSource> list = new List<AudioSource>();
			AudioSource val = null;
			((Component)enemyAI).TryGetComponent<AudioSource>(ref val);
			if ((Object)(object)val != (Object)null)
			{
				list.Add(val);
			}
			list.AddRange(((Component)enemyAI).GetComponentsInChildren<AudioSource>());
			float num = 1f - (multiplier - 1f);
			float pitch = Mathf.Clamp(num, soundInfluenceMin, soundInfluenceMax);
			if ((Object)(object)enemyAI.creatureVoice != (Object)null)
			{
				enemyAI.creatureVoice.pitch = pitch;
			}
			if ((Object)(object)enemyAI.creatureSFX != (Object)null)
			{
				enemyAI.creatureSFX.pitch = pitch;
			}
			foreach (AudioSource item in list)
			{
				item.pitch = pitch;
			}
		}

		public void InfluenceTurretSound(Turret turret, float multiplier)
		{
			if (!soundInfluence || (Object)(object)turret == (Object)null)
			{
				return;
			}
			List<AudioSource> list = new List<AudioSource>();
			AudioSource val = null;
			((Component)turret).TryGetComponent<AudioSource>(ref val);
			if ((Object)(object)val != (Object)null)
			{
				list.Add(val);
			}
			list.AddRange(((Component)turret).GetComponentsInChildren<AudioSource>());
			float num = 1f - (multiplier - 1f);
			float pitch = Mathf.Clamp(num, soundInfluenceMin, soundInfluenceMax);
			if ((Object)(object)turret.berserkAudio != (Object)null)
			{
				turret.berserkAudio.pitch = pitch;
			}
			if ((Object)(object)turret.farAudio != (Object)null)
			{
				turret.farAudio.pitch = pitch;
			}
			if ((Object)(object)turret.mainAudio != (Object)null)
			{
				turret.mainAudio.pitch = pitch;
			}
			if ((Object)(object)turret.bulletCollisionAudio != (Object)null)
			{
				turret.bulletCollisionAudio.pitch = pitch;
			}
			foreach (AudioSource item in list)
			{
				item.pitch = pitch;
			}
		}

		public void InfluenceMineSound(Landmine landmine, float multiplier)
		{
			if (!soundInfluence || (Object)(object)landmine == (Object)null)
			{
				return;
			}
			List<AudioSource> list = new List<AudioSource>();
			AudioSource val = null;
			((Component)landmine).TryGetComponent<AudioSource>(ref val);
			if ((Object)(object)val != (Object)null)
			{
				list.Add(val);
			}
			list.AddRange(((Component)landmine).GetComponentsInChildren<AudioSource>());
			float num = 1f - (multiplier - 1f);
			float pitch = Mathf.Clamp(num, soundInfluenceMin, soundInfluenceMax);
			if ((Object)(object)landmine.mineAudio != (Object)null)
			{
				landmine.mineAudio.pitch = pitch;
			}
			if ((Object)(object)landmine.mineFarAudio != (Object)null)
			{
				landmine.mineFarAudio.pitch = pitch;
			}
			foreach (AudioSource item in list)
			{
				item.pitch = pitch;
			}
		}

		public void InfluenceSpikeTrapSound(SpikeRoofTrap spikeTrap, float multiplier)
		{
			if (!soundInfluence || (Object)(object)spikeTrap == (Object)null)
			{
				return;
			}
			List<AudioSource> list = new List<AudioSource>();
			AudioSource val = null;
			((Component)spikeTrap).TryGetComponent<AudioSource>(ref val);
			if ((Object)(object)val != (Object)null)
			{
				list.Add(val);
			}
			list.AddRange(((Component)spikeTrap).GetComponentsInChildren<AudioSource>());
			float num = 1f - (multiplier - 1f);
			float pitch = Mathf.Clamp(num, soundInfluenceMin, soundInfluenceMax);
			if ((Object)(object)spikeTrap.spikeTrapAudio != (Object)null)
			{
				spikeTrap.spikeTrapAudio.pitch = pitch;
			}
			foreach (AudioSource item in list)
			{
				item.pitch = pitch;
			}
		}
	}
	[StaticNetcode]
	public class NetworkSize
	{
		[ClientRpc]
		public static void UpdateEnemyClientRpc(ulong networkId, Vector3 newScale, float scaleMultiplier, Influences influences)
		{
			//IL_0073: Unknown result type (might be due to invalid IL or missing references)
			List<EnemyAI> list = Object.FindObjectsByType<EnemyAI>((FindObjectsSortMode)0).ToList();
			EnemyAI val = list.Find((EnemyAI e) => ((NetworkBehaviour)e).NetworkObjectId == networkId);
			if ((Object)(object)val == (Object)null)
			{
				if (RandomEnemiesSize.instance.devLogEntry.Value)
				{
					Debug.Log((object)$"ENEMIE NOT FOUND {networkId}");
				}
				return;
			}
			((Component)val).transform.localScale = newScale;
			val.enemyHP = influences.InfluenceHp(val.enemyHP, scaleMultiplier);
			influences.InfluenceSound(val, scaleMultiplier);
			if (val.enemyType.enemyName == "Red Locust Bees")
			{
				new RedBeesManagement().ChangeSize(val, scaleMultiplier);
			}
		}

		[ClientRpc]
		public static void UpdateTurretClientRpc(ulong networkId, Vector3 newScale, float scaleMultiplier, Influences influences)
		{
			//IL_00ac: Unknown result type (might be due to invalid IL or missing references)
			//IL_0095: Unknown result type (might be due to invalid IL or missing references)
			List<Turret> list = Object.FindObjectsByType<Turret>((FindObjectsSortMode)0).ToList();
			Turret val = list.Find((Turret e) => ((NetworkBehaviour)e).NetworkObjectId == networkId);
			GameObject gameObject = ((Component)((Component)val).GetComponentInParent<NetworkObject>()).gameObject;
			if ((Object)(object)gameObject == (Object)null)
			{
				if (RandomEnemiesSize.instance.devLogEntry.Value)
				{
					Debug.Log((object)$"TURRET NOT FOUND {networkId}");
				}
				return;
			}
			if (RandomEnemiesSize.instance.devLogEntry.Value)
			{
				Debug.Log((object)$"TURRET WITH NEW SCALE : {newScale}");
			}
			gameObject.transform.localScale = newScale;
			influences.InfluenceTurretSound(gameObject.GetComponentInChildren<Turret>(), scaleMultiplier);
		}

		[ClientRpc]
		public static void UpdateLandMineClientRpc(ulong networkId, Vector3 newScale, float scaleMultiplier, Influences influences)
		{
			//IL_00ac: Unknown result type (might be due to invalid IL or missing references)
			//IL_0095: Unknown result type (might be due to invalid IL or missing references)
			List<Landmine> list = Object.FindObjectsByType<Landmine>((FindObjectsSortMode)0).ToList();
			Landmine val = list.Find((Landmine e) => ((NetworkBehaviour)e).NetworkObjectId == networkId);
			GameObject gameObject = ((Component)((Component)val).GetComponentInParent<NetworkObject>()).gameObject;
			if ((Object)(object)gameObject == (Object)null)
			{
				if (RandomEnemiesSize.instance.devLogEntry.Value)
				{
					Debug.Log((object)$"LANDMINE NOT FOUND {networkId}");
				}
				return;
			}
			if (RandomEnemiesSize.instance.devLogEntry.Value)
			{
				Debug.Log((object)$"LANDMINE WITH NEW SCALE : {newScale}");
			}
			gameObject.transform.localScale = newScale;
			influences.InfluenceMineSound(gameObject.GetComponentInChildren<Landmine>(), scaleMultiplier);
		}

		[ClientRpc]
		public static void UpdateSpikeTrapClientRpc(ulong networkId, Vector3 newScale, float scaleMultiplier, Influences influences)
		{
			//IL_00ac: Unknown result type (might be due to invalid IL or missing references)
			//IL_0095: Unknown result type (might be due to invalid IL or missing references)
			List<SpikeRoofTrap> list = Object.FindObjectsByType<SpikeRoofTrap>((FindObjectsSortMode)0).ToList();
			SpikeRoofTrap val = list.Find((SpikeRoofTrap e) => ((NetworkBehaviour)e).NetworkObjectId == networkId);
			GameObject gameObject = ((Component)((Component)val).GetComponentInParent<NetworkObject>()).gameObject;
			if ((Object)(object)gameObject == (Object)null)
			{
				if (RandomEnemiesSize.instance.devLogEntry.Value)
				{
					Debug.Log((object)$"SPIKE TRAP NOT FOUND {networkId}");
				}
				return;
			}
			if (RandomEnemiesSize.instance.devLogEntry.Value)
			{
				Debug.Log((object)$"SPIKE TRAP WITH NEW SCALE : {newScale}");
			}
			gameObject.transform.localScale = newScale;
			influences.InfluenceSpikeTrapSound(gameObject.GetComponentInChildren<SpikeRoofTrap>(), scaleMultiplier);
		}
	}
	public class VanillaEnemies
	{
		public List<string> VanillaNames = new List<string>
		{
			"ForestGiant", "Baboon hawk", "Blob", "Butler", "Butler Bees", "Centipede", "Crawler", "Docile Locust Bees", "Manticoil", "Girl",
			"Flowerman", "Tulip Snake", "Hoarding bug", "Jester", "Masked", "MouthDog", "Nutcracker", "Puffer", "RadMech", "Red Locust Bees",
			"Bunker Spider", "Earth Leviathan", "Spring"
		};

		public bool IsAVanillaEnemy(string name)
		{
			bool result = false;
			foreach (string vanillaName in VanillaNames)
			{
				if (RandomEnemiesSize.instance.CompareEnemyName(name, vanillaName))
				{
					result = true;
				}
			}
			return result;
		}
	}
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInPlugin("wexop.random_enemies_size", "RandomEnemiesSize", "1.1.7")]
	public class RandomEnemiesSize : BaseUnityPlugin
	{
		private const string GUID = "wexop.random_enemies_size";

		private const string NAME = "RandomEnemiesSize";

		private const string VERSION = "1.1.7";

		public static string LethalLevelLoaderReferenceChain = "imabatby.lethallevelloader";

		public static RandomEnemiesSize instance;

		public bool LethalLevelLoaderIsHere;

		public ConfigEntry<bool> customAffectMineEntry;

		public ConfigEntry<bool> CustomAffectModEntry;

		public ConfigEntry<bool> customAffectTurretEntry;

		public ConfigEntry<bool> customAffectSpikeTrapEntry;

		public ConfigEntry<bool> CustomAffectVanillaEntry;

		public ConfigEntry<string> customEnemyEntry;

		public ConfigEntry<string> customInteriorEntry;

		public ConfigEntry<bool> devLogEntry;

		public ConfigEntry<bool> funModeEntry;

		public ConfigEntry<float> funModeHorizontalMaxEntry;

		public ConfigEntry<float> funModeHorizontalMinEntry;

		public ConfigEntry<bool> funModeLockHorizontalEnrty;

		public ConfigEntry<bool> influenceHpConfig;

		public ConfigEntry<bool> influenceSoundConfig;

		public ConfigEntry<float> influenceSoundMaxEntry;

		public ConfigEntry<float> influenceSoundMinEntry;

		public ConfigEntry<float> maxSizeIndoorEntry;

		public ConfigEntry<float> maxSizeMineEntry;

		public ConfigEntry<float> maxSizeOutdoorEntry;

		public ConfigEntry<float> maxSizeTurretEntry;

		public ConfigEntry<float> minSizeIndoorEntry;

		public ConfigEntry<float> minSizeMineEntry;

		public ConfigEntry<float> minSizeOutdoorEntry;

		public ConfigEntry<float> minSizeTurretEntry;

		public ConfigEntry<float> minSizeSpikeTrapEntry;

		public ConfigEntry<float> maxSizeSpikeTrapEntry;

		public ConfigEntry<float> randomPercentChanceEntry;

		private void Awake()
		{
			instance = this;
			((BaseUnityPlugin)this).Logger.LogInfo((object)"RandomEnemiesSize starting....");
			if (Chainloader.PluginInfos.ContainsKey(LethalLevelLoaderReferenceChain))
			{
				Debug.Log((object)"LethalLevelLoader found !");
				LethalLevelLoaderIsHere = true;
			}
			randomPercentChanceEntry = ((BaseUnityPlugin)this).Config.Bind<float>("General", "ChanceOfRandomSize", 100f, "The chance for each monster to have a random size. 100% is always, 0% is never. No need to restart the game :)");
			CreateFloatConfig(randomPercentChanceEntry, 0f, 100f);
			minSizeIndoorEntry = ((BaseUnityPlugin)this).Config.Bind<float>("General", "MinMonstersSizeIndoor", 0.4f, "Change the minimum size of monsters in the factory. No need to restart the game :)");
			CreateFloatConfig(minSizeIndoorEntry);
			maxSizeIndoorEntry = ((BaseUnityPlugin)this).Config.Bind<float>("General", "MaxMonstersSizeIndoor", 1.5f, "Change the maximum size of monsters in the factory. No need to restart the game :)");
			CreateFloatConfig(maxSizeIndoorEntry);
			minSizeOutdoorEntry = ((BaseUnityPlugin)this).Config.Bind<float>("General", "MinMonstersSizeOutdoor", 0.5f, "Change the minimum size of monsters outside the factory. No need to restart the game :)");
			CreateFloatConfig(minSizeOutdoorEntry);
			maxSizeOutdoorEntry = ((BaseUnityPlugin)this).Config.Bind<float>("General", "MaxMonstersSizeOutdoor", 3f, "Change the maximum size of monsters outside the factory. No need to restart the game :)");
			CreateFloatConfig(maxSizeOutdoorEntry);
			CustomAffectVanillaEntry = ((BaseUnityPlugin)this).Config.Bind<bool>("Custom", "AffectVanillaEnemies", true, "Activate to make this mod affect vanilla enemies. No need to restart the game :)");
			CreateBoolConfig(CustomAffectVanillaEntry);
			CustomAffectModEntry = ((BaseUnityPlugin)this).Config.Bind<bool>("Custom", "AffectModdedEnemies", true, "Activate to make this mod affect modded enemies. No need to restart the game :)");
			CreateBoolConfig(CustomAffectModEntry);
			customEnemyEntry = ((BaseUnityPlugin)this).Config.Bind<string>("Custom", "CustomEnemiesSize", "", "Custom the size for an enemy wanted with his EXACT name. RECOMMENDED: Go to the thunderstore mod page, you can find a generator to make easier this config. Manual example -> ForestGiant:0.4:5;FlowerMan:0.2:6. Dont forgot the separator ';' between each monsters. No need to restart the game :)");
			CreateStringConfig(customEnemyEntry);
			customInteriorEntry = ((BaseUnityPlugin)this).Config.Bind<string>("Custom", "CustomInteriorsSize", "", "THE MOD LethalLevelLoader IS REQUIRED FOR THIS FEATURE. Multiply the base size for an indoor enemy in an interior wanted with his EXACT name. RECOMMENDED: Go to the thunderstore mod page, you can find a generator to make easier this config. Manual example -> mansion#any:1.5,NutCracker:2;customInterior#any:3; No need to restart the game :)");
			CreateInteriorStringConfig(customInteriorEntry);
			customAffectTurretEntry = ((BaseUnityPlugin)this).Config.Bind<bool>("Turret", "AffectTurretSize", true, "Activate to make this mod affect turrets size. No need to restart the game :)");
			CreateBoolConfig(customAffectTurretEntry);
			minSizeTurretEntry = ((BaseUnityPlugin)this).Config.Bind<float>("Turret", "MinTurretSize", 0.25f, "Change the minimum size of turrets. No need to restart the game :)");
			CreateFloatConfig(minSizeTurretEntry, 0f, 3f);
			maxSizeTurretEntry = ((BaseUnityPlugin)this).Config.Bind<float>("Turret", "MaxTurretSize", 1.5f, "Change the maximum size of turrets. No need to restart the game :)");
			CreateFloatConfig(maxSizeTurretEntry, 0f, 3f);
			customAffectMineEntry = ((BaseUnityPlugin)this).Config.Bind<bool>("Landmine", "AffectLandMineSize", true, "Activate to make this mod affect land mines size. No need to restart the game :)");
			CreateBoolConfig(customAffectMineEntry);
			minSizeMineEntry = ((BaseUnityPlugin)this).Config.Bind<float>("Landmine", "MinLandMinesSize", 0.2f, "Change the minimum size of land mines. No need to restart the game :)");
			CreateFloatConfig(minSizeMineEntry, 0f, 5f);
			maxSizeMineEntry = ((BaseUnityPlugin)this).Config.Bind<float>("Landmine", "MaxLandMinesSize", 3f, "Change the maximum size of land mines. No need to restart the game :)");
			CreateFloatConfig(maxSizeMineEntry, 0f, 5f);
			customAffectSpikeTrapEntry = ((BaseUnityPlugin)this).Config.Bind<bool>("SpikeTrap", "AffectSpikeTrapSize", true, "Activate to make this mod affect spike traps size. No need to restart the game :)");
			CreateBoolConfig(customAffectSpikeTrapEntry);
			minSizeSpikeTrapEntry = ((BaseUnityPlugin)this).Config.Bind<float>("SpikeTrap", "MinSpikeTrapSize", 0.3f, "Change the minimum size of spike traps. No need to restart the game :)");
			CreateFloatConfig(minSizeSpikeTrapEntry, 0f, 5f);
			maxSizeSpikeTrapEntry = ((BaseUnityPlugin)this).Config.Bind<float>("SpikeTrap", "MaxSpikeTrapSize", 2f, "Change the maximum size of spike traps. No need to restart the game :)");
			CreateFloatConfig(maxSizeSpikeTrapEntry, 0f, 5f);
			influenceHpConfig = ((BaseUnityPlugin)this).Config.Bind<bool>("Influences", "InfluenceHp", true, "Activate to make size influence monsters HP. No need to restart the game :)");
			CreateBoolConfig(influenceHpConfig);
			influenceSoundConfig = ((BaseUnityPlugin)this).Config.Bind<bool>("Influences", "InfluenceSound", true, "Activate to make size influence monsters sounds pitch. No need to restart the game :)");
			CreateBoolConfig(influenceSoundConfig);
			influenceSoundMinEntry = ((BaseUnityPlugin)this).Config.Bind<float>("Influences", "InfluenceSoundMinPitch", 0.6f, "If InfluenceSound is activated, this define the minimum pitch of monsters audio sources. No need to restart the game :)");
			CreateFloatConfig(influenceSoundMinEntry, 0f, 3f);
			influenceSoundMaxEntry = ((BaseUnityPlugin)this).Config.Bind<float>("Influences", "InfluenceSoundMaxPitch", 2.5f, "If InfluenceSound is activated, this define the maximum pitch of monsters audio sources. No need to restart the game :)");
			CreateFloatConfig(influenceSoundMaxEntry, 0f, 3f);
			funModeEntry = ((BaseUnityPlugin)this).Config.Bind<bool>("FunMode", "FunMode", false, "Activate the fun mode to randomize the size in every space directions (verticaly, horizontaly). No need to restart the game :)");
			CreateBoolConfig(funModeEntry);
			funModeHorizontalMinEntry = ((BaseUnityPlugin)this).Config.Bind<float>("FunMode", "FunModeHorizontalSizeMin", 0.5f, "If fun mode is activated, it will change the minimum horizontal size of monsters (axis x and z). No need to restart the game :)");
			CreateFloatConfig(funModeHorizontalMinEntry);
			funModeHorizontalMaxEntry = ((BaseUnityPlugin)this).Config.Bind<float>("FunMode", "FunModeHorizontalSizeMax", 1.5f, "If fun mode is activated, it will change the maximum horizontal size of monsters (axis x and z). No need to restart the game :)");
			CreateFloatConfig(funModeHorizontalMaxEntry);
			funModeLockHorizontalEnrty = ((BaseUnityPlugin)this).Config.Bind<bool>("FunMode", "LockHorizontalAxis", false, "If fun mode is activated, it will change the horizontal axis (x and z) with the same value. No need to restart the game :)");
			CreateBoolConfig(funModeLockHorizontalEnrty);
			devLogEntry = ((BaseUnityPlugin)this).Config.Bind<bool>("DEV", "DevLogs", false, "Show the dev logs");
			CreateBoolConfig(devLogEntry);
			Harmony.CreateAndPatchAll(typeof(PatchEnemySize), (string)null);
			Harmony.CreateAndPatchAll(typeof(PatchTurretSize), (string)null);
			Harmony.CreateAndPatchAll(typeof(PatchLandmineSize), (string)null);
			Harmony.CreateAndPatchAll(typeof(PatchSpikeTrapSize), (string)null);
			((BaseUnityPlugin)this).Logger.LogInfo((object)"RandomEnemiesSize Patched !!");
		}

		public static string GetDungeonName()
		{
			string text = "Facility";
			if (!Chainloader.PluginInfos.ContainsKey(LethalLevelLoaderReferenceChain))
			{
				return text;
			}
			try
			{
				ExtendedDungeonFlow currentExtendedDungeonFlow = DungeonManager.CurrentExtendedDungeonFlow;
				if (((currentExtendedDungeonFlow != null) ? currentExtendedDungeonFlow.DungeonName : null) != null)
				{
					ExtendedDungeonFlow currentExtendedDungeonFlow2 = DungeonManager.CurrentExtendedDungeonFlow;
					text = ((currentExtendedDungeonFlow2 != null) ? currentExtendedDungeonFlow2.DungeonName : null);
				}
			}
			catch
			{
				return text;
			}
			if (instance.devLogEntry.Value)
			{
				Debug.Log((object)("INTERIOR FOUND: " + text));
			}
			return text;
		}

		private CanModifyResult CanModifyInterior()
		{
			//IL_0022: Unknown result type (might be due to invalid IL or missing references)
			//IL_0027: Unknown result type (might be due to invalid IL or missing references)
			//IL_0019: Unknown result type (might be due to invalid IL or missing references)
			//IL_001e: Unknown result type (might be due to invalid IL or missing references)
			//IL_002a: Unknown result type (might be due to invalid IL or missing references)
			if (!LethalLevelLoaderIsHere)
			{
				return CanModifyResult.op_Implicit((false, "You need the mod LethalLevelLoader to use this feature !"));
			}
			return CanModifyResult.op_Implicit(true);
		}

		private void CreateFloatConfig(ConfigEntry<float> configEntry, float min = 0f, float max = 30f)
		{
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			//IL_0007: Unknown result type (might be due to invalid IL or missing references)
			//IL_000e: Expected O, but got Unknown
			//IL_000f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0016: Expected O, but got Unknown
			//IL_0017: Unknown result type (might be due to invalid IL or missing references)
			//IL_0024: Expected O, but got Unknown
			//IL_001f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0025: Expected O, but got Unknown
			FloatSliderOptions val = new FloatSliderOptions();
			((BaseRangeOptions<float>)val).Min = min;
			((BaseRangeOptions<float>)val).Max = max;
			((BaseOptions)val).RequiresRestart = false;
			FloatSliderConfigItem val2 = new FloatSliderConfigItem(configEntry, val);
			LethalConfigManager.AddConfigItem((BaseConfigItem)(object)val2);
		}

		private void CreateStringConfig(ConfigEntry<string> configEntry)
		{
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			//IL_0007: Unknown result type (might be due to invalid IL or missing references)
			//IL_0014: Expected O, but got Unknown
			//IL_000f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0015: Expected O, but got Unknown
			TextInputFieldConfigItem val = new TextInputFieldConfigItem(configEntry, new TextInputFieldOptions
			{
				RequiresRestart = false
			});
			LethalConfigManager.AddConfigItem((BaseConfigItem)(object)val);
		}

		private void CreateInteriorStringConfig(ConfigEntry<string> configEntry)
		{
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			//IL_0007: Unknown result type (might be due to invalid IL or missing references)
			//IL_000f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0017: Unknown result type (might be due to invalid IL or missing references)
			//IL_0021: Expected O, but got Unknown
			//IL_0027: Expected O, but got Unknown
			//IL_0022: Unknown result type (might be due to invalid IL or missing references)
			//IL_0028: Expected O, but got Unknown
			TextInputFieldConfigItem val = new TextInputFieldConfigItem(configEntry, new TextInputFieldOptions
			{
				RequiresRestart = false,
				CanModifyCallback = new CanModifyDelegate(CanModifyInterior)
			});
			LethalConfigManager.AddConfigItem((BaseConfigItem)(object)val);
		}

		private void CreateBoolConfig(ConfigEntry<bool> configEntry)
		{
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			//IL_0007: Unknown result type (might be due to invalid IL or missing references)
			//IL_0014: Expected O, but got Unknown
			//IL_000f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0015: Expected O, but got Unknown
			BoolCheckBoxConfigItem val = new BoolCheckBoxConfigItem(configEntry, new BoolCheckBoxOptions
			{
				RequiresRestart = false
			});
			LethalConfigManager.AddConfigItem((BaseConfigItem)(object)val);
		}

		public bool CompareEnemyName(string name, string verifiedName)
		{
			string text = name.ToLower();
			while (text.Contains(" "))
			{
				text = text.Replace(" ", "");
			}
			string text2 = verifiedName.ToLower();
			while (text2.Contains(" "))
			{
				text2 = text2.Replace(" ", "");
			}
			return text.Contains(text2);
		}

		public CustomEnemySize GetCustomEnemySize(string nameValue)
		{
			CustomEnemySize customEnemySize = new CustomEnemySize();
			string text = customEnemyEntry.Value.ToLower();
			while (text.Contains(" "))
			{
				text = text.Replace(" ", "");
			}
			float result = 1f;
			float result2 = 1f;
			string text2 = nameValue.ToLower();
			while (text2.Contains(" "))
			{
				text2 = text2.Replace(" ", "");
			}
			if (text.ToLower().Contains(text2))
			{
				string[] array = text.Split(";");
				string[] array2 = array;
				foreach (string text3 in array2)
				{
					string[] array3 = text3.Split(":");
					if (array3[0].Contains(text2))
					{
						float.TryParse(array3[1], NumberStyles.Any, CultureInfo.InvariantCulture, out result);
						float.TryParse(array3[2], NumberStyles.Any, CultureInfo.InvariantCulture, out result2);
						customEnemySize.found = true;
						customEnemySize.minValue = result;
						customEnemySize.maxValue = result2;
					}
				}
			}
			return customEnemySize;
		}

		public float GetInteriorMultiplier(string enemyNameValue, string interiorNameValue)
		{
			string text = enemyNameValue.ToLower();
			while (text.Contains(" "))
			{
				text = text.Replace(" ", "");
			}
			string text2 = interiorNameValue.ToLower();
			while (text2.Contains(" "))
			{
				text2 = text2.Replace(" ", "");
			}
			string text3 = customInteriorEntry.Value.ToLower();
			while (text3.Contains(" "))
			{
				text3 = text3.Replace(" ", "");
			}
			if ((text3.Contains(text) || text3.Contains("any")) && text3.Contains(text2))
			{
				float result = 1f;
				string[] array = text3.Split(";");
				string[] array2 = array;
				foreach (string text4 in array2)
				{
					string[] array3 = text4.Split("#");
					string text5 = array3[0];
					if (!text5.Contains(text2))
					{
						continue;
					}
					string[] array4 = array3[1].Split(",");
					string[] array5 = array4;
					foreach (string text6 in array5)
					{
						string[] array6 = text6.Split(":");
						string text7 = array6[0];
						string s = array6[1];
						if (text7 == "any" || text7 == text)
						{
							float.TryParse(s, NumberStyles.Any, CultureInfo.InvariantCulture, out result);
						}
					}
				}
				return result;
			}
			return 1f;
		}
	}
	public class CustomEnemySize
	{
		public bool found;

		public float maxValue = 1f;

		public float minValue = 1f;
	}
	public static class PluginInfo
	{
		public const string PLUGIN_GUID = "RandomEnemiesSize";

		public const string PLUGIN_NAME = "RandomEnemiesSize";

		public const string PLUGIN_VERSION = "1.0.0";
	}
}
namespace RandomEnemiesSize.SpecialEnemies
{
	public class RedBeesManagement
	{
		public void ChangeSize(EnemyAI enemyAI, float scaleMultiplier)
		{
			//IL_0021: Unknown result type (might be due to invalid IL or missing references)
			//IL_0027: Unknown result type (might be due to invalid IL or missing references)
			RedLocustBees component = ((Component)enemyAI).GetComponent<RedLocustBees>();
			VisualEffect componentInChildren = ((Component)enemyAI).GetComponentInChildren<VisualEffect>();
			if ((Object)(object)componentInChildren != (Object)null)
			{
				Transform transform = ((Component)componentInChildren).transform;
				transform.localScale *= scaleMultiplier;
			}
			if ((Object)(object)component != (Object)null)
			{
				((MonoBehaviour)component).StartCoroutine(ChangeHiveSize(component, scaleMultiplier));
			}
		}

		public IEnumerator ChangeHiveSize(RedLocustBees redLocustBees, float multiplier)
		{
			yield return (object)new WaitUntil((Func<bool>)(() => (Object)(object)redLocustBees.hive != (Object)null));
			Transform transform = ((Component)redLocustBees.hive).gameObject.transform;
			transform.localScale *= multiplier;
			PhysicsProp physicsProp = ((Component)redLocustBees.hive).GetComponent<PhysicsProp>();
			Item cloneHide = Object.Instantiate<Item>(((GrabbableObject)physicsProp).itemProperties);
			cloneHide.weight *= 1f + multiplier * 0.25f;
			((GrabbableObject)physicsProp).originalScale = ((Component)redLocustBees.hive).gameObject.transform.localScale;
			((GrabbableObject)physicsProp).itemProperties = cloneHide;
		}
	}
}
namespace RandomEnemiesSize.Patches
{
	[HarmonyPatch(typeof(EnemyAI))]
	internal class PatchEnemySize
	{
		[HarmonyPatch("Start")]
		[HarmonyPostfix]
		private static void PatchStart(EnemyAI __instance)
		{
			//IL_01b9: Unknown result type (might be due to invalid IL or missing references)
			//IL_01be: Unknown result type (might be due to invalid IL or missing references)
			//IL_01c0: Unknown result type (might be due to invalid IL or missing references)
			//IL_01c3: Unknown result type (might be due to invalid IL or missing references)
			//IL_01c8: Unknown result type (might be due to invalid IL or missing references)
			//IL_027e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0248: Unknown result type (might be due to invalid IL or missing references)
			//IL_0252: Unknown result type (might be due to invalid IL or missing references)
			//IL_0259: Unknown result type (might be due to invalid IL or missing references)
			if (!((NetworkBehaviour)__instance).IsServer || !((NetworkBehaviour)__instance).IsOwner)
			{
				return;
			}
			bool flag = new VanillaEnemies().IsAVanillaEnemy(__instance.enemyType.enemyName);
			if ((flag && !RandomEnemiesSize.instance.CustomAffectVanillaEntry.Value) || (!flag && !RandomEnemiesSize.instance.CustomAffectModEntry.Value))
			{
				return;
			}
			float num = Random.Range(0f, 100f);
			if (RandomEnemiesSize.instance.randomPercentChanceEntry.Value < num)
			{
				if (RandomEnemiesSize.instance.devLogEntry.Value)
				{
					Debug.Log((object)$"RANDOM PERCENT NOT RANDOM SIZE : {num} FOR ENEMY {((Object)((Component)__instance).gameObject).name}");
				}
				return;
			}
			float num2 = Random.Range(RandomEnemiesSize.instance.minSizeOutdoorEntry.Value, RandomEnemiesSize.instance.maxSizeOutdoorEntry.Value);
			if (!__instance.isOutside)
			{
				num2 = Random.Range(RandomEnemiesSize.instance.minSizeIndoorEntry.Value, RandomEnemiesSize.instance.maxSizeIndoorEntry.Value);
			}
			CustomEnemySize customEnemySize = RandomEnemiesSize.instance.GetCustomEnemySize(__instance.enemyType.enemyName);
			if (customEnemySize.found)
			{
				num2 = Random.Range(customEnemySize.minValue, customEnemySize.maxValue);
			}
			if (RandomEnemiesSize.instance.LethalLevelLoaderIsHere)
			{
				string dungeonName = RandomEnemiesSize.GetDungeonName();
				if (!__instance.isOutside && dungeonName != null)
				{
					float interiorMultiplier = RandomEnemiesSize.instance.GetInteriorMultiplier(__instance.enemyType.enemyName, dungeonName);
					num2 *= interiorMultiplier;
				}
			}
			Vector3 localScale = ((Component)__instance).gameObject.transform.localScale;
			Vector3 val = localScale * num2;
			if (RandomEnemiesSize.instance.funModeEntry.Value)
			{
				float num3 = Random.Range(RandomEnemiesSize.instance.funModeHorizontalMinEntry.Value, RandomEnemiesSize.instance.funModeHorizontalMaxEntry.Value);
				float num4 = Random.Range(RandomEnemiesSize.instance.funModeHorizontalMinEntry.Value, RandomEnemiesSize.instance.funModeHorizontalMaxEntry.Value);
				if (RandomEnemiesSize.instance.funModeLockHorizontalEnrty.Value)
				{
					num4 = num3;
				}
				((Vector3)(ref val))..ctor(val.x * num3, val.y, val.z * num4);
			}
			Influences influences = new Influences();
			influences.GetInfos();
			NetworkSize.UpdateEnemyClientRpc(((NetworkBehaviour)__instance).NetworkObjectId, val, num2, influences);
			if (RandomEnemiesSize.instance.devLogEntry.Value)
			{
				Debug.Log((object)("ENEMY (" + ((Object)((Component)__instance).gameObject).name + ") SPAWNED WITH RANDOM SIZE " + ((object)(Vector3)(ref val)).ToString()));
			}
		}
	}
	[HarmonyPatch(typeof(Landmine))]
	public class PatchLandmineSize
	{
		[HarmonyPatch("Start")]
		[HarmonyPostfix]
		private static void PatchStart(Landmine __instance)
		{
			//IL_00d7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00dc: Unknown result type (might be due to invalid IL or missing references)
			//IL_00dd: Unknown result type (might be due to invalid IL or missing references)
			//IL_00df: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e4: Unknown result type (might be due to invalid IL or missing references)
			//IL_019a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0164: Unknown result type (might be due to invalid IL or missing references)
			//IL_016e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0175: Unknown result type (might be due to invalid IL or missing references)
			if (!((NetworkBehaviour)__instance).IsServer || !((NetworkBehaviour)__instance).IsOwner || !RandomEnemiesSize.instance.customAffectMineEntry.Value)
			{
				return;
			}
			float num = Random.Range(0f, 100f);
			if (RandomEnemiesSize.instance.randomPercentChanceEntry.Value < num)
			{
				if (RandomEnemiesSize.instance.devLogEntry.Value)
				{
					Debug.Log((object)$"RANDOM PERCENT NOT RANDOM SIZE : {num} FOR ENEMY {((Object)((Component)__instance).gameObject).name}");
				}
				return;
			}
			float num2 = Random.Range(RandomEnemiesSize.instance.minSizeMineEntry.Value, RandomEnemiesSize.instance.maxSizeMineEntry.Value);
			NetworkObject componentInParent = ((Component)__instance).gameObject.GetComponentInParent<NetworkObject>();
			Vector3 localScale = ((Component)componentInParent).transform.localScale;
			Vector3 val = localScale * num2;
			if (RandomEnemiesSize.instance.funModeEntry.Value)
			{
				float num3 = Random.Range(RandomEnemiesSize.instance.funModeHorizontalMinEntry.Value, RandomEnemiesSize.instance.funModeHorizontalMaxEntry.Value);
				float num4 = Random.Range(RandomEnemiesSize.instance.funModeHorizontalMinEntry.Value, RandomEnemiesSize.instance.funModeHorizontalMaxEntry.Value);
				if (RandomEnemiesSize.instance.funModeLockHorizontalEnrty.Value)
				{
					num4 = num3;
				}
				((Vector3)(ref val))..ctor(val.x * num3, val.y, val.z * num4);
			}
			Influences influences = new Influences();
			influences.GetInfos();
			NetworkSize.UpdateLandMineClientRpc(componentInParent.NetworkObjectId, val, num2, influences);
		}
	}
	[HarmonyPatch(typeof(SpikeRoofTrap))]
	public class PatchSpikeTrapSize
	{
		[HarmonyPatch("Start")]
		[HarmonyPostfix]
		private static void PatchStart(SpikeRoofTrap __instance)
		{
			//IL_00e7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e9: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ee: 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_01ac: Unknown result type (might be due to invalid IL or missing references)
			//IL_01be: Unknown result type (might be due to invalid IL or missing references)
			//IL_016e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0178: Unknown result type (might be due to invalid IL or missing references)
			//IL_017f: Unknown result type (might be due to invalid IL or missing references)
			if (!((NetworkBehaviour)__instance).IsServer || !((NetworkBehaviour)__instance).IsOwner || !RandomEnemiesSize.instance.customAffectSpikeTrapEntry.Value)
			{
				return;
			}
			float num = Random.Range(0f, 100f);
			if (RandomEnemiesSize.instance.randomPercentChanceEntry.Value < num)
			{
				if (RandomEnemiesSize.instance.devLogEntry.Value)
				{
					Debug.Log((object)$"RANDOM PERCENT NOT RANDOM SIZE : {num} FOR ENEMY {((Object)((Component)__instance).gameObject).name}");
				}
				return;
			}
			float num2 = Random.Range(RandomEnemiesSize.instance.minSizeSpikeTrapEntry.Value, RandomEnemiesSize.instance.maxSizeSpikeTrapEntry.Value);
			NetworkObject componentInParent = ((Component)__instance).gameObject.GetComponentInParent<NetworkObject>();
			Vector3 val = default(Vector3);
			((Vector3)(ref val))..ctor(1f, 0f, 1f);
			Vector3 val2 = val * num2;
			if (RandomEnemiesSize.instance.funModeEntry.Value)
			{
				float num3 = Random.Range(RandomEnemiesSize.instance.funModeHorizontalMinEntry.Value, RandomEnemiesSize.instance.funModeHorizontalMaxEntry.Value);
				float num4 = Random.Range(RandomEnemiesSize.instance.funModeHorizontalMinEntry.Value, RandomEnemiesSize.instance.funModeHorizontalMaxEntry.Value);
				if (RandomEnemiesSize.instance.funModeLockHorizontalEnrty.Value)
				{
					num4 = num3;
				}
				((Vector3)(ref val2))..ctor(val2.x * num3, val2.y, val2.z * num4);
			}
			Influences influences = new Influences();
			influences.GetInfos();
			((Vector3)(ref val2))..ctor(val2.x, 1f, val2.z);
			NetworkSize.UpdateSpikeTrapClientRpc(componentInParent.NetworkObjectId, val2, num2, influences);
		}
	}
	[HarmonyPatch(typeof(Turret))]
	public class PatchTurretSize
	{
		[HarmonyPatch("Start")]
		[HarmonyPostfix]
		private static void PatchStart(Turret __instance)
		{
			//IL_00d7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00dc: Unknown result type (might be due to invalid IL or missing references)
			//IL_00dd: Unknown result type (might be due to invalid IL or missing references)
			//IL_00df: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e4: Unknown result type (might be due to invalid IL or missing references)
			//IL_019a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0164: Unknown result type (might be due to invalid IL or missing references)
			//IL_016e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0175: Unknown result type (might be due to invalid IL or missing references)
			if (!((NetworkBehaviour)__instance).IsServer || !((NetworkBehaviour)__instance).IsOwner || !RandomEnemiesSize.instance.customAffectTurretEntry.Value)
			{
				return;
			}
			float num = Random.Range(0f, 100f);
			if (RandomEnemiesSize.instance.randomPercentChanceEntry.Value < num)
			{
				if (RandomEnemiesSize.instance.devLogEntry.Value)
				{
					Debug.Log((object)$"RANDOM PERCENT NOT RANDOM SIZE : {num} FOR ENEMY {((Object)((Component)__instance).gameObject).name}");
				}
				return;
			}
			float num2 = Random.Range(RandomEnemiesSize.instance.minSizeTurretEntry.Value, RandomEnemiesSize.instance.maxSizeTurretEntry.Value);
			NetworkObject componentInParent = ((Component)__instance).gameObject.GetComponentInParent<NetworkObject>();
			Vector3 localScale = ((Component)componentInParent).transform.localScale;
			Vector3 val = localScale * num2;
			if (RandomEnemiesSize.instance.funModeEntry.Value)
			{
				float num3 = Random.Range(RandomEnemiesSize.instance.funModeHorizontalMinEntry.Value, RandomEnemiesSize.instance.funModeHorizontalMaxEntry.Value);
				float num4 = Random.Range(RandomEnemiesSize.instance.funModeHorizontalMinEntry.Value, RandomEnemiesSize.instance.funModeHorizontalMaxEntry.Value);
				if (RandomEnemiesSize.instance.funModeLockHorizontalEnrty.Value)
				{
					num4 = num3;
				}
				((Vector3)(ref val))..ctor(val.x * num3, val.y, val.z * num4);
			}
			Influences influences = new Influences();
			influences.GetInfos();
			NetworkSize.UpdateTurretClientRpc(componentInParent.NetworkObjectId, val, num2, influences);
		}
	}
}