Please disclose if any significant portion of your mod was created using AI tools by adding the 'AI Generated' category. Failing to do so may result in the mod being removed from Thunderstore.
Decompiled source of Phenomena v1.0.0
Y4NGZAnklager.dll
Decompiled 2 hours ago
The result has been truncated due to the large size, download it to view full contents!
using System; using System.Collections.Generic; using System.Diagnostics; using System.Globalization; using System.IO; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using System.Security.Cryptography; using System.Text; using System.Text.RegularExpressions; using BepInEx; using BepInEx.Bootstrap; using BepInEx.Configuration; using BepInEx.Logging; using Dawn; using GameNetcodeStuff; using HarmonyLib; using Microsoft.CodeAnalysis; using Unity.Netcode; using UnityEngine; using UnityEngine.AI; using UnityEngine.Audio; using UnityEngine.Rendering; using UnityEngine.Rendering.HighDefinition; using UnityEngine.SceneManagement; using UnityEngine.UI; using Y4NGZAnklager; using Y4NGZAnklager.NetcodePatcher; using Y4NGZAnklager.Patches; using Y4NGZMonsters.Shared; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")] [assembly: AssemblyCompany("Y4NGZAnklager")] [assembly: AssemblyConfiguration("Release")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0+597d0743e3d9fad0ef076615b4f8bdf577fcfd15")] [assembly: AssemblyProduct("Y4NGZAnklager")] [assembly: AssemblyTitle("Y4NGZAnklager")] [assembly: AssemblyVersion("1.0.0.0")] [module: RefSafetyRules(11)] [module: NetcodePatchedAssembly] namespace Microsoft.CodeAnalysis { [CompilerGenerated] [Embedded] internal sealed class EmbeddedAttribute : Attribute { } } namespace System.Runtime.CompilerServices { [CompilerGenerated] [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] [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] [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 Y4NGZAnklager { internal static class AnklagerActors { private sealed class PresenceProbe : IAnklagerActorProbe { public bool IsPresent(AnklagerActor actor) { return AnklagerActors.IsPresent(actor); } } private const float EyeHeightShare = 0.85f; internal static readonly IAnklagerActorProbe Probe = new PresenceProbe(); internal static AnklagerActor From(PlayerControllerB player) { if (!((Object)(object)player == (Object)null)) { return AnklagerActor.Player((int)player.playerClientId); } return AnklagerActor.None; } internal static AnklagerActor From(EnemyAI enemy) { if (!((Object)(object)enemy == (Object)null) && ((NetworkBehaviour)enemy).IsSpawned && !(enemy is AnklagerAI)) { return AnklagerActor.Enemy(((NetworkBehaviour)enemy).NetworkObjectId); } return AnklagerActor.None; } internal static PlayerControllerB Player(AnklagerActor actor) { if (!actor.IsPlayer || actor.Id > int.MaxValue) { return null; } return VictimRpc.FromSlot((int)actor.Id); } internal static EnemyAI Enemy(AnklagerActor actor) { NetworkManager singleton = NetworkManager.Singleton; if (!actor.IsEnemy || (Object)(object)singleton == (Object)null || singleton.SpawnManager == null || !singleton.SpawnManager.SpawnedObjects.TryGetValue(actor.Id, out var value) || (Object)(object)value == (Object)null) { return null; } EnemyAI component = ((Component)value).GetComponent<EnemyAI>(); if (!((Object)(object)component != (Object)null)) { return ((Component)value).GetComponentInChildren<EnemyAI>(); } return component; } internal static bool IsPresent(AnklagerActor actor) { if (actor.IsPlayer) { PlayerControllerB val = Player(actor); if ((Object)(object)val != (Object)null && val.isPlayerControlled) { return !val.isPlayerDead; } return false; } EnemyAI val2 = Enemy(actor); if ((Object)(object)val2 != (Object)null) { return !val2.isEnemyDead; } return false; } internal static string Name(AnklagerActor actor) { if (actor.IsPlayer) { PlayerControllerB val = Player(actor); if (!((Object)(object)val != (Object)null)) { return null; } return val.playerUsername; } EnemyAI val2 = Enemy(actor); if (!((Object)(object)val2 != (Object)null) || !((Object)(object)val2.enemyType != (Object)null)) { return null; } return val2.enemyType.enemyName; } internal static bool TryGetPoints(AnklagerActor actor, out Vector3 eyes, out Vector3 centre, out Vector3 feet) { //IL_0005: Unknown result type (might be due to invalid IL or missing references) //IL_000b: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Unknown result type (might be due to invalid IL or missing references) //IL_000d: Unknown result type (might be due to invalid IL or missing references) //IL_000e: Unknown result type (might be due to invalid IL or missing references) //IL_0013: Unknown result type (might be due to invalid IL or missing references) //IL_0014: Unknown result type (might be due to invalid IL or missing references) //IL_0015: Unknown result type (might be due to invalid IL or missing references) //IL_0016: Unknown result type (might be due to invalid IL or missing references) //IL_001b: Unknown result type (might be due to invalid IL or missing references) //IL_001c: Unknown result type (might be due to invalid IL or missing references) //IL_00ab: Unknown result type (might be due to invalid IL or missing references) //IL_00b0: Unknown result type (might be due to invalid IL or missing references) //IL_0043: Unknown result type (might be due to invalid IL or missing references) //IL_0048: Unknown result type (might be due to invalid IL or missing references) //IL_0083: Unknown result type (might be due to invalid IL or missing references) //IL_005d: Unknown result type (might be due to invalid IL or missing references) //IL_0067: Unknown result type (might be due to invalid IL or missing references) //IL_006c: Unknown result type (might be due to invalid IL or missing references) //IL_0071: Unknown result type (might be due to invalid IL or missing references) //IL_0088: Unknown result type (might be due to invalid IL or missing references) //IL_0109: Unknown result type (might be due to invalid IL or missing references) //IL_00e6: Unknown result type (might be due to invalid IL or missing references) //IL_00f2: Unknown result type (might be due to invalid IL or missing references) //IL_00f7: Unknown result type (might be due to invalid IL or missing references) //IL_00fc: Unknown result type (might be due to invalid IL or missing references) //IL_011a: Unknown result type (might be due to invalid IL or missing references) //IL_0120: Unknown result type (might be due to invalid IL or missing references) //IL_0125: Unknown result type (might be due to invalid IL or missing references) //IL_012a: Unknown result type (might be due to invalid IL or missing references) //IL_012f: Unknown result type (might be due to invalid IL or missing references) //IL_010e: Unknown result type (might be due to invalid IL or missing references) eyes = (centre = (feet = default(Vector3))); if (actor.IsPlayer) { PlayerControllerB val = Player(actor); if ((Object)(object)val == (Object)null) { return false; } feet = ((Component)val).transform.position; eyes = (((Object)(object)val.gameplayCamera != (Object)null) ? ((Component)val.gameplayCamera).transform.position : (feet + 1.6f * Vector3.up)); } else { EnemyAI val2 = Enemy(actor); if ((Object)(object)val2 == (Object)null) { return false; } feet = ((Component)val2).transform.position; float num = (((Object)(object)val2.agent != (Object)null) ? val2.agent.height : 1f); eyes = (((Object)(object)val2.eye != (Object)null) ? val2.eye.position : (feet + 0.85f * num * Vector3.up)); } centre = 0.5f * (eyes + feet); return true; } } public sealed class AnklagerAI : EnemyAI, IAnklagerJudgementGround<Vector3> { private readonly struct JudgementEnemyHit { internal readonly EnemyAI Enemy; internal readonly AnklagerActor Actor; internal readonly float Distance; internal readonly float Exposure; internal readonly Vector3 Centre; internal JudgementEnemyHit(EnemyAI enemy, AnklagerActor actor, float distance, float exposure, Vector3 centre) { //IL_001e: Unknown result type (might be due to invalid IL or missing references) //IL_0020: Unknown result type (might be due to invalid IL or missing references) Enemy = enemy; Actor = actor; Distance = distance; Exposure = exposure; Centre = centre; } } private struct WatcherTrack { internal AnklagerWatcherMemory Memory; internal Vector3 LastPos; internal Vector3 Lead; } private sealed class WatcherLineCaster : IAnklagerWatcherLineCaster { internal Vector3 Origin; internal Vector3 Direction; internal int Mask; public bool Nearest(float from, float length, out float distance, out bool character) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_000d: Unknown result type (might be due to invalid IL or missing references) //IL_0012: Unknown result type (might be due to invalid IL or missing references) //IL_0018: Unknown result type (might be due to invalid IL or missing references) RaycastHit val = default(RaycastHit); if (!Physics.Raycast(Origin + Direction * from, Direction, ref val, length, Mask, (QueryTriggerInteraction)1)) { distance = 0f; character = false; return false; } distance = ((RaycastHit)(ref val)).distance; Collider collider = ((RaycastHit)(ref val)).collider; character = (Object)(object)collider == (Object)null || (Object)(object)((Component)collider).GetComponentInParent<PlayerControllerB>() != (Object)null || (Object)(object)((Component)collider).GetComponentInParent<EnemyAI>() != (Object)null; return true; } } private enum WatcherTeleportPhase : byte { None, Out, In, Settle } private readonly IAnklagerBehaviour[] _behaviours = new IAnklagerBehaviour[10]; private AnklagerBrain _brain; private int _eyeModeSetAtEntry = -1; internal const string InputLockHolder = "Y4NGZAnklager"; private static readonly List<AnklagerAI> LiveList = new List<AnklagerAI>(); private readonly ServerOwnershipGuard _ownership = new ServerOwnershipGuard(); private bool _started; private bool _spawned; private bool _live; private bool _shutDown; private AnklagerFavorBeams _favorBeams; private AnklagerActor _favorGlance; private double _favorGlanceUntil; private static readonly HashSet<string> FaultedSites = new HashSet<string>(StringComparer.Ordinal); internal const float JudgementFaceDegreesPerSecond = 160f; private const float RebukeGlow = 0.85f; private const float RebukeFlash = 0.4f; private const float RebukeGuilt = 0.7f; private const float RebukeGuiltSeconds = 2.5f; private const float RebukeFreezeSeconds = 0.6f; private const float RebukeSlowFactor = 0.45f; private const float RebukeSlowSeconds = 2.5f; private const float FaceAtOnceDegrees = 180f; private const float JudgementResendMetres = 0.5f; private const int HauntMixerSnapshot = 1; private const float BodyPushSpeed = 6f; private const int BurntBody = 6; private const int KillOutright = -1; private const float MaxFreezeSeconds = 5f; private const float MaxSlowSeconds = 10f; private static readonly ulong[] JudgementSingleTarget = new ulong[1]; private static readonly List<JudgementEnemyHit> JudgementEnemyHits = new List<JudgementEnemyHit>(); private AnklagerJudgementClock _judgementClock; private Vector3 _judgementPointSent; private Vector3 _judgementDestinationSent; private AnklagerCreatureView _view; private const float MinPitch = 0.1f; private const float MaxPitch = 3f; private const float MaxBurstScale = 10f; private const float ClipFadeSeconds = 0.15f; private readonly NetworkVariable<AnklagerSnapshot> _snapshot = new NetworkVariable<AnklagerSnapshot>(AnklagerSnapshot.Initial, (NetworkVariableReadPermission)0, (NetworkVariableWritePermission)0); private AnklagerSnapshot _shown = AnklagerSnapshot.Initial; private AnklagerClip _shownClip; private const float WatcherLongAgo = -100000f; private const int WatcherFirstBufferLength = 8; private static readonly WatcherLineCaster WatcherLine = new WatcherLineCaster(); private readonly NetworkVariable<bool> _watcherOutside = new NetworkVariable<bool>(false, (NetworkVariableReadPermission)0, (NetworkVariableWritePermission)0); private float _watcherGaitSpeed; private Vector3 _watcherGaitLast; private bool _watcherHost; private IAnklagerWatcherDice _watcherDice; private AnklagerWatcherTargetChoice _watcherChoice; private AnklagerWatcherLook _watcherLook; private Dictionary<AnklagerActor, WatcherTrack> _watcherTracks; private HashSet<AnklagerActor> _watcherFighting; private List<AnklagerActor> _watcherGone; private AnklagerWatcherNearby[] _watcherNearby; private int _watcherNearbyCount; private AnklagerWatcherCandidate[] _watcherCandidates; private int _watcherCandidateCount; private bool _watcherSomeoneNearby; private float _watcherNextPerceive; private float _watcherNextTarget; private float _watcherGlow; private float _watcherAwakensAt; private bool _watcherAwakensSent; private AnklagerActor _watcherLookWritten; private IAnklagerWitness _watcherWitness; private readonly AnklagerWatcherHeardScene _watcherHeard = new AnklagerWatcherHeardScene(); private float _watcherNextWhisper; private const float WatcherRepathDistance = 0.5f; private const float WatcherArriveSlack = 0.25f; private const float WatcherSampleRadius = 3f; private const float WatcherShipMargin = 1f; private const float WatcherShipSampleRadius = 5f; private bool _watcherDestinationWaiting; private AnklagerWatcherStuck _watcherStuck; private bool _watcherLookingAround; private float _watcherLookYaw; private bool _watcherPointUnreachable; private readonly AnklagerWatcherShipWatch _watcherShipWatch = new AnklagerWatcherShipWatch(); private int _watcherFacingMoveFrame = -1; private const float WatcherSpotSampleRadius = 3f; private const float WatcherPassageProbe = 3f; private const float WatcherFeetLift = 0.2286f; private const int WatcherPathTries = 3; private const float WatcherTargetSampleRadius = 10f; private static readonly AnklagerWatcherSpot[] WatcherSpots = new AnklagerWatcherSpot[40]; private NavMeshPath _watcherPath; private float _watcherTeleportLast = -100000f; private float _watcherTeleportNext; private WatcherTeleportPhase _watcherTeleportPhase; private float _watcherTeleportPhaseEnds; private Vector3 _watcherTeleportTo; private bool _watcherTeleportOutside; private AnklagerActor _watcherTeleportFace; private AnklagerTeleportMode _watcherTeleportMode; private float _watcherTeleportRetryAt; private AnklagerTeleportMode _watcherTeleportRetryMode; private AnklagerActor _watcherTeleportRetryTarget; internal AnklagerBrain Brain => _brain; internal static IReadOnlyList<AnklagerAI> Live => LiveList; internal Transform Eyes { get; private set; } internal Transform HeadGlow { get; private set; } internal Transform HeadBone { get; private set; } internal Transform EyeBone { get; private set; } internal AnklagerJudgementClock JudgementClock => _judgementClock; internal AnklagerBlastTimes JudgementLastBlast { get; set; } internal double JudgementFiredAt { get; set; } internal bool JudgementBlastReady { get { if (_judgementClock != null) { return _judgementClock.BlastReady(Time.timeAsDouble); } return false; } } internal float JudgementSpeedFactor { get { if (_judgementClock == null) { return 1f; } return _judgementClock.SpeedFactor(Time.timeAsDouble); } } private ulong JudgementStrikerId => (ulong)((Object)this).GetInstanceID(); internal AnklagerSnapshot Snapshot => _snapshot.Value; internal AnklagerState State => _snapshot.Value.State; internal AnklagerStage Stage => _snapshot.Value.Stage; internal AnklagerActor Accused => _snapshot.Value.Accused; internal float ChargeProgress { get { //IL_0022: 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) if (!((NetworkBehaviour)this).IsSpawned) { return 0f; } AnklagerSnapshot value = _snapshot.Value; NetworkTime serverTime = ((NetworkBehaviour)this).NetworkManager.ServerTime; return value.ChargeProgress(((NetworkTime)(ref serverTime)).Time); } } internal bool WatcherHosting => _watcherHost; internal AnklagerActor WatcherTarget { get { if (!_watcherHost) { return AnklagerActor.None; } return _watcherChoice.Target; } } internal bool WatcherSomeoneNearby { get { if (_watcherHost) { return _watcherSomeoneNearby; } return false; } } internal Vector3 WatcherInvestigatePoint { get; private set; } internal bool WatcherTeleporting => _watcherTeleportPhase != WatcherTeleportPhase.None; internal void SetBehaviour(AnklagerState state, IAnklagerBehaviour behaviour) { if (behaviour != null) { if (_brain != null || _behaviours[(uint)state] != null) { Plugin.ErrorOnce("behaviour:" + state, string.Format("[{0}] The {1} behaviour was set twice or after the brain was built; the first one stays.", "Anklager", state)); } else { _behaviours[(uint)state] = behaviour; } } } private void HostCreateBrain() { Array.Clear(_behaviours, 0, _behaviours.Length); RaiseInstallBehaviours(); for (int i = 0; i < _behaviours.Length; i++) { if (_behaviours[i] == null) { _behaviours[i] = new AnklagerStandStill(this); } } _brain = new AnklagerBrain(_behaviours, AnklagerActors.Probe); } private void HostDestroyBrain() { if (_brain != null) { try { _brain.Shutdown(); } catch (Exception e) { Fault("Brain.Shutdown", e); } _brain = null; } } private void HostThink(float dt) { if (_brain == null) { return; } try { AnklagerBrainInputs inputs = default(AnklagerBrainInputs); inputs.Target = AnklagerSeams.Watcher.Target(this); inputs.TargetStage = AnklagerSeams.Ledger.Stage(this, inputs.Target); inputs.BlastReady = AnklagerSeams.Judgement.BlastReady(this); inputs.SomeoneNearby = AnklagerSeams.Watcher.SomeoneNearby(this); AnklagerState state = _brain.State; int entries = _brain.Entries; _brain.Tick(in inputs, dt); AnklagerSnapshot next = _snapshot.Value; next.State = _brain.State; next.Accused = (AnklagerActors.IsPresent(_brain.Subject) ? _brain.Subject : AnklagerActor.None); next.Stage = ((!next.Accused.IsNone) ? AnklagerSeams.Ledger.Stage(this, next.Accused) : AnklagerStage.Peaceful); if (_brain.Entries != entries && _eyeModeSetAtEntry != _brain.Entries) { next.EyeMode = AnklagerStates.DefaultEyeMode(next.State); } if (!next.LookAt.IsNone && !AnklagerActors.IsPresent(next.LookAt)) { next.LookAt = AnklagerActor.None; } HostWrite(in next); if (next.State != state && Plugin.ModConfig.DebugLogs.Value) { Plugin.Log.LogInfo((object)string.Format("[{0}] {1} -> {2} ({3}), accused {4}, stage {5}.", "Anklager", state, next.State, _brain.Drive, next.Accused, next.Stage)); } } catch (Exception e) { Fault("HostThink", e); try { _brain.Abort(); } catch (Exception e2) { Fault("Brain.Abort", e2); } } } internal static void ResetRoundState() { LiveList.RemoveAll((AnklagerAI ai) => (Object)(object)ai == (Object)null || !((NetworkBehaviour)ai).IsSpawned); } public override void OnNetworkSpawn() { ((NetworkBehaviour)this).OnNetworkSpawn(); if (!LiveList.Contains(this)) { LiveList.Add(this); } _spawned = true; _shown = _snapshot.Value; if (((NetworkBehaviour)this).IsServer) { HostCreateBrain(); } RaiseNetworkSpawn(); GoLive(); } public override void Start() { //IL_0009: Unknown result type (might be due to invalid IL or missing references) //IL_0013: Expected O, but got Unknown if (base.currentSearch == null) { base.currentSearch = new AISearchRoutine(); } ((EnemyAI)this).Start(); Transform parent = ((Component)this).transform.Find("VisualRoot"); HeadBone = PrefabPrep.FindChildRecursive(parent, "Star_Head"); EyeBone = PrefabPrep.FindChildRecursive(parent, "Star_Eye"); Eyes = PrefabPrep.FindChildRecursive(parent, "eyes"); HeadGlow = PrefabPrep.FindChildRecursive(parent, "head_glow"); base.moveTowardsDestination = false; base.movingTowardsTargetPlayer = false; HostStop(); _started = true; if (_spawned) { _shown = _snapshot.Value; } RaiseStart(); GoLive(); } public override void Update() { _ownership.Ensure((EnemyAI)(object)this, Plugin.Log); ((EnemyAI)this).Update(); if (_live) { float deltaTime = Time.deltaTime; if (((NetworkBehaviour)this).IsServer) { HostThink(deltaTime); } RaiseUpdate(deltaTime); ShowSnapshot(); } } private void LateUpdate() { if (_live) { RaiseLateUpdate(); } } public override void DoAIInterval() { ((EnemyAI)this).DoAIInterval(); if (((NetworkBehaviour)this).IsServer && _live) { RaiseAIInterval(); } } public override void HitEnemy(int force = 1, PlayerControllerB playerWhoHit = null, bool playHitSFX = false, int hitID = -1) { if (_live) { RaiseHit(force, playerWhoHit, hitID); } } public override void HitFromExplosion(float distance) { } public override void SetEnemyStunned(bool setToStunned, float setToStunTime = 1f, PlayerControllerB setStunnedByPlayer = null) { } public override void KillEnemy(bool destroy = false) { } public override void OnNetworkDespawn() { Shutdown(); ((NetworkBehaviour)this).OnNetworkDespawn(); } public override void OnDestroy() { Shutdown(); ((EnemyAI)this).OnDestroy(); } internal void HostStop() { if (((NetworkBehaviour)this).IsServer && !((Object)(object)base.agent == (Object)null)) { base.agent.speed = 0f; if (((Behaviour)base.agent).isActiveAndEnabled && base.agent.isOnNavMesh) { base.agent.isStopped = true; } } } private void GoLive() { if (!_live && _spawned && _started && !_shutDown) { _live = true; AnklagerSnapshot value = _snapshot.Value; if (value.Clip != AnklagerClip.Locomotion) { ShowClip(value.Clip, value.ClipSpeed); } } } private void Shutdown() { if (!_shutDown) { _shutDown = true; _live = false; HostDestroyBrain(); if (_spawned) { RaiseShutdown(); } LiveList.Remove(this); } } internal void FavorHostHeal(PlayerControllerB player, int amount, int request) { //IL_0026: Unknown result type (might be due to invalid IL or missing references) if (((NetworkBehaviour)this).IsServer && ((NetworkBehaviour)this).IsSpawned && (Object)(object)player != (Object)null && request != 0) { FavorHealClientRpc(player.playerClientId, amount, request, VictimRpc.TargetOwner(player)); } } internal void FavorHostShowHealth(PlayerControllerB player, int health, bool bless) { //IL_0064: Unknown result type (might be due to invalid IL or missing references) //IL_0069: Unknown result type (might be due to invalid IL or missing references) if (!((NetworkBehaviour)this).IsServer || !((NetworkBehaviour)this).IsSpawned) { return; } FavorHealthClientRpc(player.playerClientId, health, bless); if (bless) { HostPlaySound(AnklagerSound.Bless, 0.7f); HostRaiseGlow(0.3f); if (State == AnklagerState.Dormant || State == AnklagerState.Observing) { _favorGlance = AnklagerActors.From(player); NetworkTime serverTime = ((NetworkBehaviour)this).NetworkManager.ServerTime; _favorGlanceUntil = ((NetworkTime)(ref serverTime)).Time + 2.5; HostSetLookAt(_favorGlance); } } } [ClientRpc] private void FavorHealClientRpc(ulong slot, int amount, int request, ClientRpcParams rpcParams = default(ClientRpcParams)) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_00b3: Unknown result type (might be due to invalid IL or missing references) //IL_00bd: 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_008b: Unknown result type (might be due to invalid IL or missing references) //IL_00a3: Unknown result type (might be due to invalid IL or missing references) //IL_00e8: Unknown result type (might be due to invalid IL or missing references) //IL_0132: Unknown result type (might be due to invalid IL or missing references) //IL_0138: 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.IsServer || networkManager.IsHost)) { FastBufferWriter val = ((NetworkBehaviour)this).__beginSendClientRpc(3955631890u, rpcParams, (RpcDelivery)0); BytePacker.WriteValueBitPacked(val, slot); BytePacker.WriteValueBitPacked(val, amount); BytePacker.WriteValueBitPacked(val, request); ((NetworkBehaviour)this).__endSendClientRpc(ref val, 3955631890u, rpcParams, (RpcDelivery)0); } if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1 || (!networkManager.IsClient && !networkManager.IsHost)) { return; } ((NetworkBehaviour)this).__rpc_exec_stage = (__RpcExecStage)0; PlayerControllerB val2 = VictimRpc.LocalVictimFromSlot(slot); if (!((Object)(object)val2 == (Object)null) && !val2.isPlayerDead && val2.isPlayerControlled) { int num = AnklagerFavorLedger.HealedAmount(val2.health, amount); if (num > 0) { FavorHeal(val2, num); } FavorHealedServerRpc(slot, request, val2.health, num); } } [ServerRpc(RequireOwnership = false)] private void FavorHealedServerRpc(ulong slot, int request, int health, int healed, ServerRpcParams rpcParams = default(ServerRpcParams)) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_00c0: Unknown result type (might be due to invalid IL or missing references) //IL_00ca: 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_008b: Unknown result type (might be due to invalid IL or missing references) //IL_0098: Unknown result type (might be due to invalid IL or missing references) //IL_00b0: 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_0117: Unknown result type (might be due to invalid IL or missing references) //IL_0119: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager; if (networkManager == null || !networkManager.IsListening) { return; } if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1 && (networkManager.IsClient || networkManager.IsHost)) { FastBufferWriter val = ((NetworkBehaviour)this).__beginSendServerRpc(1533720048u, rpcParams, (RpcDelivery)0); BytePacker.WriteValueBitPacked(val, slot); BytePacker.WriteValueBitPacked(val, request); BytePacker.WriteValueBitPacked(val, health); BytePacker.WriteValueBitPacked(val, healed); ((NetworkBehaviour)this).__endSendServerRpc(ref val, 1533720048u, rpcParams, (RpcDelivery)0); } if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1 || (!networkManager.IsServer && !networkManager.IsHost)) { return; } ((NetworkBehaviour)this).__rpc_exec_stage = (__RpcExecStage)0; PlayerControllerB val2 = ((slot <= int.MaxValue) ? VictimRpc.FromSlot((int)slot) : null); if ((Object)(object)val2 == (Object)null || !VictimRpc.SenderOwnsSlot(rpcParams.Receive.SenderClientId, val2)) { return; } try { AnklagerSeams.FavorService.HostHealed(this, val2, request, Mathf.Clamp(health, 0, 100), healed); } catch (Exception e) { Fault("FavorHealed", e); } } [ClientRpc] private void FavorHealthClientRpc(ulong slot, int health, bool bless) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_00c1: Unknown result type (might be due to invalid IL or missing references) //IL_00cb: Invalid comparison between Unknown and I4 //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_006d: Unknown result type (might be due to invalid IL or missing references) //IL_0071: Unknown result type (might be due to invalid IL or missing references) //IL_007e: Unknown result type (might be due to invalid IL or missing references) //IL_0097: Unknown result type (might be due to invalid IL or missing references) //IL_009d: Unknown result type (might be due to invalid IL or missing references) //IL_00b1: Unknown result type (might be due to invalid IL or missing references) //IL_00f6: 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.IsServer || networkManager.IsHost)) { ClientRpcParams val2 = default(ClientRpcParams); FastBufferWriter val = ((NetworkBehaviour)this).__beginSendClientRpc(3409198432u, val2, (RpcDelivery)0); BytePacker.WriteValueBitPacked(val, slot); BytePacker.WriteValueBitPacked(val, health); ((FastBufferWriter)(ref val)).WriteValueSafe<bool>(ref bless, default(ForPrimitives)); ((NetworkBehaviour)this).__endSendClientRpc(ref val, 3409198432u, val2, (RpcDelivery)0); } if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1 || (!networkManager.IsClient && !networkManager.IsHost)) { return; } ((NetworkBehaviour)this).__rpc_exec_stage = (__RpcExecStage)0; PlayerControllerB val3 = ((slot <= int.MaxValue) ? VictimRpc.FromSlot((int)slot) : null); if ((Object)(object)val3 == (Object)null) { return; } if (!VictimRpc.IsVictimLocal(val3)) { val3.health = Mathf.Clamp(health, 0, 100); } if (bless) { if (_favorBeams == null) { _favorBeams = new AnklagerFavorBeams(((Component)this).transform); } _favorBeams.Show(AnklagerActors.From(val3), Time.time); } } private static void FavorHeal(PlayerControllerB player, int healed) { player.health += healed; if (player.criticallyInjured && player.health >= 20) { player.MakeCriticallyInjured(false); } GameNetworkManager instance = GameNetworkManager.Instance; HUDManager instance2 = HUDManager.Instance; if (!((Object)(object)instance2 == (Object)null) && !((Object)(object)instance == (Object)null) && !((Object)(object)player != (Object)(object)instance.localPlayerController)) { if (player.health >= 100) { instance2.UpdateHealthUI(99, false); } instance2.UpdateHealthUI(player.health, false); instance2.SetCracksOnVisor((float)player.health); } } private void WitnessNetworkSpawn() { if (((NetworkBehaviour)this).IsServer) { AnklagerSeams.WitnessService?.HostAddWatcher(this); } } private void WatcherNetworkSpawn() { if (_watcherHost) { IAnklagerWitness witness = AnklagerSeams.Witness; witness.Harmed += WatcherOnHarmed; witness.CrimeCommitted += WatcherOnCrimeCommitted; witness.CrimePerceived += WatcherOnCrimePerceived; witness.Forgiven += WatcherOnForgiven; _watcherWitness = witness; float time = Time.time; _watcherLook.BeginSurvey(time); _watcherAwakensAt = time + 1.5f; _watcherNextWhisper = time + 8f; WatcherStartTeleportClock(time); } } private void WatcherStart() { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Unknown result type (might be due to invalid IL or missing references) _watcherGaitLast = ((Component)this).transform.position; if (_watcherHost) { if ((Object)(object)base.agent != (Object)null) { base.agent.acceleration = 9.906f * Plugin.ModConfig.SpeedFactor.Value; base.agent.angularSpeed = 160f; base.agent.autoBraking = true; } _watcherOutside.Value = base.isOutside; } } private void PresentationStart() { _view = new AnklagerCreatureView(this); _view.PlayArrival(); } private void WatcherInstallBehaviours() { //IL_005b: Unknown result type (might be due to invalid IL or missing references) //IL_0065: Expected O, but got Unknown _watcherDice = new AnklagerWatcherRandomDice(); _watcherChoice = new AnklagerWatcherTargetChoice(); _watcherLook = new AnklagerWatcherLook(); _watcherTracks = new Dictionary<AnklagerActor, WatcherTrack>(); _watcherFighting = new HashSet<AnklagerActor>(); _watcherGone = new List<AnklagerActor>(); _watcherNearby = new AnklagerWatcherNearby[8]; _watcherCandidates = new AnklagerWatcherCandidate[8]; _watcherPath = new NavMeshPath(); _watcherHost = true; SetBehaviour(AnklagerState.Dormant, new AnklagerWatcherDormant(this, _watcherDice)); SetBehaviour(AnklagerState.Observing, new AnklagerWatcherObserving(this, _watcherDice)); SetBehaviour(AnklagerState.Suspicious, new AnklagerWatcherSuspicious(this, _watcherDice)); SetBehaviour(AnklagerState.Stalking, new AnklagerWatcherStalking(this, _watcherDice)); SetBehaviour(AnklagerState.Enraged, new AnklagerWatcherEnraged(this, _watcherDice)); } private void JudgementInstallBehaviours() { _judgementClock = new AnklagerJudgementClock(); _judgementClock.StartSpawnCooldown(Time.timeAsDouble); SetBehaviour(AnklagerState.Witnessing, new AnklagerJudgementWitnessing(this)); SetBehaviour(AnklagerState.Protecting, new AnklagerJudgementProtecting(this)); SetBehaviour(AnklagerState.Judging, new AnklagerJudgementJudging(this)); SetBehaviour(AnklagerState.Attacking, new AnklagerJudgementAttacking(this)); SetBehaviour(AnklagerState.Recovering, new AnklagerJudgementRecovering(this)); } private void WitnessUpdate(float dt) { if (((NetworkBehaviour)this).IsServer) { AnklagerSeams.WitnessService?.HostTick(); } } private void WatcherUpdate(float dt) { if (_watcherHost && ((NetworkBehaviour)this).IsServer && (Object)(object)base.agent != (Object)null) { base.agent.updateRotation = _watcherFacingMoveFrame != Time.frameCount; } bool value = _watcherOutside.Value; if (base.isOutside != value) { ((EnemyAI)this).SetEnemyOutside(value); } WatcherGait(dt); if (_watcherHost && ((NetworkBehaviour)this).IsServer) { float time = Time.time; WatcherTeleportStep(time); WatcherShipGuard(); if (time >= _watcherNextPerceive) { _watcherNextPerceive = time + 0.3f; WatcherPerceive(time); } if (time >= _watcherNextTarget) { _watcherNextTarget = time + 0.5f; WatcherChooseTarget(time); } WatcherGlowStep(dt); WatcherSurveyLine(time); WatcherWhisperStep(time); } } private void PresentationUpdate(float dt) { if (_view != null) { try { _view.Update(dt); } catch (Exception e) { Fault("PresentationView", e); } } if (((NetworkBehaviour)this).IsServer && Live.Count > 0 && (Object)(object)Live[0] == (Object)(object)this) { AnklagerLocalEffects.Instance.HostTick(this, Time.time); } } private void FavorUpdate(float dt) { //IL_0026: Unknown result type (might be due to invalid IL or missing references) //IL_002b: Unknown result type (might be due to invalid IL or missing references) if (!((NetworkBehaviour)this).IsServer) { return; } AnklagerSeams.FavorService.HostTick(); if (_favorGlance.IsNone) { return; } NetworkTime serverTime = ((NetworkBehaviour)this).NetworkManager.ServerTime; if (!(((NetworkTime)(ref serverTime)).Time < _favorGlanceUntil)) { if (Snapshot.LookAt == _favorGlance) { HostSetLookAt(AnklagerActor.None); } _favorGlance = AnklagerActor.None; } } private void PresentationLateUpdate() { if (_view != null) { _view.LateUpdate(Time.deltaTime); } } private void FavorLateUpdate() { if (_favorBeams != null) { _favorBeams.Draw(HeadGlow, Time.time); } } private void WatcherAIInterval() { if (!base.inSpecialAnimation) { _watcherDestinationWaiting = false; } } private void WitnessHit(int force, PlayerControllerB playerWhoHit, int hitID) { AnklagerWitnessService witnessService = AnklagerSeams.WitnessService; if (!((NetworkBehaviour)this).IsServer || witnessService == null || AnklagerSeams.Watcher.IsTeleporting(this)) { return; } AnklagerActor anklagerActor = AnklagerActors.From(playerWhoHit); if (witnessService.HostProvoke(this, anklagerActor, force)) { AnklagerBrain brain = Brain; if (brain != null && !brain.HasQueuedJudgement && State != AnklagerState.Attacking) { brain.QueueJudgement(anklagerActor); } } } private void WitnessShutdown() { AnklagerSeams.WitnessService?.RemoveWatcher(this); } private void WatcherShutdown() { if (_watcherWitness != null) { _watcherWitness.Harmed -= WatcherOnHarmed; _watcherWitness.CrimeCommitted -= WatcherOnCrimeCommitted; _watcherWitness.CrimePerceived -= WatcherOnCrimePerceived; _watcherWitness.Forgiven -= WatcherOnForgiven; _watcherWitness = null; } WatcherDropTeleport(); _watcherHost = false; } private void JudgementShutdown() { AnklagerJudgementPlayerHold.ReleaseOwnedBy(this); AnklagerJudgementService.Strikes.Forget(JudgementStrikerId); } private void PresentationShutdown() { if (((NetworkBehaviour)this).IsServer && Live.Count == 1 && (Object)(object)Live[0] == (Object)(object)this) { AnklagerLocalEffects.Instance.HostReset(); } if (_view != null) { _view.Shutdown(); } _view = null; } private void FavorShutdown() { if (_favorBeams != null) { _favorBeams.Destroy(); } _favorBeams = null; } internal static void Fault(string site, Exception e) { if (FaultedSites.Add(site)) { ManualLogSource log = Plugin.Log; if (log != null) { log.LogError((object)string.Format("[{0}] {1} failed; later failures there are not logged. {2}", "Anklager", site, e)); } } } private void RaiseNetworkSpawn() { try { WitnessNetworkSpawn(); } catch (Exception e) { Fault("WitnessNetworkSpawn", e); } try { WatcherNetworkSpawn(); } catch (Exception e2) { Fault("WatcherNetworkSpawn", e2); } try { } catch (Exception e3) { Fault("JudgementNetworkSpawn", e3); } try { } catch (Exception e4) { Fault("PresentationNetworkSpawn", e4); } try { } catch (Exception e5) { Fault("FavorNetworkSpawn", e5); } } private void RaiseStart() { try { } catch (Exception e) { Fault("WitnessStart", e); } try { WatcherStart(); } catch (Exception e2) { Fault("WatcherStart", e2); } try { } catch (Exception e3) { Fault("JudgementStart", e3); } try { PresentationStart(); } catch (Exception e4) { Fault("PresentationStart", e4); } try { } catch (Exception e5) { Fault("FavorStart", e5); } } private void RaiseInstallBehaviours() { try { WatcherInstallBehaviours(); } catch (Exception e) { Fault("WatcherInstallBehaviours", e); } try { JudgementInstallBehaviours(); } catch (Exception e2) { Fault("JudgementInstallBehaviours", e2); } } private void RaiseUpdate(float dt) { try { WitnessUpdate(dt); } catch (Exception e) { Fault("WitnessUpdate", e); } try { WatcherUpdate(dt); } catch (Exception e2) { Fault("WatcherUpdate", e2); } try { } catch (Exception e3) { Fault("JudgementUpdate", e3); } try { PresentationUpdate(dt); } catch (Exception e4) { Fault("PresentationUpdate", e4); } try { FavorUpdate(dt); } catch (Exception e5) { Fault("FavorUpdate", e5); } } private void RaiseLateUpdate() { try { } catch (Exception e) { Fault("WitnessLateUpdate", e); } try { } catch (Exception e2) { Fault("WatcherLateUpdate", e2); } try { } catch (Exception e3) { Fault("JudgementLateUpdate", e3); } try { PresentationLateUpdate(); } catch (Exception e4) { Fault("PresentationLateUpdate", e4); } try { FavorLateUpdate(); } catch (Exception e5) { Fault("FavorLateUpdate", e5); } } private void RaiseAIInterval() { try { } catch (Exception e) { Fault("WitnessAIInterval", e); } try { WatcherAIInterval(); } catch (Exception e2) { Fault("WatcherAIInterval", e2); } try { } catch (Exception e3) { Fault("JudgementAIInterval", e3); } try { } catch (Exception e4) { Fault("PresentationAIInterval", e4); } try { } catch (Exception e5) { Fault("FavorAIInterval", e5); } } private void RaiseHit(int force, PlayerControllerB playerWhoHit, int hitID) { try { WitnessHit(force, playerWhoHit, hitID); } catch (Exception e) { Fault("WitnessHit", e); } try { } catch (Exception e2) { Fault("WatcherHit", e2); } try { } catch (Exception e3) { Fault("JudgementHit", e3); } try { } catch (Exception e4) { Fault("PresentationHit", e4); } try { } catch (Exception e5) { Fault("FavorHit", e5); } } private void RaiseSnapshotChanged(in AnklagerSnapshot previous, in AnklagerSnapshot current) { try { } catch (Exception e) { Fault("WitnessSnapshotChanged", e); } try { } catch (Exception e2) { Fault("WatcherSnapshotChanged", e2); } try { } catch (Exception e3) { Fault("JudgementSnapshotChanged", e3); } try { } catch (Exception e4) { Fault("PresentationSnapshotChanged", e4); } try { } catch (Exception e5) { Fault("FavorSnapshotChanged", e5); } } private void RaiseShutdown() { try { WitnessShutdown(); } catch (Exception e) { Fault("WitnessShutdown", e); } try { WatcherShutdown(); } catch (Exception e2) { Fault("WatcherShutdown", e2); } try { JudgementShutdown(); } catch (Exception e3) { Fault("JudgementShutdown", e3); } try { PresentationShutdown(); } catch (Exception e4) { Fault("PresentationShutdown", e4); } try { FavorShutdown(); } catch (Exception e5) { Fault("FavorShutdown", e5); } } internal static void JudgementOnCrimePerceived(AnklagerAI anklager, AnklagerCrime crime) { try { if ((Object)(object)anklager != (Object)null) { anklager.JudgementReact(in crime); } } catch (Exception e) { Fault("JudgementOnCrimePerceived", e); } } internal static AnklagerBlastTimes JudgementBlastTimes(AnklagerBlastKind kind) { AnklagerConfig modConfig = Plugin.ModConfig; return new AnklagerBlastTimes(kind, modConfig.JudgementChargeSeconds.Value, modConfig.JudgementEscapeSeconds.Value, modConfig.BlastCooldownSeconds.Value, modConfig.EnragedDamageMultiplier.Value, modConfig.JudgementDamageMultiplier.Value); } internal float JudgementSpeed(bool hunting) { AnklagerConfig modConfig = Plugin.ModConfig; return (hunting ? modConfig.SpeedEnraged.Value : modConfig.SpeedStalking.Value) * modConfig.SpeedFactor.Value * JudgementSpeedFactor; } internal float JudgementTurnTowards(Vector3 point, float degreesPerSecond, float dt) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Unknown result type (might be due to invalid IL or missing references) //IL_0012: Unknown result type (might be due to invalid IL or missing references) //IL_0018: Unknown result type (might be due to invalid IL or missing references) //IL_001f: 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_0040: Unknown result type (might be due to invalid IL or missing references) //IL_0045: Unknown result type (might be due to invalid IL or missing references) //IL_0046: Unknown result type (might be due to invalid IL or missing references) //IL_004c: Unknown result type (might be due to invalid IL or missing references) //IL_008d: 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_0087: Unknown result type (might be due to invalid IL or missing references) Vector3 val = point - ((Component)this).transform.position; if (val.x * val.x + val.z * val.z < 0.0001f) { return 0f; } Vector3 eulerAngles = ((Component)this).transform.eulerAngles; float num = Mathf.Atan2(val.x, val.z) * 57.29578f; if (!AnklagerSeams.Watcher.IsTeleporting(this)) { eulerAngles.y = Mathf.MoveTowardsAngle(eulerAngles.y, num, degreesPerSecond * dt); ((Component)this).transform.eulerAngles = eulerAngles; } return Mathf.Abs(Mathf.DeltaAngle(eulerAngles.y, num)); } internal bool JudgementMoveTowards(Vector3 point, float speed, float toleranceMetres) { //IL_004e: Unknown result type (might be due to invalid IL or missing references) //IL_0053: Unknown result type (might be due to invalid IL or missing references) //IL_00b7: Unknown result type (might be due to invalid IL or missing references) //IL_00c0: 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_00c8: Unknown result type (might be due to invalid IL or missing references) //IL_00cd: Unknown result type (might be due to invalid IL or missing references) //IL_0087: Unknown result type (might be due to invalid IL or missing references) //IL_008d: Unknown result type (might be due to invalid IL or missing references) //IL_0099: Unknown result type (might be due to invalid IL or missing references) //IL_009b: Unknown result type (might be due to invalid IL or missing references) //IL_00a0: Unknown result type (might be due to invalid IL or missing references) //IL_00a5: Unknown result type (might be due to invalid IL or missing references) if (AnklagerSeams.Watcher.IsTeleporting(this)) { HostStop(); return false; } if (!((NetworkBehaviour)this).IsServer || (Object)(object)base.agent == (Object)null || !((Behaviour)base.agent).isActiveAndEnabled || !base.agent.isOnNavMesh) { return false; } if (!AnklagerJudgementMoves.TryDestination(this, ((Component)this).transform.position, point, toleranceMetres, out var destination)) { HostStop(); return false; } base.agent.isStopped = false; base.agent.speed = speed; if (base.moveTowardsDestination && base.destination == _judgementDestinationSent) { Vector3 val = destination - _judgementPointSent; if (((Vector3)(ref val)).sqrMagnitude <= 0.25f) { return true; } } ((EnemyAI)this).SetDestinationToPosition(destination, false); _judgementPointSent = destination; _judgementDestinationSent = base.destination; return true; } Vector3 IAnklagerJudgementGround<Vector3>.OutsideShip(Vector3 goal) { //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Unknown result type (might be due to invalid IL or missing references) return AnklagerSeams.Watcher.OutsideShip(this, goal); } float IAnklagerJudgementGround<Vector3>.SqrDistance(Vector3 a, Vector3 b) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Unknown result type (might be due to invalid IL or missing references) Vector3 val = a - b; return ((Vector3)(ref val)).sqrMagnitude; } internal bool HostJudgementTryRebuke(AnklagerActor actor) { //IL_0047: Unknown result type (might be due to invalid IL or missing references) //IL_008d: Unknown result type (might be due to invalid IL or missing references) //IL_0080: Unknown result type (might be due to invalid IL or missing references) if (!((NetworkBehaviour)this).IsServer || _judgementClock == null || !AnklagerActors.IsPresent(actor) || !AnklagerActors.TryGetPoints(actor, out var _, out var _, out var feet) || !_judgementClock.TryStartRebuke(Time.timeAsDouble)) { return false; } AnklagerSeams.Ledger.NoteRebuke(this, actor); JudgementTurnTowards(feet, 180f, 1f); HostPlaySound(AnklagerSound.Rebuke); HostBurst(AnklagerBurst.Rebuke, ((Object)(object)HeadGlow != (Object)null) ? HeadGlow.position : ((Component)this).transform.position); HostRaiseGlow(0.85f); if (actor.IsPlayer) { HostFlash(AnklagerActors.Player(actor), 0.4f, ring: false); AnklagerSeams.LocalEffects.HostSpikeGuilt(actor, 0.7f, 2.5f); } HostJudgementFreeze(actor, 0.6f, 0.45f, 2.5f); return true; } internal void HostJudgementFreeze(AnklagerActor actor, float freezeSeconds, float slowFactor, float slowSeconds) { //IL_0046: Unknown result type (might be due to invalid IL or missing references) if (!((NetworkBehaviour)this).IsServer || !((NetworkBehaviour)this).IsSpawned) { return; } if (actor.IsPlayer) { PlayerControllerB val = AnklagerActors.Player(actor); if ((Object)(object)val != (Object)null && val.isPlayerControlled && !val.isPlayerDead) { JudgementHoldClientRpc(val.playerClientId, freezeSeconds, slowFactor, slowSeconds, VictimRpc.TargetOwner(val)); } } else { EnemyAI val2 = AnklagerActors.Enemy(actor); if ((Object)(object)val2 != (Object)null && !val2.isEnemyDead) { JudgementStunEnemyClientRpc(((NetworkBehaviour)val2).NetworkObjectId, freezeSeconds); } } } internal void HostJudgementUnfreeze(AnklagerActor actor) { //IL_0038: Unknown result type (might be due to invalid IL or missing references) PlayerControllerB val = AnklagerActors.Player(actor); if (((NetworkBehaviour)this).IsServer && ((NetworkBehaviour)this).IsSpawned && (Object)(object)val != (Object)null && val.isPlayerControlled && !val.isPlayerDead) { JudgementUnfreezeClientRpc(val.playerClientId, VictimRpc.TargetOwner(val)); } } internal void HostJudgementFire(AnklagerActor target, in AnklagerBlastTimes times) { //IL_0022: Unknown result type (might be due to invalid IL or missing references) //IL_0027: Unknown result type (might be due to invalid IL or missing references) //IL_006c: Unknown result type (might be due to invalid IL or missing references) //IL_00dc: Unknown result type (might be due to invalid IL or missing references) //IL_00dd: Unknown result type (might be due to invalid IL or missing references) //IL_03bf: Unknown result type (might be due to invalid IL or missing references) //IL_0410: Unknown result type (might be due to invalid IL or missing references) //IL_0415: Unknown result type (might be due to invalid IL or missing references) //IL_0416: Unknown result type (might be due to invalid IL or missing references) //IL_041b: Unknown result type (might be due to invalid IL or missing references) //IL_041f: Unknown result type (might be due to invalid IL or missing references) //IL_0138: Unknown result type (might be due to invalid IL or missing references) //IL_0125: Unknown result type (might be due to invalid IL or missing references) //IL_013d: Unknown result type (might be due to invalid IL or missing references) //IL_0142: Unknown result type (might be due to invalid IL or missing references) //IL_0144: Unknown result type (might be due to invalid IL or missing references) //IL_0145: Unknown result type (might be due to invalid IL or missing references) //IL_0147: Unknown result type (might be due to invalid IL or missing references) //IL_014c: Unknown result type (might be due to invalid IL or missing references) //IL_0150: Unknown result type (might be due to invalid IL or missing references) //IL_029d: Unknown result type (might be due to invalid IL or missing references) //IL_029e: Unknown result type (might be due to invalid IL or missing references) //IL_02d6: Unknown result type (might be due to invalid IL or missing references) //IL_01d4: Unknown result type (might be due to invalid IL or missing references) //IL_01d6: Unknown result type (might be due to invalid IL or missing references) //IL_01d7: Unknown result type (might be due to invalid IL or missing references) //IL_01dc: Unknown result type (might be due to invalid IL or missing references) //IL_01e0: Unknown result type (might be due to invalid IL or missing references) //IL_01ea: Unknown result type (might be due to invalid IL or missing references) //IL_01f1: Unknown result type (might be due to invalid IL or missing references) Transform headGlow = HeadGlow; if (!((NetworkBehaviour)this).IsServer || !((NetworkBehaviour)this).IsSpawned || (Object)(object)headGlow == (Object)null) { return; } Vector3 position = headGlow.position; AnklagerConfig modConfig = Plugin.ModConfig; float value = modConfig.BlastRange.Value; bool value2 = modConfig.OneHitKill.Value; float value3 = modConfig.BlastDamage.Value; double timeAsDouble = Time.timeAsDouble; AnklagerJudgementStrikes strikes = AnklagerJudgementService.Strikes; ulong judgementStrikerId = JudgementStrikerId; HostBurst(AnklagerBurst.Blast, position, times.BurstScale); HostPlaySound(AnklagerSound.Blast, 1f, times.BlastPitch); PlayerControllerB[] array = (((Object)(object)StartOfRound.Instance != (Object)null) ? StartOfRound.Instance.allPlayerScripts : null); int num = 0; Vector3 feet; while (array != null && num < array.Length) { PlayerControllerB val = array[num]; AnklagerActor anklagerActor = AnklagerActors.From(val); if (AnklagerActors.IsPresent(anklagerActor) && AnklagerActors.TryGetPoints(anklagerActor, out var eyes, out var _, out feet)) { float num2 = Vector3.Distance(position, eyes); if (!(num2 > value * 1.15f)) { float num3 = AnklagerSeams.Judgement.Exposure(this, anklagerActor); if (!(num3 <= 0f)) { Vector3 val2 = (((Object)(object)val.gameplayCamera != (Object)null) ? ((Component)val.gameplayCamera).transform.forward : ((Component)val).transform.forward); feet = position - eyes; HostFlash(val, AnklagerJudgementRules.FlashStrength(Vector3.Dot(val2, ((Vector3)(ref feet)).normalized), num2, value, num3, times.FlashFactor), anklagerActor == target); if (AnklagerJudgementRules.IsHit(anklagerActor == target, AnklagerSeams.Ledger.IsKnownGuilty(this, anklagerActor), num2, value, num3)) { int num4 = (value2 ? (-1) : AnklagerJudgementRules.PlayerDamage(AnklagerJudgementRules.Damage(value3, times.DamageMultiplier, num2, value, num3))); if (num4 != 0) { try { strikes.Record(anklagerActor, judgementStrikerId, timeAsDouble); ulong playerClientId = val.playerClientId; feet = eyes - position; JudgementStrikePlayerClientRpc(playerClientId, num4, ((Vector3)(ref feet)).normalized * 6f, VictimRpc.TargetOwner(val)); } catch (Exception e) { Fault("JudgementStrikePlayer", e); } } } } } } num++; } RoundManager instance = RoundManager.Instance; if ((Object)(object)instance == (Object)null) { return; } try { List<EnemyAI> spawnedEnemies = instance.SpawnedEnemies; for (int i = 0; i < spawnedEnemies.Count; i++) { EnemyAI val3 = spawnedEnemies[i]; AnklagerActor anklagerActor2 = AnklagerActors.From(val3); if (anklagerActor2.IsNone || val3.isEnemyDead || !AnklagerJudgementService.CanBeJudged(val3) || (anklagerActor2 != target && !AnklagerSeams.Ledger.IsKnownGuilty(this, anklagerActor2)) || !AnklagerActors.TryGetPoints(anklagerActor2, out var eyes2, out var centre2, out feet)) { continue; } float num5 = Vector3.Distance(position, eyes2); if (!(num5 > value)) { float exposure = AnklagerSeams.Judgement.Exposure(this, anklagerActor2); if (AnklagerJudgementRules.IsHit(isTarget: true, knownGuilty: true, num5, value, exposure)) { JudgementEnemyHits.Add(new JudgementEnemyHit(val3, anklagerActor2, num5, exposure, centre2)); } } } bool value4 = modConfig.RemoveUnkillableEnemies.Value; for (int j = 0; j < JudgementEnemyHits.Count; j++) { JudgementEnemyHit judgementEnemyHit = JudgementEnemyHits[j]; EnemyAI enemy = judgementEnemyHit.Enemy; if ((Object)(object)enemy == (Object)null || enemy.isEnemyDead) { continue; } try { switch (AnklagerJudgementRules.EnemyFate(value2, enemy.enemyType.canDie, enemy.enemyType.canBeDestroyed, AnklagerJudgementService.Removal(enemy), value4)) { case AnklagerEnemyFate.Killed: strikes.Record(judgementEnemyHit.Actor, judgementStrikerId, timeAsDouble); HostJudgementKillEnemy(enemy, remove: false); break; case AnklagerEnemyFate.Removed: strikes.Record(judgementEnemyHit.Actor, judgementStrikerId, timeAsDouble); HostJudgementKillEnemy(enemy, remove: true); HostBurst(AnklagerBurst.Death, judgementEnemyHit.Centre); break; case AnklagerEnemyFate.Damaged: { int num6 = AnklagerJudgementRules.EnemyForce(AnklagerJudgementRules.Damage(value3, times.DamageMultiplier, judgementEnemyHit.Distance, value, judgementEnemyHit.Exposure)); if (num6 > 0) { strikes.Record(judgementEnemyHit.Actor, judgementStrikerId, timeAsDouble); feet = judgementEnemyHit.Centre - position; enemy.HitEnemyOnLocalClient(num6, ((Vector3)(ref feet)).normalized, (PlayerControllerB)null, true, -1); } break; } } } catch (Exception e2) { Fault("JudgementStrikeEnemy", e2); } } } finally { JudgementEnemyHits.Clear(); } } private void HostJudgementKillEnemy(EnemyAI enemy, bool remove) { //IL_00a3: 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) //IL_00bf: Unknown result type (might be due to invalid IL or missing references) //IL_00c0: Unknown result type (might be due to invalid IL or missing references) //IL_00c5: Unknown result type (might be due to invalid IL or missing references) //IL_004a: Unknown result type (might be due to invalid IL or missing references) if (remove && !enemy.enemyType.canBeDestroyed) { if (AnklagerJudgementService.Removal(enemy) == AnklagerEnemyRemoval.Audited) { DressGirlAI val = (DressGirlAI)(object)((enemy is DressGirlAI) ? enemy : null); if (val != null && (Object)(object)val.hauntingPlayer != (Object)null) { JudgementEndHauntClientRpc(val.hauntingPlayer.playerClientId, ((NetworkBehaviour)enemy).NetworkObjectId, VictimRpc.TargetOwner(val.hauntingPlayer)); } if ((Object)(object)((NetworkBehaviour)enemy).NetworkObject != (Object)null && ((NetworkBehaviour)enemy).NetworkObject.IsSpawned) { ((NetworkBehaviour)enemy).NetworkObject.Despawn(true); } } } else if (((NetworkBehaviour)enemy).IsOwner) { enemy.KillEnemyOnOwnerClient(remove); } else { JudgementSingleTarget[0] = ((NetworkBehaviour)enemy).OwnerClientId; JudgementKillEnemyClientRpc(((NetworkBehaviour)enemy).NetworkObjectId, remove, new ClientRpcParams { Send = new ClientRpcSendParams { TargetClientIds = JudgementSingleTarget } }); } } private void JudgementReact(in AnklagerCrime crime) { if (((NetworkBehaviour)this).IsServer && _brain != null && _judgementClock != null && !crime.Offender.IsNone) { double timeAsDouble = Time.timeAsDouble; switch (AnklagerJudgementRules.ChooseReaction(crime.Kind, crime.Perception == AnklagerPerception.Seen, crime.Repeat, crime.VictimFavored, AnklagerJudgementRules.IsBusy(_brain.State), _brain.HasQueuedWitness, _judgementClock.ProtectReady(crime.Offender, timeAsDouble), AnklagerSeams.Ledger.Stage(this, crime.Offender), AnklagerActors.IsPresent(crime.Victim))) { case AnklagerReactionChoice.GraveWitness: _brain.QueueWitness(new AnklagerReaction(crime.Offender, crime.Victim, grave: true)); break; case AnklagerReactionChoice.Protect: _brain.QueueProtect(new AnklagerReaction(crime.Offender, crime.Victim, grave: false)); _judgementClock.StartProtectCooldown(crime.Offender, timeAsDouble); break; case AnklagerReactionChoice.LightNotice: _brain.QueueWitness(new AnklagerReaction(crime.Offender, crime.Victim, grave: false)); break; } } } private static EnemyAI JudgementLivingEnemy(ulong enemyId) { EnemyAI val = AnklagerActors.Enemy(AnklagerActor.Enemy(enemyId)); if (!((Object)(object)val == (Object)null) && !(val is AnklagerAI) && !val.isEnemyDead) { return val; } return null; } [ClientRpc] private void JudgementHoldClientRpc(ulong slot, float freezeSeconds, float slowFactor, float slowSeconds, ClientRpcParams rpcParams = default(ClientRpcParams)) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_00ea: Unknown result type (might be due to invalid IL or missing references) //IL_00f4: Invalid comparison between Unknown and I4 //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_006d: Unknown result type (might be due to invalid IL or missing references) //IL_0071: Unknown result type (might be due to invalid IL or missing references) //IL_008a: Unknown result type (might be due to invalid IL or missing references) //IL_0090: Unknown result type (might be due to invalid IL or missing references) //IL_00a5: Unknown result type (might be due to invalid IL or missing references) //IL_00ab: Unknown result type (might be due to invalid IL or missing references) //IL_00c0: 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_00da: Unknown result type (might be due to invalid IL or missing references) //IL_011f: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager; if (networkManager == null || !networkManager.IsListening) { return; } if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1 && (networkManager.IsServer || networkManager.IsHost)) { FastBufferWriter val = ((NetworkBehaviour)this).__beginSendClientRpc(736527067u, rpcParams, (RpcDelivery)0); BytePacker.WriteValueBitPacked(val, slot); ((FastBufferWriter)(ref val)).WriteValueSafe<float>(ref freezeSeconds, default(ForPrimitives)); ((FastBufferWriter)(ref val)).WriteValueSafe<float>(ref slowFactor, default(ForPrimitives)); ((FastBufferWriter)(ref val)).WriteValueSafe<float>(ref slowSeconds, default(ForPrimitives)); ((NetworkBehaviour)this).__endSendClientRpc(ref val, 736527067u, rpcParams, (RpcDelivery)0); } if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsClient || networkManager.IsHost)) { ((NetworkBehaviour)this).__rpc_exec_stage = (__RpcExecStage)0; PlayerControllerB val2 = VictimRpc.LocalVictimFromSlot(slot); if (!((Object)(object)val2 == (Object)null) && !val2.isPlayerDead && !_shutDown) { AnklagerJudgementPlayerHold.Apply(this, val2, AnklagerSnapshot.Sane(freezeSeconds, 0f, 5f), AnklagerSnapshot.Sane(slowFactor, 0f, 1f), AnklagerSnapshot.Sane(slowSeconds, 0f, 10f)); } } } [ClientRpc] private void JudgementUnfreezeClientRpc(ulong slot, ClientRpcParams rpcParams = default(ClientRpcParams)) { //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_00ce: 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.IsServer || networkManager.IsHost)) { FastBufferWriter val = ((NetworkBehaviour)this).__beginSendClientRpc(3330632413u, rpcParams, (RpcDelivery)0); BytePacker.WriteValueBitPacked(val, slot); ((NetworkBehaviour)this).__endSendClientRpc(ref val, 3330632413u, rpcParams, (RpcDelivery)0); } if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsClient || networkManager.IsHost)) { ((NetworkBehaviour)this).__rpc_exec_stage = (__RpcExecStage)0; PlayerControllerB val2 = VictimRpc.LocalVictimFromSlot(slot); if ((Object)(object)val2 != (Object)null) { AnklagerJudgementPlayerHold.Unfreeze(this, val2); } } } [ClientRpc] private void JudgementStrikePlayerClientRpc(ulong slot, int damage, Vector3 push, ClientRpcParams rpcParams = default(ClientRpcParams)) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_00b3: Unknown result type (might be due to invalid IL or missing references) //IL_00bd: 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_00a3: Unknown result type (might be due to invalid IL or missing references) //IL_00e8: Unknown result type (might be due to invalid IL or missing references) //IL_010e: 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) //IL_0119: Unknown result type (might be due to invalid IL or missing references) //IL_0126: Unknown result type (might be due to invalid IL or missing references) //IL_012d: Unknown result type (might be due to invalid IL or missing references) //IL_0133: Unknown result type (might be due to invalid IL or missing references) //IL_0147: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager; if (networkManager == null || !networkManager.IsListening) { return; } if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1 && (networkManager.IsServer || networkManager.IsHost)) { FastBufferWriter val = ((NetworkBehaviour)this).__beginSendClientRpc(2292706075u, rpcParams, (RpcDelivery)0); BytePacker.WriteValueBitPacked(val, slot); BytePacker.WriteValueBitPacked(val, damage); ((FastBufferWriter)(ref val)).WriteValueSafe(ref push); ((NetworkBehaviour)this).__endSendClientRpc(ref val, 2292706075u, rpcParams, (RpcDelivery)0); } if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1 || (!networkManager.IsClient && !networkManager.IsHost)) { return; } ((NetworkBehaviour)this).__rpc_exec_stage = (__RpcExecStage)0; PlayerControllerB val2 = VictimRpc.LocalVictimFromSlot(slot); if (!((Object)(object)val2 == (Object)null) && !val2.isPlayerDead && val2.isPlayerControlled) { push = Vector3.ClampMagnitude(push, 6f); if (damage < 0) { AnklagerJudgementPlayerHold.Release(val2); val2.KillPlayer(push, true, (CauseOfDeath)13, 6, default(Vector3), false); } else if (damage > 0) { val2.DamagePlayer(damage, true, true, (CauseOfDeath)13, 6, false, push); } } } [ClientRpc] private void JudgementKillEnemyClientRpc(ulong enemyId, bool remove, ClientRpcParams rpcParams = default(ClientRpcParams)) { //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) //IL_00e9: 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.IsServer || networkManager.IsHost)) { FastBufferWriter val = ((NetworkBehaviour)this).__beginSendClientRpc(3192034420u, rpcParams, (RpcDelivery)0); BytePacker.WriteValueBitPacked(val, enemyId); ((FastBufferWriter)(ref val)).WriteValueSafe<bool>(ref remove, default(ForPrimitives)); ((NetworkBehaviour)this).__endSendClientRpc(ref val, 3192034420u, rpcParams, (RpcDelivery)0); } if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1 || (!networkManager.IsClient && !networkManager.IsHost)) { return; } ((NetworkBehaviour)this).__rpc_exec_stage = (__RpcExecStage)0; EnemyAI val2 = JudgementLivingEnemy(enemyId); if ((Object)(object)val2 == (Object)null) { return; } try { if (((NetworkBehaviour)val2).IsOwner) { val2.KillEnemyOnOwnerClient(remove); } else { val2.KillEnemyServerRpc(remove || ((Object)(object)val2.enemyType != (Object)null && val2.enemyType.destroyOnDeath)); } } catch (Exception e) { Fault("JudgementKillEnemy", e); } } [ClientRpc] private void JudgementEndHauntClientRpc(ulong slot, ulong girlId, ClientRpcParams rpcParams = default(ClientRpcParams)) { //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) //IL_00db: 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.IsServer || networkManager.IsHost)) { FastBufferWriter val = ((NetworkBehaviour)this).__beginSendClientRpc(2108918948u, rpcParams, (RpcDelivery)0); BytePacker.WriteValueBitPacked(val, slot); BytePacker.WriteValueBitPacked(val, girlId); ((NetworkBehaviour)this).__endSendClientRpc(ref val, 2108918948u, rpcParams, (RpcDelivery)0); } if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1 || (!networkManager.IsClient && !networkManager.IsHost)) { return; } ((NetworkBehaviour)this).__rpc_exec_stage = (__RpcExecStage)0; if ((Object)(object)VictimRpc.LocalVictimFromSlot(slot) == (Object)null) { return; } try { EnemyAI obj = AnklagerActors.Enemy(AnklagerActor.Enemy(girlId)); DressGirlAI val2 = (DressGirlAI)(object)((obj is DressGirlAI) ? obj : null); if (val2 != null) { ((Behaviour)val2).enabled = false; } SoundManager instance = SoundManager.Instance; if ((Object)(object)instance != (Object)null && instance.currentMixerSnapshotID == 1) { instance.SetDiageticMixerSnapshot(0, 1f); } } catch (Exception e) { Fault("JudgementEndHaunt", e); } } [ClientRpc] private void JudgementStunEnemyClientRpc(ulong enemyId, float seconds) { //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) //IL_00e9: 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.IsServer || networkManager.IsHost)) { ClientRpcParams val2 = default(ClientRpcParams); FastBufferWriter val = ((NetworkBehaviour)this).__beginSendClientRpc(2477707380u, val2, (RpcDelivery)0); BytePacker.WriteValueBitPacked(val, enemyId); ((FastBufferWriter)(ref val)).WriteValueSafe<float>(ref seconds, default(ForPrimitives)); ((NetworkBehaviour)this).__endSendClientRpc(ref val, 2477707380u, val2, (RpcDelivery)0); } if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1 || (!networkManager.IsClient && !networkManager.IsHost)) { return; } ((NetworkBehaviour)this).__rpc_exec_stage = (__RpcExecStage)0; EnemyAI val3 = JudgementLivingEnemy(enemyId); if ((Object)(object)val3 == (Object)null) { return; } try { val3.SetEnemyStunned(true, AnklagerSnapshot.Sane(seconds, 0f, 5f), (PlayerControllerB)null); } catch (Exception e) { Fault("JudgementStunEnemy", e); } } internal void PresentationPlaySound(AnklagerSound sound, float volume, float pitch) { if (_view != null) { _view.PlaySound(sound, volume, pitch); } } internal void HostPlaySound(AnklagerSound sound, float volume = 1f, float pitch = 1f) { if (((NetworkBehaviour)this).IsServer && _live) { PlaySoundClientRpc((byte)sound, volume, pitch); } } internal void HostBurst(AnklagerBurst kind, Vector3 position, float scale = 1f) { //IL_0012: Unknown result type (might be due to invalid IL or missing references) if (((NetworkBehaviour)this).IsServer && _live) { BurstClientRpc((byte)kind, position, scale); } } internal void HostFlash(PlayerControllerB player, float strength, bool ring) { //IL_0013: Unknown result type (might be due to invalid IL or missing references) if (HostMaySendTo(player)) { FlashClientRpc(player.playerClientId, strength, ring, VictimRpc.TargetOwner(player)); } } internal void HostSendGuilt(PlayerControllerB player, in AnklagerGuiltState state) { //IL_002f: Unknown result type (might be due to invalid IL or missing references) if (HostMaySendTo(player)) { GuiltClientRpc(player.playerClientId, state.Intensity, (byte)state.Stage, (byte)state.KnownStage, state.Judgement, state.Paralysed, VictimRpc.TargetOwner(player)); } } private bool HostMaySendTo(PlayerControllerB player) { if (((NetworkBehaviour)this).IsServer && ((NetworkBehaviour)this).IsSpawned && (Object)(object)player != (Object)null && player.isPlayerControlled && !player.isPlayerDead) { return !VictimRpc.IsHostDummy(player); } return false; } private static PlayerControllerB LocalPlayerInSlot(ulong slot) { GameNetworkManager instance = GameNetworkManager.Instance; PlayerControllerB val = (((Object)(object)instance != (Object)null) ? instance.localPlayerController : null); if (!((Object)(object)val != (Object)null) || val.playerClientId != slot || val.isPlayerDead) { return null; } return val; } [ClientRpc] private void PlaySoundClientRpc(byte sound, float volume, float pitch) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_00dd: Unknown result type (might be due to invalid IL or missing references) //IL_00e7: Invalid comparison between Unknown and I4 //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_006d: Unknown result type (might be due to invalid IL or missing references) //IL_007d: Unknown result type (might be due to invalid IL or missing references) //IL_0083: Unknown result type (might be due to invalid IL or missing references) //IL_0098: Unknown result type (might be due to invalid IL or missing references) //IL_009e: Unknown result type (might be due to invalid IL or missing references) //IL_00b3: Unknown result type (might be due to invalid IL or missing references) //IL_00b9: Unknown result type (might be due to invalid IL or missing references) //IL_00cd: 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) NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager; if (networkManager == null || !networkManager.IsListening) { return; } if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1 && (networkManager.IsServer || networkManager.IsHost)) { ClientRpcParams val2 = default(ClientRpcParams); FastBufferWriter val = ((NetworkBehaviour)this).__beginSendClientRpc(453834350u, val2, (RpcDelivery)0); ((FastBufferWriter)(ref val)).WriteValueSafe<byte>(ref sound, default(ForPrimitives)); ((FastBufferWriter)(ref val)).WriteValueSafe<float>(ref volume, default(ForPrimitives)); ((FastBufferWriter)(ref val)).WriteValueSafe<float>(ref pitch, default(ForPrimitives)); ((NetworkBehaviour)this).__endSendClientRpc(ref val, 453834350u, val2, (RpcDelivery)0); } if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1 || (!networkManager.IsClient && !networkManager.IsHost)) { return; } ((NetworkBehaviour)this).__rpc_exec_stage = (__RpcExecStage)0; if (!_live || sound >= AnklagerAssetNames.SoundCount) { return; } try { AnklagerSeams.LocalEffects.ReceiveSound(this, (AnklagerSound)sound, AnklagerSnapshot.Sane(volume, 0f, 1f), AnklagerSnapshot.Sane(pitch, 0.1f, 3f)); } catch (Exception e) { Fault("ReceiveSound", e); } } [ClientRpc] private void BurstClientRpc(byte kind, Vector3 position, float scale) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_00cf: Unknown result type (might be due to invalid IL or missing references) //IL_00d9: Invalid comparison between Unknown and I4 //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_006d: Unknown result type (might be due to invalid IL or missing references) //IL_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_00a5: Unknown result type (might be due to invalid IL or missing references) //IL_00ab: Unknown result type (might be due to invalid IL or missing references) //IL_00bf: Unknown result type (might be due to invalid IL or missing references) //IL_0104: Unknown result type (might be due to invalid IL or missing references) //IL_011d: 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.IsServer || networkManager.IsHost)) { ClientRpcParams val2 = default(ClientRpcParams); FastBufferWriter val = ((NetworkBehaviour)this).__beginSendClientRpc(958961535u, val2, (RpcDelivery)0); ((FastBufferWriter)(ref val)).WriteValueSafe<byte>(ref kind, default(ForPrimitives)); ((FastBufferWriter)(ref val)).WriteValueSafe(ref position); ((FastBufferWriter)(ref val)).WriteValueSafe<float>(ref scale, default(ForPrimitives)); ((NetworkBehaviour)this).__endSendClientRpc(ref val, 958961535u, val2, (RpcDelivery)0); } if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1 || (!networkManager.IsClient && !networkManager.IsHost)) { return; } ((NetworkBehaviour)this).__rpc_exec_stage = (__RpcExecStage)0; if (!_live || kind > 4) { return; } try { AnklagerSeams.LocalEffects.ReceiveBurst((AnklagerBurst)kind, position, AnklagerSnapshot.Sane(scale, 0f, 10f)); } catch (Exception e) { Fault("ReceiveBurst", e); } } [ClientRpc] private void FlashClientRpc(ulong slot, float strength, bool ring, ClientRpcParams rpcParams = default(ClientRpcParams)) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_00cf: Unknown result type (might be due to invalid IL or missing references) //IL_00d9: Invalid comparison between Unknown and I4 //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_006d: Unknown result type (might be due to invalid IL or missing references) //IL_0071: Unknown result type (might be due to invalid IL or missing references) //IL_008a: Unknown result type (might be due to invalid IL or missing references) //IL_0090: Unknown result type (might be due to invalid IL or missing references) //IL_00a5: Unknown result type (might be due to invalid IL or missing references) //IL_00ab: Unknown result type (might be due to invalid IL or missing references) //IL_00bf: Unknown result type (might be due to invalid IL or missing references) //IL_0104: 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.IsServer || networkManager.IsHost)) { FastBufferWriter val = ((NetworkBehaviour)this).__beginSendClientRpc(758304706u, rpcParams, (RpcDelivery)0); BytePacker.WriteValueBitPacked(val, slot); ((FastBufferWriter)(ref val)).WriteValueSafe<float>(ref strength, default(ForPrimitives)); ((FastBufferWriter)(ref val)).WriteValueSafe<bool>(ref ring, default(ForPrimitives)); ((NetworkBehaviour)this).__endSendClientRpc(ref val, 758304706u, rpcParams, (RpcDelivery)0); } if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1 || (!networkManager.IsClient && !networkManager.IsHost)) { return; } ((NetworkBehaviour)this).__rpc_exec_stage = (__RpcExecStage)0; if ((Object)(object)LocalPlayerInSlot(slot) == (Object)null) { return; } try { AnklagerSeams.LocalEffects.ReceiveFlash(AnklagerSnapshot.Sane(strength, 0f, 1f), ring); } catch (Exception e) { Fault("ReceiveFlash", e); } } [ClientRpc] private void GuiltClientRpc(ulong slot, float intensity, byte stage, byte knownStage, float judgement, bool paralysed, ClientRpcParams rpcParams = default(ClientRpcParams)) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_0120: Unknown result type (might be due to invalid IL or missing references) //IL_012a: Invalid comparison between Unknown and I4 //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_006d: Unknown result type (might be due to invalid IL or missing references) //IL_0071: Unknown result type (might be due to invalid IL or missing references) //IL_008a: Unknown result type (might be due to invalid IL or missing references) //IL_0090: Unknown result type (might be due to invalid IL or missing references) //IL_00a5: Unknown result type (might be due to invalid IL or missing references) //IL_00ab: Unknown result type (might be due to invalid IL or missing references) //IL_00c0: 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_00db: 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) //IL_00f6: Unknown result type (might be due to invalid IL or missing references) //IL_00fc: Unknown result type (might be due to invalid IL or missing references) //IL_0110: Unknown result type (might be due to invalid IL or missing references) //IL_0155: 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.IsServer || networkManager.IsHost)) { FastBufferWriter val = ((NetworkBehaviour)this).__beginSendClientRpc(3116442938u, rpcParams, (RpcDelivery)0); BytePacker.WriteValueBitPacked(val, slot); ((FastBufferWriter)(ref val)).WriteValueSafe<float>(ref intensity, default(ForPrimitives)); ((FastBufferWriter)(ref val)).WriteValueSafe<byte>(ref stage, default(ForPrimitives)); ((FastBufferWriter)(ref val)).WriteValueSafe<byte>(ref knownStage, default(ForPrimitives)); ((FastBufferWriter)(ref val)).WriteValueSafe<float>(ref judgement, default(ForPrimitives)); ((FastBufferWriter)(ref val)).WriteValueSafe<bool>(ref paralysed, default(ForPrimitives)); ((NetworkBehaviour)this).__endSendClientRpc(ref val, 3116442938u, rpcParams, (RpcDelivery)0); } if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1 || (!networkManager.IsClient && !networkManager.IsHost)) { return; } ((NetworkBehaviour)this).__rpc_exec_stage = (__RpcExecStage)0; if ((Object)(object)LocalPlayerInSlot(slot) == (Object)null || stage > 4 || knownStage > 4) { return; } try { AnklagerSeams.LocalEffects.ReceiveGuilt(new AnklagerGuiltState(AnklagerSnapshot.Sane(intensity, 0f, 1f), (AnklagerStage)stage, (AnklagerStage)knownStage, AnklagerSnapshot.Sane(judgement, 0f, 1f), paralysed)); } catch (Exception e) { Fault("ReceiveGuilt", e); } } internal void HostSetEyeMode(AnklagerEyeMode mode) { if (_brain != null) { _eyeModeSetAtEntry = _brain.Entries; } AnklagerSnapshot next = _snapshot.Value; next.EyeMode = mode; HostWrite(in next); } internal void HostPlayClip(AnklagerClip clip, float speed = 1f) { AnklagerSnapshot next = _snapshot.Value; next.Clip = clip; next.ClipSpeed = AnklagerSnapshot.Sane(speed, 0f, 10f); HostWrite(in next); } internal void HostSetGlow(float glow) { AnklagerSnapshot next = _snapshot.Value; next.Glow = Mathf.Round(AnklagerSnapshot.Sane(glow, 0f, 1f) * 100f) / 100f; HostWrite(in next); } internal void HostRaiseGlow(float minimum) { if (_snapshot.Value.Glow < minimum) { HostSetGlow(minimum); } } internal void HostSetFade(float fade) { AnklagerSnapshot next = _snapshot.Value; next.Fade = AnklagerSnapshot.Sane(fade, 0f, 1f); HostWrite(in next); } internal void HostSetLookAt(AnklagerActor actor) { AnklagerSnapshot next = _snapshot.Value; next.LookAt = actor; HostWrite(in next); } internal void HostStartCharge(float seconds) { //IL_0025: Unknown result type (might be due to invalid IL or missing references) //IL_002a: Unknown result type (might be due to invalid IL or missing references) if (((NetworkBehaviour)this).IsServer && ((NetworkBehaviour)this).IsSpawned) { AnklagerSnapshot next = _snapshot.Value; NetworkTime serverTime = ((NetworkBehaviour)this).NetworkManager.ServerTime; next.ChargeStart = ((NetworkTime)(ref serverTime)).Time; next.ChargeLength = AnklagerSnapshot.Sane(seconds, 0f, 60f); HostWrite(in next); } } internal void HostEndCharge() { AnklagerSnapshot next = _snapshot.Value; next.ChargeStart = 0.0; next.ChargeLength = 0f; HostWrite(in next); } internal void ShowClip(AnklagerClip clip, float speed) { string text = AnklagerAssetNames.StateName(clip); if (!((Object)(object)base.creatureAnimator == (Object)null) && text != null) { base.creatureAnimator.speed = speed; if (clip != _shownClip) { _shownClip = clip; base.creatureAnimator.CrossFadeInFixedTime(text, 0.15f); } } } private void HostWrite(in AnklagerSnapshot next) { if (((NetworkBehaviour)this).IsServer && ((NetworkBehaviour)this).IsSpawned && !next.Equals(_snapshot.Value)) { _snapshot.Value = next; } } private void ShowSnapshot() { AnklagerSnapshot current = _snapshot.Value; if (!current.Equals(_shown)) { AnklagerSnapshot previous = _shown; _shown = current; if (current.Clip != AnklagerClip.Locomotion && (current.Clip != previous.Clip || !current.ClipSpeed.Equals(previous.ClipSpeed))) { ShowClip(current.Clip, current.ClipSpeed); } RaiseSnapshotChanged(in previous, in current); } } internal void WatcherWriteLook(AnklagerActor actor) { if (!(actor == _watcherLookWritten) || (Snapshot.LookAt.IsNone && !actor.IsNone)) { _watcherLookWritten = actor; HostSetLookAt(actor); } } internal bool WatcherTakeHeardScene(float now) { //IL_001a: Unknown result type (might be due to invalid IL or missing references) //IL_0045: Unknown result type (might be due to invalid IL or missing references) if (!_watcherHeard.Take(now, out var x, out var y, out var z)) { return false; } WatcherInvestigatePoint = new Vector3(x, y, z); if (Plugin.ModConfig.DebugLogs.Value) { Plugin.Log.LogInfo((object)string.Format("[{0}] Heard a crime at {1}; it goes to look.", "Anklager", WatcherInvestigatePoint)); } return true; } internal AnklagerActor WatcherPickObserved(float now) { AnklagerConfig modConfig = Plugin.ModConfig; return _watcherLook.PickObserved(now, _watcherNearby, _watcherNearbyCount, modConfig.DetectionRange.Value, modConfig.ObserveCreatures.Value, _watcherDice); } internal AnklagerActor WatcherLookAt(float now) { return _watcherLook.LookAt(now); } internal void WatcherGlance(float now) { //IL_0039: Unknown result type (might be due to invalid IL or missing references) //IL_003e: Unknown result type (might be due to invalid IL or missing references) //IL_0045: Unknown result type (might be due to invalid IL or missing references) //IL_004a: 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_008a: Unknown result type (might be due to invalid IL or missing references) //IL_008b: Unknown result type (might be due to invalid IL or missing references) //IL_0090: Unknown result type (might be due to invalid IL or missing references) //IL_0094: Unknown result type (might be due to invalid IL or missing references) //IL_009b: Unknown result type (might be due to invalid IL or missing references) //IL_00a2: Unknown result type (might be due to invalid IL or missing references) //IL_00a9: Unknown result type (might be due to invalid IL or missing references) //IL_00af: Unknown result type (might be due to invalid IL or missing references) //IL_00be: Unknown result type (might be due to invalid IL or missing references) //IL_00bf: Unknown result type (might be due to invalid IL or missing references) AnklagerConfig modConfig = Plugin.ModConfig; if (!_watcherLook.GlanceDue(now, modConfig.ObserveCreatures.Value)) { return; } float num = _watcherLook.GlanceRange(now, modConfig.DetectionRange.Value); Vector3 val = WatcherEye(); Vector3 forward = ((Component)this).transform.forward; for (int i = 0; i < _watcherNearbyCount; i++) { ref AnklagerWatcherNearby reference = ref _watcherNearby[i]; reference.InGlanceView = false; if (!(reference.Distance > num) && AnklagerActors.TryGetPoints(reference.Actor, out var eyes, out var _, out var _)) { Vector3 val2 = eyes - val; reference.InGlanceView = AnklagerWatcherSight.InView(val2.x, val2.y, val2.z, forward.x, forward.z, num, wide: true) && WatcherLineClear(val, eyes); } } _watcherLook.Glance(now, _watcherNearby, _watcherNearbyCount, _watcherDice); } internal bool WatcherCanSee(AnklagerActor actor) { //IL_0019: Unknown result type (might be due to invalid IL or missing references) //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Unknown result type (might be due to invalid IL or missing references) //IL_002f: Unknown result type (might be due to invalid IL or missing references) if (!WatcherSightSubject(actor) || !AnklagerActors.TryGetPoints(actor, out var eyes, out var centre, out var _)) { return false; } return WatcherSees(WatcherEye(), ((Component)this).transform.forward, WatcherSightRange(), eyes, centre); } internal bool WatcherCanSeeAround(AnklagerActor actor) { //IL_0019: Unknown result type (might be due to invalid IL or missing references) //IL_001e: Unknown result type (might be due to invalid IL or missing references) //IL_0025: Unknown result type (might be due to invalid IL or missing references) //IL_0026: Unknown result type (might be due to invalid IL or missing references) //IL_0027: Unknown result type (might be due to invalid IL or missing references) //IL_002c: Unknown result type (might be due to invalid IL or missing references) //IL_003c: 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) //IL_0045: Unknown result type (might be due to invalid IL or missing references) //IL_0046: Unknown result type (might be due to invalid IL or missing references) if (!WatcherSightSubject(actor) || !AnklagerActors.TryGetPoints(actor, out var eyes, out var centre, out var feet)) { return false; } Vector3 val = WatcherEye(); float num = WatcherSightRange(); feet = eyes - val; if (((Vector3)(ref feet)).sqrMagnitude > num * num) { return false; } if (!WatcherLineClear(val, eyes)) { return WatcherLineClear(val, centre); } return true; } internal bool WatcherCanSee(Vector3 point) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_000d: Unknown result type (might be due to invalid IL or missing references) //IL_0012: Unknown result type (might be due to invalid IL or missing references) //IL_0013: Unknown result type (might be due to invalid IL or missing references) //IL_0014: Unknown result type (might be due to invalid IL or missing references) //IL_0015: Unknown result type (might be due to invalid IL or missing references) //IL_001a: Unknown result type (might be due to invalid IL or missing references) //IL_001b: Unknown result type (might be due to invalid IL or missing references) //IL_0021: Unknown result type (might be due to invalid IL or missing references) //IL_0027: Unknown result type (might be due t
Y4NGZBoiledOne.dll
Decompiled 2 hours ago
The result has been truncated due to the large size, download it to view full contents!
using System; using System.Collections.Generic; using System.Diagnostics; using System.Globalization; using System.IO; using System.Linq; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using System.Security.Cryptography; using System.Text; using System.Text.RegularExpressions; using BepInEx; using BepInEx.Bootstrap; using BepInEx.Configuration; using BepInEx.Logging; using Dawn; using DunGen; using GameNetcodeStuff; using HarmonyLib; using Microsoft.CodeAnalysis; using Unity.Netcode; using UnityEngine; using UnityEngine.AI; using UnityEngine.Audio; using UnityEngine.Rendering; using UnityEngine.Rendering.HighDefinition; using UnityEngine.SceneManagement; using UnityEngine.UI; using Y4NGZBoiledOne; using Y4NGZBoiledOne.NetcodePatcher; using Y4NGZBoiledOne.Patches; using Y4NGZMonsters.Shared; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")] [assembly: AssemblyCompany("Y4NGZBoiledOne")] [assembly: AssemblyConfiguration("Release")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0+597d0743e3d9fad0ef076615b4f8bdf577fcfd15")] [assembly: AssemblyProduct("Y4NGZBoiledOne")] [assembly: AssemblyTitle("Y4NGZBoiledOne")] [assembly: AssemblyVersion("1.0.0.0")] [module: RefSafetyRules(11)] [module: NetcodePatchedAssembly] namespace Microsoft.CodeAnalysis { [CompilerGenerated] [Embedded] internal sealed class EmbeddedAttribute : Attribute { } } namespace System.Runtime.CompilerServices { [CompilerGenerated] [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] [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] [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 Y4NGZBoiledOne { public sealed class BoiledOneAI : EnemyAI, IBoiledOneHaunt { private static readonly List<BoiledOneAI> Live = new List<BoiledOneAI>(); private readonly NetworkVariable<BoiledOneHauntSnapshot> _snapshot = new NetworkVariable<BoiledOneHauntSnapshot>(new BoiledOneHauntSnapshot { State = new BoiledOneHauntState { TargetSlot = -1 } }, (NetworkVariableReadPermission)0, (NetworkVariableWritePermission)0); private readonly ServerOwnershipGuard _ownership = new ServerOwnershipGuard(); private readonly Random _random = new Random(); private BoiledOneHauntLogic _logic; private BoiledOneExhaustion _exhaustion; private BoiledOneScreen _screen; private BoiledOneHauntPlayer[] _players; private BoiledOneHauntState _state = new BoiledOneHauntState { TargetSlot = -1 }; private PlayerControllerB _target; private bool _started; private bool _firstApply = true; private Vector3 _placedPosition; private float _placedYaw; private float _eyeHeight; private readonly List<AudioSource> _audioSources = new List<AudioSource>(); private Collider _scanCollider; private float _hiddenUntil; private bool _shown; public BoiledOnePhase Phase => _state.Phase; public PlayerControllerB Target => _target; public bool TargetInShip => _state.TargetInShip; public bool IsLocalTarget { get { GameNetworkManager instance = GameNetworkManager.Instance; if ((Object)(object)_target != (Object)null && (Object)(object)instance != (Object)null) { return (Object)(object)_target == (Object)(object)instance.localPlayerController; } return false; } } public bool IsPresent => _state.IsPresent; public BoiledOneKillTrigger KillTrigger => _state.KillTrigger; internal ushort CurrentPlacement => _state.Placement; public event Action StateChanged; internal static void ResetRoundState() { Live.RemoveAll((BoiledOneAI ai) => (Object)(object)ai == (Object)null || !((NetworkBehaviour)ai).IsSpawned); } public override void OnNetworkSpawn() { //IL_0047: Unknown result type (might be due to invalid IL or missing references) //IL_004c: Unknown result type (might be due to invalid IL or missing references) ((NetworkBehaviour)this).OnNetworkSpawn(); Live.Add(this); NetworkVariable<BoiledOneHauntSnapshot> snapshot = _snapshot; snapshot.OnValueChanged = (OnValueChangedDelegate<BoiledOneHauntSnapshot>)(object)Delegate.Combine((Delegate?)(object)snapshot.OnValueChanged, (Delegate?)(object)new OnValueChangedDelegate<BoiledOneHauntSnapshot>(OnSnapshotChanged)); if (((NetworkBehaviour)this).IsServer) { NetworkTime serverTime = ((NetworkBehaviour)this).NetworkManager.ServerTime; _logic = new BoiledOneHauntLogic(((NetworkTime)(ref serverTime)).Time); } _firstApply = true; if (_started) { ApplySnapshot(_snapshot.Value); } } public override void Start() { //IL_0093: Unknown result type (might be due to invalid IL or missing references) //IL_00a3: Unknown result type (might be due to invalid IL or missing references) ((EnemyAI)this).Start(); _exhaustion = ((Component)this).GetComponent<BoiledOneExhaustion>(); _screen = ((Component)this).GetComponent<BoiledOneScreen>(); ApplyMeshVisibility(); base.moveTowardsDestination = false; base.movingTowardsTargetPlayer = false; base.agent.updateRotation = false; base.agent.avoidancePriority = 99; if (((Behaviour)base.agent).enabled && base.agent.isOnNavMesh) { base.agent.isStopped = true; } _scanCollider = ((Component)((Component)this).transform.Find("ScanNode")).GetComponent<Collider>(); _eyeHeight = base.eye.position.y - ((Component)this).transform.position.y; ((Component)((Component)this).transform.Find("Collision")).GetComponent<Collider>().enabled = false; _started = true; if (((NetworkBehaviour)this).IsSpawned) { ApplySnapshot(_snapshot.Value); } } public override void Update() { //IL_003e: Unknown result type (might be due to invalid IL or missing references) //IL_0043: Unknown result type (might be due to invalid IL or missing references) //IL_0044: Unknown result type (might be due to invalid IL or missing references) //IL_004a: Unknown result type (might be due to invalid IL or missing references) //IL_004b: Unknown result type (might be due to invalid IL or missing references) _ownership.Ensure((EnemyAI)(object)this, Plugin.Log); ((EnemyAI)this).Update(); if (!((NetworkBehaviour)this).IsServer && _state.Placed) { Vector3 serverPosition = (((Component)this).transform.position = _snapshot.Value.Position); base.serverPosition = serverPosition; } TickHost(); UpdatePresentation(); } public override void DoAIInterval() { } public override void OnNetworkDespawn() { NetworkVariable<BoiledOneHauntSnapshot> snapshot = _snapshot; snapshot.OnValueChanged = (OnValueChangedDelegate<BoiledOneHauntSnapshot>)(object)Delegate.Remove((Delegate?)(object)snapshot.OnValueChanged, (Delegate?)(object)new OnValueChangedDelegate<BoiledOneHauntSnapshot>(OnSnapshotChanged)); Live.Remove(this); _logic = null; bool num = _state.TargetSlot >= 0; _state = new BoiledOneHauntState { TargetSlot = -1 }; _target = null; if ((Object)(object)_screen != (Object)null) { _screen.ClearVanishMeshLatch(); } UpdatePresentation(); RefreshAudio(); if (num) { this.StateChanged?.Invoke(); } ((NetworkBehaviour)this).OnNetworkDespawn(); } public override void OnDestroy() { NetworkVariable<BoiledOneHauntSnapshot> snapshot = _snapshot; snapshot.OnValueChanged = (OnValueChangedDelegate<BoiledOneHauntSnapshot>)(object)Delegate.Remove((Delegate?)(object)snapshot.OnValueChanged, (Delegate?)(object)new OnValueChangedDelegate<BoiledOneHauntSnapshot>(OnSnapshotChanged)); Live.Remove(this); ((EnemyAI)this).OnDestroy(); } public bool TryBeginKill(BoiledOneKillTrigger trigger) { //IL_0032: Unknown result type (might be due to invalid IL or missing references) //IL_0037: Unknown result type (might be due to invalid IL or missing references) if (!((NetworkBehaviour)this).IsServer || !((NetworkBehaviour)this).IsSpawned || _logic == null) { return false; } int playerCount = FillPlayers(StartOfRound.Instance); BoiledOneHauntLogic logic = _logic; NetworkTime serverTime = ((NetworkBehaviour)this).NetworkManager.ServerTime; if (!logic.TryBeginKill(((NetworkTime)(ref serverTime)).Time, _players, playerCount, ReadSettings(), trigger)) { return false; } Plugin.Log.LogInfo((object)$"[BoiledOne] Kill begins on player {_logic.State.TargetSlot} ({trigger})."); Commit(); return true; } public void EndKill() { //IL_0031: 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) if (((NetworkBehaviour)this).IsServer && ((NetworkBehaviour)this).IsSpawned && _logic != null) { int playerCount = FillPlayers(StartOfRound.Instance); BoiledOneHauntLogic logic = _logic; NetworkTime serverTime = ((NetworkBehaviour)this).NetworkManager.ServerTime; if (logic.EndKill(((NetworkTime)(ref serverTime)).Time, _players, playerCount, ReadSettings(), _random)) { Commit(); } } } internal bool TriggerStage2Sighting(PlayerControllerB target, float dwellSeconds) { //IL_007b: Unknown result type (might be due to invalid IL or missing references) //IL_0080: Unknown result type (might be due to invalid IL or missing references) StartOfRound instance = StartOfRound.Instance; if (!((NetworkBehaviour)this).IsServer || !((NetworkBehaviour)this).IsSpawned || _logic == null || (Object)(object)instance == (Object)null || (Object)(object)target == (Object)null) { return false; } if (_logic.State.Phase != BoiledOnePhase.Haunting || _logic.State.TargetInShip) { return false; } if (!TryPlaceForStage2Sighting(instance, target, _logic.State.TargetSlot)) { return false; } NetworkTime serverTime = ((NetworkBehaviour)this).NetworkManager.ServerTime; double time = ((NetworkTime)(ref serverTime)).Time; _logic.NoteManifested(time, dwellSeconds, instantPlacement: true, allowLookAcceleration: true); Commit(); return true; } internal bool TryNightmareFlashPlacement(PlayerControllerB target, int roomTileIndex) { StartOfRound instance = StartOfRound.Instance; if (!((NetworkBehaviour)this).IsServer || !((NetworkBehaviour)this).IsSpawned || _logic == null || (Object)(object)instance == (Object)null || (Object)(object)target == (Object)null) { return false; } if (_logic.State.Phase != BoiledOnePhase.Haunting || _logic.State.TargetInShip) { return false; } return TryPlaceForNightmareFlash(instance, target, _logic.State.TargetSlot, roomTileIndex); } internal void CommitStage3Nightmare(double now, float dwellSeconds) { if (((NetworkBehaviour)this).IsServer && ((NetworkBehaviour)this).IsSpawned && _logic != null) { _logic.NoteManifested(now, dwellSeconds); Commit(); } } internal bool TryStage4ReckoningPlacement(PlayerControllerB target, bool allowFallback) { //IL_007c: Unknown result type (might be due to invalid IL or missing references) //IL_0081: Unknown result type (might be due to invalid IL or missing references) StartOfRound instance = StartOfRound.Instance; if (!((NetworkBehaviour)this).IsServer || !((NetworkBehaviour)this).IsSpawned || _logic == null || (Object)(object)instance == (Object)null || (Object)(object)target == (Object)null) { return false; } if (_logic.State.Phase != BoiledOnePhase.Haunting || _logic.State.TargetInShip) { return false; } if (!TryPlaceForStage4Execution(instance, target, _logic.State.TargetSlot, allowFallback)) { return false; } NetworkTime serverTime = ((NetworkBehaviour)this).NetworkManager.ServerTime; double time = ((NetworkTime)(ref serverTime)).Time; _logic.NoteManifested(time, 2.15); Commit(); return true; } internal void DismissManifestation() { if (((NetworkBehaviour)this).IsServer && ((NetworkBehaviour)this).IsSpawned && _logic != null) { _logic.DismissManifestation(); Commit(); } } public override void HitEnemy(int force = 1, PlayerControllerB playerWhoHit = null, bool playHitSFX = false, int hitID = -1) { } public override void HitFromExplosion(float distance) { } public override void SetEnemyStunned(bool setToStunned, float setToStunTime = 1f, PlayerControllerB setStunnedByPlayer = null) { } public override void KillEnemy(bool destroy = false) { } private void TickHost() { //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) StartOfRound instance = StartOfRound.Instance; if (!((NetworkBehaviour)this).IsServer || !((NetworkBehaviour)this).IsSpawned || _logic == null || (Object)(object)instance == (Object)null) { return; } int playerCount = FillPlayers(instance); BoiledOneHauntSettings settings = ReadSettings(); NetworkTime serverTime = ((NetworkBehaviour)this).NetworkManager.ServerTime; double time = ((NetworkTime)(ref serverTime)).Time; _logic.Tick(time, _players, playerCount, in settings, _random); PlayerControllerB val = VictimRpc.FromSlot(_logic.State.TargetSlot); if ((Object)(object)val != (Object)null) { if (_logic.WantsLookCheck && IsTargetLookingDirectlyAtMe(instance, val)) { _logic.NoteVictimLooked(time); } if (_logic.ConsumeVanishBlinkDue() && (Object)(object)_exhaustion != (Object)null) { _exhaustion.NotifyVanishBlink(val); } TurnTowards(instance, val); } else { _logic.ConsumeVanishBlinkDue(); } Commit(); } private int FillPlayers(StartOfRound round) { if ((Object)(object)round == (Object)null) { return 0; } PlayerControllerB[] allPlayerScripts = round.allPlayerScripts; if (_players == null) { _players = new BoiledOneHauntPlayer[allPlayerScripts.Length]; } int num = Math.Min(allPlayerScripts.Length, _players.Length); for (int i = 0; i < num; i++) { PlayerControllerB val = allPlayerScripts[i]; _players[i].Alive = (Object)(object)val != (Object)null && val.isPlayerControlled && !val.isPlayerDead; _players[i].InShip = (Object)(object)val != (Object)null && val.isInHangarShipRoom; _players[i].HauntedByOther = IsHauntedByOther(i); } return num; } private bool IsHauntedByOther(int slot) { for (int i = 0; i < Live.Count; i++) { BoiledOneAI boiledOneAI = Live[i]; if (!((Object)(object)boiledOneAI == (Object)(object)this) && !((Object)(object)boiledOneAI == (Object)null) && boiledOneAI._logic != null) { BoiledOneHauntState state = boiledOneAI._logic.State; if (state.TargetSlot == slot && (state.Phase == BoiledOnePhase.Haunting || state.Phase == BoiledOnePhase.Killing)) { return true; } } } return false; } private static BoiledOneHauntSettings ReadSettings() { BoiledOneConfig modConfig = Plugin.ModConfig; return new BoiledOneHauntSettings { KillEnabled = modConfig.KillEnabled.Value, CountdownEnabled = modConfig.CountdownEnabled.Value, CountdownSeconds = modConfig.CountdownSeconds.Value, RestSeconds = modConfig.RestSeconds.Value, ApparitionDwellSeconds = modConfig.ApparitionDwellSeconds.Value }; } private void Commit() { //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) BoiledOneHauntSnapshot value = new BoiledOneHauntSnapshot { State = _logic.State, Position = _placedPosition, Yaw = _placedYaw }; if (!value.Equals(_snapshot.Value)) { _snapshot.Value = value; } } private bool TryPlaceForStage2Sighting(StartOfRound round, PlayerControllerB target, int slot) { //IL_000b: Unknown result type (might be due to invalid IL or missing references) //IL_001b: Unknown result type (might be due to invalid IL or missing references) //IL_0020: Unknown result type (might be due to invalid IL or missing references) //IL_004e: Unknown result type (might be due to invalid IL or missing references) //IL_003e: 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_0053: Unknown result type (might be due to invalid IL or missing references) //IL_0056: Unknown result type (might be due to invalid IL or missing references) //IL_0058: Unknown result type (might be due to invalid IL or missing references) //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0078: Unknown result type (might be due to invalid IL or missing references) //IL_007a: Unknown result type (might be due to invalid IL or missing references) //IL_0081: 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_0085: 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_008e: Unknown result type (might be due to invalid IL or missing references) //IL_0093: Unknown result type (might be due to invalid IL or missing references) //IL_009a: Unknown result type (might be due to invalid IL or missing references) //IL_00a1: Unknown result type (might be due to invalid IL or missing references) TargetEye(target, out var eyePosition, out var eyeForward); TargetPlanarFacing(target, eyeForward, out var viewX, out var viewZ); Vector3 position = ((Component)target).transform.position; int collidersAndRoomMaskAndDefault = round.collidersAndRoomMaskAndDefault; bool flag = (Object)(object)round.shipBounds != (Object)null; Bounds shipBounds = (Bounds)(flag ? round.shipBounds.bounds : default(Bounds)); if (TryFindAlignedSpot(position, eyePosition, viewX, viewZ, collidersAndRoomMaskAndDefault, flag, shipBounds, -1, requireInRoom: false, BoiledOneHauntPlacement.SightingAnglesDegrees, BoiledOneHauntPlacement.SightingDistances, useSightingRange: true, out var found)) { WarpAndFace(found, position); Vector3 val = found - position; float num = Vector2.Angle(new Vector2(viewX, viewZ), new Vector2(val.x, val.z)); Plugin.Log.LogInfo((object)$"[BoiledOne] Stage 2 sighting for player {slot}: {((Vector3)(ref val)).magnitude:F1} m away, {num:F0} deg from eye facing."); return true; } return false; } private bool TryPlaceForNightmareFlash(StartOfRound round, PlayerControllerB target, int slot, int roomTileIndex) { //IL_000b: Unknown result type (might be due to invalid IL or missing references) //IL_001b: Unknown result type (might be due to invalid IL or missing references) //IL_0020: Unknown result type (might be due to invalid IL or missing references) //IL_004e: Unknown result type (might be due to invalid IL or missing references) //IL_003e: 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_0053: Unknown result type (might be due to invalid IL or missing references) //IL_00fc: Unknown result type (might be due to invalid IL or missing references) //IL_00fe: Unknown result type (might be due to invalid IL or missing references) //IL_0105: 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_0060: Unknown result type (might be due to invalid IL or missing references) //IL_0067: Unknown result type (might be due to invalid IL or missing references) //IL_011f: Unknown result type (might be due to invalid IL or missing references) //IL_0121: Unknown result type (might be due to invalid IL or missing references) //IL_0128: Unknown result type (might be due to invalid IL or missing references) //IL_012a: Unknown result type (might be due to invalid IL or missing references) //IL_012c: Unknown result type (might be due to invalid IL or missing references) //IL_0131: Unknown result type (might be due to invalid IL or missing references) //IL_0135: 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_0141: Unknown result type (might be due to invalid IL or missing references) //IL_0148: Unknown result type (might be due to invalid IL or missing references) //IL_0081: 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_008a: Unknown result type (might be due to invalid IL or missing references) //IL_008c: Unknown result type (might be due to invalid IL or missing references) //IL_008e: Unknown result type (might be due to invalid IL or missing references) //IL_0093: Unknown result type (might be due to invalid IL or missing references) //IL_0097: Unknown result type (might be due to invalid IL or missing references) //IL_009c: Unknown result type (might be due to invalid IL or missing references) //IL_00a3: Unknown result type (might be due to invalid IL or missing references) //IL_00aa: Unknown result type (might be due to invalid IL or missing references) TargetEye(target, out var eyePosition, out var eyeForward); TargetPlanarFacing(target, eyeForward, out var viewX, out var viewZ); Vector3 position = ((Component)target).transform.position; int collidersAndRoomMaskAndDefault = round.collidersAndRoomMaskAndDefault; bool flag = (Object)(object)round.shipBounds != (Object)null; Bounds shipBounds = (Bounds)(flag ? round.shipBounds.bounds : default(Bounds)); if (roomTileIndex >= 0 && TryFindAlignedSpot(position, eyePosition, viewX, viewZ, collidersAndRoomMaskAndDefault, flag, shipBounds, roomTileIndex, requireInRoom: true, BoiledOneHauntPlacement.NightmareAnglesDegrees, BoiledOneHauntPlacement.NightmareDistances, useSightingRange: false, out var found)) { WarpAndFace(found, position); Vector3 val = found - position; float num = Vector2.Angle(new Vector2(viewX, viewZ), new Vector2(val.x, val.z)); Plugin.Log.LogInfo((object)($"[BoiledOne] Nightmare-aligned in room '{BoiledOneRoomMap.TileName(roomTileIndex)}' for player {slot}: " + $"{((Vector3)(ref val)).magnitude:F1} m away, {num:F0} deg from eye facing.")); return true; } if (TryFindAlignedSpot(position, eyePosition, viewX, viewZ, collidersAndRoomMaskAndDefault, flag, shipBounds, roomTileIndex, requireInRoom: false, BoiledOneHauntPlacement.NightmareAnglesDegrees, BoiledOneHauntPlacement.NightmareDistances, useSightingRange: false, out var found2)) { WarpAndFace(found2, position); Vector3 val2 = found2 - position; float num2 = Vector2.Angle(new Vector2(viewX, viewZ), new Vector2(val2.x, val2.z)); Plugin.Log.LogInfo((object)($"[BoiledOne] Nightmare-aligned (fallback) for player {slot}: " + $"{((Vector3)(ref val2)).magnitude:F1} m away, {num2:F0} deg from eye facing.")); return true; } return false; } private bool TryPlaceForStage4Execution(StartOfRound round, PlayerControllerB target, int slot, bool allowFallback) { //IL_0036: Unknown result type (might be due to invalid IL or missing references) //IL_0026: Unknown result type (might be due to invalid IL or missing references) //IL_002c: Unknown result type (might be due to invalid IL or missing references) //IL_003b: Unknown result type (might be due to invalid IL or missing references) //IL_0042: Unknown result type (might be due to invalid IL or missing references) //IL_0047: Unknown result type (might be due to invalid IL or missing references) //IL_0048: Unknown result type (might be due to invalid IL or missing references) //IL_0065: Unknown result type (might be due to invalid IL or missing references) //IL_00e6: Unknown result type (might be due to invalid IL or missing references) //IL_00c7: Unknown result type (might be due to invalid IL or missing references) //IL_00c8: Unknown result type (might be due to invalid IL or missing references) //IL_00d2: Unknown result type (might be due to invalid IL or missing references) //IL_00d7: Unknown result type (might be due to invalid IL or missing references) //IL_009b: Unknown result type (might be due to invalid IL or missing references) //IL_0078: Unknown result type (might be due to invalid IL or missing references) //IL_007d: Unknown result type (might be due to invalid IL or missing references) //IL_0087: Unknown result type (might be due to invalid IL or missing references) //IL_008c: Unknown result type (might be due to invalid IL or missing references) if (TryPlaceForNightmareFlash(round, target, slot, -1)) { return true; } if (!allowFallback) { return false; } bool flag = (Object)(object)round.shipBounds != (Object)null; Bounds val = (Bounds)(flag ? round.shipBounds.bounds : default(Bounds)); Vector3 position = ((Component)target).transform.position; NavMeshHit val2 = default(NavMeshHit); if (NavMesh.SamplePosition(position, ref val2, 4f, base.agent.areaMask) && !((EnemyAI)this).IsInsideMineshaftElevator(((NavMeshHit)(ref val2)).position) && (!flag || !((Bounds)(ref val)).Contains(((NavMeshHit)(ref val2)).position + Vector3.up * 0.25f))) { WarpAndFaceWithFallback(((NavMeshHit)(ref val2)).position, target); Plugin.Log.LogInfo((object)$"[BoiledOne] Stage 4 reckoning fallback NavMesh placement for player {slot}."); return true; } if (flag && ((Bounds)(ref val)).Contains(position + Vector3.up * 0.25f)) { return false; } WarpAndFaceWithFallback(position, target); Plugin.Log.LogInfo((object)$"[BoiledOne] Stage 4 reckoning direct fallback placement for player {slot}."); return true; } private bool IsTargetLookingDirectlyAtMe(StartOfRound round, PlayerControllerB target) { //IL_0040: Unknown result type (might be due to invalid IL or missing references) //IL_001e: Unknown result type (might be due to invalid IL or missing references) //IL_0023: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Unknown result type (might be due to invalid IL or missing references) //IL_0033: Unknown result type (might be due to invalid IL or missing references) //IL_0045: Unknown result type (might be due to invalid IL or missing references) //IL_0046: Unknown result type (might be due to invalid IL or missing references) //IL_0047: Unknown result type (might be due to invalid IL or missing references) //IL_0048: Unknown result type (might be due to invalid IL or missing references) //IL_004d: Unknown result type (might be due to invalid IL or missing references) //IL_004e: Unknown result type (might be due to invalid IL or missing references) //IL_0054: Unknown result type (might be due to invalid IL or missing references) //IL_005a: Unknown result type (might be due to invalid IL or missing references) //IL_0060: 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_006c: 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_007d: Unknown result type (might be due to invalid IL or missing references) TargetEye(target, out var eyePosition, out var eyeForward); Vector3 val = (((Object)(object)base.eye != (Object)null) ? base.eye.position : (((Component)this).transform.position + Vector3.up * _eyeHeight)); Vector3 val2 = val - eyePosition; if (!BoiledOneHauntPlacement.IsLookingDirectlyAt(eyeForward.x, eyeForward.y, eyeForward.z, val2.x, val2.y, val2.z, lineClear: true)) { return false; } return !Physics.Linecast(eyePosition, val, round.collidersAndRoomMaskAndDefault, (QueryTriggerInteraction)1); } private bool TryFindAlignedSpot(Vector3 targetPosition, Vector3 eyePosition, float viewX, float viewZ, int mask, bool hasShip, Bounds shipBounds, int roomTileIndex, bool requireInRoom, float[] angles, float[] distances, bool useSightingRange, out Vector3 found) { //IL_0215: Unknown result type (might be due to invalid IL or missing references) //IL_0055: Unknown result type (might be due to invalid IL or missing references) //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0064: Unknown result type (might be due to invalid IL or missing references) //IL_0087: Unknown result type (might be due to invalid IL or missing references) //IL_008c: Unknown result type (might be due to invalid IL or missing references) //IL_008f: Unknown result type (might be due to invalid IL or missing references) //IL_009b: Unknown result type (might be due to invalid IL or missing references) //IL_009d: 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_00a3: Unknown result type (might be due to invalid IL or missing references) //IL_00ab: Unknown result type (might be due to invalid IL or missing references) //IL_00bd: Unknown result type (might be due to invalid IL or missing references) //IL_00bf: Unknown result type (might be due to invalid IL or missing references) //IL_00c9: Unknown result type (might be due to invalid IL or missing references) //IL_00ce: Unknown result type (might be due to invalid IL or missing references) //IL_00e7: 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_0103: Unknown result type (might be due to invalid IL or missing references) //IL_0161: 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_0164: Unknown result type (might be due to invalid IL or missing references) //IL_016f: Unknown result type (might be due to invalid IL or missing references) //IL_0174: Unknown result type (might be due to invalid IL or missing references) //IL_0194: Unknown result type (might be due to invalid IL or missing references) //IL_0196: Unknown result type (might be due to invalid IL or missing references) //IL_019c: Unknown result type (might be due to invalid IL or missing references) //IL_01a1: Unknown result type (might be due to invalid IL or missing references) //IL_01a6: Unknown result type (might be due to invalid IL or missing references) //IL_01a8: Unknown result type (might be due to invalid IL or missing references) //IL_01ae: 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_01eb: 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) float num = base.agent.radius + 0.2f; float num2 = base.agent.height - base.agent.radius; NavMeshHit val = default(NavMeshHit); foreach (float angleDegrees in angles) { for (int j = 0; j < distances.Length; j++) { if (!BoiledOneHauntPlacement.NightmareCandidateOffset(viewX, viewZ, distances[j], angleDegrees, out var offsetX, out var offsetZ) || !NavMesh.SamplePosition(targetPosition + new Vector3(offsetX, 0f, offsetZ), ref val, 1.905f, base.agent.areaMask)) { continue; } Vector3 position = ((NavMeshHit)(ref val)).position; if (((EnemyAI)this).IsInsideMineshaftElevator(position)) { continue; } Vector3 val2 = position - targetPosition; bool inRoom = !requireInRoom || BoiledOneRoomMap.IsPointInTile(roomTileIndex, position); bool inShip = hasShip && ((Bounds)(ref shipBounds)).Contains(position + Vector3.up * 0.25f); BoiledOneNightmareCandidate candidate = new BoiledOneNightmareCandidate { OffsetX = val2.x, OffsetY = val2.y, OffsetZ = val2.z, OnNavMesh = true, RequireInRoom = requireInRoom, InRoom = inRoom, InShip = inShip, LineClear = true, BodyRoom = true }; if ((useSightingRange ? BoiledOneHauntPlacement.CheckSighting(in candidate) : BoiledOneHauntPlacement.CheckNightmare(in candidate)) != BoiledOneNightmareVerdict.Accepted) { continue; } candidate.LineClear = !Physics.Linecast(eyePosition, position + Vector3.up * _eyeHeight, mask, (QueryTriggerInteraction)1); if (candidate.LineClear) { candidate.BodyRoom = !Physics.CheckCapsule(position + Vector3.up * num, position + Vector3.up * num2, base.agent.radius, mask, (QueryTriggerInteraction)1); if ((useSightingRange ? BoiledOneHauntPlacement.CheckSighting(in candidate) : BoiledOneHauntPlacement.CheckNightmare(in candidate)) == BoiledOneNightmareVerdict.Accepted) { found = position; return true; } } } } found = default(Vector3); return false; } private void WarpAndFaceWithFallback(Vector3 point, PlayerControllerB target) { //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_000b: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Unknown result type (might be due to invalid IL or missing references) //IL_0012: Unknown result type (might be due to invalid IL or missing references) //IL_0018: Unknown result type (might be due to invalid IL or missing references) //IL_001f: 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_0053: Unknown result type (might be due to invalid IL or missing references) //IL_0034: Unknown result type (might be due to invalid IL or missing references) //IL_003b: 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) Vector3 val = ((Component)target).transform.position - point; float yaw; if (val.x * val.x + val.z * val.z >= 0.0001f) { yaw = YawTowards(point, ((Component)target).transform.position); } else { TargetEye(target, out var _, out var eyeForward); TargetPlanarFacing(target, eyeForward, out var viewX, out var viewZ); yaw = Mathf.Atan2(0f - viewX, 0f - viewZ) * 57.29578f; } WarpWithYaw(point, yaw); } private void WarpAndFace(Vector3 point, Vector3 targetPosition) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0003: Unknown result type (might be due to invalid IL or missing references) WarpWithYaw(point, YawTowards(point, targetPosition)); } private void WarpWithYaw(Vector3 point, float yaw) { //IL_001f: Unknown result type (might be due to invalid IL or missing references) //IL_0039: Unknown result type (might be due to invalid IL or missing references) //IL_005b: 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_0072: Unknown result type (might be due to invalid IL or missing references) //IL_008d: Unknown result type (might be due to invalid IL or missing references) //IL_0099: Unknown result type (might be due to invalid IL or missing references) //IL_009a: Unknown result type (might be due to invalid IL or missing references) if (!((Behaviour)base.agent).enabled) { ((Behaviour)base.agent).enabled = true; } if (!base.agent.Warp(point)) { ((Behaviour)base.agent).enabled = false; ((Component)this).transform.position = point; } else if (base.agent.isOnNavMesh) { base.agent.isStopped = true; } base.serverPosition = point; ((Component)this).transform.rotation = Quaternion.Euler(0f, yaw, 0f); VanillaEnemyYaw.Previous.Invoke((EnemyAI)(object)this) = ((Component)this).transform.eulerAngles.y; _placedPosition = point; _placedYaw = yaw; } private void TurnTowards(StartOfRound round, PlayerControllerB target) { //IL_002f: Unknown result type (might be due to invalid IL or missing references) //IL_0034: Unknown result type (might be due to invalid IL or missing references) //IL_004a: Unknown result type (might be due to invalid IL or missing references) //IL_005a: Unknown result type (might be due to invalid IL or missing references) //IL_0065: Unknown result type (might be due to invalid IL or missing references) //IL_0091: Unknown result type (might be due to invalid IL or missing references) BoiledOneHauntState state = _logic.State; if (state.Phase == BoiledOnePhase.Haunting && state.IsPresent) { TargetEye(target, out var eyePosition, out var _); if (!Physics.Linecast(base.eye.position, eyePosition, round.collidersAndRoomMaskAndDefault, (QueryTriggerInteraction)1)) { float num = Mathf.MoveTowardsAngle(((Component)this).transform.eulerAngles.y, YawTowards(((Component)this).transform.position, ((Component)target).transform.position), 160f * Time.deltaTime); ((Component)this).transform.rotation = Quaternion.Euler(0f, num, 0f); } } } private static void TargetEye(PlayerControllerB target, out Vector3 eyePosition, out Vector3 eyeForward) { //IL_0012: Unknown result type (might be due to invalid IL or missing references) //IL_0017: Unknown result type (might be due to invalid IL or missing references) //IL_001e: Unknown result type (might be due to invalid IL or missing references) //IL_0023: Unknown result type (might be due to invalid IL or missing references) //IL_0063: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_0072: Unknown result type (might be due to invalid IL or missing references) //IL_0077: Unknown result type (might be due to invalid IL or missing references) //IL_007c: Unknown result type (might be due to invalid IL or missing references) //IL_0088: Unknown result type (might be due to invalid IL or missing references) //IL_008d: Unknown result type (might be due to invalid IL or missing references) //IL_0045: Unknown result type (might be due to invalid IL or missing references) //IL_004a: Unknown result type (might be due to invalid IL or missing references) //IL_0051: Unknown result type (might be due to invalid IL or missing references) //IL_0056: Unknown result type (might be due to invalid IL or missing references) Transform playerEye = target.playerEye; if ((Object)(object)playerEye != (Object)null) { eyePosition = playerEye.position; eyeForward = playerEye.forward; } else if ((Object)(object)target.gameplayCamera != (Object)null) { Transform transform = ((Component)target.gameplayCamera).transform; eyePosition = transform.position; eyeForward = transform.forward; } else { eyePosition = ((Component)target).transform.position + Vector3.up * 1.6f; eyeForward = ((Component)target).transform.forward; } } private static void TargetPlanarFacing(PlayerControllerB target, Vector3 eyeForward, out float viewX, out float viewZ) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_000d: Unknown result type (might be due to invalid IL or missing references) //IL_0013: Unknown result type (might be due to invalid IL or missing references) //IL_0039: Unknown result type (might be due to invalid IL or missing references) //IL_003e: Unknown result type (might be due to invalid IL or missing references) //IL_0040: Unknown result type (might be due to invalid IL or missing references) //IL_0048: Unknown result type (might be due to invalid IL or missing references) //IL_0023: Unknown result type (might be due to invalid IL or missing references) //IL_002b: Unknown result type (might be due to invalid IL or missing references) if (eyeForward.x * eyeForward.x + eyeForward.z * eyeForward.z >= 0.0001f) { viewX = eyeForward.x; viewZ = eyeForward.z; } else { Vector3 forward = ((Component)target).transform.forward; viewX = forward.x; viewZ = forward.z; } } private static float YawTowards(Vector3 from, Vector3 to) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_000d: Unknown result type (might be due to invalid IL or missing references) //IL_0013: Unknown result type (might be due to invalid IL or missing references) return Mathf.Atan2(to.x - from.x, to.z - from.z) * 57.29578f; } public override void EnableEnemyMesh(bool enable, bool overrideDoNotSet = false, bool tamperWithMeshes = false) { if (_started) { ApplyMeshVisibility(); } } private void ApplyMeshVisibility() { ((EnemyAI)this).EnableEnemyMesh(_shown, true, !_shown); for (int i = 0; i < base.skinnedMeshRenderers.Length; i++) { ((Renderer)base.skinnedMeshRenderers[i]).enabled = _shown; } for (int j = 0; j < base.meshRenderers.Length; j++) { ((Renderer)base.meshRenderers[j]).enabled = _shown; } } private void OnSnapshotChanged(BoiledOneHauntSnapshot previous, BoiledOneHauntSnapshot current) { if (_started) { ApplySnapshot(current); } } private void ApplySnapshot(BoiledOneHauntSnapshot snapshot) { //IL_006c: Unknown result type (might be due to invalid IL or missing references) //IL_0078: Unknown result type (might be due to invalid IL or missing references) //IL_007d: Unknown result type (might be due to invalid IL or missing references) //IL_0098: Unknown result type (might be due to invalid IL or missing references) BoiledOneHauntState state = _state; bool firstApply = _firstApply; _firstApply = false; _state = snapshot.State; _target = VictimRpc.FromSlot(_state.TargetSlot); if (_state.Placed && (firstApply || _state.Placement != state.Placement)) { if (!((NetworkBehaviour)this).IsServer) { ((Component)this).transform.position = snapshot.Position; base.serverPosition = snapshot.Position; ((Component)this).transform.rotation = Quaternion.Euler(0f, snapshot.Yaw, 0f); VanillaEnemyYaw.Target.Invoke((EnemyAI)(object)this) = snapshot.Yaw; } if (!firstApply) { _hiddenUntil = (_state.InstantPlacement ? 0f : (Time.time + 0.1f)); } } if ((Object)(object)_screen != (Object)null && (!_state.Placed || _state.Phase != BoiledOnePhase.Haunting)) { _screen.ClearVanishMeshLatch(); } if (_state.InstantPlacement || state.Placed != _state.Placed) { UpdatePresentation(); } RefreshAudio(); if (firstApply || state.Phase != _state.Phase || state.TargetSlot != _state.TargetSlot || state.TargetInShip != _state.TargetInShip || state.IsPresent != _state.IsPresent) { this.StateChanged?.Invoke(); } } private void RefreshAudio() { bool mute = !IsLocalTarget; ((Component)this).GetComponentsInChildren<AudioSource>(true, _audioSources); for (int i = 0; i < _audioSources.Count; i++) { _audioSources[i].mute = mute; } } internal void RefreshPresentation() { UpdatePresentation(); } private void UpdatePresentation() { bool flag = _state.Phase == BoiledOnePhase.Haunting && (Object)(object)_screen != (Object)null && _screen.VanishHidesMeshFor(_state.Placement); bool flag2 = IsLocalTarget && _state.IsPresent && !flag && Time.time >= _hiddenUntil && (_state.Phase == BoiledOnePhase.Killing || (!_target.isInHangarShipRoom && !_target.isPlayerDead)); if (flag2 != _shown) { _shown = flag2; ApplyMeshVisibility(); if ((Object)(object)_scanCollider != (Object)null) { _scanCollider.enabled = flag2; } } } protected override void __initializeVariables() { if (_snapshot == null) { throw new Exception("BoiledOneAI._snapshot cannot be null. All NetworkVariableBase instances must be initialized."); } ((NetworkVariableBase)_snapshot).Initialize((NetworkBehaviour)(object)this); ((NetworkBehaviour)this).__nameNetworkVariable((NetworkVariableBase)(object)_snapshot, "_snapshot"); ((NetworkBehaviour)this).NetworkVariableFields.Add((NetworkVariableBase)(object)_snapshot); ((EnemyAI)this).__initializeVariables(); } protected override void __initializeRpcs() { ((EnemyAI)this).__initializeRpcs(); } protected internal override string __getTypeName() { return "BoiledOneAI"; } } internal static class BoiledOneBestiary { internal const string Text = "The Boiled One\n\nDanger level: high\n\nA tall, scalded figure that fixes on one worker and is never seen by anyone else on the crew. It does not walk; it is simply standing somewhere new each time its chosen worker looks away. Workers it follows report whispering, sudden exhaustion and images at the edge of their vision. Do not let it close the distance.\n\n"; } internal sealed class BoiledOneConfig { private const string SectionGeneral = "General"; private const string SectionSpawning = "Spawning"; private const string SectionMovement = "Movement"; private const string SectionCombat = "Combat"; private const string SectionAbilities = "Abilities"; private const string SectionPresentation = "Presentation"; private const string AbsentSentinel = "\u0001y4ngz-boiled-one-absent\u0001"; private static readonly ConfigDefinition[] RetiredEntries = (ConfigDefinition[])(object)new ConfigDefinition[12] { new ConfigDefinition("Abilities", "DoorIntervalMinSeconds"), new ConfigDefinition("Abilities", "DoorIntervalMaxSeconds"), new ConfigDefinition("Movement", "TeleportIntervalMinSeconds"), new ConfigDefinition("Movement", "TeleportIntervalMaxSeconds"), new ConfigDefinition("Abilities", "ExhaustionEnabled"), new ConfigDefinition("Abilities", "ExhaustionMovingGain"), new ConfigDefinition("Abilities", "ExhaustionWhisperGain"), new ConfigDefinition("Abilities", "ExhaustionScareFlashGain"), new ConfigDefinition("Abilities", "WhisperCooldownMinSeconds"), new ConfigDefinition("Abilities", "WhisperCooldownMaxSeconds"), new ConfigDefinition("Abilities", "ScareFlashCooldownMinSeconds"), new ConfigDefinition("Abilities", "ScareFlashCooldownMaxSeconds") }; public ConfigEntry<bool> Enabled { get; } public ConfigEntry<float> SpawnWeightMultiplier { get; } public ConfigEntry<string> MoonWeightOverrides { get; } public ConfigEntry<int> MaxCount { get; } public ConfigEntry<float> PowerLevel { get; } public ConfigEntry<bool> KillEnabled { get; } public ConfigEntry<bool> CountdownEnabled { get; } public ConfigEntry<float> CountdownSeconds { get; } public ConfigEntry<float> RestSeconds { get; } public ConfigEntry<float> StageIntervalSeconds { get; } public ConfigEntry<float> ApparitionDwellSeconds { get; } public ConfigEntry<float> TeammateExhaustionMultiplier { get; } public ConfigEntry<bool> DoorsEnabled { get; } public ConfigEntry<float> DoorHoldSeconds { get; } public ConfigEntry<bool> HornAndDim { get; } public ConfigEntry<bool> WhisperEnabled { get; } public ConfigEntry<bool> ScareFlashEnabled { get; } public ConfigEntry<float> ScareFlashRoomWaitSeconds { get; } public ConfigEntry<bool> ColourLoss { get; } public ConfigEntry<bool> FearEnabled { get; } public BoiledOneConfig(ConfigFile config) { //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_0072: Expected O, but got Unknown //IL_00b5: Unknown result type (might be due to invalid IL or missing references) //IL_00bf: Expected O, but got Unknown //IL_00ee: Unknown result type (might be due to invalid IL or missing references) //IL_00f8: Expected O, but got Unknown //IL_015f: Unknown result type (might be due to invalid IL or missing references) //IL_0169: Expected O, but got Unknown //IL_0198: Unknown result type (might be due to invalid IL or missing references) //IL_01a2: Expected O, but got Unknown //IL_01d1: Unknown result type (might be due to invalid IL or missing references) //IL_01db: Expected O, but got Unknown //IL_020a: Unknown result type (might be due to invalid IL or missing references) //IL_0214: Expected O, but got Unknown //IL_0243: Unknown result type (might be due to invalid IL or missing references) //IL_024d: Expected O, but got Unknown //IL_0298: Unknown result type (might be due to invalid IL or missing references) //IL_02a2: Expected O, but got Unknown //IL_0325: Unknown result type (might be due to invalid IL or missing references) //IL_032f: Expected O, but got Unknown using (ConfigPersistence.BeginBinding(config, Plugin.Log, "Boiled One")) { RetireReplacedEntries(config, Plugin.Log); Enabled = config.Bind<bool>("General", "Enabled", true, "Enable the Boiled One encounter. Host-only: the host's value decides whether it spawns; every install still registers the creature so clients stay in sync."); SpawnWeightMultiplier = config.Bind<float>("Spawning", "SpawnWeightMultiplier", 1f, new ConfigDescription("Multiplier applied to the Boiled One's contextual moon/interior spawn policy. 0 disables natural spawns.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0f, 5f), Array.Empty<object>())); MoonWeightOverrides = config.Bind<string>("Spawning", "MoonWeightOverrides", string.Empty, "Optional comma-separated base moon weights, e.g. Experimentation:8,Offense:15 or namespace:moon=12. Use 0 to disable a moon; unlisted moons keep authored defaults."); MaxCount = config.Bind<int>("Spawning", "MaxCount", 1, new ConfigDescription("Maximum number of Boiled Ones at once.", (AcceptableValueBase)(object)new AcceptableValueRange<int>(1, 4), Array.Empty<object>())); PowerLevel = config.Bind<float>("Spawning", "PowerLevel", 2f, new ConfigDescription("Indoor enemy power budget cost for each Boiled One.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0.5f, 20f), Array.Empty<object>())); KillEnabled = config.Bind<bool>("Combat", "KillEnabled", true, "Let the Boiled One kill its target on Stage 4 execution or when the target walks into it while manifested. Off: it haunts and cycles cleanly without killing. Host-only."); CountdownEnabled = config.Bind<bool>("Abilities", "CountdownEnabled", true, "Run the countdown that makes the Boiled One let go of its target. Off: it keeps its target until that player dies or leaves. Host-only."); CountdownSeconds = config.Bind<float>("Abilities", "CountdownSeconds", 100f, new ConfigDescription("Seconds the target must outlast before the Boiled One lets go. The countdown pauses while the target is inside the ship. Host-only.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(10f, 600f), Array.Empty<object>())); RestSeconds = config.Bind<float>("Abilities", "RestSeconds", 50f, new ConfigDescription("Seconds the Boiled One rests after letting go before it picks a new target. Host-only.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0f, 600f), Array.Empty<object>())); StageIntervalSeconds = config.Bind<float>("Abilities", "StageIntervalSeconds", 25f, new ConfigDescription("Host-only: base pacing interval in seconds between the 4 escalation stages (Stage 1 Omen at 0.8x, Stage 2 Voice + Sighting at +1.0x, Stage 3 Room Lockdown Nightmare at +1.0x, Stage 4 Execution grace beat at +0.9x). Freezes inside the ship.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(10f, 90f), Array.Empty<object>())); ApparitionDwellSeconds = config.Bind<float>("Abilities", "ApparitionDwellSeconds", 3.5f, new ConfigDescription("Host-only: seconds the Boiled One remains physically manifested during a Stage 2 sighting or Stage 3 room-lockdown reveal before vanishing behind the exit glitch-blink (Stage 2 shortens to 1.8 s once directly looked at). Decoupled from DoorHoldSeconds.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(1.5f, 10f), Array.Empty<object>())); TeammateExhaustionMultiplier = config.Bind<float>("Abilities", "TeammateExhaustionMultiplier", 0.5f, new ConfigDescription("Host-only: while another living player is within 17 metres of the haunted player, stage escalation pace is multiplied by this. 1 turns the rule off; 0 pauses stage progression near a teammate.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0f, 1f), Array.Empty<object>())); DoorsEnabled = config.Bind<bool>("Abilities", "DoorsEnabled", true, "Lock all lockable doors of the haunted player's room during a Stage 3 nightmare flash. Host-only."); DoorHoldSeconds = config.Bind<float>("Abilities", "DoorHoldSeconds", 12f, new ConfigDescription("How long locked room doors stay shut after a Stage 3 nightmare flash, in seconds. The Boiled One vanishes after ApparitionDwellSeconds while the doors finish locking. Host-only.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(1f, 120f), Array.Empty<object>())); HornAndDim = config.Bind<bool>("Abilities", "HornAndDimEnabled", true, "Host-only: play the apocalyptic trumpet horn (and brief screen dim outside nightmare flashes) on escalation stage beats."); WhisperEnabled = config.Bind<bool>("Abilities", "WhisperEnabled", true, "Host-only: let the Boiled One play capped voice lines (at most 2 per haunt: Stage 2 and Stage 3) with smear and slow."); ScareFlashEnabled = config.Bind<bool>("Abilities", "ScareFlashEnabled", true, "Host-only: let Stage 3 trigger the live 3D nightmare vision (preferring lockable rooms and locking their doors when DoorsEnabled is on)."); ScareFlashRoomWaitSeconds = config.Bind<float>("Abilities", "ScareFlashRoomWaitSeconds", 20f, new ConfigDescription("Host-only: seconds after Stage 3 is ready that the Boiled One waits for the haunted player to enter a lockable room before falling back to a non-room nightmare flash (such as outside or in doorless caves). 0 disables waiting.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0f, 120f), Array.Empty<object>())); ColourLoss = config.Bind<bool>("Presentation", "ColourLossEnabled", true, "Local: the world drains toward dark grey while crimson stays vivid when the Boiled One is manifested nearby or executing."); FearEnabled = config.Bind<bool>("Presentation", "FearEnabled", true, "Local: when the Boiled One scares you or you approach too closely, your character gets frightened too, which can bring on the game's heartbeat, screen filter and tense music. Off: it leaves your fear alone."); } } public BoiledOneExhaustionSettings ReadExhaustionSettings() { BoiledOneExhaustionSettings result = default(BoiledOneExhaustionSettings); result.KillEnabled = KillEnabled.Value; result.HornAndDim = HornAndDim.Value; result.Whisper = WhisperEnabled.Value; result.ScareFlash = ScareFlashEnabled.Value; result.PreferLockableRoom = DoorsEnabled.Value; result.StageIntervalSeconds = StageIntervalSeconds.Value; result.ScareFlashRoomWaitSeconds = ScareFlashRoomWaitSeconds.Value; return result; } private static void RetireReplacedEntries(ConfigFile config, ManualLogSource log) { for (int i = 0; i < RetiredEntries.Length; i++) { ConfigDefinition val = RetiredEntries[i]; string value = config.Bind<string>(val, "\u0001y4ngz-boiled-one-absent\u0001", (ConfigDescription)null).Value; config.Remove(val); if (!(value == "\u0001y4ngz-boiled-one-absent\u0001") && log != null) { log.LogInfo((object)("[Boiled One] Removed retired setting " + val.Section + "." + val.Key + " = " + value + ". Replaced by the 4-stage escalation arc and short apparition dwell.")); } } } } internal sealed class BoiledOneDoorHold : MonoBehaviour { private readonly BoiledOneDoorHoldState _state = new BoiledOneDoorHoldState(); private DoorLock _door; private AnimatedObjectTrigger _picture; private bool _writing; internal static BoiledOneDoorHold For(NetworkBehaviour door) { if ((Object)(object)door == (Object)null) { return null; } BoiledOneDoorHold result = default(BoiledOneDoorHold); if (((Component)door).TryGetComponent<BoiledOneDoorHold>(ref result)) { return result; } DoorLock val = (DoorLock)(object)((door is DoorLock) ? door : null); if ((Object)(object)val == (Object)null) { TerminalAccessibleObject val2 = (TerminalAccessibleObject)(object)((door is TerminalAccessibleObject) ? door : null); if (val2 == null || !val2.isBigDoor) { return null; } } AnimatedObjectTrigger picture = default(AnimatedObjectTrigger); if (!((Component)door).TryGetComponent<AnimatedObjectTrigger>(ref picture)) { return null; } result = ((Component)door).gameObject.AddComponent<BoiledOneDoorHold>(); result._door = val; result._picture = picture; ((Behaviour)result).enabled = false; return result; } internal static bool IsHeld(Component door) { BoiledOneDoorHold boiledOneDoorHold = default(BoiledOneDoorHold); if (door.TryGetComponent<BoiledOneDoorHold>(ref boiledOneDoorHold)) { return boiledOneDoorHold._state.Held; } return false; } internal static bool BlocksPicture(AnimatedObjectTrigger picture, bool setTo) { BoiledOneDoorHold boiledOneDoorHold = default(BoiledOneDoorHold); if (((Component)picture).TryGetComponent<BoiledOneDoorHold>(ref boiledOneDoorHold) && !boiledOneDoorHold._writing) { return boiledOneDoorHold._state.Intercept(setTo); } return false; } internal void Acquire() { if (_state.Acquire(_picture.boolValue)) { if ((Object)(object)_door != (Object)null) { Refuse(_door.doorTrigger); Refuse(_door.doorTriggerB); } ((Behaviour)this).enabled = true; Shut(); } } internal void Release() { if (_state.Release()) { ((Behaviour)this).enabled = false; if ((Object)(object)_door != (Object)null) { bool usable = BoiledOneDoorHoldState.RegularDoorUsable(_door.isLocked); SetUsable(_door.doorTrigger, usable); SetUsable(_door.doorTriggerB, usable); } else if (_picture.boolValue != _state.ShownOpenAtRelease) { Write(_state.ShownOpenAtRelease); } } } private void Update() { Shut(); } private void Shut() { if (_picture.boolValue) { Write(open: false); if ((Object)(object)_door != (Object)null) { _door.SetDoorAsOpen(false); } } } private void Write(bool open) { _writing = true; try { _picture.SetBoolOnClientOnly(open); } finally { _writing = false; } } private static void Refuse(InteractTrigger trigger) { if (!((Object)(object)trigger == (Object)null)) { trigger.interactable = false; trigger.disabledHoverTip = "Locked"; } } private static void SetUsable(InteractTrigger trigger, bool usable) { if ((Object)(object)trigger != (Object)null) { trigger.interactable = usable; } } } internal enum BoiledOneDoorKind : byte { Regular, Big } internal struct BoiledOneDoorCandidate { public BoiledOneDoorKind Kind; public bool Networked; public bool CanBeLocked; public bool InShip; public bool Locked; public bool BeingPicked; public bool Held; public bool HasTwin; public int Twin; } internal static class BoiledOneDoorRules { internal static bool Eligible(in BoiledOneDoorCandidate door) { return Free(in door); } internal static bool HasEligibleRoomDoor(IReadOnlyList<BoiledOneDoorCandidate> candidates) { for (int i = 0; i < candidates.Count; i++) { BoiledOneDoorCandidate door = candidates[i]; int num = TwinOf(candidates, i); if (num < 0) { if (Free(in door)) { return true; } } else if (num > i && Free(in door) && Free(candidates[num])) { return true; } } return false; } internal static void SelectRoomDoors(IReadOnlyList<BoiledOneDoorCandidate> candidates, List<int> selected) { selected.Clear(); for (int i = 0; i < candidates.Count; i++) { BoiledOneDoorCandidate door = candidates[i]; int num = TwinOf(candidates, i); if (num < 0) { if (Free(in door)) { selected.Add(i); } } else if (num > i && Free(in door) && Free(candidates[num])) { selected.Add(i); selected.Add(num); } } } private static bool Free(in BoiledOneDoorCandidate door) { if (door.Networked && door.CanBeLocked && !door.InShip && !door.Locked && !door.BeingPicked) { return !door.Held; } return false; } private static int TwinOf(IReadOnlyList<BoiledOneDoorCandidate> candidates, int index) { BoiledOneDoorCandidate boiledOneDoorCandidate = candidates[index]; if (!boiledOneDoorCandidate.HasTwin || boiledOneDoorCandidate.Twin == index || boiledOneDoorCandidate.Twin < 0 || boiledOneDoorCandidate.Twin >= candidates.Count) { return -1; } BoiledOneDoorCandidate boiledOneDoorCandidate2 = candidates[boiledOneDoorCandidate.Twin]; if (!boiledOneDoorCandidate2.HasTwin || boiledOneDoorCandidate2.Twin != index) { return -1; } return boiledOneDoorCandidate.Twin; } internal static bool Expired(double endTime, double now) { return now >= endTime; } internal static bool KeepHolds(bool haunting, bool targetInShip, bool sameTarget) { return haunting && !targetInShip && sameTarget; } internal static void Reconcile<T>(List<T> applied, List<T> desired, Func<T, bool> alive, Action<T> acquire, Action<T> release) where T : class { for (int num = applied.Count - 1; num >= 0; num--) { T val = applied[num]; if (!alive(val) || !desired.Contains(val)) { applied.RemoveAt(num); if (alive(val)) { release(val); } } } for (int i = 0; i < desired.Count; i++) { T val2 = desired[i]; if (!applied.Contains(val2)) { applied.Add(val2); acquire(val2); } } } internal static void ReleaseAll<T>(List<T> applied, Func<T, bool> alive, Action<T> release) where T : class { for (int num = applied.Count - 1; num >= 0; num--) { T val = applied[num]; applied.RemoveAt(num); if (alive(val)) { release(val); } } } } internal sealed class BoiledOneDoorHoldState { private int _holders; internal bool Held => _holders > 0; internal bool ShownOpenAtRelease { get; private set; } internal bool Acquire(bool shownOpen) { if (_holders++ > 0) { return false; } ShownOpenAtRelease = shownOpen; return true; } internal bool Release() { if (_holders == 0) { return false; } return --_holders == 0; } internal bool Intercept(bool setTo) { if (!Held) { return false; } ShownOpenAtRelease = setTo; return true; } internal static bool RegularDoorUsable(bool locked) { return !locked; } } internal struct BoiledOneHeldDoor : INetworkSerializeByMemcpy, IEquatable<BoiledOneHeldDoor> { public NetworkBehaviourReference Door; public double EndTime; public BoiledOneHeldDoor(NetworkBehaviourReference door, double endTime) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0002: Unknown result type (might be due to invalid IL or missing references) Door = door; EndTime = endTime; } public bool Equals(BoiledOneHeldDoor other) { //IL_0007: Unknown result type (might be due to invalid IL or missing references) if (((NetworkBehaviourReference)(ref Door)).Equals(other.Door)) { return EndTime.Equals(other.EndTime); } return false; } public override bool Equals(object obj) { if (obj is BoiledOneHeldDoor other) { return Equals(other); } return false; } public override int GetHashCode() { return (((object)Unsafe.As<NetworkBehaviourReference, NetworkBehaviourReference>(ref Door)/*cast due to .constrained prefix*/).GetHashCode() * 397) ^ EndTime.GetHashCode(); } } internal sealed class BoiledOneDoors : NetworkBehaviour { private static readonly Func<BoiledOneDoorHold, bool> Alive = (BoiledOneDoorHold hold) => (Object)(object)hold != (Object)null; private static readonly Action<BoiledOneDoorHold> AcquireHold = delegate(BoiledOneDoorHold hold) { hold.Acquire(); }; private static readonly Action<BoiledOneDoorHold> ReleaseHold = delegate(BoiledOneDoorHold hold) { hold.Release(); }; private NetworkList<BoiledOneHeldDoor> _held; private IBoiledOneHaunt _haunt; private PlayerControllerB _heldTarget; private bool _reconcile; private readonly List<BoiledOneDoorHold> _applied = new List<BoiledOneDoorHold>(); private readonly List<BoiledOneDoorHold> _desired = new List<BoiledOneDoorHold>(); private readonly List<NetworkBehaviour> _roomDoors = new List<NetworkBehaviour>(8); private void Awake() { _held = new NetworkList<BoiledOneHeldDoor>((IEnumerable<BoiledOneHeldDoor>)null, (NetworkVariableReadPermission)0, (NetworkVariableWritePermission)0); _haunt = ((Component)this).GetComponent<IBoiledOneHaunt>(); } public override void OnNetworkSpawn() { ((NetworkBehaviour)this).OnNetworkSpawn(); _held.OnListChanged += OnHeldChanged; _reconcile = true; } public override void OnNetworkDespawn() { _held.OnListChanged -= OnHeldChanged; _heldTarget = null; ReleaseApplied(); ((NetworkBehaviour)this).OnNetworkDespawn(); } public override void OnDestroy() { if (_held != null) { _held.OnListChanged -= OnHeldChanged; } _heldTarget = null; ReleaseApplied(); ((NetworkBehaviour)this).OnDestroy(); } private void OnHeldChanged(NetworkListEvent<BoiledOneHeldDoor> change) { _reconcile = true; } internal bool LockRoomDoors(int tileIndex, double now, float holdSeconds) { //IL_00b7: Unknown result type (might be due to invalid IL or missing references) if (!((NetworkBehaviour)this).IsServer || !((NetworkBehaviour)this).IsSpawned || _haunt == null) { return false; } PlayerControllerB target = _haunt.Target; if (_haunt.Phase != BoiledOnePhase.Haunting || _haunt.TargetInShip || (Object)(object)target == (Object)null || target.isInHangarShipRoom || target.isPlayerDead || !target.isPlayerControlled) { return false; } if (tileIndex < 0 || !Plugin.ModConfig.DoorsEnabled.Value || holdSeconds <= 0f) { return false; } int num = BoiledOneRoomMap.CollectEligibleRoomDoors(tileIndex, _roomDoors); if (num == 0) { return false; } double endTime = now + (double)holdSeconds; _heldTarget = target; for (int i = 0; i < num; i++) { _held.Add(new BoiledOneHeldDoor(new NetworkBehaviourReference(_roomDoors[i]), endTime)); } _roomDoors.Clear(); Reconcile(); Plugin.Log.LogInfo((object)$"[BoiledOne] Room lockdown on '{BoiledOneRoomMap.TileName(tileIndex)}': held {num} door(s) for {holdSeconds:F1} s."); return true; } private void Update() { if (((NetworkBehaviour)this).IsSpawned) { if (((NetworkBehaviour)this).IsServer) { HostStep(); } if (_reconcile) { Reconcile(); } } } private void HostStep() { //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_000b: Unknown result type (might be due to invalid IL or missing references) NetworkTime serverTime = ((NetworkBehaviour)this).NetworkManager.ServerTime; double time = ((NetworkTime)(ref serverTime)).Time; PlayerControllerB val = ((_haunt != null) ? _haunt.Target : null); bool targetInShip = _haunt == null || _haunt.TargetInShip || (Object)(object)val == (Object)null || val.isInHangarShipRoom; bool sameTarget = (Object)(object)val != (Object)null && (Object)(object)val == (Object)(object)_heldTarget && val.isPlayerControlled && !val.isPlayerDead; bool flag = BoiledOneDoorRules.KeepHolds(_haunt != null && _haunt.Phase == BoiledOnePhase.Haunting, targetInShip, sameTarget); bool flag2 = false; for (int num = _held.Count - 1; num >= 0; num--) { if (!flag || BoiledOneDoorRules.Expired(_held[num].EndTime, time)) { _held.RemoveAt(num); flag2 = true; } } if (_held.Count == 0) { _heldTarget = null; } if (flag2) { Reconcile(); } } private void Reconcile() { _reconcile = false; _desired.Clear(); NetworkBehaviour door = default(NetworkBehaviour); for (int i = 0; i < _held.Count; i++) { BoiledOneHeldDoor boiledOneHeldDoor = _held[i]; BoiledOneDoorHold boiledOneDoorHold = (((NetworkBehaviourReference)(ref boiledOneHeldDoor.Door)).TryGet(ref door, ((NetworkBehaviour)this).NetworkManager) ? BoiledOneDoorHold.For(door) : null); if ((Object)(object)boiledOneDoorHold == (Object)null) { _reconcile = true; } else { _desired.Add(boiledOneDoorHold); } } BoiledOneDoorRules.Reconcile(_applied, _desired, Alive, AcquireHold, ReleaseHold); _desired.Clear(); } private void ReleaseApplied() { BoiledOneDoorRules.ReleaseAll(_applied, Alive, ReleaseHold); } protected override void __initializeVariables() { if (_held == null) { throw new Exception("BoiledOneDoors._held cannot be null. All NetworkVariableBase instances must be initialized."); } ((NetworkVariableBase)_held).Initialize((NetworkBehaviour)(object)this); ((NetworkBehaviour)this).__nameNetworkVariable((NetworkVariableBase)(object)_held, "_held"); base.NetworkVariableFields.Add((NetworkVariableBase)(object)_held); ((NetworkBehaviour)this).__initializeVariables(); } protected override void __initializeRpcs() { ((NetworkBehaviour)this).__initializeRpcs(); } protected internal override string __getTypeName() { return "BoiledOneDoors"; } } internal static class BoiledOneDoorTuning { internal const float DoorwayMatchHorizontalMetres = 1.25f; internal const float DoorwayMatchVerticalMetres = 2f; internal const string HeldTip = "Locked"; } public sealed class BoiledOneExhaustion : NetworkBehaviour { private IBoiledOneHaunt _haunt; private BoiledOneAI _ai; private BoiledOneDoors _doors; private BoiledOneScreen _screen; private BoiledOneExhaustionModel _model; private void Awake() { _haunt = ((Component)this).GetComponent<IBoiledOneHaunt>(); _ai = ((Component)this).GetComponent<BoiledOneAI>(); _doors = ((Component)this).GetComponent<BoiledOneDoors>(); _screen = ((Component)this).GetComponent<BoiledOneScreen>(); } public override void OnNetworkSpawn() { ((NetworkBehaviour)this).OnNetworkSpawn(); if (((NetworkBehaviour)this).IsServer) { _model = new BoiledOneExhaustionModel(); } } public override void OnNetworkDespawn() { _model = null; ((NetworkBehaviour)this).OnNetworkDespawn(); } private void Update() { if (_haunt != null && ((NetworkBehaviour)this).IsSpawned && ((NetworkBehaviour)this).IsServer && _model != null) { AdvanceHost(); } } internal void NotifyVanishBlink(PlayerControllerB target) { //IL_005f: Unknown result type (might be due to invalid IL or missing references) if (((NetworkBehaviour)this).IsServer && ((NetworkBehaviour)this).IsSpawned && _haunt != null && !((Object)(object)target == (Object)null) && _haunt.Phase == BoiledOnePhase.Haunting && !_haunt.TargetInShip && !target.isInHangarShipRoom && !target.isPlayerDead && target.isPlayerControlled) { PlayEffectsClientRpc(8, target.actualClientId, VictimRpc.TargetOnly(target)); } } private void AdvanceHost() { //IL_0101: Unknown result type (might be due to invalid IL or missing references) //IL_023e: Unknown result type (might be due to invalid IL or missing references) PlayerControllerB target = _haunt.Target; bool flag = _haunt.Phase == BoiledOnePhase.Haunting; if (flag && !_haunt.TargetInShip && (Object)(object)target != (Object)null && (target.isInHangarShipRoom || target.isPlayerDead || !target.isPlayerControlled)) { return; } bool flag2 = flag && (Object)(object)target != (Object)null && !_haunt.TargetInShip && target.isPlayerControlled && !target.isPlayerDead && !target.isInHangarShipRoom; if (flag2 && _model.Stage == BoiledOneEscalationStage.ExecutionPending && !_haunt.IsPresent && (Object)(object)_ai != (Object)null) { bool allowFallback = _model.ReckoningElapsed + Time.deltaTime >= 0.65f; _ai.TryStage4ReckoningPlacement(target, allowFallback); } int tileIndex = -1; bool inLockableRoom = false; if (flag2 && _model.Stage == BoiledOneEscalationStage.VoiceSighting) { BoiledOneRoomMap.EnsureBuilt(RoundManager.Instance); inLockableRoom = BoiledOneRoomMap.TryGetQualifyingRoom(((Component)target).transform.position, out tileIndex); } BoiledOneExhaustionSettings settings = Plugin.ModConfig.ReadExhaustionSettings(); BoiledOneExhaustionEvents boiledOneExhaustionEvents = _model.Advance(Time.deltaTime, _haunt, in settings, TeammatePaceMultiplier(target), inLockableRoom); if (boiledOneExhaustionEvents == BoiledOneExhaustionEvents.None) { return; } target = _haunt.Target; if ((Object)(object)target == (Object)null) { return; } if ((boiledOneExhaustionEvents & BoiledOneExhaustionEvents.ScareFlash) != BoiledOneExhaustionEvents.None) { if (!flag2 || _haunt.Phase != BoiledOnePhase.Haunting || _haunt.TargetInShip) { boiledOneExhaustionEvents &= ~BoiledOneExhaustionEvents.ScareFlash; } else { TriggerStage3Nightmare(target, tileIndex); } } else if ((boiledOneExhaustionEvents & BoiledOneExhaustionEvents.SightingManifest) != BoiledOneExhaustionEvents.None) { if (flag2 && (Object)(object)_ai != (Object)null) { _ai.TriggerStage2Sighting(target, Plugin.ModConfig.ApparitionDwellSeconds.Value); } } else if ((boiledOneExhaustionEvents & BoiledOneExhaustionEvents.ReckoningManifest) != BoiledOneExhaustionEvents.None) { if (flag2 && (Object)(object)_ai != (Object)null && !_ai.TryStage4ReckoningPlacement(target, allowFallback: false)) { _ai.DismissManifestation(); } } else if ((boiledOneExhaustionEvents & BoiledOneExhaustionEvents.DismissManifest) != BoiledOneExhaustionEvents.None && (Object)(object)_ai != (Object)null) { _ai.DismissManifestation(); } BoiledOneExhaustionEvents boiledOneExhaustionEvents2 = boiledOneExhaustionEvents & ~(BoiledOneExhaustionEvents.SightingManifest | BoiledOneExhaustionEvents.ReckoningManifest | BoiledOneExhaustionEvents.DismissManifest); if (boiledOneExhaustionEvents2 != BoiledOneExhaustionEvents.None) { PlayEffectsClientRpc((byte)boiledOneExhaustionEvents2, target.actualClientId, VictimRpc.TargetOnly(target)); } } private void TriggerStage3Nightmare(PlayerControllerB target, int roomTileIndex) { //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_000b: Unknown result type (might be due to invalid IL or missing references) NetworkTime serverTime = ((NetworkBehaviour)this).NetworkManager.ServerTime; double time = ((NetworkTime)(ref serverTime)).Time; float value = Plugin.ModConfig.DoorHoldSeconds.Value; float dwellSeconds = Math.Max(Plugin.ModConfig.ApparitionDwellSeconds.Value, 2f); if ((Object)(object)_ai != (Object)null && _ai.TryNightmareFlashPlacement(target, roomTileIndex)) { _ai.CommitStage3Nightmare(time, dwellSeconds); } if (roomTileIndex >= 0 && (Object)(object)_doors != (Object)null) { _doors.LockRoomDoors(roomTileIndex, time, value); } } private static float TeammatePaceMultiplier(PlayerControllerB target) { //IL_0043: Unknown result type (might be due to invalid IL or missing references) //IL_0048: Unknown result type (might be due to invalid IL or missing references) //IL_0074: 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_0081: Unknown result type (might be due to invalid IL or missing references) //IL_0086: Unknown result type (might be due to invalid IL or missing references) float value = Plugin.ModConfig.TeammateExhaustionMultiplier.Value; StartOfRound instance = StartOfRound.Instance; if (value >= 1f || (Object)(object)target == (Object)null || (Object)(object)instance == (Object)null) { return 1f; } PlayerControllerB[] allPlayerScripts = instance.allPlayerScripts; Vector3 position = ((Component)target).transform.position; foreach (PlayerControllerB val in allPlayerScripts) { if ((Object)(object)val != (Object)null) { bool isTarget = (Object)(object)val == (Object)(object)target; bool isPlayerControlled = val.isPlayerControlled; bool isPlayerDead = val.isPlayerDead; Vector3 val2 = position - ((Component)val).transform.position; if (BoiledOneExhaustionRules.CountsAsTeammate(isTarget, isPlayerControlled, isPlayerDead, ((Vector3)(ref val2)).sqrMagnitude)) { return value; } } } return 1f; } [ClientRpc] private void PlayEffectsClientRpc(byte events, ulong targetClientId, ClientRpcParams clientRpcParams = default(ClientRpcParams)) { //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_007d: Unknown result type (might be due to invalid IL or missing references) //IL_0083: Unknown result type (might be due to invalid IL or missing references) //IL_008c: Unknown result type (might be due to invalid IL or missing references) //IL_00a4: Unknown result type (might be due to invalid IL or missing references) //IL_00e9: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager; if (networkManager == null || !networkManager.IsListening) { return; } if ((int)base.__rpc_exec_stage != 1 && (networkManager.IsServer || networkManager.IsHost)) { FastBufferWriter val = ((NetworkBehaviour)this).__beginSendClientRpc(899736488u, clientRpcParams, (RpcDelivery)0); ((FastBufferWriter)(ref val)).WriteValueSafe<byte>(ref events, default(ForPrimitives)); BytePacker.WriteValueBitPacked(val, targetClientId); ((NetworkBehaviour)this).__endSendClientRpc(ref val, 899736488u, clientRpcParams, (RpcDelivery)0); } if ((int)base.__rpc_exec_stage == 1 && (networkManager.IsClient || networkManager.IsHost)) { base.__rpc_exec_stage = (__RpcExecStage)0; if (_haunt != null && VictimRpc.IsLocalVictim(targetClientId) && _haunt.IsLocalTarget) { _screen.Play((BoiledOneExhaustionEvents)events); } } } protected override void __initializeVariables() { ((NetworkBehaviour)this).__initializeVariables(); } protected override void __initializeRpcs() { //IL_000d: Unknown result type (might be due to invalid IL or missing references) //IL_001c: Expected O, but got Unknown ((NetworkBehaviour)this).__registerRpc(899736488u, new RpcReceiveHandler(__rpc_handler_899736488), "PlayEffectsClientRpc"); ((NetworkBehaviour)this).__initializeRpcs(); } private static void __rpc_handler_899736488(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams) { //IL_002f: Unknown result type (might be due to invalid IL or missing references) //IL_0035: Unknown result type (might be due to invalid IL or missing references) //IL_003e: Unknown result type (might be due to invalid IL or missing references) //IL_004b: Unknown result type (might be due to invalid IL or missing references) //IL_004c: 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_005b: 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_007d: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = target.NetworkManager; if (networkManager != null && networkManager.IsListening) { byte events = default(byte); ((FastBufferReader)(ref reader)).ReadValueSafe<byte>(ref events, default(ForPrimitives)); ulong targetClientId = default(ulong); ByteUnpacker.ReadValueBitPacked(reader, ref targetClientId); ClientRpcParams client = rpcParams.Client; target.__rpc_exec_stage = (__RpcExecStage)1; ((BoiledOneExhaustion)(object)target).PlayEffectsClientRpc(events, targetClientId, client); target.__rpc_exec_stage = (__RpcExecStage)0; } } protected internal override string __getTypeName() { return "BoiledOneExhaustion"; } } internal enum BoiledOneEscalationStage : byte { Buildup, Omen, VoiceSighting, NightmareRoom, ExecutionPending } internal struct BoiledOneExhaustionSettings { public bool KillEnabled; public bool HornAndDim; public bool Whisper; public bool ScareFlash; public bool PreferLockableRoom; public float StageIntervalSeconds; public float ScareFlashRoomWaitSeconds; } [Flags] internal enum BoiledOneExhaustionEvents : byte { None = 0, HornAndDim = 1, Whisper = 2, ScareFlash = 4, VanishBlink = 8, ReckoningFlash = 0x10, SightingManifest = 0x20, ReckoningManifest = 0x40, DismissManifest = 0x80 } internal sealed class BoiledOneExhaustionModel { public const BoiledOneExhaustionEvents ClientEffectMask = ~(BoiledOneExhaustionEvents.SightingManifest | BoiledOneExhaustionEvents.ReckoningManifest | BoiledOneExhaustionEvents.DismissManifest); private BoiledOneEscalationStage _stage; private float _stageElapsed; private float _roomWaitElapsed; private float _reckoningElapsed; private int _voiceLinesUsed; private BoiledOnePhase _seenPhase; private PlayerControllerB _seenTarget; public BoiledOneEscalationStage Stage => _stage; public float StageElapsed => _stageElapsed; public float ScareFlashRoomWaitElapsed => _roomWaitElapsed; public float ReckoningElapsed => _reckoningElapsed; public int VoiceLinesUsed => _voiceLinesUsed; public static float StageDurationSeconds(BoiledOneEscalationStage stage, float stageIntervalSeconds) { float num = Math.Max(1f, stageIntervalSeconds); return stage switch { BoiledOneEscalationStage.Buildup => num * 0.8f, BoiledOneEscalationStage.Omen => num * 1f, BoiledOneEscalationStage.VoiceSighting => num * 1f, BoiledOneEscalationStage.NightmareRoom => num * 0.9f, _ => 0.65f, }; } public BoiledOneExhaustionEvents Advance(float deltaSeconds, IBoiledOneHaunt haunt, in BoiledOneExhaustionSettings settings, float paceMultiplier = 1f, bool inLockableRoom = false) { BoiledOnePhase phase = haunt.Phase; PlayerControllerB target = haunt.Target; ObserveHaunt(phase, target); if (phase != BoiledOnePhase.Haunting || (Object)(object)target == (Object)null) { return BoiledOneExhaustionEvents.None; } if (haunt.TargetInShip) { if (_stage == BoiledOneEscalationStage.ExecutionPending) { _stage = BoiledOneEscalationStage.NightmareRoom; _stageElapsed = 0f; _reckoningElapsed = 0f; } return BoiledOneExhaustionEvents.None; } float num = ((deltaSeconds > 0f) ? Math.Min(deltaSeconds, 0.5f) : 0f); float num2 = ((paceMultiplier > 0f) ? paceMultiplier : 0f); float scaledDt = num * num2; return _stage switch { BoiledOneEscalationStage.Buildup => AdvanceBuildup(scaledDt, in settings), BoiledOneEscalationStage.Omen => AdvanceOmen(scaledDt, in settings), BoiledOneEscalationStage.VoiceSighting => AdvanceVoiceSighting(num, scaledDt, inLockableRoom, in settings), BoiledOneEscalationStage.NightmareRoom => AdvanceNightmareRoom(scaledDt, in settings), BoiledOneEscalationStage.ExecutionPending => AdvanceExecutionPending(num, haunt, in settings), _ => BoiledOneExhaustionEvents.None, }; } private BoiledOneExhaustionEvents AdvanceBuildup(float scaledDt, in BoiledOneExhaustionSettings settings) { _stageElapsed += scaledDt; if (_stageElapsed < StageDurationSeconds(BoiledOneEscalationStage.Buildup, settings.StageIntervalSeconds)) { return BoiledOneExhaustionEvents.None; } _stage = BoiledOneEscalationStage.Omen; _stageElapsed = 0f; if (!settings.HornAndDim) { return BoiledOneExhaustionEvents.None; } return BoiledOneExhaustionEvents.HornAndDim; } private BoiledOneExhaustionEvents AdvanceOmen(float scaledDt, in BoiledOneExhaustionSettings settings) { _stageElapsed += scaledDt; if (_stageElapsed < StageDurationSeconds(BoiledOneEscalationStage.Omen, settings.StageIntervalSeconds)) { return BoiledOneExhaustionEvents.None; } _stage = BoiledOneEscalationStage.VoiceSighting; _stageElapsed = 0f; BoiledOneExhaustionEvents boiledOneExhaustionEvents = BoiledOneExhaustionEvents.SightingManifest; if (settings.HornAndDim) { boiledOneExhaustionEvents |= BoiledOneExhaustionEvents.HornAndDim; } if (TryConsumeVoiceLine(in settings)) { boiledOneExhaustionEvents |= BoiledOneExhaustionEvents.Whisper; } return boiledOneExhaustionEvents; } private BoiledOneExhaustionEvents AdvanceVoiceSighting(float rawDt, float scaledDt, bool inLockableRoom, in BoiledOneExhaustionSettings settings) { float num = StageDurationSeconds(BoiledOneEscalationStage.VoiceSighting, settings.StageIntervalSeconds); if (_stageElapsed < num) { _stageElapsed += scaledDt; if (_stageElapsed < num) { return BoiledOneExhaustionEvents.None; } } if (settings.ScareFlash && settings.PreferLockableRoom && !inLockableRoom) { float num2 = Math.Max(0f, settings.ScareFlashRoomWaitSeconds); if (_roomWaitElapsed < num2) { _roomWaitElapsed += rawDt; if (_roomWaitElapsed < num2) { return BoiledOneExhaustionEvents.None; } } } _stage = BoiledOneEscalationStage.NightmareRoom; _stageElapsed = 0f; _roomWaitElapsed = 0f; BoiledOneExhaustionEvents boiledOneExhaustionEvents = BoiledOneExhaustionEvents.None; if (settings.ScareFlash) { boiledOneExhaustionEvents |= BoiledOneExhaustionEvents.ScareFlash; } if (settings.HornAndDim) { boiledOneExhaustionEvents |= BoiledOneExhaustionEvents.HornAndDim; } if (TryConsumeVoiceLine(in settings)) { boiledOneExhaustionEvents |= BoiledOneExhaustionEvents.Whisper; } return boiledOneExhaustionEvents; } private BoiledOneExhaustionEvents AdvanceNightmareRoom(float scaledDt, in BoiledOneExhaustionSettings settings) { _stageElapsed += scaledDt; if (_stageElapsed < StageDurationSeconds(BoiledOneEscalationStage.NightmareRoom, settings.StageIntervalSeconds)) { return BoiledOneExhaustionEvents.None; } _stageElapsed = 0f; if (!settings.KillEnabled) { _stage = BoiledOneEscalationStage.Buildup; BoiledOneExhaustionEvents boiledOneExhaustionEvents = BoiledOneExhaustionEvents.SightingManifest; if (settings.HornAndDim) { boiledOneExhaustionEvents |= BoiledOneExhaustionEvents.HornAndDim; } return boiledOneExhaustionEvents; } _stage = BoiledOneEscalationStage.ExecutionPending; _reckoningElapsed = 0f; BoiledOneExhaustionEvents boiledOneExhaustionEvents2 = BoiledOneExhaustionEvents.ReckoningFlash | BoiledOneExhaustionEvents.ReckoningManifest; if (settings.HornAndDim) { boiledOneExhaustionEvents2 |= BoiledOneExhaustionEvents.HornAndDim; } return boiledOneExhaustionEvents2; } private BoiledOneExhaustionEvents AdvanceExecutionPending(float rawDt, IBoiledOneHaunt haunt, in BoiledOneExhaustionSettings settings) { if (!settings.KillEnabled) { _stage = BoiledOneEscalationStage.Buildup; _stageElapsed = 0f; _reckoningElapsed = 0f; return BoiledOneExhaustionEvents.DismissManifest; } _reckoningElapsed += rawDt; if (_reckoningElapsed >= 0.65f && haunt.TryBeginKill(BoiledOneKillTrigger.Exhaustion)) { ResetForNewHaunt(); } return BoiledOneExhaustionEvents.None; } private bool TryConsumeVoiceLine(in BoiledOneExhaustionSettings settings) { if (!settings.Whisper || _voiceLinesUsed >= 2) { return false; } _voiceLinesUsed++; return true; } private void ObserveHaunt(BoiledOnePhase phase, PlayerControllerB target) { bool num = _seenPhase == BoiledOnePhase.Killing && phase != BoiledOnePhase.Killing; bool flag = _seenTarget != null && _seenTarget != target; bool flag2 = phase == BoiledOnePhase.Dormant || phase == BoiledOnePhase.Resting; _seenPhase = phase; _seenTarget = target; if (num || flag || flag2) { ResetForNewHaunt(); } } private void ResetForNewHaunt() { _stage = BoiledOneEscalationStage.Buildup; _stageElapsed = 0f; _roomWaitElapsed = 0f; _reckoningElapsed = 0f; _voiceLinesUsed = 0; } } internal static class BoiledOneExhaustionRules { public static bool CountsAsTeammate(bool isTarget, bool isControlled, bool isDead, float distanceSquared) { if (!isTarget && isControlled && !isDead) { return distanceSquared < 289f; } return false; } public static float FearLevel(BoiledOneExhaustionEvents events) { float num = 0f; if ((events & BoiledOneExhaustionEvents.HornAndDim) != BoiledOneExhaustionEvents.None) { num = Math.Max(num, 0.3f); } if ((events & BoiledOneExhaustionEvents.Whisper) != BoiledOneExhaustionEvents.None) { num = Math.Max(num, 0.6f); } if ((events & BoiledOneExhaustionEvents.ReckoningFlash) != BoiledOneExhaustionEvents.None) { num = Math.Max(num, 0.85f); } if ((events & BoiledOneExhaustionEvents.ScareFlash) != BoiledOneExhaustionEvents.None) { num = Math.Max(num, 0.9f); } return num; } } internal static class BoiledOneExhaustionTuning { public const float StageIntervalDefaultSeconds = 25f; public const float StageIntervalMinSeconds = 10f; public const float StageIntervalMaxSeconds = 90f; public const float Stage1OmenFraction = 0.8f; public const float Stage2VoiceFraction = 1f; public const float Stage3NightmareFraction = 1f; public const float Stage4ExecutionFraction = 0.9f; public const float Stage4ReckoningLeadSeconds = 0.65f; public const int MaxVoiceLinesPerHaunt = 2; public const float MaxDeltaSecondsPerAdvance = 0.5f; public const float TeammateRadiusMetres = 17f; public const float FearHornAndDim = 0.3f; public const float FearWhisper = 0.6f; public const float FearScareFlash = 0.9f; public const float FearReckoning = 0.85f; public const float FearProximityMin = 0.25f; public const float FearProximityMax = 0.8f; public const float ScareFlashRoomWaitDefaultSeconds = 20f; public const float ScareFlashRoomWaitMinSeconds = 0f; public const float ScareFlashRoomWaitMaxSeconds = 120f; public const float VanishBlinkSeconds = 0.32f; public const float VanishHidePeakSeconds = 0.1f; public const float VanishGlitchStartSeconds = 0.06f; public const float VanishGlitchEndSeconds = 0.22f; public const int VanishGlitchFrameCount = 3; public const float VanishAudioStopSeconds = 0.26f; public const float VanishAudioVolume = 0.42f; public const float VanishAudioPitch = 1.35f; public const float ProximityDangerStartMetres = 4.2f; public const float ProximityDangerFullMetres = 1.7145001f; public const float ProximityVignetteMaxIntensity = 0.62f; public const float ProximityChromaticMaxIntensity = 0.85f; public const float ProximityGrainMaxIntensity = 0.75f; public const float ProximityEdgeFlickerMaxAlpha = 0.24f; public const float ProximityGhostFlickerMaxAlpha = 0.16f; public const float DimSeconds = 0.5f; public const float DimAlpha = 40f / 51f; public const float HornVolume = 1f; public const float SmearRiseSeconds = 4.1666665f; public const float SmearMaxAmount = 0.6f; public const float SmearUpdateSeconds = 0.027f; public const float SmearAddAlpha = 0.04f; public const float WhisperSlowSeconds = 5f; public const float WhisperSpeedFactor = 0.4f; public const float WhisperVolume = 0.8f; public const int WhisperLineCount = 5; public const float ScreamVolume = 0.8f; public const int ScreamCount = 2; public const int ScareFrameCount = 20; public const float ScareFrameSeconds = 0.05f; public const float ScareUvWidth = 0.9987805f; public const float NightmareVisionSeconds = 1.2f; public const float NightmareFaceFlickerMaxAlpha = 0.22f; public const float NightmarePostExposure = -0.75f; public const float NightmareContrast = 52f; public const float NightmareRedOutRedIn = 110f; public const float NightmareRedOutGreenIn = 0f; public const float NightmareRedOutBlueIn = 0f; public const float NightmareGreenOutRedIn = 4f; public const float NightmareGreenOutGreenIn = 62f; public const float NightmareGreenOutBlueIn = 34f; public const float NightmareBlueOutRedIn = 4f; public const float NightmareBlueOutGreenIn = 58f; public const float NightmareBlueOutBlueIn = 38f; public const float NightmareRedHueSat = 0.68f; public const float NightmareRedShoulderHueSat = 0.5f; public const float NightmareNonRedHueSat = 0.02f; public const float NightmareVignetteIntensity = 0.58f; public const float NightmareFilmGrainIntensity = 0.85f; public const float NightmareChromaticAberrationIntensity = 0.45f; public const float NightmareLightRangeMetres = 4.2f; public const float NightmareLightLumens = 55f; public const float ColourLossStartMetres = 11.43f; public const float ColourLossFullMetres = 5.715f; public const float ColourLossDarken = 0.18f; public const float ColourLossContrast = 12f; public const float ColourLossRedOutRedIn = 96f; public const float ColourLossRedOutGreenIn = 4f; public const float ColourLossRedOutBlueIn = 0f; public const float ColourLossGreenOutRedIn = 6f; public const float ColourLossGreenOutGreenIn = 66f; public const float ColourLossGreenOutBlueIn = 28f; public const float ColourLossBlueOutRedIn = 6f; public const float ColourLossBlueOutGreenIn = 62f; public const float ColourLossBlueOutBlueIn = 32f; public const float ColourLossRedHueSat = 0.58f; public const float ColourLossRedShoulderHueSat = 0.48f; public const float ColourLossNonRedHueSat = 0.05f; public const float ColourLossRedGain = 1.06f; public const float ColourLossNeutralGain = 0.96f; } public enum BoiledOnePhase : byte { Dormant, Haunting, Resting, Killing } public enum BoiledOneKillTrigger : byte { Exhaustion, Proximity } public interface IBoiledOneHaunt { BoiledOnePhase Phase { get; } PlayerControllerB Target { get; } bool TargetInShip { get; } bool IsLocalTarget { get; } bool IsPresent { get; } BoiledOneKillTrigger KillTrigger { get; } event Action StateChanged; bool TryBeginKill(BoiledOneKillTrigger trigger); void EndKill(); } [DisallowMultipleComponent] internal sealed class BoiledOneKill : MonoBehaviour { private readonly BoiledOneKillHost _host = new BoiledOneKillHost(); private IBoiledOneHaunt _haunt; private EnemyAI _enemy; private BoiledOneVictimHold _hold; private bool _wasLocalKill; private void Start() { _haunt = ((Component)this).GetComponent<IBoiledOneHaunt>(); _enemy = ((Component)this).GetComponent<EnemyAI>(); if (_haunt == null || (Object)(object)_enemy == (Object)null) { ((Behaviour)this).enabled = false; } } private void Update() { if (((NetworkBehaviour)_enemy).IsServer && ((NetworkBehaviour)_enemy).IsSpawned) { TickHost(); } bool flag = _haunt.Phase == BoiledOnePhase.Killing && _haunt.IsLocalTarget; if (flag && !_wasLocalKill) { BeginLocalHold(_haunt.Target); } _wasLocalKill = flag; } private void TickHost() { //IL_0052: Unknown result type (might be due to invalid IL or missing references) //IL_005d: Unknown result type (might be due to invalid IL or missing references) //IL_0062: Unknown result type (might be due to invalid IL or missing references) //IL_0067: Unknown result type (might be due to invalid IL or missing references) PlayerControllerB target = _haunt.Target; bool targetLost = (Object)(object)target == (Object)null || target.isPlayerDead || !target.isPlayerControlled || target.disconnectedMidGame; float num; if (!((Object)(object)target != (Object)null) || !_haunt.IsPresent) { num = float.PositiveInfinity; } else { Vector3 val = ((Component)this).transform.position - ((Component)target).transform.position; num = ((Vector3)(ref val)).sqrMagnitude; } float sqrDistanceMetres = num; bool targetInShip = _haunt.TargetInShip || ((Object)(object)target != (Object)null && target.isInHangarShipRoom); _host.Tick(_haunt, sqrDistanceMetres, targetLost, targetInShip, Time.deltaTime); } private void BeginLocalHold(PlayerControllerB target) { GameNetworkManager instance = GameNetworkManager.Instance; if ((Object)(object)target == (Object)null || (Object)(object)instance == (Object)null || (Object)(object)target != (Object)(object)instance.localPlayerController || !((NetworkBehaviour)target).IsOwner || target.isPlayerDead || !target.isPlayerControlled) { return; } if ((Object)(object)_hold == (Object)null) { _hold = ((Component)this).GetComponent<BoiledOneVictimHold>(); if ((Object)(object)_hold == (Object)null) { _hold = ((Component)this).gameObject.AddComponent<BoiledOneVictimHold>(); } } _hold.Begin(target, _haunt, _enemy.creatureAnimator, _haunt.KillTrigger); } } internal sealed class BoiledOneKillHost { private PlayerControllerB _victim; private float _killSeconds; private float _secondsSinceRefusal = 0.5f; internal void Tick(IBoiledOneHaunt haunt, float sqrDistanceMetres, bool targetLost, bool targetInShip, float deltaTime) { if (haunt.Phase == BoiledOnePhase.Killing) { PlayerControllerB target = haunt.Target; if (target != _victim) { _victim = target; _killSeconds = 0f; } else { _killSeconds += deltaTime; } if (BoiledOneKillTimeline.HostEndsKill(_killSeconds, targetLost, targetInShip)) { _victim = null; haunt.EndKill(); } } else { _victim = null; _secondsSinceRefusal += deltaTime; if (BoiledOneKillTimeline.ProximityKillDue(haunt.Phase, haunt.IsPresent, targetInShip, sqrDistanceMetres, _secondsSinceRefusal) && !haunt.TryBeginKill(BoiledOneKillTrigger.Proximity)) { _secondsSinceRefusal = 0f; } } } } [Flags] internal enum BoiledOneKillCues : byte { None = 0, Down = 1, Speak = 2, Heartbeat = 4, HorrorFx = 8 } internal enum BoiledOneVictimStep : byte { Hold, Kill, Abort, Finish } internal static class BoiledOneKillTimeline { private const float FramesPerSecond = 30f; internal const float ClipSeconds = 5f; internal const float SpeakSeconds = 2f / 15f; internal const float HeartbeatSeconds = 19f / 30f; internal const float HorrorFxSeconds = 3.6333334f; internal const float KillPlayerSeconds = 4.4f; internal const float EndCameraSeconds = 4.633333f; internal const float
Y4NGZLocust.dll
Decompiled 2 hours ago
The result has been truncated due to the large size, download it to view full contents!
using System; using System.Collections; using System.Collections.Generic; using System.Diagnostics; using System.Globalization; using System.IO; using System.Reflection; using System.Reflection.Emit; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using System.Security.Cryptography; using System.Text; using System.Text.RegularExpressions; using BepInEx; using BepInEx.Bootstrap; using BepInEx.Configuration; using BepInEx.Logging; using Dawn; using DunGen; using GameNetcodeStuff; using HarmonyLib; using Microsoft.CodeAnalysis; using Unity.Netcode; using UnityEngine; using UnityEngine.AI; using UnityEngine.Audio; using UnityEngine.Events; using UnityEngine.InputSystem; using UnityEngine.InputSystem.Utilities; using UnityEngine.Rendering; using UnityEngine.SceneManagement; using Y4NGZCompany.Facility.Interior.Placement; using Y4NGZCore.Modules.Monitor; using Y4NGZCore.Modules.ShipSystems; using Y4NGZLocust; using Y4NGZLocust.Broadcast; using Y4NGZLocust.Emergence; using Y4NGZLocust.NetcodePatcher; using Y4NGZLocust.ShipDoor; using Y4NGZMonsters.Shared; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")] [assembly: AssemblyCompany("Y4NGZLocust")] [assembly: AssemblyConfiguration("Release")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0+597d0743e3d9fad0ef076615b4f8bdf577fcfd15")] [assembly: AssemblyProduct("Y4NGZLocust")] [assembly: AssemblyTitle("Y4NGZLocust")] [assembly: AssemblyVersion("1.0.0.0")] [module: RefSafetyRules(11)] [module: NetcodePatchedAssembly] namespace Microsoft.CodeAnalysis { [CompilerGenerated] [Embedded] internal sealed class EmbeddedAttribute : Attribute { } } namespace System.Runtime.CompilerServices { [CompilerGenerated] [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] [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] [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 Y4NGZLocust { internal enum HuntAttackKind : byte { None, ImpaleThrow, ImpaleSlam, ImpaleSweep, CrouchStab } internal enum HuntImpaleState : byte { None, Pinned, Flung, Dropped } internal readonly struct HuntAttackSpec { internal readonly HuntAttackKind Kind; internal readonly HuntClip Clip; internal readonly string StateName; internal readonly bool UsesLeftNeedle; internal readonly string NeedleBoneName; internal readonly string SocketBoneName; internal readonly string SocketPath; internal readonly bool IsCrouched; internal readonly float ActiveHitStartSeconds; internal readonly float ActiveHitEndSeconds; internal readonly float ReleaseSeconds; internal readonly float ClipSeconds; internal readonly float ReleaseTangentLocalX; internal readonly float ReleaseTangentLocalY; internal readonly float ReleaseTangentLocalZ; internal readonly float ReleaseSpeedMps; internal readonly float MaxHeightMeters; internal HuntAttackSpec(HuntAttackKind kind, HuntClip clip, string stateName, bool usesLeftNeedle, string needleBoneName, string socketBoneName, string socketPath, bool isCrouched, float activeHitStartSeconds, float activeHitEndSeconds, float releaseSeconds, float clipSeconds, float releaseTangentLocalX, float releaseTangentLocalY, float releaseTangentLocalZ, float releaseSpeedMps, float maxHeightMeters) { Kind = kind; Clip = clip; StateName = stateName; UsesLeftNeedle = usesLeftNeedle; NeedleBoneName = needleBoneName; SocketBoneName = socketBoneName; SocketPath = socketPath; IsCrouched = isCrouched; ActiveHitStartSeconds = activeHitStartSeconds; ActiveHitEndSeconds = activeHitEndSeconds; ReleaseSeconds = releaseSeconds; ClipSeconds = clipSeconds; ReleaseTangentLocalX = releaseTangentLocalX; ReleaseTangentLocalY = releaseTangentLocalY; ReleaseTangentLocalZ = releaseTangentLocalZ; ReleaseSpeedMps = releaseSpeedMps; MaxHeightMeters = maxHeightMeters; } } internal static class HuntAttackCatalog { internal const float Fps = 60f; internal const float NeedleBladeLocalLength = 1.0668f; internal const float SocketLocalY = 0.6934f; internal const float CrouchCeilingLimitMeters = 2.04f; internal const string RightNeedleBoneName = "Needle.R"; internal const string LeftNeedleBoneName = "Needle.L"; internal const string RightSocketBoneName = "ImpaleSocket"; internal const string LeftSocketBoneName = "ImpaleSocket.L"; internal const string RightSocketPath = "VisualRoot/Locust_Rig/Locust/Root/SMILE/LowerTorso/MiddleTorso/UpperTorso/UpperArm.R/LowerArm.R/Needle.R/ImpaleSocket"; internal const string LeftSocketPath = "VisualRoot/Locust_Rig/Locust/Root/SMILE/LowerTorso/MiddleTorso/UpperTorso/UpperArm.L/LowerArm.L/Needle.L/ImpaleSocket.L"; internal static readonly HuntAttackSpec ImpaleThrow = new HuntAttackSpec(HuntAttackKind.ImpaleThrow, HuntClip.ImpaleThrow, "ImpaleThrow", usesLeftNeedle: false, "Needle.R", "ImpaleSocket", "VisualRoot/Locust_Rig/Locust/Root/SMILE/LowerTorso/MiddleTorso/UpperTorso/UpperArm.R/LowerArm.R/Needle.R/ImpaleSocket", isCrouched: false, 0.25f, 0.45f, 1.7833333f, 2.4f, -0.927f, -0.265f, 0.265f, 15.463f, 3.471f); internal static readonly HuntAttackSpec ImpaleSlam = new HuntAttackSpec(HuntAttackKind.ImpaleSlam, HuntClip.ImpaleSlam, "ImpaleSlam", usesLeftNeedle: true, "Needle.L", "ImpaleSocket.L", "VisualRoot/Locust_Rig/Locust/Root/SMILE/LowerTorso/MiddleTorso/UpperTorso/UpperArm.L/LowerArm.L/Needle.L/ImpaleSocket.L", isCrouched: false, 0.35f, 0.55f, 1.55f, 2.4f, 0.061f, -0.81f, 0.583f, 16.754f, 3.472f); internal static readonly HuntAttackSpec ImpaleSweep = new HuntAttackSpec(HuntAttackKind.ImpaleSweep, HuntClip.ImpaleSweep, "ImpaleSweep", usesLeftNeedle: false, "Needle.R", "ImpaleSocket", "VisualRoot/Locust_Rig/Locust/Root/SMILE/LowerTorso/MiddleTorso/UpperTorso/UpperArm.R/LowerArm.R/Needle.R/ImpaleSocket", isCrouched: false, 0.35f, 0.85f, 0.9f, 2.2f, -0.975f, -0.171f, 0.143f, 15.456f, 3.472f); internal static readonly HuntAttackSpec CrouchStab = new HuntAttackSpec(HuntAttackKind.CrouchStab, HuntClip.CrouchStab, "CrouchStab", usesLeftNeedle: false, "Needle.R", "ImpaleSocket", "VisualRoot/Locust_Rig/Locust/Root/SMILE/LowerTorso/MiddleTorso/UpperTorso/UpperArm.R/LowerArm.R/Needle.R/ImpaleSocket", isCrouched: true, 17f / 60f, 31f / 60f, 53f / 60f, 1.8f, -0.966f, -0.171f, 0.193f, 15.702f, 1.955f); internal static readonly HuntAttackSpec[] All = new HuntAttackSpec[4] { ImpaleThrow, ImpaleSlam, ImpaleSweep, CrouchStab }; private static readonly HuntAttackKind[] StandingAttacks = new HuntAttackKind[3] { HuntAttackKind.ImpaleThrow, HuntAttackKind.ImpaleSlam, HuntAttackKind.ImpaleSweep }; internal static bool IsStanding(HuntAttackKind kind) { if (kind != HuntAttackKind.ImpaleThrow && kind != HuntAttackKind.ImpaleSlam) { return kind == HuntAttackKind.ImpaleSweep; } return true; } internal static bool TryGet(HuntAttackKind kind, out HuntAttackSpec spec) { switch (kind) { case HuntAttackKind.ImpaleThrow: spec = ImpaleThrow; return true; case HuntAttackKind.ImpaleSlam: spec = ImpaleSlam; return true; case HuntAttackKind.ImpaleSweep: spec = ImpaleSweep; return true; case HuntAttackKind.CrouchStab: spec = CrouchStab; return true; default: spec = default(HuntAttackSpec); return false; } } internal static HuntAttackSpec GetOrFallback(HuntAttackKind kind, bool crouched) { if (TryGet(kind, out var spec)) { return spec; } if (!crouched) { return ImpaleThrow; } return CrouchStab; } internal static HuntClip ClipFor(HuntAttackKind kind, bool crouched) { return GetOrFallback(kind, crouched).Clip; } internal static HuntAttackKind Select(bool crouched, HuntAttackKind lastStanding, Func<int, int> nextInt) { if (crouched) { return HuntAttackKind.CrouchStab; } bool flag = IsStanding(lastStanding); int num = (flag ? (StandingAttacks.Length - 1) : StandingAttacks.Length); int num2 = nextInt?.Invoke(num) ?? 0; if (num2 < 0) { num2 = 0; } else if (num2 >= num) { num2 %= num; } int num3 = 0; for (int i = 0; i < StandingAttacks.Length; i++) { HuntAttackKind huntAttackKind = StandingAttacks[i]; if (!flag || huntAttackKind != lastStanding) { if (num3 == num2) { return huntAttackKind; } num3++; } } return HuntAttackKind.ImpaleThrow; } } internal enum HuntAttackPhase : byte { Idle, Windup, ActiveSwing, FollowThroughWhiff, ImpaledLift, PostRelease } internal enum HuntAttackEvent : byte { None, ReleaseFling, FinishWhiff, FinishKill, AbortDrop, AbortClean } internal static class HuntAttackRules { internal const float InitiateReachPastBody = 1.85f; internal const float StandingInitiateVerticalMax = 2f; internal const float CrouchedInitiateVerticalMax = 1.65f; internal const float WhiffCooldownSeconds = 0.65f; internal const float KillCooldownSeconds = 0.85f; internal const float AbortCooldownSeconds = 0.75f; internal const float MaxPendingBodyWaitSeconds = 1.5f; internal static float InitiateHorizontalReach(in HuntBody body) { return body.BodyRadius + 1.85f; } internal static float InitiateVerticalReach(bool crouched, in HuntBody body) { return Math.Min(crouched ? 1.65f : 2f, crouched ? body.CrouchHeight : body.StandHeight); } internal static bool CanInitiate(LocustState state, bool stunned, bool attackActive, float now, float nextAllowedAttackTime, bool crouched, bool targetAlive, bool targetTargetable, float horizontalDistance, float verticalDistance, in HuntBody body) { if ((state == LocustState.Roam || state == LocustState.Chase) && !stunned && !attackActive && now >= nextAllowedAttackTime && targetAlive && targetTargetable && horizontalDistance >= 0f && verticalDistance >= 0f && horizontalDistance <= InitiateHorizontalReach(in body)) { return verticalDistance <= InitiateVerticalReach(crouched, in body); } return false; } internal static bool IsTrackingFacing(in HuntAttackSpec spec, float elapsed) { if (elapsed >= 0f) { return elapsed < spec.ActiveHitStartSeconds; } return false; } internal static bool IsActiveHitWindow(in HuntAttackSpec spec, float elapsed) { if (elapsed >= spec.ActiveHitStartSeconds) { return elapsed <= spec.ActiveHitEndSeconds; } return false; } } internal sealed class HuntAttackStateMachine { private bool _active; private HuntAttackSpec _attack; private int _aimSlot = -1; private int _impaledSlot = -1; private float _elapsed; private HuntAttackPhase _phase; private float _nextAllowedAttackTime = float.NegativeInfinity; private HuntAttackKind _lastStandingAttack; internal bool Active => _active; internal HuntAttackSpec Attack => _attack; internal int AimSlot => _aimSlot; internal int ImpaledSlot => _impaledSlot; internal float Elapsed => _elapsed; internal HuntAttackPhase Phase => _phase; internal float NextAllowedAttackTime => _nextAllowedAttackTime; internal HuntAttackKind LastStandingAttack => _lastStandingAttack; internal bool IsTrackingFacing { get { if (_active && _phase == HuntAttackPhase.Windup) { return HuntAttackRules.IsTrackingFacing(in _attack, _elapsed); } return false; } } internal bool IsHitWindowOpen { get { if (_active && _impaledSlot < 0) { return HuntAttackRules.IsActiveHitWindow(in _attack, _elapsed); } return false; } } internal bool HasPinnedVictim { get { if (_active && _impaledSlot >= 0) { return _phase == HuntAttackPhase.ImpaledLift; } return false; } } internal bool CanInitiate(LocustState state, bool stunned, float now, bool crouched, bool targetAlive, bool targetTargetable, float horizontalDistance, float verticalDistance, in HuntBody body) { return HuntAttackRules.CanInitiate(state, stunned, _active, now, _nextAllowedAttackTime, crouched, targetAlive, targetTargetable, horizontalDistance, verticalDistance, in body); } internal HuntAttackSpec Begin(bool crouched, int aimSlot, Func<int, int> nextInt) { HuntAttackSpec orFallback = HuntAttackCatalog.GetOrFallback(HuntAttackCatalog.Select(crouched, _lastStandingAttack, nextInt), crouched); if (!crouched && HuntAttackCatalog.IsStanding(orFallback.Kind)) { _lastStandingAttack = orFallback.Kind; } _active = true; _attack = orFallback; _aimSlot = aimSlot; _impaledSlot = -1; _elapsed = 0f; _phase = HuntAttackPhase.Windup; return orFallback; } internal bool TryRegisterContact(int victimSlot) { if (!IsHitWindowOpen || victimSlot < 0) { return false; } _impaledSlot = victimSlot; _phase = ((_elapsed >= _attack.ReleaseSeconds) ? HuntAttackPhase.PostRelease : HuntAttackPhase.ImpaledLift); return true; } internal HuntAttackEvent Step(float deltaTime, float now, bool stunned, bool aimVictimLostInWindup, bool impaledBodyLost) { if (!_active) { return HuntAttackEvent.None; } if (stunned) { return EndWithAbort(now, 0.75f); } if (deltaTime > 0f && !float.IsNaN(deltaTime) && !float.IsInfinity(deltaTime)) { _elapsed += deltaTime; } if (_impaledSlot >= 0) { if (_phase == HuntAttackPhase.ImpaledLift) { if (impaledBodyLost) { return EndWithAbort(now, 0.75f); } if (_elapsed >= _attack.ReleaseSeconds) { _phase = HuntAttackPhase.PostRelease; return HuntAttackEvent.ReleaseFling; } } if (_elapsed >= _attack.ClipSeconds) { ClearActive(); _nextAllowedAttackTime = now + 0.85f; return HuntAttackEvent.FinishKill; } return HuntAttackEvent.None; } if (_elapsed < _attack.ActiveHitStartSeconds) { _phase = HuntAttackPhase.Windup; if (aimVictimLostInWindup) { return EndWithAbort(now, 0.75f); } return HuntAttackEvent.None; } _phase = ((_elapsed <= _attack.ActiveHitEndSeconds) ? HuntAttackPhase.ActiveSwing : HuntAttackPhase.FollowThroughWhiff); if (_elapsed >= _attack.ClipSeconds) { ClearActive(); _nextAllowedAttackTime = now + 0.65f; return HuntAttackEvent.FinishWhiff; } return HuntAttackEvent.None; } internal HuntAttackEvent ForceAbort(float now) { if (!_active) { return HuntAttackEvent.None; } return EndWithAbort(now, 0.75f); } internal void Reset() { ClearActive(); _nextAllowedAttackTime = float.NegativeInfinity; _lastStandingAttack = HuntAttackKind.None; } private HuntAttackEvent EndWithAbort(float now, float cooldown) { bool hasPinnedVictim = HasPinnedVictim; ClearActive(); _nextAllowedAttackTime = now + cooldown; if (!hasPinnedVictim) { return HuntAttackEvent.AbortClean; } return HuntAttackEvent.AbortDrop; } private void ClearActive() { _active = false; _attack = default(HuntAttackSpec); _aimSlot = -1; _impaledSlot = -1; _elapsed = 0f; _phase = HuntAttackPhase.Idle; } } internal static class HuntAudio { private const string Folder = "assets/y4ngz/locust/audio/"; private const int StepCount = 4; internal static readonly AudioClip[] Steps = (AudioClip[])(object)new AudioClip[4]; internal static readonly AudioClip[] Speech = (AudioClip[])(object)new AudioClip[7]; internal static AudioClip Kill { get; private set; } internal static AudioClip IdleLoop { get; private set; } internal static AudioClip Emerge { get; private set; } internal static void Load(AssetBundle bundle) { for (int i = 0; i < Steps.Length; i++) { Steps[i] = LoadClip(bundle, "locust_body_step" + (i + 1)); } for (int j = 0; j < Speech.Length; j++) { Speech[j] = LoadClip(bundle, "locust_speech" + (j + 1)); } Kill = LoadClip(bundle, "locust_killsfx"); IdleLoop = LoadClip(bundle, "locust_idleloop"); Emerge = LoadClip(bundle, "locust_emerge"); } private static AudioClip LoadClip(AssetBundle bundle, string name) { string text = "assets/y4ngz/locust/audio/" + name + ".wav"; AudioClip obj = bundle.LoadAsset<AudioClip>(text); if ((Object)(object)obj == (Object)null) { Plugin.Log.LogWarning((object)("[Locust] y4ngzlocust.bundle has no " + text + "; the hunt plays without it.")); } return obj; } } internal readonly struct HuntBody { internal const float SourceStandHeight = 2.772f; internal const float SourceCrouchHeight = 1.5953126f; internal const float SourceBodyRadius = 0.4f; internal const float SourceCollisionHalfWidth = 0.5f; internal const float SourceHeadroomMargin = 0.1f; internal const float SourceWalkSpeed = 2.1f; internal const float SourceRunSpeed = 7.81f; internal const float SourceCrouchWalkSpeed = 1.52f; internal const float SourceMoveStartSpeed = 0.35f; internal const float SourceMoveStopSpeed = 0.12f; internal const float CatchReachPastBody = 2.4f; internal const float CrouchLeadSeconds = 0.35f; internal float Scale { get; } internal float StandHeight => 2.772f * Scale; internal float CrouchHeight => 1.5953126f * Scale; internal float BodyRadius => 0.4f * Scale; internal float StandClearance => 2.872f * Scale; internal float CatchReach => 0.5f * Scale + 2.4f; internal float MoveStartSpeed => 0.35f * Scale; internal float MoveStopSpeed => 0.12f * Scale; internal HuntBody(float scale) { Scale = ((scale > 0f) ? scale : 1f); } internal float NativeSpeed(HuntClip clip) { return clip switch { HuntClip.Walk => 2.1f * Scale, HuntClip.Run => 7.81f * Scale, HuntClip.CrouchWalk => 1.52f * Scale, _ => 0f, }; } internal float ProbeLookahead(float speed) { return BodyRadius + Math.Max(0f, speed) * 0.35f; } } internal struct HuntSighting { internal int Slot; internal float Distance; internal HuntSighting(int slot, float distance) { Slot = slot; Distance = distance; } } internal sealed class HuntBrain { internal const float AcquireSeconds = 0.2f; internal const float RetargetBuffer = 1.5f; private bool _noticing; internal int TargetSlot { get; private set; } = -1; internal float SecondsUnseen { get; private set; } internal float SecondsNoticing { get; private set; } internal void Reset() { TargetSlot = -1; SecondsUnseen = 0f; SecondsNoticing = 0f; _noticing = false; } internal LocustState Tick(LocustState state, bool stunned, HuntSighting[] visible, int visibleCount, bool targetTargetable, float deltaTime, float loseSeconds) { if (stunned) { return state; } return state switch { LocustState.Roam => TickRoam(visible, visibleCount, deltaTime), LocustState.Chase => TickChase(visible, visibleCount, targetTargetable, deltaTime, loseSeconds), _ => state, }; } private LocustState TickRoam(HuntSighting[] visible, int visibleCount, float deltaTime) { int num = Closest(visible, visibleCount); if (num < 0) { SecondsNoticing = 0f; _noticing = false; return LocustState.Roam; } if (!_noticing) { _noticing = true; SecondsNoticing = 0f; } else { SecondsNoticing += deltaTime; } if (SecondsNoticing < 0.2f) { return LocustState.Roam; } TargetSlot = visible[num].Slot; SecondsUnseen = 0f; SecondsNoticing = 0f; _noticing = false; return LocustState.Chase; } private LocustState TickChase(HuntSighting[] visible, int visibleCount, bool targetTargetable, float deltaTime, float loseSeconds) { if (TargetSlot < 0 || !targetTargetable) { Reset(); return LocustState.Roam; } int num = Closest(visible, visibleCount); if (num >= 0) { SecondsUnseen = 0f; int num2 = IndexOf(visible, visibleCount, TargetSlot); if (num2 < 0 || (visible[num].Slot != TargetSlot && visible[num].Distance < visible[num2].Distance - 1.5f)) { TargetSlot = visible[num].Slot; } return LocustState.Chase; } SecondsUnseen += deltaTime; if (SecondsUnseen < loseSeconds) { return LocustState.Chase; } Reset(); return LocustState.Roam; } private static int Closest(HuntSighting[] visible, int visibleCount) { int num = -1; for (int i = 0; i < visibleCount; i++) { if (num < 0 || visible[i].Distance < visible[num].Distance) { num = i; } } return num; } private static int IndexOf(HuntSighting[] visible, int visibleCount, int slot) { for (int i = 0; i < visibleCount; i++) { if (visible[i].Slot == slot) { return i; } } return -1; } } internal static class HuntCatchRules { internal const float ReleaseSeconds = 0.3f; internal const float RecatchGraceSeconds = 2f; internal static float JumpscareSeconds => HuntGait.ClipLength(HuntClip.Jumpscare); internal static bool CanBegin(LocustState state, bool stunned, bool catchInProgress, bool victimAlive, bool victimJustReleased, bool victimTargetable, float horizontalDistance, float verticalDistance, in HuntBody body) { if ((state == LocustState.Roam || state == LocustState.Chase) && !stunned && !catchInProgress && victimAlive && !victimJustReleased && victimTargetable && horizontalDistance <= body.CatchReach) { return verticalDistance <= body.StandHeight; } return false; } internal static bool VictimLeft(bool isPlayerControlled, bool isPlayerDead) { if (!isPlayerControlled) { return !isPlayerDead; } return false; } } internal enum HuntClip { None, Idle, Walk, Run, CrouchIdle, CrouchWalk, Jumpscare, ImpaleThrow, ImpaleSlam, ImpaleSweep, CrouchStab } internal static class HuntGait { internal const float MinPlayback = 0.3f; internal const float MaxPlayback = 2.5f; private const float Fps = 60f; private static readonly float[] NoSteps = Array.Empty<float>(); private static readonly float[] WalkSteps = Frames(40f, 80f, 120f, 160f, 200f, 240f, 280f, 320f); private static readonly float[] RunSteps = Frames(2f, 22f); private static readonly float[] CrouchWalkSteps = Frames(55f, 110f); internal static bool IsAttack(HuntClip clip) { if (clip != HuntClip.ImpaleThrow && clip != HuntClip.ImpaleSlam && clip != HuntClip.ImpaleSweep && clip != HuntClip.CrouchStab) { return clip == HuntClip.Jumpscare; } return true; } internal static string StateName(HuntClip clip) { return clip switch { HuntClip.Idle => "Idle", HuntClip.Walk => "Walk", HuntClip.Run => "Run", HuntClip.CrouchIdle => "CrouchIdle", HuntClip.CrouchWalk => "CrouchWalk", HuntClip.Jumpscare => "Jumpscare", HuntClip.ImpaleThrow => "ImpaleThrow", HuntClip.ImpaleSlam => "ImpaleSlam", HuntClip.ImpaleSweep => "ImpaleSweep", HuntClip.CrouchStab => "CrouchStab", _ => null, }; } internal static HuntClip Choose(LocustState state, bool crouched, bool moving, bool stunned) { return Choose(state, crouched, moving, stunned, HuntClip.None); } internal static HuntClip Choose(LocustState state, bool crouched, bool moving, bool stunned, HuntClip attackClip) { if (!LocustStates.IsHunt(state)) { return HuntClip.None; } if (state == LocustState.Catch) { if (stunned) { if (!crouched) { return HuntClip.Idle; } return HuntClip.CrouchIdle; } if (IsAttack(attackClip)) { return attackClip; } if (!crouched) { return HuntClip.ImpaleThrow; } return HuntClip.CrouchStab; } if (stunned || !moving) { if (!crouched) { return HuntClip.Idle; } return HuntClip.CrouchIdle; } if (crouched) { return HuntClip.CrouchWalk; } if (state != LocustState.Chase) { return HuntClip.Walk; } return HuntClip.Run; } internal static bool UpdateMoving(bool wasMoving, float speed, in HuntBody body) { if (!wasMoving) { return speed > body.MoveStartSpeed; } return !(speed < body.MoveStopSpeed); } internal static float PlaybackSpeed(HuntClip clip, float moveSpeed, in HuntBody body) { float num = body.NativeSpeed(clip); if (!(num > 0f)) { return 1f; } return Math.Clamp(moveSpeed / num, 0.3f, 2.5f); } internal static float ClipLength(HuntClip clip) { return clip switch { HuntClip.Idle => 10f, HuntClip.Walk => 5.3333335f, HuntClip.Run => 2f / 3f, HuntClip.CrouchIdle => 12.4f, HuntClip.CrouchWalk => 1.8333334f, HuntClip.Jumpscare => 1.7f, HuntClip.ImpaleThrow => 2.4f, HuntClip.ImpaleSlam => 2.4f, HuntClip.ImpaleSweep => 2.2f, HuntClip.CrouchStab => 1.8f, _ => 0f, }; } internal static float[] StepTimes(HuntClip clip) { return clip switch { HuntClip.Walk => WalkSteps, HuntClip.Run => RunSteps, HuntClip.CrouchWalk => CrouchWalkSteps, _ => NoSteps, }; } private static float[] Frames(params float[] frames) { float[] array = new float[frames.Length]; for (int i = 0; i < frames.Length; i++) { array[i] = frames[i] / 60f; } return array; } } internal static class HuntHeadroom { internal static int FirstLowSpan(in HuntBody body, float floor, float[] bottoms, float[] tops, int count) { float num = floor + body.CrouchHeight; float num2 = floor + body.StandClearance; for (int i = 0; i < count; i++) { if (bottoms[i] < num2 && tops[i] > num) { return i; } } return -1; } } internal readonly struct HuntVec3 { internal static readonly HuntVec3 Zero = new HuntVec3(0f, 0f, 0f); internal readonly float X; internal readonly float Y; internal readonly float Z; internal bool IsFinite { get { if (!float.IsNaN(X) && !float.IsInfinity(X) && !float.IsNaN(Y) && !float.IsInfinity(Y) && !float.IsNaN(Z)) { return !float.IsInfinity(Z); } return false; } } internal float SqrMagnitude => X * X + Y * Y + Z * Z; internal float Magnitude => (float)Math.Sqrt(SqrMagnitude); internal HuntVec3(float x, float y, float z) { X = x; Y = y; Z = z; } internal static float Dot(HuntVec3 a, HuntVec3 b) { return a.X * b.X + a.Y * b.Y + a.Z * b.Z; } public static HuntVec3 operator +(HuntVec3 a, HuntVec3 b) { return new HuntVec3(a.X + b.X, a.Y + b.Y, a.Z + b.Z); } public static HuntVec3 operator -(HuntVec3 a, HuntVec3 b) { return new HuntVec3(a.X - b.X, a.Y - b.Y, a.Z - b.Z); } public static HuntVec3 operator *(HuntVec3 a, float s) { return new HuntVec3(a.X * s, a.Y * s, a.Z * s); } internal static HuntVec3 Lerp(HuntVec3 a, HuntVec3 b, float t) { return new HuntVec3(a.X + (b.X - a.X) * t, a.Y + (b.Y - a.Y) * t, a.Z + (b.Z - a.Z) * t); } } internal struct HuntThrownCorpseState { internal float ElapsedSeconds; internal float SettledSeconds; internal float CooldownRemaining; internal int SplatterCount; internal bool GibAttempted; internal bool Disarmed; } internal readonly struct HuntCorpseImpactDecision { internal readonly bool ShouldSplatter; internal readonly float SplatterScale; internal readonly bool ShouldRequestGib; internal readonly bool ShouldDisarm; internal HuntCorpseImpactDecision(bool shouldSplatter, float splatterScale, bool shouldRequestGib, bool shouldDisarm) { ShouldSplatter = shouldSplatter; SplatterScale = splatterScale; ShouldRequestGib = shouldRequestGib; ShouldDisarm = shouldDisarm; } } internal static class HuntImpalePhysics { internal const float BladeCapsuleRadius = 0.24f; internal const float PlayerCapsuleRadius = 0.32f; internal const float PlayerCapsuleBottomOffset = 0.35f; internal const float PlayerCapsuleDefaultTopOffset = 1.55f; internal const float PlayerCapsuleMinTopOffset = 0.9f; internal const float PlayerCapsuleMaxTopOffset = 1.75f; internal const float MeasuredVelocityBlendWeight = 0.35f; internal const float MinMeasuredVelocityForBlendMps = 3f; internal const float MinMeasuredAlignmentDot = 0.25f; internal const float MinReleaseSpeedMps = 12f; internal const float MaxReleaseSpeedMps = 22f; internal const float GentleDropMaxSpeedMps = 1.25f; internal const float GentleDropMaxUpSpeedMps = 0.5f; internal const float MaxTrackSeconds = 2.5f; internal const float SplatterMinSpeedMps = 5.5f; internal const float GibMinSpeedMps = 8.5f; internal const float MinNormalApproachSpeedMps = 2f; internal const float ImpactCooldownSeconds = 0.14f; internal const int MaxSplatterImpacts = 3; internal const float SettleSpeedMps = 1f; internal const float SettleDurationSeconds = 0.35f; internal const float MinSplatterScale = 0.7f; internal const float MaxSplatterScale = 1.8f; internal static float SegmentSegmentDistanceSq(HuntVec3 p1, HuntVec3 q1, HuntVec3 p2, HuntVec3 q2, out HuntVec3 closestOnFirst, out HuntVec3 closestOnSecond) { HuntVec3 huntVec = q1 - p1; HuntVec3 huntVec2 = q2 - p2; HuntVec3 b = p1 - p2; float num = HuntVec3.Dot(huntVec, huntVec); float num2 = HuntVec3.Dot(huntVec2, huntVec2); float num3 = HuntVec3.Dot(huntVec2, b); if (num <= 1E-06f && num2 <= 1E-06f) { closestOnFirst = p1; closestOnSecond = p2; return (p1 - p2).SqrMagnitude; } float num4; float num5; if (num <= 1E-06f) { num4 = 0f; num5 = Clamp01(num3 / num2); } else { float num6 = HuntVec3.Dot(huntVec, b); if (num2 <= 1E-06f) { num5 = 0f; num4 = Clamp01((0f - num6) / num); } else { float num7 = HuntVec3.Dot(huntVec, huntVec2); float num8 = num * num2 - num7 * num7; num4 = ((num8 > 1E-06f) ? Clamp01((num7 * num3 - num6 * num2) / num8) : 0f); num5 = (num7 * num4 + num3) / num2; if (num5 < 0f) { num5 = 0f; num4 = Clamp01((0f - num6) / num); } else if (num5 > 1f) { num5 = 1f; num4 = Clamp01((num7 - num6) / num); } } } closestOnFirst = p1 + huntVec * num4; closestOnSecond = p2 + huntVec2 * num5; return (closestOnFirst - closestOnSecond).SqrMagnitude; } internal static bool TestBladeHit(HuntVec3 locustOrigin, HuntVec3 locustForward, HuntVec3 bladeBase, HuntVec3 bladeTip, float bladeRadius, HuntVec3 playerCapsuleBottom, HuntVec3 playerCapsuleTop, float playerRadius, out HuntVec3 contactPoint, out float distanceSq) { contactPoint = HuntVec3.Zero; distanceSq = float.PositiveInfinity; if (!locustOrigin.IsFinite || !locustForward.IsFinite || !bladeBase.IsFinite || !bladeTip.IsFinite || !playerCapsuleBottom.IsFinite || !playerCapsuleTop.IsFinite || bladeRadius < 0f || playerRadius < 0f || float.IsNaN(bladeRadius) || float.IsNaN(playerRadius)) { return false; } float num = locustForward.X * locustForward.X + locustForward.Z * locustForward.Z; if (num > 1E-06f) { float num2 = 1f / (float)Math.Sqrt(num); float num3 = locustForward.X * num2; float num4 = locustForward.Z * num2; float num5 = 0.5f * (playerCapsuleBottom.X + playerCapsuleTop.X) - locustOrigin.X; float num6 = 0.5f * (playerCapsuleBottom.Z + playerCapsuleTop.Z) - locustOrigin.Z; if (num5 * num5 + num6 * num6 > 0.0025f && num5 * num3 + num6 * num4 <= 0f) { return false; } } float num7 = bladeRadius + playerRadius; distanceSq = SegmentSegmentDistanceSq(bladeBase, bladeTip, playerCapsuleBottom, playerCapsuleTop, out var closestOnFirst, out var closestOnSecond); if (distanceSq > num7 * num7) { return false; } contactPoint = HuntVec3.Lerp(closestOnFirst, closestOnSecond, 0.5f); return true; } internal static HuntVec3 ComputeReleaseVelocity(HuntVec3 authoredWorldTangent, float authoredSpeedMps, HuntVec3 measuredSocketVelocity, bool hasMeasuredVelocity, bool isGentleDrop) { if (isGentleDrop) { return ComputeGentleDropVelocity(measuredSocketVelocity, hasMeasuredVelocity); } float num = ((float.IsNaN(authoredSpeedMps) || float.IsInfinity(authoredSpeedMps)) ? 12f : Clamp(authoredSpeedMps, 12f, 22f)); HuntVec3 huntVec; if (authoredWorldTangent.IsFinite && authoredWorldTangent.SqrMagnitude > 1E-06f) { float num2 = 1f / authoredWorldTangent.Magnitude; huntVec = authoredWorldTangent * num2; } else { huntVec = new HuntVec3(0f, -0.24253562f, 0.9701425f); } HuntVec3 huntVec2 = huntVec * num; if (!hasMeasuredVelocity || !measuredSocketVelocity.IsFinite) { return huntVec2; } float magnitude = measuredSocketVelocity.Magnitude; if (magnitude < 3f) { return huntVec2; } HuntVec3 huntVec3 = measuredSocketVelocity * (1f / magnitude); if (HuntVec3.Dot(huntVec3, huntVec) < 0.25f) { return huntVec2; } float num3 = Clamp(magnitude, 12f, 22f); HuntVec3 b = huntVec3 * num3; HuntVec3 huntVec4 = HuntVec3.Lerp(huntVec2, b, 0.35f); if (!huntVec4.IsFinite || huntVec4.SqrMagnitude <= 1E-06f) { return huntVec2; } float magnitude2 = huntVec4.Magnitude; float num4 = Clamp(magnitude2, 12f, 22f); return huntVec4 * (num4 / magnitude2); } internal static HuntVec3 ComputeGentleDropVelocity(HuntVec3 measuredSocketVelocity, bool hasMeasuredVelocity) { if (!hasMeasuredVelocity || !measuredSocketVelocity.IsFinite) { return HuntVec3.Zero; } float num = Math.Min(measuredSocketVelocity.Y, 0.5f); HuntVec3 huntVec = new HuntVec3(measuredSocketVelocity.X * 0.15f, num * 0.15f, measuredSocketVelocity.Z * 0.15f); float magnitude = huntVec.Magnitude; if (magnitude <= 0.0001f) { return HuntVec3.Zero; } if (magnitude > 1.25f) { return huntVec * (1.25f / magnitude); } return huntVec; } internal static bool AdvanceThrownCorpse(ref HuntThrownCorpseState state, float deltaTime, float currentSpeedMps, bool corpseAliveAndFree, bool alreadyGibbed) { if (state.Disarmed || !corpseAliveAndFree || alreadyGibbed) { state.Disarmed = true; return false; } float num = ((deltaTime > 0f && !float.IsNaN(deltaTime) && !float.IsInfinity(deltaTime)) ? deltaTime : 0f); state.ElapsedSeconds += num; if (state.CooldownRemaining > 0f) { state.CooldownRemaining = Math.Max(0f, state.CooldownRemaining - num); } if (state.ElapsedSeconds >= 2.5f) { state.Disarmed = true; return false; } if (((!float.IsNaN(currentSpeedMps) && !float.IsInfinity(currentSpeedMps)) ? Math.Abs(currentSpeedMps) : 0f) < 1f) { state.SettledSeconds += num; if (state.SettledSeconds >= 0.35f) { state.Disarmed = true; return false; } } else { state.SettledSeconds = 0f; } return true; } internal static HuntCorpseImpactDecision EvaluateCorpseImpact(ref HuntThrownCorpseState state, HuntVec3 impactVelocity, HuntVec3 surfaceNormal, bool isServer, bool alreadyGibbed) { if (state.Disarmed || alreadyGibbed) { state.Disarmed = true; return new HuntCorpseImpactDecision(shouldSplatter: false, 0f, shouldRequestGib: false, shouldDisarm: true); } if (!impactVelocity.IsFinite || !surfaceNormal.IsFinite || surfaceNormal.SqrMagnitude <= 0.0001f) { return new HuntCorpseImpactDecision(shouldSplatter: false, 0f, shouldRequestGib: false, shouldDisarm: false); } if (state.CooldownRemaining > 0f) { return new HuntCorpseImpactDecision(shouldSplatter: false, 0f, shouldRequestGib: false, shouldDisarm: false); } HuntVec3 b = surfaceNormal * (1f / surfaceNormal.Magnitude); if (0f - HuntVec3.Dot(impactVelocity, b) < 2f) { return new HuntCorpseImpactDecision(shouldSplatter: false, 0f, shouldRequestGib: false, shouldDisarm: false); } float magnitude = impactVelocity.Magnitude; if (magnitude < 5.5f) { return new HuntCorpseImpactDecision(shouldSplatter: false, 0f, shouldRequestGib: false, shouldDisarm: false); } bool num = state.SplatterCount < 3; float splatterScale = (num ? Clamp(magnitude / 12f, 0.7f, 1.8f) : 0f); if (num) { state.SplatterCount++; } bool flag = isServer && !state.GibAttempted && magnitude >= 8.5f; if (flag) { state.GibAttempted = true; } state.CooldownRemaining = 0.14f; bool flag2 = state.SplatterCount >= 3 && (!isServer || state.GibAttempted); if (flag2) { state.Disarmed = true; } return new HuntCorpseImpactDecision(num, splatterScale, flag, flag2); } private static float Clamp01(float value) { if (!(value < 0f)) { if (!(value > 1f)) { return value; } return 1f; } return 0f; } private static float Clamp(float value, float min, float max) { if (!(value < min)) { if (!(value > max)) { return value; } return max; } return min; } } internal sealed class HuntPosture { internal const float StandUpDelay = 0.4f; private float _clearSeconds; internal bool Crouched { get; private set; } internal bool Update(bool lowSpace, float deltaTime) { if (lowSpace) { _clearSeconds = 0f; if (Crouched) { return false; } Crouched = true; return true; } if (!Crouched) { return false; } _clearSeconds += deltaTime; if (_clearSeconds < 0.4f) { return false; } Crouched = false; _clearSeconds = 0f; return true; } internal void Reset() { Crouched = false; _clearSeconds = 0f; } } internal sealed class HuntRecatchGuard { private readonly float[] _deadlines; private readonly ulong[] _occupants; internal int Slots => _deadlines.Length; internal HuntRecatchGuard(int slots) { _deadlines = new float[Math.Max(0, slots)]; _occupants = new ulong[_deadlines.Length]; ClearAll(); } internal void Release(int slot, float now, ulong occupant) { if (Has(slot)) { _deadlines[slot] = now + 2f; _occupants[slot] = occupant; } } internal bool Blocks(int slot, float now, ulong occupant) { if (!Has(slot)) { return false; } if (now < _deadlines[slot] && _occupants[slot] == occupant) { return true; } Clear(slot); return false; } internal bool Pending(int slot, float now) { if (Has(slot)) { return now < _deadlines[slot]; } return false; } internal void Refresh(int slot, bool aliveAndControlled, ulong occupant) { if (Has(slot) && (!aliveAndControlled || _occupants[slot] != occupant)) { Clear(slot); } } internal void Clear(int slot) { if (Has(slot)) { _deadlines[slot] = float.NegativeInfinity; } } internal void ClearAll() { for (int i = 0; i < _deadlines.Length; i++) { _deadlines[i] = float.NegativeInfinity; } } private bool Has(int slot) { if (slot >= 0) { return slot < _deadlines.Length; } return false; } } internal static class HuntSight { internal const float Range = 40f; internal const float HalfAngle = 60f; private const float RadToDeg = 57.29578f; internal static bool InView(float headX, float headY, float headZ, float forwardX, float forwardZ, float viewX, float viewY, float viewZ, float proximity, out float distance) { float num = viewX - headX; float num2 = viewY - headY; float num3 = viewZ - headZ; float num4 = num * num + num2 * num2 + num3 * num3; distance = (float)Math.Sqrt(num4); if (distance >= 40f) { return false; } if (!(distance < proximity)) { return Angle(forwardX * forwardX + forwardZ * forwardZ, num4, forwardX * num + forwardZ * num3) < 60f; } return true; } private static float Angle(float fromSquared, float toSquared, float dot) { float num = (float)Math.Sqrt(fromSquared * toSquared); if (num < 1E-15f) { return 0f; } return (float)Math.Acos(Math.Clamp(dot / num, -1f, 1f)) * 57.29578f; } } internal struct HuntSnapshot : INetworkSerializable, IEquatable<HuntSnapshot> { internal static readonly HuntSnapshot Initial = new HuntSnapshot { VictimSlot = -1, ImpaledSlot = -1 }; internal byte State; internal bool Crouched; internal bool Moving; internal ushort MoveSpeedCm; internal short VictimSlot; internal byte CatchSeq; internal byte AttackKind; internal short ImpaledSlot; internal byte ImpaleSeq; internal byte ImpaleState; internal byte SpeechLine; internal byte SpeechSeq; public unsafe void NetworkSerialize<T>(BufferSerializer<T> serializer) where T : IReaderWriter { //IL_0017: Unknown result type (might be due to invalid IL or missing references) //IL_001d: Unknown result type (might be due to invalid IL or missing references) //IL_002d: Unknown result type (might be due to invalid IL or missing references) //IL_0033: Unknown result type (might be due to invalid IL or missing references) //IL_0043: Unknown result type (might be due to invalid IL or missing references) //IL_0049: Unknown result type (might be due to invalid IL or missing references) //IL_0059: Unknown result type (might be due to invalid IL or missing references) //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0089: Unknown result type (might be due to invalid IL or missing references) //IL_008f: Unknown result type (might be due to invalid IL or missing references) serializer.SerializeValue(ref State); ((BufferSerializer<bool>*)(&serializer))->SerializeValue<bool>(ref Crouched, default(ForPrimitives)); ((BufferSerializer<bool>*)(&serializer))->SerializeValue<bool>(ref Moving, default(ForPrimitives)); ((BufferSerializer<ushort>*)(&serializer))->SerializeValue<ushort>(ref MoveSpeedCm, default(ForPrimitives)); ((BufferSerializer<short>*)(&serializer))->SerializeValue<short>(ref VictimSlot, default(ForPrimitives)); serializer.SerializeValue(ref CatchSeq); serializer.SerializeValue(ref AttackKind); ((BufferSerializer<short>*)(&serializer))->SerializeValue<short>(ref ImpaledSlot, default(ForPrimitives)); serializer.SerializeValue(ref ImpaleSeq); serializer.SerializeValue(ref ImpaleState); serializer.SerializeValue(ref SpeechLine); serializer.SerializeValue(ref SpeechSeq); } public bool Equals(HuntSnapshot other) { if (State == other.State && Crouched == other.Crouched && Moving == other.Moving && MoveSpeedCm == other.MoveSpeedCm && VictimSlot == other.VictimSlot && CatchSeq == other.CatchSeq && AttackKind == other.AttackKind && ImpaledSlot == other.ImpaledSlot && ImpaleSeq == other.ImpaleSeq && ImpaleState == other.ImpaleState && SpeechLine == other.SpeechLine) { return SpeechSeq == other.SpeechSeq; } return false; } } internal sealed class HuntSpeech { internal const int LineCount = 7; private readonly Random _random; internal int LastLine { get; private set; } internal double NextAt { get; private set; } internal HuntSpeech(Random random) { _random = random; } internal void Schedule(double now, float minSeconds, float maxSeconds) { NextAt = now + (double)Interval(_random.NextDouble(), minSeconds, maxSeconds); } internal int Tick(double now, bool canSpeak, float minSeconds, float maxSeconds) { if (!canSpeak || now < NextAt) { return 0; } int num = _random.Next((LastLine > 0) ? 6 : 7) + 1; if (LastLine > 0 && num >= LastLine) { num++; } LastLine = num; Schedule(now, minSeconds, maxSeconds); return num; } internal static float Interval(double unit, float minSeconds, float maxSeconds) { double num = Math.Max(0.0, Math.Min(minSeconds, maxSeconds)); double num2 = Math.Max(0.0, Math.Max(minSeconds, maxSeconds)); return (float)(num + unit * (num2 - num)); } } internal sealed class HuntStepTimer { internal HuntClip Clip { get; private set; } internal float Phase { get; private set; } internal int Advance(HuntClip clip, float deltaTime, float playbackSpeed) { if (clip != Clip) { Clip = clip; Phase = 0f; } float num = HuntGait.ClipLength(clip); if (num <= 0f || !(deltaTime > 0f) || !(playbackSpeed > 0f)) { return 0; } float phase = Phase; float num2 = phase + deltaTime * playbackSpeed; Phase = num2 % num; float[] array = HuntGait.StepTimes(clip); int num3 = 0; for (int i = 0; i < array.Length; i++) { num3 += StepsUpTo(num2, array[i], num) - StepsUpTo(phase, array[i], num); } return num3; } internal void Reset() { Clip = HuntClip.None; Phase = 0f; } private static int StepsUpTo(float phase, float t, float length) { return Math.Max(0, (int)MathF.Floor((phase - t) / length) + 1); } } public sealed class LocustAI : EnemyAI { private const int BladeSweepSubsteps = 3; private const float EntryBloodSplatterScale = 0.65f; private const float VictimDeathCameraInitialSeconds = 2.2f; private readonly HuntAttackStateMachine _huntAttack = new HuntAttackStateMachine(); private readonly Random _huntAttackRng = new Random(); private float _huntContactTime; private bool _huntHasPrevBladePose; private Vector3 _huntPrevBladeBase; private Vector3 _huntPrevBladeTip; private LocustRagdollImpale _huntImpale; private bool _huntHasHandledKillRpc; private byte _huntHandledKillAttackSeq; private byte _huntHandledKillImpaleSeq; private const float GaitCrossFade = 0.2f; private const float AttackCrossFade = 0.08f; private const float SpeakCrossFade = 0.1f; private const float FearSightWidth = 80f; private const int FearSightRange = 25; private const float FearProximity = 5f; private const float FearRate = 0.8f; private const float RoamFearCap = 0.5f; private const string SpeakLayerName = "Speak"; private const string SpeakEmptyState = "Empty"; private static readonly int CrouchedHash = Animator.StringToHash("Crouched"); private static readonly string[] SpeakStates = new string[7] { "Speak1", "Speak2", "Speak3", "Speak4", "Speak5", "Speak6", "Speak7" }; private readonly HuntStepTimer _huntSteps = new HuntStepTimer(); private HuntSnapshot _huntApplied = HuntSnapshot.Initial; private bool _huntHasApplied; private bool _huntPresenting; private bool _huntPresentStunned; private HuntClip _huntClip; private int _huntSpeakLayer = -1; private bool _huntSpeaking; private const float WatchIntervalSeconds = 0.2f; private const int WatchRangeMeters = 20; private const float WatchPointDepth = 0.05f; private const float SwitchOffReachMeters = 6f; private const float ChargePublishStep = 0.01f; private readonly NetworkVariable<BroadcastSnapshot> _broadcast = new NetworkVariable<BroadcastSnapshot>(default(BroadcastSnapshot), (NetworkVariableReadPermission)0, (NetworkVariableWritePermission)0); private Renderer[] _bodyRenderers; private Collider[] _bodyColliders; private bool[] _bodyCollidersEnabled; private readonly LocustTvView[] _tvs = new LocustTvView[6]; private bool _warnedClientManifest; private BroadcastSettings _broadcastSettings; private TvPlacementJob _placement; private BroadcastState _broadcastState; private float _publishedCharge; private readonly Vector3[] _tvWatchPoints = (Vector3[])(object)new Vector3[6]; private readonly Vector3[] _tvForwards = (Vector3[])(object)new Vector3[6]; private float _watchTimer; private int _watchedMask; internal const string AnimCrouched = "Crouched"; private readonly ServerOwnershipGuard _ownership = new ServerOwnershipGuard(); private const string EmergenceVisualPath = "VisualRoot"; private static readonly int TvExitHash = Animator.StringToHash("TvExit"); private readonly NetworkVariable<EmergenceSnapshot> _emergence = new NetworkVariable<EmergenceSnapshot>(default(EmergenceSnapshot), (NetworkVariableReadPermission)0, (NetworkVariableWritePermission)0); private bool _warnedClientEmergence; private Vector3 _emergenceStandPoint; private StandResult _emergenceStand; private bool _emergenceBound; private Transform _emergenceVisual; private SkinnedMeshRenderer _emergenceBody; private Transform[] _emergenceBones; private int[] _emergenceGroup; private Transform[] _emergenceStandIns; private Transform[] _emergenceWorking; private Vector3 _emergenceVisualLocalPosition; private Quaternion _emergenceVisualLocalRotation; private Vector3 _emergencePinStart; private Vector3 _emergencePinPosition; private Quaternion _emergencePinRotation; private bool _emergencePresenting; private float _emergenceClock; private int _emergenceSteps; private int _emergenceShown; private bool _emergenceSoundHeld; private Vector3 _emergenceSoundLocalPosition; private Vector3 _emergenceSoundPoint; private const float ProximityAwarenessPerScale = 4f; private const float AgentAcceleration = 35f; private const float AgentAngularSpeed = 600f; private const float ProbeInterval = 0.1f; private const float ProbeRadiusScale = 0.75f; private const float ProbeSpacingRadii = 1.5f; private const int MaxProbeSamples = 12; private const float MaxProbeSlope = 1f; private const int MiscLevelGeometryLayer = 24; private const int ProbeIgnoredLayers = 1572872; private const int ProbeHitCapacity = 16; private const int MaxStateEdgesPerFrame = 3; private static readonly List<LocustAI> LiveHuntInstances = new List<LocustAI>(4); private static bool _huntRoundResetRegistered; private readonly NetworkVariable<HuntSnapshot> _huntSnapshot = new NetworkVariable<HuntSnapshot>(HuntSnapshot.Initial, (NetworkVariableReadPermission)0, (NetworkVariableWritePermission)0); private readonly HuntBrain _huntBrain = new HuntBrain(); private readonly HuntPosture _huntPosture = new HuntPosture(); private readonly HuntSpeech _huntSpeech = new HuntSpeech(new Random()); private readonly AISearchRoutine _huntSearch = new AISearchRoutine(); private HuntBody _huntBody = new HuntBody(1f); private HuntSighting[] _huntSightings = Array.Empty<HuntSighting>(); private bool _huntAudioReady; private LocustState _huntServerState; private HuntSnapshot _huntServerSnapshot = HuntSnapshot.Initial; private bool _huntServerStunned; private bool _huntMoving; private float _huntProbeElapsed; private readonly Collider[] _huntProbeColliders = (Collider[])(object)new Collider[16]; private readonly RaycastHit[] _huntProbeHits = (RaycastHit[])(object)new RaycastHit[16]; private readonly float[] _huntProbeBottoms = new float[16]; private readonly float[] _huntProbeTops = new float[16]; private readonly Collider[] _huntProbeSpanColliders = (Collider[])(object)new Collider[16]; private int _huntLowSample; private int _huntLowSamples; private Vector3 _huntLowFloor; private string _huntLowKind; private Collider _huntLowCollider; private float _huntLowBottom; private float _huntLowTop; private Transform _huntHead; private bool _huntHeadSearched; private bool _huntHeadWarned; private const float FlashChargePublishStep = 0.02f; private readonly NetworkVariable<ShipDoorSnapshot> _shipDoor = new NetworkVariable<ShipDoorSnapshot>(default(ShipDoorSnapshot), (NetworkVariableReadPermission)0, (NetworkVariableWritePermission)0); private static LocustAI s_shipDoorHolder; private ShipDoorSettings _shipDoorSettings; private ShipDoorClock _shipDoorClock; private ShipFlashState _shipFlash; private float _publishedFlashCharge; private bool _shipDoorFailed; private bool _shipDoorLoggedGi; private ShipMonitorView _shipMonitors; private bool _shipMonitorsRefused; private bool _shipDoorOutsideApplied; private double BroadcastNow { get { //IL_001a: Unknown result type (might be due to invalid IL or missing references) //IL_001f: Unknown result type (might be due to invalid IL or missing references) if (!((Object)(object)((NetworkBehaviour)this).NetworkManager != (Object)null)) { return Time.timeAsDouble; } NetworkTime serverTime = ((NetworkBehaviour)this).NetworkManager.ServerTime; return ((NetworkTime)(ref serverTime)).Time; } } internal bool BroadcastUnplaced => _broadcast.Value.CurrentPhase == BroadcastPhase.Unplaced; private bool HuntServerTryBeginAttack(LocustState state) { //IL_0052: 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_0058: Unknown result type (might be due to invalid IL or missing references) //IL_0059: Unknown result type (might be due to invalid IL or missing references) //IL_006f: Unknown result type (might be due to invalid IL or missing references) //IL_0074: Unknown result type (might be due to invalid IL or missing references) //IL_0079: Unknown result type (might be due to invalid IL or missing references) //IL_00ef: Unknown result type (might be due to invalid IL or missing references) //IL_00f4: Unknown result type (might be due to invalid IL or missing references) //IL_00f5: Unknown result type (might be due to invalid IL or missing references) //IL_00fa: Unknown result type (might be due to invalid IL or missing references) //IL_00fc: 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_0111: Unknown result type (might be due to invalid IL or missing references) //IL_0119: Unknown result type (might be due to invalid IL or missing references) //IL_0120: Unknown result type (might be due to invalid IL or missing references) //IL_01b4: Unknown result type (might be due to invalid IL or missing references) //IL_01b9: Unknown result type (might be due to invalid IL or missing references) //IL_01bb: Unknown result type (might be due to invalid IL or missing references) //IL_01bd: Unknown result type (might be due to invalid IL or missing references) //IL_01a6: Unknown result type (might be due to invalid IL or missing references) //IL_017f: Unknown result type (might be due to invalid IL or missing references) //IL_0184: Unknown result type (might be due to invalid IL or missing references) //IL_018e: Unknown result type (might be due to invalid IL or missing references) //IL_0193: Unknown result type (might be due to invalid IL or missing references) StartOfRound instance = StartOfRound.Instance; if ((Object)(object)instance == (Object)null || _huntAttack.Active || Time.time < _huntAttack.NextAllowedAttackTime) { return false; } PlayerControllerB[] allPlayerScripts = instance.allPlayerScripts; if (allPlayerScripts == null || allPlayerScripts.Length == 0) { return false; } bool crouched = _huntPosture.Crouched; Vector3 position = ((Component)this).transform.position; Vector3 val = position + Vector3.up * (_huntBody.CrouchHeight * 0.5f); int collidersAndRoomMask = instance.collidersAndRoomMask; int targetSlot = _huntBrain.TargetSlot; int num = -1; float num2 = float.PositiveInfinity; for (int i = 0; i < allPlayerScripts.Length; i++) { PlayerControllerB val2 = allPlayerScripts[i]; if ((Object)(object)val2 == (Object)null) { continue; } bool flag = val2.isPlayerControlled && !val2.isPlayerDead; bool flag2 = flag && ((EnemyAI)this).PlayerIsTargetable(val2, false, false, true); if (!flag2) { continue; } Vector3 val3 = ((Component)val2).transform.position - position; float verticalDistance = Mathf.Abs(val3.y); float num3 = val3.x * val3.x + val3.z * val3.z; float horizontalDistance = Mathf.Sqrt(num3); if (!_huntAttack.CanInitiate(state, stunned: false, Time.time, crouched, flag, flag2, horizontalDistance, verticalDistance, in _huntBody)) { continue; } Vector3 val4 = (((Object)(object)val2.upperSpine != (Object)null) ? val2.upperSpine.position : (((Object)(object)val2.gameplayCamera != (Object)null) ? ((Component)val2.gameplayCamera).transform.position : (((Component)val2).transform.position + Vector3.up * 1.3f))); if (!Physics.Linecast(val, val4, collidersAndRoomMask, (QueryTriggerInteraction)1)) { if (i == targetSlot) { num = i; break; } if (num3 < num2) { num2 = num3; num = i; } } } if (num < 0) { return false; } HuntAttackSpec huntAttackSpec = _huntAttack.Begin(crouched, num, _huntAttackRng.Next); _huntHasPrevBladePose = false; EnsureHuntImpale().ResetSocketVelocitySample(); HuntServerStopMoving(); ((EnemyAI)(object)this).HoldAgent(); _huntMoving = false; _huntServerSnapshot.State = 4; _huntServerSnapshot.Crouched = crouched; _huntServerSnapshot.Moving = false; _huntServerSnapshot.VictimSlot = (short)num; _huntServerSnapshot.AttackKind = (byte)huntAttackSpec.Kind; _huntServerSnapshot.CatchSeq++; _huntServerSnapshot.ImpaledSlot = -1; _huntServerSnapshot.ImpaleState = 0; ((EnemyAI)this).SwitchToBehaviourState(4); HuntPublish(); Plugin.Log.LogInfo((object)$"[Locust] attack {huntAttackSpec.StateName} started (crouched={crouched}, aim slot {num})"); return true; } private void HuntServerCatchTick(bool stunned) { //IL_0176: Unknown result type (might be due to invalid IL or missing references) ((EnemyAI)(object)this).HoldAgent(); if (!_huntAttack.Active) { if (base.currentBehaviourStateIndex == 4) { ((EnemyAI)this).SwitchToBehaviourState(2); _huntServerSnapshot.State = 2; HuntPublish(); } return; } PlayerControllerB val = VictimRpc.FromSlot(_huntAttack.AimSlot); bool aimVictimLostInWindup = _huntAttack.Phase == HuntAttackPhase.Windup && ((Object)(object)val == (Object)null || !val.isPlayerControlled || val.isPlayerDead || !((EnemyAI)this).PlayerIsTargetable(val, false, false, true)); bool impaledBodyLost = _huntAttack.HasPinnedVictim && EnsureHuntImpale().IsPinnedBodyLostOnServer(_huntAttack.ImpaledSlot, Time.time - _huntContactTime); int impaledSlot = _huntAttack.ImpaledSlot; HuntAttackSpec spec = _huntAttack.Attack; switch (_huntAttack.Step(Time.deltaTime, Time.time, stunned, aimVictimLostInWindup, impaledBodyLost)) { case HuntAttackEvent.ReleaseFling: HuntServerReleaseFling(impaledSlot, in spec); return; case HuntAttackEvent.FinishKill: HuntFinishAttack("finished (kill)", preferChase: false); return; case HuntAttackEvent.FinishWhiff: HuntFinishAttack("finished (whiff)", preferChase: true); return; case HuntAttackEvent.AbortDrop: HuntAbortAttack(stunned ? "aborted (stunned during lift), corpse dropped" : "aborted (corpse lost), dropped", switchToRoam: true); return; case HuntAttackEvent.AbortClean: HuntAbortAttack(stunned ? "aborted (stunned)" : "aborted (target lost in windup)", switchToRoam: true); return; } if (_huntAttack.IsTrackingFacing && (Object)(object)val != (Object)null) { HuntTurnToward(((Component)val).transform.position); } } private void HuntServerTestBladeHit() { //IL_0061: Unknown result type (might be due to invalid IL or missing references) //IL_005d: Unknown result type (might be due to invalid IL or missing references) //IL_0066: Unknown result type (might be due to invalid IL or missing references) //IL_0074: Unknown result type (might be due to invalid IL or missing references) //IL_0070: Unknown result type (might be due to invalid IL or missing references) //IL_0079: Unknown result type (might be due to invalid IL or missing references) //IL_008a: Unknown result type (might be due to invalid IL or missing references) //IL_008b: Unknown result type (might be due to invalid IL or missing references) //IL_0091: Unknown result type (might be due to invalid IL or missing references) //IL_0092: Unknown result type (might be due to invalid IL or missing references) //IL_00a4: Unknown result type (might be due to invalid IL or missing references) //IL_00a9: 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_00b6: Unknown result type (might be due to invalid IL or missing references) //IL_00b8: Unknown result type (might be due to invalid IL or missing references) //IL_00ba: Unknown result type (might be due to invalid IL or missing references) //IL_00d0: Unknown result type (might be due to invalid IL or missing references) //IL_00d5: Unknown result type (might be due to invalid IL or missing references) //IL_00da: Unknown result type (might be due to invalid IL or missing references) //IL_00e6: Unknown result type (might be due to invalid IL or missing references) //IL_00ed: Unknown result type (might be due to invalid IL or missing references) //IL_00f4: Unknown result type (might be due to invalid IL or missing references) //IL_0102: Unknown result type (might be due to invalid IL or missing references) //IL_0109: Unknown result type (might be due to invalid IL or missing references) //IL_0110: Unknown result type (might be due to invalid IL or missing references) //IL_0373: Unknown result type (might be due to invalid IL or missing references) //IL_017c: Unknown result type (might be due to invalid IL or missing references) //IL_0181: Unknown result type (might be due to invalid IL or missing references) //IL_01a5: Unknown result type (might be due to invalid IL or missing references) //IL_01af: Unknown result type (might be due to invalid IL or missing references) //IL_01ca: Unknown result type (might be due to invalid IL or missing references) //IL_01d1: Unknown result type (might be due to invalid IL or missing references) //IL_01de: Unknown result type (might be due to invalid IL or missing references) //IL_01ec: Unknown result type (might be due to invalid IL or missing references) //IL_01f3: Unknown result type (might be due to invalid IL or missing references) //IL_01fd: Unknown result type (might be due to invalid IL or missing references) //IL_021a: Unknown result type (might be due to invalid IL or missing references) //IL_021c: Unknown result type (might be due to invalid IL or missing references) //IL_021f: 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_0226: Unknown result type (might be due to invalid IL or missing references) //IL_0228: Unknown result type (might be due to invalid IL or missing references) //IL_022b: Unknown result type (might be due to invalid IL or missing references) //IL_0230: Unknown result type (might be due to invalid IL or missing references) //IL_0236: Unknown result type (might be due to invalid IL or missing references) //IL_023d: Unknown result type (might be due to invalid IL or missing references) //IL_0244: Unknown result type (might be due to invalid IL or missing references) //IL_0250: Unknown result type (might be due to invalid IL or missing references) //IL_0257: Unknown result type (might be due to invalid IL or missing references) //IL_025e: Unknown result type (might be due to invalid IL or missing references) //IL_02a5: Unknown result type (might be due to invalid IL or missing references) //IL_02a7: Unknown result type (might be due to invalid IL or missing references) //IL_02b3: Unknown result type (might be due to invalid IL or missing references) //IL_02b5: Unknown result type (might be due to invalid IL or missing references) if (((EnemyAI)(object)this).IsStunned() || !_huntAttack.IsHitWindowOpen) { _huntHasPrevBladePose = false; return; } StartOfRound instance = StartOfRound.Instance; if ((Object)(object)instance == (Object)null || instance.allPlayerScripts == null) { return; } LocustRagdollImpale locustRagdollImpale = EnsureHuntImpale(); HuntAttackSpec spec = _huntAttack.Attack; if (!locustRagdollImpale.TryGetBladeSegment(in spec, out var bladeBase, out var bladeTip)) { return; } Vector3 val = (_huntHasPrevBladePose ? _huntPrevBladeBase : bladeBase); Vector3 val2 = (_huntHasPrevBladePose ? _huntPrevBladeTip : bladeTip); int num = ((!_huntHasPrevBladePose) ? 1 : 3); _huntPrevBladeBase = bladeBase; _huntPrevBladeTip = bladeTip; _huntHasPrevBladePose = true; Vector3 position = ((Component)this).transform.position; Vector3 forward = ((Component)this).transform.forward; Vector3 val3 = position + Vector3.up * (_huntBody.CrouchHeight * 0.65f); int collidersAndRoomMask = instance.collidersAndRoomMask; HuntVec3 locustOrigin = new HuntVec3(position.x, position.y, position.z); HuntVec3 locustForward = new HuntVec3(forward.x, forward.y, forward.z); int num2 = -1; PlayerControllerB val4 = null; float num3 = float.PositiveInfinity; PlayerControllerB[] allPlayerScripts = instance.allPlayerScripts; Vector3 val8 = default(Vector3); for (int i = 0; i < allPlayerScripts.Length; i++) { PlayerControllerB val5 = allPlayerScripts[i]; if ((Object)(object)val5 == (Object)null || !val5.isPlayerControlled || val5.isPlayerDead || !((EnemyAI)this).PlayerIsTargetable(val5, false, false, true)) { continue; } Vector3 position2 = ((Component)val5).transform.position; float num4 = (((Object)(object)val5.gameplayCamera != (Object)null) ? Mathf.Clamp(((Component)val5.gameplayCamera).transform.position.y - position2.y, 0.9f, 1.75f) : 1.55f); HuntVec3 playerCapsuleBottom = new HuntVec3(position2.x, position2.y + 0.35f, position2.z); HuntVec3 playerCapsuleTop = new HuntVec3(position2.x, position2.y + num4, position2.z); for (int j = 1; j <= num; j++) { float num5 = (float)j / (float)num; Vector3 val6 = Vector3.Lerp(val, bladeBase, num5); Vector3 val7 = Vector3.Lerp(val2, bladeTip, num5); if (HuntImpalePhysics.TestBladeHit(locustOrigin, locustForward, new HuntVec3(val6.x, val6.y, val6.z), new HuntVec3(val7.x, val7.y, val7.z), 0.24f, playerCapsuleBottom, playerCapsuleTop, 0.32f, out var contactPoint, out var distanceSq) && !(distanceSq >= num3)) { ((Vector3)(ref val8))..ctor(contactPoint.X, contactPoint.Y, contactPoint.Z); if (!Physics.Linecast(val3, val8, collidersAndRoomMask, (QueryTriggerInteraction)1) && !Physics.Linecast(val6, val8, collidersAndRoomMask, (QueryTriggerInteraction)1)) { num3 = distanceSq; num2 = i; val4 = val5; break; } } } } if (num2 >= 0 && !((Object)(object)val4 == (Object)null) && _huntAttack.TryRegisterContact(num2)) { _huntContactTime = Time.time; _huntHasPrevBladePose = false; _huntServerSnapshot.ImpaledSlot = (short)num2; _huntServerSnapshot.ImpaleSeq++; _huntServerSnapshot.ImpaleState = 1; HuntPublish(); HuntApplyLatest(); HuntImpaleKillClientRpc((ulong)num2, _huntServerSnapshot.CatchSeq, _huntServerSnapshot.ImpaleSeq, VictimRpc.TargetOwner(val4)); Plugin.Log.LogInfo((object)$"[Locust] {spec.StateName} impaled slot {num2} at t={_huntAttack.Elapsed:F3}s"); } } private void HuntServerReleaseFling(int victimSlot, in HuntAttackSpec spec) { //IL_001e: Unknown result type (might be due to invalid IL or missing references) //IL_0023: Unknown result type (might be due to invalid IL or missing references) //IL_0028: Unknown result type (might be due to invalid IL or missing references) //IL_002a: Unknown result type (might be due to invalid IL or missing references) //IL_002f: Unknown result type (might be due to invalid IL or missing references) //IL_0037: 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) //IL_0043: Unknown result type (might be due to invalid IL or missing references) //IL_0054: Unknown result type (might be due to invalid IL or missing references) //IL_005a: Unknown result type (might be due to invalid IL or missing references) //IL_0060: Unknown result type (might be due to invalid IL or missing references) //IL_00a8: Unknown result type (might be due to invalid IL or missing references) //IL_008b: Unknown result type (might be due to invalid IL or missing references) //IL_0090: Unknown result type (might be due to invalid IL or missing references) //IL_009a: Unknown result type (might be due to invalid IL or missing references) //IL_009f: Unknown result type (might be due to invalid IL or missing references) //IL_00ad: Unknown result type (might be due to invalid IL or missing references) //IL_0103: Unknown result type (might be due to invalid IL or missing references) //IL_0105: Unknown result type (might be due to invalid IL or missing references) LocustRagdollImpale locustRagdollImpale = EnsureHuntImpale(); Vector3 val = ((Component)this).transform.TransformDirection(new Vector3(spec.ReleaseTangentLocalX, spec.ReleaseTangentLocalY, spec.ReleaseTangentLocalZ)); Vector3 socketVelocity = locustRagdollImpale.SocketVelocity; HuntVec3 huntVec = HuntImpalePhysics.ComputeReleaseVelocity(hasMeasuredVelocity: locustRagdollImpale.HasSocketVelocity, authoredWorldTangent: new HuntVec3(val.x, val.y, val.z), authoredSpeedMps: spec.ReleaseSpeedMps, measuredSocketVelocity: new HuntVec3(socketVelocity.x, socketVelocity.y, socketVelocity.z), isGentleDrop: false); Transform socket = locustRagdollImpale.GetSocket(in spec); Vector3 releasePos = (((Object)(object)socket != (Object)null) ? socket.position : (((Component)this).transform.position + Vector3.up * 1.5f)); Vector3 flingVelocity = default(Vector3); ((Vector3)(ref flingVelocity))..ctor(huntVec.X, huntVec.Y, huntVec.Z); _huntServerSnapshot.ImpaledSlot = -1; _huntServerSnapshot.ImpaleState = 2; HuntPublish(); if (victimSlot >= 0) { HuntRagdollFlingClientRpc((short)victimSlot, _huntServerSnapshot.CatchSeq, _huntServerSnapshot.ImpaleSeq, releasePos, flingVelocity); Plugin.Log.LogInfo((object)$"[Locust] {spec.StateName} flung slot {victimSlot} at {((Vector3)(ref flingVelocity)).magnitude:F1} m/s"); } } private void HuntFinishAttack(string outcome, bool preferChase) { _huntHasPrevBladePose = false; _huntServerSnapshot.VictimSlot = -1; _huntServerSnapshot.AttackKind = 0; _huntServerSnapshot.ImpaledSlot = -1; _huntServerSnapshot.ImpaleState = 0; Plugin.Log.LogInfo((object)("[Locust] attack " + outcome)); if (base.currentBehaviourStateIndex == 4) { LocustState locustState = LocustState.Roam; if (preferChase) { PlayerControllerB val = VictimRpc.FromSlot(_huntBrain.TargetSlot); if ((Object)(object)val != (Object)null && val.isPlayerControlled && !val.isPlayerDead && ((EnemyAI)this).PlayerIsTargetable(val, false, false, true)) { locustState = LocustState.Chase; } } ((EnemyAI)this).SwitchToBehaviourState((int)locustState); _huntServerSnapshot.State = (byte)locustState; } HuntPublish(); } private void HuntAbortAttack(string outcome, bool switchToRoam) { HuntAttackEvent num = _huntAttack.ForceAbort(Time.time); _huntHasPrevBladePose = false; bool flag = num == HuntAttackEvent.AbortDrop || _huntServerSnapshot.ImpaleState == 1; _huntServerSnapshot.VictimSlot = -1; _huntServerSnapshot.AttackKind = 0; _huntServerSnapshot.ImpaledSlot = -1; _huntServerSnapshot.ImpaleState = (byte)(flag ? 3 : 0); if (flag) { _huntImpale?.ReleaseGentleDrop(); } Plugin.Log.LogInfo((object)("[Locust] attack " + outcome)); if (switchToRoam && ((NetworkBehaviour)this).IsSpawned && base.currentBehaviourStateIndex == 4) { ((EnemyAI)this).SwitchToBehaviourState(2); _huntServerSnapshot.State = 2; } if (((NetworkBehaviour)this).IsSpawned) { HuntPublish(); } } private void HuntTurnToward(Vector3 point) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Unknown result type (might be due to invalid IL or missing references) //IL_0012: Unknown result type (might be due to invalid IL or missing references) //IL_0018: Unknown result type (might be due to invalid IL or missing references) //IL_001f: 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_003b: 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_0041: Unknown result type (might be due to invalid IL or missing references) //IL_0047: Unknown result type (might be due to invalid IL or missing references) //IL_004d: Unknown result type (might be due to invalid IL or missing references) //IL_0075: Unknown result type (might be due to invalid IL or missing references) //IL_007c: Unknown result type (might be due to invalid IL or missing references) //IL_0082: Unknown result type (might be due to invalid IL or missing references) Vector3 val = point - ((Component)this).transform.position; if (!(val.x * val.x + val.z * val.z < 0.0001f)) { Vector3 eulerAngles = ((Component)this).transform.eulerAngles; float num = Mathf.MoveTowardsAngle(eulerAngles.y, Mathf.Atan2(val.x, val.z) * 57.29578f, 600f * Time.deltaTime); ((Component)this).transform.eulerAngles = new Vector3(eulerAngles.x, num, eulerAngles.z); } } [ClientRpc] private void HuntImpaleKillClientRpc(ulong slot, byte attackSeq, byte impaleSeq, ClientRpcParams clientRpcParams = default(ClientRpcParams)) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_00cf: Unknown result type (might be due to invalid IL or missing references) //IL_00d9: Invalid comparison between Unknown and I4 //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_006d: Unknown result type (might be due to invalid IL or missing references) //IL_0071: Unknown result type (might be due to invalid IL or missing references) //IL_008a: Unknown result type (might be due to invalid IL or missing references) //IL_0090: Unknown result type (might be due to invalid IL or missing references) //IL_00a5: Unknown result type (might be due to invalid IL or missing references) //IL_00ab: Unknown result type (might be due to invalid IL or missing references) //IL_00bf: Unknown result type (might be due to invalid IL or missing references) //IL_0104: Unknown result type (might be due to invalid IL or missing references) //IL_0161: Unknown result type (might be due to invalid IL or missing references) //IL_016c: Unknown result type (might be due to invalid IL or missing references) //IL_0171: Unknown result type (might be due to invalid IL or missing references) //IL_0176: Unknown result type (might be due to invalid IL or missing references) //IL_01b6: Unknown result type (might be due to invalid IL or missing references) //IL_01c1: Unknown result type (might be due to invalid IL or missing references) //IL_01c7: 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.IsServer || networkManager.IsHost)) { FastBufferWriter val = ((NetworkBehaviour)this).__beginSendClientRpc(444695526u, clientRpcParams, (RpcDelivery)0); BytePacker.WriteValueBitPacked(val, slot); ((FastBufferWriter)(ref val)).WriteValueSafe<byte>(ref attackSeq, default(ForPrimitives)); ((FastBufferWriter)(ref val)).WriteValueSafe<byte>(ref impaleSeq, default(ForPrimitives)); ((NetworkBehaviour)this).__endSendClientRpc(ref val, 444695526u, clientRpcParams, (RpcDelivery)0); } if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1 || (!networkManager.IsClient && !networkManager.IsHost)) { return; } ((NetworkBehaviour)this).__rpc_exec_stage = (__RpcExecStage)0; if (!((NetworkBehaviour)this).IsSpawned || (_huntHasHandledKillRpc && _huntHandledKillAttackSeq == attackSeq && _huntHandledKillImpaleSeq == impaleSeq)) { return; } LocustRagdollImpale locustRagdollImpale = EnsureHuntImpale(); HuntApplyLatest(); PlayerControllerB val2 = VictimRpc.LocalVictimFromSlot(slot); if ((Object)(object)val2 == (Object)null || val2.isPlayerDead || !val2.isPlayerControlled) { return; } Vector3 val3 = ((Component)val2).transform.position - ((Component)this).transform.position; if (((Vector3)(ref val3)).sqrMagnitude > 100f) { Plugin.Log.LogInfo((object)$"[Locust] impale kill skipped slot {slot}: player too far (teleported)"); return; } _huntHasHandledKillRpc = true; _huntHandledKillAttackSeq = attackSeq; _huntHandledKillImpaleSeq = impaleSeq; Vector3 zero = Vector3.zero; val3 = default(Vector3); val2.KillPlayer(zero, true, (CauseOfDeath)14, 0, val3, false); GameNetworkManager instance = GameNetworkManager.Instance; if ((Object)(object)instance != (Object)null && (Object)(object)val2 == (Object)(object)instance.localPlayerController && val2.isPlayerDead) { val2.isInGameOverAnimation = Mathf.Max(val2.isInGameOverAnimation, 2.2f); } locustRagdollImpale.TickUpdate(0f, Time.time, ((NetworkBehaviour)this).IsServer); Plugin.Log.LogInfo((object)$"[Locust] impale killed slot {slot} (seq {attackSeq}/{impaleSeq})"); } [ClientRpc] private void HuntRagdollFlingClientRpc(short slot, byte attackSeq, byte impaleSeq, Vector3 releasePos, Vector3 flingVelocity) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_00e9: Unknown result type (might be due to invalid IL or missing references) //IL_00f3: Invalid comparison between Unknown and I4 //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_006d: Unknown result type (might be due to invalid IL or missing references) //IL_0071: Unknown result type (might be due to invalid IL or missing references) //IL_008a: Unknown result type (might be due to invalid IL or missing references) //IL_0090: Unknown result type (might be due to invalid IL or missing references) //IL_00a5: Unknown result type (might be due to invalid IL or missing references) //IL_00ab: Unknown result type (might be due to invalid IL or missing references) //IL_00d9: Unknown result type (might be due to invalid IL or missing references) //IL_011e: Unknown result type (might be due to invalid IL or missing references) //IL_013f: Unknown result type (might be due to invalid IL or missing references) //IL_0141: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager; if (networkManager == null || !networkManager.IsListening) { return; } if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1 && (networkManager.IsServer || networkManager.IsHost)) { ClientRpcParams val2 = default(ClientRpcParams); FastBufferWriter val = ((NetworkBehaviour)this).__beginSendClientRpc(1390180226u, val2, (RpcDelivery)0); BytePacker.WriteValueBitPacked(val, slot); ((FastBufferWriter)(ref val)).WriteValueSafe<byte>(ref attackSeq, default(ForPrimitives)); ((FastBufferWriter)(ref val)).WriteValueSafe<byte>(ref impaleSeq, default(ForPrimitives)); ((FastBufferWriter)(ref val)).WriteValueSafe(ref releasePos); ((FastBufferWriter)(ref val)).WriteValueSafe(ref flingVelocity); ((NetworkBehaviour)this).__endSendClientRpc(ref val, 1390180226u, val2, (RpcDelivery)0); } if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsClient || networkManager.IsHost)) { ((NetworkBehaviour)this).__rpc_exec_stage = (__RpcExecStage)0; if (((NetworkBehaviour)this).IsSpawned && slot >= 0) { LocustRagdollImpale locustRagdollImpale = EnsureHuntImpale(); HuntApplyLatest(); locustRagdollImpale.ApplyFling(slot, attackSeq, impaleSeq, releasePos, flingVelocity, Time.time, ((NetworkBehaviour)this).IsServer); } } } private void HuntPresentImpale(in HuntSnapshot snapshot, in HuntSnapshot previous, bool first) { LocustRagdollImpale locustRagdollImpale = EnsureHuntImpale(); if (snapshot.ImpaleState == 1 && snapshot.ImpaledSlot >= 0) { if (first || snapshot.ImpaleSeq != previous.ImpaleSeq || snapshot.CatchSeq != previous.CatchSeq || previous.ImpaleState != 1) { HuntAttackSpec spec = HuntAttackCatalog.GetOrFallback((HuntAttackKind)snapshot.AttackKind, snapshot.Crouched); if (!first) { CreatureAudioSetup.TransmitOneShot(base.creatureSFX, HuntAudio.Kill); HuntPlayEntrySplatter(in spec, snapshot.ImpaledSlot); } locustRagdollImpale.BeginPin(snapshot.ImpaledSlot, in spec, snapshot.CatchSeq, snapshot.ImpaleSeq, Time.time, ((NetworkBehaviour)this).IsServer); } } else if (snapshot.ImpaleState == 2) { if (!first && snapshot.ImpaleSeq != previous.ImpaleSeq && previous.ImpaleState != 1) { HuntAttackSpec spec2 = HuntAttackCatalog.GetOrFallback((HuntAttackKind)snapshot.AttackKind, snapshot.Crouched); CreatureAudioSetup.TransmitOneShot(base.creatureSFX, HuntAudio.Kill); HuntPlayEntrySplatter(in spec2, (snapshot.ImpaledSlot >= 0) ? snapshot.ImpaledSlot : snapshot.VictimSlot); } locustRagdollImpale.MarkAwaitingFlingRpc(snapshot.CatchSeq, snapshot.ImpaleSeq, Time.time); } else if (locustRagdollImpale.IsPinnedOrPending) { locustRagdollImpale.ReleaseGentleDrop(); } } private void HuntPlayEntrySplatter(in HuntAttackSpec spec, int slot) { //IL_0038: 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_0021: Unknown result type (might be due to invalid IL or missing references) //IL_002b: Unknown result type (might be due to invalid IL or missing references) //IL_0030: 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) //IL_005a: Unknown result type (might be due to invalid IL or missing references) //IL_004d: Unknown result type (might be due to invalid IL or missing references) //IL_0052: Unknown result type (might be due to invalid IL or missing references) //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_006e: Unknown result type (might be due to invalid IL or missing references) //IL_0073: Unknown result type (might be due to invalid IL or missing references) //IL_008d: Unknown result type (might be due to invalid IL or missing references) //IL_008e: Unknown result type (might be due to invalid IL or missing references) //IL_008f: Unknown result type (might be due to invalid IL or missing references) //IL_0090: Unknown result type (might be due to invalid IL or missing references) //IL_009a: Unknown result type (might be due to invalid IL or missing references) Transform socket = EnsureHuntImpale().GetSocket(in spec); Vector3 point = (((Object)(object)socket != (Object)null) ? socket.position : (((Component)this).transform.position + Vector3.up * 1.4f)); Vector3 val = (((Object)(object)socket != (Object)null) ? socket.forward : (-((Component)this).transform.forward)); if (((Vector3)(ref val)).sqrMagnitude < 0.0001f) { val = Vector3.up; } else { ((Vector3)(ref val)).Normalize(); } LocustBloodFxBridge.PlayImpactSplatter(((Object)this).GetInstanceID() ^ ((slot + 1) * 397), point, val, -val * 6f, 0.65f); } private void HuntOnRoundReset(bool canBroadcast) { if (canBroadcast && ((NetworkBehaviour)this).IsServer && ((NetworkBehaviour)this).IsSpawned && _huntAttack.Active) { HuntAbortAttack("aborted (round reset)", switchToRoam: true); } _huntAttack.Reset(); _huntHasPrevBladePose = false; _huntHasHandledKillRpc = false; _huntImpale?.OnRoundReset(); } private void HuntDropCatch() { _huntAttack.Reset(); _huntHasPrevBladePose = false; _huntHasHandledKillRpc = false; _huntImpale?.DropAll(dropBones: true); } private void HuntPresent() { HuntApplyLatest(); EnsureHuntImpale().TickUpdate(Time.deltaTime, Time.time, ((NetworkBehaviour)this).IsServer); LocustState state = (LocustState)_huntApplied.State; if (!LocustStates.IsHunt(state)) { if (_huntPresenting) { HuntLeavePresentation(); } return; } _huntPresenting = true; bool stunned = ((EnemyAI)(object)this).IsStunned(); if (((EnemyAI)(object)this).TrackStun(ref _huntPresentStunned) == StunEdge.Started) { HuntStopSpeech(); } HuntAnimate(state, stunned); HuntVoice(state); HuntFear(state); } private void HuntApplyLatest() { HuntSnapshot snapshot = _huntSnapshot.Value; if (!_huntHasApplied || !snapshot.Equals(_huntApplied)) { HuntApply(in snapshot); } } private void HuntApply(in HuntSnapshot snapshot) { bool flag = !_huntHasApplied; HuntSnapshot previous = _huntApplied; _huntApplied = snapshot; _huntHasApplied = true; if (!((NetworkBehaviour)this).IsServer && snapshot.State != base.currentBehaviourStateIndex && snapshot.State < base.enemyBehaviourStates.Length) { ((EnemyAI)this).SwitchToBehaviourStateOnLocalClient((int)snapshot.State); } LocustState state = (LocustState)snapshot.State; if (state == LocustState.Catch) { if (flag || snapshot.CatchSeq != previous.CatchSeq) { HuntPresentAttackStart(); } HuntPresentImpale(in snapshot, in previous, flag); return; } if (_huntImpale != null && _huntImpale.IsPinnedOrPending) { _huntImpale.ReleaseGentleDrop(); } if (!flag && snapshot.SpeechSeq != previous.SpeechSeq && (state == LocustState.Roam || state == LocustState.Chase)) { HuntPresentSpeech(snapshot.SpeechLine); } } private void HuntPresentAttackStart() { _huntClip = HuntClip.None; EnsureHuntImpale().ResetSocketVelocitySample(); if ((Object)(object)base.creatureVoice != (Object)null) { base.creatureVoice.Stop(); } HuntEndSpeak(); } private void HuntPresentSpeech(byte line) { if (line >= 1 && line <= 7) { AudioClip val = HuntAudio.Speech[line - 1]; if ((Object)(object)val != (Object)null && (Object)(object)base.creatureVoice != (Object)null) { base.creatureVoice.Stop(); base.creatureVoice.clip = val; base.creatureVoice.loop = false; base.creatureVoice.Play(); } if (_huntSpeakLayer >= 0) { base.creatureAnimator.CrossFadeInFixedTime(SpeakStates[line - 1], 0.1f, _huntSpeakLayer, 0f); } _huntSpeaking = true; Plugin.Log.LogInfo((object)$"[Locust] speaks line {line} (locust_speech{line})"); } } private void HuntStopSpeech() { if (_huntSpeaking) { AudioSource creatureVoice = base.creatureVoice; if ((Object)(object)creatureVoice != (Object)null && (Object)(object)creatureVoice.clip != (Object)(object)HuntAudio.IdleLoop) { creatureVoice.Stop(); } HuntEndSpeak(); } } private void HuntEndSpeak() { if (_huntSpeaking) { _huntSpeaking = false; if (_huntSpeakLayer >= 0 && (Object)(object)base.creatureAnimator != (Object)null) { base.creatureAnimator.CrossFadeInFixedTime("Empty", 0.1f, _huntSpeakLayer, 0f); } } } private void HuntAnimate(LocustState state, bool stunned) { Animator creatureAnimator = base.creatureAnimator; if ((Object)(object)creatureAnimator == (Object)null) { return; } creatureAnimator.SetBool(CrouchedHash, _huntApplied.Crouched); HuntClip attackClip = HuntAttackCatalog.ClipFor((HuntAttackKind)_huntApplied.AttackKind, _huntApplied.Crouched); HuntClip huntClip = HuntGait.Choose(state, _huntApplied.Crouched, _huntApplied.Moving, stunned, attackClip); if (huntClip != _huntClip) { _huntClip = huntClip; creatureAnimator.CrossFadeInFixedTime(HuntGait.StateName(huntClip), HuntGait.IsAttack(huntClip) ? 0.08f : 0.2f, 0, 0f); } float playbackSpeed = (creatureAnimator.speed = HuntGait.PlaybackSpeed(huntClip, (float)(int)_huntApplied.MoveSpeedCm / 100f, in _huntBody)); if (_huntSteps.Advance(huntClip, Time.deltaTime, playbackSpeed) > 0 && (Object)(object)base.creatureSFX != (Object)null) { AudioClip val = HuntAudio.Steps[Random.Range(0, HuntAudio.Steps.Length)]; if ((Object)(object)val != (Object)null) { base.creatureSFX.PlayOneShot(val); } } } private void HuntVoice(LocustState state) { AudioSource creatureVoice = base.creatureVoice; if (_huntSpeaking && ((Object)(object)creatureVoice == (Object)null || !creatureVoice.isPlaying || (Object)(object)creatureVoice.clip == (Object)(object)HuntAudio.IdleLoop)) { HuntEndSpeak(); } if ((Object)(object)creatureVoice == (Object)null) { return; } if (state == LocustState.Catch) { if (creatureVoice.isPlaying) { creatureVoice.Stop(); } } else if (!creatureVoice.isPlaying && !((Object)(object)HuntAudio.IdleLoop == (Object)null)) { creatureVoice.clip = HuntAudio.IdleLoop; creatureVoice.loop = true; creatureVoice.Play(); } } private void HuntFear(LocustState state) { //IL_0035: Unknown result type (might be due to invalid IL or missing references) GameNetworkManager instance = GameNetworkManager.Instance; PlayerControllerB val = (((Object)(object)instance != (Object)null) ? instance.localPlayerController : null); if (!((Object)(object)val == (Object)null) && !val.isPlayerDead && HuntTryHeadPoint(out var point) && val.HasLineOfSightToPosition(point, 80f, 25, 5f, -1)) { if (state == LocustState.Chase || state == LocustState.Catch) { val.IncreaseFearLevelOverTime(0.8f, 1f); } else { val.IncreaseFearLevelOverTime(0.8f, 0.5f); } } } private void HuntLeavePresentation() { _huntPresenting = false; _huntPresentStunned = false; _huntClip = HuntClip.None; _huntSteps.Reset(); if ((Object)(object)base.creatureAnimator != (Object)null) { base.creatureAnimator.speed = 1f; ((EnemyAI)this).PlayAnimationOfCurrentState(); HuntClip clip = ((base.currentBehaviourStateIndex != 1) ? HuntClip.Idle : HuntClip.CrouchIdle); base.creatureAnimator.CrossFadeInFixedTime(HuntGait.StateName(clip), 0.2f, 0, 0f); } if ((Object)(object)base.creatureVoice != (Object)null) { base.creatureVoice.Stop(); } HuntEndSpeak(); _huntImpale?.ReleaseGentleDrop(); } internal void SetManifested(bool shown) { if (!((NetworkBehaviour)this).IsServer) { if (!_warnedClientManifest) { _warnedClientManifest = true; Plugin.Log.LogWarning((object)"Locust: SetManifested is server only; ignored on this client."); } } else { BroadcastSnapshot value = _broadcast.Value; value.Manifested = shown; _broadcast.Value = value; } } private bool TickBroadcastServer(double now) { if (_broadcastState.Phase == BroadcastPhase.Unplaced) { if (_placement == null) { RemoveUnplaced("no usable TV prefab Assets/Y4NGZ/Locust/Prefabs/LocustTV.prefab, removing The Locust"); return false; } switch (_placement.Tick(now)) { case TvPlacementStatus.Placed: PlaceTvs(now); break; case TvPlacementStatus.GaveUp: RemoveUnplaced("no valid room, removing The Locust: " + _placement.Summary); return false; } return true; } if (_broadcastState.Phase == BroadcastPhase.On || _broadcastState.Phase == BroadcastPhase.Off) { _watchTimer -= Time.deltaTime; if (_watchTimer <= 0f) { _watchTimer = 0.2f; _watchedMask = SampleWatchedMask(); } } int wakeRoll = Random.Range(0, 96); BroadcastState b = BroadcastRules.Advance(_broadcastState, now, Time.deltaTime, _watchedMask, _broadcastSettings, wakeRoll, NextReactivationDelay()); if (BroadcastRules.AnyTvChanged(in _broadcastState, in b)) { LogBroadcastChange(in _broadcastState, in b, null); } if (b.Phase == BroadcastPhase.Ready) { ShipDoorCancelFlashingForFacilityEmerge(); b = BroadcastHandOver(in b, now); } else { b = ShipDoorDecide(in b, now); } bool num = BroadcastRules.AnyTvChanged(in _broadcastState, in b) || Mathf.Abs(b.Charge - _publishedCharge) >= 0.01f || TvScreenFlipbook.ChargeBucket(b.Charge) != TvScreenFlipbook.ChargeBucket(_publishedCharge); bool num2 = b.Phase == BroadcastPhase.On && _broadcastState.Phase != BroadcastPhase.On; _broadcastState = b; if (num2) { _watchTimer = 0f; } if (num) { PublishBroadcast(); } return true; } private BroadcastState BroadcastHandOver(in BroadcastState ready, double now) { //IL_0053: Unknown result type (might be due to invalid IL or missing references) //IL_005e: Unknown result type (might be due to invalid IL or missing references) BroadcastSnapshot value = _broadcast.Value; int num = ((ready.EmergeTvIndex >= 0 && ready.EmergeTvIndex < value.TvCount) ? ready.EmergeTvIndex : BroadcastRules.PickFallbackTv(in ready)); if (num >= 0 && num < value.TvCount) { TvPose pose = value.GetSlot(num).Pose; BeginEmergence(pose.Position, pose.Yaw, Vector3.zero, requireStand: false); } BroadcastState to = BroadcastRules.Break(ready, num, now); LogBroadcastChange(in ready, in to, null); return to; } private void PlaceTvs(double now) { //IL_007a: Unknown result type (might be due to invalid IL or missing references) //IL_009a: Unknown result type (might be due to invalid IL or missing references) //IL_0067: Unknown result type (might be due to invalid IL or missing references) //IL_017a: Unknown result type (might be due to invalid IL or missing references) //IL_016c: Unknown result type (might be due to invalid IL or missing references) //IL_017f: Unknown result type (might be due to invalid IL or missing references) //IL_01ba: Unknown result type (might be due to invalid IL or missing references) //IL_01a7: Unknown result type (might be due to invalid IL or missing references) //IL_01ac: Unknown result type (might be due to invalid IL or missing references) //IL_01b1: Unknown result type (might be due to invalid IL or missing references) //IL_01bf: Unknown result type (might be due to invalid IL or missing references) IReadOnlyList<TvPose> poses = _placement.Poses; if (poses.Count == 0) { RemoveUnplaced("no valid room, removing The Locust: " + _placement.Summary); return; } TvPose tvPose = poses[0]; if (!((Object)(object)base.agent != (Object)null) || !((Behaviour)base.agent).enabled || !base.agent.isOnNavMesh || !base.agent.Warp(tvPose.Position)) { ((Component)this).transform.position = tvPose.Position; } ((Component)this).transform.rotation = Quaternion.Euler(0f, tvPose.Yaw, 0f); ((EnemyAI)this).SyncPositionToClients(); _watchTimer = 0f; _watchedMask = 0; BroadcastState to = BroadcastRules.Begin(poses.Count, now, NextReactivationDelay(), _broadcastSettings); Plugin.Log.LogInfo((object)("Locust TVs placed: " + _placement.Summary)); LogBroadcastChange(in _broadcastState, in to, null); _broadcastState = to; _broadcast.Value = _broadcast.Value.WithPoses(poses, in _broadcastState); _publishedCharge = _broadcastState.Charge; for (int i = 0; i < poses.Count; i++) { LocustTvView locustTvView = _tvs[i]; _tvWatchPoints[i] = locustTvView?.ScreenWorldPoint(0.05f) ?? LocustTvView.GeometryScreenPoint(poses[i], 0.05f); _tvForwards[i] = locustTvView?.Forward ?? (Quaternion.Euler(0f, poses[i].Yaw, 0f) * Vector3.forward); } ApplyManifested(_broadcast.Value.Manifested); } private double NextReactivationDelay() { if (_broadcastSettings == null) { return 35.0; } return Random.Range(_broadcastSettings.ReactivationMinSeconds, _broadcastSettings.ReactivationMaxSeconds); } private void RemoveUnplaced(string reason) { Plugin.Log.LogWarning((object)("Locust TV: " + reason)); base.enemyType.numberSpawned = Mathf.Max(base.enemyType.numberSpawned, base.enemyType.MaxCount); ((NetworkBehaviour)this).NetworkObject.Despawn(true); } private int SampleWatchedMask() { //IL_0086: Unknown result type (might be due to invalid IL or missing references) //IL_008b: Unknown result type (might be due to invalid IL or missing references) //IL_00a5: Unknown result type (might be due to invalid IL or missing references) //IL_00aa: Unknown result type (might be due to invalid IL or missing references) //IL_00b4: Unknown result type (might be due to invalid IL or missing references) //IL_00b9: Unknown result type (might be due to invalid IL or missing references) //IL_00d4: Unknown result type (might be due to invalid IL or missing references) StartOfRound instance = StartOfRound.Instance; if ((Object)(object)instance == (Object)null || _broadcastState.TvCount <= 0) { return 0; } int num = 0; int num2 = Math.Min(_broadcastState.TvCount, 6); PlayerControllerB[] allPlayerScripts = instance.allPlayerScripts; foreach (PlayerControllerB val in allPlayerScripts) { if ((Object)(object)val == (Object)null || !val.isPlayerControlled || val.isPlayerDead || (Object)(object)val.playerEye == (Object)null) { continue; } Vector3 position = val.playerEye.position; for (int j = 0; j < num2; j++) { if ((num & (1 << j)) == 0 && Vector3.Dot(_tvForwards[j], position - _tvWatchPoints[j]) > 0f && val.HasLineOfSightToPosition(_tvWatchPoints[j], 45f, 20, -1f, -1)) { num |= 1 << j; } } } return num; } private Vector3 TvScreenPoint(int tvIndex, float depthInFront) { //IL_004e: Unknown result type (might be due to invalid IL or missing references) //IL_0016: 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) if (tvIndex >= 0 && tvIndex < 6) { LocustTvView locustTvView = _tvs[tvIndex]; if (locustTvView != null) { return locustTvView.ScreenWorldPoint(depthInFront); } BroadcastSnapshot value = _broadcast.Value; if (tvIndex < value.TvCount) { return LocustTvView.GeometryScreenPoint(value.GetSlot(tvIndex).Pose, depthInFront); } } return ((Component)this).transform.position; } private void PublishBroadcast() { _broadcast.Value = _broadcast.Value.With(in _broadcastState); _publishedCharge = _broadcastState.Charge; } private void LogBroadcastChange(in BroadcastState from, in BroadcastState to, string byPlayer) { int num = to.CountInPhase(TvPhase.On); int num2 = to.CountInPhase(TvPhase.Off); Plugin.Log.LogInfo((object)($"Locust broadcast: {from.Phase} -> {to.Phase} (tvs {to.TvCount}: {num} on, {num2} off; " + $"switch-offs {to.SwitchOffs}, charge {to.Charge:0.00}" + ((to.EmergeTvIndex >= 0) ? $", emerge #{to.EmergeTvIndex + 1}" : string.Empty) + ")" + ((byPlayer != null) ? (" by " + byPlayer) : string.Empty))); } private void OnBroadcastChanged(BroadcastSnapshot previous, BroadcastSnapshot current) { if (previous.Manifested != current.Manifested) { ApplyManifested(current.Manifested); } EnsureTvs(in current); } private void EnsureTvs(in BroadcastSnapshot snapshot) { if (snapshot.CurrentPhase == BroadcastPhase.Unplaced) { return; } int num = Math.Min((int)snapshot.TvCount, 6); for (int i = 0; i < num; i++) { TvSlotSnapshot slot = snapshot.GetSlot(i); if (_tvs[i] == null && slot.CurrentPhase != TvPhase.None) { _tvs[i] = LocustTvView.Create((byt