Decompiled source of BigMouth v1.1.1

BigMouth.dll

Decompiled 4 months ago
using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using BepInEx;
using BepInEx.Configuration;
using BigMouth;
using BigMouth.Utils;
using GameNetcodeStuff;
using JetBrains.Annotations;
using LethalConfig;
using LethalConfig.ConfigItems;
using LethalConfig.ConfigItems.Options;
using LethalLib.Modules;
using Microsoft.CodeAnalysis;
using StaticNetcodeLib;
using Unity.Netcode;
using UnityEngine;

[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 = ".NET Standard 2.1")]
[assembly: AssemblyCompany("BigMouth")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyDescription("BigMouth")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0+b4d6fcc71654c3fda8564a2cc0aa8974703c1b42")]
[assembly: AssemblyProduct("BigMouth")]
[assembly: AssemblyTitle("BigMouth")]
[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 BigEyes.Scripts
{
	public class BigMouthEnemyAI : EnemyAI
	{
		public AudioClip angrySound;

		public AudioSource screamSound;

		public GameObject TeethObjectContainer;

		private GameObject fakeItemGameObject;

		private ScanNodeProperties scanNode;

		private bool haveAFakeItem;

		private bool deadAnimHaveBeenCalled;

		private int value;

		private float attackPlayerTimer = 0f;

		private float chasePlayerTimer = BigMouthPlugin.instance.chaseDuration.Value;

		public float aiInterval;

		public bool isPlayerClose;

		private static readonly int Angry = Animator.StringToHash("Angry");

		public int lastBehaviorState;

		private static readonly int Dead = Animator.StringToHash("Dead");

		private IEnumerator DeadCoroutine()
		{
			yield return (object)new WaitForSeconds(1f);
			if (!((NetworkBehaviour)this).IsServer || (Object)(object)BigMouthPlugin.instance.teehGameObject == (Object)null)
			{
				yield return null;
			}
			GameObject teethObject = Object.Instantiate<GameObject>(BigMouthPlugin.instance.teehGameObject, ((Component)this).transform.position, Quaternion.identity);
			NetworkObject networkObject = teethObject.GetComponent<NetworkObject>();
			networkObject.Spawn(false);
			NetworkBigMouth.SetTeethValueClientRpc(networkObject.NetworkObjectId, value);
			((NetworkBehaviour)this).NetworkObject.Despawn(true);
		}

		public void SetValue(int value)
		{
			this.value = value;
			scanNode = ((Component)this).GetComponentInChildren<ScanNodeProperties>();
			scanNode.subText = $"Value: {value}";
		}

		public void SetFakeItemClient(GameObject gameObject)
		{
			//IL_0032: Unknown result type (might be due to invalid IL or missing references)
			//IL_0042: Unknown result type (might be due to invalid IL or missing references)
			//IL_0047: Unknown result type (might be due to invalid IL or missing references)
			//IL_004c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0051: Unknown result type (might be due to invalid IL or missing references)
			//IL_0064: Unknown result type (might be due to invalid IL or missing references)
			fakeItemGameObject = gameObject;
			GrabbableObject component = fakeItemGameObject.GetComponent<GrabbableObject>();
			ScanNodeProperties componentInChildren = fakeItemGameObject.GetComponentInChildren<ScanNodeProperties>();
			component.isInShipRoom = false;
			Vector3 localPosition = fakeItemGameObject.transform.localPosition + component.itemProperties.verticalOffset * Vector3.up;
			Object.Destroy((Object)(object)component);
			fakeItemGameObject.transform.localPosition = localPosition;
			fakeItemGameObject.transform.parent = ((Component)this).transform;
			fakeItemGameObject.tag = "PhysicsProp";
			fakeItemGameObject.layer = LayerMask.NameToLayer("Props");
			((Component)componentInChildren).tag = "DoNotSet";
			((Component)componentInChildren).gameObject.layer = LayerMask.NameToLayer("ScanNode");
			((Component)scanNode).gameObject.SetActive(false);
			haveAFakeItem = true;
			ChangeFakeItemState(isAngry: false);
		}

		public void SetFakeItem(string name)
		{
			//IL_002b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0030: Unknown result type (might be due to invalid IL or missing references)
			//IL_0056: Unknown result type (might be due to invalid IL or missing references)
			//IL_005b: Unknown result type (might be due to invalid IL or missing references)
			if (((NetworkBehaviour)this).IsServer)
			{
				GameObject val = FindNetworkGameObject(name);
				GrabbableObject component = val.GetComponent<GrabbableObject>();
				fakeItemGameObject = Object.Instantiate<GameObject>(val, TeethObjectContainer.transform.position, Quaternion.identity, ((Component)this).transform);
				fakeItemGameObject.transform.rotation = Quaternion.Euler(component.itemProperties.restingRotation);
				GrabbableObject component2 = fakeItemGameObject.GetComponent<GrabbableObject>();
				component2.isInShipRoom = false;
				NetworkObject component3 = fakeItemGameObject.GetComponent<NetworkObject>();
				component3.Spawn(false);
				float scrapValueMultiplier = RoundManager.Instance.scrapValueMultiplier;
				NetworkBigMouth.SetClientFakeItemClientRpc(((NetworkBehaviour)this).NetworkObjectId, component3.NetworkObjectId, Random.Range(Mathf.RoundToInt((float)component2.itemProperties.minValue * scrapValueMultiplier), Mathf.RoundToInt((float)component2.itemProperties.maxValue * scrapValueMultiplier)));
			}
		}

		public void ChangeFakeItemState(bool isAngry)
		{
			if (haveAFakeItem)
			{
				TeethObjectContainer.SetActive(isAngry);
				fakeItemGameObject.SetActive(!isAngry);
			}
		}

		public void GetNetworkPrefab()
		{
			BigMouthPlugin.instance.everyScrapsItems.Clear();
			RoundManager.Instance.currentLevel.spawnableScrap.ToList().ForEach(delegate(SpawnableItemWithRarity prefab)
			{
				GrabbableObject component2 = prefab.spawnableItem.spawnPrefab.GetComponent<GrabbableObject>();
				if ((Object)(object)component2 != (Object)null && component2.itemProperties.isScrap && BigMouthPlugin.instance.CanTransformInItem(component2.itemProperties.itemName))
				{
					BigMouthPlugin.instance.everyScrapsItems.Add(component2.itemProperties.itemName);
				}
			});
			if (!((Object)(object)BigMouthPlugin.instance.teehGameObject == (Object)null))
			{
				return;
			}
			((NetworkBehaviour)this).NetworkManager.NetworkConfig.Prefabs.NetworkPrefabsLists.ForEach(delegate(NetworkPrefabsList list)
			{
				list.PrefabList.ToList().ForEach(delegate(NetworkPrefab prefab)
				{
					GrabbableObject component = prefab.Prefab.GetComponent<GrabbableObject>();
					if ((Object)(object)component != (Object)null && component.itemProperties.itemName == "Teeth")
					{
						BigMouthPlugin.instance.teehGameObject = prefab.Prefab;
					}
				});
			});
		}

		public GameObject FindNetworkGameObject(string itemName)
		{
			GameObject gameObject = BigMouthPlugin.instance.teehGameObject;
			RoundManager.Instance.currentLevel.spawnableScrap.ToList().ForEach(delegate(SpawnableItemWithRarity prefab)
			{
				GrabbableObject component = prefab.spawnableItem.spawnPrefab.GetComponent<GrabbableObject>();
				if ((Object)(object)component != (Object)null && component.itemProperties.itemName == itemName)
				{
					gameObject = prefab.spawnableItem.spawnPrefab;
				}
			});
			return gameObject;
		}

		public override void Start()
		{
			((EnemyAI)this).Start();
			base.agent.stoppingDistance = 1f;
			GetNetworkPrefab();
			FindNetworkGameObject("Teeth");
			if (((NetworkBehaviour)this).IsServer)
			{
				NetworkBigMouth.SetBigMouthValueClientRpc(((NetworkBehaviour)this).NetworkObjectId, Random.Range(BigMouthPlugin.instance.minTeethValue.Value, BigMouthPlugin.instance.maxTeethValue.Value));
				if (BigMouthPlugin.instance.canBeEveryItem.Value)
				{
					NetworkBigMouth.SetBigFakeItemClientRpc(((NetworkBehaviour)this).NetworkObjectId, BigMouthPlugin.instance.everyScrapsItems[Random.Range(0, BigMouthPlugin.instance.everyScrapsItems.Count)]);
				}
			}
		}

		public override void Update()
		{
			//IL_00e8: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ed: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00fc: Unknown result type (might be due to invalid IL or missing references)
			if (base.isEnemyDead)
			{
				if (!deadAnimHaveBeenCalled)
				{
					deadAnimHaveBeenCalled = true;
					SetAnimation();
					if (((NetworkBehaviour)this).IsServer)
					{
						((MonoBehaviour)this).StartCoroutine(DeadCoroutine());
					}
				}
				return;
			}
			((EnemyAI)this).Update();
			aiInterval -= Time.deltaTime;
			attackPlayerTimer -= Time.deltaTime;
			chasePlayerTimer -= Time.deltaTime;
			if (lastBehaviorState != base.currentBehaviourStateIndex)
			{
				ChangeFakeItemState(base.currentBehaviourStateIndex == 1);
				lastBehaviorState = base.currentBehaviourStateIndex;
				SetAnimation();
				if (base.currentBehaviourStateIndex == 1)
				{
					attackPlayerTimer = 1f;
				}
			}
			if (GameNetworkManager.Instance.localPlayerController.HasLineOfSightToPosition(((Component)this).transform.position + Vector3.up * 0.25f, 100f, 25, -1f) && base.currentBehaviourStateIndex == 1)
			{
				GameNetworkManager.Instance.localPlayerController.JumpToFearLevel(1f, true);
			}
			if (aiInterval <= 0f && ((NetworkBehaviour)this).IsOwner)
			{
				aiInterval = base.AIIntervalTime;
				((EnemyAI)this).DoAIInterval();
			}
		}

		public void PlayerIsClose(bool close, [CanBeNull] Collider other)
		{
			base.movingTowardsTargetPlayer = close;
			isPlayerClose = close;
			if (!((NetworkBehaviour)this).IsOwner || ((Object)(object)base.targetPlayer != (Object)null && close))
			{
				return;
			}
			if (close && (Object)(object)other != (Object)null)
			{
				PlayerControllerB component = ((Component)other).GetComponent<PlayerControllerB>();
				if (!((Object)(object)component == (Object)null) && !component.isPlayerDead && !base.isEnemyDead && ((EnemyAI)this).PlayerIsTargetable(component, false, false))
				{
					chasePlayerTimer = BigMouthPlugin.instance.chaseDuration.Value;
					((EnemyAI)this).SetMovingTowardsTargetPlayer(component);
					((EnemyAI)this).SwitchToBehaviourClientRpc(1);
				}
			}
			else
			{
				base.targetPlayer = null;
				((EnemyAI)this).SwitchToBehaviourState(0);
			}
		}

		public override void HitEnemy(int force = 1, PlayerControllerB playerWhoHit = null, bool playHitSFX = false, int hitID = -1)
		{
			((EnemyAI)this).HitEnemy(force, playerWhoHit, playHitSFX, hitID);
			Debug.Log((object)$"ENEMY HIT {base.isEnemyDead} {base.enemyHP}");
			if (!base.isEnemyDead)
			{
				base.enemyHP -= force;
				if (base.enemyHP <= 0 && ((NetworkBehaviour)this).IsOwner)
				{
					((EnemyAI)this).KillEnemyOnOwnerClient(false);
				}
			}
		}

		public override void DoAIInterval()
		{
			((EnemyAI)this).DoAIInterval();
			switch (base.currentBehaviourStateIndex)
			{
			case 0:
				base.agent.speed = 0f;
				break;
			case 1:
				base.agent.speed = BigMouthPlugin.instance.angrySpeed.Value;
				base.agent.acceleration = BigMouthPlugin.instance.angryAcceleration.Value;
				if ((Object)(object)base.targetPlayer != (Object)null && ((EnemyAI)this).PlayerIsTargetable(base.targetPlayer, false, false))
				{
					((EnemyAI)this).SetMovingTowardsTargetPlayer(base.targetPlayer);
				}
				if (chasePlayerTimer <= 0f)
				{
					if (isPlayerClose)
					{
						chasePlayerTimer = BigMouthPlugin.instance.chaseDuration.Value / 2f;
					}
					else
					{
						PlayerIsClose(close: false, null);
					}
				}
				break;
			}
		}

		public void SetAnimation()
		{
			if (base.isEnemyDead)
			{
				base.creatureAnimator.SetBool(Dead, true);
				return;
			}
			switch (base.currentBehaviourStateIndex)
			{
			case 0:
				base.creatureVoice.clip = null;
				base.creatureAnimator.SetBool(Angry, false);
				break;
			case 1:
				screamSound.Play();
				base.creatureVoice.clip = angrySound;
				base.creatureVoice.Play();
				base.creatureAnimator.SetBool(Angry, true);
				break;
			}
		}

		public override void OnCollideWithPlayer(Collider other)
		{
			//IL_0052: Unknown result type (might be due to invalid IL or missing references)
			//IL_0058: Unknown result type (might be due to invalid IL or missing references)
			if (base.currentBehaviourStateIndex != 0)
			{
				PlayerControllerB val = ((EnemyAI)this).MeetsStandardPlayerCollisionConditions(other, false, true);
				if ((Object)(object)val != (Object)null && attackPlayerTimer <= 0f)
				{
					val.DamagePlayer(BigMouthPlugin.instance.attackDamage.Value, true, true, (CauseOfDeath)8, 0, false, default(Vector3));
					attackPlayerTimer = BigMouthPlugin.instance.attackPlayerDelay.Value;
				}
			}
		}
	}
	public class BigMouthPlayerDetection : MonoBehaviour
	{
		public BigMouthEnemyAI MouthEnemyAI;

		public void Start()
		{
			//IL_001e: Unknown result type (might be due to invalid IL or missing references)
			float value = BigMouthPlugin.instance.playerDetectionDistance.Value;
			((Component)this).transform.localScale = new Vector3(value, 4.65f, value);
		}

		public void OnTriggerEnter(Collider other)
		{
			if (((Component)other).CompareTag("Player"))
			{
				MouthEnemyAI.PlayerIsClose(close: true, other);
			}
		}

		private void OnTriggerStay(Collider other)
		{
			if (((Component)other).CompareTag("Player") && !MouthEnemyAI.isPlayerClose)
			{
				MouthEnemyAI.isPlayerClose = true;
			}
		}

		private void OnTriggerExit(Collider other)
		{
			if (((Component)other).CompareTag("Player"))
			{
				MouthEnemyAI.isPlayerClose = false;
			}
		}
	}
	[StaticNetcode]
	public class NetworkBigMouth
	{
		[ClientRpc]
		public static void SetTeethValueClientRpc(ulong networkId, int value)
		{
			((MonoBehaviour)BigMouthPlugin.instance).StartCoroutine(SetValue(networkId, value));
		}

		[ClientRpc]
		public static void SetBigMouthValueClientRpc(ulong networkId, int value)
		{
			BigMouthEnemyAI[] array = Object.FindObjectsByType<BigMouthEnemyAI>((FindObjectsSortMode)0);
			BigMouthEnemyAI bigMouthEnemyAI = null;
			BigMouthEnemyAI[] array2 = array;
			foreach (BigMouthEnemyAI bigMouthEnemyAI2 in array2)
			{
				if (((NetworkBehaviour)bigMouthEnemyAI2).NetworkObjectId == networkId)
				{
					bigMouthEnemyAI = bigMouthEnemyAI2;
				}
			}
			if ((Object)(object)bigMouthEnemyAI != (Object)null)
			{
				bigMouthEnemyAI.SetValue(value);
			}
		}

		[ClientRpc]
		public static void SetClientFakeItemClientRpc(ulong bigMouthId, ulong scrapId, int value)
		{
			GrabbableObject[] array = Object.FindObjectsByType<GrabbableObject>((FindObjectsSortMode)0);
			GrabbableObject val = null;
			GrabbableObject[] array2 = array;
			foreach (GrabbableObject val2 in array2)
			{
				if (((NetworkBehaviour)val2).NetworkObjectId == scrapId)
				{
					val = val2;
				}
			}
			BigMouthEnemyAI[] array3 = Object.FindObjectsByType<BigMouthEnemyAI>((FindObjectsSortMode)0);
			BigMouthEnemyAI bigMouthEnemyAI = null;
			BigMouthEnemyAI[] array4 = array3;
			foreach (BigMouthEnemyAI bigMouthEnemyAI2 in array4)
			{
				if (((NetworkBehaviour)bigMouthEnemyAI2).NetworkObjectId == bigMouthId)
				{
					bigMouthEnemyAI = bigMouthEnemyAI2;
				}
			}
			if ((Object)(object)val != (Object)null && (Object)(object)bigMouthEnemyAI != (Object)null)
			{
				val.SetScrapValue(value);
				val.grabbable = false;
				bigMouthEnemyAI.SetFakeItemClient(((Component)val).gameObject);
			}
		}

		[ClientRpc]
		public static void SetBigFakeItemClientRpc(ulong networkId, string name)
		{
			BigMouthEnemyAI[] array = Object.FindObjectsByType<BigMouthEnemyAI>((FindObjectsSortMode)0);
			BigMouthEnemyAI bigMouthEnemyAI = null;
			BigMouthEnemyAI[] array2 = array;
			foreach (BigMouthEnemyAI bigMouthEnemyAI2 in array2)
			{
				if (((NetworkBehaviour)bigMouthEnemyAI2).NetworkObjectId == networkId)
				{
					bigMouthEnemyAI = bigMouthEnemyAI2;
				}
			}
			if ((Object)(object)bigMouthEnemyAI != (Object)null)
			{
				Debug.Log((object)$"BIG MOUTH FOUND {networkId} SET FAKE ITEM {name}");
				bigMouthEnemyAI.SetFakeItem(name);
			}
		}

		public static IEnumerator SetValue(ulong networkId, int value)
		{
			yield return (object)new WaitForSeconds(1f);
			GrabbableObject[] networkObjects = Object.FindObjectsByType<GrabbableObject>((FindObjectsSortMode)0);
			GrabbableObject grabbableObjectFound = null;
			GrabbableObject[] array = networkObjects;
			foreach (GrabbableObject g in array)
			{
				if (((NetworkBehaviour)g).NetworkObjectId == networkId)
				{
					grabbableObjectFound = g;
				}
			}
			if ((Object)(object)grabbableObjectFound != (Object)null)
			{
				Debug.Log((object)$"TEETH FOUND {networkId} SET VALUE {value}");
				grabbableObjectFound.SetScrapValue(value);
				ScanNodeProperties scanNodeProperties = ((Component)grabbableObjectFound).GetComponentInChildren<ScanNodeProperties>();
				scanNodeProperties.headerText = "BigMouth body";
			}
		}
	}
}
namespace BigMouth
{
	[BepInPlugin("wexop.bigmouth", "BigMouth", "1.1.1")]
	[BepInDependency("evaisa.lethallib", "0.15.1")]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	public class BigMouthPlugin : BaseUnityPlugin
	{
		private const string GUID = "wexop.bigmouth";

		private const string NAME = "BigMouth";

		private const string VERSION = "1.1.1";

		public GameObject teehGameObject;

		public List<string> everyScrapsItems = new List<string>();

		public static BigMouthPlugin instance;

		public ConfigEntry<string> spawnMoonRarity;

		public ConfigEntry<float> playerDetectionDistance;

		public ConfigEntry<int> minTeethValue;

		public ConfigEntry<int> maxTeethValue;

		public ConfigEntry<float> chaseDuration;

		public ConfigEntry<float> attackPlayerDelay;

		public ConfigEntry<int> attackDamage;

		public ConfigEntry<float> angrySpeed;

		public ConfigEntry<float> angryAcceleration;

		public ConfigEntry<bool> canBeEveryItem;

		public ConfigEntry<string> itemDisabled;

		private void Awake()
		{
			instance = this;
			((BaseUnityPlugin)this).Logger.LogInfo((object)"BigMouth starting....");
			string text = Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), "bigmouth");
			AssetBundle bundle = AssetBundle.LoadFromFile(text);
			((BaseUnityPlugin)this).Logger.LogInfo((object)"BigMouth bundle found !");
			RegisterConfigs();
			RegisterMonster(bundle);
			((BaseUnityPlugin)this).Logger.LogInfo((object)"BigMouth is ready!");
		}

		private void RegisterConfigs()
		{
			spawnMoonRarity = ((BaseUnityPlugin)this).Config.Bind<string>("General", "SpawnRarity", "Modded:100,ExperimentationLevel:40,AssuranceLevel:40,VowLevel:40,OffenseLevel:50,MarchLevel:50,RendLevel:100,DineLevel:100,TitanLevel:150,Adamance:90,Embrion:175,Artifice:180", "Chance for BigMouth to spawn for any moon, example => assurance:100,offense:50 . You need to restart the game.");
			CreatStringConfig(spawnMoonRarity, requireRestart: true);
			canBeEveryItem = ((BaseUnityPlugin)this).Config.Bind<bool>("Special", "canBeEveryItem", false, "Big Mouth can transform into any scrap items, even modded one. You don't need to restart the game !");
			CreateBoolConfig(canBeEveryItem);
			itemDisabled = ((BaseUnityPlugin)this).Config.Bind<string>("Special", "itemsDisabled", "Body,Apparatus,Hive,Shotgun", "Items that BigMouth cannot transform into. You don't need to restart the game.");
			CreatStringConfig(itemDisabled);
			playerDetectionDistance = ((BaseUnityPlugin)this).Config.Bind<float>("Custom Behavior", "playerDetectionDistance", 4.65f, "Chance for BigMouth to spawn for any moon, example => assurance:100,offense:50 . You don't need to restart the game !");
			CreateFloatConfig(playerDetectionDistance);
			minTeethValue = ((BaseUnityPlugin)this).Config.Bind<int>("Custom Behavior", "minTeethValue", 50, "Min teeth scrap item value when BigMouth die. You don't need to restart the game !");
			CreateIntConfig(minTeethValue, 0, 500);
			maxTeethValue = ((BaseUnityPlugin)this).Config.Bind<int>("Custom Behavior", "maxTeethValue", 98, "Max teeth scrap item value when BigMouth die. You don't need to restart the game !");
			CreateIntConfig(maxTeethValue, 0, 500);
			chaseDuration = ((BaseUnityPlugin)this).Config.Bind<float>("Custom Behavior", "chaseDuration", 2f, "BigMouth chase player duration when detect one. You don't need to restart the game !");
			CreateFloatConfig(chaseDuration);
			attackPlayerDelay = ((BaseUnityPlugin)this).Config.Bind<float>("Custom Behavior", "attackPlayerDelay", 0.25f, "BigMouth attack player delay. You don't need to restart the game !");
			CreateFloatConfig(attackPlayerDelay, 0f, 5f);
			attackDamage = ((BaseUnityPlugin)this).Config.Bind<int>("Custom Behavior", "attackDamage", 5, "BigMouth attack player delay. You don't need to restart the game !");
			CreateIntConfig(attackDamage);
			angrySpeed = ((BaseUnityPlugin)this).Config.Bind<float>("Custom Behavior", "angrySpeed", 8f, "BigMouth speed on angry phase. See Unity NavMeshAgent for more infos. You don't need to restart the game !");
			CreateFloatConfig(angrySpeed);
			angryAcceleration = ((BaseUnityPlugin)this).Config.Bind<float>("Custom Behavior", "angryAcceleration", 8f, "BigMouth acceleration on angry phase. See Unity NavMeshAgent for more infos. You don't need to restart the game !");
			CreateFloatConfig(angryAcceleration);
		}

		private void RegisterMonster(AssetBundle bundle)
		{
			//IL_005d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0063: Expected O, but got Unknown
			//IL_0079: Unknown result type (might be due to invalid IL or missing references)
			//IL_007f: Expected O, but got Unknown
			EnemyType val = bundle.LoadAsset<EnemyType>("Assets/LethalCompany/Mods/BigMouth/BigMouth.asset");
			((BaseUnityPlugin)this).Logger.LogInfo((object)(((Object)val).name + " FOUND"));
			((BaseUnityPlugin)this).Logger.LogInfo((object)$"{val.enemyPrefab} prefab");
			NetworkPrefabs.RegisterNetworkPrefab(val.enemyPrefab);
			Utilities.FixMixerGroups(val.enemyPrefab);
			TerminalNode val2 = new TerminalNode();
			val2.creatureName = "BigMouth";
			val2.displayText = "He's cute";
			TerminalKeyword val3 = new TerminalKeyword();
			val3.word = "BigMouth";
			RegisterUtil.RegisterEnemyWithConfig(spawnMoonRarity.Value, val, val2, val3, val.PowerLevel, val.MaxCount);
		}

		private void CreateFloatConfig(ConfigEntry<float> configEntry, float min = 0f, float max = 100f)
		{
			//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 = true;
			FloatSliderConfigItem val2 = new FloatSliderConfigItem(configEntry, val);
			LethalConfigManager.AddConfigItem((BaseConfigItem)(object)val2);
		}

		private void CreateIntConfig(ConfigEntry<int> configEntry, int min = 0, int max = 100)
		{
			//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
			IntSliderOptions val = new IntSliderOptions();
			((BaseRangeOptions<int>)val).Min = min;
			((BaseRangeOptions<int>)val).Max = max;
			((BaseOptions)val).RequiresRestart = true;
			IntSliderConfigItem val2 = new IntSliderConfigItem(configEntry, val);
			LethalConfigManager.AddConfigItem((BaseConfigItem)(object)val2);
		}

		private void CreatStringConfig(ConfigEntry<string> configEntry, bool requireRestart = false)
		{
			//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 = requireRestart
			});
			LethalConfigManager.AddConfigItem((BaseConfigItem)(object)val);
		}

		private void CreateBoolConfig(ConfigEntry<bool> configEntry, bool requireRestart = false)
		{
			//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 = requireRestart
			});
			LethalConfigManager.AddConfigItem((BaseConfigItem)(object)val);
		}

		public bool CanTransformInItem(string name)
		{
			bool result = true;
			string text = name.ToLower();
			while (text.Contains(" "))
			{
				text = text.Replace(" ", "");
			}
			string[] array = itemDisabled.Value.Split(",");
			string[] array2 = array;
			foreach (string text2 in array2)
			{
				string text3 = text2.ToLower();
				while (text3.Contains(" "))
				{
					text3 = text3.Replace(" ", "");
				}
				if (text3.Contains(text))
				{
					result = false;
				}
			}
			return result;
		}
	}
	public static class PluginInfo
	{
		public const string PLUGIN_GUID = "BigMouth";

		public const string PLUGIN_NAME = "BigMouth";

		public const string PLUGIN_VERSION = "1.0.0";
	}
}
namespace BigMouth.Utils
{
	public class RegisterUtil
	{
		public static void RegisterEnemyWithConfig(string configMoonRarity, EnemyType enemy, TerminalNode terminalNode, TerminalKeyword terminalKeyword, float powerLevel, int spawnCount)
		{
			enemy.MaxCount = spawnCount;
			enemy.PowerLevel = powerLevel;
			var (dictionary, dictionary2) = ConfigParsing(configMoonRarity);
			Enemies.RegisterEnemy(enemy, dictionary, dictionary2, terminalNode, terminalKeyword);
		}

		public static void RegisterScrapWithConfig(string configMoonRarity, Item scrap)
		{
			var (dictionary, dictionary2) = ConfigParsing(configMoonRarity);
			Items.RegisterScrap(scrap, dictionary, dictionary2);
		}

		public static void RegisterShopItemWithConfig(bool enabledScrap, Item item, TerminalNode terminalNode, int itemCost, string configMoonRarity)
		{
			Items.RegisterShopItem(item, (TerminalNode)null, (TerminalNode)null, terminalNode, itemCost);
			if (enabledScrap)
			{
				RegisterScrapWithConfig(configMoonRarity, item);
			}
		}

		public static (Dictionary<LevelTypes, int> spawnRateByLevelType, Dictionary<string, int> spawnRateByCustomLevelType) ConfigParsing(string configMoonRarity)
		{
			//IL_0099: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c7: Unknown result type (might be due to invalid IL or missing references)
			Dictionary<LevelTypes, int> dictionary = new Dictionary<LevelTypes, int>();
			Dictionary<string, int> dictionary2 = new Dictionary<string, int>();
			foreach (string item in from s in configMoonRarity.Split(',')
				select s.Trim())
			{
				string[] array = item.Split(':');
				if (array.Length != 2)
				{
					continue;
				}
				string text = array[0];
				if (!int.TryParse(array[1], out var result))
				{
					continue;
				}
				if (Enum.TryParse<LevelTypes>(text, ignoreCase: true, out LevelTypes result2))
				{
					dictionary[result2] = result;
					continue;
				}
				string value = text + "Level";
				if (Enum.TryParse<LevelTypes>(value, ignoreCase: true, out result2))
				{
					dictionary[result2] = result;
				}
				else
				{
					dictionary2[text] = result;
				}
			}
			return (dictionary, dictionary2);
		}
	}
}