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.InteropServices;
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 Locker.MonoBehaviours;
using Locker.NetcodePatcher;
using Microsoft.CodeAnalysis;
using Unity.Netcode;
using UnityEngine;
using UnityEngine.VFX;
[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: AssemblyTitle("Locker")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("Locker")]
[assembly: AssemblyCopyright("Copyright © zealsprince 2024")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("335007C9-7068-4DF7-85B3-B406E9795203")]
[assembly: AssemblyFileVersion("1.6.0")]
[assembly: TargetFramework(".NETFramework,Version=v4.8", FrameworkDisplayName = ".NET Framework 4.8")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.6.0.0")]
[module: UnverifiableCode]
[module: RefSafetyRules(11)]
[module: NetcodePatchedAssembly]
internal class <Module>
{
static <Module>()
{
}
}
namespace Microsoft.CodeAnalysis
{
[CompilerGenerated]
[Microsoft.CodeAnalysis.Embedded]
internal sealed class EmbeddedAttribute : Attribute
{
}
}
namespace System.Runtime.CompilerServices
{
[CompilerGenerated]
[Microsoft.CodeAnalysis.Embedded]
[AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)]
internal sealed class RefSafetyRulesAttribute : Attribute
{
public readonly int Version;
public RefSafetyRulesAttribute(int P_0)
{
Version = P_0;
}
}
}
namespace Locker
{
internal class Assets
{
public enum LoadStatusCode : ushort
{
Success,
Failed,
Exists
}
public static AssetBundle Bundle;
public static Dictionary<string, GameObject> Prefabs = new Dictionary<string, GameObject>();
public static readonly Dictionary<string, string> Manifest = new Dictionary<string, string>
{
{ "locker", "assets/exported/locker/enemies/locker.prefab" },
{ "lockerenemy", "assets/exported/locker/enemies/lockerenemy.asset" }
};
public static LoadStatusCode Load()
{
if ((Object)(object)Bundle != (Object)null)
{
return LoadStatusCode.Exists;
}
string text = Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), "Locker");
Bundle = AssetBundle.LoadFromFile(text);
if ((Object)(object)Bundle == (Object)null)
{
Plugin.logger.LogInfo((object)("Failed to load asset bundle from path: " + text));
return LoadStatusCode.Failed;
}
Plugin.logger.LogInfo((object)("Loaded asset bundle from path: " + text));
string[] allAssetNames = Bundle.GetAllAssetNames();
foreach (string text2 in allAssetNames)
{
Plugin.logger.LogDebug((object)("Found asset: " + text2));
}
foreach (KeyValuePair<string, string> item in Manifest)
{
Prefabs.Add(item.Key, Bundle.LoadAsset<GameObject>(item.Value));
}
return LoadStatusCode.Success;
}
public static GameObject SpawnPrefab(string name, Vector3 position)
{
//IL_0038: 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)
try
{
if (Prefabs.ContainsKey(name))
{
Plugin.logger.LogDebug((object)("Loading prefab '" + name + "'"));
return Object.Instantiate<GameObject>(Prefabs[name], position, Quaternion.identity);
}
Plugin.logger.LogWarning((object)("Prefab " + name + " not found!"));
}
catch (Exception ex) when (ex is ArgumentException || ex is NullReferenceException)
{
Plugin.logger.LogError((object)ex.Message);
}
return null;
}
public static GameObject Get(string name)
{
if (Prefabs.ContainsKey(name))
{
return Prefabs[name];
}
return null;
}
}
public class Config
{
public static ConfigEntry<float> LockerMechanicsReactivationChance;
public static ConfigEntry<bool> LockerMechanicsBodiesEnabled;
public static ConfigEntry<bool> LockerMechanicsProximitySenseEnabled;
public static ConfigEntry<float> LockerMechanicsProximitySenseDistance;
public static ConfigEntry<int> LockerSpawnWeight;
public static ConfigEntry<float> LockerSpawnPower;
public static ConfigEntry<int> LockerSpawnMax;
public static ConfigEntry<string> LockerSpawnLevelsSet;
public static ConfigEntry<string> LockerSpawnLevelsWithWeight;
public static ConfigEntry<float> LockerVolumeAdjustment;
public static void Load()
{
//IL_0020: Unknown result type (might be due to invalid IL or missing references)
//IL_002a: Expected O, but got Unknown
//IL_004a: Unknown result type (might be due to invalid IL or missing references)
//IL_0054: Expected O, but got Unknown
//IL_0074: Unknown result type (might be due to invalid IL or missing references)
//IL_007e: Expected O, but got Unknown
//IL_00a2: Unknown result type (might be due to invalid IL or missing references)
//IL_00ac: Expected O, but got Unknown
//IL_00d7: Unknown result type (might be due to invalid IL or missing references)
//IL_00e1: Expected O, but got Unknown
//IL_0105: Unknown result type (might be due to invalid IL or missing references)
//IL_010f: Expected O, but got Unknown
//IL_012f: Unknown result type (might be due to invalid IL or missing references)
//IL_0139: Expected O, but got Unknown
//IL_015d: Unknown result type (might be due to invalid IL or missing references)
//IL_0167: Expected O, but got Unknown
//IL_018b: Unknown result type (might be due to invalid IL or missing references)
//IL_0195: Expected O, but got Unknown
//IL_01b9: Unknown result type (might be due to invalid IL or missing references)
//IL_01c3: Expected O, but got Unknown
LockerMechanicsReactivationChance = Plugin.config.Bind<float>("Mechanics", "LockerMechanicsReactivationChance", 50f, new ConfigDescription("Chance for the Locker to reactivate after a chase and begin another lunge at the closest player (rolls a value 0-100 and if below the given value will reactivate)", (AcceptableValueBase)null, Array.Empty<object>()));
LockerMechanicsBodiesEnabled = Plugin.config.Bind<bool>("Mechanics", "LockerMechanicsBodiesEnabled", false, new ConfigDescription("Should bodies fall to the ground after being killed instead of being destroyed?", (AcceptableValueBase)null, Array.Empty<object>()));
LockerMechanicsProximitySenseEnabled = Plugin.config.Bind<bool>("Mechanics", "LockerMechanicsProximitySenseEnabled", false, new ConfigDescription("Should the Locker automatically lunge at players in line of sight and within reach?", (AcceptableValueBase)null, Array.Empty<object>()));
LockerMechanicsProximitySenseDistance = Plugin.config.Bind<float>("Mechanics", "LockerMechanicsProximitySenseDistance", 8f, new ConfigDescription("Distance at which the Locker activates if proximity sense is enabled", (AcceptableValueBase)null, Array.Empty<object>()));
LockerSpawnWeight = Plugin.config.Bind<int>("Spawn", "LockerSpawnWeight", 50, new ConfigDescription("What is the chance of the Locker spawning - higher values make it more common (this is like adding tickets to a lottery - it doesn't guarantee getting picked but it vastly increases the chances)", (AcceptableValueBase)(object)new AcceptableValueRange<int>(0, 99999), Array.Empty<object>()));
LockerSpawnPower = Plugin.config.Bind<float>("Spawn", "LockerSpawnPower", 1f, new ConfigDescription("What's the spawn power of a Locker? How much does it subtract from the moon power pool on spawn?", (AcceptableValueBase)null, Array.Empty<object>()));
LockerSpawnMax = Plugin.config.Bind<int>("Spawn", "LockerSpawnMax", 3, new ConfigDescription("What's the maximum amount of Lockers that can spawn on a given moon?", (AcceptableValueBase)null, Array.Empty<object>()));
LockerSpawnLevelsSet = Plugin.config.Bind<string>("Spawn", "LockerSpawnLevelsSet", "all", new ConfigDescription("Which set of levels should by default let the Locker spawn on them? (Options are: all/none/modded/vanilla)", (AcceptableValueBase)null, Array.Empty<object>()));
LockerSpawnLevelsWithWeight = Plugin.config.Bind<string>("Spawn", "LockerSpawnLevels", "experimentation:25, assurance:75, vow:0, march:0, offense:100", new ConfigDescription("Which specific moons/levels can the Locker spawn on and with what weight? (This takes priority over the level set config option - names are matched leniently and case insensitive)", (AcceptableValueBase)null, Array.Empty<object>()));
LockerVolumeAdjustment = Plugin.config.Bind<float>("Volume", "LockerVolumeAdjustment", 1f, new ConfigDescription("Client side volume adjustment - values are a percentage i.e. 50% volume is 0.5", (AcceptableValueBase)null, Array.Empty<object>()));
}
}
[BepInPlugin("com.zealsprince.locker", "Locker", "1.6.0")]
[BepInDependency(/*Could not decode attribute arguments.*/)]
public class Plugin : BaseUnityPlugin
{
public const string ModGUID = "com.zealsprince.locker";
public const string ModName = "Locker";
public const string ModVersion = "1.6.0";
public static ManualLogSource logger;
public static ConfigFile config;
private readonly Harmony harmony = new Harmony("com.zealsprince.locker");
public void Awake()
{
//IL_00db: Unknown result type (might be due to invalid IL or missing references)
//IL_0112: 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_0124: Unknown result type (might be due to invalid IL or missing references)
//IL_027e: Unknown result type (might be due to invalid IL or missing references)
//IL_0280: Unknown result type (might be due to invalid IL or missing references)
//IL_0283: Unknown result type (might be due to invalid IL or missing references)
logger = ((BaseUnityPlugin)this).Logger;
config = ((BaseUnityPlugin)this).Config;
Config.Load();
if (Assets.Load() != 0)
{
return;
}
EnemyType val = Assets.Bundle.LoadAsset<EnemyType>("assets/exported/locker/enemies/lockerenemy.asset");
TerminalNode val2 = Assets.Bundle.LoadAsset<TerminalNode>("assets/exported/locker/enemies/lockerterminalnode.asset");
TerminalKeyword val3 = Assets.Bundle.LoadAsset<TerminalKeyword>("assets/exported/locker/enemies/lockerterminalkeyword.asset");
NetworkPrefabs.RegisterNetworkPrefab(val.enemyPrefab);
val.PowerLevel = Config.LockerSpawnPower.Value;
val.MaxCount = Config.LockerSpawnMax.Value;
string[] source = new string[4] { "all", "modded", "vanilla", "none" };
string text = source.FirstOrDefault((string s) => new string((from c in Config.LockerSpawnLevelsSet.Value.ToLower().ToCharArray()
where !char.IsWhiteSpace(c)
select c).ToArray()).Contains(s));
LevelTypes val4 = (LevelTypes)1;
switch (text)
{
case "all":
val4 = (LevelTypes)(-1);
break;
case "modded":
val4 = (LevelTypes)1024;
break;
case "vanilla":
val4 = (LevelTypes)1020;
break;
}
Dictionary<string, int> dictionary = new Dictionary<string, int>();
string text2 = new string((from c in Config.LockerSpawnLevelsWithWeight.Value.ToLower().ToCharArray()
where !char.IsWhiteSpace(c)
select c).ToArray());
string[] array = text2.Split(new char[1] { ',' });
foreach (string text3 in array)
{
string[] array2 = text3.Split(new char[1] { ':' });
if (array2.Length == 1)
{
dictionary.Add(array2[0], Config.LockerSpawnWeight.Value);
}
else
{
if (array2.Length != 2)
{
continue;
}
int num = 0;
try
{
num = int.Parse(array2[1]);
}
catch (Exception ex)
{
if (ex is ArgumentException || ex is FormatException || ex is OverflowException)
{
logger.LogError((object)$"Failed to parse level/moon weight value: {ex}");
}
continue;
}
dictionary.Add(array2[0], num);
}
}
Enemies.RegisterEnemy(val, Config.LockerSpawnWeight.Value, (LevelTypes)1, (SpawnType)0, val2, val3);
Enemies.RemoveEnemyFromLevels(val, (LevelTypes)1, (string[])null);
Enemies.RegisterEnemy(val, (SpawnType)0, new Dictionary<LevelTypes, int> { [val4] = Config.LockerSpawnWeight.Value }, dictionary, val2, val3);
try
{
Type[] types = Assembly.GetExecutingAssembly().GetTypes();
Type[] array3 = types;
foreach (Type type in array3)
{
MethodInfo[] methods = type.GetMethods(BindingFlags.Instance | BindingFlags.Static | BindingFlags.NonPublic);
MethodInfo[] array4 = methods;
foreach (MethodInfo methodInfo in array4)
{
object[] customAttributes = methodInfo.GetCustomAttributes(typeof(RuntimeInitializeOnLoadMethodAttribute), inherit: false);
if (customAttributes.Length != 0)
{
methodInfo.Invoke(null, null);
}
}
}
}
catch (Exception ex2)
{
logger.LogError((object)ex2);
}
harmony.PatchAll();
}
}
internal class Utilities
{
public static void ApplyLocalPlayerScreenshake(Vector3 position, float minDistance = 14f, float maxDistance = 25f, bool onlySmall = false)
{
//IL_0010: Unknown result type (might be due to invalid IL or missing references)
//IL_0015: Unknown result type (might be due to invalid IL or missing references)
float num = Vector3.Distance(((Component)GameNetworkManager.Instance.localPlayerController).transform.position, position);
if (num < minDistance && !onlySmall)
{
HUDManager.Instance.ShakeCamera((ScreenShakeType)1);
}
else if (num < maxDistance)
{
HUDManager.Instance.ShakeCamera((ScreenShakeType)0);
}
}
public static void Explode(Vector3 position, float minRange = 5f, float maxRange = 6f, float damage = 25f, int enemyDamage = 6)
{
//IL_005a: 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_007c: 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_00a5: Unknown result type (might be due to invalid IL or missing references)
//IL_00af: Unknown result type (might be due to invalid IL or missing references)
//IL_028a: 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_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_00dd: 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_02b5: 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_016d: Unknown result type (might be due to invalid IL or missing references)
//IL_0236: Unknown result type (might be due to invalid IL or missing references)
//IL_023c: Unknown result type (might be due to invalid IL or missing references)
Transform val = null;
if ((Object)(object)RoundManager.Instance != (Object)null && (Object)(object)RoundManager.Instance.mapPropsContainer != (Object)null && (Object)(object)RoundManager.Instance.mapPropsContainer.transform != (Object)null)
{
val = RoundManager.Instance.mapPropsContainer.transform;
}
Object.Instantiate<GameObject>(StartOfRound.Instance.explosionPrefab, position, Quaternion.Euler(-90f, 0f, 0f), val).SetActive(true);
ApplyLocalPlayerScreenshake(position);
Collider[] array = Physics.OverlapSphere(position, maxRange, 2621448, (QueryTriggerInteraction)2);
for (int i = 0; i < array.Length; i++)
{
float num = Vector3.Distance(position, ((Component)array[i]).transform.position);
if (num > 4f && Physics.Linecast(position, ((Component)array[i]).transform.position + Vector3.up * 0.3f, 256, (QueryTriggerInteraction)1))
{
continue;
}
if (((Component)array[i]).gameObject.layer == 3)
{
PlayerControllerB component = ((Component)array[i]).gameObject.GetComponent<PlayerControllerB>();
if ((Object)(object)component != (Object)null && ((NetworkBehaviour)component).IsOwner)
{
float num2 = 1f - Mathf.Clamp01((num - minRange) / (maxRange - minRange));
component.DamagePlayer((int)(damage * num2), true, true, (CauseOfDeath)3, 0, false, default(Vector3));
}
}
else if (((Component)array[i]).gameObject.layer == 21)
{
Landmine componentInChildren = ((Component)array[i]).gameObject.GetComponentInChildren<Landmine>();
if ((Object)(object)componentInChildren != (Object)null && !componentInChildren.hasExploded && num < 6f)
{
componentInChildren.Detonate();
}
}
else if (((Component)array[i]).gameObject.layer == 19)
{
EnemyAICollisionDetect componentInChildren2 = ((Component)array[i]).gameObject.GetComponentInChildren<EnemyAICollisionDetect>();
if ((Object)(object)componentInChildren2 != (Object)null && ((NetworkBehaviour)componentInChildren2.mainScript).IsOwner && num < 4.5f)
{
componentInChildren2.mainScript.HitEnemyOnLocalClient(enemyDamage, default(Vector3), (PlayerControllerB)null, false, -1);
}
}
}
int num3 = ~LayerMask.GetMask(new string[1] { "Room" });
num3 = ~LayerMask.GetMask(new string[1] { "Colliders" });
array = Physics.OverlapSphere(position, 10f, num3);
for (int j = 0; j < array.Length; j++)
{
Rigidbody component2 = ((Component)array[j]).GetComponent<Rigidbody>();
if (component2 != null)
{
component2.AddExplosionForce(70f, position, 10f);
}
}
}
}
}
namespace Locker.Patches
{
[HarmonyPatch(typeof(HUDManager))]
internal class HUDManagerPatches
{
[HarmonyPostfix]
[HarmonyPatch("PingScan_performed")]
private static void NotifyScanLockers()
{
if (!((Object)(object)GameNetworkManager.Instance.localPlayerController != (Object)null))
{
return;
}
foreach (LockerAI activeLocker in LockerAI.activeLockers)
{
activeLocker?.PlayerScan(GameNetworkManager.Instance.localPlayerController);
}
}
}
}
namespace Locker.MonoBehaviours
{
public class LockerAI : EnemyAI
{
public enum State
{
Dormant,
Activating,
Chasing,
Reactivating,
Resetting,
Consuming,
Debug
}
public static readonly int CreatureID = 176;
private static readonly Color eyeColorDormant = Color.black;
private static readonly Color eyeColorScan = Color.cyan;
private static readonly Color eyeColorDetect = new Color(1f, 0.4f, 0f);
private static readonly Color eyeColorChase = Color.red;
private AudioSource audioSource;
private Animator animationController;
private Material eyeMaterial;
private Light internalLight;
private List<Light> scrapeLights;
private DoorLock[] doors = Array.Empty<DoorLock>();
private Turret[] turrets = Array.Empty<Turret>();
private Landmine[] landmines = Array.Empty<Landmine>();
private VisualEffect[] visualEffects;
private static VFXExposedProperty chaseVFXBeginTrigger;
private static VFXExposedProperty chaseVFXEndTrigger;
private static readonly string chaseVFXBeginTriggerName = "BeginChase";
private static readonly string chaseVFXEndTriggerName = "EndChase";
private static VFXExposedProperty consumeVFXBeginTrigger;
private static VFXExposedProperty consumeVFXEndTrigger;
private static readonly string consumeVFXBeginTriggerName = "BeginConsume";
private static readonly string consumeVFXEndTriggerName = "EndConsume";
private int observedState;
private Vector3 targetPosition;
private Quaternion targetRotation;
private float currentRotationSpeed = 0f;
private readonly float maxRotationSpeed = 90f;
private Color currentEyeColor = eyeColorDormant;
private float currentEyeIntensity = 0f;
private float activationTimer = 0f;
private readonly float activationDuration = 1.5f;
private readonly float activationSpinWindup = 0.45f;
private float reactivationTimer = 0f;
private readonly float reactivationDuration = 1f;
private float consumeTimer = 0f;
private readonly float consumeDuration = 2.2f;
private readonly float consumeBloodWindup = 1f;
private bool consumeBloodTriggered = false;
private float resetTimer = 0f;
private readonly float resetDuration = 1f;
private PlayerControllerB playerScanning;
private bool playerScanned = false;
private float playerScannedTimer = 0f;
private float playerScannedDuration = 0f;
private float lastTargetTime;
private readonly float touchOvershoot = 1.75f;
private readonly float scanOvershoot = 1f;
private readonly float reactivationOvershoot = 1.25f;
private Vector3 lastChasePosition = Vector3.zero;
private float chaseMovementAverage = 0f;
private readonly float chaseMovementSpeed = 30f;
private readonly float chaseMovementAverageInitial = 1000f;
private readonly float chaseMovementAverageMinimum = 0.01f;
private readonly float lastTargetTimeframe = 0.2f;
private readonly float explosionDamage = 100f;
private readonly float explosionMinRange = 5f;
private readonly float explosionMaxRange = 6f;
private readonly int explosionEnemyDamage = 6;
[Header("Locker")]
public bool DebugToCamera = false;
public AudioClip AudioClipPing;
public AudioClip AudioClipActivate;
public AudioClip AudioClipChase;
public AudioClip AudioClipReactivate;
public AudioClip AudioClipReset;
public AudioClip AudioClipConsume;
private LineRenderer debugLine;
public static List<LockerAI> activeLockers = new List<LockerAI>();
private bool ProximitySensePlayers()
{
//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)
//IL_0081: 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_00b2: Unknown result type (might be due to invalid IL or missing references)
//IL_00bd: Unknown result type (might be due to invalid IL or missing references)
//IL_00c2: Unknown result type (might be due to invalid IL or missing references)
//IL_00c7: Unknown result type (might be due to invalid IL or missing references)
//IL_00d6: 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_00e8: Unknown result type (might be due to invalid IL or missing references)
//IL_00ed: Unknown result type (might be due to invalid IL or missing references)
if (Config.LockerMechanicsProximitySenseEnabled.Value)
{
PlayerControllerB val = null;
try
{
val = ((EnemyAI)this).GetClosestPlayer(true, true, true);
}
catch (Exception ex)
{
if (!(ex is NullReferenceException))
{
}
}
if ((Object)(object)val != (Object)null && Mathf.Abs(((Component)val).transform.position.y - ((Component)this).transform.position.y) + 2f > 2f && Vector3.Distance(((Component)val).transform.position, ((Component)this).transform.position) < Config.LockerMechanicsProximitySenseDistance.Value)
{
Vector3 val2 = ((Component)this).transform.position - ((Component)val).transform.position;
TargetServerRpc(val.playerClientId, ((Component)val).transform.position - ((Vector3)(ref val2)).normalized * touchOvershoot);
return true;
}
}
return false;
}
public override void OnDestroy()
{
((EnemyAI)this).OnDestroy();
activeLockers.Remove(this);
}
public override void Start()
{
//IL_007b: Unknown result type (might be due to invalid IL or missing references)
//IL_012a: Unknown result type (might be due to invalid IL or missing references)
//IL_012f: Unknown result type (might be due to invalid IL or missing references)
((EnemyAI)this).Start();
activeLockers.Add(this);
audioSource = ((Component)this).GetComponent<AudioSource>();
animationController = ((Component)this).GetComponent<Animator>();
SkinnedMeshRenderer componentInChildren = ((Component)this).gameObject.GetComponentInChildren<SkinnedMeshRenderer>();
Material[] materials = ((Renderer)componentInChildren).materials;
foreach (Material val in materials)
{
if (((Object)val).name.ToLower().Contains("eye"))
{
eyeMaterial = val;
eyeMaterial.SetColor("_EmissiveColor", currentEyeColor);
break;
}
}
scrapeLights = new List<Light>();
Light[] componentsInChildren = ((Component)this).gameObject.GetComponentsInChildren<Light>();
Light[] array = componentsInChildren;
foreach (Light val2 in array)
{
if (((Object)((Component)val2).gameObject).name == "InternalLight")
{
internalLight = val2;
continue;
}
scrapeLights.Add(val2);
((Behaviour)val2).enabled = false;
}
internalLight.intensity = 0f;
((Behaviour)internalLight).enabled = true;
targetPosition = Vector3.zero;
visualEffects = ((Component)this).gameObject.GetComponentsInChildren<VisualEffect>();
chaseVFXBeginTrigger.name = chaseVFXBeginTriggerName;
chaseVFXEndTrigger.name = chaseVFXEndTriggerName;
consumeVFXBeginTrigger.name = consumeVFXBeginTriggerName;
consumeVFXEndTrigger.name = consumeVFXEndTriggerName;
doors = Object.FindObjectsOfType(typeof(DoorLock)) as DoorLock[];
turrets = Object.FindObjectsOfType(typeof(Turret)) as Turret[];
landmines = Object.FindObjectsOfType(typeof(Landmine)) as Landmine[];
debugLine = ((Component)this).gameObject.GetComponent<LineRenderer>();
SwitchState(State.Dormant);
}
public IEnumerator DrawPath()
{
if (((Behaviour)base.agent).enabled)
{
yield return (object)new WaitForEndOfFrame();
debugLine.positionCount = base.agent.path.corners.Length;
debugLine.SetPosition(0, ((Component)base.agent).transform.position);
for (int i = 1; i < base.agent.path.corners.Length; i++)
{
debugLine.SetPosition(i, base.agent.path.corners[i]);
}
}
}
public override void DoAIInterval()
{
((EnemyAI)this).DoAIInterval();
if (!base.isEnemyDead && !StartOfRound.Instance.allPlayersDead && Object.op_Implicit((Object)(object)debugLine))
{
if (base.debugEnemyAI)
{
((Renderer)debugLine).enabled = true;
((MonoBehaviour)this).StartCoroutine(DrawPath());
}
else
{
((Renderer)debugLine).enabled = false;
}
}
}
public override void HitEnemy(int force = 1, PlayerControllerB playerWhoHit = null, bool playHitSFX = false, int hitID = -1)
{
//IL_001a: Unknown result type (might be due to invalid IL or missing references)
if ((Object)(object)playerWhoHit != (Object)null)
{
TargetServerRpc(playerWhoHit.playerClientId, ((Component)playerWhoHit).transform.position);
}
}
public override void Update()
{
//IL_0036: 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_007e: Unknown result type (might be due to invalid IL or missing references)
//IL_0088: Unknown result type (might be due to invalid IL or missing references)
//IL_008d: Unknown result type (might be due to invalid IL or missing references)
//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_01cf: 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_0200: Unknown result type (might be due to invalid IL or missing references)
//IL_0206: Unknown result type (might be due to invalid IL or missing references)
//IL_0360: Unknown result type (might be due to invalid IL or missing references)
//IL_0366: Unknown result type (might be due to invalid IL or missing references)
//IL_037d: Unknown result type (might be due to invalid IL or missing references)
//IL_0543: Unknown result type (might be due to invalid IL or missing references)
//IL_054e: Unknown result type (might be due to invalid IL or missing references)
//IL_0159: Unknown result type (might be due to invalid IL or missing references)
//IL_015e: Unknown result type (might be due to invalid IL or missing references)
//IL_0168: Unknown result type (might be due to invalid IL or missing references)
//IL_016d: Unknown result type (might be due to invalid IL or missing references)
//IL_012e: Unknown result type (might be due to invalid IL or missing references)
//IL_0134: Unknown result type (might be due to invalid IL or missing references)
//IL_014b: Unknown result type (might be due to invalid IL or missing references)
//IL_021d: Unknown result type (might be due to invalid IL or missing references)
//IL_0223: Unknown result type (might be due to invalid IL or missing references)
//IL_0228: Unknown result type (might be due to invalid IL or missing references)
//IL_022d: Unknown result type (might be due to invalid IL or missing references)
//IL_0232: Unknown result type (might be due to invalid IL or missing references)
//IL_023c: Unknown result type (might be due to invalid IL or missing references)
//IL_0241: Unknown result type (might be due to invalid IL or missing references)
//IL_0246: Unknown result type (might be due to invalid IL or missing references)
//IL_024b: Unknown result type (might be due to invalid IL or missing references)
//IL_0255: Unknown result type (might be due to invalid IL or missing references)
//IL_025a: Unknown result type (might be due to invalid IL or missing references)
//IL_025f: Unknown result type (might be due to invalid IL or missing references)
//IL_0264: Unknown result type (might be due to invalid IL or missing references)
//IL_0272: Unknown result type (might be due to invalid IL or missing references)
//IL_0277: Unknown result type (might be due to invalid IL or missing references)
//IL_0284: Unknown result type (might be due to invalid IL or missing references)
//IL_0457: Unknown result type (might be due to invalid IL or missing references)
//IL_045d: Unknown result type (might be due to invalid IL or missing references)
//IL_046d: Unknown result type (might be due to invalid IL or missing references)
//IL_047a: Unknown result type (might be due to invalid IL or missing references)
//IL_047f: Unknown result type (might be due to invalid IL or missing references)
//IL_0489: Unknown result type (might be due to invalid IL or missing references)
//IL_048e: Unknown result type (might be due to invalid IL or missing references)
((EnemyAI)this).Update();
if (base.isEnemyDead)
{
return;
}
if (DebugToCamera)
{
DebugToCamera = false;
TargetServerRpc(0uL, ((Component)Camera.main).transform.position);
}
switch (base.currentBehaviourStateIndex)
{
case 0:
currentEyeColor = Color.Lerp(currentEyeColor, eyeColorDormant, Time.deltaTime);
currentEyeIntensity = Mathf.Lerp(currentEyeIntensity, 0f, Time.deltaTime);
internalLight.intensity = Mathf.Lerp(internalLight.intensity, 0f, Time.deltaTime * 8f);
break;
case 1:
if (activationTimer > activationSpinWindup)
{
currentRotationSpeed = Mathf.Lerp(currentRotationSpeed, maxRotationSpeed, Time.deltaTime / Mathf.Abs(maxRotationSpeed - currentRotationSpeed));
((Component)this).transform.rotation = Quaternion.Slerp(((Component)this).transform.rotation, targetRotation, Time.deltaTime * currentRotationSpeed * 4f);
}
currentEyeColor = Color.Lerp(currentEyeColor, eyeColorDetect, Time.deltaTime);
currentEyeIntensity = Mathf.Lerp(currentEyeIntensity, 100000f, Time.deltaTime);
internalLight.intensity = Mathf.Lerp(internalLight.intensity, 40000f, Time.deltaTime / 4f);
break;
case 2:
currentEyeColor = Color.Lerp(currentEyeColor, eyeColorChase, Time.deltaTime);
currentEyeIntensity = Mathf.Lerp(currentEyeIntensity, 500000f, Time.deltaTime * 2f);
if (((Component)this).transform.position != lastChasePosition)
{
Quaternion val2 = Quaternion.LookRotation(((Component)this).transform.position - lastChasePosition) * Quaternion.Euler(Vector3.up * 90f) * Quaternion.Euler(Vector3.back * 8f);
((Component)this).transform.rotation = Quaternion.Slerp(((Component)this).transform.rotation, val2, Time.deltaTime * 4f);
}
internalLight.intensity = Mathf.Lerp(internalLight.intensity, 20000f, Time.deltaTime);
foreach (Light scrapeLight in scrapeLights)
{
scrapeLight.intensity = Mathf.Lerp(scrapeLight.intensity + (float)Random.Range(-3000, 3000), 4000f, Time.deltaTime * 2f);
}
break;
case 3:
currentRotationSpeed = Mathf.Lerp(currentRotationSpeed, maxRotationSpeed, Time.deltaTime / Mathf.Abs(maxRotationSpeed - currentRotationSpeed));
((Component)this).transform.rotation = Quaternion.Slerp(((Component)this).transform.rotation, targetRotation, Time.deltaTime * currentRotationSpeed * 6f);
break;
case 4:
foreach (Light scrapeLight2 in scrapeLights)
{
scrapeLight2.intensity = Mathf.Lerp(scrapeLight2.intensity, 0f, Time.deltaTime * 10f);
}
break;
case 5:
if (consumeTimer > consumeBloodWindup && !consumeBloodTriggered)
{
VisualEffect[] array = visualEffects;
foreach (VisualEffect val in array)
{
val.SendEvent(consumeVFXBeginTrigger.name);
}
consumeBloodTriggered = true;
}
((Component)this).transform.rotation = Quaternion.Slerp(((Component)this).transform.rotation, targetRotation, Time.deltaTime * 8f);
currentEyeColor = Color.Lerp(currentEyeColor, eyeColorChase, Time.deltaTime);
currentEyeIntensity = Mathf.Lerp(currentEyeIntensity, 0f, Time.deltaTime);
internalLight.intensity = Mathf.Lerp(internalLight.intensity, 0f, Time.deltaTime * 2f);
foreach (Light scrapeLight3 in scrapeLights)
{
scrapeLight3.intensity = Mathf.Lerp(scrapeLight3.intensity, 0f, Time.deltaTime * 10f);
}
break;
}
eyeMaterial.SetColor("_EmissiveColor", currentEyeColor * currentEyeIntensity);
}
public void FixedUpdate()
{
//IL_0071: Unknown result type (might be due to invalid IL or missing references)
//IL_0081: Unknown result type (might be due to invalid IL or missing references)
//IL_02c3: Unknown result type (might be due to invalid IL or missing references)
//IL_00a4: Unknown result type (might be due to invalid IL or missing references)
//IL_00af: Unknown result type (might be due to invalid IL or missing references)
//IL_0857: Unknown result type (might be due to invalid IL or missing references)
//IL_0863: Unknown result type (might be due to invalid IL or missing references)
//IL_0868: Unknown result type (might be due to invalid IL or missing references)
//IL_086d: Unknown result type (might be due to invalid IL or missing references)
//IL_087e: Unknown result type (might be due to invalid IL or missing references)
//IL_0885: Unknown result type (might be due to invalid IL or missing references)
//IL_0890: Unknown result type (might be due to invalid IL or missing references)
//IL_0895: Unknown result type (might be due to invalid IL or missing references)
//IL_015e: Unknown result type (might be due to invalid IL or missing references)
//IL_039d: Unknown result type (might be due to invalid IL or missing references)
//IL_03ad: Unknown result type (might be due to invalid IL or missing references)
//IL_033e: Unknown result type (might be due to invalid IL or missing references)
//IL_0343: 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)
//IL_00d5: Unknown result type (might be due to invalid IL or missing references)
//IL_00e0: Unknown result type (might be due to invalid IL or missing references)
//IL_00e5: Unknown result type (might be due to invalid IL or missing references)
//IL_00ea: Unknown result type (might be due to invalid IL or missing references)
//IL_00f9: Unknown result type (might be due to invalid IL or missing references)
//IL_0100: Unknown result type (might be due to invalid IL or missing references)
//IL_010b: Unknown result type (might be due to invalid IL or missing references)
//IL_0110: Unknown result type (might be due to invalid IL or missing references)
//IL_03d0: Unknown result type (might be due to invalid IL or missing references)
//IL_03db: Unknown result type (might be due to invalid IL or missing references)
//IL_01a5: 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_01e9: Unknown result type (might be due to invalid IL or missing references)
//IL_01f9: Unknown result type (might be due to invalid IL or missing references)
//IL_01fe: Unknown result type (might be due to invalid IL or missing references)
//IL_0203: Unknown result type (might be due to invalid IL or missing references)
//IL_021c: Unknown result type (might be due to invalid IL or missing references)
//IL_0223: Unknown result type (might be due to invalid IL or missing references)
//IL_022e: Unknown result type (might be due to invalid IL or missing references)
//IL_0233: Unknown result type (might be due to invalid IL or missing references)
//IL_048b: Unknown result type (might be due to invalid IL or missing references)
//IL_0496: Unknown result type (might be due to invalid IL or missing references)
//IL_0599: Unknown result type (might be due to invalid IL or missing references)
//IL_05a4: Unknown result type (might be due to invalid IL or missing references)
//IL_04bd: Unknown result type (might be due to invalid IL or missing references)
//IL_05c8: Unknown result type (might be due to invalid IL or missing references)
//IL_0748: Unknown result type (might be due to invalid IL or missing references)
//IL_0753: Unknown result type (might be due to invalid IL or missing references)
//IL_0770: Unknown result type (might be due to invalid IL or missing references)
//IL_0775: Unknown result type (might be due to invalid IL or missing references)
//IL_06a4: Unknown result type (might be due to invalid IL or missing references)
//IL_06af: Unknown result type (might be due to invalid IL or missing references)
//IL_0790: Unknown result type (might be due to invalid IL or missing references)
//IL_0796: Unknown result type (might be due to invalid IL or missing references)
//IL_06d3: Unknown result type (might be due to invalid IL or missing references)
ObserveState();
PlayerControllerB val2 = null;
try
{
val2 = ((EnemyAI)this).GetClosestPlayer(false, true, true);
}
catch (Exception ex)
{
if (!(ex is NullReferenceException))
{
}
}
switch (base.currentBehaviourStateIndex)
{
case 0:
if ((Object)(object)val2 != (Object)null && Mathf.Abs(((Component)val2).transform.position.y - ((Component)this).transform.position.y) + 2f > 2f && (double)Vector3.Distance(((Component)val2).transform.position, ((Component)this).transform.position) < 1.5)
{
Vector3 val3 = ((Component)this).transform.position - ((Component)val2).transform.position;
TargetServerRpc(val2.playerClientId, ((Component)val2).transform.position - ((Vector3)(ref val3)).normalized * touchOvershoot);
}
else
{
if (ProximitySensePlayers())
{
break;
}
if (IsLocalPlayerClosestWithLight())
{
TargetServerRpc(StartOfRound.Instance.localPlayerController.playerClientId, ((Component)StartOfRound.Instance.localPlayerController).transform.position);
}
if (playerScanned)
{
playerScannedTimer += Time.fixedDeltaTime;
if (playerScannedTimer > playerScannedDuration)
{
currentEyeColor = eyeColorScan;
audioSource.PlayOneShot(AudioClipPing, 1.5f * Config.LockerVolumeAdjustment.Value);
playerScanning.JumpToFearLevel(0.2f, true);
Vector3 val4 = ((Component)this).transform.position - ((Component)playerScanning).transform.position;
TargetServerRpc(playerScanning.playerClientId, ((Component)playerScanning).transform.position - ((Vector3)(ref val4)).normalized * scanOvershoot);
playerScanned = false;
playerScannedTimer = 0f;
playerScannedDuration = 0f;
}
}
}
break;
case 1:
activationTimer += Time.fixedDeltaTime;
if (activationTimer > activationDuration)
{
SwitchState(State.Chasing);
}
break;
case 2:
{
if (IsLocalPlayerClosestWithLight())
{
TargetServerRpc(StartOfRound.Instance.localPlayerController.playerClientId, ((Component)StartOfRound.Instance.localPlayerController).transform.position);
}
if (playerScanned)
{
playerScannedTimer += Time.fixedDeltaTime;
if (playerScannedTimer > playerScannedDuration)
{
audioSource.PlayOneShot(AudioClipPing, 1.5f * Config.LockerVolumeAdjustment.Value);
playerScanning.JumpToFearLevel(0.5f, true);
currentEyeColor = eyeColorScan;
TargetServerRpc(playerScanning.playerClientId, ((Component)playerScanning).transform.position);
playerScanned = false;
playerScannedTimer = 0f;
playerScannedDuration = 0f;
}
}
if ((Object)(object)val2 != (Object)null && Mathf.Abs(((Component)val2).transform.position.y - ((Component)this).transform.position.y) + 2f > 2f && Vector3.Distance(((Component)val2).transform.position, ((Component)this).transform.position) < 2f)
{
ConsumeServerRpc(val2.playerClientId);
break;
}
DoorLock[] array = doors;
foreach (DoorLock door in array)
{
if (!Object.op_Implicit((Object)(object)door))
{
doors = doors.Where((DoorLock val) => (Object)(object)val != (Object)(object)door).ToArray();
break;
}
if (!Object.op_Implicit((Object)(object)((Component)door).GetComponent<Rigidbody>()) && Vector3.Distance(((Component)door).transform.position, ((Component)this).transform.position) < 3f)
{
Utilities.Explode(((Component)door).transform.position, 2f, 4f, 100f, 0);
Object.Destroy((Object)(object)((Component)((Component)door).transform.parent).gameObject);
doors = doors.Where((DoorLock val) => (Object)(object)val != (Object)(object)door).ToArray();
}
}
Turret[] array2 = turrets;
foreach (Turret turret in array2)
{
if (!Object.op_Implicit((Object)(object)turret))
{
turrets = turrets.Where((Turret val) => (Object)(object)val != (Object)(object)turret).ToArray();
break;
}
if (Vector3.Distance(((Component)turret).transform.position, ((Component)this).transform.position) < 3f)
{
Utilities.Explode(((Component)turret).transform.position, 2f, 4f, 100f, 0);
Object.Destroy((Object)(object)((Component)((Component)turret).transform.parent).gameObject);
turrets = turrets.Where((Turret val) => (Object)(object)val != (Object)(object)turret).ToArray();
}
}
Landmine[] array3 = landmines;
foreach (Landmine landmine in array3)
{
if (!Object.op_Implicit((Object)(object)landmine))
{
landmines = landmines.Where((Landmine val) => (Object)(object)val != (Object)(object)landmine).ToArray();
break;
}
if (Vector3.Distance(((Component)landmine).transform.position, ((Component)this).transform.position) < 3f)
{
Utilities.Explode(((Component)landmine).transform.position, 2f, 4f, 100f, 0);
Object.Destroy((Object)(object)((Component)((Component)landmine).transform.parent).gameObject);
landmines = landmines.Where((Landmine val) => (Object)(object)val != (Object)(object)landmine).ToArray();
}
}
chaseMovementAverage = (chaseMovementAverage + Vector3.Distance(lastChasePosition, ((Component)this).transform.position)) / 2f;
lastChasePosition = ((Component)this).transform.position;
if (((NetworkBehaviour)this).IsServer && (Vector3.Distance(((Component)this).transform.position, targetPosition) <= 1f || chaseMovementAverage < chaseMovementAverageMinimum))
{
if (chaseMovementAverage > chaseMovementAverageMinimum && Random.Range(0f, 100f) < Config.LockerMechanicsReactivationChance.Value)
{
ReactivateServerRpc();
}
else
{
ResetServerRpc();
}
}
break;
}
case 3:
reactivationTimer += Time.fixedDeltaTime;
if (reactivationTimer > reactivationDuration)
{
PlayerControllerB closestPlayer = ((EnemyAI)this).GetClosestPlayer(true, false, false);
if (Object.op_Implicit((Object)(object)closestPlayer))
{
Vector3 val5 = ((Component)this).transform.position - ((Component)closestPlayer).transform.position;
TargetServerRpc(closestPlayer.playerClientId, ((Component)closestPlayer).transform.position - ((Vector3)(ref val5)).normalized * reactivationOvershoot);
}
else
{
ResetServerRpc();
}
}
break;
case 5:
consumeTimer += Time.fixedDeltaTime;
if (consumeTimer > consumeDuration)
{
SwitchState(State.Dormant);
}
break;
case 4:
resetTimer += Time.fixedDeltaTime;
if (resetTimer > resetDuration)
{
SwitchState(State.Dormant);
}
break;
}
}
public override void KillEnemy(bool destroy = false)
{
((EnemyAI)this).KillEnemy(destroy);
if (((NetworkBehaviour)this).IsServer)
{
ExplodeServerRpc();
}
}
public override void OnCollideWithEnemy(Collider other, EnemyAI enemy)
{
((EnemyAI)this).OnCollideWithEnemy(other, enemy);
int currentBehaviourStateIndex = base.currentBehaviourStateIndex;
int num = currentBehaviourStateIndex;
if (num == 2)
{
if (enemy.enemyType.canDie && !enemy.isEnemyDead)
{
enemy.KillEnemy(false);
}
if ((Object)(object)enemy.enemyType == (Object)(object)base.enemyType)
{
((EnemyAI)this).KillEnemy(false);
}
}
}
public void OnTriggerEnter(Collider collider)
{
int currentBehaviourStateIndex = base.currentBehaviourStateIndex;
int num = currentBehaviourStateIndex;
if (num == 2)
{
PlayerControllerB component = ((Component)collider).gameObject.GetComponent<PlayerControllerB>();
if ((Object)(object)component != (Object)null)
{
ConsumeServerRpc(component.playerClientId);
}
}
}
public void SwitchState(State state)
{
((EnemyAI)this).SwitchToBehaviourState((int)state);
}
public void ObserveState()
{
//IL_0351: Unknown result type (might be due to invalid IL or missing references)
//IL_0356: Unknown result type (might be due to invalid IL or missing references)
//IL_0360: Unknown result type (might be due to invalid IL or missing references)
//IL_0365: Unknown result type (might be due to invalid IL or missing references)
//IL_036a: 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_009b: 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_01ff: 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_03f6: Unknown result type (might be due to invalid IL or missing references)
//IL_0402: Unknown result type (might be due to invalid IL or missing references)
//IL_0424: Unknown result type (might be due to invalid IL or missing references)
if (base.currentBehaviourStateIndex == observedState)
{
return;
}
activationTimer = 0f;
reactivationTimer = 0f;
consumeTimer = 0f;
resetTimer = 0f;
switch (base.currentBehaviourStateIndex)
{
case 6:
TargetServerRpc(0uL, new Vector3((float)Random.Range(-25, 25), ((Component)this).transform.position.y, (float)Random.Range(-25, 25)));
break;
case 0:
{
audioSource.loop = false;
currentRotationSpeed = 0f;
foreach (Light scrapeLight in scrapeLights)
{
scrapeLight.intensity = 0f;
((Behaviour)scrapeLight).enabled = false;
}
animationController.SetTrigger("Deactivate");
animationController.SetBool("Chasing", false);
VisualEffect[] array2 = visualEffects;
foreach (VisualEffect val2 in array2)
{
val2.SendEvent(consumeVFXEndTrigger.name);
val2.SendEvent(chaseVFXEndTrigger.name);
}
consumeBloodTriggered = false;
break;
}
case 1:
audioSource.PlayOneShot(AudioClipActivate, Config.LockerVolumeAdjustment.Value);
animationController.SetTrigger("Activate");
break;
case 2:
{
if (((NetworkBehaviour)this).IsServer && base.agent.isOnNavMesh)
{
((EnemyAI)this).SetDestinationToPosition(targetPosition, true);
}
base.agent.speed = chaseMovementSpeed;
lastChasePosition = ((Component)this).transform.position;
chaseMovementAverage = chaseMovementAverageInitial;
audioSource.pitch = 1f;
audioSource.clip = AudioClipChase;
audioSource.loop = true;
audioSource.volume = Config.LockerVolumeAdjustment.Value;
audioSource.Play();
animationController.SetTrigger("OpenDoors");
foreach (Light scrapeLight2 in scrapeLights)
{
((Behaviour)scrapeLight2).enabled = true;
}
animationController.SetTrigger("Chase");
animationController.SetBool("Chasing", true);
VisualEffect[] array3 = visualEffects;
foreach (VisualEffect val3 in array3)
{
val3.SendEvent(chaseVFXBeginTrigger.name);
}
break;
}
case 3:
case 4:
case 5:
{
base.agent.speed = 0f;
currentRotationSpeed = 0f;
audioSource.Stop();
audioSource.loop = false;
((Component)this).transform.rotation = ((Component)this).transform.rotation * Quaternion.Euler(Vector3.forward * 10f);
animationController.SetBool("Chasing", false);
animationController.SetTrigger("CloseDoors");
VisualEffect[] array = visualEffects;
foreach (VisualEffect val in array)
{
val.SendEvent(chaseVFXEndTrigger.name);
}
if ((Object)(object)StartOfRound.Instance != (Object)null)
{
PlayerControllerB localPlayerController = StartOfRound.Instance.localPlayerController;
float num = Vector3.Distance(((Component)this).transform.position, ((Component)localPlayerController).transform.position);
if (num < 7f)
{
Utilities.ApplyLocalPlayerScreenshake(((Component)this).transform.position, 4f, 7f);
if (num < 4f)
{
if (base.currentBehaviourStateIndex == 5)
{
localPlayerController.JumpToFearLevel(1f, true);
}
else
{
localPlayerController.JumpToFearLevel(0.7f, true);
}
}
}
}
if (base.currentBehaviourStateIndex == 5)
{
audioSource.PlayOneShot(AudioClipConsume, Config.LockerVolumeAdjustment.Value);
}
else if (base.currentBehaviourStateIndex == 3)
{
audioSource.PlayOneShot(AudioClipReactivate, Config.LockerVolumeAdjustment.Value);
}
else
{
audioSource.PlayOneShot(AudioClipReset, Config.LockerVolumeAdjustment.Value);
}
break;
}
}
observedState = base.currentBehaviourStateIndex;
}
private bool IsLocalPlayerClosestWithLight()
{
//IL_0053: Unknown result type (might be due to invalid IL or missing references)
//IL_005f: Unknown result type (might be due to invalid IL or missing references)
//IL_0064: 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_0072: 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_01a4: 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)
PlayerControllerB val = null;
float num = float.PositiveInfinity;
PlayerControllerB[] allPlayersInLineOfSight = ((EnemyAI)this).GetAllPlayersInLineOfSight(360f, 15, (Transform)null, -1f, -1);
if (allPlayersInLineOfSight == null || allPlayersInLineOfSight.Length == 0)
{
return false;
}
PlayerControllerB[] array = allPlayersInLineOfSight;
foreach (PlayerControllerB val2 in array)
{
bool flag = false;
Vector3 val3 = ((Component)this).transform.position - ((Component)val2).transform.position;
float num2 = Vector3.Angle(((Component)val2).transform.forward, val3);
if ((Object)(object)val2.pocketedFlashlight != (Object)null && val2.pocketedFlashlight.isBeingUsed && Mathf.Abs(num2) < 30f)
{
flag = true;
}
GrabbableObject currentlyHeldObjectServer = val2.currentlyHeldObjectServer;
if (!flag && val2.isHoldingObject && (Object)(object)currentlyHeldObjectServer != (Object)null)
{
bool flag2 = ((object)currentlyHeldObjectServer).GetType() == typeof(FlashlightItem);
Light[] componentsInChildren = ((Component)currentlyHeldObjectServer).gameObject.GetComponentsInChildren<Light>();
Light[] array2 = componentsInChildren;
foreach (Light val4 in array2)
{
if (!((Behaviour)val4).enabled || !(val4.intensity > 0f) || !(val4.range > 0f))
{
continue;
}
if (flag2)
{
if (Mathf.Abs(num2) < 30f)
{
flag = true;
}
}
else
{
flag = true;
}
}
}
if (flag)
{
float num3 = Vector3.Distance(((Component)val2).transform.position, ((Component)this).transform.position);
if (num3 < num)
{
num = num3;
val = val2;
}
}
}
if ((Object)(object)val != (Object)null && (Object)(object)val == (Object)(object)StartOfRound.Instance.localPlayerController)
{
return true;
}
return false;
}
public PlayerControllerB GetClosestVisiblePlayer()
{
//IL_004a: 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)
PlayerControllerB[] allPlayersInLineOfSight = ((EnemyAI)this).GetAllPlayersInLineOfSight(360f, 30, (Transform)null, -1f, -1);
float num = float.PositiveInfinity;
PlayerControllerB result = null;
if (allPlayersInLineOfSight != null)
{
if (allPlayersInLineOfSight.Length != 0)
{
PlayerControllerB[] array = allPlayersInLineOfSight;
foreach (PlayerControllerB val in array)
{
float num2 = Vector3.Distance(((Component)this).transform.position, ((Component)val).transform.position);
if (num2 < num)
{
num = num2;
result = val;
}
}
}
return result;
}
return null;
}
[ServerRpc(RequireOwnership = false)]
public void TargetServerRpc(ulong clientId, Vector3 position)
{
//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_00d8: 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(1408573431u, val, (RpcDelivery)0);
BytePacker.WriteValueBitPacked(val2, clientId);
((FastBufferWriter)(ref val2)).WriteValueSafe(ref position);
((NetworkBehaviour)this).__endSendServerRpc(ref val2, 1408573431u, val, (RpcDelivery)0);
}
if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost))
{
TargetClientRpc(clientId, position);
}
}
}
[ClientRpc]
public void TargetClientRpc(ulong clientId, Vector3 position)
{
//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_012f: 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_0147: Unknown result type (might be due to invalid IL or missing references)
//IL_015c: Unknown result type (might be due to invalid IL or missing references)
//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_0171: Unknown result type (might be due to invalid IL or missing references)
//IL_0176: 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_0182: Unknown result type (might be due to invalid IL or missing references)
//IL_018c: Unknown result type (might be due to invalid IL or missing references)
//IL_0191: Unknown result type (might be due to invalid IL or missing references)
//IL_0196: Unknown result type (might be due to invalid IL or missing references)
//IL_019b: 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)
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(1018811517u, val, (RpcDelivery)0);
BytePacker.WriteValueBitPacked(val2, clientId);
((FastBufferWriter)(ref val2)).WriteValueSafe(ref position);
((NetworkBehaviour)this).__endSendClientRpc(ref val2, 1018811517u, val, (RpcDelivery)0);
}
if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 2 || (!networkManager.IsClient && !networkManager.IsHost) || !(Time.time - lastTargetTimeframe > lastTargetTime) || (base.currentBehaviourStateIndex != 0 && base.currentBehaviourStateIndex != 6 && (base.currentBehaviourStateIndex != 2 || clientId != base.targetPlayer.playerClientId) && base.currentBehaviourStateIndex != 3))
{
return;
}
targetPosition = position;
targetRotation = Quaternion.LookRotation(new Vector3(targetPosition.x, ((Component)this).transform.position.y, targetPosition.z) - ((Component)this).transform.position);
targetRotation *= Quaternion.Euler(Vector3.up * 90f);
lastTargetTime = Time.time;
base.targetPlayer = StartOfRound.Instance.allPlayerScripts[clientId];
if (base.currentBehaviourStateIndex == 0 || base.currentBehaviourStateIndex == 6)
{
SwitchState(State.Activating);
}
else if ((base.currentBehaviourStateIndex == 2 || base.currentBehaviourStateIndex == 3) && base.currentBehaviourStateIndex == 3)
{
if (((NetworkBehaviour)this).IsServer && base.agent.isOnNavMesh)
{
((EnemyAI)this).SetDestinationToPosition(targetPosition, true);
}
SwitchState(State.Chasing);
}
}
[ServerRpc(RequireOwnership = false)]
public void ReactivateServerRpc()
{
//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_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_00ea: 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(1126862929u, val, (RpcDelivery)0);
((NetworkBehaviour)this).__endSendServerRpc(ref val2, 1126862929u, val, (RpcDelivery)0);
}
if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost))
{
targetPosition = ((Component)this).transform.position;
if (((NetworkBehaviour)this).IsServer && base.agent.isOnNavMesh)
{
((EnemyAI)this).SetDestinationToPosition(targetPosition, true);
}
ReactivateClientRpc();
}
}
[ClientRpc]
public void ReactivateClientRpc()
{
//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_00e4: Unknown result type (might be due to invalid IL or missing references)
//IL_00f4: Unknown result type (might be due to invalid IL or missing references)
//IL_0104: Unknown result type (might be due to invalid IL or missing references)
//IL_010e: 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_011e: Unknown result type (might be due to invalid IL or missing references)
//IL_0123: Unknown result type (might be due to invalid IL or missing references)
//IL_0128: Unknown result type (might be due to invalid IL or missing references)
//IL_012f: Unknown result type (might be due to invalid IL or missing references)
//IL_0134: Unknown result type (might be due to invalid IL or missing references)
//IL_013e: Unknown result type (might be due to invalid IL or missing references)
//IL_0143: Unknown result type (might be due to invalid IL or missing references)
//IL_0148: Unknown result type (might be due to invalid IL or missing references)
//IL_014d: Unknown result type (might be due to invalid IL or missing references)
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(1648224205u, val, (RpcDelivery)0);
((NetworkBehaviour)this).__endSendClientRpc(ref val2, 1648224205u, val, (RpcDelivery)0);
}
if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 2 && (networkManager.IsClient || networkManager.IsHost))
{
PlayerControllerB closestVisiblePlayer = GetClosestVisiblePlayer();
if ((Object)(object)closestVisiblePlayer != (Object)null)
{
currentRotationSpeed = 0f;
targetRotation = Quaternion.LookRotation(new Vector3(((Component)closestVisiblePlayer).transform.position.x, ((Component)this).transform.position.y, ((Component)closestVisiblePlayer).transform.position.z) - ((Component)this).transform.position);
targetRotation *= Quaternion.Euler(Vector3.up * 90f);
}
SwitchState(State.Reactivating);
}
}
[ServerRpc(RequireOwnership = false)]
public void ConsumeServerRpc(ulong clientid)
{
//IL_0024: Unknown result type (might be due to invalid IL or missing references)
//IL_002e: Invalid comparison between Unknown and I4
//IL_0099: Unknown result type (might be due to invalid IL or missing references)
//IL_00a3: Invalid comparison between Unknown and I4
//IL_005f: Unknown result type (might be due to invalid IL or missing references)
//IL_0068: Unknown result type (might be due to invalid IL or missing references)
//IL_006d: Unknown result type (might be due to invalid IL or missing references)
//IL_0071: Unknown result type (might be due to invalid IL or missing references)
//IL_0089: Unknown result type (might be due to invalid IL or missing references)
//IL_00d0: Unknown result type (might be due to invalid IL or missing references)
//IL_00d5: Unknown result type (might be due to invalid IL or missing references)
//IL_00f7: 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(2082259863u, val, (RpcDelivery)0);
BytePacker.WriteValueBitPacked(val2, clientid);
((NetworkBehaviour)this).__endSendServerRpc(ref val2, 2082259863u, val, (RpcDelivery)0);
}
if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost))
{
targetPosition = ((Component)this).transform.position;
if (((NetworkBehaviour)this).IsServer && base.agent.isOnNavMesh)
{
((EnemyAI)this).SetDestinationToPosition(targetPosition, false);
}
ConsumeClientRpc(clientid);
}
}
[ClientRpc]
public void ConsumeClientRpc(ulong id)
{
//IL_0024: Unknown result type (might be due to invalid IL or missing references)
//IL_002e: Invalid comparison between Unknown and I4
//IL_0099: Unknown result type (might be due to invalid IL or missing references)
//IL_00a3: Invalid comparison between Unknown and I4
//IL_005f: Unknown result type (might be due to invalid IL or missing references)
//IL_0068: Unknown result type (might be due to invalid IL or missing references)
//IL_006d: Unknown result type (might be due to invalid IL or missing references)
//IL_0071: Unknown result type (might be due to invalid IL or missing references)
//IL_0089: Unknown result type (might be due to invalid IL or missing references)
NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
if (networkManager != null && networkManager.IsListening)
{
if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 2 && (networkManager.IsServer || networkManager.IsHost))
{
ClientRpcParams val = default(ClientRpcParams);
FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(2705739593u, val, (RpcDelivery)0);
BytePacker.WriteValueBitPacked(val2, id);
((NetworkBehaviour)this).__endSendClientRpc(ref val2, 2705739593u, val, (RpcDelivery)0);
}
if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 2 && (networkManager.IsClient || networkManager.IsHost))
{
((MonoBehaviour)this).StartCoroutine(KillPlayer(id));
SwitchState(State.Consuming);
}
}
}
[ServerRpc(RequireOwnership = false)]
public void ResetServerRpc()
{
//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_00de: 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_00ea: 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(3735075229u, val, (RpcDelivery)0);
((NetworkBehaviour)this).__endSendServerRpc(ref val2, 3735075229u, val, (RpcDelivery)0);
}
if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost))
{
if (((NetworkBehaviour)this).IsServer && base.agent.isOnNavMesh)
{
targetPosition = ((Component)this).transform.position;
((EnemyAI)this).SetDestinationToPosition(targetPosition, false);
}
ResetClientRpc();
}
}
[ClientRpc]
public void ResetClientRpc()
{
//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(3355973848u, val, (RpcDelivery)0);
((NetworkBehaviour)this).__endSendClientRpc(ref val2, 3355973848u, val, (RpcDelivery)0);
}
if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 2 && (networkManager.IsClient || networkManager.IsHost))
{
SwitchState(State.Resetting);
}
}
}
[ServerRpc(RequireOwnership = true)]
public void ExplodeServerRpc()
{
//IL_0024: Unknown result type (might be due to invalid IL or missing references)
//IL_002e: Invalid comparison between Unknown and I4
//IL_00d2: Unknown result type (might be due to invalid IL or missing references)
//IL_00dc: Invalid comparison between Unknown and I4
//IL_00a5: 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_00c2: 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_0084: Invalid comparison between Unknown and I4
NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
if (networkManager == null || !networkManager.IsListening)
{
return;
}
if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1 && (networkManager.IsClient || networkManager.IsHost))
{
if (((NetworkBehaviour)this).OwnerClientId != networkManager.LocalClientId)
{
if ((int)networkManager.LogLevel <= 1)
{
Debug.LogError((object)"Only the owner can invoke a ServerRpc that requires ownership!");
}
return;
}
ServerRpcParams val = default(ServerRpcParams);
FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendServerRpc(2667453085u, val, (RpcDelivery)0);
((NetworkBehaviour)this).__endSendServerRpc(ref val2, 2667453085u, val, (RpcDelivery)0);
}
if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost))
{
ExplodeClientRpc();
}
}
[ClientRpc]
public void ExplodeClientRpc()
{
//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_00c2: 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(707895878u, val, (RpcDelivery)0);
((NetworkBehaviour)this).__endSendClientRpc(ref val2, 707895878u, val, (RpcDelivery)0);
}
if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 2 && (networkManager.IsClient || networkManager.IsHost))
{
Utilities.Explode(((Component)this).transform.position, explosionMinRange, explosionMaxRange, explosionDamage, explosionEnemyDamage);
Object.Destroy((Object)(object)((Component)this).gameObject);
}
}
}
public IEnumerator KillPlayer(ulong id)
{
PlayerControllerB player = StartOfRound.Instance.allPlayerScripts[id];
if (!((Object)(object)player != (Object)null))
{
yield break;
}
player.bleedingHeavily = true;
yield return (object)new WaitForSeconds(0.1f);
player.KillPlayer(Vector3.zero, true, (CauseOfDeath)8, 1, default(Vector3));
float startTime = Time.timeSinceLevelLoad;
yield return (object)new WaitUntil((Func<bool>)(() => (Object)(object)player.deadBody != (Object)null || Time.timeSinceLevelLoad - startTime > 3f));
if ((Object)(object)player.deadBody != (Object)null)
{
player.deadBody.attachedTo = ((Component)base.eye).transform;
player.deadBody.attachedLimb = player.deadBody.bodyParts[5];
player.deadBody.matchPositionExactly = true;
}
yield return (object)new WaitUntil((Func<bool>)(() => (double)(Time.timeSinceLevelLoad - startTime) > (double)consumeDuration * 0.75));
if ((Object)(object)player.deadBody != (Object)null)
{
player.deadBody.attachedTo = null;
player.deadBody.attachedLimb = null;
player.deadBody.matchPositionExactly = false;
if (!Config.LockerMechanicsBodiesEnabled.Value)
{
((Component)player.deadBody).gameObject.SetActive(false);
player.deadBody = null;
}
}
}
public void PlayerScan(PlayerControllerB player)
{
//IL_002c: Unknown result type (might be due to invalid IL or missing references)
//IL_0037: 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_0060: Unknown result type (might be due to invalid IL or missing references)
//IL_0097: Unknown result type (might be due to invalid IL or missing references)
//IL_009c: Unknown result type (might be due to invalid IL or missing references)
//IL_00a6: 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_00b0: 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_00bf: Unknown result type (might be due to invalid IL or missing references)
//IL_00ca: Unknown result type (might be due to invalid IL or missing references)
//IL_00cf: 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_00e3: 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_00f2: Unknown result type (might be due to invalid IL or missing references)
if (base.currentBehaviourStateIndex != 0 && base.currentBehaviourStateIndex != 6 && base.currentBehaviourStateIndex != 2)
{
return;
}
float num = Vector3.Distance(((Component)this).transform.position, ((Component)player).transform.position);
if ((!(num < 2f) || !(Mathf.Abs(((Component)player).transform.position.y - ((Component)this).transform.position.y) + 2f > 2f)) && num < 90f && !Physics.Linecast(((Component)this).transform.position + Vector3.up * 2f + Vector3.right * 0.2f, ((Component)player).transform.position + Vector3.up * 2f + Vector3.right * 0.2f, StartOfRound.Instance.collidersAndRoomMask))
{
playerScanning = player;
if (!playerScanned)
{
playerScanned = true;
playerScannedTimer = 0f;
playerScannedDuration = num / 30f;
}
else if (playerScannedDuration - playerScannedTimer < num / 30f)
{
playerScannedDuration = num / 30f;
}
}
}
protected override void __initializeVariables()
{
((EnemyAI)this).__initializeVariables();
}
[RuntimeInitializeOnLoadMethod]
internal static void InitializeRPCS_LockerAI()
{
//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
//IL_00b3: Unknown result type (might be due to invalid IL or missing references)
//IL_00bd: Expected O, but got Unknown
//IL_00ce: Unknown result type (might be due to invalid IL or missing references)
//IL_00d8: Expected O, but got Unknown
//IL_00e9: Unknown result type (might be due to invalid IL or missing references)
//IL_00f3: Expected O, but got Unknown
//IL_0104: Unknown result type (might be due to invalid IL or missing references)
//IL_010e: Expected O, but got Unknown
NetworkManager.__rpc_func_table.Add(1408573431u, new RpcReceiveHandler(__rpc_handler_1408573431));
NetworkManager.__rpc_func_table.Add(1018811517u, new RpcReceiveHandler(__rpc_handler_1018811517));
NetworkManager.__rpc_func_table.Add(1126862929u, new RpcReceiveHandler(__rpc_handler_1126862929));
NetworkManager.__rpc_func_table.Add(1648224205u, new RpcReceiveHandler(__rpc_handler_1648224205));
NetworkManager.__rpc_func_table.Add(2082259863u, new RpcReceiveHandler(__rpc_handler_2082259863));
NetworkManager.__rpc_func_table.Add(2705739593u, new RpcReceiveHandler(__rpc_handler_2705739593));
NetworkManager.__rpc_func_table.Add(3735075229u, new RpcReceiveHandler(__rpc_handler_3735075229));
NetworkManager.__rpc_func_table.Add(3355973848u, new RpcReceiveHandler(__rpc_handler_3355973848));
NetworkManager.__rpc_func_table.Add(2667453085u, new RpcReceiveHandler(__rpc_handler_2667453085));
NetworkManager.__rpc_func_table.Add(707895878u, new RpcReceiveHandler(__rpc_handler_707895878));
}
private static void __rpc_handler_1408573431(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams)
{
//IL_0023: 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_0052: 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)
NetworkManager networkManager = target.NetworkManager;
if (networkManager != null && networkManager.IsListening)
{
ulong clientId = default(ulong);
ByteUnpacker.ReadValueBitPacked(reader, ref clientId);
Vector3 position = default(Vector3);
((FastBufferReader)(ref reader)).ReadValueSafe(ref position);
target.__rpc_exec_stage = (__RpcExecStage)1;
((LockerAI)(object)target).TargetServerRpc(clientId, position);
target.__rpc_exec_stage = (__RpcExecStage)0;
}
}
private static void __rpc_handler_1018811517(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams)
{
//IL_0023: 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_0052: 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)
NetworkManager networkManager = target.NetworkManager;
if (networkManager != null && networkManager.IsListening)
{
ulong clientId = default(ulong);
ByteUnpacker.ReadValueBitPacked(reader, ref clientId);
Vector3 position = default(Vector3);
((FastBufferReader)(ref reader)).ReadValueSafe(ref position);
target.__rpc_exec_stage = (__RpcExecStage)2;
((LockerAI)(object)target).TargetClientRpc(clientId, position);
target.__rpc_exec_stage = (__RpcExecStage)0;
}
}
private static void __rpc_handler_1126862929(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;
((LockerAI)(object)target).ReactivateServerRpc();
target.__rpc_exec_stage = (__RpcExecStage)0;
}
}
private static void __rpc_handler_1648224205(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;
((LockerAI)(object)target).ReactivateClientRpc();
target.__rpc_exec_stage = (__RpcExecStage)0;
}
}
private static void __rpc_handler_2082259863(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams)
{
//IL_0023: Unknown result type (might be due to invalid IL or missing references)
//IL_0036: Unknown result type (might be due to invalid IL or missing references)
//IL_0050: Unknown result type (might be due to invalid IL or missing references)
NetworkManager networkManager = target.NetworkManager;
if (networkManager != null && networkManager.IsListening)
{
ulong clientid = default(ulong);
ByteUnpacker.ReadValueBitPacked(reader, ref clientid);
target.__rpc_exec_stage = (__RpcExecStage)1;
((LockerAI)(object)target).ConsumeServerRpc(clientid);
target.__rpc_exec_stage = (__RpcExecStage)0;
}
}
private static void __rpc_handler_2705739593(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams)
{
//IL_0023: Unknown result type (might be due to invalid IL or missing references)
//IL_0036: Unknown result type (might be due to invalid IL or missing references)
//IL_0050: Unknown result type (might be due to invalid IL or missing references)
NetworkManager networkManager = target.NetworkManager;
if (networkManager != null && networkManager.IsListening)
{
ulong id = default(ulong);
ByteUnpacker.ReadValueBitPacked(reader, ref id);
target.__rpc_exec_stage = (__RpcExecStage)2;
((LockerAI)(object)target).ConsumeClientRpc(id);
target.__rpc_exec_stage = (__RpcExecStage)0;
}
}
private static void __rpc_handler_3735075229(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;
((LockerAI)(object)target).ResetServerRpc();
target.__rpc_exec_stage = (__RpcExecStage)0;
}
}
private static void __rpc_handler_3355973848(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;
((LockerAI)(object)target).ResetClientRpc();
target.__rpc_exec_stage = (__RpcExecStage)0;
}
}
private static void __rpc_handler_2667453085(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams)
{
//IL_0023: Unknown result type (might be due to invalid IL or missing references)
//IL_0024: Unknown result type (might be due to invalid IL or missing references)
//IL_0029: Unknown result type (might be due to invalid IL or missing references)
//IL_0076: 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_004b: Unknown result type (might be due to invalid IL or missing references)
//IL_0055: Invalid comparison between Unknown and I4
NetworkManager networkManager = target.NetworkManager;
if (networkManager == null || !networkManager.IsListening)
{
return;
}
if (rpcParams.Server.Receive.SenderClientId != target.OwnerClientId)
{
if ((int)networkManager.LogLevel <= 1)
{
Debug.LogError((object)"Only the owner can invoke a ServerRpc that requires ownership!");
}
}
else
{
target.__rpc_exec_stage = (__RpcExecStage)1;
((LockerAI)(object)target).ExplodeServerRpc();
target.__rpc_exec_stage = (__RpcExecStage)0;
}
}
private static void __rpc_handler_707895878(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;
((LockerAI)(object)target).ExplodeClientRpc();
target.__rpc_exec_stage = (__RpcExecStage)0;
}
}
protected internal override string __getTypeName()
{
return "LockerAI";
}
}
}
namespace Locker.NetcodePatcher
{
[AttributeUsage(AttributeTargets.Module)]
internal class NetcodePatchedAssemblyAttribute : Attribute
{
}
}