Decompiled source of RandomEnemiesSize v1.1.16

RandomEnemiesSize.dll

Decompiled 3 weeks 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 LethalLib.Modules;
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+53a76bf8c8b3bb1caa9ec4a0412beeb64819aa96")]
[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.Class | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Parameter | AttributeTargets.ReturnValue | AttributeTargets.GenericParameter, AllowMultiple = false, Inherited = false)]
	internal sealed class NullableAttribute : Attribute
	{
		public readonly byte[] NullableFlags;

		public NullableAttribute(byte P_0)
		{
			NullableFlags = new byte[1] { P_0 };
		}

		public NullableAttribute(byte[] P_0)
		{
			NullableFlags = P_0;
		}
	}
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	[AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Method | AttributeTargets.Interface | AttributeTargets.Delegate, AllowMultiple = false, Inherited = false)]
	internal sealed class NullableContextAttribute : Attribute
	{
		public readonly byte Flag;

		public NullableContextAttribute(byte P_0)
		{
			Flag = P_0;
		}
	}
	[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 EnemyResized
	{
		public Vector3 scale;

		public float multiplier;

		public ulong newtorkId;

		public Influences influences;

		public GameObject gameObject;

		public bool isHazard;

		public string enemyName;
	}
	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 InfluenceMapHazardSound(GameObject gameObject, float multiplier)
		{
			if (!soundInfluence)
			{
				return;
			}
			List<AudioSource> list = new List<AudioSource>();
			AudioSource val = null;
			gameObject.TryGetComponent<AudioSource>(ref val);
			if ((Object)(object)val != (Object)null)
			{
				list.Add(val);
			}
			list.AddRange(gameObject.GetComponentsInChildren<AudioSource>());
			float num = 1f - (multiplier - 1f);
			float pitch = Mathf.Clamp(num, soundInfluenceMin, soundInfluenceMax);
			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;
			}
		}
	}
	public class MapHazardSizeRandomizer : NetworkBehaviour
	{
		private void Start()
		{
			//IL_0106: Unknown result type (might be due to invalid IL or missing references)
			//IL_010b: Unknown result type (might be due to invalid IL or missing references)
			//IL_010d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0110: Unknown result type (might be due to invalid IL or missing references)
			//IL_0115: Unknown result type (might be due to invalid IL or missing references)
			//IL_01cb: Unknown result type (might be due to invalid IL or missing references)
			//IL_0195: Unknown result type (might be due to invalid IL or missing references)
			//IL_019f: Unknown result type (might be due to invalid IL or missing references)
			//IL_01a6: Unknown result type (might be due to invalid IL or missing references)
			if (!((NetworkBehaviour)this).IsServer || !((NetworkBehaviour)this).IsOwner || !RandomEnemiesSize.instance.customAffectModdedHazardEntry.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 MAP HAZARD {((Object)((Component)this).gameObject).name}");
				}
				return;
			}
			float num2 = Random.Range(RandomEnemiesSize.instance.minSizeModdedHazardEntry.Value, RandomEnemiesSize.instance.maxSizeModdedHazardEntry.Value);
			CustomEnemySize customEnemySize = RandomEnemiesSize.instance.GetCustomEnemySize(((Object)((Component)this).gameObject).name);
			if (customEnemySize.found)
			{
				num2 = Random.Range(customEnemySize.minValue, customEnemySize.maxValue);
			}
			NetworkObject networkObject = ((NetworkBehaviour)this).NetworkObject;
			Vector3 localScale = ((Component)networkObject).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.UpdateAnyMapHazardClientRpc(networkObject.NetworkObjectId, val, num2, influences);
		}
	}
	[StaticNetcode]
	public class NetworkSize
	{
		[ClientRpc]
		public static void UpdateEnemyClientRpc(ulong networkId, Vector3 newScale, float scaleMultiplier, Influences influences)
		{
			//IL_00b3: Unknown result type (might be due to invalid IL or missing references)
			//IL_0111: Unknown result type (might be due to invalid IL or missing references)
			//IL_0112: 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;
			}
			if (RandomEnemiesSize.instance.devLogEntry.Value)
			{
				Debug.Log((object)("ENEMY (" + ((Object)val).name + ") SPAWNED WITH RANDOM SIZE " + ((object)(Vector3)(ref newScale)).ToString()));
			}
			((Component)val).transform.localScale = newScale;
			val.enemyHP = influences.InfluenceHp(val.enemyHP, scaleMultiplier);
			influences.InfluenceSound(val, scaleMultiplier);
			EnemyResized enemyResized = new EnemyResized();
			enemyResized.influences = influences;
			enemyResized.isHazard = false;
			enemyResized.newtorkId = networkId;
			enemyResized.multiplier = scaleMultiplier;
			enemyResized.gameObject = ((Component)val).gameObject;
			enemyResized.scale = newScale;
			enemyResized.enemyName = val.enemyType.enemyName;
			RandomEnemiesSize.instance.RegisterResizedGameObject(enemyResized);
			if (val.enemyType.enemyName == "Red Locust Bees")
			{
				RedBeesManagement.ChangeSize(val, scaleMultiplier);
			}
		}

		[ClientRpc]
		public static void UpdateAnyMapHazardClientRpc(ulong networkId, Vector3 newScale, float scaleMultiplier, Influences influences)
		{
			//IL_00a1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f2: Unknown result type (might be due to invalid IL or missing references)
			//IL_008a: Unknown result type (might be due to invalid IL or missing references)
			List<NetworkObject> list = Object.FindObjectsByType<NetworkObject>((FindObjectsSortMode)0).ToList();
			NetworkObject val = list.Find((NetworkObject e) => e.NetworkObjectId == networkId);
			if ((Object)(object)val == (Object)null)
			{
				if (RandomEnemiesSize.instance.devLogEntry.Value)
				{
					Debug.Log((object)$"MAP HAZARD NOT FOUND {networkId}");
				}
				return;
			}
			if (RandomEnemiesSize.instance.devLogEntry.Value)
			{
				Debug.Log((object)$"MAP HAZARD WITH NEW SCALE : {newScale}");
			}
			((Component)val).transform.localScale = newScale;
			influences.InfluenceMapHazardSound(((Component)val).gameObject, scaleMultiplier);
			EnemyResized enemyResized = new EnemyResized();
			enemyResized.influences = influences;
			enemyResized.isHazard = true;
			enemyResized.newtorkId = networkId;
			enemyResized.multiplier = scaleMultiplier;
			enemyResized.gameObject = ((Component)val).gameObject;
			enemyResized.scale = newScale;
			enemyResized.enemyName = ((Object)((Component)val).gameObject).name;
			RandomEnemiesSize.instance.RegisterResizedGameObject(enemyResized);
		}

		[ClientRpc]
		public static void UpdateTurretClientRpc(ulong networkId, Vector3 newScale, float scaleMultiplier, Influences influences)
		{
			//IL_00af: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ff: Unknown result type (might be due to invalid IL or missing references)
			//IL_0100: Unknown result type (might be due to invalid IL or missing references)
			//IL_0098: 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);
			EnemyResized enemyResized = new EnemyResized();
			enemyResized.influences = influences;
			enemyResized.isHazard = true;
			enemyResized.newtorkId = networkId;
			enemyResized.multiplier = scaleMultiplier;
			enemyResized.gameObject = gameObject.gameObject;
			enemyResized.scale = newScale;
			enemyResized.enemyName = "Turret";
			RandomEnemiesSize.instance.RegisterResizedGameObject(enemyResized);
		}

		[ClientRpc]
		public static void UpdateLandMineClientRpc(ulong networkId, Vector3 newScale, float scaleMultiplier, Influences influences)
		{
			//IL_00af: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ff: Unknown result type (might be due to invalid IL or missing references)
			//IL_0100: Unknown result type (might be due to invalid IL or missing references)
			//IL_0098: 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);
			EnemyResized enemyResized = new EnemyResized();
			enemyResized.influences = influences;
			enemyResized.isHazard = true;
			enemyResized.newtorkId = networkId;
			enemyResized.multiplier = scaleMultiplier;
			enemyResized.gameObject = gameObject.gameObject;
			enemyResized.scale = newScale;
			enemyResized.enemyName = "LandMine";
			RandomEnemiesSize.instance.RegisterResizedGameObject(enemyResized);
		}

		[ClientRpc]
		public static void UpdateSpikeTrapClientRpc(ulong networkId, Vector3 newScale, float scaleMultiplier, Influences influences)
		{
			//IL_00af: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ff: Unknown result type (might be due to invalid IL or missing references)
			//IL_0100: Unknown result type (might be due to invalid IL or missing references)
			//IL_0098: 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);
			EnemyResized enemyResized = new EnemyResized();
			enemyResized.influences = influences;
			enemyResized.isHazard = true;
			enemyResized.newtorkId = networkId;
			enemyResized.multiplier = scaleMultiplier;
			enemyResized.gameObject = gameObject.gameObject;
			enemyResized.scale = newScale;
			enemyResized.enemyName = "SpikeTrap";
			RandomEnemiesSize.instance.RegisterResizedGameObject(enemyResized);
		}
	}
	public class RedBees
	{
		public GameObject GameObject;

		public Vector3 baseScale = Vector3.one;

		public Vector3 SizedScale = Vector3.one;

		public int lastState = -1;

		public float multiplier = 1f;
	}
	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", "Clay Surgeon", "Bush Wolf", "Maneater"
		};

		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.16")]
	public class RandomEnemiesSize : BaseUnityPlugin
	{
		private const string GUID = "wexop.random_enemies_size";

		private const string NAME = "RandomEnemiesSize";

		private const string VERSION = "1.1.16";

		public static string LethalLevelLoaderReferenceChain = "imabatby.lethallevelloader";

		public static RandomEnemiesSize instance;

		public bool LethalLevelLoaderIsHere;

		public Dictionary<ulong, EnemyResized> RandomEnemiesSizeDataDictionary = new Dictionary<ulong, EnemyResized>();

		public ConfigEntry<bool> customAffectMineEntry;

		public ConfigEntry<bool> CustomAffectModEntry;

		public ConfigEntry<bool> customAffectTurretEntry;

		public ConfigEntry<bool> customAffectSpikeTrapEntry;

		public ConfigEntry<bool> customAffectModdedHazardEntry;

		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<bool> influenceBeehiveEntry;

		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> minSizeModdedHazardEntry;

		public ConfigEntry<float> maxSizeModdedHazardEntry;

		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);
			customAffectModdedHazardEntry = ((BaseUnityPlugin)this).Config.Bind<bool>("ModdedHazard", "AffectModdedHazard", true, "Activate to make this mod affect modded map hazards size. No need to restart the game :)");
			CreateBoolConfig(customAffectModdedHazardEntry);
			minSizeModdedHazardEntry = ((BaseUnityPlugin)this).Config.Bind<float>("ModdedHazard", "MinModdedHazardSize", 0.3f, "Change the minimum size of modded map hazards. No need to restart the game :)");
			CreateFloatConfig(minSizeModdedHazardEntry, 0f, 5f);
			maxSizeModdedHazardEntry = ((BaseUnityPlugin)this).Config.Bind<float>("ModdedHazard", "MaxModdedHazardSize", 2f, "Change the maximum size of modded map hazards. No need to restart the game :)");
			CreateFloatConfig(maxSizeModdedHazardEntry, 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);
			influenceBeehiveEntry = ((BaseUnityPlugin)this).Config.Bind<bool>("Influences", "InfluenceBeehive", false, "Activate to make size influence beehive weight and price. No need to restart the game :)");
			CreateBoolConfig(influenceBeehiveEntry);
			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);
			RedBeesManagement.Init();
			MapObjects.mapObjects.ForEach(delegate(RegisteredMapObject m)
			{
				string name = ((Object)m.mapObject.prefabToSpawn).name;
				if (!name.Contains("TurretContainer") && !name.Contains("Landmine") && !name.Contains("SpikeRoofTrapHazard"))
				{
					MapHazardSizeRandomizer component = m.mapObject.prefabToSpawn.gameObject.GetComponent<MapHazardSizeRandomizer>();
					if ((Object)(object)component == (Object)null)
					{
						m.mapObject.prefabToSpawn.gameObject.AddComponent<MapHazardSizeRandomizer>();
					}
				}
			});
			Harmony.CreateAndPatchAll(typeof(PatchEnemySize), (string)null);
			Harmony.CreateAndPatchAll(typeof(PatchTurretSize), (string)null);
			Harmony.CreateAndPatchAll(typeof(PatchLandmineSize), (string)null);
			Harmony.CreateAndPatchAll(typeof(PatchSpikeTrapSize), (string)null);
			Harmony.CreateAndPatchAll(typeof(PatchRedLocustBees), (string)null);
			Harmony.CreateAndPatchAll(typeof(PatchRoundManager), (string)null);
			((BaseUnityPlugin)this).Logger.LogInfo((object)"RandomEnemiesSize Patched !!");
		}

		public void RegisterResizedGameObject(EnemyResized enemyResized)
		{
			if (instance.RandomEnemiesSizeDataDictionary.ContainsKey(enemyResized.newtorkId))
			{
				instance.RandomEnemiesSizeDataDictionary.Remove(enemyResized.newtorkId);
			}
			instance.RandomEnemiesSizeDataDictionary.Add(enemyResized.newtorkId, enemyResized);
		}

		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();
			if (customEnemyEntry.Value == "")
			{
				return 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(" ", "");
			}
			string[] array = text.Split(";");
			string[] array2 = array;
			foreach (string text3 in array2)
			{
				string[] array3 = text3.Split(":");
				if (array3.Length == 3 && text2.Contains(array3[0]))
				{
					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 static RedBeesManagement instance;

		public Dictionary<ulong, RedBees> BeesDictionary = new Dictionary<ulong, RedBees>();

		public static void Init()
		{
			if (instance == null)
			{
				instance = new RedBeesManagement();
			}
		}

		public static void ChangeSize(EnemyAI enemyAI, float scaleMultiplier)
		{
			//IL_004f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0054: Unknown result type (might be due to invalid IL or missing references)
			//IL_0060: Unknown result type (might be due to invalid IL or missing references)
			//IL_0066: Unknown result type (might be due to invalid IL or missing references)
			//IL_0079: Unknown result type (might be due to invalid IL or missing references)
			//IL_007e: Unknown result type (might be due to invalid IL or missing references)
			RedLocustBees component = ((Component)enemyAI).GetComponent<RedLocustBees>();
			if (scaleMultiplier > 1f)
			{
				component.defenseDistance = Mathf.RoundToInt((float)component.defenseDistance * scaleMultiplier);
			}
			VisualEffect componentInChildren = ((Component)enemyAI).GetComponentInChildren<VisualEffect>();
			if ((Object)(object)componentInChildren != (Object)null)
			{
				RedBees redBees = new RedBees();
				redBees.baseScale = ((Component)componentInChildren).transform.localScale;
				Transform transform = ((Component)componentInChildren).transform;
				transform.localScale *= scaleMultiplier;
				redBees.SizedScale = ((Component)componentInChildren).transform.localScale;
				redBees.GameObject = ((Component)componentInChildren).gameObject;
				redBees.multiplier = scaleMultiplier;
				if (instance.BeesDictionary.ContainsKey(((NetworkBehaviour)component).NetworkObjectId))
				{
					instance.BeesDictionary.Remove(((NetworkBehaviour)component).NetworkObjectId);
				}
				instance.BeesDictionary.Add(((NetworkBehaviour)component).NetworkObjectId, redBees);
			}
			if ((Object)(object)component != (Object)null)
			{
				((MonoBehaviour)component).StartCoroutine(ChangeHiveSize(component, scaleMultiplier));
			}
		}

		public static 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);
			if (RandomEnemiesSize.instance.influenceBeehiveEntry.Value)
			{
				if (multiplier > 1f)
				{
					cloneHide.weight = 1f + multiplier * 0.1f;
				}
				((GrabbableObject)physicsProp).SetScrapValue(Mathf.RoundToInt((float)((GrabbableObject)physicsProp).scrapValue * multiplier));
			}
			((GrabbableObject)physicsProp).originalScale = ((Component)redLocustBees.hive).gameObject.transform.localScale;
			((GrabbableObject)physicsProp).itemProperties = cloneHide;
		}

		public void TargetPlayerRescale(ulong networkId)
		{
			//IL_0028: Unknown result type (might be due to invalid IL or missing references)
			RedBees redBees = instance.BeesDictionary[networkId];
			if (redBees != null)
			{
				redBees.GameObject.transform.localScale = redBees.baseScale;
			}
		}

		public void StopTargetingPlayerRescale(ulong networkId)
		{
			//IL_0028: Unknown result type (might be due to invalid IL or missing references)
			RedBees redBees = instance.BeesDictionary[networkId];
			if (redBees != null)
			{
				redBees.GameObject.transform.localScale = redBees.SizedScale;
			}
		}
	}
}
namespace RandomEnemiesSize.Patches
{
	[HarmonyPatch(typeof(EnemyAI))]
	internal class PatchEnemySize
	{
		[HarmonyPatch(typeof(MaskedPlayerEnemy))]
		[HarmonyPatch("Start")]
		[HarmonyPostfix]
		private static void PatchStartMasked(MaskedPlayerEnemy __instance)
		{
			PatchStart((EnemyAI)(object)__instance);
		}

		[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);
		}
	}
	[HarmonyPatch(typeof(Landmine))]
	public class PatchLandmineSize
	{
		[HarmonyPatch("Start")]
		[HarmonyPostfix]
		private static void PatchStart(Landmine __instance)
		{
			//IL_00d2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d8: Unknown result type (might be due to invalid IL or missing references)
			//IL_00da: 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_0195: Unknown result type (might be due to invalid IL or missing references)
			//IL_015f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0169: Unknown result type (might be due to invalid IL or missing references)
			//IL_0170: 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 networkObject = ((NetworkBehaviour)__instance).NetworkObject;
			Vector3 localScale = ((Component)networkObject).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(networkObject.NetworkObjectId, val, num2, influences);
		}
	}
	[HarmonyPatch(typeof(RedLocustBees))]
	public class PatchRedLocustBees
	{
		[HarmonyPatch("Update")]
		[HarmonyPostfix]
		private static void PatchMovingTowardPlayer(RedLocustBees __instance)
		{
			if (!RedBeesManagement.instance.BeesDictionary.ContainsKey(((NetworkBehaviour)__instance).NetworkObjectId))
			{
				return;
			}
			int? num = Traverse.Create((object)__instance).Field("beeParticleState").GetValue() as int?;
			if (!num.HasValue)
			{
				return;
			}
			RedBees redBees = RedBeesManagement.instance.BeesDictionary[((NetworkBehaviour)__instance).NetworkObjectId];
			((EnemyAI)__instance).agent.speed = Mathf.Clamp(((EnemyAI)__instance).agent.speed / redBees.multiplier, 1f, 100f);
			if (redBees.lastState != num)
			{
				RedBeesManagement.instance.BeesDictionary[((NetworkBehaviour)__instance).NetworkObjectId].lastState = num.Value;
				if (num.Value == 0)
				{
					RedBeesManagement.instance.StopTargetingPlayerRescale(((NetworkBehaviour)__instance).NetworkObjectId);
				}
				else
				{
					RedBeesManagement.instance.TargetPlayerRescale(((NetworkBehaviour)__instance).NetworkObjectId);
				}
			}
		}
	}
	[HarmonyPatch(typeof(RoundManager))]
	public class PatchRoundManager
	{
		[HarmonyPatch("GenerateNewLevelClientRpc")]
		[HarmonyPrefix]
		private static void PatchLoadLevel(RoundManager __instance)
		{
			RandomEnemiesSize.instance.RandomEnemiesSizeDataDictionary.Clear();
			List<SpawnableMapObject> list = __instance.currentLevel.spawnableMapObjects.ToList();
			foreach (SpawnableMapObject item in list)
			{
				string name = ((Object)item.prefabToSpawn).name;
				if (name.Contains("TurretContainer") || name.Contains("Landmine") || name.Contains("SpikeRoofTrapHazard"))
				{
					break;
				}
				MapHazardSizeRandomizer mapHazardSizeRandomizer = item.prefabToSpawn.GetComponent<MapHazardSizeRandomizer>();
				if ((Object)(object)mapHazardSizeRandomizer == (Object)null)
				{
					mapHazardSizeRandomizer = item.prefabToSpawn.GetComponentInChildren<MapHazardSizeRandomizer>();
				}
				if ((Object)(object)mapHazardSizeRandomizer == (Object)null)
				{
					item.prefabToSpawn.AddComponent<MapHazardSizeRandomizer>();
				}
			}
		}
	}
	[HarmonyPatch(typeof(SpikeRoofTrap))]
	public class PatchSpikeTrapSize
	{
		[HarmonyPatch("Start")]
		[HarmonyPostfix]
		private static void PatchStart(SpikeRoofTrap __instance)
		{
			//IL_00e2: 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_00e9: 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_01a7: Unknown result type (might be due to invalid IL or missing references)
			//IL_01b9: Unknown result type (might be due to invalid IL or missing references)
			//IL_0169: Unknown result type (might be due to invalid IL or missing references)
			//IL_0173: 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)
			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 networkObject = ((NetworkBehaviour)__instance).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(networkObject.NetworkObjectId, val2, num2, influences);
		}
	}
	[HarmonyPatch(typeof(Turret))]
	public class PatchTurretSize
	{
		[HarmonyPatch("Start")]
		[HarmonyPostfix]
		private static void PatchStart(Turret __instance)
		{
			//IL_00d2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d8: Unknown result type (might be due to invalid IL or missing references)
			//IL_00da: 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_0195: Unknown result type (might be due to invalid IL or missing references)
			//IL_015f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0169: Unknown result type (might be due to invalid IL or missing references)
			//IL_0170: 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 networkObject = ((NetworkBehaviour)__instance).NetworkObject;
			Vector3 localScale = ((Component)networkObject).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(networkObject.NetworkObjectId, val, num2, influences);
		}
	}
}