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.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+4fcf0c359a404195534775ff4ac074edf0f152ed")] [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 BigMouth { [BepInPlugin("wexop.bigmouth", "BigMouth", "1.1.4")] [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.4"; public GameObject teehGameObject; public List everyScrapsItems = new List(); public static BigMouthPlugin instance; public ConfigEntry spawnMoonRarity; public ConfigEntry playerDetectionDistance; public ConfigEntry minTeethValue; public ConfigEntry maxTeethValue; public ConfigEntry chaseDuration; public ConfigEntry attackPlayerDelay; public ConfigEntry attackDamage; public ConfigEntry angrySpeed; public ConfigEntry angryAcceleration; public ConfigEntry canBeEveryItem; public ConfigEntry 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("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("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("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("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("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("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("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("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("Custom Behavior", "attackDamage", 5, "BigMouth attack player delay. You don't need to restart the game !"); CreateIntConfig(attackDamage); angrySpeed = ((BaseUnityPlugin)this).Config.Bind("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("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("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 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)val).Min = min; ((BaseRangeOptions)val).Max = max; ((BaseOptions)val).RequiresRestart = true; FloatSliderConfigItem val2 = new FloatSliderConfigItem(configEntry, val); LethalConfigManager.AddConfigItem((BaseConfigItem)(object)val2); } private void CreateIntConfig(ConfigEntry 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)val).Min = min; ((BaseRangeOptions)val).Max = max; ((BaseOptions)val).RequiresRestart = true; IntSliderConfigItem val2 = new IntSliderConfigItem(configEntry, val); LethalConfigManager.AddConfigItem((BaseConfigItem)(object)val2); } private void CreatStringConfig(ConfigEntry 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 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 spawnRateByLevelType, Dictionary 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 dictionary = new Dictionary(); Dictionary dictionary2 = new Dictionary(); 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(text, ignoreCase: true, out LevelTypes result2)) { dictionary[result2] = result; continue; } string value = text + "Level"; if (Enum.TryParse(value, ignoreCase: true, out result2)) { dictionary[result2] = result; } else { dictionary2[text] = result; } } return (dictionary, dictionary2); } } } namespace BigMouth.Scripts { public class BigMouthEnemyAI : EnemyAI { [CompilerGenerated] private sealed class d__15 : IEnumerator, IEnumerator, IDisposable { private int <>1__state; private object <>2__current; public BigMouthEnemyAI <>4__this; private GameObject 5__1; private NetworkObject 5__2; object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public d__15(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { 5__1 = null; 5__2 = null; <>1__state = -2; } private bool MoveNext() { //IL_0031: Unknown result type (might be due to invalid IL or missing references) //IL_003b: Expected O, but got Unknown //IL_009c: Unknown result type (might be due to invalid IL or missing references) //IL_00a1: Unknown result type (might be due to invalid IL or missing references) switch (<>1__state) { default: return false; case 0: <>1__state = -1; <>2__current = (object)new WaitForSeconds(1f); <>1__state = 1; return true; case 1: <>1__state = -1; if (!((NetworkBehaviour)<>4__this).IsServer || (Object)(object)BigMouthPlugin.instance.teehGameObject == (Object)null) { <>2__current = null; <>1__state = 2; return true; } break; case 2: <>1__state = -1; break; } 5__1 = Object.Instantiate(BigMouthPlugin.instance.teehGameObject, ((Component)<>4__this).transform.position, Quaternion.identity); 5__2 = 5__1.GetComponent(); 5__2.Spawn(false); NetworkBigMouth.SetTeethValueClientRpc(5__2.NetworkObjectId, <>4__this.value); ((NetworkBehaviour)<>4__this).NetworkObject.Despawn(true); return false; } bool IEnumerator.MoveNext() { //ILSpy generated this explicit interface implementation from .override directive in MoveNext return this.MoveNext(); } [DebuggerHidden] void IEnumerator.Reset() { throw new NotSupportedException(); } } 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 = 0f; 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"); [IteratorStateMachine(typeof(d__15))] private IEnumerator DeadCoroutine() { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new d__15(0) { <>4__this = this }; } public void SetValue(int value) { this.value = value; scanNode = ((Component)this).GetComponentInChildren(); 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(); ScanNodeProperties componentInChildren = fakeItemGameObject.GetComponentInChildren(); 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(); fakeItemGameObject = Object.Instantiate(val, TeethObjectContainer.transform.position, Quaternion.identity, ((Component)this).transform); fakeItemGameObject.transform.rotation = Quaternion.Euler(component.itemProperties.restingRotation); GrabbableObject component2 = fakeItemGameObject.GetComponent(); component2.isInShipRoom = false; NetworkObject component3 = fakeItemGameObject.GetComponent(); 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(); 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(); 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(); 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, -1) && 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(); if (!((Object)(object)component == (Object)null) && !component.isPlayerDead && !base.isEnemyDead && ((EnemyAI)this).PlayerIsTargetable(component, false, false, true)) { chasePlayerTimer = BigMouthPlugin.instance.chaseDuration.Value; base.targetPlayer = 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, true)) { ((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 { [CompilerGenerated] private sealed class d__4 : IEnumerator, IEnumerator, IDisposable { private int <>1__state; private object <>2__current; public ulong networkId; public int value; private GrabbableObject[] 5__1; private GrabbableObject 5__2; private GrabbableObject[] <>s__3; private int <>s__4; private GrabbableObject 5__5; private ScanNodeProperties 5__6; object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public d__4(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { 5__1 = null; 5__2 = null; <>s__3 = null; 5__5 = null; 5__6 = null; <>1__state = -2; } private bool MoveNext() { //IL_0026: Unknown result type (might be due to invalid IL or missing references) //IL_0030: Expected O, but got Unknown switch (<>1__state) { default: return false; case 0: <>1__state = -1; <>2__current = (object)new WaitForSeconds(1f); <>1__state = 1; return true; case 1: <>1__state = -1; 5__1 = Object.FindObjectsByType((FindObjectsSortMode)0); 5__2 = null; <>s__3 = 5__1; for (<>s__4 = 0; <>s__4 < <>s__3.Length; <>s__4++) { 5__5 = <>s__3[<>s__4]; if (((NetworkBehaviour)5__5).NetworkObjectId == networkId) { 5__2 = 5__5; } 5__5 = null; } <>s__3 = null; if ((Object)(object)5__2 != (Object)null) { Debug.Log((object)$"TEETH FOUND {networkId} SET VALUE {value}"); 5__2.SetScrapValue(value); 5__6 = ((Component)5__2).GetComponentInChildren(); 5__6.headerText = "BigMouth body"; 5__6 = null; } return false; } } bool IEnumerator.MoveNext() { //ILSpy generated this explicit interface implementation from .override directive in MoveNext return this.MoveNext(); } [DebuggerHidden] void IEnumerator.Reset() { throw new NotSupportedException(); } } [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((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((FindObjectsSortMode)0); GrabbableObject val = null; GrabbableObject[] array2 = array; foreach (GrabbableObject val2 in array2) { if (((NetworkBehaviour)val2).NetworkObjectId == scrapId) { val = val2; } } BigMouthEnemyAI[] array3 = Object.FindObjectsByType((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((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); } } [IteratorStateMachine(typeof(d__4))] public static IEnumerator SetValue(ulong networkId, int value) { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new d__4(0) { networkId = networkId, value = value }; } } }