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 SCP999.NetcodePatcher;
using Unity.Netcode;
using UnityEngine;
[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("SCP999")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0+83ab06db55009b403915d69c889296be9f7fc59f")]
[assembly: AssemblyProduct("SCP999")]
[assembly: AssemblyTitle("SCP999")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.0.0")]
[module: UnverifiableCode]
[module: RefSafetyRules(11)]
[module: NetcodePatchedAssembly]
internal class <Module>
{
static <Module>()
{
}
}
namespace Microsoft.CodeAnalysis
{
[CompilerGenerated]
[Microsoft.CodeAnalysis.Embedded]
internal sealed class EmbeddedAttribute : Attribute
{
}
}
namespace System.Runtime.CompilerServices
{
[CompilerGenerated]
[Microsoft.CodeAnalysis.Embedded]
[AttributeUsage(AttributeTargets.Class | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Parameter | AttributeTargets.ReturnValue | AttributeTargets.GenericParameter, AllowMultiple = false, Inherited = false)]
internal sealed class NullableAttribute : Attribute
{
public readonly byte[] NullableFlags;
public NullableAttribute(byte P_0)
{
NullableFlags = new byte[1] { P_0 };
}
public NullableAttribute(byte[] P_0)
{
NullableFlags = P_0;
}
}
[CompilerGenerated]
[Microsoft.CodeAnalysis.Embedded]
[AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Method | AttributeTargets.Interface | AttributeTargets.Delegate, AllowMultiple = false, Inherited = false)]
internal sealed class NullableContextAttribute : Attribute
{
public readonly byte Flag;
public NullableContextAttribute(byte P_0)
{
Flag = P_0;
}
}
[CompilerGenerated]
[Microsoft.CodeAnalysis.Embedded]
[AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)]
internal sealed class RefSafetyRulesAttribute : Attribute
{
public readonly int Version;
public RefSafetyRulesAttribute(int P_0)
{
Version = P_0;
}
}
}
namespace SCP999
{
[BepInPlugin("ProjectSCP.SCP999", "SCP999", "1.0.0")]
[BepInDependency(/*Could not decode attribute arguments.*/)]
public class Plugin : BaseUnityPlugin
{
private const string modGUID = "ProjectSCP.SCP999";
private const string modName = "SCP999";
private const string modVersion = "1.0.0";
public static Plugin PluginInstance;
public static ManualLogSource LoggerInstance;
private readonly Harmony harmony = new Harmony("ProjectSCP.SCP999");
public static AssetBundle? ModAssets;
public static ConfigEntry<int> configExperimentationLevelRarity;
public static ConfigEntry<int> configAssuranceLevelRarity;
public static ConfigEntry<int> configVowLevelRarity;
public static ConfigEntry<int> configOffenseLevelRarity;
public static ConfigEntry<int> configMarchLevelRarity;
public static ConfigEntry<int> configRendLevelRarity;
public static ConfigEntry<int> configDineLevelRarity;
public static ConfigEntry<int> configTitanLevelRarity;
public static ConfigEntry<int> configModdedLevelRarity;
public static ConfigEntry<int> configOtherLevelRarity;
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<int> configMaxCandy;
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;
private void Awake()
{
if ((Object)(object)PluginInstance == (Object)null)
{
PluginInstance = this;
}
LoggerInstance = ((BaseUnityPlugin)PluginInstance).Logger;
harmony.PatchAll();
InitializeNetworkBehaviours();
configExperimentationLevelRarity = ((BaseUnityPlugin)this).Config.Bind<int>("Rarity", "ExperimentationLevelRarity", 50, "Experimentation Level Rarity");
configAssuranceLevelRarity = ((BaseUnityPlugin)this).Config.Bind<int>("Rarity", "AssuranceLevelRarity", 50, "Assurance Level Rarity");
configVowLevelRarity = ((BaseUnityPlugin)this).Config.Bind<int>("Rarity", "VowLevelRarity", 50, "Vow Level Rarity");
configOffenseLevelRarity = ((BaseUnityPlugin)this).Config.Bind<int>("Rarity", "OffenseLevelRarity", 30, "Offense Level Rarity");
configMarchLevelRarity = ((BaseUnityPlugin)this).Config.Bind<int>("Rarity", "MarchLevelRarity", 30, "March Level Rarity");
configRendLevelRarity = ((BaseUnityPlugin)this).Config.Bind<int>("Rarity", "RendLevelRarity", 10, "Rend Level Rarity");
configDineLevelRarity = ((BaseUnityPlugin)this).Config.Bind<int>("Rarity", "DineLevelRarity", 10, "Dine Level Rarity");
configTitanLevelRarity = ((BaseUnityPlugin)this).Config.Bind<int>("Rarity", "TitanLevelRarity", 20, "Titan Level Rarity");
configModdedLevelRarity = ((BaseUnityPlugin)this).Config.Bind<int>("Rarity", "ModdedLevelRarity", 10, "Modded Level Rarity");
configOtherLevelRarity = ((BaseUnityPlugin)this).Config.Bind<int>("Rarity", "OtherLevelRarity", 10, "Other Level Rarity");
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", 20f, "How far SCP-999 can detect you");
configEnemyDetectionRange = ((BaseUnityPlugin)this).Config.Bind<float>("General", "Enemy Detection Range", 10f, "How far SCP-999 can detect enemies");
configFollowRange = ((BaseUnityPlugin)this).Config.Bind<float>("General", "Follow Range", 7f, "How far SCP-999 can follow you or other enemies");
configMaxCandy = ((BaseUnityPlugin)this).Config.Bind<int>("General", "Max Candy", 3, "Max amount of candy SCP-999 can eat before something bad happens");
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")));
EnemyType val = ModAssets.LoadAsset<EnemyType>("Assets/ModAssets/SCP999/TickleMonster.asset");
if ((Object)(object)val == (Object)null)
{
LoggerInstance.LogError((object)"Error: Couldnt get SCP-999 from assets");
return;
}
LoggerInstance.LogDebug((object)"Got SCP-999 prefab");
TerminalNode val2 = ModAssets.LoadAsset<TerminalNode>("Assets/ModAssets/SCP999/Bestiary/TickleMonsterTN.asset");
TerminalKeyword val3 = ModAssets.LoadAsset<TerminalKeyword>("Assets/ModAssets/SCP999/Bestiary/TickleMonsterTK.asset");
LoggerInstance.LogDebug((object)"Setting rarities");
Dictionary<LevelTypes, int> dictionary = new Dictionary<LevelTypes, int>
{
{
(LevelTypes)4,
configExperimentationLevelRarity.Value
},
{
(LevelTypes)8,
configAssuranceLevelRarity.Value
},
{
(LevelTypes)16,
configVowLevelRarity.Value
},
{
(LevelTypes)32,
configOffenseLevelRarity.Value
},
{
(LevelTypes)64,
configMarchLevelRarity.Value
},
{
(LevelTypes)128,
configRendLevelRarity.Value
},
{
(LevelTypes)256,
configDineLevelRarity.Value
},
{
(LevelTypes)512,
configTitanLevelRarity.Value
},
{
(LevelTypes)(-1),
configOtherLevelRarity.Value
},
{
(LevelTypes)1024,
configModdedLevelRarity.Value
}
};
LoggerInstance.LogDebug((object)"Registering enemy network prefab...");
NetworkPrefabs.RegisterNetworkPrefab(val.enemyPrefab);
LoggerInstance.LogDebug((object)"Registering enemy...");
Enemies.RegisterEnemy(val, dictionary, (Dictionary<string, int>)null, val2, val3);
((BaseUnityPlugin)this).Logger.LogInfo((object)"ProjectSCP.SCP999 v1.0.0 has loaded!");
}
private static void InitializeNetworkBehaviours()
{
Type[] types = Assembly.GetExecutingAssembly().GetTypes();
Type[] array = types;
foreach (Type type in array)
{
MethodInfo[] methods = type.GetMethods(BindingFlags.Instance | BindingFlags.Static | BindingFlags.NonPublic);
MethodInfo[] array2 = methods;
foreach (MethodInfo methodInfo in array2)
{
object[] customAttributes = methodInfo.GetCustomAttributes(typeof(RuntimeInitializeOnLoadMethodAttribute), inherit: false);
if (customAttributes.Length != 0)
{
methodInfo.Invoke(null, null);
}
}
}
LoggerInstance.LogDebug((object)"Finished initializing network behaviours");
}
}
internal class SCP999AI : EnemyAI
{
public enum State
{
Roaming,
Following,
Blocking,
Healing,
Hyper
}
private static ManualLogSource logger = Plugin.LoggerInstance;
public Transform turnCompass = null;
public EnemyAI targetEnemy;
private Turret blockedTurret;
private float timeSinceHealing;
private float healingBuffTime;
private float hyperTime;
private float timeSinceBlockSFX;
private float timeSinceHugSFX;
private int playerHealAmount;
private int enemyHealAmount;
private float playerDetectionRange;
private float enemyDetectionRange;
private float rangeMultiplier = 1f;
private float followingRange;
private float huggingRange = 5f;
private bool walking = false;
private bool hugging = false;
private bool dancing = false;
private int maxCandy;
private int candyEaten;
public bool followPlayer = true;
public bool followEnemy = true;
public List<AudioClip> hitSFXList;
public List<AudioClip> hugSFXList;
public List<AudioClip> hurtSFXList;
public List<AudioClip> roamSFXList;
public override void Start()
{
//IL_00d5: Unknown result type (might be due to invalid IL or missing references)
((EnemyAI)this).Start();
logger.LogDebug((object)"SCP-999 Spawned");
playerHealAmount = Plugin.configPlayerHealAmount.Value;
enemyHealAmount = Plugin.configEnemyHealAmount.Value;
playerDetectionRange = Plugin.configPlayerDetectionRange.Value;
enemyDetectionRange = Plugin.configEnemyDetectionRange.Value;
followingRange = Plugin.configFollowRange.Value;
candyEaten = 0;
maxCandy = Plugin.configMaxCandy.Value;
timeSinceHealing = 0f;
healingBuffTime = 0f;
hyperTime = 0f;
timeSinceBlockSFX = 0f;
timeSinceHugSFX = 0f;
base.currentBehaviourStateIndex = 0;
RoundManager.Instance.SpawnedEnemies.Add((EnemyAI)(object)this);
((EnemyAI)this).StartSearch(((Component)this).transform.position, (AISearchRoutine)null);
}
public override void Update()
{
//IL_00aa: Unknown result type (might be due to invalid IL or missing references)
//IL_00c1: Unknown result type (might be due to invalid IL or missing references)
//IL_00d1: 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_00f5: 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)
((EnemyAI)this).Update();
timeSinceHealing += Time.deltaTime;
if (healingBuffTime > 0f)
{
healingBuffTime -= Time.deltaTime;
if (healingBuffTime <= 0.5f)
{
candyEaten = 0;
}
}
if (hyperTime > 0f)
{
hyperTime -= Time.deltaTime;
}
if ((Object)(object)base.targetPlayer != (Object)null)
{
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);
}
int currentBehaviourStateIndex = base.currentBehaviourStateIndex;
if ((NetworkManager.Singleton.IsServer || NetworkManager.Singleton.IsHost) && currentBehaviourStateIndex != 4 && currentBehaviourStateIndex != 3)
{
if (base.agent.remainingDistance <= base.agent.stoppingDistance + 0.1f)
{
Vector3 velocity = base.agent.velocity;
if (((Vector3)(ref velocity)).sqrMagnitude < 0.01f)
{
if (walking)
{
walking = false;
DoAnimationClientRpc("stopWalking");
}
goto IL_01d2;
}
}
if (!walking)
{
walking = true;
DoAnimationClientRpc("startWalking");
}
}
goto IL_01d2;
IL_01d2:
if (currentBehaviourStateIndex == 2)
{
timeSinceBlockSFX += Time.deltaTime;
}
if (currentBehaviourStateIndex == 3)
{
timeSinceHugSFX += Time.deltaTime;
}
}
public override void DoAIInterval()
{
//IL_0162: Unknown result type (might be due to invalid IL or missing references)
((EnemyAI)this).DoAIInterval();
if (base.isEnemyDead || StartOfRound.Instance.allPlayersDead)
{
return;
}
switch (base.currentBehaviourStateIndex)
{
case 0:
base.agent.speed = 5f;
base.agent.stoppingDistance = 0f;
dancing = false;
if ((((EnemyAI)this).TargetClosestPlayer(1.5f, true, 70f) && followPlayer) || (TargetClosestEnemy(1.5f, requireLineOfSight: true) && followEnemy))
{
((EnemyAI)this).StopSearch(base.currentSearch, true);
((EnemyAI)this).SwitchToBehaviourClientRpc(1);
}
break;
case 1:
if (healingBuffTime > 0f)
{
base.agent.speed = 10f;
}
else
{
base.agent.speed = 5f;
}
base.agent.stoppingDistance = followingRange;
if (!TargetClosestEntity())
{
logger.LogDebug((object)"Stop Targeting");
base.targetPlayer = null;
targetEnemy = null;
((EnemyAI)this).SwitchToBehaviourClientRpc(0);
((EnemyAI)this).StartSearch(((Component)this).transform.position, (AISearchRoutine)null);
}
else if (MoveToSweetsIfDroppedByPlayer())
{
EatSweetsIfClose();
}
else
{
FollowTarget();
}
break;
case 2:
base.agent.speed = 20f;
base.agent.stoppingDistance = 0f;
if (!MoveInFrontOfTurret())
{
logger.LogDebug((object)"Stop Blocking");
blockedTurret = null;
((EnemyAI)this).SwitchToBehaviourClientRpc(1);
}
break;
case 3:
base.agent.speed = 10f;
base.agent.stoppingDistance = huggingRange;
if (!hugging)
{
DoAnimationClientRpc("startHugging");
hugging = true;
}
MoveToHealTarget();
break;
case 4:
base.agent.speed = 20f;
base.agent.stoppingDistance = 0f;
if (hyperTime <= 0f)
{
candyEaten = 0;
((EnemyAI)this).SwitchToBehaviourClientRpc(0);
}
break;
default:
logger.LogWarning((object)("Invalid state: " + base.currentBehaviourStateIndex));
break;
}
}
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_005e: Unknown result type (might be due to invalid IL or missing references)
//IL_00b6: Unknown result type (might be due to invalid IL or missing references)
//IL_00c6: Unknown result type (might be due to invalid IL or missing references)
//IL_00ea: 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 || ((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_0063: 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)
//IL_012f: 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_00a2: Unknown result type (might be due to invalid IL or missing references)
//IL_00ad: 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)(object)spawnedEnemy == (Object)(object)this) && !((EnemyAI)this).PathIsIntersectedByLineOfSight(((Component)spawnedEnemy).transform.position, 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_001d: 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_0042: Unknown result type (might be due to invalid IL or missing references)
//IL_0047: Unknown result type (might be due to invalid IL or missing references)
//IL_0057: Unknown result type (might be due to invalid IL or missing references)
//IL_005c: Unknown result type (might be due to invalid IL or missing references)
//IL_00f3: Unknown result type (might be due to invalid IL or missing references)
Vector3 position;
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;
}
if (Vector3.Distance(((Component)this).transform.position, position) < followingRange)
{
if (!dancing && IsNearbyPlayerEmoting(followingRange) && !walking)
{
DoAnimationClientRpc("startDancing");
dancing = true;
}
else if (dancing && !IsNearbyPlayerEmoting(followingRange) && !walking)
{
DoAnimationClientRpc("stopWalking");
dancing = false;
}
}
else
{
((EnemyAI)this).SetDestinationToPosition(position, false);
dancing = false;
}
}
private void MoveToHealTarget()
{
//IL_008e: Unknown result type (might be due to invalid IL or missing references)
//IL_009e: Unknown result type (might be due to invalid IL or missing references)
//IL_01a3: Unknown result type (might be due to invalid IL or missing references)
//IL_01b3: Unknown result type (might be due to invalid IL or missing references)
//IL_00d9: Unknown result type (might be due to invalid IL or missing references)
//IL_01ed: Unknown result type (might be due to invalid IL or missing references)
if ((Object)(object)base.targetPlayer != (Object)null)
{
logger.LogDebug((object)("Player hp: " + base.targetPlayer.health));
if (base.targetPlayer.health >= 100 || base.targetPlayer.isPlayerDead)
{
if (hugging)
{
hugging = false;
DoAnimationClientRpc("stopHugging");
}
((EnemyAI)this).SwitchToBehaviourClientRpc(1);
}
else
{
if (Vector3.Distance(((Component)this).transform.position, ((Component)base.targetPlayer).transform.position) <= huggingRange)
{
HealPlayer(base.targetPlayer);
PlayHugSFX();
}
((EnemyAI)this).SetDestinationToPosition(((Component)base.targetPlayer).transform.position, false);
}
}
else
{
if (!((Object)(object)targetEnemy != (Object)null))
{
return;
}
int enemyHP = targetEnemy.enemyType.enemyPrefab.GetComponent<EnemyAI>().enemyHP;
logger.LogDebug((object)("Enemy hp: " + targetEnemy.enemyHP + "/" + enemyHP));
if (targetEnemy.enemyHP >= enemyHP || targetEnemy.isEnemyDead)
{
((EnemyAI)this).SwitchToBehaviourClientRpc(1);
if (hugging)
{
hugging = false;
DoAnimationClientRpc("stopHugging");
}
}
else
{
if (Vector3.Distance(((Component)this).transform.position, ((Component)targetEnemy).transform.position) < huggingRange)
{
HealEnemy(targetEnemy);
PlayHugSFX();
}
((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)
{
logger.LogDebug((object)"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_001a: Unknown result type (might be due to invalid IL or missing references)
//IL_0025: Unknown result type (might be due to invalid IL or missing references)
//IL_00a9: Unknown result type (might be due to invalid IL or missing references)
GrabbableObject[] array = Object.FindObjectsOfType<GrabbableObject>();
foreach (GrabbableObject val in array)
{
if (Vector3.Distance(((Component)this).transform.position, ((Component)val).transform.position) <= followingRange && Plugin.Sweets.Contains(val.itemProperties.itemName) && val.hasBeenHeld && !val.heldByPlayerOnServer)
{
logger.LogDebug((object)("Moving to item: " + val.itemProperties.itemName));
base.agent.stoppingDistance = 0f;
((EnemyAI)this).SetDestinationToPosition(((Component)val).transform.position, false);
return true;
}
}
return false;
}
public void EatSweetsIfClose()
{
//IL_001a: Unknown result type (might be due to invalid IL or missing references)
//IL_0025: Unknown result type (might be due to invalid IL or missing references)
GrabbableObject[] array = Object.FindObjectsOfType<GrabbableObject>();
foreach (GrabbableObject val in array)
{
if (Vector3.Distance(((Component)this).transform.position, ((Component)val).transform.position) < 1f && Plugin.Sweets.Contains(val.itemProperties.itemName))
{
logger.LogDebug((object)("Eating item: " + val.itemProperties.itemName));
if (val.itemProperties.itemName == "SCP-559")
{
ChangeSizeClientRpc(0.5f);
}
if (val.itemProperties.itemName == "Black Candy")
{
MakeHyper(60f);
}
if (val.itemProperties.itemName == "Cake")
{
healingBuffTime += 10f;
}
((Component)val).GetComponent<NetworkObject>().Despawn(true);
Object.Destroy((Object)(object)((Component)val).gameObject);
candyEaten++;
logger.LogDebug((object)("Candy eaten: " + candyEaten));
healingBuffTime += 20f;
if (candyEaten >= maxCandy)
{
MakeHyper(30f);
}
}
}
}
public void MakeHyper(float duration)
{
//IL_0031: Unknown result type (might be due to invalid IL or missing references)
hyperTime += duration;
((EnemyAI)this).SwitchToBehaviourClientRpc(4);
DoAnimationClientRpc("startHyperDancing");
dancing = true;
((EnemyAI)this).StartSearch(((Component)this).transform.position, (AISearchRoutine)null);
base.targetPlayer = null;
targetEnemy = null;
}
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);
if (timeSinceHealing > 1f)
{
PlayerControllerB player = ((EnemyAI)this).MeetsStandardPlayerCollisionConditions(other, false, false);
HealPlayer(player);
}
}
public override void OnCollideWithEnemy(Collider other, EnemyAI collidedEnemy = null)
{
((EnemyAI)this).OnCollideWithEnemy(other, collidedEnemy);
if (timeSinceHealing > 1f)
{
if ((Object)(object)collidedEnemy != (Object)null)
{
HealEnemy(collidedEnemy);
}
else
{
logger.LogError((object)"Collided enemy is null");
}
}
}
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 PlayHugSFX()
{
if (timeSinceHugSFX > 3.3f)
{
int index = Random.Range(0, hugSFXList.Count - 1);
base.creatureVoice.PlayOneShot(hugSFXList[index], 1f);
timeSinceHugSFX = 0f;
}
}
public bool HealPlayer(PlayerControllerB player)
{
if ((Object)(object)player != (Object)null && player.health < 100 && timeSinceHealing > 1f)
{
logger.LogDebug((object)("Healing player: " + player.playerUsername));
int num = ((!(healingBuffTime > 0f)) ? (player.health + playerHealAmount) : (player.health + playerHealAmount * 2));
if (num > 100)
{
num = 100;
}
HealPlayerClientRpc(player.actualClientId, num);
timeSinceHealing = 0f;
return true;
}
return false;
}
public bool HealEnemy(EnemyAI enemyToHeal)
{
EnemyAI enemyToHeal2 = enemyToHeal;
SpawnableEnemyWithRarity val = RoundManager.Instance.currentLevel.Enemies.Where((SpawnableEnemyWithRarity x) => x.enemyType.enemyName == enemyToHeal2.enemyType.enemyName).FirstOrDefault();
if (val == null)
{
logger.LogError((object)("Enemy not found: " + enemyToHeal2.enemyType.enemyName));
return false;
}
int enemyHP = val.enemyType.enemyPrefab.GetComponent<EnemyAI>().enemyHP;
if (enemyToHeal2.enemyHP < enemyHP && timeSinceHealing > 1f)
{
if (healingBuffTime > 0f)
{
EnemyAI obj = enemyToHeal2;
obj.enemyHP += enemyHealAmount * 2;
}
else
{
EnemyAI obj2 = enemyToHeal2;
obj2.enemyHP += enemyHealAmount;
}
logger.LogDebug((object)$"{enemyToHeal2.enemyType.enemyName} HP: {enemyToHeal2.enemyHP}/{enemyHP}");
timeSinceHealing = 0f;
return true;
}
return false;
}
[ClientRpc]
private void DoAnimationClientRpc(string animationName)
{
//IL_0024: Unknown result type (might be due to invalid IL or missing references)
//IL_002e: Invalid comparison between Unknown and I4
//IL_00ca: Unknown result type (might be due to invalid IL or missing references)
//IL_00d4: Invalid comparison between Unknown and I4
//IL_005f: Unknown result type (might be due to invalid IL or missing references)
//IL_0068: Unknown result type (might be due to invalid IL or missing references)
//IL_006d: Unknown result type (might be due to invalid IL or missing references)
//IL_0088: Unknown result type (might be due to invalid IL or missing references)
//IL_008e: Unknown result type (might be due to invalid IL or missing references)
//IL_00ba: Unknown result type (might be due to invalid IL or missing references)
NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
if (networkManager == null || !networkManager.IsListening)
{
return;
}
if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 2 && (networkManager.IsServer || networkManager.IsHost))
{
ClientRpcParams val = default(ClientRpcParams);
FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(76983473u, val, (RpcDelivery)0);
bool flag = animationName != null;
((FastBufferWriter)(ref val2)).WriteValueSafe<bool>(ref flag, default(ForPrimitives));
if (flag)
{
((FastBufferWriter)(ref val2)).WriteValueSafe(animationName, false);
}
((NetworkBehaviour)this).__endSendClientRpc(ref val2, 76983473u, val, (RpcDelivery)0);
}
if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 2 && (networkManager.IsClient || networkManager.IsHost))
{
logger.LogDebug((object)("Animation: " + animationName));
base.creatureAnimator.SetTrigger(animationName);
}
}
[ClientRpc]
private void HealPlayerClientRpc(ulong clientId, int newHealthAmount)
{
//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_007e: 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)
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(2441967902u, val, (RpcDelivery)0);
BytePacker.WriteValueBitPacked(val2, clientId);
BytePacker.WriteValueBitPacked(val2, newHealthAmount);
((NetworkBehaviour)this).__endSendClientRpc(ref val2, 2441967902u, val, (RpcDelivery)0);
}
if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 2 && (networkManager.IsClient || networkManager.IsHost))
{
ulong clientId2 = clientId;
PlayerControllerB val3 = StartOfRound.Instance.allPlayerScripts.Where((PlayerControllerB x) => x.actualClientId == clientId2).FirstOrDefault();
if (!((Object)(object)val3 == (Object)null))
{
val3.playersManager.fearLevel = 0f;
val3.health = newHealthAmount;
HUDManager.Instance.UpdateHealthUI(newHealthAmount, false);
}
}
}
[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_0153: 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)
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(2545455583u, val, (RpcDelivery)0);
BytePacker.WriteValueBitPacked(val2, clientId);
((NetworkBehaviour)this).__endSendServerRpc(ref val2, 2545455583u, val, (RpcDelivery)0);
}
if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1 || (!networkManager.IsServer && !networkManager.IsHost))
{
return;
}
ulong clientId2 = clientId;
if (!NetworkManager.Singleton.IsServer && !NetworkManager.Singleton.IsHost)
{
return;
}
PlayerControllerB val3 = StartOfRound.Instance.allPlayerScripts.Where((PlayerControllerB x) => x.actualClientId == clientId2).FirstOrDefault();
if ((Object)(object)val3 == (Object)null)
{
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))
{
return;
}
targetEnemy = null;
base.targetPlayer = val3;
if (!(hyperTime > 0f))
{
if (base.currentSearch != null)
{
((EnemyAI)this).StopSearch(base.currentSearch, true);
}
((EnemyAI)this).SwitchToBehaviourClientRpc(3);
}
}
[ServerRpc(RequireOwnership = false)]
public void EnemyTookDamageServerRpc()
{
//IL_0024: Unknown result type (might be due to invalid IL or missing references)
//IL_002e: Invalid comparison between Unknown and I4
//IL_008c: Unknown result type (might be due to invalid IL or missing references)
//IL_0096: Invalid comparison between Unknown and I4
//IL_005f: Unknown result type (might be due to invalid IL or missing references)
//IL_0068: Unknown result type (might be due to invalid IL or missing references)
//IL_006d: Unknown result type (might be due to invalid IL or missing references)
//IL_007c: Unknown result type (might be due to invalid IL or missing references)
NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
if (networkManager == null || !networkManager.IsListening)
{
return;
}
if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1 && (networkManager.IsClient || networkManager.IsHost))
{
ServerRpcParams val = default(ServerRpcParams);
FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendServerRpc(3163008467u, val, (RpcDelivery)0);
((NetworkBehaviour)this).__endSendServerRpc(ref val2, 3163008467u, val, (RpcDelivery)0);
}
if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost) && (NetworkManager.Singleton.IsServer || NetworkManager.Singleton.IsHost) && !(hyperTime > 0f))
{
if (base.currentSearch != null)
{
((EnemyAI)this).StopSearch(base.currentSearch, true);
}
((EnemyAI)this).SwitchToBehaviourClientRpc(3);
}
}
[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_00e0: 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(2929267988u, val, (RpcDelivery)0);
((FastBufferWriter)(ref val2)).WriteValueSafe<float>(ref size, default(ForPrimitives));
((NetworkBehaviour)this).__endSendClientRpc(ref val2, 2929267988u, val, (RpcDelivery)0);
}
if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 2 && (networkManager.IsClient || networkManager.IsHost))
{
((Component)this).transform.localScale = new Vector3(size, size, size);
}
}
}
[ServerRpc(RequireOwnership = false)]
public void BlockTurretFireServerRpc()
{
//IL_0024: Unknown result type (might be due to invalid IL or missing references)
//IL_002e: Invalid comparison between Unknown and I4
//IL_008c: Unknown result type (might be due to invalid IL or missing references)
//IL_0096: Invalid comparison between Unknown and I4
//IL_005f: Unknown result type (might be due to invalid IL or missing references)
//IL_0068: Unknown result type (might be due to invalid IL or missing references)
//IL_006d: Unknown result type (might be due to invalid IL or missing references)
//IL_007c: Unknown result type (might be due to invalid IL or missing references)
NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
if (networkManager == null || !networkManager.IsListening)
{
return;
}
if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1 && (networkManager.IsClient || networkManager.IsHost))
{
ServerRpcParams val = default(ServerRpcParams);
FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendServerRpc(874709681u, val, (RpcDelivery)0);
((NetworkBehaviour)this).__endSendServerRpc(ref val2, 874709681u, val, (RpcDelivery)0);
}
if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1 || (!networkManager.IsServer && !networkManager.IsHost) || (!NetworkManager.Singleton.IsServer && !NetworkManager.Singleton.IsHost))
{
return;
}
Turret[] array = Object.FindObjectsOfType<Turret>();
foreach (Turret val3 in array)
{
if ((Object)(object)val3.targetPlayerWithRotation == (Object)(object)base.targetPlayer)
{
blockedTurret = val3;
((EnemyAI)this).SwitchToBehaviourClientRpc(2);
break;
}
}
}
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
NetworkManager.__rpc_func_table.Add(76983473u, new RpcReceiveHandler(__rpc_handler_76983473));
NetworkManager.__rpc_func_table.Add(2441967902u, new RpcReceiveHandler(__rpc_handler_2441967902));
NetworkManager.__rpc_func_table.Add(2545455583u, new RpcReceiveHandler(__rpc_handler_2545455583));
NetworkManager.__rpc_func_table.Add(3163008467u, new RpcReceiveHandler(__rpc_handler_3163008467));
NetworkManager.__rpc_func_table.Add(2929267988u, new RpcReceiveHandler(__rpc_handler_2929267988));
NetworkManager.__rpc_func_table.Add(874709681u, new RpcReceiveHandler(__rpc_handler_874709681));
}
private static void __rpc_handler_76983473(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams)
{
//IL_002f: Unknown result type (might be due to invalid IL or missing references)
//IL_0035: Unknown result type (might be due to invalid IL or missing references)
//IL_0061: Unknown result type (might be due to invalid IL or missing references)
//IL_007b: Unknown result type (might be due to invalid IL or missing references)
NetworkManager networkManager = target.NetworkManager;
if (networkManager != null && networkManager.IsListening)
{
bool flag = default(bool);
((FastBufferReader)(ref reader)).ReadValueSafe<bool>(ref flag, default(ForPrimitives));
string animationName = null;
if (flag)
{
((FastBufferReader)(ref reader)).ReadValueSafe(ref animationName, false);
}
target.__rpc_exec_stage = (__RpcExecStage)2;
((SCP999AI)(object)target).DoAnimationClientRpc(animationName);
target.__rpc_exec_stage = (__RpcExecStage)0;
}
}
private static void __rpc_handler_2441967902(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams)
{
//IL_0023: Unknown result type (might be due to invalid IL or missing references)
//IL_0030: Unknown result type (might be due to invalid IL or missing references)
//IL_0043: 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);
int newHealthAmount = default(int);
ByteUnpacker.ReadValueBitPacked(reader, ref newHealthAmount);
target.__rpc_exec_stage = (__RpcExecStage)2;
((SCP999AI)(object)target).HealPlayerClientRpc(clientId, newHealthAmount);
target.__rpc_exec_stage = (__RpcExecStage)0;
}
}
private static void __rpc_handler_2545455583(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_3163008467(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;
((SCP999AI)(object)target).EnemyTookDamageServerRpc();
target.__rpc_exec_stage = (__RpcExecStage)0;
}
}
private static void __rpc_handler_2929267988(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_874709681(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;
((SCP999AI)(object)target).BlockTurretFireServerRpc();
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 = "SCP999";
public const string PLUGIN_NAME = "SCP999";
public const string PLUGIN_VERSION = "1.0.0";
}
}
namespace SCP999.Patches
{
[HarmonyPatch(typeof(EnemyAI))]
internal class EnemyAIPatch
{
private static ManualLogSource logger = Plugin.LoggerInstance;
[HarmonyPostfix]
[HarmonyPatch("HitEnemy")]
private static void HitEnemyPostfix(EnemyAI __instance)
{
//IL_00eb: Unknown result type (might be due to invalid IL or missing references)
//IL_00f6: Unknown result type (might be due to invalid IL or missing references)
if ((!NetworkManager.Singleton.IsServer && !NetworkManager.Singleton.IsHost) || __instance.enemyType.enemyName == "SCP-999")
{
return;
}
int enemyHP = __instance.enemyType.enemyPrefab.GetComponent<EnemyAI>().enemyHP;
float num = 2 - __instance.enemyHP / enemyHP;
float num2 = Plugin.configEnemyDetectionRange.Value * num;
foreach (SCP999AI item in RoundManager.Instance.SpawnedEnemies.OfType<SCP999AI>())
{
logger.LogDebug((object)(__instance.enemyType.enemyName + " took damage, hp: " + __instance.enemyHP + "/" + enemyHP));
if (Vector3.Distance(((Component)item).transform.position, ((Component)__instance).transform.position) <= num2)
{
((EnemyAI)item).targetPlayer = null;
item.targetEnemy = __instance;
item.EnemyTookDamageServerRpc();
break;
}
}
}
}
[HarmonyPatch(typeof(PlayerControllerB))]
internal class PlayerControllerBPatch
{
private static ManualLogSource logger = Plugin.LoggerInstance;
[HarmonyPostfix]
[HarmonyPatch("DamagePlayer")]
private static void DamagePlayerPostfix(PlayerControllerB __instance, CauseOfDeath causeOfDeath)
{
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;
}
}
[HarmonyPrefix]
[HarmonyPatch("DamagePlayer")]
private static bool DamagePlayerPrefix(PlayerControllerB __instance, CauseOfDeath causeOfDeath)
{
//IL_0003: Unknown result type (might be due to invalid IL or missing references)
//IL_0005: Invalid comparison between Unknown and I4
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;
}
}
[HarmonyPatch(typeof(Turret))]
internal class TurretPatch
{
private static ManualLogSource logger = Plugin.LoggerInstance;
[HarmonyPostfix]
[HarmonyPatch("SwitchTurretMode")]
private static void SwitchTurretModePostfix(Turret __instance)
{
//IL_0023: Unknown result type (might be due to invalid IL or missing references)
//IL_0029: Invalid comparison between Unknown and I4
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();
break;
}
}
}
}
}
namespace SCP999.NetcodePatcher
{
[AttributeUsage(AttributeTargets.Module)]
internal class NetcodePatchedAssemblyAttribute : Attribute
{
}
}