#define DEBUG
using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using BepInEx;
using BepInEx.Bootstrap;
using BepInEx.Configuration;
using BepInEx.Logging;
using GameNetcodeStuff;
using HarmonyLib;
using LethalLib.Modules;
using Microsoft.CodeAnalysis;
using MoreCompany;
using MoreCompany.Cosmetics;
using SCP049.NetcodePatcher;
using Unity.Netcode;
using UnityEngine;
using UnityEngine.AI;
[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")]
[assembly: AssemblyCompany("SCP049")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyDescription("SCP 049 for Lethal Company.")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("SCP049")]
[assembly: AssemblyTitle("SCP049")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.0.0")]
[module: UnverifiableCode]
[module: RefSafetyRules(11)]
[module: NetcodePatchedAssembly]
internal class <Module>
{
static <Module>()
{
NetworkVariableSerializationTypes.InitializeSerializer_UnmanagedINetworkSerializable<NetworkBehaviourReference>();
NetworkVariableSerializationTypes.InitializeEqualityChecker_UnmanagedIEquatable<NetworkBehaviourReference>();
}
}
namespace Microsoft.CodeAnalysis
{
[CompilerGenerated]
[Microsoft.CodeAnalysis.Embedded]
internal sealed class EmbeddedAttribute : Attribute
{
}
}
namespace System.Runtime.CompilerServices
{
[CompilerGenerated]
[Microsoft.CodeAnalysis.Embedded]
[AttributeUsage(AttributeTargets.Class | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Parameter | AttributeTargets.ReturnValue | AttributeTargets.GenericParameter, AllowMultiple = false, Inherited = false)]
internal sealed class NullableAttribute : Attribute
{
public readonly byte[] NullableFlags;
public NullableAttribute(byte P_0)
{
NullableFlags = new byte[1] { P_0 };
}
public NullableAttribute(byte[] P_0)
{
NullableFlags = P_0;
}
}
[CompilerGenerated]
[Microsoft.CodeAnalysis.Embedded]
[AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Method | AttributeTargets.Interface | AttributeTargets.Delegate, AllowMultiple = false, Inherited = false)]
internal sealed class NullableContextAttribute : Attribute
{
public readonly byte Flag;
public NullableContextAttribute(byte P_0)
{
Flag = P_0;
}
}
[CompilerGenerated]
[Microsoft.CodeAnalysis.Embedded]
[AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)]
internal sealed class RefSafetyRulesAttribute : Attribute
{
public readonly int Version;
public RefSafetyRulesAttribute(int P_0)
{
Version = P_0;
}
}
}
namespace SCP049
{
public static class PluginInformation
{
public const string PLUGIN_GUID = "scp049";
public const string PLUGIN_NAME = "SCP 049";
public const string PLUGIN_VERSION = "1.0.2";
}
[BepInDependency(/*Could not decode attribute arguments.*/)]
[BepInPlugin("scp049", "SCP 049", "1.0.2")]
public class Plugin : BaseUnityPlugin
{
public static Harmony _harmony;
public static AssetBundle MainAssetBundle;
public static EnemyType Scp49Enemy;
public static EnemyType Scp492Enemy;
public static AudioClip yipeeSound;
internal static ManualLogSource Logger;
public static ConfigFile config;
public static ConfigEntry<int> scp049spawnWeight;
public static ConfigEntry<bool> scp049killable;
public static ConfigEntry<int> scp049health;
public static ConfigEntry<float> scp049roamSpeed;
public static ConfigEntry<float> scp049chaseSpeed;
public static ConfigEntry<int> scp049damage;
public static ConfigEntry<int> scp049maxZombies;
public static ConfigEntry<int> scp0492spawnWeight;
public static ConfigEntry<bool> scp0492killable;
public static ConfigEntry<int> scp0492health;
public static ConfigEntry<float> scp0492roamSpeed;
public static ConfigEntry<float> scp0492chaseSpeed;
public static ConfigEntry<int> scp0492damage;
public static ConfigEntry<bool> yipee;
[Conditional("DEBUG")]
public static void LogIfDebugBuild(string text)
{
Logger.LogInfo((object)text);
}
private void Awake()
{
//IL_0034: Unknown result type (might be due to invalid IL or missing references)
//IL_003e: Expected O, but got Unknown
Logger = ((BaseUnityPlugin)this).Logger;
MainAssetBundle = AssetBundle.LoadFromFile(Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), "scp049assets"));
_harmony = new Harmony("scp049");
InitializeConfig();
Scp49Enemy = MainAssetBundle.LoadAsset<EnemyType>("Scp049Type");
Scp492Enemy = MainAssetBundle.LoadAsset<EnemyType>("Scp049-2Type");
yipeeSound = MainAssetBundle.LoadAsset<AudioClip>("yipee");
TerminalNode val = MainAssetBundle.LoadAsset<TerminalNode>("Scp049EnemyTN");
TerminalKeyword val2 = MainAssetBundle.LoadAsset<TerminalKeyword>("Scp049EnemyTK");
TerminalNode val3 = MainAssetBundle.LoadAsset<TerminalNode>("Scp0492EnemyTN");
TerminalKeyword val4 = MainAssetBundle.LoadAsset<TerminalKeyword>("Scp0492EnemyTK");
if ((Object)(object)Scp49Enemy == (Object)null)
{
Logger.LogError((object)"Scp 049 is null");
}
if ((Object)(object)Scp492Enemy == (Object)null)
{
Logger.LogError((object)"Scp 049-2 is null");
}
NetworkPrefabs.RegisterNetworkPrefab(Scp49Enemy.enemyPrefab);
NetworkPrefabs.RegisterNetworkPrefab(Scp492Enemy.enemyPrefab);
Enemies.RegisterEnemy(Scp49Enemy, scp049spawnWeight.Value, (LevelTypes)(-1), (SpawnType)0, val, val2);
Enemies.RegisterEnemy(Scp492Enemy, scp0492spawnWeight.Value, (LevelTypes)(-1), (SpawnType)0, val3, val4);
Type[] types = Assembly.GetExecutingAssembly().GetTypes();
Type[] array = types;
foreach (Type type in array)
{
MethodInfo[] methods = type.GetMethods(BindingFlags.Instance | BindingFlags.Static | BindingFlags.NonPublic);
MethodInfo[] array2 = methods;
foreach (MethodInfo methodInfo in array2)
{
object[] customAttributes = methodInfo.GetCustomAttributes(typeof(RuntimeInitializeOnLoadMethodAttribute), inherit: false);
if (customAttributes.Length != 0)
{
methodInfo.Invoke(null, null);
}
}
}
}
private void InitializeConfig()
{
scp049spawnWeight = ((BaseUnityPlugin)this).Config.Bind<int>("Scp-049", "SpawnWeight", 10, "The SpawnWeight for SCP-049 1 - 100");
scp049killable = ((BaseUnityPlugin)this).Config.Bind<bool>("Scp-049", "Killable", false, "Is SCP-049 killable?");
scp049health = ((BaseUnityPlugin)this).Config.Bind<int>("Scp-049", "Health", 10, "The health of SCP-049");
scp049roamSpeed = ((BaseUnityPlugin)this).Config.Bind<float>("Scp-049", "RoamSpeed", 1.5f, "The Roaming speed of SCP-049");
scp049chaseSpeed = ((BaseUnityPlugin)this).Config.Bind<float>("Scp-049", "ChaseSpeed", 5f, "The Chasing speed of SCP-049");
scp049damage = ((BaseUnityPlugin)this).Config.Bind<int>("Scp-049", "Damage", 100, "The amount of damage from SCP-049");
scp049maxZombies = ((BaseUnityPlugin)this).Config.Bind<int>("Scp-049", "MaxZombies", 2, "The Maximum amount of Zombies that can spawn around SCP-049 when spawning.");
scp0492spawnWeight = ((BaseUnityPlugin)this).Config.Bind<int>("Scp-049-2", "SpawnWeight", 0, "The SpawnWeight for SCP-049-2 1 - 100");
scp0492killable = ((BaseUnityPlugin)this).Config.Bind<bool>("Scp-049-2", "Killable", false, "Is SCP-049-2 killable?");
scp0492health = ((BaseUnityPlugin)this).Config.Bind<int>("Scp-049-2", "Health", 4, "The health of SCP-049-2");
scp0492roamSpeed = ((BaseUnityPlugin)this).Config.Bind<float>("Scp-049-2", "RoamSpeed", 0.8f, "The Roaming speed of SCP-049-2");
scp0492chaseSpeed = ((BaseUnityPlugin)this).Config.Bind<float>("Scp-049-2", "ChaseSpeed", 1f, "The Chasing speed of SCP-049-2");
scp0492damage = ((BaseUnityPlugin)this).Config.Bind<int>("Scp-049-2", "Damage", 33, "The amount of damage from SCP-049-2");
yipee = ((BaseUnityPlugin)this).Config.Bind<bool>("Secret Stuff", "Yipee Mode", false, "Youll find out what this does :)");
}
}
internal class Scp049 : EnemyAI
{
private enum State
{
Searching,
Attacking,
Surgery
}
[Header("SCP 049")]
public Transform turnCompass = null;
private bool isDeadAnimationDone;
private Vector3 agentLocalVelocity;
private Vector3 previousPosition;
private float velX;
public Transform animationHolder;
public float timeSinceSpeakingSearching;
public float timeSinceSpeakingAttacking;
private bool armUp;
public bool heardNoise = false;
public bool checkingNoise = false;
public Vector3 heardPosition;
[SerializeField]
private AudioSource movementAudio;
[SerializeField]
private AudioClip[] searchVoiceLines;
[SerializeField]
private AudioClip[] attackVoiceLines;
[SerializeField]
private AudioClip[] killLines;
[SerializeField]
private AudioClip[] footstepClips;
private int previousFootstepClip;
private Random enemyRandom;
private NetworkVariable<NetworkBehaviourReference> _playerNetVar = new NetworkVariable<NetworkBehaviourReference>(default(NetworkBehaviourReference), (NetworkVariableReadPermission)0, (NetworkVariableWritePermission)0);
private Coroutine surgeryCoroutine;
public PlayerControllerB TheTargetPlayer
{
get
{
//IL_0007: Unknown result type (might be due to invalid IL or missing references)
//IL_0011: Unknown result type (might be due to invalid IL or missing references)
//IL_0017: Expected O, but got Unknown
return (PlayerControllerB)NetworkBehaviourReference.op_Implicit(_playerNetVar.Value);
}
set
{
//IL_002a: 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)
if ((Object)(object)value == (Object)null)
{
_playerNetVar.Value = NetworkBehaviourReference.op_Implicit((NetworkBehaviour)null);
}
else
{
_playerNetVar.Value = new NetworkBehaviourReference((NetworkBehaviour)(object)value);
}
}
}
public override void Start()
{
//IL_0040: Unknown result type (might be due to invalid IL or missing references)
//IL_0065: Unknown result type (might be due to invalid IL or missing references)
//IL_006a: Unknown result type (might be due to invalid IL or missing references)
//IL_006c: Unknown result type (might be due to invalid IL or missing references)
//IL_0079: Unknown result type (might be due to invalid IL or missing references)
enemyRandom = new Random(StartOfRound.Instance.randomMapSeed + 69);
((EnemyAI)this).Start();
Plugin.LogIfDebugBuild("SCP-049 Spawned");
isDeadAnimationDone = false;
base.currentBehaviourStateIndex = 0;
((EnemyAI)this).StartSearch(((Component)this).transform.position, (AISearchRoutine)null);
HashSet<Vector3> hashSet = new HashSet<Vector3>();
int num = 0;
for (int i = 0; i < enemyRandom.Next(0, Plugin.scp049maxZombies.Value); i++)
{
Vector3 randomAINodePosition = GetRandomAINodePosition(hashSet);
hashSet.Add(randomAINodePosition);
SpawnZombieServerRpc(6969, randomAINodePosition);
num++;
}
Plugin.LogIfDebugBuild("SCP-049 Spawned " + num + " Zombies around it.");
}
private Vector3 GetRandomAINodePosition(HashSet<Vector3> usedPositions, float minDistance = 5f, float maxDistance = 10f)
{
//IL_0016: Unknown result type (might be due to invalid IL or missing references)
//IL_001b: Unknown result type (might be due to invalid IL or missing references)
//IL_00a9: Unknown result type (might be due to invalid IL or missing references)
//IL_0040: Unknown result type (might be due to invalid IL or missing references)
//IL_0045: 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_005a: Unknown result type (might be due to invalid IL or missing references)
//IL_00a0: Unknown result type (might be due to invalid IL or missing references)
//IL_00a5: Unknown result type (might be due to invalid IL or missing references)
//IL_0082: Unknown result type (might be due to invalid IL or missing references)
//IL_0087: Unknown result type (might be due to invalid IL or missing references)
GameObject[] array = GameObject.FindGameObjectsWithTag("AINode");
if (array.Length == 0)
{
return Vector3.zero;
}
List<Vector3> list = new List<Vector3>();
GameObject[] array2 = array;
foreach (GameObject val in array2)
{
Vector3 position = val.transform.position;
if (!usedPositions.Contains(position))
{
list.Add(position);
}
}
if (list.Count == 0)
{
return Vector3.zero;
}
int index = enemyRandom.Next(0, list.Count);
return list[index];
}
public override void Update()
{
//IL_0019: 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_0043: 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_0058: 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_0072: 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_019c: Unknown result type (might be due to invalid IL or missing references)
//IL_01b3: Unknown result type (might be due to invalid IL or missing references)
//IL_01c3: Unknown result type (might be due to invalid IL or missing references)
//IL_01d2: Unknown result type (might be due to invalid IL or missing references)
//IL_01d7: 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)
((EnemyAI)this).Update();
base.creatureAnimator.SetBool("IsMoving", Vector3.Distance(((Component)this).transform.position, previousPosition) > 0f);
agentLocalVelocity = animationHolder.InverseTransformDirection(Vector3.ClampMagnitude(((Component)this).transform.position - previousPosition, 1f) / (Time.deltaTime * 2f));
velX = Mathf.Lerp(velX, agentLocalVelocity.z, 10f * Time.deltaTime);
base.creatureAnimator.SetFloat("VelocityX", Mathf.Clamp(velX, 0f, 1f));
previousPosition = ((Component)this).transform.position;
if (!base.creatureVoice.isPlaying)
{
timeSinceSpeakingSearching += Time.deltaTime;
timeSinceSpeakingAttacking += Time.deltaTime;
}
if (base.isEnemyDead)
{
if (!isDeadAnimationDone)
{
isDeadAnimationDone = true;
base.creatureVoice.Stop();
base.creatureVoice.PlayOneShot(base.dieSFX, 0.75f);
}
return;
}
if ((Object)(object)TheTargetPlayer != (Object)null || ((Object)(object)TheTargetPlayer != (Object)null && base.currentBehaviourStateIndex == 1))
{
turnCompass.LookAt(((Component)TheTargetPlayer.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()
{
//IL_01bc: Unknown result type (might be due to invalid IL or missing references)
//IL_01cc: Unknown result type (might be due to invalid IL or missing references)
//IL_01e9: Unknown result type (might be due to invalid IL or missing references)
//IL_0213: Unknown result type (might be due to invalid IL or missing references)
//IL_015a: 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_0147: 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_035f: Unknown result type (might be due to invalid IL or missing references)
((EnemyAI)this).DoAIInterval();
if (base.isEnemyDead || StartOfRound.Instance.allPlayersDead)
{
return;
}
switch (base.currentBehaviourStateIndex)
{
case 0:
base.agent.speed = Plugin.scp049roamSpeed.Value;
if (timeSinceSpeakingSearching > 13f && !base.creatureVoice.isPlaying)
{
base.creatureVoice.PlayOneShot(Plugin.yipee.Value ? Plugin.yipeeSound : searchVoiceLines[enemyRandom.Next(0, searchVoiceLines.Length)], 0.75f);
timeSinceSpeakingSearching = 0f;
}
if (FindClosestPlayerInRange(25f))
{
Plugin.Logger.LogInfo((object)"Found Player (Dont worry i'll cure you)");
((EnemyAI)this).StopSearch(base.currentSearch, true);
checkingNoise = false;
heardNoise = false;
((EnemyAI)this).SwitchToBehaviourClientRpc(1);
}
if (heardNoise)
{
if (!checkingNoise)
{
checkingNoise = true;
((EnemyAI)this).StopSearch(base.currentSearch, false);
((EnemyAI)this).SetDestinationToPosition(heardPosition, false);
}
if (Vector3.Distance(((Component)this).transform.position, heardPosition) < 5f)
{
heardNoise = false;
checkingNoise = false;
((EnemyAI)this).StartSearch(((Component)this).transform.position, (AISearchRoutine)null);
}
}
break;
case 1:
base.agent.speed = Plugin.scp049chaseSpeed.Value;
if (Vector3.Distance(((Component)this).transform.position, ((Component)TheTargetPlayer).transform.position) > 15f && !SCPHasLineOfSightToPosition(((Component)TheTargetPlayer).transform.position))
{
((EnemyAI)this).StartSearch(((Component)this).transform.position, (AISearchRoutine)null);
((EnemyAI)this).SwitchToBehaviourClientRpc(0);
if (armUp)
{
armUp = false;
SetArmUpServerRpc(setOut: false);
}
break;
}
if (timeSinceSpeakingAttacking > 13f && !base.creatureVoice.isPlaying)
{
base.creatureVoice.PlayOneShot(Plugin.yipee.Value ? Plugin.yipeeSound : attackVoiceLines[enemyRandom.Next(0, attackVoiceLines.Length)], 0.75f);
timeSinceSpeakingAttacking = 0f;
}
if (base.mostOptimalDistance > 7f)
{
if (armUp)
{
armUp = false;
SetArmUpServerRpc(setOut: false);
}
}
else if (base.mostOptimalDistance < 14f && !armUp)
{
armUp = true;
SetArmUpServerRpc(setOut: true);
}
if (!((Object)(object)TheTargetPlayer == (Object)null) && !((Object)(object)TheTargetPlayer == (Object)null) && ((NetworkBehaviour)this).IsOwner)
{
((EnemyAI)this).SetDestinationToPosition(((Component)TheTargetPlayer).transform.position, false);
}
break;
case 2:
base.agent.speed = 0f;
break;
default:
Plugin.LogIfDebugBuild("This Behavior State doesn't exist!");
break;
}
}
public bool FindClosestPlayerInRange(float range)
{
//IL_0074: Unknown result type (might be due to invalid IL or missing references)
//IL_0080: 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)
PlayerControllerB val = null;
float num = float.MaxValue;
PlayerControllerB[] allPlayerScripts = StartOfRound.Instance.allPlayerScripts;
foreach (PlayerControllerB val2 in allPlayerScripts)
{
if (((NetworkBehaviour)val2).IsSpawned && val2.isPlayerControlled && !val2.isPlayerDead && !val2.isInHangarShipRoom && SCPHasLineOfSightToPosition(((Component)val2).transform.position, 45f, (int)range))
{
float num2 = Vector3.Distance(((Component)this).transform.position, ((Component)val2).transform.position);
if (num2 < num)
{
num = num2;
val = val2;
}
}
}
if ((Object)(object)val != (Object)null)
{
TheTargetPlayer = val;
return true;
}
return false;
}
public bool SCPHasLineOfSightToPosition(Vector3 pos, float width = 120f, int range = 50, float proximityAwareness = 10f)
{
//IL_002b: Unknown result type (might be due to invalid IL or missing references)
//IL_0030: Unknown result type (might be due to invalid IL or missing references)
//IL_0040: Unknown result type (might be due to invalid IL or missing references)
//IL_0045: Unknown result type (might be due to invalid IL or missing references)
//IL_0060: Unknown result type (might be due to invalid IL or missing references)
//IL_0067: Unknown result type (might be due to invalid IL or missing references)
//IL_006c: Unknown result type (might be due to invalid IL or missing references)
//IL_0071: Unknown result type (might be due to invalid IL or missing references)
//IL_0078: 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_008c: Unknown result type (might be due to invalid IL or missing references)
//IL_0091: Unknown result type (might be due to invalid IL or missing references)
if ((Object)(object)base.eye == (Object)null)
{
_ = ((Component)this).transform;
}
else
{
_ = base.eye;
}
if (Vector3.Distance(base.eye.position, pos) < (float)range && !Physics.Linecast(base.eye.position, pos, StartOfRound.Instance.collidersAndRoomMaskAndDefault))
{
Vector3 val = pos - base.eye.position;
if (Vector3.Angle(base.eye.forward, val) < width || Vector3.Distance(((Component)this).transform.position, pos) < proximityAwareness)
{
return true;
}
}
return false;
}
[ServerRpc(RequireOwnership = false)]
public void SetArmUpServerRpc(bool setOut)
{
//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)
{
if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1 && (networkManager.IsClient || networkManager.IsHost))
{
ServerRpcParams val = default(ServerRpcParams);
FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendServerRpc(1894502201u, val, (RpcDelivery)0);
((FastBufferWriter)(ref val2)).WriteValueSafe<bool>(ref setOut, default(ForPrimitives));
((NetworkBehaviour)this).__endSendServerRpc(ref val2, 1894502201u, val, (RpcDelivery)0);
}
if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost))
{
SetArmUpClientRpc(setOut);
}
}
}
[ClientRpc]
public void SetArmUpClientRpc(bool setUp)
{
//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)
{
if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 2 && (networkManager.IsServer || networkManager.IsHost))
{
ClientRpcParams val = default(ClientRpcParams);
FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(794464084u, val, (RpcDelivery)0);
((FastBufferWriter)(ref val2)).WriteValueSafe<bool>(ref setUp, default(ForPrimitives));
((NetworkBehaviour)this).__endSendClientRpc(ref val2, 794464084u, val, (RpcDelivery)0);
}
if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 2 && (networkManager.IsClient || networkManager.IsHost))
{
armUp = setUp;
base.creatureAnimator.SetBool("ArmUp", setUp);
}
}
}
public void PlayFootstepSound()
{
int num = enemyRandom.Next(0, footstepClips.Length);
if (num == previousFootstepClip)
{
num = (num + 1) % footstepClips.Length;
}
movementAudio.pitch = Random.Range(0.93f, 1.07f);
movementAudio.PlayOneShot(footstepClips[num], 0.4f);
previousFootstepClip = num;
WalkieTalkie.TransmitOneShotAudio(movementAudio, footstepClips[num], 0.4f);
}
public override void AnimationEventA()
{
((EnemyAI)this).AnimationEventA();
PlayFootstepSound();
}
public override void OnCollideWithPlayer(Collider other)
{
//IL_0040: Unknown result type (might be due to invalid IL or missing references)
//IL_0046: Unknown result type (might be due to invalid IL or missing references)
PlayerControllerB val = ((EnemyAI)this).MeetsStandardPlayerCollisionConditions(other, false, false);
if ((Object)(object)val != (Object)null && base.currentBehaviourStateIndex == 1 && surgeryCoroutine == null)
{
val.DamagePlayer(Plugin.scp049damage.Value, true, true, (CauseOfDeath)0, 0, false, default(Vector3));
if (val.isPlayerDead)
{
surgeryCoroutine = ((MonoBehaviour)this).StartCoroutine(DoSurgeryCoroutine(val));
}
}
}
private IEnumerator DoSurgeryCoroutine(PlayerControllerB playerControllerB)
{
PlayKillLineClientRpc();
((EnemyAI)this).SwitchToBehaviourServerRpc(2);
DoAnimationClientRpc("startSurgery");
SpawnZombieServerRpc((int)playerControllerB.playerClientId, default(Vector3), wakeUpOnStart: true);
yield return (object)new WaitForSeconds(8f);
((EnemyAI)this).StartSearch(((Component)this).transform.position, (AISearchRoutine)null);
((EnemyAI)this).SwitchToBehaviourServerRpc(0);
if (armUp)
{
armUp = false;
SetArmUpServerRpc(setOut: false);
}
surgeryCoroutine = null;
}
[ClientRpc]
public void PlayKillLineClientRpc()
{
//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(708352434u, val, (RpcDelivery)0);
((NetworkBehaviour)this).__endSendClientRpc(ref val2, 708352434u, val, (RpcDelivery)0);
}
if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 2 && (networkManager.IsClient || networkManager.IsHost))
{
base.creatureVoice.PlayOneShot(killLines[enemyRandom.Next(0, killLines.Length)], 0.75f);
}
}
}
[ServerRpc(RequireOwnership = false)]
public void SpawnZombieServerRpc(int playerObjectId = 6969, Vector3 spawnPosition = default(Vector3), bool wakeUpOnStart = false)
{
//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_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)
//IL_013c: Unknown result type (might be due to invalid IL or missing references)
//IL_0141: Unknown result type (might be due to invalid IL or missing references)
//IL_0129: Unknown result type (might be due to invalid IL or missing references)
//IL_0146: Unknown result type (might be due to invalid IL or missing references)
//IL_014d: Unknown result type (might be due to invalid IL or missing references)
//IL_0158: Unknown result type (might be due to invalid IL or missing references)
//IL_0162: Unknown result type (might be due to invalid IL or missing references)
//IL_0167: Unknown result type (might be due to invalid IL or missing references)
//IL_016c: Unknown result type (might be due to invalid IL or missing references)
//IL_016f: Unknown result type (might be due to invalid IL or missing references)
//IL_017c: Unknown result type (might be due to invalid IL or missing references)
//IL_017d: Unknown result type (might be due to invalid IL or missing references)
//IL_0184: Unknown result type (might be due to invalid IL or missing references)
//IL_0189: Unknown result type (might be due to invalid IL or missing references)
//IL_01a3: Unknown result type (might be due to invalid IL or missing references)
//IL_01a6: Unknown result type (might be due to invalid IL or missing references)
//IL_01ac: Unknown result type (might be due to invalid IL or missing references)
//IL_01bb: 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_01b5: 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_01d2: Unknown result type (might be due to invalid IL or missing references)
//IL_01e1: Unknown result type (might be due to invalid IL or missing references)
//IL_01e6: Unknown result type (might be due to invalid IL or missing references)
//IL_01f0: Unknown result type (might be due to invalid IL or missing references)
//IL_01f5: Unknown result type (might be due to invalid IL or missing references)
//IL_01fa: Unknown result type (might be due to invalid IL or missing references)
//IL_022b: 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_0261: Unknown result type (might be due to invalid IL or missing references)
//IL_0393: Unknown result type (might be due to invalid IL or missing references)
NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
if (networkManager == null || !networkManager.IsListening)
{
return;
}
if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1 && (networkManager.IsClient || networkManager.IsHost))
{
ServerRpcParams val = default(ServerRpcParams);
FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendServerRpc(2448079418u, val, (RpcDelivery)0);
BytePacker.WriteValueBitPacked(val2, playerObjectId);
((FastBufferWriter)(ref val2)).WriteValueSafe(ref spawnPosition);
((FastBufferWriter)(ref val2)).WriteValueSafe<bool>(ref wakeUpOnStart, default(ForPrimitives));
((NetworkBehaviour)this).__endSendServerRpc(ref val2, 2448079418u, val, (RpcDelivery)0);
}
if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1 || (!networkManager.IsServer && !networkManager.IsHost))
{
return;
}
PlayerControllerB val3 = ((playerObjectId != 6969) ? StartOfRound.Instance.allPlayerScripts[playerObjectId] : StartOfRound.Instance.allPlayerScripts[0]);
Vector3 val4 = ((!((NetworkBehaviour)val3).IsOwner) ? ((Component)val3).transform.parent.TransformPoint(val3.serverPlayerPosition) : ((Component)val3).transform.position);
Vector3 val5 = ((Component)this).transform.position - ((Component)this).transform.forward * 2f;
val5.y = val4.y;
Ray val6 = default(Ray);
((Ray)(ref val6))..ctor(val4, val5 - ((Component)val3).transform.position);
if (!((NetworkBehaviour)this).IsServer)
{
return;
}
Vector3 val7 = spawnPosition;
Vector3 val8 = default(Vector3);
Vector3 val9 = ((val7 == val8) ? GetGroundPosition(((Ray)(ref val6)).origin) : spawnPosition);
Quaternion val10 = Quaternion.Euler(0f, ((Component)val3).transform.eulerAngles.y, 0f);
val8 = GetGroundPosition(((Ray)(ref val6)).origin);
Plugin.LogIfDebugBuild("thing: " + ((object)(Vector3)(ref val8)).ToString() + "final thing: " + ((object)(Vector3)(ref val9)).ToString());
NetworkObjectReference netObjectRef = RoundManager.Instance.SpawnEnemyGameObject(val9, ((Quaternion)(ref val10)).eulerAngles.y, -1, Plugin.Scp492Enemy);
NetworkObject val11 = default(NetworkObject);
if (!((NetworkObjectReference)(ref netObjectRef)).TryGet(ref val11, (NetworkManager)null))
{
return;
}
((Component)val11).transform.position = val9;
List<UnlockableItem> list = (from u in StartOfRound.Instance.unlockablesList.unlockables
where u.unlockableName.Contains("suit", StringComparison.OrdinalIgnoreCase)
orderby u.unlockableName
select u).ToList();
int num = Random.Range(0, list.Count);
Scp0492 component = ((Component)val11).GetComponent<Scp0492>();
if (wakeUpOnStart)
{
component.WakeUp();
}
if (playerObjectId == 6969)
{
Plugin.LogIfDebugBuild("RandomSuitID: " + num);
component.SetSuit(num, random: true);
}
else
{
component.SetSuit(val3.currentSuitID);
component.whoAmIOriginally = val3;
component.ApplyMoreCompanyToZombie();
if ((Object)(object)val3.deadBody != (Object)null)
{
val3.deadBody.DeactivateBody(false);
}
}
Plugin.LogIfDebugBuild("suit count: " + list.Count + " picked suit: " + num);
SpawnZombieClientRpc(netObjectRef, playerObjectId, num, wakeUpOnStart);
}
[ClientRpc]
public void SpawnZombieClientRpc(NetworkObjectReference netObjectRef, int playerObjectId, int randomSuit, bool wakeUpOnStart)
{
//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_008c: Unknown result type (might be due to invalid IL or missing references)
//IL_0099: 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_00cc: 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)
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(4085340435u, val, (RpcDelivery)0);
((FastBufferWriter)(ref val2)).WriteValueSafe<NetworkObjectReference>(ref netObjectRef, default(ForNetworkSerializable));
BytePacker.WriteValueBitPacked(val2, playerObjectId);
BytePacker.WriteValueBitPacked(val2, randomSuit);
((FastBufferWriter)(ref val2)).WriteValueSafe<bool>(ref wakeUpOnStart, default(ForPrimitives));
((NetworkBehaviour)this).__endSendClientRpc(ref val2, 4085340435u, val, (RpcDelivery)0);
}
if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 2 && (networkManager.IsClient || networkManager.IsHost) && !((NetworkBehaviour)this).IsServer)
{
Plugin.LogIfDebugBuild("Sync Zombie RPC with clients");
((MonoBehaviour)this).StartCoroutine(waitFor0492EnemySpawn(netObjectRef, playerObjectId, randomSuit, wakeUpOnStart));
}
}
}
private IEnumerator waitFor0492EnemySpawn(NetworkObjectReference netObjectRef, int playerObjectId, int randomSuit, bool wakeUpOnStart)
{
//IL_000e: Unknown result type (might be due to invalid IL or missing references)
//IL_000f: Unknown result type (might be due to invalid IL or missing references)
PlayerControllerB playerControllerB;
if (playerObjectId == 6969)
{
playerControllerB = StartOfRound.Instance.allPlayerScripts[0];
}
else
{
playerControllerB = StartOfRound.Instance.allPlayerScripts[playerObjectId];
}
NetworkObject netObject = null;
float startTime = Time.realtimeSinceStartup;
yield return (object)new WaitUntil((Func<bool>)(() => Time.realtimeSinceStartup - startTime > 20f || ((NetworkObjectReference)(ref netObjectRef)).TryGet(ref netObject, (NetworkManager)null)));
if ((Object)(object)playerControllerB.deadBody == (Object)null && playerObjectId != 6969)
{
startTime = Time.realtimeSinceStartup;
yield return (object)new WaitUntil((Func<bool>)(() => Time.realtimeSinceStartup - startTime > 20f || (Object)(object)playerControllerB.deadBody != (Object)null));
}
Plugin.LogIfDebugBuild("Syncing Zombie. PlayerObjectID: " + playerObjectId);
if ((Object)(object)playerControllerB.deadBody != (Object)null)
{
playerControllerB.deadBody.DeactivateBody(false);
}
if ((Object)(object)netObject != (Object)null)
{
Scp0492 component = ((Component)netObject).GetComponent<Scp0492>();
if (wakeUpOnStart)
{
component.WakeUp();
}
if (playerObjectId == 6969)
{
Plugin.LogIfDebugBuild("RandomSuitID: " + randomSuit);
component.SetSuit(randomSuit, random: true);
}
else
{
component.SetSuit(playerControllerB.currentSuitID);
component.whoAmIOriginally = playerControllerB;
component.ApplyMoreCompanyToZombie();
}
}
}
private void AdjustSpawnPositionAndRotation(ref Vector3 position, ref Quaternion rotation)
{
//IL_0015: Unknown result type (might be due to invalid IL or missing references)
//IL_001a: Unknown result type (might be due to invalid IL or missing references)
//IL_0021: 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_002d: 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)
//IL_0039: 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_004f: Unknown result type (might be due to invalid IL or missing references)
//IL_0054: Unknown result type (might be due to invalid IL or missing references)
//IL_0058: Unknown result type (might be due to invalid IL or missing references)
//IL_005d: Unknown result type (might be due to invalid IL or missing references)
//IL_006d: 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_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_0080: Unknown result type (might be due to invalid IL or missing references)
//IL_0085: Unknown result type (might be due to invalid IL or missing references)
//IL_0087: Unknown result type (might be due to invalid IL or missing references)
//IL_008d: Unknown result type (might be due to invalid IL or missing references)
//IL_0092: 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)
float num = 2f;
float num2 = 1.5f;
Vector3[] array = (Vector3[])(object)new Vector3[4]
{
Vector3.forward,
Vector3.back,
Vector3.left,
Vector3.right
};
Vector3[] array2 = array;
foreach (Vector3 val in array2)
{
if (Physics.Raycast(position, val, num))
{
rotation = Quaternion.LookRotation(-val);
position += -val * num2;
break;
}
}
}
private Vector3 GetGroundPosition(Vector3 startingPos)
{
//IL_0001: Unknown result type (might be due to invalid IL or missing references)
//IL_0002: Unknown result type (might be due to invalid IL or missing references)
//IL_0008: 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_0011: 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_001d: Unknown result type (might be due to invalid IL or missing references)
//IL_00e3: 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_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_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_00e8: Unknown result type (might be due to invalid IL or missing references)
//IL_0077: 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_0084: Unknown result type (might be due to invalid IL or missing references)
//IL_008b: Unknown result type (might be due to invalid IL or missing references)
//IL_0090: Unknown result type (might be due to invalid IL or missing references)
//IL_00da: Unknown result type (might be due to invalid IL or missing references)
//IL_00df: Unknown result type (might be due to invalid IL or missing references)
Vector3 val = startingPos;
val = RoundManager.Instance.GetNavMeshPosition(val, default(NavMeshHit), 3f, -1);
if (!RoundManager.Instance.GotNavMeshPositionResult)
{
RaycastHit val2 = default(RaycastHit);
if (Physics.Raycast(startingPos + Vector3.up * 0.15f, -Vector3.up, ref val2, 50f, StartOfRound.Instance.collidersAndRoomMaskAndDefault, (QueryTriggerInteraction)1))
{
val = RoundManager.Instance.GetNavMeshPosition(((RaycastHit)(ref val2)).point, default(NavMeshHit), 10f, -1);
}
else
{
int num = enemyRandom.Next(0, base.allAINodes.Length);
if (base.allAINodes != null && (Object)(object)base.allAINodes[num] != (Object)null)
{
val = base.allAINodes[num].transform.position;
}
}
}
return val;
}
public override void HitEnemy(int force = 1, PlayerControllerB? playerWhoHit = null, bool playHitSFX = false, int hitID = -1)
{
((EnemyAI)this).HitEnemy(force, playerWhoHit, playHitSFX, hitID);
if (!base.isEnemyDead && Plugin.scp049killable.Value)
{
base.enemyHP -= force;
if (((NetworkBehaviour)this).IsOwner && base.enemyHP <= 0 && !base.isEnemyDead)
{
((MonoBehaviour)this).StopCoroutine(base.searchCoroutine);
((EnemyAI)this).KillEnemyOnOwnerClient(false);
}
}
}
public override void KillEnemy(bool destroy = false)
{
if (Plugin.scp049killable.Value)
{
((EnemyAI)this).KillEnemy(destroy);
base.creatureAnimator.SetBool("Stunned", false);
base.creatureAnimator.SetBool("Dead", true);
}
}
public override void DetectNoise(Vector3 noisePosition, float noiseLoudness, int timesPlayedInOneSpot = 0, int noiseID = 0)
{
//IL_0002: Unknown result type (might be due to invalid IL or missing references)
//IL_000d: 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_0049: Unknown result type (might be due to invalid IL or missing references)
((EnemyAI)this).DetectNoise(noisePosition, noiseLoudness, timesPlayedInOneSpot, noiseID);
float num = Vector3.Distance(noisePosition, ((Component)this).transform.position);
if (!(num > 18f) && !base.movingTowardsTargetPlayer && base.currentBehaviourStateIndex != 1 && noiseLoudness > 0.17f)
{
InvestigatePosition(noisePosition);
}
}
public void InvestigatePosition(Vector3 position)
{
//IL_0010: Unknown result type (might be due to invalid IL or missing references)
//IL_0011: Unknown result type (might be due to invalid IL or missing references)
if (!checkingNoise)
{
heardPosition = position;
heardNoise = true;
}
}
[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(3960123882u, 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, 3960123882u, val, (RpcDelivery)0);
}
if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 2 && (networkManager.IsClient || networkManager.IsHost))
{
Plugin.LogIfDebugBuild("Animation: " + animationName);
base.creatureAnimator.SetTrigger(animationName);
}
}
protected override void __initializeVariables()
{
if (_playerNetVar == null)
{
throw new Exception("Scp049._playerNetVar cannot be null. All NetworkVariableBase instances must be initialized.");
}
((NetworkVariableBase)_playerNetVar).Initialize((NetworkBehaviour)(object)this);
((NetworkBehaviour)this).__nameNetworkVariable((NetworkVariableBase)(object)_playerNetVar, "_playerNetVar");
((NetworkBehaviour)this).NetworkVariableFields.Add((NetworkVariableBase)(object)_playerNetVar);
((EnemyAI)this).__initializeVariables();
}
[RuntimeInitializeOnLoadMethod]
internal static void InitializeRPCS_Scp049()
{
//IL_0011: Unknown result type (might be due to invalid IL or missing references)
//IL_001b: Expected O, but got Unknown
//IL_002c: Unknown result type (might be due to invalid IL or missing references)
//IL_0036: Expected O, but got Unknown
//IL_0047: Unknown result type (might be due to invalid IL or missing references)
//IL_0051: Expected O, but got Unknown
//IL_0062: Unknown result type (might be due to invalid IL or missing references)
//IL_006c: Expected O, but got Unknown
//IL_007d: Unknown result type (might be due to invalid IL or missing references)
//IL_0087: Expected O, but got Unknown
//IL_0098: Unknown result type (might be due to invalid IL or missing references)
//IL_00a2: Expected O, but got Unknown
NetworkManager.__rpc_func_table.Add(1894502201u, new RpcReceiveHandler(__rpc_handler_1894502201));
NetworkManager.__rpc_func_table.Add(794464084u, new RpcReceiveHandler(__rpc_handler_794464084));
NetworkManager.__rpc_func_table.Add(708352434u, new RpcReceiveHandler(__rpc_handler_708352434));
NetworkManager.__rpc_func_table.Add(2448079418u, new RpcReceiveHandler(__rpc_handler_2448079418));
NetworkManager.__rpc_func_table.Add(4085340435u, new RpcReceiveHandler(__rpc_handler_4085340435));
NetworkManager.__rpc_func_table.Add(3960123882u, new RpcReceiveHandler(__rpc_handler_3960123882));
}
private static void __rpc_handler_1894502201(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams)
{
//IL_002f: Unknown result type (might be due to invalid IL or missing references)
//IL_0035: Unknown result type (might be due to invalid IL or missing references)
//IL_0044: Unknown result type (might be due to invalid IL or missing references)
//IL_005e: Unknown result type (might be due to invalid IL or missing references)
NetworkManager networkManager = target.NetworkManager;
if (networkManager != null && networkManager.IsListening)
{
bool armUpServerRpc = default(bool);
((FastBufferReader)(ref reader)).ReadValueSafe<bool>(ref armUpServerRpc, default(ForPrimitives));
target.__rpc_exec_stage = (__RpcExecStage)1;
((Scp049)(object)target).SetArmUpServerRpc(armUpServerRpc);
target.__rpc_exec_stage = (__RpcExecStage)0;
}
}
private static void __rpc_handler_794464084(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams)
{
//IL_002f: Unknown result type (might be due to invalid IL or missing references)
//IL_0035: Unknown result type (might be due to invalid IL or missing references)
//IL_0044: Unknown result type (might be due to invalid IL or missing references)
//IL_005e: Unknown result type (might be due to invalid IL or missing references)
NetworkManager networkManager = target.NetworkManager;
if (networkManager != null && networkManager.IsListening)
{
bool armUpClientRpc = default(bool);
((FastBufferReader)(ref reader)).ReadValueSafe<bool>(ref armUpClientRpc, default(ForPrimitives));
target.__rpc_exec_stage = (__RpcExecStage)2;
((Scp049)(object)target).SetArmUpClientRpc(armUpClientRpc);
target.__rpc_exec_stage = (__RpcExecStage)0;
}
}
private static void __rpc_handler_708352434(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;
((Scp049)(object)target).PlayKillLineClientRpc();
target.__rpc_exec_stage = (__RpcExecStage)0;
}
}
private static void __rpc_handler_2448079418(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams)
{
//IL_0023: 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_004f: 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_006d: Unknown result type (might be due to invalid IL or missing references)
//IL_0080: Unknown result type (might be due to invalid IL or missing references)
NetworkManager networkManager = target.NetworkManager;
if (networkManager != null && networkManager.IsListening)
{
int playerObjectId = default(int);
ByteUnpacker.ReadValueBitPacked(reader, ref playerObjectId);
Vector3 spawnPosition = default(Vector3);
((FastBufferReader)(ref reader)).ReadValueSafe(ref spawnPosition);
bool wakeUpOnStart = default(bool);
((FastBufferReader)(ref reader)).ReadValueSafe<bool>(ref wakeUpOnStart, default(ForPrimitives));
target.__rpc_exec_stage = (__RpcExecStage)1;
((Scp049)(object)target).SpawnZombieServerRpc(playerObjectId, spawnPosition, wakeUpOnStart);
target.__rpc_exec_stage = (__RpcExecStage)0;
}
}
private static void __rpc_handler_4085340435(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams)
{
//IL_002f: Unknown result type (might be due to invalid IL or missing references)
//IL_0035: Unknown result type (might be due to invalid IL or missing references)
//IL_003e: Unknown result type (might be due to invalid IL or missing references)
//IL_004b: Unknown result type (might be due to invalid IL or missing references)
//IL_0064: Unknown result type (might be due to invalid IL or missing references)
//IL_006a: 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_0084: Unknown result type (might be due to invalid IL or missing references)
//IL_009f: Unknown result type (might be due to invalid IL or missing references)
NetworkManager networkManager = target.NetworkManager;
if (networkManager != null && networkManager.IsListening)
{
NetworkObjectReference netObjectRef = default(NetworkObjectReference);
((FastBufferReader)(ref reader)).ReadValueSafe<NetworkObjectReference>(ref netObjectRef, default(ForNetworkSerializable));
int playerObjectId = default(int);
ByteUnpacker.ReadValueBitPacked(reader, ref playerObjectId);
int randomSuit = default(int);
ByteUnpacker.ReadValueBitPacked(reader, ref randomSuit);
bool wakeUpOnStart = default(bool);
((FastBufferReader)(ref reader)).ReadValueSafe<bool>(ref wakeUpOnStart, default(ForPrimitives));
target.__rpc_exec_stage = (__RpcExecStage)2;
((Scp049)(object)target).SpawnZombieClientRpc(netObjectRef, playerObjectId, randomSuit, wakeUpOnStart);
target.__rpc_exec_stage = (__RpcExecStage)0;
}
}
private static void __rpc_handler_3960123882(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;
((Scp049)(object)target).DoAnimationClientRpc(animationName);
target.__rpc_exec_stage = (__RpcExecStage)0;
}
}
[MethodImpl(MethodImplOptions.NoInlining)]
protected internal override string __getTypeName()
{
return "Scp049";
}
}
internal class Scp0492 : EnemyAI
{
private enum State
{
OnGround,
Searching,
PositionAttack,
SwingingArm
}
[Header("SCP 049-2")]
public Transform turnCompass = null;
private bool isDeadAnimationDone;
private Vector3 agentLocalVelocity;
private Vector3 previousPosition;
private float velX;
public Transform animationHolder;
public bool heardNoise = false;
[SerializeField]
private Transform attackBox;
[SerializeField]
private Transform headCostumeContainer;
[SerializeField]
private AudioClip breathingSFX;
private Coroutine wakeupCoroutine;
public PlayerControllerB whoAmIOriginally;
private Random enemyRandom;
private float hitCoolDown;
private float newPosCoolDown;
private float swingCoolDown;
private Vector3 stalkPos;
private Coroutine hitCoroutine;
public override void Start()
{
//IL_0044: Unknown result type (might be due to invalid IL or missing references)
((EnemyAI)this).Start();
isDeadAnimationDone = false;
base.currentBehaviourStateIndex = 0;
newPosCoolDown = 0f;
enemyRandom = new Random(StartOfRound.Instance.randomMapSeed + base.thisEnemyIndex);
((EnemyAI)this).StartSearch(((Component)this).transform.position, (AISearchRoutine)null);
}
public override void Update()
{
//IL_0019: 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_0042: 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_0057: Unknown result type (might be due to invalid IL or missing references)
//IL_0067: Unknown result type (might be due to invalid IL or missing references)
//IL_006c: Unknown result type (might be due to invalid IL or missing references)
//IL_0071: 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_00c1: Unknown result type (might be due to invalid IL or missing references)
//IL_00c6: Unknown result type (might be due to invalid IL or missing references)
//IL_0183: 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_01aa: 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_01ce: Unknown result type (might be due to invalid IL or missing references)
((EnemyAI)this).Update();
base.creatureAnimator.SetBool("IsMoving", Vector3.Distance(((Component)this).transform.position, previousPosition) > 0f);
Vector3 val = animationHolder.InverseTransformDirection(Vector3.ClampMagnitude(((Component)this).transform.position - previousPosition, 1f) / (Time.deltaTime * 2f));
velX = Mathf.Lerp(velX, val.z, 10f * Time.deltaTime);
base.creatureAnimator.SetFloat("VelocityX", Mathf.Clamp(velX, 0f, 1f));
previousPosition = ((Component)this).transform.position;
if (base.isEnemyDead)
{
if (!isDeadAnimationDone)
{
isDeadAnimationDone = true;
base.creatureVoice.Stop();
base.creatureVoice.PlayOneShot(base.dieSFX, 0.75f);
}
return;
}
hitCoolDown += Time.deltaTime;
newPosCoolDown += Time.deltaTime;
swingCoolDown += Time.deltaTime;
int currentBehaviourStateIndex = base.currentBehaviourStateIndex;
if ((Object)(object)base.targetPlayer != (Object)null && currentBehaviourStateIndex == 2)
{
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()
{
//IL_00ce: 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_00fb: Unknown result type (might be due to invalid IL or missing references)
//IL_0129: Unknown result type (might be due to invalid IL or missing references)
((EnemyAI)this).DoAIInterval();
if (base.isEnemyDead || StartOfRound.Instance.allPlayersDead)
{
return;
}
switch (base.currentBehaviourStateIndex)
{
case 0:
base.agent.speed = 0f;
break;
case 1:
base.agent.speed = Plugin.scp0492roamSpeed.Value;
if (FoundClosestPlayerInRange(17f, 3f))
{
((EnemyAI)this).StopSearch(base.currentSearch, true);
((EnemyAI)this).SwitchToBehaviourClientRpc(2);
}
break;
case 2:
base.agent.speed = Plugin.scp0492chaseSpeed.Value;
if (!TargetClosestPlayerInAnyCase() || (Vector3.Distance(((Component)this).transform.position, ((Component)base.targetPlayer).transform.position) > 15f && !((EnemyAI)this).CheckLineOfSightForPosition(((Component)base.targetPlayer).transform.position, 45f, 60, -1f, (Transform)null)))
{
((EnemyAI)this).StartSearch(((Component)this).transform.position, (AISearchRoutine)null);
((EnemyAI)this).SwitchToBehaviourClientRpc(1);
}
else if (!((Object)(object)base.targetPlayer == (Object)null) && ((NetworkBehaviour)this).IsOwner)
{
PositionAroundPlayer();
}
break;
case 3:
base.agent.speed = 0f;
break;
default:
Plugin.LogIfDebugBuild("This Behavior State doesn't exist!");
break;
}
}
[ServerRpc(RequireOwnership = false)]
public void WakeUpServerRpc()
{
//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 != 1 && (networkManager.IsClient || networkManager.IsHost))
{
ServerRpcParams val = default(ServerRpcParams);
FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendServerRpc(3158060622u, val, (RpcDelivery)0);
((NetworkBehaviour)this).__endSendServerRpc(ref val2, 3158060622u, val, (RpcDelivery)0);
}
if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost) && wakeupCoroutine == null)
{
wakeupCoroutine = ((MonoBehaviour)this).StartCoroutine(WakeUpCoroutine());
}
}
}
public void WakeUp()
{
if (wakeupCoroutine == null)
{
wakeupCoroutine = ((MonoBehaviour)this).StartCoroutine(WakeUpCoroutine());
}
}
private IEnumerator WakeUpCoroutine()
{
yield return (object)new WaitForSeconds(1f);
DoAnimBoolClientRpc("SpawnPose", toggle: false);
yield return (object)new WaitForSeconds(14f);
PlayBreathingClientRpc();
((EnemyAI)this).SwitchToBehaviourClientRpc(1);
}
[ClientRpc]
public void PlayBreathingClientRpc()
{
//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(1417083152u, val, (RpcDelivery)0);
((NetworkBehaviour)this).__endSendClientRpc(ref val2, 1417083152u, val, (RpcDelivery)0);
}
if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 2 && (networkManager.IsClient || networkManager.IsHost))
{
if (base.creatureSFX.isPlaying)
{
base.creatureSFX.Stop();
}
base.creatureSFX.clip = breathingSFX;
base.creatureSFX.loop = true;
base.creatureSFX.volume = 0.1f;
base.creatureSFX.Play();
}
}
private bool FoundClosestPlayerInRange(float range, float senseRange, bool requiresLineOfSight = true)
{
//IL_004e: 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)
((EnemyAI)this).TargetClosestPlayer(1.5f, requiresLineOfSight, 70f);
if ((Object)(object)base.targetPlayer == (Object)null)
{
((EnemyAI)this).TargetClosestPlayer(1.5f, false, 70f);
range = senseRange;
}
return (Object)(object)base.targetPlayer != (Object)null && Vector3.Distance(((Component)this).transform.position, ((Component)base.targetPlayer).transform.position) < range;
}
private bool TargetClosestPlayerInAnyCase()
{
//IL_001f: 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)
base.mostOptimalDistance = 2000f;
base.targetPlayer = null;
for (int i = 0; i < StartOfRound.Instance.connectedPlayersAmount + 1; i++)
{
base.tempDist = Vector3.Distance(((Component)this).transform.position, ((Component)StartOfRound.Instance.allPlayerScripts[i]).transform.position);
if (base.tempDist < base.mostOptimalDistance)
{
base.mostOptimalDistance = base.tempDist;
base.targetPlayer = StartOfRound.Instance.allPlayerScripts[i];
}
}
if ((Object)(object)base.targetPlayer == (Object)null)
{
return false;
}
return true;
}
public override void OnCollideWithPlayer(Collider other)
{
if (!(hitCoolDown < 1.5f))
{
PlayerControllerB val = ((EnemyAI)this).MeetsStandardPlayerCollisionConditions(other, false, false);
if ((Object)(object)val != (Object)null && base.currentBehaviourStateIndex == 0 && wakeupCoroutine == null)
{
WakeUpServerRpc();
}
}
}
public override void HitEnemy(int force = 1, PlayerControllerB? playerWhoHit = null, bool playHitSFX = false, int hitID = -1)
{
((EnemyAI)this).HitEnemy(force, playerWhoHit, playHitSFX, hitID);
if (!base.isEnemyDead && Plugin.scp049killable.Value)
{
base.enemyHP -= force;
if (((NetworkBehaviour)this).IsOwner && base.enemyHP <= 0 && !base.isEnemyDead)
{
((MonoBehaviour)this).StopCoroutine(base.searchCoroutine);
((EnemyAI)this).KillEnemyOnOwnerClient(false);
}
}
}
public override void KillEnemy(bool destroy = false)
{
if (Plugin.scp049killable.Value)
{
((EnemyAI)this).KillEnemy(destroy);
base.creatureAnimator.SetBool("Stunned", false);
base.creatureAnimator.SetBool("Dead", true);
}
}
public void SetSuit(int suitId, bool random = false)
{
List<UnlockableItem> list = StartOfRound.Instance.unlockablesList.unlockables;
if (random)
{
list = (from u in StartOfRound.Instance.unlockablesList.unlockables
where u.unlockableName.Contains("suit", StringComparison.OrdinalIgnoreCase)
orderby u.unlockableName
select u).ToList();
}
Plugin.LogIfDebugBuild("Setting Suit to ID: " + suitId);
Material suitMaterial = list[suitId].suitMaterial;
((Renderer)base.skinnedMeshRenderers[0]).material = suitMaterial;
ChangeHat(headCostumeContainer, list[suitId].headCostumeObject);
}
public static void ChangeHat(Transform costumeContainer, GameObject newCostume)
{
//IL_0011: Unknown result type (might be due to invalid IL or missing references)
//IL_0017: Expected O, but got Unknown
//IL_0057: Unknown result type (might be due to invalid IL or missing references)
//IL_0062: 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)
foreach (Transform item in costumeContainer)
{
Transform val = item;
Object.Destroy((Object)(object)((Component)val).gameObject);
}
if (!((Object)(object)newCostume == (Object)null))
{
GameObject val2 = Object.Instantiate<GameObject>(newCostume, ((Component)costumeContainer).transform.position, ((Component)costumeContainer).transform.rotation, ((Component)costumeContainer).transform);
val2.transform.localScale = new Vector3(7.9f, 7.9f, 7.9f);
}
}
private void PositionAroundPlayer()
{
//IL_007f: Unknown result type (might be due to invalid IL or missing references)
//IL_008f: 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_002a: Unknown result type (might be due to invalid IL or missing references)
//IL_002f: Unknown result type (might be due to invalid IL or missing references)
//IL_0030: Unknown result type (might be due to invalid IL or missing references)
//IL_003c: Unknown result type (might be due to invalid IL or missing references)
//IL_0041: Unknown result type (might be due to invalid IL or missing references)
//IL_0046: Unknown result type (might be due to invalid IL or missing references)
//IL_0054: Unknown result type (might be due to invalid IL or missing references)
//IL_0064: Unknown result type (might be due to invalid IL or missing references)
//IL_0065: Unknown result type (might be due to invalid IL or missing references)
//IL_006c: Unknown result type (might be due to invalid IL or missing references)
if (newPosCoolDown > 0.7f)
{
newPosCoolDown = 0f;
float num = 2f;
Vector3 val = Random.insideUnitSphere * num;
val += ((Component)base.targetPlayer).transform.position;
val.y = ((Component)base.targetPlayer).transform.position.y;
stalkPos = val;
((EnemyAI)this).SetDestinationToPosition(stalkPos, false);
}
if (Vector3.Distance(((Component)this).transform.position, ((Component)base.targetPlayer).transform.position) <= 2f && swingCoolDown >= 2f && hitCoroutine == null)
{
swingCoolDown = 0f;
hitCoroutine = ((MonoBehaviour)this).StartCoroutine(SwingAttack());
}
}
private IEnumerator SwingAttack()
{
((EnemyAI)this).SwitchToBehaviourClientRpc(3);
DoAnimTriggerClientRpc("Attack");
yield return (object)new WaitForSeconds(1.1f);
AttackBoxHitClientRpc();
yield return (object)new WaitForSeconds(1.5f);
if (base.currentBehaviourStateIndex != 3)
{
hitCoroutine = null;
yield break;
}
((EnemyAI)this).SwitchToBehaviourClientRpc(2);
hitCoroutine = null;
}
[ClientRpc]
public void AttackBoxHitClientRpc()
{
//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_00c4: 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)
//IL_00d4: Unknown result type (might be due to invalid IL or missing references)
//IL_01c8: Unknown result type (might be due to invalid IL or missing references)
//IL_01ce: 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(3818057253u, val, (RpcDelivery)0);
((NetworkBehaviour)this).__endSendClientRpc(ref val2, 3818057253u, val, (RpcDelivery)0);
}
if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 2 || (!networkManager.IsClient && !networkManager.IsHost))
{
return;
}
int num = 8;
Collider[] array = Physics.OverlapBox(attackBox.position, attackBox.localScale, Quaternion.identity, num);
Plugin.LogIfDebugBuild("Attack Box Hit");
if (array.Length != 0)
{
Plugin.LogIfDebugBuild("HitCollider Count:" + array.Length);
HashSet<GameObject> hashSet = new HashSet<GameObject>();
Collider[] array2 = array;
foreach (Collider val3 in array2)
{
GameObject gameObject = ((Component)val3).gameObject;
if (hashSet.Contains(gameObject))
{
continue;
}
hashSet.Add(gameObject);
Plugin.LogIfDebugBuild("Name: " + ((Object)gameObject).name);
if (!((Object)(object)gameObject.GetComponent<PlayerControllerB>() == (Object)null))
{
PlayerControllerB val4 = ((EnemyAI)this).MeetsStandardPlayerCollisionConditions(val3, false, false);
if ((Object)(object)val4 != (Object)null)
{
int health = val4.health;
hitCoolDown = 0f;
val4.DamagePlayer(Plugin.scp0492damage.Value, true, true, (CauseOfDeath)0, 0, false, default(Vector3));
Plugin.LogIfDebugBuild("I hit you with power of: " + Plugin.scp0492damage.Value + " damage you should now be at: " + val4.health + " was: " + health);
}
}
}
}
else
{
Plugin.Logger.LogInfo((object)"Darn i missed trying again");
}
}
public override void DetectNoise(Vector3 noisePosition, float noiseLoudness, int timesPlayedInOneSpot = 0, int noiseID = 0)
{
//IL_0002: Unknown result type (might be due to invalid IL or missing references)
//IL_000d: 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)
((EnemyAI)this).DetectNoise(noisePosition, noiseLoudness, timesPlayedInOneSpot, noiseID);
float num = Vector3.Distance(noisePosition, ((Component)this).transform.position);
if (!(num > 7.5f) && wakeupCoroutine == null && !base.movingTowardsTargetPlayer && base.currentBehaviourStateIndex == 0 && noiseLoudness > 0.17f)
{
WakeUpServerRpc();
}
}
[ClientRpc]
public void DoAnimBoolClientRpc(string animationName, bool toggle)
{
//IL_0024: Unknown result type (might be due to invalid IL or missing references)
//IL_002e: Invalid comparison between Unknown and I4
//IL_00e5: Unknown result type (might be due to invalid IL or missing references)
//IL_00ef: 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_00bb: 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_00d5: 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(1679554520u, val, (RpcDelivery)0);
bool flag = animationName != null;
((FastBufferWriter)(ref val2)).WriteValueSafe<bool>(ref flag, default(ForPrimitives));
if (flag)
{
((FastBufferWriter)(ref val2)).WriteValueSafe(animationName, false);
}
((FastBufferWriter)(ref val2)).WriteValueSafe<bool>(ref toggle, default(ForPrimitives));
((NetworkBehaviour)this).__endSendClientRpc(ref val2, 1679554520u, val, (RpcDelivery)0);
}
if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 2 && (networkManager.IsClient || networkManager.IsHost))
{
Plugin.LogIfDebugBuild("Animation: " + animationName);
base.creatureAnimator.SetBool(animationName, toggle);
}
}
[ClientRpc]
public void DoAnimTriggerClientRpc(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(1358388238u, 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, 1358388238u, val, (RpcDelivery)0);
}
if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 2 && (networkManager.IsClient || networkManager.IsHost))
{
Plugin.LogIfDebugBuild("Animation: " + animationName);
base.creatureAnimator.SetTrigger(animationName);
}
}
public void ApplyMoreCompanyToZombie()
{
//IL_0121: 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_0142: Unknown result type (might be due to invalid IL or missing references)
//IL_0148: Invalid comparison between Unknown and I4
if (!Chainloader.PluginInfos.ContainsKey("me.swipez.melonloader.morecompany") || !((Object)(object)whoAmIOriginally != (Object)null) || !MainClass.cosmeticsSyncOther.Value || !MainClass.playerIdsAndCosmetics.ContainsKey((int)whoAmIOriginally.playerClientId))
{
return;
}
List<string> list = MainClass.playerIdsAndCosmetics[(int)whoAmIOriginally.playerClientId];
Transform val = ((Component)this).transform.Find("SCP049-2").Find("AnimHolder").Find("Armature");
CosmeticApplication component = ((Component)val).GetComponent<CosmeticApplication>();
if (Object.op_Implicit((Object)(object)component))
{
component.ClearCosmetics();
Object.Destroy((Object)(object)component);
}
component = ((Component)val).gameObject.AddComponent<CosmeticApplication>();
foreach (string item in list)
{
component.ApplyCosmetic(item, true);
}
foreach (CosmeticInstance spawnedCosmetic in component.spawnedCosmetics)
{
Transform transform = ((Component)spawnedCosmetic).transform;
transform.localScale *= 0.38f;
if ((int)((Component)spawnedCosmetic).gameObject.GetComponent<CosmeticInstance>().cosmeticType == 4)
{
Object.Destroy((Object)(object)spawnedCosmetic);
}
}
base.skinnedMeshRenderers = ((Component)this).gameObject.GetComponentsInChildren<SkinnedMeshRenderer>();
base.meshRenderers = ((Component)this).gameObject.GetComponentsInChildren<MeshRenderer>();
}
protected override void __initializeVariables()
{
((EnemyAI)this).__initializeVariables();
}
[RuntimeInitializeOnLoadMethod]
internal static void InitializeRPCS_Scp0492()
{
//IL_0011: Unknown result type (might be due to invalid IL or missing references)
//IL_001b: Expected O, but got Unknown
//IL_002c: Unknown result type (might be due to invalid IL or missing references)
//IL_0036: Expected O, but got Unknown
//IL_0047: Unknown result type (might be due to invalid IL or missing references)
//IL_0051: Expected O, but got Unknown
//IL_0062: Unknown result type (might be due to invalid IL or missing references)
//IL_006c: Expected O, but got Unknown
//IL_007d: Unknown result type (might be due to invalid IL or missing references)
//IL_0087: Expected O, but got Unknown
NetworkManager.__rpc_func_table.Add(3158060622u, new RpcReceiveHandler(__rpc_handler_3158060622));
NetworkManager.__rpc_func_table.Add(1417083152u, new RpcReceiveHandler(__rpc_handler_1417083152));
NetworkManager.__rpc_func_table.Add(3818057253u, new RpcReceiveHandler(__rpc_handler_3818057253));
NetworkManager.__rpc_func_table.Add(1679554520u, new RpcReceiveHandler(__rpc_handler_1679554520));
NetworkManager.__rpc_func_table.Add(1358388238u, new RpcReceiveHandler(__rpc_handler_1358388238));
}
private static void __rpc_handler_3158060622(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)1;
((Scp0492)(object)target).WakeUpServerRpc();
target.__rpc_exec_stage = (__RpcExecStage)0;
}
}
private static void __rpc_handler_1417083152(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;
((Scp0492)(object)target).PlayBreathingClientRpc();
target.__rpc_exec_stage = (__RpcExecStage)0;
}
}
private static void __rpc_handler_3818057253(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;
((Scp0492)(object)target).AttackBoxHitClientRpc();
target.__rpc_exec_stage = (__RpcExecStage)0;
}
}
private static void __rpc_handler_1679554520(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_0067: 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_009a: 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);
}
bool toggle = default(bool);
((FastBufferReader)(ref reader)).ReadValueSafe<bool>(ref toggle, default(ForPrimitives));
target.__rpc_exec_stage = (__RpcExecStage)2;
((Scp0492)(object)target).DoAnimBoolClientRpc(animationName, toggle);
target.__rpc_exec_stage = (__RpcExecStage)0;
}
}
private static void __rpc_handler_1358388238(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;
((Scp0492)(object)target).DoAnimTriggerClientRpc(animationName);
target.__rpc_exec_stage = (__RpcExecStage)0;
}
}
[MethodImpl(MethodImplOptions.NoInlining)]
protected internal override string __getTypeName()
{
return "Scp0492";
}
}
public static class PluginInfo
{
public const string PLUGIN_GUID = "SCP049";
public const string PLUGIN_NAME = "SCP049";
public const string PLUGIN_VERSION = "1.0.0";
}
}
namespace System.Runtime.CompilerServices
{
[AttributeUsage(AttributeTargets.Assembly, AllowMultiple = true)]
internal sealed class IgnoresAccessChecksToAttribute : Attribute
{
public IgnoresAccessChecksToAttribute(string assemblyName)
{
}
}
}
namespace SCP049.NetcodePatcher
{
[AttributeUsage(AttributeTargets.Module)]
internal class NetcodePatchedAssemblyAttribute : Attribute
{
}
}