using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using BepInEx;
using BepInEx.Configuration;
using BepInEx.Logging;
using GameNetcodeStuff;
using HarmonyLib;
using LethalLib.Modules;
using Microsoft.CodeAnalysis;
using ProjectSCP.SCP999.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: IgnoresAccessChecksTo("AmazingAssets.TerrainToMesh")]
[assembly: IgnoresAccessChecksTo("Assembly-CSharp-firstpass")]
[assembly: IgnoresAccessChecksTo("Assembly-CSharp")]
[assembly: IgnoresAccessChecksTo("ClientNetworkTransform")]
[assembly: IgnoresAccessChecksTo("DissonanceVoip")]
[assembly: IgnoresAccessChecksTo("Facepunch Transport for Netcode for GameObjects")]
[assembly: IgnoresAccessChecksTo("Facepunch.Steamworks.Win64")]
[assembly: IgnoresAccessChecksTo("Unity.AI.Navigation")]
[assembly: IgnoresAccessChecksTo("Unity.Animation.Rigging")]
[assembly: IgnoresAccessChecksTo("Unity.Animation.Rigging.DocCodeExamples")]
[assembly: IgnoresAccessChecksTo("Unity.Burst")]
[assembly: IgnoresAccessChecksTo("Unity.Burst.Unsafe")]
[assembly: IgnoresAccessChecksTo("Unity.Collections")]
[assembly: IgnoresAccessChecksTo("Unity.Collections.LowLevel.ILSupport")]
[assembly: IgnoresAccessChecksTo("Unity.InputSystem")]
[assembly: IgnoresAccessChecksTo("Unity.InputSystem.ForUI")]
[assembly: IgnoresAccessChecksTo("Unity.Jobs")]
[assembly: IgnoresAccessChecksTo("Unity.Mathematics")]
[assembly: IgnoresAccessChecksTo("Unity.Multiplayer.Tools.Common")]
[assembly: IgnoresAccessChecksTo("Unity.Multiplayer.Tools.MetricTypes")]
[assembly: IgnoresAccessChecksTo("Unity.Multiplayer.Tools.NetStats")]
[assembly: IgnoresAccessChecksTo("Unity.Multiplayer.Tools.NetStatsMonitor.Component")]
[assembly: IgnoresAccessChecksTo("Unity.Multiplayer.Tools.NetStatsMonitor.Configuration")]
[assembly: IgnoresAccessChecksTo("Unity.Multiplayer.Tools.NetStatsMonitor.Implementation")]
[assembly: IgnoresAccessChecksTo("Unity.Multiplayer.Tools.NetStatsReporting")]
[assembly: IgnoresAccessChecksTo("Unity.Multiplayer.Tools.NetworkProfiler.Runtime")]
[assembly: IgnoresAccessChecksTo("Unity.Multiplayer.Tools.NetworkSolutionInterface")]
[assembly: IgnoresAccessChecksTo("Unity.Netcode.Components")]
[assembly: IgnoresAccessChecksTo("Unity.Netcode.Runtime")]
[assembly: IgnoresAccessChecksTo("Unity.Networking.Transport")]
[assembly: IgnoresAccessChecksTo("Unity.ProBuilder.Csg")]
[assembly: IgnoresAccessChecksTo("Unity.ProBuilder")]
[assembly: IgnoresAccessChecksTo("Unity.ProBuilder.KdTree")]
[assembly: IgnoresAccessChecksTo("Unity.ProBuilder.Poly2Tri")]
[assembly: IgnoresAccessChecksTo("Unity.ProBuilder.Stl")]
[assembly: IgnoresAccessChecksTo("Unity.Profiling.Core")]
[assembly: IgnoresAccessChecksTo("Unity.RenderPipelines.Core.Runtime")]
[assembly: IgnoresAccessChecksTo("Unity.RenderPipelines.Core.ShaderLibrary")]
[assembly: IgnoresAccessChecksTo("Unity.RenderPipelines.HighDefinition.Config.Runtime")]
[assembly: IgnoresAccessChecksTo("Unity.RenderPipelines.HighDefinition.Runtime")]
[assembly: IgnoresAccessChecksTo("Unity.RenderPipelines.ShaderGraph.ShaderGraphLibrary")]
[assembly: IgnoresAccessChecksTo("Unity.Services.Authentication")]
[assembly: IgnoresAccessChecksTo("Unity.Services.Core.Analytics")]
[assembly: IgnoresAccessChecksTo("Unity.Services.Core.Configuration")]
[assembly: IgnoresAccessChecksTo("Unity.Services.Core.Device")]
[assembly: IgnoresAccessChecksTo("Unity.Services.Core")]
[assembly: IgnoresAccessChecksTo("Unity.Services.Core.Environments")]
[assembly: IgnoresAccessChecksTo("Unity.Services.Core.Environments.Internal")]
[assembly: IgnoresAccessChecksTo("Unity.Services.Core.Internal")]
[assembly: IgnoresAccessChecksTo("Unity.Services.Core.Networking")]
[assembly: IgnoresAccessChecksTo("Unity.Services.Core.Registration")]
[assembly: IgnoresAccessChecksTo("Unity.Services.Core.Scheduler")]
[assembly: IgnoresAccessChecksTo("Unity.Services.Core.Telemetry")]
[assembly: IgnoresAccessChecksTo("Unity.Services.Core.Threading")]
[assembly: IgnoresAccessChecksTo("Unity.Services.QoS")]
[assembly: IgnoresAccessChecksTo("Unity.Services.Relay")]
[assembly: IgnoresAccessChecksTo("Unity.TextMeshPro")]
[assembly: IgnoresAccessChecksTo("Unity.Timeline")]
[assembly: IgnoresAccessChecksTo("Unity.VisualEffectGraph.Runtime")]
[assembly: IgnoresAccessChecksTo("UnityEngine.ARModule")]
[assembly: IgnoresAccessChecksTo("UnityEngine.NVIDIAModule")]
[assembly: IgnoresAccessChecksTo("UnityEngine.UI")]
[assembly: AssemblyCompany("ProjectSCP.SCP999")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("2.2.3.0")]
[assembly: AssemblyInformationalVersion("2.2.3+40ee6d2c263e70fc2ce404b3ea43f1190873c563")]
[assembly: AssemblyProduct("SCP999")]
[assembly: AssemblyTitle("ProjectSCP.SCP999")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("2.2.3.0")]
[module: UnverifiableCode]
[module: RefSafetyRules(11)]
[module: NetcodePatchedAssembly]
internal class <Module>
{
static <Module>()
{
}
}
namespace Microsoft.CodeAnalysis
{
[CompilerGenerated]
[Microsoft.CodeAnalysis.Embedded]
internal sealed class EmbeddedAttribute : Attribute
{
}
}
namespace System.Runtime.CompilerServices
{
[CompilerGenerated]
[Microsoft.CodeAnalysis.Embedded]
[AttributeUsage(AttributeTargets.Class | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Parameter | AttributeTargets.ReturnValue | AttributeTargets.GenericParameter, AllowMultiple = false, Inherited = false)]
internal sealed class NullableAttribute : Attribute
{
public readonly byte[] NullableFlags;
public NullableAttribute(byte P_0)
{
NullableFlags = new byte[1] { P_0 };
}
public NullableAttribute(byte[] P_0)
{
NullableFlags = P_0;
}
}
[CompilerGenerated]
[Microsoft.CodeAnalysis.Embedded]
[AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Method | AttributeTargets.Interface | AttributeTargets.Delegate, AllowMultiple = false, Inherited = false)]
internal sealed class NullableContextAttribute : Attribute
{
public readonly byte Flag;
public NullableContextAttribute(byte P_0)
{
Flag = P_0;
}
}
[CompilerGenerated]
[Microsoft.CodeAnalysis.Embedded]
[AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)]
internal sealed class RefSafetyRulesAttribute : Attribute
{
public readonly int Version;
public RefSafetyRulesAttribute(int P_0)
{
Version = P_0;
}
}
}
namespace SCP999
{
internal class ContainmentJarBehavior : PhysicsProp
{
internal enum Contents
{
Empty,
SCP999,
Blob
}
private static ManualLogSource logger = Plugin.LoggerInstance;
public Sprite[] ItemIcons = null;
public Material[] ItemMaterials = null;
public ScanNodeProperties ScanNode = null;
public Contents JarContents = Contents.Empty;
public PlayerControllerB? lastPlayerHeldBy;
public override void Start()
{
((GrabbableObject)this).Start();
((GrabbableObject)this).FallToGround(false);
}
public override void GrabItem()
{
((GrabbableObject)this).GrabItem();
lastPlayerHeldBy = ((GrabbableObject)this).playerHeldBy;
}
public override void ItemActivate(bool used, bool buttonDown = true)
{
((GrabbableObject)this).ItemActivate(used, buttonDown);
if (buttonDown && JarContents != 0 && !StartOfRound.Instance.inShipPhase)
{
OpenJarServerRpc();
}
}
public override int GetItemDataToSave()
{
Plugin.logIfDebug("GetItemDataToSave: " + JarContents);
return (int)JarContents;
}
public override void LoadItemSaveData(int saveData)
{
Contents contents = (Contents)saveData;
Plugin.logIfDebug("LoadItemSaveData: " + contents);
((GrabbableObject)this).fallTime = 0f;
ChangeJarContentsOnLocalClient((Contents)saveData);
}
public void ChangeJarContentsOnLocalClient(Contents contents)
{
Plugin.logIfDebug("ChangeJarContentsOnLocalClient: " + contents);
((Renderer)((GrabbableObject)this).mainObjectRenderer).material = ItemMaterials[(int)contents];
((GrabbableObject)this).itemProperties.itemIcon = ItemIcons[(int)contents];
JarContents = contents;
if (JarContents == Contents.Empty)
{
((GrabbableObject)this).scrapValue = 0;
((GrabbableObject)this).itemProperties.isScrap = false;
((GrabbableObject)this).itemProperties.toolTips[0] = "";
}
else
{
((GrabbableObject)this).itemProperties.isScrap = true;
((GrabbableObject)this).itemProperties.toolTips[0] = "Release " + JarContents.ToString() + " [LMB]";
switch (contents)
{
case Contents.Blob:
((GrabbableObject)this).SetScrapValue(Plugin.configJarSlimeValue.Value);
break;
case Contents.SCP999:
((GrabbableObject)this).SetScrapValue(Plugin.configJar999Value.Value);
break;
}
}
ScanNode.subText = "Contents: " + contents;
if ((Object)(object)((GrabbableObject)this).playerHeldBy != (Object)null && (Object)(object)Plugin.localPlayer == (Object)(object)((GrabbableObject)this).playerHeldBy)
{
HUDManager.Instance.itemSlotIcons[Plugin.localPlayer.currentItemSlot].sprite = ((GrabbableObject)this).itemProperties.itemIcon;
}
}
[ServerRpc(RequireOwnership = false)]
private void OpenJarServerRpc()
{
//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_0139: 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_0152: 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_0179: Unknown result type (might be due to invalid IL or missing references)
//IL_0210: Unknown result type (might be due to invalid IL or missing references)
//IL_0224: Unknown result type (might be due to invalid IL or missing references)
//IL_0229: Unknown result type (might be due to invalid IL or missing references)
//IL_0239: Unknown result type (might be due to invalid IL or missing references)
//IL_0251: 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(3572622651u, val, (RpcDelivery)0);
((NetworkBehaviour)this).__endSendServerRpc(ref val2, 3572622651u, val, (RpcDelivery)0);
}
if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1 || (!networkManager.IsServer && !networkManager.IsHost) || (!NetworkManager.Singleton.IsServer && !NetworkManager.Singleton.IsHost))
{
return;
}
if (JarContents == Contents.SCP999)
{
SpawnableEnemy val3 = Enemies.spawnableEnemies.Where((SpawnableEnemy x) => ((Object)x.enemy).name == "SCP999Enemy").FirstOrDefault();
if (val3 != null)
{
NetworkObject val4 = NetworkObjectReference.op_Implicit(RoundManager.Instance.SpawnEnemyGameObject(((Component)((GrabbableObject)this).playerHeldBy).transform.position + new Vector3(0f, 0f, 3.5f), ((Component)((GrabbableObject)this).playerHeldBy).transform.rotation.y + 180f, 0, val3.enemy));
if (Plugin.configSlimeTaming.Value)
{
((Component)val4).GetComponent<SCP999AI>().SetTamed(((GrabbableObject)this).playerHeldBy);
}
}
}
else if (JarContents == Contents.Blob)
{
SpawnableEnemyWithRarity val5 = (from x in Plugin.GetEnemies()
where ((Object)x.enemyType).name == "Blob"
select x).FirstOrDefault();
if (val5 != null)
{
RoundManager.Instance.SpawnEnemyGameObject(((Component)((GrabbableObject)this).playerHeldBy).transform.position + new Vector3(0f, 0f, 3.5f), ((Component)((GrabbableObject)this).playerHeldBy).transform.rotation.y + 180f, 0, val5.enemyType);
}
}
ChangeJarContentsClientRpc(Contents.Empty);
}
[ClientRpc]
public void ChangeJarContentsClientRpc(Contents contents)
{
//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(3420106347u, val, (RpcDelivery)0);
((FastBufferWriter)(ref val2)).WriteValueSafe<Contents>(ref contents, default(ForEnums));
((NetworkBehaviour)this).__endSendClientRpc(ref val2, 3420106347u, val, (RpcDelivery)0);
}
if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 2 && (networkManager.IsClient || networkManager.IsHost))
{
Plugin.logIfDebug("ChangeJarContentsClientRpc: " + contents);
ChangeJarContentsOnLocalClient(contents);
}
}
}
[ClientRpc]
public void NotifyPlayerClientRpc()
{
//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(1688014456u, val, (RpcDelivery)0);
((NetworkBehaviour)this).__endSendClientRpc(ref val2, 1688014456u, val, (RpcDelivery)0);
}
if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 2 && (networkManager.IsClient || networkManager.IsHost) && (Object)(object)lastPlayerHeldBy != (Object)null && (Object)(object)lastPlayerHeldBy == (Object)(object)Plugin.localPlayer)
{
HUDManager.Instance.DisplayTip("You monster!", "You are a horrible person", true, false, "LC_Tip1");
}
}
}
protected override void __initializeVariables()
{
((PhysicsProp)this).__initializeVariables();
}
[RuntimeInitializeOnLoadMethod]
internal static void InitializeRPCS_ContainmentJarBehavior()
{
//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
NetworkManager.__rpc_func_table.Add(3572622651u, new RpcReceiveHandler(__rpc_handler_3572622651));
NetworkManager.__rpc_func_table.Add(3420106347u, new RpcReceiveHandler(__rpc_handler_3420106347));
NetworkManager.__rpc_func_table.Add(1688014456u, new RpcReceiveHandler(__rpc_handler_1688014456));
}
private static void __rpc_handler_3572622651(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;
((ContainmentJarBehavior)(object)target).OpenJarServerRpc();
target.__rpc_exec_stage = (__RpcExecStage)0;
}
}
private static void __rpc_handler_3420106347(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)
{
Contents contents = default(Contents);
((FastBufferReader)(ref reader)).ReadValueSafe<Contents>(ref contents, default(ForEnums));
target.__rpc_exec_stage = (__RpcExecStage)2;
((ContainmentJarBehavior)(object)target).ChangeJarContentsClientRpc(contents);
target.__rpc_exec_stage = (__RpcExecStage)0;
}
}
private static void __rpc_handler_1688014456(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;
((ContainmentJarBehavior)(object)target).NotifyPlayerClientRpc();
target.__rpc_exec_stage = (__RpcExecStage)0;
}
}
[MethodImpl(MethodImplOptions.NoInlining)]
protected internal override string __getTypeName()
{
return "ContainmentJarBehavior";
}
}
[HarmonyPatch(typeof(DepositItemsDesk))]
internal class DepositItemsDeskPatch
{
private static ManualLogSource logger = Plugin.LoggerInstance;
[HarmonyPostfix]
[HarmonyPatch("delayedAcceptanceOfItems")]
public static void delayedAcceptanceOfItemsPostFix(GrabbableObject[] objectsOnDesk)
{
if (!Plugin.IsServerOrHost)
{
return;
}
foreach (GrabbableObject val in objectsOnDesk)
{
if ((Object)(object)((Component)val).GetComponent<ContainmentJarBehavior>() != (Object)null)
{
ContainmentJarBehavior component = ((Component)val).GetComponent<ContainmentJarBehavior>();
if (component.JarContents == ContainmentJarBehavior.Contents.SCP999)
{
component.NotifyPlayerClientRpc();
}
}
}
}
}
[BepInPlugin("ProjectSCP.SCP999", "SCP999", "2.2.3")]
[BepInDependency(/*Could not decode attribute arguments.*/)]
public class Plugin : BaseUnityPlugin
{
public static Plugin PluginInstance;
public static ManualLogSource LoggerInstance;
private readonly Harmony harmony = new Harmony("ProjectSCP.SCP999");
public static AssetBundle? ModAssets;
public static ConfigEntry<string> config999LevelRarities;
public static ConfigEntry<string> config999CustomLevelRarities;
public static ConfigEntry<int> config999SCPDungeonRarity;
public static ConfigEntry<bool> configEnableDebug;
public static ConfigEntry<float> config999Size;
public static ConfigEntry<int> configPlayerHealAmount;
public static ConfigEntry<int> configEnemyHealAmount;
public static ConfigEntry<float> configPlayerDetectionRange;
public static ConfigEntry<float> configEnemyDetectionRange;
public static ConfigEntry<float> configFollowRange;
public static ConfigEntry<float> configHuggingRange;
public static ConfigEntry<int> configMaxCandy;
public static ConfigEntry<float> configInsanityDecreaseRate;
public static ConfigEntry<bool> configEnableJar;
public static ConfigEntry<int> configJarPrice;
public static ConfigEntry<int> configJar999Value;
public static ConfigEntry<int> configJarSlimeValue;
public static ConfigEntry<bool> configSlimeTaming;
public static List<string> Sweets = new List<string>
{
"Blue Candy", "Green Candy", "Pink Candy", "Purple Candy", "Rainbow Candy", "Red Candy", "Yellow Candy", "Black Candy", "Candy", "Cake",
"SCP-559"
};
public static PlayerControllerB localPlayer => StartOfRound.Instance.localPlayerController;
public static bool IsServerOrHost => NetworkManager.Singleton.IsServer || NetworkManager.Singleton.IsHost;
public static PlayerControllerB PlayerFromId(ulong id)
{
return StartOfRound.Instance.allPlayerScripts.Where((PlayerControllerB x) => x.actualClientId == id).FirstOrDefault();
}
private void Awake()
{
if ((Object)(object)PluginInstance == (Object)null)
{
PluginInstance = this;
}
LoggerInstance = ((BaseUnityPlugin)PluginInstance).Logger;
harmony.PatchAll();
InitializeNetworkBehaviours();
config999LevelRarities = ((BaseUnityPlugin)this).Config.Bind<string>("SCP-999 Rarities", "Level Rarities", "ExperimentationLevel:100, AssuranceLevel:75, VowLevel:75, OffenseLevel:50, AdamanceLevel:65, MarchLevel:50, RendLevel:45, DineLevel:45, TitanLevel:75, ArtificeLevel:70, EmbrionLevel:100, Modded:50", "Rarities for each level. See default for formatting.");
config999CustomLevelRarities = ((BaseUnityPlugin)this).Config.Bind<string>("SCP-999 Rarities", "Custom Level Rarities", "Secret LabsLevel:150", "Rarities for modded levels. Same formatting as level rarities.");
config999SCPDungeonRarity = ((BaseUnityPlugin)this).Config.Bind<int>("SCP-999 Rarities", "SCP Dungeon Rarity", 150, "The rarity of SCP-999 in the SCP Dungeon. Set to -1 to use level rarities.");
configEnableDebug = ((BaseUnityPlugin)this).Config.Bind<bool>("General", "Enable Debug", false, "Enables logging debugging logs for testing.");
config999Size = ((BaseUnityPlugin)this).Config.Bind<float>("General", "Size", 1f, "How big SCP-999 is");
configPlayerHealAmount = ((BaseUnityPlugin)this).Config.Bind<int>("General", "Player Heal Amount", 10, "How much SCP-999 heals the player per second");
configEnemyHealAmount = ((BaseUnityPlugin)this).Config.Bind<int>("General", "Enemy Heal Amount", 1, "How much SCP-999 heals the enemy per second");
configPlayerDetectionRange = ((BaseUnityPlugin)this).Config.Bind<float>("General", "Player Detection Range", 50f, "How far SCP-999 can detect you");
configEnemyDetectionRange = ((BaseUnityPlugin)this).Config.Bind<float>("General", "Enemy Detection Range", 15f, "How far SCP-999 can detect enemies");
configFollowRange = ((BaseUnityPlugin)this).Config.Bind<float>("General", "Follow Range", 5f, "How far SCP-999 can follow you or other enemies");
configHuggingRange = ((BaseUnityPlugin)this).Config.Bind<float>("General", "Hugging Range", 2f, "How far SCP-999 will be to you when rushing over to hug/heal you");
configMaxCandy = ((BaseUnityPlugin)this).Config.Bind<int>("General", "Max Candy", 2, "Max amount of candy SCP-999 can eat before something bad happens");
configInsanityDecreaseRate = ((BaseUnityPlugin)this).Config.Bind<float>("General", "Insanity Decrease Rate", 5f, "How much insanity the player loses per second when SCP-999 is hugging them");
configEnableJar = ((BaseUnityPlugin)this).Config.Bind<bool>("Containment Jar", "Enable", true, "Enable Containment Jar");
configJarPrice = ((BaseUnityPlugin)this).Config.Bind<int>("Containment Jar", "Price", 30, "Price of Containment Jar");
configJar999Value = ((BaseUnityPlugin)this).Config.Bind<int>("Containment Jar", "SCP-999 Value", 1, "Value of Containment Jar with SCP-999 inside it");
configJarSlimeValue = ((BaseUnityPlugin)this).Config.Bind<int>("Containment Jar", "Slime Value", 50, "Value of Containment Jar");
configSlimeTaming = ((BaseUnityPlugin)this).Config.Bind<bool>("Containment Jar", "Slime Taming", true, "When true, releasing SCP-999 from the containment jar will make it tamed to the person who released it. It will only follow that person unless it becomes hyper.");
string directoryName = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location);
ModAssets = AssetBundle.LoadFromFile(Path.Combine(Path.GetDirectoryName(((BaseUnityPlugin)this).Info.Location), "scp999_assets"));
if ((Object)(object)ModAssets == (Object)null)
{
((BaseUnityPlugin)this).Logger.LogError((object)"Failed to load custom assets.");
return;
}
LoggerInstance.LogDebug((object)("Got AssetBundle at: " + Path.Combine(directoryName, "scp999_assets")));
if (configEnableJar.Value)
{
Item val = ModAssets.LoadAsset<Item>("Assets/ModAssets/ContainmentJar/ContainmentJarItem.asset");
if ((Object)(object)val == (Object)null)
{
LoggerInstance.LogError((object)"Error: Couldnt get Containment Jar from assets");
return;
}
LoggerInstance.LogDebug((object)"Got Containment Jar prefab");
NetworkPrefabs.RegisterNetworkPrefab(val.spawnPrefab);
Utilities.FixMixerGroups(val.spawnPrefab);
Items.RegisterShopItem(val, configJarPrice.Value);
}
EnemyType val2 = ModAssets.LoadAsset<EnemyType>("Assets/ModAssets/SCP999/SCP999Enemy.asset");
if ((Object)(object)val2 == (Object)null)
{
LoggerInstance.LogError((object)"Error: Couldnt get SCP-999 from assets");
return;
}
LoggerInstance.LogDebug((object)"Got SCP-999 prefab");
TerminalNode val3 = ModAssets.LoadAsset<TerminalNode>("Assets/ModAssets/SCP999/Bestiary/SCP999TN.asset");
TerminalKeyword val4 = ModAssets.LoadAsset<TerminalKeyword>("Assets/ModAssets/SCP999/Bestiary/SCP999TK.asset");
Dictionary<LevelTypes, int> levelRarities = GetLevelRarities(config999LevelRarities.Value);
Dictionary<string, int> customLevelRarities = GetCustomLevelRarities(config999CustomLevelRarities.Value);
LoggerInstance.LogDebug((object)"Registering enemy network prefab...");
NetworkPrefabs.RegisterNetworkPrefab(val2.enemyPrefab);
LoggerInstance.LogDebug((object)"Registering enemy...");
Enemies.RegisterEnemy(val2, levelRarities, customLevelRarities, val3, val4);
LoggerInstance.LogDebug((object)"Registered enemy");
((BaseUnityPlugin)this).Logger.LogInfo((object)"ProjectSCP.SCP999 v2.2.3 has loaded!");
}
public Dictionary<LevelTypes, int>? GetLevelRarities(string levelsString)
{
//IL_0091: Unknown result type (might be due to invalid IL or missing references)
try
{
Dictionary<LevelTypes, int> dictionary = new Dictionary<LevelTypes, int>();
if (levelsString != null && levelsString != "")
{
string[] array = levelsString.Split(',');
string[] array2 = array;
foreach (string text in array2)
{
string[] array3 = text.Split(':');
if (array3.Length == 2)
{
string text2 = array3[0].Trim();
string text3 = array3[1].Trim();
if (Enum.TryParse<LevelTypes>(text2, out LevelTypes result) && int.TryParse(text3, out var result2))
{
dictionary.Add(result, result2);
}
else
{
LoggerInstance.LogError((object)("Error: Invalid level rarity: " + text2 + ":" + text3));
}
}
}
}
return dictionary;
}
catch (Exception arg)
{
((BaseUnityPlugin)this).Logger.LogError((object)$"Error: {arg}");
return null;
}
}
public Dictionary<string, int>? GetCustomLevelRarities(string levelsString)
{
try
{
Dictionary<string, int> dictionary = new Dictionary<string, int>();
if (levelsString != null)
{
string[] array = levelsString.Split(',');
string[] array2 = array;
foreach (string text in array2)
{
string[] array3 = text.Split(':');
if (array3.Length == 2)
{
string text2 = array3[0].Trim();
string text3 = array3[1].Trim();
if (int.TryParse(text3, out var result))
{
dictionary.Add(text2, result);
}
else
{
LoggerInstance.LogError((object)("Error: Invalid level rarity: " + text2 + ":" + text3));
}
}
}
}
return dictionary;
}
catch (Exception arg)
{
((BaseUnityPlugin)this).Logger.LogError((object)$"Error: {arg}");
return null;
}
}
public static void logIfDebug(string message)
{
if (configEnableDebug.Value)
{
LoggerInstance.LogDebug((object)message);
}
}
public static List<SpawnableEnemyWithRarity> GetEnemies()
{
LoggerInstance.LogDebug((object)"Getting enemies");
List<SpawnableEnemyWithRarity> list = new List<SpawnableEnemyWithRarity>();
list = (from x in GameObject.Find("Terminal").GetComponentInChildren<Terminal>().moonsCatalogueList.SelectMany((SelectableLevel x) => x.Enemies.Concat(x.DaytimeEnemies).Concat(x.OutsideEnemies))
where x != null && (Object)(object)x.enemyType != (Object)null && ((Object)x.enemyType).name != null
select x).GroupBy((SpawnableEnemyWithRarity x) => ((Object)x.enemyType).name, (string k, IEnumerable<SpawnableEnemyWithRarity> v) => v.First()).ToList();
LoggerInstance.LogDebug((object)$"Enemy types: {list.Count}");
return list;
}
private static void InitializeNetworkBehaviours()
{
Type[] types = Assembly.GetExecutingAssembly().GetTypes();
Type[] array = types;
foreach (Type type in array)
{
MethodInfo[] methods = type.GetMethods(BindingFlags.Instance | BindingFlags.Static | BindingFlags.NonPublic);
MethodInfo[] array2 = methods;
foreach (MethodInfo methodInfo in array2)
{
object[] customAttributes = methodInfo.GetCustomAttributes(typeof(RuntimeInitializeOnLoadMethodAttribute), inherit: false);
if (customAttributes.Length != 0)
{
methodInfo.Invoke(null, null);
}
}
}
LoggerInstance.LogDebug((object)"Finished initializing network behaviours");
}
}
public class SCP999AI : EnemyAI
{
public enum State
{
Roaming,
Following,
Blocking,
Healing,
Hyper
}
private static ManualLogSource logger = Plugin.LoggerInstance;
public Transform turnCompass = null;
public ScanNodeProperties ScanNode = null;
public List<AudioClip> hitSFXList = null;
public List<AudioClip> hugSFXList = null;
public List<AudioClip> hurtSFXList = null;
public List<AudioClip> roamSFXList = null;
public InteractTrigger jarTrigger = null;
public ulong lizzieSteamId;
public ulong snowySteamId;
private static readonly int hugAnim = Animator.StringToHash("hugging");
private static readonly int stretchAnim = Animator.StringToHash("stretching");
private static readonly int hyperAnim = Animator.StringToHash("hyperDancing");
private static readonly int walkAnim = Animator.StringToHash("walking");
private static readonly int danceAnim = Animator.StringToHash("dancing");
private EnemyAI? targetEnemy;
private Turret? blockedTurret;
private float timeSinceHealing;
private float healingBuffTime;
private float hyperTime;
private float timeSinceBlockSFX;
private float timeSinceHugSFX;
private float hugTime;
private int playerHealAmount;
private int enemyHealAmount;
private float playerDetectionRange;
private float enemyDetectionRange;
private float rangeMultiplier = 1f;
private float followingRange;
private float huggingRange;
private bool walking;
private bool hugging;
private int maxCandy;
private int candyEaten;
private bool gettingInJar;
private bool followPlayer = true;
private bool followEnemy = true;
private bool tamed = false;
private PlayerControllerB tamedByPlayer = null;
private float insanityDecreaseRate;
private bool dancing;
public void SwitchToBehaviourStateCustom(State state)
{
//IL_0032: 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)
switch (state)
{
case State.Roaming:
SetTargetNull();
((EnemyAI)this).StartSearch(((Component)this).transform.position, (AISearchRoutine)null);
break;
case State.Following:
((EnemyAI)this).StopSearch(base.currentSearch, true);
break;
case State.Blocking:
((EnemyAI)this).StopSearch(base.currentSearch, true);
DoAnimationClientRpc(stretchAnim, value: true);
break;
case State.Healing:
((EnemyAI)this).StopSearch(base.currentSearch, true);
break;
case State.Hyper:
tamed = false;
tamedByPlayer = null;
SetTargetNull();
((EnemyAI)this).StartSearch(((Component)this).transform.position, (AISearchRoutine)null);
DoAnimationClientRpc(walkAnim, value: false);
DoAnimationClientRpc(hyperAnim, value: true);
break;
}
((EnemyAI)this).SwitchToBehaviourClientRpc((int)state);
}
public override void Start()
{
//IL_00d4: 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)
((EnemyAI)this).Start();
Plugin.logIfDebug("SCP-999 Spawned");
playerHealAmount = Plugin.configPlayerHealAmount.Value;
enemyHealAmount = Plugin.configEnemyHealAmount.Value;
playerDetectionRange = Plugin.configPlayerDetectionRange.Value;
enemyDetectionRange = Plugin.configEnemyDetectionRange.Value;
followingRange = Plugin.configFollowRange.Value;
huggingRange = Plugin.configHuggingRange.Value;
maxCandy = Plugin.configMaxCandy.Value;
insanityDecreaseRate = Plugin.configInsanityDecreaseRate.Value;
base.currentBehaviourStateIndex = 0;
if (!RoundManager.Instance.SpawnedEnemies.Contains((EnemyAI)(object)this))
{
RoundManager.Instance.SpawnedEnemies.Add((EnemyAI)(object)this);
}
if (Plugin.IsServerOrHost)
{
if (((Component)this).transform.localScale.y != Plugin.config999Size.Value)
{
ChangeSizeClientRpc(Plugin.config999Size.Value);
}
SetOutsideOrInside();
((EnemyAI)this).StartSearch(((Component)this).transform.position, (AISearchRoutine)null);
}
}
public override void Update()
{
//IL_0113: 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_013a: Unknown result type (might be due to invalid IL or missing references)
//IL_0149: Unknown result type (might be due to invalid IL or missing references)
//IL_014e: 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_01fc: Unknown result type (might be due to invalid IL or missing references)
//IL_0201: Unknown result type (might be due to invalid IL or missing references)
((EnemyAI)this).Update();
timeSinceHealing += Time.deltaTime;
timeSinceBlockSFX += Time.deltaTime;
timeSinceHugSFX += Time.deltaTime;
if (healingBuffTime > 0f)
{
healingBuffTime -= Time.deltaTime;
}
if (hyperTime > 0f)
{
hyperTime -= Time.deltaTime;
}
bool flag = hugTime > 0f;
if (flag)
{
hugTime -= Time.deltaTime;
}
if (hugging != flag)
{
base.creatureAnimator.SetBool(hugAnim, flag);
hugging = flag;
}
if ((Object)(object)base.targetPlayer != (Object)null && base.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)), 10f * Time.deltaTime);
}
if ((Object)(object)Plugin.localPlayer.currentlyHeldObjectServer != (Object)null && ((Object)Plugin.localPlayer.currentlyHeldObjectServer.itemProperties).name == "ContainmentJarItem" && ((Component)Plugin.localPlayer.currentlyHeldObjectServer).GetComponent<ContainmentJarBehavior>().JarContents == ContainmentJarBehavior.Contents.Empty)
{
jarTrigger.interactable = true;
}
else
{
jarTrigger.interactable = false;
}
if (base.currentBehaviourStateIndex == 1 || base.currentBehaviourStateIndex == 0)
{
Vector3 velocity = base.agent.velocity;
bool flag2 = ((Vector3)(ref velocity)).sqrMagnitude >= 0.01f;
if (walking != flag2)
{
base.creatureAnimator.SetBool(walkAnim, flag2);
walking = flag2;
}
}
}
public override void DoAIInterval()
{
//IL_0013: Unknown result type (might be due to invalid IL or missing references)
//IL_0217: Unknown result type (might be due to invalid IL or missing references)
//IL_021e: Unknown result type (might be due to invalid IL or missing references)
//IL_0224: Unknown result type (might be due to invalid IL or missing references)
//IL_022c: Unknown result type (might be due to invalid IL or missing references)
//IL_0231: Unknown result type (might be due to invalid IL or missing references)
//IL_0239: Unknown result type (might be due to invalid IL or missing references)
if (base.moveTowardsDestination)
{
base.agent.SetDestination(base.destination);
}
if (base.isEnemyDead || StartOfRound.Instance.allPlayersDead || gettingInJar || BabyIsCryingNearby())
{
return;
}
if (tamed && (Object)(object)tamedByPlayer != (Object)null)
{
base.targetPlayer = tamedByPlayer;
}
switch (base.currentBehaviourStateIndex)
{
case 0:
base.agent.speed = 5f;
base.agent.stoppingDistance = 0f;
base.agent.acceleration = 8f;
if ((((EnemyAI)this).TargetClosestPlayer(1.5f, true, 70f) && followPlayer) || (TargetClosestEnemy(1.5f, requireLineOfSight: true) && followEnemy))
{
Plugin.logIfDebug("Start Targeting");
SwitchToBehaviourStateCustom(State.Following);
}
break;
case 1:
{
if (healingBuffTime > 0f)
{
base.agent.speed = 10f;
}
else
{
base.agent.speed = 5f;
}
base.agent.stoppingDistance = followingRange;
base.agent.acceleration = 10f;
if (!tamed && !TargetClosestEntity())
{
Plugin.logIfDebug("Stop Targeting");
SwitchToBehaviourStateCustom(State.Roaming);
break;
}
if (tamed && (Object)(object)tamedByPlayer != (Object)null && base.isOutside == tamedByPlayer.isInsideFactory)
{
Vector3 navMeshPosition = RoundManager.Instance.GetNavMeshPosition(((Component)tamedByPlayer).transform.position, default(NavMeshHit), 5f, -1);
base.agent.Warp(navMeshPosition);
SetEnemyOutsideClientRpc(!tamedByPlayer.isInsideFactory);
}
if (MoveToSweetsIfDroppedByPlayer())
{
EatSweetsIfClose();
break;
}
bool flag = IsNearbyPlayerEmoting(followingRange);
if (dancing != flag)
{
DoAnimationClientRpc(danceAnim, flag);
dancing = flag;
}
FollowTarget();
break;
}
case 2:
base.agent.speed = 20f;
base.agent.stoppingDistance = 0f;
base.agent.acceleration = 15f;
if (!MoveInFrontOfTurret())
{
Plugin.logIfDebug("Stop Blocking");
SwitchToBehaviourStateCustom(State.Following);
blockedTurret = null;
DoAnimationClientRpc(stretchAnim, value: false);
}
break;
case 3:
base.agent.speed = 10f;
base.agent.stoppingDistance = huggingRange;
base.agent.acceleration = 50f;
MoveToHealTarget();
break;
case 4:
base.agent.speed = 20f;
base.agent.stoppingDistance = 0f;
base.agent.acceleration = 25f;
if (hyperTime <= 0f)
{
candyEaten = 0;
SwitchToBehaviourStateCustom(State.Roaming);
DoAnimationClientRpc(hyperAnim, value: false);
}
break;
default:
logger.LogWarning((object)("Invalid state: " + base.currentBehaviourStateIndex));
break;
}
}
private bool BabyIsCryingNearby()
{
//IL_0074: Unknown result type (might be due to invalid IL or missing references)
CaveDwellerAI val = (from x in RoundManager.Instance.SpawnedEnemies.OfType<CaveDwellerAI>()
where x.babyCrying && Vector3.Distance(((Component)this).transform.position, ((Component)x).transform.position) < x.babyCryingAudio.maxDistance
select x).FirstOrDefault();
if ((Object)(object)val != (Object)null)
{
base.agent.speed = 10f;
base.agent.stoppingDistance = 0f;
base.agent.acceleration = 50f;
targetEnemy = (EnemyAI?)(object)val;
return ((EnemyAI)this).SetDestinationToPosition(((Component)val).transform.position, true);
}
return false;
}
public void SetTamed(PlayerControllerB playerTamedTo)
{
tamed = true;
tamedByPlayer = playerTamedTo;
base.targetPlayer = playerTamedTo;
if (playerTamedTo.playerSteamId == snowySteamId)
{
SetScanNodeClientRpc("Following my creator");
}
else if (playerTamedTo.playerSteamId == lizzieSteamId)
{
SetScanNodeClientRpc("Following my best friend lizzie <3");
}
else
{
SetScanNodeClientRpc("Following " + playerTamedTo.playerUsername);
}
SwitchToBehaviourStateCustom(State.Following);
}
public void SetOutsideOrInside()
{
//IL_0017: Unknown result type (might be due to invalid IL or missing references)
//IL_0022: Unknown result type (might be due to invalid IL or missing references)
//IL_0032: Unknown result type (might be due to invalid IL or missing references)
//IL_003d: Unknown result type (might be due to invalid IL or missing references)
GameObject closestAINode = GetClosestAINode(inside: false);
GameObject closestAINode2 = GetClosestAINode(inside: true);
if (Vector3.Distance(((Component)this).transform.position, closestAINode.transform.position) < Vector3.Distance(((Component)this).transform.position, closestAINode2.transform.position))
{
SetEnemyOutsideClientRpc(value: true);
}
}
public GameObject GetClosestAINode(bool inside)
{
//IL_0047: Unknown result type (might be due to invalid IL or missing references)
//IL_0053: Unknown result type (might be due to invalid IL or missing references)
float num = float.PositiveInfinity;
GameObject result = null;
List<GameObject> list = (inside ? RoundManager.Instance.insideAINodes.ToList() : RoundManager.Instance.outsideAINodes.ToList());
foreach (GameObject item in list)
{
float num2 = Vector3.Distance(((Component)this).transform.position, item.transform.position);
if (num2 < num)
{
num = num2;
result = item;
}
}
return result;
}
public void GetInJar()
{
Plugin.logIfDebug("GetInJar");
GetInJarServerRpc(Plugin.localPlayer.actualClientId);
}
public bool TargetClosestEntity()
{
//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_0064: Unknown result type (might be due to invalid IL or missing references)
//IL_00bc: Unknown result type (might be due to invalid IL or missing references)
//IL_00cc: Unknown result type (might be due to invalid IL or missing references)
//IL_00f0: Unknown result type (might be due to invalid IL or missing references)
if ((Object)(object)base.targetPlayer != (Object)null && followPlayer && ((EnemyAI)this).TargetClosestPlayer(1.5f, false, 70f) && (Vector3.Distance(((Component)this).transform.position, ((Component)base.targetPlayer).transform.position) < playerDetectionRange * 2f || ((EnemyAI)this).CheckLineOfSightForPosition(((Component)base.targetPlayer).transform.position, 45f, 60, -1f, (Transform)null)))
{
return true;
}
if ((Object)(object)targetEnemy != (Object)null && followEnemy && TargetClosestEnemy(5f) && (Vector3.Distance(((Component)this).transform.position, ((Component)targetEnemy).transform.position) < enemyDetectionRange * 2f || ((EnemyAI)this).CheckLineOfSightForPosition(((Component)targetEnemy).transform.position, 45f, 60, -1f, (Transform)null)))
{
return true;
}
return false;
}
public bool TargetClosestEnemy(float bufferDistance = 1.5f, bool requireLineOfSight = false, float viewWidth = 70f)
{
//IL_0071: Unknown result type (might be due to invalid IL or missing references)
//IL_008a: Unknown result type (might be due to invalid IL or missing references)
//IL_013e: Unknown result type (might be due to invalid IL or missing references)
//IL_0149: Unknown result type (might be due to invalid IL or missing references)
//IL_00b1: Unknown result type (might be due to invalid IL or missing references)
//IL_00bc: Unknown result type (might be due to invalid IL or missing references)
base.mostOptimalDistance = 2000f;
EnemyAI val = targetEnemy;
targetEnemy = null;
foreach (EnemyAI spawnedEnemy in RoundManager.Instance.SpawnedEnemies)
{
if (!spawnedEnemy.isEnemyDead && !(((Object)spawnedEnemy.enemyType).name == "SCP999Enemy") && !((EnemyAI)this).PathIsIntersectedByLineOfSight(((Component)spawnedEnemy).transform.position, false, false, false) && (!requireLineOfSight || ((EnemyAI)this).CheckLineOfSightForPosition(((Component)spawnedEnemy).transform.position, viewWidth, 40, -1f, (Transform)null)))
{
base.tempDist = Vector3.Distance(((Component)this).transform.position, ((Component)spawnedEnemy).transform.position);
if (base.tempDist < base.mostOptimalDistance)
{
base.mostOptimalDistance = base.tempDist;
targetEnemy = spawnedEnemy;
}
}
}
if ((Object)(object)targetEnemy != (Object)null && bufferDistance > 0f && (Object)(object)val != (Object)null && Mathf.Abs(base.mostOptimalDistance - Vector3.Distance(((Component)this).transform.position, ((Component)val).transform.position)) < bufferDistance)
{
targetEnemy = val;
}
return (Object)(object)targetEnemy != (Object)null;
}
private void FollowTarget()
{
//IL_0017: Unknown result type (might be due to invalid IL or missing references)
//IL_001c: 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_006e: 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_0066: Unknown result type (might be due to invalid IL or missing references)
Vector3 position;
if (tamed)
{
position = ((Component)tamedByPlayer).transform.position;
}
else if ((Object)(object)base.targetPlayer != (Object)null)
{
position = ((Component)base.targetPlayer).transform.position;
}
else
{
if (!((Object)(object)targetEnemy != (Object)null))
{
return;
}
position = ((Component)targetEnemy).transform.position;
}
((EnemyAI)this).SetDestinationToPosition(position, false);
}
private void SetTarget(PlayerControllerB player)
{
base.targetPlayer = player;
targetEnemy = null;
}
private void SetTarget(EnemyAI enemy)
{
base.targetPlayer = null;
targetEnemy = enemy;
}
private void SetTargetNull()
{
base.targetPlayer = null;
targetEnemy = null;
}
private void MoveToHealTarget()
{
//IL_004d: 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)
if ((Object)(object)base.targetPlayer != (Object)null)
{
if (base.targetPlayer.health >= 100 || base.targetPlayer.isPlayerDead)
{
SwitchToBehaviourStateCustom(State.Following);
}
else
{
((EnemyAI)this).SetDestinationToPosition(((Component)base.targetPlayer).transform.position, false);
}
}
else if ((Object)(object)targetEnemy != (Object)null)
{
int enemyHP = targetEnemy.enemyType.enemyPrefab.GetComponent<EnemyAI>().enemyHP;
if (targetEnemy.enemyHP >= enemyHP || targetEnemy.isEnemyDead)
{
SwitchToBehaviourStateCustom(State.Following);
}
else
{
((EnemyAI)this).SetDestinationToPosition(((Component)targetEnemy).transform.position, false);
}
}
}
private bool MoveInFrontOfTurret()
{
//IL_001b: Unknown result type (might be due to invalid IL or missing references)
//IL_0021: Invalid comparison between Unknown and I4
//IL_0029: Unknown result type (might be due to invalid IL or missing references)
//IL_002f: Invalid comparison between Unknown and I4
//IL_0047: 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_0061: Unknown result type (might be due to invalid IL or missing references)
//IL_0066: 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_0076: 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)
if ((Object)(object)blockedTurret != (Object)null && ((int)blockedTurret.turretMode == 2 || (int)blockedTurret.turretMode == 1))
{
Vector3 val = Vector3.Lerp(((Component)base.targetPlayer).transform.position, ((Component)blockedTurret).transform.position, 0.5f);
((EnemyAI)this).SetDestinationToPosition(val, false);
if (Vector3.Distance(((Component)this).transform.position, val) < 1f && timeSinceBlockSFX > 0.5f)
{
Plugin.logIfDebug("Playing hitSFX");
int index = Random.Range(0, hitSFXList.Count - 1);
base.creatureSFX.PlayOneShot(hitSFXList[index], 1f);
timeSinceBlockSFX = 0f;
}
return true;
}
return false;
}
public bool MoveToSweetsIfDroppedByPlayer()
{
//IL_005e: Unknown result type (might be due to invalid IL or missing references)
//IL_0069: Unknown result type (might be due to invalid IL or missing references)
//IL_00ea: Unknown result type (might be due to invalid IL or missing references)
try
{
foreach (GameObject item in HoarderBugAI.grabbableObjectsInMap.ToList())
{
if ((Object)(object)item == (Object)null)
{
HoarderBugAI.grabbableObjectsInMap.Remove(item);
continue;
}
GrabbableObject componentInChildren = item.GetComponentInChildren<GrabbableObject>();
if ((Object)(object)componentInChildren == (Object)null || !(Vector3.Distance(((Component)this).transform.position, ((Component)componentInChildren).transform.position) <= followingRange) || !Plugin.Sweets.Contains(componentInChildren.itemProperties.itemName) || !componentInChildren.hasBeenHeld || componentInChildren.heldByPlayerOnServer)
{
continue;
}
Plugin.logIfDebug("Moving to item: " + componentInChildren.itemProperties.itemName);
base.agent.stoppingDistance = 0f;
((EnemyAI)this).SetDestinationToPosition(((Component)componentInChildren).transform.position, false);
return true;
}
return false;
}
catch
{
return false;
}
}
public void EatSweetsIfClose()
{
//IL_005e: Unknown result type (might be due to invalid IL or missing references)
//IL_0069: Unknown result type (might be due to invalid IL or missing references)
//IL_00e1: Unknown result type (might be due to invalid IL or missing references)
try
{
foreach (GameObject item in HoarderBugAI.grabbableObjectsInMap.ToList())
{
if ((Object)(object)item == (Object)null)
{
HoarderBugAI.grabbableObjectsInMap.Remove(item);
continue;
}
GrabbableObject componentInChildren = item.GetComponentInChildren<GrabbableObject>();
if (!((Object)(object)componentInChildren == (Object)null) && Vector3.Distance(((Component)this).transform.position, ((Component)componentInChildren).transform.position) < 1f && Plugin.Sweets.Contains(componentInChildren.itemProperties.itemName))
{
Plugin.logIfDebug("Eating item: " + componentInChildren.itemProperties.itemName);
if (componentInChildren.itemProperties.itemName == "SCP-559")
{
ChangeSizeClientRpc(((Component)this).transform.localScale.y / 2f);
}
if (componentInChildren.itemProperties.itemName == "Black Candy")
{
MakeHyper(60f);
}
if (componentInChildren.itemProperties.itemName == "Cake")
{
healingBuffTime += 10f;
}
((NetworkBehaviour)componentInChildren).NetworkObject.Despawn(true);
candyEaten++;
Plugin.logIfDebug("Candy eaten: " + candyEaten);
healingBuffTime += 20f;
if (candyEaten >= maxCandy)
{
MakeHyper(30f);
}
}
}
}
catch
{
}
}
public void MakeHyper(float duration)
{
hyperTime += duration;
SwitchToBehaviourStateCustom(State.Hyper);
}
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)
((EnemyAI)this).DetectNoise(noisePosition, noiseLoudness, timesPlayedInOneSpot, noiseID);
}
public override void ReachedNodeInSearch()
{
((EnemyAI)this).ReachedNodeInSearch();
int index = Random.Range(0, roamSFXList.Count - 1);
base.creatureVoice.PlayOneShot(roamSFXList[index], 1f);
}
public override void OnCollideWithPlayer(Collider other)
{
((EnemyAI)this).OnCollideWithPlayer(other);
PlayerControllerB val = MeetsStandardPlayerCollisionConditions(other);
if ((Object)(object)val != (Object)null)
{
HealPlayer(val);
Hug();
}
}
public PlayerControllerB MeetsStandardPlayerCollisionConditions(Collider other, bool inKillAnimation = false, bool overrideIsInsideFactoryCheck = false)
{
if (base.isEnemyDead)
{
return null;
}
if (!base.ventAnimationFinished)
{
return null;
}
if (inKillAnimation)
{
return null;
}
if (base.stunNormalizedTimer >= 0f)
{
return null;
}
PlayerControllerB component = ((Component)other).gameObject.GetComponent<PlayerControllerB>();
if ((Object)(object)component == (Object)null)
{
return null;
}
if (!((EnemyAI)this).PlayerIsTargetable(component, false, overrideIsInsideFactoryCheck))
{
Debug.Log((object)"Player is not targetable");
return null;
}
return component;
}
public override void OnCollideWithEnemy(Collider other, EnemyAI? collidedEnemy = null)
{
((EnemyAI)this).OnCollideWithEnemy(other, collidedEnemy);
if ((Object)(object)collidedEnemy != (Object)null && ((Object)collidedEnemy.enemyType).name != "SCP999Enemy")
{
HealEnemy(collidedEnemy);
Hug();
}
}
public override void HitEnemy(int force = 0, PlayerControllerB playerWhoHit = null, bool playHitSFX = true, int hitID = -1)
{
int index = Random.Range(0, hitSFXList.Count - 1);
base.creatureVoice.PlayOneShot(hurtSFXList[index], 1f);
}
public bool IsNearbyPlayerEmoting(float distance)
{
//IL_001c: Unknown result type (might be due to invalid IL or missing references)
//IL_0027: Unknown result type (might be due to invalid IL or missing references)
PlayerControllerB[] allPlayerScripts = StartOfRound.Instance.allPlayerScripts;
foreach (PlayerControllerB val in allPlayerScripts)
{
if (Vector3.Distance(((Component)this).transform.position, ((Component)val).transform.position) < distance && val.performingEmote)
{
return true;
}
}
return false;
}
public void Hug()
{
if (base.currentBehaviourStateIndex == 1 || base.currentBehaviourStateIndex == 3)
{
hugTime = 1f;
if (timeSinceHugSFX > 5f)
{
int index = Random.Range(0, hugSFXList.Count - 1);
base.creatureVoice.PlayOneShot(hugSFXList[index], 1f);
timeSinceHugSFX = 0f;
}
}
}
public void HealPlayer(PlayerControllerB player)
{
if (!((Object)(object)player != (Object)null) || !(timeSinceHealing > 1f))
{
return;
}
timeSinceHealing = 0f;
if (player.health < 100)
{
int num = ((!(healingBuffTime > 0f)) ? (player.health + playerHealAmount) : (player.health + playerHealAmount * 2));
if (num > 100)
{
num = 100;
}
player.health = num;
HUDManager.Instance.UpdateHealthUI(player.health, false);
}
player.insanityLevel -= insanityDecreaseRate;
player.JumpToFearLevel(0f, false);
}
public void HealEnemy(EnemyAI enemyToHeal)
{
//IL_0094: Unknown result type (might be due to invalid IL or missing references)
//IL_009b: Expected O, but got Unknown
if (timeSinceHealing > 1f)
{
timeSinceHealing = 0f;
int enemyHP = enemyToHeal.enemyType.enemyPrefab.GetComponent<EnemyAI>().enemyHP;
if (enemyToHeal.enemyHP < enemyHP)
{
if (healingBuffTime > 0f)
{
enemyToHeal.enemyHP += enemyHealAmount * 2;
}
else
{
enemyToHeal.enemyHP += enemyHealAmount;
}
}
}
if (!(enemyToHeal is CaveDwellerAI))
{
return;
}
CaveDwellerAI val = (CaveDwellerAI)enemyToHeal;
if (val.babyCrying)
{
val.rockBabyTimer += Time.deltaTime * 0.4f;
if (val.rockBabyTimer > 1f)
{
val.SetCryingLocalClient(false);
val.SetBabyCryingServerRpc(false);
}
}
}
public void EnemyTookDamage(EnemyAI enemy)
{
if (!(hyperTime > 0f) && !tamed)
{
targetEnemy = enemy;
SwitchToBehaviourStateCustom(State.Healing);
}
}
[ClientRpc]
public void SetScanNodeClientRpc(string subText)
{
//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(3126157941u, val, (RpcDelivery)0);
bool flag = subText != null;
((FastBufferWriter)(ref val2)).WriteValueSafe<bool>(ref flag, default(ForPrimitives));
if (flag)
{
((FastBufferWriter)(ref val2)).WriteValueSafe(subText, false);
}
((NetworkBehaviour)this).__endSendClientRpc(ref val2, 3126157941u, val, (RpcDelivery)0);
}
if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 2 && (networkManager.IsClient || networkManager.IsHost))
{
ScanNode.subText = subText;
}
}
[ServerRpc(RequireOwnership = false)]
public void SetTamedPlayerServerRpc(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)
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(3877894376u, val, (RpcDelivery)0);
BytePacker.WriteValueBitPacked(val2, clientId);
((NetworkBehaviour)this).__endSendServerRpc(ref val2, 3877894376u, val, (RpcDelivery)0);
}
if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost) && Plugin.IsServerOrHost)
{
SetTamed(Plugin.PlayerFromId(clientId));
}
}
}
[ServerRpc(RequireOwnership = false)]
private void DoAnimationServerRpc(int id, bool value)
{
//IL_0024: Unknown result type (might be due to invalid IL or missing references)
//IL_002e: Invalid comparison between Unknown and I4
//IL_00b4: Unknown result type (might be due to invalid IL or missing references)
//IL_00be: Invalid comparison between Unknown and I4
//IL_005f: Unknown result type (might be due to invalid IL or missing references)
//IL_0068: Unknown result type (might be due to invalid IL or missing references)
//IL_006d: Unknown result type (might be due to invalid IL or missing references)
//IL_0071: Unknown result type (might be due to invalid IL or missing references)
//IL_008a: Unknown result type (might be due to invalid IL or missing references)
//IL_0090: Unknown result type (might be due to invalid IL or missing references)
//IL_00a4: 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(1961172741u, val, (RpcDelivery)0);
BytePacker.WriteValueBitPacked(val2, id);
((FastBufferWriter)(ref val2)).WriteValueSafe<bool>(ref value, default(ForPrimitives));
((NetworkBehaviour)this).__endSendServerRpc(ref val2, 1961172741u, val, (RpcDelivery)0);
}
if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost) && Plugin.IsServerOrHost)
{
DoAnimationClientRpc(id, value);
}
}
}
[ClientRpc]
private void DoAnimationClientRpc(int id, bool value)
{
//IL_0024: Unknown result type (might be due to invalid IL or missing references)
//IL_002e: Invalid comparison between Unknown and I4
//IL_00b4: Unknown result type (might be due to invalid IL or missing references)
//IL_00be: Invalid comparison between Unknown and I4
//IL_005f: Unknown result type (might be due to invalid IL or missing references)
//IL_0068: Unknown result type (might be due to invalid IL or missing references)
//IL_006d: Unknown result type (might be due to invalid IL or missing references)
//IL_0071: Unknown result type (might be due to invalid IL or missing references)
//IL_008a: Unknown result type (might be due to invalid IL or missing references)
//IL_0090: Unknown result type (might be due to invalid IL or missing references)
//IL_00a4: 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(1169953250u, val, (RpcDelivery)0);
BytePacker.WriteValueBitPacked(val2, id);
((FastBufferWriter)(ref val2)).WriteValueSafe<bool>(ref value, default(ForPrimitives));
((NetworkBehaviour)this).__endSendClientRpc(ref val2, 1169953250u, val, (RpcDelivery)0);
}
if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 2 && (networkManager.IsClient || networkManager.IsHost))
{
base.creatureAnimator.SetBool(id, value);
}
}
}
[ServerRpc(RequireOwnership = false)]
private void GetInJarServerRpc(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)
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(4103771736u, val, (RpcDelivery)0);
BytePacker.WriteValueBitPacked(val2, clientId);
((NetworkBehaviour)this).__endSendServerRpc(ref val2, 4103771736u, val, (RpcDelivery)0);
}
if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost) && (NetworkManager.Singleton.IsServer || NetworkManager.Singleton.IsHost))
{
PlayerControllerB val3 = Plugin.PlayerFromId(clientId);
((Component)val3.currentlyHeldObjectServer).GetComponent<ContainmentJarBehavior>().ChangeJarContentsClientRpc(ContainmentJarBehavior.Contents.SCP999);
RoundManager.Instance.DespawnEnemyOnServer(((NetworkBehaviour)this).NetworkObject);
}
}
}
[ClientRpc]
private void SetEnemyOutsideClientRpc(bool value)
{
//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(3990597999u, val, (RpcDelivery)0);
((FastBufferWriter)(ref val2)).WriteValueSafe<bool>(ref value, default(ForPrimitives));
((NetworkBehaviour)this).__endSendClientRpc(ref val2, 3990597999u, val, (RpcDelivery)0);
}
if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 2 && (networkManager.IsClient || networkManager.IsHost))
{
((EnemyAI)this).SetEnemyOutside(value);
}
}
}
[ServerRpc(RequireOwnership = false)]
public void PlayerTookDamageServerRpc(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_0137: 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)
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(771765929u, val, (RpcDelivery)0);
BytePacker.WriteValueBitPacked(val2, clientId);
((NetworkBehaviour)this).__endSendServerRpc(ref val2, 771765929u, val, (RpcDelivery)0);
}
if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1 || (!networkManager.IsServer && !networkManager.IsHost) || !Plugin.IsServerOrHost)
{
return;
}
PlayerControllerB val3 = Plugin.PlayerFromId(clientId);
if ((Object)(object)val3 == (Object)null || (tamed && (Object)(object)val3 != (Object)(object)base.targetPlayer))
{
return;
}
float num = 2f - (float)val3.health / 100f;
float num2 = Plugin.configPlayerDetectionRange.Value * num;
if (Vector3.Distance(((Component)this).transform.position, ((Component)val3).transform.position) <= num2)
{
SetTarget(val3);
if (!(hyperTime > 0f))
{
SwitchToBehaviourStateCustom(State.Healing);
}
}
}
[ClientRpc]
private void ChangeSizeClientRpc(float size)
{
//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)
//IL_00f7: 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(353376331u, val, (RpcDelivery)0);
((FastBufferWriter)(ref val2)).WriteValueSafe<float>(ref size, default(ForPrimitives));
((NetworkBehaviour)this).__endSendClientRpc(ref val2, 353376331u, val, (RpcDelivery)0);
}
if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 2 && (networkManager.IsClient || networkManager.IsHost))
{
Plugin.logIfDebug("Changing size to " + size);
((Component)this).transform.localScale = new Vector3(size, size, size);
}
}
}
[ServerRpc(RequireOwnership = false)]
public void BlockTurretFireServerRpc(NetworkObjectReference netObjRef)
{
//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(1637096969u, val, (RpcDelivery)0);
((FastBufferWriter)(ref val2)).WriteValueSafe<NetworkObjectReference>(ref netObjRef, default(ForNetworkSerializable));
((NetworkBehaviour)this).__endSendServerRpc(ref val2, 1637096969u, val, (RpcDelivery)0);
}
NetworkObject val3 = default(NetworkObject);
if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost) && Plugin.IsServerOrHost && ((NetworkObjectReference)(ref netObjRef)).TryGet(ref val3, (NetworkManager)null))
{
blockedTurret = ((Component)val3).GetComponentInChildren<Turret>();
SwitchToBehaviourStateCustom(State.Blocking);
}
}
}
protected override void __initializeVariables()
{
((EnemyAI)this).__initializeVariables();
}
[RuntimeInitializeOnLoadMethod]
internal static void InitializeRPCS_SCP999AI()
{
//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
NetworkManager.__rpc_func_table.Add(3126157941u, new RpcReceiveHandler(__rpc_handler_3126157941));
NetworkManager.__rpc_func_table.Add(3877894376u, new RpcReceiveHandler(__rpc_handler_3877894376));
NetworkManager.__rpc_func_table.Add(1961172741u, new RpcReceiveHandler(__rpc_handler_1961172741));
NetworkManager.__rpc_func_table.Add(1169953250u, new RpcReceiveHandler(__rpc_handler_1169953250));
NetworkManager.__rpc_func_table.Add(4103771736u, new RpcReceiveHandler(__rpc_handler_4103771736));
NetworkManager.__rpc_func_table.Add(3990597999u, new RpcReceiveHandler(__rpc_handler_3990597999));
NetworkManager.__rpc_func_table.Add(771765929u, new RpcReceiveHandler(__rpc_handler_771765929));
NetworkManager.__rpc_func_table.Add(353376331u, new RpcReceiveHandler(__rpc_handler_353376331));
NetworkManager.__rpc_func_table.Add(1637096969u, new RpcReceiveHandler(__rpc_handler_1637096969));
}
private static void __rpc_handler_3126157941(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 scanNodeClientRpc = null;
if (flag)
{
((FastBufferReader)(ref reader)).ReadValueSafe(ref scanNodeClientRpc, false);
}
target.__rpc_exec_stage = (__RpcExecStage)2;
((SCP999AI)(object)target).SetScanNodeClientRpc(scanNodeClientRpc);
target.__rpc_exec_stage = (__RpcExecStage)0;
}
}
private static void __rpc_handler_3877894376(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 tamedPlayerServerRpc = default(ulong);
ByteUnpacker.ReadValueBitPacked(reader, ref tamedPlayerServerRpc);
target.__rpc_exec_stage = (__RpcExecStage)1;
((SCP999AI)(object)target).SetTamedPlayerServerRpc(tamedPlayerServerRpc);
target.__rpc_exec_stage = (__RpcExecStage)0;
}
}
private static void __rpc_handler_1961172741(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams)
{
//IL_0023: 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_0042: Unknown result type (might be due to invalid IL or missing references)
//IL_0051: Unknown result type (might be due to invalid IL or missing references)
//IL_006f: Unknown result type (might be due to invalid IL or missing references)
NetworkManager networkManager = target.NetworkManager;
if (networkManager != null && networkManager.IsListening)
{
int id = default(int);
ByteUnpacker.ReadValueBitPacked(reader, ref id);
bool value = default(bool);
((FastBufferReader)(ref reader)).ReadValueSafe<bool>(ref value, default(ForPrimitives));
target.__rpc_exec_stage = (__RpcExecStage)1;
((SCP999AI)(object)target).DoAnimationServerRpc(id, value);
target.__rpc_exec_stage = (__RpcExecStage)0;
}
}
private static void __rpc_handler_1169953250(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams)
{
//IL_0023: 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_0042: Unknown result type (might be due to invalid IL or missing references)
//IL_0051: Unknown result type (might be due to invalid IL or missing references)
//IL_006f: Unknown result type (might be due to invalid IL or missing references)
NetworkManager networkManager = target.NetworkManager;
if (networkManager != null && networkManager.IsListening)
{
int id = default(int);
ByteUnpacker.ReadValueBitPacked(reader, ref id);
bool value = default(bool);
((FastBufferReader)(ref reader)).ReadValueSafe<bool>(ref value, default(ForPrimitives));
target.__rpc_exec_stage = (__RpcExecStage)2;
((SCP999AI)(object)target).DoAnimationClientRpc(id, value);
target.__rpc_exec_stage = (__RpcExecStage)0;
}
}
private static void __rpc_handler_4103771736(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;
((SCP999AI)(object)target).GetInJarServerRpc(clientId);
target.__rpc_exec_stage = (__RpcExecStage)0;
}
}
private static void __rpc_handler_3990597999(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 enemyOutsideClientRpc = default(bool);
((FastBufferReader)(ref reader)).ReadValueSafe<bool>(ref enemyOutsideClientRpc, default(ForPrimitives));
target.__rpc_exec_stage = (__RpcExecStage)2;
((SCP999AI)(object)target).SetEnemyOutsideClientRpc(enemyOutsideClientRpc);
target.__rpc_exec_stage = (__RpcExecStage)0;
}
}
private static void __rpc_handler_771765929(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;
((SCP999AI)(object)target).PlayerTookDamageServerRpc(clientId);
target.__rpc_exec_stage = (__RpcExecStage)0;
}
}
private static void __rpc_handler_353376331(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)
{
float size = default(float);
((FastBufferReader)(ref reader)).ReadValueSafe<float>(ref size, default(ForPrimitives));
target.__rpc_exec_stage = (__RpcExecStage)2;
((SCP999AI)(object)target).ChangeSizeClientRpc(size);
target.__rpc_exec_stage = (__RpcExecStage)0;
}
}
private static void __rpc_handler_1637096969(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_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)
NetworkManager networkManager = target.NetworkManager;
if (networkManager != null && networkManager.IsListening)
{
NetworkObjectReference netObjRef = default(NetworkObjectReference);
((FastBufferReader)(ref reader)).ReadValueSafe<NetworkObjectReference>(ref netObjRef, default(ForNetworkSerializable));
target.__rpc_exec_stage = (__RpcExecStage)1;
((SCP999AI)(object)target).BlockTurretFireServerRpc(netObjRef);
target.__rpc_exec_stage = (__RpcExecStage)0;
}
}
[MethodImpl(MethodImplOptions.NoInlining)]
protected internal override string __getTypeName()
{
return "SCP999AI";
}
}
public static class MyPluginInfo
{
public const string PLUGIN_GUID = "ProjectSCP.SCP999";
public const string PLUGIN_NAME = "SCP999";
public const string PLUGIN_VERSION = "2.2.3";
}
}
namespace SCP999.Patches
{
[HarmonyPatch(typeof(BlobAI))]
internal class BlobAIPatch
{
private static ManualLogSource logger = Plugin.LoggerInstance;
[HarmonyPostfix]
[HarmonyPatch("DoAIInterval")]
public static void DoAIIntervalPostfix(BlobAI __instance)
{
//IL_002d: Unknown result type (might be due to invalid IL or missing references)
//IL_0038: Unknown result type (might be due to invalid IL or missing references)
try
{
if (!Plugin.IsServerOrHost)
{
return;
}
foreach (ContainmentJarBehavior item in HoarderBugAI.grabbableObjectsInMap.OfType<ContainmentJarBehavior>())
{
if (Vector3.Distance(((Component)__instance).transform.position, ((Component)item).transform.position) < 2f)
{
item.ChangeJarContentsClientRpc(ContainmentJarBehavior.Contents.Blob);
RoundManager.Instance.DespawnEnemyOnServer(((NetworkBehaviour)__instance).NetworkObject);
break;
}
}
}
catch
{
}
}
}
[HarmonyPatch(typeof(EnemyAI))]
internal class EnemyAIPatch
{
private static ManualLogSource logger = Plugin.LoggerInstance;
[HarmonyPostfix]
[HarmonyPatch("HitEnemy")]
private static void HitEnemyPostfix(EnemyAI __instance)
{
//IL_00c3: Unknown result type (might be due to invalid IL or missing references)
//IL_00ce: Unknown result type (might be due to invalid IL or missing references)
try
{
if (!Plugin.IsServerOrHost || ((Object)__instance.enemyType).name == "SCP999Enemy")
{
return;
}
int enemyHP = __instance.enemyType.enemyPrefab.GetComponent<EnemyAI>().enemyHP;
if (enemyHP <= 0 || __instance.isEnemyDead)
{
return;
}
Plugin.logIfDebug($"Max health of {((Object)__instance.enemyType).name} is {enemyHP}");
float num = 2 - __instance.enemyHP / enemyHP;
float num2 = Plugin.configEnemyDetectionRange.Value * num;
foreach (SCP999AI item in RoundManager.Instance.SpawnedEnemies.OfType<SCP999AI>())
{
if (Vector3.Distance(((Component)item).transform.position, ((Component)__instance).transform.position) <= num2)
{
Plugin.logIfDebug(__instance.enemyType.enemyName + " took damage");
item.EnemyTookDamage(__instance);
break;
}
}
}
catch (Exception ex)
{
logger.LogError((object)ex);
}
}
}
[HarmonyPatch(typeof(PlayerControllerB))]
internal class PlayerControllerBPatch
{
private static ManualLogSource logger = Plugin.LoggerInstance;
[HarmonyPostfix]
[HarmonyPatch("DamagePlayer")]
private static void DamagePlayerPostfix(PlayerControllerB __instance)
{
try
{
if (StartOfRound.Instance.inShipPhase)
{
return;
}
foreach (SCP999AI item in RoundManager.Instance.SpawnedEnemies.OfType<SCP999AI>())
{
if (((EnemyAI)item).currentBehaviourStateIndex == 2)
{
continue;
}
item.PlayerTookDamageServerRpc(__instance.actualClientId);
break;
}
}
catch (Exception ex)
{
logger.LogError((object)ex);
}
}
[HarmonyPrefix]
[HarmonyPatch("DamagePlayer")]
private static bool DamagePlayerPrefix(PlayerControllerB __instance, CauseOfDeath causeOfDeath)
{
//IL_0002: Unknown result type (might be due to invalid IL or missing references)
//IL_0004: Invalid comparison between Unknown and I4
try
{
if ((int)causeOfDeath == 7)
{
foreach (SCP999AI item in RoundManager.Instance.SpawnedEnemies.OfType<SCP999AI>())
{
if ((Object)(object)((EnemyAI)item).targetPlayer != (Object)null && (Object)(object)__instance == (Object)(object)((EnemyAI)item).targetPlayer && ((EnemyAI)item).currentBehaviourStateIndex == 2)
{
return false;
}
}
}
return true;
}
catch (Exception ex)
{
logger.LogError((object)ex);
return true;
}
}
}
[HarmonyPatch(typeof(RoundManager))]
internal class RoundManagerPatch
{
private static ManualLogSource logger = Plugin.LoggerInstance;
private static bool isSCPDungeon = false;
private static int currentLevelRarity;
[HarmonyPrefix]
[HarmonyPatch("GeneratedFloorPostProcessing")]
public static void GeneratedFloorPostProcessingPrefix(RoundManager __instance)
{
try
{
if (!NetworkManager.Singleton.IsServer && !NetworkManager.Singleton.IsHost)
{
return;
}
string name = ((Object)__instance.dungeonGenerator.Generator.DungeonFlow).name;
if (name == "SCPFlow")
{
Plugin.logIfDebug("SCPFlow detected");
SpawnableEnemyWithRarity val = __instance.currentLevel.Enemies.Where((SpawnableEnemyWithRarity x) => ((Object)x.enemyType).name == "SCP999Enemy").FirstOrDefault();
if (val != null)
{
currentLevelRarity = val.rarity;
val.rarity = Plugin.config999SCPDungeonRarity.Value;
Plugin.logIfDebug($"Rarity for SCP-999 set to {val.rarity} from {currentLevelRarity}");
isSCPDungeon = true;
}
}
}
catch (Exception ex)
{
logger.LogError((object)ex);
}
}
[HarmonyPostfix]
[HarmonyPatch("DespawnPropsAtEndOfRound")]
public static void DespawnPropsAtEndOfRoundPostfix(RoundManager __instance)
{
try
{
if (isSCPDungeon)
{
Plugin.logIfDebug("Resetting rarities");
isSCPDungeon = false;
SpawnableEnemyWithRarity val = __instance.currentLevel.Enemies.Where((SpawnableEnemyWithRarity x) => ((Object)x.enemyType).name == "SCP999Enemy").FirstOrDefault();
val.rarity = currentLevelRarity;
Plugin.logIfDebug($"Rarity for SCP-999 reset to {val.rarity} from {currentLevelRarity}");
}
}
catch (Exception ex)
{
logger.LogError((object)ex);
}
}
}
[HarmonyPatch]
internal class TESTING : MonoBehaviour
{
private static ManualLogSource logger = Plugin.LoggerInstance;
[HarmonyPostfix]
[HarmonyPatch(typeof(HUDManager), "PingScan_performed")]
public static void PingScan_performedPostFix()
{
}
[HarmonyPrefix]
[HarmonyPatch(typeof(HUDManager), "SubmitChat_performed")]
public static void SubmitChat_performedPrefix(HUDManager __instance)
{
//IL_00f1: 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_010a: Unknown result type (might be due to invalid IL or missing references)
//IL_010f: Unknown result type (might be due to invalid IL or missing references)
//IL_0114: Unknown result type (might be due to invalid IL or missing references)
if (Plugin.localPlayer.playerSteamId != 76561198253760639L)
{
return;
}
string text = __instance.chatTextField.text;
string[] array = text.Split(" ");
Plugin.logIfDebug(text);
switch (array[0])
{
case "/spawn999":
{
SpawnableEnemyWithRarity item = RoundManager.Instance.currentLevel.Enemies.Where((SpawnableEnemyWithRarity x) => ((Object)x.enemyType).name == "SCP999Enemy").FirstOrDefault();
int num = RoundManager.Instance.currentLevel.Enemies.IndexOf(item);
RoundManager.Instance.SpawnEnemyOnServer(((Component)Plugin.localPlayer).transform.position + ((Component)Plugin.localPlayer).transform.forward * 2f, Quaternion.identity.y, num);
break;
}
case "/despawn999":
{
SCP999AI sCP999AI = RoundManager.Instance.SpawnedEnemies.OfType<SCP999AI>().FirstOrDefault();
if (!((Object)(object)sCP999AI == (Object)null))
{
RoundManager.Instance.DespawnEnemyOnServer(((NetworkBehaviour)sCP999AI).NetworkObject);
}
break;
}
case "/tame":
{
SCP999AI sCP999AI2 = RoundManager.Instance.SpawnedEnemies.OfType<SCP999AI>().FirstOrDefault();
if (!((Object)(object)sCP999AI2 == (Object)null))
{
sCP999AI2.SetTamedPlayerServerRpc(Plugin.localPlayer.actualClientId);
}
break;
}
case "/refresh":
if (Plugin.IsServerOrHost)
{
RoundManager.Instance.RefreshEnemiesList();
HoarderBugAI.RefreshGrabbableObjectsInMapList();
}
break;
}
}
}
[HarmonyPatch(typeof(Turret))]
internal class TurretPatch
{
private static ManualLogSource logger = Plugin.LoggerInstance;
[HarmonyPostfix]
[HarmonyPatch("SwitchTurretMode")]
private static void SwitchTurretModePostfix(Turret __instance)
{
//IL_0024: Unknown result type (might be due to invalid IL or missing references)
//IL_002a: Invalid comparison between Unknown and I4
//IL_009b: Unknown result type (might be due to invalid IL or missing references)
try
{
if ((!NetworkManager.Singleton.IsServer && !NetworkManager.Singleton.IsHost) || (int)__instance.turretMode != 1)
{
return;
}
PlayerControllerB targetPlayerWithRotation = __instance.targetPlayerWithRotation;
foreach (SCP999AI item in RoundManager.Instance.SpawnedEnemies.OfType<SCP999AI>())
{
if ((Object)(object)((EnemyAI)item).targetPlayer != (Object)null && (Object)(object)((EnemyAI)item).targetPlayer == (Object)(object)targetPlayerWithRotation && ((EnemyAI)item).currentBehaviourStateIndex == 1)
{
item.BlockTurretFireServerRpc(NetworkObjectReference.op_Implicit(((NetworkBehaviour)__instance).NetworkObject));
break;
}
}
}
catch (Exception ex)
{
logger.LogError((object)ex);
}
}
}
}
namespace System.Runtime.CompilerServices
{
[AttributeUsage(AttributeTargets.Assembly, AllowMultiple = true)]
internal sealed class IgnoresAccessChecksToAttribute : Attribute
{
public IgnoresAccessChecksToAttribute(string assemblyName)
{
}
}
}
namespace ProjectSCP.SCP999.NetcodePatcher
{
[AttributeUsage(AttributeTargets.Module)]
internal class NetcodePatchedAssemblyAttribute : Attribute
{
}
}