Decompiled source of MelsEnemyPack v1.0.7
plugins/MelsEnemyPack/MelsEnemyPack.dll
Decompiled 4 months ago
The result has been truncated due to the large size, download it to view full contents!
using 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 HarmonyLib; using LethalLib.Modules; using MelsEnemyPack.NetcodePatcher; using Microsoft.CodeAnalysis; using Unity.Netcode; using UnityEngine; using UnityEngine.AI; [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("MelsEnemyPack")] [assembly: AssemblyConfiguration("Release")] [assembly: AssemblyDescription("Mels enemies for Lethal Company.")] [assembly: AssemblyFileVersion("1.0.7.0")] [assembly: AssemblyInformationalVersion("1.0.7")] [assembly: AssemblyProduct("MelsEnemyPack")] [assembly: AssemblyTitle("MelsEnemyPack")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.0.7.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.Module, AllowMultiple = false, Inherited = false)] internal sealed class RefSafetyRulesAttribute : Attribute { public readonly int Version; public RefSafetyRulesAttribute(int P_0) { Version = P_0; } } } namespace MelsEnemyPack { internal class ExampleEnemeyAI : EnemyAI { private enum State { SearchingForPlayer, StickingInFrontOfPlayer, HeadSwingAttackInProgress } public Transform turnCompass; public Transform attackArea; public AISearchRoutine scoutingSearchRoutine; private float timeSinceHittingLocalPlayer; private float timeSinceNewRandPos; private Vector3 positionRandomness; private Vector3 StalkPos; private Random enemyRandom; private bool isDeadAnimationDone; private void LogIfDebugBuild(string text) { } public override void Start() { //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) ((EnemyAI)this).Start(); LogIfDebugBuild("Example Enemy Spawned"); timeSinceHittingLocalPlayer = 0f; base.creatureAnimator.SetTrigger("startWalk"); timeSinceNewRandPos = 0f; positionRandomness = new Vector3(0f, 0f, 0f); enemyRandom = new Random(StartOfRound.Instance.randomMapSeed + base.thisEnemyIndex); isDeadAnimationDone = false; base.currentBehaviourStateIndex = 0; } public override void Update() { //IL_00ad: Unknown result type (might be due to invalid IL or missing references) //IL_00c3: Unknown result type (might be due to invalid IL or missing references) //IL_00d3: 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_00f7: Unknown result type (might be due to invalid IL or missing references) ((EnemyAI)this).Update(); if (base.isEnemyDead) { if (!isDeadAnimationDone) { LogIfDebugBuild("Stopping enemy voice with janky code."); isDeadAnimationDone = true; base.creatureVoice.Stop(); base.creatureVoice.PlayOneShot(base.dieSFX); } return; } timeSinceHittingLocalPlayer += Time.deltaTime; timeSinceNewRandPos += Time.deltaTime; if ((Object)(object)base.targetPlayer != (Object)null && ((EnemyAI)this).PlayerIsTargetable(base.targetPlayer, false, false) && !scoutingSearchRoutine.inProgress) { 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); } if (base.stunNormalizedTimer > 0f) { base.agent.speed = 0f; } } public override void DoAIInterval() { ((EnemyAI)this).DoAIInterval(); if (!base.isEnemyDead && !StartOfRound.Instance.allPlayersDead) { KeepSearchingForPlayerUnlessInRange(25f, ref scoutingSearchRoutine); switch (base.currentBehaviourStateIndex) { case 0: base.agent.speed = 3f; break; case 1: base.agent.speed = 5f; StickingInFrontOfPlayer(); break; default: LogIfDebugBuild("This Behavior State doesn't exist!"); break; case 2: break; } } } private void KeepSearchingForPlayerUnlessInRange(float range, ref AISearchRoutine routine) { //IL_0026: 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_0083: Unknown result type (might be due to invalid IL or missing references) ((EnemyAI)this).TargetClosestPlayer(1.5f, false, 70f); if ((Object)(object)base.targetPlayer != (Object)null && Vector3.Distance(((Component)this).transform.position, ((Component)base.targetPlayer).transform.position) <= range) { if (routine.inProgress) { LogIfDebugBuild("Start Target Player"); ((EnemyAI)this).StopSearch(routine, true); ((EnemyAI)this).SwitchToBehaviourClientRpc(1); } } else if (!routine.inProgress) { LogIfDebugBuild("Stop Target Player"); ((EnemyAI)this).StartSearch(((Component)this).transform.position, routine); ((EnemyAI)this).SwitchToBehaviourClientRpc(0); } } private void StickingInFrontOfPlayer() { //IL_0074: Unknown result type (might be due to invalid IL or missing references) //IL_0079: Unknown result type (might be due to invalid IL or missing references) //IL_008a: 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_00ae: Unknown result type (might be due to invalid IL or missing references) //IL_00b3: Unknown result type (might be due to invalid IL or missing references) //IL_00b8: Unknown result type (might be due to invalid IL or missing references) //IL_00be: Unknown result type (might be due to invalid IL or missing references) //IL_00c3: Unknown result type (might be due to invalid IL or missing references) //IL_00c8: Unknown result type (might be due to invalid IL or missing references) //IL_00cf: Unknown result type (might be due to invalid IL or missing references) if (!((Object)(object)base.targetPlayer == (Object)null) && ((NetworkBehaviour)this).IsOwner && timeSinceNewRandPos > 0.7f) { timeSinceNewRandPos = 0f; if (enemyRandom.Next(0, 5) == 0) { ((MonoBehaviour)this).StartCoroutine(SwingAttack()); } else { positionRandomness = new Vector3((float)enemyRandom.Next(-2, 2), 0f, (float)enemyRandom.Next(-2, 2)); StalkPos = ((Component)base.targetPlayer).transform.position - Vector3.Scale(new Vector3(-5f, 0f, -5f), ((Component)base.targetPlayer).transform.forward) + positionRandomness; } ((EnemyAI)this).SetDestinationToPosition(StalkPos, false); } } private IEnumerator SwingAttack() { ((EnemyAI)this).SwitchToBehaviourClientRpc(2); StalkPos = ((Component)base.targetPlayer).transform.position; ((EnemyAI)this).SetDestinationToPosition(StalkPos, false); yield return (object)new WaitForSeconds(0.5f); if (!base.isEnemyDead) { DoAnimationClientRpc("swingAttack"); yield return (object)new WaitForSeconds(0.24f); SwingAttackHitClientRpc(); if (base.currentBehaviourStateIndex == 2) { ((EnemyAI)this).SwitchToBehaviourClientRpc(1); } } } public override void OnCollideWithPlayer(Collider other) { //IL_0041: 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) if (!(timeSinceHittingLocalPlayer < 1f)) { PlayerControllerB val = ((EnemyAI)this).MeetsStandardPlayerCollisionConditions(other, false, false); if ((Object)(object)val != (Object)null) { LogIfDebugBuild("Example Enemy Collision with Player!"); timeSinceHittingLocalPlayer = 0f; val.DamagePlayer(20, true, true, (CauseOfDeath)0, 0, false, default(Vector3)); } } } public override void HitEnemy(int force = 1, PlayerControllerB playerWhoHit = null, bool playHitSFX = false, int hitID = -1) { ((EnemyAI)this).HitEnemy(force, playerWhoHit, playHitSFX, -1); if (!base.isEnemyDead) { base.enemyHP -= force; if (((NetworkBehaviour)this).IsOwner && base.enemyHP <= 0 && !base.isEnemyDead) { ((MonoBehaviour)this).StopCoroutine(SwingAttack()); ((EnemyAI)this).KillEnemyOnOwnerClient(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(2216770801u, 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, 2216770801u, val, (RpcDelivery)0); } if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 2 && (networkManager.IsClient || networkManager.IsHost)) { LogIfDebugBuild("Animation: " + animationName); base.creatureAnimator.SetTrigger(animationName); } } [ClientRpc] public void SwingAttackHitClientRpc() { //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_00ce: Unknown result type (might be due to invalid IL or missing references) //IL_00d9: Unknown result type (might be due to invalid IL or missing references) //IL_00de: 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_0136: 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(2322635522u, val, (RpcDelivery)0); ((NetworkBehaviour)this).__endSendClientRpc(ref val2, 2322635522u, val, (RpcDelivery)0); } if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 2 || (!networkManager.IsClient && !networkManager.IsHost)) { return; } LogIfDebugBuild("SwingAttackHitClientRPC"); 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) { LogIfDebugBuild("Swing attack hit player!"); timeSinceHittingLocalPlayer = 0f; val4.DamagePlayer(40, true, true, (CauseOfDeath)0, 0, false, default(Vector3)); } } } protected override void __initializeVariables() { ((EnemyAI)this).__initializeVariables(); } [RuntimeInitializeOnLoadMethod] internal static void InitializeRPCS_ExampleEnemeyAI() { //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(2216770801u, new RpcReceiveHandler(__rpc_handler_2216770801)); NetworkManager.__rpc_func_table.Add(2322635522u, new RpcReceiveHandler(__rpc_handler_2322635522)); } private static void __rpc_handler_2216770801(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; ((ExampleEnemeyAI)(object)target).DoAnimationClientRpc(animationName); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_2322635522(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; ((ExampleEnemeyAI)(object)target).SwingAttackHitClientRpc(); target.__rpc_exec_stage = (__RpcExecStage)0; } } protected internal override string __getTypeName() { return "ExampleEnemeyAI"; } } internal class LegSolver : MonoBehaviour { [SerializeField] private LayerMask terrainLayer; [SerializeField] private Transform body; [SerializeField] private LegSolver otherFoot; [SerializeField] private float speed = 1f; [SerializeField] private float stepDistance = 4f; [SerializeField] private float stepLength = 4f; [SerializeField] private float stepHeight = 1f; [SerializeField] private Vector3 footOffset; private float footSpacing; private Vector3 oldPosition; private Vector3 currentPosition; private Vector3 newPosition; private Vector3 oldNormal; private Vector3 currentNormal; private Vector3 newNormal; private float lerp; private void Start() { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_001f: 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_0025: 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_002b: Unknown result type (might be due to invalid IL or missing references) //IL_002c: 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_002e: 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_0034: 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_0048: Unknown result type (might be due to invalid IL or missing references) //IL_0049: 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_004f: 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_0051: 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_0057: Unknown result type (might be due to invalid IL or missing references) footSpacing = ((Component)this).transform.localPosition.x; currentPosition = (newPosition = (oldPosition = ((Component)this).transform.position)); currentNormal = (newNormal = (oldNormal = ((Component)this).transform.up)); lerp = 1f; } private void Update() { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_0018: Unknown result type (might be due to invalid IL or missing references) //IL_0028: 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_0043: Unknown result type (might be due to invalid IL or missing references) //IL_0048: 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_006f: Unknown result type (might be due to invalid IL or missing references) //IL_0076: Unknown result type (might be due to invalid IL or missing references) //IL_01b9: Unknown result type (might be due to invalid IL or missing references) //IL_01be: Unknown result type (might be due to invalid IL or missing references) //IL_01c5: Unknown result type (might be due to invalid IL or missing references) //IL_01ca: Unknown result type (might be due to invalid IL or missing references) //IL_013f: Unknown result type (might be due to invalid IL or missing references) //IL_0145: Unknown result type (might be due to invalid IL or missing references) //IL_0150: 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_017a: Unknown result type (might be due to invalid IL or missing references) //IL_017b: Unknown result type (might be due to invalid IL or missing references) //IL_0182: 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_0193: Unknown result type (might be due to invalid IL or missing references) //IL_0198: Unknown result type (might be due to invalid IL or missing references) //IL_00be: Unknown result type (might be due to invalid IL or missing references) //IL_00c3: Unknown result type (might be due to invalid IL or missing references) //IL_00d4: Unknown result type (might be due to invalid IL or missing references) //IL_00d9: 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_00f8: 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_010a: Unknown result type (might be due to invalid IL or missing references) //IL_010f: Unknown result type (might be due to invalid IL or missing references) //IL_0115: Unknown result type (might be due to invalid IL or missing references) //IL_011a: Unknown result type (might be due to invalid IL or missing references) //IL_011f: 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_012c: Unknown result type (might be due to invalid IL or missing references) ((Component)this).transform.position = currentPosition; ((Component)this).transform.up = currentNormal; RaycastHit val = default(RaycastHit); if (Physics.Raycast(new Ray(body.position + body.right * footSpacing, Vector3.down), ref val, 10f, ((LayerMask)(ref terrainLayer)).value) && Vector3.Distance(newPosition, ((RaycastHit)(ref val)).point) > stepDistance && !otherFoot.IsMoving() && lerp >= 1f) { lerp = 0f; int num = ((body.InverseTransformPoint(((RaycastHit)(ref val)).point).z > body.InverseTransformPoint(newPosition).z) ? 1 : (-1)); newPosition = ((RaycastHit)(ref val)).point + body.forward * stepLength * (float)num + footOffset; newNormal = ((RaycastHit)(ref val)).normal; } if (lerp < 1f) { Vector3 val2 = Vector3.Lerp(oldPosition, newPosition, lerp); val2.y += Mathf.Sin(lerp * MathF.PI) * stepHeight; currentPosition = val2; currentNormal = Vector3.Lerp(oldNormal, newNormal, lerp); lerp += Time.deltaTime * speed; } else { oldPosition = newPosition; oldNormal = newNormal; } } private void OnDrawGizmos() { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_000b: Unknown result type (might be due to invalid IL or missing references) Gizmos.color = Color.red; Gizmos.DrawSphere(newPosition, 0.5f); } public bool IsMoving() { return lerp < 1f; } } [BepInPlugin("MelsEnemyPack", "MelsEnemyPack", "1.0.7")] [BepInDependency(/*Could not decode attribute arguments.*/)] public class Plugin : BaseUnityPlugin { public static Harmony _harmony; public static EnemyType SampleEnemy; public static EnemyType ReplicatorEnemy; public static AnomalyType SpringAnomaly; internal static ManualLogSource Logger; internal static PluginConfig BoundConfig { get; private set; } private void Awake() { //IL_0015: Unknown result type (might be due to invalid IL or missing references) //IL_001f: Expected O, but got Unknown Logger = ((BaseUnityPlugin)this).Logger; Assets.PopulateAssets(); _harmony = new Harmony("MelsEnemyPack"); _harmony.PatchAll(); BoundConfig = new PluginConfig((BaseUnityPlugin)(object)this); ReplicatorEnemy = Assets.MainAssetBundle.LoadAsset<EnemyType>("ReplicatorEnemy"); SpringAnomaly = Assets.MainAssetBundle.LoadAsset<AnomalyType>("SpringMine"); TerminalNode val = Assets.MainAssetBundle.LoadAsset<TerminalNode>("ReplicatorEnemyTN"); TerminalKeyword val2 = Assets.MainAssetBundle.LoadAsset<TerminalKeyword>("ReplicatorEnemyTK"); Logger.LogInfo((object)$"repl {ReplicatorEnemy} !"); Logger.LogInfo((object)$"repl-pf {ReplicatorEnemy.enemyPrefab} !"); Logger.LogInfo((object)$"stat {SpringAnomaly.anomalyName} {SpringAnomaly.anomalyPrefab} !"); Type[] types = Assembly.GetExecutingAssembly().GetTypes(); for (int i = 0; i < types.Length; i++) { MethodInfo[] methods = types[i].GetMethods(BindingFlags.Instance | BindingFlags.Static | BindingFlags.NonPublic); foreach (MethodInfo methodInfo in methods) { if (methodInfo.GetCustomAttributes(typeof(RuntimeInitializeOnLoadMethodAttribute), inherit: false).Length != 0) { methodInfo.Invoke(null, null); } } } NetworkPrefabs.RegisterNetworkPrefab(ReplicatorEnemy.enemyPrefab); Enemies.RegisterEnemy(ReplicatorEnemy, BoundConfig.SpawnWeight.Value, (LevelTypes)(-1), (SpawnType)0, val, val2); Logger.LogInfo((object)"Plugin MelsEnemyPack is loaded!"); Assets.MainAssetBundle.Unload(false); } } public static class Assets { public static AssetBundle MainAssetBundle; public static void PopulateAssets() { string directoryName = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location); if ((Object)(object)MainAssetBundle == (Object)null) { MainAssetBundle = AssetBundle.LoadFromFile(Path.Combine(directoryName, "mels.lethalbundle")); } if ((Object)(object)MainAssetBundle == (Object)null) { Plugin.Logger.LogError((object)"Failed to load custom assets."); } } } [HarmonyPatch(typeof(RoundManager))] internal class MapObjectRoundManagerPatch { public static bool AddCustomStaticToMap(RoundManager __instance, string[] RequiredNames, AnomalyType ToSpawn, bool bSpawnFacingAwayFromWall = true, int AmountToSpawn = 1) { //IL_002a: Unknown result type (might be due to invalid IL or missing references) //IL_0030: Expected O, but got Unknown //IL_0050: Unknown result type (might be due to invalid IL or missing references) //IL_0056: Expected O, but got Unknown //IL_0058: Unknown result type (might be due to invalid IL or missing references) //IL_0075: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)ToSpawn == (Object)null || (Object)(object)ToSpawn.anomalyPrefab == (Object)null) { return false; } if (AddToRandomMapObjects(RequiredNames, ToSpawn.anomalyPrefab)) { SpawnableMapObject val = new SpawnableMapObject(); val.prefabToSpawn = ToSpawn.anomalyPrefab; val.spawnFacingAwayFromWall = bSpawnFacingAwayFromWall; AnimationCurve val2; if (ToSpawn.probabilityCurve.length == 0) { val2 = new AnimationCurve(); Keyframe val3 = default(Keyframe); ((Keyframe)(ref val3)).value = AmountToSpawn; ((Keyframe)(ref val3)).time = 0f; val2.AddKey(val3); } else { val2 = ToSpawn.probabilityCurve; } val.numberToSpawn = val2; SpawnableMapObject[] array = (SpawnableMapObject[])(object)new SpawnableMapObject[__instance.currentLevel.spawnableMapObjects.Length + 1]; for (int i = 0; i < __instance.currentLevel.spawnableMapObjects.Length; i++) { array[i] = __instance.currentLevel.spawnableMapObjects[i]; } array[^1] = val; __instance.currentLevel.spawnableMapObjects = array; return true; } return false; } public static bool AddToRandomMapObjects(string[] RequiredNames, GameObject Prefab) { bool result = false; RandomMapObject[] array = Object.FindObjectsOfType<RandomMapObject>(); for (int i = 0; i < array.Length; i++) { if ((Object)(object)array[i] == (Object)null) { continue; } for (int j = 0; j < array[i].spawnablePrefabs.Count; j++) { bool flag = false; if (RequiredNames.Length == 0) { flag = true; } else { for (int k = 0; k < RequiredNames.Length; k++) { if (((Object)array[i].spawnablePrefabs[j]).name.ToLower() == RequiredNames[k].ToLower()) { flag = true; } } } if (flag) { result = true; array[i].spawnablePrefabs.Add(Prefab); } } } return result; } [HarmonyPatch("SpawnMapObjects")] [HarmonyPrefix] private static void SpawnMapObjectsPrefix(RoundManager __instance) { } } public class PluginConfig { public ConfigEntry<int> SpawnWeight; public ConfigEntry<int> DamageLevel; public ConfigEntry<int> ConsumesRessourceValueToReplicate; public ConfigEntry<bool> bAutowakeupSuntimer; public PluginConfig(BaseUnityPlugin bindingPlugin) { SpawnWeight = bindingPlugin.Config.Bind<int>("Replicator", "Spawning weight", 100, "The weight for the replicator spawn-wise (rarity)"); DamageLevel = bindingPlugin.Config.Bind<int>("Replicator", "Damage-tier", 0, "0: default damage (Recommended), 1: reduced damage, 2: Reduced damage and no collision damage"); ConsumesRessourceValueToReplicate = bindingPlugin.Config.Bind<int>("Replicator", "Scrap-value-replicate", 3, "How much scrap value must be consumed in order to replicate (DO NOT set this to 0)"); bAutowakeupSuntimer = bindingPlugin.Config.Bind<bool>("Replicator", "Awake on daytime end", true, "Should the enemy activate when daytime enemies leaves?"); } } internal class ReplicatorEnemyAI : EnemyAI { private struct ClaimedObjects { public GrabbableObject claimedObject; public float time; } public enum State { SearchingForPlayer, StickingInFrontOfPlayer, HeadSwingAttackInProgress, ReplicatorStateDocile, ReplicatorStateActive, ReplicatorStateNomming, ReplicatorStateRoaming, ReplicatorStateFleeing, ReplicatorStateDefending, ReplicatorStateSpawnAnim, ReplicatorStateFindDocileLocation, ReplicatorStateReplicating } public Transform turnCompass; public Transform attackArea; public AISearchRoutine scoutingSearchRoutine; private float timeSinceHittingLocalPlayer; private float timeSinceNewRandPos; private Vector3 positionRandomness; private Vector3 StalkPos; private Random enemyRandom; private bool isDeadAnimationDone; private bool bStartDocile = true; private int MaxSpawns = 3; private bool bAutowakeupSuntimer = true; private int DamageLevel; private int ConsumesRessourceValueToReplicate = 3; private bool bPersonallyAggroed; private bool bGroupAggroed; private GrabbableObject ObjectOfInterest; private List<ClaimedObjects> grabbableClaimed = new List<ClaimedObjects>(); private GrabbableObject lastClaim; private int PersonallySpawned; private ReplicatorEnemyAI Parent; private int CurrentlyConsumedScrap; private int MyMaxSpawns; private bool bPlayedSpawnAnimation; private bool bLurking; private float EnteredStateTime; public float FriendlyAggroRange = 30f; private bool bCaresAboutPlayer; public GameObject PrefabToSpawn; public AnimationCurve fallToGroundCurve; private Vector3[] legPositions = (Vector3[])(object)new Vector3[4]; private Vector3[] oldLegPositions = (Vector3[])(object)new Vector3[4]; private Vector3[] newLegPositions = (Vector3[])(object)new Vector3[4]; private Vector3[] oldLegNormal = (Vector3[])(object)new Vector3[4]; private Vector3[] currentLegNormal = (Vector3[])(object)new Vector3[4]; private Vector3[] newLegNormal = (Vector3[])(object)new Vector3[4]; [SerializeField] private LayerMask terrainLayer; [SerializeField] private Vector3[] footOffset; private float[] legLerp = new float[4]; public Transform body; public float stepHeight = 0.3f; public Transform[] legDefaultPositions; public Transform[] legTargets; public Transform debugSphere1; public Transform debugSphere2; public AudioSource footstepAudio; public AudioClip[] footstepSFX; public AudioClip AttackSFX; public AudioClip ConsumeSFX; public AudioClip CallForHelpSFX; public AudioClip StartupSFX; public AudioClip hitGroundSFX; public AudioClip DeathSound; private float LastConsumeSFX; public Vector3 DesiredDestination; public ParticleSystem Poof; public ParticleSystem Grind; public ParticleSystem Death; private float updateOffsetPositionInterval; private Vector3 offsetTargetPos; private bool clingingToCeiling; public Transform modelContainer; private Ray ray; private Coroutine ceilingAnimationCoroutine; public Vector3 ceilingHidingPoint; private int offsetNodeAmount = 6; private Vector3 propelVelocity = Vector3.zero; private RaycastHit rayHit; private bool startedCeilingAnimationCoroutine; private Vector3 wallPosition; private Vector3 wallNormal; private bool bDesiresCeiling; private bool bDesiresWall; private Vector3 defaultGravity; private int EnemyMask = 524288; private Vector3[] legSpacing = (Vector3[])(object)new Vector3[4]; private float[] legDistances = new float[4] { 0.5f, 0.5f, 0.35f, 0.35f }; private float timeSinceActuallySpawned; private float PossiblyStuckTime; private float timeSinceLastCheck; private ObstacleAvoidanceType defaultObstacleAvoidanceType; public static List<GameObject> grabbableObjectsInMap = new List<GameObject>(); public void Awake() { DamageLevel = Plugin.BoundConfig.DamageLevel.Value; ConsumesRessourceValueToReplicate = Plugin.BoundConfig.ConsumesRessourceValueToReplicate.Value; bAutowakeupSuntimer = Plugin.BoundConfig.bAutowakeupSuntimer.Value; Debug.Log((object)(".." + DamageLevel + ".." + ConsumesRessourceValueToReplicate + ".." + bAutowakeupSuntimer)); } public void LateUpdate() { MoveLegsProcedurally(); } public int GetDamageForAction(bool bDirectHit = false, bool bCollision = false) { if (DamageLevel == 0) { if (bDirectHit) { return 40; } return 20; } if (DamageLevel == 1) { if (bDirectHit) { return 20; } if (bCollision) { return 10; } } else if (DamageLevel == 2) { if (bDirectHit) { return 20; } if (bCollision) { return 0; } } return 20; } [ClientRpc] public void SyncConfigClientRPC(int repRessourcesDemand, int repDamageLevel, bool repSunset) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_00c1: Unknown result type (might be due to invalid IL or missing references) //IL_00cb: 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_007e: 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_009d: Unknown result type (might be due to invalid IL or missing references) //IL_00b1: 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(10916840u, val, (RpcDelivery)0); BytePacker.WriteValueBitPacked(val2, repRessourcesDemand); BytePacker.WriteValueBitPacked(val2, repDamageLevel); ((FastBufferWriter)(ref val2)).WriteValueSafe<bool>(ref repSunset, default(ForPrimitives)); ((NetworkBehaviour)this).__endSendClientRpc(ref val2, 10916840u, val, (RpcDelivery)0); } if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 2 && (networkManager.IsClient || networkManager.IsHost)) { ConsumesRessourceValueToReplicate = repRessourcesDemand; DamageLevel = repDamageLevel; bAutowakeupSuntimer = repSunset; } } } public override void Start() { //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_00cb: Unknown result type (might be due to invalid IL or missing references) //IL_00d0: Unknown result type (might be due to invalid IL or missing references) //IL_00e4: Unknown result type (might be due to invalid IL or missing references) //IL_00e9: Unknown result type (might be due to invalid IL or missing references) //IL_00fd: Unknown result type (might be due to invalid IL or missing references) //IL_0102: Unknown result type (might be due to invalid IL or missing references) //IL_0116: 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_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_0144: Unknown result type (might be due to invalid IL or missing references) //IL_0149: Unknown result type (might be due to invalid IL or missing references) //IL_015b: Unknown result type (might be due to invalid IL or missing references) //IL_0160: Unknown result type (might be due to invalid IL or missing references) //IL_01af: 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_01c0: Unknown result type (might be due to invalid IL or missing references) //IL_01c5: Unknown result type (might be due to invalid IL or missing references) //IL_0286: Unknown result type (might be due to invalid IL or missing references) //IL_028c: Unknown result type (might be due to invalid IL or missing references) //IL_0266: Unknown result type (might be due to invalid IL or missing references) //IL_026c: Invalid comparison between Unknown and I4 //IL_0273: Unknown result type (might be due to invalid IL or missing references) //IL_0279: Unknown result type (might be due to invalid IL or missing references) ((EnemyAI)this).Start(); LogIfDebugBuild("Replicator Enemy Spawned"); timeSinceHittingLocalPlayer = 0f; base.creatureAnimator.SetTrigger("startWalk"); timeSinceNewRandPos = 0f; positionRandomness = new Vector3(0f, 0f, 0f); enemyRandom = new Random(StartOfRound.Instance.randomMapSeed + base.thisEnemyIndex); isDeadAnimationDone = false; base.currentBehaviourStateIndex = 0; if (((NetworkBehaviour)this).IsServer) { SyncConfigClientRPC(ConsumesRessourceValueToReplicate, DamageLevel, bAutowakeupSuntimer); } for (int i = 0; i < legDefaultPositions.Length; i++) { if ((Object)(object)legDefaultPositions[i] == (Object)null) { Debug.Log((object)"wtf"); } legPositions[i] = legDefaultPositions[i].position; newLegPositions[i] = legDefaultPositions[i].position; oldLegPositions[i] = legDefaultPositions[i].position; legSpacing[i] = legDefaultPositions[i].position; currentLegNormal[i] = ((Component)this).transform.up; newLegNormal[i] = ((Component)this).transform.up; oldLegNormal[i] = ((Component)this).transform.up; legLerp[i] = 1f; } base.openDoorSpeedMultiplier = 0.6f; if ((Object)(object)body == (Object)null) { body = ((Component)this).gameObject.transform; } defaultGravity = Physics.gravity; defaultObstacleAvoidanceType = base.agent.obstacleAvoidanceType; if ((Object)(object)Parent == (Object)null) { MyMaxSpawns = MaxSpawns; PersonallySpawned = 0; Parent = null; CurrentlyConsumedScrap = 0; ObjectOfInterest = null; bGroupAggroed = false; bPersonallyAggroed = false; } if ((Object)(object)Poof != (Object)null) { Poof.Stop(); } if ((Object)(object)Grind != (Object)null) { Grind.Stop(); } if ((Object)(object)Death != (Object)null) { Death.Stop(); } if (bStartDocile && (int)TimeOfDay.Instance.currentLevelWeather != 5) { SetCurrentBehaviourState(State.ReplicatorStateFindDocileLocation); } else { SetCurrentBehaviourState(State.ReplicatorStateSpawnAnim); } RefreshGrabbableObjectsInMapList(); } public void TryReplicate() { //IL_005e: Unknown result type (might be due to invalid IL or missing references) //IL_0069: Unknown result type (might be due to invalid IL or missing references) //IL_007a: Unknown result type (might be due to invalid IL or missing references) //IL_007f: Unknown result type (might be due to invalid IL or missing references) //IL_0107: Unknown result type (might be due to invalid IL or missing references) if (!((NetworkBehaviour)this).IsServer || PersonallySpawned >= MyMaxSpawns || CurrentlyConsumedScrap < ConsumesRessourceValueToReplicate) { return; } CurrentlyConsumedScrap -= ConsumesRessourceValueToReplicate; PersonallySpawned++; LogIfDebugBuild("Spawning new replicator enemy"); NetworkObjectReference val = RoundManager.Instance.SpawnEnemyGameObject(((Component)this).transform.position, ((Component)this).transform.rotation.y, -1, base.enemyType); NetworkObject val2 = default(NetworkObject); if (((NetworkObjectReference)(ref val)).TryGet(ref val2, (NetworkManager)null)) { ReplicatorEnemyAI component = ((Component)val2).gameObject.GetComponent<ReplicatorEnemyAI>(); if ((Object)(object)component != (Object)null) { component.SpawnedByParent(MyMaxSpawns - 1, this); } } ulong repPlayerOfInterest = 0uL; if ((Object)(object)base.targetPlayer != (Object)null) { repPlayerOfInterest = base.targetPlayer.playerClientId; } ReplicateValuesClientRpc(PersonallySpawned, CurrentlyConsumedScrap, bGroupAggroed, bPersonallyAggroed, MyMaxSpawns, repPlayerOfInterest); if ((Object)(object)GetObjectOfInterest() != (Object)null) { ReplicateObjectOfInterestClientRpc(NetworkObjectReference.op_Implicit(GetObjectOfInterest())); } } [ClientRpc] public void DesiresCeilingWallClientRPC(bool bNewDesiresCeiling, bool bNewDesiresWall, Vector3 NewCeilingPoint, Vector3 NewDesiredPosition) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_00dc: Unknown result type (might be due to invalid IL or missing references) //IL_00e6: 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_00cc: 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(1031894649u, val, (RpcDelivery)0); ((FastBufferWriter)(ref val2)).WriteValueSafe<bool>(ref bNewDesiresCeiling, default(ForPrimitives)); ((FastBufferWriter)(ref val2)).WriteValueSafe<bool>(ref bNewDesiresWall, default(ForPrimitives)); ((FastBufferWriter)(ref val2)).WriteValueSafe(ref NewCeilingPoint); ((FastBufferWriter)(ref val2)).WriteValueSafe(ref NewDesiredPosition); ((NetworkBehaviour)this).__endSendClientRpc(ref val2, 1031894649u, val, (RpcDelivery)0); } if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 2 || (!networkManager.IsClient && !networkManager.IsHost)) { return; } bDesiresCeiling = bNewDesiresCeiling; bDesiresWall = bNewDesiresWall; if (bDesiresCeiling || bDesiresWall) { startedCeilingAnimationCoroutine = true; if (bDesiresCeiling) { ceilingAnimationCoroutine = ((MonoBehaviour)this).StartCoroutine(clingToCeiling()); } } else { startedCeilingAnimationCoroutine = false; } } public NetworkObject GetObjectOfInterest() { if ((Object)(object)ObjectOfInterest == (Object)null) { return null; } return ((Component)ObjectOfInterest).GetComponent<NetworkObject>(); } public NetworkObject GetReplicatorEnemyAI(ReplicatorEnemyAI a) { if ((Object)(object)a == (Object)null) { return null; } return ((Component)a).GetComponent<NetworkObject>(); } [ClientRpc] public void ReplicateObjectOfInterestClientRpc(NetworkObjectReference RepObjectOfInterest) { //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 != 2 && (networkManager.IsServer || networkManager.IsHost)) { ClientRpcParams val = default(ClientRpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(237264681u, val, (RpcDelivery)0); ((FastBufferWriter)(ref val2)).WriteValueSafe<NetworkObjectReference>(ref RepObjectOfInterest, default(ForNetworkSerializable)); ((NetworkBehaviour)this).__endSendClientRpc(ref val2, 237264681u, val, (RpcDelivery)0); } if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 2 || (!networkManager.IsClient && !networkManager.IsHost)) { return; } ObjectOfInterest = null; NetworkObject val3 = default(NetworkObject); if (((NetworkObjectReference)(ref RepObjectOfInterest)).TryGet(ref val3, (NetworkManager)null)) { if ((Object)(object)val3 == (Object)null || (Object)(object)((Component)val3).gameObject == (Object)null || (Object)(object)((Component)val3).GetComponent<GrabbableObject>() == (Object)null) { ObjectOfInterest = null; } else { ObjectOfInterest = ((Component)val3).gameObject.GetComponent<GrabbableObject>(); } } } [ClientRpc] public void ReplicateValuesClientRpc(int RepPersonallySpawned, int RepConsumedScrap, bool RepGroupAggro, bool RepSelfAggro, int RepMaxSpawns, ulong RepPlayerOfInterest) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_00f6: Unknown result type (might be due to invalid IL or missing references) //IL_0100: 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_007e: 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_009d: 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) //IL_00b8: Unknown result type (might be due to invalid IL or missing references) //IL_00c1: Unknown result type (might be due to invalid IL or missing references) //IL_00ce: 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) 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(776576605u, val, (RpcDelivery)0); BytePacker.WriteValueBitPacked(val2, RepPersonallySpawned); BytePacker.WriteValueBitPacked(val2, RepConsumedScrap); ((FastBufferWriter)(ref val2)).WriteValueSafe<bool>(ref RepGroupAggro, default(ForPrimitives)); ((FastBufferWriter)(ref val2)).WriteValueSafe<bool>(ref RepSelfAggro, default(ForPrimitives)); BytePacker.WriteValueBitPacked(val2, RepMaxSpawns); BytePacker.WriteValueBitPacked(val2, RepPlayerOfInterest); ((NetworkBehaviour)this).__endSendClientRpc(ref val2, 776576605u, val, (RpcDelivery)0); } if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 2 || (!networkManager.IsClient && !networkManager.IsHost)) { return; } PersonallySpawned = RepPersonallySpawned; CurrentlyConsumedScrap = RepConsumedScrap; bGroupAggroed = RepGroupAggro; bPersonallyAggroed = RepSelfAggro; MyMaxSpawns = RepMaxSpawns; base.targetPlayer = null; for (int i = 0; i < StartOfRound.Instance.allPlayerScripts.Length; i++) { if (StartOfRound.Instance.allPlayerScripts[i].actualClientId == RepPlayerOfInterest) { base.targetPlayer = StartOfRound.Instance.allPlayerScripts[i]; break; } } } public void SpawnedByParent(int MaxSpawns, ReplicatorEnemyAI Source) { //IL_009d: Unknown result type (might be due to invalid IL or missing references) if (!((NetworkBehaviour)this).IsServer) { return; } PersonallySpawned = 0; Parent = Source; CurrentlyConsumedScrap = 0; ObjectOfInterest = null; bGroupAggroed = false; bPersonallyAggroed = false; MyMaxSpawns = MaxSpawns; if ((Object)(object)Source != (Object)null) { bGroupAggroed = Source.bGroupAggroed; if (!bGroupAggroed) { bGroupAggroed = Source.bPersonallyAggroed; } } base.ventAnimationFinished = true; if ((Object)(object)base.creatureAnimator != (Object)null) { base.creatureAnimator.SetBool("inSpawningAnimation", false); } SpawnedByParentClientRPC(MyMaxSpawns, bGroupAggroed, NetworkObjectReference.op_Implicit(GetReplicatorEnemyAI(Source))); } [ClientRpc] public void SpawnedByParentClientRPC(int RepMaxSpawns, bool bRepGroupAggroed, NetworkObjectReference Source) { //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_0071: Unknown result type (might be due to invalid IL or missing references) //IL_008a: Unknown result type (might be due to invalid IL or missing references) //IL_0090: 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(629129375u, val, (RpcDelivery)0); BytePacker.WriteValueBitPacked(val2, RepMaxSpawns); ((FastBufferWriter)(ref val2)).WriteValueSafe<bool>(ref bRepGroupAggroed, default(ForPrimitives)); ((FastBufferWriter)(ref val2)).WriteValueSafe<NetworkObjectReference>(ref Source, default(ForNetworkSerializable)); ((NetworkBehaviour)this).__endSendClientRpc(ref val2, 629129375u, val, (RpcDelivery)0); } if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 2 || (!networkManager.IsClient && !networkManager.IsHost)) { return; } Parent = null; NetworkObject val3 = default(NetworkObject); if (((NetworkObjectReference)(ref Source)).TryGet(ref val3, (NetworkManager)null)) { if ((Object)(object)val3 == (Object)null || (Object)(object)((Component)val3).gameObject == (Object)null || (Object)(object)((Component)val3).GetComponent<ReplicatorEnemyAI>() == (Object)null) { Parent = null; } else { Parent = ((Component)val3).gameObject.GetComponent<ReplicatorEnemyAI>(); } } base.ventAnimationFinished = true; if ((Object)(object)base.creatureAnimator != (Object)null) { base.creatureAnimator.SetBool("inSpawningAnimation", false); } PersonallySpawned = 0; CurrentlyConsumedScrap = 0; ObjectOfInterest = null; bGroupAggroed = bRepGroupAggroed; bPersonallyAggroed = false; MyMaxSpawns = RepMaxSpawns; } private void LogIfDebugBuild(string text) { } public static void RefreshGrabbableObjectsInMapList() { grabbableObjectsInMap.Clear(); GrabbableObject[] array = Object.FindObjectsOfType<GrabbableObject>(); for (int i = 0; i < array.Length; i++) { if ((Object)(object)array[i] != (Object)null && array[i].grabbable) { grabbableObjectsInMap.Add(((Component)array[i]).gameObject); } } } public void ClaimObject(GrabbableObject grab) { //IL_0015: Unknown result type (might be due to invalid IL or missing references) //IL_007a: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)grab == (Object)(object)lastClaim) { return; } Collider[] array = Physics.OverlapSphere(((Component)this).transform.position, 80f, EnemyMask); ReplicatorEnemyAI replicatorEnemyAI = null; for (int i = 0; i < array.Length; i++) { if (!((Object)(object)array[i] == (Object)null)) { replicatorEnemyAI = ((Component)array[i]).gameObject.GetComponent<ReplicatorEnemyAI>(); if ((Object)(object)replicatorEnemyAI == (Object)null) { replicatorEnemyAI = ((Component)array[i]).gameObject.GetComponentInParent<ReplicatorEnemyAI>(); } if (!((Object)(object)replicatorEnemyAI == (Object)null) && !((Object)(object)replicatorEnemyAI == (Object)(object)this)) { replicatorEnemyAI.ClaimObjectClientRPC(NetworkObjectReference.op_Implicit(((NetworkBehaviour)grab).NetworkObject)); } } } } [ClientRpc] public void ClaimObjectClientRPC(NetworkObjectReference claim) { //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 != 2 && (networkManager.IsServer || networkManager.IsHost)) { ClientRpcParams val = default(ClientRpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(4196267238u, val, (RpcDelivery)0); ((FastBufferWriter)(ref val2)).WriteValueSafe<NetworkObjectReference>(ref claim, default(ForNetworkSerializable)); ((NetworkBehaviour)this).__endSendClientRpc(ref val2, 4196267238u, val, (RpcDelivery)0); } NetworkObject val3 = default(NetworkObject); if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 2 || (!networkManager.IsClient && !networkManager.IsHost) || !((NetworkObjectReference)(ref claim)).TryGet(ref val3, (NetworkManager)null) || (Object)(object)val3 == (Object)null || (Object)(object)((Component)val3).gameObject == (Object)null || (Object)(object)((Component)val3).GetComponent<GrabbableObject>() == (Object)null) { return; } GrabbableObject component = ((Component)val3).gameObject.GetComponent<GrabbableObject>(); if ((Object)(object)component == (Object)null) { return; } ClaimedObjects claimedObjects = default(ClaimedObjects); for (int i = 0; i < grabbableClaimed.Count; i++) { if ((Object)(object)grabbableClaimed[i].claimedObject == (Object)(object)component) { claimedObjects = grabbableClaimed[i]; claimedObjects.time = Time.time; grabbableClaimed[i] = claimedObjects; if ((Object)(object)ObjectOfInterest == (Object)(object)component) { ObjectOfInterest = null; } return; } } claimedObjects.time = Time.time; claimedObjects.claimedObject = component; CollectionExtensions.AddItem<ClaimedObjects>((IEnumerable<ClaimedObjects>)grabbableClaimed, claimedObjects); if ((Object)(object)component == (Object)(object)ObjectOfInterest) { ObjectOfInterest = null; } } public bool CheckIfObjectClaimed(GrabbableObject grab) { for (int i = 0; i < grabbableClaimed.Count; i++) { if (Time.time - grabbableClaimed[i].time < 20f && (Object)(object)grab == (Object)(object)grabbableClaimed[i].claimedObject) { return true; } } return false; } public void SetCurrentBehaviourState(State NewState, Vector3 NewPOI = default(Vector3)) { //IL_0013: Unknown result type (might be due to invalid IL or missing references) //IL_0014: Unknown result type (might be due to invalid IL or missing references) //IL_0060: Unknown result type (might be due to invalid IL or missing references) if (((NetworkBehaviour)this).IsServer) { if (base.currentBehaviourStateIndex != (int)NewState) { DesiredDestination = NewPOI; LogIfDebugBuild("Replicator Enemy entering new state " + NewState.ToString() + " Old state: " + base.currentBehaviourStateIndex); base.currentBehaviourStateIndex = (int)NewState; EnteredStateTime = timeSinceActuallySpawned; SetBehaviourStateClientRpc(base.currentBehaviourStateIndex, NewPOI); bDesiresCeiling = false; bDesiresWall = false; } else { LogIfDebugBuild("Replicator Enemy tried entering " + NewState.ToString() + " but was already doing it"); } } } [ClientRpc] public void SetBehaviourStateClientRpc(int NewState, Vector3 NewPOI = default(Vector3)) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_00a6: Unknown result type (might be due to invalid IL or missing references) //IL_00b0: 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_0096: Unknown result type (might be due to invalid IL or missing references) //IL_00dd: Unknown result type (might be due to invalid IL or missing references) //IL_00de: 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(2523502834u, val, (RpcDelivery)0); BytePacker.WriteValueBitPacked(val2, NewState); ((FastBufferWriter)(ref val2)).WriteValueSafe(ref NewPOI); ((NetworkBehaviour)this).__endSendClientRpc(ref val2, 2523502834u, val, (RpcDelivery)0); } if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 2 && (networkManager.IsClient || networkManager.IsHost)) { base.currentBehaviourStateIndex = NewState; DesiredDestination = NewPOI; LogIfDebugBuild("(client) Replicator Enemy entering new state " + NewState + " Old state: " + base.currentBehaviourStateIndex); ((EnemyAI)this).SwitchToBehaviourClientRpc(NewState); } } } public override void Update() { //IL_00a4: Unknown result type (might be due to invalid IL or missing references) //IL_00aa: 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) //IL_00d9: 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_0109: Unknown result type (might be due to invalid IL or missing references) //IL_0119: 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_01d4: Unknown result type (might be due to invalid IL or missing references) //IL_01e2: Unknown result type (might be due to invalid IL or missing references) //IL_01e8: Unknown result type (might be due to invalid IL or missing references) ((EnemyAI)this).Update(); if (base.isEnemyDead) { if (!isDeadAnimationDone) { LogIfDebugBuild("Stopping enemy voice with janky code."); isDeadAnimationDone = true; base.creatureVoice.Stop(); base.creatureVoice.PlayOneShot(base.dieSFX); } return; } timeSinceHittingLocalPlayer += Time.deltaTime; timeSinceNewRandPos += Time.deltaTime; if (base.stunNormalizedTimer > 0f) { base.agent.speed = 0f; } if (bDesiresCeiling) { ((Component)this).gameObject.transform.position = Vector3.SmoothDamp(((Component)this).gameObject.transform.position, ceilingHidingPoint, ref propelVelocity, 0.1f); ((Component)this).transform.eulerAngles = new Vector3(0f, 0f, 180f); } else if (bDesiresWall) { ((Component)this).gameObject.transform.position = Vector3.SmoothDamp(((Component)this).gameObject.transform.position, wallPosition, ref propelVelocity, 0.1f); } if ((bDesiresCeiling || bDesiresWall) && timeSinceActuallySpawned - timeSinceLastCheck > base.AIIntervalTime) { timeSinceLastCheck = timeSinceActuallySpawned; base.targetPlayer = ((EnemyAI)this).GetClosestPlayer(false, false, false); if (NearbyTargetWithLoot(bCheckLOS: true, bAnyLoot: true) || (bAutowakeupSuntimer && !((Object)(object)TimeOfDay.Instance == (Object)null) && TimeOfDay.Instance.normalizedTimeOfDay > base.enemyType.normalizedTimeInDayToLeave)) { base.inSpecialAnimation = false; ((Behaviour)base.agent).enabled = true; bDesiresCeiling = false; bDesiresWall = false; DesiresCeilingWallClientRPC(bDesiresCeiling, bDesiresWall, ceilingHidingPoint, DesiredDestination); SetCurrentBehaviourState(State.ReplicatorStateActive); } } timeSinceActuallySpawned += Time.deltaTime; } private IEnumerator DoDeath() { if ((Object)(object)Death != (Object)null) { Death.Play(); } if ((Object)(object)Grind != (Object)null) { Grind.Stop(); } if ((Object)(object)DeathSound != (Object)null && (Object)(object)base.creatureSFX != (Object)null) { base.creatureSFX.pitch = Random.Range(0.6f, 1.2f); base.creatureSFX.PlayOneShot(DeathSound, Random.Range(0.7f, 1f)); WalkieTalkie.TransmitOneShotAudio(base.creatureSFX, DeathSound, Mathf.Clamp(Random.Range(-0.4f, 0.8f), 0f, 1f)); } DoDeathClientRpc(); for (float deathTime = 0f; deathTime < 1f; deathTime += Time.deltaTime) { yield return null; } Object.Destroy((Object)(object)((Component)this).gameObject); } [ClientRpc] public void DoDeathClientRpc() { //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)((NetworkBehaviour)this).__rpc_exec_stage != 2 && (networkManager.IsServer || networkManager.IsHost)) { ClientRpcParams val = default(ClientRpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(1017313517u, val, (RpcDelivery)0); ((NetworkBehaviour)this).__endSendClientRpc(ref val2, 1017313517u, val, (RpcDelivery)0); } if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 2 && (networkManager.IsClient || networkManager.IsHost)) { ((MonoBehaviour)this).StartCoroutine(DoDeathClient()); } } } private IEnumerator DoDeathClient() { if ((Object)(object)Death != (Object)null) { Death.Play(); } if ((Object)(object)Grind != (Object)null) { Grind.Stop(); } if ((Object)(object)DeathSound != (Object)null && (Object)(object)base.creatureSFX != (Object)null) { base.creatureSFX.pitch = Random.Range(0.6f, 1.2f); base.creatureSFX.PlayOneShot(DeathSound, Random.Range(0.1f, 1f)); WalkieTalkie.TransmitOneShotAudio(base.creatureSFX, DeathSound, Mathf.Clamp(Random.Range(-0.4f, 0.8f), 0f, 1f)); } for (float deathTime = 0f; deathTime < 1f; deathTime += Time.deltaTime) { yield return null; } Object.Destroy((Object)(object)((Component)this).gameObject); } private void StopCreatureSFX(bool bSound = true) { if (bSound) { base.creatureSFX.Stop(); } if ((Object)(object)Grind != (Object)null) { Grind.Stop(); } if (((NetworkBehaviour)this).IsServer) { StopCreatureSFXClientRPC(); } } [ClientRpc] private void StopCreatureSFXClientRPC(bool bSound = true) { //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 != 2 && (networkManager.IsServer || networkManager.IsHost)) { ClientRpcParams val = default(ClientRpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(3364030128u, val, (RpcDelivery)0); ((FastBufferWriter)(ref val2)).WriteValueSafe<bool>(ref bSound, default(ForPrimitives)); ((NetworkBehaviour)this).__endSendClientRpc(ref val2, 3364030128u, val, (RpcDelivery)0); } if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 2 && (networkManager.IsClient || networkManager.IsHost)) { if (bSound) { base.creatureSFX.Stop(); } if ((Object)(object)Grind != (Object)null) { Grind.Stop(); } } } private void PlayWakeSFX() { if (!((Object)(object)StartupSFX == (Object)null) && !((Object)(object)base.creatureSFX == (Object)null)) { base.creatureSFX.Stop(); base.creatureSFX.pitch = Random.Range(0.6f, 1.2f); base.creatureSFX.PlayOneShot(StartupSFX, Random.Range(0.6f, 1f)); WalkieTalkie.TransmitOneShotAudio(base.creatureSFX, StartupSFX, Mathf.Clamp(Random.Range(-0.4f, 0.8f), 0f, 1f)); if (((NetworkBehaviour)this).IsServer) { PlayWakeSFXClientRPC(); } } } [ClientRpc] private void PlayWakeSFXClientRPC() { //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)((NetworkBehaviour)this).__rpc_exec_stage != 2 && (networkManager.IsServer || networkManager.IsHost)) { ClientRpcParams val = default(ClientRpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(1601373250u, val, (RpcDelivery)0); ((NetworkBehaviour)this).__endSendClientRpc(ref val2, 1601373250u, val, (RpcDelivery)0); } if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 2 && (networkManager.IsClient || networkManager.IsHost) && !((Object)(object)StartupSFX == (Object)null) && !((Object)(object)base.creatureSFX == (Object)null)) { base.creatureSFX.Stop(); base.creatureSFX.pitch = Random.Range(0.6f, 1.2f); base.creatureSFX.PlayOneShot(StartupSFX, Random.Range(0.6f, 1f)); WalkieTalkie.TransmitOneShotAudio(base.creatureSFX, StartupSFX, Mathf.Clamp(Random.Range(-0.4f, 0.8f), 0f, 1f)); } } } private void PlayHitGroundSFX() { if (!((Object)(object)hitGroundSFX == (Object)null) && !((Object)(object)base.creatureSFX == (Object)null)) { base.creatureSFX.Stop(); base.creatureSFX.pitch = Random.Range(0.6f, 1.2f); base.creatureSFX.PlayOneShot(hitGroundSFX, Random.Range(0.6f, 1f)); WalkieTalkie.TransmitOneShotAudio(base.creatureSFX, hitGroundSFX, Mathf.Clamp(Random.Range(-0.4f, 0.8f), 0f, 1f)); if (((NetworkBehaviour)this).IsServer) { PlayHitGroundSFXClientRPC(); } } } [ClientRpc] private void PlayHitGroundSFXClientRPC() { //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)((NetworkBehaviour)this).__rpc_exec_stage != 2 && (networkManager.IsServer || networkManager.IsHost)) { ClientRpcParams val = default(ClientRpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(4147499191u, val, (RpcDelivery)0); ((NetworkBehaviour)this).__endSendClientRpc(ref val2, 4147499191u, val, (RpcDelivery)0); } if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 2 && (networkManager.IsClient || networkManager.IsHost) && !((Object)(object)hitGroundSFX == (Object)null) && !((Object)(object)base.creatureSFX == (Object)null)) { base.creatureSFX.Stop(); base.creatureSFX.pitch = Random.Range(0.6f, 1.2f); base.creatureSFX.PlayOneShot(hitGroundSFX, Random.Range(0.6f, 1f)); WalkieTalkie.TransmitOneShotAudio(base.creatureSFX, hitGroundSFX, Mathf.Clamp(Random.Range(-0.4f, 0.8f), 0f, 1f)); } } } private void PlayAlertSFX() { if (!((Object)(object)CallForHelpSFX == (Object)null) && !((Object)(object)base.creatureSFX == (Object)null)) { base.creatureSFX.Stop(); base.creatureSFX.pitch = Random.Range(0.6f, 1.2f); base.creatureSFX.PlayOneShot(CallForHelpSFX, Random.Range(0.6f, 1f)); WalkieTalkie.TransmitOneShotAudio(base.creatureSFX, CallForHelpSFX, Mathf.Clamp(Random.Range(-0.4f, 0.8f), 0f, 1f)); if (((NetworkBehaviour)this).IsServer) { PlayAlertSFXClientRPC(); } } } [ClientRpc] private void PlayAlertSFXClientRPC() { //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)((NetworkBehaviour)this).__rpc_exec_stage != 2 && (networkManager.IsServer || networkManager.IsHost)) { ClientRpcParams val = default(ClientRpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(2086105730u, val, (RpcDelivery)0); ((NetworkBehaviour)this).__endSendClientRpc(ref val2, 2086105730u, val, (RpcDelivery)0); } if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 2 && (networkManager.IsClient || networkManager.IsHost) && !((Object)(object)CallForHelpSFX == (Object)null) && !((Object)(object)base.creatureSFX == (Object)null)) { base.creatureSFX.Stop(); base.creatureSFX.pitch = Random.Range(0.6f, 1.2f); base.creatureSFX.PlayOneShot(CallForHelpSFX, Random.Range(0.6f, 1f)); WalkieTalkie.TransmitOneShotAudio(base.creatureSFX, CallForHelpSFX, Mathf.Clamp(Random.Range(-0.4f, 0.8f), 0f, 1f)); } } } private void PlayEatingFX() { if (!((Object)(object)ConsumeSFX == (Object)null) && !((Object)(object)base.creatureSFX == (Object)null) && !(timeSinceActuallySpawned - LastConsumeSFX < ConsumeSFX.length)) { base.creatureSFX.Stop(); if ((Object)(object)Grind != (Object)null) { Grind.Play(); } LastConsumeSFX = timeSinceActuallySpawned; base.creatureSFX.pitch = Random.Range(0.6f, 1.2f); base.creatureSFX.PlayOneShot(ConsumeSFX, Random.Range(0.6f, 1f)); WalkieTalkie.TransmitOneShotAudio(base.creatureSFX, ConsumeSFX, Mathf.Clamp(Random.Range(-0.4f, 0.8f), 0f, 1f)); if (((NetworkBehaviour)this).IsServer) { PlayEatingFXClientRPC(); } } } [ClientRpc] private void PlayEatingFXClientRPC() { //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) { return; } if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 2 && (networkManager.IsServer || networkManager.IsHost)) { ClientRpcParams val = default(ClientRpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(3445709125u, val, (RpcDelivery)0); ((NetworkBehaviour)this).__endSendClientRpc(ref val2, 3445709125u, val, (RpcDelivery)0); } if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 2 && (networkManager.IsClient || networkManager.IsHost) && !((Object)(object)ConsumeSFX == (Object)null) && !((Object)(object)base.creatureSFX == (Object)null) && !(timeSinceActuallySpawned - LastConsumeSFX < ConsumeSFX.length)) { base.creatureSFX.Stop(); if ((Object)(object)Grind != (Object)null) { Grind.Play(); } LastConsumeSFX = timeSinceActuallySpawned; base.creatureSFX.pitch = Random.Range(0.6f, 1.2f); base.creatureSFX.PlayOneShot(ConsumeSFX, Random.Range(0.6f, 1f)); WalkieTalkie.TransmitOneShotAudio(base.creatureSFX, ConsumeSFX, Mathf.Clamp(Random.Range(-0.4f, 0.8f), 0f, 1f)); } } private void PlayAttackFX() { if (!((Object)(object)AttackSFX == (Object)null) && !((Object)(object)base.creatureSFX == (Object)null)) { base.creatureSFX.Stop(); base.creatureSFX.pitch = Random.Range(0.6f, 1.2f); base.creatureSFX.PlayOneShot(AttackSFX, Random.Range(0.6f, 1f)); WalkieTalkie.TransmitOneShotAudio(base.creatureSFX, AttackSFX, Mathf.Clamp(Random.Range(-0.4f, 0.8f), 0f, 1f)); if (((NetworkBehaviour)this).IsServer) { PlayAttackFXClientRPC(); } } } [ClientRpc] private void PlayAttackFXClientRPC() { //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)((NetworkBehaviour)this).__rpc_exec_stage != 2 && (networkManager.IsServer || networkManager.IsHost)) { ClientRpcParams val = default(ClientRpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(2471009619u, val, (RpcDelivery)0); ((NetworkBehaviour)this).__endSendClientRpc(ref val2, 2471009619u, val, (RpcDelivery)0); } if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 2 && (networkManager.IsClient || networkManager.IsHost) && !((Object)(object)AttackSFX == (Object)null) && !((Object)(object)base.creatureSFX == (Object)null)) { base.creatureSFX.Stop(); base.creatureSFX.pitch = Random.Range(0.6f, 1.2f); base.creatureSFX.PlayOneShot(AttackSFX, Random.Range(0.6f, 1f)); WalkieTalkie.TransmitOneShotAudio(base.creatureSFX, AttackSFX, Mathf.Clamp(Random.Range(-0.4f, 0.8f), 0f, 1f)); } } } public bool IsHostile() { if (!bGroupAggroed) { return bPersonallyAggroed; } return true; } public float MatchTargetSpeed(bool bWantsFaster = false) { float num = 0f; if (bWantsFaster) { num = 5f; } if ((Object)(object)base.targetPlayer != (Object)null) { if (base.targetPlayer.isSprinting) { return 20f + num; } if (base.targetPlayer.isCrouching) { return 5f + num; } return 10f + num; } return 10f + num; } public bool NearbyTargetWithLoot(bool bCheckLOS = false, bool bAnyLoot = false) { //IL_004d: Unknown result type (might be due to invalid IL or missing references) //IL_00c5: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)base.targetPlayer != (Object)null) { if ((Object)(object)base.targetPlayer.currentlyHeldObject != (Object)null || (Object)(object)base.targetPlayer.currentlyHeldObjectServer != (Object)null) { if (!bCheckLOS) { return true; } if (CanSeePoint(((Component)base.targetPlayer.gameplayCamera).transform.position, 80f)) { return true; } } else if (bAnyLoot) { for (int i = 0; i < base.targetPlayer.ItemSlots.Length; i++) { if ((Object)(object)base.targetPlayer.ItemSlots[i] != (Object)null && base.targetPlayer.ItemSlots[i].grabbable && base.targetPlayer.ItemSlots[i].itemProperties.isConductiveMetal) { if (!bCheckLOS) { return true; } if (CanSeePoint(((Component)base.targetPlayer.gameplayCamera).transform.position, 80f)) { return true; } } } } } return false; } public bool CanSeePoint(Vector3 Point, float Range) { //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_000b: 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_0027: Unknown result type (might be due to invalid IL or missing references) //IL_0020: Unknown result type (might be due to invalid IL or missing references) //IL_0025: Unknown result type (might be due to invalid IL or missing references) //IL_0031: Unknown result type (might be due to invalid IL or missing references) //IL_0032: Unknown result type (might be due to invalid IL or missing references) Vector3 position = ((Component)this).transform.position; if ((Object)(object)base.eye != (Object)null) { position = base.eye.position; } if (Vector3.Distance(position, Point) < Range && !Physics.Linecast(position, Point, StartOfRound.Instance.collidersAndRoomMaskAndDefault)) { return true; } return false; } public GrabbableObject TryFindNearbyScrap(int range = 20, bool bOmniPotent = false) { //IL_00b0: Unknown result type (might be due to invalid IL or missing references) //IL_00b5: Unknown result type (might be due to invalid IL or missing references) //IL_00bc: Unknown result type (might be due to invalid IL or missing references) //IL_00c3: Unknown result type (might be due to invalid IL or missing references) //IL_00ce: Unknown result type (might be due to invalid IL or missing references) //IL_00d3: Unknown result type (might be due to invalid IL or missing references) //IL_00d6: Unknown result type (might be due to invalid IL or missing references) //IL_00e0: Expected O, but got Unknown //IL_00e6: 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_005e: Unknown result type (might be due to invalid IL or missing references) //IL_0063: 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_011a: Unknown result type (might be due to invalid IL or missing references) //IL_0124: 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_0136: Unknown result type (might be due to invalid IL or missing references) float num = range; GrabbableObject val = null; if (bOmniPotent) { for (int i = 0; i < grabbableObjectsInMap.Count; i++) { if (!((Object)(object)grabbableObjectsInMap[i] != (Object)null)) { continue; } GrabbableObject component = grabbableObjectsInMap[i].GetComponent<GrabbableObject>(); if (Object.op_Implicit((Object)(object)component) && !component.isHeld) { Vector3 val2 = grabbableObjectsInMap[i].transform.position - ((Component)this).transform.position; if (((Vector3)(ref val2)).magnitude < num) { val = component; num = range; } } } if ((Object)(object)val != (Object)null && CheckIfObjectClaimed(val)) { val = null; } if ((Object)(object)val != (Object)null) { Vector3 position = ((Component)val).transform.position; position = RoundManager.Instance.GetNavMeshPosition(position, RoundManager.Instance.navHit, 1.75f, -1); base.path1 = new NavMeshPath(); if (!base.agent.CalculatePath(position, base.path1)) { val = null; } if ((Object)(object)val != (Object)null && Vector3.Distance(base.path1.corners[base.path1.corners.Length - 1], RoundManager.Instance.GetNavMeshPosition(position, RoundManager.Instance.navHit, 2.7f, -1)) > 1.55f) { val = null; } } return val; } GameObject val3 = ((EnemyAI)this).CheckLineOfSight(grabbableObjectsInMap, 60f, range, 5f, (Transform)null, (int[])null); if (Object.op_Implicit((Object)(object)val3)) { GrabbableObject component2 = val3.GetComponent<GrabbableObject>(); if (Object.op_Implicit((Object)(object)component2) && !component2.isHeld) { return component2; } } return null; } public override void DoAIInterval() { //IL_098f: Unknown result type (might be due to invalid IL or missing references) //IL_0994: Unknown result type (might be due to invalid IL or missing references) //IL_0c17: Unknown result type (might be due to invalid IL or missing references) //IL_0c1c: Unknown result type (might be due to invalid IL or missing references) //IL_0d81: Unknown result type (might be due to invalid IL or missing references) //IL_0d86: 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_018d: Unknown result type (might be due to invalid IL or missing references) //IL_02f4: Unknown result type (might be due to invalid IL or missing references) //IL_02fa: Unknown result type (might be due to invalid IL or missing references) //IL_07e7: Unknown result type (might be due to invalid IL or missing references) //IL_07ed: Unknown result type (might be due to invalid IL or missing references) //IL_0b1f: Unknown result type (might be due to invalid IL or missing references) //IL_0b24: Unknown result type (might be due to invalid IL or missing references) //IL_0cf8: Unknown result type (might be due to invalid IL or missing references) //IL_0cfd: Unknown result type (might be due to invalid IL or missing references) //IL_0c2d: Unknown result type (might be due to invalid IL or missing references) //IL_0c38: Unknown result type (might be due to invalid IL or missing references) //IL_0c48: Unknown result type (might be due to invalid IL or missing references) //IL_0c4d: Unknown result type (might be due to invalid IL or missing references) //IL_0c52: Unknown result type (might be due to invalid IL or missing references) //IL_0d94: Unknown result type (might be due to invalid IL or missing references) //IL_0d9f: Unknown result type (might be due to invalid IL or missing references) //IL_0daf: Unknown result type (might be due to invalid IL or missing references) //IL_0db4: Unknown result type (might be due to invalid IL or missing references) //IL_0db9: Unknown result type (might be due to invalid IL or missing references) //IL_016a: Unknown result type (might be due to invalid IL or missing references) //IL_0170: Unknown result type (might be due to invalid IL or missing references) //IL_01ac: Unknown result type (might be due to invalid IL or missing references) //IL_019a: Unknown result type (might be due to invalid IL or missing references) //IL_096a: Unknown result type (might be due to invalid IL or missing references) //IL_0970: Unknown result type (might be due to invalid IL or missing references) //IL_0e40: Unknown result type (might be due to invalid IL or missing references) //IL_0e46: 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_0313: Unknown result type (might be due to invalid IL or missing references) //IL_0319: Unknown result type (might be due to invalid IL or missing references) //IL_073f: Unknown result type (might be due to invalid IL or missing references) //IL_0744: Unknown result type (might be due to invalid IL or missing references) //IL_0a59: Unknown result type (might be due to invalid IL or missing references) //IL_0a5e: Unknown result type (might be due to invalid IL or missing references) //IL_09c6: Unknown result type (might be due to invalid IL or missing references) //IL_09d6: Unknown result type (might be due to invalid IL or missing references) //IL_09db: Unknown result type (might be due to invalid IL or missing references) //IL_09e1: Unknown result type (might be due to invalid IL or missing references) //IL_09e6: Unknown result type (might be due to invalid IL or missing references) //IL_0d21: Unknown result type (might be due to invalid IL or missing references) //IL_0d2e: Unknown result type (might be due to invalid IL or missing references) //IL_0d33: Unknown result type (might be due to invalid IL or missing references) //IL_0d18: Unknown result type (might be due to invalid IL or missing references) //IL_0d1d: Unknown result type (might be due to invalid IL or missing references) //IL_0c83: Unknown result type (might be due to invalid IL or missing references) //IL_0c88: Unknown result type (might be due to invalid IL or missing references) //IL_0c62: Unknown result type (might be due to invalid IL or missing references) //IL_0c67: Unknown result type (might be due to invalid IL or missing references) //IL_0c70: Unknown result type (might be due to invalid IL or missing references) //IL_0c76: Unknown result type (might be due to invalid IL or missing references) //IL_0de9: Unknown result type (might be due to invalid IL or missing references) //IL_0def: Unknown result type (might be due to invalid IL or missing references) //IL_0dcc: Unknown result type (might be due to invalid IL or missing references) //IL_0dd1: Unknown result type (might be due to invalid IL or missing references) //IL_01e7: 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_01d5: Unknown result type (might be due to invalid IL or missing references) //IL_022f: Unknown result type (might be due to invalid IL or missing references) //IL_023f: Unknown result type (might be due to invalid IL or missing references) //IL_0244: Unknown result type (might be due to invalid IL or missing references) //IL_0249: Unknown result type (might be due to invalid IL or missing references) //IL_032e: Unknown result type (might be due to invalid IL or missing references) //IL_0334: Unknown result type (might be due to invalid IL or missing references) //IL_07a9: Unknown result type (might be due to invalid IL or missing references) //IL_07af: Unknown result type (might be due to invalid IL or missing references) //IL_0752: Unknown result type (might be due to invalid IL or missing references) //IL_075d: Unknown result type (might be due to invalid IL or missing references) //IL_076d: Unknown result type (might be due to invalid IL or missing references) //IL_0772: Unknown result type (might be due to invalid IL or missing references) //IL_0777: Unknown result type (might be due to invalid IL or missing references) //IL_051e: Unknown result type (might be due to invalid IL or missing references) //IL_0523: Unknown result type (might be due to invalid IL or missing references) //IL_0529: Unknown result type (might be due to invalid IL or missing references) //IL_052e: Unknown result type (might be due to invalid IL or missing references) //IL_080d: Unknown result type (might be due to invalid IL or missing references) //IL_0813: Unknown result type (might be due to invalid IL or missing references) //IL_0b70: Unknown result type (might be due to invalid IL or missing references) //IL_0b80: Unknown result type (might be due to invalid IL or missing references) //IL_0b85: Unknown result type (might be due to invalid IL or missing references) //IL_0b8a: Unknown result type (might be due to invalid IL or missing references) //IL_0b58: Unknown result type (might be due to invalid IL or missing references) //IL_0b5d: Unknown result type (might be due to invalid IL or missing references) //IL_0a95: Unknown result type (might be due to invalid IL or missing references) //IL_0a9a: Unknown result type (might be due to invalid IL or missing references) //IL_0a76: Unknown result type (might be due to invalid IL or missing references) //IL_0a82: Unknown result type (might be due to invalid IL or missing references) //IL_0a88: Unknown result type (might be due to invalid IL or missing references) //IL_0a8a: Unknown result type (might be due to invalid IL or missing references) //IL_0a8f: Unknown result type (might be due to invalid IL or missing references) //IL_0a25: Unknown result type (might be due to invalid IL or missing references) //IL_0a2a: Unknown result type (might be due to invalid IL or missing references) //IL_09fe: Unknown result type (might be due to invalid IL or missing references) //IL_0a0e: Unknown result type (might be due to invalid IL or missing references) //IL_0a13: Unknown result type (might be due to invalid IL or missing references) //IL_0d5c: Unknown result type (might be due to invalid IL or missing references) //IL_0d62: Unknown result type (might be due to invalid IL or missing references) //IL_0d4d: Unknown result type (might be due to invalid IL or missing references) //IL_0d52: Unknown result type (might be due to invalid IL or missing references) //IL_021a: Unknown result type (might be due to invalid IL or missing references) //IL_0220: Unknown result type (might be due to invalid IL or missing references) //IL_01ff: Unknown result type (might be due to invalid IL or missing references) //IL_0204: Unknown result type (might be due to invalid IL or missing references) //IL_020b: Unknown result type (might be due to invalid IL or missing references) //IL_0281: Unknown result type (might be due to invalid IL or missing references) //IL_0286: Unknown result type (might be due to invalid IL or missing references) //IL_0259: Unknown result type (might be due to invalid IL or missing references) //IL_025e: Unknown result type (might be due to invalid IL or missing references) //IL_026e: Unknown result type (might be due to invalid IL or missing references) //IL_0274: Unknown result type (might be due to invalid IL or missing references) //IL_0348: Unknown result type (might be due to invalid IL or missing references) //IL_034e: Unknown result type (might be due to invalid IL or missing references) //IL_078a: Unknown result type (might be due to invalid IL or missing references) //IL_078f: Unknown result type (might be due to invalid IL or missing references) //IL_0798: Unknown result type (might be due to invalid IL or missing references) //IL_079e: Unknown result type (might be due to invalid IL or missing references) //IL_065f: Unknown result type (might be due to invalid IL or missing references) //IL_0664: Unknown result type (might be due to invalid IL or missing references) //IL_066b: Unknown result type (might be due to invalid IL or missing references) //IL_0676: Unknown result type (might be due to invalid IL or missing references) //IL_0686: Unknown result type (might be due to invalid IL or missing references) //IL_068b: Unknown result type (might be due to invalid IL or missing references) //IL_0690: Unknown result type (might be due to invalid IL or missing references) //IL_0646: Unknown result type (might be due to invalid IL or missing references) //IL_064c: Unknown result type (might be due to invalid IL or missing references) //IL_053f: Unknown result type (might be due to invalid IL or missing references) //IL_054a: Unknown result type (might be due to invalid IL or missing references) //IL_055a: Unknown result type (might be due to invalid IL or missing references) //IL_055f: Unknown result type (might be due to invalid IL or missing references) //IL_0564: Unknown result type (might be due to invalid IL or missing references) //IL_084e: Unknown result type (might be due to invalid IL or missing references) //IL_0854: Unknown result type (might be due to invalid IL or missing references) //IL_0b9a: Unknown result type (might be due to invalid IL or missing references) //IL_0b9f: Unknown result type (might be due to invalid IL or missing references) //IL_0ad1: Unknown result type (might be due to invalid IL or missing references) //IL_0ad6: Unknown result type (might be due to invalid IL or missing references) //IL_0ab2: Unknown result type (might be due to invalid IL or missing references) //IL_0abe: Unknown result type (might be due to invalid IL or missing references) //IL_0ac4: Unknown result type (might be due to invalid IL or missing references) //IL_0ac6: Unknown result type (might be due to invalid IL or missing references) //IL_0acb: Unknown result type (might be due to invalid IL or missing references) //IL_0a3e: Unknown result type (might be due to invalid IL or missing references) //IL_0a4e: Unknown result type (might be due to invalid IL or missing references) //IL_0a53: Unknown result type (might be due to invalid IL or missing references) //IL_0cbf: Unknown result type (might be due to invalid IL or missing references) //IL_0cc4: Unknown result type (might be due to invalid IL or missing references) //IL_0cd4: Unknown result type (might be due to invalid IL or missing references) //IL_0cda: Unknown result type (might be due to invalid IL or missing references) //IL_0595: Unknown result type (might be due to invalid IL or missing references) //IL_059a: Unknown result type (might be due to invalid IL or missing references) //IL_0574: Unknown result type (might be due to invalid IL or missing references) //IL_0579: Unknown result type (might be due to invalid IL or missing references) //IL_0582: Unknown result type (might be due to invalid IL or missing references) //IL_0588: Unknown result type (might be due to invalid IL or missing references) //IL_0bb5: Unknown result type (might be due to invalid IL or missing references) //IL_0bbb: Unknown result type (might be due to invalid IL or missing references) //IL_0b0e: Unknown result type (might be due to invalid IL or missing references) //IL_0aee: Unknown result type (might be due to invalid IL or missing references) //IL_0afa: Unknown result type (might be due to invalid IL or missing references) //IL_0b00: U