using System; using System.Collections; using System.Collections.Generic; using System.Diagnostics; using System.IO; using System.Linq; using System.Numerics; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using System.Text; using BepInEx; using BepInEx.Configuration; using Flinch.Core; using HarmonyLib; using Microsoft.CodeAnalysis; using Newtonsoft.Json.Linq; using Photon.Pun; using Photon.Realtime; using REPOLib.Modules; using REPOLib.Objects.Sdk; using TMPro; using UnityEngine; using UnityEngine.AI; using UnityEngine.Events; using UnityEngine.Rendering; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)] [assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")] [assembly: AssemblyCompany("Flinch")] [assembly: AssemblyConfiguration("Debug")] [assembly: AssemblyFileVersion("0.1.21.0")] [assembly: AssemblyInformationalVersion("0.1.21")] [assembly: AssemblyProduct("Flinch")] [assembly: AssemblyTitle("Flinch")] [assembly: AssemblyVersion("0.1.21.0")] [module: RefSafetyRules(11)] 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 Flinch.Core { public sealed class BoneData { public string Name = ""; public int Parent; public float[] Rest = Array.Empty(); } public sealed class MeshData { public string Name = ""; public float[] Vertices = Array.Empty(); public int[] Bones = Array.Empty(); public float[] Weights = Array.Empty(); public int[] Triangles = Array.Empty(); } public sealed class ModelData { public BoneData[] Bones = Array.Empty(); public MeshData[] Meshes = Array.Empty(); } public sealed class ClipData { public string Name = ""; public float Duration; public float Travel; public bool Loop; public int Frames; public float[] Samples = Array.Empty(); } public static class AssetData { private static BinaryReader Open(Stream s) { BinaryReader binaryReader = new BinaryReader(s, Encoding.UTF8, leaveOpen: true); if (Encoding.ASCII.GetString(binaryReader.ReadBytes(8)) != "FLINCH07") { throw new InvalidDataException("Flinch asset header mismatch"); } return binaryReader; } private static int Count(BinaryReader r, int max) { int num = r.ReadInt32(); if (num < 0 || num > max) { throw new InvalidDataException("Asset count outside allowed range"); } return num; } private static string Text(BinaryReader r) { int num = Count(r, 1024); byte[] array = r.ReadBytes(num); if (array.Length != num) { throw new EndOfStreamException(); } return Encoding.UTF8.GetString(array); } private static float[] Floats(BinaryReader r, int n) { float[] array = new float[n]; for (int i = 0; i < n; i++) { array[i] = r.ReadSingle(); if (float.IsNaN(array[i]) || float.IsInfinity(array[i])) { throw new InvalidDataException("Nonfinite asset data"); } } return array; } public static ModelData ReadMesh(Stream stream) { using BinaryReader binaryReader = Open(stream); ModelData modelData = new ModelData(); modelData.Bones = new BoneData[Count(binaryReader, 256)]; ModelData modelData2 = modelData; for (int i = 0; i < modelData2.Bones.Length; i++) { BoneData boneData = new BoneData { Name = Text(binaryReader), Parent = binaryReader.ReadInt32(), Rest = Floats(binaryReader, 10) }; if (boneData.Parent >= i || boneData.Parent < -1) { throw new InvalidDataException("Invalid skeleton hierarchy"); } modelData2.Bones[i] = boneData; } modelData2.Meshes = new MeshData[Count(binaryReader, 32)]; for (int j = 0; j < modelData2.Meshes.Length; j++) { MeshData meshData = new MeshData { Name = Text(binaryReader) }; int num = Count(binaryReader, 200000); int num2 = Count(binaryReader, 600000); if (num2 % 3 != 0) { throw new InvalidDataException("Triangle count invalid"); } meshData.Vertices = new float[num * 8]; meshData.Bones = new int[num * 4]; meshData.Weights = new float[num * 4]; for (int k = 0; k < num; k++) { float[] sourceArray = Floats(binaryReader, 8); Array.Copy(sourceArray, 0, meshData.Vertices, k * 8, 8); for (int l = 0; l < 4; l++) { int num3 = binaryReader.ReadInt32(); if (num3 < 0 || num3 >= modelData2.Bones.Length) { throw new InvalidDataException("Skin bone index invalid"); } meshData.Bones[k * 4 + l] = num3; } sourceArray = Floats(binaryReader, 4); float num4 = 0f; for (int m = 0; m < 4; m++) { if (sourceArray[m] < 0f) { throw new InvalidDataException("Negative skin weight"); } num4 += sourceArray[m]; } if ((double)Math.Abs(num4 - 1f) > 0.001) { throw new InvalidDataException("Skin weights not normalized"); } Array.Copy(sourceArray, 0, meshData.Weights, k * 4, 4); } meshData.Triangles = new int[num2]; for (int n = 0; n < num2; n++) { int num5 = binaryReader.ReadInt32(); if (num5 < 0 || num5 >= num) { throw new InvalidDataException("Mesh index invalid"); } meshData.Triangles[n] = num5; } modelData2.Meshes[j] = meshData; } return modelData2; } public static ClipData[] ReadMotion(Stream stream, int boneCount) { using BinaryReader binaryReader = Open(stream); ClipData[] array = new ClipData[Count(binaryReader, 128)]; if (binaryReader.ReadInt32() != boneCount) { throw new InvalidDataException("Animation skeleton mismatch"); } for (int i = 0; i < array.Length; i++) { ClipData clipData = new ClipData { Name = Text(binaryReader), Duration = binaryReader.ReadSingle(), Travel = binaryReader.ReadSingle(), Loop = binaryReader.ReadBoolean(), Frames = Count(binaryReader, 10000) }; if (clipData.Duration <= 0f || float.IsNaN(clipData.Duration) || float.IsInfinity(clipData.Duration) || clipData.Frames < 2) { throw new InvalidDataException("Animation duration invalid"); } clipData.Samples = Floats(binaryReader, clipData.Frames * boneCount * 10); array[i] = clipData; } return array; } } public enum VoiceCue { None, Detect, Lost, Idle } public readonly struct AudioDecision { public readonly VoiceCue Voice; public readonly bool Step; public AudioDecision(VoiceCue voice, bool step) { Voice = voice; Step = step; } } public sealed class AudioCues { private bool seen; private bool hadTarget; private bool gaitSeeded; private int half; private float absent; private float noticeCooldown; private float lostCooldown; private float idleClock = 45f; private float stepCooldown; public void DelayIdle(float seconds) { idleClock = Math.Max(idleClock, seconds); } public AudioDecision Tick(float dt, bool visible, bool patrol, bool locomotion, float gait, bool voiceBusy, float distance) { if (dt <= 0f || float.IsNaN(dt) || float.IsInfinity(dt)) { return default(AudioDecision); } noticeCooldown = Math.Max(0f, noticeCooldown - dt); stepCooldown = Math.Max(0f, stepCooldown - dt); lostCooldown = Math.Max(0f, lostCooldown - dt); VoiceCue voiceCue = VoiceCue.None; if (visible) { if (!seen && noticeCooldown <= 0f) { voiceCue = VoiceCue.Detect; noticeCooldown = 8f; } hadTarget = true; absent = 0f; } else { absent += dt; if (hadTarget && absent >= 1.1f) { hadTarget = false; if (lostCooldown <= 0f) { voiceCue = VoiceCue.Lost; lostCooldown = 8f; } } } seen = visible; if (patrol && distance > 0.001f) { idleClock -= dt; } if (voiceCue != VoiceCue.None) { idleClock = 35f; } else if (idleClock <= 0f && !voiceBusy) { voiceCue = VoiceCue.Idle; idleClock = 60f; } int num = (int)Math.Floor(gait * 2f); bool flag = false; if (locomotion) { flag = gaitSeeded && num != half && distance > 0.001f && stepCooldown <= 0f; half = num; gaitSeeded = true; } else { gaitSeeded = false; } if (flag) { stepCooldown = 0.12f; } return new AudioDecision(voiceCue, flag); } } public static class CoverAttack { public const float EntryHold = 0.12f; public const float Windup = 0.2f; public const float Duration = 1.25f; public const float Impact = 0.28f; public const float Open = 0.22f; public const float Close = 0.65f; public const float Settle = 0.72f; public const float Commit = 0.14f; public const float Playback = 1.6f; public const float Inspection = 1.25f; } public sealed class EncounterCue { private float unseen = 30f; private float seen; private float cooldown; private bool armed = true; public bool Tick(bool visible, float dt) { if (float.IsNaN(dt) || float.IsInfinity(dt) || dt <= 0f) { return false; } cooldown = Math.Max(0f, cooldown - dt); if (!visible) { unseen += dt; seen = 0f; if (unseen >= 5f && cooldown <= 0f) { armed = true; } return false; } unseen = 0f; seen += dt; if (!armed || seen < 0.12f || cooldown > 0f) { return false; } armed = false; cooldown = 25f; return true; } } public enum State { Patrol, Observe, Stalk, Startle, Panic, RageTransition, Chase, Attack, CalmDown, Exhausted, Stunned, Dead, LookUnder, UnderAttack, Retreat, RoamBurst, InspectUnder } public enum RageCause { None, Neglect, Group, Provocation, Damage } public sealed class BrainSnapshot { public State State; public RageCause Cause; public float StateTime; public float GroupAlarm; public float SoloAlarm; public float RageTime; public float GroupLostTime; public float RearmRemaining; public float AttackRemaining; public int Sequence; public int AttackDamage; public int AttackVariant; public bool HitSent; public bool Encountered; public bool ChaseCommitted; public int CoverFailures; public float LostSight; public float UnreachableTime; public float RetreatRemaining; public float WanderClock = 45f; } public sealed class Settings { public bool SingleplayerRules; public bool StatueRules; public float SingleNeglectSeconds = 4f; public float SingleRageMultiplier = 2.4f; public float GroupRageMultiplier = 1.3f; public float SearchSeconds = 21f; public float UnreachableSeconds = 30f; public float PanicSeconds = 16f; public float NeglectSeconds = 16f; public float AlarmDecay = 2f; public float RageSeconds = 10f; public float GroupExitSeconds = 3f; public float ExhaustedSeconds = 3.5f; public float RearmSeconds = 10f; public float TransitionSeconds = 0.8f; public float StartleSeconds = 0.8f; public float AttackSeconds = 1.1f; public float ImpactSeconds = 0.46f; public float AttackCooldown = 2f; public float LowWindupSeconds = 0.2f; public float LowAttackSeconds = 1.25f; public float LowImpactSeconds = 0.28f; public int CalmDamage = 15; public int RageDamage = 35; } public readonly struct Perception { public readonly int VisiblePlayers; public readonly bool Watched; public readonly bool InReach; public readonly bool Provoked; public readonly bool HasMemory; public readonly bool Stunned; public readonly bool Dead; public readonly bool LowTarget; public readonly bool LowReach; public readonly bool Hidden; public readonly bool RunningChase; public readonly bool Roaming; public readonly bool KnownCover; public readonly bool CoverEntry; public readonly bool Vulnerable; public readonly bool Unreachable; public Perception(int visible = 0, bool watched = false, bool reach = false, bool provoked = false, bool memory = false, bool stunned = false, bool dead = false, bool low = false, bool lowReach = false, bool hidden = false, bool runningChase = false, bool roaming = false, bool knownCover = false, bool coverEntry = false, bool vulnerable = false, bool unreachable = false) { VisiblePlayers = visible; Watched = watched; InReach = reach; Provoked = provoked; HasMemory = memory; Stunned = stunned; Dead = dead; LowTarget = low; LowReach = lowReach; Hidden = hidden; RunningChase = runningChase; Roaming = roaming; KnownCover = knownCover; CoverEntry = coverEntry || lowReach; Vulnerable = vulnerable; Unreachable = unreachable; } } public sealed class FlinchBrain { private bool encountered; private bool hitSent; private int attackDamage; private int coverFailures; private float lostSight; private float unreachableTime; private float retreatRemaining; private bool chaseCommitted; private float wanderClock = 45f; public Settings Config { get; } public State State { get; private set; } = State.Patrol; public RageCause Cause { get; private set; } public float StateTime { get; private set; } public float GroupAlarm { get; private set; } public float SoloAlarm { get; private set; } public float RageTime { get; private set; } public float GroupLostTime { get; private set; } public float RearmRemaining { get; private set; } public float AttackRemaining { get; private set; } public int Sequence { get; private set; } public int DamagePulse { get; private set; } public int AttackVariant { get; private set; } public bool Enraged => Cause != RageCause.None; public bool ForcedPursuit => Cause == RageCause.Damage || Cause == RageCause.Provocation; public float SpeedFraction { get; private set; } public bool CoverScanExpired { get; private set; } public FlinchBrain(Settings? settings = null) { Config = settings ?? new Settings(); } public BrainSnapshot Capture() { return new BrainSnapshot { State = State, Cause = Cause, StateTime = StateTime, GroupAlarm = GroupAlarm, SoloAlarm = SoloAlarm, RageTime = RageTime, GroupLostTime = GroupLostTime, RearmRemaining = RearmRemaining, AttackRemaining = AttackRemaining, Sequence = Sequence, AttackDamage = attackDamage, AttackVariant = AttackVariant, HitSent = hitSent, Encountered = encountered, CoverFailures = coverFailures, LostSight = lostSight, UnreachableTime = unreachableTime, RetreatRemaining = retreatRemaining, ChaseCommitted = chaseCommitted, WanderClock = wanderClock }; } public void Restore(BrainSnapshot snapshot) { if (snapshot == null) { throw new ArgumentNullException("snapshot"); } State = snapshot.State; Cause = snapshot.Cause; StateTime = snapshot.StateTime; GroupAlarm = snapshot.GroupAlarm; SoloAlarm = snapshot.SoloAlarm; RageTime = snapshot.RageTime; GroupLostTime = snapshot.GroupLostTime; RearmRemaining = snapshot.RearmRemaining; AttackRemaining = snapshot.AttackRemaining; Sequence = snapshot.Sequence; attackDamage = snapshot.AttackDamage; AttackVariant = snapshot.AttackVariant; hitSent = snapshot.HitSent; encountered = snapshot.Encountered; DamagePulse = 0; coverFailures = snapshot.CoverFailures; lostSight = snapshot.LostSight; unreachableTime = snapshot.UnreachableTime; retreatRemaining = snapshot.RetreatRemaining; chaseCommitted = snapshot.ChaseCommitted; wanderClock = snapshot.WanderClock; } private void Set(State next) { if (State != next) { State = next; StateTime = 0f; Sequence++; } } private void EndRage(State next) { Cause = RageCause.None; float rageTime = (GroupLostTime = (unreachableTime = 0f)); RageTime = rageTime; chaseCommitted = false; coverFailures = 0; Set(next); } private void BeginRage(RageCause cause) { Cause = cause; float rageTime = (GroupLostTime = 0f); RageTime = rageTime; Set(State.RageTransition); } public void ReceiveDamage() { if (State == State.Dead) { return; } encountered = true; RageCause cause = (Config.StatueRules ? RageCause.Damage : RageCause.Provocation); if (Enraged) { Cause = cause; return; } bool flag = State == State.Stunned; retreatRemaining = 0f; coverFailures = 0; lostSight = 0f; BeginRage(cause); SpeedFraction = 0f; if (flag) { Set(State.Stunned); } } public void ReceiveProvocation() { if (State == State.Dead) { return; } encountered = true; if (Enraged) { if (Cause != RageCause.Damage) { Cause = RageCause.Provocation; } } else { retreatRemaining = 0f; coverFailures = 0; lostSight = 0f; BeginRage(RageCause.Provocation); SpeedFraction = 0f; } } private void BeginAttack() { AttackVariant ^= 1; attackDamage = (Enraged ? Config.RageDamage : Config.CalmDamage); AttackRemaining = Math.Max(Config.AttackCooldown, Config.AttackSeconds); hitSent = false; Set(State.Attack); } public void Tick(float dt, Perception input) { if (Config.StatueRules) { TickStatue(dt, input); return; } DamagePulse = 0; if (float.IsNaN(dt) || float.IsInfinity(dt) || dt <= 0f) { return; } if (State == State.Dead) { StateTime += dt; return; } StateTime += dt; RearmRemaining = Math.Max(0f, RearmRemaining - dt); AttackRemaining = Math.Max(0f, AttackRemaining - dt); if (input.Dead) { EndRage(State.Dead); SpeedFraction = 0f; return; } encountered |= input.VisiblePlayers > 0 || input.Provoked || input.LowTarget; if (input.Provoked && State != State.Exhausted) { if (!Enraged) { BeginRage(RageCause.Provocation); } else { Cause = RageCause.Provocation; } } if (input.Stunned) { Set(State.Stunned); SpeedFraction = 0f; return; } if (State == State.Stunned) { Set(State.CalmDown); } int num = Math.Max(0, input.VisiblePlayers); bool flag = !Config.SingleplayerRules && num >= 2; float num2 = (Config.SingleplayerRules ? Config.SingleNeglectSeconds : Config.NeglectSeconds); GroupAlarm = (flag ? Math.Min(Config.PanicSeconds, GroupAlarm + dt) : Math.Max(0f, GroupAlarm - Config.AlarmDecay * dt)); bool flag2 = !input.Watched && (Config.SingleplayerRules ? encountered : (num == 1)); SoloAlarm = (flag2 ? Math.Min(num2, SoloAlarm + dt) : Math.Max(0f, SoloAlarm - Config.AlarmDecay * dt)); if (State == State.Exhausted) { SpeedFraction = 0f; if (StateTime < Config.ExhaustedSeconds) { return; } Set(State.CalmDown); } if (Enraged && State != State.RageTransition) { RageTime += dt; GroupLostTime = (flag ? 0f : (GroupLostTime + dt)); if (RageTime >= Config.RageSeconds) { RearmRemaining = Config.RearmSeconds; float groupAlarm = (SoloAlarm = 0f); GroupAlarm = groupAlarm; EndRage(State.Exhausted); SpeedFraction = 0f; return; } if (Cause == RageCause.Group && GroupLostTime >= Config.GroupExitSeconds) { EndRage(State.CalmDown); } else if (!Config.SingleplayerRules && Cause == RageCause.Neglect && num == 1 && input.Watched) { EndRage(State.CalmDown); } else if (!Config.SingleplayerRules && num == 0 && !input.HasMemory) { EndRage(State.CalmDown); } } if (State == State.RageTransition) { SpeedFraction = 0f; if (StateTime >= Config.TransitionSeconds) { Set(State.Chase); } return; } if (State == State.Attack) { SpeedFraction = 0f; if (!hitSent && StateTime >= Config.ImpactSeconds) { hitSent = true; DamagePulse = attackDamage; } if (StateTime < Config.AttackSeconds) { return; } Set(Enraged ? State.Chase : State.CalmDown); } if (State == State.LookUnder) { SpeedFraction = 0f; if (Enraged && input.LowTarget) { if (!(StateTime < Config.LowWindupSeconds)) { attackDamage = Config.RageDamage; AttackRemaining = Config.AttackCooldown; hitSent = false; Set(State.UnderAttack); } return; } Set(State.Chase); } if (State == State.UnderAttack) { SpeedFraction = 0f; if (!hitSent && StateTime >= Config.LowImpactSeconds) { hitSent = true; if (Enraged && input.LowTarget && input.LowReach) { DamagePulse = attackDamage; } } if (StateTime < Config.LowAttackSeconds) { return; } Set(Enraged ? State.Chase : State.CalmDown); } if (Enraged) { Set(State.Chase); float num4 = (Config.SingleplayerRules ? Config.SingleRageMultiplier : Config.GroupRageMultiplier); SpeedFraction = ((Cause == RageCause.Group && !flag) ? (num4 * (1f - 0.65f * Math.Min(1f, GroupLostTime / Config.GroupExitSeconds))) : num4); if (input.LowTarget && input.LowReach && AttackRemaining <= 0f) { Set(State.LookUnder); SpeedFraction = 0f; } else if (input.InReach && num > 0 && AttackRemaining <= 0f) { BeginAttack(); } return; } if (RearmRemaining <= 0f) { if (flag && GroupAlarm >= Config.PanicSeconds) { BeginRage(RageCause.Group); SpeedFraction = 0f; return; } if (!flag && flag2 && SoloAlarm >= num2) { BeginRage(RageCause.Neglect); SpeedFraction = 0f; return; } } if (Config.SingleplayerRules) { Set(input.Watched ? State.Observe : (encountered ? State.Stalk : State.Patrol)); SpeedFraction = (input.Watched ? 0f : (encountered ? (0.8f + 0.3f * (SoloAlarm / Math.Max(0.01f, num2))) : 0.7f)); } else if (flag) { if (State != State.Panic && State != State.Startle) { Set(State.Startle); } if (State == State.Startle && StateTime >= Config.StartleSeconds) { Set(State.Panic); } SpeedFraction = -0.18f; } else if (num == 1) { Set(input.Watched ? State.Observe : State.Stalk); float num5 = ((Config.NeglectSeconds > 0f) ? (SoloAlarm / Config.NeglectSeconds) : 1f); SpeedFraction = (input.Watched ? 0.25f : (0.3f + 0.8f * num5)); } else { Set(input.HasMemory ? State.Stalk : State.Patrol); SpeedFraction = (input.HasMemory ? 0.35f : 0.3f); } } public void FinishSearch() { EndRage(State.Patrol); encountered = false; float soloAlarm = (GroupAlarm = 0f); SoloAlarm = soloAlarm; lostSight = 0f; SpeedFraction = 0.7f; } public void CoverResult(bool success) { if (Config.StatueRules && Enraged) { coverFailures = ((!success) ? (coverFailures + 1) : 0); if (coverFailures >= 3) { GiveUp(); } else if (!success) { AttackRemaining = Math.Max(AttackRemaining, 2.2f); } } } private void GiveUp() { EndRage(State.Retreat); float soloAlarm = (GroupAlarm = 0f); SoloAlarm = soloAlarm; encountered = false; retreatRemaining = 10f; RearmRemaining = Math.Max(18f, Config.RearmSeconds); SpeedFraction = 0.7f; } private void TickStatue(float dt, Perception input) { DamagePulse = 0; CoverScanExpired = false; if (float.IsNaN(dt) || float.IsInfinity(dt) || dt <= 0f) { return; } if (State == State.Dead) { StateTime += dt; return; } StateTime += dt; AttackRemaining = Math.Max(0f, AttackRemaining - dt); RearmRemaining = Math.Max(0f, RearmRemaining - dt); retreatRemaining = Math.Max(0f, retreatRemaining - dt); if (input.Dead) { EndRage(State.Dead); SpeedFraction = 0f; return; } bool flag = input.VisiblePlayers > 0 || input.KnownCover; if (retreatRemaining <= 0f) { encountered |= flag; } lostSight = (flag ? 0f : (lostSight + dt)); if (input.Provoked) { ReceiveProvocation(); } if (input.Stunned) { Set(State.Stunned); SpeedFraction = 0f; return; } if (State == State.Stunned) { Set(State.CalmDown); } if (Enraged && State == State.Chase && input.RunningChase) { chaseCommitted = true; } if (input.Hidden && !input.KnownCover && input.VisiblePlayers == 0 && !chaseCommitted && retreatRemaining <= 0f && State != State.Exhausted && (!input.Watched || ForcedPursuit)) { GiveUp(); return; } bool flag2 = input.Watched && !ForcedPursuit; SoloAlarm = (flag2 ? Math.Max(0f, SoloAlarm - Config.AlarmDecay * dt) : (encountered ? Math.Min(Config.SingleNeglectSeconds, SoloAlarm + dt) : 0f)); GroupAlarm = 0f; if (State == State.Exhausted) { SpeedFraction = 0f; if (StateTime < Config.ExhaustedSeconds) { return; } Set(State.CalmDown); } if (Enraged && State != State.RageTransition) { RageTime += dt; bool flag3 = input.Unreachable || (!flag && !input.HasMemory); unreachableTime = (flag3 ? (unreachableTime + dt) : 0f); if (unreachableTime >= Config.UnreachableSeconds) { GiveUp(); return; } } if (flag2) { if (Enraged && SoloAlarm <= 0f) { EndRage(State.Observe); } Set(State.Observe); SpeedFraction = 0f; return; } if (retreatRemaining > 0f) { Set(State.Retreat); SpeedFraction = 0.7f; return; } if (State == State.RageTransition) { SpeedFraction = 0f; if (StateTime >= (ForcedPursuit ? 0.25f : Config.TransitionSeconds)) { Set(State.Chase); } return; } if (State == State.Attack) { SpeedFraction = 0f; if (!hitSent && StateTime >= Config.ImpactSeconds) { hitSent = true; DamagePulse = attackDamage; } if (StateTime < Config.AttackSeconds) { return; } Set(State.Chase); } if (State == State.LookUnder) { SpeedFraction = 0f; if (!input.LowTarget) { Set(State.Chase); } else if (!input.LowReach && !input.CoverEntry) { Set(State.InspectUnder); } else if (!(StateTime < Config.LowWindupSeconds)) { attackDamage = Config.RageDamage; AttackRemaining = Config.AttackCooldown; hitSent = false; Set(State.UnderAttack); } return; } if (State == State.InspectUnder) { SpeedFraction = 0f; if (!input.LowTarget) { Set(State.Chase); return; } bool flag4 = input.KnownCover && input.CoverEntry && StateTime >= 1.25f; if ((input.LowReach || flag4) && AttackRemaining <= 0f) { Set(State.LookUnder); } else { CoverScanExpired = !input.LowReach && StateTime >= 1.25f && StateTime - dt < 1.25f; } return; } if (State == State.UnderAttack) { SpeedFraction = 0f; if (!hitSent && StateTime >= Config.LowImpactSeconds) { hitSent = true; DamagePulse = attackDamage; } if (StateTime < Config.LowAttackSeconds) { return; } if (input.LowTarget) { Set(State.InspectUnder); return; } Set(State.Chase); } if (Enraged) { Set(State.Chase); SpeedFraction = Config.SingleRageMultiplier; if (input.LowTarget && input.LowReach && (chaseCommitted || (ForcedPursuit && input.KnownCover)) && AttackRemaining <= 0f) { Set(State.LookUnder); SpeedFraction = 0f; } else if (input.LowTarget && input.CoverEntry && (chaseCommitted || (ForcedPursuit && input.KnownCover)) && AttackRemaining <= 0f) { Set(State.InspectUnder); SpeedFraction = 0f; } else if (input.InReach && input.VisiblePlayers > 0 && AttackRemaining <= 0f) { BeginAttack(); } return; } if (input.Vulnerable && input.VisiblePlayers > 0 && !input.Hidden && retreatRemaining <= 0f && RearmRemaining <= 0f) { coverFailures = 0; BeginRage(RageCause.Neglect); Set(State.Chase); SpeedFraction = Config.SingleRageMultiplier; return; } if (lostSight >= Config.SearchSeconds) { encountered = false; SoloAlarm = 0f; } if (encountered && SoloAlarm >= Config.SingleNeglectSeconds && RearmRemaining <= 0f) { coverFailures = 0; BeginRage(RageCause.Neglect); SpeedFraction = 0f; return; } if (State == State.RoamBurst && !encountered) { if (StateTime < 2.7f) { SpeedFraction = ((StateTime < 0.55f) ? 0f : 2.6f); return; } Set(State.Patrol); } if (!encountered && input.Roaming) { wanderClock -= dt; if (wanderClock <= 0f) { wanderClock = 55 + Sequence * 17 % 35; Set(State.RoamBurst); SpeedFraction = 0f; return; } } Set(encountered ? State.Stalk : State.Patrol); SpeedFraction = (encountered ? (0.45f + 0.65f * (SoloAlarm / Math.Max(0.01f, Config.SingleNeglectSeconds))) : 0.7f); } } public static class FrontGaze { public static bool FacesViewer(float forwardX, float forwardZ, float viewerX, float viewerZ) { return forwardX * viewerX + forwardZ * viewerZ > 0f; } } public readonly struct GazeCandidate { public readonly int Id; public readonly float Distance; public readonly bool Visible; public readonly bool Alive; public GazeCandidate(int id, float distance, bool visible = true, bool alive = true) { Id = id; Distance = distance; Visible = visible; Alive = alive; } } public sealed class GazeSelector { private float heldUntil; public int Target { get; private set; } = -1; public int Select(IReadOnlyList candidates, float time, int provoker = -1) { int num = -1; float num2 = float.PositiveInfinity; float num3 = float.PositiveInfinity; bool flag = false; for (int i = 0; i < candidates.Count; i++) { GazeCandidate gazeCandidate = candidates[i]; if (!gazeCandidate.Alive || !gazeCandidate.Visible || gazeCandidate.Distance < 0f || float.IsNaN(gazeCandidate.Distance) || float.IsInfinity(gazeCandidate.Distance)) { continue; } if (gazeCandidate.Id == provoker) { if (Target != gazeCandidate.Id) { Target = gazeCandidate.Id; heldUntil = time + 3f; } return Target; } if (gazeCandidate.Id == Target) { flag = true; num3 = gazeCandidate.Distance; } if (gazeCandidate.Distance < num2 || (gazeCandidate.Distance == num2 && (num < 0 || gazeCandidate.Id < num))) { num = gazeCandidate.Id; num2 = gazeCandidate.Distance; } } if (flag && (time < heldUntil || num2 >= num3 * 0.65f)) { return Target; } if (Target != num) { Target = num; heldUntil = time + 3f; } return Target; } } public static class GroundMotor { public static Vector2 Delta(float x, float z, float targetX, float targetZ, float acceleration, float dt) { if (dt <= 0f || float.IsNaN(dt) || float.IsInfinity(dt)) { return Vector2.Zero; } Vector2 vector = new Vector2(targetX - x, targetZ - z); float num = vector.Length(); float num2 = Math.Max(0f, acceleration) * dt; return (num > num2 && num > 0f) ? (vector * (num2 / num)) : vector; } } public sealed class RouteProgress { private float time; private float travel; public bool Tick(bool requested, float distance, float dt) { if (!requested) { time = (travel = 0f); return false; } time += dt; travel += Math.Max(0f, distance); if (travel >= 0.2f) { time = (travel = 0f); return false; } if (time < 3f) { return false; } time = (travel = 0f); return true; } } public static class LiftGate { public static bool Allows(int strengthUpgradeLevel, int requiredLevel) { return strengthUpgradeLevel >= requiredLevel; } } public static class LocomotionRules { public static float Probe(float speed, float dt) { return Math.Min(0.35f, Math.Max(0.12f, Math.Abs(speed) * Math.Min(0.05f, Math.Max(0.01f, dt)) + 0.1f)); } public static bool NavSurface(float horizontalError, float heightError, bool sameFreeSurface) { return horizontalError < 0.65f && Math.Abs(heightError) < 0.25f && sameFreeSurface; } public static float Duck(float freeHeight, float undersideNormalY) { return (undersideNormalY < -0.4f) ? Math.Max(0f, Math.Min(1f, (2.45f - freeHeight) / 0.7f)) : 0f; } } public static class ContactRules { public static bool Provokes(bool explicitGrab) { return explicitGrab; } } public static class DeathRules { public static bool HideBody(bool deathStarted) { return deathStarted; } public static bool Cleanup(float age, bool soulSpawned) { return (soulSpawned && age >= 0.25f) || age >= 3f; } } public static class MeleeWindow { public static bool Active(State state, float previousPhase, float phase) { return state == State.Attack && phase >= 0.36f && previousPhase <= 0.68f && phase >= previousPhase; } } public static class NativeBehaviour { public const float SearchSeconds = 20f; public const float RoamMinimum = 5f; public const float RoamMaximum = 15f; public const float RoamArrival = 2f; public static bool Breathing(State state, float speed, bool present) { return present && state == State.Observe && speed < 0.08f; } public static float PushAcceleration(bool cart, float alongSpeed, float mass, float dt) { float num = (cart ? 0.65f : 1.25f); return Math.Max(0f, Math.Min(cart ? 1.2f : 4f, (num - alongSpeed) / Math.Max(0.01f, dt))); } public static bool ReverseThroughNeck(float facingDot, bool turnFits, bool lowCeiling) { return facingDot < -0.25f && (lowCeiling || !turnFits); } public static float SpawnChance(int level, float first, float early, float middle, float late) { return (level < 1) ? 0f : ((level < 3) ? first : ((level < 6) ? early : ((level < 10) ? middle : late))); } } public sealed class RoamClock { public bool Selected { get; private set; } public float IdleRemaining { get; private set; } public float BlockedRemaining { get; private set; } = 5f; public void Idle(float seconds) { Selected = false; IdleRemaining = seconds; BlockedRemaining = 5f; } public void Select() { Selected = true; IdleRemaining = 0f; BlockedRemaining = 5f; } public float[] Capture() { return new float[3] { Selected ? 1f : 0f, IdleRemaining, BlockedRemaining }; } public void Restore(float selected, float idle, float blocked) { Selected = selected > 0f; IdleRemaining = Math.Max(0f, idle); BlockedRemaining = Math.Max(0f, blocked); } public bool Tick(float dt, float distance, float notMoving, bool frozen, bool spawnPaused, float idleSeconds) { if (frozen) { return false; } if (!Selected) { if (!spawnPaused) { IdleRemaining = Math.Max(0f, IdleRemaining - dt); } return IdleRemaining <= 0f; } if (distance < 2f) { Idle(idleSeconds); return false; } if (notMoving > 1f) { BlockedRemaining -= dt; } if (BlockedRemaining <= 0f) { Idle(idleSeconds); return false; } return false; } } public enum ObstructionAction { None, Warn, Break } public sealed class ObstructionClock { private int blocker; private float age; private float moved; private bool warned; private bool broken; public bool Pending => age >= 0.5f && !broken; public ObstructionAction Tick(int id, bool trying, float progress, float dt) { if (!trying || id != blocker) { blocker = id; age = (moved = 0f); warned = (broken = false); } moved += progress; if (moved > 0.12f) { age = (moved = 0f); warned = (broken = false); return ObstructionAction.None; } if (!trying || id == 0) { return ObstructionAction.None; } age += dt; if (age >= 4f && !broken) { broken = true; return ObstructionAction.Break; } if (age >= 3f && !warned) { warned = true; return ObstructionAction.Warn; } return ObstructionAction.None; } } public sealed class PathCursor { private int next; public int Next => next; public void Reset() { next = 0; } public int Advance(float[] distances, float arrival = 0.25f, float turnArrival = 0.35f) { while (next < distances.Length && distances[next] < ((next == distances.Length - 1) ? arrival : turnArrival)) { next++; } return next; } } public sealed class PcmWave { public int Rate; public int Channels; public float[] Samples = Array.Empty(); public static PcmWave Read(Stream stream) { BinaryReader reader = new BinaryReader(stream, Encoding.ASCII, leaveOpen: true); try { if (stream.Length < 12 || Tag() != "RIFF") { throw new InvalidDataException("Invalid WAV header"); } long num = (long)reader.ReadUInt32() + 8L; if (num > stream.Length || num < 12 || Tag() != "WAVE") { throw new InvalidDataException("Truncated WAV"); } int num2 = 0; int num3 = 0; byte[] array = null; while (stream.Position + 8 <= num) { string text = Tag(); uint num4 = reader.ReadUInt32(); long num5 = stream.Position + num4 + (num4 & 1); if (num5 > num || num4 > 33554432) { throw new InvalidDataException("Invalid WAV chunk"); } if (text == "fmt ") { if (num4 < 16) { throw new InvalidDataException("Invalid WAV format"); } int num6 = reader.ReadUInt16(); num2 = reader.ReadUInt16(); num3 = reader.ReadInt32(); int num7 = reader.ReadInt32(); int num8 = reader.ReadUInt16(); int num9 = reader.ReadUInt16(); if (num6 != 1 || num2 < 1 || num2 > 2 || num3 < 8000 || num3 > 96000 || num9 != 16 || num8 != num2 * 2 || num7 != num3 * num8) { throw new InvalidDataException("Only PCM16 mono/stereo supported"); } } else if (text == "data") { array = reader.ReadBytes((int)num4); } stream.Position = num5; } if (num2 == 0 || array == null || array.Length == 0 || array.Length % (num2 * 2) != 0) { throw new InvalidDataException("Missing WAV samples"); } PcmWave pcmWave = new PcmWave(); pcmWave.Rate = num3; pcmWave.Channels = num2; pcmWave.Samples = new float[array.Length / 2]; PcmWave pcmWave2 = pcmWave; for (int i = 0; i < pcmWave2.Samples.Length; i++) { pcmWave2.Samples[i] = (float)(short)(array[i * 2] | (array[i * 2 + 1] << 8)) / 32768f; } return pcmWave2; } finally { if (reader != null) { ((IDisposable)reader).Dispose(); } } string Tag() { return Encoding.ASCII.GetString(reader.ReadBytes(4)); } } } public static class ReachEnvelope { public static bool Allows(float horizontal, float vertical) { return horizontal >= 0f && horizontal * horizontal + vertical * vertical <= 3.8025002f; } } public sealed class RearSurprise { private float rearMemory; private float cooldown; public bool Tick(float dt, bool closeBehind, bool stoppedByThisViewer) { cooldown = Math.Max(0f, cooldown - dt); rearMemory = Math.Max(0f, rearMemory - dt); if (closeBehind) { rearMemory = 1.2f; } if (!stoppedByThisViewer || rearMemory <= 0f || cooldown > 0f) { return false; } rearMemory = 0f; cooldown = 45f; return true; } } public sealed class ReturnTrail { private readonly List points = new List(); public KnowledgePoint[] Capture() { return points.ToArray(); } public void Restore(IEnumerable saved) { points.Clear(); foreach (KnowledgePoint item in saved) { if (points.Count >= 64) { break; } points.Add(item); } } public void Record(KnowledgePoint point, bool onNavigationSurface) { if (onNavigationSurface) { points.Clear(); points.Add(point); return; } if (points.Count == 0 || points[points.Count - 1].Distance(point) > 0.25f) { points.Add(point); } if (points.Count > 64) { points.RemoveAt(1); } } public KnowledgePoint[] Backtrack(KnowledgePoint current) { List list = new List(); for (int num = points.Count - 1; num >= 0; num--) { if (points[num].Distance(current) > 0.15f) { list.Add(points[num]); } } return list.ToArray(); } } public readonly struct SearchPoint { public readonly int Id; public readonly float PathLength; public readonly float ClueDistance; public readonly bool Reachable; public SearchPoint(int id, float pathLength, float clueDistance = 0f, bool reachable = true) { Id = id; PathLength = pathLength; ClueDistance = clueDistance; Reachable = reachable; } } public sealed class SearchRoute { private readonly Dictionary visited = new Dictionary(); public static bool IsSelected(int id) { return id != -1; } public void Visit(int id, float time) { visited[id] = time; } public float RecentPenalty(int id, float time) { float value; return visited.TryGetValue(id, out value) ? (Math.Max(0f, 45f - (time - value)) * 2f) : 0f; } public int Choose(IReadOnlyList points, float time, bool followingClue) { int result = -1; float num = float.PositiveInfinity; for (int i = 0; i < points.Count; i++) { SearchPoint searchPoint = points[i]; if (searchPoint.Reachable && !(searchPoint.PathLength < 0.3f) && !float.IsNaN(searchPoint.PathLength) && !float.IsInfinity(searchPoint.PathLength)) { float num2 = searchPoint.PathLength + RecentPenalty(searchPoint.Id, time) + (followingClue ? (Math.Max(0f, searchPoint.ClueDistance) * 0.3f) : 0f); if (num2 < num) { num = num2; result = searchPoint.Id; } } } return result; } } public static class StandingGaze { public static bool Eligible(bool crouching, bool crawling, bool tumbling) { return !crouching && !crawling && !tumbling; } } public sealed class SharedGaze { private struct Sample { public bool Eligible; public bool Watching; public float At; public float Positive; } private readonly Dictionary samples = new Dictionary(); public void Clear() { samples.Clear(); } public void Report(int id, bool watching, bool eligible, float now) { samples.TryGetValue(id, out var value); if (!samples.ContainsKey(id)) { value.Positive = -100f; } value.At = now; value.Eligible = eligible; value.Watching = watching; if (watching && eligible) { value.Positive = now; } samples[id] = value; } public bool Watched(float now) { foreach (Sample value in samples.Values) { if (value.Eligible && now - value.At <= 0.3f && (value.Watching || now - value.Positive < 0.12f)) { return true; } } return false; } } public static class ShelterRules { public static bool CanFreeze(bool crawling, bool overheadCover) { return !(crawling && overheadCover); } public static bool RecognizesLastTarget(bool sameTarget, float age, float displacement) { return sameTarget && age >= 0f && age < 6f && displacement < 2.5f; } } public sealed class SoulReward { private bool claimed; public int Claim(float sample) { if (claimed) { return 0; } claimed = true; if (float.IsNaN(sample)) { sample = 0f; } return 4000 + 100 * Math.Min(30, (int)(Math.Max(0f, Math.Min(1f, sample)) * 31f)); } } public sealed class SoundMemory { public const float SearchSeconds = 2.5f; private const float BlockedSeconds = 5f; private const float ArrivalDistance = 0.55f; private const float ArrivalHeight = 0.4f; private float heardAt = float.NegativeInfinity; private float score; private float blockedRemaining = 5f; public float SearchRemaining { get; private set; } public bool Searching => SearchRemaining > 0f; public bool Active(float now) { return !float.IsNegativeInfinity(heardAt); } public static bool WithinArrival(float horizontalDistance, float elevationDelta) { return horizontalDistance <= 0.55f && Math.Abs(elevationDelta) <= 0.4f; } public void Tick(float dt, float horizontalDistance, float elevationDelta, bool blocked) { if (!Active(0f) || dt <= 0f || float.IsNaN(dt) || float.IsInfinity(dt)) { return; } if (Searching) { SearchRemaining -= dt; if (SearchRemaining <= 0.0001f) { Clear(); } return; } if (WithinArrival(horizontalDistance, elevationDelta)) { SearchRemaining = 2.5f; return; } if (blocked) { blockedRemaining -= dt; } if (blockedRemaining <= 0.0001f) { Clear(); } } public float[] Capture(float now) { return new float[5] { Active(now) ? 1f : 0f, Active(now) ? (now - heardAt) : 0f, score, blockedRemaining, SearchRemaining }; } public void Restore(float now, float active, float age, float strength, float blocked, float search = 0f) { if (active <= 0f) { Clear(); return; } heardAt = now - age; score = strength; blockedRemaining = blocked; SearchRemaining = search; } public bool Hear(float distance, float radius, bool occluded, float now, bool sameSource = false) { if (float.IsNaN(distance) || float.IsNaN(radius) || float.IsInfinity(distance) || radius <= 0f || distance < 0f) { return false; } float num = Math.Min(radius, 35f) * (occluded ? 0.6f : 1f); if (distance >= num) { return false; } float num2 = num - distance; if (Active(now) && (sameSource || (now - heardAt < 2f && num2 < score * 0.45f))) { return false; } heardAt = now; score = num2; blockedRemaining = 5f; SearchRemaining = 0f; return true; } public void Clear() { heardAt = float.NegativeInfinity; score = 0f; blockedRemaining = 5f; SearchRemaining = 0f; } } public static class StairStep { public static float Delta(float rise, float upwardSpeed, float dt, bool clear, bool moving) { if (!clear || !moving || rise < 0.025f || rise > 0.34f || dt <= 0f || float.IsNaN(dt) || float.IsInfinity(dt) || float.IsNaN(rise) || float.IsNaN(upwardSpeed)) { return 0f; } float num = Math.Min(2.1f, 0.35f + rise * 5f); float val = 16f * Math.Min(dt, 0.05f); return Math.Max(0f, Math.Min(val, num - upwardSpeed)); } } public static class StealthAudio { public const float DetectGain = 0.3f; public const float DetectRange = 9f; public static float StepGain(bool pursuit) { return pursuit ? 0.5f : 0.18f; } public static float StepRange(bool pursuit) { return pursuit ? 18f : 5f; } } public sealed class StrideClock { public float Phase { get; private set; } public void Advance(float distance, float travelPerCycle) { if (!float.IsNaN(distance) && !float.IsInfinity(distance) && !(distance <= 0f) && !(travelPerCycle <= 0f)) { Phase = (Phase + distance / travelPerCycle) % 1f; } } } public sealed class StrikeLatch { private bool open; private int openedAt; public bool Tick(State state, int frame, bool requested) { if (state != State.Attack) { open = false; return false; } if (requested && !open) { openedAt = frame; } open = requested || (open && frame <= openedAt + 1); return open; } } public readonly struct KnowledgePoint { public readonly float X; public readonly float Y; public readonly float Z; public KnowledgePoint(float x, float y, float z) { X = x; Y = y; Z = z; } public float Distance(KnowledgePoint p) { return (float)Math.Sqrt((X - p.X) * (X - p.X) + (Y - p.Y) * (Y - p.Y) + (Z - p.Z) * (Z - p.Z)); } } public sealed class TargetKnowledge { public const float TrackingSeconds = 5f; public int Id = -1; public KnowledgePoint LastSeen; public KnowledgePoint CoverPoint; public float SeenAt = -100f; public float CoverUntil = -100f; public float AnchorAt = -100f; public static float ObservationTime(float now, float sentAge, float transitAge) { if (float.IsNaN(now) || float.IsInfinity(now)) { return float.NegativeInfinity; } if (float.IsNaN(sentAge) || float.IsInfinity(sentAge) || float.IsNaN(transitAge) || float.IsInfinity(transitAge)) { return now - 5f; } return now - Math.Max(0f, sentAge) - Math.Max(0f, transitAge); } public void See(int id, KnowledgePoint point, float now, bool frontal = true) { if (Id != id) { AnchorAt = -100f; } Id = id; LastSeen = point; SeenAt = now; CoverUntil = -100f; if (frontal) { AnchorAt = now; } } public bool RecentRear(int id, float now, float distance) { return Id == id && now - AnchorAt < 2.5f && distance <= 3f; } public bool Hide(int id, KnowledgePoint point, float now, bool witnessed) { if (CoverKnown(now) || !witnessed || Id != id || now - SeenAt > 2f || LastSeen.Distance(point) > 3f) { return false; } CoverPoint = point; CoverUntil = now + 22f; return true; } public bool CoverKnown(float now) { return Id >= 0 && now < CoverUntil; } public bool TrackingActive(float now) { return Id >= 0 && now >= SeenAt && now - SeenAt < 5f && !CoverKnown(now); } public bool UpdateTracking(int id, KnowledgePoint point, float now) { if (id < 0 || Id != id || !TrackingActive(now)) { return false; } LastSeen = point; return true; } public bool RecordGrab(int id, KnowledgePoint point, float now, bool verifiedAttempt, bool sheltered) { if (id < 0 || !ContactRules.Provokes(verifiedAttempt)) { return false; } See(id, point, now, frontal: false); if (sheltered) { CoverPoint = point; CoverUntil = now + 22f; } return true; } public bool ObserveCover(int id, KnowledgePoint point, float now, bool visible) { if (!visible || Id != id || !CoverKnown(now)) { return false; } CoverPoint = point; CoverUntil = now + 22f; SeenAt = now; return true; } public void Forget() { Id = -1; SeenAt = (CoverUntil = (AnchorAt = -100f)); } } public sealed class TravelWatch { private KnowledgePoint anchor; private bool anchored; private float age; public void Reset() { anchored = false; age = 0f; } public bool Tick(KnowledgePoint position, bool tryingToTravel, float dt) { if (!tryingToTravel) { Reset(); return false; } if (float.IsNaN(dt) || float.IsInfinity(dt) || dt <= 0f) { return false; } if (!anchored) { anchor = position; anchored = true; age = 0f; } float num = position.X - anchor.X; float num2 = position.Z - anchor.Z; if (num * num + num2 * num2 >= 0.09f) { anchor = position; age = 0f; } else { age += Math.Min(dt, 0.25f); } return age >= 5f; } } public static class VisionLayers { public static int Environment(int gameVisionMask, int playerMask) { return gameVisionMask & ~playerMask; } } } namespace Flinch.Mod { public sealed class AttackStep { private int sequence = -1; private float travelled; private float entrySpeed; private Vector3 previous; private Vector3 heading; public Vector3 Plan(Vector3 position, Quaternion rotation, Vector3 target, float phase, int nextSequence, float dt, Vector3 incoming = default(Vector3)) { //IL_007c: 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_0083: 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_009f: 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_0027: 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_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) //IL_0030: 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_003a: Unknown result type (might be due to invalid IL or missing references) //IL_003f: Unknown result type (might be due to invalid IL or missing references) //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_004e: 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_00b5: 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_00b7: Unknown result type (might be due to invalid IL or missing references) //IL_00bc: Unknown result type (might be due to invalid IL or missing references) //IL_00c1: Unknown result type (might be due to invalid IL or missing references) //IL_00c6: Unknown result type (might be due to invalid IL or missing references) //IL_00ca: Unknown result type (might be due to invalid IL or missing references) //IL_00cf: Unknown result type (might be due to invalid IL or missing references) //IL_00e7: Unknown result type (might be due to invalid IL or missing references) //IL_00ec: Unknown result type (might be due to invalid IL or missing references) //IL_00fb: Unknown result type (might be due to invalid IL or missing references) //IL_0100: 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_02b4: Unknown result type (might be due to invalid IL or missing references) //IL_01fc: Unknown result type (might be due to invalid IL or missing references) //IL_01fd: Unknown result type (might be due to invalid IL or missing references) //IL_0207: Unknown result type (might be due to invalid IL or missing references) //IL_020c: Unknown result type (might be due to invalid IL or missing references) //IL_0217: Unknown result type (might be due to invalid IL or missing references) //IL_0237: Unknown result type (might be due to invalid IL or missing references) //IL_023c: Unknown result type (might be due to invalid IL or missing references) //IL_02a5: Unknown result type (might be due to invalid IL or missing references) //IL_02ab: Unknown result type (might be due to invalid IL or missing references) //IL_02b0: Unknown result type (might be due to invalid IL or missing references) //IL_024e: Unknown result type (might be due to invalid IL or missing references) Vector3 val; if (sequence != nextSequence) { sequence = nextSequence; travelled = 0f; previous = position; val = Vector3.ProjectOnPlane(target - position, Vector3.up); heading = ((Vector3)(ref val)).normalized; entrySpeed = Mathf.Clamp(Vector3.Dot(incoming, heading), 0f, 3.2f); } travelled += Mathf.Max(0f, Vector3.Dot(position - previous, heading)); previous = position; if (phase < 0.2f) { val = Vector3.ProjectOnPlane(target - position, Vector3.up); Vector3 normalized = ((Vector3)(ref val)).normalized; if (((Vector3)(ref normalized)).sqrMagnitude > 0.1f) { heading = Vector3.RotateTowards(heading, normalized, 2.2f * dt, 0f); } } if (phase > 0.72f || ((Vector3)(ref heading)).sqrMagnitude < 0.1f) { return Vector3.zero; } float num = entrySpeed * 0.1f * Mathf.SmoothStep(0f, 1f, Mathf.InverseLerp(0f, 0.23f, phase)); float num2 = 0.72f * Mathf.SmoothStep(0f, 1f, Mathf.InverseLerp(0.1f, 0.52f, phase)) + num; float num3 = Mathf.Min(4.5f, Mathf.Max(0f, num2 - travelled) / Mathf.Max(0.04f, dt)); if (phase < 0.18f && travelled < 0.24f) { num3 = Mathf.Max(num3, entrySpeed * (1f - Mathf.InverseLerp(0.05f, 0.18f, phase))); } RaycastHit[] array = Physics.SphereCastAll(position + Vector3.up * 0.55f, 0.3f, heading, 0.9f, WorldQueries.Mask, (QueryTriggerInteraction)1); for (int i = 0; i < array.Length; i++) { RaycastHit val2 = array[i]; if (WallSafety.BlocksMovement(((RaycastHit)(ref val2)).collider) && Mathf.Abs(((RaycastHit)(ref val2)).normal.y) < 0.6f) { num3 = Mathf.Min(num3, Mathf.Sqrt(64f * Mathf.Max(0f, ((RaycastHit)(ref val2)).distance - 0.05f))); } } return heading * num3; } } public sealed class AuthoredAttackPose { private static readonly float[] SillProbes = new float[4] { 0.12f, 0.23f, 0.34f, 0f }; private readonly FlinchMotion motion; private int sequence = -1; private Vector3 lockedTarget; private Vector3 lastTarget; private Vector3 leadFoot; private bool tracking; private bool raised; private bool throughOpening; private float raisedFloor; private float sillHeight; private float exitBlend; public AuthoredAttackPose(FlinchMotion motion) { this.motion = motion; } private static float Ease(float a, float b, float t) { return Mathf.SmoothStep(0f, 1f, Mathf.InverseLerp(a, b, t)); } private static bool TrySill(Vector3 body, Vector3 target, float targetFloor, out float height) { //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_0009: Unknown result type (might be due to invalid IL or missing references) //IL_000a: Unknown result type (might be due to invalid IL or missing references) //IL_000f: Unknown result type (might be due to invalid IL or missing references) //IL_0014: Unknown result type (might be due to invalid IL or missing references) //IL_0019: 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_003a: 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_0054: Unknown result type (might be due to invalid IL or missing references) //IL_0058: Unknown result type (might be due to invalid IL or missing references) //IL_0066: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_007b: 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_00a9: Unknown result type (might be due to invalid IL or missing references) //IL_00ae: Unknown result type (might be due to invalid IL or missing references) //IL_00b3: Unknown result type (might be due to invalid IL or missing references) //IL_00b5: Unknown result type (might be due to invalid IL or missing references) //IL_00cc: Unknown result type (might be due to invalid IL or missing references) //IL_00f0: Unknown result type (might be due to invalid IL or missing references) height = 0f; Vector3 val = Vector3.ProjectOnPlane(target - body, Vector3.up); if (((Vector3)(ref val)).sqrMagnitude < 0.01f) { return false; } Vector3 normalized = ((Vector3)(ref val)).normalized; float[] sillProbes = SillProbes; foreach (float num in sillProbes) { Vector3 origin = body; origin.y = target.y - num; if (WorldQueries.Raycast(origin, normalized, ((Vector3)(ref val)).magnitude, out var hit) && !(Mathf.Abs(((RaycastHit)(ref hit)).normal.y) > 0.5f)) { Vector3 point = ((RaycastHit)(ref hit)).point + normalized * 0.07f; if (GroundSupport.Floor(point, 0.4f, 0.1f, out var floor) && !(floor.Position.y <= targetFloor + 0.2f)) { height = floor.Position.y; return true; } } } return false; } public void Pose(State state, float phase, Vector3 target, int nextSequence, int variant, float dt) { //IL_01a6: 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_01a8: Unknown result type (might be due to invalid IL or missing references) //IL_01aa: Unknown result type (might be due to invalid IL or missing references) //IL_01af: 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_01d8: Unknown result type (might be due to invalid IL or missing references) //IL_01dd: Unknown result type (might be due to invalid IL or missing references) //IL_01f2: Unknown result type (might be due to invalid IL or missing references) //IL_0202: Unknown result type (might be due to invalid IL or missing references) //IL_0203: Unknown result type (might be due to invalid IL or missing references) //IL_020d: Unknown result type (might be due to invalid IL or missing references) //IL_0212: Unknown result type (might be due to invalid IL or missing references) //IL_0217: Unknown result type (might be due to invalid IL or missing references) //IL_00df: 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_00f3: Unknown result type (might be due to invalid IL or missing references) //IL_0311: Unknown result type (might be due to invalid IL or missing references) //IL_0313: Unknown result type (might be due to invalid IL or missing references) //IL_0318: Unknown result type (might be due to invalid IL or missing references) //IL_0329: Unknown result type (might be due to invalid IL or missing references) //IL_030a: Unknown result type (might be due to invalid IL or missing references) //IL_023a: Unknown result type (might be due to invalid IL or missing references) //IL_023f: Unknown result type (might be due to invalid IL or missing references) //IL_02d6: Unknown result type (might be due to invalid IL or missing references) //IL_02db: Unknown result type (might be due to invalid IL or missing references) //IL_032e: Unknown result type (might be due to invalid IL or missing references) //IL_0331: Unknown result type (might be due to invalid IL or missing references) //IL_0332: Unknown result type (might be due to invalid IL or missing references) //IL_0339: Unknown result type (might be due to invalid IL or missing references) //IL_0264: Unknown result type (might be due to invalid IL or missing references) //IL_042b: Unknown result type (might be due to invalid IL or missing references) //IL_0352: Unknown result type (might be due to invalid IL or missing references) //IL_0357: Unknown result type (might be due to invalid IL or missing references) //IL_035c: Unknown result type (might be due to invalid IL or missing references) //IL_0362: Unknown result type (might be due to invalid IL or missing references) //IL_0363: Unknown result type (might be due to invalid IL or missing references) //IL_02ae: Unknown result type (might be due to invalid IL or missing references) //IL_0277: Unknown result type (might be due to invalid IL or missing references) //IL_0282: Unknown result type (might be due to invalid IL or missing references) //IL_045b: Unknown result type (might be due to invalid IL or missing references) //IL_0460: Unknown result type (might be due to invalid IL or missing references) //IL_0465: Unknown result type (might be due to invalid IL or missing references) //IL_04af: Unknown result type (might be due to invalid IL or missing references) //IL_04b4: Unknown result type (might be due to invalid IL or missing references) //IL_04bb: Unknown result type (might be due to invalid IL or missing references) //IL_04c0: Unknown result type (might be due to invalid IL or missing references) //IL_050a: Unknown result type (might be due to invalid IL or missing references) //IL_050f: Unknown result type (might be due to invalid IL or missing references) //IL_0516: Unknown result type (might be due to invalid IL or missing references) //IL_051b: Unknown result type (might be due to invalid IL or missing references) //IL_0567: Unknown result type (might be due to invalid IL or missing references) //IL_056c: Unknown result type (might be due to invalid IL or missing references) //IL_0573: Unknown result type (might be due to invalid IL or missing references) //IL_0578: Unknown result type (might be due to invalid IL or missing references) //IL_05f5: Unknown result type (might be due to invalid IL or missing references) //IL_0614: Unknown result type (might be due to invalid IL or missing references) //IL_0619: Unknown result type (might be due to invalid IL or missing references) //IL_063a: Unknown result type (might be due to invalid IL or missing references) //IL_063f: Unknown result type (might be due to invalid IL or missing references) //IL_06a4: Unknown result type (might be due to invalid IL or missing references) //IL_06a9: Unknown result type (might be due to invalid IL or missing references) //IL_06ae: Unknown result type (might be due to invalid IL or missing references) //IL_06c0: Unknown result type (might be due to invalid IL or missing references) //IL_06eb: Unknown result type (might be due to invalid IL or missing references) //IL_06ee: Unknown result type (might be due to invalid IL or missing references) //IL_06f8: Unknown result type (might be due to invalid IL or missing references) //IL_06fd: Unknown result type (might be due to invalid IL or missing references) //IL_0702: Unknown result type (might be due to invalid IL or missing references) //IL_073b: Unknown result type (might be due to invalid IL or missing references) //IL_0740: Unknown result type (might be due to invalid IL or missing references) //IL_076d: Unknown result type (might be due to invalid IL or missing references) //IL_0771: Unknown result type (might be due to invalid IL or missing references) //IL_0776: Unknown result type (might be due to invalid IL or missing references) //IL_077b: Unknown result type (might be due to invalid IL or missing references) //IL_077d: Unknown result type (might be due to invalid IL or missing references) //IL_0781: Unknown result type (might be due to invalid IL or missing references) //IL_0750: Unknown result type (might be due to invalid IL or missing references) //IL_07a9: Unknown result type (might be due to invalid IL or missing references) //IL_07ae: Unknown result type (might be due to invalid IL or missing references) //IL_07b3: Unknown result type (might be due to invalid IL or missing references) //IL_07b7: Unknown result type (might be due to invalid IL or missing references) //IL_07bc: Unknown result type (might be due to invalid IL or missing references) //IL_07c0: Unknown result type (might be due to invalid IL or missing references) //IL_07c5: Unknown result type (might be due to invalid IL or missing references) //IL_07c7: Unknown result type (might be due to invalid IL or missing references) //IL_07c9: Unknown result type (might be due to invalid IL or missing references) //IL_07cd: Unknown result type (might be due to invalid IL or missing references) //IL_07d2: Unknown result type (might be due to invalid IL or missing references) //IL_07d4: Unknown result type (might be due to invalid IL or missing references) //IL_07d7: Unknown result type (might be due to invalid IL or missing references) //IL_0805: Unknown result type (might be due to invalid IL or missing references) //IL_0812: Unknown result type (might be due to invalid IL or missing references) //IL_0817: Unknown result type (might be due to invalid IL or missing references) //IL_081c: Unknown result type (might be due to invalid IL or missing references) //IL_085a: Unknown result type (might be due to invalid IL or missing references) //IL_085d: Unknown result type (might be due to invalid IL or missing references) //IL_082c: Unknown result type (might be due to invalid IL or missing references) //IL_0881: Unknown result type (might be due to invalid IL or missing references) //IL_0888: Unknown result type (might be due to invalid IL or missing references) //IL_0895: Unknown result type (might be due to invalid IL or missing references) //IL_089a: Unknown result type (might be due to invalid IL or missing references) //IL_089f: Unknown result type (might be due to invalid IL or missing references) //IL_08af: Unknown result type (might be due to invalid IL or missing references) //IL_08be: Unknown result type (might be due to invalid IL or missing references) //IL_091a: Unknown result type (might be due to invalid IL or missing references) //IL_092e: Unknown result type (might be due to invalid IL or missing references) //IL_0933: Unknown result type (might be due to invalid IL or missing references) //IL_093a: Unknown result type (might be due to invalid IL or missing references) //IL_093f: Unknown result type (might be due to invalid IL or missing references) //IL_0943: Unknown result type (might be due to invalid IL or missing references) //IL_0949: Unknown result type (might be due to invalid IL or missing references) //IL_08fd: Unknown result type (might be due to invalid IL or missing references) //IL_0964: Unknown result type (might be due to invalid IL or missing references) //IL_0969: Unknown result type (might be due to invalid IL or missing references) //IL_096f: Unknown result type (might be due to invalid IL or missing references) //IL_0997: Unknown result type (might be due to invalid IL or missing references) //IL_099c: Unknown result type (might be due to invalid IL or missing references) //IL_09a2: Unknown result type (might be due to invalid IL or missing references) //IL_09bb: Unknown result type (might be due to invalid IL or missing references) //IL_09c0: Unknown result type (might be due to invalid IL or missing references) //IL_09c5: Unknown result type (might be due to invalid IL or missing references) //IL_09c9: Unknown result type (might be due to invalid IL or missing references) //IL_09cb: Unknown result type (might be due to invalid IL or missing references) //IL_0a1b: Unknown result type (might be due to invalid IL or missing references) //IL_0a20: Unknown result type (might be due to invalid IL or missing references) //IL_0a27: Unknown result type (might be due to invalid IL or missing references) //IL_0a2d: Unknown result type (might be due to invalid IL or missing references) //IL_0a33: Unknown result type (might be due to invalid IL or missing references) //IL_0a3d: Unknown result type (might be due to invalid IL or missing references) //IL_0a42: Unknown result type (might be due to invalid IL or missing references) //IL_0a6e: Unknown result type (might be due to invalid IL or missing references) //IL_0a75: Unknown result type (might be due to invalid IL or missing references) //IL_0a7a: Unknown result type (might be due to invalid IL or missing references) //IL_0a7f: Unknown result type (might be due to invalid IL or missing references) //IL_0aaa: Unknown result type (might be due to invalid IL or missing references) //IL_0aaf: Unknown result type (might be due to invalid IL or missing references) //IL_0ab1: Unknown result type (might be due to invalid IL or missing references) //IL_0ab5: Unknown result type (might be due to invalid IL or missing references) //IL_0aba: Unknown result type (might be due to invalid IL or missing references) //IL_0abf: Unknown result type (might be due to invalid IL or missing references) //IL_0ac6: Unknown result type (might be due to invalid IL or missing references) //IL_0acb: Unknown result type (might be due to invalid IL or missing references) //IL_0adb: Unknown result type (might be due to invalid IL or missing references) //IL_0b6b: Unknown result type (might be due to invalid IL or missing references) //IL_0b70: Unknown result type (might be due to invalid IL or missing references) //IL_0b74: Unknown result type (might be due to invalid IL or missing references) //IL_0b79: Unknown result type (might be due to invalid IL or missing references) //IL_0b7d: Unknown result type (might be due to invalid IL or missing references) //IL_0b82: Unknown result type (might be due to invalid IL or missing references) //IL_0b8e: Unknown result type (might be due to invalid IL or missing references) //IL_0b93: Unknown result type (might be due to invalid IL or missing references) //IL_0b9d: Unknown result type (might be due to invalid IL or missing references) //IL_0bb2: Unknown result type (might be due to invalid IL or missing references) //IL_0bb7: Unknown result type (might be due to invalid IL or missing references) //IL_0bc1: Unknown result type (might be due to invalid IL or missing references) //IL_0bd6: Unknown result type (might be due to invalid IL or missing references) //IL_0bdb: Unknown result type (might be due to invalid IL or missing references) //IL_0be5: Unknown result type (might be due to invalid IL or missing references) //IL_0c83: Unknown result type (might be due to invalid IL or missing references) //IL_0c89: Unknown result type (might be due to invalid IL or missing references) //IL_0c96: Unknown result type (might be due to invalid IL or missing references) //IL_0c9b: Unknown result type (might be due to invalid IL or missing references) //IL_0ca1: Unknown result type (might be due to invalid IL or missing references) //IL_0cb9: Unknown result type (might be due to invalid IL or missing references) //IL_0cbe: Unknown result type (might be due to invalid IL or missing references) //IL_0cc3: Unknown result type (might be due to invalid IL or missing references) //IL_0db5: Unknown result type (might be due to invalid IL or missing references) //IL_0ce0: Unknown result type (might be due to invalid IL or missing references) //IL_0ce3: Unknown result type (might be due to invalid IL or missing references) //IL_0ce8: Unknown result type (might be due to invalid IL or missing references) //IL_0ced: Unknown result type (might be due to invalid IL or missing references) //IL_0dcc: Unknown result type (might be due to invalid IL or missing references) //IL_0dd7: Unknown result type (might be due to invalid IL or missing references) //IL_0d9a: Unknown result type (might be due to invalid IL or missing references) //IL_0da1: Unknown result type (might be due to invalid IL or missing references) //IL_0da8: Unknown result type (might be due to invalid IL or missing references) //IL_0dad: Unknown result type (might be due to invalid IL or missing references) //IL_0db2: Unknown result type (might be due to invalid IL or missing references) //IL_0d0c: Unknown result type (might be due to invalid IL or missing references) //IL_0d18: Unknown result type (might be due to invalid IL or missing references) //IL_0e20: Unknown result type (might be due to invalid IL or missing references) //IL_0e24: Unknown result type (might be due to invalid IL or missing references) //IL_0e2a: Unknown result type (might be due to invalid IL or missing references) //IL_0df7: Unknown result type (might be due to invalid IL or missing references) //IL_0e00: Unknown result type (might be due to invalid IL or missing references) //IL_0d35: Unknown result type (might be due to invalid IL or missing references) //IL_0d3a: Unknown result type (might be due to invalid IL or missing references) //IL_0d4c: Unknown result type (might be due to invalid IL or missing references) //IL_0e43: Unknown result type (might be due to invalid IL or missing references) //IL_0e48: Unknown result type (might be due to invalid IL or missing references) //IL_0e4e: Unknown result type (might be due to invalid IL or missing references) //IL_0e6a: Unknown result type (might be due to invalid IL or missing references) //IL_0e6f: Unknown result type (might be due to invalid IL or missing references) //IL_0e9f: Unknown result type (might be due to invalid IL or missing references) //IL_0ea6: Unknown result type (might be due to invalid IL or missing references) //IL_0ead: Unknown result type (might be due to invalid IL or missing references) //IL_0ec2: Unknown result type (might be due to invalid IL or missing references) //IL_0ec9: Unknown result type (might be due to invalid IL or missing references) //IL_0ed0: Unknown result type (might be due to invalid IL or missing references) if (state != State.Attack) { tracking = false; motion.UnplantedFoot = null; if (state == State.Observe || state == State.Dead || state == State.Stunned) { exitBlend = 0f; } else { if (!(exitBlend > 0f)) { return; } string[] array = new string[2] { "L", "R" }; foreach (string text in array) { string[] array2 = new string[3] { "upper_arm.", "forearm.", "hand." }; foreach (string text2 in array2) { Transform val = motion.Map[text2 + text]; val.localRotation = Quaternion.RotateTowards(motion.PreviousRotation(val), val.localRotation, 360f * dt); } } exitBlend = Mathf.Max(0f, exitBlend - dt); } return; } exitBlend = 0.24f; Transform parent = motion.Visual.parent; float num = ((variant == 0) ? 1 : (-1)); string text3 = ((variant == 0) ? "R" : "L"); string text4 = ((variant == 0) ? "L" : "R"); if (nextSequence != sequence) { sequence = nextSequence; lockedTarget = (lastTarget = target); leadFoot = motion.PreviousPosition(motion.Map["foot." + text4]); tracking = false; raised = false; raisedFloor = parent.position.y; RaycastHit[] array3 = Physics.RaycastAll(target + Vector3.up * 0.1f, Vector3.down, 2f, WorldQueries.Mask, (QueryTriggerInteraction)1); for (int k = 0; k < array3.Length; k++) { RaycastHit val2 = array3[k]; if (!WorldQueries.Self(((RaycastHit)(ref val2)).collider) && !Object.op_Implicit((Object)(object)WorldQueries.PlayerOwner(((RaycastHit)(ref val2)).collider)) && ((RaycastHit)(ref val2)).normal.y > 0.6f && ((RaycastHit)(ref val2)).point.y > parent.position.y + 0.4f) { raised = true; raisedFloor = Mathf.Max(raisedFloor, ((RaycastHit)(ref val2)).point.y); } } throughOpening = TrySill(parent.position, target, raisedFloor, out sillHeight); } if (phase < 0.32f) { Vector3 val3 = (tracking ? ((target - lastTarget) / Mathf.Max(0.001f, dt)) : Vector3.zero); lockedTarget = target + Vector3.ClampMagnitude(val3 * 0.09f, throughOpening ? 0.08f : 0.25f); lastTarget = target; tracking = true; } float num2 = Ease(0f, 0.23f, phase); float num3 = Ease(raised ? 0.24f : 0.18f, raised ? 0.44f : 0.36f, phase); float num4 = Ease(0.44f, 0.67f, phase); float num5 = Ease(0.68f, 1.04f, phase); float num6 = num3 * (1f - num5); Transform val4 = motion.Map["pelvis"]; Transform val5 = motion.Map["chest"]; Transform val6 = motion.Map["spine_01"]; val4.position += parent.TransformDirection(new Vector3((0f - num) * 0.06f * num6, (raised ? 0.08f : (-0.07f)) * num6, 0.12f * num6)); val4.rotation = Quaternion.AngleAxis(num * ((float)(raised ? (-12) : (-18)) * num2 + (float)(throughOpening ? 16 : (raised ? 25 : 38)) * num3) * (1f - num5), parent.up) * val4.rotation; val5.rotation = Quaternion.AngleAxis(num * ((float)(raised ? (-22) : (-32)) * num2 + (float)(throughOpening ? 29 : (raised ? 48 : 70)) * num3) * (1f - num5), parent.up) * val5.rotation; val6.rotation = Quaternion.AngleAxis(throughOpening ? (-15f * num6) : (raised ? (-8f * num6) : ((-10f * num2 + 24f * num3) * (1f - num5))), parent.right) * val6.rotation; Transform val7 = motion.Map["upper_arm." + text3]; Transform val8 = motion.Map["forearm." + text3]; Transform val9 = motion.Map["hand." + text3]; if (throughOpening) { float num7 = Mathf.Clamp(sillHeight + 0.22f - val7.position.y, 0f, 0.3f); val4.position += Vector3.up * (num7 * Ease(0.12f, 0.38f, phase) * (1f - num5)); } Vector3 val10 = parent.TransformPoint(new Vector3(num * (throughOpening ? 0.48f : (raised ? 0.67f : 0.95f)), (!raised) ? 1.7f : ((variant == 0) ? 1.65f : 1.25f), raised ? (-0.18f) : (-0.28f))); if (raised) { val10.y = Mathf.Max(parent.position.y + 1.75f, lockedTarget.y + 0.2f); val10 += parent.forward * 0.33f; } if (throughOpening) { val10.y = Mathf.Max(sillHeight + 0.16f, lockedTarget.y + 0.12f); } Vector3 val11 = lockedTarget; if (throughOpening) { val11.y = Mathf.Max(val11.y, sillHeight + 0.1f); } Vector3 val12 = val11 - val7.position; Vector3 val13 = val11 - ((Vector3)(ref val12)).normalized * (throughOpening ? 0.3f : (raised ? 0.14f : 0.3f)); Vector3 val14 = Vector3.Lerp(val9.position, val10, num2); val14 = Vector3.Lerp(val14, val13, num3); val14 += parent.right * ((0f - num) * (throughOpening ? 0.12f : (raised ? 0.35f : 0.6f)) * num4) * (1f - num5); if (raised) { val14.y = Mathf.Max(val14.y, lockedTarget.y + 0.1f * num3 * (1f - num5)); } val14 += parent.up * (raised ? (-0.1f) : ((variant == 0) ? (-0.14f) : 0.2f)) * num4 * (1f - num5); if (raised) { val14.y = Mathf.Max(val14.y, raisedFloor + Mathf.Clamp((val7.position.y - raisedFloor) * 1.5f, 0.15f, 0.45f)); } if (throughOpening) { val14.y = Mathf.Max(val14.y, sillHeight + 0.16f); } val14 = Vector3.Lerp(val14, parent.TransformPoint(new Vector3(num * 0.38f, 1.05f, 0.24f)), num5); Vector3 pole = val7.position + parent.right * (num * (throughOpening ? 0.18f : 0.65f)) + parent.up * (throughOpening ? 0.75f : (raised ? 0.9f : 0.18f)) - parent.forward * (raised ? 0.2f : 0f); SolveArm(text3, val14, pole, dt); string text5 = ((variant == 0) ? "L" : "R"); Transform val15 = motion.Map["upper_arm." + text5]; SolveArm(text5, parent.TransformPoint(new Vector3((0f - num) * 0.58f, 1.1f, -0.18f)), val15.position - parent.right * num * 0.55f, dt); Transform val16 = motion.Map["finger_2.03." + text3]; Vector3 val17 = val16.position - val9.position; if (((Vector3)(ref val17)).sqrMagnitude > 0.001f && ((Vector3)(ref val12)).sqrMagnitude > 0.001f) { val9.rotation = Quaternion.Slerp(val9.rotation, Quaternion.FromToRotation(val17, val11 - val9.position) * val9.rotation, num3 * (1f - num5)); } string[] array4 = new string[2] { "L", "R" }; foreach (string text6 in array4) { Transform val18 = motion.Map["upper_arm." + text6]; Transform val19 = motion.Map["forearm." + text6]; Transform val20 = motion.Map["hand." + text6]; Quaternion rotation = val18.rotation; Quaternion rotation2 = val19.rotation; Quaternion rotation3 = val20.rotation; val18.rotation = Quaternion.RotateTowards(motion.PreviousWorldRotation(val18), rotation, 900f * dt); val19.rotation = Quaternion.RotateTowards(motion.PreviousWorldRotation(val19), rotation2, 900f * dt); val20.rotation = Quaternion.RotateTowards(motion.PreviousWorldRotation(val20), rotation3, 900f * dt); } float num8 = Ease(0.08f, 0.64f, phase); motion.UnplantedFoot = ((phase < 0.72f) ? text4 : null); Transform val21 = motion.Map["thigh." + text4]; Transform val22 = motion.Map["shin." + text4]; Transform hand = motion.Map["foot." + text4]; Vector3 val23 = leadFoot + parent.forward * (0.55f * num8) + parent.up * (0.15f * Mathf.Sin(num8 * MathF.PI)); if (raised || throughOpening) { Vector3 val24 = val23 - leadFoot; float num9 = ((Vector3)(ref val24)).magnitude; if (num9 > 0.001f) { RaycastHit[] array5 = Physics.SphereCastAll(leadFoot, 0.34f, ((Vector3)(ref val24)).normalized, num9, WorldQueries.Mask, (QueryTriggerInteraction)1); for (int m = 0; m < array5.Length; m++) { RaycastHit val25 = array5[m]; if (WallSafety.BlocksMovement(((RaycastHit)(ref val25)).collider) && Mathf.Abs(((RaycastHit)(ref val25)).normal.y) < 0.6f) { num9 = Mathf.Min(num9, Mathf.Max(0f, ((RaycastHit)(ref val25)).distance - 0.02f)); } } } val23 = leadFoot + ((Vector3)(ref val24)).normalized * num9; } if (GroundSupport.Floor(val23, 0.34f, 0.4f, out var floor) && floor.Position.y <= parent.position.y + 0.1f) { val23.y = Mathf.Max(val23.y, floor.Position.y + 0.21f); } WallSafety.Solve(val21, val22, hand, val23, val21.position + parent.forward * (raised ? 0.1f : 0.65f) + parent.right * ((0f - num) * (raised ? 0.35f : 0.15f))); float num10 = 1f - Mathf.Exp((0f - dt) / 0.04f); val21.localRotation = Quaternion.Slerp(motion.PreviousRotation(val21), val21.localRotation, num10); val22.localRotation = Quaternion.Slerp(motion.PreviousRotation(val22), val22.localRotation, num10); } private void SolveArm(string side, Vector3 goal, Vector3 pole, float dt) { //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_0082: Unknown result type (might be due to invalid IL or missing references) //IL_0088: Unknown result type (might be due to invalid IL or missing references) //IL_008e: Unknown result type (might be due to invalid IL or missing references) //IL_00a1: Unknown result type (might be due to invalid IL or missing references) //IL_00a7: 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) Transform val = motion.Map["upper_arm." + side]; Transform val2 = motion.Map["forearm." + side]; Transform hand = motion.Map["hand." + side]; WallSafety.Solve(val, val2, hand, goal, pole); float num = 1f - Mathf.Exp((0f - dt) / 0.035f); val.localRotation = Quaternion.Slerp(motion.PreviousRotation(val), val.localRotation, num); val2.localRotation = Quaternion.Slerp(motion.PreviousRotation(val2), val2.localRotation, num); } } public sealed class BodySteering { private float angularVelocity; public bool Reversing { get; private set; } public void Reset() { angularVelocity = 0f; Reversing = false; } public void Plan(Vector3 body, Quaternion current, ref Vector3 velocity, float duck, bool running, float dt, out Quaternion rotation) { //IL_0003: Unknown result type (might be due to invalid IL or missing references) //IL_0004: 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_0034: 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_0036: 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_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_00a0: Unknown result type (might be due to invalid IL or missing references) //IL_00ac: Unknown result type (might be due to invalid IL or missing references) //IL_007a: Unknown result type (might be due to invalid IL or missing references) //IL_0084: 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_00df: Unknown result type (might be due to invalid IL or missing references) //IL_00e4: Unknown result type (might be due to invalid IL or missing references) //IL_00e5: 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_0101: 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_0107: Unknown result type (might be due to invalid IL or missing references) //IL_010d: 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_00f7: Unknown result type (might be due to invalid IL or missing references) //IL_0129: Unknown result type (might be due to invalid IL or missing references) //IL_0133: 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_013a: Unknown result type (might be due to invalid IL or missing references) //IL_013b: Unknown result type (might be due to invalid IL or missing references) //IL_013c: Unknown result type (might be due to invalid IL or missing references) //IL_0140: 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_0149: Unknown result type (might be due to invalid IL or missing references) //IL_014a: Unknown result type (might be due to invalid IL or missing references) //IL_014f: Unknown result type (might be due to invalid IL or missing references) //IL_01cb: Unknown result type (might be due to invalid IL or missing references) //IL_01d0: Unknown result type (might be due to invalid IL or missing references) //IL_01d5: Unknown result type (might be due to invalid IL or missing references) //IL_01db: Unknown result type (might be due to invalid IL or missing references) //IL_01ee: Unknown result type (might be due to invalid IL or missing references) //IL_0204: Unknown result type (might be due to invalid IL or missing references) //IL_0209: Unknown result type (might be due to invalid IL or missing references) //IL_015f: 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_0197: Unknown result type (might be due to invalid IL or missing references) //IL_0198: Unknown result type (might be due to invalid IL or missing references) //IL_019d: Unknown result type (might be due to invalid IL or missing references) //IL_01a2: 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_0175: 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) rotation = current; Reversing = false; if (((Vector3)(ref velocity)).sqrMagnitude < 0.001f) { return; } Quaternion q = Quaternion.LookRotation(velocity); bool turnFits = WallSafety.ClearStepPose(body, q, duck); Reversing = NativeBehaviour.ReverseThroughNeck(Vector3.Dot(current * Vector3.forward, ((Vector3)(ref velocity)).normalized), turnFits, duck > 0.1f); if (Reversing) { velocity = Vector3.ClampMagnitude(velocity, 1f); angularVelocity = 0f; return; } float num = Mathf.SmoothDampAngle(((Quaternion)(ref current)).eulerAngles.y, ((Quaternion)(ref q)).eulerAngles.y, ref angularVelocity, 0.28f, (float)(running ? 110 : 75), dt); Quaternion val = Quaternion.Euler(0f, num, 0f); if (WallSafety.ClearStepPose(body, val, duck)) { rotation = val; } else if (Vector3.Dot(current * Vector3.forward, ((Vector3)(ref velocity)).normalized) < 0.3f) { Vector3 delta = ((Vector3)(ref velocity)).normalized * 0.28f; Vector3 val2 = WallSafety.Move(body, current, delta, duck); Vector3 val3 = val2 - body; if (((Vector3)(ref val3)).sqrMagnitude >= 0.0324f && WallSafety.ClearStepPose(val2, current, duck)) { velocity = Vector3.ClampMagnitude(velocity, 0.75f); angularVelocity = 0f; } else { velocity = -(current * Vector3.forward) * 0.45f; Reversing = true; } return; } if (running) { float num2 = Mathf.Clamp01(Vector3.Dot(rotation * Vector3.forward, ((Vector3)(ref velocity)).normalized)); velocity *= Mathf.SmoothStep(0f, 1f, num2); } } } public sealed class CartBypass { public const float MaxLookAhead = 7f; private Component cart; private readonly Transform own; private readonly bool enemies; private Vector3 center; private Vector3 goal; private Quaternion rotation; private Vector3[] route = Array.Empty(); private int cursor; private float retry; public bool Active => Object.op_Implicit((Object)(object)cart); private int QueryMask => enemies ? (-1) : WorldQueries.Mask; public CartBypass() { } public CartBypass(Transform own, bool enemies) { this.own = own; this.enemies = enemies; } public bool BlockedNear(Vector3 body, float distance) { //IL_0032: 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_0038: 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_004a: Unknown result type (might be due to invalid IL or missing references) //IL_004f: Unknown result type (might be due to invalid IL or missing references) //IL_0050: 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_005a: 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) if (!Object.op_Implicit((Object)(object)cart) || route.Length != 0 || !BoundsFor(cart, out var bounds)) { return false; } Vector3 val = body; val.y = ((Bounds)(ref bounds)).center.y; Vector3 val2 = Vector3.ProjectOnPlane(((Bounds)(ref bounds)).ClosestPoint(val) - val, Vector3.up); return ((Vector3)(ref val2)).magnitude <= distance; } public void Reset() { cart = null; route = Array.Empty(); cursor = 0; retry = 0f; } private static Vector3 Flat(Vector3 v) { //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_0006: Unknown result type (might be due to invalid IL or missing references) return Vector3.ProjectOnPlane(v, Vector3.up); } private Component Obstacle(Collider c) { if (!Object.op_Implicit((Object)(object)c) || (Object.op_Implicit((Object)(object)own) && ((Component)c).transform.IsChildOf(own))) { return null; } if (!enemies) { return (Component)(object)((Component)c).GetComponentInParent(); } EnemyRigidbody componentInParent = ((Component)c).GetComponentInParent(); if (Object.op_Implicit((Object)(object)componentInParent)) { return (Component)(object)componentInParent; } return (Component)(object)((Component)c).GetComponentInParent(); } private static bool BoundsFor(Component cart, out Bounds bounds) { //IL_0002: 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_0041: Unknown result type (might be due to invalid IL or missing references) //IL_0046: Unknown result type (might be due to invalid IL or missing references) bounds = default(Bounds); bool flag = false; Collider[] componentsInChildren = cart.GetComponentsInChildren(); foreach (Collider val in componentsInChildren) { if (val.enabled && !val.isTrigger) { if (!flag) { bounds = val.bounds; flag = true; } else { ((Bounds)(ref bounds)).Encapsulate(val.bounds); } } } return flag; } private bool Segment(Vector3 a, Vector3 b, out Vector3[] points) { //IL_0004: Unknown result type (might be due to invalid IL or missing references) //IL_0005: 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_000b: Unknown result type (might be due to invalid IL or missing references) //IL_0010: 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_0049: Unknown result type (might be due to invalid IL or missing references) //IL_004e: Unknown result type (might be due to invalid IL or missing references) //IL_004f: Unknown result type (might be due to invalid IL or missing references) //IL_0050: Unknown result type (might be due to invalid IL or missing references) //IL_0051: Unknown result type (might be due to invalid IL or missing references) //IL_0031: Unknown result type (might be due to invalid IL or missing references) //IL_0032: Unknown result type (might be due to invalid IL or missing references) //IL_0039: Unknown result type (might be due to invalid IL or missing references) //IL_003a: Unknown result type (might be due to invalid IL or missing references) //IL_006b: 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_0076: Unknown result type (might be due to invalid IL or missing references) //IL_007b: Unknown result type (might be due to invalid IL or missing references) //IL_0080: 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_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_00ce: Unknown result type (might be due to invalid IL or missing references) //IL_00d3: Unknown result type (might be due to invalid IL or missing references) //IL_00d6: Unknown result type (might be due to invalid IL or missing references) //IL_00d8: Unknown result type (might be due to invalid IL or missing references) //IL_00e2: 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_00ec: Unknown result type (might be due to invalid IL or missing references) //IL_00ee: Unknown result type (might be due to invalid IL or missing references) //IL_00f8: Unknown result type (might be due to invalid IL or missing references) //IL_00fd: 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_013b: 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_014a: Unknown result type (might be due to invalid IL or missing references) //IL_014f: Unknown result type (might be due to invalid IL or missing references) //IL_0151: Unknown result type (might be due to invalid IL or missing references) //IL_0153: Unknown result type (might be due to invalid IL or missing references) //IL_015d: Unknown result type (might be due to invalid IL or missing references) //IL_0162: Unknown result type (might be due to invalid IL or missing references) //IL_0167: Unknown result type (might be due to invalid IL or missing references) //IL_0173: Unknown result type (might be due to invalid IL or missing references) //IL_0177: Unknown result type (might be due to invalid IL or missing references) //IL_0179: Unknown result type (might be due to invalid IL or missing references) //IL_017e: Unknown result type (might be due to invalid IL or missing references) //IL_0183: Unknown result type (might be due to invalid IL or missing references) //IL_0192: 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_0198: Unknown result type (might be due to invalid IL or missing references) //IL_019d: Unknown result type (might be due to invalid IL or missing references) //IL_01a2: Unknown result type (might be due to invalid IL or missing references) //IL_01ad: 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_01b0: Unknown result type (might be due to invalid IL or missing references) //IL_01b5: Unknown result type (might be due to invalid IL or missing references) //IL_01ba: 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_01c2: Unknown result type (might be due to invalid IL or missing references) //IL_01c6: Unknown result type (might be due to invalid IL or missing references) //IL_01cb: Unknown result type (might be due to invalid IL or missing references) //IL_01d0: Unknown result type (might be due to invalid IL or missing references) points = null; Vector3 val = Flat(b - a); float magnitude = ((Vector3)(ref val)).magnitude; if (magnitude < 0.04f) { points = (Vector3[])(object)new Vector3[2] { a, b }; return true; } Quaternion val2 = Quaternion.LookRotation(val); if (!FloorBridge.Route(a, b, val2, out points, out var _)) { return false; } Collider[] source = (from c in Physics.OverlapCapsule(a + Vector3.up * 0.4f, a + Vector3.up * 1.55f, 0.48f, QueryMask, (QueryTriggerInteraction)1) where Object.op_Implicit((Object)(object)Obstacle(c)) select c).ToArray(); Vector3[] array = points; foreach (Vector3 val3 in array) { foreach (Collider item in from c in Physics.OverlapCapsule(val3 + Vector3.up * 0.4f, val3 + Vector3.up * 1.55f, 0.48f, QueryMask, (QueryTriggerInteraction)1) where Object.op_Implicit((Object)(object)Obstacle(c)) select c) { Vector3 val4 = a + Vector3.up * 0.65f; Vector3 val5 = val3 + Vector3.up * 0.65f; if (source.Contains(item)) { Vector3 val6 = val5 - item.ClosestPoint(val5); float num2 = ((Vector3)(ref val6)).sqrMagnitude + 0.0001f; val6 = val4 - item.ClosestPoint(val4); if (!(num2 < ((Vector3)(ref val6)).sqrMagnitude)) { Vector3 val7 = Flat(val3 - a); Bounds bounds = item.bounds; if (!(Vector3.Dot(val7, Flat(a - ((Bounds)(ref bounds)).center)) < -0.001f)) { continue; } } } return false; } } return true; } private bool Plan(Vector3 body, Vector3 forward) { //IL_003d: 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_0053: 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_0064: 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_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_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_0080: Unknown result type (might be due to invalid IL or missing references) //IL_0085: Unknown result type (might be due to invalid IL or missing references) //IL_0086: 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_0098: 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_00ad: 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_00bf: Unknown result type (might be due to invalid IL or missing references) //IL_00ca: Unknown result type (might be due to invalid IL or missing references) //IL_012c: 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_0136: Unknown result type (might be due to invalid IL or missing references) //IL_013b: Unknown result type (might be due to invalid IL or missing references) //IL_0140: Unknown result type (might be due to invalid IL or missing references) //IL_0146: Unknown result type (might be due to invalid IL or missing references) //IL_014b: 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_0152: Unknown result type (might be due to invalid IL or missing references) //IL_0153: Unknown result type (might be due to invalid IL or missing references) //IL_015c: 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_0166: 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_0178: Unknown result type (might be due to invalid IL or missing references) //IL_0179: Unknown result type (might be due to invalid IL or missing references) //IL_0185: Unknown result type (might be due to invalid IL or missing references) //IL_018a: Unknown result type (might be due to invalid IL or missing references) //IL_018f: Unknown result type (might be due to invalid IL or missing references) //IL_0199: Unknown result type (might be due to invalid IL or missing references) //IL_019b: Unknown result type (might be due to invalid IL or missing references) //IL_01a2: Unknown result type (might be due to invalid IL or missing references) //IL_01a4: Unknown result type (might be due to invalid IL or missing references) //IL_01ab: Unknown result type (might be due to invalid IL or missing references) //IL_01ad: 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_01b5: Unknown result type (might be due to invalid IL or missing references) //IL_01d9: 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_01e2: Unknown result type (might be due to invalid IL or missing references) //IL_01e4: Unknown result type (might be due to invalid IL or missing references) //IL_020a: Unknown result type (might be due to invalid IL or missing references) //IL_0213: Unknown result type (might be due to invalid IL or missing references) //IL_0226: Unknown result type (might be due to invalid IL or missing references) //IL_024e: Unknown result type (might be due to invalid IL or missing references) //IL_0253: Unknown result type (might be due to invalid IL or missing references) route = Array.Empty(); cursor = 0; if (!BoundsFor(cart, out var bounds)) { return false; } center = cart.transform.position; rotation = cart.transform.rotation; Vector3 val = ((Bounds)(ref bounds)).center; val.y = body.y; Vector3 val2 = Vector3.Cross(Vector3.up, forward); Vector3 extents = ((Bounds)(ref bounds)).extents; float num = Mathf.Abs(val2.x) * extents.x + Mathf.Abs(val2.z) * extents.z; float num2 = Mathf.Abs(forward.x) * extents.x + Mathf.Abs(forward.z) * extents.z; float num3 = float.PositiveInfinity; float[] array = new float[2] { 0.95f, 1.25f }; foreach (float num4 in array) { float[] array2 = new float[2] { -1f, 1f }; foreach (float num5 in array2) { Vector3 val3 = val + val2 * (num5 * (num + num4)) - forward * (num2 + num4); Vector3 val4 = val + val2 * (num5 * (num + num4)) + forward * (num2 + num4); Vector3 val5 = val + forward * (num2 + num4 + 0.5f); Vector3[] array3 = (Vector3[])(object)new Vector3[3] { val3, val4, val5 }; Vector3 a = body; float num6 = 0f; bool flag = true; List list = new List(); Vector3[] array4 = array3; foreach (Vector3 b in array4) { if (!Segment(a, b, out Vector3[] points)) { flag = false; break; } for (int l = 1; l < points.Length; l++) { num6 += Vector3.Distance(points[l - 1], points[l]); list.Add(points[l]); } a = points[^1]; } if (flag && num6 < num3) { num3 = num6; route = list.ToArray(); } } } return route.Length != 0; } private Component Ahead(Vector3 body, Vector3 direction, float range) { //IL_0036: 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_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_004d: Unknown result type (might be due to invalid IL or missing references) //IL_0069: Unknown result type (might be due to invalid IL or missing references) //IL_006e: Unknown result type (might be due to invalid IL or missing references) Component val = null; float num = float.PositiveInfinity; float num2 = float.PositiveInfinity; float[] array = new float[2] { 0.5f, 1f }; foreach (float num3 in array) { RaycastHit[] array2 = Physics.SphereCastAll(body + Vector3.up * num3, 0.45f, direction, range, QueryMask, (QueryTriggerInteraction)1); for (int j = 0; j < array2.Length; j++) { RaycastHit val2 = array2[j]; if (!(Object.op_Implicit((Object)(object)own) ? ((Component)((RaycastHit)(ref val2)).collider).transform.IsChildOf(own) : WorldQueries.Self(((RaycastHit)(ref val2)).collider)) && !Object.op_Implicit((Object)(object)WorldQueries.PlayerOwner(((RaycastHit)(ref val2)).collider))) { Component val3 = Obstacle(((RaycastHit)(ref val2)).collider); if (Object.op_Implicit((Object)(object)val3) && ((RaycastHit)(ref val2)).distance < num) { val = val3; num = ((RaycastHit)(ref val2)).distance; } else if (!Object.op_Implicit((Object)(object)val3) && WallSafety.BlocksMovement(((RaycastHit)(ref val2)).collider)) { num2 = Mathf.Min(num2, ((RaycastHit)(ref val2)).distance); } } } } return (num <= num2) ? val : null; } public Vector3 Resolve(Vector3 body, Vector3 destination, Vector3 velocity, float dt) { //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_0056: 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_0061: Unknown result type (might be due to invalid IL or missing references) //IL_0066: Unknown result type (might be due to invalid IL or missing references) //IL_036b: 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_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_0091: 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_00a7: 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_00f2: 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_013d: Unknown result type (might be due to invalid IL or missing references) //IL_013e: Unknown result type (might be due to invalid IL or missing references) //IL_0144: 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_0134: 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_0187: Unknown result type (might be due to invalid IL or missing references) //IL_018a: 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_01ef: Unknown result type (might be due to invalid IL or missing references) //IL_01f0: Unknown result type (might be due to invalid IL or missing references) //IL_01f5: Unknown result type (might be due to invalid IL or missing references) //IL_01fa: Unknown result type (might be due to invalid IL or missing references) //IL_01b1: 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_0248: Unknown result type (might be due to invalid IL or missing references) //IL_024d: Unknown result type (might be due to invalid IL or missing references) //IL_024e: Unknown result type (might be due to invalid IL or missing references) //IL_0253: Unknown result type (might be due to invalid IL or missing references) //IL_0258: Unknown result type (might be due to invalid IL or missing references) //IL_025a: Unknown result type (might be due to invalid IL or missing references) //IL_025b: 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_0274: Unknown result type (might be due to invalid IL or missing references) //IL_0279: Unknown result type (might be due to invalid IL or missing references) //IL_0234: Unknown result type (might be due to invalid IL or missing references) //IL_0235: 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_02aa: Unknown result type (might be due to invalid IL or missing references) //IL_02d2: Unknown result type (might be due to invalid IL or missing references) //IL_02d7: Unknown result type (might be due to invalid IL or missing references) //IL_02d8: Unknown result type (might be due to invalid IL or missing references) //IL_02dd: Unknown result type (might be due to invalid IL or missing references) //IL_02e2: Unknown result type (might be due to invalid IL or missing references) //IL_02f4: Unknown result type (might be due to invalid IL or missing references) //IL_0302: Unknown result type (might be due to invalid IL or missing references) //IL_0307: Unknown result type (might be due to invalid IL or missing references) //IL_0308: Unknown result type (might be due to invalid IL or missing references) //IL_030d: Unknown result type (might be due to invalid IL or missing references) //IL_0312: Unknown result type (might be due to invalid IL or missing references) //IL_0316: Unknown result type (might be due to invalid IL or missing references) //IL_0337: Unknown result type (might be due to invalid IL or missing references) //IL_033c: Unknown result type (might be due to invalid IL or missing references) //IL_033d: Unknown result type (might be due to invalid IL or missing references) //IL_0342: Unknown result type (might be due to invalid IL or missing references) //IL_0347: Unknown result type (might be due to invalid IL or missing references) //IL_034a: Unknown result type (might be due to invalid IL or missing references) //IL_0362: Unknown result type (might be due to invalid IL or missing references) //IL_0367: Unknown result type (might be due to invalid IL or missing references) retry = Mathf.Max(0f, retry - Mathf.Max(0f, dt)); float magnitude = ((Vector3)(ref velocity)).magnitude; if (magnitude < 0.1f) { Reset(); return velocity; } Vector3 val; if (Object.op_Implicit((Object)(object)cart)) { val = Flat(goal - destination); if (!(((Vector3)(ref val)).magnitude > 3f)) { val = Flat(cart.transform.position - center); if (!(((Vector3)(ref val)).magnitude > 0.35f) && !(Quaternion.Angle(rotation, cart.transform.rotation) > 12f)) { goto IL_00db; } } Reset(); } goto IL_00db; IL_00db: if (!Object.op_Implicit((Object)(object)cart)) { cart = Ahead(body, ((Vector3)(ref velocity)).normalized, Mathf.Clamp(magnitude * 0.65f + 1.6f, 2.5f, 7f)); if (!Object.op_Implicit((Object)(object)cart)) { return velocity; } goal = destination; Plan(body, ((Vector3)(ref velocity)).normalized); retry = 0.5f; } if (route.Length == 0) { if (retry <= 0f) { Plan(body, ((Vector3)(ref velocity)).normalized); retry = 0.5f; } if (route.Length == 0) { return Vector3.zero; } } while (cursor < route.Length) { val = Flat(route[cursor] - body); if (!(((Vector3)(ref val)).magnitude < 0.22f)) { break; } cursor++; } if (cursor >= route.Length) { Reset(); return velocity; } Vector3 val2 = Flat(route[cursor] - body); if (!Segment(body, body + ((Vector3)(ref val2)).normalized * Mathf.Min(0.55f, ((Vector3)(ref val2)).magnitude), out Vector3[] _)) { route = Array.Empty(); retry = 0.25f; return Vector3.zero; } int i; for (i = cursor; i + 1 < route.Length; i++) { val = Flat(route[i] - body); if (!(((Vector3)(ref val)).magnitude < 0.75f)) { break; } Vector3 normalized = ((Vector3)(ref val2)).normalized; val = Flat(route[i + 1] - body); if (!(Vector3.Dot(normalized, ((Vector3)(ref val)).normalized) > 0.98f)) { break; } } val2 = Flat(route[i] - body); return ((Vector3)(ref val2)).normalized * Mathf.Min(magnitude, ((Vector3)(ref val2)).magnitude / 0.18f); } } [HarmonyPatch(typeof(PlayerHealth), "Hurt")] internal static class CombatDiagnostics { private static bool Ours(int index) { if (index < 0 || Plugin.DebugOverlay == null || !Plugin.DebugOverlay.Value) { return false; } foreach (FlinchActor actor in FlinchActor.Actors) { if (Object.op_Implicit((Object)(object)actor) && index == SemiFunc.EnemyGetIndex(((Component)actor).GetComponent())) { return true; } } return false; } private static void Prefix(PlayerHealth __instance, int enemyIndex, out int? __state) { __state = (Ours(enemyIndex) ? new int?(Fields.Get(__instance, "health")) : ((int?)null)); } private static void Postfix(PlayerHealth __instance, int damage, int enemyIndex, int? __state) { if (__state.HasValue) { int num = Fields.Get(__instance, "health"); Plugin instance = Plugin.Instance; string[] obj = new string[6] { "FLINCH_PLAYER_DAMAGE: requested=", damage.ToString(), ", hp=", null, null, null }; int? num2 = __state; obj[3] = num2.ToString(); obj[4] = " -> "; obj[5] = num.ToString(); instance.CombatLog(string.Concat(obj)); } } } public sealed class CoverKickPose { private readonly FlinchMotion motion; private readonly Transform body; private readonly Quaternion opticalFrame; private readonly Quaternion[] neutralFoot = (Quaternion[])(object)new Quaternion[2]; private float weight; private float weightVelocity; private Vector3 restFoot; private bool wasKicking; private readonly LowStrikeVolume strike = new LowStrikeVolume(); public bool ClearContact { get; private set; } public CoverKickPose(FlinchMotion motion, Transform body) { //IL_006a: 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_006b: 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_0073: 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_007f: Unknown result type (might be due to invalid IL or missing references) //IL_0084: Unknown result type (might be due to invalid IL or missing references) //IL_0089: 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_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_00b5: Unknown result type (might be due to invalid IL or missing references) //IL_00ba: Unknown result type (might be due to invalid IL or missing references) //IL_00bf: Unknown result type (might be due to invalid IL or missing references) //IL_00cc: Unknown result type (might be due to invalid IL or missing references) //IL_00d1: Unknown result type (might be due to invalid IL or missing references) //IL_00e6: Unknown result type (might be due to invalid IL or missing references) //IL_00eb: Unknown result type (might be due to invalid IL or missing references) //IL_00f0: Unknown result type (might be due to invalid IL or missing references) this.motion = motion; this.body = body; Transform val = motion.Map["head"]; Transform val2 = motion.Map["eye.L"]; Vector3 value; Vector3 val3 = val2.TransformDirection(RuntimeAssets.EyeAxes.TryGetValue("eye.L", out value) ? value : Vector3.forward); opticalFrame = Quaternion.Inverse(val.rotation) * Quaternion.LookRotation(val3, body.up); neutralFoot[0] = Quaternion.Inverse(body.rotation) * motion.Map["foot.R"].rotation; neutralFoot[1] = Quaternion.Inverse(body.rotation) * motion.Map["foot.L"].rotation; } private static float Ease(float a, float b, float t) { return Mathf.SmoothStep(0f, 1f, Mathf.InverseLerp(a, b, t)); } public void Apply(State state, float phase, Vector3 target, float dt, int side = 1) { //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_01a6: 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_01f1: Unknown result type (might be due to invalid IL or missing references) //IL_01f8: 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_0224: Unknown result type (might be due to invalid IL or missing references) //IL_0229: Unknown result type (might be due to invalid IL or missing references) //IL_0230: Unknown result type (might be due to invalid IL or missing references) //IL_0235: Unknown result type (might be due to invalid IL or missing references) //IL_0259: 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_0265: Unknown result type (might be due to invalid IL or missing references) //IL_026a: Unknown result type (might be due to invalid IL or missing references) //IL_0298: 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_02b7: Unknown result type (might be due to invalid IL or missing references) //IL_02bc: Unknown result type (might be due to invalid IL or missing references) //IL_02cf: Unknown result type (might be due to invalid IL or missing references) //IL_02d4: Unknown result type (might be due to invalid IL or missing references) //IL_02d9: Unknown result type (might be due to invalid IL or missing references) //IL_02e0: Unknown result type (might be due to invalid IL or missing references) //IL_0324: Unknown result type (might be due to invalid IL or missing references) //IL_034b: Unknown result type (might be due to invalid IL or missing references) //IL_0360: Unknown result type (might be due to invalid IL or missing references) //IL_036b: Unknown result type (might be due to invalid IL or missing references) //IL_036d: Unknown result type (might be due to invalid IL or missing references) //IL_0374: Unknown result type (might be due to invalid IL or missing references) //IL_0379: Unknown result type (might be due to invalid IL or missing references) //IL_038c: Unknown result type (might be due to invalid IL or missing references) //IL_0391: Unknown result type (might be due to invalid IL or missing references) //IL_0396: Unknown result type (might be due to invalid IL or missing references) //IL_03aa: Unknown result type (might be due to invalid IL or missing references) //IL_03c2: Unknown result type (might be due to invalid IL or missing references) //IL_03db: Unknown result type (might be due to invalid IL or missing references) //IL_03dd: Unknown result type (might be due to invalid IL or missing references) //IL_0401: Unknown result type (might be due to invalid IL or missing references) //IL_0406: Unknown result type (might be due to invalid IL or missing references) //IL_040d: Unknown result type (might be due to invalid IL or missing references) //IL_0412: Unknown result type (might be due to invalid IL or missing references) //IL_041d: Unknown result type (might be due to invalid IL or missing references) //IL_0420: Unknown result type (might be due to invalid IL or missing references) //IL_0425: Unknown result type (might be due to invalid IL or missing references) //IL_042a: Unknown result type (might be due to invalid IL or missing references) //IL_0444: Unknown result type (might be due to invalid IL or missing references) //IL_0449: Unknown result type (might be due to invalid IL or missing references) //IL_0451: Unknown result type (might be due to invalid IL or missing references) //IL_0456: Unknown result type (might be due to invalid IL or missing references) //IL_045c: Unknown result type (might be due to invalid IL or missing references) //IL_0461: Unknown result type (might be due to invalid IL or missing references) //IL_0466: Unknown result type (might be due to invalid IL or missing references) //IL_0471: Unknown result type (might be due to invalid IL or missing references) //IL_0793: Unknown result type (might be due to invalid IL or missing references) //IL_0798: Unknown result type (might be due to invalid IL or missing references) //IL_07bc: Unknown result type (might be due to invalid IL or missing references) //IL_07f8: Unknown result type (might be due to invalid IL or missing references) //IL_07fd: Unknown result type (might be due to invalid IL or missing references) //IL_0802: Unknown result type (might be due to invalid IL or missing references) //IL_080a: Unknown result type (might be due to invalid IL or missing references) //IL_080b: Unknown result type (might be due to invalid IL or missing references) //IL_0810: Unknown result type (might be due to invalid IL or missing references) //IL_055a: Unknown result type (might be due to invalid IL or missing references) //IL_055f: Unknown result type (might be due to invalid IL or missing references) //IL_0564: Unknown result type (might be due to invalid IL or missing references) //IL_0568: Unknown result type (might be due to invalid IL or missing references) //IL_056d: Unknown result type (might be due to invalid IL or missing references) //IL_0571: Unknown result type (might be due to invalid IL or missing references) //IL_0576: Unknown result type (might be due to invalid IL or missing references) //IL_057a: Unknown result type (might be due to invalid IL or missing references) //IL_057f: Unknown result type (might be due to invalid IL or missing references) //IL_0587: Unknown result type (might be due to invalid IL or missing references) //IL_058b: Unknown result type (might be due to invalid IL or missing references) //IL_05a8: Unknown result type (might be due to invalid IL or missing references) //IL_05ad: Unknown result type (might be due to invalid IL or missing references) //IL_05b2: Unknown result type (might be due to invalid IL or missing references) //IL_05c4: Unknown result type (might be due to invalid IL or missing references) //IL_05c9: Unknown result type (might be due to invalid IL or missing references) //IL_05cd: Unknown result type (might be due to invalid IL or missing references) //IL_05d2: Unknown result type (might be due to invalid IL or missing references) //IL_05ee: Unknown result type (might be due to invalid IL or missing references) //IL_05f0: Unknown result type (might be due to invalid IL or missing references) //IL_05f4: Unknown result type (might be due to invalid IL or missing references) //IL_0601: Unknown result type (might be due to invalid IL or missing references) //IL_0603: Unknown result type (might be due to invalid IL or missing references) //IL_0607: Unknown result type (might be due to invalid IL or missing references) //IL_0632: Unknown result type (might be due to invalid IL or missing references) //IL_0639: Unknown result type (might be due to invalid IL or missing references) //IL_063e: Unknown result type (might be due to invalid IL or missing references) //IL_0643: Unknown result type (might be due to invalid IL or missing references) //IL_0816: Unknown result type (might be due to invalid IL or missing references) //IL_06a8: Unknown result type (might be due to invalid IL or missing references) //IL_06af: Unknown result type (might be due to invalid IL or missing references) //IL_06b6: Unknown result type (might be due to invalid IL or missing references) //IL_06cb: Unknown result type (might be due to invalid IL or missing references) //IL_06d2: Unknown result type (might be due to invalid IL or missing references) //IL_06d9: Unknown result type (might be due to invalid IL or missing references) //IL_06ee: Unknown result type (might be due to invalid IL or missing references) //IL_06f5: Unknown result type (might be due to invalid IL or missing references) //IL_06fc: Unknown result type (might be due to invalid IL or missing references) //IL_065b: Unknown result type (might be due to invalid IL or missing references) //IL_065d: Unknown result type (might be due to invalid IL or missing references) //IL_0665: Unknown result type (might be due to invalid IL or missing references) //IL_066a: Unknown result type (might be due to invalid IL or missing references) //IL_0671: Unknown result type (might be due to invalid IL or missing references) //IL_0676: Unknown result type (might be due to invalid IL or missing references) //IL_067d: Unknown result type (might be due to invalid IL or missing references) //IL_0844: Unknown result type (might be due to invalid IL or missing references) //IL_0850: Unknown result type (might be due to invalid IL or missing references) //IL_0866: Unknown result type (might be due to invalid IL or missing references) //IL_086b: Unknown result type (might be due to invalid IL or missing references) //IL_0870: Unknown result type (might be due to invalid IL or missing references) //IL_0898: Unknown result type (might be due to invalid IL or missing references) //IL_089d: Unknown result type (might be due to invalid IL or missing references) //IL_08af: Unknown result type (might be due to invalid IL or missing references) //IL_08b4: Unknown result type (might be due to invalid IL or missing references) //IL_08b8: Unknown result type (might be due to invalid IL or missing references) //IL_08bd: Unknown result type (might be due to invalid IL or missing references) //IL_08bf: Unknown result type (might be due to invalid IL or missing references) //IL_08c2: Unknown result type (might be due to invalid IL or missing references) //IL_08d7: Unknown result type (might be due to invalid IL or missing references) //IL_08dc: Unknown result type (might be due to invalid IL or missing references) //IL_08e0: Unknown result type (might be due to invalid IL or missing references) //IL_08e5: Unknown result type (might be due to invalid IL or missing references) //IL_08e9: Unknown result type (might be due to invalid IL or missing references) //IL_08ee: Unknown result type (might be due to invalid IL or missing references) //IL_08f2: Unknown result type (might be due to invalid IL or missing references) //IL_08f7: Unknown result type (might be due to invalid IL or missing references) //IL_08ff: Unknown result type (might be due to invalid IL or missing references) //IL_0903: Unknown result type (might be due to invalid IL or missing references) //IL_0882: Unknown result type (might be due to invalid IL or missing references) //IL_0935: Unknown result type (might be due to invalid IL or missing references) //IL_093a: Unknown result type (might be due to invalid IL or missing references) //IL_093f: Unknown result type (might be due to invalid IL or missing references) //IL_0951: Unknown result type (might be due to invalid IL or missing references) //IL_0956: Unknown result type (might be due to invalid IL or missing references) //IL_095a: Unknown result type (might be due to invalid IL or missing references) //IL_095f: Unknown result type (might be due to invalid IL or missing references) //IL_096b: Unknown result type (might be due to invalid IL or missing references) //IL_096d: Unknown result type (might be due to invalid IL or missing references) //IL_0971: Unknown result type (might be due to invalid IL or missing references) //IL_097e: Unknown result type (might be due to invalid IL or missing references) //IL_0980: Unknown result type (might be due to invalid IL or missing references) //IL_0984: Unknown result type (might be due to invalid IL or missing references) //IL_0991: Unknown result type (might be due to invalid IL or missing references) //IL_0999: Unknown result type (might be due to invalid IL or missing references) //IL_09a6: Unknown result type (might be due to invalid IL or missing references) //IL_09ab: Unknown result type (might be due to invalid IL or missing references) //IL_09b2: Unknown result type (might be due to invalid IL or missing references) //IL_09dd: Unknown result type (might be due to invalid IL or missing references) //IL_09e4: Unknown result type (might be due to invalid IL or missing references) //IL_09eb: Unknown result type (might be due to invalid IL or missing references) //IL_0a00: Unknown result type (might be due to invalid IL or missing references) //IL_0a07: Unknown result type (might be due to invalid IL or missing references) //IL_0a0e: Unknown result type (might be due to invalid IL or missing references) //IL_0a23: Unknown result type (might be due to invalid IL or missing references) //IL_0a2a: Unknown result type (might be due to invalid IL or missing references) //IL_0a31: Unknown result type (might be due to invalid IL or missing references) //IL_0a3e: Unknown result type (might be due to invalid IL or missing references) //IL_0a43: Unknown result type (might be due to invalid IL or missing references) //IL_0a47: Unknown result type (might be due to invalid IL or missing references) //IL_0a4c: Unknown result type (might be due to invalid IL or missing references) //IL_0a51: Unknown result type (might be due to invalid IL or missing references) //IL_0a58: Unknown result type (might be due to invalid IL or missing references) //IL_0a6c: Unknown result type (might be due to invalid IL or missing references) //IL_0a71: Unknown result type (might be due to invalid IL or missing references) side = ((side != 0) ? 1 : 0); phase *= 1.6f; bool flag = state == State.InspectUnder || state == State.LookUnder || state == State.UnderAttack; weight = Mathf.SmoothDamp(weight, (float)(flag ? 1 : 0), ref weightVelocity, 0.18f, 6f, dt); string text = ((side == 1) ? "L" : "R"); float num = ((side != 1) ? 1 : (-1)); if (state != State.Attack) { motion.UnplantedFoot = ((state == State.UnderAttack && phase < 1.45f) ? text : null); } ClearContact = false; if (weight < 0.005f) { motion.LowCoverWeight = 0f; return; } bool flag2 = state == State.UnderAttack; bool flag3 = CoverReach.OpeningHeight(body.position, target) < 0.66f; motion.LowCoverWeight = (flag3 ? weight : 0f); float num2 = weight * weight; float num3 = (flag2 ? (Ease(0.28f, 0.52f, phase) * (1f - Ease(0.92f, 1.38f, phase))) : 0f); Transform val = motion.Map["pelvis"]; Transform val2 = motion.Map["spine_01"]; Transform val3 = motion.Map["chest"]; Transform val4 = motion.Map["head"]; val.position += body.TransformDirection(new Vector3((0f - num) * 0.13f * num3, flag3 ? (-0.58f) : (0f - Mathf.Lerp(0.24f, 0.08f, num3)), flag3 ? 0f : (0.48f * num3))) * num2; val2.rotation = Quaternion.AngleAxis(Mathf.Lerp(60f, 25f, num3) * num2, body.right) * val2.rotation; val3.rotation = Quaternion.AngleAxis((5f - num3 * 19f) * num2, body.right) * val3.rotation; motion.Map["neck"].rotation = Quaternion.AngleAxis(-20f * num2, body.right) * motion.Map["neck"].rotation; Vector3 val5 = body.InverseTransformPoint(val4.position); float t = Mathf.Lerp(0.9f, val5.y, num3); float num4 = 0.3f + 0.5f * Ease(1.25f, 1.55f, t) + 0.25f * num3; Vector3 val6 = default(Vector3); ((Vector3)(ref val6))..ctor(0f, Mathf.Clamp(0.9f - val5.y, -0.15f, 0.1f) * (1f - num3), Mathf.Min(0f, num4 - val5.z)); val.position += body.TransformDirection(val6) * num2; Vector3 val7 = body.InverseTransformPoint(val.position); val7.y = Mathf.Max(flag3 ? 0.52f : 0.6f, val7.y); val7.z = Mathf.Max(-0.4f, val7.z); val.position = body.TransformPoint(val7); val3.rotation = Quaternion.AngleAxis(num * 22f * num3 * weight, body.up) * val3.rotation; Vector3 val8 = target - val4.position; if (((Vector3)(ref val8)).sqrMagnitude > 0.01f) { val4.rotation = Quaternion.Slerp(val4.rotation, Quaternion.LookRotation(val8, body.up) * Quaternion.Inverse(opticalFrame), weight); } string[] array = new string[2] { "L", "R" }; foreach (string text2 in array) { float num5 = ((!(text2 == "L")) ? 1 : (-1)); Transform val9 = motion.Map["upper_arm." + text2]; Transform val10 = motion.Map["forearm." + text2]; Transform val11 = motion.Map["hand." + text2]; Vector3 target2 = body.TransformPoint(new Vector3(num5 * 0.42f, Mathf.Lerp(flag3 ? 0.55f : 0.44f, flag3 ? 0.7f : 1.12f, num3), Mathf.Lerp(0.12f, -0.12f, num3))); Quaternion rotation = val9.rotation; Quaternion rotation2 = val10.rotation; Quaternion rotation3 = val11.rotation; WallSafety.Solve(val9, val10, val11, target2, val9.position + body.TransformDirection(new Vector3(num5 * 0.6f, 0.15f, -0.25f))); Quaternion rotation4 = val9.rotation; Quaternion rotation5 = val10.rotation; float num6 = Mathf.Min(1f, weight * 2.5f); val9.rotation = Quaternion.Slerp(rotation, rotation4, num6); val10.rotation = Quaternion.Slerp(rotation2, rotation5, num6); Transform val12 = motion.Map["finger_2.03." + text2]; Vector3 val13 = val12.position - val11.position; if (((Vector3)(ref val13)).sqrMagnitude > 0.001f) { val11.rotation = Quaternion.Slerp(rotation3, Quaternion.FromToRotation(val13, body.forward) * val11.rotation, num6); } float num7 = 1f - Mathf.Exp((0f - dt) / 0.055f); val9.localRotation = Quaternion.Slerp(motion.PreviousRotation(val9), val9.localRotation, num7); val10.localRotation = Quaternion.Slerp(motion.PreviousRotation(val10), val10.localRotation, num7); val11.localRotation = Quaternion.Slerp(motion.PreviousRotation(val11), val11.localRotation, num7); } if (flag2) { Transform val14 = motion.Map["thigh." + text]; Transform val15 = motion.Map["shin." + text]; Transform val16 = motion.Map["foot." + text]; if (!wasKicking) { restFoot = motion.PreviousPosition(val16); } if (flag3) { restFoot.y = Mathf.Max(restFoot.y, body.position.y + 0.23f); } Vector3 val17 = body.TransformPoint(new Vector3(num * 0.25f, flag3 ? 0.23f : 0.36f, -0.06f)); Vector3 val18 = body.InverseTransformPoint(target); float num8 = (flag3 ? (num * 0.1f) : Mathf.Clamp(val18.x, -0.32f, 0.32f)); Vector3 val19 = body.TransformPoint(new Vector3(num8, Mathf.Max(0.19f, val18.y), Mathf.Clamp(val18.z, 1.05f, 1.55f))); if (flag3) { val19.y = body.position.y + 0.205f; } Vector3 val20 = Vector3.Lerp(Vector3.Lerp(restFoot, val17, Ease(0f, 0.28f, phase)), val19, num3); val20 = Vector3.Lerp(val20, restFoot, Ease(1.45f, 1.85f, phase)); Quaternion rotation6 = val14.rotation; Quaternion rotation7 = val15.rotation; Quaternion rotation8 = val16.rotation; WallSafety.Solve(val14, val15, val16, val20, val14.position + body.TransformDirection(new Vector3(num * 0.55f, flag3 ? (-0.35f) : 0.1f, flag3 ? (-0.65f) : 0.6f))); Quaternion rotation9 = val14.rotation; Quaternion rotation10 = val15.rotation; float num9 = weight; val14.rotation = Quaternion.Slerp(rotation6, rotation9, num9); val15.rotation = Quaternion.Slerp(rotation7, rotation10, num9); val16.rotation = Quaternion.Slerp(rotation8, body.rotation * neutralFoot[side], num9); float num10 = 1f - Mathf.Exp((0f - dt) / 0.045f); val14.localRotation = Quaternion.Slerp(motion.PreviousRotation(val14), val14.localRotation, num10); val15.localRotation = Quaternion.Slerp(motion.PreviousRotation(val15), val15.localRotation, num10); val16.localRotation = Quaternion.Slerp(motion.PreviousRotation(val16), val16.localRotation, num10); Vector3 position = val16.position; Vector3 position2 = val15.position; ClearContact = KickOcclusion.ClearTube(val14.position, val15.position, 0.07f) && KickOcclusion.ClearTube(val15.position, position, 0.065f); } wasKicking = flag2; } public bool TryHit(Collider target, float phase, int sequence) { return strike.TryHit(body, target, phase, sequence, wasKicking && weight >= 0.7f); } } public sealed class CoverLegClearance { private readonly FlinchMotion motion; private readonly Transform pelvis; private readonly Transform[] joints; private readonly Quaternion[] safe; private readonly Quaternion[] desired; private Vector3 safePelvis; private bool cached; public CoverLegClearance(FlinchMotion motion) { this.motion = motion; pelvis = motion.Map["pelvis"]; joints = new string[6] { "thigh.L", "shin.L", "foot.L", "thigh.R", "shin.R", "foot.R" }.Select((string n) => motion.Map[n]).ToArray(); safe = (Quaternion[])(object)new Quaternion[joints.Length]; desired = (Quaternion[])(object)new Quaternion[joints.Length]; } private bool ClearSegment(Vector3 a, Vector3 b, float r) { //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) return !Physics.OverlapCapsule(a, b, r, WorldQueries.Mask, (QueryTriggerInteraction)1).Any((Collider c) => !WorldQueries.Self(c) && !Object.op_Implicit((Object)(object)WorldQueries.PlayerOwner(c))); } private bool Clear() { //IL_0009: 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_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_0057: 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_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) return ClearSegment(joints[0].position, joints[1].position, 0.08f) && ClearSegment(joints[1].position, joints[2].position, 0.07f) && ClearSegment(joints[3].position, joints[4].position, 0.08f) && ClearSegment(joints[4].position, joints[5].position, 0.07f); } public void Apply(float dt) { //IL_002c: Unknown result type (might be due to invalid IL or missing references) //IL_0031: 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_0092: Unknown result type (might be due to invalid IL or missing references) //IL_0097: Unknown result type (might be due to invalid IL or missing references) //IL_009c: Unknown result type (might be due to invalid IL or missing references) //IL_010d: 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_00bd: Unknown result type (might be due to invalid IL or missing references) //IL_00c2: Unknown result type (might be due to invalid IL or missing references) //IL_0268: Unknown result type (might be due to invalid IL or missing references) //IL_021b: Unknown result type (might be due to invalid IL or missing references) //IL_0220: Unknown result type (might be due to invalid IL or missing references) //IL_0185: Unknown result type (might be due to invalid IL or missing references) //IL_018a: Unknown result type (might be due to invalid IL or missing references) //IL_018d: Unknown result type (might be due to invalid IL or missing references) //IL_0289: Unknown result type (might be due to invalid IL or missing references) //IL_023b: Unknown result type (might be due to invalid IL or missing references) //IL_0240: 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_01bb: Unknown result type (might be due to invalid IL or missing references) //IL_01c2: Unknown result type (might be due to invalid IL or missing references) if (motion.LowCoverWeight < 0.005f) { cached = false; return; } Vector3 localPosition = pelvis.localPosition; for (int i = 0; i < joints.Length; i++) { desired[i] = joints[i].localRotation; } if (!cached) { safePelvis = pelvis.parent.InverseTransformPoint(motion.PreviousPosition(pelvis)); for (int j = 0; j < joints.Length; j++) { safe[j] = motion.PreviousRotation(joints[j]); } cached = true; } float num = 1f; float num2 = Mathf.Max(2f, dt * 1500f); for (int k = 0; k < joints.Length; k++) { float num3 = Quaternion.Angle(safe[k], desired[k]); if (num3 > num2) { num = Mathf.Min(num, num2 / num3); } } bool flag = false; for (int l = 0; l < 12; l++) { float num4 = ((l == 11) ? 0f : (num * Mathf.Pow(0.68f, (float)l))); pelvis.localPosition = Vector3.Lerp(safePelvis, localPosition, num4); for (int m = 0; m < joints.Length; m++) { joints[m].localRotation = Quaternion.Slerp(safe[m], desired[m], num4); } if (Clear()) { flag = true; break; } } if (flag) { safePelvis = pelvis.localPosition; for (int n = 0; n < joints.Length; n++) { safe[n] = joints[n].localRotation; } } else { pelvis.localPosition = safePelvis; for (int num5 = 0; num5 < joints.Length; num5++) { joints[num5].localRotation = safe[num5]; } } } } public sealed class CoverReach { private readonly Transform body; private readonly CoverKickPose pose; public bool ClearContact => pose.ClearContact; public CoverReach(FlinchMotion motion, Transform body) { this.body = body; pose = new CoverKickPose(motion, body); } public static Vector3 Point(PlayerAvatar p) { //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_004f: Unknown result type (might be due to invalid IL or missing references) //IL_0054: Unknown result type (might be due to invalid IL or missing references) //IL_0059: Unknown result type (might be due to invalid IL or missing references) //IL_0032: Unknown result type (might be due to invalid IL or missing references) //IL_0037: 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) PlayerTumble val = Fields.Get(p, "tumble"); if (Object.op_Implicit((Object)(object)val) && Fields.Get(val, "isTumbling")) { return Fields.Get(val, "physGrabObject").centerPoint; } return ((Component)p).transform.position + Vector3.up * 0.22f; } public static bool Hidden(PlayerAvatar player) { //IL_0054: 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_005a: 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) if (!WorldQueries.Living(player) || (!Fields.Get(player, "isCrawling") && !Fields.Get(player, "isCrouching"))) { return false; } Vector3 val = Point(player); return Physics.RaycastAll(val, Vector3.up, 1.1f, WorldQueries.Mask, (QueryTriggerInteraction)1).Any((RaycastHit hit) => !WorldQueries.Self(((RaycastHit)(ref hit)).collider) && !((Component)((RaycastHit)(ref hit)).collider).transform.IsChildOf(((Component)player).transform) && !Object.op_Implicit((Object)(object)((Component)((RaycastHit)(ref hit)).collider).GetComponentInParent())); } public static bool Detect(Transform body, PlayerAvatar player, out Vector3 point) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_003e: Unknown result type (might be due to invalid IL or missing references) //IL_0043: Unknown result type (might be due to invalid IL or missing references) //IL_004a: Unknown result type (might be due to invalid IL or missing references) //IL_004f: Unknown result type (might be due to invalid IL or missing references) //IL_0054: Unknown result type (might be due to invalid IL or missing references) //IL_0055: Unknown result type (might be due to invalid IL or missing references) //IL_0067: Unknown result type (might be due to invalid IL or missing references) //IL_006d: Unknown result type (might be due to invalid IL or missing references) //IL_0073: 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_0088: 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_00fd: Unknown result type (might be due to invalid IL or missing references) point = default(Vector3); if (!WorldQueries.Living(player) || (!Fields.Get(player, "isCrawling") && !Fields.Get(player, "isCrouching"))) { return false; } point = Point(player); Vector3 val = body.InverseTransformPoint(point); if (!(Mathf.Abs(val.y) > 0.85f)) { Vector2 val2 = new Vector2(val.x, val.z); if (!(((Vector2)(ref val2)).magnitude > 3f) && !(val.z < -0.25f)) { float[] array = new float[3] { 0.14f, 0.24f, 0.36f }; foreach (float num in array) { float[] array2 = new float[3] { -0.28f, 0f, 0.28f }; foreach (float num2 in array2) { if (WorldQueries.ClearTube(body.TransformPoint(new Vector3(num2, num, 0.3f)), point, 0.045f)) { return true; } } } return false; } } return false; } public static bool KickClear(Vector3 position, Quaternion facing, Vector3 target, int side) { //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_001f: Unknown result type (might be due to invalid IL or missing references) //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_0029: Unknown result type (might be due to invalid IL or missing references) //IL_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) //IL_0030: 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_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_0052: Unknown result type (might be due to invalid IL or missing references) //IL_0053: Unknown result type (might be due to invalid IL or missing references) float num = ((side == 1) ? (-0.25f) : 0.25f); Vector3 a = position + facing * new Vector3(num, 0.2f, 0.16f); Vector3 b = target + facing * new Vector3(num * 0.4f, 0f, -0.06f); return KickOcclusion.ClearTube(a, b, 0.075f); } public static int PreferredFoot(Transform body, Vector3 target, int failure) { //IL_000c: 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_0017: 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_002d: Unknown result type (might be due to invalid IL or missing references) //IL_0032: Unknown result type (might be due to invalid IL or missing references) int num = ((failure % 2 == 0) ? 1 : 0); if (KickClear(body.position, body.rotation, target, num)) { return num; } return KickClear(body.position, body.rotation, target, 1 - num) ? (1 - num) : (-1); } public static bool CanReach(Transform body, PlayerAvatar player, out Vector3 point) { //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_0020: 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 to invalid IL or missing references) //IL_002d: Unknown result type (might be due to invalid IL or missing references) //IL_0032: Unknown result type (might be due to invalid IL or missing references) //IL_0041: 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) if (!Detect(body, player, out point)) { return false; } Vector3 val = body.InverseTransformPoint(point); Vector2 val2 = new Vector2(val.x, val.z); return ((Vector2)(ref val2)).magnitude <= 1.65f && val.z > 0.25f && Mathf.Abs(val.x) < 0.85f && LowStrikeVolume.CanHit(body, PlayerBody.Collider(player)); } public static bool AtEntry(Vector3 from, Vector3 stance, Vector3 target) { //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) //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_0020: 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_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_002c: Unknown result type (might be due to invalid IL or missing references) //IL_0031: Unknown result type (might be due to invalid IL or missing references) Vector3 val = Vector3.ProjectOnPlane(from - stance, Vector3.up); int result; if (((Vector3)(ref val)).magnitude <= 0.28f) { val = Vector3.ProjectOnPlane(from - target, Vector3.up); result = ((((Vector3)(ref val)).magnitude <= 1.65f) ? 1 : 0); } else { result = 0; } return (byte)result != 0; } public static float OpeningHeight(Vector3 body, Vector3 target) { //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_0029: 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_0032: 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_0046: 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_006b: 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_00ad: 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) float num = 2f; float[] array = new float[3] { 0.65f, 0.85f, 1f }; foreach (float num2 in array) { Vector3 val = Vector3.Lerp(body, target, num2); val.y = body.y + 0.08f; RaycastHit[] array2 = Physics.RaycastAll(val, Vector3.up, 1.2f, WorldQueries.Mask, (QueryTriggerInteraction)1); for (int j = 0; j < array2.Length; j++) { RaycastHit val2 = array2[j]; if (!WorldQueries.Self(((RaycastHit)(ref val2)).collider) && !Object.op_Implicit((Object)(object)WorldQueries.PlayerOwner(((RaycastHit)(ref val2)).collider)) && ((RaycastHit)(ref val2)).normal.y < -0.5f) { num = Mathf.Min(num, ((RaycastHit)(ref val2)).point.y - body.y); } } } return num; } public static bool ApproachUsable(Vector3 from, Vector3 stance, Vector3 target, bool inspection) { //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) //IL_0008: 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_0039: Unknown result type (might be due to invalid IL or missing references) //IL_003a: 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_0049: Unknown result type (might be due to invalid IL or missing references) //IL_004e: Unknown result type (might be due to invalid IL or missing references) //IL_004f: 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_0071: 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_008f: 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_00b1: Expected O, but got Unknown //IL_00b3: 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_00c3: Unknown result type (might be due to invalid IL or missing references) //IL_00c9: Invalid comparison between Unknown and I4 Vector3 val = Vector3.ProjectOnPlane(target - stance, Vector3.up); if (((Vector3)(ref val)).magnitude > (inspection ? 4.5f : 1.65f) || ((Vector3)(ref val)).sqrMagnitude < 0.01f || !WallSafety.ClearPose(stance + Vector3.up * 0.02f, Quaternion.LookRotation(val))) { return false; } if (!inspection && !LowStrikeVolume.ClearApproach(stance, Quaternion.LookRotation(val), target)) { return false; } NavMeshHit val2 = default(NavMeshHit); if (!NavMesh.SamplePosition(from, ref val2, 0.8f, -1)) { return false; } NavMeshPath val3 = new NavMeshPath(); return NavMesh.CalculatePath(((NavMeshHit)(ref val2)).position, stance, -1, val3) && (int)val3.status == 0; } public static bool TryInspectionEntry(Vector3 from, Vector3 target, Vector3 rememberedEntry, out Vector3 result) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_002d: Unknown result type (might be due to invalid IL or missing references) //IL_003f: Unknown result type (might be due to invalid IL or missing references) //IL_0065: 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_00a8: 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_00b5: Unknown result type (might be due to invalid IL or missing references) //IL_00ba: Unknown result type (might be due to invalid IL or missing references) //IL_00bf: Unknown result type (might be due to invalid IL or missing references) //IL_00df: Unknown result type (might be due to invalid IL or missing references) //IL_00e4: Unknown result type (might be due to invalid IL or missing references) //IL_00ee: Unknown result type (might be due to invalid IL or missing references) //IL_00f3: Unknown result type (might be due to invalid IL or missing references) //IL_00f8: 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_0117: Unknown result type (might be due to invalid IL or missing references) //IL_011e: Expected O, but got Unknown //IL_0120: Unknown result type (might be due to invalid IL or missing references) //IL_0127: Unknown result type (might be due to invalid IL or missing references) //IL_0138: Unknown result type (might be due to invalid IL or missing references) //IL_013e: Invalid comparison between Unknown and I4 //IL_014e: Unknown result type (might be due to invalid IL or missing references) //IL_0153: Unknown result type (might be due to invalid IL or missing references) result = default(Vector3); NavMeshHit val = default(NavMeshHit); if (!NavMesh.SamplePosition(from, ref val, 0.8f, -1)) { return false; } (Vector3, float)[] array = new(Vector3, float)[2] { (rememberedEntry, 0.6f), (target, 4f) }; NavMeshHit val2 = default(NavMeshHit); for (int i = 0; i < array.Length; i++) { (Vector3, float) tuple = array[i]; if (!NavMesh.SamplePosition(tuple.Item1, ref val2, tuple.Item2, -1) || Mathf.Abs(((NavMeshHit)(ref val2)).position.y - from.y) > 0.5f) { continue; } Vector3 val3 = Vector3.ProjectOnPlane(target - ((NavMeshHit)(ref val2)).position, Vector3.up); if (!(((Vector3)(ref val3)).magnitude > 4.5f) && !(((Vector3)(ref val3)).sqrMagnitude < 0.01f) && WallSafety.ClearPose(((NavMeshHit)(ref val2)).position + Vector3.up * 0.02f, Quaternion.LookRotation(val3))) { NavMeshPath val4 = new NavMeshPath(); if (NavMesh.CalculatePath(((NavMeshHit)(ref val)).position, ((NavMeshHit)(ref val2)).position, -1, val4) && (int)val4.status <= 0) { result = ((NavMeshHit)(ref val2)).position; return true; } } } return false; } public static bool TryApproach(Vector3 from, Vector3 target, int failure, out Vector3 result) { //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) return TryApproach(from, target, failure, null, out result); } public static bool TryApproach(Vector3 from, Vector3 target, int failure, Vector3? previous, out Vector3 result) { //IL_0003: Unknown result type (might be due to invalid IL or missing references) //IL_000f: Unknown result type (might be due to invalid IL or missing references) //IL_0010: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Unknown result type (might be due to invalid IL or missing references) //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_0020: 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_0043: 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_0042: 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_00bf: Unknown result type (might be due to invalid IL or missing references) //IL_00c4: Unknown result type (might be due to invalid IL or missing references) //IL_00c9: Unknown result type (might be due to invalid IL or missing references) //IL_00ca: Unknown result type (might be due to invalid IL or missing references) //IL_00d1: Unknown result type (might be due to invalid IL or missing references) //IL_00d6: Unknown result type (might be due to invalid IL or missing references) //IL_00db: Unknown result type (might be due to invalid IL or missing references) //IL_00df: Unknown result type (might be due to invalid IL or missing references) //IL_00ea: Unknown result type (might be due to invalid IL or missing references) //IL_00fd: Unknown result type (might be due to invalid IL or missing references) //IL_0107: 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_013a: 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_0144: Unknown result type (might be due to invalid IL or missing references) //IL_0149: Unknown result type (might be due to invalid IL or missing references) //IL_014e: Unknown result type (might be due to invalid IL or missing references) //IL_016b: Unknown result type (might be due to invalid IL or missing references) //IL_016e: Unknown result type (might be due to invalid IL or missing references) //IL_0173: Unknown result type (might be due to invalid IL or missing references) //IL_0178: Unknown result type (might be due to invalid IL or missing references) //IL_017d: Unknown result type (might be due to invalid IL or missing references) //IL_0182: Unknown result type (might be due to invalid IL or missing references) //IL_01b6: Unknown result type (might be due to invalid IL or missing references) //IL_01b8: 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_01c1: Unknown result type (might be due to invalid IL or missing references) //IL_01c6: Unknown result type (might be due to invalid IL or missing references) //IL_01d0: Unknown result type (might be due to invalid IL or missing references) //IL_01d5: Unknown result type (might be due to invalid IL or missing references) //IL_01da: 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_01ef: 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) //IL_0209: Unknown result type (might be due to invalid IL or missing references) //IL_0210: Expected O, but got Unknown //IL_0212: Unknown result type (might be due to invalid IL or missing references) //IL_0219: Unknown result type (might be due to invalid IL or missing references) //IL_022a: Unknown result type (might be due to invalid IL or missing references) //IL_0230: Invalid comparison between Unknown and I4 //IL_0259: Unknown result type (might be due to invalid IL or missing references) //IL_0267: Unknown result type (might be due to invalid IL or missing references) //IL_02e3: Unknown result type (might be due to invalid IL or missing references) //IL_02e8: Unknown result type (might be due to invalid IL or missing references) result = default(Vector3); float num = float.PositiveInfinity; Vector3 val = Vector3.ProjectOnPlane(from - target, Vector3.up); Vector3 val2 = ((Vector3)(ref val)).normalized; if (((Vector3)(ref val2)).sqrMagnitude < 0.1f) { val2 = Vector3.back; } NavMeshHit val3 = default(NavMeshHit); if (!NavMesh.SamplePosition(from, ref val3, 0.8f, -1)) { return false; } float[] array = new float[3] { 1.05f, 1.25f, 1.5f }; NavMeshHit val5 = default(NavMeshHit); foreach (float num2 in array) { float[] array2 = new float[8] { 0f, -30f, 30f, -60f, 60f, -90f, 90f, 180f }; foreach (float num3 in array2) { Vector3 val4 = target + Quaternion.AngleAxis(num3 + (float)((failure != 0) ? ((failure % 2 == 0) ? 25 : (-25)) : 0), Vector3.up) * val2 * num2; val4.y = from.y; if (!NavMesh.SamplePosition(val4, ref val5, 0.3f, -1) || Mathf.Abs(((NavMeshHit)(ref val5)).position.y - from.y) > 0.45f) { continue; } if (previous.HasValue) { val = Vector3.ProjectOnPlane(((NavMeshHit)(ref val5)).position - previous.Value, Vector3.up); if (((Vector3)(ref val)).magnitude < 0.42f) { continue; } } Vector3 val6 = Vector3.ProjectOnPlane(target - ((NavMeshHit)(ref val5)).position, Vector3.up); if (((Vector3)(ref val6)).sqrMagnitude < 0.1f || ((Vector3)(ref val6)).magnitude > 1.5f) { continue; } Quaternion val7 = Quaternion.LookRotation(val6); if (!WallSafety.ClearPose(((NavMeshHit)(ref val5)).position + Vector3.up * 0.02f, val7) || !LowStrikeVolume.ClearApproach(((NavMeshHit)(ref val5)).position, val7, target)) { continue; } NavMeshPath val8 = new NavMeshPath(); if (!NavMesh.CalculatePath(((NavMeshHit)(ref val3)).position, ((NavMeshHit)(ref val5)).position, -1, val8) || (int)val8.status > 0) { continue; } float num4 = 0f; for (int k = 1; k < val8.corners.Length; k++) { num4 += Vector3.Distance(val8.corners[k - 1], val8.corners[k]); } if (!previous.HasValue || !(num4 > 2.5f)) { float num5 = num4 + Mathf.Abs(num2 - 1.05f) * 2f + Mathf.Abs(num3) * 0.003f; if (num5 < num) { num = num5; result = ((NavMeshHit)(ref val5)).position; } } } } return num < float.PositiveInfinity; } public PlayerAvatar Sense() { Vector3 point; return (from p in SemiFunc.PlayerGetList() where Detect(body, p, out point) select p).OrderBy(delegate(PlayerAvatar p) { //IL_0006: 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_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) Vector3 val = ((Component)p).transform.position - body.position; return ((Vector3)(ref val)).sqrMagnitude; }).FirstOrDefault(); } public void Pose(State state, float phase, Vector3 target, float dt, int side = 1) { //IL_0008: Unknown result type (might be due to invalid IL or missing references) pose.Apply(state, phase, target, dt, side); } public bool TryKickHit(Collider target, float phase, int sequence) { return pose.TryHit(target, phase, sequence); } } public sealed class DamageFlash : MonoBehaviour { private Renderer[] renderers; private Color[] colors; private MaterialPropertyBlock[] blocks; private bool[] overlay; private AnimationCurve curve; private float phase = 1f; private bool active; public void Initialize(Transform visual, EnemyHealth health) { //IL_0113: Unknown result type (might be due to invalid IL or missing references) //IL_011d: Expected O, but got Unknown //IL_012b: Unknown result type (might be due to invalid IL or missing references) //IL_0135: Expected O, but got Unknown //IL_008a: 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_00a8: Unknown result type (might be due to invalid IL or missing references) //IL_00ae: Expected O, but got Unknown //IL_0097: Unknown result type (might be due to invalid IL or missing references) renderers = ((Component)visual).GetComponentsInChildren(true); colors = (Color[])(object)new Color[renderers.Length]; blocks = (MaterialPropertyBlock[])(object)new MaterialPropertyBlock[renderers.Length]; overlay = new bool[renderers.Length]; curve = Fields.Get(health, "hurtCurve"); for (int i = 0; i < renderers.Length; i++) { Material sharedMaterial = renderers[i].sharedMaterial; colors[i] = ((Object.op_Implicit((Object)(object)sharedMaterial) && sharedMaterial.HasProperty("_Color")) ? sharedMaterial.GetColor("_Color") : Color.white); blocks[i] = new MaterialPropertyBlock(); renderers[i].GetPropertyBlock(blocks[i]); overlay[i] = Object.op_Implicit((Object)(object)sharedMaterial) && sharedMaterial.HasProperty("_ColorOverlayAmount") && sharedMaterial.HasProperty("_ColorOverlay"); } health.onHurt.AddListener(new UnityAction(Pulse)); health.onDeathStart.AddListener(new UnityAction(Pulse)); } private void Pulse() { phase = 0f; active = true; Plugin.Instance.CombatLog("FLINCH_HURT_FLASH: renderers=" + renderers.Length + ", nativeCurve=" + (curve != null)); } private void Update() { //IL_00f1: 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_00bb: Unknown result type (might be due to invalid IL or missing references) if (!active || renderers == null) { return; } phase = Mathf.Min(1f, phase + 2.5f * Time.deltaTime); float num = ((phase >= 1f) ? 0f : ((curve != null) ? Mathf.Clamp01(curve.Evaluate(phase)) : (1f - phase))); for (int i = 0; i < renderers.Length; i++) { if (Object.op_Implicit((Object)(object)renderers[i])) { if (overlay[i]) { blocks[i].SetColor("_ColorOverlay", Color.red); blocks[i].SetFloat("_ColorOverlayAmount", num); } else { blocks[i].SetColor("_Color", Color.Lerp(colors[i], Color.red, num)); } renderers[i].SetPropertyBlock(blocks[i]); } } if (phase >= 1f) { active = false; } } } [HarmonyPatch(typeof(HurtCollider), "EnemyHurt")] internal static class DamagingHitContext { private static void Prefix(HurtCollider __instance, Enemy _enemy, bool __runOriginal, out FlinchActor __state) { __state = ((__runOriginal && Object.op_Implicit((Object)(object)_enemy)) ? ((Component)_enemy).GetComponent() : null); if (Object.op_Implicit((Object)(object)__state) && __instance.enemyDamage > 0 && !__instance.deathPit) { __state.BeginIncomingHit(Fields.Get(__instance, "playerCausingHurt")); } else { __state = null; } } private static Exception Finalizer(Exception __exception, FlinchActor __state) { if (Object.op_Implicit((Object)(object)__state)) { __state.EndIncomingHit(); } return __exception; } } [HarmonyPatch(typeof(EnemyStateStunned), "Set")] internal static class DamageKnockdown { private static bool Prefix(EnemyStateStunned __instance) { FlinchActor component = ((Component)__instance).GetComponent(); return !Object.op_Implicit((Object)(object)component) || !component.SuppressDamageStun; } } public static class DebugItems { private static float nextSpawn; private static GameObject lastPistol; public static void Tick() { //IL_0012: Unknown result type (might be due to invalid IL or missing references) //IL_0199: Unknown result type (might be due to invalid IL or missing references) //IL_0191: Unknown result type (might be due to invalid IL or missing references) //IL_019e: 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_01ab: Unknown result type (might be due to invalid IL or missing references) //IL_01b0: 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_01c1: Unknown result type (might be due to invalid IL or missing references) //IL_01c6: Unknown result type (might be due to invalid IL or missing references) //IL_01cd: Unknown result type (might be due to invalid IL or missing references) //IL_01d2: Unknown result type (might be due to invalid IL or missing references) //IL_01d7: Unknown result type (might be due to invalid IL or missing references) //IL_01e1: Unknown result type (might be due to invalid IL or missing references) //IL_01e6: Unknown result type (might be due to invalid IL or missing references) //IL_01eb: Unknown result type (might be due to invalid IL or missing references) //IL_01ee: 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_0202: Unknown result type (might be due to invalid IL or missing references) //IL_0266: Unknown result type (might be due to invalid IL or missing references) //IL_0268: Unknown result type (might be due to invalid IL or missing references) //IL_025a: Unknown result type (might be due to invalid IL or missing references) //IL_025c: Unknown result type (might be due to invalid IL or missing references) if (!Plugin.TestPistol.Value || !Input.GetKeyDown(Plugin.PistolKey.Value) || Time.unscaledTime < nextSpawn || !Plugin.ActiveLevel() || !SemiFunc.NoTextInputsActive() || (Object.op_Implicit((Object)(object)MenuPageEsc.instance) && ((Component)MenuPageEsc.instance).gameObject.activeInHierarchy)) { return; } if (!SemiFunc.IsMasterClientOrSingleplayer()) { Plugin.Notice("Тестовый пистолет призывает хост"); return; } nextSpawn = Time.unscaledTime + 3f; if (Object.op_Implicit((Object)(object)lastPistol)) { Plugin.Notice("Тестовый пистолет уже призван — подними его"); return; } PlayerAvatar instance = PlayerAvatar.instance; if (!WorldQueries.Living(instance)) { return; } Item[] source = Resources.FindObjectsOfTypeAll(); Item val = (from i in source.Where(Pistol) orderby (!(((Object)i).name + " " + i.itemName).ToLowerInvariant().Contains("handgun")) ? 1 : 0 select i).FirstOrDefault(); string text = (Object.op_Implicit((Object)(object)val) ? ((PrefabRef)(object)val.prefab).ResourcePath : "Items/Item Gun Handgun"); GameObject val2 = (Object.op_Implicit((Object)(object)val) ? ((PrefabRef)(object)val.prefab).Prefab : Resources.Load(text)); if (!Object.op_Implicit((Object)(object)val2) || !Object.op_Implicit((Object)(object)val2.GetComponent())) { Plugin.Notice("Штатный пистолет не загружен: предмет не создан"); return; } Quaternion val3 = (Object.op_Implicit((Object)(object)val) ? val.spawnRotationOffset : Quaternion.identity); Vector3 val4 = Vector3.ProjectOnPlane(WorldQueries.Forward(instance), Vector3.up); Vector3 normalized = ((Vector3)(ref val4)).normalized; Vector3 val5 = ((Component)instance).transform.position + normalized * 1.1f + Vector3.up * 0.6f; if (!WorldQueries.ClearTube(WorldQueries.Eye(instance), val5, 0.15f) || Physics.OverlapSphere(val5, 0.25f, WorldQueries.Mask, (QueryTriggerInteraction)1).Any((Collider c) => !WorldQueries.Self(c))) { Plugin.Notice("Перед игроком нет места для пистолета"); return; } try { lastPistol = (SemiFunc.IsMultiplayer() ? PhotonNetwork.InstantiateRoomObject(text, val5, val3, (byte)0, (object[])null) : Object.Instantiate(val2, val5, val3)); Plugin.Notice(Object.op_Implicit((Object)(object)lastPistol) ? "Тестовый пистолет призван (T)" : "Не удалось призвать пистолет"); } catch (Exception ex) { Plugin.Instance.LoggerMessage("Flinch test pistol: " + ex); Plugin.Notice("Пистолет не создан — ошибка записана в журнал"); } static bool Pistol(Item item) { string text2 = (((Object)item).name + " " + item.itemName + " " + ((PrefabRef)(object)item.prefab)?.ResourcePath).ToLowerInvariant(); return !item.disabled && item.prefab != null && (text2.Contains("handgun") || text2.Contains("pistol") || text2.Contains("revolver")) && Object.op_Implicit((Object)(object)((PrefabRef)(object)item.prefab).Prefab) && Object.op_Implicit((Object)(object)((PrefabRef)(object)item.prefab).Prefab.GetComponent()); } } } public sealed class DuckController { public float Weight; private readonly Transform body; private readonly CapsuleCollider torso; private readonly CapsuleCollider head; private readonly Vector3 headOffset; private float keepLowUntil; private float heldWeight; private float poseWeight; private float poseVelocity; public DuckController(Transform body, FlinchMotion motion) { //IL_005c: Unknown result type (might be due to invalid IL or missing references) //IL_0061: Unknown result type (might be due to invalid IL or missing references) //IL_0066: Unknown result type (might be due to invalid IL or missing references) //IL_006b: Unknown result type (might be due to invalid IL or missing references) this.body = body; torso = ((Component)body.Find("Torso")).GetComponent(); head = ((Component)body.Find("Head")).GetComponent(); headOffset = motion.Map["head"].InverseTransformPoint(body.TransformPoint(new Vector3(0f, 2.02f, 0.24f))); } public void Plan(Vector3 direction, float dt) { //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_003b: 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_004b: 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_0068: 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_007d: Unknown result type (might be due to invalid IL or missing references) keepLowUntil = Mathf.Max(0f, keepLowUntil - dt); float num = Mathf.Max(new float[3] { RequiredAt(body.position, direction), RequiredAt(body.position, -body.forward * 0.65f), RequiredAt(body.position, body.forward * 0.65f) }); if (num > 0.01f) { heldWeight = num; keepLowUntil = 0.25f; } float num2 = ((keepLowUntil > 0f) ? Mathf.Max(num, heldWeight) : num); Weight = Mathf.MoveTowards(Weight, num2, dt * (float)((num2 > Weight) ? 3 : 2)); ApplyColliders(); } public static float RequiredAt(Vector3 position, Vector3 direction) { //IL_0023: 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_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) //IL_0038: 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_0072: 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_008b: 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_005b: Unknown result type (might be due to invalid IL or missing references) //IL_00ae: Unknown result type (might be due to invalid IL or missing references) //IL_00b3: Unknown result type (might be due to invalid IL or missing references) //IL_010e: Unknown result type (might be due to invalid IL or missing references) //IL_0118: Unknown result type (might be due to invalid IL or missing references) //IL_0122: 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_00f1: Unknown result type (might be due to invalid IL or missing references) float num = 0f; float[] array = new float[2] { 0f, 0.55f }; foreach (float num2 in array) { Vector3 val = position + ((Vector3)(ref direction)).normalized * num2; if (GroundSupport.Floor(val, 0.34f, 0.5f, out var floor)) { val.y = Mathf.Max(position.y, floor.Position.y); } RaycastHit[] array2 = Physics.SphereCastAll(val + Vector3.up * 0.65f, 0.3f, Vector3.up, 1.5f, WorldQueries.Mask, (QueryTriggerInteraction)1); for (int j = 0; j < array2.Length; j++) { RaycastHit val2 = array2[j]; if (!WorldQueries.Self(((RaycastHit)(ref val2)).collider) && !Object.op_Implicit((Object)(object)WorldQueries.PlayerOwner(((RaycastHit)(ref val2)).collider)) && WallSafety.BlocksMovement(((RaycastHit)(ref val2)).collider) && !(((RaycastHit)(ref val2)).point.y < val.y + 1.7f)) { num = Mathf.Max(num, LocomotionRules.Duck(((RaycastHit)(ref val2)).point.y - val.y, ((RaycastHit)(ref val2)).normal.y)); } } } return num; } public void Request() { //IL_0007: 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) float num = RequiredAt(body.position, body.forward); if (num > 0.01f) { heldWeight = num; keepLowUntil = 0.35f; } } public void ApplyColliders() { //IL_0016: 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_0035: Unknown result type (might be due to invalid IL or missing references) //IL_0076: Unknown result type (might be due to invalid IL or missing references) //IL_008a: Unknown result type (might be due to invalid IL or missing references) //IL_0095: Unknown result type (might be due to invalid IL or missing references) torso.center = Vector3.Lerp(new Vector3(0f, 0.995f, -0.3f), new Vector3(0f, 0.66f, -0.2f), Weight); torso.height = Mathf.Lerp(1.92f, 1.27f, Weight); head.center = Vector3.Lerp(new Vector3(0f, 2.02f, 0.24f), new Vector3(0f, 1.32f, 0.5f), Weight); } public void Pose(FlinchMotion motion, float dt = -1f) { //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_0084: 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_00bf: Unknown result type (might be due to invalid IL or missing references) //IL_00c4: Unknown result type (might be due to invalid IL or missing references) //IL_00ca: Unknown result type (might be due to invalid IL or missing references) //IL_00cf: Unknown result type (might be due to invalid IL or missing references) //IL_0105: 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_0110: Unknown result type (might be due to invalid IL or missing references) //IL_0115: 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_0151: 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_017b: 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_019f: Unknown result type (might be due to invalid IL or missing references) //IL_01a4: Unknown result type (might be due to invalid IL or missing references) if (dt < 0f) { dt = Time.deltaTime; } poseWeight = Mathf.SmoothDamp(poseWeight, Weight, ref poseVelocity, 0.07f, 5f, dt); if (!(poseWeight < 0.001f)) { if (motion.Map.TryGetValue("pelvis", out Transform value)) { Transform obj = value; obj.position -= Vector3.up * (0.4f * poseWeight); } if (motion.Map.TryGetValue("spine_01", out Transform value2)) { value2.rotation = Quaternion.AngleAxis(38f * poseWeight, body.right) * value2.rotation; } if (motion.Map.TryGetValue("neck", out Transform value3)) { value3.rotation = Quaternion.AngleAxis(-12f * poseWeight, body.right) * value3.rotation; } if (Object.op_Implicit((Object)(object)value)) { float y = body.InverseTransformPoint(motion.Map["head"].TransformPoint(headOffset)).y; float num = Mathf.Lerp(2.02f, 1.32f, poseWeight); Transform obj2 = value; obj2.position += Vector3.up * Mathf.Clamp(num - y, -0.35f, 0.15f) * poseWeight; } } } } public sealed class EnemyAvoidance { private readonly Transform body; private readonly CartBypass bypass; private Vector3 goal; public EnemyAvoidance(Transform body) { this.body = body; bypass = new CartBypass(body, enemies: true); } public void Reset() { bypass.Reset(); } public Vector3 Resolve(Vector3 velocity, float dt) { //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_0051: 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_0058: Unknown result type (might be due to invalid IL or missing references) //IL_001a: Unknown result type (might be due to invalid IL or missing references) //IL_0021: Unknown result type (might be due to invalid IL or missing references) //IL_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_0035: 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) if (!bypass.Active) { goal = body.position + ((Vector3)(ref velocity)).normalized * 8f; } return bypass.Resolve(body.position, goal, velocity, dt); } } [DefaultExecutionOrder(-50)] public sealed class FlinchActor : MonoBehaviourPunCallbacks, IPunObservable { private struct OwnerView { public bool Standing; public bool Watching; public bool Seen; public float At; public int Sequence; } private MonsterAudio audio; private readonly AudioCues audioCues = new AudioCues(); private int audioSerial; private int lastAudioSerial = -1; private int lastImpactSequence = -1; private int lastHurt = -1; private int lastRoarSequence = -1; private float hurtSoundAt; private float ambienceAt; private State localPreviousState = State.Dead; private readonly RearSurprise surprise = new RearSurprise(); public static FlinchActor Live; public static readonly HashSet Actors = new HashSet(); public bool TestSummon; private FlinchBrain brain; private FlinchMotion motion; private Enemy enemy; private EnemyHealth health; private EnemyStateStunned stun; private EnemyParent parent; private NavMeshAgent agent; private BrainSnapshot snapshot = new BrainSnapshot(); private PlayerAvatar visibleTarget; private Vector3 remembered; private Vector3 networkPosition; private Quaternion networkRotation; private float lastSeen = -100f; private float perceptionAt; private float pathAt; private float patrolAt; private float provokedUntil; private float deathAt = -1f; private Vector3 patrolPoint; private int visibleCount; private int targetId = -1; private int lastHitSequence = -1; private bool watched; private bool ready; private bool registered; private float displayPhase; private readonly HashSet lowHitVictims = new HashSet(); private readonly List visible = new List(); private EnemyRigidbody physical; private Rigidbody physicalBody; private PhysGrabObject grab; private Vector3 previousPhysicalPosition; private readonly BodySteering steering = new BodySteering(); private readonly GazeSelector gazeSelector = new GazeSelector(); private readonly SearchRoute searchRoute = new SearchRoute(); private readonly List gazeCandidates = new List(); private GazeDriver gaze; private Vector3 gazePoint; private int gazeTargetId = -1; private int gazeProvokerId = -1; private int patrolPointId = -1; private float gazeUntil; private float gazeProvokerUntil; private float lastStuckCheck; private float searchStuckSince; private Vector3 searchLastPosition; private readonly SoundMemory sounds = new SoundMemory(); private readonly SoulReward reward = new SoulReward(); private CoverReach cover; private AuthoredAttackPose attackPose; private NativeMelee melee; private LocalPresentation presentation; private readonly MotionPolish polish = new MotionPolish(); private PlayerAvatar lowTarget; private Vector3 lowPoint; private Vector3 noisePoint; private Vector3 attackPoint; private int soulValue; private bool soulSpawned; private Vector3[] routeCorners = Array.Empty(); private float navLogAt; private State lastMoveState = State.Dead; private NativeRoaming roaming; private Vector3 motorVelocity; private float motorClearance; private float stairRise; private bool passiveHidden; private Vector3 shelterPoint; private PlayerAvatar encounterTarget; private readonly AttackStep attackStep = new AttackStep(); private readonly CartBypass cartBypass = new CartBypass(); private readonly TravelWatch travelWatch = new TravelWatch(); private EnemyAvoidance enemyAvoidance; private bool travelRequested; private bool confirmedStall; private bool cartAssistUsed; private readonly ReturnTrail groundTrail = new ReturnTrail(); private Vector3 navAnchor; private bool hasNavAnchor; private bool onNavSurface; private bool returningToNav; private bool freezeGroundTrail; private Vector3 pursuitStance; private Vector3 pursuitTarget; private float pursuitPlanAt; private int pursuitId = -1; private bool pursuitPlanned; private int pursuitVariant = -1; private Vector3 progressGoal; private Vector3 progressBody; private float bestRouteDistance = float.PositiveInfinity; private float progressUntil; private int progressTarget = -1; private readonly SurfaceMotor surfaceMotor = new SurfaceMotor(); private static readonly float[] SoundProbeRadii = new float[3] { 0.65f, 1.15f, 1.65f }; private Vector3 soundDestination; private bool soundRouteKnown; private float soundScanYaw; private readonly TargetKnowledge knowledge = new TargetKnowledge(); private readonly Dictionary recognition = new Dictionary(); private PlayerAvatar pendingAggressor; private float pendingUntil; private float damageBraceUntil; private float avoidTargetUntil; private float lastActualDamage = -100f; private int incomingHitDepth; private int avoidedTarget = -1; private DuckController duck; private ObstacleInteractor obstacles; private Vector3 movementIntent; private readonly PathCursor pathCursor = new PathCursor(); private bool floorBridge; private Vector3 lastTargetNav; private Vector3 coverApproachPoint; private Vector3 coverStrikePoint; private float coverLookAt = -1f; private float coverPlanAt; private bool coverApproachKnown; private bool coverInspectionOnly; private int coverStrikeSequence = -1; private int coverKickSide = 1; private bool coverStrikeSettled; private bool leaving; private Vector3 leavePoint; private float leaveBlocked = 5f; private Vector3 deathPoint; private readonly SharedGaze sharedGaze = new SharedGaze(); private readonly Dictionary ownerViews = new Dictionary(); private float nextViewReport; private int viewReportSequence; private bool gazeAnchored; private Quaternion gazeAnchorRotation; private PlayerAvatar nearbyObserver; private bool peerProximityTurn; private bool peerVisualReady; private bool peerVisualHeld; private Vector3 peerVisualBase; private Vector3 peerVisualAnchor; private Vector3 peerVisualVelocity; private Quaternion peerVisualBaseRotation; private Quaternion peerVisualAnchorRotation; private bool present = true; private float spawnPoseUntil; private int receivedPresenceEpoch; private bool seeking; private float searchUntil; private Vector3 seekPoint; public bool InitializationSucceeded { get; private set; } public Transform PhysicsRoot => Object.op_Implicit((Object)(object)physical) ? ((Component)physical).transform : ((Component)this).transform; public Transform ActorRoot => Object.op_Implicit((Object)(object)parent) ? ((Component)parent).transform : ((Component)this).transform.parent; public bool ConfirmedStall => confirmedStall; public bool PhysicalTravelAttempt => travelRequested && (((Vector3)(ref movementIntent)).sqrMagnitude > 0.04f || cartBypass.BlockedNear(physicalBody.position, 1.1f)); private bool TrackingActive => TrackingActiveAt(Time.time); public bool SuppressDamageStun => incomingHitDepth > 0 || (Object.op_Implicit((Object)(object)grab) && grab.playerGrabbing.Count > 0 && !CanLiftNow()); public bool CanNativeLeave => ready && present && !Dying && !brain.Enraged && !watched && !sounds.Active(Time.time) && (brain.State == State.Patrol || brain.State == State.Retreat); public bool ForcedPursuit => brain != null && brain.ForcedPursuit; private bool OrdinaryGazeStop => ready && present && !Dying && !ForcedPursuit && watched && stun.stunTimer <= 0f && (!Object.op_Implicit((Object)(object)grab) || grab.playerGrabbing.Count == 0); public bool Ready => ready; public bool Dying => deathAt >= 0f || snapshot.State == State.Dead; public bool ObservedOrHeld => watched || (Object.op_Implicit((Object)(object)grab) && grab.playerGrabbing.Count > 0); public int CurrentHealth => Object.op_Implicit((Object)(object)health) ? Fields.Get(health, "healthCurrent") : 0; public bool RecoveryPaused { get { if (!ready || !present || brain == null || Dying || CurrentHealth <= 0 || (Object.op_Implicit((Object)(object)grab) && grab.playerGrabbing.Count > 0 && CanLiftNow()) || (watched && !ForcedPursuit) || Time.time < spawnPoseUntil || stun.stunTimer > 0f || enemy.FreezeTimer > 0f || physicalBody.isKinematic) { return true; } switch (brain.State) { case State.Observe: case State.Startle: case State.RageTransition: case State.Attack: case State.Exhausted: case State.Stunned: case State.Dead: case State.LookUnder: case State.UnderAttack: case State.InspectUnder: return true; case State.RoamBurst: return brain.StateTime < 0.55f; default: return false; } } } private bool SearchKnown => SearchKnownAt(Time.time); private void WarnObstacle(Vector3 point) { EmitSound(MonsterSound.Roar); audioCues.DelayIdle(35f); Plugin.Instance.CombatLog("FLINCH_OBSTRUCTION: roar before clearing blocker"); } private void InitializeAudio() { //IL_003d: Unknown result type (might be due to invalid IL or missing references) //IL_0047: Expected O, but got Unknown //IL_005a: Unknown result type (might be due to invalid IL or missing references) //IL_0064: Expected O, but got Unknown audio = new MonsterAudio(PhysicsRoot); ambienceAt = Time.time + (float)Random.Range(90, 160); health.onHurt.AddListener((UnityAction)delegate { if (SemiFunc.IsMasterClientOrSingleplayer() && !(Time.time < hurtSoundAt)) { hurtSoundAt = Time.time + 0.12f; int num = Random.Range(0, (lastHurt < 0) ? 4 : 3); if (lastHurt >= 0 && num >= lastHurt) { num++; } lastHurt = num; EmitSound((MonsterSound)lastHurt); } }); health.onDeathStart.AddListener((UnityAction)delegate { audio.Stop(); }); melee.Contact += delegate(PlayerAvatar victim) { if (Object.op_Implicit((Object)(object)victim)) { if (SemiFunc.IsMasterClientOrSingleplayer()) { ImpactSound(snapshot.Sequence); } else { ((MonoBehaviourPun)this).photonView.RPC("ImpactRequestRPC", (RpcTarget)2, new object[2] { victim.photonView.ViewID, snapshot.Sequence }); } } }; } private void TickAudio() { //IL_00e5: Unknown result type (might be due to invalid IL or missing references) //IL_00ea: Unknown result type (might be due to invalid IL or missing references) //IL_00f4: Unknown result type (might be due to invalid IL or missing references) //IL_00f9: Unknown result type (might be due to invalid IL or missing references) //IL_00fe: Unknown result type (might be due to invalid IL or missing references) if (snapshot.State == State.Dead) { audio.Stop(); return; } if (snapshot.State == State.RoamBurst && snapshot.Sequence != lastRoarSequence) { lastRoarSequence = snapshot.Sequence; audioCues.DelayIdle(35f); EmitSound(MonsterSound.Roar); } bool flag = snapshot.State == State.Patrol || snapshot.State == State.Stalk || snapshot.State == State.Chase || snapshot.State == State.Retreat || (snapshot.State == State.RoamBurst && displayPhase >= 0.55f); RaycastHit hit; bool flag2 = WorldQueries.Raycast(PhysicsRoot.position + Vector3.up * 0.2f, Vector3.down, 0.5f, out hit); AudioDecision audioDecision = audioCues.Tick(Time.deltaTime, visibleCount > 0, snapshot.State == State.Patrol, flag && flag2, motion.GaitPhase, audio.VoiceBusy, motion.DistanceMoved); if (audioDecision.Step) { EmitSound(MonsterSound.Step); } if (audioDecision.Voice == VoiceCue.Detect) { EmitSound(MonsterSound.Detect); } else if (audioDecision.Voice == VoiceCue.Lost) { EmitSound((Random.value < 0.5f) ? MonsterSound.Lost1 : MonsterSound.Lost2); } else if (audioDecision.Voice == VoiceCue.Idle) { EmitSound(MonsterSound.Idle); } } private void TickLocalAudio() { //IL_0109: 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_0124: Unknown result type (might be due to invalid IL or missing references) //IL_0129: Unknown result type (might be due to invalid IL or missing references) //IL_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_0143: Unknown result type (might be due to invalid IL or missing references) //IL_0159: Unknown result type (might be due to invalid IL or missing references) //IL_018d: 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_01ce: Unknown result type (might be due to invalid IL or missing references) //IL_01d9: 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_01e8: Unknown result type (might be due to invalid IL or missing references) //IL_01ed: Unknown result type (might be due to invalid IL or missing references) if (snapshot.State == State.Dead) { audio.Stop(); return; } audio.Pursuit = snapshot.State == State.Chase || snapshot.State == State.Attack || snapshot.State == State.UnderAttack || snapshot.State == State.RoamBurst; audio.Breathing(NativeBehaviour.Breathing(snapshot.State, motion.DistanceMoved / Mathf.Max(Time.deltaTime, 0.001f), present)); bool flag = snapshot.State == State.Observe && localPreviousState != State.Observe; localPreviousState = snapshot.State; PlayerAvatar instance = PlayerAvatar.instance; if (!WorldQueries.Living(instance) || !Plugin.ActiveLevel()) { return; } Vector3 val = WorldQueries.Eye(instance); Vector3 val2 = motion.Map["head"].position - val; float magnitude = ((Vector3)(ref val2)).magnitude; bool flag2 = magnitude < 1.8f && WorldQueries.Clear(val, motion.Map["head"].position); bool closeBehind = flag2 && motion.DistanceMoved > 0.001f && snapshot.State != State.Observe && Vector3.Dot(WorldQueries.Forward(instance), ((Vector3)(ref val2)).normalized) < -0.2f; bool stoppedByThisViewer = flag2 && flag && !CoverReach.Hidden(instance) && WorldQueries.WatchedFromFront(instance, motion.Map["head"].position, PhysicsRoot.position + Vector3.up * 1.2f, PhysicsRoot); if (surprise.Tick(Time.deltaTime, closeBehind, stoppedByThisViewer)) { audio.Play((MonsterSound)Random.Range(13, 18)); } if (Time.time >= ambienceAt) { ambienceAt = Time.time + (float)Random.Range(160, 280); if (Plugin.AmbientSound.Value && magnitude > 8f && Random.value < 0.65f) { audio.Play(MonsterSound.Ambience); } } } private void ImpactSound(int sequence) { if (SemiFunc.IsMasterClientOrSingleplayer() && sequence != lastImpactSequence) { lastImpactSequence = sequence; EmitSound(MonsterSound.Hit); } } [PunRPC] private void ImpactRequestRPC(int victim, int sequence, PhotonMessageInfo info = default(PhotonMessageInfo)) { //IL_0033: 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_006f: Unknown result type (might be due to invalid IL or missing references) if (SemiFunc.IsMasterClientOrSingleplayer() && SemiFunc.IsMultiplayer()) { PlayerAvatar val = SemiFunc.PlayerAvatarGetFromPhotonID(victim); if (Object.op_Implicit((Object)(object)val) && val.photonView.Owner == info.Sender && sequence == snapshot.Sequence && snapshot.State == State.Attack && !(Vector3.Distance(PlayerBody.Aim(val), PhysicsRoot.position) > 3.5f)) { ImpactSound(sequence); } } } private void EmitSound(MonsterSound sound) { //IL_006c: 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) if (SemiFunc.IsMasterClientOrSingleplayer()) { audioSerial = Mathf.Max(audioSerial, lastAudioSerial) + 1; if (SemiFunc.IsMultiplayer()) { ((MonoBehaviourPun)this).photonView.RPC("MonsterSoundRPC", (RpcTarget)0, new object[2] { (int)sound, audioSerial }); } else { MonsterSoundRPC((int)sound, audioSerial); } } } [PunRPC] private void MonsterSoundRPC(int sound, int serial, PhotonMessageInfo info = default(PhotonMessageInfo)) { //IL_0008: Unknown result type (might be due to invalid IL or missing references) if ((!SemiFunc.IsMultiplayer() || info.Sender == PhotonNetwork.MasterClient) && serial > lastAudioSerial && sound >= 0 && sound <= 10 && audio != null) { lastAudioSerial = serial; if (snapshot.State != State.Dead) { audio.Play((MonsterSound)sound); } } } private bool CoverSidestepping(Vector3 body) { //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) return brain.State == State.InspectUnder && Object.op_Implicit((Object)(object)lowTarget) && coverApproachKnown && Vector3.Distance(coverApproachPoint, body) > 0.3f; } public (bool Detected, bool Known, bool Ready, bool Entry) PlanCover(float now) { //IL_0003: 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_0032: Unknown result type (might be due to invalid IL or missing references) //IL_013e: Unknown result type (might be due to invalid IL or missing references) //IL_0144: 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_00fb: Unknown result type (might be due to invalid IL or missing references) //IL_0101: 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_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) //IL_0167: Unknown result type (might be due to invalid IL or missing references) //IL_016a: 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_0231: Unknown result type (might be due to invalid IL or missing references) //IL_01da: Unknown result type (might be due to invalid IL or missing references) //IL_01dd: Unknown result type (might be due to invalid IL or missing references) //IL_019a: Unknown result type (might be due to invalid IL or missing references) //IL_019c: Unknown result type (might be due to invalid IL or missing references) //IL_02c2: Unknown result type (might be due to invalid IL or missing references) //IL_02c8: Unknown result type (might be due to invalid IL or missing references) //IL_02cd: Unknown result type (might be due to invalid IL or missing references) //IL_02d2: Unknown result type (might be due to invalid IL or missing references) //IL_02d4: Unknown result type (might be due to invalid IL or missing references) //IL_0248: Unknown result type (might be due to invalid IL or missing references) //IL_020d: Unknown result type (might be due to invalid IL or missing references) //IL_020f: Unknown result type (might be due to invalid IL or missing references) //IL_02e7: Unknown result type (might be due to invalid IL or missing references) //IL_02e9: Unknown result type (might be due to invalid IL or missing references) //IL_02ee: Unknown result type (might be due to invalid IL or missing references) //IL_02f3: Unknown result type (might be due to invalid IL or missing references) //IL_027b: Unknown result type (might be due to invalid IL or missing references) //IL_0280: Unknown result type (might be due to invalid IL or missing references) //IL_03e2: Unknown result type (might be due to invalid IL or missing references) //IL_03e8: Unknown result type (might be due to invalid IL or missing references) //IL_0403: Unknown result type (might be due to invalid IL or missing references) //IL_041c: Unknown result type (might be due to invalid IL or missing references) //IL_041e: Unknown result type (might be due to invalid IL or missing references) //IL_03b8: Unknown result type (might be due to invalid IL or missing references) Vector3 point = default(Vector3); bool flag = brain.Enraged && CoverReach.CanReach(PhysicsRoot, lowTarget, out point); if (flag && Vector3.Distance(point, lowPoint) > 0.75f) { flag = false; } bool flag2 = brain.Enraged && knowledge.CoverKnown(now) && WorldQueries.Living(lowTarget); bool item = knowledge.CoverKnown(now) && (brain.ForcedPursuit || brain.Capture().ChaseCommitted); bool flag3 = brain.State == State.Chase || (brain.State == State.InspectUnder && !coverApproachKnown); if (flag2 && flag3 && now >= coverPlanAt && (!coverApproachKnown || !CoverReach.ApproachUsable(PhysicsRoot.position, coverApproachPoint, lowPoint, coverInspectionOnly))) { coverPlanAt = now + 0.7f; coverApproachKnown = false; Vector3 result2; if (CoverReach.TryApproach(PhysicsRoot.position, lowPoint, brain.Capture().CoverFailures, out var result)) { if (Vector3.Distance(result, coverApproachPoint) > 0.35f) { coverLookAt = -1f; pathAt = 0f; } coverApproachPoint = result; coverApproachKnown = true; coverInspectionOnly = false; } else if (CoverReach.TryInspectionEntry(PhysicsRoot.position, lowPoint, lastTargetNav, out result2)) { if (Vector3.Distance(result2, coverApproachPoint) > 0.35f) { coverLookAt = -1f; pathAt = 0f; } coverApproachPoint = result2; coverApproachKnown = true; coverInspectionOnly = true; } else if (Vector3.Distance(PhysicsRoot.position, lowPoint) < 2.25f && Mathf.Abs(PhysicsRoot.position.y - lowPoint.y) < 0.65f) { coverApproachPoint = PhysicsRoot.position; coverApproachKnown = true; coverInspectionOnly = true; coverLookAt = -1f; } } bool flag4 = flag; bool flag5 = false; if (flag2 && coverApproachKnown) { Vector3 val = PhysicsRoot.position - coverApproachPoint; int num; if (Mathf.Abs(val.y) <= 0.42f) { Vector3 val2 = Vector3.ProjectOnPlane(val, Vector3.up); num = ((((Vector3)(ref val2)).magnitude <= 0.3f) ? 1 : 0); } else { num = 0; } flag5 = (byte)num != 0; if (!flag5) { coverLookAt = -1f; } if (flag5 && coverLookAt < 0f) { coverLookAt = now; } flag4 = flag && flag5 && coverLookAt >= 0f && now - coverLookAt >= 0.12f; } if (flag2 && !flag4 && brain.State == State.InspectUnder && brain.Capture().CoverFailures > 0 && brain.StateTime >= 1.25f && now >= coverPlanAt && !CoverSidestepping(PhysicsRoot.position)) { coverPlanAt = now + 1.1f; if (CoverReach.TryApproach(PhysicsRoot.position, lowPoint, brain.Capture().CoverFailures, PhysicsRoot.position, out var result3)) { coverApproachPoint = result3; coverApproachKnown = true; coverInspectionOnly = false; coverLookAt = -1f; pathAt = 0f; flag5 = false; } } return (Detected: flag2, Known: item, Ready: flag4, Entry: flag5); } public void Awake() { //IL_015a: Unknown result type (might be due to invalid IL or missing references) //IL_0164: Expected O, but got Unknown //IL_020e: Unknown result type (might be due to invalid IL or missing references) //IL_0218: Expected O, but got Unknown //IL_0276: Unknown result type (might be due to invalid IL or missing references) //IL_0280: Expected O, but got Unknown //IL_0288: Unknown result type (might be due to invalid IL or missing references) //IL_028d: Unknown result type (might be due to invalid IL or missing references) //IL_0299: 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) if (Object.op_Implicit((Object)(object)Plugin.Cache) && ((Component)this).transform.IsChildOf(Plugin.Cache.transform)) { return; } parent = ((Component)this).GetComponentInParent(); motion = ((Component)this).GetComponent(); motion.EnsureInitialized(); brain = new FlinchBrain(Plugin.BrainSettings()); enemy = ((Component)this).GetComponent(); health = ((Component)this).GetComponent(); stun = ((Component)this).GetComponent(); agent = ((Component)this).GetComponent(); physical = ((Component)parent).GetComponentInChildren(true); physicalBody = ((Component)physical).GetComponent(); grab = ((Component)physical).GetComponent(); gaze = new GazeDriver(motion, ((Component)physical).transform); cover = new CoverReach(motion, ((Component)physical).transform); attackPose = new AuthoredAttackPose(motion); melee = new NativeMelee(((Component)physical).transform, enemy); presentation = ((Component)this).gameObject.AddComponent(); InitializeAudio(); health.onHurt.AddListener(new UnityAction(polish.Hurt)); roaming = new NativeRoaming(enemy); duck = new DuckController(((Component)physical).transform, motion); obstacles = new ObstacleInteractor(((Component)physical).transform); obstacles.Warning += WarnObstacle; obstacles.Reroute += delegate { roaming.ChangeRoute(); pathAt = (patrolAt = 0f); }; DamageFlash damageFlash = ((Component)this).gameObject.AddComponent(); damageFlash.Initialize(motion.Visual, health); health.onDeathStart.AddListener(new UnityAction(BeginDeath)); health.impactHurt = true; health.impactLightDamage = 10; health.impactMediumDamage = 30; health.impactHeavyDamage = 60; health.objectHurt = true; health.objectHurtStun = false; health.onObjectHurt.AddListener((UnityAction)delegate { if (Time.time - lastActualDamage < 0.1f) { RememberContact(Fields.Get(health, "onObjectHurtPlayer")); } }); networkPosition = ((Component)this).transform.position; networkRotation = ((Component)this).transform.rotation; ((Component)motion.Visual).gameObject.SetActive(false); InitializationSucceeded = true; Live = this; Actors.Add(this); } public void ApplyDamageResistance() { if (brain != null) { health.OverrideDamageResistance(brain.Enraged ? 0f : Plugin.CalmResistance.Value, 0.25f); } } public void DamageReceived() { //IL_00ad: Unknown result type (might be due to invalid IL or missing references) //IL_00b2: Unknown result type (might be due to invalid IL or missing references) //IL_00b7: Unknown result type (might be due to invalid IL or missing references) //IL_00bc: Unknown result type (might be due to invalid IL or missing references) //IL_00d8: Unknown result type (might be due to invalid IL or missing references) //IL_00df: Unknown result type (might be due to invalid IL or missing references) //IL_00e9: Unknown result type (might be due to invalid IL or missing references) //IL_00ee: Unknown result type (might be due to invalid IL or missing references) if (brain == null || !SemiFunc.IsMasterClientOrSingleplayer() || deathAt >= 0f || Fields.Get(health, "healthCurrent") <= 0) { return; } lastActualDamage = Time.time; damageBraceUntil = Time.time + 0.35f; Plugin.Instance.CombatLog("FLINCH_AGGRESSION: actual health loss -> Damage"); if ((!(Time.time < pendingUntil) || !RememberContact(pendingAggressor)) && knowledge.Id < 0) { Vector3 val = Vector3.ProjectOnPlane(Fields.Get(health, "hurtDirection"), Vector3.up); if (((Vector3)(ref val)).sqrMagnitude > 0.01f) { Hear(PhysicsRoot.position - ((Vector3)(ref val)).normalized * 2f, 6f); } } brain.ReceiveDamage(); snapshot = brain.Capture(); displayPhase = brain.StateTime; } private void Provoke(PlayerAvatar player, bool physicalTouch = false) { if (brain != null && !(deathAt >= 0f) && SemiFunc.IsMasterClientOrSingleplayer() && WorldQueries.Living(player) && ContactRules.Provokes(grab.playerGrabbing.Any((PhysGrabber g) => (Object)(object)g.playerAvatar == (Object)(object)player))) { if (!brain.ForcedPursuit) { Plugin.Instance.CombatLog("FLINCH_AGGRESSION: explicit grab attempt -> Provocation"); } provokedUntil = Time.time + 0.25f; RememberContact(player, physicalTouch); brain.ReceiveProvocation(); snapshot = brain.Capture(); displayPhase = brain.StateTime; } } private IEnumerator Start() { while (!Object.op_Implicit((Object)(object)LevelGenerator.Instance) || !Object.op_Implicit((Object)(object)EnemyDirector.instance)) { yield return null; } if (!InitializationSucceeded) { ReportSpawnReady(); if (SemiFunc.IsMasterClientOrSingleplayer()) { Remove(); } yield break; } ((Component)parent).transform.SetParent(LevelGenerator.Instance.EnemyParent.transform, true); List enemies = Fields.Get>(EnemyDirector.instance, "enemiesSpawned"); if (!enemies.Contains(parent)) { enemies.Add(parent); } registered = true; Fields.Set(parent, "Enemy", enemy); Fields.Set(parent, "SetupDone", true); Fields.Set(parent, "Spawned", true); ReportSpawnReady(); while (!LevelGenerator.Instance.Generated) { yield return null; } if (SemiFunc.IsMasterClientOrSingleplayer()) { object[] instantiationData = ((MonoBehaviourPun)this).photonView.InstantiationData; bool debug = instantiationData != null && instantiationData.Length != 0 && (bool)((MonoBehaviourPun)this).photonView.InstantiationData[0]; if (!SemiFunc.IsMultiplayer()) { debug = TestSummon; } if (!debug) { EnemyDirector.instance.FirstSpawnPointAdd(parent); LevelPoint point = Fields.Get(parent, "firstSpawnPoint"); if (!Object.op_Implicit((Object)(object)point)) { Plugin.Notice("Для Нелюдима нет штатной точки появления"); Remove(); yield break; } ((Component)this).transform.position = ((Component)point).transform.position; } ((Behaviour)agent).enabled = true; if (!agent.isOnNavMesh && !agent.Warp(((Component)this).transform.position)) { Plugin.Notice("Нелюдим не смог встать на навигацию уровня"); Remove(); yield break; } agent.nextPosition = ((Component)this).transform.position; navAnchor = agent.nextPosition; hasNavAnchor = true; groundTrail.Record(K(((Component)this).transform.position), onNavigationSurface: true); ready = true; networkPosition = ((Component)this).transform.position; networkRotation = ((Component)this).transform.rotation; } if (SemiFunc.IsMasterClientOrSingleplayer()) { ((Component)physical).transform.SetPositionAndRotation(((Component)this).transform.position, ((Component)this).transform.rotation); ((Component)physical).gameObject.SetActive(true); physicalBody.isKinematic = false; grab.spawned = true; previousPhysicalPosition = ((Component)physical).transform.position; } SetVisual(ready); ((Component)parent).GetComponent().Initialize(); if (SemiFunc.IsMasterClientOrSingleplayer() && TestSummon) { Plugin.Notice("Нелюдим призван"); } } private static void ReportSpawnReady() { if (!LevelGenerator.Instance.Generated) { Fields.Set(LevelGenerator.Instance, "EnemiesSpawned", Fields.Get(LevelGenerator.Instance, "EnemiesSpawned") + 1); AccessTools.Method(typeof(LevelGenerator), "EnemySpawnReady", (Type[])null, (Type[])null).Invoke(LevelGenerator.Instance, null); } } private void SetVisual(bool show) { ((Component)motion.Visual).gameObject.SetActive(show); Collider[] componentsInChildren = ((Component)physical).GetComponentsInChildren(true); foreach (Collider val in componentsInChildren) { val.enabled = show; } } private void Update() { //IL_006b: 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_05bf: Unknown result type (might be due to invalid IL or missing references) //IL_05c5: Unknown result type (might be due to invalid IL or missing references) //IL_05df: Unknown result type (might be due to invalid IL or missing references) //IL_05ea: Unknown result type (might be due to invalid IL or missing references) //IL_05ef: Unknown result type (might be due to invalid IL or missing references) //IL_05f4: Unknown result type (might be due to invalid IL or missing references) //IL_0602: Unknown result type (might be due to invalid IL or missing references) //IL_060d: Unknown result type (might be due to invalid IL or missing references) //IL_0612: Unknown result type (might be due to invalid IL or missing references) //IL_0619: Unknown result type (might be due to invalid IL or missing references) //IL_062a: Unknown result type (might be due to invalid IL or missing references) //IL_0630: Unknown result type (might be due to invalid IL or missing references) //IL_0651: Unknown result type (might be due to invalid IL or missing references) //IL_0657: Unknown result type (might be due to invalid IL or missing references) //IL_0671: Unknown result type (might be due to invalid IL or missing references) //IL_06ee: Unknown result type (might be due to invalid IL or missing references) //IL_06f3: Unknown result type (might be due to invalid IL or missing references) //IL_06f4: Unknown result type (might be due to invalid IL or missing references) //IL_06f9: Unknown result type (might be due to invalid IL or missing references) //IL_0724: Unknown result type (might be due to invalid IL or missing references) //IL_0729: Unknown result type (might be due to invalid IL or missing references) //IL_074e: Unknown result type (might be due to invalid IL or missing references) //IL_0753: Unknown result type (might be due to invalid IL or missing references) //IL_0809: Unknown result type (might be due to invalid IL or missing references) //IL_0843: Unknown result type (might be due to invalid IL or missing references) //IL_08a3: Unknown result type (might be due to invalid IL or missing references) //IL_089b: Unknown result type (might be due to invalid IL or missing references) //IL_02f8: Unknown result type (might be due to invalid IL or missing references) //IL_02fd: Unknown result type (might be due to invalid IL or missing references) //IL_02fe: Unknown result type (might be due to invalid IL or missing references) //IL_0303: Unknown result type (might be due to invalid IL or missing references) //IL_0308: Unknown result type (might be due to invalid IL or missing references) //IL_030d: Unknown result type (might be due to invalid IL or missing references) //IL_02bb: Unknown result type (might be due to invalid IL or missing references) //IL_02c0: Unknown result type (might be due to invalid IL or missing references) //IL_02c1: Unknown result type (might be due to invalid IL or missing references) //IL_02c6: Unknown result type (might be due to invalid IL or missing references) //IL_02cb: Unknown result type (might be due to invalid IL or missing references) //IL_02d0: Unknown result type (might be due to invalid IL or missing references) //IL_043d: Unknown result type (might be due to invalid IL or missing references) //IL_0442: Unknown result type (might be due to invalid IL or missing references) //IL_044e: Unknown result type (might be due to invalid IL or missing references) //IL_04e1: Unknown result type (might be due to invalid IL or missing references) //IL_049c: Unknown result type (might be due to invalid IL or missing references) //IL_04a1: Unknown result type (might be due to invalid IL or missing references) //IL_0517: Unknown result type (might be due to invalid IL or missing references) //IL_0519: Unknown result type (might be due to invalid IL or missing references) //IL_056a: Unknown result type (might be due to invalid IL or missing references) //IL_056c: Unknown result type (might be due to invalid IL or missing references) if (brain == null) { return; } bool flag = SemiFunc.IsMasterClientOrSingleplayer(); if (!ready) { return; } PublishObservation(); if (TickDeath(flag) || !present) { return; } if (flag) { RefreshObservation(); } Vector3 val = previousPhysicalPosition; if (flag) { if (!Plugin.ActiveLevel() || Time.time < spawnPoseUntil) { return; } WorldHearing.PollSoloVoice(); if (Time.time >= perceptionAt) { perceptionAt = Time.time + 0.08f; Perceive(); } bool flag2 = deathAt >= 0f || Fields.Get(health, "dead"); if (flag2 && deathAt < 0f) { deathAt = Time.time - brain.StateTime; } Fields.Set(enemy, "Stunned", stun.stunTimer > 0f || flag2); Fields.Set(enemy, "FreezeTimer", Mathf.Max(0f, Fields.Get(enemy, "FreezeTimer") - Time.deltaTime)); Fields.Set(enemy, "TeleportedTimer", Mathf.Max(0f, Fields.Get(enemy, "TeleportedTimer") - Time.deltaTime)); bool flag3 = Fields.Get(physical, "grabbed") && CanLiftNow(); ApplyLiftGate(); if (grab.playerGrabbing.Count > 0) { Provoke(grab.playerGrabbing[0].playerAvatar, physicalTouch: true); } UpdateTracking(Time.time); Vector3 point; bool flag4 = CanStartMovingStrike(visibleTarget, brain.AttackVariant ^ 1, out point); bool provoked = Time.time < provokedUntil; var (flag5, knownCover, flag6, coverEntry) = PlanCover(Time.time); Vector3 val2; int num; if (brain.State == State.Chase && brain.SpeedFraction > 1f && Time.time - lastSeen < 6f) { val2 = Vector3.ProjectOnPlane(PhysicsRoot.position - val, Vector3.up); num = ((((Vector3)(ref val2)).magnitude > 0.002f) ? 1 : 0); } else { num = 0; } bool runningChase = (byte)num != 0; int num2; if (brain.State == State.Patrol) { val2 = Vector3.ProjectOnPlane(PhysicsRoot.position - val, Vector3.up); num2 = ((((Vector3)(ref val2)).magnitude > 0.001f) ? 1 : 0); } else { num2 = 0; } bool flag7 = (byte)num2 != 0; bool vulnerable = PlayerBody.OpenLowTarget(visibleTarget); bool unreachable = !flag4 && !flag6 && (progressTarget != knowledge.Id || Time.time >= progressUntil); brain.Tick(Time.deltaTime, new Perception(visibleCount, watched, flag4, provoked, Time.time - lastSeen < 6f || flag5, stun.stunTimer > 0f || flag3, flag2, flag5, flag6, passiveHidden, runningChase, flag7, knownCover, coverEntry, vulnerable, unreachable)); snapshot = brain.Capture(); displayPhase = brain.StateTime; if (snapshot.State == State.UnderAttack) { if (coverStrikeSequence != snapshot.Sequence) { coverStrikeSequence = snapshot.Sequence; coverStrikeSettled = false; coverStrikePoint = lowPoint; int num3 = CoverReach.PreferredFoot(PhysicsRoot, lowPoint, snapshot.CoverFailures); coverKickSide = ((num3 >= 0) ? num3 : (snapshot.CoverFailures % 2)); } if (snapshot.StateTime < 0.14f) { coverStrikePoint = lowPoint; } } enemy.CurrentState = (EnemyState)(flag2 ? 11 : ((stun.stunTimer > 0f || flag3) ? 9 : (brain.Enraged ? 4 : 2))); Vector3 point2; if (flag4 && snapshot.State == State.Attack && snapshot.StateTime <= Time.deltaTime) { attackPoint = point; } else if (snapshot.State == State.Attack && AuthoredPhase(State.Attack, snapshot.StateTime) < 0.32f && CanStartMovingStrike(visibleTarget, snapshot.AttackVariant, out point2)) { attackPoint = point2; } health.OverrideDamageResistance(brain.Enraged ? 0f : Plugin.CalmResistance.Value, 0.25f); } else { displayPhase += Time.deltaTime; Vector3 delta = Vector3.Lerp(((Component)this).transform.position, networkPosition, Mathf.Min(1f, Time.deltaTime * 18f)) - ((Component)this).transform.position; ((Component)this).transform.position = WallSafety.Move(((Component)this).transform.position, ((Component)this).transform.rotation, delta); if (WallSafety.ClearPose(((Component)this).transform.position, networkRotation)) { ((Component)this).transform.rotation = Quaternion.Slerp(((Component)this).transform.rotation, networkRotation, Mathf.Min(1f, Time.deltaTime * 18f)); } } float num4 = AuthoredPhase(snapshot.State, displayPhase); motion.State = snapshot.State; motion.StateTime = num4; motion.Panic = snapshot.GroupAlarm; motion.AttackVariant = snapshot.AttackVariant; Vector3 val3 = ((Component)physical).transform.position - val; val3.y = 0f; motion.DistanceMoved = ((Vector3)(ref val3)).magnitude; previousPhysicalPosition = ((Component)physical).transform.position; if (((Vector3)(ref val3)).sqrMagnitude > 1E-06f) { motion.Backwards = Vector3.Dot(PhysicsRoot.forward, val3) < 0f; } bool flag8 = snapshot.State == State.Observe; if (!flag8) { motion.Sample(Time.deltaTime); polish.Apply(motion, ((Component)physical).transform, Time.deltaTime); if (snapshot.State != State.Dead && snapshot.State != State.Stunned) { duck.Pose(motion); } } attackPose.Pose(snapshot.State, num4, attackPoint, snapshot.Sequence, snapshot.AttackVariant, Time.deltaTime); gaze.Update(Time.time < gazeUntil, gazePoint, Time.deltaTime, Mathf.Lerp(1f, 0.25f, duck.Weight)); if (!flag8) { cover.Pose(snapshot.State, num4, (snapshot.State == State.UnderAttack) ? coverStrikePoint : lowPoint, Time.deltaTime, coverKickSide); WallSafety.Arms(motion); motion.PlantFeet(); } presentation.Tick(motion.Map["head"], PhysicsRoot, grab, snapshot.State != State.Dead, Time.deltaTime); melee.Tick(snapshot.State, num4, snapshot.Sequence, snapshot.AttackVariant, motion, snapshot.AttackDamage); if (flag) { TickAudio(); } TickLocalAudio(); if (!flag || brain.State != State.UnderAttack) { return; } if (TryLowHit(snapshot.AttackDamage)) { if (!coverStrikeSettled) { brain.CoverResult(success: true); } coverStrikeSettled = true; } if (!coverStrikeSettled && brain.StateTime >= 0.72f) { brain.CoverResult(success: false); coverStrikeSettled = true; RepositionCover(); } } private void Perceive() { ObservePlayers(); } public bool CanLiftNow() { if ((Object)(object)grab == (Object)null || grab.playerGrabbing.Count == 0) { return false; } Dictionary dictionary = (Object.op_Implicit((Object)(object)StatsManager.instance) ? Fields.Get>(StatsManager.instance, "playerUpgradeStrength") : null); foreach (PhysGrabber item in grab.playerGrabbing) { PlayerAvatar playerAvatar = item.playerAvatar; if (WorldQueries.Living(playerAvatar)) { int value = 0; string text = Fields.Get(playerAvatar, "steamID"); if (dictionary != null && !string.IsNullOrEmpty(text)) { dictionary.TryGetValue(text, out value); } if (LiftGate.Allows(value, Plugin.MinimumLiftStrength.Value)) { return true; } } } return false; } private void ApplyLiftGate() { //IL_0051: Unknown result type (might be due to invalid IL or missing references) bool flag = grab.playerGrabbing.Count > 0 && !CanLiftNow(); physical.grabForceNeeded.amount = (flag ? float.MaxValue : 0.1f); if (flag) { Fields.Set(grab, "grabDisplacementCurrent", Vector3.zero); Fields.Set(physical, "grabForceTimer", 0f); Fields.Set(physical, "grabStrengthTimer", 0f); } } private void Navigate() { //IL_0003: Unknown result type (might be due to invalid IL or missing references) //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_0009: 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_0010: 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_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_0073: 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_00af: Unknown result type (might be due to invalid IL or missing references) //IL_00d1: Unknown result type (might be due to invalid IL or missing references) //IL_01f7: Unknown result type (might be due to invalid IL or missing references) //IL_014b: Unknown result type (might be due to invalid IL or missing references) //IL_0150: Unknown result type (might be due to invalid IL or missing references) //IL_04a3: Unknown result type (might be due to invalid IL or missing references) //IL_04a8: Unknown result type (might be due to invalid IL or missing references) //IL_04b4: Unknown result type (might be due to invalid IL or missing references) //IL_02d3: Unknown result type (might be due to invalid IL or missing references) //IL_02da: Unknown result type (might be due to invalid IL or missing references) //IL_02e0: Unknown result type (might be due to invalid IL or missing references) //IL_02fd: Unknown result type (might be due to invalid IL or missing references) //IL_0302: Unknown result type (might be due to invalid IL or missing references) //IL_0307: Unknown result type (might be due to invalid IL or missing references) //IL_0310: Unknown result type (might be due to invalid IL or missing references) //IL_0318: Unknown result type (might be due to invalid IL or missing references) //IL_031d: Unknown result type (might be due to invalid IL or missing references) //IL_0322: Unknown result type (might be due to invalid IL or missing references) //IL_0327: Unknown result type (might be due to invalid IL or missing references) //IL_0330: Unknown result type (might be due to invalid IL or missing references) //IL_0335: Unknown result type (might be due to invalid IL or missing references) //IL_033b: Unknown result type (might be due to invalid IL or missing references) //IL_033d: Unknown result type (might be due to invalid IL or missing references) //IL_0375: Unknown result type (might be due to invalid IL or missing references) //IL_02bd: Unknown result type (might be due to invalid IL or missing references) //IL_04f8: Unknown result type (might be due to invalid IL or missing references) //IL_03c3: Unknown result type (might be due to invalid IL or missing references) //IL_03ac: Unknown result type (might be due to invalid IL or missing references) //IL_04e6: Unknown result type (might be due to invalid IL or missing references) //IL_0426: Unknown result type (might be due to invalid IL or missing references) //IL_042b: Unknown result type (might be due to invalid IL or missing references) //IL_0438: Unknown result type (might be due to invalid IL or missing references) //IL_0444: Unknown result type (might be due to invalid IL or missing references) //IL_0455: Unknown result type (might be due to invalid IL or missing references) //IL_045a: Unknown result type (might be due to invalid IL or missing references) //IL_0462: Unknown result type (might be due to invalid IL or missing references) //IL_046e: Unknown result type (might be due to invalid IL or missing references) //IL_0475: Unknown result type (might be due to invalid IL or missing references) //IL_0491: Unknown result type (might be due to invalid IL or missing references) //IL_057a: Unknown result type (might be due to invalid IL or missing references) //IL_057b: Unknown result type (might be due to invalid IL or missing references) //IL_0580: Unknown result type (might be due to invalid IL or missing references) //IL_0594: Unknown result type (might be due to invalid IL or missing references) //IL_0595: Unknown result type (might be due to invalid IL or missing references) //IL_059a: Unknown result type (might be due to invalid IL or missing references) //IL_05aa: Unknown result type (might be due to invalid IL or missing references) //IL_05ab: Unknown result type (might be due to invalid IL or missing references) //IL_05b0: Unknown result type (might be due to invalid IL or missing references) //IL_05f7: Unknown result type (might be due to invalid IL or missing references) //IL_05f8: Unknown result type (might be due to invalid IL or missing references) //IL_05fd: Unknown result type (might be due to invalid IL or missing references) //IL_05d9: Unknown result type (might be due to invalid IL or missing references) //IL_05d1: Unknown result type (might be due to invalid IL or missing references) //IL_0742: Unknown result type (might be due to invalid IL or missing references) //IL_060d: Unknown result type (might be due to invalid IL or missing references) //IL_060e: Unknown result type (might be due to invalid IL or missing references) //IL_0613: Unknown result type (might be due to invalid IL or missing references) //IL_05de: Unknown result type (might be due to invalid IL or missing references) //IL_0622: Unknown result type (might be due to invalid IL or missing references) //IL_0624: Unknown result type (might be due to invalid IL or missing references) //IL_069b: Unknown result type (might be due to invalid IL or missing references) //IL_06a1: Unknown result type (might be due to invalid IL or missing references) //IL_06a6: Unknown result type (might be due to invalid IL or missing references) //IL_06ab: Unknown result type (might be due to invalid IL or missing references) //IL_06bf: Unknown result type (might be due to invalid IL or missing references) //IL_06c6: Unknown result type (might be due to invalid IL or missing references) //IL_06d0: Unknown result type (might be due to invalid IL or missing references) //IL_06d5: Unknown result type (might be due to invalid IL or missing references) //IL_06da: Unknown result type (might be due to invalid IL or missing references) //IL_0670: Unknown result type (might be due to invalid IL or missing references) //IL_0681: Unknown result type (might be due to invalid IL or missing references) //IL_0663: Unknown result type (might be due to invalid IL or missing references) //IL_0686: Unknown result type (might be due to invalid IL or missing references) //IL_08b2: Unknown result type (might be due to invalid IL or missing references) //IL_08b9: Unknown result type (might be due to invalid IL or missing references) //IL_08fd: Unknown result type (might be due to invalid IL or missing references) //IL_08ff: Unknown result type (might be due to invalid IL or missing references) //IL_0937: Unknown result type (might be due to invalid IL or missing references) //IL_0938: Unknown result type (might be due to invalid IL or missing references) //IL_0970: Unknown result type (might be due to invalid IL or missing references) //IL_0975: Unknown result type (might be due to invalid IL or missing references) //IL_099e: Unknown result type (might be due to invalid IL or missing references) //IL_09a3: Unknown result type (might be due to invalid IL or missing references) //IL_09a4: Unknown result type (might be due to invalid IL or missing references) //IL_09a9: Unknown result type (might be due to invalid IL or missing references) //IL_09b0: Unknown result type (might be due to invalid IL or missing references) //IL_09cd: Unknown result type (might be due to invalid IL or missing references) //IL_09d4: Unknown result type (might be due to invalid IL or missing references) //IL_09dc: Unknown result type (might be due to invalid IL or missing references) //IL_09e3: Unknown result type (might be due to invalid IL or missing references) //IL_0a48: Unknown result type (might be due to invalid IL or missing references) //IL_0a49: Unknown result type (might be due to invalid IL or missing references) //IL_0a6e: Unknown result type (might be due to invalid IL or missing references) //IL_0a73: Unknown result type (might be due to invalid IL or missing references) //IL_0a74: Unknown result type (might be due to invalid IL or missing references) //IL_0a79: Unknown result type (might be due to invalid IL or missing references) //IL_0a7e: Unknown result type (might be due to invalid IL or missing references) //IL_0a83: Unknown result type (might be due to invalid IL or missing references) //IL_0aba: Unknown result type (might be due to invalid IL or missing references) //IL_0ad3: Unknown result type (might be due to invalid IL or missing references) //IL_0ad8: Unknown result type (might be due to invalid IL or missing references) //IL_0b15: Unknown result type (might be due to invalid IL or missing references) //IL_0b1c: Unknown result type (might be due to invalid IL or missing references) //IL_0be0: Unknown result type (might be due to invalid IL or missing references) //IL_0be1: Unknown result type (might be due to invalid IL or missing references) //IL_0be3: Unknown result type (might be due to invalid IL or missing references) //IL_0be8: Unknown result type (might be due to invalid IL or missing references) //IL_0b50: Unknown result type (might be due to invalid IL or missing references) //IL_0b55: Unknown result type (might be due to invalid IL or missing references) //IL_0b58: Unknown result type (might be due to invalid IL or missing references) //IL_0b65: Unknown result type (might be due to invalid IL or missing references) //IL_0b67: Unknown result type (might be due to invalid IL or missing references) //IL_0b68: Unknown result type (might be due to invalid IL or missing references) //IL_0b6d: Unknown result type (might be due to invalid IL or missing references) //IL_0b72: Unknown result type (might be due to invalid IL or missing references) //IL_0b77: Unknown result type (might be due to invalid IL or missing references) //IL_0b7b: Unknown result type (might be due to invalid IL or missing references) //IL_0b80: Unknown result type (might be due to invalid IL or missing references) //IL_0b8f: Unknown result type (might be due to invalid IL or missing references) //IL_0b91: Unknown result type (might be due to invalid IL or missing references) //IL_0bcd: Unknown result type (might be due to invalid IL or missing references) //IL_0bd1: Unknown result type (might be due to invalid IL or missing references) //IL_0bd6: Unknown result type (might be due to invalid IL or missing references) //IL_0c10: Unknown result type (might be due to invalid IL or missing references) //IL_0c17: Unknown result type (might be due to invalid IL or missing references) //IL_0c1c: Unknown result type (might be due to invalid IL or missing references) //IL_0c1e: Unknown result type (might be due to invalid IL or missing references) //IL_0c20: Unknown result type (might be due to invalid IL or missing references) //IL_0c28: Unknown result type (might be due to invalid IL or missing references) //IL_0c29: Unknown result type (might be due to invalid IL or missing references) //IL_0c2b: Unknown result type (might be due to invalid IL or missing references) //IL_0c32: Unknown result type (might be due to invalid IL or missing references) //IL_0c37: Unknown result type (might be due to invalid IL or missing references) //IL_0c90: Unknown result type (might be due to invalid IL or missing references) //IL_0c98: Unknown result type (might be due to invalid IL or missing references) //IL_0c9d: Unknown result type (might be due to invalid IL or missing references) //IL_0ca2: Unknown result type (might be due to invalid IL or missing references) //IL_0ca7: Unknown result type (might be due to invalid IL or missing references) //IL_0cb0: Unknown result type (might be due to invalid IL or missing references) //IL_0cb5: Unknown result type (might be due to invalid IL or missing references) //IL_0cbd: Unknown result type (might be due to invalid IL or missing references) //IL_0c7b: Unknown result type (might be due to invalid IL or missing references) //IL_0c82: Unknown result type (might be due to invalid IL or missing references) //IL_0c87: Unknown result type (might be due to invalid IL or missing references) //IL_0d6d: Unknown result type (might be due to invalid IL or missing references) //IL_0d6f: Unknown result type (might be due to invalid IL or missing references) //IL_0d7b: Unknown result type (might be due to invalid IL or missing references) //IL_0e71: Unknown result type (might be due to invalid IL or missing references) //IL_0e76: Unknown result type (might be due to invalid IL or missing references) //IL_0d62: Unknown result type (might be due to invalid IL or missing references) //IL_0d63: Unknown result type (might be due to invalid IL or missing references) //IL_0d17: Unknown result type (might be due to invalid IL or missing references) //IL_0d1e: Unknown result type (might be due to invalid IL or missing references) //IL_0d58: Unknown result type (might be due to invalid IL or missing references) Vector3 target = (motorVelocity = (movementIntent = Vector3.zero)); motorClearance = (stairRise = 0f); surfaceMotor.Stop(); if (!((Behaviour)agent).enabled) { return; } travelRequested = !RecoveryPaused; Vector3 position = physicalBody.position; ((Component)this).transform.position = position; if (!agent.isOnNavMesh && hasNavAnchor) { agent.Warp(navAnchor); ((Component)this).transform.position = position; } if (!agent.isOnNavMesh) { return; } TrackGround(position); State state = brain.State; if (state != lastMoveState) { if (state == State.RoamBurst) { roaming.ChangeRoute(); pathAt = 0f; routeCorners = Array.Empty(); } if (state == State.Retreat) { if (Object.op_Implicit((Object)(object)lowTarget)) { remembered = lowPoint; } avoidedTarget = knowledge.Id; avoidTargetUntil = Time.time + 10f; roaming.ChangeRoute(); knowledge.Forget(); seeking = (leaving = false); recognition.Clear(); patrolPointId = -1; patrolAt = (pathAt = 0f); routeCorners = Array.Empty(); lowTarget = null; sounds.Clear(); } lastMoveState = state; } bool flag = state == State.Observe; bool flag2 = CoverSidestepping(position); bool flag3 = flag || state == State.RageTransition || (state == State.RoamBurst && brain.StateTime < 0.55f) || state == State.Attack || state == State.LookUnder || (state == State.InspectUnder && !flag2) || state == State.UnderAttack || state == State.Exhausted || state == State.Stunned || state == State.Dead || state == State.Startle; agent.isStopped = flag3; physical.rotationSpeedIdle = ((!flag) ? 3 : 0); physical.rotationSpeedChase = ((!flag) ? 4 : 0); if (flag3) { if (state == State.Attack) { float num = AuthoredPhase(state, brain.StateTime); if (num < 0.32f) { FaceTarget(attackPoint, Time.fixedDeltaTime); } Vector3 velocity = attackStep.Plan(position, physicalBody.rotation, attackPoint, num, snapshot.Sequence, Time.fixedDeltaTime, physicalBody.linearVelocity); ObstacleInteractor obstacleInteractor = obstacles; target = Vector3.ProjectOnPlane(physicalBody.linearVelocity, Vector3.up); movementIntent = obstacleInteractor.LimitCartApproach(velocity, ((Vector3)(ref target)).magnitude); PlanGroundMotion(position, movementIntent); physical.positionSpeedIdle = (physical.positionSpeedChase = ((Vector3)(ref movementIntent)).magnitude); obstacles.Tick(movementIntent, motion.DistanceMoved, Time.fixedDeltaTime, allowed: true); return; } if (state == State.LookUnder || state == State.InspectUnder) { FaceTarget(lowPoint, Time.fixedDeltaTime); } obstacles.Tick(Vector3.zero, 0f, Time.deltaTime, allowed: false); roaming.Pause(); physical.positionSpeedIdle = (physical.positionSpeedChase = 0f); if (flag && !physicalBody.isKinematic) { Vector3 linearVelocity = physicalBody.linearVelocity; physicalBody.linearVelocity = new Vector3(0f, linearVelocity.y, 0f); Vector3 angularVelocity = physicalBody.angularVelocity; physicalBody.angularVelocity = new Vector3(angularVelocity.x, 0f, angularVelocity.z); ((Component)this).transform.rotation = ((Component)physical).transform.rotation; } return; } Vector3 val = remembered; bool trackingActive = TrackingActive; Vector3 destination = default(Vector3); bool flag4 = !leaving && !trackingActive && state != State.Retreat && !Object.op_Implicit((Object)(object)visibleTarget) && !Object.op_Implicit((Object)(object)lowTarget) && TrySoundInvestigation(position, out destination); if (flag4 && ScanSoundSource(position)) { return; } bool flag5 = !trackingActive && !Object.op_Implicit((Object)(object)visibleTarget) && !flag4 && !Object.op_Implicit((Object)(object)lowTarget) && SearchKnown && Time.time - lastSeen >= 1f && state != State.Retreat; if (brain.Enraged) { leaving = false; } if (state == State.Retreat) { val = SearchDestination(position); } else if (leaving) { val = NativeLeaveDestination(position); } else if (flag5) { val = RobeSearchDestination(position); } else if (Object.op_Implicit((Object)(object)lowTarget)) { val = (coverApproachKnown ? coverApproachPoint : lowPoint); } else if (Object.op_Implicit((Object)(object)visibleTarget)) { val = VisiblePursuitDestination(position); } else if (trackingActive) { val = TrackingDestination(position); } else if (flag4) { val = destination; } else if (state == State.Patrol || state == State.Retreat || state == State.RoamBurst || (!Object.op_Implicit((Object)(object)visibleTarget) && !SearchKnown)) { val = (onNavSurface ? roaming.Destination(position, Time.fixedDeltaTime, obstacles.Clearing) : navAnchor); } else if (state == State.Panic) { Vector3 val2 = ((Component)this).transform.position - remembered; val2.y = 0f; val = ((Component)this).transform.position + ((Vector3)(ref val2)).normalized * 1.4f; } if (!trackingActive && !leaving && !flag4 && !flag5 && !Object.op_Implicit((Object)(object)lowTarget) && state == State.Patrol && roaming.Waiting && onNavSurface) { travelRequested = false; routeCorners = Array.Empty(); pathCursor.Reset(); obstacles.Tick(Vector3.zero, 0f, Time.fixedDeltaTime, allowed: false); return; } float num2 = (Object.op_Implicit((Object)(object)PlayerController.instance) ? PlayerController.instance.MoveSpeed : 2f); float num3 = (Object.op_Implicit((Object)(object)PlayerController.instance) ? PlayerController.instance.SprintSpeed : 4f); float num4 = Mathf.Abs(brain.SpeedFraction); float num5 = (brain.Enraged ? (num3 * num4) : (num2 * num4)); if (flag2) { num5 = 1.05f; } if (trackingActive && Object.op_Implicit((Object)(object)LiveTrackingTarget(Time.time))) { num5 = Mathf.Max(num5, num3 * Plugin.SoloRageSpeed.Value); } physical.positionSpeedIdle = (physical.positionSpeedChase = num5); agent.speed = num5; agent.acceleration = ((brain.Enraged || trackingActive) ? 10f : 4f); agent.stoppingDistance = (Object.op_Implicit((Object)(object)lowTarget) ? 0.07f : ((Object.op_Implicit((Object)(object)visibleTarget) || trackingActive) ? 0.12f : ((flag5 || flag4 || state == State.Panic || state == State.Patrol || state == State.Retreat) ? 0.25f : 1.12f))); if (Mathf.Abs(val.y - position.y) > 0.25f) { agent.stoppingDistance = Mathf.Min(agent.stoppingDistance, 0.12f); } travelRequested = num5 > 0.1f && Vector3.Distance(val, position) > agent.stoppingDistance + 0.2f; if (Time.time >= pathAt) { BuildGroundRoute(position, val); } if (agent.isOnOffMeshLink) { agent.isStopped = true; agent.ResetPath(); return; } Vector3 velocity2 = Vector3.zero; float[] array = new float[Mathf.Max(0, routeCorners.Length - 1)]; for (int i = 0; i < array.Length; i++) { Vector3 val3 = routeCorners[i + 1] - position; float num6 = Mathf.Max(0f, Mathf.Abs(val3.y) - 0.32f); array[i] = Mathf.Sqrt(val3.x * val3.x + val3.z * val3.z + num6 * num6); } int num7 = pathCursor.Advance(array, Mathf.Max(0.02f, agent.stoppingDistance), floorBridge ? 0.24f : 0.22f) + 1; RecordRouteProgress(position, val, num7); if (num7 < routeCorners.Length) { Vector3 val4 = Vector3.ProjectOnPlane(routeCorners[num7] - position, Vector3.up); float num8 = ((num7 == routeCorners.Length - 1) ? agent.stoppingDistance : 0.14f); if (((Vector3)(ref val4)).magnitude > num8) { velocity2 = ((Vector3)(ref val4)).normalized * Mathf.Min(num5, ((Vector3)(ref val4)).magnitude / 0.18f); } } PlayerAvatar val5 = (Object.op_Implicit((Object)(object)visibleTarget) ? visibleTarget : (trackingActive ? LiveTrackingTarget(Time.time) : null)); bool flag6 = Object.op_Implicit((Object)(object)val5) && (state == State.Stalk || state == State.Chase) && PlayerBody.TryFaceAttackFrom(position, physicalBody.rotation, motion, val5, brain.AttackVariant ^ 1, out target); if (flag6) { Vector3 val6 = PlayerBody.Aim(val5); FaceTarget(val6, Time.fixedDeltaTime); Vector3 val7 = Vector3.ProjectOnPlane(val6 - position, Vector3.up); Vector3 normalized = ((Vector3)(ref val7)).normalized; float num9 = Mathf.Min(new float[3] { Mathf.Max(0f, Vector3.Dot(velocity2, normalized)), 1.6f, Mathf.Max(0f, ((Vector3)(ref val7)).magnitude - 0.75f) * 4f }); velocity2 = normalized * num9; travelRequested = false; } velocity2 = GroundSupport.CenterCorridor(position, velocity2); if (enemyAvoidance == null) { enemyAvoidance = new EnemyAvoidance(PhysicsRoot); } velocity2 = enemyAvoidance.Resolve(velocity2, Time.fixedDeltaTime); Vector3 desired = velocity2; velocity2 = cartBypass.Resolve(position, val, velocity2, Time.fixedDeltaTime); if (((Vector3)(ref desired)).sqrMagnitude > 0.01f && ((Vector3)(ref velocity2)).sqrMagnitude < 0.01f && cartBypass.Active) { cartAssistUsed = true; velocity2 = obstacles.ClearCart(desired, Time.fixedDeltaTime); } ObstacleInteractor obstacleInteractor2 = obstacles; Vector3 velocity3 = velocity2; target = Vector3.ProjectOnPlane(physicalBody.linearVelocity, Vector3.up); velocity2 = obstacleInteractor2.LimitCartApproach(velocity3, ((Vector3)(ref target)).magnitude); duck.Plan(velocity2, Time.fixedDeltaTime); agent.height = Mathf.Lerp(2.3f, 1.75f, duck.Weight); if (((Vector3)(ref velocity2)).sqrMagnitude > 0.001f) { if (!flag6) { steering.Plan(position, physicalBody.rotation, ref velocity2, duck.Weight, brain.Enraged || state == State.RoamBurst, Time.fixedDeltaTime, out var rotation); ((Component)this).transform.rotation = rotation; } PlanGroundMotion(position, velocity2); } movementIntent = velocity2; obstacles.Tick(movementIntent, motion.DistanceMoved, Time.fixedDeltaTime, allowed: true); if (Time.time > navLogAt) { navLogAt = Time.time + 3f; Plugin instance = Plugin.Instance; string[] obj = new string[22] { "FLINCH_NAV: state=", state.ToString(), ", corners=", routeCorners.Length.ToString(), ", desired=", ((Vector3)(ref velocity2)).magnitude.ToString("F2"), ", clearance=", motorClearance.ToString("F2"), ", motor=", ((Vector3)(ref motorVelocity)).magnitude.ToString("F2"), ", actual=", null, null, null, null, null, null, null, null, null, null, null }; target = physicalBody.linearVelocity; obj[11] = ((Vector3)(ref target)).magnitude.ToString("F2"); obj[12] = ", kinematic="; obj[13] = physicalBody.isKinematic.ToString(); obj[14] = ", duck="; obj[15] = duck.Weight.ToString("F2"); obj[16] = ", step="; obj[17] = stairRise.ToString("F2"); obj[18] = ", bridge="; obj[19] = floorBridge.ToString(); obj[20] = ", blocker="; obj[21] = obstacles.Description; instance.CombatLog(string.Concat(obj)); } } private void FixedUpdate() { //IL_0116: Unknown result type (might be due to invalid IL or missing references) //IL_0255: Unknown result type (might be due to invalid IL or missing references) //IL_0264: Unknown result type (might be due to invalid IL or missing references) //IL_0269: Unknown result type (might be due to invalid IL or missing references) //IL_0270: Unknown result type (might be due to invalid IL or missing references) //IL_0275: Unknown result type (might be due to invalid IL or missing references) //IL_027a: Unknown result type (might be due to invalid IL or missing references) //IL_027f: Unknown result type (might be due to invalid IL or missing references) //IL_02ab: Unknown result type (might be due to invalid IL or missing references) //IL_029c: Unknown result type (might be due to invalid IL or missing references) //IL_02b8: Unknown result type (might be due to invalid IL or missing references) //IL_02f4: Unknown result type (might be due to invalid IL or missing references) //IL_0348: Unknown result type (might be due to invalid IL or missing references) //IL_0369: Unknown result type (might be due to invalid IL or missing references) //IL_036e: Unknown result type (might be due to invalid IL or missing references) //IL_0376: Unknown result type (might be due to invalid IL or missing references) //IL_0382: Unknown result type (might be due to invalid IL or missing references) //IL_0389: Unknown result type (might be due to invalid IL or missing references) if (!ready || !present || brain == null || !SemiFunc.IsMasterClientOrSingleplayer() || !Plugin.ActiveLevel()) { return; } physical.DisableFollowPosition(0.15f, 10f); physical.DisableFollowRotation(0.15f, 10f); if (Time.time < spawnPoseUntil) { surfaceMotor.Stop(); travelWatch.Reset(); return; } RefreshObservation(); if (OrdinaryGazeStop) { StopForGaze(); return; } gazeAnchored = false; travelRequested = false; cartAssistUsed = false; Navigate(); if (!cartAssistUsed) { obstacles.StopCartAssist(Time.fixedDeltaTime); } bool flag = Fields.Get(physical, "grabbed") && CanLiftNow(); confirmedStall = travelWatch.Tick(K(physicalBody.position), PhysicalTravelAttempt && !RecoveryPaused, Time.fixedDeltaTime); if (confirmedStall) { NativePresenceCycle component = ((Component)parent).GetComponent(); if (component != null && component.TryStuckRecovery()) { confirmedStall = false; travelWatch.Reset(); cartBypass.Reset(); return; } } physicalBody.constraints = (RigidbodyConstraints)((!(deathAt >= 0f || stun.stunTimer > 0f || flag)) ? 80 : 0); if (stun.stunTimer > 0f || flag || deathAt >= 0f || enemy.FreezeTimer > 0f) { return; } physical.DisableFollowPosition(0.1f, 10f); physical.DisableFollowRotation(0.1f, 10f); if (!physicalBody.isKinematic) { Quaternion val = Quaternion.Euler(0f, ((Component)this).transform.eulerAngles.y, 0f); if (Vector3.Dot(physicalBody.rotation * Vector3.up, Vector3.up) < 0.999f) { physicalBody.rotation = val; } else { physicalBody.MoveRotation(val); } physicalBody.angularVelocity = Vector3.zero; if (((Vector3)(ref movementIntent)).sqrMagnitude > 0.04f) { obstacles.Push(); } surfaceMotor.Apply(physicalBody, movementIntent, (brain.State == State.Attack) ? 32 : (brain.Enraged ? 20 : 10), duck.Weight, Time.fixedDeltaTime); if (Time.time < damageBraceUntil && physicalBody.linearVelocity.y > 1.2f) { Vector3 linearVelocity = physicalBody.linearVelocity; physicalBody.linearVelocity = new Vector3(linearVelocity.x, 1.2f, linearVelocity.z); } } } private Vector3 SearchDestination(Vector3 body) { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_0023: Unknown result type (might be due to invalid IL or missing references) //IL_0029: Unknown result type (might be due to invalid IL or missing references) //IL_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_0157: Unknown result type (might be due to invalid IL or missing references) //IL_015c: Unknown result type (might be due to invalid IL or missing references) //IL_04e1: 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_00dc: 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) //IL_01f8: Expected O, but got Unknown //IL_01ff: Unknown result type (might be due to invalid IL or missing references) //IL_0219: Unknown result type (might be due to invalid IL or missing references) //IL_0220: Unknown result type (might be due to invalid IL or missing references) //IL_0231: Unknown result type (might be due to invalid IL or missing references) //IL_0237: Invalid comparison between Unknown and I4 //IL_0344: Unknown result type (might be due to invalid IL or missing references) //IL_0339: Unknown result type (might be due to invalid IL or missing references) //IL_0349: Unknown result type (might be due to invalid IL or missing references) //IL_0274: Unknown result type (might be due to invalid IL or missing references) //IL_0282: Unknown result type (might be due to invalid IL or missing references) //IL_02b0: Unknown result type (might be due to invalid IL or missing references) //IL_02b6: Unknown result type (might be due to invalid IL or missing references) //IL_02d2: Unknown result type (might be due to invalid IL or missing references) //IL_0374: Unknown result type (might be due to invalid IL or missing references) //IL_037a: Unknown result type (might be due to invalid IL or missing references) //IL_037f: Unknown result type (might be due to invalid IL or missing references) //IL_0384: Unknown result type (might be due to invalid IL or missing references) //IL_0389: Unknown result type (might be due to invalid IL or missing references) //IL_038e: Unknown result type (might be due to invalid IL or missing references) //IL_0392: Unknown result type (might be due to invalid IL or missing references) //IL_0397: Unknown result type (might be due to invalid IL or missing references) //IL_03b3: Unknown result type (might be due to invalid IL or missing references) //IL_03b8: Unknown result type (might be due to invalid IL or missing references) //IL_03bd: Unknown result type (might be due to invalid IL or missing references) //IL_04d8: Unknown result type (might be due to invalid IL or missing references) //IL_04dd: Unknown result type (might be due to invalid IL or missing references) //IL_03e4: Unknown result type (might be due to invalid IL or missing references) //IL_03eb: Unknown result type (might be due to invalid IL or missing references) //IL_03f0: Unknown result type (might be due to invalid IL or missing references) //IL_03f5: Unknown result type (might be due to invalid IL or missing references) //IL_03f7: Unknown result type (might be due to invalid IL or missing references) //IL_0401: Unknown result type (might be due to invalid IL or missing references) //IL_0406: Unknown result type (might be due to invalid IL or missing references) //IL_040b: Unknown result type (might be due to invalid IL or missing references) //IL_040d: Unknown result type (might be due to invalid IL or missing references) //IL_0420: Unknown result type (might be due to invalid IL or missing references) //IL_0426: Unknown result type (might be due to invalid IL or missing references) //IL_0431: Unknown result type (might be due to invalid IL or missing references) //IL_0437: Unknown result type (might be due to invalid IL or missing references) //IL_0454: Unknown result type (might be due to invalid IL or missing references) //IL_045b: Expected O, but got Unknown //IL_0461: Unknown result type (might be due to invalid IL or missing references) //IL_0468: Unknown result type (might be due to invalid IL or missing references) //IL_0479: Unknown result type (might be due to invalid IL or missing references) //IL_047f: Invalid comparison between Unknown and I4 //IL_048f: Unknown result type (might be due to invalid IL or missing references) //IL_0494: Unknown result type (might be due to invalid IL or missing references) bool flag = SearchRoute.IsSelected(patrolPointId) && Vector3.Distance(body, patrolPoint) < 0.85f; if (flag) { searchRoute.Visit(patrolPointId, Time.time); patrolAt = 0f; } if (Time.time > lastStuckCheck + 1f) { if (Vector3.Distance(body, searchLastPosition) < 0.15f && !flag) { searchStuckSince += 1f; } else { searchStuckSince = 0f; } lastStuckCheck = Time.time; searchLastPosition = body; if (searchStuckSince > 3f) { if (SearchRoute.IsSelected(patrolPointId)) { searchRoute.Visit(patrolPointId, Time.time); } patrolAt = 0f; searchStuckSince = 0f; } } if (Time.time < patrolAt && SearchRoute.IsSelected(patrolPointId)) { return patrolPoint; } List list = (Object.op_Implicit((Object)(object)LevelGenerator.Instance) ? SemiFunc.LevelPointsGetAll() : null); IEnumerable enumerable = list; LevelPoint[] array = (from p in enumerable ?? Enumerable.Empty() where Object.op_Implicit((Object)(object)p) && !p.Truck && Vector3.Distance(((Component)p).transform.position, body) > 0.7f where brain.State != State.Retreat || Vector3.Distance(((Component)p).transform.position, remembered) > Vector3.Distance(body, remembered) + 2f orderby Vector3.Distance(body, ((Component)p).transform.position) + searchRoute.RecentPenalty(((Object)p).GetInstanceID(), Time.time) select p).Take(24).ToArray(); List list2 = new List(); Dictionary dictionary = new Dictionary(); LevelPoint[] array2 = array; NavMeshHit val3 = default(NavMeshHit); foreach (LevelPoint val in array2) { int instanceID = ((Object)val).GetInstanceID(); NavMeshPath val2 = new NavMeshPath(); if (!NavMesh.SamplePosition(((Component)val).transform.position, ref val3, 2f, -1) || !NavMesh.CalculatePath(agent.nextPosition, ((NavMeshHit)(ref val3)).position, -1, val2) || (int)val2.status > 0) { searchRoute.Visit(instanceID, Time.time); continue; } float num2 = 0f; for (int num3 = 1; num3 < val2.corners.Length; num3++) { num2 += Vector3.Distance(val2.corners[num3 - 1], val2.corners[num3]); } list2.Add(new SearchPoint(instanceID, num2, Vector3.Distance(((NavMeshHit)(ref val3)).position, remembered))); dictionary[instanceID] = ((NavMeshHit)(ref val3)).position; } int num4 = (patrolPointId = searchRoute.Choose(list2, Time.time, snapshot.Encountered && Time.time - lastSeen < 30f)); patrolPoint = (SearchRoute.IsSelected(num4) ? dictionary[num4] : body); if (!SearchRoute.IsSelected(num4) && brain.State == State.Retreat) { Vector3 val4 = Vector3.ProjectOnPlane(body - remembered, Vector3.up); Vector3 val5 = ((Vector3)(ref val4)).normalized; if (((Vector3)(ref val5)).sqrMagnitude < 0.01f) { val5 = -PhysicsRoot.forward; } float[] array3 = new float[5] { 0f, 45f, -45f, 90f, -90f }; NavMeshHit val7 = default(NavMeshHit); foreach (float num6 in array3) { Vector3 val6 = body + Quaternion.AngleAxis(num6, Vector3.up) * val5 * 4f; if (NavMesh.SamplePosition(val6, ref val7, 1.5f, -1) && !(Vector3.Distance(((NavMeshHit)(ref val7)).position, remembered) < Vector3.Distance(body, remembered) + 0.8f)) { NavMeshPath val8 = new NavMeshPath(); if (NavMesh.CalculatePath(agent.nextPosition, ((NavMeshHit)(ref val7)).position, -1, val8) && (int)val8.status <= 0) { patrolPoint = ((NavMeshHit)(ref val7)).position; patrolPointId = int.MinValue; break; } } } } patrolAt = Time.time + (float)((!SearchRoute.IsSelected(patrolPointId)) ? 1 : 14); return patrolPoint; } private bool TryLowHit(int damage) { //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) bool flag = false; foreach (PlayerAvatar item in SemiFunc.PlayerGetList()) { if (WorldQueries.Living(item) && cover.TryKickHit(PlayerBody.Collider(item), brain.StateTime, snapshot.Sequence)) { int viewID = item.photonView.ViewID; if (SemiFunc.IsMultiplayer()) { ((MonoBehaviourPun)this).photonView.RPC("FlinchHitRPC", (RpcTarget)0, new object[3] { viewID, damage, snapshot.Sequence }); } else { FlinchHitRPC(viewID, damage, snapshot.Sequence); } flag = true; } } if (flag) { ImpactSound(snapshot.Sequence); } return flag; } [PunRPC] private void FlinchHitRPC(int victim, int damage, int sequence, PhotonMessageInfo info = default(PhotonMessageInfo)) { //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_0127: Unknown result type (might be due to invalid IL or missing references) //IL_0132: Unknown result type (might be due to invalid IL or missing references) //IL_0137: Unknown result type (might be due to invalid IL or missing references) //IL_013c: Unknown result type (might be due to invalid IL or missing references) //IL_0141: Unknown result type (might be due to invalid IL or missing references) //IL_0146: Unknown result type (might be due to invalid IL or missing references) //IL_014a: Unknown result type (might be due to invalid IL or missing references) //IL_014f: Unknown result type (might be due to invalid IL or missing references) //IL_0153: Unknown result type (might be due to invalid IL or missing references) //IL_015a: Unknown result type (might be due to invalid IL or missing references) //IL_015f: Unknown result type (might be due to invalid IL or missing references) //IL_0169: Unknown result type (might be due to invalid IL or missing references) //IL_016e: Unknown result type (might be due to invalid IL or missing references) if ((SemiFunc.IsMultiplayer() && info.Sender != PhotonNetwork.MasterClient) || sequence < lastHitSequence) { return; } if (sequence > lastHitSequence) { lastHitSequence = sequence; lowHitVictims.Clear(); } if (!lowHitVictims.Add(victim)) { return; } PlayerAvatar val = SemiFunc.PlayerAvatarGetFromPhotonID(victim); if (WorldQueries.Living(val) && Object.op_Implicit((Object)(object)val.playerHealth) && (!SemiFunc.IsMultiplayer() || val.photonView.IsMine)) { val.playerHealth.Hurt(damage, false, SemiFunc.EnemyGetIndex(enemy), false); PlayerTumble val2 = Fields.Get(val, "tumble"); if (Object.op_Implicit((Object)(object)val2) && Fields.Get(val.playerHealth, "health") > 0) { val2.TumbleRequest(true, false); val2.TumbleOverrideTime(0.9f); Vector3 val3 = Vector3.ProjectOnPlane(((Component)val).transform.position - PhysicsRoot.position, Vector3.up); Vector3 normalized = ((Vector3)(ref val3)).normalized; val2.TumbleForce(normalized * 12f + Vector3.up * 1.2f); } } } public void OnPhotonSerializeView(PhotonStream stream, PhotonMessageInfo info) { //IL_0744: Unknown result type (might be due to invalid IL or missing references) //IL_0749: Unknown result type (might be due to invalid IL or missing references) //IL_0751: Unknown result type (might be due to invalid IL or missing references) //IL_0756: Unknown result type (might be due to invalid IL or missing references) //IL_0876: Unknown result type (might be due to invalid IL or missing references) //IL_087b: Unknown result type (might be due to invalid IL or missing references) //IL_0890: Unknown result type (might be due to invalid IL or missing references) //IL_0895: Unknown result type (might be due to invalid IL or missing references) //IL_089d: Unknown result type (might be due to invalid IL or missing references) //IL_08a2: Unknown result type (might be due to invalid IL or missing references) //IL_094a: Unknown result type (might be due to invalid IL or missing references) //IL_094f: Unknown result type (might be due to invalid IL or missing references) //IL_0964: Unknown result type (might be due to invalid IL or missing references) //IL_0969: Unknown result type (might be due to invalid IL or missing references) //IL_097e: Unknown result type (might be due to invalid IL or missing references) //IL_0983: Unknown result type (might be due to invalid IL or missing references) //IL_09d9: Unknown result type (might be due to invalid IL or missing references) //IL_09de: 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_004b: Unknown result type (might be due to invalid IL or missing references) //IL_019f: Unknown result type (might be due to invalid IL or missing references) //IL_01d3: Unknown result type (might be due to invalid IL or missing references) //IL_01e5: Unknown result type (might be due to invalid IL or missing references) //IL_02bf: Unknown result type (might be due to invalid IL or missing references) //IL_0302: Unknown result type (might be due to invalid IL or missing references) //IL_033b: Unknown result type (might be due to invalid IL or missing references) //IL_0a00: Unknown result type (might be due to invalid IL or missing references) //IL_0a05: Unknown result type (might be due to invalid IL or missing references) //IL_0a55: Unknown result type (might be due to invalid IL or missing references) //IL_0408: Unknown result type (might be due to invalid IL or missing references) //IL_0a15: Unknown result type (might be due to invalid IL or missing references) //IL_0a6b: Unknown result type (might be due to invalid IL or missing references) //IL_0a70: Unknown result type (might be due to invalid IL or missing references) //IL_0acb: Unknown result type (might be due to invalid IL or missing references) //IL_0ad0: Unknown result type (might be due to invalid IL or missing references) //IL_0ae5: Unknown result type (might be due to invalid IL or missing references) //IL_0aea: Unknown result type (might be due to invalid IL or missing references) //IL_0aff: Unknown result type (might be due to invalid IL or missing references) //IL_0b04: Unknown result type (might be due to invalid IL or missing references) //IL_0b19: Unknown result type (might be due to invalid IL or missing references) //IL_0b1e: Unknown result type (might be due to invalid IL or missing references) //IL_0b81: Unknown result type (might be due to invalid IL or missing references) //IL_0b86: Unknown result type (might be due to invalid IL or missing references) //IL_0b9b: Unknown result type (might be due to invalid IL or missing references) //IL_0ba0: Unknown result type (might be due to invalid IL or missing references) //IL_0be9: Unknown result type (might be due to invalid IL or missing references) //IL_0bee: Unknown result type (might be due to invalid IL or missing references) //IL_0c29: Unknown result type (might be due to invalid IL or missing references) //IL_044a: Unknown result type (might be due to invalid IL or missing references) //IL_0a83: Unknown result type (might be due to invalid IL or missing references) //IL_0cc4: Unknown result type (might be due to invalid IL or missing references) //IL_0cef: Unknown result type (might be due to invalid IL or missing references) //IL_0d0f: Unknown result type (might be due to invalid IL or missing references) //IL_0d11: Unknown result type (might be due to invalid IL or missing references) //IL_04c3: Unknown result type (might be due to invalid IL or missing references) //IL_04c8: Unknown result type (might be due to invalid IL or missing references) //IL_04cb: Unknown result type (might be due to invalid IL or missing references) //IL_0528: Unknown result type (might be due to invalid IL or missing references) //IL_055c: Unknown result type (might be due to invalid IL or missing references) //IL_0580: Unknown result type (might be due to invalid IL or missing references) //IL_0d80: Unknown result type (might be due to invalid IL or missing references) //IL_0d82: Unknown result type (might be due to invalid IL or missing references) //IL_05d0: Unknown result type (might be due to invalid IL or missing references) //IL_0df8: Unknown result type (might be due to invalid IL or missing references) //IL_0dfa: Unknown result type (might be due to invalid IL or missing references) //IL_0e00: Unknown result type (might be due to invalid IL or missing references) //IL_0e02: Unknown result type (might be due to invalid IL or missing references) //IL_0e38: Unknown result type (might be due to invalid IL or missing references) //IL_0e3a: Unknown result type (might be due to invalid IL or missing references) //IL_0e4e: Unknown result type (might be due to invalid IL or missing references) //IL_0e50: Unknown result type (might be due to invalid IL or missing references) //IL_0e56: Unknown result type (might be due to invalid IL or missing references) //IL_0e58: Unknown result type (might be due to invalid IL or missing references) //IL_0e76: Unknown result type (might be due to invalid IL or missing references) //IL_0e78: Unknown result type (might be due to invalid IL or missing references) //IL_0e95: Unknown result type (might be due to invalid IL or missing references) //IL_0e97: Unknown result type (might be due to invalid IL or missing references) //IL_0ea5: Unknown result type (might be due to invalid IL or missing references) //IL_0ea7: Unknown result type (might be due to invalid IL or missing references) //IL_0633: Unknown result type (might be due to invalid IL or missing references) //IL_065c: Unknown result type (might be due to invalid IL or missing references) //IL_0ecb: Unknown result type (might be due to invalid IL or missing references) //IL_0ecd: Unknown result type (might be due to invalid IL or missing references) //IL_0f08: Unknown result type (might be due to invalid IL or missing references) //IL_0f0a: Unknown result type (might be due to invalid IL or missing references) //IL_0f1d: Unknown result type (might be due to invalid IL or missing references) //IL_0f3c: Unknown result type (might be due to invalid IL or missing references) //IL_0f3e: Unknown result type (might be due to invalid IL or missing references) //IL_06c8: Unknown result type (might be due to invalid IL or missing references) //IL_0f80: Unknown result type (might be due to invalid IL or missing references) //IL_0f82: Unknown result type (might be due to invalid IL or missing references) //IL_0f8b: Unknown result type (might be due to invalid IL or missing references) //IL_0f8d: Unknown result type (might be due to invalid IL or missing references) //IL_0f98: Unknown result type (might be due to invalid IL or missing references) //IL_0f9a: Unknown result type (might be due to invalid IL or missing references) //IL_0fbf: Unknown result type (might be due to invalid IL or missing references) //IL_0fc1: Unknown result type (might be due to invalid IL or missing references) //IL_0fd4: Unknown result type (might be due to invalid IL or missing references) //IL_0fd6: Unknown result type (might be due to invalid IL or missing references) //IL_1004: Unknown result type (might be due to invalid IL or missing references) //IL_1006: Unknown result type (might be due to invalid IL or missing references) if (stream.IsWriting) { BrainSnapshot brainSnapshot = brain.Capture(); stream.SendNext((object)ready); stream.SendNext((object)((Component)this).transform.position); stream.SendNext((object)((Component)this).transform.rotation); stream.SendNext((object)((Object)(object)nearbyObserver != (Object)null)); stream.SendNext((object)(int)brainSnapshot.State); stream.SendNext((object)(int)brainSnapshot.Cause); stream.SendNext((object)brainSnapshot.StateTime); stream.SendNext((object)brainSnapshot.GroupAlarm); stream.SendNext((object)brainSnapshot.SoloAlarm); stream.SendNext((object)brainSnapshot.RageTime); stream.SendNext((object)brainSnapshot.GroupLostTime); stream.SendNext((object)brainSnapshot.RearmRemaining); stream.SendNext((object)brainSnapshot.AttackRemaining); stream.SendNext((object)brainSnapshot.Sequence); stream.SendNext((object)brainSnapshot.AttackDamage); stream.SendNext((object)brainSnapshot.HitSent); stream.SendNext((object)brainSnapshot.Encountered); stream.SendNext((object)Fields.Get(health, "healthCurrent")); stream.SendNext((object)targetId); stream.SendNext((object)gazeTargetId); stream.SendNext((object)gazePoint); stream.SendNext((object)Mathf.Max(0f, gazeUntil - Time.time)); stream.SendNext((object)lowPoint); stream.SendNext((object)attackPoint); stream.SendNext((object)soulValue); stream.SendNext((object)soulSpawned); stream.SendNext((object)brainSnapshot.AttackVariant); stream.SendNext((object)brainSnapshot.CoverFailures); stream.SendNext((object)brainSnapshot.LostSight); stream.SendNext((object)brainSnapshot.RetreatRemaining); stream.SendNext((object)brainSnapshot.ChaseCommitted); stream.SendNext((object)brainSnapshot.WanderClock); stream.SendNext((object)duck.Weight); stream.SendNext((object)knowledge.Id); stream.SendNext((object)V(knowledge.LastSeen)); stream.SendNext((object)Mathf.Max(0f, Time.time - knowledge.SeenAt)); stream.SendNext((object)V(knowledge.CoverPoint)); stream.SendNext((object)Mathf.Max(0f, knowledge.CoverUntil - Time.time)); stream.SendNext((object)remembered); stream.SendNext((object)Mathf.Max(0f, Time.time - lastSeen)); stream.SendNext((object)avoidedTarget); stream.SendNext((object)Mathf.Max(0f, avoidTargetUntil - Time.time)); stream.SendNext((object)((deathAt >= 0f) ? (Time.time - deathAt) : (-1f))); stream.SendNext((object)Mathf.Max(0f, Time.time - knowledge.AnchorAt)); stream.SendNext((object)hasNavAnchor); stream.SendNext((object)navAnchor); KnowledgePoint[] array = groundTrail.Capture(); stream.SendNext((object)array.Length); KnowledgePoint[] array2 = array; foreach (KnowledgePoint p in array2) { stream.SendNext((object)V(p)); } stream.SendNext((object)returningToNav); Vector3[] array3 = (returningToNav ? routeCorners.Skip(pathCursor.Next + 1).ToArray() : Array.Empty()); stream.SendNext((object)array3.Length); Vector3[] array4 = array3; foreach (Vector3 val in array4) { stream.SendNext((object)val); } stream.SendNext((object)present); stream.SendNext((object)((Component)parent).GetComponent().Epoch); stream.SendNext((object)seeking); stream.SendNext((object)seekPoint); stream.SendNext((object)Mathf.Max(0f, searchUntil - Time.time)); stream.SendNext((object)lastTargetNav); stream.SendNext((object)coverApproachKnown); stream.SendNext((object)coverApproachPoint); stream.SendNext((object)((coverLookAt >= 0f) ? (Time.time - coverLookAt) : (-1f))); float[] array5 = sounds.Capture(Time.time); stream.SendNext((object)noisePoint); float[] array6 = array5; foreach (float num in array6) { stream.SendNext((object)num); } stream.SendNext((object)soundScanYaw); stream.SendNext((object)leaving); stream.SendNext((object)leavePoint); stream.SendNext((object)leaveBlocked); stream.SendNext((object)roaming.Goal); float[] array7 = roaming.Capture(); foreach (float num2 in array7) { stream.SendNext((object)num2); } stream.SendNext((object)coverStrikeSequence); stream.SendNext((object)coverStrikeSettled); stream.SendNext((object)coverStrikePoint); stream.SendNext((object)coverKickSide); stream.SendNext((object)coverInspectionOnly); stream.SendNext((object)((Component)parent).GetComponent().RecoverySerial); stream.SendNext((object)brainSnapshot.UnreachableTime); return; } bool flag = (bool)stream.ReceiveNext(); Vector3 val2 = (Vector3)stream.ReceiveNext(); Quaternion val3 = (Quaternion)stream.ReceiveNext(); bool flag2 = (bool)stream.ReceiveNext(); BrainSnapshot brainSnapshot2 = new BrainSnapshot { State = (State)(int)stream.ReceiveNext(), Cause = (RageCause)(int)stream.ReceiveNext(), StateTime = (float)stream.ReceiveNext(), GroupAlarm = (float)stream.ReceiveNext(), SoloAlarm = (float)stream.ReceiveNext(), RageTime = (float)stream.ReceiveNext(), GroupLostTime = (float)stream.ReceiveNext(), RearmRemaining = (float)stream.ReceiveNext(), AttackRemaining = (float)stream.ReceiveNext(), Sequence = (int)stream.ReceiveNext(), AttackDamage = (int)stream.ReceiveNext(), HitSent = (bool)stream.ReceiveNext(), Encountered = (bool)stream.ReceiveNext() }; int num3 = (int)stream.ReceiveNext(); int num4 = (int)stream.ReceiveNext(); int num5 = (int)stream.ReceiveNext(); Vector3 val4 = (Vector3)stream.ReceiveNext(); float num6 = (float)stream.ReceiveNext(); Vector3 val5 = (Vector3)stream.ReceiveNext(); Vector3 val6 = (Vector3)stream.ReceiveNext(); int num7 = (int)stream.ReceiveNext(); bool flag3 = (bool)stream.ReceiveNext(); brainSnapshot2.AttackVariant = (int)stream.ReceiveNext(); brainSnapshot2.CoverFailures = (int)stream.ReceiveNext(); brainSnapshot2.LostSight = (float)stream.ReceiveNext(); brainSnapshot2.RetreatRemaining = (float)stream.ReceiveNext(); brainSnapshot2.ChaseCommitted = (bool)stream.ReceiveNext(); brainSnapshot2.WanderClock = (float)stream.ReceiveNext(); float num8 = (float)stream.ReceiveNext(); int id = (int)stream.ReceiveNext(); Vector3 p2 = (Vector3)stream.ReceiveNext(); float sentAge = (float)stream.ReceiveNext(); Vector3 p3 = (Vector3)stream.ReceiveNext(); float num9 = (float)stream.ReceiveNext(); Vector3 val7 = (Vector3)stream.ReceiveNext(); float sentAge2 = (float)stream.ReceiveNext(); int num10 = (int)stream.ReceiveNext(); float num11 = (float)stream.ReceiveNext(); float num12 = (float)stream.ReceiveNext(); float sentAge3 = (float)stream.ReceiveNext(); bool flag4 = (bool)stream.ReceiveNext(); Vector3 val8 = (Vector3)stream.ReceiveNext(); int num13 = (int)stream.ReceiveNext(); List list = new List(); for (int m = 0; m < num13; m++) { Vector3 p4 = (Vector3)stream.ReceiveNext(); if (m < 64) { list.Add(K(p4)); } } bool flag5 = (bool)stream.ReceiveNext(); int num14 = (int)stream.ReceiveNext(); List list2 = new List { val2 }; for (int n = 0; n < num14; n++) { Vector3 item = (Vector3)stream.ReceiveNext(); if (n < 256) { list2.Add(item); } } bool presence = (bool)stream.ReceiveNext(); int num15 = (int)stream.ReceiveNext(); bool flag6 = (bool)stream.ReceiveNext(); Vector3 val9 = (Vector3)stream.ReceiveNext(); float num16 = (float)stream.ReceiveNext(); Vector3 val10 = (Vector3)stream.ReceiveNext(); bool flag7 = (bool)stream.ReceiveNext(); Vector3 val11 = (Vector3)stream.ReceiveNext(); float num17 = (float)stream.ReceiveNext(); Vector3 val12 = (Vector3)stream.ReceiveNext(); float active = (float)stream.ReceiveNext(); float num18 = (float)stream.ReceiveNext(); float strength = (float)stream.ReceiveNext(); float blocked = (float)stream.ReceiveNext(); float search = (float)stream.ReceiveNext(); float num19 = (float)stream.ReceiveNext(); bool flag8 = (bool)stream.ReceiveNext(); Vector3 val13 = (Vector3)stream.ReceiveNext(); float num20 = (float)stream.ReceiveNext(); Vector3 goal = (Vector3)stream.ReceiveNext(); float selected = (float)stream.ReceiveNext(); float idle = (float)stream.ReceiveNext(); float blocked2 = (float)stream.ReceiveNext(); int num21 = (int)stream.ReceiveNext(); bool flag9 = (bool)stream.ReceiveNext(); Vector3 val14 = (Vector3)stream.ReceiveNext(); int num22 = (int)stream.ReceiveNext(); bool flag10 = (bool)stream.ReceiveNext(); int num23 = (int)stream.ReceiveNext(); brainSnapshot2.UnreachableTime = (float)stream.ReceiveNext(); if (info.Sender != PhotonNetwork.MasterClient) { return; } NativePresenceCycle component = ((Component)parent).GetComponent(); if (num15 < component.Epoch || num23 < component.RecoverySerial) { return; } float num24 = (float)Math.Max(0.0, PhotonNetwork.Time - ((PhotonMessageInfo)(ref info)).SentServerTime); duck.Weight = Mathf.Clamp01(num8); duck.ApplyColliders(); knowledge.Id = id; knowledge.LastSeen = K(p2); knowledge.SeenAt = TargetKnowledge.ObservationTime(Time.time, sentAge, num24); knowledge.CoverPoint = K(p3); knowledge.CoverUntil = Time.time + num9; remembered = val7; lastSeen = TargetKnowledge.ObservationTime(Time.time, sentAge2, num24); avoidedTarget = num10; avoidTargetUntil = Time.time + num11; deathAt = ((num12 >= 0f) ? (Time.time - num12) : (-1f)); knowledge.AnchorAt = TargetKnowledge.ObservationTime(Time.time, sentAge3, num24); hasNavAnchor = flag4; navAnchor = val8; groundTrail.Restore(list); returningToNav = (freezeGroundTrail = flag5); routeCorners = (flag5 ? list2.ToArray() : Array.Empty()); pathCursor.Reset(); floorBridge = flag5; snapshot = brainSnapshot2; brain.Restore(brainSnapshot2); displayPhase = brainSnapshot2.StateTime; networkPosition = val2; networkRotation = val3; peerProximityTurn = flag2; targetId = num4; Fields.Set(health, "healthCurrent", num3); gazeTargetId = num5; gazePoint = val4; gazeUntil = Time.time + num6; lowPoint = val5; attackPoint = val6; soulValue = num7; soulSpawned = flag3; seeking = flag6; seekPoint = val9; searchUntil = Time.time + num16; SetPresence(presence); lastTargetNav = val10; coverApproachKnown = flag7; coverApproachPoint = val11; coverLookAt = ((num17 >= 0f) ? (Time.time - num17) : (-1f)); noisePoint = val12; sounds.Restore(Time.time, active, num18 + num24, strength, blocked, search); soundScanYaw = num19; soundRouteKnown = false; leaving = flag8; leavePoint = val13; leaveBlocked = num20; roaming.Restore(goal, selected, idle, blocked2); coverStrikeSequence = num21; coverStrikeSettled = flag9; coverStrikePoint = val14; coverKickSide = ((num22 != 0) ? 1 : 0); coverInspectionOnly = flag10; if (receivedPresenceEpoch != num15) { receivedPresenceEpoch = num15; ((Component)physical).transform.SetPositionAndRotation(val2, val3); previousPhysicalPosition = val2; ((Component)this).transform.SetPositionAndRotation(val2, val3); } if (!ready && flag) { ((Component)this).transform.SetPositionAndRotation(val2, val3); ((Component)physical).transform.SetPositionAndRotation(val2, val3); ((Component)physical).gameObject.SetActive(true); grab.spawned = true; ready = true; previousPhysicalPosition = val2; SetVisual(snapshot.State != State.Dead); if (snapshot.State == State.Dead) { HideDeadBody(); } } } public override void OnMasterClientSwitched(Player player) { //IL_00e8: Unknown result type (might be due to invalid IL or missing references) //IL_00cc: Unknown result type (might be due to invalid IL or missing references) //IL_00c4: Unknown result type (might be due to invalid IL or missing references) ((MonoBehaviourPunCallbacks)this).OnMasterClientSwitched(player); if (player == PhotonNetwork.LocalPlayer && ready) { brain.Restore(snapshot); lastMoveState = snapshot.State; soundRouteKnown = false; Fields.Set(grab, "isMaster", true); Fields.Set(enemy, "MasterClient", true); physicalBody.isKinematic = !present; ((Behaviour)agent).enabled = present; if (present) { agent.Warp(hasNavAnchor ? navAnchor : ((Component)physical).transform.position); } ((Component)this).transform.position = ((Component)physical).transform.position; visibleTarget = null; } } private void Remove() { if (SemiFunc.IsMultiplayer()) { PhotonNetwork.Destroy(((Component)parent).gameObject); } else { Object.Destroy((Object)(object)((Component)parent).gameObject); } } private void OnDestroy() { Actors.Remove(this); if ((Object)(object)Live == (Object)(object)this) { Live = null; } if (registered && Object.op_Implicit((Object)(object)EnemyDirector.instance)) { Fields.Get>(EnemyDirector.instance, "enemiesSpawned").Remove(parent); } } private void OnGUI() { //IL_0036: Unknown result type (might be due to invalid IL or missing references) if (Plugin.DebugOverlay.Value && ready) { GUI.Box(new Rect(16f, 120f, 350f, 100f), string.Format("FLINCH 0.1.21 — {0}\nHP {1} | visible {2}\nGroup {3:F1}s | solo {4:F1}s\nU: test spawn | lift: Strength {5}", snapshot.State, Fields.Get(health, "healthCurrent"), visibleCount, snapshot.GroupAlarm, snapshot.SoloAlarm, Plugin.MinimumLiftStrength.Value)); } } private void RecordRouteProgress(Vector3 body, Vector3 destination, int corner) { //IL_0077: Unknown result type (might be due to invalid IL or missing references) //IL_007f: 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_005e: 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_00a6: Unknown result type (might be due to invalid IL or missing references) //IL_00d8: Unknown result type (might be due to invalid IL or missing references) //IL_00da: Unknown result type (might be due to invalid IL or missing references) //IL_0107: Unknown result type (might be due to invalid IL or missing references) //IL_0108: 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_010f: 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_012e: Unknown result type (might be due to invalid IL or missing references) //IL_0152: Unknown result type (might be due to invalid IL or missing references) //IL_0153: Unknown result type (might be due to invalid IL or missing references) if (brain.Enraged && knowledge.Id >= 0 && (Object.op_Implicit((Object)(object)visibleTarget) || Object.op_Implicit((Object)(object)lowTarget) || TrackingActive) && corner < routeCorners.Length && !(Vector3.Distance(routeCorners[routeCorners.Length - 1], destination) > 0.65f)) { float num = Vector3.Distance(body, routeCorners[corner]); for (int i = corner + 1; i < routeCorners.Length; i++) { num += Vector3.Distance(routeCorners[i - 1], routeCorners[i]); } if (progressTarget != knowledge.Id || Vector3.Distance(destination, progressGoal) > 1f) { progressTarget = knowledge.Id; progressGoal = destination; progressBody = body; bestRouteDistance = num; } else if (!(num > bestRouteDistance - 0.45f) && !(Vector3.Distance(body, progressBody) < 0.35f)) { bestRouteDistance = num; progressBody = body; progressUntil = Time.time + 1.1f; } } } private bool CanFaceTarget(Vector3 body, Vector3 target) { //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) //IL_0008: 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_0021: Unknown result type (might be due to invalid IL or missing references) //IL_0022: Unknown result type (might be due to invalid IL or missing references) //IL_0023: Unknown result type (might be due to invalid IL or missing references) Vector3 val = Vector3.ProjectOnPlane(target - body, Vector3.up); return ((Vector3)(ref val)).sqrMagnitude < 0.01f || WallSafety.ClearStepPose(body, Quaternion.LookRotation(val)); } public void FaceTarget(Vector3 target, float dt) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_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_0017: Unknown result type (might be due to invalid IL or missing references) //IL_001c: Unknown result type (might be due to invalid IL or missing references) //IL_0041: Unknown result type (might be due to invalid IL or missing references) //IL_0046: Unknown result type (might be due to invalid IL or missing references) //IL_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) //IL_008a: Unknown result type (might be due to invalid IL or missing references) Vector3 val = Vector3.ProjectOnPlane(target - physicalBody.position, Vector3.up); if (!(((Vector3)(ref val)).sqrMagnitude < 0.01f) && !(dt <= 0f)) { Vector3 velocity = ((Vector3)(ref val)).normalized; steering.Plan(physicalBody.position, physicalBody.rotation, ref velocity, duck.Weight, brain.Enraged, dt, out var rotation); ((Component)this).transform.rotation = rotation; } } private Vector3 VisiblePursuitDestination(Vector3 body) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0008: Unknown result type (might be due to invalid IL or missing references) return PursuitDestination(body, visibleTarget); } private bool CanStartMovingStrike(PlayerAvatar player, int variant, out Vector3 point) { //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_0013: 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_0019: 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_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) //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_0057: Unknown result type (might be due to invalid IL or missing references) //IL_005c: Unknown result type (might be due to invalid IL or missing references) //IL_006b: Unknown result type (might be due to invalid IL or missing references) //IL_006c: Unknown result type (might be due to invalid IL or missing references) //IL_0071: Unknown result type (might be due to invalid IL or missing references) //IL_0078: Unknown result type (might be due to invalid IL or missing references) //IL_0089: 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) Vector3 position = PhysicsRoot.position; Quaternion rotation = PhysicsRoot.rotation; if (PlayerBody.TryAttackFrom(position, rotation, motion, player, variant, out point)) { return true; } if (!WorldQueries.Living(player)) { return false; } Vector3 val = Vector3.ProjectOnPlane(PlayerBody.Aim(player) - position, Vector3.up); return ((Vector3)(ref val)).sqrMagnitude > 0.01f && Vector3.Dot(rotation * Vector3.forward, ((Vector3)(ref val)).normalized) > 0.63f && PlayerBody.TryFaceAttackFrom(position, rotation, motion, player, variant, out point); } private Vector3 TrackingDestination(Vector3 body) { //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) //IL_0016: 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_0028: Unknown result type (might be due to invalid IL or missing references) PlayerAvatar val = LiveTrackingTarget(Time.time); return Object.op_Implicit((Object)(object)val) ? PursuitDestination(body, val) : remembered; } private Vector3 PursuitDestination(Vector3 body, PlayerAvatar player) { //IL_000f: 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_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_0030: Unknown result type (might be due to invalid IL or missing references) //IL_0031: Unknown result type (might be due to invalid IL or missing references) //IL_021b: 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_00c5: Unknown result type (might be due to invalid IL or missing references) //IL_00ca: Unknown result type (might be due to invalid IL or missing references) //IL_008b: Unknown result type (might be due to invalid IL or missing references) //IL_0092: Expected O, but got Unknown //IL_0093: 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_0075: 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: Invalid comparison between Unknown and I4 //IL_00ea: 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_00b7: Unknown result type (might be due to invalid IL or missing references) //IL_00bc: Unknown result type (might be due to invalid IL or missing references) //IL_0127: 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_0158: Unknown result type (might be due to invalid IL or missing references) //IL_015a: Unknown result type (might be due to invalid IL or missing references) //IL_0171: Unknown result type (might be due to invalid IL or missing references) //IL_0178: 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_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_01cb: Unknown result type (might be due to invalid IL or missing references) //IL_01cd: 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_01e3: Unknown result type (might be due to invalid IL or missing references) //IL_01e5: Unknown result type (might be due to invalid IL or missing references) //IL_01f8: Unknown result type (might be due to invalid IL or missing references) //IL_01fa: Unknown result type (might be due to invalid IL or missing references) //IL_0216: Unknown result type (might be due to invalid IL or missing references) //IL_0217: Unknown result type (might be due to invalid IL or missing references) //IL_0210: Unknown result type (might be due to invalid IL or missing references) //IL_0212: Unknown result type (might be due to invalid IL or missing references) int num = brain.AttackVariant ^ 1; if (PlayerBody.TryFaceAttackFrom(body, physicalBody.rotation, motion, player, num, out var target)) { return body; } Vector3 position = ((Component)player).transform.position; if (position.y < body.y - 0.6f && hasNavAnchor && GroundSupport.Floor(position, 0.12f, 4f, out var floor) && GroundSupport.NavProjection(floor.Position, out var nav)) { NavMeshPath val = new NavMeshPath(); if (NavMesh.CalculatePath(navAnchor, nav, -1, val) && (int)val.status == 0) { return floor.Position; } } Vector3 val2 = PlayerBody.Aim(player); int instanceID = ((Object)player).GetInstanceID(); bool flag = Time.time >= pursuitPlanAt && (!pursuitPlanned || !PlayerBody.TryFaceAttackFrom(pursuitStance, physicalBody.rotation, motion, player, num, out target)); if (instanceID != pursuitId || pursuitVariant != num || Vector3.Distance(val2, pursuitTarget) > 0.55f || flag) { pursuitId = instanceID; pursuitVariant = num; pursuitTarget = val2; pursuitPlanAt = Time.time + 0.45f; pursuitPlanned = PursuitApproach.TryFindForVariant(body, physicalBody.rotation, motion, player, num, out pursuitStance); pathAt = 0f; } if (pursuitPlanned) { return pursuitStance; } if (GroundSupport.NavProjection(((Component)player).transform.position, out var nav2) && Vector3.Distance(nav2, body) > 0.25f) { return nav2; } if (GroundSupport.NavProjection(lastTargetNav, out var nav3) && Vector3.Distance(nav3, body) > 0.4f) { return nav3; } return body; } private void TrackGround(Vector3 body) { //IL_0002: 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_002e: 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_0085: Unknown result type (might be due to invalid IL or missing references) onNavSurface = GroundSupport.NavProjection(body, out var nav); if (onNavSurface) { navAnchor = nav; hasNavAnchor = true; agent.nextPosition = nav; groundTrail.Record(K(body), onNavigationSurface: true); if (returningToNav) { pathAt = 0f; } returningToNav = (freezeGroundTrail = false); } else if (!freezeGroundTrail) { groundTrail.Record(K(body), onNavigationSurface: false); } } private bool BuildGroundRoute(Vector3 body, Vector3 destination) { //IL_0045: 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: Expected O, but got Unknown //IL_005d: 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_0065: 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_0087: Invalid comparison between Unknown and I4 //IL_00b8: 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_00c0: Unknown result type (might be due to invalid IL or missing references) //IL_00e2: Unknown result type (might be due to invalid IL or missing references) //IL_014f: Unknown result type (might be due to invalid IL or missing references) //IL_0158: Unknown result type (might be due to invalid IL or missing references) //IL_0159: Unknown result type (might be due to invalid IL or missing references) //IL_0165: Unknown result type (might be due to invalid IL or missing references) //IL_0188: Unknown result type (might be due to invalid IL or missing references) //IL_018d: Unknown result type (might be due to invalid IL or missing references) //IL_018f: Unknown result type (might be due to invalid IL or missing references) //IL_0191: Unknown result type (might be due to invalid IL or missing references) //IL_01a7: Unknown result type (might be due to invalid IL or missing references) //IL_01a9: 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_01de: 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) if (returningToNav && !onNavSurface && routeCorners.Length > 1) { return true; } pathAt = Time.time + 0.35f; floorBridge = false; Vector3 nav; bool flag = GroundSupport.NavProjection(destination, out nav); NavMeshPath val = new NavMeshPath(); bool flag2 = hasNavAnchor && NavMesh.CalculatePath(navAnchor, flag ? nav : destination, -1, val); if (onNavSurface && flag && flag2 && (int)val.status == 0) { routeCorners = PhysicalPath.Widen(val.corners); pathCursor.Reset(); return true; } if (FloorBridge.Route(body, destination, PhysicsRoot.rotation, out Vector3[] corners, out bool crouch) && Mathf.Abs(corners[^1].y - destination.y) < 0.45f) { routeCorners = corners; floorBridge = true; pathCursor.Reset(); if (crouch) { duck.Request(); } return true; } if (!onNavSurface) { List list = new List { body }; Vector3 val2 = body; bool flag3 = true; KnowledgePoint[] array = groundTrail.Backtrack(K(body)); foreach (KnowledgePoint p in array) { Vector3 val3 = V(p); if (!(Vector3.Distance(val2, val3) < 0.16f)) { if (!FloorBridge.Route(val2, val3, PhysicsRoot.rotation, out Vector3[] corners2, out bool crouch2)) { flag3 = false; break; } list.AddRange(corners2.Skip(1)); val2 = val3; if (crouch2) { duck.Request(); } } } if (flag3 && list.Count > 1) { if (flag2) { list.AddRange(val.corners.Skip(1)); } routeCorners = list.ToArray(); pathCursor.Reset(); floorBridge = true; returningToNav = (freezeGroundTrail = true); return true; } } if (onNavSurface && flag2 && val.corners.Length > 1) { routeCorners = val.corners; pathCursor.Reset(); return true; } routeCorners = Array.Empty(); patrolAt = 0f; return false; } private void PlanGroundMotion(Vector3 body, Vector3 velocity) { //IL_0007: 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_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) surfaceMotor.Plan(body, physicalBody.rotation, velocity, duck.Weight, Time.fixedDeltaTime); motorVelocity = surfaceMotor.motorVelocity; motorClearance = surfaceMotor.motorClearance; stairRise = surfaceMotor.stairRise; } public void Hear(Vector3 point, float radius) { //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_007d: 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_00a2: 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_00ad: Unknown result type (might be due to invalid IL or missing references) //IL_00b2: Unknown result type (might be due to invalid IL or missing references) //IL_00b7: 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_00b9: 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_00c0: 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_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_00dc: 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_00f1: 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_00fb: 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_0132: Unknown result type (might be due to invalid IL or missing references) if (!ready || !present || Dying || brain == null || brain.State == State.Dead || Object.op_Implicit((Object)(object)visibleTarget) || Object.op_Implicit((Object)(object)lowTarget) || !SemiFunc.IsMasterClientOrSingleplayer() || Time.time < obstacles.OwnNoiseUntil) { return; } Vector3 position = PhysicsRoot.position; float num = Vector3.Distance(position, point); if (!float.IsNaN(num) && !(num >= radius)) { Vector3 val = position + Vector3.up * 0.9f; bool occluded = !WorldQueries.Clear(val, Vector3.MoveTowards(point, val, 0.08f)); Vector3 val2 = point - noisePoint; int num2; if (Mathf.Abs(val2.y) < 0.55f) { Vector3 val3 = Vector3.ProjectOnPlane(val2, Vector3.up); num2 = ((((Vector3)(ref val3)).sqrMagnitude < 0.5625f) ? 1 : 0); } else { num2 = 0; } bool sameSource = (byte)num2 != 0; if (sounds.Hear(num, radius, occluded, Time.time, sameSource)) { noisePoint = point; soundRouteKnown = false; pathAt = (patrolAt = 0f); } } } private bool TrySoundInvestigation(Vector3 body, out Vector3 destination) { //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) //IL_00a1: Unknown result type (might be due to invalid IL or missing references) //IL_00a6: Unknown result type (might be due to invalid IL or missing references) //IL_00a7: Unknown result type (might be due to invalid IL or missing references) //IL_00ac: 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_00ae: Unknown result type (might be due to invalid IL or missing references) //IL_00b3: Unknown result type (might be due to invalid IL or missing references) //IL_00b8: 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_004d: 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_0064: 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_00d3: Unknown result type (might be due to invalid IL or missing references) //IL_00d4: Unknown result type (might be due to invalid IL or missing references) //IL_00de: Unknown result type (might be due to invalid IL or missing references) //IL_00e3: Unknown result type (might be due to invalid IL or missing references) //IL_00e9: Unknown result type (might be due to invalid IL or missing references) //IL_00ee: Unknown result type (might be due to invalid IL or missing references) //IL_00f8: Unknown result type (might be due to invalid IL or missing references) //IL_00fd: 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) //IL_01c0: Unknown result type (might be due to invalid IL or missing references) //IL_01c5: Unknown result type (might be due to invalid IL or missing references) //IL_01a6: Unknown result type (might be due to invalid IL or missing references) //IL_01ab: 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) destination = body; if (!sounds.Active(Time.time)) { return false; } bool searching = sounds.Searching; if (!searching && !soundRouteKnown) { if (!TryFindSoundDestination(body, navAnchor, hasNavAnchor, PhysicsRoot.rotation, noisePoint, out soundDestination)) { EndSoundInvestigation(); return false; } soundRouteKnown = true; pathAt = 0f; } Vector3 val = soundDestination - body; Vector3 val2 = Vector3.ProjectOnPlane(val, Vector3.up); float horizontalDistance = ((Vector3)(ref val2)).magnitude; if (!searching && SoundMemory.WithinArrival(horizontalDistance, val.y) && !WorldQueries.Clear(body + Vector3.up * 0.25f, soundDestination + Vector3.up * 0.25f)) { horizontalDistance = float.PositiveInfinity; } bool blocked = !RecoveryPaused && !obstacles.Clearing && Fields.Get(physical, "notMovingTimer") > 2f; sounds.Tick(Time.fixedDeltaTime, horizontalDistance, val.y, blocked); if (!sounds.Active(Time.time)) { EndSoundInvestigation(); return false; } if (!searching && sounds.Searching) { Quaternion rotation = physicalBody.rotation; soundScanYaw = ((Quaternion)(ref rotation)).eulerAngles.y; } destination = soundDestination; return true; } private void EndSoundInvestigation() { sounds.Clear(); soundRouteKnown = false; pathAt = (patrolAt = 0f); roaming.ChangeRoute(); } private bool ScanSoundSource(Vector3 body) { //IL_0054: 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_00af: 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_00be: Unknown result type (might be due to invalid IL or missing references) if (!sounds.Searching) { return false; } travelRequested = false; agent.isStopped = true; physical.positionSpeedIdle = (physical.positionSpeedChase = 0f); obstacles.Tick(Vector3.zero, 0f, Time.fixedDeltaTime, allowed: false); float num = 1f - sounds.SearchRemaining / 2.5f; float num2 = soundScanYaw + Mathf.Sin(num * MathF.PI * 2f) * 58f; FaceTarget(body + Quaternion.Euler(0f, num2, 0f) * Vector3.forward, Time.fixedDeltaTime); return true; } internal static bool TryFindSoundDestination(Vector3 body, Vector3 anchor, bool hasAnchor, Quaternion rotation, Vector3 source, out Vector3 destination) { //IL_0003: Unknown result type (might be due to invalid IL or missing references) //IL_0009: Unknown result type (might be due to invalid IL or missing references) //IL_00e2: Unknown result type (might be due to invalid IL or missing references) //IL_00fd: Unknown result type (might be due to invalid IL or missing references) //IL_0103: Expected O, but got Unknown //IL_0104: 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_010b: Unknown result type (might be due to invalid IL or missing references) //IL_010c: Unknown result type (might be due to invalid IL or missing references) //IL_00f8: Unknown result type (might be due to invalid IL or missing references) //IL_00f9: Unknown result type (might be due to invalid IL or missing references) //IL_004d: 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_0058: 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_007a: Unknown result type (might be due to invalid IL or missing references) //IL_007f: 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) //IL_0149: Unknown result type (might be due to invalid IL or missing references) //IL_0152: Unknown result type (might be due to invalid IL or missing references) //IL_0157: Unknown result type (might be due to invalid IL or missing references) //IL_0159: Unknown result type (might be due to invalid IL or missing references) //IL_015c: Unknown result type (might be due to invalid IL or missing references) //IL_015d: Unknown result type (might be due to invalid IL or missing references) //IL_015e: Unknown result type (might be due to invalid IL or missing references) //IL_0173: 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_017b: Unknown result type (might be due to invalid IL or missing references) //IL_0180: Unknown result type (might be due to invalid IL or missing references) //IL_01a2: Unknown result type (might be due to invalid IL or missing references) //IL_01a4: Unknown result type (might be due to invalid IL or missing references) //IL_0205: Unknown result type (might be due to invalid IL or missing references) //IL_020e: Unknown result type (might be due to invalid IL or missing references) //IL_0213: Unknown result type (might be due to invalid IL or missing references) //IL_0215: Unknown result type (might be due to invalid IL or missing references) //IL_0237: Unknown result type (might be due to invalid IL or missing references) //IL_0243: Unknown result type (might be due to invalid IL or missing references) //IL_0271: Unknown result type (might be due to invalid IL or missing references) //IL_0276: Unknown result type (might be due to invalid IL or missing references) //IL_027c: Unknown result type (might be due to invalid IL or missing references) //IL_028d: Unknown result type (might be due to invalid IL or missing references) //IL_0291: 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_02a4: 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_02a6: Unknown result type (might be due to invalid IL or missing references) //IL_02bb: Unknown result type (might be due to invalid IL or missing references) //IL_02be: Unknown result type (might be due to invalid IL or missing references) //IL_02c3: Unknown result type (might be due to invalid IL or missing references) //IL_02c8: Unknown result type (might be due to invalid IL or missing references) //IL_02ea: Unknown result type (might be due to invalid IL or missing references) //IL_02ec: Unknown result type (might be due to invalid IL or missing references) destination = default(Vector3); Vector3 val; if (!GroundSupport.Floor(source, 0.16f, 3.5f, out var floor)) { float num = float.PositiveInfinity; float[] soundProbeRadii = SoundProbeRadii; foreach (float distance in soundProbeRadii) { for (int j = 0; j < 8; j++) { Vector3 point = SoundProbe(source, distance, j); if (GroundSupport.Floor(point, 0.16f, 3.5f, out var floor2)) { val = floor2.Position - source; float sqrMagnitude = ((Vector3)(ref val)).sqrMagnitude; if (!(sqrMagnitude >= num)) { num = sqrMagnitude; floor = floor2; } } } } if (float.IsPositiveInfinity(num)) { return false; } } Vector3 nav; bool flag = GroundSupport.NavProjection(body, out nav); if (!flag && hasAnchor) { nav = anchor; flag = true; } NavMeshPath path = new NavMeshPath(); if (SoundStance(floor.Position, floor, body, rotation, nav, flag, path, out destination)) { return true; } float num2 = float.PositiveInfinity; float[] soundProbeRadii2 = SoundProbeRadii; foreach (float distance2 in soundProbeRadii2) { for (int l = 0; l < 8; l++) { Vector3 probe = SoundProbe(floor.Position, distance2, l); if (SoundStance(probe, floor, body, rotation, nav, flag, path, out var stance)) { val = stance - floor.Position; float sqrMagnitude2 = ((Vector3)(ref val)).sqrMagnitude; if (!(sqrMagnitude2 >= num2)) { num2 = sqrMagnitude2; destination = stance; } } } } if (!float.IsPositiveInfinity(num2)) { return true; } float[] soundProbeRadii3 = SoundProbeRadii; foreach (float distance3 in soundProbeRadii3) { for (int n = 0; n < 8; n++) { Vector3 point2 = SoundProbe(floor.Position, distance3, n); if (!GroundSupport.Floor(point2, 0.12f, 1.35f, out var floor3)) { continue; } float num3 = floor.Position.y - floor3.Position.y; if (num3 <= 0.4f || num3 > 1.35f) { continue; } Vector3 position = floor.Position; position.y = floor3.Position.y; if (SoundStance(sourceFloor: new GroundPoint(position, floor3.Normal), probe: floor3.Position, body: body, rotation: rotation, start: nav, hasStart: flag, path: path, stance: out var stance2)) { val = stance2 - floor.Position; float sqrMagnitude3 = ((Vector3)(ref val)).sqrMagnitude; if (!(sqrMagnitude3 >= num2)) { num2 = sqrMagnitude3; destination = stance2; } } } } return !float.IsPositiveInfinity(num2); } private static Vector3 SoundProbe(Vector3 point, float distance, int direction) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0010: Unknown result type (might be due to invalid IL or missing references) //IL_0015: Unknown result type (might be due to invalid IL or missing references) //IL_001a: 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_0025: Unknown result type (might be due to invalid IL or missing references) return point + Quaternion.Euler(0f, (float)(direction * 45), 0f) * Vector3.forward * distance; } private static bool SoundStance(Vector3 probe, GroundPoint sourceFloor, Vector3 body, Quaternion rotation, Vector3 start, bool hasStart, NavMeshPath path, out Vector3 stance) { //IL_0003: Unknown result type (might be due to invalid IL or missing references) //IL_0009: 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_0029: 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_0057: 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_005e: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_006d: Unknown result type (might be due to invalid IL or missing references) //IL_0072: Unknown result type (might be due to invalid IL or missing references) //IL_0073: 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_007e: 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_0088: 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_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_00a0: 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_00d1: 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_0149: Unknown result type (might be due to invalid IL or missing references) //IL_014a: Unknown result type (might be due to invalid IL or missing references) //IL_014b: Unknown result type (might be due to invalid IL or missing references) //IL_013a: 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_00f2: Unknown result type (might be due to invalid IL or missing references) //IL_00fd: Unknown result type (might be due to invalid IL or missing references) //IL_0169: 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_0116: Unknown result type (might be due to invalid IL or missing references) //IL_0124: Unknown result type (might be due to invalid IL or missing references) //IL_012a: Invalid comparison between Unknown and I4 //IL_018c: Unknown result type (might be due to invalid IL or missing references) //IL_018d: Unknown result type (might be due to invalid IL or missing references) stance = default(Vector3); if (!GroundSupport.Floor(probe, 0.3f, 0.38f, out var floor) || Mathf.Abs(floor.Position.y - sourceFloor.Position.y) > 0.4f) { return false; } Vector3 position = floor.Position; Vector3 val = sourceFloor.Position + Vector3.up * 0.25f; Vector3 val2 = position + Vector3.up * 0.25f; Vector3 val3 = val - val2; if (((Vector3)(ref val3)).magnitude > 0.35f && WorldQueries.Raycast(val2, ((Vector3)(ref val3)).normalized, ((Vector3)(ref val3)).magnitude - 0.35f, out var _)) { return false; } if (hasStart && GroundSupport.NavProjection(position, out var nav) && GroundSupport.Floor(nav, 0.34f, 0.4f, out var floor2) && Mathf.Abs(floor2.Position.y - sourceFloor.Position.y) <= 0.4f && NavMesh.CalculatePath(start, nav, -1, path) && (int)path.status == 0) { stance = floor2.Position; return true; } if (!FloorBridge.Route(body, position, rotation, out Vector3[] corners, out bool _) || Mathf.Abs(corners[^1].y - position.y) > 0.25f) { return false; } stance = position; return true; } private static KnowledgePoint K(Vector3 p) { //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_000c: Unknown result type (might be due to invalid IL or missing references) return new KnowledgePoint(p.x, p.y, p.z); } private static Vector3 V(KnowledgePoint p) { //IL_0012: Unknown result type (might be due to invalid IL or missing references) return new Vector3(p.X, p.Y, p.Z); } private bool TrackingActiveAt(float now) { return !Object.op_Implicit((Object)(object)visibleTarget) && knowledge.TrackingActive(now) && WorldQueries.Living(SemiFunc.PlayerAvatarGetFromPhotonID(knowledge.Id)); } private PlayerAvatar LiveTrackingTarget(float now) { if (!TrackingActiveAt(now)) { return null; } PlayerAvatar val = SemiFunc.PlayerAvatarGetFromPhotonID(knowledge.Id); return CoverReach.Hidden(val) ? null : val; } private bool UpdateTracking(float now) { //IL_0038: 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_005c: Unknown result type (might be due to invalid IL or missing references) //IL_0061: Unknown result type (might be due to invalid IL or missing references) //IL_0066: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_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_00b5: 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) if (!TrackingActiveAt(now)) { return false; } PlayerAvatar val = LiveTrackingTarget(now); if (Object.op_Implicit((Object)(object)val) && knowledge.UpdateTracking(knowledge.Id, K(CoverReach.Point(val)), now)) { Vector3 val2 = ((Component)val).transform.position - remembered; if (Mathf.Abs(val2.y) > 0.18f || ((Vector3)(ref val2)).sqrMagnitude > 0.122499995f) { pathAt = 0f; } remembered = ((Component)val).transform.position; lastTargetNav = Fields.Get(val, "LastNavmeshPosition"); encounterTarget = val; } seeking = false; leaving = false; return true; } public void BeginIncomingHit(PlayerAvatar source) { incomingHitDepth++; pendingAggressor = source; pendingUntil = Time.time + 0.1f; } public void EndIncomingHit() { incomingHitDepth = Mathf.Max(0, incomingHitDepth - 1); } private bool RememberContact(PlayerAvatar player, bool physicalTouch = false) { //IL_0030: 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_004b: Unknown result type (might be due to invalid IL or missing references) //IL_0050: Unknown result type (might be due to invalid IL or missing references) //IL_0081: 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_009e: 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_016c: Unknown result type (might be due to invalid IL or missing references) //IL_014e: Unknown result type (might be due to invalid IL or missing references) //IL_0128: Unknown result type (might be due to invalid IL or missing references) //IL_0116: Unknown result type (might be due to invalid IL or missing references) //IL_018a: Unknown result type (might be due to invalid IL or missing references) //IL_018f: 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_01c0: Unknown result type (might be due to invalid IL or missing references) //IL_01c5: Unknown result type (might be due to invalid IL or missing references) //IL_020b: Unknown result type (might be due to invalid IL or missing references) //IL_020c: Unknown result type (might be due to invalid IL or missing references) //IL_0219: 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) if (!WorldQueries.Living(player)) { return false; } Vector3 val = CoverReach.Point(player); Vector3 position = motion.Map["head"].position; bool flag = physicalTouch && Object.op_Implicit((Object)(object)grab) && grab.playerGrabbing.Any((PhysGrabber g) => Object.op_Implicit((Object)(object)g) && (Object)(object)g.playerAvatar == (Object)(object)player); if ((!(Vector3.Distance(position, WorldQueries.Eye(player)) <= Plugin.DetectRange.Value) || !WorldQueries.Clear(position, WorldQueries.Eye(player))) && !flag) { return false; } int viewID = player.photonView.ViewID; bool flag2 = CoverReach.Hidden(player); bool flag3 = knowledge.Id != viewID || (flag2 && !knowledge.CoverKnown(Time.time)) || Vector3.Distance(flag2 ? V(knowledge.CoverPoint) : remembered, val) > 0.35f; if (flag) { knowledge.RecordGrab(viewID, K(val), Time.time, verifiedAttempt: true, flag2); } else { knowledge.See(viewID, K(val), Time.time); } remembered = ((Component)player).transform.position; lastSeen = Time.time; encounterTarget = player; if (flag3) { lastTargetNav = Fields.Get(player, "LastNavmeshPosition"); coverApproachKnown = false; coverLookAt = -1f; coverPlanAt = (pathAt = 0f); } if (flag2 && flag) { lowTarget = player; lowPoint = val; passiveHidden = true; shelterPoint = val; } visibleTarget = (flag2 ? null : player); targetId = viewID; gazeProvokerId = targetId; gazeProvokerUntil = Time.time + 3f; seeking = false; leaving = false; avoidedTarget = -1; avoidTargetUntil = 0f; return true; } private void ObservePlayers() { //IL_003c: Unknown result type (might be due to invalid IL or missing references) //IL_0041: Unknown result type (might be due to invalid IL or missing references) //IL_0083: 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_008c: Unknown result type (might be due to invalid IL or missing references) //IL_008d: Unknown result type (might be due to invalid IL or missing references) //IL_0092: Unknown result type (might be due to invalid IL or missing references) //IL_00fe: 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) //IL_010a: Unknown result type (might be due to invalid IL or missing references) //IL_010f: Unknown result type (might be due to invalid IL or missing references) //IL_0113: Unknown result type (might be due to invalid IL or missing references) //IL_0134: Unknown result type (might be due to invalid IL or missing references) //IL_0135: Unknown result type (might be due to invalid IL or missing references) //IL_034b: Unknown result type (might be due to invalid IL or missing references) //IL_0350: Unknown result type (might be due to invalid IL or missing references) //IL_016d: Unknown result type (might be due to invalid IL or missing references) //IL_0172: Unknown result type (might be due to invalid IL or missing references) //IL_0179: Unknown result type (might be due to invalid IL or missing references) //IL_0199: Unknown result type (might be due to invalid IL or missing references) //IL_03f4: Unknown result type (might be due to invalid IL or missing references) //IL_03ff: Unknown result type (might be due to invalid IL or missing references) //IL_0404: Unknown result type (might be due to invalid IL or missing references) //IL_0405: Unknown result type (might be due to invalid IL or missing references) //IL_040a: Unknown result type (might be due to invalid IL or missing references) //IL_040e: Unknown result type (might be due to invalid IL or missing references) //IL_0433: Unknown result type (might be due to invalid IL or missing references) //IL_0456: Unknown result type (might be due to invalid IL or missing references) //IL_045b: Unknown result type (might be due to invalid IL or missing references) //IL_0491: Unknown result type (might be due to invalid IL or missing references) //IL_0496: Unknown result type (might be due to invalid IL or missing references) //IL_01cc: 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_01d8: Unknown result type (might be due to invalid IL or missing references) //IL_01dd: Unknown result type (might be due to invalid IL or missing references) //IL_052e: Unknown result type (might be due to invalid IL or missing references) //IL_051c: Unknown result type (might be due to invalid IL or missing references) //IL_0533: Unknown result type (might be due to invalid IL or missing references) //IL_05af: Unknown result type (might be due to invalid IL or missing references) //IL_05b4: Unknown result type (might be due to invalid IL or missing references) //IL_05c7: Unknown result type (might be due to invalid IL or missing references) //IL_063b: Unknown result type (might be due to invalid IL or missing references) //IL_0640: Unknown result type (might be due to invalid IL or missing references) //IL_05da: Unknown result type (might be due to invalid IL or missing references) //IL_05dc: Unknown result type (might be due to invalid IL or missing references) visible.Clear(); gazeCandidates.Clear(); passiveHidden = false; RefreshObservation(); Vector3 position = motion.Map["head"].position; Vector3 val3; foreach (PlayerAvatar item in SemiFunc.PlayerGetList()) { if (WorldQueries.Living(item)) { int viewID = item.photonView.ViewID; Vector3 val = WorldQueries.Eye(item); Vector3 val2 = val - position; float magnitude = ((Vector3)(ref val2)).magnitude; bool flag = CoverReach.Hidden(item); float num = Plugin.DetectRange.Value * (Fields.Get(item, "isCrawling") ? 0.55f : (Fields.Get(item, "isCrouching") ? 0.75f : 1f)); bool flag2 = knowledge.RecentRear(viewID, Time.time, magnitude); Vector3 forward = PhysicsRoot.forward; val3 = Vector3.ProjectOnPlane(val2, Vector3.up); bool flag3 = Vector3.Dot(forward, ((Vector3)(ref val3)).normalized) > 0.5f || flag2; bool flag4 = magnitude < num && flag3 && WorldQueries.Clear(position, val); bool witnessed = magnitude < Plugin.DetectRange.Value && flag3 && (flag4 || WorldQueries.Clear(PhysicsRoot.TransformPoint(new Vector3(0f, 0.45f, 0.15f)), CoverReach.Point(item))); if (flag && knowledge.Hide(viewID, K(CoverReach.Point(item)), Time.time, witnessed)) { passiveHidden = true; shelterPoint = V(knowledge.CoverPoint); coverApproachPoint = lastTargetNav; coverApproachKnown = true; coverInspectionOnly = true; coverLookAt = -1f; } bool flag5 = viewID == avoidedTarget && Time.time < avoidTargetUntil && !brain.ForcedPursuit; bool flag6 = !flag && SensesNearby(item); bool flag7 = (flag4 || flag6) && !flag && !flag5; recognition.TryGetValue(viewID, out var value); value = Mathf.Clamp01(value + (flag7 ? 0.26666665f : (-0.16f))); recognition[viewID] = value; if (flag7 && (flag6 || !(value < 1f))) { visible.Add(item); gazeCandidates.Add(new GazeCandidate(viewID, magnitude)); } } } gazeTargetId = gazeSelector.Select(gazeCandidates, Time.time, (Time.time < gazeProvokerUntil) ? gazeProvokerId : (-1)); if (gazeTargetId >= 0) { PlayerAvatar p = SemiFunc.PlayerAvatarGetFromPhotonID(gazeTargetId); if (WorldQueries.Living(p)) { gazePoint = WorldQueries.Eye(p); gazeUntil = Time.time + 0.7f; } } visibleCount = visible.Count; if (visibleCount > 0) { if (!Object.op_Implicit((Object)(object)visibleTarget) || !visible.Contains(visibleTarget)) { visibleTarget = visible.OrderBy(delegate(PlayerAvatar val6) { //IL_0006: 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_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) Vector3 val5 = ((Component)val6).transform.position - PhysicsRoot.position; return ((Vector3)(ref val5)).sqrMagnitude; }).First(); } targetId = visibleTarget.photonView.ViewID; Vector3 forward2 = PhysicsRoot.forward; val3 = WorldQueries.Eye(visibleTarget) - position; bool frontal = Vector3.Dot(forward2, ((Vector3)(ref val3)).normalized) > 0.5f; knowledge.See(targetId, K(CoverReach.Point(visibleTarget)), Time.time, frontal); remembered = ((Component)visibleTarget).transform.position; lastSeen = Time.time; encounterTarget = visibleTarget; seeking = false; leaving = false; lastTargetNav = Fields.Get(visibleTarget, "LastNavmeshPosition"); coverApproachKnown = false; coverLookAt = -1f; } else { visibleTarget = null; targetId = -1; } bool flag8 = knowledge.CoverKnown(Time.time); if (knowledge.Id >= 0 && !WorldQueries.Living(SemiFunc.PlayerAvatarGetFromPhotonID(knowledge.Id))) { knowledge.Forget(); flag8 = false; } passiveHidden = flag8; shelterPoint = (flag8 ? V(knowledge.CoverPoint) : shelterPoint); bool flag9 = brain.ForcedPursuit || brain.Capture().ChaseCommitted; lowTarget = ((flag8 && flag9) ? SemiFunc.PlayerAvatarGetFromPhotonID(knowledge.Id) : null); if (Object.op_Implicit((Object)(object)lowTarget) && CoverReach.Detect(PhysicsRoot, lowTarget, out var point)) { Vector3 val4 = V(knowledge.CoverPoint); if (knowledge.ObserveCover(knowledge.Id, K(point), Time.time, visible: true) && Vector3.Distance(val4, point) > 0.25f) { coverPlanAt = 0f; if (brain.State == State.Chase) { coverApproachKnown = false; coverLookAt = -1f; } } } if (flag8) { lowPoint = V(knowledge.CoverPoint); } } private float AuthoredPhase(State state, float time) { return time * ((state == State.Attack) ? (1.1f / brain.Config.AttackSeconds) : 1f); } private void RepositionCover() { if (brain.Enraged) { coverPlanAt = 0f; } } public void BeginNativeLeave() { //IL_001f: 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) Vector3 val = default(Vector3); if (SemiFunc.EnemyLeavePoint(enemy, ref val)) { leaving = true; leavePoint = val; leaveBlocked = 5f; pathAt = 0f; SemiFunc.EnemyLeaveStart(enemy); } } private Vector3 NativeLeaveDestination(Vector3 body) { //IL_002e: 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_0071: Unknown result type (might be due to invalid IL or missing references) //IL_0076: Unknown result type (might be due to invalid IL or missing references) //IL_006c: 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_0079: Unknown result type (might be due to invalid IL or missing references) if (Fields.Get(physical, "notMovingTimer") > 2f) { leaveBlocked -= Time.fixedDeltaTime; } if (Vector3.Distance(body, leavePoint) < 1f || leaveBlocked <= 0f) { leaving = false; roaming.ChangeRoute(); return body; } return leavePoint; } private void BeginDeath() { //IL_0037: 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_0046: 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_0050: 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_0094: Unknown result type (might be due to invalid IL or missing references) //IL_0095: 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_009b: Unknown result type (might be due to invalid IL or missing references) if (brain != null && !(deathAt >= 0f)) { deathAt = Time.time; deathPoint = PhysicsRoot.position + Vector3.up * 0.55f; brain.Tick(0.001f, new Perception(0, watched: false, reach: false, provoked: false, memory: false, stunned: false, dead: true)); snapshot = brain.Capture(); motorVelocity = (movementIntent = Vector3.zero); HideDeadBody(); if ((Object)(object)Live == (Object)(object)this) { Live = null; } if (SemiFunc.IsMasterClientOrSingleplayer()) { CreateSoul(); } } } private void HideDeadBody() { if (DeathRules.HideBody(deathAt >= 0f || snapshot.State == State.Dead)) { melee.Stop(); ((Component)motion.Visual).gameObject.SetActive(false); Collider[] componentsInChildren = ((Component)physical).GetComponentsInChildren(true); foreach (Collider val in componentsInChildren) { val.enabled = false; } physicalBody.isKinematic = true; } } private void CreateSoul() { //IL_0011: 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_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_003a: Unknown result type (might be due to invalid IL or missing references) //IL_003f: Unknown result type (might be due to invalid IL or missing references) //IL_0044: 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) if (!soulSpawned) { if (deathPoint == Vector3.zero) { deathPoint = PhysicsRoot.position + Vector3.up * 0.55f; } if (soulValue == 0) { soulValue = reward.Claim(Random.value); } soulSpawned = SoulDrop.Spawn(deathPoint, soulValue, ((MonoBehaviourPun)parent).photonView.ViewID); } } private bool TickDeath(bool master) { //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_0061: Unknown result type (might be due to invalid IL or missing references) //IL_0066: Unknown result type (might be due to invalid IL or missing references) //IL_006b: Unknown result type (might be due to invalid IL or missing references) if (deathAt < 0f && snapshot.State != State.Dead) { return false; } if (deathAt < 0f) { deathAt = Time.time; deathPoint = PhysicsRoot.position + Vector3.up * 0.55f; } HideDeadBody(); if (master) { CreateSoul(); if (DeathRules.Cleanup(Time.time - deathAt, soulSpawned)) { Remove(); } } return true; } private static bool Standing(PlayerAvatar p) { PlayerTumble val = Fields.Get(p, "tumble"); return StandingGaze.Eligible(Fields.Get(p, "isCrouching"), Fields.Get(p, "isCrawling"), Object.op_Implicit((Object)(object)val) && Fields.Get(val, "isTumbling")); } private bool FrontAndClear(PlayerAvatar p) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_000d: Unknown result type (might be due to invalid IL or missing references) //IL_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_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002a: Unknown result type (might be due to invalid IL or missing references) //IL_0030: Unknown result type (might be due to invalid IL or missing references) //IL_0036: Unknown result type (might be due to invalid IL or missing references) //IL_0044: Unknown result type (might be due to invalid IL or missing references) //IL_005e: Unknown result type (might be due to invalid IL or missing references) //IL_006b: Unknown result type (might be due to invalid IL or missing references) //IL_0076: Unknown result type (might be due to invalid IL or missing references) //IL_007b: Unknown result type (might be due to invalid IL or missing references) //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) Vector3 val = WorldQueries.Eye(p) - PhysicsRoot.position; Vector3 forward = PhysicsRoot.forward; return FrontGaze.FacesViewer(forward.x, forward.z, val.x, val.z) && (WorldQueries.Clear(WorldQueries.Eye(p), motion.Map["head"].position) || WorldQueries.Clear(WorldQueries.Eye(p), PhysicsRoot.position + Vector3.up * 1.2f)); } private bool LocalWatching(PlayerAvatar p) { //IL_0026: Unknown result type (might be due to invalid IL or missing references) //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) //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) return WorldQueries.Living(p) && Standing(p) && WorldQueries.WatchedFromFront(p, motion.Map["head"].position, PhysicsRoot.position + Vector3.up * 1.2f, PhysicsRoot); } private bool SensesNearby(PlayerAvatar player) { //IL_001d: Unknown result type (might be due to invalid IL or missing references) //IL_0022: Unknown result type (might be due to invalid IL or missing references) //IL_0027: 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_003a: Unknown result type (might be due to invalid IL or missing references) //IL_0031: Unknown result type (might be due to invalid IL or missing references) //IL_003f: Unknown result type (might be due to invalid IL or missing references) //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_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_0056: 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_005e: Unknown result type (might be due to invalid IL or missing references) Collider val = PlayerBody.Collider(player); Vector3 val2 = PhysicsRoot.TransformPoint(new Vector3(0f, 0.85f, -0.18f)); Vector3 val3 = (Object.op_Implicit((Object)(object)val) ? val.ClosestPoint(val2) : CoverReach.Point(player)); Vector3 val4 = val3 - val2; return ((Vector3)(ref val4)).sqrMagnitude <= 0.80999994f && WorldQueries.Clear(val2, Vector3.MoveTowards(val3, val2, 0.025f)); } private void RefreshObservation() { //IL_010f: 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_011f: Unknown result type (might be due to invalid IL or missing references) //IL_0124: Unknown result type (might be due to invalid IL or missing references) nearbyObserver = null; float num = float.PositiveInfinity; foreach (PlayerAvatar item in SemiFunc.PlayerGetList()) { if (!Object.op_Implicit((Object)(object)item)) { continue; } int viewID = item.photonView.ViewID; OwnerView value; bool flag = ownerViews.TryGetValue(viewID, out value); bool flag2 = SemiFunc.IsMultiplayer() && (Object)(object)item != (Object)(object)PlayerAvatar.instance && flag && Time.time - value.At < 0.3f; bool flag3 = WorldQueries.Living(item) && Standing(item) && (!flag2 || value.Standing); bool watching = false; if (flag3) { bool flag4 = ((!flag2) ? (!flag && LocalWatching(item)) : (value.Watching && FrontAndClear(item))); bool flag5 = SensesNearby(item); watching = flag5 || flag4; if (flag5 && !flag4) { Vector3 val = ((Component)item).transform.position - PhysicsRoot.position; float sqrMagnitude = ((Vector3)(ref val)).sqrMagnitude; if (sqrMagnitude < num) { num = sqrMagnitude; nearbyObserver = item; } } } sharedGaze.Report(viewID, watching, flag3, Time.time); } watched = sharedGaze.Watched(Time.time); } private void PublishObservation() { //IL_007f: 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_008f: 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_009e: Unknown result type (might be due to invalid IL or missing references) if (SemiFunc.IsMultiplayer() && !SemiFunc.IsMasterClientOrSingleplayer() && !(Time.unscaledTime < nextViewReport)) { PlayerAvatar instance = PlayerAvatar.instance; if (Object.op_Implicit((Object)(object)instance) && instance.photonView.IsMine) { nextViewReport = Time.unscaledTime + 0.08f; bool flag = WorldQueries.Living(instance) && WorldQueries.Watched(instance, motion.Map["head"].position, PhysicsRoot.position + Vector3.up * 1.2f); ((MonoBehaviourPun)this).photonView.RPC("ObserverViewRPC", (RpcTarget)2, new object[5] { instance.photonView.ViewID, Standing(instance), LocalWatching(instance), flag, ++viewReportSequence }); } } } [PunRPC] private void ObserverViewRPC(int id, bool standing, bool watching, bool seen, int sequence, PhotonMessageInfo info = default(PhotonMessageInfo)) { //IL_0072: Unknown result type (might be due to invalid IL or missing references) if (SemiFunc.IsMasterClientOrSingleplayer() && SemiFunc.IsMultiplayer() && !(PhotonNetwork.Time - ((PhotonMessageInfo)(ref info)).SentServerTime > 0.65) && !(PhotonNetwork.Time - ((PhotonMessageInfo)(ref info)).SentServerTime < -0.25)) { PlayerAvatar val = SemiFunc.PlayerAvatarGetFromPhotonID(id); if (Object.op_Implicit((Object)(object)val) && val.photonView.Owner == info.Sender && (!ownerViews.TryGetValue(id, out var value) || sequence > value.Sequence)) { ownerViews[id] = new OwnerView { Standing = standing, Watching = watching, Seen = seen, At = Time.time, Sequence = sequence }; } } } private void StopForGaze() { //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) //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_0053: 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_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_0193: Unknown result type (might be due to invalid IL or missing references) //IL_0199: Unknown result type (might be due to invalid IL or missing references) //IL_008d: Unknown result type (might be due to invalid IL or missing references) //IL_0092: Unknown result type (might be due to invalid IL or missing references) //IL_009e: 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_00ba: Unknown result type (might be due to invalid IL or missing references) //IL_00f3: Unknown result type (might be due to invalid IL or missing references) //IL_00fe: 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_0108: Unknown result type (might be due to invalid IL or missing references) //IL_010d: Unknown result type (might be due to invalid IL or missing references) //IL_0112: Unknown result type (might be due to invalid IL or missing references) //IL_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_0131: 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_0146: Unknown result type (might be due to invalid IL or missing references) //IL_014e: Unknown result type (might be due to invalid IL or missing references) //IL_0153: Unknown result type (might be due to invalid IL or missing references) //IL_0172: 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_0175: Unknown result type (might be due to invalid IL or missing references) //IL_0177: 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) obstacles.StopCartAssist(Time.fixedDeltaTime); if (!gazeAnchored) { gazeAnchored = true; gazeAnchorRotation = physicalBody.rotation; steering.Reset(); } motorVelocity = (movementIntent = Vector3.zero); surfaceMotor.Stop(); travelWatch.Reset(); if (!physicalBody.isKinematic) { Vector3 linearVelocity = physicalBody.linearVelocity; physicalBody.linearVelocity = new Vector3(0f, linearVelocity.y, 0f); physicalBody.angularVelocity = Vector3.zero; physicalBody.constraints = (RigidbodyConstraints)122; if (Object.op_Implicit((Object)(object)nearbyObserver)) { Vector3 val = Vector3.ProjectOnPlane(((Component)nearbyObserver).transform.position - physicalBody.position, Vector3.up); if (((Vector3)(ref val)).sqrMagnitude > 0.04f) { Quaternion q = Quaternion.RotateTowards(gazeAnchorRotation, Quaternion.LookRotation(val), 85f * Time.fixedDeltaTime); if (WallSafety.ClearStepPose(physicalBody.position, q, duck.Weight)) { physicalBody.rotation = (gazeAnchorRotation = q); } } } } ((Component)this).transform.SetPositionAndRotation(physicalBody.position, gazeAnchorRotation); physical.positionSpeedIdle = (physical.positionSpeedChase = 0f); } private void LateUpdate() { if (ready && present && Object.op_Implicit((Object)(object)physicalBody) && !Dying && !SemiFunc.IsMasterClientOrSingleplayer()) { ApplyPeerVisual(snapshot.State == State.Observe && !ForcedPursuit, Time.deltaTime); } } private void ResetPeerVisual() { //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_0039: Unknown result type (might be due to invalid IL or missing references) //IL_003f: Unknown result type (might be due to invalid IL or missing references) if (peerVisualReady && Object.op_Implicit((Object)(object)motion) && Object.op_Implicit((Object)(object)motion.Visual)) { motion.Visual.SetLocalPositionAndRotation(peerVisualBase, peerVisualBaseRotation); } peerVisualHeld = false; peerVisualVelocity = Vector3.zero; } public void ApplyPeerVisual(bool observed, float dt) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_0029: Unknown result type (might be due to invalid IL or missing references) //IL_0030: 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_005b: Unknown result type (might be due to invalid IL or missing references) //IL_0060: Unknown result type (might be due to invalid IL or missing references) //IL_0067: Unknown result type (might be due to invalid IL or missing references) //IL_006c: Unknown result type (might be due to invalid IL or missing references) //IL_00f3: Unknown result type (might be due to invalid IL or missing references) //IL_00f9: Unknown result type (might be due to invalid IL or missing references) //IL_010f: Unknown result type (might be due to invalid IL or missing references) //IL_011c: Unknown result type (might be due to invalid IL or missing references) //IL_0122: 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_00b6: Unknown result type (might be due to invalid IL or missing references) //IL_00bc: Unknown result type (might be due to invalid IL or missing references) //IL_008d: 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_0099: 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_00aa: 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) Transform visual = motion.Visual; if (!peerVisualReady) { peerVisualReady = true; peerVisualBase = visual.localPosition; peerVisualBaseRotation = visual.localRotation; } if (observed) { if (!peerVisualHeld) { peerVisualHeld = true; peerVisualAnchor = visual.position; peerVisualAnchorRotation = visual.rotation; } if (peerProximityTurn && dt > 0f) { peerVisualAnchorRotation = Quaternion.RotateTowards(peerVisualAnchorRotation, networkRotation * peerVisualBaseRotation, 95f * dt); } visual.SetPositionAndRotation(peerVisualAnchor, peerVisualAnchorRotation); } else if (!(dt <= 0f) && !float.IsNaN(dt) && !float.IsInfinity(dt)) { peerVisualHeld = false; visual.localPosition = Vector3.SmoothDamp(visual.localPosition, peerVisualBase, ref peerVisualVelocity, 0.12f, 100f, dt); visual.localRotation = Quaternion.Slerp(visual.localRotation, peerVisualBaseRotation, 1f - Mathf.Exp((0f - dt) / 0.12f)); } } public void SyncNativePlacement(Vector3 position) { //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_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_0019: 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_002a: 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) gazeAnchored = false; ResetPeerVisual(); networkPosition = (previousPhysicalPosition = position); ((Component)physical).transform.position = position; ((Component)this).transform.position = position; SetPresence(active: true); } public bool SeenByAnyPlayer() { //IL_0062: 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_0089: 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_0099: 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_00c3: Unknown result type (might be due to invalid IL or missing references) //IL_00ce: Unknown result type (might be due to invalid IL or missing references) //IL_00d3: Unknown result type (might be due to invalid IL or missing references) //IL_00d8: Unknown result type (might be due to invalid IL or missing references) foreach (PlayerAvatar item in SemiFunc.PlayerGetList()) { if (WorldQueries.Living(item)) { OwnerView value; bool flag = ownerViews.TryGetValue(item.photonView.ViewID, out value) && Time.time - value.At < 0.3f && value.Seen; bool flag2 = WorldQueries.Clear(WorldQueries.Eye(item), motion.Map["head"].position) || WorldQueries.Clear(WorldQueries.Eye(item), PhysicsRoot.position + Vector3.up); if (WorldQueries.Watched(item, motion.Map["head"].position, PhysicsRoot.position + Vector3.up) || (flag && flag2)) { return true; } } } return false; } public void RestoreRecoveryHealth(int remaining) { if (remaining > 0 && CurrentHealth > 0 && !Dying) { Fields.Set(health, "healthCurrent", Mathf.Min(CurrentHealth, Mathf.Clamp(remaining, 1, health.health))); } } public void RestoreDormantReadiness() { if (!ready) { ready = true; SetPresence(active: false); } } public void SetPresence(bool active) { //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_004f: Unknown result type (might be due to invalid IL or missing references) //IL_0054: Unknown result type (might be due to invalid IL or missing references) //IL_0055: Unknown result type (might be due to invalid IL or missing references) if (!Dying && present != active) { present = active; if (!active) { melee.Stop(); audio.Stop(); motorVelocity = (movementIntent = Vector3.zero); surfaceMotor.Stop(); confirmedStall = false; travelWatch.Reset(); cartBypass.Reset(); } ((Component)physical).gameObject.SetActive(active); SetVisual(active); } } public void NativeSpawn(bool recovering = false) { //IL_010f: Unknown result type (might be due to invalid IL or missing references) //IL_0114: Unknown result type (might be due to invalid IL or missing references) //IL_035c: Unknown result type (might be due to invalid IL or missing references) //IL_0361: Unknown result type (might be due to invalid IL or missing references) //IL_0362: Unknown result type (might be due to invalid IL or missing references) //IL_0364: Unknown result type (might be due to invalid IL or missing references) //IL_0369: Unknown result type (might be due to invalid IL or missing references) //IL_036b: Unknown result type (might be due to invalid IL or missing references) //IL_037c: Unknown result type (might be due to invalid IL or missing references) //IL_0381: Unknown result type (might be due to invalid IL or missing references) //IL_0153: Unknown result type (might be due to invalid IL or missing references) //IL_0163: Unknown result type (might be due to invalid IL or missing references) //IL_02be: 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_031d: Unknown result type (might be due to invalid IL or missing references) //IL_02ec: Unknown result type (might be due to invalid IL or missing references) //IL_02fa: Unknown result type (might be due to invalid IL or missing references) //IL_02ff: Unknown result type (might be due to invalid IL or missing references) if (Dying) { return; } gazeAnchored = false; ResetPeerVisual(); confirmedStall = false; pursuitPlanned = false; pursuitId = -1; sharedGaze.Clear(); ownerViews.Clear(); enemyAvoidance?.Reset(); travelWatch.Reset(); cartBypass.Reset(); ready = true; present = true; ((Component)physical).gameObject.SetActive(true); SetVisual(show: true); melee.Stop(); lastHitSequence = (lastImpactSequence = -1); roaming = new NativeRoaming(enemy); motion.Backwards = false; ArmAvoidance[] avoidance = motion.Avoidance; foreach (ArmAvoidance armAvoidance in avoidance) { armAvoidance.Initialized = false; armAvoidance.Weight = (armAvoidance.WeightVelocity = 0f); armAvoidance.Velocity = Vector3.zero; } if (SemiFunc.IsMasterClientOrSingleplayer()) { ((Behaviour)agent).enabled = true; if (recovering) { if (!SpawnPlacement.Recovery(((Component)physical).transform.position, ((Component)physical).transform.rotation, out var point)) { parent.Despawn(); parent.DespawnedTimer = 2f; SetPresence(active: false); return; } enemy.EnemyTeleported(point); } else if (!SemiFunc.EnemySpawn(enemy)) { SetPresence(active: false); return; } physicalBody.isKinematic = false; brain = new FlinchBrain(Plugin.BrainSettings()); snapshot = brain.Capture(); knowledge.Forget(); sounds.Clear(); recognition.Clear(); leaving = false; routeCorners = Array.Empty(); seeking = false; returningToNav = (freezeGroundTrail = false); lastSeen = -100f; coverApproachKnown = false; coverLookAt = -1f; visibleTarget = (lowTarget = null); targetId = -1; lastMoveState = State.Dead; pathAt = (patrolAt = 0f); gazeUntil = 0f; gazeTargetId = -1; NavMeshHit val = default(NavMeshHit); if (NavMesh.SamplePosition(((Component)this).transform.position, ref val, 1f, -1)) { ((Behaviour)agent).enabled = true; agent.Warp(((NavMeshHit)(ref val)).position); navAnchor = ((NavMeshHit)(ref val)).position; hasNavAnchor = true; } groundTrail.Record(K(((Component)physical).transform.position), onNavigationSurface: true); } present = true; SetVisual(show: true); spawnPoseUntil = Time.time + 3f; networkPosition = (previousPhysicalPosition = ((Component)physical).transform.position); networkRotation = ((Component)physical).transform.rotation; Plugin.Instance?.CombatLog("FLINCH_PRESENCE: native Robe spawn cycle"); } private bool SearchKnownAt(float now) { return knowledge.Id >= 0 && (seeking ? (now < searchUntil) : (now - lastSeen < brain.Config.UnreachableSeconds)); } private void StartRobeSearch(Vector3 origin) { //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_0033: Unknown result type (might be due to invalid IL or missing references) //IL_004f: Unknown result type (might be due to invalid IL or missing references) //IL_0054: Unknown result type (might be due to invalid IL or missing references) seeking = true; searchUntil = lastSeen + brain.Config.UnreachableSeconds; seekPoint = origin; LevelPoint levelPointAhead = enemy.GetLevelPointAhead(seekPoint); if (Object.op_Implicit((Object)(object)levelPointAhead)) { seekPoint = ((Component)levelPointAhead).transform.position; } Fields.Set(physical, "notMovingTimer", 0f); pathAt = 0f; } private Vector3 RobeSearchDestination(Vector3 body) { //IL_0011: 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_0071: 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_0069: 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_0116: Unknown result type (might be due to invalid IL or missing references) //IL_011b: Unknown result type (might be due to invalid IL or missing references) //IL_00b9: 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_00db: 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_0103: Unknown result type (might be due to invalid IL or missing references) if (!seeking) { StartRobeSearch(remembered); } if (Time.time >= searchUntil) { seeking = false; knowledge.Forget(); lastSeen = -100f; brain.FinishSearch(); roaming.ChangeRoute(); return body; } if (Vector3.Distance(body, seekPoint) < 2f || (Fields.Get(physical, "notMovingTimer") >= 3f && !obstacles.Clearing)) { LevelPoint levelPointAhead = enemy.GetLevelPointAhead(seekPoint); if (Object.op_Implicit((Object)(object)levelPointAhead) && Vector3.Distance(((Component)levelPointAhead).transform.position, seekPoint) > 0.1f) { seekPoint = ((Component)levelPointAhead).transform.position; pathAt = 0f; } } return seekPoint; } } public static class FloorBridge { public static bool Support(Vector3 point, out Vector3 ground) { //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) //IL_0008: 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) ground = point; if (!GroundSupport.Floor(point, 0.34f, 0.65f, out var floor)) { return false; } ground = floor.Position; return true; } public static bool Route(Vector3 from, Vector3 to, Quaternion rotation, out Vector3[] corners, out bool crouch) { //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_0009: Unknown result type (might be due to invalid IL or missing references) //IL_000a: Unknown result type (might be due to invalid IL or missing references) //IL_000f: Unknown result type (might be due to invalid IL or missing references) //IL_0014: Unknown result type (might be due to invalid IL or missing references) //IL_0019: 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_005f: 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_0070: 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_0086: 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_00b4: 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_00b7: 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_00c4: 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_00ed: 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) corners = null; crouch = false; Vector3 val = Vector3.ProjectOnPlane(to - from, Vector3.up); float magnitude = ((Vector3)(ref val)).magnitude; if (magnitude > 6f || magnitude < 0.05f) { return false; } List list = new List { from }; int num = Mathf.CeilToInt(magnitude / 0.22f); float y = from.y; for (int i = 1; i <= num; i++) { Vector3 point = Vector3.Lerp(from, to, (float)i / (float)num); point.y = y; if (!Support(point, out var ground) || Mathf.Abs(ground.y - y) > 0.34f) { return false; } float num2 = DuckController.RequiredAt(ground, to - from); if (!WallSafety.ClearStepPose(ground, rotation, num2)) { return false; } crouch |= num2 > 0.01f; list.Add(ground); y = ground.y; } corners = list.ToArray(); return true; } } public sealed class GazeDriver { private readonly FlinchMotion motion; private readonly Transform frame; private readonly Quaternion[] rest = (Quaternion[])(object)new Quaternion[2]; private readonly Quaternion[] smoothed = (Quaternion[])(object)new Quaternion[2]; private bool initialized; private float yaw; private float pitch; private float yawVelocity; private float pitchVelocity; public GazeDriver(FlinchMotion motion, Transform body) { //IL_006a: 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) this.motion = motion; frame = body; int i; for (i = 0; i < 2; i++) { rest[i] = RuntimeAssets.Q(RuntimeAssets.Model.Bones.Single((BoneData b) => b.Name == "eye." + ((i == 0) ? "L" : "R")).Rest, 3); } } public void Update(bool hasTarget, Vector3 target, float dt, float headWeight = 1f) { //IL_0041: Unknown result type (might be due to invalid IL or missing references) //IL_0043: Unknown result type (might be due to invalid IL or missing references) //IL_0048: Unknown result type (might be due to invalid IL or missing references) //IL_004d: Unknown result type (might be due to invalid IL or missing references) //IL_0034: 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_005d: 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_008a: 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_0112: 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_011c: 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_0125: 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_0133: 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_014e: Unknown result type (might be due to invalid IL or missing references) //IL_0154: Unknown result type (might be due to invalid IL or missing references) //IL_015a: Unknown result type (might be due to invalid IL or missing references) //IL_0160: Unknown result type (might be due to invalid IL or missing references) //IL_0165: Unknown result type (might be due to invalid IL or missing references) //IL_00b2: Unknown result type (might be due to invalid IL or missing references) //IL_00ca: 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_00dc: Unknown result type (might be due to invalid IL or missing references) //IL_00e8: Unknown result type (might be due to invalid IL or missing references) //IL_00ed: Unknown result type (might be due to invalid IL or missing references) //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_020f: Unknown result type (might be due to invalid IL or missing references) //IL_0214: Unknown result type (might be due to invalid IL or missing references) //IL_0229: Unknown result type (might be due to invalid IL or missing references) //IL_022e: Unknown result type (might be due to invalid IL or missing references) //IL_0233: Unknown result type (might be due to invalid IL or missing references) //IL_0239: 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) //IL_0289: Unknown result type (might be due to invalid IL or missing references) //IL_028e: Unknown result type (might be due to invalid IL or missing references) //IL_0297: Unknown result type (might be due to invalid IL or missing references) //IL_02a4: Unknown result type (might be due to invalid IL or missing references) //IL_02a9: Unknown result type (might be due to invalid IL or missing references) //IL_02ae: Unknown result type (might be due to invalid IL or missing references) //IL_02b0: Unknown result type (might be due to invalid IL or missing references) //IL_02b2: Unknown result type (might be due to invalid IL or missing references) //IL_02b4: Unknown result type (might be due to invalid IL or missing references) //IL_02b9: Unknown result type (might be due to invalid IL or missing references) //IL_02bb: Unknown result type (might be due to invalid IL or missing references) //IL_02bd: Unknown result type (might be due to invalid IL or missing references) //IL_02ca: Unknown result type (might be due to invalid IL or missing references) //IL_02cd: Unknown result type (might be due to invalid IL or missing references) //IL_02d2: Unknown result type (might be due to invalid IL or missing references) //IL_02d7: Unknown result type (might be due to invalid IL or missing references) //IL_02db: Unknown result type (might be due to invalid IL or missing references) //IL_02e0: Unknown result type (might be due to invalid IL or missing references) //IL_02e2: Unknown result type (might be due to invalid IL or missing references) //IL_02ea: Unknown result type (might be due to invalid IL or missing references) //IL_02ef: Unknown result type (might be due to invalid IL or missing references) //IL_02f4: Unknown result type (might be due to invalid IL or missing references) //IL_02f6: Unknown result type (might be due to invalid IL or missing references) //IL_02f8: Unknown result type (might be due to invalid IL or missing references) //IL_02fd: Unknown result type (might be due to invalid IL or missing references) //IL_02ff: Unknown result type (might be due to invalid IL or missing references) //IL_0304: Unknown result type (might be due to invalid IL or missing references) //IL_0306: Unknown result type (might be due to invalid IL or missing references) //IL_030d: Unknown result type (might be due to invalid IL or missing references) //IL_0330: Unknown result type (might be due to invalid IL or missing references) //IL_0337: Unknown result type (might be due to invalid IL or missing references) //IL_033e: Unknown result type (might be due to invalid IL or missing references) //IL_0345: Unknown result type (might be due to invalid IL or missing references) //IL_034a: Unknown result type (might be due to invalid IL or missing references) //IL_036f: Unknown result type (might be due to invalid IL or missing references) //IL_037b: Unknown result type (might be due to invalid IL or missing references) //IL_0380: Unknown result type (might be due to invalid IL or missing references) //IL_0385: Unknown result type (might be due to invalid IL or missing references) //IL_038a: Unknown result type (might be due to invalid IL or missing references) //IL_038f: Unknown result type (might be due to invalid IL or missing references) //IL_0391: Unknown result type (might be due to invalid IL or missing references) //IL_0393: Unknown result type (might be due to invalid IL or missing references) //IL_0395: Unknown result type (might be due to invalid IL or missing references) //IL_039a: Unknown result type (might be due to invalid IL or missing references) //IL_039c: Unknown result type (might be due to invalid IL or missing references) //IL_03a1: Unknown result type (might be due to invalid IL or missing references) //IL_03d2: Unknown result type (might be due to invalid IL or missing references) //IL_03df: Unknown result type (might be due to invalid IL or missing references) //IL_03e4: Unknown result type (might be due to invalid IL or missing references) //IL_03ed: Unknown result type (might be due to invalid IL or missing references) //IL_0405: Unknown result type (might be due to invalid IL or missing references) //IL_040a: Unknown result type (might be due to invalid IL or missing references) //IL_0419: Unknown result type (might be due to invalid IL or missing references) //IL_03bb: Unknown result type (might be due to invalid IL or missing references) //IL_03bd: Unknown result type (might be due to invalid IL or missing references) if (motion.State == State.Dead) { return; } Transform val = motion.Map["head"]; Vector3 val2 = (hasTarget ? frame.InverseTransformDirection(target - val.position) : Vector3.forward); float num = (hasTarget ? Mathf.Clamp(Mathf.Atan2(val2.x, val2.z) * 57.29578f * 0.6f, -40f, 40f) : 0f); Vector3 val3 = Vector3.zero; for (int i = 0; i < 2; i++) { string key = "eye." + ((i == 0) ? "L" : "R"); val3 += motion.Map[key].parent.rotation * rest[i] * RuntimeAssets.EyeAxes[key]; } Vector3 val4 = frame.InverseTransformDirection(((Vector3)(ref val3)).normalized); float y = val4.y; Vector2 val5 = new Vector2(val4.x, val4.z); float num2 = Mathf.Atan2(y, ((Vector2)(ref val5)).magnitude) * 57.29578f; float y2 = val2.y; val5 = new Vector2(val2.x, val2.z); float num3 = Mathf.Atan2(y2, ((Vector2)(ref val5)).magnitude) * 57.29578f; float num4 = (hasTarget ? Mathf.Clamp((num3 - num2) * 0.35f, -18f, 22f) : 0f); yaw = Mathf.SmoothDamp(yaw, num, ref yawVelocity, 0.17f, 145f, dt); pitch = Mathf.SmoothDamp(pitch, num4, ref pitchVelocity, 0.17f, 90f, dt); if (motion.State != State.Observe) { val.rotation = Quaternion.AngleAxis(yaw * headWeight, frame.up) * Quaternion.AngleAxis((0f - pitch) * headWeight, frame.right) * val.rotation; } for (int j = 0; j < 2; j++) { string key2 = "eye." + ((j == 0) ? "L" : "R"); Transform val6 = motion.Map[key2]; Vector3 val7 = RuntimeAssets.EyeAxes[key2]; Quaternion val8 = val6.parent.rotation * rest[j]; Vector3 val9 = val8 * val7; Quaternion val10 = val8; if (hasTarget) { Vector3 val11 = target - val6.position; Vector3 normalized = ((Vector3)(ref val11)).normalized; Quaternion val12 = Quaternion.LookRotation(val9, frame.up); Vector3 val13 = Quaternion.Inverse(val12) * normalized; float num5 = Mathf.Clamp(Mathf.Atan2(val13.x, val13.z) * 57.29578f, -24f, 24f); float y3 = val13.y; val5 = new Vector2(val13.x, val13.z); float num6 = Mathf.Clamp(Mathf.Atan2(y3, ((Vector2)(ref val5)).magnitude) * 57.29578f, -24f, 24f); Vector3 val14 = val12 * Quaternion.Euler(0f - num6, num5, 0f) * Vector3.forward; val10 = Quaternion.FromToRotation(val9, val14) * val8; } if (!initialized) { smoothed[j] = val8; } smoothed[j] = Quaternion.Slerp(smoothed[j], Quaternion.RotateTowards(smoothed[j], val10, 300f * dt), 1f - Mathf.Exp((0f - dt) * 24f)); val6.rotation = smoothed[j]; } initialized = true; } } [HarmonyPatch(typeof(PhysGrabObject), "PhysicsGrabbingManipulation")] internal static class GrabStrengthPatch { private static bool Prefix(PhysGrabObject __instance) { //IL_0076: Unknown result type (might be due to invalid IL or missing references) EnemyRigidbody component = ((Component)__instance).GetComponent(); FlinchActor flinchActor = ((Object.op_Implicit((Object)(object)component) && Object.op_Implicit((Object)(object)component.enemy)) ? ((Component)component.enemy).GetComponent() : null); if (!Object.op_Implicit((Object)(object)flinchActor) || (Object)(object)((Component)__instance).transform != (Object)(object)flinchActor.PhysicsRoot || __instance.playerGrabbing.Count == 0) { return true; } if (flinchActor.CanLiftNow()) { return true; } Fields.Set(__instance, "grabDisplacementCurrent", Vector3.zero); return false; } } public readonly struct GroundPoint { public readonly Vector3 Position; public readonly Vector3 Normal; public GroundPoint(Vector3 position, Vector3 normal) { //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) //IL_0009: Unknown result type (might be due to invalid IL or missing references) //IL_000a: Unknown result type (might be due to invalid IL or missing references) Position = position; Normal = normal; } } public static class GroundSupport { private static readonly float[] ForwardStepProbes = new float[6] { 0.08f, 0.12f, 0.18f, 0.24f, 0.3f, 0.35f }; private static readonly float[] BackwardStepProbes = new float[11] { 0.12f, 0.18f, 0.24f, 0.3f, 0.36f, 0.42f, 0.48f, 0.54f, 0.6f, 0.66f, 0.72f }; private static readonly float[] FootOffsets = new float[3] { 0f, -0.24f, 0.24f }; public static bool Floor(Vector3 point, float maxRise, float maxDrop, out GroundPoint floor) { //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_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_004b: Unknown result type (might be due to invalid IL or missing references) //IL_0050: Unknown result type (might be due to invalid IL or missing references) //IL_0083: Unknown result type (might be due to invalid IL or missing references) //IL_00cc: Unknown result type (might be due to invalid IL or missing references) //IL_00d6: Unknown result type (might be due to invalid IL or missing references) //IL_00ec: 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_0117: Unknown result type (might be due to invalid IL or missing references) //IL_011c: 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_012b: 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) floor = default(GroundPoint); bool result = false; float num = float.NegativeInfinity; RaycastHit[] array = Physics.RaycastAll(point + Vector3.up * (maxRise + 0.12f), Vector3.down, maxRise + maxDrop + 0.15f, WorldQueries.Mask, (QueryTriggerInteraction)1); for (int i = 0; i < array.Length; i++) { RaycastHit val = array[i]; Collider collider = ((RaycastHit)(ref val)).collider; if (!WorldQueries.Self(collider) && !Object.op_Implicit((Object)(object)WorldQueries.PlayerOwner(collider)) && !Object.op_Implicit((Object)(object)((Component)collider).GetComponentInParent()) && !(((RaycastHit)(ref val)).normal.y < 0.65f) && (!Object.op_Implicit((Object)(object)collider.attachedRigidbody) || collider.attachedRigidbody.isKinematic)) { float num2 = ((RaycastHit)(ref val)).point.y - point.y; if (!(num2 > maxRise) && !(num2 < 0f - maxDrop) && !(((RaycastHit)(ref val)).point.y <= num)) { num = ((RaycastHit)(ref val)).point.y; floor = new GroundPoint(((RaycastHit)(ref val)).point + Vector3.up * 0.015f, ((RaycastHit)(ref val)).normal); result = true; } } } return result; } public static bool BodyFloor(Vector3 body, Quaternion rotation, out GroundPoint floor) { //IL_0001: 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_0030: 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_003c: 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_004b: 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_005c: Unknown result type (might be due to invalid IL or missing references) //IL_0061: Unknown result type (might be due to invalid IL or missing references) //IL_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_0083: 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_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) if (Floor(body, 0.1f, 0.8f, out floor)) { return true; } Vector3[] array = (Vector3[])(object)new Vector3[4] { Vector3.forward * 0.22f, Vector3.back * 0.22f, Vector3.right * 0.22f, Vector3.left * 0.22f }; foreach (Vector3 val in array) { if (Floor(body + rotation * val, 0.1f, 0.4f, out floor)) { return true; } } return false; } public static bool StepChain(Vector3 body, Vector3 direction, float ahead, out GroundPoint rear, out float rise) { //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) float grade; float surface; return StepChain(body, direction, ahead, out rear, out rise, out grade, out surface); } internal static bool StepChain(Vector3 body, Vector3 direction, float ahead, out GroundPoint rear, out float rise, out float grade, out float surface) { //IL_001a: Unknown result type (might be due to invalid IL or missing references) //IL_0021: Unknown result type (might be due to invalid IL or missing references) //IL_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_002c: 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_0035: 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_0095: 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_009d: 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_0120: 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_00f9: Unknown result type (might be due to invalid IL or missing references) //IL_0210: Unknown result type (might be due to invalid IL or missing references) //IL_0174: Unknown result type (might be due to invalid IL or missing references) //IL_017e: 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_019d: 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) rear = default(GroundPoint); rise = (grade = 0f); surface = body.y; Vector3 val = Vector3.ProjectOnPlane(direction, Vector3.up); direction = ((Vector3)(ref val)).normalized; if (((Vector3)(ref direction)).sqrMagnitude < 0.5f) { return false; } int num = 0; int num2 = 0; float num3 = 0f; float num4 = 0f; int num5 = Mathf.CeilToInt((0.6f + ahead) / 0.1f); for (int i = 0; i <= num5; i++) { float num6 = Mathf.Lerp(-0.6f, ahead, (float)i / (float)num5); if (!Floor(body + direction * num6, 0.65f, 1.25f, out var floor) || floor.Normal.y < 0.985f) { return false; } if (i == 0) { rear = floor; if (Mathf.Abs(floor.Position.y - body.y) > 0.85f) { return false; } } else { float num7 = floor.Position.y - num3; if (Mathf.Abs(num7) > 0.345f) { return false; } if (num7 > 0.025f) { num++; } if (num7 < -0.025f) { num2++; } } num4 += floor.Position.y - body.y; if (num6 > 0f) { rise = Mathf.Max(rise, floor.Position.y - body.y); } num3 = floor.Position.y; } if ((num >= 2 && num2 == 0) || (num2 >= 2 && num == 0)) { grade = (num3 - rear.Position.y) / (0.6f + ahead); surface = body.y + num4 / (float)(num5 + 1) - grade * (ahead - 0.6f) * 0.5f; } return num + num2 > 0; } internal static float NextStepRise(Vector3 body, Vector3 direction, bool backwards, bool hasGround, GroundPoint ground) { //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_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_0049: 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_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_0056: 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_005e: 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_0065: 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_0092: 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_00b3: Unknown result type (might be due to invalid IL or missing references) //IL_00d4: Unknown result type (might be due to invalid IL or missing references) //IL_00e0: Unknown result type (might be due to invalid IL or missing references) Vector3 val = Vector3.Cross(Vector3.up, direction); float[] array = (backwards ? BackwardStepProbes : ForwardStepProbes); foreach (float num in array) { float num2 = 0f; float[] footOffsets = FootOffsets; foreach (float num3 in footOffsets) { Vector3 point = body + direction * num + val * num3; if (Floor(point, 0.34f, 0.5f, out var floor)) { float num4 = floor.Position.y - body.y; bool flag = floor.Normal.y > 0.985f || (hasGround && ground.Normal.y >= 0.985f); bool flag2 = hasGround && floor.Position.y - ground.Position.y > 0.02f; if (flag && num4 <= 0.34f && (num4 > 0.025f || (flag2 && num4 > -0.005f))) { num2 = Mathf.Max(num2, Mathf.Max(0.026f, num4)); } } } if (num2 > 0f) { return num2; } } return 0f; } internal static float StepFootTravel(Vector3 body, Quaternion rotation, Vector3 direction, float distance) { //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_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_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_003b: 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_003e: 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_005f: 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) Vector3 val = body + rotation * new Vector3(0f, 0.068f, -0.1f); Vector3 val2 = default(Vector3); ((Vector3)(ref val2))..ctor(0.315f, 0.05f, 0.315f); float num = distance; RaycastHit[] array = Physics.BoxCastAll(val, val2, direction, rotation, distance + 0.005f, WorldQueries.Mask, (QueryTriggerInteraction)1); for (int i = 0; i < array.Length; i++) { RaycastHit val3 = array[i]; if (Mathf.Abs(((RaycastHit)(ref val3)).normal.y) < 0.28f && WallSafety.BlocksMovement(((RaycastHit)(ref val3)).collider)) { num = Mathf.Min(num, Mathf.Max(0f, ((RaycastHit)(ref val3)).distance - 0.005f)); } } return num; } public static bool NavProjection(Vector3 body, out Vector3 nav) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_0029: 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_0038: 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_0042: 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_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_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_008b: 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) //IL_00bb: 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_00f8: Unknown result type (might be due to invalid IL or missing references) //IL_00fd: 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_0103: Unknown result type (might be due to invalid IL or missing references) //IL_0108: Unknown result type (might be due to invalid IL or missing references) //IL_010d: Unknown result type (might be due to invalid IL or missing references) //IL_0118: Unknown result type (might be due to invalid IL or missing references) //IL_0122: Unknown result type (might be due to invalid IL or missing references) //IL_00ea: Unknown result type (might be due to invalid IL or missing references) //IL_00eb: Unknown result type (might be due to invalid IL or missing references) //IL_0285: Unknown result type (might be due to invalid IL or missing references) //IL_028a: Unknown result type (might be due to invalid IL or missing references) //IL_013f: 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_014a: Unknown result type (might be due to invalid IL or missing references) //IL_014f: Unknown result type (might be due to invalid IL or missing references) //IL_0154: Unknown result type (might be due to invalid IL or missing references) //IL_0169: Unknown result type (might be due to invalid IL or missing references) //IL_0173: Unknown result type (might be due to invalid IL or missing references) //IL_0188: Unknown result type (might be due to invalid IL or missing references) //IL_0206: Unknown result type (might be due to invalid IL or missing references) //IL_020b: Unknown result type (might be due to invalid IL or missing references) //IL_0212: Unknown result type (might be due to invalid IL or missing references) //IL_0217: Unknown result type (might be due to invalid IL or missing references) //IL_021e: Unknown result type (might be due to invalid IL or missing references) //IL_0223: Unknown result type (might be due to invalid IL or missing references) //IL_022a: Unknown result type (might be due to invalid IL or missing references) //IL_022f: Unknown result type (might be due to invalid IL or missing references) //IL_01a2: 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_01c5: Unknown result type (might be due to invalid IL or missing references) //IL_01c6: Unknown result type (might be due to invalid IL or missing references) //IL_01cb: Unknown result type (might be due to invalid IL or missing references) //IL_01d2: Unknown result type (might be due to invalid IL or missing references) //IL_01d7: Unknown result type (might be due to invalid IL or missing references) //IL_01dc: Unknown result type (might be due to invalid IL or missing references) //IL_023f: Unknown result type (might be due to invalid IL or missing references) //IL_0244: Unknown result type (might be due to invalid IL or missing references) //IL_0246: Unknown result type (might be due to invalid IL or missing references) //IL_0247: Unknown result type (might be due to invalid IL or missing references) nav = default(Vector3); NavMeshHit val = default(NavMeshHit); if (!NavMesh.SamplePosition(body, ref val, 0.8f, -1)) { return false; } Vector3 val2 = ((NavMeshHit)(ref val)).position + Vector3.up * 0.12f; Vector3 b = body + Vector3.up * 0.12f; bool flag = Physics.OverlapSphere(val2, 0.025f, WorldQueries.Mask, (QueryTriggerInteraction)1).Any(WallSafety.BlocksMovement); GroundPoint floor; GroundPoint floor2; bool sameFreeSurface = Floor(body, 0.1f, 0.8f, out floor) && Floor(((NavMeshHit)(ref val)).position, 0.08f, 0.4f, out floor2) && Mathf.Abs(floor.Position.y - floor2.Position.y) < 0.08f && !flag && WorldQueries.Clear(val2, b); Vector3 val3 = Vector3.ProjectOnPlane(((NavMeshHit)(ref val)).position - body, Vector3.up); if (!LocomotionRules.NavSurface(((Vector3)(ref val3)).magnitude, ((NavMeshHit)(ref val)).position.y - body.y, sameFreeSurface)) { val3 = Vector3.ProjectOnPlane(((NavMeshHit)(ref val)).position - body, Vector3.up); if (((Vector3)(ref val3)).magnitude > 0.6f || Mathf.Abs(((NavMeshHit)(ref val)).position.y - body.y) > 0.85f || !Floor(((NavMeshHit)(ref val)).position, 0.34f, 0.4f, out var floor3) || Mathf.Abs(floor3.Position.y - ((NavMeshHit)(ref val)).position.y) > 0.28f || !WorldQueries.Clear(body + Vector3.up, ((NavMeshHit)(ref val)).position + Vector3.up)) { return false; } bool flag2 = false; Vector3[] array = (Vector3[])(object)new Vector3[4] { Vector3.forward, Vector3.right, Vector3.back, Vector3.left }; foreach (Vector3 direction in array) { if (StepChain(body, direction, 0.35f, out var _, out var _)) { flag2 = true; break; } } if (!flag2) { return false; } } nav = ((NavMeshHit)(ref val)).position; return true; } public static Vector3 CenterCorridor(Vector3 body, Vector3 velocity) { //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) //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_0029: Unknown result type (might be due to invalid IL or missing references) //IL_002a: Unknown result type (might be due to invalid IL or missing references) //IL_002f: Unknown result type (might be due to invalid IL or missing references) //IL_0030: Unknown result type (might be due to invalid IL or missing references) //IL_0035: 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_0038: 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_006a: Unknown result type (might be due to invalid IL or missing references) //IL_006b: 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_0084: 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_008e: 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_001e: 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) if (((Vector3)(ref velocity)).sqrMagnitude < 0.01f) { return velocity; } Vector3 normalized = ((Vector3)(ref velocity)).normalized; Vector3 val = Vector3.Cross(Vector3.up, normalized); float num = Side(-val); float num2 = Side(val); float num3 = Mathf.Clamp((num2 - num) * 1.2f, -0.45f, 0.45f); return velocity + val * num3 * Mathf.Min(1f, ((Vector3)(ref velocity)).magnitude); float Side(Vector3 side) { //IL_0009: 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_0018: Unknown result type (might be due to invalid IL or missing references) //IL_001d: Unknown result type (might be due to invalid IL or missing references) //IL_0027: Unknown result type (might be due to invalid IL or missing references) //IL_003f: Unknown result type (might be due to invalid IL or missing references) //IL_0044: 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) float num4 = 1f; RaycastHit[] array = Physics.SphereCastAll(body + Vector3.up * 0.85f, 0.15f, side, 1f, WorldQueries.Mask, (QueryTriggerInteraction)1); for (int i = 0; i < array.Length; i++) { RaycastHit val2 = array[i]; if (WallSafety.BlocksMovement(((RaycastHit)(ref val2)).collider) && !Object.op_Implicit((Object)(object)WorldQueries.PlayerOwner(((RaycastHit)(ref val2)).collider)) && Mathf.Abs(((RaycastHit)(ref val2)).normal.y) < 0.4f) { num4 = Mathf.Min(num4, ((RaycastHit)(ref val2)).distance); } } return num4; } } } public static class KickOcclusion { private static bool Blocks(Collider c, Transform ignore) { return !WorldQueries.Self(c) && !Object.op_Implicit((Object)(object)WorldQueries.PlayerOwner(c)) && (!Object.op_Implicit((Object)(object)ignore) || !((Component)c).transform.IsChildOf(ignore)); } private static bool Chord(Collider c, Vector3 point, Vector3 direction, out float thickness) { //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) //IL_000a: Unknown result type (might be due to invalid IL or missing references) //IL_000f: Unknown result type (might be due to invalid IL or missing references) //IL_0027: 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_0034: 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_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_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_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_005e: Unknown result type (might be due to invalid IL or missing references) Bounds bounds = c.bounds; Vector3 size = ((Bounds)(ref bounds)).size; float num = ((Vector3)(ref size)).magnitude + 0.5f; thickness = 0f; RaycastHit val = default(RaycastHit); RaycastHit val2 = default(RaycastHit); if (!c.Raycast(new Ray(point - direction * num, direction), ref val, num * 2f) || !c.Raycast(new Ray(point + direction * num, -direction), ref val2, num * 2f)) { return false; } thickness = Mathf.Max(0f, num * 2f - ((RaycastHit)(ref val)).distance - ((RaycastHit)(ref val2)).distance); return true; } private static bool Narrow(Collider c, Vector3 point, Vector3 direction, out float thickness) { //IL_0009: 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_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_0018: 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_002b: 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_005b: 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_0071: Unknown result type (might be due to invalid IL or missing references) //IL_00d6: Unknown result type (might be due to invalid IL or missing references) //IL_00db: 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_00e1: Unknown result type (might be due to invalid IL or missing references) //IL_00e5: Unknown result type (might be due to invalid IL or missing references) //IL_00ea: Unknown result type (might be due to invalid IL or missing references) //IL_00b4: 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_012a: Unknown result type (might be due to invalid IL or missing references) //IL_012b: Unknown result type (might be due to invalid IL or missing references) //IL_0134: Unknown result type (might be due to invalid IL or missing references) //IL_0139: Unknown result type (might be due to invalid IL or missing references) //IL_013e: Unknown result type (might be due to invalid IL or missing references) thickness = 0f; Bounds bounds = c.bounds; Vector3 size = ((Bounds)(ref bounds)).size; if (size.y > 1.65f || Mathf.Max(size.x, size.z) > 2f) { return false; } bool flag = size.x <= 0.22f && size.z <= 0.22f; bool flag2 = Chord(c, point, direction, out thickness); if (flag2 && thickness > 0.201f) { return false; } if (!flag2) { if (!flag) { return false; } thickness = Mathf.Max(size.x, size.z); } if (flag) { return true; } Vector3 val = Vector3.Cross(Vector3.up, direction); Vector3 normalized = ((Vector3)(ref val)).normalized; if (((Vector3)(ref normalized)).sqrMagnitude < 0.1f) { return false; } float[] array = new float[2] { -1f, 1f }; foreach (float num in array) { if (Chord(c, point + normalized * (num * 0.14f), direction, out var _)) { return false; } } return flag2; } public static bool ClearTube(Vector3 a, Vector3 b, float radius, Transform ignore = null) { //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) //IL_0008: 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_0022: Unknown result type (might be due to invalid IL or missing references) //IL_0019: 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_002f: 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_005e: 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) //IL_0088: Unknown result type (might be due to invalid IL or missing references) //IL_00a0: Unknown result type (might be due to invalid IL or missing references) //IL_00a5: Unknown result type (might be due to invalid IL or missing references) //IL_011a: 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_00d9: Unknown result type (might be due to invalid IL or missing references) Vector3 val = b - a; float magnitude = ((Vector3)(ref val)).magnitude; Vector3 val2 = ((magnitude > 0.0001f) ? (val / magnitude) : Vector3.forward); Dictionary dictionary = new Dictionary(); Collider[] array = Physics.OverlapSphere(a, radius, WorldQueries.Mask, (QueryTriggerInteraction)1); foreach (Collider val3 in array) { if (Blocks(val3, ignore)) { dictionary[val3] = val3.ClosestPoint(a); } } if (magnitude > 0.0001f) { RaycastHit[] array2 = Physics.SphereCastAll(a, radius, val2, magnitude, WorldQueries.Mask, (QueryTriggerInteraction)1); for (int j = 0; j < array2.Length; j++) { RaycastHit val4 = array2[j]; if (Blocks(((RaycastHit)(ref val4)).collider, ignore) && !dictionary.ContainsKey(((RaycastHit)(ref val4)).collider)) { dictionary[((RaycastHit)(ref val4)).collider] = ((RaycastHit)(ref val4)).point; } } } float num = 0f; int num2 = 0; foreach (KeyValuePair item in dictionary) { if (!Narrow(item.Key, item.Value, val2, out var thickness)) { return false; } num += thickness; if (++num2 > 2 || num > 0.301f) { return false; } } return true; } } public sealed class LocalPresentation : MonoBehaviour { private PhysGrabObject localGrab; public void Tick(Transform head, Transform body, PhysGrabObject grab, bool alive, float dt) { localGrab = grab; } private void LateUpdate() { //IL_007a: 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_00a2: 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_00bb: Unknown result type (might be due to invalid IL or missing references) if (Object.op_Implicit((Object)(object)localGrab) && Fields.Get(localGrab, "grabbedLocal") && Object.op_Implicit((Object)(object)ItemInfoUI.instance)) { ItemInfoUI.instance.ItemInfoText((ItemAttributes)null, Plugin.DisplayName.Value, true); TextMeshProUGUI val = Fields.Get(ItemInfoUI.instance, "Text"); if (Object.op_Implicit((Object)(object)val)) { ((TMP_Text)val).colorGradient = new VertexGradient(new Color(1f, 0.83f, 0.16f), new Color(1f, 0.83f, 0.16f), new Color(1f, 0.37f, 0.04f), new Color(1f, 0.37f, 0.04f)); } } } } public sealed class LowStrikeVolume { private readonly HashSet victims = new HashSet(); private int sequence = -1; public static bool CanHit(Transform body, Collider target) { //IL_003d: 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_0058: 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_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) //IL_0098: 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_00a2: Unknown result type (might be due to invalid IL or missing references) if (!Object.op_Implicit((Object)(object)target) || !target.enabled || !((Component)target).gameObject.activeInHierarchy) { return false; } Vector3 val = body.TransformPoint(new Vector3(0f, 0.34f, 0.95f)); if (!Physics.OverlapBox(val, new Vector3(0.62f, 0.27f, 0.85f), body.rotation, -1, (QueryTriggerInteraction)1).Contains(target)) { return false; } return ClearApproach(body.position, body.rotation, target.ClosestPoint(body.TransformPoint(new Vector3(0f, 0.2f, 0.16f))), ((Component)target).transform); } public static bool ClearApproach(Vector3 position, Quaternion rotation, Vector3 target, Transform ignore = null) { //IL_0022: 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_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_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_003f: 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) float[] array = new float[3] { 0f, -0.24f, 0.24f }; foreach (float num in array) { Vector3 a = position + rotation * new Vector3(num, 0.2f, 0.16f); if (KickOcclusion.ClearTube(a, target, 0.075f, ignore)) { return true; } } return false; } public bool TryHit(Transform body, Collider target, float phase, int nextSequence, bool crouched) { if (sequence != nextSequence) { sequence = nextSequence; victims.Clear(); } if (!crouched || phase < 0.22f || phase > 0.65f || !CanHit(body, target) || !victims.Add(((Object)target).GetInstanceID())) { return false; } return true; } } public enum MonsterSound { Hurt1, Hurt2, Hurt3, Hurt4, Idle, Detect, Lost1, Lost2, Step, Hit, Roar, Ambience, Breath, Scare1, Scare2, Scare3, Scare4, Scare5 } public static class SoundBank { private static readonly AudioClip[] clips = (AudioClip[])(object)new AudioClip[18]; private static readonly string[] names = new string[18] { "hurt1", "hurt2", "hurt3", "hurt4", "idle", "detect", "lost1", "lost2", "step", "hit", "roar", "ambience", "breath", "scare1", "scare2", "scare3", "scare4", "scare5" }; public static void Load(string directory) { for (int i = 0; i < names.Length; i++) { using FileStream stream = File.OpenRead(Path.Combine(directory, "Audio", names[i] + ".wav")); PcmWave pcmWave = PcmWave.Read(stream); AudioClip val = AudioClip.Create("Flinch " + names[i], pcmWave.Samples.Length / pcmWave.Channels, pcmWave.Channels, pcmWave.Rate, false); if (!val.SetData(pcmWave.Samples, 0)) { throw new InvalidDataException("Cannot load Flinch audio " + names[i]); } clips[i] = val; } } public static AudioClip Get(MonsterSound id) { return (id >= MonsterSound.Hurt1 && (int)id < clips.Length) ? clips[(int)id] : null; } } public sealed class MonsterAudio { public bool Pursuit; private readonly AudioSource voice; private readonly AudioSource hurt; private readonly AudioSource feet; private readonly AudioSource impact; private readonly AudioSource breath; private readonly AudioSource localCue; private readonly AudioSource ambience; private readonly AudioLowPassFilter[] filters; private readonly Transform body; private float acousticAt; public bool VoiceBusy => voice.isPlaying; public MonsterAudio(Transform body) { this.body = body; voice = Make("voice", 1.6f, 25f); hurt = Make("hurt", 1.2f, 22f); feet = Make("feet", 0.1f, 18f); impact = Make("impact", 1f, 22f); breath = Make("breathing", 1.6f, 8f); breath.loop = true; localCue = Make("local surprise", 1.6f, 15f); localCue.spatialBlend = 0f; ambience = Make("local ambience", 1f, 20f); ambience.spatialBlend = 0f; filters = (AudioLowPassFilter[])(object)new AudioLowPassFilter[5] { ((Component)voice).gameObject.AddComponent(), ((Component)hurt).gameObject.AddComponent(), ((Component)feet).gameObject.AddComponent(), ((Component)impact).gameObject.AddComponent(), ((Component)breath).gameObject.AddComponent() }; AudioLowPassFilter[] array = filters; foreach (AudioLowPassFilter val in array) { val.cutoffFrequency = 20000f; } AudioSource Make(string name, float height, float range) { //IL_000c: Unknown result type (might be due to invalid IL or missing references) //IL_0012: Expected O, but got Unknown //IL_002b: Unknown result type (might be due to invalid IL or missing references) //IL_0031: Unknown result type (might be due to invalid IL or missing references) GameObject val2 = new GameObject("Flinch audio " + name); val2.transform.SetParent(body, false); val2.transform.localPosition = Vector3.up * height; AudioSource val3 = val2.AddComponent(); val3.playOnAwake = false; val3.spatialBlend = 1f; val3.dopplerLevel = 0f; val3.minDistance = 2f; val3.maxDistance = range; val3.rolloffMode = (AudioRolloffMode)0; return val3; } } public void Play(MonsterSound sound) { AudioClip val = SoundBank.Get(sound); if (!Object.op_Implicit((Object)(object)val) || Plugin.SoundVolume.Value <= 0f) { return; } AudioSource val2 = ((sound <= MonsterSound.Hurt4) ? hurt : ((sound == MonsterSound.Step) ? feet : ((sound == MonsterSound.Hit) ? impact : ((sound == MonsterSound.Ambience) ? ambience : ((sound >= MonsterSound.Scare1) ? localCue : voice))))); if (Object.op_Implicit((Object)(object)AudioManager.instance)) { val2.outputAudioMixerGroup = AudioManager.instance.SoundMasterGroup; } if (sound == MonsterSound.Idle && voice.isPlaying) { return; } switch (sound) { case MonsterSound.Step: val2.maxDistance = StealthAudio.StepRange(Pursuit); val2.minDistance = (Pursuit ? 2f : 0.8f); val2.rolloffMode = (AudioRolloffMode)((!Pursuit) ? 2 : 0); if (!Pursuit) { val2.SetCustomCurve((AudioSourceCurveType)0, NearRolloff()); } break; case MonsterSound.Detect: val2.maxDistance = 9f; val2.minDistance = 1f; val2.rolloffMode = (AudioRolloffMode)2; val2.SetCustomCurve((AudioSourceCurveType)0, NearRolloff()); break; default: if ((Object)(object)val2 == (Object)(object)voice) { val2.maxDistance = 25f; val2.minDistance = 2f; val2.rolloffMode = (AudioRolloffMode)0; } break; } float num = ((sound == MonsterSound.Step) ? StealthAudio.StepGain(Pursuit) : ((sound == MonsterSound.Detect) ? 0.3f : ((sound == MonsterSound.Hit) ? 0.65f : ((sound == MonsterSound.Ambience) ? 0.2f : ((sound >= MonsterSound.Scare1) ? 0.5f : 1f))))); val2.Stop(); val2.clip = val; val2.volume = Plugin.SoundVolume.Value * num; val2.pitch = 1f; val2.Play(); } private static AnimationCurve NearRolloff() { //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_0028: 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_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_0054: 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_005e: Unknown result type (might be due to invalid IL or missing references) //IL_0064: Expected O, but got Unknown return new AnimationCurve((Keyframe[])(object)new Keyframe[4] { new Keyframe(0f, 1f), new Keyframe(0.2f, 0.75f), new Keyframe(0.6f, 0.18f), new Keyframe(1f, 0f) }); } public void Breathing(bool allowed) { //IL_0128: 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_0137: Unknown result type (might be due to invalid IL or missing references) //IL_013c: Unknown result type (might be due to invalid IL or missing references) //IL_0143: Unknown result type (might be due to invalid IL or missing references) if (Object.op_Implicit((Object)(object)AudioManager.instance)) { breath.outputAudioMixerGroup = AudioManager.instance.SoundMasterGroup; } float num = (allowed ? (Plugin.SoundVolume.Value * 0.65f) : 0f); breath.volume = Mathf.MoveTowards(breath.volume, num, Time.deltaTime * 2f); if (allowed && num > 0f && !breath.isPlaying) { breath.clip = SoundBank.Get(MonsterSound.Breath); if (Object.op_Implicit((Object)(object)breath.clip)) { breath.Play(); } } if (!allowed && breath.volume < 0.001f) { breath.Stop(); } if (Time.time >= acousticAt) { acousticAt = Time.time + 0.25f; PlayerAvatar instance = PlayerAvatar.instance; bool flag = WorldQueries.Living(instance) && !WorldQueries.Clear(body.position + Vector3.up * 1.4f, WorldQueries.Eye(instance)); AudioLowPassFilter[] array = filters; foreach (AudioLowPassFilter val in array) { val.cutoffFrequency = (flag ? 1600 : 20000); } } } public void Stop() { voice.Stop(); hurt.Stop(); feet.Stop(); impact.Stop(); breath.Stop(); localCue.Stop(); ambience.Stop(); } } public sealed class MotionPolish { private float previousYaw; private float turn; private float hurtAt = -100f; private bool initialized; public void Hurt() { hurtAt = Time.time; } public void Apply(FlinchMotion motion, Transform body, float dt) { //IL_0017: Unknown result type (might be due to invalid IL or missing references) //IL_0160: Unknown result type (might be due to invalid IL or missing references) //IL_018c: Unknown result type (might be due to invalid IL or missing references) //IL_01c6: Unknown result type (might be due to invalid IL or missing references) //IL_01e3: Unknown result type (might be due to invalid IL or missing references) //IL_0255: Unknown result type (might be due to invalid IL or missing references) //IL_026f: Unknown result type (might be due to invalid IL or missing references) float y = body.eulerAngles.y; float num = (initialized ? Mathf.Clamp(Mathf.DeltaAngle(previousYaw, y) / Mathf.Max(dt, 0.001f), -120f, 120f) : 0f); previousYaw = y; initialized = true; turn = Mathf.Lerp(turn, num, 1f - Mathf.Exp((0f - dt) * 8f)); if (motion.State != State.Dead && motion.State != State.Stunned && motion.State != State.Observe && motion.State != State.LookUnder && motion.State != State.UnderAttack) { bool flag = motion.State == State.Chase || (motion.State == State.RoamBurst && motion.StateTime >= 0.55f); float num2 = Mathf.Clamp01(motion.DistanceMoved / Mathf.Max(dt, 0.001f) / 2f); float num3 = motion.GaitPhase * MathF.PI * 2f; Rotate("pelvis", Vector3.up, Mathf.Sin(num3) * (flag ? 3f : 1.6f) * num2); Rotate("chest", Vector3.forward, (0f - turn) * 0.035f + Mathf.Sin(num3) * (flag ? 3f : 1.2f) * num2); Rotate("spine_01", Vector3.right, (float)(flag ? 4 : 0) * num2); Rotate("neck", Vector3.right, Mathf.Sin(Time.time * 2.5f) * 0.8f * (1f - num2)); float num4 = Mathf.Clamp01((Time.time - hurtAt) / 0.28f); if (num4 < 1f) { float num5 = Mathf.Sin(num4 * MathF.PI) * (1f - num4); Rotate("chest", Vector3.right, -8f * num5); Rotate("neck", Vector3.right, 4f * num5); } } void Rotate(string name, Vector3 axis, float degrees) { //IL_0020: Unknown result type (might be due to invalid IL or missing references) //IL_0021: Unknown result type (might be due to invalid IL or missing references) //IL_0026: Unknown result type (might be due to invalid IL or missing references) //IL_002c: Unknown result type (might be due to invalid IL or missing references) //IL_0031: Unknown result type (might be due to invalid IL or missing references) if (motion.Map.TryGetValue(name, out Transform value)) { value.rotation = Quaternion.AngleAxis(degrees, body.TransformDirection(axis)) * value.rotation; } } } } public static class PlayerBody { private static readonly float[] UpperBodySamples = new float[3] { 0.68f, 0.84f, 0.96f }; public static bool OpenLowTarget(PlayerAvatar p) { return WorldQueries.Living(p) && (Fields.Get(p, "isCrouching") || Fields.Get(p, "isCrawling")) && !CoverReach.Hidden(p); } public static Vector3 AttackPoint(PlayerAvatar p, FlinchMotion motion) { //IL_000e: 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_0043: Unknown result type (might be due to invalid IL or missing references) //IL_0058: Unknown result type (might be due to invalid IL or missing references) //IL_005d: Unknown result type (might be due to invalid IL or missing references) //IL_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_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) //IL_0085: 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) //IL_007d: 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_008b: Unknown result type (might be due to invalid IL or missing references) Transform parent = motion.Visual.parent; if (TryAttackFrom(parent.position, parent.rotation, motion, p, motion.AttackVariant, out var target)) { return target; } Vector3 val = (motion.Map["upper_arm.L"].position + motion.Map["upper_arm.R"].position) * 0.5f; Collider val2 = Collider(p); return Object.op_Implicit((Object)(object)val2) ? ContactPoint(val2, val) : Aim(p); } private static Vector3 ContactPoint(Collider collider, Vector3 from) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_000d: Unknown result type (might be due to invalid IL or missing references) //IL_0010: 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) Vector3 val = collider.ClosestPoint(from); Bounds bounds = collider.bounds; return Vector3.MoveTowards(val, ((Bounds)(ref bounds)).center, 0.04f); } public static bool TryFaceAttackFrom(Vector3 position, Quaternion rotation, FlinchMotion motion, PlayerAvatar p, int variant, out Vector3 target) { //IL_0003: Unknown result type (might be due to invalid IL or missing references) //IL_0029: Unknown result type (might be due to invalid IL or missing references) //IL_002a: Unknown result type (might be due to invalid IL or missing references) target = default(Vector3); if (!WorldQueries.Living(p)) { return false; } Collider val = Collider(p); return Object.op_Implicit((Object)(object)val) && TryFaceColliderFrom(position, rotation, motion, val, variant, out target); } internal static bool TryFaceColliderFrom(Vector3 position, Quaternion rotation, FlinchMotion motion, Collider collider, int variant, out Vector3 target) { //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) //IL_000a: Unknown result type (might be due to invalid IL or missing references) //IL_000f: Unknown result type (might be due to invalid IL or missing references) //IL_0010: Unknown result type (might be due to invalid IL or missing references) //IL_0015: Unknown result type (might be due to invalid IL or missing references) //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) //IL_003a: 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_0032: 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_0038: Unknown result type (might be due to invalid IL or missing references) Bounds bounds = collider.bounds; Vector3 val = Vector3.ProjectOnPlane(((Bounds)(ref bounds)).center - position, Vector3.up); if (((Vector3)(ref val)).sqrMagnitude > 0.0001f) { rotation = Quaternion.LookRotation(val); } return TryAttackColliderFrom(position, rotation, motion, collider, variant, out target); } public static bool TryAttackFrom(Vector3 position, Quaternion rotation, FlinchMotion motion, PlayerAvatar p, int variant, out Vector3 target) { //IL_0003: Unknown result type (might be due to invalid IL or missing references) //IL_0029: Unknown result type (might be due to invalid IL or missing references) //IL_002a: Unknown result type (might be due to invalid IL or missing references) target = default(Vector3); if (!WorldQueries.Living(p)) { return false; } Collider val = Collider(p); return Object.op_Implicit((Object)(object)val) && TryAttackColliderFrom(position, rotation, motion, val, variant, out target); } private static bool TryAttackColliderFrom(Vector3 position, Quaternion rotation, FlinchMotion motion, Collider collider, int variant, out Vector3 target) { //IL_0003: Unknown result type (might be due to invalid IL or missing references) //IL_000a: Unknown result type (might be due to invalid IL or missing references) //IL_000f: Unknown result type (might be due to invalid IL or missing references) //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_0018: Unknown result type (might be due to invalid IL or missing references) //IL_001d: Unknown result type (might be due to invalid IL or missing references) //IL_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_0036: 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_003c: 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_0065: 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_0082: 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_00a6: Unknown result type (might be due to invalid IL or missing references) //IL_00ab: Unknown result type (might be due to invalid IL or missing references) //IL_00b5: 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_00bc: 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_00cc: Unknown result type (might be due to invalid IL or missing references) //IL_00d3: Unknown result type (might be due to invalid IL or missing references) //IL_00e1: Unknown result type (might be due to invalid IL or missing references) //IL_00e2: Unknown result type (might be due to invalid IL or missing references) //IL_00e3: 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_00f3: 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_0142: 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_0151: Unknown result type (might be due to invalid IL or missing references) //IL_0156: Unknown result type (might be due to invalid IL or missing references) //IL_015b: Unknown result type (might be due to invalid IL or missing references) //IL_015e: Unknown result type (might be due to invalid IL or missing references) //IL_0160: Unknown result type (might be due to invalid IL or missing references) //IL_0165: Unknown result type (might be due to invalid IL or missing references) //IL_0167: Unknown result type (might be due to invalid IL or missing references) //IL_0169: Unknown result type (might be due to invalid IL or missing references) //IL_0180: Unknown result type (might be due to invalid IL or missing references) //IL_0182: Unknown result type (might be due to invalid IL or missing references) //IL_01a4: Unknown result type (might be due to invalid IL or missing references) //IL_01a6: Unknown result type (might be due to invalid IL or missing references) //IL_01ac: Unknown result type (might be due to invalid IL or missing references) //IL_01b8: Unknown result type (might be due to invalid IL or missing references) //IL_01cf: Unknown result type (might be due to invalid IL or missing references) //IL_01d1: 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_01d8: Unknown result type (might be due to invalid IL or missing references) //IL_01da: Unknown result type (might be due to invalid IL or missing references) //IL_020c: Unknown result type (might be due to invalid IL or missing references) //IL_020e: 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) //IL_01f3: Unknown result type (might be due to invalid IL or missing references) //IL_022c: Unknown result type (might be due to invalid IL or missing references) //IL_022e: Unknown result type (might be due to invalid IL or missing references) target = default(Vector3); Bounds bounds = collider.bounds; Vector3 val = Vector3.ProjectOnPlane(((Bounds)(ref bounds)).center - position, Vector3.up); if (((Vector3)(ref val)).sqrMagnitude > 0.0001f && Vector3.Dot(rotation * Vector3.forward, ((Vector3)(ref val)).normalized) < 0.88f) { return false; } if (!WallSafety.ClearStepPose(position, rotation)) { return false; } if (!GroundSupport.Floor(position, 0.12f, 0.24f, out var floor)) { return false; } Vector3 val2 = rotation * Vector3.back * 0.9f; float y = floor.Position.y - Vector3.Dot(floor.Normal, val2) / floor.Normal.y; Vector3 point = position + val2; point.y = y; if (!GroundSupport.Floor(point, 0.09f, 0.09f, out var _)) { return false; } Transform parent = motion.Visual.parent; Transform val3 = motion.Map[(variant == 0) ? "upper_arm.R" : "upper_arm.L"]; Vector3 val4 = position + rotation * parent.InverseTransformPoint(val3.position); Vector3 val5 = ContactPoint(collider, val4); if (ClearReach(val4, val5, ((Component)collider).transform, upwardArc: false)) { target = val5; return true; } float[] upperBodySamples = UpperBodySamples; foreach (float num in upperBodySamples) { Vector3 val6 = val4; val6.y = Mathf.Lerp(((Bounds)(ref bounds)).min.y, ((Bounds)(ref bounds)).max.y, num); Vector3 val7 = ContactPoint(collider, val6); if (ClearReach(val4, val7, ((Component)collider).transform, upwardArc: false)) { target = val7; return true; } } if (!ClearReach(val4, val5, ((Component)collider).transform, upwardArc: true)) { return false; } target = val5; return true; } private static bool ClearReach(Vector3 shoulder, Vector3 target, Transform ignore, bool upwardArc) { //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) //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_0009: Unknown result type (might be due to invalid IL or missing references) //IL_000a: Unknown result type (might be due to invalid IL or missing references) //IL_000f: Unknown result type (might be due to invalid IL or missing references) //IL_0014: 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_0054: 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_006f: 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_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_0098: 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_00ac: 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_00b3: 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_00c2: Unknown result type (might be due to invalid IL or missing references) //IL_00c3: Unknown result type (might be due to invalid IL or missing references) //IL_00d1: 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) Vector3 val = target - shoulder; Vector3 val2 = Vector3.ProjectOnPlane(val, Vector3.up); if (!ReachEnvelope.Allows(((Vector3)(ref val2)).magnitude, val.y)) { return false; } if (!upwardArc) { return WorldQueries.ClearTube(shoulder, target, 0.065f, ignore); } if (val.y <= 0.1f) { return false; } Vector3 val3 = shoulder + ((Vector3)(ref val2)).normalized * Mathf.Min(0.35f, ((Vector3)(ref val2)).magnitude * 0.25f); val3.y = target.y + 0.2f; return Vector3.Distance(shoulder, val3) + Vector3.Distance(val3, target) <= 1.95f && WorldQueries.ClearTube(shoulder, val3, 0.07f, ignore) && WorldQueries.ClearTube(val3, target, 0.07f, ignore); } public static bool CanAttackFrom(Vector3 position, Quaternion rotation, FlinchMotion motion, PlayerAvatar p) { //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_000e: Unknown result type (might be due to invalid IL or missing references) //IL_000f: Unknown result type (might be due to invalid IL or missing references) Vector3 target; return TryAttackFrom(position, rotation, motion, p, 0, out target) || TryAttackFrom(position, rotation, motion, p, 1, out target); } public static bool InReach(PlayerAvatar p, FlinchMotion motion) { //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) if (!WorldQueries.Living(p)) { return false; } return CanAttackFrom(motion.Visual.parent.position, motion.Visual.parent.rotation, motion, p); } public static Collider Collider(PlayerAvatar p) { PlayerTumble val = Fields.Get(p, "tumble"); if (Object.op_Implicit((Object)(object)val) && Fields.Get(val, "isTumbling")) { Collider[] componentsInChildren = ((Component)val).GetComponentsInChildren(); foreach (Collider val2 in componentsInChildren) { if (val2.enabled && !val2.isTrigger) { return val2; } } } if ((Object)(object)p == (Object)(object)PlayerAvatar.instance && Object.op_Implicit((Object)(object)PlayerController.instance) && Object.op_Implicit((Object)(object)PlayerController.instance.col) && PlayerController.instance.col.enabled) { return PlayerController.instance.col; } Collider[] componentsInChildren2 = ((Component)p).GetComponentsInChildren(); foreach (Collider val3 in componentsInChildren2) { if (val3.enabled && !val3.isTrigger && ((Component)val3).gameObject.layer == LayerMask.NameToLayer("Player")) { return val3; } } return null; } public static Vector3 Aim(PlayerAvatar p) { //IL_002d: Unknown result type (might be due to invalid IL or missing references) //IL_0032: Unknown result type (might be due to invalid IL or missing references) //IL_0035: 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_0016: 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_0025: Unknown result type (might be due to invalid IL or missing references) //IL_003a: 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) Collider val = Collider(p); Vector3 result; if (!Object.op_Implicit((Object)(object)val)) { result = WorldQueries.Eye(p) - Vector3.up * 0.25f; } else { Bounds bounds = val.bounds; result = ((Bounds)(ref bounds)).center; } return result; } } public sealed class NativeMelee { private const float ContactRadius = 0.18f; private readonly GameObject volume; private readonly BoxCollider box; private readonly HurtCollider hurt; private readonly Action hurtPlayer; private Vector3 previousHand; private Vector3 previousTip; private float previousPhase; private int sequence = -1; public event Action Contact; public static bool LimbClear(FlinchMotion motion, int variant) { //IL_0027: 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_006a: 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) string text = ((variant == 0) ? "R" : "L"); return WorldQueries.ClearTube(motion.Map["upper_arm." + text].position, motion.Map["forearm." + text].position, 0.075f) && WorldQueries.ClearTube(motion.Map["forearm." + text].position, motion.Map["hand." + text].position, 0.065f); } public static bool CanContact(FlinchMotion motion, int variant, Vector3 previousHand, Vector3 previousTip, Collider target) { //IL_0059: 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_0075: 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_007d: 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_008a: 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_009c: Unknown result type (might be due to invalid IL or missing references) //IL_00b2: Unknown result type (might be due to invalid IL or missing references) //IL_00b7: Unknown result type (might be due to invalid IL or missing references) //IL_00bb: Unknown result type (might be due to invalid IL or missing references) //IL_00df: Unknown result type (might be due to invalid IL or missing references) //IL_00e0: Unknown result type (might be due to invalid IL or missing references) //IL_00e6: 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_011e: 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_0122: Unknown result type (might be due to invalid IL or missing references) //IL_0127: Unknown result type (might be due to invalid IL or missing references) //IL_0129: 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_012d: 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_0135: Unknown result type (might be due to invalid IL or missing references) //IL_0137: Unknown result type (might be due to invalid IL or missing references) //IL_017b: Unknown result type (might be due to invalid IL or missing references) //IL_017d: Unknown result type (might be due to invalid IL or missing references) //IL_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_0186: Unknown result type (might be due to invalid IL or missing references) //IL_0187: Unknown result type (might be due to invalid IL or missing references) //IL_019f: 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_01a5: Unknown result type (might be due to invalid IL or missing references) //IL_01aa: Unknown result type (might be due to invalid IL or missing references) //IL_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_01cf: Unknown result type (might be due to invalid IL or missing references) //IL_01d4: Unknown result type (might be due to invalid IL or missing references) //IL_01d9: Unknown result type (might be due to invalid IL or missing references) //IL_01dd: Unknown result type (might be due to invalid IL or missing references) //IL_01df: 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_01ec: Unknown result type (might be due to invalid IL or missing references) //IL_01f7: Unknown result type (might be due to invalid IL or missing references) //IL_01f9: Unknown result type (might be due to invalid IL or missing references) if (!Object.op_Implicit((Object)(object)target) || !target.enabled || !((Component)target).gameObject.activeInHierarchy) { return false; } string text = ((variant == 0) ? "R" : "L"); Vector3 position = motion.Map["hand." + text].position; Vector3 position2 = motion.Map["finger_2.03." + text].position; Bounds val = default(Bounds); ((Bounds)(ref val))..ctor(position, Vector3.zero); ((Bounds)(ref val)).Encapsulate(position2); ((Bounds)(ref val)).Encapsulate(previousHand); ((Bounds)(ref val)).Encapsulate(previousTip); ((Bounds)(ref val)).Expand(0.36f); Bounds bounds = target.bounds; if (!((Bounds)(ref val)).Intersects(bounds) || !LimbClear(motion, variant)) { return false; } float num = Mathf.Max(Vector3.Distance(previousHand, position), Vector3.Distance(previousTip, position2)); int num2 = Mathf.Clamp(Mathf.CeilToInt(num / 0.08f), 1, 16); for (int num3 = num2; num3 >= 0; num3--) { float num4 = (float)num3 / (float)num2; Vector3 val2 = Vector3.Lerp(previousHand, position, num4); Vector3 val3 = Vector3.Lerp(previousTip, position2, num4); Collider[] array = Physics.OverlapCapsule(val2, val3, 0.18f, 1 << ((Component)target).gameObject.layer, (QueryTriggerInteraction)1); foreach (Collider val4 in array) { if ((Object)(object)val4 != (Object)(object)target) { continue; } Vector3 val5 = val3 - val2; if (WorldQueries.ClearTube(position, val2, 0.055f)) { Vector3 finger = val2 + val5 * Mathf.Clamp01(Vector3.Dot(((Bounds)(ref bounds)).center - val2, val5) / Mathf.Max(1E-05f, ((Vector3)(ref val5)).sqrMagnitude)); if (ClearContact(target, val2, finger) || ClearContact(target, val2, val3) || ClearContact(target, val2, val2)) { return true; } } } } return false; } private static bool ClearContact(Collider target, Vector3 wrist, Vector3 finger) { //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) //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_0009: Unknown result type (might be due to invalid IL or missing references) //IL_000a: 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_0010: 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_0020: Unknown result type (might be due to invalid IL or missing references) Vector3 val = target.ClosestPoint(finger); Vector3 val2 = val - finger; return ((Vector3)(ref val2)).sqrMagnitude <= 0.0324f && WorldQueries.ClearTube(wrist, val, 0.045f); } public NativeMelee(Transform body, Enemy host) { //IL_0015: Unknown result type (might be due to invalid IL or missing references) //IL_001f: Expected O, but got Unknown //IL_0070: 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_0175: Unknown result type (might be due to invalid IL or missing references) //IL_017f: Expected O, but got Unknown //IL_0185: Unknown result type (might be due to invalid IL or missing references) //IL_018f: Expected O, but got Unknown //IL_0195: Unknown result type (might be due to invalid IL or missing references) //IL_019f: Expected O, but got Unknown //IL_01a5: Unknown result type (might be due to invalid IL or missing references) //IL_01af: Expected O, but got Unknown //IL_01d8: Unknown result type (might be due to invalid IL or missing references) //IL_01e2: Expected O, but got Unknown volume = new GameObject("Flinch native strike"); volume.SetActive(false); volume.transform.SetParent(body, false); volume.layer = 2; box = volume.AddComponent(); ((Collider)box).isTrigger = true; box.size = Vector3.one * 0.4f; hurt = volume.AddComponent(); hurt.enemyHost = host; hurt.playerLogic = false; hurt.playerKill = false; hurt.physLogic = false; hurt.enemyLogic = false; MethodInfo method = typeof(HurtCollider).GetMethod("PlayerHurt", BindingFlags.Instance | BindingFlags.NonPublic); hurtPlayer = (Action)method.CreateDelegate(typeof(Action), hurt); hurt.playerDamage = 35; hurt.playerDamageCooldown = 2f; hurt.playerHitForce = 12f; hurt.playerTumbleTime = 0.6f; hurt.playerTumbleForce = 10f; hurt.playerRayCast = false; hurt.hasTimer = false; hurt.onImpactAny = new UnityEvent(); hurt.onImpactPlayer = new UnityEvent(); hurt.onImpactPhysObject = new UnityEvent(); hurt.onImpactEnemy = new UnityEvent(); Fields.Set(hurt, "keepHitCooldownsOnDisable", true); hurt.onImpactPlayer.AddListener((UnityAction)delegate { Plugin.Instance?.CombatLog("FLINCH_STRIKE_CONTACT: native melee contact"); this.Contact?.Invoke(Fields.Get(hurt, "onImpactPlayerAvatar")); }); } public void Stop() { volume.SetActive(false); } public void Tick(State state, float phase, int nextSequence, int variant, FlinchMotion motion, int damage) { //IL_0029: 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_0046: 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_0072: 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_0079: 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_00af: 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_00b1: 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_00bd: Unknown result type (might be due to invalid IL or missing references) //IL_00c2: Unknown result type (might be due to invalid IL or missing references) //IL_00c7: Unknown result type (might be due to invalid IL or missing references) //IL_00cc: 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_00cf: 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_00d6: 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_00e1: 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_00eb: Unknown result type (might be due to invalid IL or missing references) //IL_00f8: 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_0106: Unknown result type (might be due to invalid IL or missing references) //IL_010b: Unknown result type (might be due to invalid IL or missing references) //IL_011c: 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_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_012f: Unknown result type (might be due to invalid IL or missing references) //IL_0134: Unknown result type (might be due to invalid IL or missing references) //IL_0267: Unknown result type (might be due to invalid IL or missing references) //IL_0268: Unknown result type (might be due to invalid IL or missing references) //IL_026e: Unknown result type (might be due to invalid IL or missing references) //IL_026f: 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_0225: Unknown result type (might be due to invalid IL or missing references) string text = ((variant == 0) ? "R" : "L"); Vector3 position = motion.Map["hand." + text].position; Vector3 position2 = motion.Map["finger_2.03." + text].position; if (sequence != nextSequence) { sequence = nextSequence; previousPhase = 0f; previousHand = position; previousTip = position2; Fields.Get>(hurt, "hits").Clear(); } bool flag = MeleeWindow.Active(state, previousPhase, phase); if (flag) { Vector3 val = Vector3.Min(Vector3.Min(position, position2), Vector3.Min(previousHand, previousTip)); Vector3 val2 = Vector3.Max(Vector3.Max(position, position2), Vector3.Max(previousHand, previousTip)); volume.transform.SetPositionAndRotation((val + val2) * 0.5f, Quaternion.identity); box.size = val2 - val + Vector3.one * 0.36f; } if (flag && !volume.activeSelf) { Plugin.Instance?.CombatLog("FLINCH_STRIKE_OPEN: hand=" + text + ", damage=" + damage); } if (volume.activeSelf != flag) { volume.SetActive(flag); } if (flag) { hurt.playerDamage = damage; bool flag2 = GameManager.Multiplayer(); foreach (PlayerAvatar item in SemiFunc.PlayerGetList()) { if (!WorldQueries.Living(item)) { continue; } if (flag2) { PhotonView obj = Fields.Get(item, "photonView"); if (obj == null || !obj.IsMine) { continue; } } if (CanContact(motion, variant, previousHand, previousTip, PlayerBody.Collider(item))) { hurtPlayer(item); } } } previousHand = position; previousTip = position2; previousPhase = phase; } } public static class NativePhysics { public static void Build(GameObject go, Enemy enemy, Transform follow, Transform[] bones) { //IL_005d: 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) //IL_00b8: 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_0112: Unknown result type (might be due to invalid IL or missing references) //IL_011c: Expected O, but got Unknown //IL_013a: 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_0149: Unknown result type (might be due to invalid IL or missing references) //IL_015f: Unknown result type (might be due to invalid IL or missing references) //IL_0169: Unknown result type (might be due to invalid IL or missing references) //IL_016e: Unknown result type (might be due to invalid IL or missing references) //IL_0185: Unknown result type (might be due to invalid IL or missing references) //IL_018a: Unknown result type (might be due to invalid IL or missing references) //IL_019b: Unknown result type (might be due to invalid IL or missing references) //IL_01a0: Unknown result type (might be due to invalid IL or missing references) //IL_0318: Unknown result type (might be due to invalid IL or missing references) //IL_0322: Expected O, but got Unknown //IL_0324: Unknown result type (might be due to invalid IL or missing references) //IL_032e: Expected O, but got Unknown //IL_0330: Unknown result type (might be due to invalid IL or missing references) //IL_033a: Expected O, but got Unknown //IL_033c: Unknown result type (might be due to invalid IL or missing references) //IL_0346: Expected O, but got Unknown //IL_0348: Unknown result type (might be due to invalid IL or missing references) //IL_0352: Expected O, but got Unknown //IL_0354: Unknown result type (might be due to invalid IL or missing references) //IL_035e: Expected O, but got Unknown //IL_0360: Unknown result type (might be due to invalid IL or missing references) //IL_036a: Expected O, but got Unknown //IL_036c: Unknown result type (might be due to invalid IL or missing references) //IL_0376: Expected O, but got Unknown //IL_0378: Unknown result type (might be due to invalid IL or missing references) //IL_0382: Expected O, but got Unknown //IL_0384: Unknown result type (might be due to invalid IL or missing references) //IL_038e: Expected O, but got Unknown //IL_0390: Unknown result type (might be due to invalid IL or missing references) //IL_039a: Expected O, but got Unknown //IL_039c: Unknown result type (might be due to invalid IL or missing references) //IL_03a6: Expected O, but got Unknown //IL_03a8: Unknown result type (might be due to invalid IL or missing references) //IL_03b2: Expected O, but got Unknown //IL_03b4: Unknown result type (might be due to invalid IL or missing references) //IL_03be: Expected O, but got Unknown //IL_03c0: Unknown result type (might be due to invalid IL or missing references) //IL_03ca: Expected O, but got Unknown //IL_03cc: Unknown result type (might be due to invalid IL or missing references) //IL_03d6: Expected O, but got Unknown //IL_03d8: Unknown result type (might be due to invalid IL or missing references) //IL_03e2: Expected O, but got Unknown //IL_03f1: Unknown result type (might be due to invalid IL or missing references) //IL_03fb: Expected O, but got Unknown //IL_040b: Unknown result type (might be due to invalid IL or missing references) //IL_0415: Expected O, but got Unknown //IL_0425: Unknown result type (might be due to invalid IL or missing references) //IL_042f: Expected O, but got Unknown //IL_0435: Unknown result type (might be due to invalid IL or missing references) //IL_043a: Unknown result type (might be due to invalid IL or missing references) //IL_0446: Unknown result type (might be due to invalid IL or missing references) //IL_0452: Unknown result type (might be due to invalid IL or missing references) //IL_045e: Unknown result type (might be due to invalid IL or missing references) //IL_0468: Expected O, but got Unknown //IL_04aa: Unknown result type (might be due to invalid IL or missing references) //IL_04d6: Unknown result type (might be due to invalid IL or missing references) //IL_04f2: Unknown result type (might be due to invalid IL or missing references) //IL_04f9: Expected O, but got Unknown //IL_0542: Unknown result type (might be due to invalid IL or missing references) //IL_055e: Unknown result type (might be due to invalid IL or missing references) //IL_0627: Unknown result type (might be due to invalid IL or missing references) go.tag = "Enemy"; Rigidbody val = go.AddComponent(); val.mass = 12f; val.useGravity = true; val.isKinematic = true; val.linearDamping = 0.4f; val.angularDamping = 5f; val.interpolation = (RigidbodyInterpolation)1; val.collisionDetectionMode = (CollisionDetectionMode)2; Transform transform = new GameObject("Center of Mass").transform; transform.SetParent(go.transform, false); transform.localPosition = new Vector3(0f, 0.8f, -0.15f); PhotonView val2 = go.AddComponent(); PhotonTransformView item = go.AddComponent(); RoomVolumeCheck val3 = go.AddComponent(); val3.CheckPosition = new Vector3(0f, 1.1f, 0f); PhysGrabObject val4 = go.AddComponent(); val4.overrideTagsAndLayers = false; val4.ignoreGrabPointCentering = true; NotValuableObject val5 = go.AddComponent(); val5.physAttributePreset = ScriptableObject.CreateInstance(); val5.physAttributePreset.mass = val.mass; val5.hasHealth = false; val5.healthDestroy = false; val5.particleColors = new Gradient(); val5.particleColors.SetKeys((GradientColorKey[])(object)new GradientColorKey[2] { new GradientColorKey(new Color(0.3f, 0.34f, 0.05f), 0f), new GradientColorKey(new Color(0.16f, 0.19f, 0.02f), 1f) }, (GradientAlphaKey[])(object)new GradientAlphaKey[2] { new GradientAlphaKey(1f, 0f), new GradientAlphaKey(1f, 1f) }); PhysGrabObjectImpactDetector val6 = go.AddComponent(); val6.particleDisable = true; val6.slidingDisable = true; val6.destroyDisable = true; val6.playerHurtDisable = true; EnemyRigidbody val7 = go.AddComponent(); val7.enemy = enemy; val7.followTarget = follow; val7.gravity = true; val7.grabForceNeeded = ScriptableObject.CreateInstance(); val7.grabForceNeeded.amount = 0.1f; val7.grabTimeNeeded = 0.35f; val7.grabStun = true; val7.grabOverride = true; val7.grabPositionStrength = 0.08f; val7.grabRotationStrength = 0.08f; val7.grabTimeMax = 3f; val7.positionSpeedIdle = 3f; val7.positionSpeedChase = 6f; val7.positionSpeedLerpIdle = 30f; val7.positionSpeedLerpChase = 30f; val7.rotationSpeedIdle = 3f; val7.rotationSpeedChase = 4f; val7.rotationSpeedDamping = 15f; val7.speedResetCurve = AnimationCurve.EaseInOut(0f, 0f, 1f, 1f); val7.distanceWarpIdle = (val7.distanceWarpChase = 100f); val7.notMovingDistance = 0.015f; Fields.Set(val7, "disableFollowPositionResetSpeed", 10f); Fields.Set(val7, "disableFollowRotationResetSpeed", 10f); val7.onImpactLight = new UnityEvent(); val7.onImpactMedium = new UnityEvent(); val7.onImpactHeavy = new UnityEvent(); val7.onTouchPlayer = new UnityEvent(); val7.onTouchPlayerGrabbedObject = new UnityEvent(); val7.onTouchPhysObject = new UnityEvent(); val7.onGrabbed = new UnityEvent(); val6.onAllImpacts = new UnityEvent(); val6.onImpactLight = new UnityEvent(); val6.onImpactMedium = new UnityEvent(); val6.onImpactHeavy = new UnityEvent(); val6.onAllBreaks = new UnityEvent(); val6.onBreakLight = new UnityEvent(); val6.onBreakMedium = new UnityEvent(); val6.onBreakHeavy = new UnityEvent(); val6.onDestroy = new UnityEvent(); val6.onHurtColliderHit = new UnityEvent(); val6.onImpactLight.AddListener(new UnityAction(val7.LightImpact)); val6.onImpactMedium.AddListener(new UnityAction(val7.MediumImpact)); val6.onImpactHeavy.AddListener(new UnityAction(val7.HeavyImpact)); PhysicsMaterial val8 = (val7.ColliderMaterialJumping = (val7.ColliderMaterialGrabbed = (val7.ColliderMaterialStunned = (val7.ColliderMaterialDisabled = (val7.ColliderMaterialDefault = new PhysicsMaterial("Flinch physics") { dynamicFriction = 0.08f, staticFriction = 0.08f, bounciness = 0f, frictionCombine = (PhysicsMaterialCombine)2 }))))); Capsule(go, "Torso", new Vector3(0f, 0.995f, -0.3f), 0.34f, 1.92f, val8); Capsule(go, "Head", new Vector3(0f, 2.02f, 0.24f), 0.35f, 0.7f, val8); GameObject val9 = new GameObject("Feet support"); val9.transform.SetParent(go.transform, false); val9.layer = go.layer; val9.tag = "Phys Grab Object"; BoxCollider val10 = val9.AddComponent(); val10.center = new Vector3(0f, 0.06f, -0.1f); val10.size = new Vector3(0.64f, 0.12f, 0.64f); ((Collider)val10).sharedMaterial = val8; val9.AddComponent(); WallSafety.AddHitShapes(bones, go.layer); Collider[] componentsInChildren = go.GetComponentsInChildren(true); foreach (Collider val11 in componentsInChildren) { if (((Component)val11).transform.IsChildOf(bones[0])) { val11.isTrigger = true; } ((Component)val11).gameObject.tag = "Phys Grab Object"; if (!Object.op_Implicit((Object)(object)((Component)val11).GetComponent())) { ((Component)val11).gameObject.AddComponent(); } } val2.ObservedComponents = new List { (Component)(object)item, (Component)(object)val4, (Component)(object)val6 }; val2.Synchronization = (ViewSynchronization)2; } private static void Capsule(GameObject root, string name, Vector3 center, float radius, float height, PhysicsMaterial material) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0008: Expected O, but got Unknown //IL_003c: Unknown result type (might be due to invalid IL or missing references) GameObject val = new GameObject(name); val.transform.SetParent(root.transform, false); val.layer = root.layer; val.tag = "Phys Grab Object"; CapsuleCollider val2 = val.AddComponent(); val2.center = center; val2.radius = radius; val2.height = height; ((Collider)val2).sharedMaterial = material; val.AddComponent(); } } [DefaultExecutionOrder(250)] public sealed class NativePresenceCycle : MonoBehaviourPunCallbacks, IPunObservable { private EnemyParent parent; private FlinchActor actor; private float pause; private float checkAt; private bool initialized; private bool close; public int Epoch; private int recoveryHealth = -1; private float recoveryCooldown; private int recoverySerial; public int RecoverySerial => recoverySerial; private void Awake() { //IL_0031: Unknown result type (might be due to invalid IL or missing references) //IL_003b: Expected O, but got Unknown parent = ((Component)this).GetComponent(); actor = ((Component)this).GetComponentInChildren(true); ((Component)actor).GetComponent().OnSpawn.AddListener(new UnityAction(OnNativeSpawn)); } public void Initialize() { if (initialized) { return; } initialized = true; if (SemiFunc.IsMasterClientOrSingleplayer()) { parent.SpawnedTimer = Random.Range(parent.SpawnedTimeMin, parent.SpawnedTimeMax); pause = (Fields.Get(EnemyDirector.instance, "debugNoSpawnedPause") ? 0f : (Random.Range(3f, 4f) * 60f)); if (actor.TestSummon) { Fields.Set(parent, "firstSpawnPointUsed", true); return; } parent.Despawn(); parent.DespawnedTimer = Random.Range(2f, 5f); actor.SetPresence(active: false); } } public void OnNativeSpawn() { //IL_0124: 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_013e: Unknown result type (might be due to invalid IL or missing references) //IL_00e0: Unknown result type (might be due to invalid IL or missing references) if (SemiFunc.IsMasterClientOrSingleplayer()) { Epoch++; pause = (Fields.Get(EnemyDirector.instance, "debugNoSpawnedPause") ? 0f : (Random.Range(3f, 4f) * 60f)); } if (recoveryHealth > 0) { actor.RestoreRecoveryHealth(recoveryHealth); } actor.NativeSpawn(recoveryHealth > 0); if (SemiFunc.IsMasterClientOrSingleplayer() && Fields.Get(parent, "Spawned")) { int currentHealth = actor.CurrentHealth; recoveryHealth = -1; if (SemiFunc.IsMultiplayer()) { ((MonoBehaviourPun)this).photonView.RPC("PlacementRPC", (RpcTarget)0, new object[4] { ((Component)actor).transform.position, Epoch, recoverySerial, currentHealth }); } else { PlacementRPC(((Component)actor).transform.position, Epoch, recoverySerial, currentHealth); } } } public bool TryStuckRecovery() { //IL_00a5: Unknown result type (might be due to invalid IL or missing references) //IL_00b5: Unknown result type (might be due to invalid IL or missing references) //IL_0127: Unknown result type (might be due to invalid IL or missing references) //IL_012d: Unknown result type (might be due to invalid IL or missing references) if (!initialized || !Object.op_Implicit((Object)(object)actor) || !actor.ConfirmedStall || !SemiFunc.IsMasterClientOrSingleplayer() || !Fields.Get(parent, "Spawned") || recoveryCooldown > 0f || actor.ObservedOrHeld || actor.RecoveryPaused || actor.SeenByAnyPlayer()) { return false; } int currentHealth = actor.CurrentHealth; if (currentHealth <= 0) { return false; } if (!SpawnPlacement.Recovery(actor.PhysicsRoot.position, actor.PhysicsRoot.rotation, out var _)) { recoveryCooldown = 2f; return false; } if (SemiFunc.IsMultiplayer()) { ((MonoBehaviourPun)this).photonView.RPC("RecoveryRPC", (RpcTarget)0, new object[2] { currentHealth, recoverySerial + 1 }); } else { RecoveryRPC(currentHealth, recoverySerial + 1); } parent.Despawn(); parent.DespawnedTimer = 2f; actor.SetPresence(active: false); Plugin.Instance?.CombatLog("FLINCH_RECOVERY: blocked travel -> native Robe relocation, hp=" + currentHealth); return true; } [PunRPC] private void RecoveryRPC(int hp, int serial, PhotonMessageInfo info = default(PhotonMessageInfo)) { //IL_0008: Unknown result type (might be due to invalid IL or missing references) if ((!SemiFunc.IsMultiplayer() || info.Sender == PhotonNetwork.MasterClient) && serial >= recoverySerial) { recoverySerial = serial; recoveryHealth = Mathf.Clamp(hp, 1, ((Component)actor).GetComponent().health); recoveryCooldown = 15f; Fields.Set(parent, "firstSpawnPointUsed", true); } } [PunRPC] private void PlacementRPC(Vector3 position, int epoch, int serial, int hp, PhotonMessageInfo info = default(PhotonMessageInfo)) { //IL_0008: 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) if ((!SemiFunc.IsMultiplayer() || info.Sender == PhotonNetwork.MasterClient) && epoch >= Epoch && serial >= recoverySerial) { Epoch = epoch; recoverySerial = serial; recoveryHealth = -1; Fields.Set(parent, "Spawned", true); actor.RestoreRecoveryHealth(hp); actor.SyncNativePlacement(position); } } private void Update() { //IL_00f3: 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_0108: Unknown result type (might be due to invalid IL or missing references) //IL_010d: Unknown result type (might be due to invalid IL or missing references) //IL_0112: Unknown result type (might be due to invalid IL or missing references) //IL_0117: Unknown result type (might be due to invalid IL or missing references) //IL_0186: Unknown result type (might be due to invalid IL or missing references) //IL_0196: Unknown result type (might be due to invalid IL or missing references) //IL_019b: Unknown result type (might be due to invalid IL or missing references) //IL_01a0: Unknown result type (might be due to invalid IL or missing references) //IL_01a5: Unknown result type (might be due to invalid IL or missing references) //IL_01aa: Unknown result type (might be due to invalid IL or missing references) if (!Object.op_Implicit((Object)(object)actor) || !actor.Ready || !initialized || actor.Dying || !Plugin.ActiveLevel()) { return; } bool flag = Fields.Get(parent, "Spawned"); actor.SetPresence(flag); if (!SemiFunc.IsMasterClientOrSingleplayer()) { return; } recoveryCooldown = Mathf.Max(0f, recoveryCooldown - Time.deltaTime); if (Time.time >= checkAt) { checkAt = Time.time + 1f; close = false; parent.GetRoomVolume(); Vector3 val; foreach (PlayerAvatar item in SemiFunc.PlayerGetList()) { if (WorldQueries.Living(item)) { val = Vector3.ProjectOnPlane(((Component)item).transform.position - actor.PhysicsRoot.position, Vector3.up); if (((Vector3)(ref val)).magnitude <= 20f) { close = true; } } } foreach (PlayerDeathSpot item2 in Fields.Get>(GameDirector.instance, "PlayerDeathSpots")) { if (Object.op_Implicit((Object)(object)item2)) { val = Vector3.ProjectOnPlane(((Component)item2).transform.position - actor.PhysicsRoot.position, Vector3.up); if (((Vector3)(ref val)).magnitude <= 20f) { close = true; } } } Fields.Set(parent, "playerClose", close); if (close) { Fields.Set(EnemyDirector.instance, "spawnIdlePauseTimer", 0f); } } if (flag) { if (actor.CanNativeLeave && SemiFunc.EnemyForceLeave(((Component)actor).GetComponent())) { actor.BeginNativeLeave(); } if (parent.SpawnedTimer <= 0f) { if (!close && !actor.ObservedOrHeld) { parent.Despawn(); actor.SetPresence(active: false); } } else if (pause > 0f) { pause = Mathf.Max(0f, pause - Time.deltaTime); } else if (!close && !actor.ObservedOrHeld) { parent.SpawnedTimer = Mathf.Max(0f, parent.SpawnedTimer - Time.deltaTime); } } else { EnemyParent obj = parent; obj.DespawnedTimer -= Time.deltaTime; if (parent.DespawnedTimer <= 0f) { AccessTools.Method(typeof(EnemyParent), "Spawn", (Type[])null, (Type[])null).Invoke(parent, null); } } } public void OnPhotonSerializeView(PhotonStream stream, PhotonMessageInfo info) { //IL_019d: Unknown result type (might be due to invalid IL or missing references) //IL_01a2: Unknown result type (might be due to invalid IL or missing references) //IL_01cb: Unknown result type (might be due to invalid IL or missing references) //IL_00e4: Unknown result type (might be due to invalid IL or missing references) //IL_00d7: Unknown result type (might be due to invalid IL or missing references) //IL_02de: Unknown result type (might be due to invalid IL or missing references) //IL_02e3: Unknown result type (might be due to invalid IL or missing references) if (stream.IsWriting) { stream.SendNext((object)initialized); stream.SendNext((object)pause); stream.SendNext((object)parent.SpawnedTimer); stream.SendNext((object)parent.DespawnedTimer); stream.SendNext((object)Fields.Get(parent, "Spawned")); stream.SendNext((object)Epoch); stream.SendNext((object)Fields.Get(parent, "firstSpawnPointUsed")); LevelPoint val = Fields.Get(parent, "firstSpawnPoint"); stream.SendNext((object)Object.op_Implicit((Object)(object)val)); stream.SendNext((object)(Object.op_Implicit((Object)(object)val) ? ((Component)val).transform.position : Vector3.zero)); stream.SendNext((object)recoveryHealth); stream.SendNext((object)recoveryCooldown); stream.SendNext((object)recoverySerial); return; } bool flag = (bool)stream.ReceiveNext(); float num = (float)stream.ReceiveNext(); float spawnedTimer = (float)stream.ReceiveNext(); float despawnedTimer = (float)stream.ReceiveNext(); bool flag2 = (bool)stream.ReceiveNext(); int num2 = (int)stream.ReceiveNext(); bool flag3 = (bool)stream.ReceiveNext(); bool flag4 = (bool)stream.ReceiveNext(); Vector3 val2 = (Vector3)stream.ReceiveNext(); int num3 = (int)stream.ReceiveNext(); float num4 = (float)stream.ReceiveNext(); int num5 = (int)stream.ReceiveNext(); if (info.Sender != PhotonNetwork.MasterClient || num2 < Epoch || num5 < recoverySerial) { return; } recoverySerial = num5; initialized = flag; pause = num; parent.SpawnedTimer = spawnedTimer; parent.DespawnedTimer = despawnedTimer; Fields.Set(parent, "Spawned", flag2); Epoch = num2; recoveryHealth = num3; recoveryCooldown = Mathf.Max(0f, num4); if (initialized && !flag2 && Object.op_Implicit((Object)(object)actor)) { actor.RestoreDormantReadiness(); } Fields.Set(parent, "firstSpawnPointUsed", flag3); if (!flag3 && flag4) { foreach (LevelPoint item in SemiFunc.LevelPointsGetAll()) { if (Object.op_Implicit((Object)(object)item) && Vector3.Distance(((Component)item).transform.position, val2) < 0.2f) { Fields.Set(parent, "firstSpawnPoint", item); break; } } } if (Object.op_Implicit((Object)(object)actor) && actor.Ready) { actor.SetPresence(flag2); } } public override void OnMasterClientSwitched(Player player) { ((MonoBehaviourPunCallbacks)this).OnMasterClientSwitched(player); if (Object.op_Implicit((Object)(object)actor) && player == PhotonNetwork.LocalPlayer) { if (initialized && !Fields.Get(parent, "Spawned")) { actor.RestoreDormantReadiness(); } if (!Fields.Get(parent, "firstSpawnPointUsed") && !Object.op_Implicit((Object)(object)Fields.Get(parent, "firstSpawnPoint"))) { EnemyDirector.instance.FirstSpawnPointAdd(parent); } ((MonoBehaviourPunCallbacks)actor).OnMasterClientSwitched(player); } } } public sealed class NativeRoaming { private readonly Enemy enemy; private readonly RoamClock clock = new RoamClock(); private Vector3 destination; public bool Waiting => !clock.Selected; public Vector3 Goal => destination; public NativeRoaming(Enemy enemy) { this.enemy = enemy; clock.Idle(Random.Range(2f, 5f)); } public float[] Capture() { return clock.Capture(); } public void Restore(Vector3 goal, float selected, float idle, float blocked) { //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) destination = goal; clock.Restore(selected, idle, blocked); } public void Pause() { } public void ChangeRoute() { clock.Idle(Random.Range(2f, 5f)); } public void Avoid(Vector3 point, float seconds) { ChangeRoute(); } public Vector3 Destination(Vector3 body, float dt, bool clearingObstacle = false) { //IL_0051: 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_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_01c4: Unknown result type (might be due to invalid IL or missing references) //IL_00c3: Unknown result type (might be due to invalid IL or missing references) //IL_01bb: Unknown result type (might be due to invalid IL or missing references) //IL_01b7: Unknown result type (might be due to invalid IL or missing references) //IL_00e5: Unknown result type (might be due to invalid IL or missing references) //IL_01c0: Unknown result type (might be due to invalid IL or missing references) //IL_0107: Unknown result type (might be due to invalid IL or missing references) //IL_010c: Unknown result type (might be due to invalid IL or missing references) //IL_0116: Unknown result type (might be due to invalid IL or missing references) //IL_011b: Unknown result type (might be due to invalid IL or missing references) //IL_0131: Unknown result type (might be due to invalid IL or missing references) //IL_0136: Unknown result type (might be due to invalid IL or missing references) //IL_0165: Unknown result type (might be due to invalid IL or missing references) //IL_016a: Unknown result type (might be due to invalid IL or missing references) EnemyRigidbody val = Fields.Get(enemy, "Rigidbody"); float num = (Object.op_Implicit((Object)(object)val) ? Fields.Get(val, "notMovingTimer") : 0f); if (clearingObstacle && clock.Selected) { return destination; } float num2 = Vector3.Distance(body, destination); float idleSeconds = ((clock.Selected && (num2 < 2f || (num > 1f && clock.BlockedRemaining <= dt))) ? Random.Range(2f, 5f) : 2f); if (clock.Tick(dt, num2, num, frozen: false, SemiFunc.EnemySpawnIdlePause(), idleSeconds)) { LevelPoint val2 = SemiFunc.LevelPointGet(body, 5f, 15f); if (!Object.op_Implicit((Object)(object)val2)) { val2 = SemiFunc.LevelPointGet(body, 0f, 999f); } NavMeshHit val3 = default(NavMeshHit); if (Object.op_Implicit((Object)(object)val2) && NavMesh.SamplePosition(((Component)val2).transform.position + Random.insideUnitSphere * 3f, ref val3, 5f, -1) && Physics.Raycast(((NavMeshHit)(ref val3)).position, Vector3.down, 5f, LayerMask.GetMask(new string[1] { "Default" }))) { destination = ((NavMeshHit)(ref val3)).position; clock.Select(); Plugin.Instance.CombatLog("FLINCH_ROAM: Robe level point selected"); } else { clock.Idle(Random.Range(2f, 5f)); } } return clock.Selected ? destination : body; } } public sealed class ObstacleInteractor { private readonly Transform body; private readonly ObstructionClock clock = new ObstructionClock(); private Rigidbody pushing; private Vector3 direction; private Vector3 contact; private Collider blocker; private Rigidbody clearCart; private Vector3 clearForward; private Vector3 clearSide; private float clearLine; private Rigidbody assistedCart; private Vector3 assistedSide; private Vector3 expectedAssistVelocity; private float assistedSpeed; public float OwnNoiseUntil; public bool Clearing => Object.op_Implicit((Object)(object)blocker) && clock.Pending; public string Description => Object.op_Implicit((Object)(object)blocker) ? (((Object)blocker).name + (Object.op_Implicit((Object)(object)blocker.attachedRigidbody) ? "/rigidbody" : "/static")) : "none"; public event Action Warning; public event Action Reroute; private static Vector3 Flat(Vector3 value) { //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_0006: Unknown result type (might be due to invalid IL or missing references) return Vector3.ProjectOnPlane(value, Vector3.up); } private static bool CartBounds(Rigidbody rb, out Bounds bounds) { //IL_0002: 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_004f: Unknown result type (might be due to invalid IL or missing references) //IL_0054: Unknown result type (might be due to invalid IL or missing references) bounds = default(Bounds); bool flag = false; Collider[] componentsInChildren = ((Component)rb).GetComponentsInChildren(); foreach (Collider val in componentsInChildren) { if (val.enabled && !val.isTrigger && !((Object)(object)val.attachedRigidbody != (Object)(object)rb)) { if (!flag) { bounds = val.bounds; flag = true; } else { ((Bounds)(ref bounds)).Encapsulate(val.bounds); } } } return flag; } private static bool CartSupported(Rigidbody rb, Bounds bounds) { //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) //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_0023: Unknown result type (might be due to invalid IL or missing references) //IL_003a: Unknown result type (might be due to invalid IL or missing references) //IL_003f: Unknown result type (might be due to invalid IL or missing references) //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_006b: 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) //IL_00ad: Unknown result type (might be due to invalid IL or missing references) //IL_00b2: Unknown result type (might be due to invalid IL or missing references) //IL_00e6: Unknown result type (might be due to invalid IL or missing references) if (!(Vector3.Dot(rb.rotation * Vector3.up, Vector3.up) < 0.85f) && !(Mathf.Abs(rb.linearVelocity.y) > 0.25f)) { Vector3 angularVelocity = rb.angularVelocity; if (!(((Vector3)(ref angularVelocity)).sqrMagnitude > 0.25f)) { RaycastHit[] array = Physics.RaycastAll(new Vector3(((Bounds)(ref bounds)).center.x, ((Bounds)(ref bounds)).min.y + 0.12f, ((Bounds)(ref bounds)).center.z), Vector3.down, 0.3f, WorldQueries.Mask, (QueryTriggerInteraction)1); for (int i = 0; i < array.Length; i++) { RaycastHit val = array[i]; Collider collider = ((RaycastHit)(ref val)).collider; if (!((Object)(object)collider.attachedRigidbody == (Object)(object)rb) && !WorldQueries.Self(collider) && !Object.op_Implicit((Object)(object)WorldQueries.PlayerOwner(collider)) && !(((RaycastHit)(ref val)).normal.y < 0.65f) && (!Object.op_Implicit((Object)(object)collider.attachedRigidbody) || collider.attachedRigidbody.isKinematic)) { return true; } } return false; } } return false; } private static bool SideSupported(Bounds bounds, Vector3 offset) { //IL_0003: Unknown result type (might be due to invalid IL or missing references) //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_0009: 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_0029: 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_0065: 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_006d: 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_007a: Unknown result type (might be due to invalid IL or missing references) //IL_007f: 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) //IL_008f: 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_0099: 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_00a9: Unknown result type (might be due to invalid IL or missing references) //IL_00ae: Unknown result type (might be due to invalid IL or missing references) //IL_00b3: Unknown result type (might be due to invalid IL or missing references) //IL_00ba: Unknown result type (might be due to invalid IL or missing references) //IL_00c4: Unknown result type (might be due to invalid IL or missing references) //IL_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_00dc: 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_00e3: Unknown result type (might be due to invalid IL or missing references) Vector3 val = ((Bounds)(ref bounds)).center + offset; val.y = ((Bounds)(ref bounds)).min.y; float num = Mathf.Max(0.04f, ((Bounds)(ref bounds)).extents.x - 0.06f); float num2 = Mathf.Max(0.04f, ((Bounds)(ref bounds)).extents.z - 0.06f); Vector3[] array = (Vector3[])(object)new Vector3[5] { val, val + new Vector3(num, 0f, num2), val + new Vector3(0f - num, 0f, num2), val + new Vector3(num, 0f, 0f - num2), val + new Vector3(0f - num, 0f, 0f - num2) }; foreach (Vector3 point in array) { if (!GroundSupport.Floor(point, 0.08f, 0.12f, out var _)) { return false; } } return true; } private static float SideRoom(Rigidbody rb, Bounds bounds, Vector3 side, PhysGrabObject[] cargo) { //IL_000a: 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_0020: 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_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_0046: 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_005e: 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_0083: Unknown result type (might be due to invalid IL or missing references) //IL_0084: Unknown result type (might be due to invalid IL or missing references) //IL_00d9: Unknown result type (might be due to invalid IL or missing references) //IL_00de: Unknown result type (might be due to invalid IL or missing references) //IL_00df: Unknown result type (might be due to invalid IL or missing references) //IL_00e0: Unknown result type (might be due to invalid IL or missing references) //IL_00fc: Unknown result type (might be due to invalid IL or missing references) //IL_0101: 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_0149: Unknown result type (might be due to invalid IL or missing references) //IL_017e: Unknown result type (might be due to invalid IL or missing references) //IL_0183: Unknown result type (might be due to invalid IL or missing references) //IL_0186: Unknown result type (might be due to invalid IL or missing references) Vector3 val = ((Bounds)(ref bounds)).extents + new Vector3(0.04f, -0.06f, 0.04f); val.y = Mathf.Max(0.05f, val.y); Bounds containment = bounds; ((Bounds)(ref containment)).Expand(0.08f); Collider[] array = Physics.OverlapBox(((Bounds)(ref bounds)).center, val, Quaternion.identity, WorldQueries.SolidMask, (QueryTriggerInteraction)1); foreach (Collider c in array) { if (Blocks(c)) { return 0f; } } float num = 1.7f; RaycastHit[] array2 = Physics.BoxCastAll(((Bounds)(ref bounds)).center, val, side, Quaternion.identity, num, WorldQueries.SolidMask, (QueryTriggerInteraction)1); for (int j = 0; j < array2.Length; j++) { RaycastHit val2 = array2[j]; if (Blocks(((RaycastHit)(ref val2)).collider)) { num = Mathf.Min(num, Mathf.Max(0f, ((RaycastHit)(ref val2)).distance - 0.06f)); } } if (!SideSupported(bounds, Vector3.zero)) { return 0f; } float num2 = 0f; while (num2 < num) { float num3 = Mathf.Min(num, num2 + 0.2f); if (!SideSupported(bounds, side * num3)) { return num2; } num2 = num3; } return num; bool Blocks(Collider val3) { //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) //IL_002d: 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_008f: 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_0097: 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_00af: Unknown result type (might be due to invalid IL or missing references) //IL_00b2: Unknown result type (might be due to invalid IL or missing references) int result; if (Object.op_Implicit((Object)(object)val3) && !((Object)(object)val3.attachedRigidbody == (Object)(object)rb) && !WorldQueries.Self(val3)) { Bounds bounds2 = val3.bounds; if (!(((Bounds)(ref bounds2)).max.y <= ((Bounds)(ref bounds)).min.y + 0.04f)) { PhysGrabObject componentInParent = ((Component)val3).GetComponentInParent(); if (Object.op_Implicit((Object)(object)componentInParent) && componentInParent.playerGrabbing.Count <= 0 && cargo.Contains(componentInParent)) { ref Bounds reference = ref containment; bounds2 = val3.bounds; if (((Bounds)(ref reference)).Contains(((Bounds)(ref bounds2)).min)) { ref Bounds reference2 = ref containment; bounds2 = val3.bounds; result = ((!((Bounds)(ref reference2)).Contains(((Bounds)(ref bounds2)).max)) ? 1 : 0); goto IL_00c2; } } result = 1; goto IL_00c2; } } return false; IL_00c2: return (byte)result != 0; } } private void ForgetCartAssist() { assistedCart = null; assistedSpeed = 0f; } private bool ReconcileCartAssist() { //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_00d3: Unknown result type (might be due to invalid IL or missing references) //IL_00d4: Unknown result type (might be due to invalid IL or missing references) //IL_00d6: 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_00e0: Unknown result type (might be due to invalid IL or missing references) //IL_00f0: Unknown result type (might be due to invalid IL or missing references) //IL_00f3: 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_0107: Unknown result type (might be due to invalid IL or missing references) //IL_010c: 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_0082: Unknown result type (might be due to invalid IL or missing references) //IL_0140: 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_0146: 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_0176: Unknown result type (might be due to invalid IL or missing references) //IL_0178: Unknown result type (might be due to invalid IL or missing references) //IL_0192: 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) //IL_0090: 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) if (!Object.op_Implicit((Object)(object)assistedCart)) { return false; } PhysGrabCart componentInParent = ((Component)assistedCart).GetComponentInParent(); PhysGrabObject componentInParent2 = ((Component)assistedCart).GetComponentInParent(); if (!Object.op_Implicit((Object)(object)componentInParent) || assistedCart.isKinematic || (Object.op_Implicit((Object)(object)componentInParent2) && componentInParent2.playerGrabbing.Count > 0) || Fields.Get(componentInParent, "cartBeingPulled") || !CartBounds(assistedCart, out var bounds) || !CartSupported(assistedCart, bounds) || !GroundSupport.BodyFloor(body.position, body.rotation, out var _)) { ForgetCartAssist(); return false; } Vector3 val = Flat(assistedCart.linearVelocity); Vector3 val2 = val - expectedAssistVelocity; if (!(((Vector3)(ref val)).sqrMagnitude > 2.1025002f) && !(Vector3.Dot(val2, assistedSide) > 0.25f)) { Vector3 val3 = Vector3.ProjectOnPlane(val2, assistedSide); if (!(((Vector3)(ref val3)).sqrMagnitude > 0.122499995f)) { float num = Mathf.Max(0f, Vector3.Dot(expectedAssistVelocity - val, assistedSide)); assistedSpeed = Mathf.Min(Mathf.Max(0f, assistedSpeed - num), Mathf.Max(0f, Vector3.Dot(val, assistedSide))); expectedAssistVelocity = val; if (assistedSpeed <= 0.005f) { ForgetCartAssist(); return false; } return true; } } ForgetCartAssist(); return false; } private void ApplyCartAssist(Rigidbody rb, Vector3 side, float delta, float dt, float maxForce = 90f) { //IL_0010: Unknown result type (might be due to invalid IL or missing references) //IL_0015: Unknown result type (might be due to invalid IL or missing references) //IL_00a1: Unknown result type (might be due to invalid IL or missing references) //IL_00a6: Unknown result type (might be due to invalid IL or missing references) //IL_00ab: Unknown result type (might be due to invalid IL or missing references) //IL_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_00be: Unknown result type (might be due to invalid IL or missing references) //IL_00c4: Unknown result type (might be due to invalid IL or missing references) //IL_00c6: 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) if ((Object)(object)assistedCart != (Object)(object)rb || Vector3.Dot(assistedSide, side) < 0.99f) { if (delta <= 0f) { return; } assistedCart = rb; assistedSide = side; assistedSpeed = 0f; } delta = Mathf.Max(0f - assistedSpeed, delta); float num = Mathf.Clamp(rb.mass * delta, (0f - maxForce) * dt, maxForce * dt); assistedSpeed = Mathf.Max(0f, assistedSpeed + num / rb.mass); expectedAssistVelocity = Flat(rb.linearVelocity) + side * (num / rb.mass); rb.AddForce(side * num, (ForceMode)1); if (assistedSpeed <= 0.005f) { ForgetCartAssist(); } } public void StopCartAssist(float dt) { //IL_002f: Unknown result type (might be due to invalid IL or missing references) if (!(dt <= 0f) && ReconcileCartAssist()) { float num = Mathf.Min(dt, 0.05f); ApplyCartAssist(assistedCart, assistedSide, 0f - Mathf.Min(assistedSpeed, 6f * num), num); } } public Vector3 ClearCart(Vector3 desired, float dt) { //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) //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) //IL_0055: 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_0064: Unknown result type (might be due to invalid IL or missing references) //IL_0069: Unknown result type (might be due to invalid IL or missing references) //IL_0075: 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_06be: 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_00fd: 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_01b6: Unknown result type (might be due to invalid IL or missing references) //IL_01bb: Unknown result type (might be due to invalid IL or missing references) //IL_01c0: Unknown result type (might be due to invalid IL or missing references) //IL_01a9: 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_01f0: Unknown result type (might be due to invalid IL or missing references) //IL_01f5: Unknown result type (might be due to invalid IL or missing references) //IL_016e: Unknown result type (might be due to invalid IL or missing references) //IL_017d: Unknown result type (might be due to invalid IL or missing references) //IL_0188: Unknown result type (might be due to invalid IL or missing references) //IL_0238: 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_02a1: Unknown result type (might be due to invalid IL or missing references) //IL_02a6: Unknown result type (might be due to invalid IL or missing references) //IL_02b0: Unknown result type (might be due to invalid IL or missing references) //IL_02b5: Unknown result type (might be due to invalid IL or missing references) //IL_02ba: Unknown result type (might be due to invalid IL or missing references) //IL_02c5: Unknown result type (might be due to invalid IL or missing references) //IL_02ca: Unknown result type (might be due to invalid IL or missing references) //IL_02cf: Unknown result type (might be due to invalid IL or missing references) //IL_02d4: Unknown result type (might be due to invalid IL or missing references) //IL_02ee: Unknown result type (might be due to invalid IL or missing references) //IL_02f4: Unknown result type (might be due to invalid IL or missing references) //IL_032f: Unknown result type (might be due to invalid IL or missing references) //IL_0339: Unknown result type (might be due to invalid IL or missing references) //IL_033e: Unknown result type (might be due to invalid IL or missing references) //IL_0354: Unknown result type (might be due to invalid IL or missing references) //IL_035b: Unknown result type (might be due to invalid IL or missing references) //IL_03e3: Unknown result type (might be due to invalid IL or missing references) //IL_03e9: Unknown result type (might be due to invalid IL or missing references) //IL_03ee: Unknown result type (might be due to invalid IL or missing references) //IL_03f3: Unknown result type (might be due to invalid IL or missing references) //IL_03f7: Unknown result type (might be due to invalid IL or missing references) //IL_03fc: Unknown result type (might be due to invalid IL or missing references) //IL_03fe: Unknown result type (might be due to invalid IL or missing references) //IL_040a: Unknown result type (might be due to invalid IL or missing references) //IL_0412: Unknown result type (might be due to invalid IL or missing references) //IL_041e: Unknown result type (might be due to invalid IL or missing references) //IL_042b: Unknown result type (might be due to invalid IL or missing references) //IL_0430: Unknown result type (might be due to invalid IL or missing references) //IL_045b: Unknown result type (might be due to invalid IL or missing references) //IL_045d: Unknown result type (might be due to invalid IL or missing references) //IL_045f: Unknown result type (might be due to invalid IL or missing references) //IL_046e: Unknown result type (might be due to invalid IL or missing references) //IL_0470: Unknown result type (might be due to invalid IL or missing references) //IL_04a6: Unknown result type (might be due to invalid IL or missing references) //IL_04ab: Unknown result type (might be due to invalid IL or missing references) //IL_04be: Unknown result type (might be due to invalid IL or missing references) //IL_04c3: Unknown result type (might be due to invalid IL or missing references) //IL_03a7: Unknown result type (might be due to invalid IL or missing references) //IL_03ac: Unknown result type (might be due to invalid IL or missing references) //IL_03b2: Unknown result type (might be due to invalid IL or missing references) //IL_03b7: Unknown result type (might be due to invalid IL or missing references) //IL_03c3: Unknown result type (might be due to invalid IL or missing references) //IL_03c8: Unknown result type (might be due to invalid IL or missing references) //IL_03ce: Unknown result type (might be due to invalid IL or missing references) //IL_03d3: Unknown result type (might be due to invalid IL or missing references) //IL_0391: Unknown result type (might be due to invalid IL or missing references) //IL_0396: Unknown result type (might be due to invalid IL or missing references) //IL_0500: Unknown result type (might be due to invalid IL or missing references) //IL_0505: Unknown result type (might be due to invalid IL or missing references) //IL_0575: Unknown result type (might be due to invalid IL or missing references) //IL_057a: Unknown result type (might be due to invalid IL or missing references) //IL_059f: Unknown result type (might be due to invalid IL or missing references) //IL_05a5: Unknown result type (might be due to invalid IL or missing references) //IL_053d: Unknown result type (might be due to invalid IL or missing references) //IL_0542: Unknown result type (might be due to invalid IL or missing references) //IL_0547: Unknown result type (might be due to invalid IL or missing references) //IL_0563: Unknown result type (might be due to invalid IL or missing references) //IL_0565: Unknown result type (might be due to invalid IL or missing references) //IL_05c8: Unknown result type (might be due to invalid IL or missing references) //IL_05cd: Unknown result type (might be due to invalid IL or missing references) //IL_056e: Unknown result type (might be due to invalid IL or missing references) //IL_056c: Unknown result type (might be due to invalid IL or missing references) //IL_06b5: Unknown result type (might be due to invalid IL or missing references) //IL_06ba: Unknown result type (might be due to invalid IL or missing references) //IL_05f4: Unknown result type (might be due to invalid IL or missing references) //IL_05f9: Unknown result type (might be due to invalid IL or missing references) //IL_05fe: Unknown result type (might be due to invalid IL or missing references) //IL_0600: Unknown result type (might be due to invalid IL or missing references) //IL_0603: Unknown result type (might be due to invalid IL or missing references) //IL_060f: Unknown result type (might be due to invalid IL or missing references) //IL_0612: Unknown result type (might be due to invalid IL or missing references) //IL_0696: Unknown result type (might be due to invalid IL or missing references) desired = Flat(desired); if (dt <= 0f) { return Vector3.zero; } if (((Vector3)(ref desired)).sqrMagnitude < 0.01f) { StopCartAssist(dt); return Vector3.zero; } RaycastHit val = (from h in Physics.SphereCastAll(body.position + Vector3.up * 0.65f, 0.45f, ((Vector3)(ref desired)).normalized, 7f, WorldQueries.Mask, (QueryTriggerInteraction)1) where !WorldQueries.Self(((RaycastHit)(ref h)).collider) && Object.op_Implicit((Object)(object)((Component)((RaycastHit)(ref h)).collider).GetComponentInParent()) orderby ((RaycastHit)(ref h)).distance select h).FirstOrDefault(); if (!Object.op_Implicit((Object)(object)((RaycastHit)(ref val)).collider)) { StopCartAssist(dt); clearCart = null; return Vector3.zero; } Rigidbody attachedRigidbody = ((RaycastHit)(ref val)).collider.attachedRigidbody; PhysGrabObject componentInParent = ((Component)((RaycastHit)(ref val)).collider).GetComponentInParent(); PhysGrabCart componentInParent2 = ((Component)((RaycastHit)(ref val)).collider).GetComponentInParent(); if (!Object.op_Implicit((Object)(object)attachedRigidbody) || attachedRigidbody.isKinematic || (Object.op_Implicit((Object)(object)componentInParent) && componentInParent.playerGrabbing.Count > 0) || Fields.Get(componentInParent2, "cartBeingPulled") || !CartBounds(attachedRigidbody, out var bounds) || !CartSupported(attachedRigidbody, bounds) || !GroundSupport.BodyFloor(body.position, body.rotation, out var _)) { StopCartAssist(dt); return Vector3.zero; } Vector3 val2 = Flat(attachedRigidbody.linearVelocity); if (((Vector3)(ref val2)).sqrMagnitude > 2.1025002f) { if ((Object)(object)assistedCart == (Object)(object)attachedRigidbody) { ForgetCartAssist(); } return Vector3.zero; } if (Object.op_Implicit((Object)(object)assistedCart) && (Object)(object)assistedCart != (Object)(object)attachedRigidbody) { StopCartAssist(dt); if (Object.op_Implicit((Object)(object)assistedCart)) { return Vector3.zero; } } if ((Object)(object)assistedCart == (Object)(object)attachedRigidbody) { ReconcileCartAssist(); } PhysGrabObject[] cargo = (from item in Fields.Get>(componentInParent2, "itemsInCart") where Object.op_Implicit((Object)(object)item) select item).ToArray(); val2 = Flat(((RaycastHit)(ref val)).collider.ClosestPoint(body.position + Vector3.up * 0.65f) - body.position); float magnitude = ((Vector3)(ref val2)).magnitude; bool flag = (Object)(object)assistedCart == (Object)(object)attachedRigidbody && Vector3.Dot(assistedSide, clearForward) > 0.99f; if (magnitude > (flag ? 1.2f : 0.9f)) { StopCartAssist(dt); return ((Vector3)(ref desired)).normalized * 1f; } if ((Object)(object)clearCart != (Object)(object)attachedRigidbody || Vector3.Dot(clearForward, ((Vector3)(ref desired)).normalized) < 0.7f) { if ((Object)(object)assistedCart == (Object)(object)attachedRigidbody) { StopCartAssist(dt); return Vector3.zero; } clearCart = attachedRigidbody; clearForward = ((Vector3)(ref desired)).normalized; clearSide = Vector3.zero; clearLine = Vector3.Dot(body.position, Vector3.Cross(Vector3.up, clearForward)); } Vector3 val3 = Vector3.Cross(Vector3.up, clearForward); Vector3 extents = ((Bounds)(ref bounds)).extents; float num = Mathf.Abs(val3.x) * extents.x + Mathf.Abs(val3.z) * extents.z; float num2 = Vector3.Dot(((Bounds)(ref bounds)).center, val3) - clearLine; float num3 = num + 0.5f + num2; float num4 = num + 0.5f - num2; float num5 = SideRoom(attachedRigidbody, bounds, -val3, cargo); float num6 = SideRoom(attachedRigidbody, bounds, val3, cargo); bool flag2 = num5 >= Mathf.Max(0.05f, num3); bool flag3 = num6 >= Mathf.Max(0.05f, num4); bool flag4 = (Vector3.Dot(clearSide, val3) > 0f && !flag3) || (Vector3.Dot(clearSide, val3) < 0f && !flag2); if (flag4 && (Object)(object)assistedCart == (Object)(object)attachedRigidbody) { StopCartAssist(dt); return Vector3.zero; } if (((Vector3)(ref clearSide)).sqrMagnitude < 0.5f || flag4) { if (!flag2 && !flag3) { return RollCartAhead(attachedRigidbody, componentInParent, bounds, cargo, dt); } clearSide = ((flag3 && (!flag2 || num6 - num4 >= num5 - num3)) ? val3 : (-val3)); } float num7 = ((Vector3.Dot(clearSide, val3) > 0f) ? num4 : num3); if ((Object)(object)assistedCart == (Object)(object)attachedRigidbody && Vector3.Dot(assistedSide, clearSide) < 0.99f) { StopCartAssist(dt); return Vector3.zero; } if (num7 > 0.02f) { if (componentInParent != null) { componentInParent.EnemyInteractTimeSet(); } Vector3 val4 = Flat(attachedRigidbody.linearVelocity); float num8 = Vector3.Dot(val4, clearSide); float num9 = Vector3.Dot(val4, clearForward); float num10 = Mathf.Min(1.15f, Mathf.Sqrt(Mathf.Max(0f, 1.8225001f - num9 * num9))); num10 = Mathf.Min(num10, Mathf.Sqrt(6f * Mathf.Max(0f, num7 - 0.08f))); float num11 = Mathf.Min(dt, 0.05f); float delta = Mathf.Clamp(num10 - num8, -6f * num11, 6f * num11); ApplyCartAssist(attachedRigidbody, clearSide, delta, num11); } else { StopCartAssist(dt); } return Vector3.zero; } private Vector3 RollCartAhead(Rigidbody cart, PhysGrabObject grab, Bounds bounds, PhysGrabObject[] cargo, float dt) { //IL_0010: 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_0049: Unknown result type (might be due to invalid IL or missing references) //IL_0050: Unknown result type (might be due to invalid IL or missing references) //IL_0064: Unknown result type (might be due to invalid IL or missing references) //IL_0069: Unknown result type (might be due to invalid IL or missing references) //IL_006e: Unknown result type (might be due to invalid IL or missing references) //IL_003a: Unknown result type (might be due to invalid IL or missing references) //IL_003f: Unknown result type (might be due to invalid IL or missing references) //IL_018f: 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_00ca: 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_00b2: 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_010b: 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_0149: 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_0186: Unknown result type (might be due to invalid IL or missing references) //IL_018b: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)assistedCart == (Object)(object)cart && Vector3.Dot(assistedSide, clearForward) < 0.99f) { StopCartAssist(dt); return Vector3.zero; } Collider[] array = Physics.OverlapBox(((Bounds)(ref bounds)).center, ((Bounds)(ref bounds)).extents + new Vector3(0.4f, 0f, 0.25f), Quaternion.identity, WorldQueries.SolidMask, (QueryTriggerInteraction)1); foreach (Collider c in array) { if (Object.op_Implicit((Object)(object)WorldQueries.PlayerOwner(c))) { StopCartAssist(dt); return Vector3.zero; } } float num = SideRoom(cart, bounds, clearForward, cargo); if (num <= 0.16f) { StopCartAssist(dt); return Vector3.zero; } if (grab != null) { grab.EnemyInteractTimeSet(); } float num2 = Vector3.Dot(cart.linearVelocity, clearForward); float num3 = Mathf.Min(1.05f, Mathf.Sqrt(5f * (num - 0.16f))); float num4 = Mathf.Min(dt, 0.05f); ApplyCartAssist(cart, clearForward, Mathf.Clamp(num3 - num2, -6f * num4, 13f * num4), num4, 260f); return clearForward * Mathf.Clamp(num2, 0.24f, 0.78f); } public ObstacleInteractor(Transform body) { this.body = body; } public Vector3 LimitCartApproach(Vector3 velocity, float actualSpeed) { //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_013b: 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_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_0081: 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_0131: 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_0138: 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_00ae: Unknown result type (might be due to invalid IL or missing references) if (((Vector3)(ref velocity)).sqrMagnitude < 0.01f) { return velocity; } float num = ((Vector3)(ref velocity)).magnitude; float num2 = Mathf.Clamp(actualSpeed * actualSpeed / 60f + 0.9f, 0.9f, 4f); float[] array = new float[2] { 0.5f, 1f }; foreach (float num3 in array) { RaycastHit[] array2 = Physics.SphereCastAll(body.position + Vector3.up * num3, 0.3f, ((Vector3)(ref velocity)).normalized, num2, WorldQueries.Mask, (QueryTriggerInteraction)1); for (int j = 0; j < array2.Length; j++) { RaycastHit val = array2[j]; if (!WorldQueries.Self(((RaycastHit)(ref val)).collider) && Object.op_Implicit((Object)(object)((Component)((RaycastHit)(ref val)).collider).GetComponentInParent())) { float num4 = Mathf.Max(0f, ((RaycastHit)(ref val)).distance - 0.55f); num = Mathf.Min(num, Mathf.Sqrt(0.42249995f + 50f * num4)); } } } return Vector3.ClampMagnitude(velocity, num); } public void Tick(Vector3 intent, float progress, float dt, bool allowed) { //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_006a: 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_0076: Unknown result type (might be due to invalid IL or missing references) //IL_007b: Unknown result type (might be due to invalid IL or missing references) //IL_0086: Unknown result type (might be due to invalid IL or missing references) //IL_00a6: Unknown result type (might be due to invalid IL or missing references) //IL_00ab: Unknown result type (might be due to invalid IL or missing references) //IL_010f: Unknown result type (might be due to invalid IL or missing references) //IL_0114: Unknown result type (might be due to invalid IL or missing references) //IL_01f7: Unknown result type (might be due to invalid IL or missing references) //IL_02db: Unknown result type (might be due to invalid IL or missing references) pushing = null; blocker = null; direction = ((Vector3)(ref intent)).normalized; if (allowed && ((Vector3)(ref intent)).sqrMagnitude > 0.04f) { float num = float.PositiveInfinity; float[] array = new float[3] { 0.35f, 0.85f, 1.45f }; foreach (float num2 in array) { RaycastHit[] array2 = Physics.SphereCastAll(body.position + Vector3.up * num2, 0.22f, direction, 0.9f, WorldQueries.Mask, (QueryTriggerInteraction)1); for (int j = 0; j < array2.Length; j++) { RaycastHit val = array2[j]; Collider collider = ((RaycastHit)(ref val)).collider; if (!WorldQueries.Self(collider) && !Object.op_Implicit((Object)(object)WorldQueries.PlayerOwner(collider)) && !Object.op_Implicit((Object)(object)((Component)collider).GetComponentInParent()) && !(((RaycastHit)(ref val)).distance >= num)) { num = ((RaycastHit)(ref val)).distance; blocker = collider; contact = ((RaycastHit)(ref val)).point; } } } } if (Object.op_Implicit((Object)(object)blocker) && Object.op_Implicit((Object)(object)blocker.attachedRigidbody) && !blocker.attachedRigidbody.isKinematic) { pushing = blocker.attachedRigidbody; } int id = (Object.op_Implicit((Object)(object)blocker) ? (Object.op_Implicit((Object)(object)pushing) ? ((Object)pushing).GetInstanceID() : ((Object)blocker).GetInstanceID()) : 0); ObstructionAction obstructionAction = clock.Tick(id, allowed && Object.op_Implicit((Object)(object)blocker), progress, dt); if (obstructionAction == ObstructionAction.Warn) { this.Warning?.Invoke(contact); } if (obstructionAction != ObstructionAction.Break) { return; } bool flag = false; OwnNoiseUntil = Time.time + 1f; if (Object.op_Implicit((Object)(object)blocker) && !Object.op_Implicit((Object)(object)((Component)blocker).GetComponentInParent()) && !Object.op_Implicit((Object)(object)((Component)blocker).GetComponentInParent()) && !Object.op_Implicit((Object)(object)((Component)blocker).GetComponentInParent())) { PhysGrabHinge componentInParent = ((Component)blocker).GetComponentInParent(); PhysGrabObjectImpactDetector componentInParent2 = ((Component)blocker).GetComponentInParent(); if (Object.op_Implicit((Object)(object)componentInParent)) { componentInParent.DestroyHinge(); flag = true; } else if (Object.op_Implicit((Object)(object)componentInParent2) && !componentInParent2.destroyDisable && !Fields.Get(componentInParent2, "isIndestructible")) { componentInParent2.BreakHeavy(contact, true, 0f); componentInParent2.DestroyObject(true, false); flag = true; } } if (flag) { OwnNoiseUntil = Time.time + 1f; Plugin.Instance.CombatLog("FLINCH_OBSTRUCTION: native break applied"); } this.Reroute?.Invoke(); } public void Push() { //IL_003f: 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_006c: 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) if (Object.op_Implicit((Object)(object)pushing) && !pushing.isKinematic && !Object.op_Implicit((Object)(object)((Component)pushing).GetComponentInParent())) { float num = NativeBehaviour.PushAcceleration(cart: false, Vector3.Dot(pushing.linearVelocity, direction), pushing.mass, Time.fixedDeltaTime); pushing.AddForce(direction * Mathf.Min(120f, pushing.mass * num), (ForceMode)0); } } } public static class PhysicalPath { private static bool ClearLocal(Vector3 a, Vector3 b, bool incoming) { //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) //IL_0008: 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_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_005a: Unknown result type (might be due to invalid IL or missing references) //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0064: Unknown result type (might be due to invalid IL or missing references) //IL_0069: Unknown result type (might be due to invalid IL or missing references) //IL_003c: Unknown result type (might be due to invalid IL or missing references) //IL_003f: Unknown result type (might be due to invalid IL or missing references) //IL_0049: Unknown result type (might be due to invalid IL or missing references) //IL_004e: Unknown result type (might be due to invalid IL or missing references) //IL_0053: 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_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_0033: Unknown result type (might be due to invalid IL or missing references) //IL_0038: Unknown result type (might be due to invalid IL or missing references) Vector3 val = b - a; if (((Vector3)(ref val)).magnitude > 4f) { if (incoming) { a = b - ((Vector3)(ref val)).normalized * 4f; } else { b = a + ((Vector3)(ref val)).normalized * 4f; } } Vector3[] corners; bool crouch; return FloorBridge.Route(a, b, Quaternion.LookRotation(Vector3.ProjectOnPlane(b - a, Vector3.up)), out corners, out crouch); } public static Vector3[] Widen(Vector3[] path) { //IL_0028: Unknown result type (might be due to invalid IL or missing references) //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) //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_0045: Unknown result type (might be due to invalid IL or missing references) //IL_0049: Unknown result type (might be due to invalid IL or missing references) //IL_004e: Unknown result type (might be due to invalid IL or missing references) //IL_0054: 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_0060: Unknown result type (might be due to invalid IL or missing references) //IL_0065: Unknown result type (might be due to invalid IL or missing references) //IL_006a: Unknown result type (might be due to invalid IL or missing references) //IL_006f: 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_0078: 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_0098: 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_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_00bd: Unknown result type (might be due to invalid IL or missing references) //IL_00c1: Unknown result type (might be due to invalid IL or missing references) //IL_00c6: Unknown result type (might be due to invalid IL or missing references) //IL_021f: Unknown result type (might be due to invalid IL or missing references) //IL_0227: Unknown result type (might be due to invalid IL or missing references) //IL_00ee: Unknown result type (might be due to invalid IL or missing references) //IL_00f3: Unknown result type (might be due to invalid IL or missing references) //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_0101: 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_0245: Unknown result type (might be due to invalid IL or missing references) //IL_024d: Unknown result type (might be due to invalid IL or missing references) //IL_0116: 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_025d: Unknown result type (might be due to invalid IL or missing references) //IL_0267: 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_0149: Unknown result type (might be due to invalid IL or missing references) //IL_014b: Unknown result type (might be due to invalid IL or missing references) //IL_0283: Unknown result type (might be due to invalid IL or missing references) //IL_0288: Unknown result type (might be due to invalid IL or missing references) //IL_016b: Unknown result type (might be due to invalid IL or missing references) //IL_0170: Unknown result type (might be due to invalid IL or missing references) //IL_017b: Unknown result type (might be due to invalid IL or missing references) //IL_017d: Unknown result type (might be due to invalid IL or missing references) //IL_0182: Unknown result type (might be due to invalid IL or missing references) //IL_0184: Unknown result type (might be due to invalid IL or missing references) //IL_0192: Unknown result type (might be due to invalid IL or missing references) //IL_0197: Unknown result type (might be due to invalid IL or missing references) //IL_0199: Unknown result type (might be due to invalid IL or missing references) //IL_019b: Unknown result type (might be due to invalid IL or missing references) //IL_01da: 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) if (path.Length < 3) { return path; } Vector3[] array = (Vector3[])path.Clone(); NavMeshHit val3 = default(NavMeshHit); for (int i = 1; i < path.Length - 1; i++) { Vector3 val = Vector3.ProjectOnPlane(path[i] - path[i - 1], Vector3.up); Vector3 normalized = ((Vector3)(ref val)).normalized; val = Vector3.ProjectOnPlane(path[i + 1] - path[i], Vector3.up); Vector3 normalized2 = ((Vector3)(ref val)).normalized; if (((Vector3)(ref normalized)).sqrMagnitude < 0.5f || ((Vector3)(ref normalized2)).sqrMagnitude < 0.5f || Vector3.Dot(normalized, normalized2) > 0.94f) { continue; } val = normalized - normalized2; Vector3 normalized3 = ((Vector3)(ref val)).normalized; float[] array2 = new float[4] { 0.3f, 0.45f, 0.6f, 0.75f }; foreach (float num in array2) { Vector3 val2 = path[i] + normalized3 * num; if (!NavMesh.SamplePosition(val2, ref val3, 0.12f, -1) || Mathf.Abs(((NavMeshHit)(ref val3)).position.y - val2.y) > 0.2f) { continue; } val2 = ((NavMeshHit)(ref val3)).position; if (!GroundSupport.Floor(val2, 0.22f, 0.3f, out var floor)) { continue; } val2 = floor.Position; bool flag = true; for (int k = 0; k <= 4; k++) { Quaternion q = Quaternion.Slerp(Quaternion.LookRotation(normalized), Quaternion.LookRotation(normalized2), (float)k * 0.25f); if (!WallSafety.ClearStepPose(val2, q)) { flag = false; break; } } if (flag) { array[i] = val2; break; } } } for (int l = 0; l < path.Length; l++) { bool flag2 = false; for (int m = 1; m < path.Length - 1; m++) { if (!(Vector3.Distance(array[m], path[m]) < 0.01f) && (!ClearLocal(array[m - 1], array[m], incoming: true) || !ClearLocal(array[m], array[m + 1], incoming: false))) { array[m] = path[m]; flag2 = true; } } if (!flag2) { break; } } return array; } } [BepInPlugin("flinch.nelyudim", "Flinch / Nelyudim", "0.1.21")] [BepInDependency("REPOLib", "4.3.0")] public sealed class Plugin : BaseUnityPlugin { public static Plugin Instance; public static GameObject Cache; public static EnemySetup Setup; public static PrefabRef Prefab; public static bool NaturalRollUsed; private static HashSet nativeEnemyPrefabs; public static ConfigEntry TestSpawn; public static ConfigEntry NaturalSpawn; public static ConfigEntry DebugOverlay; public static ConfigEntry TestPistol; public static ConfigEntry AmbientSound; public static ConfigEntry SpawnKey; public static ConfigEntry PistolKey; public static ConfigEntry Health; public static ConfigEntry CalmDamage; public static ConfigEntry RageDamage; public static ConfigEntry MinimumLiftStrength; public static ConfigEntry PanicTime; public static ConfigEntry NeglectTime; public static ConfigEntry DetectRange; public static ConfigEntry RageTime; public static ConfigEntry Exhaustion; public static ConfigEntry Rearm; public static ConfigEntry CalmResistance; public static ConfigEntry RageSpeed; public static ConfigEntry ChanceFirst; public static ConfigEntry ChanceEarly; public static ConfigEntry ChanceMiddle; public static ConfigEntry ChanceLate; public static ConfigEntry SoloNeglectTime; public static ConfigEntry SoloRageSpeed; public static ConfigEntry DisplayName; public static ConfigEntry SoundVolume; public static ConfigEntry AttackSpeed; private static float lastKey; public static bool IsNativeEnemyPrefab(GameObject prefab) { if (!Object.op_Implicit((Object)(object)prefab)) { return false; } if (nativeEnemyPrefabs == null) { nativeEnemyPrefabs = new HashSet(from p in Resources.LoadAll("Enemies") where Object.op_Implicit((Object)(object)p) && Object.op_Implicit((Object)(object)p.GetComponent()) select p); } return nativeEnemyPrefabs.Contains(prefab); } public void LoggerMessage(string text) { ((BaseUnityPlugin)this).Logger.LogWarning((object)text); } public void CombatLog(string text) { if (DebugOverlay.Value) { ((BaseUnityPlugin)this).Logger.LogInfo((object)text); } } public static Settings BrainSettings() { return new Settings { StatueRules = true, SingleplayerRules = !SemiFunc.IsMultiplayer(), SingleNeglectSeconds = SoloNeglectTime.Value, SingleRageMultiplier = SoloRageSpeed.Value, RageSeconds = RageTime.Value, ExhaustedSeconds = Exhaustion.Value, RearmSeconds = Rearm.Value, CalmDamage = CalmDamage.Value, RageDamage = RageDamage.Value, AttackSeconds = 1.1f / AttackSpeed.Value, ImpactSeconds = 0.46f / AttackSpeed.Value, AttackCooldown = 2f / AttackSpeed.Value, LowWindupSeconds = 0.2f, LowAttackSeconds = 1.25f, LowImpactSeconds = 0.28f }; } private void Awake() { //IL_00f3: Unknown result type (might be due to invalid IL or missing references) //IL_00fd: Expected O, but got Unknown //IL_0129: Unknown result type (might be due to invalid IL or missing references) //IL_0133: 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_019c: Unknown result type (might be due to invalid IL or missing references) //IL_01a6: Expected O, but got Unknown //IL_028d: Unknown result type (might be due to invalid IL or missing references) //IL_0297: Expected O, but got Unknown //IL_02ca: Unknown result type (might be due to invalid IL or missing references) //IL_02d4: Expected O, but got Unknown //IL_02fc: Unknown result type (might be due to invalid IL or missing references) //IL_0306: Expected O, but got Unknown //IL_035d: Unknown result type (might be due to invalid IL or missing references) //IL_0367: Expected O, but got Unknown //IL_03e5: Unknown result type (might be due to invalid IL or missing references) Instance = this; TestSpawn = ((BaseUnityPlugin)this).Config.Bind("Testing", "EnableTestSpawn", true, "Enable the host-only test spawn key. Disable for normal play."); SpawnKey = ((BaseUnityPlugin)this).Config.Bind("Testing", "TestSpawnKey", (KeyCode)117, "Spawn one Flinch in a clear navigable place during a level."); TestPistol = ((BaseUnityPlugin)this).Config.Bind("Testing", "EnableTestPistol", true, "Enable host-only native pistol spawn for damage testing."); PistolKey = ((BaseUnityPlugin)this).Config.Bind("Testing", "TestPistolKey", (KeyCode)116, "Spawn one native pistol in front of the host. Disable EnableTestPistol for normal play."); DebugOverlay = ((BaseUnityPlugin)this).Config.Bind("Testing", "ShowDebugState", false, "Show state, alarms and health while testing."); NaturalSpawn = ((BaseUnityPlugin)this).Config.Bind("Spawning", "EnableNaturalSpawn", true, "Replace at most one existing enemy slot. Levels1-2 can use an early slot; later levels use tier-three slots. No extra slot is created."); Health = ((BaseUnityPlugin)this).Config.Bind("Balance", "Health", 400, new ConfigDescription("Maximum health", (AcceptableValueBase)(object)new AcceptableValueRange(1, 10000), Array.Empty())); CalmDamage = ((BaseUnityPlugin)this).Config.Bind("Balance", "CalmDamage", 15, new ConfigDescription("Defensive hit damage", (AcceptableValueBase)(object)new AcceptableValueRange(1, 1000), Array.Empty())); RageDamage = ((BaseUnityPlugin)this).Config.Bind("Balance", "RageDamage", 35, new ConfigDescription("Rage hit damage", (AcceptableValueBase)(object)new AcceptableValueRange(1, 1000), Array.Empty())); AttackSpeed = ((BaseUnityPlugin)this).Config.Bind("Balance", "AttackPlaybackSpeed", 1.75f, new ConfigDescription("Attack playback, hit timing and recovery speed multiplier.", (AcceptableValueBase)(object)new AcceptableValueRange(1f, 2.5f), Array.Empty())); CalmResistance = Float("CalmResistance", 0.5f, 0f, 0.95f, "Damage resistance outside rage"); DetectRange = Float("DetectionRange", 18f, 3f, 60f, "Vision range in game metres"); RageTime = Float("MaximumRageSeconds", 10f, 1f, 60f, "Maximum uninterrupted rage"); Exhaustion = Float("ExhaustionSeconds", 3.5f, 1f, 30f, "Recovery after rage"); Rearm = Float("RageRearmSeconds", 10f, 1f, 60f, "Protection from immediate repeated rage"); SoloNeglectTime = ((BaseUnityPlugin)this).Config.Bind("Behaviour", "SecondsWithoutAttention", 4f, new ConfigDescription("Solo and coop: seconds without a real gaze before running. Any player's gaze freezes ordinary pursuit.", (AcceptableValueBase)(object)new AcceptableValueRange(1f, 120f), Array.Empty())); SoloRageSpeed = ((BaseUnityPlugin)this).Config.Bind("Behaviour", "RageRunMultiplier", 2.4f, new ConfigDescription("Solo and coop: sprint multiplier. Actual damage makes rage ignore gaze; ordinary rage is gaze-frozen.", (AcceptableValueBase)(object)new AcceptableValueRange(0.5f, 3f), Array.Empty())); MinimumLiftStrength = ((BaseUnityPlugin)this).Config.Bind("Balance", "MinimumLiftStrengthLevel", 4, new ConfigDescription("At least one grabber needs this many real Strength upgrades to lift Flinch. Weaker grab attempts still provoke rage.", (AcceptableValueBase)(object)new AcceptableValueRange(0, 30), Array.Empty())); DisplayName = ((BaseUnityPlugin)this).Config.Bind("Presentation", "MonsterName", "Нелюдим", "Name shown by the native enemy grab interface."); SoundVolume = ((BaseUnityPlugin)this).Config.Bind("Presentation", "SoundVolume", 0.85f, new ConfigDescription("Volume of all supplied monster sounds: voice, hurt, footsteps and impacts. Set zero to mute.", (AcceptableValueBase)(object)new AcceptableValueRange(0f, 1f), Array.Empty())); AmbientSound = ((BaseUnityPlugin)this).Config.Bind("Presentation", "EnableAmbientSound", true, "Occasional supplied SCP3000 atmosphere while Flinch is alive and distant."); ChanceFirst = Chance("Levels1To2Chance", 0.1f); ChanceEarly = Chance("Levels3To5Chance", 0.1f); ChanceMiddle = Chance("Levels6To9Chance", 0.2f); ChanceLate = Chance("Levels10PlusChance", 0.25f); new Harmony("flinch.nelyudim").PatchAll(); ((MonoBehaviour)this).StartCoroutine(Initialize()); } private ConfigEntry Float(string name, float value, float min, float max, string text) { //IL_001c: Unknown result type (might be due to invalid IL or missing references) //IL_0026: Expected O, but got Unknown return ((BaseUnityPlugin)this).Config.Bind("Balance", name, value, new ConfigDescription(text, (AcceptableValueBase)(object)new AcceptableValueRange(min, max), Array.Empty())); } private ConfigEntry Chance(string name, float value) { //IL_0026: Unknown result type (might be due to invalid IL or missing references) //IL_0030: Expected O, but got Unknown return ((BaseUnityPlugin)this).Config.Bind("Spawning", name, value, new ConfigDescription("Chance when an eligible enemy slot is selected, 0..1", (AcceptableValueBase)(object)new AcceptableValueRange(0f, 1f), Array.Empty())); } private IEnumerator Initialize() { for (int i = 0; i < 240; i++) { bool ready = false; try { ready = Resources.FindObjectsOfTypeAll().Length > 2; } catch { } if (ready) { break; } yield return null; } try { RuntimeAssets.Directory = Path.GetDirectoryName(((BaseUnityPlugin)this).Info.Location); using (FileStream f = File.OpenRead(Path.Combine(RuntimeAssets.Directory, "flinch.mesh"))) { RuntimeAssets.Model = AssetData.ReadMesh(f); } using (FileStream f2 = File.OpenRead(Path.Combine(RuntimeAssets.Directory, "flinch.motion"))) { RuntimeAssets.Clips = AssetData.ReadMotion(f2, RuntimeAssets.Model.Bones.Length).ToDictionary((ClipData c) => c.Name); } RuntimeAssets.LoadGazeCalibration(); SoundBank.Load(RuntimeAssets.Directory); BuildPrefab(); ((BaseUnityPlugin)this).Logger.LogInfo((object)("FLINCH_READY BUILD 0.1.21: five-second tracking; continuous stair support; lateral cart clearance; attack speed=" + AttackSpeed.Value + "; rage=" + SoloRageSpeed.Value + "x; U=" + TestSpawn.Value + ", T=" + TestPistol.Value)); } catch (Exception ex) { ((BaseUnityPlugin)this).Logger.LogError((object)("Flinch initialization failed: " + ex)); } } private static void BuildPrefab() { //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_0010: Expected O, but got Unknown //IL_002c: Unknown result type (might be due to invalid IL or missing references) //IL_0032: Expected O, but got Unknown //IL_0069: 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: Expected O, but got Unknown //IL_00ef: 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_0108: Expected O, but got Unknown //IL_011b: Unknown result type (might be due to invalid IL or missing references) //IL_0125: Expected O, but got Unknown //IL_0165: Unknown result type (might be due to invalid IL or missing references) //IL_016f: Expected O, but got Unknown //IL_0171: Unknown result type (might be due to invalid IL or missing references) //IL_017b: Expected O, but got Unknown //IL_017d: Unknown result type (might be due to invalid IL or missing references) //IL_0187: Expected O, but got Unknown //IL_0189: Unknown result type (might be due to invalid IL or missing references) //IL_0193: Expected O, but got Unknown //IL_019d: Unknown result type (might be due to invalid IL or missing references) //IL_01a7: Expected O, but got Unknown //IL_01a9: Unknown result type (might be due to invalid IL or missing references) //IL_01b3: Expected O, but got Unknown //IL_01b8: Unknown result type (might be due to invalid IL or missing references) //IL_01e4: Unknown result type (might be due to invalid IL or missing references) //IL_0206: Unknown result type (might be due to invalid IL or missing references) //IL_020d: Expected O, but got Unknown //IL_0238: Unknown result type (might be due to invalid IL or missing references) //IL_034d: Unknown result type (might be due to invalid IL or missing references) //IL_0372: Unknown result type (might be due to invalid IL or missing references) Cache = new GameObject("Flinch prefab cache"); Cache.SetActive(false); Object.DontDestroyOnLoad((Object)(object)Cache); GameObject val = new GameObject("Flinch_Nelyudim"); val.transform.SetParent(Cache.transform, false); val.AddComponent(); EnemyParent val2 = val.AddComponent(); val2.enemyName = DisplayName.Value; val2.difficulty = (Difficulty)2; EnemyParent component = Resources.Load("Enemies/Enemy - Robe").GetComponent(); val2.SpawnedTimeMin = component.SpawnedTimeMin; val2.SpawnedTimeMax = component.SpawnedTimeMax; val2.DespawnedTimeMin = component.DespawnedTimeMin; val2.DespawnedTimeMax = component.DespawnedTimeMax; GameObject val3 = new GameObject("Flinch Actor"); val3.transform.SetParent(val.transform, false); val3.layer = LayerMask.NameToLayer("Enemy"); val2.EnableObject = val3; Enemy val4 = val3.AddComponent(); val4.Type = (EnemyType)2; EnemyStateSpawn val5 = val3.AddComponent(); val5.OnSpawn = new UnityEvent(); ((Behaviour)val5).enabled = false; EnemyStateDespawn val6 = val3.AddComponent(); val6.OnDespawn = new UnityEvent(); val6.ChaseDespawn = (val6.StuckDespawn = false); ((Behaviour)val6).enabled = false; EnemyHealth val7 = val3.AddComponent(); val7.health = Health.Value; val7.spawnValuable = false; val7.onHurt = new UnityEvent(); val7.onDeathStart = new UnityEvent(); val7.onDeath = new UnityEvent(); val7.onObjectHurt = new UnityEvent(); EnemyStateStunned val8 = val3.AddComponent(); val8.onStunnedStart = new UnityEvent(); val8.onStunnedEnd = new UnityEvent(); Transform transform = new GameObject("Center").transform; transform.SetParent(val3.transform, false); transform.localPosition = new Vector3(0f, 1.2f, -0.25f); val4.CenterTransform = transform; val4.KillLookAtTransform = transform; GameObject val9 = new GameObject("Flinch Physics"); val9.transform.SetParent(val.transform, false); val9.layer = LayerMask.NameToLayer("PhysGrabObject"); Transform transform2 = new GameObject("Visual").transform; transform2.SetParent(val9.transform, false); Transform[] bones = RuntimeAssets.Build(transform2); val7.meshParent = transform2; FlinchMotion flinchMotion = val3.AddComponent(); flinchMotion.Bones = bones; flinchMotion.Visual = transform2; NavMeshAgent val10 = val3.AddComponent(); ((Behaviour)val10).enabled = false; val10.radius = 0.48f; val10.height = 2.3f; val10.baseOffset = 0f; val10.updatePosition = false; val10.updateRotation = false; val10.stoppingDistance = 1.05f; val10.autoTraverseOffMeshLink = false; val10.obstacleAvoidanceType = (ObstacleAvoidanceType)4; EnemyNavMeshAgent val11 = val3.AddComponent(); val11.updateRotation = false; ((Behaviour)val11).enabled = false; NativePhysics.Build(val9, val4, val3.transform, bones); val9.SetActive(false); FlinchActor item = val3.AddComponent(); NativePresenceCycle item2 = val.AddComponent(); PhotonView component2 = val.GetComponent(); component2.ObservedComponents = new List { (Component)(object)item2 }; component2.Synchronization = (ViewSynchronization)2; PhotonView component3 = val3.GetComponent(); component3.ObservedComponents = new List { (Component)(object)item }; component3.Synchronization = (ViewSynchronization)2; Setup = ScriptableObject.CreateInstance(); ((Object)Setup).name = "Flinch_Nelyudim_Setup"; Setup.levelsCompletedCondition = true; Setup.levelsCompletedMin = int.MaxValue; EnemyContent val12 = ScriptableObject.CreateInstance(); ((Object)val12).name = "Flinch_Nelyudim_Content"; Fields.Set(val12, "_setup", Setup); Fields.Set(val12, "_spawnObjects", new List { val }); Enemies.RegisterEnemy(val12); Prefab = NetworkPrefabs.GetNetworkPrefabRef("Enemies/Flinch_Nelyudim"); if (Prefab == null) { throw new InvalidOperationException("Flinch network prefab registration failed"); } } private void Update() { //IL_0018: Unknown result type (might be due to invalid IL or missing references) //IL_0139: Unknown result type (might be due to invalid IL or missing references) //IL_013a: Unknown result type (might be due to invalid IL or missing references) DebugItems.Tick(); if (!TestSpawn.Value || !Input.GetKeyDown(SpawnKey.Value) || Time.unscaledTime - lastKey < 1f) { return; } lastKey = Time.unscaledTime; if (Prefab == null) { Notice("Нелюдим ещё не загружен"); } else if (!SemiFunc.IsMasterClientOrSingleplayer()) { Notice("Призыв доступен хосту"); } else { if (!ActiveLevel() || !SemiFunc.NoTextInputsActive() || (Object.op_Implicit((Object)(object)MenuPageEsc.instance) && ((Component)MenuPageEsc.instance).gameObject.activeInHierarchy)) { return; } if (Object.op_Implicit((Object)(object)FlinchActor.Live) && FlinchActor.Live.InitializationSucceeded) { Notice("Нелюдим уже находится на уровне"); return; } PlayerAvatar instance = PlayerAvatar.instance; if (!Object.op_Implicit((Object)(object)instance)) { return; } if (!SpawnPlacement.NearPlayer(instance, out var point, out var facing)) { Notice("Рядом нет свободного места для Нелюдима"); return; } GameObject val = NetworkPrefabs.SpawnNetworkPrefab(Prefab, point, facing, (byte)0, new object[1] { true }); if (!Object.op_Implicit((Object)(object)val)) { Notice("Не удалось создать Нелюдима — подробности в журнале"); return; } FlinchActor componentInChildren = val.GetComponentInChildren(true); if (Object.op_Implicit((Object)(object)componentInChildren)) { componentInChildren.TestSummon = true; } val.SetActive(true); if (!Object.op_Implicit((Object)(object)componentInChildren) || !componentInChildren.InitializationSucceeded) { Notice("Ошибка подготовки Нелюдима — подробности в журнале; призыв можно повторить"); if (SemiFunc.IsMultiplayer()) { PhotonNetwork.Destroy(val); } else { Object.Destroy((Object)(object)val); } } } } public static bool ActiveLevel() { //IL_0037: Unknown result type (might be due to invalid IL or missing references) //IL_003d: Invalid comparison between Unknown and I4 return Object.op_Implicit((Object)(object)LevelGenerator.Instance) && LevelGenerator.Instance.Generated && (SemiFunc.RunIsLevel() || SemiFunc.RunIsTutorial()) && Object.op_Implicit((Object)(object)GameDirector.instance) && (int)GameDirector.instance.currentState == 2; } public static void Notice(string text) { //IL_0030: 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) ((BaseUnityPlugin)Instance).Logger.LogInfo((object)text); if (Object.op_Implicit((Object)(object)GameDirector.instance)) { SemiFunc.UIFocusText(text, new Color(0.7f, 0.85f, 0.25f), Color.white, 2.5f); } } } public sealed class FlinchIdentity : MonoBehaviour { } public static class Fields { private static readonly Dictionary cache = new Dictionary(); private static FieldInfo Field(object obj, string name) { string text = obj.GetType().FullName + "." + name; if (!cache.TryGetValue(text, out FieldInfo value)) { value = AccessTools.Field(obj.GetType(), name); cache[text] = value; } if (value == null) { throw new MissingFieldException(text); } return value; } public static T Get(object obj, string name) { return (T)Field(obj, name).GetValue(obj); } public static void Set(object obj, string name, object value) { Field(obj, name).SetValue(obj, value); } } [HarmonyPatch(typeof(EnemyParent), "Awake")] internal static class ParentInitialization { private static bool Prefix(EnemyParent __instance) { if (!Object.op_Implicit((Object)(object)((Component)__instance).GetComponent())) { return true; } Enemy componentInChildren = ((Component)__instance).GetComponentInChildren(true); Fields.Set(__instance, "Enemy", componentInChildren); Fields.Set(__instance, "SetupDone", true); return false; } } [HarmonyPatch(typeof(EnemyParent), "Update")] internal static class ParentTick { private static bool Prefix(EnemyParent __instance) { return !Object.op_Implicit((Object)(object)((Component)__instance).GetComponent()); } } [HarmonyPatch(typeof(Enemy), "Update")] internal static class NativeEnemyTick { private static bool Prefix(Enemy __instance) { return !Object.op_Implicit((Object)(object)((Component)__instance).GetComponent()); } } [HarmonyPatch(typeof(LevelGenerator), "Awake")] internal static class LevelReset { private static void Postfix() { Plugin.NaturalRollUsed = false; } } [HarmonyPatch(typeof(EnemyDirector), "GetEnemy")] internal static class NaturalSpawnSelection { private static void Postfix(ref EnemySetup __result) { //IL_00a0: Unknown result type (might be due to invalid IL or missing references) //IL_00a6: Invalid comparison between Unknown and I4 if (!Object.op_Implicit((Object)(object)Plugin.Setup) || !Plugin.NaturalSpawn.Value || Plugin.NaturalRollUsed || !SemiFunc.IsMasterClientOrSingleplayer() || !Object.op_Implicit((Object)(object)__result) || __result.spawnObjects.Count == 0) { return; } GameObject prefab = ((PrefabRef)(object)__result.spawnObjects[0]).Prefab; if (!Plugin.IsNativeEnemyPrefab(prefab)) { return; } EnemyParent val = (Object.op_Implicit((Object)(object)prefab) ? prefab.GetComponent() : null); int num = RunManager.instance.levelsCompleted + 1; if (Object.op_Implicit((Object)(object)val) && (num < 3 || (int)val.difficulty == 2)) { Plugin.NaturalRollUsed = true; float num2 = NativeBehaviour.SpawnChance(num, Plugin.ChanceFirst.Value, Plugin.ChanceEarly.Value, Plugin.ChanceMiddle.Value, Plugin.ChanceLate.Value); if (Random.value < num2) { __result = Plugin.Setup; } } } } public static class PursuitApproach { private static readonly float[] Radii = new float[6] { 0.65f, 0.85f, 1.1f, 1.35f, 1.6f, 1.85f }; private static readonly float[] Angles = new float[8] { 0f, -30f, 30f, -60f, 60f, -90f, 90f, 180f }; public static bool TryFind(Vector3 body, Quaternion rotation, FlinchMotion motion, PlayerAvatar player, out Vector3 result) { //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) return TryFindForVariant(body, rotation, motion, player, motion.AttackVariant, out result); } public static bool TryFindForVariant(Vector3 body, Quaternion rotation, FlinchMotion motion, PlayerAvatar player, int variant, out Vector3 result) { //IL_0003: Unknown result type (might be due to invalid IL or missing references) //IL_0004: 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_003f: 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_0073: 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_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_0082: 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_0084: 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_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_00be: Unknown result type (might be due to invalid IL or missing references) //IL_00c3: Unknown result type (might be due to invalid IL or missing references) //IL_00c7: Unknown result type (might be due to invalid IL or missing references) //IL_00d3: Unknown result type (might be due to invalid IL or missing references) //IL_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_00b1: Unknown result type (might be due to invalid IL or missing references) //IL_00b2: Unknown result type (might be due to invalid IL or missing references) //IL_00b7: Unknown result type (might be due to invalid IL or missing references) //IL_00bc: Unknown result type (might be due to invalid IL or missing references) //IL_010b: Unknown result type (might be due to invalid IL or missing references) //IL_00ff: Unknown result type (might be due to invalid IL or missing references) //IL_013e: Unknown result type (might be due to invalid IL or missing references) //IL_0128: 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_014e: Expected O, but got Unknown //IL_0198: Unknown result type (might be due to invalid IL or missing references) //IL_019b: Unknown result type (might be due to invalid IL or missing references) //IL_01a0: 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_01a6: Unknown result type (might be due to invalid IL or missing references) //IL_01ad: Unknown result type (might be due to invalid IL or missing references) //IL_01b2: Unknown result type (might be due to invalid IL or missing references) //IL_01b7: Unknown result type (might be due to invalid IL or missing references) //IL_01c2: Unknown result type (might be due to invalid IL or missing references) //IL_01d5: Unknown result type (might be due to invalid IL or missing references) //IL_01fe: Unknown result type (might be due to invalid IL or missing references) //IL_0224: Unknown result type (might be due to invalid IL or missing references) //IL_0229: Unknown result type (might be due to invalid IL or missing references) //IL_0243: Unknown result type (might be due to invalid IL or missing references) //IL_0246: Unknown result type (might be due to invalid IL or missing references) //IL_0257: Unknown result type (might be due to invalid IL or missing references) //IL_025d: Invalid comparison between Unknown and I4 //IL_028a: Unknown result type (might be due to invalid IL or missing references) //IL_0293: Unknown result type (might be due to invalid IL or missing references) //IL_02ef: Unknown result type (might be due to invalid IL or missing references) //IL_02f4: Unknown result type (might be due to invalid IL or missing references) result = body; if (!WorldQueries.Living(player)) { return false; } Collider val = PlayerBody.Collider(player); if (!Object.op_Implicit((Object)(object)val)) { return false; } if (PlayerBody.TryFaceColliderFrom(body, rotation, motion, val, variant, out var target)) { return true; } if (!GroundSupport.NavProjection(body, out var nav)) { return false; } Bounds bounds = val.bounds; Vector3 center = ((Bounds)(ref bounds)).center; target = Vector3.ProjectOnPlane(body - center, Vector3.up); Vector3 val2 = ((Vector3)(ref target)).normalized; if (((Vector3)(ref val2)).sqrMagnitude < 0.01f) { val2 = rotation * Vector3.back; } bounds = val.bounds; float y = ((Bounds)(ref bounds)).min.y; if (GroundSupport.Floor(new Vector3(center.x, y, center.z), 0.2f, 0.5f, out var floor)) { y = floor.Position.y; } float[] array = ((!(Mathf.Abs(body.y - y) < 0.45f)) ? new float[2] { body.y, y } : new float[1] { body.y }); NavMeshPath val3 = new NavMeshPath(); float num = float.PositiveInfinity; float[] array2 = array; NavMeshHit val5 = default(NavMeshHit); foreach (float num2 in array2) { float[] radii = Radii; foreach (float num3 in radii) { float[] angles = Angles; foreach (float num4 in angles) { Vector3 val4 = center + Quaternion.AngleAxis(num4, Vector3.up) * val2 * num3; val4.y = num2; if (NavMesh.SamplePosition(val4, ref val5, 0.55f, -1) && !(Mathf.Abs(((NavMeshHit)(ref val5)).position.y - num2) > 0.45f) && GroundSupport.Floor(((NavMeshHit)(ref val5)).position, 0.3f, 0.35f, out var floor2) && PlayerBody.TryFaceColliderFrom(floor2.Position, rotation, motion, val, variant, out target) && NavMesh.CalculatePath(nav, ((NavMeshHit)(ref val5)).position, -1, val3) && (int)val3.status <= 0) { Vector3[] corners = val3.corners; float num5 = 0f; for (int l = 1; l < corners.Length; l++) { num5 += Vector3.Distance(corners[l - 1], corners[l]); } float num6 = num5 + Mathf.Abs(num4) * 0.002f + Mathf.Abs(num3 - 1.1f) * 2f; if (num6 < num) { num = num6; result = floor2.Position; } } } } } return num < float.PositiveInfinity; } } public static class RuntimeAssets { public static ModelData Model; public static Dictionary Clips; public static string Directory; public static readonly Dictionary EyeAxes = new Dictionary(); public static void LoadGazeCalibration() { //IL_00c5: Unknown result type (might be due to invalid IL or missing references) //IL_00ca: Unknown result type (might be due to invalid IL or missing references) //IL_00ce: Unknown result type (might be due to invalid IL or missing references) string text = Path.Combine(Directory, "Gaze_Calibration.json"); if (!File.Exists(text)) { throw new FileNotFoundException("Eye optical-axis calibration is missing", text); } JObject val = JObject.Parse(File.ReadAllText(text)); string[] array = new string[2] { "L", "R" }; foreach (string text2 in array) { JToken val2 = val["eyes"][(object)text2][(object)"local_optical_axis_unity"]; Dictionary eyeAxes = EyeAxes; string key = "eye." + text2; Vector3 val3 = new Vector3((float)val2[(object)0], (float)val2[(object)1], (float)val2[(object)2]); eyeAxes[key] = ((Vector3)(ref val3)).normalized; } } public static Transform[] Build(Transform parent) { //IL_003c: 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_00a1: Expected O, but got Unknown //IL_0112: Unknown result type (might be due to invalid IL or missing references) //IL_0119: Expected O, but got Unknown //IL_0184: 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_016b: Expected O, but got Unknown //IL_0298: 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_02b1: Unknown result type (might be due to invalid IL or missing references) //IL_02b6: Unknown result type (might be due to invalid IL or missing references) //IL_02d7: Unknown result type (might be due to invalid IL or missing references) //IL_02dc: Unknown result type (might be due to invalid IL or missing references) //IL_02e7: Unknown result type (might be due to invalid IL or missing references) //IL_0389: Unknown result type (might be due to invalid IL or missing references) //IL_038b: Unknown result type (might be due to invalid IL or missing references) //IL_03a6: Unknown result type (might be due to invalid IL or missing references) //IL_03ab: Unknown result type (might be due to invalid IL or missing references) //IL_03b9: Unknown result type (might be due to invalid IL or missing references) //IL_03cf: Expected O, but got Unknown //IL_0449: Unknown result type (might be due to invalid IL or missing references) //IL_0450: Expected O, but got Unknown //IL_04af: Unknown result type (might be due to invalid IL or missing references) //IL_04c3: Unknown result type (might be due to invalid IL or missing references) //IL_04c8: Unknown result type (might be due to invalid IL or missing references) Transform[] array = (Transform[])(object)new Transform[Model.Bones.Length]; for (int i = 0; i < array.Length; i++) { BoneData boneData = Model.Bones[i]; Transform transform = new GameObject(boneData.Name).transform; transform.SetParent((Transform)((boneData.Parent < 0) ? ((object)parent) : ((object)array[boneData.Parent])), false); array[i] = transform; Set(transform, boneData.Rest, 0); } Texture2D val = new Texture2D(2, 2, (TextureFormat)4, false, false); if (!ImageConversion.LoadImage(val, File.ReadAllBytes(Path.Combine(Directory, "Flinch_Albedo_2048.png")), true)) { throw new InvalidDataException("Flinch atlas failed to decode"); } ((Object)val).name = "Flinch_Albedo"; ((Texture)val).wrapMode = (TextureWrapMode)0; ((Texture)val).filterMode = (FilterMode)1; Shader val2 = Shader.Find("Standard") ?? Shader.Find("Legacy Shaders/Diffuse"); Material val3; if (Object.op_Implicit((Object)(object)val2)) { val3 = new Material(val2); } else { Material val4 = ((IEnumerable)Resources.FindObjectsOfTypeAll()).FirstOrDefault((Func)((Material m) => Object.op_Implicit((Object)(object)m) && Object.op_Implicit((Object)(object)m.shader) && m.HasProperty("_MainTex") && m.renderQueue < 2500)); if (!Object.op_Implicit((Object)(object)val4)) { throw new InvalidOperationException("No opaque textured game shader is loaded"); } val3 = new Material(val4); } ((Object)val3).name = "Flinch_Opaque"; val3.mainTexture = (Texture)(object)val; val3.color = Color.white; val3.renderQueue = 2000; if (val3.HasProperty("_Glossiness")) { val3.SetFloat("_Glossiness", 0.05f); } if (val3.HasProperty("_Metallic")) { val3.SetFloat("_Metallic", 0f); } if (val3.HasProperty("_BaseMap")) { val3.SetTexture("_BaseMap", (Texture)(object)val); } if (val3.HasProperty("_ColorOverlayAmount")) { val3.SetFloat("_ColorOverlayAmount", 0f); } MeshData[] meshes = Model.Meshes; foreach (MeshData meshData in meshes) { int num2 = meshData.Vertices.Length / 8; Vector3[] array2 = (Vector3[])(object)new Vector3[num2]; Vector3[] array3 = (Vector3[])(object)new Vector3[num2]; Vector2[] array4 = (Vector2[])(object)new Vector2[num2]; BoneWeight[] array5 = (BoneWeight[])(object)new BoneWeight[num2]; for (int num3 = 0; num3 < num2; num3++) { int num4 = num3 * 8; int num5 = num3 * 4; array2[num3] = V(meshData.Vertices, num4); array3[num3] = V(meshData.Vertices, num4 + 3); array4[num3] = new Vector2(meshData.Vertices[num4 + 6], meshData.Vertices[num4 + 7]); int num6 = num3; BoneWeight val5 = default(BoneWeight); ((BoneWeight)(ref val5)).boneIndex0 = meshData.Bones[num5]; ((BoneWeight)(ref val5)).boneIndex1 = meshData.Bones[num5 + 1]; ((BoneWeight)(ref val5)).boneIndex2 = meshData.Bones[num5 + 2]; ((BoneWeight)(ref val5)).boneIndex3 = meshData.Bones[num5 + 3]; ((BoneWeight)(ref val5)).weight0 = meshData.Weights[num5]; ((BoneWeight)(ref val5)).weight1 = meshData.Weights[num5 + 1]; ((BoneWeight)(ref val5)).weight2 = meshData.Weights[num5 + 2]; ((BoneWeight)(ref val5)).weight3 = meshData.Weights[num5 + 3]; array5[num6] = val5; } Mesh val6 = new Mesh { name = meshData.Name, indexFormat = (IndexFormat)(num2 > 65535) }; val6.vertices = array2; val6.normals = array3; val6.uv = array4; val6.boneWeights = array5; val6.triangles = meshData.Triangles; val6.bindposes = array.Select((Transform b) => b.worldToLocalMatrix * parent.localToWorldMatrix).ToArray(); val6.RecalculateBounds(); GameObject val7 = new GameObject(meshData.Name); val7.transform.SetParent(parent, false); SkinnedMeshRenderer val8 = val7.AddComponent(); val8.sharedMesh = val6; val8.bones = array; val8.rootBone = array[0]; ((Renderer)val8).sharedMaterial = val3; val8.updateWhenOffscreen = true; ((Renderer)val8).localBounds = new Bounds(new Vector3(0f, 1.1f, 0f), new Vector3(3.2f, 3.2f, 3.2f)); ((Renderer)val8).shadowCastingMode = (ShadowCastingMode)1; ((Renderer)val8).receiveShadows = true; } return array; } public static Vector3 V(float[] a, int i) { //IL_000d: Unknown result type (might be due to invalid IL or missing references) return new Vector3(a[i], a[i + 1], a[i + 2]); } public static Quaternion Q(float[] a, int i) { //IL_0012: Unknown result type (might be due to invalid IL or missing references) return new Quaternion(a[i], a[i + 1], a[i + 2], a[i + 3]); } public static void Set(Transform t, float[] a, int offset) { //IL_0004: 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_0024: Unknown result type (might be due to invalid IL or missing references) t.localPosition = V(a, offset); t.localRotation = Q(a, offset + 3); t.localScale = V(a, offset + 7); } } public sealed class FlinchMotion : MonoBehaviour { public Transform[] Bones; public Transform Visual; public readonly ArmAvoidance[] Avoidance = new ArmAvoidance[2] { new ArmAvoidance(), new ArmAvoidance() }; public readonly Dictionary Map = new Dictionary(); private string current = ""; private float cycle; private float blendAge; private float filteredSpeed; private bool previousBackwards; private readonly StrideClock stride = new StrideClock(); public float GaitPhase; public float LowCoverWeight; public bool Backwards; public string UnplantedFoot; private readonly bool[] planted = new bool[2]; private readonly Vector3[] anchors = (Vector3[])(object)new Vector3[2]; private readonly Quaternion[] footRotations = (Quaternion[])(object)new Quaternion[2]; private readonly bool[] releasing = new bool[2]; private readonly Quaternion[] soleRotations = (Quaternion[])(object)new Quaternion[2]; private float coverFloorRecovery; private readonly float[] plantWeights = new float[2]; private CoverLegClearance lowLegSafety; private Vector3[] fromPosition; private Vector3[] basePosition; private Vector3[] previousWorldPosition; private Quaternion[] fromRotation; private Quaternion[] baseRotation; private Quaternion[] previousPose; private Quaternion[] previousWorldRotation; private bool initialized; public State State; public float StateTime; public float Panic; public float DistanceMoved; public int AttackVariant; public bool LowCover => LowCoverWeight > 0.005f; public string ClipName => current; private void Awake() { EnsureInitialized(); } public void EnsureInitialized() { //IL_0152: Unknown result type (might be due to invalid IL or missing references) //IL_0157: Unknown result type (might be due to invalid IL or missing references) //IL_016d: Unknown result type (might be due to invalid IL or missing references) //IL_0172: 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_01f1: Unknown result type (might be due to invalid IL or missing references) //IL_01f8: 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_0202: Unknown result type (might be due to invalid IL or missing references) if (initialized) { return; } if (Bones == null || Bones.Length == 0) { throw new InvalidOperationException("Flinch skeleton is missing"); } Map.Clear(); Transform[] bones = Bones; foreach (Transform val in bones) { if (!Object.op_Implicit((Object)(object)val)) { throw new InvalidOperationException("Flinch skeleton contains a missing bone"); } Map.Add(((Object)val).name, val); } if (!Map.ContainsKey("head")) { throw new InvalidOperationException("Flinch skeleton is missing head"); } fromPosition = (Vector3[])(object)new Vector3[Bones.Length]; fromRotation = (Quaternion[])(object)new Quaternion[Bones.Length]; basePosition = (Vector3[])(object)new Vector3[Bones.Length]; baseRotation = (Quaternion[])(object)new Quaternion[Bones.Length]; previousPose = (Quaternion[])(object)new Quaternion[Bones.Length]; previousWorldPosition = (Vector3[])(object)new Vector3[Bones.Length]; previousWorldRotation = (Quaternion[])(object)new Quaternion[Bones.Length]; for (int j = 0; j < Bones.Length; j++) { basePosition[j] = Bones[j].localPosition; baseRotation[j] = Bones[j].localRotation; } Transform val2 = (Object.op_Implicit((Object)(object)Visual) ? Visual.parent : ((Component)this).transform); for (int k = 0; k < 2; k++) { if (Map.TryGetValue("foot." + ((k == 0) ? "L" : "R"), out Transform value)) { soleRotations[k] = Quaternion.Inverse(val2.rotation) * value.rotation; } } initialized = true; } public void Sample(float dt) { //IL_0018: Unknown result type (might be due to invalid IL or missing references) //IL_001d: Unknown result type (might be due to invalid IL or missing references) //IL_0033: Unknown result type (might be due to invalid IL or missing references) //IL_0038: Unknown result type (might be due to invalid IL or missing references) //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_02cd: Unknown result type (might be due to invalid IL or missing references) //IL_02d2: Unknown result type (might be due to invalid IL or missing references) //IL_02e7: Unknown result type (might be due to invalid IL or missing references) //IL_02ec: Unknown result type (might be due to invalid IL or missing references) //IL_0476: Unknown result type (might be due to invalid IL or missing references) //IL_0483: Unknown result type (might be due to invalid IL or missing references) //IL_048a: Unknown result type (might be due to invalid IL or missing references) //IL_048f: Unknown result type (might be due to invalid IL or missing references) //IL_049b: Unknown result type (might be due to invalid IL or missing references) //IL_04aa: Unknown result type (might be due to invalid IL or missing references) //IL_04b1: Unknown result type (might be due to invalid IL or missing references) //IL_04b6: Unknown result type (might be due to invalid IL or missing references) //IL_04c9: Unknown result type (might be due to invalid IL or missing references) //IL_04ce: Unknown result type (might be due to invalid IL or missing references) //IL_04d2: Unknown result type (might be due to invalid IL or missing references) //IL_04ee: Unknown result type (might be due to invalid IL or missing references) //IL_04f3: Unknown result type (might be due to invalid IL or missing references) //IL_04f7: Unknown result type (might be due to invalid IL or missing references) //IL_0513: Unknown result type (might be due to invalid IL or missing references) //IL_0518: Unknown result type (might be due to invalid IL or missing references) //IL_052e: Unknown result type (might be due to invalid IL or missing references) //IL_0533: Unknown result type (might be due to invalid IL or missing references) for (int i = 0; i < Bones.Length; i++) { previousPose[i] = Bones[i].localRotation; previousWorldPosition[i] = Bones[i].position; previousWorldRotation[i] = Bones[i].rotation; } filteredSpeed = Mathf.Lerp(filteredSpeed, (dt > 0f) ? (DistanceMoved / dt) : 0f, 1f - Mathf.Exp((0f - dt) * 9f)); bool flag = filteredSpeed > 0.035f; State state = State; if (1 == 0) { } string text = state switch { State.Patrol => flag ? "Walk" : "Idle", State.Retreat => flag ? "Walk" : "Idle", State.Observe => flag ? "Walk" : "Observe", State.Stalk => flag ? "Walk" : "Idle", State.Startle => "Startle", State.Panic => (Panic < 6f) ? "Panic_Low" : ((Panic < 12f) ? "Panic_Mid" : "Panic_High"), State.RageTransition => "RageTransition", State.Chase => flag ? "Sprint" : "Idle", State.Attack => "Observe", State.LookUnder => "Observe", State.InspectUnder => "Observe", State.UnderAttack => "Observe", State.Exhausted => "Exhausted", State.Stunned => "Stunned", State.Dead => "Death", _ => "CalmDown", }; if (1 == 0) { } string text2 = text; if (State == State.RoamBurst) { text2 = ((StateTime < 0.55f) ? "RageTransition" : "Sprint"); } if (text2 == "Walk" && (filteredSpeed > 3.2f || (current == "Sprint" && filteredSpeed > 2.5f))) { text2 = "Sprint"; } if (current != text2 || previousBackwards != Backwards) { for (int j = 0; j < Bones.Length; j++) { fromPosition[j] = basePosition[j]; fromRotation[j] = baseRotation[j]; } current = text2; previousBackwards = Backwards; cycle = 0f; blendAge = 0f; } ClipData clipData = RuntimeAssets.Clips[text2]; blendAge += dt; if (clipData.Travel > 0f) { stride.Advance(DistanceMoved, clipData.Travel); GaitPhase = (Backwards ? ((1f - stride.Phase) % 1f) : stride.Phase); cycle = GaitPhase * clipData.Duration; } else { cycle = StateTime; } float num = (clipData.Loop ? (cycle % clipData.Duration) : Mathf.Min(cycle, clipData.Duration)); float num2 = num / clipData.Duration * (float)(clipData.Frames - 1); int num3 = Math.Min((int)num2, clipData.Frames - 2); float num4 = num2 - (float)num3; float num5 = Mathf.SmoothStep(0f, 1f, blendAge / 0.16f); for (int k = 0; k < Bones.Length; k++) { int num6 = (num3 * Bones.Length + k) * 10; int num7 = num6 + Bones.Length * 10; Vector3 val = Vector3.Lerp(RuntimeAssets.V(clipData.Samples, num6), RuntimeAssets.V(clipData.Samples, num7), num4); Quaternion val2 = Quaternion.Slerp(RuntimeAssets.Q(clipData.Samples, num6 + 3), RuntimeAssets.Q(clipData.Samples, num7 + 3), num4); Bones[k].localPosition = Vector3.Lerp(fromPosition[k], val, num5); Bones[k].localRotation = Quaternion.Slerp(fromRotation[k], val2, num5); basePosition[k] = Bones[k].localPosition; baseRotation[k] = Bones[k].localRotation; } } public Quaternion PreviousRotation(Transform bone) { //IL_0012: Unknown result type (might be due to invalid IL or missing references) return previousPose[Array.IndexOf(Bones, bone)]; } public Vector3 PreviousPosition(Transform bone) { //IL_0012: Unknown result type (might be due to invalid IL or missing references) return previousWorldPosition[Array.IndexOf(Bones, bone)]; } public Quaternion PreviousWorldRotation(Transform bone) { //IL_0012: Unknown result type (might be due to invalid IL or missing references) return previousWorldRotation[Array.IndexOf(Bones, bone)]; } public void PlantFeet(float dt = -1f) { //IL_05c7: Unknown result type (might be due to invalid IL or missing references) //IL_05ce: Unknown result type (might be due to invalid IL or missing references) //IL_05da: Unknown result type (might be due to invalid IL or missing references) //IL_01db: Unknown result type (might be due to invalid IL or missing references) //IL_01e2: Unknown result type (might be due to invalid IL or missing references) //IL_0275: Unknown result type (might be due to invalid IL or missing references) //IL_027a: Unknown result type (might be due to invalid IL or missing references) //IL_0289: Unknown result type (might be due to invalid IL or missing references) //IL_028e: Unknown result type (might be due to invalid IL or missing references) //IL_0295: Unknown result type (might be due to invalid IL or missing references) //IL_029a: Unknown result type (might be due to invalid IL or missing references) //IL_02a4: Unknown result type (might be due to invalid IL or missing references) //IL_02a9: Unknown result type (might be due to invalid IL or missing references) //IL_02ae: Unknown result type (might be due to invalid IL or missing references) //IL_02c3: Unknown result type (might be due to invalid IL or missing references) //IL_02ed: Unknown result type (might be due to invalid IL or missing references) //IL_030a: Unknown result type (might be due to invalid IL or missing references) //IL_0311: Unknown result type (might be due to invalid IL or missing references) //IL_0316: Unknown result type (might be due to invalid IL or missing references) //IL_031d: Unknown result type (might be due to invalid IL or missing references) //IL_0322: Unknown result type (might be due to invalid IL or missing references) //IL_0327: Unknown result type (might be due to invalid IL or missing references) //IL_03cf: Unknown result type (might be due to invalid IL or missing references) //IL_03d6: Unknown result type (might be due to invalid IL or missing references) //IL_03f0: Unknown result type (might be due to invalid IL or missing references) //IL_03f5: Unknown result type (might be due to invalid IL or missing references) //IL_03fc: Unknown result type (might be due to invalid IL or missing references) //IL_040a: Unknown result type (might be due to invalid IL or missing references) //IL_0424: Unknown result type (might be due to invalid IL or missing references) //IL_0429: Unknown result type (might be due to invalid IL or missing references) //IL_042e: Unknown result type (might be due to invalid IL or missing references) //IL_0464: Unknown result type (might be due to invalid IL or missing references) //IL_0469: Unknown result type (might be due to invalid IL or missing references) //IL_046d: Unknown result type (might be due to invalid IL or missing references) //IL_0472: Unknown result type (might be due to invalid IL or missing references) //IL_0476: Unknown result type (might be due to invalid IL or missing references) //IL_047b: Unknown result type (might be due to invalid IL or missing references) //IL_0485: Unknown result type (might be due to invalid IL or missing references) //IL_0492: Unknown result type (might be due to invalid IL or missing references) //IL_04a0: Unknown result type (might be due to invalid IL or missing references) //IL_04a5: Unknown result type (might be due to invalid IL or missing references) //IL_04b4: Unknown result type (might be due to invalid IL or missing references) //IL_04b9: Unknown result type (might be due to invalid IL or missing references) //IL_04bd: Unknown result type (might be due to invalid IL or missing references) //IL_04c2: Unknown result type (might be due to invalid IL or missing references) //IL_04c6: Unknown result type (might be due to invalid IL or missing references) //IL_04c8: Unknown result type (might be due to invalid IL or missing references) //IL_04d3: Unknown result type (might be due to invalid IL or missing references) //IL_04e0: Unknown result type (might be due to invalid IL or missing references) //IL_04e2: Unknown result type (might be due to invalid IL or missing references) //IL_04ed: Unknown result type (might be due to invalid IL or missing references) //IL_04fa: Unknown result type (might be due to invalid IL or missing references) //IL_0504: Unknown result type (might be due to invalid IL or missing references) //IL_0512: Unknown result type (might be due to invalid IL or missing references) if (dt < 0f) { dt = Time.deltaTime; } bool flag = State == State.Attack || State == State.InspectUnder || State == State.LookUnder || State == State.UnderAttack; coverFloorRecovery = (flag ? 1f : Mathf.Max(0f, coverFloorRecovery - dt)); if (State == State.Startle || State == State.Stunned || State == State.Dead || State == State.RageTransition) { bool[] array = planted; bool[] array2 = planted; bool flag2; releasing[0] = (flag2 = (releasing[1] = false)); array2[1] = (flag2 = flag2); array[0] = flag2; plantWeights[0] = (plantWeights[1] = 0f); return; } bool flag3 = RuntimeAssets.Clips[current].Travel > 0f && filteredSpeed > 0.035f; float num = ((current == "Sprint") ? 0.46f : 0.62f); for (int i = 0; i < 2; i++) { string text = ((i == 0) ? "L" : "R"); Transform val = Map["foot." + text]; float num2 = (GaitPhase + (float)i * 0.5f) % 1f; if (text == UnplantedFoot) { planted[i] = (releasing[i] = false); plantWeights[i] = 0f; continue; } bool flag4 = !flag3 || num2 < num; if (planted[i] && (!flag4 || Vector3.Distance(anchors[i], val.position) > 0.4f)) { releasing[i] = true; } if (releasing[i] && plantWeights[i] < 0.001f) { planted[i] = false; releasing[i] = false; } if (flag4 && !planted[i] && !releasing[i]) { anchors[i] = val.position; footRotations[i] = val.rotation; if (WorldQueries.Raycast(val.position + Vector3.up * 0.4f, Vector3.down, 0.9f, out var hit) && ((RaycastHit)(ref hit)).normal.y > 0.6f) { anchors[i].y = ((RaycastHit)(ref hit)).point.y + 0.16f; footRotations[i] = Quaternion.FromToRotation(Vector3.up, ((RaycastHit)(ref hit)).normal) * val.rotation; } planted[i] = true; } plantWeights[i] = Mathf.MoveTowards(plantWeights[i], (float)((flag4 && planted[i] && !releasing[i]) ? 1 : 0), dt * (float)(releasing[i] ? 9 : 12)); if (planted[i] && !(plantWeights[i] < 0.001f)) { Transform parent = Visual.parent; Vector3 value = Map["thigh." + text].position + parent.forward * Mathf.Lerp(0.6f, -0.65f, LowCoverWeight) + parent.right * (float)((i != 0) ? 1 : (-1)) * Mathf.Lerp(0.12f, 0.35f, LowCoverWeight); Transform val2 = Map["thigh." + text]; Transform val3 = Map["shin." + text]; Quaternion rotation = val2.rotation; Quaternion rotation2 = val3.rotation; Quaternion rotation3 = val.rotation; WallSafety.Solve(val2, val3, val, Vector3.Lerp(val.position, anchors[i], plantWeights[i]), value); Quaternion rotation4 = val2.rotation; Quaternion rotation5 = val3.rotation; val2.rotation = Quaternion.Slerp(rotation, rotation4, plantWeights[i]); val3.rotation = Quaternion.Slerp(rotation2, rotation5, plantWeights[i]); val.rotation = Quaternion.Slerp(rotation3, footRotations[i], plantWeights[i]); } } if (!(coverFloorRecovery > 0f)) { return; } if (!flag) { string[] array3 = new string[2] { "L", "R" }; foreach (string text2 in array3) { string[] array4 = new string[3] { "thigh.", "shin.", "foot." }; foreach (string text3 in array4) { Transform val4 = Map[text3 + text2]; val4.localRotation = Quaternion.RotateTowards(PreviousRotation(val4), val4.localRotation, 360f * dt); } } } ConstrainCoverFloor(); if (LowCoverWeight > 0.005f || lowLegSafety != null) { if (lowLegSafety == null) { lowLegSafety = new CoverLegClearance(this); } lowLegSafety.Apply(dt); } } private void ConstrainCoverFloor() { //IL_003e: Unknown result type (might be due to invalid IL or missing references) //IL_0049: Unknown result type (might be due to invalid IL or missing references) //IL_004e: Unknown result type (might be due to invalid IL or missing references) //IL_0058: Unknown result type (might be due to invalid IL or missing references) //IL_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_0346: 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_037c: Unknown result type (might be due to invalid IL or missing references) //IL_03a3: Unknown result type (might be due to invalid IL or missing references) //IL_03af: Unknown result type (might be due to invalid IL or missing references) //IL_03b4: Unknown result type (might be due to invalid IL or missing references) //IL_03be: Unknown result type (might be due to invalid IL or missing references) //IL_03c3: Unknown result type (might be due to invalid IL or missing references) //IL_03c8: 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) //IL_00ac: Unknown result type (might be due to invalid IL or missing references) //IL_03eb: Unknown result type (might be due to invalid IL or missing references) //IL_03f0: Unknown result type (might be due to invalid IL or missing references) //IL_03f4: 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_010c: Unknown result type (might be due to invalid IL or missing references) //IL_014b: Unknown result type (might be due to invalid IL or missing references) //IL_0157: Unknown result type (might be due to invalid IL or missing references) //IL_0407: Unknown result type (might be due to invalid IL or missing references) //IL_0412: Unknown result type (might be due to invalid IL or missing references) //IL_0491: Unknown result type (might be due to invalid IL or missing references) //IL_01a5: Unknown result type (might be due to invalid IL or missing references) //IL_01aa: Unknown result type (might be due to invalid IL or missing references) //IL_01b0: 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) //IL_01cb: 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_01eb: Unknown result type (might be due to invalid IL or missing references) //IL_01f0: Unknown result type (might be due to invalid IL or missing references) //IL_01f6: Unknown result type (might be due to invalid IL or missing references) //IL_00e5: Unknown result type (might be due to invalid IL or missing references) //IL_00f1: Unknown result type (might be due to invalid IL or missing references) //IL_0470: Unknown result type (might be due to invalid IL or missing references) //IL_0472: Unknown result type (might be due to invalid IL or missing references) //IL_04b6: Unknown result type (might be due to invalid IL or missing references) //IL_04bb: Unknown result type (might be due to invalid IL or missing references) //IL_04c2: Unknown result type (might be due to invalid IL or missing references) //IL_04d5: Unknown result type (might be due to invalid IL or missing references) //IL_04da: Unknown result type (might be due to invalid IL or missing references) //IL_04df: Unknown result type (might be due to invalid IL or missing references) //IL_04e7: Unknown result type (might be due to invalid IL or missing references) //IL_04eb: Unknown result type (might be due to invalid IL or missing references) //IL_04f1: Unknown result type (might be due to invalid IL or missing references) //IL_0203: Unknown result type (might be due to invalid IL or missing references) //IL_021d: Unknown result type (might be due to invalid IL or missing references) //IL_0222: Unknown result type (might be due to invalid IL or missing references) //IL_027f: Unknown result type (might be due to invalid IL or missing references) //IL_0284: Unknown result type (might be due to invalid IL or missing references) //IL_028b: Unknown result type (might be due to invalid IL or missing references) //IL_0290: Unknown result type (might be due to invalid IL or missing references) //IL_0296: Unknown result type (might be due to invalid IL or missing references) //IL_029b: 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_02ac: 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_044b: Unknown result type (might be due to invalid IL or missing references) //IL_0457: Unknown result type (might be due to invalid IL or missing references) //IL_0510: Unknown result type (might be due to invalid IL or missing references) //IL_0515: Unknown result type (might be due to invalid IL or missing references) //IL_051b: Unknown result type (might be due to invalid IL or missing references) //IL_0525: Unknown result type (might be due to invalid IL or missing references) //IL_052a: Unknown result type (might be due to invalid IL or missing references) Transform parent = Visual.parent; for (int i = 0; i < 2; i++) { string text = ((i == 0) ? "L" : "R"); Transform val = Map["foot." + text]; RaycastHit val2 = default(RaycastHit); bool flag = false; RaycastHit[] array = Physics.RaycastAll(val.position + Vector3.up * 0.8f, Vector3.down, 1.8f, WorldQueries.Mask, (QueryTriggerInteraction)1); for (int j = 0; j < array.Length; j++) { RaycastHit val3 = array[j]; if (((RaycastHit)(ref val3)).normal.y > 0.6f && ((RaycastHit)(ref val3)).point.y <= parent.position.y + 0.35f && !WorldQueries.Self(((RaycastHit)(ref val3)).collider) && !Object.op_Implicit((Object)(object)WorldQueries.PlayerOwner(((RaycastHit)(ref val3)).collider)) && (!flag || ((RaycastHit)(ref val3)).point.y > ((RaycastHit)(ref val2)).point.y)) { val2 = val3; flag = true; } } if (flag) { float num = ((State == State.Attack) ? 0.22f : 0.18f); float num2 = val.position.y - ((RaycastHit)(ref val2)).point.y; if (num2 < num) { Transform val4 = Map["thigh." + text]; Transform fore = Map["shin." + text]; Vector3 position = val.position; position.y = ((RaycastHit)(ref val2)).point.y + num; WallSafety.Solve(val4, fore, val, position, val4.position + parent.forward * Mathf.Lerp(0.6f, -0.65f, LowCoverWeight) + parent.right * (float)((i != 0) ? 1 : (-1)) * Mathf.Lerp(0.15f, 0.35f, LowCoverWeight)); } float num3 = ((State == State.Attack) ? (1f - Mathf.SmoothStep(0f, 1f, Mathf.InverseLerp(num, 0.32f, num2))) : ((float)((num2 < num) ? 1 : 0))); if (num3 > 0f) { val.rotation = Quaternion.Slerp(val.rotation, Quaternion.FromToRotation(Vector3.up, ((RaycastHit)(ref val2)).normal) * parent.rotation * soleRotations[i], num3); } } } string[] array2 = new string[2] { "L", "R" }; foreach (string text2 in array2) { Transform val5 = Map["upper_arm." + text2]; Transform fore2 = Map["forearm." + text2]; Transform val6 = Map["hand." + text2]; float num4 = val6.position.y; for (int l = 1; l <= 3; l++) { num4 = Mathf.Min(num4, Map["finger_" + l + ".03." + text2].position.y); } RaycastHit val7 = default(RaycastHit); bool flag2 = false; RaycastHit[] array3 = Physics.RaycastAll(val6.position + Vector3.up * 0.8f, Vector3.down, 2f, WorldQueries.Mask, (QueryTriggerInteraction)1); for (int m = 0; m < array3.Length; m++) { RaycastHit val8 = array3[m]; if (((RaycastHit)(ref val8)).normal.y > 0.6f && ((RaycastHit)(ref val8)).point.y <= parent.position.y + 0.35f && !WorldQueries.Self(((RaycastHit)(ref val8)).collider) && !Object.op_Implicit((Object)(object)WorldQueries.PlayerOwner(((RaycastHit)(ref val8)).collider)) && (!flag2 || ((RaycastHit)(ref val8)).point.y > ((RaycastHit)(ref val7)).point.y)) { val7 = val8; flag2 = true; } } if (flag2 && !(num4 >= ((RaycastHit)(ref val7)).point.y + 0.04f)) { Vector3 target = val6.position + Vector3.up * (((RaycastHit)(ref val7)).point.y + 0.075f - num4); WallSafety.Solve(val5, fore2, val6, target, val5.position + parent.right * ((text2 == "L") ? (-0.6f) : 0.6f) + parent.forward * 0.1f); } } } } public static class SoulDrop { public static bool Spawn(Vector3 position, int value, int ownerView) { //IL_0114: Unknown result type (might be due to invalid IL or missing references) //IL_0115: 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_00f8: Unknown result type (might be due to invalid IL or missing references) if (!SemiFunc.IsMasterClientOrSingleplayer() || !Object.op_Implicit((Object)(object)AssetManager.instance) || !Object.op_Implicit((Object)(object)AssetManager.instance.enemyValuableBig)) { return false; } if (SemiFunc.IsMultiplayer()) { EnemyValuable[] array = Object.FindObjectsByType((FindObjectsSortMode)0); foreach (EnemyValuable val in array) { PhotonView component = ((Component)val).GetComponent(); object[] array2 = (Object.op_Implicit((Object)(object)component) ? component.InstantiationData : null); if (array2 != null && array2.Length == 2 && array2[0] is string text && text == "FlinchSoul" && array2[1] is int num && num == ownerView) { return true; } } } GameObject enemyValuableBig = AssetManager.instance.enemyValuableBig; GameObject val2 = (SemiFunc.IsMultiplayer() ? PhotonNetwork.InstantiateRoomObject("Valuables/" + ((Object)enemyValuableBig).name, position, Quaternion.identity, (byte)0, new object[2] { "FlinchSoul", ownerView }) : Object.Instantiate(enemyValuableBig, position, Quaternion.identity)); if (!Object.op_Implicit((Object)(object)val2)) { return false; } ValuableObject component2 = val2.GetComponent(); if (!Object.op_Implicit((Object)(object)component2)) { Plugin.Instance.LoggerMessage("Native soul has no ValuableObject; reward could not be priced."); return false; } Fields.Set(component2, "dollarValueOverride", value); return true; } } public static class StairAssist { public static float Rise(Vector3 body, Quaternion rotation, Vector3 direction, float duck = 0f) { //IL_0023: 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_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) //IL_0069: Unknown result type (might be due to invalid IL or missing references) //IL_006b: 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_007a: Unknown result type (might be due to invalid IL or missing references) //IL_007f: 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_014c: 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_016e: Unknown result type (might be due to invalid IL or missing references) //IL_00b2: Unknown result type (might be due to invalid IL or missing references) //IL_00bc: Unknown result type (might be due to invalid IL or missing references) //IL_019a: Unknown result type (might be due to invalid IL or missing references) //IL_01bd: Unknown result type (might be due to invalid IL or missing references) //IL_01c4: Expected O, but got Unknown //IL_01c6: Unknown result type (might be due to invalid IL or missing references) //IL_01cd: 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_0116: 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_01e4: Invalid comparison between Unknown and I4 //IL_0214: Unknown result type (might be due to invalid IL or missing references) //IL_0222: Unknown result type (might be due to invalid IL or missing references) //IL_0260: Unknown result type (might be due to invalid IL or missing references) //IL_0261: Unknown result type (might be due to invalid IL or missing references) //IL_026d: Unknown result type (might be due to invalid IL or missing references) //IL_0272: Unknown result type (might be due to invalid IL or missing references) //IL_0277: Unknown result type (might be due to invalid IL or missing references) //IL_0279: Unknown result type (might be due to invalid IL or missing references) //IL_027b: Unknown result type (might be due to invalid IL or missing references) //IL_0284: Unknown result type (might be due to invalid IL or missing references) //IL_0288: Unknown result type (might be due to invalid IL or missing references) //IL_0292: Unknown result type (might be due to invalid IL or missing references) //IL_0297: Unknown result type (might be due to invalid IL or missing references) //IL_029c: Unknown result type (might be due to invalid IL or missing references) if (((Vector3)(ref direction)).sqrMagnitude < 0.01f) { return 0f; } RaycastHit val = default(RaycastHit); float num = 0f; float[] array = new float[3] { 0.23f, 0.38f, 0.55f }; foreach (float num2 in array) { Vector3 val2 = body + ((Vector3)(ref direction)).normalized * num2; if (WorldQueries.Raycast(val2 + Vector3.up * 0.6f, Vector3.down, 0.72f, out var hit) && !(((RaycastHit)(ref hit)).normal.y < 0.65f)) { float num3 = ((RaycastHit)(ref hit)).point.y - body.y; if (!(num3 < 0.025f) && !(num3 > 0.34f) && WallSafety.BlocksMovement(((RaycastHit)(ref hit)).collider) && !Object.op_Implicit((Object)(object)((Component)((RaycastHit)(ref hit)).collider).GetComponentInParent()) && !Object.op_Implicit((Object)(object)((Component)((RaycastHit)(ref hit)).collider).GetComponentInParent())) { val = hit; num = num3; break; } } } if (num <= 0f) { return 0f; } NavMeshHit val3 = default(NavMeshHit); if (!NavMesh.SamplePosition(((RaycastHit)(ref val)).point, ref val3, 0.55f, -1) || Mathf.Abs(((NavMeshHit)(ref val3)).position.y - ((RaycastHit)(ref val)).point.y) > 0.38f) { return 0f; } NavMeshHit val4 = default(NavMeshHit); if (!NavMesh.SamplePosition(body, ref val4, 0.6f, -1)) { return 0f; } NavMeshPath val5 = new NavMeshPath(); if (!NavMesh.CalculatePath(((NavMeshHit)(ref val4)).position, ((NavMeshHit)(ref val3)).position, -1, val5) || (int)val5.status > 0) { return 0f; } float num4 = 0f; for (int j = 1; j < val5.corners.Length; j++) { num4 += Vector3.Distance(val5.corners[j - 1], val5.corners[j]); } if (num4 > 1.3f) { return 0f; } Vector3 val6 = body + Vector3.up * (num + 0.025f); if (!WallSafety.ClearPose(val6, rotation, duck) || !WallSafety.ClearPose(val6 + ((Vector3)(ref direction)).normalized * 0.22f, rotation, duck)) { return 0f; } return num; } } public sealed class SurfaceMotor { private const float StairSpeed = 2.7f; private const float MaxLiftSpeed = 2.65f; private const float MaxStairFallSpeed = 3.5f; private static readonly float[] SupportProbes = new float[2] { 0.22f, 0.12f }; public GroundPoint supportedGround; public bool hasGround; public float slopeVelocity; public float stairRise; public float motorClearance; public Vector3 motorVelocity; private bool controlledStep; private float stairGrade; private float stairSurface; private float stepSpeed; public void Stop() { //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) motorVelocity = Vector3.zero; stairRise = (slopeVelocity = (motorClearance = 0f)); controlledStep = false; stairGrade = 0f; stepSpeed = 2.7f; } public void Plan(Vector3 body, Quaternion rotation, Vector3 velocity, float duck, float dt) { //IL_0009: Unknown result type (might be due to invalid IL or missing references) //IL_000a: 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_0021: Unknown result type (might be due to invalid IL or missing references) //IL_0026: Unknown result type (might be due to invalid IL or missing references) //IL_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_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_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_00a0: Unknown result type (might be due to invalid IL or missing references) //IL_00a5: Unknown result type (might be due to invalid IL or missing references) //IL_00df: Unknown result type (might be due to invalid IL or missing references) //IL_00e0: Unknown result type (might be due to invalid IL or missing references) //IL_00e3: 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_011f: 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_0139: 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_019a: Unknown result type (might be due to invalid IL or missing references) //IL_01a4: Unknown result type (might be due to invalid IL or missing references) //IL_0169: Unknown result type (might be due to invalid IL or missing references) //IL_016a: Unknown result type (might be due to invalid IL or missing references) //IL_0170: Unknown result type (might be due to invalid IL or missing references) //IL_0175: Unknown result type (might be due to invalid IL or missing references) //IL_0222: Unknown result type (might be due to invalid IL or missing references) //IL_0223: Unknown result type (might be due to invalid IL or missing references) //IL_0230: Unknown result type (might be due to invalid IL or missing references) //IL_0235: Unknown result type (might be due to invalid IL or missing references) //IL_023a: Unknown result type (might be due to invalid IL or missing references) //IL_020a: Unknown result type (might be due to invalid IL or missing references) //IL_028b: Unknown result type (might be due to invalid IL or missing references) //IL_02e4: Unknown result type (might be due to invalid IL or missing references) //IL_02e5: 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_02b4: Unknown result type (might be due to invalid IL or missing references) //IL_02c1: Unknown result type (might be due to invalid IL or missing references) //IL_02c6: Unknown result type (might be due to invalid IL or missing references) //IL_02cb: Unknown result type (might be due to invalid IL or missing references) //IL_030a: Unknown result type (might be due to invalid IL or missing references) //IL_030f: Unknown result type (might be due to invalid IL or missing references) //IL_0314: Unknown result type (might be due to invalid IL or missing references) //IL_0316: Unknown result type (might be due to invalid IL or missing references) //IL_0318: Unknown result type (might be due to invalid IL or missing references) //IL_0319: Unknown result type (might be due to invalid IL or missing references) //IL_031b: Unknown result type (might be due to invalid IL or missing references) //IL_0322: Unknown result type (might be due to invalid IL or missing references) //IL_0327: Unknown result type (might be due to invalid IL or missing references) //IL_032a: Unknown result type (might be due to invalid IL or missing references) //IL_032c: Unknown result type (might be due to invalid IL or missing references) //IL_032e: Unknown result type (might be due to invalid IL or missing references) //IL_0333: Unknown result type (might be due to invalid IL or missing references) //IL_0338: Unknown result type (might be due to invalid IL or missing references) //IL_033d: Unknown result type (might be due to invalid IL or missing references) //IL_03a4: Unknown result type (might be due to invalid IL or missing references) //IL_03b2: Unknown result type (might be due to invalid IL or missing references) //IL_03b7: Unknown result type (might be due to invalid IL or missing references) //IL_0395: Unknown result type (might be due to invalid IL or missing references) //IL_039c: Unknown result type (might be due to invalid IL or missing references) //IL_03a1: Unknown result type (might be due to invalid IL or missing references) //IL_03db: Unknown result type (might be due to invalid IL or missing references) //IL_0409: Unknown result type (might be due to invalid IL or missing references) //IL_040f: Unknown result type (might be due to invalid IL or missing references) Stop(); hasGround = GroundSupport.BodyFloor(body, rotation, out supportedGround); velocity = Vector3.ProjectOnPlane(velocity, Vector3.up); if (((Vector3)(ref velocity)).sqrMagnitude < 0.001f) { return; } Vector3 normalized = ((Vector3)(ref velocity)).normalized; float num = LocomotionRules.Probe(((Vector3)(ref velocity)).magnitude, dt); GroundPoint rear; float rise; bool flag = GroundSupport.StepChain(body, normalized, 0.35f, out rear, out rise, out stairGrade, out stairSurface); if (flag && !hasGround) { hasGround = true; supportedGround = rear; } GroundPoint floor; bool flag2 = flag || GroundSupport.Floor(body + normalized * num, 0.34f, 0.5f, out floor); float[] supportProbes = SupportProbes; foreach (float num2 in supportProbes) { if (flag2) { break; } flag2 = GroundSupport.Floor(body + normalized * num2, 0.34f, 0.5f, out floor); } if (!flag2) { return; } bool flag3 = Vector3.Dot(rotation * Vector3.forward, normalized) < -0.25f; float num3 = GroundSupport.NextStepRise(body, normalized, flag3, hasGround, supportedGround); if (stairGrade > 0.15f && hasGround && !flag3 && GroundSupport.Floor(body + normalized * 0.38f, 0.34f, 0.12f, out var floor2)) { float num4 = floor2.Position.y - body.y; if (num4 > 0.025f && num4 <= 0.34f) { num3 = Mathf.Max(num3, num4); } float num5 = Mathf.Min(stairSurface + stairGrade * 0.15f, supportedGround.Position.y + 0.16f); num3 = Mathf.Max(num3, num5 - body.y); } if (num3 > 0f && WallSafety.ClearStepPose(body + Vector3.up * (num3 + 0.025f), rotation, duck)) { stairRise = num3; } controlledStep = flag || stairRise > 0.025f; float num6 = (hasGround ? (supportedGround.Position.y - body.y) : 0f); if (stairRise < 0.025f && num6 > 0.005f && num6 <= 0.025f && WallSafety.ClearStepPose(body + Vector3.up * (num6 + 0.003f), rotation, duck)) { stairRise = num6; } Vector3 val = body + Vector3.up * ((stairRise > 0f) ? (stairRise + 0.015f) : 0f); Vector3 val2 = WallSafety.Move(val, rotation, normalized * num, duck); Vector3 val3 = Vector3.ProjectOnPlane(val2 - val, Vector3.up); motorClearance = ((Vector3)(ref val3)).magnitude; if (Mathf.Abs(stairGrade) > 0.15f) { stepSpeed = Mathf.Clamp(2.6f / Mathf.Abs(stairGrade), 2.7f, 3.1f); } if (controlledStep) { velocity = Vector3.ClampMagnitude(velocity, stepSpeed); } motorVelocity = velocity * Mathf.Clamp01(motorClearance / num); if (hasGround && supportedGround.Normal.y < 0.985f && body.y - supportedGround.Position.y < 0.28f) { slopeVelocity = Mathf.Clamp((0f - Vector3.Dot(supportedGround.Normal, motorVelocity)) / supportedGround.Normal.y, -2.5f, 2.5f); } } public void Apply(Rigidbody rb, Vector3 intent, float acceleration, float duck, float dt) { //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) //IL_0018: Unknown result type (might be due to invalid IL or missing references) //IL_0010: 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_0036: 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_014b: Unknown result type (might be due to invalid IL or missing references) //IL_0151: Unknown result type (might be due to invalid IL or missing references) //IL_0157: 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_007a: 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_00d5: Unknown result type (might be due to invalid IL or missing references) //IL_021e: Unknown result type (might be due to invalid IL or missing references) //IL_0223: Unknown result type (might be due to invalid IL or missing references) //IL_022a: Unknown result type (might be due to invalid IL or missing references) //IL_022f: Unknown result type (might be due to invalid IL or missing references) //IL_0234: 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_0239: Unknown result type (might be due to invalid IL or missing references) //IL_012b: Unknown result type (might be due to invalid IL or missing references) //IL_0133: Unknown result type (might be due to invalid IL or missing references) //IL_0139: Unknown result type (might be due to invalid IL or missing references) //IL_0397: Unknown result type (might be due to invalid IL or missing references) //IL_0369: Unknown result type (might be due to invalid IL or missing references) //IL_0374: Unknown result type (might be due to invalid IL or missing references) //IL_038a: 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_0259: 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_0260: Unknown result type (might be due to invalid IL or missing references) //IL_0275: Unknown result type (might be due to invalid IL or missing references) //IL_0281: Unknown result type (might be due to invalid IL or missing references) //IL_0288: Unknown result type (might be due to invalid IL or missing references) //IL_02a4: Unknown result type (might be due to invalid IL or missing references) //IL_02af: Unknown result type (might be due to invalid IL or missing references) //IL_02ba: Unknown result type (might be due to invalid IL or missing references) //IL_02bc: Unknown result type (might be due to invalid IL or missing references) //IL_02be: Unknown result type (might be due to invalid IL or missing references) //IL_02c3: Unknown result type (might be due to invalid IL or missing references) //IL_02da: Unknown result type (might be due to invalid IL or missing references) //IL_02dc: Unknown result type (might be due to invalid IL or missing references) //IL_02f5: Unknown result type (might be due to invalid IL or missing references) //IL_02fa: Unknown result type (might be due to invalid IL or missing references) //IL_02fc: Unknown result type (might be due to invalid IL or missing references) //IL_02ff: Unknown result type (might be due to invalid IL or missing references) //IL_0304: Unknown result type (might be due to invalid IL or missing references) //IL_030f: Unknown result type (might be due to invalid IL or missing references) //IL_0316: Unknown result type (might be due to invalid IL or missing references) //IL_031b: Unknown result type (might be due to invalid IL or missing references) //IL_031d: Unknown result type (might be due to invalid IL or missing references) //IL_0322: Unknown result type (might be due to invalid IL or missing references) Vector3 linearVelocity = rb.linearVelocity; Vector3 val = (hasGround ? motorVelocity : Vector3.zero); float num = ((((Vector3)(ref val)).sqrMagnitude > 0.001f) ? acceleration : 30f); float num2 = rb.position.y - supportedGround.Position.y; if (hasGround && controlledStep && num2 < 0.52f) { float num3 = Vector3.Dot(linearVelocity, ((Vector3)(ref intent)).normalized); if (num3 > stepSpeed) { num = Mathf.Max(num, 48f); } float num4 = -3.5f; if (stairGrade < -0.15f && ((Vector3)(ref val)).sqrMagnitude > 0.36f) { float num5 = Mathf.Clamp(stairSurface - rb.position.y, -0.16f, 0.16f); num4 = Mathf.Clamp(stairGrade * ((Vector3)(ref val)).magnitude + num5 * 5f, -3.5f, -0.25f); } if (linearVelocity.y < num4) { rb.linearVelocity = new Vector3(linearVelocity.x, num4, linearVelocity.z); } } Vector2 vector = GroundMotor.Delta(linearVelocity.x, linearVelocity.z, val.x, val.z, num, dt); Vector3 val2 = default(Vector3); ((Vector3)(ref val2))..ctor(vector.X, 0f, vector.Y); if (hasGround && stairRise > 0.005f && ((Vector3)(ref intent)).sqrMagnitude > 0.01f && num2 < 0.28f) { bool flag = stairRise <= 0.025f; float num6 = Mathf.Clamp(((Vector3)(ref val)).magnitude * Mathf.Max(0.9f, stairGrade + 0.45f), 2f, 2.65f); float num7 = Mathf.Min(stairRise + (flag ? 0.003f : 0.02f), num6 * dt); Vector3 val3 = rb.position + Vector3.up * num7; if (WallSafety.ClearStepPose(val3, rb.rotation, duck)) { rb.position = val3; Vector3 linearVelocity2 = rb.linearVelocity; if (linearVelocity2.y < 0f) { rb.linearVelocity = new Vector3(linearVelocity2.x, 0f, linearVelocity2.z); } if (!flag) { Vector3 val4 = default(Vector3); ((Vector3)(ref val4))..ctor(linearVelocity.x, 0f, linearVelocity.z); Vector3 val5 = val4 + val2; float num8 = ((Vector3)(ref val5)).magnitude * dt; if (num8 > 0.0001f && Vector3.Dot(val5, intent) > 0f) { Vector3 normalized = ((Vector3)(ref val5)).normalized; float num9 = GroundSupport.StepFootTravel(val3, rb.rotation, normalized, num8); val2 = normalized * (num9 / dt) - val4; } } } } else if (hasGround && ((Vector3)(ref val)).sqrMagnitude > 0.01f && supportedGround.Normal.y < 0.985f && num2 < 0.28f) { rb.AddForce(Vector3.up * Mathf.Clamp(slopeVelocity - linearVelocity.y, -0.4f, 0.4f), (ForceMode)2); } rb.AddForce(val2, (ForceMode)2); } } [HarmonyPatch(typeof(EnemyDirector), "SetInvestigate")] internal static class WorldHearing { private static float nextSoloVoice; private static void Postfix(Vector3 position, float radius, bool pathfindOnly, bool __runOriginal) { //IL_000f: Unknown result type (might be due to invalid IL or missing references) if (__runOriginal && !pathfindOnly) { Emit(position, radius); } } internal static void Emit(Vector3 position, float radius) { //IL_003a: Unknown result type (might be due to invalid IL or missing references) if (!SemiFunc.IsMasterClientOrSingleplayer() || !Plugin.ActiveLevel()) { return; } foreach (FlinchActor actor in FlinchActor.Actors) { if (Object.op_Implicit((Object)(object)actor)) { actor.Hear(position, radius); } } } internal static void PollSoloVoice() { //IL_0122: Unknown result type (might be due to invalid IL or missing references) if (SemiFunc.IsMultiplayer() || Time.time < nextSoloVoice) { return; } PlayerAvatar instance = PlayerAvatar.instance; if (!WorldQueries.Living(instance) || !Object.op_Implicit((Object)(object)DataDirector.instance)) { return; } PlayerVoiceChat val = Fields.Get(instance, "voiceChat"); if (!Object.op_Implicit((Object)(object)val)) { val = PlayerVoiceChat.instance; } if (Object.op_Implicit((Object)(object)val) && ((Behaviour)val).isActiveAndEnabled && !Fields.Get(DataDirector.instance, "toggleMute") && (DataDirector.instance.SettingValueFetch((Setting)32) != 1 || SemiFunc.InputHold((InputKey)25))) { float num = Fields.Get(val, "clipLoudnessNoTTS"); bool flag = Fields.Get(instance, "isCrawling"); bool flag2 = Fields.Get(instance, "isCrouching"); if (!(num <= ((flag || flag2) ? 0.05f : 0.025f)) && (!flag || Fields.Get(val, "clipLoudnessCrawlingCounter") > 10)) { nextSoloVoice = Time.time + 1f; Emit(WorldQueries.Eye(instance), 5f); } } } } [HarmonyPatch(typeof(BreakableFloor), "StateBreak")] internal static class CollapsingFloorHearing { private static void Prefix(bool ___stateImpulse, bool __runOriginal, out bool __state) { __state = __runOriginal && ___stateImpulse; } private static void Postfix(BreakableFloor __instance, bool ___stateImpulse, bool __state) { //IL_002b: Unknown result type (might be due to invalid IL or missing references) if (!(!__state || ___stateImpulse) && Object.op_Implicit((Object)(object)__instance.breakParticlesParent)) { WorldHearing.Emit(__instance.breakParticlesParent.transform.position, 10f); } } } [HarmonyPatch(typeof(EnemyHealth), "Hurt")] internal static class DamageReception { internal struct DamageState { public FlinchActor Actor; public int Before; } private static void Prefix(EnemyHealth __instance, bool __runOriginal, out DamageState __state) { __state = default(DamageState); FlinchActor component = ((Component)__instance).GetComponent(); if (Object.op_Implicit((Object)(object)component)) { __state = new DamageState { Actor = component, Before = Fields.Get(__instance, "healthCurrent") }; if (__runOriginal) { component.ApplyDamageResistance(); } } } private static void Postfix(EnemyHealth __instance, DamageState __state) { if (Object.op_Implicit((Object)(object)__state.Actor) && Fields.Get(__instance, "healthCurrent") < __state.Before) { __state.Actor.DamageReceived(); } } } public static class WorldQueries { public static int Mask => VisionLayers.Environment(LayerMask.op_Implicit(SemiFunc.LayerMaskGetVisionObstruct()), LayerMask.GetMask(new string[1] { "Player" })); public static int SolidMask => Mask | LayerMask.GetMask(new string[1] { "Player" }); public static bool Living(PlayerAvatar p) { return Object.op_Implicit((Object)(object)p) && ((Component)p).gameObject.activeInHierarchy && !Fields.Get(p, "isDisabled") && !Fields.Get(p, "deadSet"); } public static Vector3 Eye(PlayerAvatar p) { //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_0067: 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_004b: 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_005a: 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_006c: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)p == (Object)(object)PlayerAvatar.instance && Object.op_Implicit((Object)(object)p.localCamera)) { return p.localCamera.GetOverrideTransform().position; } return Fields.Get(p, "clientCameraStateValid") ? Fields.Get(p, "clientCameraPosition") : (((Component)p).transform.position + Vector3.up * 0.7f); } public static Vector3 Forward(PlayerAvatar p) { //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_0053: Unknown result type (might be due to invalid IL or missing references) //IL_0058: Unknown result type (might be due to invalid IL or missing references) //IL_005d: Unknown result type (might be due to invalid IL or missing references) //IL_0046: 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_0062: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)p == (Object)(object)PlayerAvatar.instance && Object.op_Implicit((Object)(object)p.localCamera)) { return p.localCamera.GetOverrideTransform().forward; } return Fields.Get(p, "clientCameraStateValid") ? (Fields.Get(p, "clientCameraRotation") * Vector3.forward) : ((Component)p).transform.forward; } public static bool Self(Collider c) { return Object.op_Implicit((Object)(object)c) && Object.op_Implicit((Object)(object)((Component)c).GetComponentInParent()); } public static PlayerAvatar PlayerOwner(Collider c) { if (!Object.op_Implicit((Object)(object)c)) { return null; } PlayerAvatar componentInParent = ((Component)c).GetComponentInParent(); if (Object.op_Implicit((Object)(object)componentInParent)) { return componentInParent; } PlayerTumble componentInParent2 = ((Component)c).GetComponentInParent(); if (Object.op_Implicit((Object)(object)componentInParent2)) { return Fields.Get(componentInParent2, "playerAvatar"); } if (Object.op_Implicit((Object)(object)((Component)c).GetComponentInParent()) || (Object.op_Implicit((Object)(object)PlayerController.instance) && (Object)(object)c == (Object)(object)PlayerController.instance.col)) { return PlayerAvatar.instance; } return null; } public static bool Raycast(Vector3 origin, Vector3 direction, float distance, out RaycastHit hit) { //IL_0002: 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_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) //IL_0064: 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) hit = default(RaycastHit); float num = float.PositiveInfinity; bool result = false; RaycastHit[] array = Physics.RaycastAll(origin, direction, distance, Mask, (QueryTriggerInteraction)1); for (int i = 0; i < array.Length; i++) { RaycastHit val = array[i]; if (!Self(((RaycastHit)(ref val)).collider) && !Object.op_Implicit((Object)(object)PlayerOwner(((RaycastHit)(ref val)).collider)) && ((RaycastHit)(ref val)).distance < num) { hit = val; num = ((RaycastHit)(ref val)).distance; result = true; } } return result; } public static bool Clear(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_0003: Unknown result type (might be due to invalid IL or missing references) //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_000b: Unknown result type (might be due to invalid IL or missing references) //IL_0010: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Unknown result type (might be due to invalid IL or missing references) Vector3 val = b - a; RaycastHit hit; return !Raycast(a, ((Vector3)(ref val)).normalized, Vector3.Distance(a, b), out hit); } public static bool ClearTube(Vector3 a, Vector3 b, float radius, Transform ignore = null) { //IL_000e: Unknown result type (might be due to invalid IL or missing references) //IL_000f: Unknown result type (might be due to invalid IL or missing references) //IL_0010: Unknown result type (might be due to invalid IL or missing references) //IL_0015: Unknown result type (might be due to invalid IL or missing references) //IL_002d: 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_0059: Unknown result type (might be due to invalid IL or missing references) Vector3 val = b - a; if (((Vector3)(ref val)).sqrMagnitude < 1E-05f) { return true; } if (Physics.OverlapSphere(a, radius, Mask, (QueryTriggerInteraction)1).Any(Blocks)) { return false; } return !Physics.SphereCastAll(a, radius, ((Vector3)(ref val)).normalized, ((Vector3)(ref val)).magnitude, Mask, (QueryTriggerInteraction)1).Any((RaycastHit h) => Blocks(((RaycastHit)(ref h)).collider)); bool Blocks(Collider c) { return !Self(c) && !Object.op_Implicit((Object)(object)PlayerOwner(c)) && (!Object.op_Implicit((Object)(object)ignore) || !((Component)c).transform.IsChildOf(ignore)); } } public static bool Watched(PlayerAvatar p, Vector3 head, Vector3 chest) { //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) //IL_0027: 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_002f: Unknown result type (might be due to invalid IL or missing references) //IL_0030: Unknown result type (might be due to invalid IL or missing references) //IL_003f: 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_0047: 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_004a: Unknown result type (might be due to invalid IL or missing references) //IL_004f: Unknown result type (might be due to invalid IL or missing references) //IL_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_007b: 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_0082: Unknown result type (might be due to invalid IL or missing references) //IL_0084: Unknown result type (might be due to invalid IL or missing references) //IL_0093: 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_0105: 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_00b0: 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_00cc: Unknown result type (might be due to invalid IL or missing references) Vector3 val = Eye(p); Camera val2 = (((Object)(object)p == (Object)(object)PlayerAvatar.instance) ? SemiFunc.MainCamera() : null); Vector3[] array = (Vector3[])(object)new Vector3[2] { head, chest }; foreach (Vector3 val3 in array) { Vector3 val4 = val3 - val; if (((Vector3)(ref val4)).sqrMagnitude < 0.01f) { return true; } bool flag; if (Object.op_Implicit((Object)(object)val2)) { Vector3 val5 = val2.WorldToViewportPoint(val3); flag = val5.z > val2.nearClipPlane && val5.z < val2.farClipPlane && val5.x >= 0f && val5.x <= 1f && val5.y >= 0f && val5.y <= 1f; } else { flag = Vector3.Dot(Forward(p), ((Vector3)(ref val4)).normalized) > 0.6f; } if (flag && Clear(val, val3)) { return true; } } return false; } public static bool WatchedFromFront(PlayerAvatar p, Vector3 head, Vector3 chest, Transform body) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_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_0014: Unknown result type (might be due to invalid IL or missing references) //IL_0019: 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_0020: 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_003a: 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) Vector3 val = Eye(p) - body.position; Vector3 forward = body.forward; return FrontGaze.FacesViewer(forward.x, forward.z, val.x, val.z) && Watched(p, head, chest); } } public static class SpawnPlacement { public static bool Clear(Vector3 p, Quaternion q) { //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_000b: Unknown result type (might be due to invalid IL or missing references) //IL_0010: Unknown result type (might be due to invalid IL or missing references) //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_0029: Unknown result type (might be due to invalid IL or missing references) return !Physics.OverlapBox(p + Vector3.up * 1.18f, new Vector3(0.9f, 1.14f, 0.72f), q, WorldQueries.SolidMask, (QueryTriggerInteraction)1).Any((Collider c) => !WorldQueries.Self(c)); } public static bool Recovery(Vector3 blockedOrigin, Quaternion facing, out Vector3 point) { //IL_0008: 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_014c: Expected O, but got Unknown //IL_015c: 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_0173: Unknown result type (might be due to invalid IL or missing references) //IL_0190: Unknown result type (might be due to invalid IL or missing references) //IL_019a: Unknown result type (might be due to invalid IL or missing references) //IL_01b5: 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_01e5: 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_01f1: Unknown result type (might be due to invalid IL or missing references) //IL_0200: Unknown result type (might be due to invalid IL or missing references) //IL_0205: Unknown result type (might be due to invalid IL or missing references) //IL_0260: Unknown result type (might be due to invalid IL or missing references) //IL_0265: Unknown result type (might be due to invalid IL or missing references) point = default(Vector3); if (!Object.op_Implicit((Object)(object)LevelGenerator.Instance)) { return false; } PlayerAvatar[] players = SemiFunc.PlayerGetList().Where(WorldQueries.Living).ToArray(); Vector3[] array = (from anchor in players.Select(delegate(PlayerAvatar player) { //IL_0007: 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_002d: 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_0018: 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_0050: Unknown result type (might be due to invalid IL or missing references) if (GroundSupport.NavProjection(((Component)player).transform.position, out var nav2)) { return (true, nav: nav2); } Vector3 val = Fields.Get(player, "LastNavmeshPosition"); return (Vector3.Distance(val, ((Component)player).transform.position) < 3f && GroundSupport.NavProjection(val, out nav2), nav: nav2); }) where anchor.Item1 select anchor.nav).ToArray(); if (array.Length == 0) { return false; } IOrderedEnumerable orderedEnumerable = from marker in SemiFunc.LevelPointsGetAll() where Object.op_Implicit((Object)(object)marker) && !marker.Truck && (!Object.op_Implicit((Object)(object)marker.Room) || !marker.Room.Truck) select ((Component)marker).transform.position into candidate orderby players.Min((PlayerAvatar player) => Vector3.Distance(candidate, ((Component)player).transform.position)) descending select candidate; NavMeshPath path = new NavMeshPath(); NavMeshHit nav = default(NavMeshHit); foreach (Vector3 item in orderedEnumerable) { if (NavMesh.SamplePosition(item, ref nav, 0.65f, -1) && !(Mathf.Abs(((NavMeshHit)(ref nav)).position.y - item.y) > 0.35f) && GroundSupport.Floor(((NavMeshHit)(ref nav)).position, 0.15f, 0.25f, out var floor)) { Vector3 location = floor.Position; if (!(Vector3.Distance(location, blockedOrigin) < 2f) && Clear(location, facing) && !players.Any((PlayerAvatar player) => Vector3.Distance(((Component)player).transform.position, location) < 3.5f || WorldQueries.Watched(player, location + Vector3.up * 2f, location + Vector3.up)) && array.Any((Vector3 anchor) => NavMesh.CalculatePath(anchor, ((NavMeshHit)(ref nav)).position, -1, path) && (int)path.status == 0)) { point = location; return true; } } } return false; } private static bool Sample(Vector3 candidate, out Vector3 result) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_001a: 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_0044: 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_0053: Unknown result type (might be due to invalid IL or missing references) //IL_0058: Unknown result type (might be due to invalid IL or missing references) //IL_005d: Unknown result type (might be due to invalid IL or missing references) //IL_007e: 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_009c: Unknown result type (might be due to invalid IL or missing references) //IL_00a6: Unknown result type (might be due to invalid IL or missing references) //IL_00ab: Unknown result type (might be due to invalid IL or missing references) result = default(Vector3); NavMeshHit val = default(NavMeshHit); if (!NavMesh.SamplePosition(candidate, ref val, 1f, -1) || Mathf.Abs(((NavMeshHit)(ref val)).position.y - candidate.y) > 1f) { return false; } if (!WorldQueries.Raycast(((NavMeshHit)(ref val)).position + Vector3.up * 0.4f, Vector3.down, 1.1f, out var hit)) { return false; } result = new Vector3(((NavMeshHit)(ref val)).position.x, ((RaycastHit)(ref hit)).point.y + 0.01f, ((NavMeshHit)(ref val)).position.z); return true; } public static bool NearPlayer(PlayerAvatar player, out Vector3 point, out Quaternion facing) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0009: 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_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_0020: 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_0044: 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_0097: 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_00a4: 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_00ac: 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_00cf: 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_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_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_00f3: Unknown result type (might be due to invalid IL or missing references) //IL_0101: 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) //IL_0117: Unknown result type (might be due to invalid IL or missing references) //IL_015d: Unknown result type (might be due to invalid IL or missing references) //IL_015f: Unknown result type (might be due to invalid IL or missing references) //IL_0165: Unknown result type (might be due to invalid IL or missing references) //IL_0167: Unknown result type (might be due to invalid IL or missing references) //IL_012c: Unknown result type (might be due to invalid IL or missing references) //IL_0133: Expected O, but got Unknown //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_0148: Unknown result type (might be due to invalid IL or missing references) //IL_014e: Invalid comparison between Unknown and I4 point = default(Vector3); facing = Quaternion.identity; Vector3 position = ((Component)player).transform.position; Vector3 val = WorldQueries.Forward(player); val.y = 0f; if (((Vector3)(ref val)).sqrMagnitude < 0.01f) { val = Vector3.forward; } ((Vector3)(ref val)).Normalize(); float[] array = new float[4] { 3f, 4f, 5f, 6f }; NavMeshHit val4 = default(NavMeshHit); foreach (float num in array) { float[] array2 = new float[7] { 0f, -35f, 35f, -70f, 70f, 140f, -140f }; foreach (float num2 in array2) { Vector3 candidate = position + Quaternion.AngleAxis(num2, Vector3.up) * val * num; if (!Sample(candidate, out var result)) { continue; } Vector3 val2 = position - result; val2.y = 0f; Quaternion val3 = ((((Vector3)(ref val2)).sqrMagnitude > 0.01f) ? Quaternion.LookRotation(val2) : Quaternion.identity); if (!Clear(result, val3)) { continue; } if (NavMesh.SamplePosition(position, ref val4, 2f, -1)) { NavMeshPath val5 = new NavMeshPath(); if (!NavMesh.CalculatePath(((NavMeshHit)(ref val4)).position, result, -1, val5) || (int)val5.status > 0) { continue; } } point = result; facing = val3; return true; } } return false; } public static bool Natural(out Vector3 point, out Quaternion facing) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0009: 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_00db: Unknown result type (might be due to invalid IL or missing references) //IL_010d: Unknown result type (might be due to invalid IL or missing references) //IL_0112: Unknown result type (might be due to invalid IL or missing references) //IL_0116: Unknown result type (might be due to invalid IL or missing references) //IL_011b: Unknown result type (might be due to invalid IL or missing references) //IL_014b: 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_0156: Unknown result type (might be due to invalid IL or missing references) //IL_0158: Unknown result type (might be due to invalid IL or missing references) point = default(Vector3); facing = Quaternion.identity; IOrderedEnumerable orderedEnumerable = from _ in SemiFunc.LevelPointsGetAll() where Object.op_Implicit((Object)(object)_) && !_.Truck orderby Random.value select _; PlayerAvatar[] source = SemiFunc.PlayerGetList().Where(WorldQueries.Living).ToArray(); foreach (LevelPoint lp in orderedEnumerable) { if (!source.Any((PlayerAvatar val2) => Vector3.Distance(((Component)val2).transform.position, ((Component)lp).transform.position) < 12f) && Sample(((Component)lp).transform.position, out var p)) { Quaternion val = Quaternion.Euler(0f, (float)Random.Range(0, 360), 0f); if (Clear(p, val) && !source.Any((PlayerAvatar player) => WorldQueries.Watched(player, p + Vector3.up * 2f, p + Vector3.up * 1.3f))) { point = p; facing = val; return true; } } } return false; } } public static class WallSafety { public static void AddHitShapes(Transform[] bones, int layer) { //IL_00c2: Unknown result type (might be due to invalid IL or missing references) //IL_00c9: Expected O, but got Unknown //IL_00f3: Unknown result type (might be due to invalid IL or missing references) //IL_00f8: Unknown result type (might be due to invalid IL or missing references) //IL_010b: Unknown result type (might be due to invalid IL or missing references) //IL_0110: Unknown result type (might be due to invalid IL or missing references) //IL_0136: 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_013a: 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_0164: Unknown result type (might be due to invalid IL or missing references) //IL_0166: Unknown result type (might be due to invalid IL or missing references) string path = Path.Combine(RuntimeAssets.Directory, "Collision_Setup.json"); if (!File.Exists(path)) { return; } JObject val = JObject.Parse(File.ReadAllText(path)); foreach (JToken shape in (IEnumerable)val["query_envelopes"]) { if (!((string)shape[(object)"shape"] != "capsule")) { Transform val2 = ((IEnumerable)bones).FirstOrDefault((Func)((Transform b) => ((Object)b).name == (string)shape[(object)"bone"])); if (Object.op_Implicit((Object)(object)val2)) { GameObject val3 = new GameObject("Hit_" + ((Object)val2).name); val3.layer = layer; val3.transform.SetParent(val2, false); Vector3 val4 = Convert(shape[(object)"segment_start"]); Vector3 val5 = Convert(shape[(object)"segment_end"]); float num = (float)shape[(object)"radius_m"]; CapsuleCollider val6 = val3.AddComponent(); val6.center = (val4 + val5) * 0.5f; val6.direction = 2; val6.radius = num; val6.height = Vector3.Distance(val4, val5) + 2f * num; } } } static Vector3 Convert(JToken v) { //IL_0038: Unknown result type (might be due to invalid IL or missing references) return new Vector3(0f - (float)v[(object)0], (float)v[(object)2], 0f - (float)v[(object)1]); } } public static bool BlocksMovement(Collider c) { if (WorldQueries.Self(c)) { return false; } return !Object.op_Implicit((Object)(object)c.attachedRigidbody) || c.attachedRigidbody.isKinematic || Object.op_Implicit((Object)(object)((Component)c).GetComponentInParent()) || Object.op_Implicit((Object)(object)((Component)c).GetComponentInParent()) || Object.op_Implicit((Object)(object)((Component)c).GetComponentInParent()); } private static Vector3 HeadPoint(Vector3 p, Quaternion q, float duck) { //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_0011: 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_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_0035: Unknown result type (might be due to invalid IL or missing references) return p + q * Vector3.Lerp(new Vector3(0f, 2.02f, 0.24f), new Vector3(0f, 1.32f, 0.5f), duck); } public static bool ClearPose(Vector3 p, Quaternion q, float duck = 0f) { //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_0012: 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_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) //IL_003b: 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_0059: 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_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0065: Unknown result type (might be due to invalid IL or missing references) //IL_006a: Unknown result type (might be due to invalid IL or missing references) //IL_00a1: 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_00a4: Unknown result type (might be due to invalid IL or missing references) Vector3 val = p + q * Vector3.Lerp(new Vector3(0f, 0.995f, -0.3f), new Vector3(0f, 0.66f, -0.2f), duck); float num = Mathf.Lerp(0.62f, 0.3f, duck); return !Physics.OverlapCapsule(val - Vector3.up * num, val + Vector3.up * num, 0.335f, WorldQueries.SolidMask, (QueryTriggerInteraction)1).Any(BlocksMovement) && !Physics.OverlapSphere(HeadPoint(p, q, duck), 0.35f, WorldQueries.SolidMask, (QueryTriggerInteraction)1).Any(BlocksMovement); } public static bool ClearStepPose(Vector3 p, Quaternion q, float duck = 0f) { //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_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_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_0022: 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_003e: Unknown result type (might be due to invalid IL or missing references) //IL_0043: Unknown result type (might be due to invalid IL or missing references) //IL_0048: Unknown result type (might be due to invalid IL or missing references) //IL_004d: Unknown result type (might be due to invalid IL or missing references) //IL_004e: Unknown result type (might be due to invalid IL or missing references) //IL_004f: Unknown result type (might be due to invalid IL or missing references) //IL_0082: 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) Vector3 val = p + q * new Vector3(0f, 0.72f, -0.2f); Vector3 val2 = p + q * new Vector3(0f, Mathf.Lerp(1.6f, 1f, duck), -0.2f); return !Physics.OverlapCapsule(val, val2, 0.31f, WorldQueries.Mask, (QueryTriggerInteraction)1).Any(BlocksMovement) && !Physics.OverlapSphere(HeadPoint(p, q, duck), 0.35f, WorldQueries.Mask, (QueryTriggerInteraction)1).Any(BlocksMovement); } public static Vector3 Move(Vector3 position, Quaternion rotation, Vector3 delta, float duck = 0f) { //IL_001f: Unknown result type (might be due to invalid IL or missing references) //IL_0021: Unknown result type (might be due to invalid IL or missing references) //IL_0026: Unknown result type (might be due to invalid IL or missing references) //IL_0027: 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_0038: 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_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_005c: Unknown result type (might be due to invalid IL or missing references) //IL_0061: Unknown result type (might be due to invalid IL or missing references) //IL_0077: 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_007f: Unknown result type (might be due to invalid IL or missing references) //IL_0084: Unknown result type (might be due to invalid IL or missing references) //IL_0089: 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_0091: 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_00a0: 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_0018: Unknown result type (might be due to invalid IL or missing references) //IL_0185: 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_00c3: 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_0105: Unknown result type (might be due to invalid IL or missing references) //IL_0107: 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_012f: Unknown result type (might be due to invalid IL or missing references) //IL_0134: Unknown result type (might be due to invalid IL or missing references) //IL_0174: Unknown result type (might be due to invalid IL or missing references) //IL_0175: Unknown result type (might be due to invalid IL or missing references) //IL_0177: 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) float magnitude = ((Vector3)(ref delta)).magnitude; if (magnitude < 1E-05f) { return position; } Vector3 val = delta / magnitude; Vector3 val2 = position + rotation * Vector3.Lerp(new Vector3(0f, 0.995f, -0.3f), new Vector3(0f, 0.66f, -0.2f), duck); float num = magnitude; float num2 = Mathf.Lerp(0.62f, 0.3f, duck); RaycastHit[] array = Physics.CapsuleCastAll(val2 - Vector3.up * num2, val2 + Vector3.up * num2, 0.335f, val, magnitude + 0.025f, WorldQueries.SolidMask, (QueryTriggerInteraction)1); for (int i = 0; i < array.Length; i++) { RaycastHit val3 = array[i]; if (BlocksMovement(((RaycastHit)(ref val3)).collider)) { num = Mathf.Min(num, Mathf.Max(0f, ((RaycastHit)(ref val3)).distance - 0.025f)); } } RaycastHit[] array2 = Physics.SphereCastAll(HeadPoint(position, rotation, duck), 0.35f, val, magnitude + 0.025f, WorldQueries.SolidMask, (QueryTriggerInteraction)1); for (int j = 0; j < array2.Length; j++) { RaycastHit val4 = array2[j]; if (BlocksMovement(((RaycastHit)(ref val4)).collider)) { num = Mathf.Min(num, Mathf.Max(0f, ((RaycastHit)(ref val4)).distance - 0.025f)); } } return position + val * num; } public static void Arms(FlinchMotion motion, float dt = -1f) { //IL_007f: Unknown result type (might be due to invalid IL or missing references) //IL_0084: Unknown result type (might be due to invalid IL or missing references) //IL_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_008f: 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_0093: 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_009a: 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_01ad: Unknown result type (might be due to invalid IL or missing references) //IL_01b2: Unknown result type (might be due to invalid IL or missing references) //IL_01b7: Unknown result type (might be due to invalid IL or missing references) //IL_0169: Unknown result type (might be due to invalid IL or missing references) //IL_016b: 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_0179: Unknown result type (might be due to invalid IL or missing references) //IL_017e: 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_01bf: Unknown result type (might be due to invalid IL or missing references) //IL_01f5: Unknown result type (might be due to invalid IL or missing references) //IL_01f7: Unknown result type (might be due to invalid IL or missing references) //IL_01fc: Unknown result type (might be due to invalid IL or missing references) //IL_0242: 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_0249: Unknown result type (might be due to invalid IL or missing references) //IL_024d: Unknown result type (might be due to invalid IL or missing references) //IL_0252: 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_022c: 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_023b: Unknown result type (might be due to invalid IL or missing references) //IL_0213: Unknown result type (might be due to invalid IL or missing references) //IL_027b: Unknown result type (might be due to invalid IL or missing references) //IL_0280: Unknown result type (might be due to invalid IL or missing references) //IL_02df: Unknown result type (might be due to invalid IL or missing references) //IL_02e4: Unknown result type (might be due to invalid IL or missing references) //IL_02e8: Unknown result type (might be due to invalid IL or missing references) //IL_02ed: Unknown result type (might be due to invalid IL or missing references) //IL_02f1: Unknown result type (might be due to invalid IL or missing references) //IL_02f6: Unknown result type (might be due to invalid IL or missing references) //IL_02fa: Unknown result type (might be due to invalid IL or missing references) //IL_02fc: Unknown result type (might be due to invalid IL or missing references) //IL_0302: Unknown result type (might be due to invalid IL or missing references) //IL_030d: Unknown result type (might be due to invalid IL or missing references) //IL_0312: Unknown result type (might be due to invalid IL or missing references) //IL_0331: Unknown result type (might be due to invalid IL or missing references) //IL_031e: Unknown result type (might be due to invalid IL or missing references) //IL_0349: Unknown result type (might be due to invalid IL or missing references) //IL_0361: Unknown result type (might be due to invalid IL or missing references) //IL_0372: Unknown result type (might be due to invalid IL or missing references) //IL_0376: Unknown result type (might be due to invalid IL or missing references) //IL_0378: Unknown result type (might be due to invalid IL or missing references) //IL_037d: Unknown result type (might be due to invalid IL or missing references) //IL_037f: Unknown result type (might be due to invalid IL or missing references) //IL_0394: Unknown result type (might be due to invalid IL or missing references) //IL_0399: Unknown result type (might be due to invalid IL or missing references) //IL_039e: Unknown result type (might be due to invalid IL or missing references) //IL_03f4: Unknown result type (might be due to invalid IL or missing references) //IL_03fb: Unknown result type (might be due to invalid IL or missing references) //IL_0405: Unknown result type (might be due to invalid IL or missing references) //IL_040a: Unknown result type (might be due to invalid IL or missing references) //IL_0411: 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_0420: Unknown result type (might be due to invalid IL or missing references) //IL_03a6: Unknown result type (might be due to invalid IL or missing references) //IL_03ad: Unknown result type (might be due to invalid IL or missing references) //IL_03ba: 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_03c6: Unknown result type (might be due to invalid IL or missing references) //IL_03d0: Unknown result type (might be due to invalid IL or missing references) //IL_03d5: Unknown result type (might be due to invalid IL or missing references) //IL_03dc: Unknown result type (might be due to invalid IL or missing references) //IL_03e6: Unknown result type (might be due to invalid IL or missing references) //IL_03eb: Unknown result type (might be due to invalid IL or missing references) //IL_0425: Unknown result type (might be due to invalid IL or missing references) //IL_042d: Unknown result type (might be due to invalid IL or missing references) //IL_042f: Unknown result type (might be due to invalid IL or missing references) //IL_043e: Unknown result type (might be due to invalid IL or missing references) //IL_0443: Unknown result type (might be due to invalid IL or missing references) //IL_0447: Unknown result type (might be due to invalid IL or missing references) //IL_044c: Unknown result type (might be due to invalid IL or missing references) //IL_0450: Unknown result type (might be due to invalid IL or missing references) //IL_0455: Unknown result type (might be due to invalid IL or missing references) //IL_0459: Unknown result type (might be due to invalid IL or missing references) //IL_045b: Unknown result type (might be due to invalid IL or missing references) //IL_0463: Unknown result type (might be due to invalid IL or missing references) //IL_0470: Unknown result type (might be due to invalid IL or missing references) //IL_0472: Unknown result type (might be due to invalid IL or missing references) //IL_047a: Unknown result type (might be due to invalid IL or missing references) //IL_0487: Unknown result type (might be due to invalid IL or missing references) //IL_0489: Unknown result type (might be due to invalid IL or missing references) //IL_0491: Unknown result type (might be due to invalid IL or missing references) //IL_0518: Unknown result type (might be due to invalid IL or missing references) //IL_051f: Unknown result type (might be due to invalid IL or missing references) //IL_052b: Unknown result type (might be due to invalid IL or missing references) if (dt < 0f) { dt = Time.deltaTime; } for (int i = 0; i < 2; i++) { string text = ((i == 0) ? "L" : "R"); ArmAvoidance armAvoidance = motion.Avoidance[i]; Transform val = motion.Map["upper_arm." + text]; Transform val2 = motion.Map["forearm." + text]; Transform val3 = motion.Map["hand." + text]; Vector3 position = val.position; Vector3 position2 = val3.position; Vector3 val4 = position2 - position; RaycastHit[] array = (from h in Physics.SphereCastAll(position, 0.1f, ((Vector3)(ref val4)).normalized, ((Vector3)(ref val4)).magnitude + 0.12f, WorldQueries.Mask, (QueryTriggerInteraction)1) where !WorldQueries.Self(((RaycastHit)(ref h)).collider) && !Object.op_Implicit((Object)(object)WorldQueries.PlayerOwner(((RaycastHit)(ref h)).collider)) orderby ((RaycastHit)(ref h)).distance select h).ToArray(); bool flag = array.Length != 0; Transform parent = motion.Visual.parent; bool flag2 = motion.State == State.Chase || motion.State == State.Patrol || motion.State == State.Stalk || motion.State == State.Retreat || motion.State == State.RoamBurst; float num = ((i != 0) ? 1 : (-1)); bool flag3 = flag2 && (flag || !WorldQueries.ClearTube(position, position2 + parent.forward * 0.27f, 0.12f)); Vector3 val5 = parent.TransformPoint(new Vector3(num * 0.25f, 0.91f, 0.32f)); if (flag3 && !WorldQueries.ClearTube(position, val5, 0.075f)) { flag3 = false; } bool flag4 = flag || flag3; if (!armAvoidance.Initialized) { armAvoidance.Target = parent.InverseTransformPoint(position2); armAvoidance.Initialized = true; } Vector3 val6 = parent.InverseTransformPoint(flag3 ? val5 : (flag ? (((RaycastHit)(ref array[0])).point + ((RaycastHit)(ref array[0])).normal * 0.2f) : position2)); armAvoidance.Target = Vector3.SmoothDamp(armAvoidance.Target, val6, ref armAvoidance.Velocity, flag3 ? 0.12f : 0.22f, flag3 ? 3.5f : 1.15f, dt); armAvoidance.Weight = Mathf.SmoothDamp(armAvoidance.Weight, (float)(flag4 ? 1 : 0), ref armAvoidance.WeightVelocity, flag3 ? 0.12f : (flag ? 0.18f : 0.3f), 5f, dt); if (armAvoidance.Weight > 0.005f) { Quaternion rotation = val.rotation; Quaternion rotation2 = val2.rotation; Quaternion rotation3 = val3.rotation; Vector3 val7 = Vector3.Lerp(parent.InverseTransformPoint(position2), armAvoidance.Target, armAvoidance.Weight); val7.x = ((i == 0) ? Mathf.Min(-0.12f, val7.x) : Mathf.Max(0.12f, val7.x)); val7.y = Mathf.Max(0.12f, val7.y); val7.z = Mathf.Max(-0.3f, val7.z); Vector3 target = position2 + Vector3.ClampMagnitude(parent.TransformPoint(val7) - position2, flag3 ? 1.05f : 0.4f); Vector3 value = (flag3 ? (val.position - parent.forward * 0.6f - parent.up * 0.4f) : (val.position + parent.right * (num * 0.6f) - parent.up * 0.25f + parent.forward * 0.1f)); Solve(val, val2, val3, target, value); Quaternion rotation4 = val.rotation; Quaternion rotation5 = val2.rotation; Quaternion rotation6 = val3.rotation; val.rotation = Quaternion.Slerp(rotation, rotation4, armAvoidance.Weight); val2.rotation = Quaternion.Slerp(rotation2, rotation5, armAvoidance.Weight); val3.rotation = Quaternion.Slerp(rotation3, rotation6, armAvoidance.Weight); } if (flag2 && (flag4 || armAvoidance.Weight > 0.001f || armAvoidance.TuckRecovery > 0f)) { armAvoidance.TuckRecovery = (flag3 ? 0.24f : Mathf.Max(0f, armAvoidance.TuckRecovery - dt)); Transform[] array2 = (Transform[])(object)new Transform[3] { val, val2, val3 }; foreach (Transform val8 in array2) { val8.localRotation = Quaternion.RotateTowards(motion.PreviousRotation(val8), val8.localRotation, 720f * dt); } } } } public static void Solve(Transform upper, Transform fore, Transform hand, Vector3 target, Vector3? pole = null) { //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) //IL_0009: 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_0010: Unknown result type (might be due to invalid IL or missing references) //IL_0015: Unknown result type (might be due to invalid IL or missing references) //IL_0016: 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_0018: Unknown result type (might be due to invalid IL or missing references) //IL_001d: Unknown result type (might be due to invalid IL or missing references) //IL_0027: 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_0029: 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_0039: Unknown result type (might be due to invalid IL or missing references) //IL_003a: 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_0044: 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_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_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_008f: 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_0095: Unknown result type (might be due to invalid IL or missing references) //IL_0084: Unknown result type (might be due to invalid IL or missing references) //IL_0085: 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) //IL_009a: 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_00a1: Unknown result type (might be due to invalid IL or missing references) //IL_0101: 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_0106: Unknown result type (might be due to invalid IL or missing references) //IL_010b: Unknown result type (might be due to invalid IL or missing references) //IL_0110: Unknown result type (might be due to invalid IL or missing references) //IL_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_011e: 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_0126: Unknown result type (might be due to invalid IL or missing references) //IL_0129: Unknown result type (might be due to invalid IL or missing references) //IL_012a: Unknown result type (might be due to invalid IL or missing references) //IL_012b: Unknown result type (might be due to invalid IL or missing references) //IL_0130: 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_0133: 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_013e: Unknown result type (might be due to invalid IL or missing references) //IL_0143: Unknown result type (might be due to invalid IL or missing references) //IL_0150: Unknown result type (might be due to invalid IL or missing references) //IL_0156: Unknown result type (might be due to invalid IL or missing references) //IL_015b: Unknown result type (might be due to invalid IL or missing references) //IL_0160: Unknown result type (might be due to invalid IL or missing references) //IL_0161: Unknown result type (might be due to invalid IL or missing references) //IL_0165: Unknown result type (might be due to invalid IL or missing references) //IL_016a: Unknown result type (might be due to invalid IL or missing references) //IL_0170: Unknown result type (might be due to invalid IL or missing references) //IL_0175: 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_0180: Unknown result type (might be due to invalid IL or missing references) //IL_0185: Unknown result type (might be due to invalid IL or missing references) //IL_0191: Unknown result type (might be due to invalid IL or missing references) //IL_00b7: 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_00be: Unknown result type (might be due to invalid IL or missing references) //IL_00c3: Unknown result type (might be due to invalid IL or missing references) Vector3 position = upper.position; Vector3 position2 = fore.position; Vector3 position3 = hand.position; Vector3 val = position2 - position; float magnitude = ((Vector3)(ref val)).magnitude; val = position3 - position2; float magnitude2 = ((Vector3)(ref val)).magnitude; val = target - position; Vector3 normalized = ((Vector3)(ref val)).normalized; val = target - position; float num = Mathf.Clamp(((Vector3)(ref val)).magnitude, Mathf.Abs(magnitude - magnitude2) + 0.005f, magnitude + magnitude2 - 0.005f); Vector3 val2 = Vector3.ProjectOnPlane(pole.HasValue ? (pole.Value - position) : (position2 - position), normalized); if (((Vector3)(ref val2)).sqrMagnitude < 0.0001f) { val2 = Vector3.Cross(normalized, Vector3.up); } ((Vector3)(ref val2)).Normalize(); float num2 = (num * num + magnitude * magnitude - magnitude2 * magnitude2) / (2f * num); float num3 = Mathf.Sqrt(Mathf.Max(0f, magnitude * magnitude - num2 * num2)); Vector3 val3 = position + normalized * num2 + val2 * num3; Quaternion rotation = hand.rotation; upper.rotation = Quaternion.FromToRotation(position2 - position, val3 - position) * upper.rotation; fore.rotation = Quaternion.FromToRotation(hand.position - fore.position, position + normalized * num - fore.position) * fore.rotation; hand.rotation = rotation; } } public sealed class ArmAvoidance { public bool Initialized; public Vector3 Target; public Vector3 Velocity; public float Weight; public float WeightVelocity; public float TuckRecovery; } }