Please disclose if your mod was created primarily using AI tools by adding the 'AI Generated' category. Failing to do so may result in the mod being removed from Thunderstore.
Decompiled source of Sacha Mod v1.1.1
plugins/Sacha_Mod/NBPCSDC.Sacha_Mod.dll
Decompiled 7 months agousing System; using System.Collections; using System.Collections.Generic; using System.Diagnostics; using System.IO; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using System.Security; using System.Security.Permissions; using BepInEx; using BepInEx.Configuration; using BepInEx.Logging; using GameNetcodeStuff; using LethalLib.Modules; using Microsoft.CodeAnalysis; using NBPCSDC.Sacha_Mod.NetcodePatcher; using Sacha_Mod.Configuration; using Unity.Netcode; using UnityEngine; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")] [assembly: AssemblyCompany("NBPCSDC.Sacha_Mod")] [assembly: AssemblyConfiguration("Release")] [assembly: AssemblyFileVersion("1.1.0.0")] [assembly: AssemblyInformationalVersion("1.1.0+3cf8c6938c495fc09d2003d8fd0872680c0fe921")] [assembly: AssemblyProduct("Sacha_Mod")] [assembly: AssemblyTitle("NBPCSDC.Sacha_Mod")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.1.0.0")] [module: UnverifiableCode] [module: RefSafetyRules(11)] [module: NetcodePatchedAssembly] internal class <Module> { static <Module>() { } } 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; } } } public class FootstepSound : NetworkBehaviour { [Header("Audio Source")] public AudioSource? footstepSource; [Header("Footstep Clips")] public AudioClip[]? footstepClips; public void WalkSound() { //IL_000c: Unknown result type (might be due to invalid IL or missing references) //IL_0012: Unknown result type (might be due to invalid IL or missing references) if (((NetworkBehaviour)this).IsOwner) { PlayFootstepServerRpc(); } } [ServerRpc(RequireOwnership = false)] private void PlayFootstepServerRpc(ServerRpcParams rpcParams = default(ServerRpcParams)) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_008c: Unknown result type (might be due to invalid IL or missing references) //IL_0096: Invalid comparison between Unknown and I4 //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_006d: Unknown result type (might be due to invalid IL or missing references) //IL_007c: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager; if (networkManager != null && networkManager.IsListening) { if ((int)base.__rpc_exec_stage != 1 && (networkManager.IsClient || networkManager.IsHost)) { FastBufferWriter val = ((NetworkBehaviour)this).__beginSendServerRpc(1085873162u, rpcParams, (RpcDelivery)0); ((NetworkBehaviour)this).__endSendServerRpc(ref val, 1085873162u, rpcParams, (RpcDelivery)0); } if ((int)base.__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost) && !((Object)(object)footstepSource == (Object)null) && footstepClips != null && footstepClips.Length != 0) { int clipIndex = Random.Range(0, footstepClips.Length); PlayFootstepClientRpc(clipIndex); } } } [ClientRpc] private void PlayFootstepClientRpc(int clipIndex) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_0099: Unknown result type (might be due to invalid IL or missing references) //IL_00a3: Invalid comparison between Unknown and I4 //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_006d: Unknown result type (might be due to invalid IL or missing references) //IL_0071: Unknown result type (might be due to invalid IL or missing references) //IL_0089: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager; if (networkManager != null && networkManager.IsListening) { if ((int)base.__rpc_exec_stage != 2 && (networkManager.IsServer || networkManager.IsHost)) { ClientRpcParams val = default(ClientRpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(2270983184u, val, (RpcDelivery)0); BytePacker.WriteValueBitPacked(val2, clipIndex); ((NetworkBehaviour)this).__endSendClientRpc(ref val2, 2270983184u, val, (RpcDelivery)0); } if ((int)base.__rpc_exec_stage == 2 && (networkManager.IsClient || networkManager.IsHost) && !((Object)(object)footstepSource == (Object)null) && footstepClips != null && footstepClips.Length != 0 && footstepClips.Length != 0) { AudioClip val3 = footstepClips[Mathf.Clamp(clipIndex, 0, footstepClips.Length - 1)]; footstepSource.PlayOneShot(val3); } } } protected override void __initializeVariables() { ((NetworkBehaviour)this).__initializeVariables(); } [RuntimeInitializeOnLoadMethod] internal static void InitializeRPCS_FootstepSound() { //IL_0011: Unknown result type (might be due to invalid IL or missing references) //IL_001b: Expected O, but got Unknown //IL_002c: Unknown result type (might be due to invalid IL or missing references) //IL_0036: Expected O, but got Unknown NetworkManager.__rpc_func_table.Add(1085873162u, new RpcReceiveHandler(__rpc_handler_1085873162)); NetworkManager.__rpc_func_table.Add(2270983184u, new RpcReceiveHandler(__rpc_handler_2270983184)); } private static void __rpc_handler_1085873162(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams) { //IL_0023: Unknown result type (might be due to invalid IL or missing references) //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_0029: Unknown result type (might be due to invalid IL or missing references) //IL_0033: Unknown result type (might be due to invalid IL or missing references) //IL_003e: Unknown result type (might be due to invalid IL or missing references) //IL_004d: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = target.NetworkManager; if (networkManager != null && networkManager.IsListening) { ServerRpcParams server = rpcParams.Server; target.__rpc_exec_stage = (__RpcExecStage)1; ((FootstepSound)(object)target).PlayFootstepServerRpc(server); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_2270983184(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams) { //IL_0023: Unknown result type (might be due to invalid IL or missing references) //IL_0036: Unknown result type (might be due to invalid IL or missing references) //IL_0050: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = target.NetworkManager; if (networkManager != null && networkManager.IsListening) { int clipIndex = default(int); ByteUnpacker.ReadValueBitPacked(reader, ref clipIndex); target.__rpc_exec_stage = (__RpcExecStage)2; ((FootstepSound)(object)target).PlayFootstepClientRpc(clipIndex); target.__rpc_exec_stage = (__RpcExecStage)0; } } protected internal override string __getTypeName() { return "FootstepSound"; } } namespace Sacha_Mod { [RequireComponent(typeof(Animator))] public class IKControl : MonoBehaviour { protected Animator animator; public Transform lookObj; public bool ikActive; private void Start() { animator = ((Component)this).GetComponent<Animator>(); } private void OnAnimatorIK() { if (Object.op_Implicit((Object)(object)animator) && ikActive) { moveHeadClientRpc(); } } [ClientRpc] private void moveHeadClientRpc() { //IL_002a: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)lookObj != (Object)null) { animator.SetLookAtWeight(1f); animator.SetLookAtPosition(lookObj.position); } else { animator.SetLookAtWeight(0f); } } } [BepInPlugin("NBPCSDC.Sacha_Mod", "Sacha_Mod", "1.1.0")] [BepInDependency(/*Could not decode attribute arguments.*/)] public class Plugin : BaseUnityPlugin { internal static ManualLogSource Logger; public static AssetBundle? ModAssets; internal static PluginConfig BoundConfig { get; private set; } private void Awake() { Logger = ((BaseUnityPlugin)this).Logger; InitializeNetworkBehaviours(); string path = "sachamodassets"; ModAssets = AssetBundle.LoadFromFile(Path.Combine(Path.GetDirectoryName(((BaseUnityPlugin)this).Info.Location), path)); if ((Object)(object)ModAssets == (Object)null) { Logger.LogError((object)"Failed to load custom assets."); return; } EnemyType val = ModAssets.LoadAsset<EnemyType>("Sacha"); TerminalNode val2 = ModAssets.LoadAsset<TerminalNode>("SachaTN"); TerminalKeyword val3 = ModAssets.LoadAsset<TerminalKeyword>("SachaTK"); Dictionary<LevelTypes, int> dictionary = new Dictionary<LevelTypes, int> { { (LevelTypes)4, 40 }, { (LevelTypes)8, 20 }, { (LevelTypes)16, 15 }, { (LevelTypes)32, 15 }, { (LevelTypes)64, 40 }, { (LevelTypes)128, 10 }, { (LevelTypes)256, 35 }, { (LevelTypes)512, 40 }, { (LevelTypes)(-1), 20 }, { (LevelTypes)1024, 20 } }; Dictionary<string, int> dictionary2 = new Dictionary<string, int> { { "EGyptLevel", 50 }, { "46 Infernis", 69 } }; NetworkPrefabs.RegisterNetworkPrefab(val.enemyPrefab); Enemies.RegisterEnemy(val, dictionary, dictionary2, val2, val3); Logger.LogInfo((object)"Plugin NBPCSDC.Sacha_Mod is loaded!"); } private static void InitializeNetworkBehaviours() { Type[] types = Assembly.GetExecutingAssembly().GetTypes(); Type[] array = types; foreach (Type type in array) { MethodInfo[] methods = type.GetMethods(BindingFlags.Instance | BindingFlags.Static | BindingFlags.NonPublic); MethodInfo[] array2 = methods; foreach (MethodInfo methodInfo in array2) { object[] customAttributes = methodInfo.GetCustomAttributes(typeof(RuntimeInitializeOnLoadMethodAttribute), inherit: false); if (customAttributes.Length != 0) { methodInfo.Invoke(null, null); } } } } } internal class SachaAI : EnemyAI { public enum SoundCategory { Clap, Combat, Attack, Hit, Hello, Random, Flee, Song, StopTarget } private enum State { SearchingForPlayer, FollowPlayer, IsInCombat, RunAway, AttackInProgress, ReceiveHitInProgress, EmotePlaying, HelloInProgress, ClapInProgress } private enum MovementMode { Run, Walk, Idle, Backup } [CompilerGenerated] private sealed class <PlayHelloAndWait>d__60 : IEnumerator<object>, IEnumerator, IDisposable { private int <>1__state; private object <>2__current; public SachaAI <>4__this; object IEnumerator<object>.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public <PlayHelloAndWait>d__60(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { <>1__state = -2; } private bool MoveNext() { //IL_003a: Unknown result type (might be due to invalid IL or missing references) //IL_0044: Expected O, but got Unknown //IL_005a: Unknown result type (might be due to invalid IL or missing references) //IL_0064: Expected O, but got Unknown //IL_008c: Unknown result type (might be due to invalid IL or missing references) //IL_0096: Expected O, but got Unknown int num = <>1__state; SachaAI CS$<>8__locals0 = <>4__this; switch (num) { default: return false; case 0: <>1__state = -1; <>2__current = (object)new WaitUntil((Func<bool>)(() => CS$<>8__locals0.IsPlayerLookingAtEnemy())); <>1__state = 1; return true; case 1: <>1__state = -1; <>2__current = (object)new WaitForSeconds(0.5f); <>1__state = 2; return true; case 2: <>1__state = -1; CS$<>8__locals0.PlaySoundServerRpc(SoundCategory.Hello); CS$<>8__locals0.DoAnimationClientRpc("hello"); <>2__current = (object)new WaitForSeconds(2f); <>1__state = 3; return true; case 3: <>1__state = -1; CS$<>8__locals0.helloDone = true; ((EnemyAI)CS$<>8__locals0).SwitchToBehaviourClientRpc(1); 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(); } } [CompilerGenerated] private sealed class <TakeHit>d__62 : IEnumerator<object>, IEnumerator, IDisposable { private int <>1__state; private object <>2__current; public SachaAI <>4__this; public int force; object IEnumerator<object>.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public <TakeHit>d__62(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { <>1__state = -2; } private bool MoveNext() { //IL_0148: Unknown result type (might be due to invalid IL or missing references) //IL_0152: Expected O, but got Unknown //IL_00c6: Unknown result type (might be due to invalid IL or missing references) //IL_00e2: Unknown result type (might be due to invalid IL or missing references) //IL_00e7: Unknown result type (might be due to invalid IL or missing references) //IL_00ee: Unknown result type (might be due to invalid IL or missing references) int num = <>1__state; SachaAI sachaAI = <>4__this; switch (num) { default: return false; case 0: <>1__state = -1; ((EnemyAI)sachaAI).SwitchToBehaviourClientRpc(5); sachaAI.ik_Control.ikActive = false; ((EnemyAI)sachaAI).creatureAnimator.SetInteger("hitIndex", sachaAI.enemyRandom.Next(0, 2)); sachaAI.DoAnimationClientRpc("hit"); sachaAI.PlaySoundServerRpc(SoundCategory.Hit); if (((EnemyAI)sachaAI).enemyHP - force <= 0) { ((MonoBehaviour)sachaAI).StopCoroutine(sachaAI.attack()); sachaAI.StopSong(); ((EnemyAI)sachaAI).SwitchToBehaviourClientRpc(3); ((EnemyAI)sachaAI).creatureAnimator.SetBool("isCombat", false); sachaAI.PlaySoundServerRpc(SoundCategory.Flee); sachaAI.DoAnimationClientRpc("runAway"); sachaAI.updateRotation = false; sachaAI.farestNodeFromPos = ((EnemyAI)sachaAI).ChooseFarthestNodeFromPosition(((Component)((EnemyAI)sachaAI).targetPlayer).transform.position, false, 0, false, 50, false); sachaAI.targetPosition = sachaAI.farestNodeFromPos.position; ((EnemyAI)sachaAI).SetDestinationToPosition(sachaAI.targetPosition, true); ((EnemyAI)sachaAI).agent.speed = sachaAI.runSpeed * 3f; break; } ((EnemyAI)sachaAI).SwitchToBehaviourClientRpc(2); ((EnemyAI)sachaAI).creatureAnimator.SetBool("isCombat", true); sachaAI.attackedDelay = 0f; sachaAI.ik_Control.ikActive = true; <>2__current = (object)new WaitForSeconds(0.5f); <>1__state = 1; return true; case 1: <>1__state = -1; sachaAI.PlaySoundServerRpc(SoundCategory.Combat); break; } 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(); } } [CompilerGenerated] private sealed class <attack>d__61 : IEnumerator<object>, IEnumerator, IDisposable { private int <>1__state; private object <>2__current; public SachaAI <>4__this; private float <distanceToPlayer>5__2; object IEnumerator<object>.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public <attack>d__61(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { <>1__state = -2; } private bool MoveNext() { //IL_003d: Unknown result type (might be due to invalid IL or missing references) //IL_004d: Unknown result type (might be due to invalid IL or missing references) //IL_0090: Unknown result type (might be due to invalid IL or missing references) //IL_00a0: Unknown result type (might be due to invalid IL or missing references) //IL_01b4: Unknown result type (might be due to invalid IL or missing references) //IL_01be: Expected O, but got Unknown //IL_00ee: Unknown result type (might be due to invalid IL or missing references) //IL_00fe: Unknown result type (might be due to invalid IL or missing references) //IL_0103: Unknown result type (might be due to invalid IL or missing references) //IL_0108: 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_0110: Unknown result type (might be due to invalid IL or missing references) //IL_011d: Unknown result type (might be due to invalid IL or missing references) //IL_0122: Unknown result type (might be due to invalid IL or missing references) //IL_0128: Unknown result type (might be due to invalid IL or missing references) //IL_012d: Unknown result type (might be due to invalid IL or missing references) //IL_0132: Unknown result type (might be due to invalid IL or missing references) //IL_0139: Unknown result type (might be due to invalid IL or missing references) //IL_014c: Unknown result type (might be due to invalid IL or missing references) //IL_015c: Unknown result type (might be due to invalid IL or missing references) int num = <>1__state; SachaAI CS$<>8__locals0 = <>4__this; switch (num) { default: return false; case 0: <>1__state = -1; if ((Object)(object)((EnemyAI)CS$<>8__locals0).targetPlayer == (Object)null || Vector3.Distance(((Component)CS$<>8__locals0).transform.position, ((Component)((EnemyAI)CS$<>8__locals0).targetPlayer).transform.position) >= CS$<>8__locals0.idleDistance) { CS$<>8__locals0.switchBackToRoutineState(); return false; } CS$<>8__locals0.updateRotation = false; ((EnemyAI)CS$<>8__locals0).agent.speed = 4f; CS$<>8__locals0.tryAttackDelay = 0f; <distanceToPlayer>5__2 = Vector3.Distance(((Component)CS$<>8__locals0).transform.position, ((Component)((EnemyAI)CS$<>8__locals0).targetPlayer).transform.position); goto IL_018c; case 1: <>1__state = -1; goto IL_018c; case 2: { <>1__state = -1; CS$<>8__locals0.attackHitClientRpc(); CS$<>8__locals0.switchBackToRoutineState(); return false; } IL_018c: if (<distanceToPlayer>5__2 > 1f) { if (<distanceToPlayer>5__2 > CS$<>8__locals0.runDistance || CS$<>8__locals0.tryAttackDelay >= 6f) { CS$<>8__locals0.switchBackToRoutineState(); return false; } if ((Object)(object)((EnemyAI)CS$<>8__locals0).targetPlayer != (Object)null) { Vector3 val = ((Component)CS$<>8__locals0).transform.position - ((Component)((EnemyAI)CS$<>8__locals0).targetPlayer).transform.position; Vector3 normalized = ((Vector3)(ref val)).normalized; CS$<>8__locals0.targetPosition = ((Component)((EnemyAI)CS$<>8__locals0).targetPlayer).transform.position + normalized * 0.5f; ((EnemyAI)CS$<>8__locals0).SetDestinationToPosition(CS$<>8__locals0.targetPosition, false); <distanceToPlayer>5__2 = Vector3.Distance(((Component)CS$<>8__locals0).transform.position, ((Component)((EnemyAI)CS$<>8__locals0).targetPlayer).transform.position); <>2__current = null; <>1__state = 1; return true; } CS$<>8__locals0.switchBackToRoutineState(); return false; } CS$<>8__locals0.DoAnimationClientRpc("attack"); <>2__current = (object)new WaitUntil((Func<bool>)delegate { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Unknown result type (might be due to invalid IL or missing references) //IL_003d: 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_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) AnimatorStateInfo currentAnimatorStateInfo = ((EnemyAI)CS$<>8__locals0).creatureAnimator.GetCurrentAnimatorStateInfo(0); if (!((AnimatorStateInfo)(ref currentAnimatorStateInfo)).IsName("Hit")) { currentAnimatorStateInfo = ((EnemyAI)CS$<>8__locals0).creatureAnimator.GetCurrentAnimatorStateInfo(0); if (!((AnimatorStateInfo)(ref currentAnimatorStateInfo)).IsName("martelo")) { return true; } } currentAnimatorStateInfo = ((EnemyAI)CS$<>8__locals0).creatureAnimator.GetCurrentAnimatorStateInfo(0); return ((AnimatorStateInfo)(ref currentAnimatorStateInfo)).normalizedTime >= 1f; }); <>1__state = 2; return true; } } bool IEnumerator.MoveNext() { //ILSpy generated this explicit interface implementation from .override directive in MoveNext return this.MoveNext(); } [DebuggerHidden] void IEnumerator.Reset() { throw new NotSupportedException(); } } [CompilerGenerated] private sealed class <clap>d__59 : IEnumerator<object>, IEnumerator, IDisposable { private int <>1__state; private object <>2__current; public SachaAI <>4__this; object IEnumerator<object>.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public <clap>d__59(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { <>1__state = -2; } private bool MoveNext() { //IL_003f: Unknown result type (might be due to invalid IL or missing references) //IL_0049: Expected O, but got Unknown //IL_0071: Unknown result type (might be due to invalid IL or missing references) //IL_007b: Expected O, but got Unknown int num = <>1__state; SachaAI sachaAI = <>4__this; switch (num) { default: return false; case 0: <>1__state = -1; ((EnemyAI)sachaAI).agent.speed = 0f; <>2__current = (object)new WaitForSeconds(0.5f); <>1__state = 1; return true; case 1: <>1__state = -1; sachaAI.PlaySoundServerRpc(SoundCategory.Clap); sachaAI.DoAnimationClientRpc("clap"); <>2__current = (object)new WaitForSeconds(3f); <>1__state = 2; return true; case 2: <>1__state = -1; sachaAI.switchBackToRoutineState(); 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 Transform turnCompass; public Transform attackArea; public Transform view; public IKControl ik_Control; public AudioClip[] hi_SFX; public AudioClip[] clap_SFX; public AudioClip[] combat_SFX; public AudioClip[] attack_SFX; public AudioClip[] hit_SFX; public AudioClip[] randomSound_SFX; public AudioClip flee_SFX; public AudioClip song_SFX; public AudioClip stopTarget_SFX; private Transform farestNodeFromPos; private float timeSinceHittingLocalPlayer; private float attackDelay; private float attackedDelay; private float tryAttackDelay; private float randomSoundDelay; private bool isFirstEncounter; private bool helloDone; private Vector3 targetPosition; private Random enemyRandom; private bool isDeadAnimationDone; private float walkSpeed = 2f; private float runSpeed = 4f; private bool isWalking; private bool isRunning; private bool hasClaped; private float stamina = 10f; private float maxTargetDistance = 15f; private bool isStaminaFilling; private float runDistance = 7f; private float idleDistance = 4f; private float idleTolerance = 1f; private bool updateRotation = true; private bool isGoingBackward; [Conditional("DEBUG")] private void LogIfDebugBuild(string text) { Plugin.Logger.LogInfo((object)text); } public override void Start() { //IL_0076: Unknown result type (might be due to invalid IL or missing references) ((EnemyAI)this).Start(); base.creatureAnimator.applyRootMotion = false; timeSinceHittingLocalPlayer = 0f; isFirstEncounter = true; attackDelay = 0f; attackedDelay = 0f; tryAttackDelay = 0f; enemyRandom = new Random(StartOfRound.Instance.randomMapSeed + base.thisEnemyIndex); isDeadAnimationDone = false; base.currentBehaviourStateIndex = 0; ((EnemyAI)this).StartSearch(((Component)this).transform.position, (AISearchRoutine)null); } public override void Update() { //IL_0183: Unknown result type (might be due to invalid IL or missing references) //IL_0188: Unknown result type (might be due to invalid IL or missing references) //IL_01a2: 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_01c9: Unknown result type (might be due to invalid IL or missing references) //IL_01ce: Unknown result type (might be due to invalid IL or missing references) //IL_0155: Unknown result type (might be due to invalid IL or missing references) //IL_00e6: 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) //IL_010c: Unknown result type (might be due to invalid IL or missing references) //IL_011b: Unknown result type (might be due to invalid IL or missing references) //IL_0120: Unknown result type (might be due to invalid IL or missing references) //IL_0130: Unknown result type (might be due to invalid IL or missing references) ((EnemyAI)this).Update(); if (base.isEnemyDead) { if (!isDeadAnimationDone) { isDeadAnimationDone = true; base.creatureVoice.Stop(); base.creatureVoice.PlayOneShot(base.dieSFX); base.creatureSFX.Stop(); } return; } timeSinceHittingLocalPlayer += Time.deltaTime; attackDelay += Time.deltaTime; randomSoundDelay += Time.deltaTime; int currentBehaviourStateIndex = base.currentBehaviourStateIndex; switch (currentBehaviourStateIndex) { case 4: tryAttackDelay += Time.deltaTime; break; case 2: attackedDelay += Time.deltaTime; break; } if ((Object)(object)base.targetPlayer != (Object)null && currentBehaviourStateIndex != 4) { if (updateRotation) { turnCompass.LookAt(((Component)base.targetPlayer.gameplayCamera).transform.position); ((Component)this).transform.rotation = Quaternion.Lerp(((Component)this).transform.rotation, Quaternion.Euler(new Vector3(0f, turnCompass.eulerAngles.y, 0f)), 4f * Time.deltaTime); } ((Component)view).transform.position = ((Component)base.targetPlayer.gameplayCamera).transform.position; } if (base.stunNormalizedTimer > 0f) { base.agent.speed = 0f; } Vector3 velocity = base.agent.velocity; UpdateAnimationClientRpc(((Vector3)(ref velocity)).magnitude, isGoingBackward); velocity = base.agent.velocity; isRunning = ((Vector3)(ref velocity)).magnitude > walkSpeed + 0.1f; velocity = base.agent.velocity; isWalking = ((Vector3)(ref velocity)).magnitude > 0.1f && !isRunning; } public override void DoAIInterval() { //IL_0073: 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) //IL_0083: Unknown result type (might be due to invalid IL or missing references) //IL_0088: Unknown result type (might be due to invalid IL or missing references) //IL_008b: Unknown result type (might be due to invalid IL or missing references) //IL_0090: Unknown result type (might be due to invalid IL or missing references) //IL_0097: Unknown result type (might be due to invalid IL or missing references) //IL_009c: Unknown result type (might be due to invalid IL or missing references) ((EnemyAI)this).DoAIInterval(); if (!base.isEnemyDead && !StartOfRound.Instance.allPlayersDead) { switch (base.currentBehaviourStateIndex) { case 0: handleSearchingForPlayer(); break; case 1: handleFollowPlayer(); break; case 2: handleCombatState(); break; case 6: handleEmote(); break; } updateStamina(); Vector3 val = targetPosition - ((Component)this).transform.position; val = ((Vector3)(ref val)).normalized; float num = Vector3.Dot(((Component)this).transform.forward, val); isGoingBackward = num < 0f; } } private void handleSearchingForPlayer() { //IL_0097: Unknown result type (might be due to invalid IL or missing references) //IL_009c: Unknown result type (might be due to invalid IL or missing references) //IL_00a3: Unknown result type (might be due to invalid IL or missing references) base.agent.speed = walkSpeed; ik_Control.ikActive = false; if (FoundClosestPlayerInRange(maxTargetDistance, 3f)) { ik_Control.ikActive = true; if (isFirstEncounter) { isFirstEncounter = false; ((EnemyAI)this).SwitchToBehaviourClientRpc(7); ((MonoBehaviour)this).StartCoroutine(PlayHelloAndWait()); PlaySoundServerRpc(SoundCategory.Song); } else if (helloDone) { if (enemyRandom.Next(0, 3) == 0) { PlaySoundServerRpc(SoundCategory.Song); } ((EnemyAI)this).SwitchToBehaviourClientRpc(1); } targetPosition = ((Component)this).transform.position; ((EnemyAI)this).SetDestinationToPosition(targetPosition, false); ((EnemyAI)this).StopSearch(base.currentSearch, true); } else { TryPlayRandomSound(); } } private void handleCombatState() { if (!isPlayerStillTarget()) { return; } if (attackedDelay > 10f) { attackedDelay = 0f; base.creatureAnimator.SetBool("isCombat", false); ((EnemyAI)this).SwitchToBehaviourClientRpc(1); return; } base.creatureAnimator.SetBool("isMarteloAttack", false); if (!tryAttack(20)) { FollowPlayer(); } } private void handleFollowPlayer() { FoundClosestPlayerInRange(10f, 3f); if (isPlayerStillTarget()) { TryPlayRandomSound(); if (!reactToEmote() && !tryAttack(2000) && !tryDoRandomAnimation()) { FollowPlayer(); } } } private void handleRunAway() { //IL_0052: Unknown result type (might be due to invalid IL or missing references) //IL_002f: Unknown result type (might be due to invalid IL or missing references) //IL_003a: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)farestNodeFromPos == (Object)null) { ((EnemyAI)this).SwitchToBehaviourClientRpc(1); DoAnimationClientRpc("stopRunAway"); } else if (!TargetClosestPlayerInAnyCase() || Vector3.Distance(((Component)this).transform.position, farestNodeFromPos.position) <= 10f) { ((EnemyAI)this).StartSearch(((Component)this).transform.position, (AISearchRoutine)null); ((EnemyAI)this).SwitchToBehaviourClientRpc(0); DoAnimationClientRpc("stopRunAway"); updateRotation = true; ik_Control.ikActive = true; } } private void TryPlayRandomSound() { if (randomSoundDelay > 15f && !isVoiceSoundPlaying()) { randomSoundDelay = 0f; PlaySoundServerRpc(SoundCategory.Random); } } private bool isVoiceSoundPlaying() { return base.creatureVoice.isPlaying; } private bool isPlayerStillTarget() { //IL_0016: Unknown result type (might be due to invalid IL or missing references) //IL_0026: Unknown result type (might be due to invalid IL or missing references) //IL_0073: Unknown result type (might be due to invalid IL or missing references) //IL_0053: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)base.targetPlayer == (Object)null) { return false; } float num = Vector3.Distance(((Component)this).transform.position, ((Component)base.targetPlayer).transform.position); if (num > maxTargetDistance && (!TargetClosestPlayerInAnyCase() || !((EnemyAI)this).CheckLineOfSightForPosition(((Component)base.targetPlayer.gameplayCamera).transform.position, 45f, 60, -1f, (Transform)null))) { ((EnemyAI)this).StartSearch(((Component)this).transform.position, (AISearchRoutine)null); base.creatureAnimator.SetBool("isCombat", false); ((EnemyAI)this).SwitchToBehaviourClientRpc(0); PlaySoundServerRpc(SoundCategory.StopTarget); StopSong(); return false; } return true; } private void handleEmote() { //IL_0025: Unknown result type (might be due to invalid IL or missing references) //IL_0035: Unknown result type (might be due to invalid IL or missing references) FoundClosestPlayerInRange(10f, 3f); if ((Object)(object)base.targetPlayer != (Object)null) { float num = Vector3.Distance(((Component)this).transform.position, ((Component)base.targetPlayer).transform.position); if (num > runDistance || num < idleDistance - idleTolerance) { DoAnimationClientRpc("stopEmote"); switchBackToRoutineState(); } } else { switchBackToRoutineState(); } TryPlayRandomSound(); } private bool tryAttack(int chance) { if (attackDelay > 2f && enemyRandom.Next(0, chance) == 0) { attackDelay = 0f; ((EnemyAI)this).SwitchToBehaviourClientRpc(4); ((MonoBehaviour)this).StartCoroutine(attack()); return true; } return false; } private bool reactToEmote() { if (base.targetPlayer.performingEmote || base.targetPlayer.disableLookInput) { if (!hasClaped) { ((EnemyAI)this).SwitchToBehaviourClientRpc(8); ((MonoBehaviour)this).StartCoroutine(clap()); hasClaped = true; } } else { hasClaped = false; } return hasClaped; } private void updateStamina() { if (isRunning) { stamina -= 0.2f; if (stamina < 0f) { isStaminaFilling = true; } } else { stamina += 0.2f; if (stamina >= 10f) { isStaminaFilling = false; } } stamina = Mathf.Clamp(stamina, 0f, 10f); } private bool hasStamina() { if (stamina > 0f) { return !isStaminaFilling; } return false; } private bool FoundClosestPlayerInRange(float range, float senseRange) { //IL_0049: Unknown result type (might be due to invalid IL or missing references) //IL_0059: Unknown result type (might be due to invalid IL or missing references) ((EnemyAI)this).TargetClosestPlayer(1.5f, true, 70f); if ((Object)(object)base.targetPlayer == (Object)null) { ((EnemyAI)this).TargetClosestPlayer(1.5f, false, 70f); range = senseRange; } if ((Object)(object)base.targetPlayer != (Object)null) { return Vector3.Distance(((Component)this).transform.position, ((Component)base.targetPlayer).transform.position) < range; } return false; } private bool TargetClosestPlayerInAnyCase() { //IL_001d: Unknown result type (might be due to invalid IL or missing references) //IL_0033: Unknown result type (might be due to invalid IL or missing references) base.mostOptimalDistance = 2000f; base.targetPlayer = null; for (int i = 0; i < StartOfRound.Instance.connectedPlayersAmount + 1; i++) { base.tempDist = Vector3.Distance(((Component)this).transform.position, ((Component)StartOfRound.Instance.allPlayerScripts[i]).transform.position); if (base.tempDist < base.mostOptimalDistance) { base.mostOptimalDistance = base.tempDist; base.targetPlayer = StartOfRound.Instance.allPlayerScripts[i]; } } if ((Object)(object)base.targetPlayer == (Object)null) { return false; } return true; } private void FollowPlayer() { //IL_001d: Unknown result type (might be due to invalid IL or missing references) //IL_002d: Unknown result type (might be due to invalid IL or missing references) //IL_00b4: Unknown result type (might be due to invalid IL or missing references) //IL_00b9: 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_00fc: Unknown result type (might be due to invalid IL or missing references) //IL_0101: Unknown result type (might be due to invalid IL or missing references) //IL_0106: 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_011d: Unknown result type (might be due to invalid IL or missing references) //IL_0122: Unknown result type (might be due to invalid IL or missing references) //IL_0127: Unknown result type (might be due to invalid IL or missing references) //IL_012b: Unknown result type (might be due to invalid IL or missing references) //IL_0130: Unknown result type (might be due to invalid IL or missing references) //IL_0138: Unknown result type (might be due to invalid IL or missing references) //IL_013d: Unknown result type (might be due to invalid IL or missing references) //IL_0143: Unknown result type (might be due to invalid IL or missing references) //IL_0148: Unknown result type (might be due to invalid IL or missing references) //IL_014d: Unknown result type (might be due to invalid IL or missing references) //IL_0154: Unknown result type (might be due to invalid IL or missing references) //IL_0088: Unknown result type (might be due to invalid IL or missing references) //IL_008d: Unknown result type (might be due to invalid IL or missing references) if (!((Object)(object)base.targetPlayer == (Object)null) && ((NetworkBehaviour)this).IsOwner) { float distance = Vector3.Distance(((Component)this).transform.position, ((Component)base.targetPlayer).transform.position); switch (GetMovementMode(distance)) { case MovementMode.Run: base.agent.speed = (hasStamina() ? runSpeed : walkSpeed); targetPosition = ((Component)base.targetPlayer).transform.position; break; case MovementMode.Walk: base.agent.speed = walkSpeed; targetPosition = ((Component)base.targetPlayer).transform.position; break; case MovementMode.Idle: base.agent.speed = 0f; break; case MovementMode.Backup: { base.agent.speed = walkSpeed; Vector3 val = ((Component)base.targetPlayer).transform.position - ((Component)this).transform.position; Vector3 val2 = ((Component)this).transform.position - ((Component)base.targetPlayer).transform.position; Vector3 normalized = ((Vector3)(ref val2)).normalized; targetPosition = ((Component)this).transform.position + normalized * 2f; break; } } ((EnemyAI)this).SetDestinationToPosition(targetPosition, false); } } [IteratorStateMachine(typeof(<clap>d__59))] private IEnumerator clap() { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new <clap>d__59(0) { <>4__this = this }; } [IteratorStateMachine(typeof(<PlayHelloAndWait>d__60))] private IEnumerator PlayHelloAndWait() { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new <PlayHelloAndWait>d__60(0) { <>4__this = this }; } [IteratorStateMachine(typeof(<attack>d__61))] private IEnumerator attack() { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new <attack>d__61(0) { <>4__this = this }; } [IteratorStateMachine(typeof(<TakeHit>d__62))] private IEnumerator TakeHit(int force) { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new <TakeHit>d__62(0) { <>4__this = this, force = force }; } private void switchBackToRoutineState() { base.agent.speed = walkSpeed; if ((Object)(object)base.targetPlayer != (Object)null) { updateRotation = true; if (attackedDelay != 0f) { ((EnemyAI)this).SwitchToBehaviourClientRpc(2); } else { ((EnemyAI)this).SwitchToBehaviourClientRpc(1); } } else { ((EnemyAI)this).SwitchToBehaviourClientRpc(0); } } private bool IsPlayerLookingAtEnemy() { //IL_0016: Unknown result type (might be due to invalid IL or missing references) //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_0035: Unknown result type (might be due to invalid IL or missing references) //IL_0038: Unknown result type (might be due to invalid IL or missing references) //IL_003d: Unknown result type (might be due to invalid IL or missing references) //IL_004e: Unknown result type (might be due to invalid IL or missing references) //IL_0053: Unknown result type (might be due to invalid IL or missing references) //IL_0073: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)base.targetPlayer == (Object)null) { return false; } Vector3 val = ((Component)this).transform.position - ((Component)base.targetPlayer.gameplayCamera).transform.position; Vector3 normalized = ((Vector3)(ref val)).normalized; float num = Vector3.Dot(((Component)base.targetPlayer.gameplayCamera).transform.forward, normalized); if (num > 0.5f) { return ((EnemyAI)this).CheckLineOfSightForPosition(((Component)base.targetPlayer.gameplayCamera).transform.position, 45f, 60, -1f, (Transform)null); } return false; } public override void OnCollideWithPlayer(Collider other) { //IL_007f: Unknown result type (might be due to invalid IL or missing references) //IL_0085: Unknown result type (might be due to invalid IL or missing references) if (timeSinceHittingLocalPlayer < 1f || base.currentBehaviourStateIndex == 3 || base.currentBehaviourStateIndex == 4) { return; } PlayerControllerB val = ((EnemyAI)this).MeetsStandardPlayerCollisionConditions(other, false, false); if ((Object)(object)val != (Object)null) { if (base.currentBehaviourStateIndex == 6) { DoAnimationClientRpc("stopEmote"); } timeSinceHittingLocalPlayer = 0f; base.creatureAnimator.SetBool("isMarteloAttack", false); DoAnimationClientRpc("attack"); PlaySoundServerRpc(SoundCategory.Attack); val.DamagePlayer(25, true, true, (CauseOfDeath)0, 0, false, default(Vector3)); switchBackToRoutineState(); } } public override void HitEnemy(int force = 1, PlayerControllerB? playerWhoHit = null, bool playHitSFX = false, int hitID = -1) { ((EnemyAI)this).HitEnemy(force, playerWhoHit, playHitSFX, hitID); if (base.isEnemyDead) { return; } base.enemyHP -= force; if (((NetworkBehaviour)this).IsOwner) { if (base.enemyHP <= 0 && !base.isEnemyDead) { ((MonoBehaviour)this).StopCoroutine(attack()); ((MonoBehaviour)this).StopCoroutine(TakeHit(force)); ((MonoBehaviour)this).StopCoroutine(base.searchCoroutine); ik_Control.ikActive = false; ((EnemyAI)this).KillEnemyOnOwnerClient(false); } else { ((MonoBehaviour)this).StartCoroutine(TakeHit(force)); } } } private bool tryDoRandomAnimation() { if (enemyRandom.Next(0, 600) == 0) { base.creatureAnimator.SetInteger("randomEmote", enemyRandom.Next(0, 4)); DoAnimationClientRpc("startEmote"); ((EnemyAI)this).SwitchToBehaviourClientRpc(6); base.agent.speed = 0f; return true; } return false; } [ClientRpc] public void DoAnimationClientRpc(string animationName) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_00ca: Unknown result type (might be due to invalid IL or missing references) //IL_00d4: Invalid comparison between Unknown and I4 //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_006d: Unknown result type (might be due to invalid IL or missing references) //IL_0088: Unknown result type (might be due to invalid IL or missing references) //IL_008e: Unknown result type (might be due to invalid IL or missing references) //IL_00ba: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager; if (networkManager == null || !networkManager.IsListening) { return; } if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 2 && (networkManager.IsServer || networkManager.IsHost)) { ClientRpcParams val = default(ClientRpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(1641506680u, val, (RpcDelivery)0); bool flag = animationName != null; ((FastBufferWriter)(ref val2)).WriteValueSafe<bool>(ref flag, default(ForPrimitives)); if (flag) { ((FastBufferWriter)(ref val2)).WriteValueSafe(animationName, false); } ((NetworkBehaviour)this).__endSendClientRpc(ref val2, 1641506680u, val, (RpcDelivery)0); } if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 2 && (networkManager.IsClient || networkManager.IsHost)) { base.creatureAnimator.SetTrigger(animationName); } } [ClientRpc] public void UpdateAnimationClientRpc(float speed, bool isGoingBackward) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_00c2: Unknown result type (might be due to invalid IL or missing references) //IL_00cc: Invalid comparison between Unknown and I4 //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_006d: Unknown result type (might be due to invalid IL or missing references) //IL_007d: Unknown result type (might be due to invalid IL or missing references) //IL_0083: 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) //IL_009e: Unknown result type (might be due to invalid IL or missing references) //IL_00b2: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager; if (networkManager != null && networkManager.IsListening) { if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 2 && (networkManager.IsServer || networkManager.IsHost)) { ClientRpcParams val = default(ClientRpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(3827431406u, val, (RpcDelivery)0); ((FastBufferWriter)(ref val2)).WriteValueSafe<float>(ref speed, default(ForPrimitives)); ((FastBufferWriter)(ref val2)).WriteValueSafe<bool>(ref isGoingBackward, default(ForPrimitives)); ((NetworkBehaviour)this).__endSendClientRpc(ref val2, 3827431406u, val, (RpcDelivery)0); } if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 2 && (networkManager.IsClient || networkManager.IsHost)) { base.creatureAnimator.SetFloat("speed", speed); base.creatureAnimator.SetBool("goBackward", isGoingBackward); } } } [ClientRpc] public void attackHitClientRpc() { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_008c: Unknown result type (might be due to invalid IL or missing references) //IL_0096: Invalid comparison between Unknown and I4 //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_006d: Unknown result type (might be due to invalid IL or missing references) //IL_007c: Unknown result type (might be due to invalid IL or missing references) //IL_00ca: Unknown result type (might be due to invalid IL or missing references) //IL_00d5: 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_0120: Unknown result type (might be due to invalid IL or missing references) //IL_0126: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager; if (networkManager == null || !networkManager.IsListening) { return; } if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 2 && (networkManager.IsServer || networkManager.IsHost)) { ClientRpcParams val = default(ClientRpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(2977610776u, val, (RpcDelivery)0); ((NetworkBehaviour)this).__endSendClientRpc(ref val2, 2977610776u, val, (RpcDelivery)0); } if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 2 || (!networkManager.IsClient && !networkManager.IsHost)) { return; } PlaySoundServerRpc(SoundCategory.Attack); int num = 8; Collider[] array = Physics.OverlapBox(attackArea.position, attackArea.localScale, Quaternion.identity, num); if (array.Length == 0) { return; } Collider[] array2 = array; foreach (Collider val3 in array2) { PlayerControllerB val4 = ((EnemyAI)this).MeetsStandardPlayerCollisionConditions(val3, false, false); if ((Object)(object)val4 != (Object)null) { timeSinceHittingLocalPlayer = 0f; val4.DamagePlayer(5, true, true, (CauseOfDeath)0, 0, false, default(Vector3)); } } } private MovementMode GetMovementMode(float distance) { if (distance > runDistance) { return MovementMode.Run; } if (distance > idleDistance + idleTolerance) { return MovementMode.Walk; } if (distance < idleDistance - idleTolerance) { return MovementMode.Backup; } return MovementMode.Idle; } [ServerRpc(RequireOwnership = false)] public void PlaySoundServerRpc(SoundCategory category) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_00a7: Unknown result type (might be due to invalid IL or missing references) //IL_00b1: Invalid comparison between Unknown and I4 //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_006d: Unknown result type (might be due to invalid IL or missing references) //IL_007d: Unknown result type (might be due to invalid IL or missing references) //IL_0083: Unknown result type (might be due to invalid IL or missing references) //IL_0097: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager; if (networkManager == null || !networkManager.IsListening) { return; } if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1 && (networkManager.IsClient || networkManager.IsHost)) { ServerRpcParams val = default(ServerRpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendServerRpc(347440875u, val, (RpcDelivery)0); ((FastBufferWriter)(ref val2)).WriteValueSafe<SoundCategory>(ref category, default(ForEnums)); ((NetworkBehaviour)this).__endSendServerRpc(ref val2, 347440875u, val, (RpcDelivery)0); } if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost)) { int index = 0; bool useVoice = true; switch (category) { case SoundCategory.Clap: index = Random.Range(0, clap_SFX.Length); break; case SoundCategory.Combat: index = Random.Range(0, combat_SFX.Length); break; case SoundCategory.Attack: index = Random.Range(0, attack_SFX.Length); break; case SoundCategory.Hit: index = Random.Range(0, hit_SFX.Length); break; case SoundCategory.Random: index = Random.Range(0, randomSound_SFX.Length); break; case SoundCategory.Flee: index = 0; break; case SoundCategory.Song: index = 0; useVoice = false; break; case SoundCategory.StopTarget: index = 0; break; } PlaySoundClientRpc(category, index, useVoice); } } [ClientRpc] private void PlaySoundClientRpc(SoundCategory category, int index, bool useVoice) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_00cf: Unknown result type (might be due to invalid IL or missing references) //IL_00d9: Invalid comparison between Unknown and I4 //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_006d: Unknown result type (might be due to invalid IL or missing references) //IL_007d: Unknown result type (might be due to invalid IL or missing references) //IL_0083: Unknown result type (might be due to invalid IL or missing references) //IL_008c: Unknown result type (might be due to invalid IL or missing references) //IL_00a5: Unknown result type (might be due to invalid IL or missing references) //IL_00ab: Unknown result type (might be due to invalid IL or missing references) //IL_00bf: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager; if (networkManager == null || !networkManager.IsListening) { return; } if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 2 && (networkManager.IsServer || networkManager.IsHost)) { ClientRpcParams val = default(ClientRpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(2136651053u, val, (RpcDelivery)0); ((FastBufferWriter)(ref val2)).WriteValueSafe<SoundCategory>(ref category, default(ForEnums)); BytePacker.WriteValueBitPacked(val2, index); ((FastBufferWriter)(ref val2)).WriteValueSafe<bool>(ref useVoice, default(ForPrimitives)); ((NetworkBehaviour)this).__endSendClientRpc(ref val2, 2136651053u, val, (RpcDelivery)0); } if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 2 && (networkManager.IsClient || networkManager.IsHost)) { AudioClip clip = GetClip(category, index); if (!((Object)(object)clip == (Object)null)) { AudioSource val3 = (useVoice ? base.creatureVoice : base.creatureSFX); val3.Stop(); val3.PlayOneShot(clip); } } } private AudioClip? GetClip(SoundCategory category, int index) { switch (category) { case SoundCategory.Clap: if (clap_SFX.Length == 0) { return null; } return clap_SFX[index]; case SoundCategory.Combat: if (combat_SFX.Length == 0) { return null; } return combat_SFX[index]; case SoundCategory.Attack: if (attack_SFX.Length == 0) { return null; } return attack_SFX[index]; case SoundCategory.Hit: if (hit_SFX.Length == 0) { return null; } return hit_SFX[index]; case SoundCategory.Hello: if (hi_SFX.Length == 0) { return null; } return hi_SFX[index]; case SoundCategory.Random: if (randomSound_SFX.Length == 0) { return null; } return randomSound_SFX[index]; case SoundCategory.Flee: return flee_SFX; case SoundCategory.Song: return song_SFX; case SoundCategory.StopTarget: return stopTarget_SFX; default: return null; } } private void StopSong() { base.creatureSFX.Stop(); } protected override void __initializeVariables() { ((EnemyAI)this).__initializeVariables(); } [RuntimeInitializeOnLoadMethod] internal static void InitializeRPCS_SachaAI() { //IL_0011: Unknown result type (might be due to invalid IL or missing references) //IL_001b: Expected O, but got Unknown //IL_002c: Unknown result type (might be due to invalid IL or missing references) //IL_0036: Expected O, but got Unknown //IL_0047: Unknown result type (might be due to invalid IL or missing references) //IL_0051: Expected O, but got Unknown //IL_0062: Unknown result type (might be due to invalid IL or missing references) //IL_006c: Expected O, but got Unknown //IL_007d: Unknown result type (might be due to invalid IL or missing references) //IL_0087: Expected O, but got Unknown NetworkManager.__rpc_func_table.Add(1641506680u, new RpcReceiveHandler(__rpc_handler_1641506680)); NetworkManager.__rpc_func_table.Add(3827431406u, new RpcReceiveHandler(__rpc_handler_3827431406)); NetworkManager.__rpc_func_table.Add(2977610776u, new RpcReceiveHandler(__rpc_handler_2977610776)); NetworkManager.__rpc_func_table.Add(347440875u, new RpcReceiveHandler(__rpc_handler_347440875)); NetworkManager.__rpc_func_table.Add(2136651053u, new RpcReceiveHandler(__rpc_handler_2136651053)); } private static void __rpc_handler_1641506680(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams) { //IL_002f: Unknown result type (might be due to invalid IL or missing references) //IL_0035: Unknown result type (might be due to invalid IL or missing references) //IL_0061: Unknown result type (might be due to invalid IL or missing references) //IL_007b: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = target.NetworkManager; if (networkManager != null && networkManager.IsListening) { bool flag = default(bool); ((FastBufferReader)(ref reader)).ReadValueSafe<bool>(ref flag, default(ForPrimitives)); string animationName = null; if (flag) { ((FastBufferReader)(ref reader)).ReadValueSafe(ref animationName, false); } target.__rpc_exec_stage = (__RpcExecStage)2; ((SachaAI)(object)target).DoAnimationClientRpc(animationName); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_3827431406(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams) { //IL_002f: Unknown result type (might be due to invalid IL or missing references) //IL_0035: Unknown result type (might be due to invalid IL or missing references) //IL_004a: Unknown result type (might be due to invalid IL or missing references) //IL_0050: Unknown result type (might be due to invalid IL or missing references) //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_007d: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = target.NetworkManager; if (networkManager != null && networkManager.IsListening) { float speed = default(float); ((FastBufferReader)(ref reader)).ReadValueSafe<float>(ref speed, default(ForPrimitives)); bool flag = default(bool); ((FastBufferReader)(ref reader)).ReadValueSafe<bool>(ref flag, default(ForPrimitives)); target.__rpc_exec_stage = (__RpcExecStage)2; ((SachaAI)(object)target).UpdateAnimationClientRpc(speed, flag); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_2977610776(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams) { //IL_0029: Unknown result type (might be due to invalid IL or missing references) //IL_003f: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = target.NetworkManager; if (networkManager != null && networkManager.IsListening) { target.__rpc_exec_stage = (__RpcExecStage)2; ((SachaAI)(object)target).attackHitClientRpc(); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_347440875(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams) { //IL_002f: Unknown result type (might be due to invalid IL or missing references) //IL_0035: Unknown result type (might be due to invalid IL or missing references) //IL_0044: Unknown result type (might be due to invalid IL or missing references) //IL_005e: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = target.NetworkManager; if (networkManager != null && networkManager.IsListening) { SoundCategory category = default(SoundCategory); ((FastBufferReader)(ref reader)).ReadValueSafe<SoundCategory>(ref category, default(ForEnums)); target.__rpc_exec_stage = (__RpcExecStage)1; ((SachaAI)(object)target).PlaySoundServerRpc(category); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_2136651053(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams) { //IL_002f: Unknown result type (might be due to invalid IL or missing references) //IL_0035: Unknown result type (might be due to invalid IL or missing references) //IL_003e: Unknown result type (might be due to invalid IL or missing references) //IL_0057: Unknown result type (might be due to invalid IL or missing references) //IL_005d: Unknown result type (might be due to invalid IL or missing references) //IL_006c: Unknown result type (might be due to invalid IL or missing references) //IL_008e: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = target.NetworkManager; if (networkManager != null && networkManager.IsListening) { SoundCategory category = default(SoundCategory); ((FastBufferReader)(ref reader)).ReadValueSafe<SoundCategory>(ref category, default(ForEnums)); int index = default(int); ByteUnpacker.ReadValueBitPacked(reader, ref index); bool useVoice = default(bool); ((FastBufferReader)(ref reader)).ReadValueSafe<bool>(ref useVoice, default(ForPrimitives)); target.__rpc_exec_stage = (__RpcExecStage)2; ((SachaAI)(object)target).PlaySoundClientRpc(category, index, useVoice); target.__rpc_exec_stage = (__RpcExecStage)0; } } protected internal override string __getTypeName() { return "SachaAI"; } } public static class PluginInfo { public const string PLUGIN_GUID = "NBPCSDC.Sacha_Mod"; public const string PLUGIN_NAME = "Sacha_Mod"; public const string PLUGIN_VERSION = "1.1.0"; } } namespace Sacha_Mod.Configuration { public class PluginConfig { public ConfigEntry<int> SpawnWeight; public PluginConfig(ConfigFile cfg) { SpawnWeight = cfg.Bind<int>("General", "Spawn weight", 20, "The spawn chance weight for Sacha_Mod, relative to other existing enemies.\nGoes up from 0, lower is more rare, 100 and up is very common."); ClearUnusedEntries(cfg); } private void ClearUnusedEntries(ConfigFile cfg) { PropertyInfo property = ((object)cfg).GetType().GetProperty("OrphanedEntries", BindingFlags.Instance | BindingFlags.NonPublic); Dictionary<ConfigDefinition, string> dictionary = (Dictionary<ConfigDefinition, string>)property.GetValue(cfg, null); dictionary.Clear(); cfg.Save(); } } } namespace NBPCSDC.Sacha_Mod.NetcodePatcher { [AttributeUsage(AttributeTargets.Module)] internal class NetcodePatchedAssemblyAttribute : Attribute { } }