using System; using System.Collections; using System.Collections.Generic; using System.Diagnostics; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using System.Security; using System.Security.Permissions; using BepInEx; using BepInEx.Configuration; using BepInEx.Logging; using HarmonyLib; using Microsoft.CodeAnalysis; using Photon.Pun; using UnityEngine; using Zorro.Core; using Zorro.Settings; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)] [assembly: IgnoresAccessChecksTo("Assembly-CSharp")] [assembly: IgnoresAccessChecksTo("MMHOOK_Assembly-CSharp")] [assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")] [assembly: AssemblyCompany("PingDrivenRobots")] [assembly: AssemblyConfiguration("Debug")] [assembly: AssemblyFileVersion("1.3.9.0")] [assembly: AssemblyInformationalVersion("1.3.9")] [assembly: AssemblyProduct("PingDrivenRobots")] [assembly: AssemblyTitle("PingDrivenRobots")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.3.9.0")] [module: UnverifiableCode] [module: RefSafetyRules(11)] namespace Microsoft.CodeAnalysis { [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] internal sealed class EmbeddedAttribute : Attribute { } } namespace System.Runtime.CompilerServices { [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] [AttributeUsage(AttributeTargets.Class | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Parameter | AttributeTargets.ReturnValue | AttributeTargets.GenericParameter, AllowMultiple = false, Inherited = false)] internal sealed class NullableAttribute : Attribute { public readonly byte[] NullableFlags; public NullableAttribute(byte P_0) { NullableFlags = new byte[1] { P_0 }; } public NullableAttribute(byte[] P_0) { NullableFlags = P_0; } } [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] [AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Method | AttributeTargets.Interface | AttributeTargets.Delegate, AllowMultiple = false, Inherited = false)] internal sealed class NullableContextAttribute : Attribute { public readonly byte Flag; public NullableContextAttribute(byte P_0) { Flag = P_0; } } [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] [AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)] internal sealed class RefSafetyRulesAttribute : Attribute { public readonly int Version; public RefSafetyRulesAttribute(int P_0) { Version = P_0; } } } namespace BepInEx { [AttributeUsage(AttributeTargets.Class, Inherited = false, AllowMultiple = false)] [Conditional("CodeGeneration")] internal sealed class BepInAutoPluginAttribute : Attribute { public BepInAutoPluginAttribute(string? id = null, string? name = null, string? version = null) { } } } namespace BepInEx.Preloader.Core.Patching { [AttributeUsage(AttributeTargets.Class, Inherited = false, AllowMultiple = false)] [Conditional("CodeGeneration")] internal sealed class PatcherAutoPluginAttribute : Attribute { public PatcherAutoPluginAttribute(string? id = null, string? name = null, string? version = null) { } } } namespace PingDrivenRobots { internal sealed class NetworkRobotAgent : MonoBehaviour { internal sealed class FailedSegmentMemory { public PathActionType Action = PathActionType.None; public RouteFailureReason Reason = RouteFailureReason.Unknown; public Vector3 Position = Vector3.zero; public Vector3 Direction = Vector3.zero; public float Until; } private sealed class GroundCorridorCacheEntry { public bool Found; public GroundCorridorStats Stats; public float CreatedAt; } private struct GroundCorridorStats { public Vector3 EndPoint; public float PathLength; public float TotalRise; public float TotalDrop; public float MaxStepRise; public float MaxStepDrop; public bool HasSlope; public bool NeedsSmallHops; } private sealed class SpatialRouteNode { public Vector3 Position; public readonly List Segments = new List(); public float Cost; public float Score; public float DistanceToGoal; public float RemainingStamina; public int Depth; } private readonly struct SpatialRouteStateKey : IEquatable { private readonly int _x; private readonly int _y; private readonly int _z; private readonly int _depth; private readonly int _stamina; public SpatialRouteStateKey(int x, int y, int z, int depth, int stamina) { _x = x; _y = y; _z = z; _depth = depth; _stamina = stamina; } public bool Equals(SpatialRouteStateKey other) { return _x == other._x && _y == other._y && _z == other._z && _depth == other._depth && _stamina == other._stamina; } public override bool Equals(object? obj) { return obj is SpatialRouteStateKey other && Equals(other); } public override int GetHashCode() { int x = _x; x = (x * 397) ^ _y; x = (x * 397) ^ _z; x = (x * 397) ^ _depth; return (x * 397) ^ _stamina; } } private const float BackpackPickupFlatDistance = 1.35f; private const float BackpackPickupVerticalDistance = 1.6f; private const float BackpackPickupReachWindup = 0.65f; private const float BackpackPickupReachHold = 0.9f; private const float BackpackPickupAttachAfterReachStopDelay = 0.3f; private const float BackpackPickupRetargetInterval = 0.15f; private const float BackpackPickupTimeout = 20f; private Backpack? _backpackTarget; private bool _backpackCommandActive; private bool _backpackPickupReachStarted; private bool _backpackPickupInteractionSent; private bool _backpackPickupReachStopped; private float _backpackNextGoalRefreshTime; private float _backpackReachStartTime; private float _backpackReachStopTime; private float _backpackAttachTime; private float _backpackCommandStartTime; private const float ManualBiteAcquireRadius = 10f; private const float ManualBiteMinStamina = 0.05f; private const float CarryAssistAcquireRadius = 80f; private const float CarryAssistStartFlatDistance = 1.75f; private const float CarryAssistStartVerticalDistance = 2.25f; private const float CarryAssistRetargetInterval = 0.75f; private Character? _manualBiteTarget; private bool _manualBiteActive; private Character? _vanillaBiteTarget; private bool _vanillaBiteControlActive; private bool _carryAssistEnabled; private Character? _carryTarget; private float _nextCarryRetargetTime; private readonly List _failedSegments = new List(); public static readonly List All = new List(); private static readonly Dictionary AgentByZombieInstanceId = new Dictionary(); private static readonly Dictionary MissingAgentRetryByZombieInstanceId = new Dictionary(); private const float MissingZombieAgentRetrySeconds = 0.25f; private int _spawnOwnerActorNumber; private string _spawnOwnerUserId = string.Empty; private bool _rawGoalIsStandable; private const float ImmediateDirectClimbFlatDistance = 2.35f; private const float ImmediateDirectClimbVerticalSlack = 0.55f; private const float SmallObstacleHopCooldown = 0.12f; private const float SmallObstacleHopMinStamina = 0.16f; private const float HeavyActionLowStaminaThreshold = 0.08f; private const float SprintMinStamina = 0.12f; private const float FlatTravelHopVerticalTolerance = 0.45f; private const float FlatTravelHopMinDistance = 2f; private const float GoalExactStandFlatRadius = 1.05f; private const float GoalExactStandVerticalTolerance = 1.2f; private const float GoalStableStandSeconds = 1f; private const float GoalSettleFlatRadius = 1.55f; private const float GoalSettleVerticalTolerance = 1.25f; private const float GoalParkHysteresisFlat = 2.45f; private const float GoalParkHysteresisVertical = 2.25f; private const float GoalArrivalSettleFlatRadius = 2.05f; private const float GoalArrivalSettleVerticalTolerance = 1.6f; private const float RoughWalkableSlopeAngle = 68f; private const float RoughClimbTopSlopeAngle = 72f; private const float RoughSupportHeightTolerance = 1.05f; private const float ObstacleBypassJumpMinHeight = 0.28f; private const float ObstacleBypassJumpMaxHeight = 1.55f; private const float ObstacleBypassJumpMaxLandingDelta = 0.9f; private const float TerrainFallbackMaxRise = 2.15f; private const float TerrainFallbackMaxDrop = 6.5f; private const float TerrainFallbackMinProgress = -0.25f; public bool canBeCarriedAsRobot; public bool suppressRobotAI; public float zombieInteractionLock; public float lastRobotFedTime; private const float EdgeGoalSupportProbeRadius = 0.45f; private const float EdgeGoalSupportProbeHeight = 0.65f; private const float EdgeGoalSupportDropTolerance = 1.4f; private const float EdgeGoalResolvedReuseDistance = 0.9f; private const float EdgeGoalRawOffsetThreshold = 0.55f; private const float EdgeGoalArriveFlat = 1.85f; private const float EdgeGoalArriveVertical = 2.6f; private const float EdgeGoalNearPlanDistance = 2.2f; private PathPlan _lockedClimbPlan = new PathPlan(); private bool _hasLockedClimbPlan; private readonly Queue _segmentQueue = new Queue(); private PathPlan _activeSegment = new PathPlan(); private bool _hasActiveSegment; private float _routeWindowStartTime; private float _routeWindowStartGoalDistance; private Vector3 _segmentStartPos; private float _segmentStartTime; private float _segmentStartGoalDistance; private Vector3 _lastAcceptedGoalPoint = Vector3.zero; private bool _hadAcceptedGoalPoint; private float _nextReplanTime; private const float ImmediateJumpGrabMaxFlatDistance = 3.2f; private const float ImmediateJumpGrabMinHeightDelta = 1f; private const float ImmediateJumpGrabMaxHeightDelta = 4.8f; private const float ImmediateJumpGrabAnchorRadius = 1.6f; private const float SegmentMinProgressTime = 1.2f; private const float SegmentProgressTimeout = 3f; private const float SegmentMinGoalProgress = 1f; private const float SegmentArriveDistance = 1.25f; private const float SegmentArriveVertical = 1.75f; private const float RouteNetProgressWindow = 2.5f; private const float RouteNetProgressMin = 0.9f; private const float ReplanCooldown = 0.42f; private const int MaxPlannedSegments = 3; private const int GuidePlannerMaxDepth = 2; private const int GuidePlannerBeamWidth = 3; private const int GuidePlannerMaxCandidatesPerNode = 10; private const float GuidePlannerMinUsefulProgress = -1.75f; private const float GuidePlannerCloseEnoughFlat = 2.15f; private const float GuidePlannerCloseEnoughVertical = 2.35f; private const float GuidePlannerRepeatPenaltyDistance = 2.4f; private const float GuidePlannerMemoryLifetime = 5.5f; private const float GuidePlannerCacheLifetime = 1.1f; private const int GuidePlannerMaxCandidateCacheEntries = 128; private const int GuidePlannerMaxPathCacheEntries = 32; private const float GuidePlannerPositionCell = 1.4f; private const float GuidePlannerGoalCell = 1.25f; private const float GuidePlannerDpCell = 1.75f; private const float GuidePlannerDpScoreEpsilon = 0.08f; private const float VerticalDropFlatEpsilon = 0.35f; private const float LowerGoalThreshold = -1.25f; private const float DropSearchMaxAnchorDistance = 8.75f; private const float DropEdgeArrivalDistance = 1.15f; private const float DropLandingGoalWeight = 1.75f; private const float DropSearchTargetDirectionBonus = 1.2f; private const float StableRestSlopeAngle = 42f; private const float SlopeSettleNormalAngle = 48f; private const float SlopeSettleAssistDistance = 2.35f; private const float SlopeSettleExtraForward = 1.25f; private const float SlopeSettleClimbProbe = 0.85f; private const float ClimbProbeMinStamina = 0.1f; private const float ActiveClimbExhaustedStaminaThreshold = 0.018f; private const float ClimbContinueMinStamina = 0.018f; private const float ClimbNearTopContinueMinStamina = 0.018f; private float _repositionUntil; private const float ClimbStartGraceTime = 0.45f; private const float RepositionMinDuration = 1.1f; private const float DirectBlockedPenaltyThreshold = 1.1f; private const float ClimbLastStaminaBurstThreshold = 0.18f; private MushroomZombie _zombie = null; private Character _character = null; private PhotonView _view = null; private RobotBrainState _brainState = RobotBrainState.Idle; private Character? _ownerCharacter; private Character? _target; private Vector3 _goalPoint; private bool _hasGoalPoint; private Vector3 _resolvedGoalPoint; private bool _hasResolvedGoalPoint; private bool _resolvedGoalIsStandable; private float _nextResolvedGoalRefreshTime; private Vector3 _lastResolvedRawGoal; private bool _hasLastResolvedRawGoal; private float _goalStableTimer; private bool _goalParked; private Vector3 _parkedGoalPoint; private int _goalInstructionSerial; private int _parkedGoalInstructionSerial; private int _lastAcceptedPingSequence; private bool _allowGoalParking; private float _nextTargetRefreshTime; private float _lastSeenTargetTime; private float _timeInChase; private float _timeInLunge; private float _stuckTimer; private Vector3 _stuckAnchor; private int _stuckCount; private float _climbTimer; private float _climbStartHeight; private int _failedClimbCount; private bool _activeClimbStartedAtRetryFullStamina; private bool _awaitingFullStaminaClimbRetry; private bool _fullStaminaClimbRetryConsumed; private Vector3 _fullStaminaClimbRetryAnchor; private int _fullStaminaClimbRetryGoalSerial; private Vector3 _timeCriticalEdgeProbeTarget = Vector3.zero; private float _timeCriticalEdgeProbeTime; private bool _timeCriticalEdgeProbeResult; private float _lastAutoJumpTime; private PathPlan _plan = new PathPlan(); private readonly List _blockedMemory = new List(); private readonly List _recentRouteChoices = new List(); private readonly Dictionary _guideCandidateCache = new Dictionary(); private readonly Dictionary _spatialCandidateCache = new Dictionary(); private readonly Dictionary _guidePathCache = new Dictionary(); private readonly Dictionary _groundCorridorCache = new Dictionary(); private readonly Dictionary _routeStandableColliderCache = new Dictionary(); private readonly List _candidateCacheRemovalScratch = new List(64); private readonly List _pathCacheRemovalScratch = new List(64); private static readonly Dictionary SharedGuidePathCache = new Dictionary(); private static readonly Dictionary SharedGroundProbeCache = new Dictionary(); private static readonly Dictionary SharedLineProbeCache = new Dictionary(); private static readonly List SharedRoutePathRemovalScratch = new List(96); private static readonly List SharedPhysicsProbeRemovalScratch = new List(128); private static float SharedNextGuideCachePruneTime; private static float SharedNextPhysicsProbePruneTime; private static int SharedPlannerBudgetFrame = -1; private static int SharedPlannerBudgetUsed; private const int SharedMaxGuidedRoutePlansPerFrameDefault = 1; private const int SharedGuidePlannerMaxPathCacheEntries = 128; private const int SharedMaxGroundProbeCacheEntries = 512; private const int SharedMaxLineProbeCacheEntries = 512; private const float SharedGuidePlannerPathCacheLifetime = 2.5f; private const float SharedPhysicsProbeCacheLifetime = 0.18f; private const float SharedPhysicsProbePruneInterval = 0.25f; private const float SharedPhysicsProbeCell = 0.55f; private const float GroundCorridorCacheLifetime = 0.35f; private const int GroundCorridorMaxCacheEntries = 160; private const float GroundCorridorCacheCell = 0.85f; private bool _initialized; private float _nextPersistentRefreshTime; private State _lastVisualZombieState = (State)(-1); private bool _lastVisualBiteColliderEnabled; private bool _lastVisualSprintState; private bool _hasVisualStateSnapshot; private float _nextRemoteMouthRefreshTime; private const float ProbeDistance = 2.2f; private const float GroundProbeHeight = 2.2f; private const float GroundProbeDepth = 16f; private const float ObstacleProbeRadius = 0.38f; private const float MaxSafeWalkDrop = 10f; private const float MaxSafeJumpDrop = 20f; private const float GapJumpNear = 1.8f; private const float GapJumpFar = 4.8f; private const float MaxClimbHeight = 4.2f; private const float TargetAboveThreshold = 1.4f; private const float OverheadSearchRadius = 3.5f; private const float TravelHopInterval = 0.2f; private const float ChainJumpStaminaThreshold = 0.35f; private const float StickyClimbMinTime = 0.8f; private const float StickyClimbTopReleaseFlat = 1.8f; private const float StickyClimbTopReleaseVertical = -1f; private const float TallWallHeightThreshold = 2.15f; private const float SmallWallFastClimbThreshold = 1.2f; private const float ClimbBurstStartProgress = 0.55f; private const float ClimbBurstMinStamina = 0.12f; private const float ClosePressureFlat = 1.65f; private const float ClosePressureVertical = 1.15f; private const float CloseStopFlat = 0.55f; private const float JumpGrabMinVertical = 1f; private const float JumpGrabMaxVertical = 4.6f; private const float JumpGrabPressInterval = 0.2f; private const float JumpGrabMinStamina = 0.18f; private const float ClimbTraverseStrongX = 0.95f; private const float ClimbTraverseWeakX = 0.6f; private const float ClimbDiagonalUp = 0.95f; private const float ClimbVerticalUp = 1f; private const float ClimbBurstSprintXBoost = 1.15f; private const float ClimbBurstSprintYBoost = 1.12f; private const float ClimbTopAssistDistance = 1.25f; private const float GoalArriveFlatDistance = 1.35f; private const float GoalArriveVerticalDistance = 2.25f; private const float ClimbWaitAnchorDistance = 1.35f; private const float ClimbResumeHysteresis = 0.02f; private const float FullStaminaRetryReadyEpsilon = 0.02f; private const float FullStaminaRetrySameSiteDistance = 2.75f; private const float TimeCriticalJumpGrabMinStamina = 0.24f; private const float TimeCriticalClimbMinStamina = 0.28f; private const float TimeCriticalCarryMinStamina = 0.38f; private const float TimeCriticalShortClimbMaxHeight = 2.05f; private const float TimeCriticalTraversalMaxHeight = 3.35f; private const float TimeCriticalJumpGrabMinHorizontal = 0.72f; private const float TimeCriticalEdgeProbeForward = 0.82f; private const float TimeCriticalEdgeSafeDrop = 1.55f; private const float TimeCriticalEdgeProbeUp = 0.35f; private const float TimeCriticalEdgeProbeDown = 3.65f; private const float GoalStandSearchRadius = 1.2f; private const float GoalStandPreferRadius = 0.95f; private const float NonStandableGoalAccessSearchRadius = 5.2f; private const float NonStandableGoalAccessProbeHeight = 7f; private const float NonStandableGoalAccessProbeDepth = 13.5f; private const float ResolvedGoalRefreshInterval = 1.5f; private const float SmallObstacleHeightMax = 1.1f; private const float SmallObstacleForwardCheck = 1f; private static readonly float[] SearchAngles = new float[11] { 0f, 20f, -20f, 40f, -40f, 60f, -60f, 90f, -90f, 120f, -120f }; private static readonly float[] OverheadAngles = new float[14] { 0f, 20f, -20f, 40f, -40f, 60f, -60f, 90f, -90f, 120f, -120f, 150f, -150f, 180f }; private static readonly float[] GuideSearchAngles = new float[7] { 0f, 25f, -25f, 55f, -55f, 90f, -90f }; private static readonly float[] GuideSearchDistances = new float[2] { 2f, 4.2f }; private static readonly float[] TerrainFallbackDistances = new float[5] { 1.4f, 2.4f, 3.8f, 5.6f, 7.5f }; private static readonly float[] LateralTraverseSamples = new float[4] { 0.7f, 1.1f, 1.5f, 2f }; private static readonly float[] JumpGrabAngleSamples = new float[11] { 0f, 15f, -15f, 30f, -30f, 45f, -45f, 60f, -60f, 90f, -90f }; private static readonly float[] JumpGrabLaunchSamples = new float[5] { 0.55f, 0.85f, 1.2f, 1.6f, 2f }; private static readonly float[] JumpGrabWallSamples = new float[7] { 1.25f, 1.65f, 2.2f, 2.8f, 3.4f, 4f, 4.6f }; private static readonly float[] ClimbProbeForwardSamples = new float[7] { 0.55f, 0.8f, 1.05f, 1.3f, 1.6f, 1.95f, 2.2f }; private static readonly float[] DropSearchAngles = new float[12] { 0f, 30f, -30f, 60f, -60f, 90f, -90f, 120f, -120f, 150f, -150f, 180f }; private static readonly float[] DropAnchorSamples = new float[9] { 0.8f, 1.15f, 1.55f, 2.05f, 2.7f, 3.45f, 4.35f, 5.35f, 6.5f }; private static readonly float[] DropLandingExtraSamples = new float[6] { 0.55f, 0.9f, 1.35f, 1.9f, 2.55f, 3.35f }; private static readonly float[] NonStandableGoalAccessRadii = new float[6] { 0.55f, 1.1f, 1.8f, 2.7f, 3.8f, 5.2f }; private static readonly float[] NonStandableGoalAccessAngles = new float[8] { 0f, 45f, -45f, 90f, -90f, 135f, -135f, 180f }; private static readonly float[] ObstacleLandingOffsets = new float[4] { 0.95f, 1.25f, 1.6f, 1.95f }; private static readonly float[] WallContinuationDistances = new float[4] { 0.65f, 1.1f, 1.65f, 2.25f }; private static readonly float[] RecoverySearchAngles = new float[8] { 0f, 35f, -35f, 70f, -70f, 115f, -115f, 180f }; private static readonly float[] RecoverySearchDistances = new float[4] { 1.15f, 1.75f, 2.45f, 3.15f }; private static readonly float[] ReverseAccessRadii = new float[5] { 0.65f, 1.1f, 1.7f, 2.4f, 3.2f }; private static readonly float[] ReverseAccessAngles = new float[10] { 180f, 145f, -145f, 110f, -110f, 70f, -70f, 35f, -35f, 0f }; private static readonly float[] ObstacleBypassAngles = new float[9] { 0f, 18f, -18f, 35f, -35f, 55f, -55f, 75f, -75f }; private static readonly float[] WallTraverseLateralDistances = new float[5] { 0.95f, 1.45f, 2.1f, 2.85f, 3.6f }; private static readonly Vector3[] StandSupportDirections = (Vector3[])(object)new Vector3[4] { Vector3.forward, Vector3.back, Vector3.left, Vector3.right }; private static readonly Vector3[] GoalStandOffsets = (Vector3[])(object)new Vector3[16] { new Vector3(0.95f, 0f, 0f), new Vector3(-0.95f, 0f, 0f), new Vector3(0f, 0f, 0.95f), new Vector3(0f, 0f, -0.95f), new Vector3(1.2f, 0f, 0f), new Vector3(-1.2f, 0f, 0f), new Vector3(0f, 0f, 1.2f), new Vector3(0f, 0f, -1.2f), new Vector3(0.95f, 0f, 0.95f), new Vector3(-0.95f, 0f, 0.95f), new Vector3(0.95f, 0f, -0.95f), new Vector3(-0.95f, 0f, -0.95f), new Vector3(1.2f, 0f, 1.2f), new Vector3(-1.2f, 0f, 1.2f), new Vector3(1.2f, 0f, -1.2f), new Vector3(-1.2f, 0f, -1.2f) }; private static readonly int TerrainMask = LayerMask.GetMask(new string[2] { "Terrain", "Map" }); private static readonly MethodInfo? PushStateMethod = AccessTools.Method(typeof(MushroomZombie), "PushState", (Type[])null, (Type[])null); private static readonly FieldInfo? ZombieTimeSpentChasingField = AccessTools.Field(typeof(MushroomZombie), "timeSpentChasing"); private static readonly FieldInfo? ZombieCurrentTargetField = AccessTools.Field(typeof(MushroomZombie), "_currentTarget"); private static readonly FieldInfo? ZombieTargetForcedUntilField = AccessTools.Field(typeof(MushroomZombie), "targetForcedUntil"); private const float BlockedMemoryDefaultLifetime = 6f; private const float BlockedMemoryMaxRadius = 5f; private const float BlockedMemoryMinRadius = 1.25f; private const float BlockedMemoryBasePenalty = 1f; private const float BlockedMemoryMaxPenalty = 4f; private const float ValidatedGroundSampleSpacing = 0.72f; private const float ValidatedGroundMaxStepUp = 0.95f; private const float ValidatedGroundMaxStepDown = 1.2f; private const float ValidatedGroundMaxSegmentFlat = 7.25f; private const float ValidatedGroundFullGoalMaxFlat = 14f; private const float GroundPlanMinimumProgress = 0.45f; private const float GroundPlanMaxUsefulRise = 5f; private static readonly float[] SlopeStableExtraDistances = new float[5] { 0.75f, 1.2f, 1.75f, 2.35f, 3.1f }; private const float FootholdScanHeightTrigger = 0.85f; private const float FootholdScanMaxFlat = 15.5f; private const float FootholdScanMaxRayHeight = 7.5f; private const float FootholdScanRayDepth = 18f; private const float FootholdSameLevelIgnoreHeight = 0.38f; private static readonly float[] FootholdForwardSamples = new float[8] { 1.25f, 2.15f, 3.25f, 4.55f, 6.15f, 8.2f, 10.6f, 13.4f }; private static readonly float[] FootholdLateralSamples = new float[7] { 0f, -0.8f, 0.8f, -1.65f, 1.65f, -2.75f, 2.75f }; private RobotBrainState _lastLoggedBrainState = (RobotBrainState)(-1); private const int SpatialPlannerMaxDepthDefault = 4; private const int SpatialPlannerBeamWidthDefault = 8; private const int SpatialPlannerMaxCandidatesPerNodeDefault = 18; private const float SpatialPlannerCacheLifetime = 2.2f; private const float SpatialCandidateCacheLifetime = 0.55f; private const float SpatialPlannerCell = 1.65f; private const float SpatialPlannerCloseFlat = 2.05f; private const float SpatialPlannerCloseVertical = 1.65f; private const float SpatialWalkStepMaxRise = 0.78f; private const float SpatialWalkStepMaxDrop = 1.05f; private const float SpatialRampTotalRiseLimit = 2.25f; private const float SpatialRampTotalDropLimit = 3.25f; private const float SpatialCandidateMaxRise = 5.25f; private const float SpatialCandidateMaxDrop = 9.5f; private const float SpatialMinUseful3DProgress = -1.25f; private const float SpatialRouteAssistSearchRadius = 7.5f; private const float SpatialRouteAssistTopProbeHeight = 9.5f; private const int SpatialRouteAssistMaxColliders = 48; private static readonly Collider[] SharedRouteAssistColliderBuffer = (Collider[])(object)new Collider[48]; private static readonly float[] SpatialAngles = new float[12] { 0f, 20f, -20f, 45f, -45f, 70f, -70f, 105f, -105f, 145f, -145f, 180f }; private static readonly float[] SpatialDistances = new float[5] { 1.25f, 2.35f, 3.75f, 5.6f, 7.75f }; private static readonly float[] SpatialVerticalProbeOffsets = new float[4] { 2.4f, 4.4f, 6.8f, 9.2f }; public Character? Character => _character; public PhotonView? View => _view; public int SpawnOwnerActorNumber => _spawnOwnerActorNumber; public bool IsOwnedByLocalPlayer { get { if (!_initialized || (Object)(object)_view == (Object)null) { return false; } if (_view.IsMine) { return true; } return IsSpawnedByLocalPlayer; } } public bool IsSpawnedByLocalPlayer => PhotonNetwork.LocalPlayer != null && _spawnOwnerActorNumber > 0 && PhotonNetwork.LocalPlayer.ActorNumber == _spawnOwnerActorNumber; private bool IsAdvancedRoutingEnabled() { return (Object)(object)Plugin.Instance == (Object)null || Plugin.Instance.AdvancedRoutingEnabled; } private bool IsSpatialRoutingEnabled() { return IsAdvancedRoutingEnabled() && ((Object)(object)Plugin.Instance == (Object)null || Plugin.Instance.SpatialRoutingEnabled); } private bool IsReverseRouteSearchEnabled() { return IsSpatialRoutingEnabled() && ((Object)(object)Plugin.Instance == (Object)null || Plugin.Instance.ReverseRouteSearchEnabled); } private bool IsExplicitStaminaWaitEnabled() { return IsAdvancedRoutingEnabled() && ((Object)(object)Plugin.Instance == (Object)null || Plugin.Instance.ExplicitStaminaWaitEnabled); } private bool IsFailureMemoryEnabled() { return IsAdvancedRoutingEnabled() && ((Object)(object)Plugin.Instance == (Object)null || Plugin.Instance.FailureMemoryEnabled); } private bool IsRouteAssistAwarenessEnabled() { return IsAdvancedRoutingEnabled() && ((Object)(object)Plugin.Instance == (Object)null || Plugin.Instance.RouteAssistAwarenessEnabled); } private bool IsAdvancedRoutingDebugEnabled() { return (Object)(object)Plugin.Instance != (Object)null && Plugin.Instance.DebugRoutingLogs; } private bool IsAdvancedRoutingDrawEnabled() { return (Object)(object)Plugin.Instance != (Object)null && Plugin.Instance.DebugDrawRouting; } private int GetConfiguredSpatialPlannerMaxDepth() { return ((Object)(object)Plugin.Instance != (Object)null) ? Plugin.Instance.SpatialPlannerMaxDepth : 4; } private int GetConfiguredSpatialPlannerBeamWidth() { return ((Object)(object)Plugin.Instance != (Object)null) ? Plugin.Instance.SpatialPlannerBeamWidth : 8; } private int GetConfiguredSpatialPlannerMaxCandidatesPerNode() { return ((Object)(object)Plugin.Instance != (Object)null) ? Plugin.Instance.SpatialPlannerMaxCandidatesPerNode : 18; } private int GetConfiguredSharedPlannerPlansPerFrame() { return (!((Object)(object)Plugin.Instance != (Object)null)) ? 1 : Plugin.Instance.SharedPlannerPlansPerFrame; } private float GetConfiguredStaminaSafetyRatio() { return ((Object)(object)Plugin.Instance != (Object)null) ? Plugin.Instance.StaminaSafetyRatio : 0.22f; } private void DebugAdvancedRouting(string message) { if (IsAdvancedRoutingDebugEnabled()) { Plugin.Log.LogDebug((object)("[AdvancedRouting] " + message)); } } private void DebugDrawRouteSegments(List segments, string source) { //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_0039: 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_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_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_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_0079: 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_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_0090: 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_00a1: 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_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_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_00cd: 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_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_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_0104: 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_0113: 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_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) //IL_012e: 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_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_0159: Unknown result type (might be due to invalid IL or missing references) //IL_015e: Unknown result type (might be due to invalid IL or missing references) //IL_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_0174: 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) if (!IsAdvancedRoutingDrawEnabled() || (Object)(object)_character == (Object)null || segments.Count == 0) { return; } Vector3 val = _character.Center; Vector3 val2 = Vector3.up * 0.18f; for (int i = 0; i < segments.Count; i++) { PathPlan pathPlan = segments[i]; Vector3 planProjectedEndPoint = GetPlanProjectedEndPoint(pathPlan); Color debugColorForAction = GetDebugColorForAction(pathPlan.Action); Debug.DrawLine(val + val2, planProjectedEndPoint + val2, debugColorForAction, 2.25f); if (pathPlan.Anchor != Vector3.zero && Vector3.Distance(val, pathPlan.Anchor) > 0.35f) { Debug.DrawLine(val + Vector3.up * 0.32f, pathPlan.Anchor + Vector3.up * 0.32f, Color.gray, 2.25f); Debug.DrawLine(pathPlan.Anchor + Vector3.left * 0.18f, pathPlan.Anchor + Vector3.right * 0.18f, Color.white, 2.25f); Debug.DrawLine(pathPlan.Anchor + Vector3.forward * 0.18f, pathPlan.Anchor + Vector3.back * 0.18f, Color.white, 2.25f); } val = planProjectedEndPoint; } DebugAdvancedRouting($"debug drew {segments.Count} route segment(s) from {source}"); } private static Color GetDebugColorForAction(PathActionType action) { //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_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_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_0063: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_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_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_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_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_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_0082: 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_00b9: Unknown result type (might be due to invalid IL or missing references) switch (action) { case PathActionType.Direct: return Color.green; case PathActionType.SlopeWalk: return Color.cyan; case PathActionType.Detour: return Color.yellow; case PathActionType.JumpGrab: case PathActionType.GapJump: return Color.magenta; case PathActionType.Climb: case PathActionType.WallTraverse: case PathActionType.CornerClimb: case PathActionType.Mantle: return Color.blue; case PathActionType.RopeClimb: case PathActionType.AnchorAssist: return new Color(0.35f, 0.85f, 1f); case PathActionType.DropDown: return Color.red; case PathActionType.WaitForStamina: return Color.white; case PathActionType.Recover: return new Color(1f, 0.55f, 0f); default: return Color.gray; } } private bool IsLimitedStaminaAction(PathPlan plan) { return IsClimbPlan(plan) || plan.Action == PathActionType.GapJump || plan.Action == PathActionType.RopeClimb || plan.Action == PathActionType.AnchorAssist || (plan.Action == PathActionType.DropDown && plan.UsesJumpDropImmunity); } private float GetRouteStaminaBudgetWithSafety(PathPlan plan) { float configuredStaminaSafetyRatio = GetConfiguredStaminaSafetyRatio(); float num = Mathf.Max(EstimatePlanStaminaCost(plan), plan.RequiredStamina); if (IsClimbPlan(plan)) { float num2 = (IsMetadataTimeCriticalClimbPlan(plan) ? GetTimeCriticalClimbStartThreshold(plan) : GetFullStaminaClimbStartThreshold(plan)); num = Mathf.Max(num, num2); } else if (plan.Action == PathActionType.GapJump) { num = Mathf.Max(num, 0.18f + configuredStaminaSafetyRatio * 0.65f); } else if (plan.Action == PathActionType.RopeClimb || plan.Action == PathActionType.AnchorAssist) { num = Mathf.Max(num, 0.3f + configuredStaminaSafetyRatio * 0.8f); } else if (plan.Action == PathActionType.DropDown && plan.UsesJumpDropImmunity) { num = Mathf.Max(num, 0.1f + configuredStaminaSafetyRatio * 0.35f); } return Mathf.Clamp(num + configuredStaminaSafetyRatio * 0.3f, 0.05f, 0.98f); } private List NormalizeSegmentsForStaminaBudget(List source) { //IL_0063: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_0083: 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_00db: 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_0167: 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_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) if (source.Count == 0 || (Object)(object)_character == (Object)null || (Object)(object)_character.data == (Object)null) { return source; } bool flag = IsExplicitStaminaWaitEnabled(); List list = new List(source.Count + 1); float num = GetStamina01(); float recoverableStaminaCeiling = GetRecoverableStaminaCeiling(); Vector3 val = _character.Center; for (int i = 0; i < source.Count; i++) { PathPlan pathPlan = ClonePlan(source[i]); if (!IsPlanStartTransitionReachable(val, pathPlan, out var reason)) { if (IsAdvancedRoutingDebugEnabled()) { DebugAdvancedRouting($"normalized route rejected unreachable segment: action={pathPlan.Action}, reason={reason}, from={val}, goal={pathPlan.Goal}, anchor={pathPlan.Anchor}"); } if (list.Count == 0) { RegisterFailedSegment(pathPlan, reason); } continue; } if (flag && IsLimitedStaminaAction(pathPlan)) { float routeStaminaBudgetWithSafety = GetRouteStaminaBudgetWithSafety(pathPlan); bool flag2 = list.Count == 0; bool flag3 = IsSafeStandingNow(); bool flag4 = !IsClimbPlan(pathPlan) || Vector3.Distance(_character.Center, pathPlan.Anchor) <= 1.6f; if (flag2 && flag3 && flag4 && num + 0.01f < routeStaminaBudgetWithSafety) { list.Add(BuildWaitForStaminaSegment(pathPlan, routeStaminaBudgetWithSafety)); num = recoverableStaminaCeiling; } num = Mathf.Clamp(num - EstimatePlanStaminaCost(pathPlan), 0f, recoverableStaminaCeiling); } else if (pathPlan.Action == PathActionType.Direct || pathPlan.Action == PathActionType.SlopeWalk || pathPlan.Action == PathActionType.Detour || pathPlan.Action == PathActionType.AnchorAssist || (pathPlan.Action == PathActionType.DropDown && !pathPlan.UsesJumpDropImmunity)) { num = recoverableStaminaCeiling; } list.Add(pathPlan); if (pathPlan.Action != PathActionType.WaitForStamina && pathPlan.Action != PathActionType.Hold) { val = GetPlanProjectedEndPoint(pathPlan); } } return list; } private PathPlan BuildWaitForStaminaSegment(PathPlan nextSegment, float requiredStamina) { //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_001c: 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_0021: 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_004d: 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_0052: 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_0088: 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) Vector3 val = ((nextSegment.Anchor != Vector3.zero) ? nextSegment.Anchor : nextSegment.Goal); return new PathPlan { Action = PathActionType.WaitForStamina, Goal = val, Anchor = (((Object)(object)_character != (Object)null) ? _character.Center : val), RequiredStamina = Mathf.Clamp(requiredStamina, 0.05f, 0.98f), TargetAbove = nextSegment.TargetAbove, ProjectedEndPoint = (((Object)(object)_character != (Object)null) ? _character.Center : val), HasProjectedEndPoint = true, EndNodeType = RouteNodeType.Rest, StaminaSafetyReserve = GetConfiguredStaminaSafetyRatio() }; } private bool HasCapsuleClearanceAt(Vector3 groundPoint) { //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_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_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_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_002d: 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) Vector3 val = groundPoint + Vector3.up * 0.52f; Vector3 val2 = groundPoint + Vector3.up * 1.72f; return !Physics.CheckCapsule(val, val2, 0.34f, TerrainMask, (QueryTriggerInteraction)1); } private int CountStandSupportPoints(Vector3 point) { //IL_0011: 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_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_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_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_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_0082: Unknown result type (might be due to invalid IL or missing references) int num = 0; Vector3[] standSupportDirections = StandSupportDirections; RaycastHit val2 = default(RaycastHit); for (int i = 0; i < standSupportDirections.Length; i++) { Vector3 val = point + standSupportDirections[i] * 0.45f; if (Physics.Raycast(val + Vector3.up * 0.65f, Vector3.down, ref val2, 2.05f, TerrainMask, (QueryTriggerInteraction)1)) { float num2 = Mathf.Abs(((RaycastHit)(ref val2)).point.y - point.y); if (num2 <= 1.05f && IsRoughStandableNormal(((RaycastHit)(ref val2)).normal)) { num++; } } } return num; } private bool IsSafeStandableRoutePoint(Vector3 point, Vector3 normal, bool requireSupport) { //IL_0002: 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_002b: Unknown result type (might be due to invalid IL or missing references) if (!IsRoughStandableNormal(normal)) { return false; } if (!HasCapsuleClearanceAt(point)) { return false; } return !requireSupport || CountStandSupportPoints(point) >= 1; } private bool IsClimbableWallNormal(Vector3 normal) { //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) if (((Vector3)(ref normal)).sqrMagnitude < 0.01f) { return false; } float num = Vector3.Angle(normal, Vector3.up); return num >= 38f && num <= 145f; } private bool HasMantleSpaceAt(Vector3 topPoint) { //IL_0002: 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_0020: Unknown result type (might be due to invalid IL or missing references) if (!TryFindGround(topPoint, out var hit)) { return false; } return IsSafeStandableRoutePoint(((RaycastHit)(ref hit)).point, ((RaycastHit)(ref hit)).normal, requireSupport: false); } private bool TryFindWallContinuationPoint(PathPlan climbPlan, float sign, out Vector3 point) { //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_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_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_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_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_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_009b: Unknown result type (might be due to invalid IL or missing references) //IL_00a0: Unknown result type (might be due to invalid IL or missing references) //IL_00a5: Unknown result type (might be due to invalid IL or missing references) //IL_00a7: Unknown result type (might be due to invalid IL or missing references) //IL_00a9: Unknown result type (might be due to invalid IL or missing references) //IL_00af: Unknown result type (might be due to invalid IL or missing references) //IL_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_00bb: 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_00e9: 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_0102: Unknown result type (might be due to invalid IL or missing references) //IL_0123: Unknown result type (might be due to invalid IL or missing references) //IL_0128: Unknown result type (might be due to invalid IL or missing references) //IL_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) point = Vector3.zero; if (climbPlan.ClimbSurfaceNormal == Vector3.zero) { return false; } Vector3 normalized = ((Vector3)(ref climbPlan.ClimbSurfaceNormal)).normalized; Vector3 val = Vector3.Cross(Vector3.up, normalized); if (((Vector3)(ref val)).sqrMagnitude < 0.01f) { return false; } ((Vector3)(ref val)).Normalize(); float[] wallContinuationDistances = WallContinuationDistances; RaycastHit val4 = default(RaycastHit); for (int i = 0; i < wallContinuationDistances.Length; i++) { Vector3 val2 = _character.Center + val * (sign * wallContinuationDistances[i]) + Vector3.up * 0.2f; Vector3 val3 = val2 + normalized * 0.85f; if (Physics.SphereCast(val3, 0.16f, -normalized, ref val4, 1.35f, TerrainMask, (QueryTriggerInteraction)1) && IsClimbableWallNormal(((RaycastHit)(ref val4)).normal)) { float num = Vector3.Angle(normalized, ((RaycastHit)(ref val4)).normal); if (!(num > 115f)) { point = ((RaycastHit)(ref val4)).point + Vector3.up * 0.35f; return true; } } } return false; } private bool TryFindCornerAwareTraversePoint(PathPlan climbPlan, out Vector3 point) { //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_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_003c: 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_0078: 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_008d: 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_010c: 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_014d: 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) point = Vector3.zero; if (climbPlan.ClimbSurfaceNormal == Vector3.zero || (Object)(object)_character == (Object)null) { return false; } Vector3 val = Vector3.Cross(Vector3.up, ((Vector3)(ref climbPlan.ClimbSurfaceNormal)).normalized); if (((Vector3)(ref val)).sqrMagnitude < 0.01f) { return false; } ((Vector3)(ref val)).Normalize(); Vector3 val2 = GetGoalLookPoint() - _character.Center; val2.y = 0f; float num = ((((Vector3)(ref val2)).sqrMagnitude > 0.01f) ? Mathf.Sign(Vector3.Dot(((Vector3)(ref val2)).normalized, val)) : 1f); if (Mathf.Approximately(num, 0f)) { num = 1f; } bool flag = false; float num2 = float.NegativeInfinity; for (int i = 0; i < 2; i++) { float sign = ((i == 0) ? num : (0f - num)); if (TryFindWallContinuationPoint(climbPlan, sign, out var point2)) { float num3 = 0f - Vector3.Distance(point2, GetGoalLookPoint()); if (i == 0) { num3 += 0.45f; } if (!flag || num3 > num2) { flag = true; num2 = num3; point = point2; } } } return flag; } private RouteFailureReason DetermineRouteFailureReason(PathPlan segment, RouteFailureReason fallback) { //IL_028a: Unknown result type (might be due to invalid IL or missing references) //IL_028f: 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_02a4: 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_0103: 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_02a9: 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_02ab: 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_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_02d8: 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_02e7: 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_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_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_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_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_0245: 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) //IL_024e: 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_026c: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)_character == (Object)null || (Object)(object)_character.data == (Object)null) { return fallback; } if (GetStamina01() <= 0.08f && IsLimitedStaminaAction(segment)) { return RouteFailureReason.StaminaTooLow; } if ((segment.Action == PathActionType.RopeClimb || segment.Action == PathActionType.AnchorAssist || segment.UsesRouteAssist) && Time.time - _segmentStartTime >= 3f && !_character.data.isClimbing && !_character.data.isRopeClimbing && !_character.data.isVineClimbing) { return RouteFailureReason.RouteAssistFailed; } if (IsClimbPlan(segment)) { float num = ((segment.Anchor != Vector3.zero) ? Vector3.Distance(_character.Center, segment.Anchor) : 999f); bool flag = num <= 1.9000001f; bool flag2 = _character.data.isClimbing || _character.data.isRopeClimbing || _character.data.isVineClimbing; if (!flag2 && flag && Time.time - _segmentStartTime >= 1.15f) { if (segment.Action == PathActionType.Mantle) { return RouteFailureReason.MantleFailed; } if (segment.Action == PathActionType.JumpGrab || segment.NeedsJumpStart) { return RouteFailureReason.JumpGrabFailed; } if (segment.Action == PathActionType.RopeClimb || segment.UsesRouteAssist) { return RouteFailureReason.RouteAssistFailed; } return RouteFailureReason.WallLost; } if (flag2 && segment.ClimbSurfaceNormal != Vector3.zero) { Vector3 normalized = ((Vector3)(ref segment.ClimbSurfaceNormal)).normalized; Vector3 val = _character.Center + Vector3.up * 0.25f + normalized * 0.75f; RaycastHit val2 = default(RaycastHit); if (!Physics.SphereCast(val, 0.16f, -normalized, ref val2, 1.25f, TerrainMask, (QueryTriggerInteraction)1) || !IsClimbableWallNormal(((RaycastHit)(ref val2)).normal)) { return RouteFailureReason.WallLost; } } } Vector3 val3 = ((segment.Anchor != Vector3.zero) ? segment.Anchor : segment.Goal); if (val3 != Vector3.zero && IsRoughTerrainLineBlocked(_character.Center + Vector3.up * 0.1f, val3 + Vector3.up * 0.1f)) { return RouteFailureReason.PathBlocked; } return fallback; } private bool TryBuildRecoveryPlan(out PathPlan plan) { //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_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_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_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_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_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) //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_0289: 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_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_029f: Unknown result type (might be due to invalid IL or missing references) //IL_02a5: Unknown result type (might be due to invalid IL or missing references) //IL_02a7: Unknown result type (might be due to invalid IL or missing references) //IL_02c6: 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_00e9: 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_00f0: Unknown result type (might be due to invalid IL or missing references) //IL_00f5: Unknown result type (might be due to invalid IL or missing references) //IL_00fa: Unknown result type (might be due to invalid IL or missing references) //IL_00fd: 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_011f: 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_014e: 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_0185: 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_0190: Unknown result type (might be due to invalid IL or missing references) //IL_0195: Unknown result type (might be due to invalid IL or missing references) //IL_019c: Unknown result type (might be due to invalid IL or missing references) //IL_01a1: Unknown result type (might be due to invalid IL or missing references) //IL_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_01c6: Unknown result type (might be due to invalid IL or missing references) //IL_01f4: 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_0238: Unknown result type (might be due to invalid IL or missing references) plan = new PathPlan(); if ((Object)(object)_character == (Object)null) { return false; } Vector3 center = _character.Center; Vector3 val = center - GetGoalCenter(); val.y = 0f; if (((Vector3)(ref val)).sqrMagnitude < 0.01f) { val = -((Component)_character).transform.forward; val.y = 0f; } if (((Vector3)(ref val)).sqrMagnitude < 0.01f) { val = Vector3.back; } ((Vector3)(ref val)).Normalize(); float[] recoverySearchAngles = RecoverySearchAngles; float[] recoverySearchDistances = RecoverySearchDistances; bool flag = false; float num = float.NegativeInfinity; Vector3 val2 = Vector3.zero; for (int i = 0; i < recoverySearchAngles.Length; i++) { Vector3 val3 = Quaternion.AngleAxis(recoverySearchAngles[i], Vector3.up) * val; for (int j = 0; j < recoverySearchDistances.Length; j++) { Vector3 point = center + val3 * recoverySearchDistances[j]; if (!TryFindGround(point, out var hit) || !IsSafeStandableRoutePoint(((RaycastHit)(ref hit)).point, ((RaycastHit)(ref hit)).normal, requireSupport: false)) { continue; } float num2 = ((RaycastHit)(ref hit)).point.y - center.y; float num3 = center.y - ((RaycastHit)(ref hit)).point.y; if (!(num2 > 0.85f) && !(num3 > 10f) && !IsRoughTerrainLineBlocked(center + Vector3.up * 0.1f, ((RaycastHit)(ref hit)).point + Vector3.up * 0.1f)) { float blockedPenalty = GetBlockedPenalty(((RaycastHit)(ref hit)).point); float num4 = recoverySearchDistances[j] * 0.45f - Mathf.Abs(recoverySearchAngles[i]) * 0.006f - blockedPenalty; if (CountStandSupportPoints(((RaycastHit)(ref hit)).point) >= 2) { num4 += 0.55f; } if (!flag || num4 > num) { flag = true; num = num4; val2 = ((RaycastHit)(ref hit)).point; } } } } if (!flag) { return false; } plan = new PathPlan { Action = PathActionType.Recover, Goal = val2 + Vector3.up * 0.15f, Anchor = val2, RequiredStamina = 0f, TargetAbove = false, ReachableWithinRecoverableBudget = true, ProjectedEndPoint = val2, HasProjectedEndPoint = true, StartNodeType = RouteNodeType.Hazard, EndNodeType = RouteNodeType.Rest, Score = num }; return true; } private bool TryBuildReverseAccessPath(Vector3 start, Vector3 goal, out List segments) { //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_0045: Unknown result type (might be due to invalid IL or missing references) //IL_0046: Unknown result type (might be due to invalid IL or missing references) //IL_0047: Unknown result type (might be due to invalid IL or missing references) //IL_004c: 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_0067: 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_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_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) //IL_00eb: 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_00f2: Unknown result type (might be due to invalid IL or missing references) //IL_00f7: Unknown result type (might be due to invalid IL or missing references) //IL_00fc: Unknown result type (might be due to invalid IL or missing references) //IL_00fe: Unknown result type (might be due to invalid IL or missing references) //IL_0100: Unknown result type (might be due to invalid IL or missing references) //IL_010a: Unknown result type (might be due to invalid IL or missing references) //IL_010f: Unknown result type (might be due to invalid IL or missing references) //IL_0114: Unknown result type (might be due to invalid IL or missing references) //IL_013d: 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_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_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_017a: 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_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_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_01b8: 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_01e5: Unknown result type (might be due to invalid IL or missing references) //IL_0201: Unknown result type (might be due to invalid IL or missing references) //IL_020d: Unknown result type (might be due to invalid IL or missing references) //IL_0251: Unknown result type (might be due to invalid IL or missing references) //IL_0258: 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_0262: 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) //IL_02ba: 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_02c4: 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_02d5: 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_02de: 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_0285: Unknown result type (might be due to invalid IL or missing references) //IL_0287: Unknown result type (might be due to invalid IL or missing references) //IL_028c: Unknown result type (might be due to invalid IL or missing references) //IL_0309: Unknown result type (might be due to invalid IL or missing references) //IL_0325: 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_0348: 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_0367: 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_0470: 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_03a7: Unknown result type (might be due to invalid IL or missing references) //IL_03cd: 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_03dc: Unknown result type (might be due to invalid IL or missing references) //IL_03e1: 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_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_0401: 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_0422: Unknown result type (might be due to invalid IL or missing references) //IL_0427: Unknown result type (might be due to invalid IL or missing references) //IL_04cf: Unknown result type (might be due to invalid IL or missing references) //IL_04d4: Unknown result type (might be due to invalid IL or missing references) //IL_04de: Unknown result type (might be due to invalid IL or missing references) //IL_04e3: Unknown result type (might be due to invalid IL or missing references) //IL_04e8: Unknown result type (might be due to invalid IL or missing references) //IL_04f0: Unknown result type (might be due to invalid IL or missing references) //IL_04f5: Unknown result type (might be due to invalid IL or missing references) //IL_0535: Unknown result type (might be due to invalid IL or missing references) //IL_053a: 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_054b: Unknown result type (might be due to invalid IL or missing references) //IL_0550: Unknown result type (might be due to invalid IL or missing references) //IL_0558: Unknown result type (might be due to invalid IL or missing references) //IL_055d: 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_0571: 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_0585: Unknown result type (might be due to invalid IL or missing references) //IL_058d: 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_05f7: Unknown result type (might be due to invalid IL or missing references) //IL_05fa: Unknown result type (might be due to invalid IL or missing references) //IL_0611: Unknown result type (might be due to invalid IL or missing references) //IL_0616: Unknown result type (might be due to invalid IL or missing references) //IL_0644: Unknown result type (might be due to invalid IL or missing references) segments = new List(); if (!IsReverseRouteSearchEnabled()) { return false; } float num = goal.y - start.y; if (num < 1.8499999f) { return false; } Vector3 val = goal - start; val.y = 0f; Vector3 val2 = ((((Vector3)(ref val)).sqrMagnitude > 0.01f) ? ((Vector3)(ref val)).normalized : Vector3.forward); float[] reverseAccessRadii = ReverseAccessRadii; float[] reverseAccessAngles = ReverseAccessAngles; bool flag = false; float num2 = float.NegativeInfinity; List list = new List(); RaycastHit val5 = default(RaycastHit); RaycastHit val7 = default(RaycastHit); RaycastHit val10 = default(RaycastHit); for (int i = 0; i < reverseAccessRadii.Length; i++) { for (int j = 0; j < reverseAccessAngles.Length; j++) { Vector3 val3 = Quaternion.AngleAxis(reverseAccessAngles[j], Vector3.up) * val2; val3.y = 0f; if (((Vector3)(ref val3)).sqrMagnitude < 0.01f) { continue; } ((Vector3)(ref val3)).Normalize(); Vector3 val4 = goal + val3 * reverseAccessRadii[i]; if (!Physics.Raycast(val4 + Vector3.up * 2.4f, Vector3.down, ref val5, 5.5f, TerrainMask, (QueryTriggerInteraction)1) || !IsSafeStandableRoutePoint(((RaycastHit)(ref val5)).point, ((RaycastHit)(ref val5)).normal, requireSupport: false)) { continue; } Vector3 val6 = ((RaycastHit)(ref val5)).point + val3 * 1.15f; float num3 = Mathf.Clamp(((RaycastHit)(ref val5)).point.y - start.y + 3.5f, 4f, 12f); if (!Physics.Raycast(val6 + Vector3.up * 1.2f, Vector3.down, ref val7, num3, TerrainMask, (QueryTriggerInteraction)1) || !IsSafeStandableRoutePoint(((RaycastHit)(ref val7)).point, ((RaycastHit)(ref val7)).normal, requireSupport: false)) { continue; } float num4 = ((RaycastHit)(ref val5)).point.y - ((RaycastHit)(ref val7)).point.y; if (num4 < 0.75f || num4 > EstimateMaxReachableClimbHeight(targetAbove: true, num4 >= 1f) + 0.25f) { continue; } Vector3 val8 = ((RaycastHit)(ref val5)).point - ((RaycastHit)(ref val7)).point; val8.y = 0f; if (((Vector3)(ref val8)).sqrMagnitude < 0.01f) { val8 = -val3; } ((Vector3)(ref val8)).Normalize(); Vector3 val9 = ((RaycastHit)(ref val7)).point + Vector3.up * Mathf.Clamp(num4 * 0.45f, 0.9f, 2.4f) + val8 * 0.75f; if (!Physics.SphereCast(val9, 0.18f, -val8, ref val10, 1.45f, TerrainMask, (QueryTriggerInteraction)1) || !IsClimbableWallNormal(((RaycastHit)(ref val10)).normal) || !HasMantleSpaceAt(((RaycastHit)(ref val5)).point)) { continue; } List list2 = new List(); if (Vector3.Distance(start, ((RaycastHit)(ref val7)).point) > 1.25f) { if (TryCreateSpatialGroundMovePlan(start, ((RaycastHit)(ref val7)).point, targetAbove: true, out PathPlan plan)) { plan.WasBuiltByReverseSearch = true; plan.WasBuiltBySpatialPlanner = true; plan.EndNodeType = RouteNodeType.Stand; list2.Add(plan); } else { if (IsRoughTerrainLineBlocked(start, ((RaycastHit)(ref val7)).point)) { continue; } PathPlan item = new PathPlan { Action = PathActionType.Direct, Goal = ((RaycastHit)(ref val7)).point + Vector3.up * 0.15f, Anchor = ((RaycastHit)(ref val7)).point, TargetAbove = true, RequiredStamina = EstimateGroundChaseCost(Vector3.Distance(start, ((RaycastHit)(ref val7)).point)), ReachableWithinRecoverableBudget = true, ProjectedEndPoint = ((RaycastHit)(ref val7)).point, HasProjectedEndPoint = true, WasBuiltByReverseSearch = true, WasBuiltBySpatialPlanner = true, EndNodeType = RouteNodeType.Stand }; list2.Add(item); } } bool flag2 = num4 >= 1f || HelperFunctions.FlatDistance(((RaycastHit)(ref val7)).point, ((RaycastHit)(ref val5)).point) > 1.25f; float num5 = EstimateRequiredClimbStamina(num4, targetAbove: true, num4 >= 2.15f); if (num5 > GetRecoverableStaminaCeiling() + 0.02f) { continue; } PathPlan obj = new PathPlan { Action = (flag2 ? PathActionType.JumpGrab : PathActionType.Climb), Goal = ((RaycastHit)(ref val5)).point + Vector3.up * 0.2f, Anchor = ((RaycastHit)(ref val7)).point, TargetAbove = true, EstimatedClimbHeight = num4, IsTallWall = (num4 >= 2.15f), RequiredStamina = num5, ReachableWithinRecoverableBudget = true, NeedsJumpStart = flag2, ClimbTopPoint = ((RaycastHit)(ref val5)).point }; Vector3 normal = ((RaycastHit)(ref val10)).normal; obj.ClimbSurfaceNormal = ((Vector3)(ref normal)).normalized; obj.ProjectedEndPoint = ((RaycastHit)(ref val5)).point; obj.HasProjectedEndPoint = true; obj.JumpGrabAimPoint = ((RaycastHit)(ref val5)).point + Vector3.up * 0.15f; obj.JumpGrabHorizontalDistance = HelperFunctions.FlatDistance(((RaycastHit)(ref val7)).point, ((RaycastHit)(ref val5)).point); obj.WasBuiltBySpatialPlanner = true; obj.WasBuiltByReverseSearch = true; obj.StartNodeType = RouteNodeType.Wall; obj.EndNodeType = RouteNodeType.Ledge; obj.StaminaSafetyReserve = GetConfiguredStaminaSafetyRatio(); PathPlan pathPlan = obj; if (IsSpatialClimbPlanViable(pathPlan)) { list2.Add(pathPlan); float num6 = 0f; num6 -= Vector3.Distance(start, ((RaycastHit)(ref val7)).point) * 0.45f; num6 -= Vector3.Distance(((RaycastHit)(ref val5)).point, goal) * 1.35f; num6 += num4 * 0.65f; num6 -= GetFailedSegmentPenalty(pathPlan); num6 -= GetBlockedPenalty(((RaycastHit)(ref val7)).point); if (!flag || num6 > num2) { flag = true; num2 = num6; list = list2; } } } } if (!flag || list.Count == 0) { return false; } int num7 = Mathf.Min(3, list.Count); for (int k = 0; k < num7; k++) { segments.Add(ClonePlan(list[k])); } if (IsAdvancedRoutingDebugEnabled()) { DebugAdvancedRouting($"reverse access selected {segments.Count} segment(s), score={num2:0.00}"); } return true; } public bool ToggleBackpackCommand(float searchRadius, out string message) { //IL_00c7: 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_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) message = string.Empty; if (!_initialized || (Object)(object)_character == (Object)null || (Object)(object)_view == (Object)null) { message = "Controlled robot is not ready."; return false; } if (!_view.IsMine) { message = "Nearest controlled robot is not owned by this client, so it cannot be commanded to use backpacks."; return false; } if ((Object)(object)_character.data == (Object)null || _character.data.dead) { message = "Controlled robot is dead."; return false; } RobotBackpackAttachment robotBackpackAttachment = RobotBackpackAttachment.FindAttachedTo(_character); if ((Object)(object)robotBackpackAttachment != (Object)null) { CancelBackpackCommand(stopReach: true); robotBackpackAttachment.DetachNetworked(GetBackpackDropPosition(_character)); message = "Controlled robot dropped its backpack."; return true; } if (_backpackCommandActive) { CancelBackpackCommand(stopReach: true); message = "Controlled robot backpack pickup cancelled."; return true; } Backpack val = FindNearestGroundBackpack(_character.Center, searchRadius, _character); if ((Object)(object)val == (Object)null) { message = $"No wearable backpack found within {searchRadius:0.#}m of the nearest controlled robot."; return false; } StartBackpackPickup(val); message = $"Controlled robot is walking to a backpack ({Vector3.Distance(_character.Center, ((Item)val).Center()):0.#}m)."; return true; } private void UpdateBackpackCommandGoal() { //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_0128: Unknown result type (might be due to invalid IL or missing references) if (!_backpackCommandActive) { return; } if ((Object)(object)_character == (Object)null || (Object)(object)_character.data == (Object)null || _character.data.dead) { CancelBackpackCommand(stopReach: true); return; } if ((Object)(object)RobotBackpackAttachment.FindAttachedTo(_character) != (Object)null) { CancelBackpackCommand(stopReach: true); return; } Backpack backpackTarget = _backpackTarget; if (!IsUsableGroundBackpack(backpackTarget, _character)) { CancelBackpackCommand(stopReach: true); return; } if (Time.time - _backpackCommandStartTime > 20f) { CancelBackpackCommand(stopReach: true); return; } Character backpackCommandTarget = GetBackpackCommandTarget(); if ((Object)(object)backpackCommandTarget == (Object)null) { CancelBackpackCommand(stopReach: true); return; } Vector3 backpackApproachPoint = GetBackpackApproachPoint(backpackTarget, _character); if (Time.time >= _backpackNextGoalRefreshTime) { _backpackNextGoalRefreshTime = Time.time + 0.15f; SetCommandGoal(backpackCommandTarget, backpackApproachPoint); _brainState = RobotBrainState.Chase; } if (CanReachBackpack(backpackTarget, _character)) { TickBackpackPickupReach(backpackTarget); } } private void StartBackpackPickup(Backpack backpack) { //IL_00ce: Unknown result type (might be due to invalid IL or missing references) _backpackTarget = backpack; _backpackCommandActive = true; _backpackPickupReachStarted = false; _backpackPickupInteractionSent = false; _backpackPickupReachStopped = false; _backpackNextGoalRefreshTime = 0f; _backpackReachStartTime = 0f; _backpackReachStopTime = 0f; _backpackAttachTime = 0f; _backpackCommandStartTime = Time.time; _manualBiteActive = false; _manualBiteTarget = null; _vanillaBiteControlActive = false; _vanillaBiteTarget = null; _carryAssistEnabled = false; _carryTarget = null; _nextCarryRetargetTime = 0f; StopClimb(); ClearGoalParking(); ClearLockedClimbPlan(); _segmentQueue.Clear(); ClearActiveSegment(); ClearGuidePlannerCaches(); ResetInput(); ResetRouteForNewGoal(GetBackpackApproachPoint(backpack, _character)); } private void TickBackpackPickupReach(Backpack backpack) { //IL_0019: Unknown result type (might be due to invalid IL or missing references) StopClimb(); ResetInput(); SetSprint(sprinting: false); LookAt(((Item)backpack).Center()); if (!_backpackPickupReachStarted) { _backpackPickupReachStarted = true; _backpackPickupReachStopped = false; _backpackReachStartTime = Time.time; _backpackReachStopTime = Time.time + 0.9f; _backpackAttachTime = 0f; StartReachAnimation(); } else if (!_backpackPickupReachStopped) { HoldReachInput(); if (!(Time.time - _backpackReachStartTime < 0.65f) && !(Time.time < _backpackReachStopTime)) { _backpackPickupReachStopped = true; _backpackAttachTime = Time.time + 0.3f; StopReachAnimation(); } } else { ClearReachInput(); if (!_backpackPickupInteractionSent && Time.time >= _backpackAttachTime) { _backpackPickupInteractionSent = true; PickupBackpack(backpack); } } } private void PickupBackpack(Backpack backpack) { try { if (IsUsableGroundBackpack(backpack, _character) && (Object)(object)RobotBackpackAttachment.FindAttachedTo(_character) == (Object)null) { RobotBackpackAttachment.Ensure(backpack).AttachNetworked(_character); } } catch (Exception arg) { Plugin.Log.LogDebug((object)$"PickupBackpack failed: {arg}"); } finally { CancelBackpackCommand(stopReach: true); } } private void CancelBackpackCommand(bool stopReach) { _backpackTarget = null; _backpackCommandActive = false; _backpackPickupReachStarted = false; _backpackPickupInteractionSent = false; _backpackPickupReachStopped = false; _backpackNextGoalRefreshTime = 0f; _backpackReachStartTime = 0f; _backpackReachStopTime = 0f; _backpackAttachTime = 0f; if (stopReach) { StopReachAnimation(); } } private bool ShouldHoldBackpackCommandTarget() { return _backpackCommandActive; } private static Backpack? FindNearestGroundBackpack(Vector3 origin, float radius, Character robot) { //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_003a: Unknown result type (might be due to invalid IL or missing references) Backpack result = null; float num = radius * radius; Backpack[] array = Object.FindObjectsByType((FindObjectsInactive)0, (FindObjectsSortMode)1); foreach (Backpack val in array) { if (IsUsableGroundBackpack(val, robot)) { Vector3 val2 = ((Item)val).Center() - origin; float sqrMagnitude = ((Vector3)(ref val2)).sqrMagnitude; if (!(sqrMagnitude > num)) { num = sqrMagnitude; result = val; } } } return result; } private static bool IsUsableGroundBackpack(Backpack? backpack, Character robot) { //IL_0038: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)backpack == (Object)null || (Object)(object)robot == (Object)null || !((Behaviour)backpack).isActiveAndEnabled) { return false; } if (RobotBackpackAttachment.IsAttached(backpack)) { return false; } return (int)((Item)backpack).itemState == 0 && ((Item)backpack).IsInteractible(robot); } private static Vector3 GetBackpackApproachPoint(Backpack backpack, Character robot) { //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_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_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_006c: 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_0079: Unknown result type (might be due to invalid IL or missing references) //IL_007e: Unknown result type (might be due to invalid IL or missing references) //IL_0083: 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_0087: Unknown result type (might be due to invalid IL or missing references) Vector3 val = ((Item)backpack).Center(); Vector3 val2 = robot.Center - val; val2.y = 0f; if (((Vector3)(ref val2)).sqrMagnitude < 0.01f) { val2 = -((Component)backpack).transform.forward; val2.y = 0f; } if (((Vector3)(ref val2)).sqrMagnitude < 0.01f) { val2 = Vector3.forward; } return val + ((Vector3)(ref val2)).normalized * 0.55f; } private static bool CanReachBackpack(Backpack backpack, Character robot) { //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_0014: 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_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_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) float num = HelperFunctions.FlatDistance(robot.Center, ((Item)backpack).Center()); float num2 = Mathf.Abs(((Item)backpack).Center().y - robot.Center.y); if (num > 1.35f || num2 > 1.6f) { return false; } RaycastHit val = HelperFunctions.LineCheck(robot.Head, ((Item)backpack).Center(), (LayerType)1, 0f, (QueryTriggerInteraction)1); return (Object)(object)((RaycastHit)(ref val)).transform == (Object)null; } private Character? GetBackpackCommandTarget() { Character localCharacter = Character.localCharacter; if (IsValidBackpackCommandTarget(localCharacter)) { return localCharacter; } foreach (Character allCharacter in Character.AllCharacters) { if (IsValidBackpackCommandTarget(allCharacter)) { return allCharacter; } } return null; } private static bool IsValidBackpackCommandTarget(Character? candidate) { return (Object)(object)candidate != (Object)null && (Object)(object)candidate.data != (Object)null && !candidate.isBot && !candidate.data.dead && !candidate.data.fullyPassedOut; } private void HoldReachInput() { try { if (!((Object)(object)_character == (Object)null) && !((Object)(object)_character.input == (Object)null) && !((Object)(object)_character.data == (Object)null)) { _character.input.useSecondaryIsPressed = true; _character.input.useSecondaryWasPressed = true; _character.input.useSecondaryWasReleased = false; _character.data.sincePressReach = 0f; } } catch (Exception arg) { Plugin.Log.LogDebug((object)$"HoldReachInput failed: {arg}"); } } private void ClearReachInput() { try { if (!((Object)(object)_character == (Object)null) && !((Object)(object)_character.input == (Object)null)) { _character.input.useSecondaryIsPressed = false; _character.input.useSecondaryWasPressed = false; _character.input.useSecondaryWasReleased = true; if ((Object)(object)_character.data != (Object)null) { _character.data.sincePressReach = 10f; } } } catch (Exception arg) { Plugin.Log.LogDebug((object)$"ClearReachInput failed: {arg}"); } } private void StartReachAnimation() { HoldReachInput(); try { if ((Object)(object)_character != (Object)null && _character.refs != null && (Object)(object)_character.refs.view != (Object)null) { _character.refs.view.RPC("RPCA_StartReaching", (RpcTarget)0, Array.Empty()); } } catch (Exception arg) { Plugin.Log.LogDebug((object)$"StartReachAnimation failed: {arg}"); } } private void StopReachAnimation() { ClearReachInput(); try { if ((Object)(object)_character != (Object)null && (Object)(object)_character.data != (Object)null) { _character.data.isReaching = false; } if ((Object)(object)_character != (Object)null && _character.refs != null && (Object)(object)_character.refs.view != (Object)null) { _character.refs.view.RPC("RPCA_StopReaching", (RpcTarget)0, Array.Empty()); } } catch (Exception arg) { Plugin.Log.LogDebug((object)$"StopReachAnimation failed: {arg}"); } } private static Vector3 GetBackpackDropPosition(Character character) { //IL_00bb: 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_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_0025: Unknown result type (might be due to invalid IL or missing references) //IL_0026: Unknown result type (might be due to invalid IL or missing references) //IL_00ea: 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_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_0105: 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_0119: 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_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_0044: Unknown result type (might be due to invalid IL or missing references) //IL_011d: Unknown result type (might be due to invalid IL or missing references) //IL_007a: Unknown result type (might be due to invalid IL or missing references) //IL_0081: Unknown result type (might be due to invalid IL or missing references) //IL_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_0095: 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_00a9: 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) try { Bodypart bodypart = character.GetBodypart((BodypartType)0); if ((Object)(object)bodypart != (Object)null) { Vector3 val = ((Component)bodypart).transform.forward; if (Vector3.Dot(val, Vector3.up) < 0f) { val = -val; } val.y = 0f; if (((Vector3)(ref val)).sqrMagnitude < 0.001f) { val = ((Component)character).transform.forward; } return ((Component)bodypart).transform.position + ((Vector3)(ref val)).normalized * 0.75f + Vector3.up * 0.2f; } } catch { } Vector3 forward = ((Component)character).transform.forward; forward.y = 0f; if (((Vector3)(ref forward)).sqrMagnitude < 0.001f) { forward = Vector3.forward; } return character.Center + ((Vector3)(ref forward)).normalized * 0.75f + Vector3.up * 0.2f; } private bool TryBuildJumpGrabPlanFrom(Vector3 startPos, Vector3 toTargetDir, bool targetAbove, out PathPlan plan) { //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_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_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_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_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) //IL_00b4: 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_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) //IL_00c6: 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_00ea: 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_0136: 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_014f: 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_0170: 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_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_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_018c: Unknown result type (might be due to invalid IL or missing references) //IL_0191: Unknown result type (might be due to invalid IL or missing references) //IL_0196: Unknown result type (might be due to invalid IL or missing references) //IL_0198: 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_01c2: 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_01f9: 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_0213: Unknown result type (might be due to invalid IL or missing references) //IL_0223: Unknown result type (might be due to invalid IL or missing references) //IL_0228: Unknown result type (might be due to invalid IL or missing references) //IL_022d: Unknown result type (might be due to invalid IL or missing references) //IL_022f: 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_0240: 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_024a: 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_026a: 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_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_02f5: 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_0303: 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_02a1: 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_02c3: 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_0386: Unknown result type (might be due to invalid IL or missing references) //IL_0387: 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_039b: 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_03a8: 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_03bc: Unknown result type (might be due to invalid IL or missing references) //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_0449: 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_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_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_047f: Unknown result type (might be due to invalid IL or missing references) //IL_046b: 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_0484: Unknown result type (might be due to invalid IL or missing references) //IL_04d1: Unknown result type (might be due to invalid IL or missing references) plan = new PathPlan(); if (!HasActiveGoal()) { return false; } Vector3 goalCenter = GetGoalCenter(); float num = HelperFunctions.FlatDistance(startPos, goalCenter); float num2 = goalCenter.y - startPos.y; if (num2 < 0.45f && num < 2.2f) { return false; } float[] jumpGrabAngleSamples = JumpGrabAngleSamples; float[] jumpGrabLaunchSamples = JumpGrabLaunchSamples; float[] jumpGrabWallSamples = JumpGrabWallSamples; bool flag = false; float num3 = float.NegativeInfinity; PathPlan pathPlan = new PathPlan(); RaycastHit val2 = default(RaycastHit); RaycastHit val5 = default(RaycastHit); for (int i = 0; i < jumpGrabAngleSamples.Length; i++) { Vector3 val = Quaternion.AngleAxis(jumpGrabAngleSamples[i], Vector3.up) * toTargetDir; foreach (float num4 in jumpGrabLaunchSamples) { Vector3 point = startPos + val * num4; if (!TryFindGround(point, out var hit)) { continue; } float num5 = Mathf.Abs(((RaycastHit)(ref hit)).point.y - startPos.y); if (num5 > 1.15f) { continue; } foreach (float num6 in jumpGrabWallSamples) { if (num6 < num4 + 0.25f || !Physics.SphereCast(startPos + Vector3.up * 1.15f, 0.2f, val, ref val2, num6, TerrainMask, (QueryTriggerInteraction)1)) { continue; } Vector3 val3 = startPos + val * num6; Vector3 val4 = val3 + Vector3.up * 5.8f; if (!Physics.Raycast(val4, Vector3.down, ref val5, 6.8f, TerrainMask, (QueryTriggerInteraction)1)) { continue; } float num7 = ((RaycastHit)(ref val5)).point.y - startPos.y; if (num7 < 0.75f || num7 > 4.6f || !IsRoughClimbTopNormal(((RaycastHit)(ref val5)).normal)) { continue; } Vector3 point2 = startPos + val * Mathf.Lerp(num4, num6, 0.35f); Vector3 point3 = startPos + val * Mathf.Lerp(num4, num6, 0.6f); bool flag2 = false; if (!TryFindGround(point2, out var hit2)) { flag2 = true; } else { float num8 = startPos.y - ((RaycastHit)(ref hit2)).point.y; if (num8 > 10f) { flag2 = true; } } if (!flag2) { if (!TryFindGround(point3, out var hit3)) { flag2 = true; } else { float num9 = startPos.y - ((RaycastHit)(ref hit3)).point.y; if (num9 > 10f) { flag2 = true; } } } float num10 = HelperFunctions.FlatDistance(((RaycastHit)(ref val5)).point, goalCenter); float num11 = HelperFunctions.FlatDistance(startPos, goalCenter) - num10; float num12 = Mathf.Abs(((RaycastHit)(ref val5)).point.y - goalCenter.y); bool flag3 = num10 <= 1.45f && num12 <= 1.9f; if ((flag3 || !(num11 < 0.55f)) && (flag2 || targetAbove || flag3)) { PathPlan obj = new PathPlan { Action = PathActionType.JumpGrab, Anchor = ((RaycastHit)(ref hit)).point, Goal = goalCenter + Vector3.up * 0.15f, JumpGrabAimPoint = ((RaycastHit)(ref val2)).point + Vector3.up * 0.25f, JumpGrabHorizontalDistance = num6, TargetAbove = true, EstimatedClimbHeight = num7, IsTallWall = (num7 >= 2.15f), RequiredStamina = EstimateRequiredClimbStamina(num7, targetAbove: true, num7 >= 2.15f), ReachableWithinRecoverableBudget = (EstimateRequiredClimbStamina(num7, targetAbove: true, num7 >= 2.15f) <= GetRecoverableStaminaCeiling()), NeedsJumpStart = true, ProjectedEndPoint = ((RaycastHit)(ref val5)).point, HasProjectedEndPoint = true, ClimbTopPoint = ((RaycastHit)(ref val5)).point }; Vector3 normal = ((RaycastHit)(ref val2)).normal; Vector3 climbSurfaceNormal; if (!(((Vector3)(ref normal)).sqrMagnitude > 0.01f)) { climbSurfaceNormal = -val; } else { normal = ((RaycastHit)(ref val2)).normal; climbSurfaceNormal = ((Vector3)(ref normal)).normalized; } obj.ClimbSurfaceNormal = climbSurfaceNormal; PathPlan pathPlan2 = obj; float num13 = (pathPlan2.Score = num11 * 2.4f + (flag3 ? 3.2f : 0f) + (flag2 ? 1.2f : 0f) - Mathf.Abs(jumpGrabAngleSamples[i]) * 0.025f - num6 * 0.06f - GetBlockedPenalty(((RaycastHit)(ref hit)).point) - GetFailedSegmentPenalty(pathPlan2)); if (!flag || num13 > num3) { flag = true; num3 = num13; pathPlan = pathPlan2; } } } } } if (flag) { plan = pathPlan; return true; } return false; } private bool IsNearClimbAnchor(PathPlan plan) { //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) if (!IsClimbPlan(plan)) { return false; } return Vector3.Distance(_character.Center, plan.Anchor) <= 1.35f; } public void Tick() { //IL_008d: Unknown result type (might be due to invalid IL or missing references) //IL_0093: Invalid comparison between Unknown and I4 if (!_initialized || (Object)(object)_zombie == (Object)null || (Object)(object)_character == (Object)null || (Object)(object)_character.data == (Object)null || (Object)(object)_view == (Object)null) { return; } UpdateInteractionState(); if (!_view.IsMine) { TickRemoteVisualOnly(); return; } KeepRobotPersistent(); if (_brainState == RobotBrainState.Dead || (int)_zombie.currentState == 6) { _brainState = RobotBrainState.Dead; _zombie.currentState = (State)6; return; } if (suppressRobotAI) { TickSuppressedByInteraction(); SyncVisualState(); return; } ResetInput(); UpdateCommandStateBeforePlanning(); if (!ShouldHoldCommandTarget()) { RefreshTargetIfNeeded(); } RefreshResolvedGoalIfNeeded(); ValidateTarget(); DecayBlockedMemory(); UpdateStuckDetection(); UpdateClimbFailureDetection(); if (TryUpdateGoalParkingAndMaybeHold()) { LogBrainStateIfChanged(); SyncVisualState(); return; } if (!HasActiveGoal()) { _brainState = RobotBrainState.Idle; } else if (!IsFollowingRoute() && HasArrivedAtGoal()) { _brainState = RobotBrainState.Idle; } switch (_brainState) { case RobotBrainState.Idle: TickIdle(); break; case RobotBrainState.Parked: TickParkedAtGoal(); break; case RobotBrainState.Chase: TickChase(); break; case RobotBrainState.PrepareTallClimb: TickPrepareTallClimb(); break; case RobotBrainState.Reposition: TickReposition(); break; case RobotBrainState.Lunge: TickLunge(); break; case RobotBrainState.LungeRecovery: TickLungeRecovery(); break; case RobotBrainState.Dead: _zombie.currentState = (State)6; break; } LogBrainStateIfChanged(); SyncVisualState(); } private void TickRemoteVisualOnly() { //IL_0031: Unknown result type (might be due to invalid IL or missing references) //IL_0037: Invalid comparison between Unknown and I4 //IL_003f: Unknown result type (might be due to invalid IL or missing references) //IL_0045: Invalid comparison between Unknown and I4 //IL_0067: Unknown result type (might be due to invalid IL or missing references) //IL_006d: Invalid comparison between Unknown and I4 //IL_0079: 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_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) if (suppressRobotAI) { _zombie.currentState = (State)2; _character.data.passedOut = false; } if ((int)_zombie.currentState == 6 || (int)_zombie.currentState == 0) { _character.data.passedOut = true; } bool flag = (int)_zombie.currentState == 4; bool flag2 = !_hasVisualStateSnapshot || _lastVisualZombieState != _zombie.currentState || _lastVisualBiteColliderEnabled != flag; if (flag2) { _zombie.SetBiteColliderProxy(flag); _lastVisualBiteColliderEnabled = flag; _lastVisualZombieState = _zombie.currentState; } if (flag2 || Time.time >= _nextRemoteMouthRefreshTime) { _nextRemoteMouthRefreshTime = Time.time + 0.12f; _zombie.UpdateMouthProxy(); } _hasVisualStateSnapshot = true; } private void KeepRobotPersistent() { if (Time.time >= _nextPersistentRefreshTime) { _nextPersistentRefreshTime = Time.time + 1f; _zombie.isNPCZombie = false; _zombie.spawner = null; _zombie.lifetime = 999999f; if ((Object)(object)ZombieManager.Instance != (Object)null) { ZombieManager.Instance.DeRegisterZombie(_zombie); } } if ((Object)(object)_character != (Object)null) { _character.isZombie = true; _character.isBot = true; _character.data.dead = false; _character.data.passedOut = false; _character.data.fullyPassedOut = false; } } private void TickIdle() { //IL_0063: 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_0054: Unknown result type (might be due to invalid IL or missing references) _zombie.currentState = (State)2; _character.data.passedOut = false; SetSprint(sprinting: false); if (HasActiveGoal()) { if (HasArrivedAtGoal()) { _character.input.movementInput = Vector2.zero; LookAt(GetGoalLookPoint()); } else { LookAt(GetCurrentDrivePoint()); _brainState = RobotBrainState.Chase; _timeInChase = 0f; } } } private void TickChase() { //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) //IL_0269: 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_02b8: 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) if (!HasActiveGoal()) { ClearLockedClimbPlan(); _segmentQueue.Clear(); ClearActiveSegment(); _brainState = RobotBrainState.Idle; _zombie.currentState = (State)2; return; } _zombie.currentState = (State)3; _character.data.passedOut = false; _timeInChase += Time.deltaTime; if (CanSeeGoal()) { _lastSeenTargetTime = Time.time; } if (!IsFollowingRoute() && HasArrivedAtGoal()) { _zombie.currentState = (State)2; _character.data.passedOut = false; SetSprint(sprinting: false); _character.input.movementInput = Vector2.zero; if (_resolvedGoalIsStandable && (_character.data.isClimbing || _character.data.isRopeClimbing || _character.data.isVineClimbing)) { StopClimb(); } ClearLockedClimbPlan(); _brainState = RobotBrainState.Idle; return; } if (_character.data.isClimbing || _character.data.isRopeClimbing || _character.data.isVineClimbing) { if (!_hasLockedClimbPlan) { if (_hasActiveSegment && IsClimbPlan(_activeSegment)) { LockCurrentClimbPlan(_activeSegment); } else if (IsClimbPlan(_plan)) { LockCurrentClimbPlan(_plan); } } TickActiveClimb(); return; } if (!_hasActiveSegment && _segmentQueue.Count == 0) { ReplanRoute(); } AdvanceSegmentIfNeeded(); if (!_hasActiveSegment && _segmentQueue.Count == 0) { ReplanRoute(); } if (_hasActiveSegment) { ExecuteActiveSegment(); return; } ClearLockedClimbPlan(); PathPlan pathPlan = (_plan = BuildPathPlanFrom(_character.Center)); if (IsClimbPlan(pathPlan) && !CanStartClimbWithRetryGate(pathPlan)) { if (!IsNearClimbAnchor(pathPlan)) { LookAt(pathPlan.Anchor); WalkTowards(pathPlan.Anchor, 0.8f, tryClimb: false, tryJump: false, sprintRequested: false); } else { EnterPrepareTallClimb(); } } else if (_stuckCount >= 2 || _failedClimbCount >= 3) { RegisterBlockedPoint(_character.Center, 3.2f); EnterReposition(); } else { ExecuteGroundPlan(pathPlan); } } private void TickPrepareTallClimb() { //IL_004a: 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_0085: 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_00bd: Unknown result type (might be due to invalid IL or missing references) //IL_00dd: Unknown result type (might be due to invalid IL or missing references) //IL_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_0156: 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_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_012e: Unknown result type (might be due to invalid IL or missing references) _zombie.currentState = (State)2; _character.data.passedOut = false; SetSprint(sprinting: false); if (!HasActiveGoal()) { _brainState = RobotBrainState.Idle; return; } PathPlan pathPlan = (_plan = BuildPathPlanFrom(_character.Center)); if (!IsClimbPlan(pathPlan)) { _brainState = RobotBrainState.Chase; return; } float num = Vector3.Distance(_character.Center, pathPlan.Anchor); bool flag = num <= 1.35f; bool flag2 = IsWaitingForFullStaminaClimbRetry(pathPlan); bool flag3 = (flag2 ? HasRecoveredFullStaminaForRetry() : HasEnoughStaminaToResumeClimb(pathPlan)); LookAt(flag ? pathPlan.Goal : pathPlan.Anchor); if (!flag) { WalkTowards(pathPlan.Anchor, 0.9f, tryClimb: false, tryJump: false, HasStaminaForSprint() && num > 2f); return; } if (!flag3) { HoldForStamina((pathPlan.Goal != Vector3.zero) ? pathPlan.Goal : (pathPlan.Anchor + Vector3.up)); return; } if (flag2) { MarkFullStaminaClimbRetryAttemptStarted(pathPlan); } WalkTowards(pathPlan.Goal, 0.95f, tryClimb: true, tryJump: false, sprintRequested: false); TryForceJumpGrab(pathPlan, closeToAnchor: true); _brainState = RobotBrainState.Chase; } private void TickReposition() { //IL_0040: 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_008a: 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_013d: 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) _zombie.currentState = (State)2; _character.data.passedOut = false; if (!HasActiveGoal()) { _brainState = RobotBrainState.Idle; return; } PathPlan pathPlan = (_plan = BuildPathPlanFrom(_character.Center)); bool flag = Time.time < _repositionUntil; if (pathPlan.Action == PathActionType.Detour || pathPlan.Action == PathActionType.SlopeWalk) { LookAt(pathPlan.Goal); WalkTowards(pathPlan.Goal, 1f, tryClimb: false, tryJump: false, sprintRequested: false); TryTravelHop(); if (!flag && Vector3.Distance(_character.Center, pathPlan.Goal) < 1.2f) { _stuckCount = 0; _failedClimbCount = 0; _brainState = RobotBrainState.Chase; } } else if (!flag && (pathPlan.Action == PathActionType.Direct || pathPlan.Action == PathActionType.SlopeWalk || IsClimbPlan(pathPlan) || pathPlan.Action == PathActionType.GapJump || pathPlan.Action == PathActionType.DropDown)) { _stuckCount = 0; _failedClimbCount = 0; _brainState = RobotBrainState.Chase; } else { LookAt(GetCurrentMoveTarget()); WalkTowards(GetGoalLookPoint(), 0.7f, tryClimb: false, tryJump: false, sprintRequested: false); } } private void TickLunge() { //IL_005a: 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_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) //IL_00a3: 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) _zombie.currentState = (State)4; _character.data.passedOut = false; _timeInLunge += Time.deltaTime; if (_manualBiteActive && IsValidManualBiteTarget(_manualBiteTarget)) { SetCommandGoal(_manualBiteTarget, _manualBiteTarget.Head); } if (HasActiveGoal()) { Vector3 targetPos = _character.Center + (GetGoalLookPoint() - _character.Center) * 100f; WalkTowards(targetPos, 1.2f, tryClimb: false, tryJump: false, sprintRequested: true); } if (_timeInLunge >= _zombie.lungeTime || _character.OutOfStamina()) { _timeInLunge = 0f; ClearManualBite(); _brainState = RobotBrainState.LungeRecovery; _zombie.currentState = (State)5; _character.Fall(3f, 0f); ForcePushState(); } } private void TickLungeRecovery() { _zombie.currentState = (State)5; _character.data.passedOut = false; if (!(_character.data.fallSeconds > 0f) && !_character.data.passedOut && !_character.data.fullyPassedOut) { _timeInLunge += Time.deltaTime; if (_timeInLunge >= _zombie.lungeRecoveryTime) { _timeInLunge = 0f; _brainState = (HasActiveGoal() ? RobotBrainState.Chase : RobotBrainState.Idle); } } } private void TickActiveClimb() { //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_019e: Unknown result type (might be due to invalid IL or missing references) //IL_01a3: Unknown result type (might be due to invalid IL or missing references) //IL_00f9: 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_011c: 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_01b8: 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_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_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_01de: Unknown result type (might be due to invalid IL or missing references) //IL_0201: Unknown result type (might be due to invalid IL or missing references) //IL_0206: Unknown result type (might be due to invalid IL or missing references) //IL_0218: 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_0165: 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_0281: 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_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_0385: 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_0343: Unknown result type (might be due to invalid IL or missing references) //IL_035e: 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_037e: 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_03b8: Unknown result type (might be due to invalid IL or missing references) //IL_03cd: 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_03ff: 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) if (!HasActiveGoal()) { StopClimb(); ClearLockedClimbPlan(); _brainState = RobotBrainState.Idle; return; } PathPlan activeClimbPlan = GetActiveClimbPlan(); if (IsExhaustedForActiveClimb()) { TryArmFullStaminaClimbRetry(activeClimbPlan); StopClimb(); ClearLockedClimbPlan(); SetSprint(sprinting: false); _character.input.movementInput = Vector2.zero; EnterPrepareTallClimb(); return; } if (_climbTimer > 0.45f && !CanContinueClimb(activeClimbPlan)) { StopClimb(); if (IsClimbPlan(activeClimbPlan)) { EnterPrepareTallClimb(); return; } RegisterBlockedPoint(_character.Center, 2.6f); EnterReposition(); return; } if (_resolvedGoalIsStandable) { float num = HelperFunctions.FlatDistance(_character.Center, _resolvedGoalPoint); float num2 = _resolvedGoalPoint.y - _character.Center.y; if (_climbTimer > 0.8f && num <= 1.4f && num2 <= 0.9f) { StopClimb(); ClearLockedClimbPlan(); LookAt(_resolvedGoalPoint); _character.input.movementInput = new Vector2(0f, 1f); SetSprint(sprinting: false); return; } } Vector3 val = ((activeClimbPlan.ClimbTopPoint != Vector3.zero) ? activeClimbPlan.ClimbTopPoint : GetGoalLookPoint()); Vector2 val2 = ComputeStrategicClimbInput(val, activeClimbPlan); float num3 = Mathf.Max(activeClimbPlan.EstimatedClimbHeight, 0.1f); float num4 = Mathf.Clamp01((_character.Center.y - _climbStartHeight) / num3); float stamina = GetStamina01(); bool flag = activeClimbPlan.ClimbTopPoint != Vector3.zero && Vector3.Distance(_character.Center, activeClimbPlan.ClimbTopPoint) < 1.25f; if (ShouldAbortClimbForStamina(activeClimbPlan, stamina, flag, num4)) { StopClimb(); if (TryArmFullStaminaClimbRetry(activeClimbPlan)) { ClearLockedClimbPlan(); EnterPrepareTallClimb(); return; } RegisterFailedSegment(activeClimbPlan, RouteFailureReason.ClimbRetryFailed); RegisterBlockedPoint(_character.Center, 3f); ClearLockedClimbPlan(); EnterReposition(); return; } bool flag2 = stamina <= 0.18f && stamina >= 0.12f && num4 >= 0.35f; bool flag3 = flag || num4 >= 0.55f; bool flag4 = IsClimbPlan(activeClimbPlan) && (flag3 || flag2) && stamina >= 0.12f; LookAt(val); SetSprint(sprinting: false); _character.input.movementInput = val2; if (flag4) { _character.input.sprintIsPressed = true; _character.input.movementInput = new Vector2(Mathf.Clamp(val2.x * 1.15f, -1f, 1f), Mathf.Clamp(val2.y * 1.12f, 0.82f, 1f)); } if (GetGoalCenter().y < _character.Center.y) { bool flag5 = !IsRoughTerrainLineBlocked(_character.Center, GetGoalCenter()); float num5 = HelperFunctions.FlatDistance(_character.Center, GetGoalCenter()); bool flag6 = _climbTimer > 0.8f; if (flag5 && flag6 && num5 < 1.8f && GetGoalCenter().y - _character.Center.y < -1f) { StopClimb(); ClearLockedClimbPlan(); SetSprint(sprinting: false); } } } public bool RequestManualBite(Character? preferredTarget, out string message) { //IL_00bc: Unknown result type (might be due to invalid IL or missing references) //IL_00c2: Invalid comparison between Unknown and I4 message = string.Empty; if (!_initialized || (Object)(object)_character == (Object)null || (Object)(object)_zombie == (Object)null || (Object)(object)_view == (Object)null) { message = "Controlled robot is not ready."; return false; } if (!_view.IsMine) { message = "Nearest controlled robot is not owned by this client, so it cannot be commanded to bite."; return false; } if (_vanillaBiteControlActive) { DisableVanillaBiteControl(); message = "Controlled robot returned to ping-driven AI control."; return true; } if ((Object)(object)_character.data == (Object)null || _character.data.dead || (int)_zombie.currentState == 6) { message = "Controlled robot is dead."; return false; } if (_character.data.isCarried || (Object)(object)_character.data.carrier != (Object)null || (Object)(object)_character.data.grabbingPlayer != (Object)null) { message = "Controlled robot cannot bite while it is being carried or grabbed."; return false; } if ((Object)(object)_character.data.carriedPlayer != (Object)null) { message = "Controlled robot is carrying a player. Drop the player before biting."; return false; } Character val = null; if (IsValidManualBiteTarget(preferredTarget)) { val = preferredTarget; } if (val == null) { val = FindNearestManualBiteTarget(); } if ((Object)(object)val == (Object)null) { message = "No valid player found for vanilla zombie bite control."; return false; } EnableVanillaBiteControl(val); message = "Controlled robot is now using the original zombie chase/bite AI against " + val.characterName + ". Press B again to restore ping-driven control."; return true; } public bool ShouldUseVanillaBiteControl(MushroomZombie zombie) { if (!_vanillaBiteControlActive) { return false; } if (!_initialized || (Object)(object)zombie != (Object)(object)_zombie || (Object)(object)_character == (Object)null || (Object)(object)_zombie == (Object)null) { _vanillaBiteControlActive = false; return false; } if (!_view.IsMine) { return true; } if (!IsValidManualBiteTarget(_vanillaBiteTarget)) { DisableVanillaBiteControl(); return false; } PrepareOriginalZombieBiteTick(_vanillaBiteTarget); return true; } private void EnableVanillaBiteControl(Character target) { _vanillaBiteTarget = target; _vanillaBiteControlActive = true; _manualBiteActive = false; _manualBiteTarget = null; _carryAssistEnabled = false; _carryTarget = null; StopClimb(); ClearGoalParking(); ClearLockedClimbPlan(); _segmentQueue.Clear(); ClearActiveSegment(); ClearGuidePlannerCaches(); ResetInput(); PrepareOriginalZombieBiteTick(target); ForcePushState(); } private void DisableVanillaBiteControl() { _vanillaBiteControlActive = false; _vanillaBiteTarget = null; _manualBiteActive = false; _manualBiteTarget = null; ResetInput(); SetSprint(sprinting: false); ClearLockedClimbPlan(); ClearActiveSegment(); _segmentQueue.Clear(); ClearGuidePlannerCaches(); try { ZombieTargetForcedUntilField?.SetValue(_zombie, 0f); ZombieCurrentTargetField?.SetValue(_zombie, null); } catch { _zombie.currentTarget = null; } _brainState = (HasActiveGoal() ? RobotBrainState.Chase : RobotBrainState.Idle); _zombie.currentState = (State)((_brainState == RobotBrainState.Chase) ? 3 : 2); _nextReplanTime = 0f; ForcePushState(); } private void PrepareOriginalZombieBiteTick(Character target) { //IL_00fb: Unknown result type (might be due to invalid IL or missing references) //IL_0101: Invalid comparison between Unknown and I4 //IL_0109: Unknown result type (might be due to invalid IL or missing references) //IL_010f: Invalid comparison between Unknown and I4 //IL_0117: Unknown result type (might be due to invalid IL or missing references) //IL_011d: Invalid comparison between Unknown and I4 if ((Object)(object)_character.data == (Object)null) { return; } _character.isZombie = true; _character.isBot = true; _character.data.dead = false; _character.data.passedOut = false; _character.data.fullyPassedOut = false; _zombie.isNPCZombie = false; _zombie.spawner = null; _zombie.lifetime = 999999f; try { ZombieTargetForcedUntilField?.SetValue(_zombie, 0f); ZombieCurrentTargetField?.SetValue(_zombie, target); } catch (Exception arg) { Plugin.Log.LogDebug((object)$"PrepareOriginalZombieBiteTick target set failed: {arg}"); _zombie.currentTarget = target; } if ((int)_zombie.currentState != 4 && (int)_zombie.currentState != 5 && (int)_zombie.currentState != 6) { _zombie.currentState = (State)3; } try { float num = Mathf.Max(_zombie.chaseTimeBeforeSprint + 0.25f, 0.25f); ZombieTimeSpentChasingField?.SetValue(_zombie, num); } catch (Exception arg2) { Plugin.Log.LogDebug((object)$"PrepareOriginalZombieBiteTick timeSpentChasing failed: {arg2}"); } } public bool ToggleCarryAssist(out string message) { //IL_0162: 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) message = string.Empty; if (!_initialized || (Object)(object)_character == (Object)null || (Object)(object)_view == (Object)null) { message = "Controlled robot is not ready."; return false; } if (!_view.IsMine) { message = "Nearest controlled robot is not owned by this client, so it cannot be commanded to carry players."; return false; } if ((Object)(object)_character.data == (Object)null || _character.data.dead) { message = "Controlled robot is dead."; return false; } if ((Object)(object)_character.data.carriedPlayer != (Object)null) { Character carriedPlayer = _character.data.carriedPlayer; DropCarriedPlayer(carriedPlayer); DisableCarryAssist(); message = "Controlled robot dropped " + carriedPlayer.characterName + " and disabled carry-assist."; return true; } if (_carryAssistEnabled) { DisableCarryAssist(); message = "Controlled robot carry-assist disabled."; return true; } Character val = FindNearestCarryCandidate(80f); if ((Object)(object)val == (Object)null) { message = "No living player found for carry-assist."; return false; } _carryAssistEnabled = true; _carryTarget = val; _nextCarryRetargetTime = Time.time + 0.75f; ResetRouteForNewGoal(val.Center); SetCommandGoal(val, val.Center); _brainState = RobotBrainState.Chase; message = "Controlled robot carry-assist enabled for " + val.characterName + "."; return true; } public void NotifyStartedCarryingPlayer(Character target) { //IL_006c: 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_0085: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)target == (Object)null) { return; } _carryAssistEnabled = false; _carryTarget = null; _nextCarryRetargetTime = 0f; _stuckCount = 0; _failedClimbCount = 0; ClearActiveSegment(); _segmentQueue.Clear(); ClearLockedClimbPlan(); ResetRouteProgressWindow(); if (PingTargetTracker.TryGetBestPingDataForRobot(_character, _spawnOwnerActorNumber, _character.Center, out var data)) { SetCommandGoal(data.OwnerCharacter, data.Point, allowGoalParking: true, data.Sequence); _lastAcceptedPingSequence = data.Sequence; _brainState = RobotBrainState.Chase; } else { _ownerCharacter = null; _target = null; _goalPoint = Vector3.zero; _hasGoalPoint = false; _hasResolvedGoalPoint = false; _zombie.currentTarget = null; _brainState = RobotBrainState.Idle; } try { _character.refs.afflictions.UpdateWeight(); } catch (Exception arg) { Plugin.Log.LogDebug((object)$"NotifyStartedCarryingPlayer UpdateWeight failed: {arg}"); } } public void NotifyStoppedCarryingPlayer(Character target) { if ((Object)(object)target == (Object)null) { return; } if ((Object)(object)_carryTarget == (Object)(object)target) { DisableCarryAssist(); } try { _character.refs.afflictions.UpdateWeight(); } catch (Exception arg) { Plugin.Log.LogDebug((object)$"NotifyStoppedCarryingPlayer UpdateWeight failed: {arg}"); } } private bool ShouldHoldCommandTarget() { if (ShouldHoldBackpackCommandTarget()) { return true; } if (_manualBiteActive || _brainState == RobotBrainState.Lunge || _brainState == RobotBrainState.LungeRecovery) { return true; } return _carryAssistEnabled && (Object)(object)_carryTarget != (Object)null && (Object)(object)_character != (Object)null && (Object)(object)_character.data != (Object)null && (Object)(object)_character.data.carriedPlayer == (Object)null; } private void UpdateCommandStateBeforePlanning() { UpdateBackpackCommandGoal(); UpdateManualBiteGoal(); UpdateCarryAssistGoal(); } private void UpdateManualBiteGoal() { //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_0041: Unknown result type (might be due to invalid IL or missing references) if (_manualBiteActive) { if (!IsValidManualBiteTarget(_manualBiteTarget)) { ClearManualBite(); return; } Vector3 head = _manualBiteTarget.Head; SetCommandGoal(_manualBiteTarget, head); } } private void StartManualBite(Character target) { //IL_003e: 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) _manualBiteTarget = target; _manualBiteActive = true; _timeInLunge = 0f; StopClimb(); ClearLockedClimbPlan(); _segmentQueue.Clear(); ClearActiveSegment(); SetCommandGoal(target, target.Head); LookAt(target.Head); _character.input.jumpWasPressed = true; _brainState = RobotBrainState.Lunge; _zombie.currentState = (State)4; ForcePushState(); } private void ClearManualBite() { _manualBiteTarget = null; _manualBiteActive = false; } private Character? FindNearestManualBiteTarget() { //IL_0034: 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_0049: Unknown result type (might be due to invalid IL or missing references) Character result = null; float num = 100f; foreach (Character allCharacter in Character.AllCharacters) { if (IsValidManualBiteTarget(allCharacter)) { Vector3 val = allCharacter.Center - _character.Center; float sqrMagnitude = ((Vector3)(ref val)).sqrMagnitude; if (sqrMagnitude <= num) { num = sqrMagnitude; result = allCharacter; } } } return result; } private bool IsManualBiteTargetInRange(Character target) { //IL_0032: Unknown result type (might be due to invalid IL or missing references) //IL_003d: Unknown result type (might be due to invalid IL or missing references) //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_0064: 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_0076: Unknown result type (might be due to invalid IL or missing references) //IL_007b: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)target == (Object)null) { return false; } float num = Mathf.Min(10f, Mathf.Max(3.5f, _zombie.zombieLungeDistance)); Vector3 val = target.Center - _character.Center; if (((Vector3)(ref val)).sqrMagnitude > num * num) { return false; } RaycastHit val2 = HelperFunctions.LineCheck(_character.Head, target.Center, (LayerType)1, 0f, (QueryTriggerInteraction)1); return (Object)(object)((RaycastHit)(ref val2)).transform == (Object)null; } private bool IsValidManualBiteTarget(Character? candidate) { if ((Object)(object)candidate == (Object)null || (Object)(object)candidate.data == (Object)null || (Object)(object)candidate == (Object)(object)_character) { return false; } if ((Object)(object)RobotInteractionUtil.GetAgent(candidate) != (Object)null) { return false; } if (candidate.isBot || candidate.data.dead || candidate.data.fullyPassedOut) { return false; } if (candidate.data.isCarried || (Object)(object)candidate.data.carrier != (Object)null) { return false; } return true; } private void UpdateCarryAssistGoal() { //IL_010e: 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_011b: 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) if (!_carryAssistEnabled) { return; } if ((Object)(object)_character == (Object)null || (Object)(object)_character.data == (Object)null) { DisableCarryAssist(); return; } if ((Object)(object)_character.data.carriedPlayer != (Object)null) { _carryAssistEnabled = false; _carryTarget = null; return; } if ((Object)(object)_carryTarget == (Object)null || !IsValidCarryCandidate(_carryTarget)) { if (Time.time < _nextCarryRetargetTime) { return; } _carryTarget = FindNearestCarryCandidate(80f); _nextCarryRetargetTime = Time.time + 0.75f; if ((Object)(object)_carryTarget == (Object)null) { DisableCarryAssist(); return; } ResetRouteForNewGoal(_carryTarget.Center); } Vector3 center = _carryTarget.Center; SetCommandGoal(_carryTarget, center); _brainState = RobotBrainState.Chase; if (CanStartCarrying(_carryTarget)) { StartCarryingTarget(_carryTarget); } } private Character? FindNearestCarryCandidate(float radius) { //IL_0032: Unknown result type (might be due to invalid IL or missing references) //IL_003d: Unknown result type (might be due to invalid IL or missing references) //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) Character result = null; float num = radius * radius; foreach (Character allCharacter in Character.AllCharacters) { if (IsValidCarryCandidate(allCharacter)) { Vector3 val = allCharacter.Center - _character.Center; float sqrMagnitude = ((Vector3)(ref val)).sqrMagnitude; if (sqrMagnitude <= num) { num = sqrMagnitude; result = allCharacter; } } } return result; } private bool IsValidCarryCandidate(Character? candidate) { if ((Object)(object)candidate == (Object)null || (Object)(object)candidate.data == (Object)null || (Object)(object)candidate == (Object)(object)_character) { return false; } if ((Object)(object)RobotInteractionUtil.GetAgent(candidate) != (Object)null) { return false; } if (candidate.isBot || candidate.data.dead) { return false; } if ((Object)(object)candidate.data.carrier != (Object)null || candidate.data.isCarried) { return false; } return true; } private bool CanStartCarrying(Character target) { //IL_0037: Unknown result type (might be due to invalid IL or missing references) //IL_003d: Unknown result type (might be due to invalid IL or missing references) //IL_0049: Unknown result type (might be due to invalid IL or missing references) //IL_0059: Unknown result type (might be due to invalid IL or missing references) //IL_008e: 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_00a0: Unknown result type (might be due to invalid IL or missing references) //IL_00a5: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)target == (Object)null || (Object)(object)target.data == (Object)null || !IsValidCarryCandidate(target)) { return false; } float num = HelperFunctions.FlatDistance(_character.Center, target.Center); float num2 = Mathf.Abs(target.Center.y - _character.Center.y); if (num > 1.75f || num2 > 2.25f) { return false; } RaycastHit val = HelperFunctions.LineCheck(_character.Head, target.Center, (LayerType)1, 0f, (QueryTriggerInteraction)1); return (Object)(object)((RaycastHit)(ref val)).transform == (Object)null; } private void StartCarryingTarget(Character target) { if ((Object)(object)target == (Object)null || (Object)(object)((MonoBehaviourPun)target).photonView == (Object)null) { return; } StopClimb(); ResetInput(); SetSprint(sprinting: false); try { ((MonoBehaviourPun)_character).photonView.RPC("RPCA_StartCarry", (RpcTarget)0, new object[1] { ((MonoBehaviourPun)target).photonView }); } catch (Exception arg) { Plugin.Log.LogDebug((object)$"StartCarryingTarget failed: {arg}"); } } private void DropCarriedPlayer(Character target) { try { if (!((Object)(object)target == (Object)null) && !((Object)(object)((MonoBehaviourPun)target).photonView == (Object)null) && !((Object)(object)_character == (Object)null) && !((Object)(object)((MonoBehaviourPun)_character).photonView == (Object)null)) { ((MonoBehaviourPun)_character).photonView.RPC("RPCA_Drop", (RpcTarget)0, new object[1] { ((MonoBehaviourPun)target).photonView }); } } catch (Exception arg) { Plugin.Log.LogDebug((object)$"DropCarriedPlayer failed: {arg}"); } } private void DisableCarryAssist() { _carryAssistEnabled = false; _carryTarget = null; _nextCarryRetargetTime = 0f; } private bool IsCarryAssistTarget(Character? target) { return _carryAssistEnabled && (Object)(object)target != (Object)null && (Object)(object)target == (Object)(object)_carryTarget; } private void SetCommandGoal(Character target, Vector3 point, bool allowGoalParking = false, int instructionSerial = 0) { //IL_0002: 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_005a: Unknown result type (might be due to invalid IL or missing references) bool flag = HasGoalPointChanged(point) || (instructionSerial > 0 && instructionSerial != _goalInstructionSerial); _ownerCharacter = target; _target = target; _goalPoint = point; _hasGoalPoint = true; _allowGoalParking = allowGoalParking; _zombie.currentTarget = target; if (flag) { ResetRouteForNewGoal(point, instructionSerial, allowGoalParking); } } public static bool TryGetForZombie(MushroomZombie? zombie, out NetworkRobotAgent? agent) { agent = null; if ((Object)(object)zombie == (Object)null) { return false; } int instanceID = ((Object)zombie).GetInstanceID(); if (AgentByZombieInstanceId.TryGetValue(instanceID, out NetworkRobotAgent value)) { if ((Object)(object)value != (Object)null && value._initialized && (Object)(object)value._zombie == (Object)(object)zombie) { agent = value; return true; } AgentByZombieInstanceId.Remove(instanceID); } float unscaledTime = Time.unscaledTime; if (MissingAgentRetryByZombieInstanceId.TryGetValue(instanceID, out var value2) && unscaledTime < value2) { return false; } try { agent = ((Component)zombie).GetComponent(); } catch { agent = null; } if ((Object)(object)agent != (Object)null) { AgentByZombieInstanceId[instanceID] = agent; MissingAgentRetryByZombieInstanceId.Remove(instanceID); return true; } MissingAgentRetryByZombieInstanceId[instanceID] = unscaledTime + 0.25f; return false; } public static NetworkRobotAgent? FindNearest(Vector3 point) { //IL_005a: 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) NetworkRobotAgent result = null; float num = float.PositiveInfinity; for (int num2 = All.Count - 1; num2 >= 0; num2--) { NetworkRobotAgent networkRobotAgent = All[num2]; if ((Object)(object)networkRobotAgent == (Object)null || !networkRobotAgent._initialized || (Object)(object)networkRobotAgent._character == (Object)null) { All.RemoveAt(num2); } else { Vector3 val = point - networkRobotAgent._character.Center; float sqrMagnitude = ((Vector3)(ref val)).sqrMagnitude; if (sqrMagnitude < num) { num = sqrMagnitude; result = networkRobotAgent; } } } return result; } public static NetworkRobotAgent? FindNearestOwnedByLocal(Vector3 point) { //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_0080: Unknown result type (might be due to invalid IL or missing references) NetworkRobotAgent result = null; float num = float.PositiveInfinity; for (int num2 = All.Count - 1; num2 >= 0; num2--) { NetworkRobotAgent networkRobotAgent = All[num2]; if ((Object)(object)networkRobotAgent == (Object)null || !networkRobotAgent._initialized || (Object)(object)networkRobotAgent._character == (Object)null) { All.RemoveAt(num2); } else if (networkRobotAgent.IsOwnedByLocalPlayer) { Vector3 val = point - networkRobotAgent._character.Center; float sqrMagnitude = ((Vector3)(ref val)).sqrMagnitude; if (sqrMagnitude < num) { num = sqrMagnitude; result = networkRobotAgent; } } } return result; } private void ReadSpawnOwnershipMetadata(PhotonView photonView) { _spawnOwnerActorNumber = (((Object)(object)photonView != (Object)null) ? photonView.OwnerActorNr : 0); _spawnOwnerUserId = (((Object)(object)photonView != (Object)null && photonView.Owner != null) ? (photonView.Owner.UserId ?? string.Empty) : string.Empty); try { object[] array = (((Object)(object)photonView != (Object)null) ? photonView.InstantiationData : null); if (array != null && array.Length != 0) { if (array.Length != 0 && array[0] is int num && num > 0) { _spawnOwnerActorNumber = num; } if (array.Length > 1 && array[1] is string spawnOwnerUserId) { _spawnOwnerUserId = spawnOwnerUserId; } } } catch (Exception arg) { Plugin.Log.LogDebug((object)$"ReadSpawnOwnershipMetadata failed: {arg}"); } } private void ClearPingGoalState() { //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) _ownerCharacter = null; _target = null; _goalPoint = Vector3.zero; _hasGoalPoint = false; _hasResolvedGoalPoint = false; _resolvedGoalIsStandable = false; _rawGoalIsStandable = false; _hasLastResolvedRawGoal = false; if ((Object)(object)_zombie != (Object)null) { _zombie.currentTarget = null; } _segmentQueue.Clear(); ClearActiveSegment(); ClearLockedClimbPlan(); ResetFullStaminaClimbRetry(); ClearGuidePlannerCaches(); ClearGoalParking(); _goalInstructionSerial = 0; _lastAcceptedPingSequence = 0; _allowGoalParking = true; _hadAcceptedGoalPoint = false; } public void Initialize(MushroomZombie zombie) { //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_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_0172: 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_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_0224: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)zombie == (Object)null || (Object)(object)zombie.character == (Object)null || (Object)(object)zombie.character.data == (Object)null) { Plugin.Log.LogError((object)"NetworkRobotAgent.Initialize failed: invalid zombie or character data."); ((Behaviour)this).enabled = false; return; } _lockedClimbPlan = new PathPlan(); _hasLockedClimbPlan = false; _repositionUntil = 0f; PhotonView component = ((Component)zombie).GetComponent(); if ((Object)(object)component == (Object)null) { Plugin.Log.LogError((object)"NetworkRobotAgent requires PhotonView on MushroomZombie object."); ((Behaviour)this).enabled = false; return; } _zombie = zombie; _character = zombie.character; _view = component; ReadSpawnOwnershipMetadata(component); _ownerCharacter = Character.localCharacter; _target = _ownerCharacter; _goalPoint = Vector3.zero; _hasGoalPoint = false; _resolvedGoalPoint = Vector3.zero; _hasResolvedGoalPoint = false; _resolvedGoalIsStandable = false; _hasLastResolvedRawGoal = false; _nextResolvedGoalRefreshTime = 0f; ClearGoalParking(); _goalInstructionSerial = 0; _lastAcceptedPingSequence = 0; _allowGoalParking = true; _brainState = RobotBrainState.Idle; _nextTargetRefreshTime = 0f; _lastSeenTargetTime = Time.time; _timeInChase = 0f; _timeInLunge = 0f; _stuckTimer = 0f; _stuckAnchor = _character.Center; _stuckCount = 0; _climbTimer = 0f; _climbStartHeight = 0f; _failedClimbCount = 0; _activeClimbStartedAtRetryFullStamina = false; _awaitingFullStaminaClimbRetry = false; _fullStaminaClimbRetryConsumed = false; _fullStaminaClimbRetryAnchor = Vector3.zero; _fullStaminaClimbRetryGoalSerial = 0; _lastAutoJumpTime = -999f; _plan = new PathPlan(); _blockedMemory.Clear(); _failedSegments.Clear(); _recentRouteChoices.Clear(); ClearGuidePlannerCaches(); _segmentQueue.Clear(); ClearActiveSegment(); ClearLockedClimbPlan(); _lastVisualZombieState = (State)(-1); _lastVisualBiteColliderEnabled = false; _lastVisualSprintState = false; _hasVisualStateSnapshot = false; canBeCarriedAsRobot = true; suppressRobotAI = false; zombieInteractionLock = 0f; lastRobotFedTime = -999f; _initialized = true; _nextPersistentRefreshTime = 0f; AgentByZombieInstanceId[((Object)_zombie).GetInstanceID()] = this; MissingAgentRetryByZombieInstanceId.Remove(((Object)_zombie).GetInstanceID()); RobotInteractionUtil.RegisterAgent(_character, this); if (!All.Contains(this)) { All.Add(this); } } private void OnDestroy() { All.Remove(this); if ((Object)(object)_zombie != (Object)null) { AgentByZombieInstanceId.Remove(((Object)_zombie).GetInstanceID()); MissingAgentRetryByZombieInstanceId.Remove(((Object)_zombie).GetInstanceID()); } RobotInteractionUtil.UnregisterAgent(_character, this); } public void DeleteRobotNetworked() { try { PrepareForDelete(); if ((Object)(object)_view != (Object)null && PhotonNetwork.InRoom) { if (!_view.IsMine && !PhotonNetwork.IsMasterClient) { try { _view.RequestOwnership(); } catch (Exception arg) { Plugin.Log.LogDebug((object)$"DeleteRobotNetworked RequestOwnership failed: {arg}"); } } PhotonNetwork.Destroy(((Component)this).gameObject); } else { Object.Destroy((Object)(object)((Component)this).gameObject); } } catch (Exception arg2) { Plugin.Log.LogDebug((object)$"DeleteRobotNetworked failed: {arg2}"); try { Object.Destroy((Object)(object)((Component)this).gameObject); } catch { } } } private void PrepareForDelete() { _initialized = false; suppressRobotAI = true; All.Remove(this); if ((Object)(object)_zombie != (Object)null) { AgentByZombieInstanceId.Remove(((Object)_zombie).GetInstanceID()); MissingAgentRetryByZombieInstanceId.Remove(((Object)_zombie).GetInstanceID()); } RobotInteractionUtil.UnregisterAgent(_character, this); try { ResetInput(); } catch { } try { if ((Object)(object)_character != (Object)null && (Object)(object)_character.data != (Object)null) { if ((Object)(object)_character.data.carriedPlayer != (Object)null && (Object)(object)((MonoBehaviourPun)_character).photonView != (Object)null) { ((MonoBehaviourPun)_character).photonView.RPC("RPCA_Drop", (RpcTarget)0, new object[1] { ((MonoBehaviourPun)_character.data.carriedPlayer).photonView }); } _character.data.grabbingPlayer = null; _character.data.grabbedPlayer = null; _character.data.carriedPlayer = null; _character.data.carrier = null; _character.data.isCarried = false; _character.data.currentItem = null; } } catch { } } private void UpdateInteractionState() { if (zombieInteractionLock > 0f) { zombieInteractionLock -= Time.deltaTime; if (zombieInteractionLock < 0f) { zombieInteractionLock = 0f; } } if (!((Object)(object)_character == (Object)null)) { bool flag = (Object)(object)_character.data.grabbingPlayer != (Object)null; if (_character.data.isCarried || (Object)(object)_character.data.carrier != (Object)null) { suppressRobotAI = true; canBeCarriedAsRobot = true; zombieInteractionLock = Mathf.Max(zombieInteractionLock, 0.5f); } else if (flag) { suppressRobotAI = true; canBeCarriedAsRobot = true; zombieInteractionLock = Mathf.Max(zombieInteractionLock, 0.5f); } else if (zombieInteractionLock <= 0f) { suppressRobotAI = false; canBeCarriedAsRobot = true; } } } public void NotifyGrabbedByPlayer(Character player) { suppressRobotAI = true; canBeCarriedAsRobot = true; zombieInteractionLock = Mathf.Max(zombieInteractionLock, 2f); } public void NotifyReleasedByPlayer(Character player) { zombieInteractionLock = Mathf.Max(zombieInteractionLock, 1.25f); if (!_character.data.isCarried) { suppressRobotAI = false; } } public void NotifyCarriedByPlayer(Character player) { suppressRobotAI = true; canBeCarriedAsRobot = true; zombieInteractionLock = 999f; } public void NotifyDroppedByPlayer(Character player) { zombieInteractionLock = 1.5f; suppressRobotAI = false; canBeCarriedAsRobot = true; } [PunRPC] public void RPC_AssistDrag(Vector3 helperCenter, float force) { //IL_0064: Unknown result type (might be due to invalid IL or missing references) try { if (!((Object)(object)_character == (Object)null) && !((Object)(object)_character.data == (Object)null) && (!((Object)(object)_view != (Object)null) || _view.IsMine || PhotonNetwork.IsMasterClient)) { _character.DragTowards(helperCenter, force); _character.LimitFalling(); if (_character.data.isClimbing) { _character.data.sinceGrounded = 0f; } suppressRobotAI = true; canBeCarriedAsRobot = true; zombieInteractionLock = Mathf.Max(zombieInteractionLock, 0.35f); } } catch (Exception arg) { Plugin.Log.LogDebug((object)$"RPC_AssistDrag failed: {arg}"); } } public void NotifyFedByPlayer(Character player, Item item) { lastRobotFedTime = Time.time; canBeCarriedAsRobot = true; suppressRobotAI = true; zombieInteractionLock = Mathf.Max(zombieInteractionLock, 8f); } public bool CanBeHelpedByPlayer() { if ((Object)(object)_character == (Object)null) { return false; } if (_character.data.dead) { return false; } if (_character.IsStuck() || _character.data.sinceUnstuck < 1f) { return true; } if ((Object)(object)_character.refs.afflictions != (Object)null && _character.refs.afflictions.isWebbed) { return true; } if (_character.data.isClimbing || _character.data.isRopeClimbing || _character.data.isVineClimbing) { return true; } if (zombieInteractionLock > 0f) { return true; } return false; } private void TickSuppressedByInteraction() { //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_00c0: 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_00da: 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_00e6: Unknown result type (might be due to invalid IL or missing references) _zombie.currentState = (State)2; _character.data.passedOut = false; ResetInput(); SetSprint(sprinting: false); if (_character.data.isClimbing || _character.data.isRopeClimbing || _character.data.isVineClimbing) { StopClimb(); } if ((Object)(object)_character.data.currentClimbHandle != (Object)null) { _character.refs.climbing.CancelHandle(false); } _character.input.movementInput = Vector2.zero; Vector3 lookAtPos = _character.Head + _character.data.lookDirection_Flat * 2f; LookAt(lookAtPos); } private void BeginSegment(PathPlan segment) { //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_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) _activeSegment = ClonePlan(segment); _hasActiveSegment = true; _segmentStartPos = _character.Center; _segmentStartTime = Time.time; _segmentStartGoalDistance = (HasActiveGoal() ? Vector3.Distance(_character.Center, GetGoalCenter()) : 999f); } private void ClearActiveSegment() { _activeSegment = new PathPlan(); _hasActiveSegment = false; } private bool IsSegmentFinished(PathPlan segment) { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_000d: Unknown result type (might be due to invalid IL or missing references) //IL_0029: Unknown result type (might be due to invalid IL or missing references) //IL_012e: Unknown result type (might be due to invalid IL or missing references) //IL_0134: Unknown result type (might be due to invalid IL or missing references) //IL_00f0: 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) float num = HelperFunctions.FlatDistance(_character.Center, segment.Goal); float num2 = Mathf.Abs(segment.Goal.y - _character.Center.y); switch (segment.Action) { case PathActionType.Direct: case PathActionType.Detour: case PathActionType.SlopeWalk: return num <= 1.25f && num2 <= 1.75f; case PathActionType.Climb: case PathActionType.JumpGrab: case PathActionType.WallTraverse: case PathActionType.CornerClimb: case PathActionType.Mantle: case PathActionType.RopeClimb: if (!_character.data.isClimbing && !_character.data.isRopeClimbing && !_character.data.isVineClimbing) { float num3 = HelperFunctions.FlatDistance(_character.Center, GetGoalCenter()); return num3 <= 2f || num <= 1.8f; } return false; case PathActionType.AnchorAssist: return Vector3.Distance(_character.Center, segment.Anchor) <= 1.15f || num <= 1.8f; case PathActionType.GapJump: case PathActionType.DropDown: return num <= 1.8f && num2 <= 2f; case PathActionType.WaitForStamina: { float recoverableStaminaCeiling = GetRecoverableStaminaCeiling(); float num4 = Mathf.Clamp(segment.RequiredStamina, 0.05f, Mathf.Max(0.05f, recoverableStaminaCeiling - 0.02f)); return GetStamina01() + 0.01f >= num4 || GetStamina01() >= recoverableStaminaCeiling - 0.025f; } case PathActionType.Recover: return Time.time - _segmentStartTime >= 0.85f || num <= 1.25f; case PathActionType.Hold: return true; default: return false; } } private bool IsSegmentFailed(PathPlan segment) { //IL_0043: Unknown result type (might be due to invalid IL or missing references) //IL_0049: Unknown result type (might be due to invalid IL or missing references) //IL_0068: 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_00c8: Unknown result type (might be due to invalid IL or missing references) if (segment.Action == PathActionType.WaitForStamina) { return false; } float num = Time.time - _segmentStartTime; if (num < 1.2f) { return false; } float num2 = Vector3.Distance(_character.Center, _segmentStartPos); if (IsClimbPlan(segment)) { float num3 = _character.Center.y - _segmentStartPos.y; if (num >= 3f && num3 < 0.35f && num2 < 0.8f) { return true; } return false; } float num4 = (HasActiveGoal() ? Vector3.Distance(_character.Center, GetGoalCenter()) : 999f); float num5 = _segmentStartGoalDistance - num4; if (num >= 3f && num2 < 1f && num5 < 1f) { return true; } return false; } private List BuildPathSegments() { //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_008e: 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_0163: 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_03e4: 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_03f1: Unknown result type (might be due to invalid IL or missing references) //IL_03f6: Unknown result type (might be due to invalid IL or missing references) //IL_03f9: 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_0400: 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_0416: 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_042c: 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_0437: Unknown result type (might be due to invalid IL or missing references) //IL_0439: 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_04a7: 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_02bc: 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_02c4: Unknown result type (might be due to invalid IL or missing references) //IL_02c9: 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_02d2: Unknown result type (might be due to invalid IL or missing references) //IL_024f: 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_0269: Unknown result type (might be due to invalid IL or missing references) //IL_0355: 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_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) List list = new List(); if (!HasActiveGoal()) { return list; } if (IsAdvancedRoutingEnabled() && _stuckCount >= 2 && TryBuildRecoveryPlan(out PathPlan plan)) { if (IsAdvancedRoutingDebugEnabled()) { DebugAdvancedRouting("recover segment inserted after repeated stuck detection"); } list.Add(plan); return list; } if (IsSpatialRoutingEnabled() && ShouldTryThreeDimensionalPlannerBeforeLocal()) { if (TryBuildReverseAccessPath(_character.Center, GetGoalCenter(), out List segments) && segments.Count > 0) { if (IsAdvancedRoutingDebugEnabled()) { DebugAdvancedRouting($"reverse-first produced {segments.Count} segment(s)"); } return NormalizeSegmentsForStaminaBudget(segments); } List list2 = BuildThreeDimensionalPathSegments(); if (list2.Count > 0) { if (IsAdvancedRoutingDebugEnabled()) { DebugAdvancedRouting($"spatial-first produced {list2.Count} segment(s)"); } return NormalizeSegmentsForStaminaBudget(list2); } } Vector3 val = _character.Center; PathPlan a = new PathPlan(); bool flag = false; for (int i = 0; i < 3; i++) { PathPlan pathPlan = BuildPathPlanFrom(val); if (i == 0 && pathPlan.Action == PathActionType.None) { pathPlan = BuildPathPlanFrom(_character.Center); } if (pathPlan.Action == PathActionType.None || pathPlan.Action == PathActionType.Hold || (flag && !IsMeaningfullyDifferentSegment(a, pathPlan))) { break; } float failedSegmentPenalty = GetFailedSegmentPenalty(pathPlan); if (failedSegmentPenalty >= 3f && list.Count > 0) { break; } if (!IsPlanStartTransitionReachable(val, pathPlan, out var reason)) { if (IsAdvancedRoutingDebugEnabled()) { DebugAdvancedRouting($"candidate rejected by transition validator: action={pathPlan.Action}, reason={reason}, start={val}, goal={pathPlan.Goal}, anchor={pathPlan.Anchor}"); } if (i == 0) { RegisterFailedSegment(pathPlan, reason); } break; } list.Add(pathPlan); if (pathPlan.Action == PathActionType.GapJump) { Vector3 goal = pathPlan.Goal; Vector3 goalCenter = GetGoalCenter(); if (goalCenter.y - goal.y > 1f) { PathPlan pathPlan2 = BuildPathPlanFrom(goal); if ((IsClimbPlan(pathPlan2) || pathPlan2.Action == PathActionType.Detour || pathPlan2.Action == PathActionType.SlopeWalk || pathPlan2.Action == PathActionType.Direct) && list.Count < 3) { list.Add(pathPlan2); } } break; } if (pathPlan.Action == PathActionType.Detour) { float num = GetGoalCenter().y - pathPlan.Goal.y; if (num < -1.5f) { break; } } if (IsSegmentCloseToFinalGoal(pathPlan)) { break; } val = GetPlanProjectedEndPoint(pathPlan); a = pathPlan; flag = true; } bool flag2 = false; if (list.Count > 0 && IsSpatialRoutingEnabled()) { Vector3 planProjectedEndPoint = GetPlanProjectedEndPoint(list[list.Count - 1]); Vector3 center = _character.Center; Vector3 goalCenter2 = GetGoalCenter(); float num2 = Mathf.Abs(goalCenter2.y - center.y); float num3 = Mathf.Abs(goalCenter2.y - planProjectedEndPoint.y); float num4 = HelperFunctions.FlatDistance(center, goalCenter2); float num5 = HelperFunctions.FlatDistance(planProjectedEndPoint, goalCenter2); flag2 = num2 > 1.85f && num3 > num2 - 0.35f && num5 > num4 - 0.75f && !IsClimbPlan(list[0]); } if ((list.Count == 0 || flag2) && IsSpatialRoutingEnabled()) { if (TryBuildReverseAccessPath(_character.Center, GetGoalCenter(), out List segments2) && segments2.Count > 0) { if (IsAdvancedRoutingDebugEnabled()) { DebugAdvancedRouting($"reverse fallback produced {segments2.Count} segment(s)"); } return NormalizeSegmentsForStaminaBudget(segments2); } List list3 = BuildThreeDimensionalPathSegments(); if (list3.Count > 0) { if (IsAdvancedRoutingDebugEnabled()) { DebugAdvancedRouting($"spatial fallback produced {list3.Count} segment(s)"); } return NormalizeSegmentsForStaminaBudget(list3); } } if ((list.Count == 0 || flag2) && ShouldEscalateToGuidedPlanner()) { List list4 = BuildGuidedPathSegments(); if (list4.Count > 0) { if (IsAdvancedRoutingDebugEnabled()) { DebugAdvancedRouting($"guided fallback produced {list4.Count} segment(s)"); } return NormalizeSegmentsForStaminaBudget(list4); } } return NormalizeSegmentsForStaminaBudget(list); } private bool ShouldEscalateToGuidedPlanner() { //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_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_00b2: 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) if (!HasActiveGoal()) { return false; } if (_stuckCount > 0 || _failedClimbCount > 0 || _failedSegments.Count > 0) { return true; } float num = HelperFunctions.FlatDistance(_character.Center, GetGoalCenter()); float num2 = Mathf.Abs(GetGoalCenter().y - _character.Center.y); if (IsAdvancedRoutingEnabled() && (!_rawGoalIsStandable || num2 > 1.65f)) { return true; } return num <= 1.2f && GetGoalCenter().y - _character.Center.y < -2f && num2 > 2f; } public bool Controls(MushroomZombie zombie) { return _initialized && (Object)(object)zombie == (Object)(object)_zombie; } private bool HasActiveGoal() { return (Object)(object)_target != (Object)null && _hasGoalPoint; } private Vector3 GetRawGoalCenter() { //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) return _goalPoint; } private Vector3 GetGoalCenter() { //IL_0012: 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_0017: 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) return _hasResolvedGoalPoint ? _resolvedGoalPoint : _goalPoint; } private Vector3 GetCurrentMoveTarget() { //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_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_0023: Unknown result type (might be due to invalid IL or missing references) if (_hasActiveSegment) { return _activeSegment.Goal; } return GetGoalLookPoint(); } private bool IsMeaningfullyDifferentSegment(PathPlan a, PathPlan b) { //IL_001c: 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_002e: 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) if (a.Action != b.Action) { return true; } float num = Vector3.Distance(a.Goal, b.Goal); float num2 = Vector3.Distance(a.Anchor, b.Anchor); if (num > 1.25f) { return true; } if (num2 > 1f) { return true; } return false; } private bool IsSegmentCloseToFinalGoal(PathPlan segment) { //IL_0014: 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_0031: Unknown result type (might be due to invalid IL or missing references) if (!HasActiveGoal()) { return true; } float num = HelperFunctions.FlatDistance(segment.Goal, GetGoalCenter()); float num2 = Mathf.Abs(segment.Goal.y - GetGoalCenter().y); return num <= 1.875f && num2 <= 2.625f; } private void ResetRouteProgressWindow() { //IL_0022: 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) _routeWindowStartTime = Time.time; _routeWindowStartGoalDistance = (HasActiveGoal() ? Vector3.Distance(_character.Center, GetGoalCenter()) : 999f); } private bool IsRouteMakingNetProgress() { //IL_003b: 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) if (!HasActiveGoal()) { return true; } float num = Time.time - _routeWindowStartTime; if (num < 2.5f) { return true; } float num2 = Vector3.Distance(_character.Center, GetGoalCenter()); float num3 = _routeWindowStartGoalDistance - num2; return num3 >= 0.9f; } private Vector3 GetGoalLookPoint() { //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_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_001e: Unknown result type (might be due to invalid IL or missing references) return GetGoalCenter() + Vector3.up * 0.15f; } private float GetGoalFlatDistance() { //IL_001d: 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) if (!HasActiveGoal()) { return 999f; } return HelperFunctions.FlatDistance(_character.Center, GetGoalCenter()); } private static PathPlan ClonePlan(PathPlan src) { //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_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_00e0: Unknown result type (might be due to invalid IL or missing references) //IL_00e5: Unknown result type (might be due to invalid IL or missing references) //IL_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_011c: Unknown result type (might be due to invalid IL or missing references) //IL_0121: Unknown result type (might be due to invalid IL or missing references) //IL_0128: Unknown result type (might be due to invalid IL or missing references) //IL_012d: 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_015d: Unknown result type (might be due to invalid IL or missing references) return new PathPlan { Action = src.Action, Goal = src.Goal, Anchor = src.Anchor, RequiredStamina = src.RequiredStamina, TargetAbove = src.TargetAbove, EstimatedClimbHeight = src.EstimatedClimbHeight, IsTallWall = src.IsTallWall, ExpectedDropHeight = src.ExpectedDropHeight, UsesJumpDropImmunity = src.UsesJumpDropImmunity, ReachableWithinRecoverableBudget = src.ReachableWithinRecoverableBudget, Score = src.Score, NeedsJumpStart = src.NeedsJumpStart, StartNodeType = src.StartNodeType, EndNodeType = src.EndNodeType, RiskScore = src.RiskScore, StaminaSafetyReserve = src.StaminaSafetyReserve, WasBuiltBySpatialPlanner = src.WasBuiltBySpatialPlanner, WasBuiltByReverseSearch = src.WasBuiltByReverseSearch, ProjectedEndPoint = src.ProjectedEndPoint, HasProjectedEndPoint = src.HasProjectedEndPoint, ProjectedRemainingStamina = src.ProjectedRemainingStamina, PlanningDepth = src.PlanningDepth, ClimbTopPoint = src.ClimbTopPoint, ClimbSurfaceNormal = src.ClimbSurfaceNormal, JumpGrabAimPoint = src.JumpGrabAimPoint, JumpGrabHorizontalDistance = src.JumpGrabHorizontalDistance, UsesRouteAssist = src.UsesRouteAssist, RouteAssistKind = src.RouteAssistKind, RouteAssistPoint = src.RouteAssistPoint }; } private PathPlan BuildHoldPlan(Vector3 goalLook, bool targetAbove) { //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_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_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) return new PathPlan { Action = PathActionType.Hold, Goal = goalLook, Anchor = goalLook, TargetAbove = targetAbove, ProjectedEndPoint = goalLook, HasProjectedEndPoint = true }; } private bool TryCreateImmediateDropPlan(Vector3 startPos, Vector3 dir, float flatDist, RouteProbe probe, out PathPlan plan) { //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_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_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_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_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_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_00ec: 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_012e: 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) plan = new PathPlan(); Vector3 anchor = startPos + dir * Mathf.Min(1f, flatDist); if (probe.SafeWalkDrop) { plan.Action = PathActionType.DropDown; plan.Goal = probe.DropLandingPoint; plan.Anchor = anchor; plan.TargetAbove = false; plan.RequiredStamina = 0.02f; plan.ExpectedDropHeight = probe.DropHeight; plan.UsesJumpDropImmunity = false; plan.ReachableWithinRecoverableBudget = true; plan.ProjectedEndPoint = probe.DropLandingPoint; plan.HasProjectedEndPoint = true; plan.Score = 3f - probe.DropHeight * 0.04f; return true; } if (probe.SafeJumpDrop) { plan.Action = PathActionType.DropDown; plan.Goal = probe.DropLandingPoint; plan.Anchor = anchor; plan.TargetAbove = false; plan.RequiredStamina = 0.08f; plan.ExpectedDropHeight = probe.DropHeight; plan.UsesJumpDropImmunity = true; plan.ReachableWithinRecoverableBudget = true; plan.ProjectedEndPoint = probe.DropLandingPoint; plan.HasProjectedEndPoint = true; plan.Score = 2.6f - probe.DropHeight * 0.03f; return true; } return false; } private void LockCurrentClimbPlan(PathPlan plan) { _lockedClimbPlan = ClonePlan(plan); _hasLockedClimbPlan = true; } private void ClearLockedClimbPlan() { _lockedClimbPlan = new PathPlan(); _hasLockedClimbPlan = false; } private PathPlan GetActiveClimbPlan() { if (_hasLockedClimbPlan) { return _lockedClimbPlan; } if (_hasActiveSegment) { return _activeSegment; } return _plan; } private float GetGoalVerticalDistance() { //IL_0018: 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) if (!HasActiveGoal()) { return 999f; } return Mathf.Abs(GetGoalCenter().y - _character.Center.y); } private bool HasArrivedAtGoal() { if (_goalParked) { return true; } return IsWithinGoalArrivalZone(1.55f, 1.25f, requireSafeStanding: false); } private void ClearGoalParking() { //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) _goalStableTimer = 0f; _goalParked = false; _parkedGoalPoint = Vector3.zero; _parkedGoalInstructionSerial = 0; } private bool TryUpdateGoalParkingAndMaybeHold() { //IL_0118: Unknown result type (might be due to invalid IL or missing references) //IL_011d: Unknown result type (might be due to invalid IL or missing references) if (!HasActiveGoal()) { ClearGoalParking(); return false; } if (!_allowGoalParking || ShouldHoldCommandTarget() || _vanillaBiteControlActive) { ClearGoalParking(); return false; } if (_goalParked) { if (_parkedGoalInstructionSerial == _goalInstructionSerial) { TickParkedAtGoal(); return true; } ClearGoalParking(); return false; } if (!IsWithinGoalArrivalZone(2.05f, 1.6f, requireSafeStanding: false)) { _goalStableTimer = 0f; return false; } if (!IsSafeStandingNow()) { _goalStableTimer = 0f; TickGoalArrivalSettle(); return true; } _goalStableTimer += Time.deltaTime; TickGoalArrivalSettle(); if (_goalStableTimer >= 1f) { _goalParked = true; _parkedGoalPoint = GetGoalCenter(); _parkedGoalInstructionSerial = _goalInstructionSerial; _segmentQueue.Clear(); ClearActiveSegment(); ClearLockedClimbPlan(); ClearGuidePlannerCaches(); _stuckCount = 0; _failedClimbCount = 0; TickParkedAtGoal(); } return true; } private void TickGoalArrivalSettle() { //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_007f: 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_00a1: Unknown result type (might be due to invalid IL or missing references) _brainState = RobotBrainState.Idle; _zombie.currentState = (State)2; _character.data.passedOut = false; ResetInput(); SetSprint(sprinting: false); if ((_character.data.isClimbing || _character.data.isRopeClimbing || _character.data.isVineClimbing) && _hasResolvedGoalPoint) { float num = HelperFunctions.FlatDistance(_character.Center, _resolvedGoalPoint); float num2 = _resolvedGoalPoint.y - _character.Center.y; if (num <= 1.6f && num2 <= 1.1f) { StopClimb(); } } _character.input.movementInput = Vector2.zero; } private void TickParkedAtGoal() { //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) _brainState = RobotBrainState.Parked; _zombie.currentState = (State)2; _character.data.passedOut = false; ResetInput(); SetSprint(sprinting: false); if (_character.data.isClimbing || _character.data.isRopeClimbing || _character.data.isVineClimbing) { StopClimb(); } _character.input.movementInput = Vector2.zero; } private bool IsWithinGoalArrivalZone(float flatRadius, float verticalTolerance, bool requireSafeStanding) { //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_006b: 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_0098: 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_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_009f: 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_00ac: 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_00e4: 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) if (!HasActiveGoal() || (Object)(object)_character == (Object)null || (Object)(object)_character.data == (Object)null) { return false; } if (requireSafeStanding && !IsSafeStandingNow()) { return false; } Vector3 val = _character.Center; if (TryFindGround(_character.Center, out var hit)) { val = ((RaycastHit)(ref hit)).point; } Vector3 val2 = (_hasResolvedGoalPoint ? _resolvedGoalPoint : _goalPoint); float num = HelperFunctions.FlatDistance(val, val2); float num2 = Mathf.Abs(val.y - val2.y); if (num <= flatRadius && num2 <= verticalTolerance) { return true; } if (_rawGoalIsStandable) { num = HelperFunctions.FlatDistance(val, _goalPoint); num2 = Mathf.Abs(val.y - _goalPoint.y); return num <= Mathf.Max(flatRadius, 1.05f) && num2 <= Mathf.Max(verticalTolerance, 1.2f); } return false; } private bool IsSafeStandingNow() { //IL_00de: 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) if ((Object)(object)_character == (Object)null || (Object)(object)_character.data == (Object)null) { return false; } if (_character.data.isClimbing || _character.data.isRopeClimbing || _character.data.isVineClimbing) { return false; } if (_character.data.fallSeconds > 0f || _character.data.passedOut || _character.data.fullyPassedOut) { return false; } if (!_character.data.isGrounded) { return false; } RaycastHit hit; return TryFindGround(_character.Center, out hit) && IsRoughStandableNormal(((RaycastHit)(ref hit)).normal); } private bool IsRoughStandableNormal(Vector3 normal) { //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) if (((Vector3)(ref normal)).sqrMagnitude < 0.01f) { return false; } return Vector3.Angle(normal, Vector3.up) <= 68f; } private bool IsRoughClimbTopNormal(Vector3 normal) { //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) if (((Vector3)(ref normal)).sqrMagnitude < 0.01f) { return false; } return Vector3.Angle(normal, Vector3.up) <= 72f; } private bool IsRoughTerrainLineBlocked(Vector3 from, Vector3 to) { //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_0046: Unknown result type (might be due to invalid IL or missing references) //IL_0047: Unknown result type (might be due to invalid IL or missing references) //IL_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_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_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_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_0096: 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_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_00ac: 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) //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) PhysicsProbeCacheKey key = MakePhysicsProbeCacheKey(from, to, 2); if (SharedLineProbeCache.TryGetValue(key, out LineProbeCacheEntry value) && Time.time - value.CreatedAt <= 0.18f) { return value.Blocked; } RaycastHit val = HelperFunctions.LineCheck(from + Vector3.up * 0.65f, to + Vector3.up * 0.65f, (LayerType)1, 0f, (QueryTriggerInteraction)1); bool flag = (Object)(object)((RaycastHit)(ref val)).transform != (Object)null; bool flag2 = false; if (flag) { val = HelperFunctions.LineCheck(from + Vector3.up * 1.25f, to + Vector3.up * 1.25f, (LayerType)1, 0f, (QueryTriggerInteraction)1); bool flag3 = (Object)(object)((RaycastHit)(ref val)).transform != (Object)null; flag2 = flag3; } SharedLineProbeCache[key] = new LineProbeCacheEntry { Blocked = flag2, CreatedAt = Time.time }; PruneSharedPhysicsProbeCaches(); return flag2; } private static PhysicsProbeCacheKey MakePhysicsProbeCacheKey(Vector3 a, Vector3 b, int kind) { //IL_0001: 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_0017: Unknown result type (might be due to invalid IL or missing references) //IL_0022: Unknown result type (might be due to invalid IL or missing references) //IL_002d: Unknown result type (might be due to invalid IL or missing references) //IL_0038: Unknown result type (might be due to invalid IL or missing references) return new PhysicsProbeCacheKey(QuantizeSharedProbe(a.x), QuantizeSharedProbe(a.y), QuantizeSharedProbe(a.z), QuantizeSharedProbe(b.x), QuantizeSharedProbe(b.y), QuantizeSharedProbe(b.z), kind); } private static int QuantizeSharedProbe(float value) { return Mathf.RoundToInt(value / 0.55f); } private static void PruneSharedPhysicsProbeCaches() { float time = Time.time; bool flag = SharedGroundProbeCache.Count > 512 || SharedLineProbeCache.Count > 512; if (!(time < SharedNextPhysicsProbePruneTime) || flag) { SharedNextPhysicsProbePruneTime = time + 0.25f; PruneGroundProbeCache(time); PruneLineProbeCache(time); } } private static void PruneGroundProbeCache(float now) { SharedPhysicsProbeRemovalScratch.Clear(); foreach (KeyValuePair item in SharedGroundProbeCache) { if (now - item.Value.CreatedAt > 0.36f) { SharedPhysicsProbeRemovalScratch.Add(item.Key); } } for (int i = 0; i < SharedPhysicsProbeRemovalScratch.Count; i++) { SharedGroundProbeCache.Remove(SharedPhysicsProbeRemovalScratch[i]); } while (SharedGroundProbeCache.Count > 512) { PhysicsProbeCacheKey key = default(PhysicsProbeCacheKey); float num = float.PositiveInfinity; bool flag = false; foreach (KeyValuePair item2 in SharedGroundProbeCache) { if (item2.Value.CreatedAt < num) { num = item2.Value.CreatedAt; key = item2.Key; flag = true; } } if (!flag) { break; } SharedGroundProbeCache.Remove(key); } } private static void PruneLineProbeCache(float now) { SharedPhysicsProbeRemovalScratch.Clear(); foreach (KeyValuePair item in SharedLineProbeCache) { if (now - item.Value.CreatedAt > 0.36f) { SharedPhysicsProbeRemovalScratch.Add(item.Key); } } for (int i = 0; i < SharedPhysicsProbeRemovalScratch.Count; i++) { SharedLineProbeCache.Remove(SharedPhysicsProbeRemovalScratch[i]); } while (SharedLineProbeCache.Count > 512) { PhysicsProbeCacheKey key = default(PhysicsProbeCacheKey); float num = float.PositiveInfinity; bool flag = false; foreach (KeyValuePair item2 in SharedLineProbeCache) { if (item2.Value.CreatedAt < num) { num = item2.Value.CreatedAt; key = item2.Key; flag = true; } } if (!flag) { break; } SharedLineProbeCache.Remove(key); } } private bool IsLowStaminaForHeavyAction() { if ((Object)(object)_character == (Object)null || (Object)(object)_character.data == (Object)null) { return true; } return _character.OutOfStamina() || GetStamina01() <= 0.08f; } private bool IsExhaustedForActiveClimb() { if ((Object)(object)_character == (Object)null || (Object)(object)_character.data == (Object)null) { return true; } return _character.OutOfStamina() || GetStamina01() <= 0.018f; } private bool HasStaminaForSprint() { if ((Object)(object)_character == (Object)null || (Object)(object)_character.data == (Object)null) { return false; } return !_character.OutOfStamina() && GetStamina01() >= 0.12f && _character.CheckSprint(); } private bool IsFlatTravelHopAllowed(Vector3 targetPos) { //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_0073: 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_00a1: 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_00d0: 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_00e1: 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_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_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) if ((Object)(object)_character == (Object)null || (Object)(object)_character.data == (Object)null || !_character.data.isGrounded) { return false; } if (Vector3.Distance(_character.Center, targetPos) < 2f) { return false; } if (!TryFindGround(_character.Center, out var hit) || !TryFindGround(targetPos, out var hit2)) { return false; } if (Mathf.Abs(((RaycastHit)(ref hit2)).point.y - ((RaycastHit)(ref hit)).point.y) > 0.45f) { return false; } Vector3 val = targetPos - _character.Center; val.y = 0f; if (((Vector3)(ref val)).sqrMagnitude < 0.01f) { return false; } ((Vector3)(ref val)).Normalize(); return !IsRoughTerrainLineBlocked(_character.Center, _character.Center + val * 1.5f); } private void HoldForStamina(Vector3 lookAtPoint) { //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_0048: Unknown result type (might be due to invalid IL or missing references) StopClimb(); SetSprint(sprinting: false); _character.input.movementInput = Vector2.zero; _character.input.jumpWasPressed = false; _character.input.jumpIsPressed = false; LookAt(lookAtPoint); } private float GetStamina01() { return Mathf.Clamp01(_character.GetTotalStamina()); } private float GetRecoverableStaminaCeiling() { return Mathf.Clamp(_character.GetMaxStamina() + _character.data.extraStamina, 0.05f, 1f); } private float EstimateGroundChaseCost(float distance) { return Mathf.Clamp(0.03f + distance * 0.01f, 0.03f, 0.25f); } private float GetClimbStartThreshold(PathPlan plan) { return GetFullStaminaClimbStartThreshold(plan); } private float GetFullStaminaClimbStartThreshold(PathPlan plan) { float recoverableStaminaCeiling = GetRecoverableStaminaCeiling(); float num = 0.02f; if (plan.Action == PathActionType.JumpGrab || plan.NeedsJumpStart || ((Object)(object)_character != (Object)null && (Object)(object)_character.data != (Object)null && (Object)(object)_character.data.carriedPlayer != (Object)null)) { num = Mathf.Min(num, 0.015f); } return Mathf.Clamp(recoverableStaminaCeiling - num, 0.05f, 0.98f); } private bool HasRecoveredFullStaminaForClimbStart(PathPlan plan) { return GetStamina01() + 0.001f >= GetFullStaminaClimbStartThreshold(plan); } private float GetTimeCriticalClimbStartThreshold(PathPlan plan) { float num = Mathf.Max(plan.RequiredStamina, EstimatePlanStaminaCost(plan)); float num2 = ((plan.Action == PathActionType.JumpGrab || plan.NeedsJumpStart) ? 0.24f : 0.28f); if ((Object)(object)_character != (Object)null && (Object)(object)_character.data != (Object)null && (Object)(object)_character.data.carriedPlayer != (Object)null) { num2 = Mathf.Max(num2, 0.38f); } float num3 = Mathf.Max(num + GetConfiguredStaminaSafetyRatio() * 0.2f, num2); return Mathf.Clamp(num3, 0.05f, GetFullStaminaClimbStartThreshold(plan)); } private bool HasEnoughStaminaForTimeCriticalClimb(PathPlan plan) { return GetStamina01() + 0.001f >= GetTimeCriticalClimbStartThreshold(plan); } private bool IsMetadataTimeCriticalClimbPlan(PathPlan plan) { if (!IsClimbPlan(plan)) { return false; } if (plan.Action == PathActionType.RopeClimb || plan.Action == PathActionType.AnchorAssist) { return false; } float num = Mathf.Abs(plan.EstimatedClimbHeight); if (plan.Action == PathActionType.JumpGrab) { bool flag = plan.JumpGrabHorizontalDistance >= 0.72f; bool flag2 = num > 0.05f && num <= 2.05f; bool flag3 = num <= 3.35f; return plan.NeedsJumpStart && flag3 && (flag || flag2); } if ((plan.Action == PathActionType.Climb || plan.Action == PathActionType.Mantle) && num > 0.05f && num <= 1.2f) { return true; } return plan.NeedsJumpStart && num > 0.05f && num <= 2.05f; } private bool IsNearUnsafeEdgeToward(Vector3 target) { //IL_002f: 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_0059: 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_00bb: Unknown result type (might be due to invalid IL or missing references) //IL_00c0: Unknown result type (might be due to invalid IL or missing references) //IL_00c6: Unknown result type (might be due to invalid IL or missing references) //IL_00cb: 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_00da: 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_008d: Unknown result type (might be due to invalid IL or missing references) //IL_008e: Unknown result type (might be due to invalid IL or missing references) //IL_0105: 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_0128: 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) if ((Object)(object)_character == (Object)null) { return false; } if (Time.time - _timeCriticalEdgeProbeTime < 0.12f && Vector3.Distance(target, _timeCriticalEdgeProbeTarget) < 0.55f) { return _timeCriticalEdgeProbeResult; } Vector3 val = target - _character.Center; val.y = 0f; if (((Vector3)(ref val)).sqrMagnitude < 0.04f) { _timeCriticalEdgeProbeTarget = target; _timeCriticalEdgeProbeTime = Time.time; _timeCriticalEdgeProbeResult = false; return false; } ((Vector3)(ref val)).Normalize(); Vector3 val2 = _character.Center + val * 0.82f + Vector3.up * 0.35f; RaycastHit val3 = default(RaycastHit); bool flag = !Physics.Raycast(val2, Vector3.down, ref val3, 3.65f, TerrainMask, (QueryTriggerInteraction)1) || _character.Center.y - ((RaycastHit)(ref val3)).point.y > 1.55f; _timeCriticalEdgeProbeTarget = target; _timeCriticalEdgeProbeTime = Time.time; _timeCriticalEdgeProbeResult = flag; return flag; } private bool IsTimeCriticalClimbStart(PathPlan plan) { //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_0099: 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_009e: 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_00a9: 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) if (!IsClimbPlan(plan)) { return false; } if (IsWaitingForFullStaminaClimbRetry(plan)) { return false; } if ((Object)(object)_character != (Object)null && (Object)(object)_character.data != (Object)null && !_character.data.isGrounded) { return true; } if (IsMetadataTimeCriticalClimbPlan(plan)) { return true; } Vector3 val = ((plan.Anchor != Vector3.zero) ? plan.Anchor : plan.Goal); if (plan.Action == PathActionType.JumpGrab && val != Vector3.zero && IsNearUnsafeEdgeToward(val)) { return true; } return false; } private bool IsClimbPlan(PathPlan plan) { return plan.Action == PathActionType.Climb || plan.Action == PathActionType.JumpGrab || plan.Action == PathActionType.WallTraverse || plan.Action == PathActionType.CornerClimb || plan.Action == PathActionType.Mantle || plan.Action == PathActionType.RopeClimb; } private bool HasEnoughStaminaToStartClimb(PathPlan plan) { if (!IsClimbPlan(plan)) { return true; } if (IsWaitingForFullStaminaClimbRetry(plan)) { return HasRecoveredFullStaminaForRetry(); } if (IsTimeCriticalClimbStart(plan)) { return HasEnoughStaminaForTimeCriticalClimb(plan); } return HasRecoveredFullStaminaForClimbStart(plan); } private bool HasEnoughStaminaToResumeClimb(PathPlan plan) { if (!IsClimbPlan(plan)) { return true; } if (IsWaitingForFullStaminaClimbRetry(plan)) { return HasRecoveredFullStaminaForRetry(); } if (IsTimeCriticalClimbStart(plan)) { return HasEnoughStaminaForTimeCriticalClimb(plan); } return HasRecoveredFullStaminaForClimbStart(plan); } private List BuildGuidedPathSegments() { //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_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_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_003a: 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_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_00a0: 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_00a7: 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_00b7: 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_0175: 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_00fa: 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_01a8: 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_01ba: 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_01fb: 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_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_0236: Unknown result type (might be due to invalid IL or missing references) //IL_0256: 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_025d: Unknown result type (might be due to invalid IL or missing references) //IL_025f: Unknown result type (might be due to invalid IL or missing references) //IL_0267: 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_0271: 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_0378: Unknown result type (might be due to invalid IL or missing references) //IL_03ca: Unknown result type (might be due to invalid IL or missing references) //IL_0416: Unknown result type (might be due to invalid IL or missing references) //IL_0418: Unknown result type (might be due to invalid IL or missing references) List result = new List(); if (!HasActiveGoal()) { return result; } Vector3 center = _character.Center; Vector3 goalCenter = GetGoalCenter(); float num = HelperFunctions.FlatDistance(center, goalCenter); float num2 = Mathf.Abs(goalCenter.y - center.y); bool flag = goalCenter.y - center.y < -1.25f; if (!flag && num < 4f && num2 < 1.35f && _stuckCount <= 0 && _failedClimbCount <= 0) { return result; } Vector3 val = goalCenter - center; Vector3 val2 = default(Vector3); ((Vector3)(ref val2))..ctor(val.x, 0f, val.z); Vector3 originalBaseDir; if (((Vector3)(ref val2)).sqrMagnitude < 0.01f) { if (!flag) { return result; } originalBaseDir = _character.data.lookDirection_Flat; originalBaseDir.y = 0f; if (((Vector3)(ref originalBaseDir)).sqrMagnitude < 0.01f) { originalBaseDir = ((Component)_character).transform.forward; originalBaseDir.y = 0f; } if (((Vector3)(ref originalBaseDir)).sqrMagnitude < 0.01f) { originalBaseDir = Vector3.forward; } ((Vector3)(ref originalBaseDir)).Normalize(); } else { originalBaseDir = ((Vector3)(ref val2)).normalized; } RoutePathCacheKey key = MakeRoutePathCacheKey(center, goalCenter, flag); if (TryGetCachedGuidedPath(key, out List segments)) { return segments; } float recoverableStaminaCeiling = GetRecoverableStaminaCeiling(); RouteSearchNode item = new RouteSearchNode { Position = center, Score = 0f, DistanceToGoal = Vector3.Distance(center, goalCenter), RemainingStamina = recoverableStaminaCeiling, Depth = 0 }; List list = new List { item }; RouteSearchNode routeSearchNode = null; float num3 = float.NegativeInfinity; Dictionary dictionary = new Dictionary(); dictionary[MakeRoutePlannerStateKey(center, 0, recoverableStaminaCeiling)] = 0f; for (int i = 0; i < 2; i++) { List list2 = new List(); for (int j = 0; j < list.Count; j++) { RouteSearchNode routeSearchNode2 = list[j]; List list3 = BuildGuideCandidatesFromCached(routeSearchNode2, originalBaseDir); for (int k = 0; k < list3.Count; k++) { PathPlan pathPlan = list3[k]; Vector3 planProjectedEndPoint = GetPlanProjectedEndPoint(pathPlan); float num4 = Vector3.Distance(planProjectedEndPoint, goalCenter); float num5 = HelperFunctions.FlatDistance(planProjectedEndPoint, goalCenter); float num6 = Mathf.Abs(goalCenter.y - planProjectedEndPoint.y); float num7 = routeSearchNode2.DistanceToGoal - num4; if (num7 < -1.75f && pathPlan.Action == PathActionType.Detour) { continue; } float num8 = EstimatePlanStaminaCost(pathPlan); if ((IsClimbPlan(pathPlan) || pathPlan.Action == PathActionType.GapJump || (pathPlan.Action == PathActionType.DropDown && pathPlan.UsesJumpDropImmunity)) && num8 > routeSearchNode2.RemainingStamina + 0.03f) { continue; } float num9 = Mathf.Clamp(routeSearchNode2.RemainingStamina - num8, 0f, recoverableStaminaCeiling); if (pathPlan.Action == PathActionType.Detour || pathPlan.Action == PathActionType.SlopeWalk || pathPlan.Action == PathActionType.Direct || (pathPlan.Action == PathActionType.DropDown && !pathPlan.UsesJumpDropImmunity)) { num9 = recoverableStaminaCeiling; } float num10 = routeSearchNode2.Score + ScoreGuideCandidate(pathPlan, routeSearchNode2.Position, routeSearchNode2.DistanceToGoal, i, k); num10 += Mathf.Clamp(num7, -2f, 4f) * 1.75f; num10 += Mathf.Max(0f, 2.15f - num5) * 0.15f; RoutePlannerStateKey key2 = MakeRoutePlannerStateKey(planProjectedEndPoint, i + 1, num9); if (!dictionary.TryGetValue(key2, out var value) || !(num10 <= value + 0.08f)) { dictionary[key2] = num10; RouteSearchNode routeSearchNode3 = new RouteSearchNode { Position = planProjectedEndPoint, Score = num10, DistanceToGoal = num4, RemainingStamina = num9, Depth = i + 1 }; for (int l = 0; l < routeSearchNode2.Segments.Count; l++) { routeSearchNode3.Segments.Add(ClonePlan(routeSearchNode2.Segments[l])); } PathPlan pathPlan2 = ClonePlan(pathPlan); pathPlan2.ProjectedRemainingStamina = num9; pathPlan2.PlanningDepth = i; routeSearchNode3.Segments.Add(pathPlan2); bool flag2 = num5 <= 2.15f && num6 <= 2.35f; if (flag && pathPlan.Action == PathActionType.DropDown) { flag2 = flag2 || num6 <= 3.4499998f; } float num11 = num10 - num4 * 0.65f - num6 * 0.35f; if (flag2) { num11 += 8f; } if (routeSearchNode == null || num11 > num3) { routeSearchNode = routeSearchNode3; num3 = num11; } list2.Add(routeSearchNode3); } } } if (list2.Count == 0) { break; } list2.Sort((RouteSearchNode a, RouteSearchNode b) => b.Score.CompareTo(a.Score)); if (list2.Count > 3) { list2.RemoveRange(3, list2.Count - 3); } list = list2; } if (routeSearchNode == null || routeSearchNode.Segments.Count == 0) { return result; } List list4 = new List(); int num12 = Mathf.Min(routeSearchNode.Segments.Count, 3); for (int m = 0; m < num12; m++) { PathPlan pathPlan3 = ClonePlan(routeSearchNode.Segments[m]); list4.Add(pathPlan3); RememberRouteChoice(pathPlan3); } StoreGuidedPathCache(key, list4); return list4; } private List BuildGuideCandidatesFrom(RouteSearchNode node, Vector3 originalBaseDir) { //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_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_001f: 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_0048: 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_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_007a: 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_00b7: 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_00c8: Unknown result type (might be due to invalid IL or missing references) //IL_00cd: Unknown result type (might be due to invalid IL or missing references) //IL_00f0: 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_0123: 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_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_0152: 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_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) //IL_01a9: 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_01c7: 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_01f1: 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_0212: 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_0245: Unknown result type (might be due to invalid IL or missing references) //IL_031a: Unknown result type (might be due to invalid IL or missing references) //IL_031f: Unknown result type (might be due to invalid IL or missing references) //IL_027d: Unknown result type (might be due to invalid IL or missing references) //IL_0294: 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_02a8: Unknown result type (might be due to invalid IL or missing references) //IL_02ad: Unknown result type (might be due to invalid IL or missing references) //IL_033a: 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_02c7: Unknown result type (might be due to invalid IL or missing references) //IL_02d1: 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_02e4: 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_030b: Unknown result type (might be due to invalid IL or missing references) List list = new List(10); Vector3 goalCenter = GetGoalCenter(); Vector3 val = goalCenter - node.Position; Vector3 val2 = default(Vector3); ((Vector3)(ref val2))..ctor(val.x, 0f, val.z); Vector3 val3 = ((((Vector3)(ref val2)).sqrMagnitude > 0.01f) ? ((Vector3)(ref val2)).normalized : originalBaseDir); if (((Vector3)(ref val3)).sqrMagnitude < 0.01f) { val3 = Vector3.forward; } float num = HelperFunctions.FlatDistance(node.Position, goalCenter); float num2 = goalCenter.y - node.Position.y; bool flag = num2 > 1.4f; bool flag2 = num2 < -1.25f; PathPlan candidate = BuildPathPlanFrom(node.Position); AddGuideCandidate(list, candidate, node.Position); if (flag && TryBuildJumpGrabPlanFrom(node.Position, val3, targetAbove: true, out PathPlan plan) && IsViableClimbPlan(plan)) { AddGuideCandidate(list, plan, node.Position); } if (flag2 && TryBuildDropDownPlanFrom(node.Position, val3, num, num2, out PathPlan plan2)) { AddGuideCandidate(list, plan2, node.Position); } if (flag2 && TryBuildVerticalDropPlanFrom(node.Position, num2, out PathPlan plan3)) { AddGuideCandidate(list, plan3, node.Position); } if (TryBuildTerrainFallbackPlanFrom(node.Position, val3, num, flag, out PathPlan plan4)) { AddGuideCandidate(list, plan4, node.Position); } for (int i = 0; i < GuideSearchAngles.Length; i++) { float num3 = GuideSearchAngles[i]; Vector3 dir = Quaternion.AngleAxis(num3, Vector3.up) * val3; for (int j = 0; j < GuideSearchDistances.Length; j++) { float num4 = GuideSearchDistances[j]; if (!TryProbeRouteFrom(node.Position, dir, num4, out var probe)) { continue; } if (probe.GapJumpable && TryCreateGuideGapPlan(node.Position, dir, probe, flag, out PathPlan plan5)) { AddGuideCandidate(list, plan5, node.Position); } if (flag2 && TryCreateImmediateDropPlan(node.Position, dir, num, probe, out PathPlan plan6)) { AddGuideCandidate(list, plan6, node.Position); } if (probe.ClimbableAhead && !probe.UnsafeDropAhead) { PathPlan plan7 = new PathPlan(); FillClimbPlan(ref plan7, probe.ClimbBasePoint, probe.ClimbHeightDelta, flag, probe.NeedsJumpStart, probe.ClimbTopPoint, probe.ClimbSurfaceNormal); if (probe.ClimbTopPoint != Vector3.zero) { plan7.Goal = probe.ClimbTopPoint + Vector3.up * 0.12f; plan7.ProjectedEndPoint = probe.ClimbTopPoint; plan7.HasProjectedEndPoint = true; } if (IsViableClimbPlan(plan7)) { AddGuideCandidate(list, plan7, node.Position); } } if (TryCreateGuideGroundPlan(node.Position, dir, num4, probe, flag, out PathPlan plan8)) { AddGuideCandidate(list, plan8, node.Position); } } } list.Sort((PathPlan a, PathPlan b) => b.Score.CompareTo(a.Score)); if (list.Count > 10) { list.RemoveRange(10, list.Count - 10); } return list; } private bool TryCreateGuideGroundPlan(Vector3 startPos, Vector3 dir, float distance, RouteProbe probe, bool targetAbove, out PathPlan plan) { //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_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_0016: 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_0035: 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_0059: Unknown result type (might be due to invalid IL or missing references) //IL_007e: Unknown result type (might be due to invalid IL or missing references) //IL_0088: Unknown result type (might be due to invalid IL or missing references) //IL_00b5: 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_00ed: 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_011c: 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_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_0143: 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_0168: Unknown result type (might be due to invalid IL or missing references) //IL_016d: Unknown result type (might be due to invalid IL or missing references) //IL_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_0189: 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_01b7: Unknown result type (might be due to invalid IL or missing references) plan = new PathPlan(); Vector3 point = startPos + dir * distance; if (!TryFindGround(point, out var hit)) { return false; } if (!IsRoughStandableNormal(((RaycastHit)(ref hit)).normal)) { return false; } float num = startPos.y - ((RaycastHit)(ref hit)).point.y; if (num > 10f) { return false; } float num2 = ((RaycastHit)(ref hit)).point.y - startPos.y; if (num2 > 2.25f && !probe.ClimbableAhead) { return false; } bool flag = IsRoughTerrainLineBlocked(startPos, ((RaycastHit)(ref hit)).point); if (flag && !probe.ObstacleAhead) { return false; } plan.Action = (flag ? PathActionType.Detour : ((!(Mathf.Abs(((RaycastHit)(ref hit)).point.y - startPos.y) > 0.55f)) ? PathActionType.Direct : PathActionType.SlopeWalk)); plan.Goal = ((RaycastHit)(ref hit)).point; plan.Anchor = ((RaycastHit)(ref hit)).point; plan.TargetAbove = targetAbove; plan.RequiredStamina = EstimateGroundChaseCost(Vector3.Distance(startPos, ((RaycastHit)(ref hit)).point)); plan.ReachableWithinRecoverableBudget = true; plan.ProjectedEndPoint = ((RaycastHit)(ref hit)).point; plan.HasProjectedEndPoint = true; float num3 = HelperFunctions.FlatDistance(startPos, GetGoalCenter()) - HelperFunctions.FlatDistance(((RaycastHit)(ref hit)).point, GetGoalCenter()); plan.Score = num3 * 1.25f - Mathf.Abs(num) * 0.05f - GetBlockedPenalty(((RaycastHit)(ref hit)).point); if (!flag) { plan.Score += 0.35f; } if (probe.ObstacleAhead && !probe.ClimbableAhead) { plan.Score += 0.55f; } return true; } private bool TryCreateGuideGapPlan(Vector3 startPos, Vector3 dir, RouteProbe probe, bool targetAbove, out PathPlan plan) { //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_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_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_00b1: 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_00e9: 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_00f9: 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_010a: Unknown result type (might be due to invalid IL or missing references) plan = new PathPlan(); if (!probe.GapJumpable) { return false; } float num = Mathf.Clamp(0.16f + probe.GapLandingDrop * 0.035f, 0.16f, 0.52f); if (num > GetRecoverableStaminaCeiling() + 0.02f) { return false; } float num2 = (probe.ObstacleAhead ? Mathf.Clamp(probe.ObstacleDistance - 0.25f, 0.75f, 1.55f) : 1.15f); plan.Action = PathActionType.GapJump; plan.Goal = probe.GapLandingPoint; plan.Anchor = startPos + dir * num2; plan.TargetAbove = targetAbove; plan.RequiredStamina = num; plan.ExpectedDropHeight = probe.GapLandingDrop; plan.ReachableWithinRecoverableBudget = true; plan.ProjectedEndPoint = probe.GapLandingPoint; plan.HasProjectedEndPoint = true; float num3 = HelperFunctions.FlatDistance(startPos, GetGoalCenter()) - HelperFunctions.FlatDistance(probe.GapLandingPoint, GetGoalCenter()); plan.Score = num3 * 1.6f + 0.9f - Mathf.Max(0f, probe.GapLandingDrop) * 0.035f; return true; } private void AddGuideCandidate(List candidates, PathPlan candidate, Vector3 startPos) { //IL_0074: Unknown result type (might be due to invalid IL or missing references) //IL_0079: Unknown result type (might be due to invalid IL or missing references) //IL_007a: 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_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_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_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_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_0122: 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) if (candidate.Action == PathActionType.None || candidate.Action == PathActionType.Hold || (IsClimbPlan(candidate) && !IsViableClimbPlan(candidate)) || ((candidate.Action == PathActionType.GapJump || IsClimbPlan(candidate)) && candidate.RequiredStamina > GetRecoverableStaminaCeiling() + 0.02f)) { return; } Vector3 planProjectedEndPoint = GetPlanProjectedEndPoint(candidate); Vector3 val = planProjectedEndPoint - startPos; if (((Vector3)(ref val)).sqrMagnitude < 0.20249999f || ((candidate.Action == PathActionType.Direct || candidate.Action == PathActionType.SlopeWalk) && !IsGuideDirectSegmentSafe(startPos, planProjectedEndPoint))) { return; } candidate.Score += ScoreGuideCandidate(candidate, startPos, Vector3.Distance(startPos, GetGoalCenter()), candidate.PlanningDepth, candidates.Count); for (int i = 0; i < candidates.Count; i++) { Vector3 planProjectedEndPoint2 = GetPlanProjectedEndPoint(candidates[i]); if (candidates[i].Action == candidate.Action && Vector3.Distance(planProjectedEndPoint2, planProjectedEndPoint) < 0.9f) { if (candidate.Score > candidates[i].Score) { candidates[i] = ClonePlan(candidate); } return; } } candidates.Add(ClonePlan(candidate)); } private float ScoreGuideCandidate(PathPlan candidate, Vector3 startPos, float currentDistanceToGoal, int depth, int candidateIndex) { //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_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_0011: 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_0022: Unknown result type (might be due to invalid IL or missing references) //IL_0032: Unknown result type (might be due to invalid IL or missing references) //IL_0038: 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_006f: 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) //IL_00b9: 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) Vector3 planProjectedEndPoint = GetPlanProjectedEndPoint(candidate); Vector3 goalCenter = GetGoalCenter(); float num = Vector3.Distance(planProjectedEndPoint, goalCenter); float num2 = currentDistanceToGoal - num; float num3 = goalCenter.y - startPos.y; float num4 = Mathf.Abs(num3) - Mathf.Abs(goalCenter.y - planProjectedEndPoint.y); float num5 = 0f; num5 += num2 * 2.35f; num5 += num4 * 0.7f; num5 -= Mathf.Abs(planProjectedEndPoint.y - startPos.y) * 0.06f; num5 -= EstimatePlanStaminaCost(candidate) * 1.85f; num5 -= EstimateHumanActionTimeCost(candidate, startPos, planProjectedEndPoint) * 0.38f; num5 -= GetFailedSegmentPenalty(candidate); num5 -= GetBlockedPenalty(planProjectedEndPoint); num5 -= GetRecentRouteChoicePenalty(candidate, startPos); num5 -= (float)depth * 0.12f; num5 -= (float)candidateIndex * 0.01f; switch (candidate.Action) { case PathActionType.Climb: case PathActionType.JumpGrab: case PathActionType.WallTraverse: case PathActionType.CornerClimb: case PathActionType.Mantle: case PathActionType.RopeClimb: num5 += ((num3 > 0.75f) ? 0.35f : (-1f)); num5 -= Mathf.Max(0f, candidate.EstimatedClimbHeight - Mathf.Max(0.8f, num4 + 0.9f)) * 0.8f; if (candidate.RequiredStamina > 0.92f) { num5 -= (candidate.RequiredStamina - 0.92f) * 4f; } break; case PathActionType.GapJump: num5 += 0.85f; break; case PathActionType.DropDown: num5 += ((num3 < -0.75f) ? 1.15f : 0.15f); break; case PathActionType.SlopeWalk: num5 += 1.05f; break; case PathActionType.Detour: num5 += 0.85f; break; case PathActionType.Direct: num5 += 0.75f; break; } if (num2 < -0.25f) { num5 += Mathf.Max(num2, -3f) * 0.85f; } return num5; } private bool IsGuideDirectSegmentSafe(Vector3 startPos, Vector3 endPos) { //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_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_0067: 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_006b: 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_0095: 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_009b: Unknown result type (might be due to invalid IL or missing references) //IL_00a0: Unknown result type (might be due to invalid IL or missing references) //IL_00a5: Unknown result type (might be due to invalid IL or missing references) //IL_00a8: 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_00e2: 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_00fa: 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_0130: 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_0150: 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) Vector3 val = endPos - startPos; val.y = 0f; float magnitude = ((Vector3)(ref val)).magnitude; if (magnitude > 8f) { return false; } if (magnitude < 0.25f) { return true; } Vector3 normalized = ((Vector3)(ref val)).normalized; int num = Mathf.Clamp(Mathf.CeilToInt(magnitude / 1.75f), 1, 5); Vector3 val2 = startPos; if (TryFindGround(startPos, out var hit)) { val2 = ((RaycastHit)(ref hit)).point; } for (int i = 1; i <= num; i++) { float num2 = (float)i / (float)num; Vector3 point = startPos + normalized * (magnitude * num2); if (!TryFindGround(point, out var hit2)) { return false; } if (!IsRoughStandableNormal(((RaycastHit)(ref hit2)).normal)) { return false; } float num3 = val2.y - ((RaycastHit)(ref hit2)).point.y; float num4 = ((RaycastHit)(ref hit2)).point.y - val2.y; if (num3 > 10f || num4 > 1.85f) { return false; } if (IsRoughTerrainLineBlocked(val2, ((RaycastHit)(ref hit2)).point)) { return false; } val2 = ((RaycastHit)(ref hit2)).point; } return true; } private Vector3 GetPlanProjectedEndPoint(PathPlan plan) { //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_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_0048: 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_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) if (plan.HasProjectedEndPoint) { return plan.ProjectedEndPoint; } if (IsClimbPlan(plan) && plan.ClimbTopPoint != Vector3.zero) { return plan.ClimbTopPoint; } return plan.Goal; } private float EstimatePlanStaminaCost(PathPlan plan) { //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) switch (plan.Action) { case PathActionType.Climb: case PathActionType.JumpGrab: case PathActionType.WallTraverse: case PathActionType.CornerClimb: case PathActionType.Mantle: case PathActionType.RopeClimb: return (plan.RequiredStamina > 0f) ? plan.RequiredStamina : EstimateRequiredClimbStamina(plan.EstimatedClimbHeight, plan.TargetAbove, plan.IsTallWall); case PathActionType.GapJump: return Mathf.Max(0.12f, plan.RequiredStamina); case PathActionType.AnchorAssist: return Mathf.Max(0.06f, plan.RequiredStamina); case PathActionType.Direct: case PathActionType.Detour: case PathActionType.SlopeWalk: return (plan.RequiredStamina > 0f) ? plan.RequiredStamina : EstimateGroundChaseCost(Vector3.Distance(_character.Center, plan.Goal)); case PathActionType.WaitForStamina: case PathActionType.Recover: return 0f; case PathActionType.DropDown: return plan.UsesJumpDropImmunity ? 0.08f : 0.02f; default: return 0f; } } private void RememberRouteChoice(PathPlan plan) { //IL_0003: 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_0018: 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_0066: 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) Vector3 direction = GetPlanProjectedEndPoint(plan) - _character.Center; direction.y = 0f; if (((Vector3)(ref direction)).sqrMagnitude > 0.01f) { ((Vector3)(ref direction)).Normalize(); } _recentRouteChoices.Add(new RouteChoiceMemory { Action = plan.Action, Position = GetPlanProjectedEndPoint(plan), Direction = direction, Until = Time.time + 5.5f }); if (_recentRouteChoices.Count > 24) { _recentRouteChoices.RemoveAt(0); } } private float GetRecentRouteChoicePenalty(PathPlan plan, Vector3 startPos) { //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_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_00a9: 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_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_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_00d8: 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) float num = 0f; Vector3 planProjectedEndPoint = GetPlanProjectedEndPoint(plan); Vector3 val = planProjectedEndPoint - startPos; val.y = 0f; if (((Vector3)(ref val)).sqrMagnitude > 0.01f) { ((Vector3)(ref val)).Normalize(); } for (int num2 = _recentRouteChoices.Count - 1; num2 >= 0; num2--) { RouteChoiceMemory routeChoiceMemory = _recentRouteChoices[num2]; if (Time.time >= routeChoiceMemory.Until) { _recentRouteChoices.RemoveAt(num2); } else if (routeChoiceMemory.Action == plan.Action) { float num3 = Vector3.Distance(planProjectedEndPoint, routeChoiceMemory.Position); float num4 = ((val == Vector3.zero || routeChoiceMemory.Direction == Vector3.zero) ? 0f : Vector3.Dot(val, routeChoiceMemory.Direction)); if (num3 <= 2.4f && num4 > 0.65f) { num += Mathf.InverseLerp(2.4f, 0.35f, num3) * 0.75f; } } } return num; } private List BuildGuideCandidatesFromCached(RouteSearchNode node, Vector3 originalBaseDir) { //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_000e: 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) RouteCandidateCacheKey key = MakeRouteCandidateCacheKey(node.Position, GetGoalCenter(), originalBaseDir); if (_guideCandidateCache.TryGetValue(key, out RouteCandidateCacheEntry value) && Time.time - value.CreatedAt <= 1.1f) { return ClonePlanList(value.Candidates); } List list = BuildGuideCandidatesFrom(node, originalBaseDir); RouteCandidateCacheEntry routeCandidateCacheEntry = new RouteCandidateCacheEntry { CreatedAt = Time.time }; for (int i = 0; i < list.Count; i++) { routeCandidateCacheEntry.Candidates.Add(ClonePlan(list[i])); } _guideCandidateCache[key] = routeCandidateCacheEntry; PruneGuidePlannerCaches(); return ClonePlanList(list); } private bool TryGetCachedGuidedPath(RoutePathCacheKey key, out List segments) { segments = new List(); if (_guidePathCache.TryGetValue(key, out RoutePathCacheEntry value)) { if (Time.time - value.CreatedAt <= 1.1f) { segments = ClonePlanList(value.Segments); return segments.Count > 0; } _guidePathCache.Remove(key); } if (SharedGuidePathCache.TryGetValue(key, out RoutePathCacheEntry value2)) { if (Time.time - value2.CreatedAt <= 2.5f) { segments = ClonePlanList(value2.Segments); return segments.Count > 0; } SharedGuidePathCache.Remove(key); } return false; } private void StoreGuidedPathCache(RoutePathCacheKey key, List segments) { RoutePathCacheEntry routePathCacheEntry = new RoutePathCacheEntry { CreatedAt = Time.time }; for (int i = 0; i < segments.Count; i++) { routePathCacheEntry.Segments.Add(ClonePlan(segments[i])); } _guidePathCache[key] = routePathCacheEntry; RoutePathCacheEntry routePathCacheEntry2 = new RoutePathCacheEntry { CreatedAt = Time.time }; for (int j = 0; j < segments.Count; j++) { routePathCacheEntry2.Segments.Add(ClonePlan(segments[j])); } SharedGuidePathCache[key] = routePathCacheEntry2; PruneGuidePlannerCaches(); } private List ClonePlanList(List source) { List list = new List(source.Count); for (int i = 0; i < source.Count; i++) { list.Add(ClonePlan(source[i])); } return list; } private RouteCandidateCacheKey MakeRouteCandidateCacheKey(Vector3 position, Vector3 goal, Vector3 dir) { //IL_0002: 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_0024: 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_0046: 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_0068: Unknown result type (might be due to invalid IL or missing references) return new RouteCandidateCacheKey(QuantizePlanner(position.x, 1.4f), QuantizePlanner(position.y, 1.4f), QuantizePlanner(position.z, 1.4f), QuantizePlanner(goal.x, 1.25f), QuantizePlanner(goal.y, 1.25f), QuantizePlanner(goal.z, 1.25f), QuantizeDirection(dir)); } private RoutePathCacheKey MakeRoutePathCacheKey(Vector3 start, Vector3 goal, bool lowerGoal) { //IL_0030: 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_0052: 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_0074: 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) int num = (lowerGoal ? 1 : 0); num = num * 10 + Mathf.Clamp(_stuckCount, 0, 3); num = num * 10 + Mathf.Clamp(_failedClimbCount, 0, 3); return new RoutePathCacheKey(QuantizePlanner(start.x, 1.4f), QuantizePlanner(start.y, 1.4f), QuantizePlanner(start.z, 1.4f), QuantizePlanner(goal.x, 1.25f), QuantizePlanner(goal.y, 1.25f), QuantizePlanner(goal.z, 1.25f), QuantizeStamina(GetStamina01()), num); } private RoutePlannerStateKey MakeRoutePlannerStateKey(Vector3 position, int depth, float stamina) { //IL_0002: 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_0024: Unknown result type (might be due to invalid IL or missing references) return new RoutePlannerStateKey(QuantizePlanner(position.x, 1.75f), QuantizePlanner(position.y, 1.75f), QuantizePlanner(position.z, 1.75f), depth, QuantizeStamina(stamina)); } private int QuantizePlanner(float value, float cell) { return Mathf.RoundToInt(value / Mathf.Max(0.01f, cell)); } private int QuantizeStamina(float stamina) { return Mathf.Clamp(Mathf.RoundToInt(stamina * 10f), 0, 14); } private int QuantizeDirection(Vector3 dir) { //IL_002c: 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) dir.y = 0f; if (((Vector3)(ref dir)).sqrMagnitude < 0.01f) { return 0; } ((Vector3)(ref dir)).Normalize(); float num = Mathf.Atan2(dir.x, dir.z) * 57.29578f; if (num < 0f) { num += 360f; } return Mathf.RoundToInt(num / 22.5f) & 0xF; } private void ClearGuidePlannerCaches() { _guideCandidateCache.Clear(); _spatialCandidateCache.Clear(); _guidePathCache.Clear(); _groundCorridorCache.Clear(); } private void PruneGuidePlannerCaches() { float time = Time.time; bool flag = SharedGuidePathCache.Count > 128; bool flag2 = _guideCandidateCache.Count > 128 || _spatialCandidateCache.Count > 128 || _guidePathCache.Count > 32; if (!(time < SharedNextGuideCachePruneTime) || flag || flag2) { SharedNextGuideCachePruneTime = time + 0.5f; PruneRoutePathCache(SharedGuidePathCache, SharedRoutePathRemovalScratch, 128, time, 5f); PruneRouteCandidateCache(_guideCandidateCache, 128, time, 2.2f); PruneRouteCandidateCache(_spatialCandidateCache, 128, time, 4.4f); PruneRoutePathCache(_guidePathCache, _pathCacheRemovalScratch, 32, time, Mathf.Max(1.1f, 2.2f) * 2f); } } private void PruneRouteCandidateCache(Dictionary cache, int maxEntries, float now, float maxAge) { if (cache.Count == 0 || (cache.Count <= maxEntries && maxAge <= 0f)) { return; } _candidateCacheRemovalScratch.Clear(); foreach (KeyValuePair item in cache) { if (now - item.Value.CreatedAt > maxAge) { _candidateCacheRemovalScratch.Add(item.Key); } } for (int i = 0; i < _candidateCacheRemovalScratch.Count; i++) { cache.Remove(_candidateCacheRemovalScratch[i]); } while (cache.Count > maxEntries) { RouteCandidateCacheKey key = default(RouteCandidateCacheKey); float num = float.PositiveInfinity; bool flag = false; foreach (KeyValuePair item2 in cache) { if (item2.Value.CreatedAt < num) { num = item2.Value.CreatedAt; key = item2.Key; flag = true; } } if (!flag) { break; } cache.Remove(key); } } private void PruneRoutePathCache(Dictionary cache, List scratch, int maxEntries, float now, float maxAge) { if (cache.Count == 0 || (cache.Count <= maxEntries && maxAge <= 0f)) { return; } scratch.Clear(); foreach (KeyValuePair item in cache) { if (now - item.Value.CreatedAt > maxAge) { scratch.Add(item.Key); } } for (int i = 0; i < scratch.Count; i++) { cache.Remove(scratch[i]); } while (cache.Count > maxEntries) { RoutePathCacheKey key = default(RoutePathCacheKey); float num = float.PositiveInfinity; bool flag = false; foreach (KeyValuePair item2 in cache) { if (item2.Value.CreatedAt < num) { num = item2.Value.CreatedAt; key = item2.Key; flag = true; } } if (!flag) { break; } cache.Remove(key); } } private bool IsViableClimbPlan(PathPlan plan) { //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) //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_00c6: Unknown result type (might be due to invalid IL or missing references) //IL_00cb: 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_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) //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_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) if (!IsClimbPlan(plan)) { return true; } float recoverableStaminaCeiling = GetRecoverableStaminaCeiling(); float num = ((plan.RequiredStamina > 0f) ? plan.RequiredStamina : EstimateRequiredClimbStamina(plan.EstimatedClimbHeight, plan.TargetAbove, plan.IsTallWall)); if (num > recoverableStaminaCeiling + 0.02f) { return false; } float num2 = EstimateMaxReachableClimbHeight(plan.TargetAbove, plan.NeedsJumpStart); if (plan.EstimatedClimbHeight > num2 + 0.35f) { return false; } if (_resolvedGoalIsStandable && plan.ClimbTopPoint != Vector3.zero) { Vector3 from = plan.ClimbTopPoint + Vector3.up * 0.25f; Vector3 to = _resolvedGoalPoint + Vector3.up * 0.25f; if (IsRoughTerrainLineBlocked(from, to)) { return false; } } return true; } private void FillClimbPlan(ref PathPlan plan, Vector3 anchor, float climbHeight, bool targetAbove, bool needsJumpStart, Vector3 topPoint, Vector3 surfaceNormal) { //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_002b: 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_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_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_00a1: 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_00b8: 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_00ba: Unknown result type (might be due to invalid IL or missing references) if (HasActiveGoal()) { plan.Action = PathActionType.Climb; plan.Goal = GetGoalLookPoint(); plan.Anchor = anchor; plan.TargetAbove = targetAbove; plan.EstimatedClimbHeight = climbHeight; plan.IsTallWall = climbHeight >= 2.15f; plan.RequiredStamina = EstimateRequiredClimbStamina(climbHeight, targetAbove, plan.IsTallWall); plan.ReachableWithinRecoverableBudget = plan.RequiredStamina <= GetRecoverableStaminaCeiling(); plan.NeedsJumpStart = needsJumpStart; plan.ClimbTopPoint = topPoint; plan.ClimbSurfaceNormal = surfaceNormal; plan.ProjectedEndPoint = ((topPoint != Vector3.zero) ? topPoint : plan.Goal); plan.HasProjectedEndPoint = true; } } private void TryForceJumpGrab(PathPlan plan, bool closeToAnchor) { //IL_00b9: 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) if (plan.NeedsJumpStart && closeToAnchor && _character.data.isGrounded && !(Time.time - _lastAutoJumpTime < 0.2f)) { if (!CanStartClimbWithRetryGate(plan)) { _character.input.jumpWasPressed = false; _character.input.jumpIsPressed = false; } else if (!(GetStamina01() < 0.18f)) { SetSprint(HasStaminaForSprint()); LookAt(plan.Goal); _character.input.movementInput = new Vector2(0f, 1f); _character.input.jumpWasPressed = true; _character.refs.climbing.TryClimb(1.6f); _lastAutoJumpTime = Time.time; } } } private RouteProbe ProbeRoute(Vector3 dir, float forwardDistance) { //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) TryProbeRouteFrom(_character.Center, dir, forwardDistance, out var probe); return probe; } private bool TryFindGround(Vector3 point, out RaycastHit hit) { //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_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_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_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_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) PhysicsProbeCacheKey key = MakePhysicsProbeCacheKey(point, point, 1); if (SharedGroundProbeCache.TryGetValue(key, out GroundProbeCacheEntry value) && Time.time - value.CreatedAt <= 0.18f) { hit = value.Hit; return value.Found; } bool flag = Physics.Raycast(point + Vector3.up * 2.2f, Vector3.down, ref hit, 16f, TerrainMask, (QueryTriggerInteraction)1); SharedGroundProbeCache[key] = new GroundProbeCacheEntry { Found = flag, Hit = hit, CreatedAt = Time.time }; PruneSharedPhysicsProbeCaches(); return flag; } private float EstimateRequiredClimbStamina(float climbHeight, bool targetAbove, bool tallWall) { float num = Mathf.Max(0.05f, climbHeight); float num2 = ((!(num <= 1.2f)) ? (0.54f + num * 0.135f) : (0.26f + num * 0.11f)); if (targetAbove) { num2 += 0.05f; } if (tallWall) { num2 += 0.06f; } if ((Object)(object)_character != (Object)null && (Object)(object)_character.data != (Object)null && (Object)(object)_character.data.carriedPlayer != (Object)null) { num2 += 0.1f + num * 0.035f; } if (_failedClimbCount > 0) { num2 += Mathf.Min(0.04f * (float)_failedClimbCount, 0.12f); } return Mathf.Clamp(num2, 0.2f, 1.35f); } private float EstimateMaxReachableClimbHeight(bool targetAbove, bool needsJumpStart) { float recoverableStaminaCeiling = GetRecoverableStaminaCeiling(); float num = 0.54f; if (targetAbove) { num += 0.05f; } if (needsJumpStart) { num += 0.04f; } if ((Object)(object)_character != (Object)null && (Object)(object)_character.data != (Object)null && (Object)(object)_character.data.carriedPlayer != (Object)null) { num += 0.1f; } float num2 = (recoverableStaminaCeiling - num) / 0.135f; return Mathf.Clamp(num2, 1.2f, 4.6f); } private bool ShouldAbortClimbForStamina(PathPlan climbPlan, float stamina, bool nearTopPoint, float climbedRatio) { //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_0066: Unknown result type (might be due to invalid IL or missing references) if (_character.OutOfStamina() || stamina <= 0.018f) { return true; } if (nearTopPoint) { return false; } if (climbPlan.ClimbTopPoint == Vector3.zero) { return false; } float num = climbPlan.ClimbTopPoint.y - _character.Center.y; if (num <= 0.55f) { return false; } float num2 = Mathf.Clamp(0.045f + num * 0.055f, 0.07f, 0.24f); if ((Object)(object)_character != (Object)null && (Object)(object)_character.data != (Object)null && (Object)(object)_character.data.carriedPlayer != (Object)null) { num2 += 0.045f; } return false; } private bool CanContinueClimb(PathPlan climbPlan) { //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_0061: 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) if (!HasActiveGoal()) { return false; } if (_character.OutOfStamina()) { return false; } float stamina = GetStamina01(); if (stamina <= 0.018f) { return false; } if (climbPlan.ClimbTopPoint != Vector3.zero && Vector3.Distance(_character.Center, climbPlan.ClimbTopPoint) < 1.35f) { return stamina >= 0.018f; } return stamina >= 0.018f; } private float GetFullStaminaRetryThreshold() { return GetFullStaminaClimbStartThreshold(_plan); } private bool HasRecoveredFullStaminaForRetry() { return GetStamina01() >= GetFullStaminaRetryThreshold(); } private Vector3 GetFullStaminaRetryAnchor(PathPlan plan) { //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_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_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_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_0038: 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_00ae: 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_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) if (plan.Anchor != Vector3.zero) { return plan.Anchor; } if (plan.ClimbTopPoint != Vector3.zero) { Vector3 val = plan.ClimbTopPoint - _character.Center; val.y = 0f; if (((Vector3)(ref val)).sqrMagnitude > 0.01f) { return _character.Center + ((Vector3)(ref val)).normalized * Mathf.Min(1.2f, ((Vector3)(ref val)).magnitude); } } return _character.Center; } private void ResetFullStaminaClimbRetry() { //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) _activeClimbStartedAtRetryFullStamina = false; _awaitingFullStaminaClimbRetry = false; _fullStaminaClimbRetryConsumed = false; _fullStaminaClimbRetryAnchor = Vector3.zero; _fullStaminaClimbRetryGoalSerial = _goalInstructionSerial; } private void RefreshFullStaminaClimbRetrySite(PathPlan plan) { //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_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) if (!(_fullStaminaClimbRetryAnchor == Vector3.zero)) { Vector3 fullStaminaRetryAnchor = GetFullStaminaRetryAnchor(plan); if (Vector3.Distance(fullStaminaRetryAnchor, _fullStaminaClimbRetryAnchor) > 2.75f) { ResetFullStaminaClimbRetry(); } } } private bool IsWaitingForFullStaminaClimbRetry(PathPlan plan) { if (!_awaitingFullStaminaClimbRetry) { return false; } if (_fullStaminaClimbRetryGoalSerial != _goalInstructionSerial) { ResetFullStaminaClimbRetry(); return false; } if (IsClimbPlan(plan)) { RefreshFullStaminaClimbRetrySite(plan); } return _awaitingFullStaminaClimbRetry; } private bool IsFullStaminaRetryPendingForCurrentGoal() { if (!_awaitingFullStaminaClimbRetry) { return false; } if (_fullStaminaClimbRetryGoalSerial != _goalInstructionSerial) { ResetFullStaminaClimbRetry(); return false; } return !HasRecoveredFullStaminaForRetry(); } private bool CanStartClimbWithRetryGate(PathPlan plan) { if (!IsClimbPlan(plan)) { return true; } if (IsWaitingForFullStaminaClimbRetry(plan)) { return HasRecoveredFullStaminaForRetry(); } return HasEnoughStaminaToStartClimb(plan); } private bool TryArmFullStaminaClimbRetry(PathPlan plan) { //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 (!IsClimbPlan(plan)) { return false; } if (_fullStaminaClimbRetryGoalSerial != _goalInstructionSerial) { ResetFullStaminaClimbRetry(); } RefreshFullStaminaClimbRetrySite(plan); if (_awaitingFullStaminaClimbRetry) { return true; } _awaitingFullStaminaClimbRetry = true; _fullStaminaClimbRetryConsumed = false; _fullStaminaClimbRetryAnchor = GetFullStaminaRetryAnchor(plan); _fullStaminaClimbRetryGoalSerial = _goalInstructionSerial; return true; } private void MarkFullStaminaClimbRetryAttemptStarted(PathPlan plan) { //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) if (IsWaitingForFullStaminaClimbRetry(plan)) { _awaitingFullStaminaClimbRetry = false; _fullStaminaClimbRetryConsumed = true; _fullStaminaClimbRetryAnchor = GetFullStaminaRetryAnchor(plan); _fullStaminaClimbRetryGoalSerial = _goalInstructionSerial; } } private void EnterPrepareTallClimb() { StopClimb(); ClearLockedClimbPlan(); SetSprint(sprinting: false); _brainState = RobotBrainState.PrepareTallClimb; } private void EnterReposition() { StopClimb(); ClearLockedClimbPlan(); SetSprint(sprinting: false); _repositionUntil = Time.time + 1.1f; _brainState = RobotBrainState.Reposition; } private bool CanSeeGoal() { //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) //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) if (!HasActiveGoal()) { return false; } return !IsRoughTerrainLineBlocked(_character.Head, GetGoalCenter() + Random.insideUnitSphere * 0.35f); } private void RefreshTargetIfNeeded() { //IL_003b: 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_0072: 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_00b9: Unknown result type (might be due to invalid IL or missing references) if (Time.time < _nextTargetRefreshTime) { return; } _nextTargetRefreshTime = Time.time + 0.2f; if (PingTargetTracker.TryGetBestPingDataForRobot(_character, _spawnOwnerActorNumber, _character.Center, out var data)) { Character ownerCharacter = data.OwnerCharacter; Vector3 point = data.Point; bool flag = data.Sequence != _lastAcceptedPingSequence; bool flag2 = HasGoalPointChanged(point); _ownerCharacter = ownerCharacter; _target = ownerCharacter; _goalPoint = point; _hasGoalPoint = true; _allowGoalParking = true; _zombie.currentTarget = ownerCharacter; if (flag || flag2) { ResetRouteForNewGoal(point, data.Sequence); _lastAcceptedPingSequence = data.Sequence; _brainState = RobotBrainState.Chase; } } else { _ownerCharacter = null; _target = null; _hasGoalPoint = false; _hasResolvedGoalPoint = false; _hasLastResolvedRawGoal = false; _allowGoalParking = true; _lastAcceptedPingSequence = 0; _zombie.currentTarget = null; _segmentQueue.Clear(); ClearActiveSegment(); ClearLockedClimbPlan(); ResetFullStaminaClimbRetry(); _hadAcceptedGoalPoint = false; } } private void RefreshResolvedGoalIfNeeded() { //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_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_0097: 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_00a5: Unknown result type (might be due to invalid IL or missing references) //IL_00dd: Unknown result type (might be due to invalid IL or missing references) //IL_00bc: 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_00e8: 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_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_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) if (!HasActiveGoal()) { _hasResolvedGoalPoint = false; _resolvedGoalIsStandable = false; _rawGoalIsStandable = false; _hasLastResolvedRawGoal = false; return; } Vector3 rawGoalCenter = GetRawGoalCenter(); if ((_hasLastResolvedRawGoal && _hasResolvedGoalPoint && Vector3.Distance(_lastResolvedRawGoal, rawGoalCenter) <= 0.08f) || Time.time < _nextResolvedGoalRefreshTime) { return; } _nextResolvedGoalRefreshTime = Time.time + 1.5f; _lastResolvedRawGoal = rawGoalCenter; _hasLastResolvedRawGoal = true; if (TryProbeExactStandableGoal(rawGoalCenter, out var standPoint)) { _rawGoalIsStandable = true; _resolvedGoalPoint = standPoint; _hasResolvedGoalPoint = true; _resolvedGoalIsStandable = true; return; } _rawGoalIsStandable = false; if (TryFindStandableNearGoal(rawGoalCenter, out var standPoint2) || TryFindStandableAccessNearNonStandableGoal(rawGoalCenter, out standPoint2)) { if (_hasResolvedGoalPoint && Vector3.Distance(_resolvedGoalPoint, standPoint2) <= 0.9f) { _resolvedGoalIsStandable = true; return; } _resolvedGoalPoint = standPoint2; _hasResolvedGoalPoint = true; _resolvedGoalIsStandable = true; } else { _resolvedGoalPoint = rawGoalCenter; _hasResolvedGoalPoint = true; _resolvedGoalIsStandable = false; } } private bool TryProbeExactStandableGoal(Vector3 rawGoal, out Vector3 standPoint) { //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_000d: 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_0031: 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_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_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_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_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_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_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_0100: 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_016f: Unknown result type (might be due to invalid IL or missing references) //IL_0174: Unknown result type (might be due to invalid IL or missing references) //IL_012a: Unknown result type (might be due to invalid IL or missing references) standPoint = Vector3.zero; if (!TryFindGround(rawGoal, out var hit)) { return false; } if (!IsSafeStandableRoutePoint(((RaycastHit)(ref hit)).point, ((RaycastHit)(ref hit)).normal, requireSupport: false)) { return false; } float num = HelperFunctions.FlatDistance(((RaycastHit)(ref hit)).point, rawGoal); float num2 = Mathf.Abs(((RaycastHit)(ref hit)).point.y - rawGoal.y); if (num > 1.05f || num2 > 1.2f) { return false; } int num3 = 0; Vector3[] standSupportDirections = StandSupportDirections; RaycastHit val2 = default(RaycastHit); for (int i = 0; i < standSupportDirections.Length; i++) { Vector3 val = ((RaycastHit)(ref hit)).point + standSupportDirections[i] * 0.45f; if (Physics.Raycast(val + Vector3.up * 0.65f, Vector3.down, ref val2, 2.05f, TerrainMask, (QueryTriggerInteraction)1)) { float num4 = Mathf.Abs(((RaycastHit)(ref val2)).point.y - ((RaycastHit)(ref hit)).point.y); if (num4 <= 1.05f && IsRoughStandableNormal(((RaycastHit)(ref val2)).normal)) { num3++; } } } if (num3 < 2) { return false; } standPoint = ((RaycastHit)(ref hit)).point; return true; } private bool TryFindStandableNearGoal(Vector3 rawGoal, out Vector3 standPoint) { //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_0022: 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_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_0032: 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_0054: 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_00a7: Unknown result type (might be due to invalid IL or missing references) //IL_00b0: Unknown result type (might be due to invalid IL or missing references) //IL_00ba: Unknown result type (might be due to invalid IL or missing references) //IL_00bf: Unknown result type (might be due to invalid IL or missing references) //IL_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_00c8: Unknown result type (might be due to invalid IL or missing references) //IL_00d2: Unknown result type (might be due to invalid IL or missing references) //IL_00d7: Unknown result type (might be due to invalid IL or missing references) //IL_00dc: 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_0108: 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_0187: Unknown result type (might be due to invalid IL or missing references) //IL_018e: Unknown result type (might be due to invalid IL or missing references) //IL_0126: 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_01f2: 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) standPoint = Vector3.zero; Vector3[] goalStandOffsets = GoalStandOffsets; bool flag = false; float num = float.NegativeInfinity; RaycastHit val2 = default(RaycastHit); for (int i = 0; i < goalStandOffsets.Length; i++) { Vector3 point = rawGoal + goalStandOffsets[i]; if (!TryFindGround(point, out var hit) || !IsSafeStandableRoutePoint(((RaycastHit)(ref hit)).point, ((RaycastHit)(ref hit)).normal, requireSupport: false)) { continue; } float num2 = Vector3.Distance(((RaycastHit)(ref hit)).point, rawGoal); if (num2 > 1.95f) { continue; } int num3 = 0; Vector3[] standSupportDirections = StandSupportDirections; for (int j = 0; j < standSupportDirections.Length; j++) { Vector3 val = ((RaycastHit)(ref hit)).point + standSupportDirections[j] * 0.45f; if (Physics.Raycast(val + Vector3.up * 0.65f, Vector3.down, ref val2, 2.05f, TerrainMask, (QueryTriggerInteraction)1)) { float num4 = Mathf.Abs(((RaycastHit)(ref val2)).point.y - ((RaycastHit)(ref hit)).point.y); if (num4 <= 1.05f && IsRoughStandableNormal(((RaycastHit)(ref val2)).normal)) { num3++; } } } if (num3 <= 0) { continue; } bool flag2 = !IsRoughTerrainLineBlocked(((RaycastHit)(ref hit)).point, rawGoal); float num5 = Vector3.Distance(_character.Center, ((RaycastHit)(ref hit)).point); float num6 = 0f; num6 -= num2 * 2.1f; num6 += (float)num3 * 1.25f; if (flag2) { num6 += 1.2f; } num6 -= num5 * 0.08f; if (_hasResolvedGoalPoint) { float num7 = Vector3.Distance(_resolvedGoalPoint, ((RaycastHit)(ref hit)).point); if (num7 <= 0.9f) { num6 += 1f; } } if (!flag || num6 > num) { flag = true; num = num6; standPoint = ((RaycastHit)(ref hit)).point; } } return flag; } private bool TryFindStandableAccessNearNonStandableGoal(Vector3 rawGoal, out Vector3 standPoint) { //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_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_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_0055: Unknown result type (might be due to invalid IL or missing references) //IL_0056: Unknown result type (might be due to invalid IL or missing references) //IL_0058: Unknown result type (might be due to invalid IL or missing references) //IL_005d: Unknown result type (might be due to invalid IL or missing references) //IL_0067: Unknown result type (might be due to invalid IL or missing references) //IL_006c: Unknown result type (might be due to invalid IL or missing references) //IL_0071: Unknown result type (might be due to invalid IL or missing references) //IL_0073: 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_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_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_00e5: 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_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_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_0159: 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_0164: 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_0193: 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_0233: 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) standPoint = Vector3.zero; float[] nonStandableGoalAccessRadii = NonStandableGoalAccessRadii; float[] nonStandableGoalAccessAngles = NonStandableGoalAccessAngles; bool flag = false; float num = float.NegativeInfinity; RaycastHit val3 = default(RaycastHit); for (int i = 0; i < nonStandableGoalAccessRadii.Length; i++) { for (int j = 0; j < nonStandableGoalAccessAngles.Length; j++) { Vector3 val = Quaternion.AngleAxis(nonStandableGoalAccessAngles[j], Vector3.up) * Vector3.forward * nonStandableGoalAccessRadii[i]; Vector3 val2 = rawGoal + val + Vector3.up * 7f; if (!Physics.Raycast(val2, Vector3.down, ref val3, 13.5f, TerrainMask, (QueryTriggerInteraction)1) || !IsSafeStandableRoutePoint(((RaycastHit)(ref val3)).point, ((RaycastHit)(ref val3)).normal, requireSupport: false)) { continue; } float num2 = HelperFunctions.FlatDistance(((RaycastHit)(ref val3)).point, rawGoal); if (!(num2 > 5.85f)) { float num3 = ((RaycastHit)(ref val3)).point.y - rawGoal.y; float num4 = ((num3 < -0.45f) ? (Mathf.Abs(num3) * 1.85f + 1.4f) : 0f); float num5 = ((num3 > 5.8f) ? ((num3 - 5.8f) * 1.2f) : 0f); bool flag2 = !IsRoughTerrainLineBlocked(((RaycastHit)(ref val3)).point + Vector3.up * 0.15f, rawGoal + Vector3.up * 0.15f); float num6 = (((Object)(object)_character != (Object)null) ? Vector3.Distance(_character.Center, ((RaycastHit)(ref val3)).point) : 0f); float num7 = 0f; num7 -= num2 * 1.35f; num7 -= Mathf.Abs(num3) * 0.75f; num7 -= num4; num7 -= num5; num7 -= num6 * 0.06f; if (num3 >= -0.35f) { num7 += 1.6f; } if (flag2) { num7 += 0.8f; } if (!flag || num7 > num) { flag = true; num = num7; standPoint = ((RaycastHit)(ref val3)).point; } } } } return flag; } private bool TryBuildObstacleBypassJumpPlanFrom(Vector3 startPos, Vector3 dir, RouteProbe directProbe, out PathPlan plan) { //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_0067: Unknown result type (might be due to invalid IL or missing references) //IL_006c: Unknown result type (might be due to invalid IL or missing references) //IL_0071: Unknown result type (might be due to invalid IL or missing references) //IL_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_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_0087: 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_00b1: 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_010a: 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_011a: 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_0150: 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_017f: 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_0193: 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_01bc: 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) //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_01e3: 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) //IL_01f0: 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_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_0233: 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_0245: Unknown result type (might be due to invalid IL or missing references) //IL_024a: Unknown result type (might be due to invalid IL or missing references) //IL_02c9: Unknown result type (might be due to invalid IL or missing references) plan = new PathPlan(); if (!directProbe.ObstacleAhead || directProbe.ClimbableAhead) { return false; } if (directProbe.ObstacleDistance < 0.45f || directProbe.ObstacleDistance > 2.2f) { return false; } float num = -999f; Vector3 val = directProbe.ObstaclePoint + dir * 0.12f + Vector3.up * 2.35f; RaycastHit val2 = default(RaycastHit); if (Physics.Raycast(val, Vector3.down, ref val2, 2.75f, TerrainMask, (QueryTriggerInteraction)1)) { num = ((RaycastHit)(ref val2)).point.y - startPos.y; } if (num < 0.28f || num > 1.55f) { return false; } float[] obstacleLandingOffsets = ObstacleLandingOffsets; bool flag = false; float num2 = float.NegativeInfinity; PathPlan pathPlan = new PathPlan(); for (int i = 0; i < obstacleLandingOffsets.Length; i++) { float num3 = directProbe.ObstacleDistance + obstacleLandingOffsets[i]; Vector3 point = startPos + dir * num3; if (!TryFindGround(point, out var hit) || !IsRoughStandableNormal(((RaycastHit)(ref hit)).normal)) { continue; } float num4 = Mathf.Abs(((RaycastHit)(ref hit)).point.y - startPos.y); if (num4 > 0.9f) { continue; } float num5 = HelperFunctions.FlatDistance(((RaycastHit)(ref hit)).point, GetGoalCenter()); float num6 = HelperFunctions.FlatDistance(startPos, GetGoalCenter()); float num7 = num6 - num5; if (num7 < 0.35f) { continue; } Vector3 from = startPos + Vector3.up * 1f; Vector3 to = ((RaycastHit)(ref hit)).point + Vector3.up * 1f; if (!IsRoughTerrainLineBlocked(from, to)) { PathPlan pathPlan2 = new PathPlan { Action = PathActionType.GapJump, Anchor = startPos + dir * Mathf.Clamp(directProbe.ObstacleDistance - 0.1f, 0.55f, 1.25f), Goal = ((RaycastHit)(ref hit)).point, TargetAbove = false, RequiredStamina = Mathf.Clamp(0.1f + num * 0.06f, 0.1f, 0.22f), ReachableWithinRecoverableBudget = true, Score = 0f }; float num8 = 0f; num8 += num7 * 1.8f; num8 -= num4 * 0.45f; num8 -= Mathf.Abs(num - 0.9f) * 0.2f; num8 -= GetBlockedPenalty(((RaycastHit)(ref hit)).point); num8 = (pathPlan2.Score = num8 - GetFailedSegmentPenalty(pathPlan2)); if (!flag || num8 > num2) { flag = true; num2 = num8; pathPlan = pathPlan2; } } } if (flag) { plan = pathPlan; return true; } return false; } private void ValidateTarget() { if ((Object)(object)_target == (Object)null) { _hasGoalPoint = false; _hasResolvedGoalPoint = false; return; } bool flag = IsCarryAssistTarget(_target); if (_target.isBot || _target.data.dead || (_target.data.fullyPassedOut && !flag)) { _target = null; _hasGoalPoint = false; _hasResolvedGoalPoint = false; _zombie.currentTarget = null; if (flag) { DisableCarryAssist(); } } } private void UpdateStuckDetection() { //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_0076: 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_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) if (_brainState != RobotBrainState.Chase && _brainState != RobotBrainState.Reposition && _brainState != RobotBrainState.PrepareTallClimb) { _stuckAnchor = _character.Center; _stuckTimer = 0f; return; } _stuckTimer += Time.deltaTime; if (!(_stuckTimer < 1f)) { float num = Vector3.Distance(_character.Center, _stuckAnchor); if (num < 0.7f) { _stuckCount++; } else { _stuckCount = 0; } _stuckAnchor = _character.Center; _stuckTimer = 0f; } } private void UpdateClimbFailureDetection() { //IL_0070: 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_008b: 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_00e6: 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_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_0114: 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_022d: Unknown result type (might be due to invalid IL or missing references) //IL_0232: Unknown result type (might be due to invalid IL or missing references) //IL_023e: 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_019a: 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_01ab: Unknown result type (might be due to invalid IL or missing references) if (!_character.data.isClimbing && !_character.data.isRopeClimbing && !_character.data.isVineClimbing) { _climbTimer = 0f; return; } if (_climbTimer <= 0f) { _climbStartHeight = _character.Center.y; _stuckAnchor = _character.Center; _activeClimbStartedAtRetryFullStamina = HasRecoveredFullStaminaForRetry(); } _climbTimer += Time.deltaTime; if (_climbTimer < 2.2f) { return; } float num = _character.Center.y - _climbStartHeight; float num2 = Vector3.Distance(_character.Center, _stuckAnchor); bool flag = _plan.ClimbTopPoint != Vector3.zero && Vector3.Distance(_character.Center, _plan.ClimbTopPoint) < 1.35f; if (!(num >= 0.18f || num2 >= 0.45f || flag)) { PathPlan activeClimbPlan = GetActiveClimbPlan(); _failedClimbCount++; if (_failedClimbCount < 3 && TryArmFullStaminaClimbRetry(activeClimbPlan)) { EnterPrepareTallClimb(); _stuckAnchor = _character.Center; _climbStartHeight = _character.Center.y; _climbTimer = 0f; return; } RegisterBlockedPoint(_character.Center, 2f); RouteFailureReason reason = ((activeClimbPlan.Action == PathActionType.JumpGrab || activeClimbPlan.NeedsJumpStart) ? RouteFailureReason.JumpGrabFailed : RouteFailureReason.WallLost); RegisterFailedSegment(activeClimbPlan, reason); StopClimb(); ClearLockedClimbPlan(); EnterReposition(); } else { _failedClimbCount = 0; } _stuckAnchor = _character.Center; _climbStartHeight = _character.Center.y; _climbTimer = 0f; } private bool HasEnoughStaminaForPassiveClimbProbe() { if ((Object)(object)_character == (Object)null || (Object)(object)_character.data == (Object)null) { return false; } if (IsLowStaminaForHeavyAction()) { return false; } if (IsFullStaminaRetryPendingForCurrentGoal()) { return false; } if (IsTimeCriticalClimbStart(_plan)) { return HasEnoughStaminaForTimeCriticalClimb(_plan); } return HasRecoveredFullStaminaForClimbStart(_plan); } private void WalkTowards(Vector3 targetPos, float mult, bool tryClimb, bool tryJump, bool sprintRequested) { //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_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_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_00a6: 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_015d: 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_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_01a2: 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_01c2: 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_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_01de: 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_01e8: 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_01f7: 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_0208: Unknown result type (might be due to invalid IL or missing references) //IL_0262: 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) float num = HelperFunctions.FlatDistance(_character.Center, targetPos); float num2 = Vector3.Distance(_character.Center, targetPos); if (num < 0.55f && num2 < 1.1f) { mult *= 0.35f; } else if (num < 1.2f && num2 < 2.8f) { mult *= 0.7f; } bool flag = IsLowStaminaForHeavyAction(); _character.input.movementInput = new Vector2(0f, mult); SetSprint(sprintRequested && HasStaminaForSprint()); LookAt(targetPos); if (tryClimb && HasEnoughStaminaForPassiveClimbProbe()) { _character.refs.climbing.TryClimb(1.25f); } if (!tryJump || !_character.data.isGrounded || Time.time - _lastAutoJumpTime < 0.12f) { return; } bool flag2 = flag && IsFlatTravelHopAllowed(targetPos); if (!flag2 && _character.GetTotalStamina() < 0.16f) { return; } Vector3 val = targetPos - _character.Center; val.y = 0f; if (!(((Vector3)(ref val)).sqrMagnitude < 0.01f)) { ((Vector3)(ref val)).Normalize(); bool flag3 = !flag && ShouldHopSmallObstacleTowards(targetPos); int num3; if (!flag) { RaycastHit val2 = HelperFunctions.LineCheck(_character.Center + val * 0.65f, _character.Center + val * 0.65f + Vector3.down * 3f, (LayerType)1, 0f, (QueryTriggerInteraction)1); num3 = (((Object)(object)((RaycastHit)(ref val2)).transform == (Object)null) ? 1 : 0); } else { num3 = 0; } bool flag4 = (byte)num3 != 0; if (flag3 || flag4 || flag2) { SetSprint(!flag && HasStaminaForSprint()); _character.input.movementInput = new Vector2(0f, Mathf.Max(mult, 1f)); _character.input.jumpWasPressed = true; _lastAutoJumpTime = Time.time; } } } private Vector2 ComputeStrategicClimbInput(Vector3 targetPos, PathPlan climbPlan) { //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_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_00b4: 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_00bb: 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_01c9: 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_0054: Unknown result type (might be due to invalid IL or missing references) //IL_016f: Unknown result type (might be due to invalid IL or missing references) //IL_0174: Unknown result type (might be due to invalid IL or missing references) //IL_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_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_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_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_018b: 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_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_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) Bodypart bodypart = _character.GetBodypart((BodypartType)2); if ((Object)(object)bodypart == (Object)null) { return new Vector2(0f, 1f); } Vector3 val = targetPos; if (IsClimbPlan(climbPlan)) { if (TryFindLateralTraversePoint(climbPlan, out var point)) { val = point; } else if (_resolvedGoalIsStandable) { val = _resolvedGoalPoint + Vector3.up * 0.1f; } else if (climbPlan.ClimbTopPoint != Vector3.zero) { val = Vector3.Lerp(climbPlan.ClimbTopPoint, targetPos, 0.7f); } } Vector3 val2 = ((Component)bodypart).transform.InverseTransformPoint(val); float num = Mathf.Clamp(val2.x * 0.9f, -1f, 1f); float num2 = Mathf.Clamp(val2.y * 0.45f + 0.95f, 0.7f, 1f); float num3 = Mathf.Abs(num); if (num3 > 0.65f) { num = Mathf.Sign(num) * 0.95f; num2 = Mathf.Max(num2, 0.95f); } else if (num3 > 0.25f) { num = Mathf.Sign(num) * 0.6f; num2 = Mathf.Max(num2, 0.92f); } else { num2 = Mathf.Max(num2, 1f); } if (climbPlan.ClimbTopPoint != Vector3.zero) { float num4 = Vector3.Distance(_character.Center, climbPlan.ClimbTopPoint); if (num4 < 1.25f) { num2 = Mathf.Max(num2, 0.95f); } } return new Vector2(num, num2); } private bool TryFindLateralTraversePoint(PathPlan climbPlan, out Vector3 point) { //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_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_0063: 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_0073: 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_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_0055: 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_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_00a8: 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_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_011d: 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_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_0132: 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_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_016c: 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_017b: Unknown result type (might be due to invalid IL or missing references) //IL_01bb: Unknown result type (might be due to invalid IL or missing references) //IL_01bd: Unknown result type (might be due to invalid IL or missing references) point = Vector3.zero; if (!IsClimbPlan(climbPlan)) { return false; } if (climbPlan.ClimbSurfaceNormal == Vector3.zero) { return false; } if (TryFindCornerAwareTraversePoint(climbPlan, out var point2)) { point = point2; return true; } Vector3 val = Vector3.Cross(Vector3.up, climbPlan.ClimbSurfaceNormal); Vector3 normalized = ((Vector3)(ref val)).normalized; if (normalized == Vector3.zero) { return false; } Vector3 val2 = GetGoalLookPoint() - _character.Center; val2.y = 0f; float num = Mathf.Sign(Vector3.Dot(((Vector3)(ref val2)).normalized, normalized)); if (Mathf.Approximately(num, 0f)) { num = 1f; } bool flag = false; float num2 = float.NegativeInfinity; for (int i = 0; i < 2; i++) { float num3 = ((i == 0) ? num : (0f - num)); for (int j = 0; j < LateralTraverseSamples.Length; j++) { float num4 = LateralTraverseSamples[j]; Vector3 val3 = _character.Center + normalized * (num3 * num4) + Vector3.up * 0.15f; if (!IsRoughTerrainLineBlocked(_character.Center, val3)) { bool flag2 = IsRoughTerrainLineBlocked(val3, GetGoalLookPoint()); float num5 = 0f - Vector3.Distance(val3, GetGoalLookPoint()); if (!flag2) { num5 += 2f; } if (!flag || num5 > num2) { flag = true; num2 = num5; point = val3; } } } } return flag; } private void StopClimb() { if (_character.data.isClimbing || _character.data.isRopeClimbing || _character.data.isVineClimbing) { _character.refs.climbing.StopClimbing(); } } private void LookAt(Vector3 lookAtPos) { //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_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) _character.data.lookValues = Vector2.op_Implicit(HelperFunctions.DirectionToLook(lookAtPos - _character.Head)); } private void SetSprint(bool sprinting) { bool flag = sprinting && HasStaminaForSprint(); _character.input.sprintIsPressed = flag; if (flag != _character.data.isSprinting) { _character.data.isSprinting = flag; } } private void SyncVisualState() { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_000d: Invalid comparison between Unknown and I4 //IL_0056: 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_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) bool flag = (int)_zombie.currentState == 4; bool flag2 = !_hasVisualStateSnapshot; if (!_hasVisualStateSnapshot || _lastVisualBiteColliderEnabled != flag) { _zombie.SetBiteColliderProxy(flag); _lastVisualBiteColliderEnabled = flag; flag2 = true; } if (!_hasVisualStateSnapshot || _lastVisualZombieState != _zombie.currentState) { _zombie.UpdateMouthProxy(); _lastVisualZombieState = _zombie.currentState; flag2 = true; } bool isSprinting = _character.data.isSprinting; if (!_hasVisualStateSnapshot || _lastVisualSprintState != isSprinting) { _lastVisualSprintState = isSprinting; flag2 = true; } _hasVisualStateSnapshot = true; if (flag2) { ForcePushState(); } } private void ForcePushState() { try { PushStateMethod?.Invoke(_zombie, null); } catch (Exception arg) { Plugin.Log.LogDebug((object)$"PushState invoke failed: {arg}"); } } private bool TryProbeRouteFrom(Vector3 startPos, Vector3 dir, float forwardDistance, out RouteProbe probe) { //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_002a: 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_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_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_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_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_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_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_0085: 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_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_00a8: 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_01b2: 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_01be: 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_0155: 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_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_01d4: 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_01f6: Unknown result type (might be due to invalid IL or missing references) //IL_01fb: 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_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_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_00e7: 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_00e9: 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_0292: 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_010e: 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_013a: 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_02ad: 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) probe = default(RouteProbe); Bodypart bodypart = _character.GetBodypart((BodypartType)2); Vector3 val = (((Object)(object)bodypart != (Object)null) ? ((Component)bodypart).transform.position : startPos); Vector3 val2 = val - _character.Center; Vector3 val3 = startPos + val2 + Vector3.up * 0.25f; bool preferJumpGrab = HasActiveGoal() && GetGoalCenter().y - startPos.y > 0.9f; RaycastHit val4 = default(RaycastHit); if (Physics.SphereCast(val3, 0.38f, dir, ref val4, forwardDistance, TerrainMask, (QueryTriggerInteraction)1)) { bool flag = IsTrivialRoughGroundHit(startPos, dir, val4); if (!flag) { probe.ObstacleAhead = true; probe.ObstacleDistance = ((RaycastHit)(ref val4)).distance; probe.ObstaclePoint = ((RaycastHit)(ref val4)).point; } if (!flag && TryProbeClimbableFrom(startPos, dir, val4, out var climbBase, out var climbHeight, out var climbTopPoint, out var surfaceNormal)) { probe.ClimbableAhead = true; probe.ClimbBasePoint = climbBase; probe.ClimbHeightDelta = climbHeight; probe.NeedsJumpStart = climbHeight >= 1f; probe.ClimbTopPoint = climbTopPoint; probe.ClimbSurfaceNormal = surfaceNormal; } } if (!probe.ClimbableAhead && TryProbeAnyClimbableAheadFrom(startPos, dir, Mathf.Max(forwardDistance, 1.9f), preferJumpGrab, out var climbBase2, out var climbHeight2, out var needsJumpStart, out var climbTopPoint2, out var surfaceNormal2)) { probe.ClimbableAhead = true; probe.ClimbBasePoint = climbBase2; probe.ClimbHeightDelta = climbHeight2; probe.NeedsJumpStart = needsJumpStart; probe.ClimbTopPoint = climbTopPoint2; probe.ClimbSurfaceNormal = surfaceNormal2; } Vector3 point = startPos + dir * forwardDistance; if (TryFindGround(point, out var hit)) { float num = (probe.DropHeight = startPos.y - ((RaycastHit)(ref hit)).point.y); probe.DropLandingPoint = ((RaycastHit)(ref hit)).point; if (num > 0.5f && num <= 10f) { probe.SafeWalkDrop = true; } if (num > 10f) { probe.UnsafeDropAhead = true; } if (num > 0.5f && num <= 20f) { probe.SafeJumpDrop = true; } } else { probe.UnsafeDropAhead = true; probe.DropHeight = 21f; } if (probe.UnsafeDropAhead && TryProbeGapJumpFrom(startPos, dir, out var landingPoint, out var landingDrop)) { probe.GapJumpable = true; probe.GapLandingPoint = landingPoint; probe.GapLandingDrop = landingDrop; } return true; } private bool IsTrivialRoughGroundHit(Vector3 center, Vector3 dir, RaycastHit hit) { //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_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_0045: Unknown result type (might be due to invalid IL or missing references) //IL_0046: Unknown result type (might be due to invalid IL or missing references) //IL_0063: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_006d: 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_0089: 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_00ae: 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_00c2: Unknown result type (might be due to invalid IL or missing references) Vector3 normal = ((RaycastHit)(ref hit)).normal; if (((Vector3)(ref normal)).sqrMagnitude >= 0.01f && Vector3.Angle(((RaycastHit)(ref hit)).normal, Vector3.up) <= 68f) { return true; } Vector3 point = center + dir * Mathf.Clamp(((RaycastHit)(ref hit)).distance + 0.55f, 0.45f, 1.65f); if (!TryFindGround(point, out var hit2)) { return false; } if (!IsRoughStandableNormal(((RaycastHit)(ref hit2)).normal)) { return false; } float num = ((RaycastHit)(ref hit2)).point.y - center.y; float num2 = ((RaycastHit)(ref hit)).point.y - center.y; return num >= -0.9f && num <= 0.72f && num2 <= 0.85f; } private bool TryProbeClimbableFrom(Vector3 center, Vector3 dir, RaycastHit obstacleHit, out Vector3 climbBase, out float climbHeight, out Vector3 climbTopPoint, out Vector3 surfaceNormal) { //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_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_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_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_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_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_005a: 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_008e: 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_00cd: Unknown result type (might be due to invalid IL or missing references) //IL_00ef: Unknown result type (might be due to invalid IL or missing references) //IL_00f4: Unknown result type (might be due to invalid IL or missing references) //IL_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_011c: 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_0125: 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_0113: Unknown result type (might be due to invalid IL or missing references) //IL_012a: Unknown result type (might be due to invalid IL or missing references) //IL_0132: 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_014d: 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_016f: Unknown result type (might be due to invalid IL or missing references) climbBase = Vector3.zero; climbHeight = 0f; climbTopPoint = Vector3.zero; surfaceNormal = Vector3.zero; Vector3 val = ((RaycastHit)(ref obstacleHit)).point + dir * 0.45f + Vector3.up * 5.2f; RaycastHit val2 = default(RaycastHit); if (!Physics.Raycast(val, Vector3.down, ref val2, 6.2f, TerrainMask, (QueryTriggerInteraction)1)) { return false; } climbHeight = ((RaycastHit)(ref val2)).point.y - center.y; if (climbHeight < 0.2f || climbHeight > 4.2f) { return false; } if (!IsRoughClimbTopNormal(((RaycastHit)(ref val2)).normal) || !HasMantleSpaceAt(((RaycastHit)(ref val2)).point)) { return false; } climbTopPoint = ((RaycastHit)(ref val2)).point; Vector3 normal = ((RaycastHit)(ref obstacleHit)).normal; Vector3 val3; if (!(((Vector3)(ref normal)).sqrMagnitude > 0.01f)) { val3 = -dir; } else { normal = ((RaycastHit)(ref obstacleHit)).normal; val3 = ((Vector3)(ref normal)).normalized; } surfaceNormal = val3; if (!IsClimbableWallNormal(surfaceNormal)) { return false; } climbBase = center + dir * Mathf.Max(0.6f, ((RaycastHit)(ref obstacleHit)).distance - 0.35f); return true; } private bool TryProbeAnyClimbableAheadFrom(Vector3 center, Vector3 dir, float forwardDistance, bool preferJumpGrab, out Vector3 climbBase, out float climbHeight, out bool needsJumpStart, out Vector3 climbTopPoint, out Vector3 surfaceNormal) { //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_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_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_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_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_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_0072: Unknown result type (might be due to invalid IL or missing references) //IL_0077: Unknown result type (might be due to invalid IL or missing references) //IL_007c: Unknown result type (might be due to invalid IL or missing references) //IL_007e: 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_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_0094: 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_00c6: 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_0102: 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_0124: 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_017a: 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_0169: 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_0194: 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_0188: 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_01a9: 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_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_01c7: 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_01e9: 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_01f2: Unknown result type (might be due to invalid IL or missing references) climbBase = Vector3.zero; climbHeight = 0f; needsJumpStart = false; climbTopPoint = Vector3.zero; surfaceNormal = Vector3.zero; float[] climbProbeForwardSamples = ClimbProbeForwardSamples; Vector3 val = center + Vector3.up * 1.2f; RaycastHit val3 = default(RaycastHit); RaycastHit val4 = default(RaycastHit); foreach (float num in climbProbeForwardSamples) { if (num > forwardDistance + 0.45f) { continue; } Vector3 val2 = center + dir * num; if (!Physics.Raycast(val2 + Vector3.up * 5.7f, Vector3.down, ref val3, 6.8f, TerrainMask, (QueryTriggerInteraction)1)) { continue; } float num2 = ((RaycastHit)(ref val3)).point.y - center.y; if (num2 < 0.25f || num2 > 4.6f || !IsRoughClimbTopNormal(((RaycastHit)(ref val3)).normal) || !HasMantleSpaceAt(((RaycastHit)(ref val3)).point)) { continue; } bool flag = Physics.SphereCast(val, 0.18f, dir, ref val4, num + 0.4f, TerrainMask, (QueryTriggerInteraction)1); if (!flag && (!preferJumpGrab || !(num2 >= 1f))) { continue; } Vector3 val5; if (flag) { Vector3 normal = ((RaycastHit)(ref val4)).normal; if (((Vector3)(ref normal)).sqrMagnitude > 0.01f) { normal = ((RaycastHit)(ref val4)).normal; val5 = ((Vector3)(ref normal)).normalized; goto IL_0191; } } val5 = -dir; goto IL_0191; IL_0191: Vector3 val6 = val5; if (!IsClimbableWallNormal(val6)) { continue; } climbBase = center + dir * Mathf.Clamp(num - 0.18f, 0.45f, forwardDistance); climbHeight = num2; needsJumpStart = num2 >= 1f; climbTopPoint = ((RaycastHit)(ref val3)).point; surfaceNormal = val6; return true; } return false; } private bool TryProbeGapJumpFrom(Vector3 center, Vector3 dir, out Vector3 landingPoint, out float landingDrop) { //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_0014: Unknown result type (might be due to invalid IL or missing references) //IL_0015: Unknown result type (might be due to invalid IL or missing references) //IL_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_0025: Unknown result type (might be due to invalid IL or missing references) //IL_0026: Unknown result type (might be due to invalid IL or missing references) //IL_0027: Unknown result type (might be due to invalid IL or missing references) //IL_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_0037: 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_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_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_0067: 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_009a: 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_0127: 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_00e6: 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_010e: 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_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_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_015c: 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_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_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_01d3: 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_0198: 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) landingPoint = Vector3.zero; landingDrop = 0f; Vector3 point = center + dir * 1.8f; Vector3 point2 = center + dir * 4.8f; RaycastHit hit; bool flag = TryFindGround(point, out hit); RaycastHit hit2; bool flag2 = TryFindGround(point2, out hit2); RaycastHit val = default(RaycastHit); bool flag3 = Physics.SphereCast(center + Vector3.up * 1f, 0.22f, dir, ref val, 1.8f, TerrainMask, (QueryTriggerInteraction)1); if (!flag2) { return false; } landingDrop = center.y - ((RaycastHit)(ref hit2)).point.y; if (landingDrop > 20f) { return false; } if (!IsRoughStandableNormal(((RaycastHit)(ref hit2)).normal)) { return false; } if (flag) { float num = center.y - ((RaycastHit)(ref hit)).point.y; if (num > 10f) { landingPoint = ((RaycastHit)(ref hit2)).point; return true; } if (flag3) { Vector3 val2 = ((RaycastHit)(ref val)).point + dir * 0.15f + Vector3.up * 2.5f; RaycastHit val3 = default(RaycastHit); if (Physics.Raycast(val2, Vector3.down, ref val3, 2.9f, TerrainMask, (QueryTriggerInteraction)1)) { float num2 = ((RaycastHit)(ref val3)).point.y - center.y; if (num2 >= 0.15f && num2 <= 1.1f) { return false; } } landingPoint = ((RaycastHit)(ref hit2)).point; return true; } return false; } landingPoint = ((RaycastHit)(ref hit2)).point; return true; } private bool IsFollowingRoute() { return _hasActiveSegment || _segmentQueue.Count > 0; } private Vector3 GetCurrentDrivePoint() { //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_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_0023: Unknown result type (might be due to invalid IL or missing references) if (_hasActiveSegment) { return _activeSegment.Goal; } return GetGoalLookPoint(); } private bool HasGoalPointChanged(Vector3 newGoal) { //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) if (!_hadAcceptedGoalPoint) { return true; } return Vector3.Distance(_lastAcceptedGoalPoint, newGoal) > 1f; } private void ResetRouteForNewGoal(Vector3 newGoal, int instructionSerial = 0, bool allowGoalParking = true) { //IL_002a: 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_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) _segmentQueue.Clear(); ClearActiveSegment(); ClearLockedClimbPlan(); ClearGuidePlannerCaches(); ClearGoalParking(); _resolvedGoalPoint = newGoal; _hasResolvedGoalPoint = true; _resolvedGoalIsStandable = false; _rawGoalIsStandable = false; _hasLastResolvedRawGoal = false; _nextReplanTime = 0f; _nextResolvedGoalRefreshTime = 0f; _stuckCount = 0; _failedClimbCount = 0; ResetFullStaminaClimbRetry(); _repositionUntil = 0f; _goalInstructionSerial = ((instructionSerial > 0) ? instructionSerial : (_goalInstructionSerial + 1)); _allowGoalParking = allowGoalParking; _lastAcceptedGoalPoint = newGoal; _hadAcceptedGoalPoint = true; } private bool TryBuildImmediateJumpGrabPlanFrom(Vector3 startPos, Vector3 goalCenter, out PathPlan plan) { //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_0012: 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_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_0099: 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_009e: 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_00fb: 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_010d: 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_010f: 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_0112: 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_011a: 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_0148: 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_0157: 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_019f: 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_01b3: 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_01c8: 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_01e9: 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_01f2: Unknown result type (might be due to invalid IL or missing references) //IL_01f4: 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_0259: 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_0265: Unknown result type (might be due to invalid IL or missing references) //IL_026b: 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_029d: 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_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_02b8: 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_02c2: Unknown result type (might be due to invalid IL or missing references) plan = new PathPlan(); Vector3 val = goalCenter - startPos; Vector3 val2 = default(Vector3); ((Vector3)(ref val2))..ctor(val.x, 0f, val.z); float magnitude = ((Vector3)(ref val2)).magnitude; float num = goalCenter.y - startPos.y; if (magnitude > 3.2f) { return false; } if (num < 0.55f || num > 4.8f) { return false; } Vector3 dir = ((((Vector3)(ref val2)).sqrMagnitude > 0.001f) ? ((Vector3)(ref val2)).normalized : ((Component)_character).transform.forward); if (!TryProbeAnyClimbableAheadFrom(startPos, dir, Mathf.Max(1.6f, magnitude + 0.35f), preferJumpGrab: true, out var climbBase, out var climbHeight, out var needsJumpStart, out var climbTopPoint, out var surfaceNormal)) { return false; } if (climbHeight < 0.45f || climbHeight > 4.6f) { return false; } Vector3 val3 = ((climbTopPoint != Vector3.zero) ? climbTopPoint : climbBase); float num2 = Vector3.Distance(startPos, goalCenter) - Vector3.Distance(val3, goalCenter); if (num2 < 0.2f && num < 1.3f) { return false; } float num3 = HelperFunctions.FlatDistance(val3, goalCenter); float num4 = Mathf.Abs(val3.y - goalCenter.y); if ((!(num3 <= 1.35f) || !(num4 <= 1.75f)) && num2 < 0.55f) { return false; } Vector3 val4 = goalCenter + Vector3.up * 0.15f; plan.Action = (needsJumpStart ? PathActionType.JumpGrab : PathActionType.Climb); plan.Anchor = climbBase; plan.Goal = val4; plan.TargetAbove = true; plan.NeedsJumpStart = needsJumpStart; plan.ClimbTopPoint = climbTopPoint; plan.ClimbSurfaceNormal = surfaceNormal; plan.EstimatedClimbHeight = Mathf.Max(climbHeight, num); plan.IsTallWall = plan.EstimatedClimbHeight >= 2.15f; plan.RequiredStamina = EstimateRequiredClimbStamina(plan.EstimatedClimbHeight, targetAbove: true, plan.IsTallWall); plan.ReachableWithinRecoverableBudget = plan.RequiredStamina <= GetRecoverableStaminaCeiling(); plan.ProjectedEndPoint = ((climbTopPoint != Vector3.zero) ? climbTopPoint : val4); plan.HasProjectedEndPoint = true; plan.Score = 12f + num2 - num3 * 0.35f; if (needsJumpStart) { plan.JumpGrabAimPoint = ((climbTopPoint != Vector3.zero) ? climbTopPoint : goalCenter) + Vector3.up * 0.1f; plan.JumpGrabHorizontalDistance = magnitude; } return true; } private bool TryFindBestLocalPlanFrom(Vector3 startPos, Vector3 toTargetDir, float currentFlatDist, bool targetAbove, out PathPlan bestPlan) { //IL_0022: 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_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_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_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_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_00bd: 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_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_00cf: 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_00ea: 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_0116: 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_0131: 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_0187: 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_0195: 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_02ff: Unknown result type (might be due to invalid IL or missing references) //IL_025a: Unknown result type (might be due to invalid IL or missing references) //IL_025f: Unknown result type (might be due to invalid IL or missing references) //IL_0268: 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_027d: 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_01f6: Unknown result type (might be due to invalid IL or missing references) //IL_01fb: 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_040e: Unknown result type (might be due to invalid IL or missing references) //IL_0413: 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_0421: Unknown result type (might be due to invalid IL or missing references) //IL_0432: Unknown result type (might be due to invalid IL or missing references) //IL_0435: Unknown result type (might be due to invalid IL or missing references) //IL_0343: Unknown result type (might be due to invalid IL or missing references) //IL_035a: 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_038d: 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_039a: Unknown result type (might be due to invalid IL or missing references) //IL_039f: Unknown result type (might be due to invalid IL or missing references) //IL_03ae: Unknown result type (might be due to invalid IL or missing references) //IL_03b1: 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_03d4: Unknown result type (might be due to invalid IL or missing references) bestPlan = new PathPlan(); if (!HasActiveGoal()) { return false; } bool flag = GetGoalCenter().y - startPos.y < -1.25f; bool flag2 = false; if (TryProbeRouteFrom(startPos, toTargetDir, 2.2f, out var probe)) { flag2 = probe.ObstacleAhead && !probe.ClimbableAhead; } bool flag3 = false; float num = float.NegativeInfinity; float[] searchAngles = SearchAngles; foreach (float num2 in searchAngles) { Vector3 val = Quaternion.AngleAxis(num2, Vector3.up) * toTargetDir; if (!TryProbeRouteFrom(startPos, val, 2.2f, out var probe2)) { continue; } Vector3 point = startPos + val * 3f; if (!TryFindGround(point, out var hit)) { continue; } float num3 = startPos.y - ((RaycastHit)(ref hit)).point.y; if (num3 > 10f) { continue; } float num4 = HelperFunctions.FlatDistance(((RaycastHit)(ref hit)).point, GetGoalCenter()); float num5 = currentFlatDist - num4; float blockedPenalty = GetBlockedPenalty(((RaycastHit)(ref hit)).point); float num6 = Mathf.Abs(num2) * 0.015f; float num7 = num5 - num6 - blockedPenalty; PathPlan plan = new PathPlan(); if (flag) { if (probe2.SafeWalkDrop) { plan.Action = PathActionType.DropDown; plan.Goal = probe2.DropLandingPoint; plan.Anchor = ((RaycastHit)(ref hit)).point; plan.TargetAbove = false; plan.RequiredStamina = 0.02f; plan.ExpectedDropHeight = probe2.DropHeight; plan.UsesJumpDropImmunity = false; plan.ReachableWithinRecoverableBudget = true; num7 += 1.35f; } else if (probe2.SafeJumpDrop) { plan.Action = PathActionType.DropDown; plan.Goal = probe2.DropLandingPoint; plan.Anchor = ((RaycastHit)(ref hit)).point; plan.TargetAbove = false; plan.RequiredStamina = 0.08f; plan.ExpectedDropHeight = probe2.DropHeight; plan.UsesJumpDropImmunity = true; plan.ReachableWithinRecoverableBudget = true; num7 += 1.05f; } else { plan.Action = PathActionType.Detour; plan.Goal = ((RaycastHit)(ref hit)).point; plan.Anchor = ((RaycastHit)(ref hit)).point; plan.TargetAbove = false; plan.RequiredStamina = EstimateGroundChaseCost(Vector3.Distance(startPos, ((RaycastHit)(ref hit)).point)); plan.ReachableWithinRecoverableBudget = true; num7 += 0.85f; } num7 = (plan.Score = num7 - GetFailedSegmentPenalty(plan)); if (!flag3 || num7 > num) { flag3 = true; num = num7; bestPlan = plan; } continue; } if ((probe2.UnsafeDropAhead || !(num5 > 0.2f) || !(Mathf.Abs(((RaycastHit)(ref hit)).point.y - startPos.y) <= 1.8f)) && probe2.ClimbableAhead && !probe2.UnsafeDropAhead) { FillClimbPlan(ref plan, probe2.ClimbBasePoint, probe2.ClimbHeightDelta, targetAbove, probe2.NeedsJumpStart, probe2.ClimbTopPoint, probe2.ClimbSurfaceNormal); if (!IsViableClimbPlan(plan)) { plan = new PathPlan { Action = PathActionType.Detour, Goal = ((RaycastHit)(ref hit)).point, Anchor = ((RaycastHit)(ref hit)).point, TargetAbove = targetAbove, RequiredStamina = EstimateGroundChaseCost(Vector3.Distance(startPos, ((RaycastHit)(ref hit)).point)), ReachableWithinRecoverableBudget = true, ProjectedEndPoint = ((RaycastHit)(ref hit)).point, HasProjectedEndPoint = true }; num7 += 0.5f; } else { num7 += 0.55f; } } else { plan.Action = PathActionType.Detour; plan.Goal = ((RaycastHit)(ref hit)).point; plan.Anchor = ((RaycastHit)(ref hit)).point; plan.TargetAbove = targetAbove; plan.RequiredStamina = EstimateGroundChaseCost(Vector3.Distance(startPos, ((RaycastHit)(ref hit)).point)); plan.ReachableWithinRecoverableBudget = true; num7 += 0.85f; if (flag2) { num7 = (probe2.ObstacleAhead ? (num7 + 0.35f) : (num7 + 1.1f)); if (num5 > 0.35f) { num7 += 0.45f; } } } num7 = (plan.Score = num7 - GetFailedSegmentPenalty(plan)); if (!flag3 || num7 > num) { flag3 = true; num = num7; bestPlan = plan; } } return flag3; } private bool TryBuildOverheadAccessPlanFrom(Vector3 startPos, Vector3 toTargetDir, float heightDelta, out PathPlan plan) { //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_0042: 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_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_0071: 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_00b3: 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_00d8: 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_0130: 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_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_0157: 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_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_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_018e: 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_01ba: 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_01e4: 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_0236: Unknown result type (might be due to invalid IL or missing references) //IL_023d: Unknown result type (might be due to invalid IL or missing references) //IL_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_0321: Unknown result type (might be due to invalid IL or missing references) //IL_0326: Unknown result type (might be due to invalid IL or missing references) //IL_0336: 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_028c: 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_0298: 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_02a0: 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) plan = new PathPlan(); if (!HasActiveGoal()) { return false; } if (!TryProbeRouteFrom(startPos, toTargetDir, 2.2f, out var probe)) { return false; } float num = HelperFunctions.FlatDistance(startPos, GetGoalCenter()); if (TryFindBestLocalPlanFrom(startPos, toTargetDir, num, targetAbove: true, out PathPlan bestPlan) && bestPlan.Action == PathActionType.Detour) { float num2 = HelperFunctions.FlatDistance(bestPlan.Goal, GetGoalCenter()); if (num2 < num - 0.75f) { plan = bestPlan; return true; } } if (probe.ClimbableAhead) { FillClimbPlan(ref plan, probe.ClimbBasePoint, Mathf.Max(probe.ClimbHeightDelta, heightDelta * 0.8f), targetAbove: true, probe.NeedsJumpStart, probe.ClimbTopPoint, probe.ClimbSurfaceNormal); if (IsViableClimbPlan(plan)) { return true; } } bool flag = false; float num3 = float.NegativeInfinity; PathPlan pathPlan = new PathPlan(); float[] overheadAngles = OverheadAngles; foreach (float num4 in overheadAngles) { Vector3 val = Quaternion.AngleAxis(num4, Vector3.up) * toTargetDir; if (!TryProbeRouteFrom(startPos, val, 2.2f, out var probe2)) { continue; } Vector3 point = startPos + val * Mathf.Min(3.5f, 3f); if (!TryFindGround(point, out var hit)) { continue; } float num5 = startPos.y - ((RaycastHit)(ref hit)).point.y; if (num5 > 10f) { continue; } float num6 = HelperFunctions.FlatDistance(((RaycastHit)(ref hit)).point, GetGoalCenter()); float num7 = num - num6; float num8 = Mathf.Abs(num4) * 0.02f; float blockedPenalty = GetBlockedPenalty(((RaycastHit)(ref hit)).point); PathPlan plan2 = new PathPlan(); float num9 = num7 - num8 - blockedPenalty; if (probe2.ClimbableAhead) { FillClimbPlan(ref plan2, probe2.ClimbBasePoint, Mathf.Max(probe2.ClimbHeightDelta, heightDelta * 0.8f), targetAbove: true, probe2.NeedsJumpStart, probe2.ClimbTopPoint, probe2.ClimbSurfaceNormal); if (!IsViableClimbPlan(plan2)) { continue; } num9 += 1.2f; } else if (probe2.GapJumpable) { plan2.Action = PathActionType.GapJump; plan2.Goal = probe2.GapLandingPoint; plan2.Anchor = startPos + val * 1f; plan2.TargetAbove = true; plan2.RequiredStamina = Mathf.Clamp(0.2f + probe2.GapLandingDrop * 0.05f, 0.2f, 0.55f); plan2.ReachableWithinRecoverableBudget = plan2.RequiredStamina <= GetRecoverableStaminaCeiling(); num9 += 1.05f; } else { plan2.Action = PathActionType.Detour; plan2.Goal = ((RaycastHit)(ref hit)).point; plan2.Anchor = ((RaycastHit)(ref hit)).point; plan2.TargetAbove = true; plan2.RequiredStamina = EstimateGroundChaseCost(Vector3.Distance(startPos, ((RaycastHit)(ref hit)).point)); plan2.ReachableWithinRecoverableBudget = true; num9 += 1f; } num9 = (plan2.Score = num9 - GetFailedSegmentPenalty(plan2)); if (!flag || num9 > num3) { flag = true; num3 = num9; pathPlan = plan2; } } if (flag) { plan = pathPlan; return true; } return false; } private bool TryBuildVerticalDropPlanFrom(Vector3 startPos, float heightDelta, out PathPlan plan) { //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_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_003b: 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_0077: 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_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_00ef: Unknown result type (might be due to invalid IL or missing references) //IL_00f4: Unknown result type (might be due to invalid IL or missing references) //IL_0123: Unknown result type (might be due to invalid IL or missing references) //IL_0128: Unknown result type (might be due to invalid IL or missing references) //IL_012d: 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_0133: 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_0137: 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_015a: Unknown result type (might be due to invalid IL or missing references) //IL_0168: Unknown result type (might be due to invalid IL or missing references) //IL_016a: 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_0174: 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_0183: 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_026d: 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_027b: Unknown result type (might be due to invalid IL or missing references) //IL_01c8: 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_01ce: 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_01fd: 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) plan = new PathPlan(); if (!HasActiveGoal() || heightDelta >= -1.25f) { return false; } Vector3 goalCenter = GetGoalCenter(); Vector3 val = goalCenter - startPos; val.y = 0f; Vector3 val2 = ((((Vector3)(ref val)).sqrMagnitude > 0.04f) ? ((Vector3)(ref val)).normalized : (((Object)(object)_character != (Object)null && (Object)(object)_character.data != (Object)null) ? _character.data.lookDirection_Flat : Vector3.zero)); if (((Vector3)(ref val2)).sqrMagnitude < 0.01f && (Object)(object)_character != (Object)null) { val2 = ((Component)_character).transform.forward; } val2.y = 0f; if (((Vector3)(ref val2)).sqrMagnitude < 0.01f) { val2 = Vector3.forward; } ((Vector3)(ref val2)).Normalize(); bool flag = false; float num = float.NegativeInfinity; PathPlan pathPlan = new PathPlan(); float[] dropSearchAngles = DropSearchAngles; for (int i = 0; i < dropSearchAngles.Length; i++) { Vector3 dir = Quaternion.AngleAxis(dropSearchAngles[i], Vector3.up) * val2; if (!TryFindDropLedgeInDirection(startPos, dir, out PathPlan plan2)) { continue; } Vector3 val3 = (plan2.HasProjectedEndPoint ? plan2.ProjectedEndPoint : plan2.Goal); float num2 = Vector3.Distance(val3, goalCenter); float num3 = HelperFunctions.FlatDistance(startPos, plan2.Anchor); float num4 = Mathf.Abs(val3.y - goalCenter.y); float num5 = Mathf.Abs(dropSearchAngles[i]) * 0.006f; float num6 = 0f; if (((Vector3)(ref val)).sqrMagnitude > 0.04f) { Vector3 val4 = plan2.Anchor - startPos; val4.y = 0f; if (((Vector3)(ref val4)).sqrMagnitude > 0.01f) { num6 = Mathf.Max(0f, Vector3.Dot(((Vector3)(ref val4)).normalized, ((Vector3)(ref val)).normalized)) * 1.2f; } } float score = plan2.Score; score -= num2 * 1.75f; score -= num3 * 0.1f; score -= num4 * 0.45f; score -= num5; score += num6; score -= GetFailedSegmentPenalty(plan2); score -= GetBlockedPenalty(plan2.Anchor); if (HelperFunctions.FlatDistance(startPos, goalCenter) <= 0.35f) { score -= num3 * 0.35f; } plan2.Score = score; if (!flag || score > num) { flag = true; num = score; pathPlan = plan2; } } if (!flag) { return false; } plan = pathPlan; return true; } private bool TryFindDropLedgeInDirection(Vector3 startPos, Vector3 dir, out PathPlan plan) { //IL_0014: Unknown result type (might be due to invalid IL or missing references) //IL_0015: Unknown result type (might be due to invalid IL or missing references) //IL_0017: 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_0055: 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_0066: 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_0085: 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_017a: 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_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_0188: 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) //IL_0109: 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_00e6: 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_00c7: 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_00df: Unknown result type (might be due to invalid IL or missing references) //IL_01a3: Unknown result type (might be due to invalid IL or missing references) //IL_00e7: 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_00ef: 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_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_01ed: 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_01f1: Unknown result type (might be due to invalid IL or missing references) plan = new PathPlan(); float[] dropAnchorSamples = DropAnchorSamples; float[] dropLandingExtraSamples = DropLandingExtraSamples; Vector3 val = startPos; RaycastHit hit; bool flag = TryFindGround(startPos, out hit); if (flag) { val = ((RaycastHit)(ref hit)).point; } foreach (float num in dropAnchorSamples) { if (num > 8.75f) { break; } Vector3 point = startPos + dir * num; if (TryFindGround(point, out var hit2)) { float num2 = startPos.y - ((RaycastHit)(ref hit2)).point.y; bool flag2 = IsRoughStandableNormal(((RaycastHit)(ref hit2)).normal); if (num2 > 0.5f && num2 <= 20f && flag2) { Vector3 anchor = (flag ? val : (startPos + dir * Mathf.Max(0.35f, num - 0.55f))); return CreateDropOrEdgePlan(startPos, anchor, ((RaycastHit)(ref hit2)).point, num2, out plan); } if (flag2 && Mathf.Abs(((RaycastHit)(ref hit2)).point.y - startPos.y) <= 1.1f) { val = ((RaycastHit)(ref hit2)).point; flag = true; continue; } } if (!flag) { continue; } for (int j = 0; j < dropLandingExtraSamples.Length; j++) { float num3 = num + dropLandingExtraSamples[j]; if (num3 > 12.25f) { break; } Vector3 point2 = startPos + dir * num3; if (TryFindGround(point2, out var hit3) && IsRoughStandableNormal(((RaycastHit)(ref hit3)).normal)) { float num4 = startPos.y - ((RaycastHit)(ref hit3)).point.y; if (!(num4 <= 0.5f) && !(num4 > 20f)) { return CreateDropOrEdgePlan(startPos, val, ((RaycastHit)(ref hit3)).point, num4, out plan); } } } } return false; } private bool CreateDropOrEdgePlan(Vector3 startPos, Vector3 anchor, Vector3 landing, float drop, out PathPlan plan) { //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_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_00d2: 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_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_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_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_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_0090: 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) plan = new PathPlan(); float num = HelperFunctions.FlatDistance(startPos, anchor); bool flag = num <= 1.15f; bool flag2 = drop <= 10f; if (flag) { plan.Action = PathActionType.DropDown; plan.Goal = landing; plan.Anchor = anchor; plan.TargetAbove = false; plan.RequiredStamina = (flag2 ? 0.02f : 0.08f); plan.ExpectedDropHeight = drop; plan.UsesJumpDropImmunity = !flag2; plan.ReachableWithinRecoverableBudget = true; plan.ProjectedEndPoint = landing; plan.HasProjectedEndPoint = true; plan.Score = 5f - drop * 0.025f; return true; } plan.Action = PathActionType.DropDown; plan.Goal = landing; plan.Anchor = anchor; plan.TargetAbove = false; plan.RequiredStamina = Mathf.Max(EstimateGroundChaseCost(Vector3.Distance(startPos, anchor)) * 0.35f, flag2 ? 0.02f : 0.08f); plan.ExpectedDropHeight = drop; plan.UsesJumpDropImmunity = !flag2; plan.ReachableWithinRecoverableBudget = true; plan.ProjectedEndPoint = landing; plan.HasProjectedEndPoint = true; plan.Score = 4.15f - num * 0.12f - drop * 0.015f; return true; } private bool TryBuildDropDownPlanFrom(Vector3 startPos, Vector3 toTargetDir, float currentFlatDist, float heightDelta, out PathPlan plan) { //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_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_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_008f: Unknown result type (might be due to invalid IL or missing references) //IL_0090: Unknown result type (might be due to invalid IL or missing references) //IL_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_0099: 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_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_00c8: Unknown result type (might be due to invalid IL or missing references) //IL_00cb: 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_00eb: 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_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_0154: 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_0194: 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_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_025b: 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_0270: Unknown result type (might be due to invalid IL or missing references) //IL_0273: 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_02bd: 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_01de: 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_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) plan = new PathPlan(); if (!HasActiveGoal()) { return false; } if (!TryProbeRouteFrom(startPos, toTargetDir, 2.2f, out var probe)) { return false; } if (TryCreateImmediateDropPlan(startPos, toTargetDir, currentFlatDist, probe, out plan)) { return true; } bool flag = false; float num = float.NegativeInfinity; PathPlan pathPlan = new PathPlan(); float[] overheadAngles = OverheadAngles; foreach (float num2 in overheadAngles) { Vector3 val = Quaternion.AngleAxis(num2, Vector3.up) * toTargetDir; if (!TryProbeRouteFrom(startPos, val, 2.2f, out var probe2)) { continue; } Vector3 point = startPos + val * 3.2f; if (TryFindGround(point, out var hit)) { float num3 = HelperFunctions.FlatDistance(((RaycastHit)(ref hit)).point, GetGoalCenter()); float num4 = currentFlatDist - num3; float num5 = Mathf.Abs(num2) * 0.02f; float blockedPenalty = GetBlockedPenalty(((RaycastHit)(ref hit)).point); float num6 = num4 - num5 - blockedPenalty; PathPlan pathPlan2 = new PathPlan(); if (probe2.SafeWalkDrop) { pathPlan2.Action = PathActionType.DropDown; pathPlan2.Goal = probe2.DropLandingPoint; pathPlan2.Anchor = ((RaycastHit)(ref hit)).point; pathPlan2.TargetAbove = false; pathPlan2.RequiredStamina = 0.02f; pathPlan2.ExpectedDropHeight = probe2.DropHeight; pathPlan2.UsesJumpDropImmunity = false; pathPlan2.ReachableWithinRecoverableBudget = true; pathPlan2.ProjectedEndPoint = probe2.DropLandingPoint; pathPlan2.HasProjectedEndPoint = true; num6 += 1.8f; } else if (probe2.SafeJumpDrop) { pathPlan2.Action = PathActionType.DropDown; pathPlan2.Goal = probe2.DropLandingPoint; pathPlan2.Anchor = ((RaycastHit)(ref hit)).point; pathPlan2.TargetAbove = false; pathPlan2.RequiredStamina = 0.08f; pathPlan2.ExpectedDropHeight = probe2.DropHeight; pathPlan2.UsesJumpDropImmunity = true; pathPlan2.ReachableWithinRecoverableBudget = true; pathPlan2.ProjectedEndPoint = probe2.DropLandingPoint; pathPlan2.HasProjectedEndPoint = true; num6 += 1.4f; } else { pathPlan2.Action = PathActionType.Detour; pathPlan2.Goal = ((RaycastHit)(ref hit)).point; pathPlan2.Anchor = ((RaycastHit)(ref hit)).point; pathPlan2.TargetAbove = false; pathPlan2.RequiredStamina = EstimateGroundChaseCost(Vector3.Distance(startPos, ((RaycastHit)(ref hit)).point)); pathPlan2.ExpectedDropHeight = 0f; pathPlan2.UsesJumpDropImmunity = false; pathPlan2.ReachableWithinRecoverableBudget = pathPlan2.RequiredStamina <= GetRecoverableStaminaCeiling(); pathPlan2.ProjectedEndPoint = ((RaycastHit)(ref hit)).point; pathPlan2.HasProjectedEndPoint = true; num6 += 0.3f; } num6 = (pathPlan2.Score = num6 - GetFailedSegmentPenalty(pathPlan2)); if (!flag || num6 > num) { flag = true; num = num6; pathPlan = pathPlan2; } } } if (flag) { plan = pathPlan; return true; } return false; } private void ResetInput() { //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) if ((Object)(object)_character == (Object)null) { return; } try { _character.input.movementInput = Vector2.zero; _character.input.jumpWasPressed = false; _character.input.jumpIsPressed = false; _character.input.sprintIsPressed = false; _character.input.useSecondaryWasPressed = false; _character.input.useSecondaryIsPressed = false; _character.input.useSecondaryWasReleased = false; if ((Object)(object)_character.data != (Object)null) { _character.data.isSprinting = false; } } catch { } } private void RegisterBlockedPoint(Vector3 point, float radius) { //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_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_00a3: 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_00a9: 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) if (!IsFailureMemoryEnabled()) { return; } float num = Mathf.Clamp(radius, 1.25f, 5f); float time = Time.time; for (int num2 = _blockedMemory.Count - 1; num2 >= 0; num2--) { BlockedMemory blockedMemory = _blockedMemory[num2]; if (time >= blockedMemory.Until) { _blockedMemory.RemoveAt(num2); } else if (Vector3.Distance(blockedMemory.Point, point) <= Mathf.Max(blockedMemory.Radius, num) * 0.65f) { blockedMemory.Point = (blockedMemory.Point + point) * 0.5f; blockedMemory.Radius = Mathf.Max(blockedMemory.Radius, num); blockedMemory.Penalty = Mathf.Min(4f, blockedMemory.Penalty + 0.75f); blockedMemory.Until = Mathf.Max(blockedMemory.Until, time + 6f); return; } } _blockedMemory.Add(new BlockedMemory { Point = point, Radius = num, Penalty = Mathf.Clamp(1f + num * 0.35f, 1f, 4f), Until = time + 6f }); } private float GetBlockedPenalty(Vector3 point) { //IL_0091: 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) if (!IsFailureMemoryEnabled() || _blockedMemory.Count == 0) { return 0f; } float time = Time.time; float num = 0f; for (int num2 = _blockedMemory.Count - 1; num2 >= 0; num2--) { BlockedMemory blockedMemory = _blockedMemory[num2]; if (time >= blockedMemory.Until) { _blockedMemory.RemoveAt(num2); } else { float num3 = Mathf.Max(blockedMemory.Radius, 1.25f); float num4 = Vector3.Distance(point, blockedMemory.Point); if (!(num4 > num3)) { float num5 = 1f - Mathf.Clamp01(num4 / num3); float num6 = Mathf.Clamp01((blockedMemory.Until - time) / 6f); num += blockedMemory.Penalty * num5 * Mathf.Lerp(0.35f, 1f, num6); } } } return num; } private void DecayBlockedMemory() { if (_blockedMemory.Count == 0) { return; } float time = Time.time; for (int num = _blockedMemory.Count - 1; num >= 0; num--) { if (time >= _blockedMemory[num].Until) { _blockedMemory.RemoveAt(num); } } } private bool IsReliableSlopeRestPoint(Vector3 point, 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_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_0034: Unknown result type (might be due to invalid IL or missing references) if (!IsSafeStandableRoutePoint(point, normal, requireSupport: true)) { return false; } float num = Vector3.Angle(normal, Vector3.up); if (num > 42f) { return false; } return CountStandSupportPoints(point) >= 2; } private bool IsReliableStandingNowForRoute() { //IL_001a: 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) if (!IsSafeStandingNow()) { return false; } if (!TryFindGround(_character.Center, out var hit)) { return false; } return IsReliableSlopeRestPoint(((RaycastHit)(ref hit)).point, ((RaycastHit)(ref hit)).normal); } private bool IsRouteGroundColliderStandable(Collider collider) { if ((Object)(object)collider == (Object)null) { return false; } if (_routeStandableColliderCache.TryGetValue(collider, out var value)) { return value; } CollisionModifier component = ((Component)collider).GetComponent(); bool flag = (Object)(object)component == (Object)null || component.standable; _routeStandableColliderCache[collider] = flag; return flag; } private bool IsSafeStandableRouteHit(RaycastHit hit, bool requireSupport) { //IL_001d: 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) if (!IsRouteGroundColliderStandable(((RaycastHit)(ref hit)).collider)) { return false; } return IsSafeStandableRoutePoint(((RaycastHit)(ref hit)).point, ((RaycastHit)(ref hit)).normal, requireSupport); } private bool TryFindFootholdGround(Vector3 probePoint, out RaycastHit hit) { //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_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_0016: 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_002b: 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_004f: Unknown result type (might be due to invalid IL or missing references) Vector3 val = probePoint + Vector3.up * 7.5f; if (!TryFindGround(val, out hit)) { return false; } if (val.y - ((RaycastHit)(ref hit)).point.y > 18f) { return false; } return IsSafeStandableRouteHit(hit, requireSupport: false); } private bool IsAlreadyStableAtGoalAccess(Vector3 startPos, Vector3 goalCenter) { //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_001b: Unknown result type (might be due to invalid IL or missing references) //IL_0021: Unknown result type (might be due to invalid IL or missing references) if (!IsReliableStandingNowForRoute()) { return false; } float num = HelperFunctions.FlatDistance(startPos, goalCenter); float num2 = Mathf.Abs(goalCenter.y - startPos.y); return num <= 1.55f && num2 <= 1.25f; } private bool ShouldSlopeSettleAssist(PathPlan plan) { //IL_008f: 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_00b4: 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_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) if (plan.Action != PathActionType.SlopeWalk || !plan.TargetAbove || (Object)(object)_character == (Object)null || (Object)(object)_character.data == (Object)null) { return false; } if (_character.data.isClimbing || _character.data.isRopeClimbing || _character.data.isVineClimbing) { return false; } if (!TryFindGround(_character.Center, out var hit)) { return true; } if (IsReliableSlopeRestPoint(((RaycastHit)(ref hit)).point, ((RaycastHit)(ref hit)).normal)) { return false; } float num = HelperFunctions.FlatDistance(_character.Center, plan.Goal); float num2 = Vector3.Angle(((RaycastHit)(ref hit)).normal, Vector3.up); return num <= 2.35f || num2 >= 48f; } private bool TryExtendSlopePlanToStableRest(Vector3 startPos, Vector3 dir, Vector3 goalCenter, GroundCorridorStats currentStats, out GroundCorridorStats extendedStats) { //IL_000d: 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_0035: Unknown result type (might be due to invalid IL or missing references) //IL_006e: Unknown result type (might be due to invalid IL or missing references) //IL_0073: Unknown result type (might be due to invalid IL or missing references) //IL_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_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_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_00b1: 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_00dc: 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_00f7: 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_011c: 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_013d: 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_0166: 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) extendedStats = currentStats; if (!TryFindGround(currentStats.EndPoint, out var hit)) { return false; } if (IsReliableSlopeRestPoint(((RaycastHit)(ref hit)).point, ((RaycastHit)(ref hit)).normal)) { return false; } bool flag = false; float num = float.NegativeInfinity; GroundCorridorStats groundCorridorStats = currentStats; for (int i = 0; i < SlopeStableExtraDistances.Length; i++) { float num2 = SlopeStableExtraDistances[i]; Vector3 point = currentStats.EndPoint + dir * num2 + Vector3.up * 0.2f; if (TryFindGround(point, out var hit2) && !(((RaycastHit)(ref hit2)).point.y < currentStats.EndPoint.y - 0.35f) && IsSafeStandableRouteHit(hit2, requireSupport: false) && TryValidateGroundCorridor(startPos, ((RaycastHit)(ref hit2)).point, out var stats)) { float num3 = (IsReliableSlopeRestPoint(((RaycastHit)(ref hit2)).point, ((RaycastHit)(ref hit2)).normal) ? 2.2f : 0f); float num4 = Vector3.Angle(((RaycastHit)(ref hit2)).normal, Vector3.up); float num5 = ((RaycastHit)(ref hit2)).point.y - currentStats.EndPoint.y; float num6 = HelperFunctions.FlatDistance(((RaycastHit)(ref hit2)).point, goalCenter) * 0.1f; float num7 = num2 * 0.28f; float num8 = num3 + num5 * 0.85f - num4 * 0.018f - num7 - num6; if (!flag || num8 > num) { flag = true; num = num8; groundCorridorStats = stats; } } } if (!flag) { return false; } extendedStats = groundCorridorStats; return true; } private bool TryBuildValidatedGroundTravelPlanFrom(Vector3 startPos, Vector3 goalCenter, float currentFlatDist, bool targetAbove, out PathPlan plan) { //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_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_006c: 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_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_006d: 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_0075: 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_00c2: 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_0127: 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_010c: 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_010e: 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_0158: 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_01c4: 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_01ef: Unknown result type (might be due to invalid IL or missing references) //IL_01f4: Unknown result type (might be due to invalid IL or missing references) //IL_01f9: Unknown result type (might be due to invalid IL or missing references) //IL_020b: 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_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_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_02af: 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_02ef: Unknown result type (might be due to invalid IL or missing references) plan = new PathPlan(); Vector3 val = goalCenter - startPos; val.y = 0f; float magnitude = ((Vector3)(ref val)).magnitude; if (magnitude < 0.35f) { return false; } Vector3 normalized = ((Vector3)(ref val)).normalized; bool flag = magnitude <= 14f; Vector3 point = (flag ? goalCenter : (startPos + normalized * Mathf.Min(7.25f, magnitude))); float num = goalCenter.y - startPos.y; if (targetAbove && magnitude <= 1.35f && num > 1.45f) { return false; } if (!TryFindGround(point, out var hit)) { return false; } if (!TryValidateGroundCorridor(startPos, ((RaycastHit)(ref hit)).point, out var stats)) { return false; } if (targetAbove && (stats.HasSlope || stats.TotalRise > 0.35f) && TryExtendSlopePlanToStableRest(startPos, normalized, goalCenter, stats, out var extendedStats)) { stats = extendedStats; } float num2 = HelperFunctions.FlatDistance(stats.EndPoint, goalCenter); float num3 = currentFlatDist - num2; bool flag2 = targetAbove && stats.TotalRise >= 0.55f && stats.EndPoint.y > startPos.y + 0.45f; if (num3 < 0.45f && !flag2) { return false; } if (targetAbove && stats.TotalRise > 5f) { return false; } PathActionType action = ((!stats.HasSlope && !(Mathf.Abs(stats.EndPoint.y - startPos.y) > 0.55f)) ? PathActionType.Direct : PathActionType.SlopeWalk); Vector3 val2 = stats.EndPoint + Vector3.up * 0.12f; plan = new PathPlan { Action = action, Goal = val2, Anchor = val2, TargetAbove = targetAbove, RequiredStamina = EstimateGroundChaseCost(stats.PathLength), ReachableWithinRecoverableBudget = true, ProjectedEndPoint = stats.EndPoint, HasProjectedEndPoint = true, StartNodeType = RouteNodeType.Stand, EndNodeType = RouteNodeType.Stand, RiskScore = (stats.NeedsSmallHops ? 0.22f : 0.05f), Score = 4f + num3 * 1.55f + stats.TotalRise * 0.35f - stats.PathLength * 0.06f }; if (flag && HelperFunctions.FlatDistance(stats.EndPoint, goalCenter) <= 1.25f) { plan.Score += 1f; } plan.Score -= GetBlockedPenalty(stats.EndPoint); plan.Score -= GetFailedSegmentPenalty(plan); return true; } private bool TryBuildHeightAwareFootholdScanPlanFrom(Vector3 startPos, Vector3 goalCenter, float currentFlatDist, bool targetAbove, bool targetBelow, out PathPlan plan) { //IL_0035: 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_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_0079: Unknown result type (might be due to invalid IL or missing references) //IL_007e: Unknown result type (might be due to invalid IL or missing references) //IL_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_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_00c0: 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_00c5: 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_0164: 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_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) //IL_0184: 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_018b: Unknown result type (might be due to invalid IL or missing references) //IL_01f4: 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_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) //IL_0205: 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_020c: Unknown result type (might be due to invalid IL or missing references) plan = new PathPlan(); if ((Object)(object)Plugin.Instance != (Object)null && !Plugin.Instance.HeightAwareFootholdScanEnabled) { return false; } float num = goalCenter.y - startPos.y; if (!(Mathf.Abs(num) >= 0.85f || targetAbove || targetBelow) || currentFlatDist > 15.5f) { return false; } Vector3 val = goalCenter - startPos; val.y = 0f; if (((Vector3)(ref val)).sqrMagnitude < 0.04f) { val = (((Object)(object)_character != (Object)null) ? ((Component)_character).transform.forward : Vector3.forward); val.y = 0f; } if (((Vector3)(ref val)).sqrMagnitude < 0.04f) { return false; } ((Vector3)(ref val)).Normalize(); Vector3 val2 = Vector3.Cross(Vector3.up, val); Vector3 normalized = ((Vector3)(ref val2)).normalized; bool found = false; float bestScore = float.NegativeInfinity; PathPlan best = new PathPlan(); float num2 = Mathf.Min(15.5f, Mathf.Max(5.5f, currentFlatDist + 2f)); for (int i = 0; i < FootholdForwardSamples.Length; i++) { float num3 = FootholdForwardSamples[i]; if (num3 > num2) { break; } for (int j = 0; j < FootholdLateralSamples.Length; j++) { Vector3 sample = startPos + val * num3 + normalized * FootholdLateralSamples[j]; ConsiderFootholdScanCandidate(startPos, goalCenter, currentFlatDist, targetAbove, targetBelow, sample, ref found, ref bestScore, ref best); } } if (currentFlatDist <= 15.5f) { for (int k = 0; k < FootholdLateralSamples.Length; k++) { float num4 = FootholdLateralSamples[k] * 0.65f; Vector3 sample2 = goalCenter + normalized * num4; ConsiderFootholdScanCandidate(startPos, goalCenter, currentFlatDist, targetAbove, targetBelow, sample2, ref found, ref bestScore, ref best); } } if (!found) { return false; } plan = best; plan.Score -= GetFailedSegmentPenalty(plan); return true; } private void ConsiderFootholdScanCandidate(Vector3 startPos, Vector3 goalCenter, float currentFlatDist, bool targetAbove, bool targetBelow, Vector3 sample, ref bool found, ref float bestScore, ref PathPlan best) { //IL_0002: 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_0086: 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_00a7: 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_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_00e8: 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_00d5: 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_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_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_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_01c8: 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_01d5: 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_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_0127: 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) if (!TryFindFootholdGround(sample, out var hit)) { return; } float num = ((RaycastHit)(ref hit)).point.y - startPos.y; if ((!targetAbove && !targetBelow && Mathf.Abs(num) < 0.38f) || (targetAbove && num < 0.18f) || (targetBelow && num > -0.18f) || HelperFunctions.FlatDistance(startPos, ((RaycastHit)(ref hit)).point) < 0.45f) { return; } if (TryValidateGroundCorridor(startPos, ((RaycastHit)(ref hit)).point, out var stats)) { float num2 = currentFlatDist - HelperFunctions.FlatDistance(stats.EndPoint, goalCenter); float num3 = (targetBelow ? (startPos.y - stats.EndPoint.y) : (stats.EndPoint.y - startPos.y)); if (!(num2 < 0.35f) || !(num3 < 0.55f)) { PathPlan candidate = BuildFootholdGroundTravelPlan(startPos, goalCenter, currentFlatDist, stats, targetAbove && stats.EndPoint.y > startPos.y + 0.4f); TryAcceptFootholdCandidate(candidate, ref found, ref bestScore, ref best); } } else { if (!targetBelow || !(num < -0.55f)) { return; } Vector3 dir = ((RaycastHit)(ref hit)).point - startPos; dir.y = 0f; if (((Vector3)(ref dir)).sqrMagnitude < 0.05f) { return; } ((Vector3)(ref dir)).Normalize(); if (TryFindDropLedgeInDirection(startPos, dir, out PathPlan plan)) { float num4 = HelperFunctions.FlatDistance(GetPlanProjectedEndPoint(plan), goalCenter); float num5 = startPos.y - GetPlanProjectedEndPoint(plan).y; if (!(num5 < 0.45f)) { plan.Score += 1.45f + num5 * 0.45f - num4 * 0.1f; TryAcceptFootholdCandidate(plan, ref found, ref bestScore, ref best); } } } } private PathPlan BuildFootholdGroundTravelPlan(Vector3 startPos, Vector3 goalCenter, float currentFlatDist, GroundCorridorStats stats, bool targetAbove) { //IL_000c: 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_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_004a: 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_0062: 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_00b1: 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_008e: 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_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_00e9: 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_00f1: 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_011d: 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_0190: Unknown result type (might be due to invalid IL or missing references) PathActionType action = ((!stats.HasSlope && !(Mathf.Abs(stats.EndPoint.y - startPos.y) > 0.55f)) ? PathActionType.Direct : PathActionType.SlopeWalk); float num = HelperFunctions.FlatDistance(stats.EndPoint, goalCenter); float num2 = currentFlatDist - num; float num3 = 0f; if (TryFindGround(stats.EndPoint, out var hit) && IsReliableSlopeRestPoint(((RaycastHit)(ref hit)).point, ((RaycastHit)(ref hit)).normal)) { num3 = 1.15f; } float num4 = (targetAbove ? Mathf.Max(0f, stats.EndPoint.y - startPos.y) : Mathf.Max(0f, startPos.y - stats.EndPoint.y)); Vector3 val = stats.EndPoint + Vector3.up * 0.12f; PathPlan pathPlan = new PathPlan { Action = action, Goal = val, Anchor = val, TargetAbove = targetAbove, RequiredStamina = EstimateGroundChaseCost(stats.PathLength), ReachableWithinRecoverableBudget = true, ProjectedEndPoint = stats.EndPoint, HasProjectedEndPoint = true, StartNodeType = RouteNodeType.Stand, EndNodeType = RouteNodeType.Stand, RiskScore = (stats.NeedsSmallHops ? 0.24f : 0.06f), Score = 3.55f + num2 * 1.35f + num4 * 0.88f + num3 - stats.PathLength * 0.07f }; pathPlan.Score -= GetBlockedPenalty(stats.EndPoint); return pathPlan; } private void TryAcceptFootholdCandidate(PathPlan candidate, ref bool found, ref float bestScore, ref PathPlan best) { float score = candidate.Score; if (!(score <= 1.15f) && (!found || score > bestScore)) { found = true; bestScore = score; best = candidate; } } private bool TryValidateGroundCorridor(Vector3 startPos, Vector3 endPos, out GroundCorridorStats stats) { //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_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_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_0060: 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_00fc: 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_0100: 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_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_0159: 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_0114: Unknown result type (might be due to invalid IL or missing references) //IL_011e: Unknown result type (might be due to invalid IL or missing references) //IL_0123: Unknown result type (might be due to invalid IL or missing references) //IL_016c: 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_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_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_020d: 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_0215: Unknown result type (might be due to invalid IL or missing references) //IL_021a: Unknown result type (might be due to invalid IL or missing references) //IL_021f: 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_0449: 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_019c: 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_01ca: 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_027d: Unknown result type (might be due to invalid IL or missing references) //IL_0287: 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_029a: 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_033c: 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_0366: 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_03c5: Unknown result type (might be due to invalid IL or missing references) //IL_03cd: Unknown result type (might be due to invalid IL or missing references) //IL_03d1: Unknown result type (might be due to invalid IL or missing references) //IL_03f8: Unknown result type (might be due to invalid IL or missing references) //IL_03fd: 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_0423: Unknown result type (might be due to invalid IL or missing references) stats = default(GroundCorridorStats); RoutePathCacheKey key = MakeGroundCorridorCacheKey(startPos, endPos); if (TryGetCachedGroundCorridor(key, out var stats2, out var found)) { stats = stats2; return found; } Vector3 val = endPos - startPos; val.y = 0f; float magnitude = ((Vector3)(ref val)).magnitude; if (magnitude < 0.2f) { if (!TryFindGround(endPos, out var hit) || !IsSafeStandableRouteHit(hit, requireSupport: false)) { return StoreGroundCorridorAndReturn(key, found: false, stats); } stats.EndPoint = ((RaycastHit)(ref hit)).point; return StoreGroundCorridorAndReturn(key, found: true, stats); } if (magnitude > 14.5f) { return StoreGroundCorridorAndReturn(key, found: false, stats); } Vector3 normalized = ((Vector3)(ref val)).normalized; int num = Mathf.Clamp(Mathf.CeilToInt(magnitude / 0.72f), 1, 24); Vector3 val2 = startPos; if (!TryFindGround(startPos, out var hit2) && !TryFindGround(startPos + Vector3.up * 0.15f, out hit2)) { return StoreGroundCorridorAndReturn(key, found: false, stats); } val2 = ((RaycastHit)(ref hit2)).point; if (!IsSafeStandableRouteHit(hit2, requireSupport: false)) { if (!TryFindGround(startPos + Vector3.up * 0.15f, out hit2) || !IsRouteGroundColliderStandable(((RaycastHit)(ref hit2)).collider) || !IsRoughStandableNormal(((RaycastHit)(ref hit2)).normal)) { return StoreGroundCorridorAndReturn(key, found: false, stats); } val2 = ((RaycastHit)(ref hit2)).point; } float num2 = 0f; float num3 = 0f; float num4 = 0f; float num5 = 0f; float num6 = 0f; bool hasSlope = false; bool needsSmallHops = false; for (int i = 1; i <= num; i++) { float num7 = (float)i / (float)num; Vector3 point = startPos + normalized * (magnitude * num7); if (!TryFindGround(point, out var hit3)) { return StoreGroundCorridorAndReturn(key, found: false, stats); } bool requireSupport = i == num; if (!IsSafeStandableRouteHit(hit3, requireSupport)) { return StoreGroundCorridorAndReturn(key, found: false, stats); } float num8 = ((RaycastHit)(ref hit3)).point.y - val2.y; float num9 = val2.y - ((RaycastHit)(ref hit3)).point.y; num5 = Mathf.Max(num5, num8); num6 = Mathf.Max(num6, num9); if (num8 > 0.95f) { if (num8 > 1.55f || GetStamina01() < 0.16f) { return StoreGroundCorridorAndReturn(key, found: false, stats); } needsSmallHops = true; } if (num9 > 1.2f || num9 > 10f) { return StoreGroundCorridorAndReturn(key, found: false, stats); } if (IsRoughTerrainLineBlocked(val2, ((RaycastHit)(ref hit3)).point)) { return StoreGroundCorridorAndReturn(key, found: false, stats); } float num10 = Vector3.Distance(val2, ((RaycastHit)(ref hit3)).point); num2 += num10; if (num8 > 0f) { num3 += num8; } if (num9 > 0f) { num4 += num9; } float num11 = ((num10 > 0.05f) ? Mathf.Abs(Mathf.Atan2(((RaycastHit)(ref hit3)).point.y - val2.y, HelperFunctions.FlatDistance(val2, ((RaycastHit)(ref hit3)).point)) * 57.29578f) : 0f); if (num11 > 12f || Vector3.Angle(((RaycastHit)(ref hit3)).normal, Vector3.up) > 18f) { hasSlope = true; } val2 = ((RaycastHit)(ref hit3)).point; } stats = new GroundCorridorStats { EndPoint = val2, PathLength = Mathf.Max(num2, magnitude), TotalRise = num3, TotalDrop = num4, MaxStepRise = num5, MaxStepDrop = num6, HasSlope = hasSlope, NeedsSmallHops = needsSmallHops }; StoreGroundCorridorCache(key, found: true, stats); return true; } private RoutePathCacheKey MakeGroundCorridorCacheKey(Vector3 startPos, Vector3 endPos) { //IL_0002: 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_0024: 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_0046: 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) return new RoutePathCacheKey(QuantizePlanner(startPos.x, 0.85f), QuantizePlanner(startPos.y, 0.85f), QuantizePlanner(startPos.z, 0.85f), QuantizePlanner(endPos.x, 0.85f), QuantizePlanner(endPos.y, 0.85f), QuantizePlanner(endPos.z, 0.85f), 0, 901); } private bool TryGetCachedGroundCorridor(RoutePathCacheKey key, out GroundCorridorStats stats, out bool found) { stats = default(GroundCorridorStats); found = false; if (_groundCorridorCache.TryGetValue(key, out GroundCorridorCacheEntry value) && Time.time - value.CreatedAt <= 0.35f) { stats = value.Stats; found = value.Found; return true; } return false; } private bool StoreGroundCorridorAndReturn(RoutePathCacheKey key, bool found, GroundCorridorStats stats) { StoreGroundCorridorCache(key, found, stats); return found; } private void StoreGroundCorridorCache(RoutePathCacheKey key, bool found, GroundCorridorStats stats) { _groundCorridorCache[key] = new GroundCorridorCacheEntry { Found = found, Stats = stats, CreatedAt = Time.time }; PruneGroundCorridorCache(); } private void PruneGroundCorridorCache() { if (_groundCorridorCache.Count <= 160) { return; } _pathCacheRemovalScratch.Clear(); float time = Time.time; foreach (KeyValuePair item in _groundCorridorCache) { if (time - item.Value.CreatedAt > 0.7f) { _pathCacheRemovalScratch.Add(item.Key); } } for (int i = 0; i < _pathCacheRemovalScratch.Count; i++) { _groundCorridorCache.Remove(_pathCacheRemovalScratch[i]); } while (_groundCorridorCache.Count > 160) { RoutePathCacheKey key = default(RoutePathCacheKey); float num = float.PositiveInfinity; bool flag = false; foreach (KeyValuePair item2 in _groundCorridorCache) { if (item2.Value.CreatedAt < num) { num = item2.Value.CreatedAt; key = item2.Key; flag = true; } } if (!flag) { break; } _groundCorridorCache.Remove(key); } } private bool IsPlanStartTransitionReachable(Vector3 startPos, PathPlan plan, out RouteFailureReason reason) { //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_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) //IL_0268: 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_0072: 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_00c6: 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_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_01f2: Unknown result type (might be due to invalid IL or missing references) //IL_01f4: 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_027e: 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_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_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_0179: 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_0101: 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_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_022a: 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_0114: 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_023b: 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) reason = RouteFailureReason.Unknown; Vector3 planProjectedEndPoint = GetPlanProjectedEndPoint(plan); GroundCorridorStats stats; switch (plan.Action) { case PathActionType.Direct: case PathActionType.Detour: case PathActionType.SlopeWalk: { Vector3 endPos = (plan.HasProjectedEndPoint ? plan.ProjectedEndPoint : plan.Goal); if (!TryValidateGroundCorridor(startPos, endPos, out stats)) { reason = RouteFailureReason.PathBlocked; return false; } return true; } case PathActionType.Climb: case PathActionType.WallTraverse: case PathActionType.CornerClimb: case PathActionType.Mantle: case PathActionType.RopeClimb: if (plan.RequiredStamina > GetRecoverableStaminaCeiling() + 0.02f) { reason = RouteFailureReason.StaminaTooLow; return false; } if (Vector3.Distance(startPos, plan.Anchor) > 1.2f && !TryValidateGroundCorridor(startPos, plan.Anchor, out stats)) { reason = RouteFailureReason.PathBlocked; return false; } if (plan.ClimbTopPoint != Vector3.zero && !HasMantleSpaceAt(plan.ClimbTopPoint)) { reason = RouteFailureReason.MantleFailed; return false; } return true; case PathActionType.JumpGrab: if (plan.RequiredStamina > GetRecoverableStaminaCeiling() + 0.02f) { reason = RouteFailureReason.StaminaTooLow; return false; } if (Vector3.Distance(startPos, plan.Anchor) > 1.2f && !TryValidateGroundCorridor(startPos, plan.Anchor, out stats)) { reason = RouteFailureReason.PathBlocked; return false; } if (plan.ClimbTopPoint == Vector3.zero || !HasMantleSpaceAt(plan.ClimbTopPoint)) { reason = RouteFailureReason.JumpGrabFailed; return false; } return true; case PathActionType.GapJump: case PathActionType.DropDown: { if (Vector3.Distance(startPos, plan.Anchor) > 1.15f && !TryValidateGroundCorridor(startPos, plan.Anchor, out stats)) { reason = RouteFailureReason.PathBlocked; return false; } if (!TryFindGround(plan.HasProjectedEndPoint ? plan.ProjectedEndPoint : plan.Goal, out var hit) || !IsSafeStandableRoutePoint(((RaycastHit)(ref hit)).point, ((RaycastHit)(ref hit)).normal, requireSupport: false)) { reason = RouteFailureReason.PathBlocked; return false; } return true; } case PathActionType.AnchorAssist: if (Vector3.Distance(startPos, plan.Anchor) > 1.15f && !TryValidateGroundCorridor(startPos, plan.Anchor, out stats)) { reason = RouteFailureReason.RouteAssistFailed; return false; } return true; default: return true; } } private float EstimateHumanActionTimeCost(PathPlan plan, Vector3 from, Vector3 end) { //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_0009: 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) float num = HelperFunctions.FlatDistance(from, end); float num2 = Mathf.Abs(end.y - from.y); float num3; switch (plan.Action) { case PathActionType.Direct: num3 = num * 0.34f + num2 * 0.18f; break; case PathActionType.SlopeWalk: num3 = num * 0.42f + num2 * 0.3f; break; case PathActionType.Detour: num3 = num * 0.46f + num2 * 0.22f; break; case PathActionType.GapJump: num3 = num * 0.55f + 1.15f + plan.RequiredStamina * 2f; break; case PathActionType.DropDown: num3 = num * 0.5f + 0.7f + Mathf.Max(0f, plan.ExpectedDropHeight - 10f) * 0.15f; break; case PathActionType.Climb: case PathActionType.Mantle: case PathActionType.RopeClimb: num3 = 2.15f + num * 0.42f + Mathf.Max(num2, plan.EstimatedClimbHeight) * 1.55f + plan.RequiredStamina * 3f; break; case PathActionType.JumpGrab: num3 = 2.7f + num * 0.45f + Mathf.Max(num2, plan.EstimatedClimbHeight) * 1.85f + plan.RequiredStamina * 3.4f; break; case PathActionType.WallTraverse: num3 = 2.35f + num * 0.7f + num2 * 1.35f + plan.RequiredStamina * 3.2f + plan.RiskScore; break; case PathActionType.CornerClimb: num3 = 2.9f + num * 0.8f + num2 * 1.55f + plan.RequiredStamina * 3.8f + plan.RiskScore * 1.5f; break; case PathActionType.AnchorAssist: num3 = 1.1f + num * 0.5f + num2 * 0.55f + plan.RiskScore; break; default: num3 = num * 0.55f + num2 * 0.55f; break; } if (plan.RequiredStamina > GetStamina01() && IsClimbPlan(plan)) { num3 += 4f; } return num3; } private bool TryBuildObstacleBypassPlanFrom(Vector3 startPos, Vector3 toTargetDir, float currentFlatDist, bool targetAbove, out PathPlan plan) { //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_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) //IL_00a7: 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_00ad: 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_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_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_0250: Unknown result type (might be due to invalid IL or missing references) //IL_0251: Unknown result type (might be due to invalid IL or missing references) //IL_0258: 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_0262: 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_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_0278: 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_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_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_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_02be: 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_018b: 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_0195: 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_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_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_031e: Unknown result type (might be due to invalid IL or missing references) //IL_0321: Unknown result type (might be due to invalid IL or missing references) //IL_033f: Unknown result type (might be due to invalid IL or missing references) //IL_0344: Unknown result type (might be due to invalid IL or missing references) plan = new PathPlan(); if (!HasActiveGoal()) { return false; } if (!TryProbeRouteFrom(startPos, toTargetDir, 2.2f, out var probe)) { return false; } if ((!probe.ObstacleAhead || probe.ClimbableAhead) && !probe.UnsafeDropAhead) { return false; } bool flag = false; float num = float.NegativeInfinity; PathPlan pathPlan = new PathPlan(); float[] obstacleBypassAngles = ObstacleBypassAngles; foreach (float num2 in obstacleBypassAngles) { Vector3 val = Quaternion.AngleAxis(num2, Vector3.up) * toTargetDir; if (!TryProbeRouteFrom(startPos, val, 2.2f, out var probe2)) { continue; } float blockedPenalty = GetBlockedPenalty(startPos + val * 2.2f); float num3 = Mathf.Abs(num2) * 0.018f; if (probe2.GapJumpable) { float num4 = HelperFunctions.FlatDistance(probe2.GapLandingPoint, GetGoalCenter()); float num5 = currentFlatDist - num4; if (num5 >= 0.55f) { PathPlan pathPlan2 = new PathPlan { Action = PathActionType.GapJump, Goal = probe2.GapLandingPoint, Anchor = startPos + val * Mathf.Clamp(Mathf.Max(0.9f, probe2.ObstacleAhead ? (probe2.ObstacleDistance - 0.2f) : 1f), 0.9f, 1.45f), TargetAbove = targetAbove, RequiredStamina = Mathf.Clamp(0.18f + probe2.GapLandingDrop * 0.04f, 0.18f, 0.5f), ReachableWithinRecoverableBudget = true, ProjectedEndPoint = probe2.GapLandingPoint, HasProjectedEndPoint = true }; float num6 = num5 * 2.1f + 1.15f - num3 - blockedPenalty - GetFailedSegmentPenalty(pathPlan2); if (Mathf.Abs(num2) <= 18f) { num6 += 0.25f; } pathPlan2.Score = num6; if (!flag || num6 > num) { flag = true; num = num6; pathPlan = pathPlan2; } } } Vector3 point = startPos + val * 3f; if (!TryFindGround(point, out var hit)) { continue; } float num7 = startPos.y - ((RaycastHit)(ref hit)).point.y; if (num7 <= 10f) { float num8 = HelperFunctions.FlatDistance(((RaycastHit)(ref hit)).point, GetGoalCenter()); float num9 = currentFlatDist - num8; bool flag2 = IsRoughTerrainLineBlocked(startPos, ((RaycastHit)(ref hit)).point); float num10 = num9 + 0.75f - num3 - blockedPenalty - (flag2 ? 0.65f : 0f); PathPlan pathPlan3 = new PathPlan { Action = PathActionType.Detour, Goal = ((RaycastHit)(ref hit)).point, Anchor = ((RaycastHit)(ref hit)).point, TargetAbove = targetAbove, RequiredStamina = EstimateGroundChaseCost(Vector3.Distance(startPos, ((RaycastHit)(ref hit)).point)), ReachableWithinRecoverableBudget = true, ProjectedEndPoint = ((RaycastHit)(ref hit)).point, HasProjectedEndPoint = true }; num10 = (pathPlan3.Score = num10 - GetFailedSegmentPenalty(pathPlan3)); if (!flag || num10 > num) { flag = true; num = num10; pathPlan = pathPlan3; } } } if (flag) { plan = pathPlan; return true; } return false; } private bool TryBuildTerrainFallbackPlanFrom(Vector3 startPos, Vector3 preferredDir, float currentFlatDist, bool targetAbove, out PathPlan plan) { //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_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_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_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) //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_00f9: 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_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_0117: Unknown result type (might be due to invalid IL or missing references) //IL_011d: Unknown result type (might be due to invalid IL or missing references) //IL_0153: 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_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_0163: 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_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_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_01a5: 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_01ca: 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_01db: 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_0210: 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_0271: 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_02fb: 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_0374: 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_0390: 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_03b1: Unknown result type (might be due to invalid IL or missing references) //IL_03b6: Unknown result type (might be due to invalid IL or missing references) plan = new PathPlan(); if (!HasActiveGoal()) { return false; } Vector3 val = preferredDir; val.y = 0f; if (((Vector3)(ref val)).sqrMagnitude < 0.01f && (Object)(object)_character != (Object)null && (Object)(object)_character.data != (Object)null) { val = _character.data.lookDirection_Flat; val.y = 0f; } if (((Vector3)(ref val)).sqrMagnitude < 0.01f && (Object)(object)_character != (Object)null) { val = ((Component)_character).transform.forward; val.y = 0f; } if (((Vector3)(ref val)).sqrMagnitude < 0.01f) { val = Vector3.forward; } ((Vector3)(ref val)).Normalize(); Vector3 goalCenter = GetGoalCenter(); float num = ((currentFlatDist > 0.01f) ? currentFlatDist : HelperFunctions.FlatDistance(startPos, goalCenter)); float num2 = Mathf.Abs(goalCenter.y - startPos.y); bool flag = goalCenter.y - startPos.y < -1.25f; bool flag2 = false; float num3 = float.NegativeInfinity; PathPlan pathPlan = new PathPlan(); for (int i = 0; i < OverheadAngles.Length; i++) { float num4 = OverheadAngles[i]; Vector3 val2 = Quaternion.AngleAxis(num4, Vector3.up) * val; for (int j = 0; j < TerrainFallbackDistances.Length; j++) { float num5 = TerrainFallbackDistances[j]; Vector3 point = startPos + val2 * num5; if (!TryFindGround(point, out var hit) || !IsRoughStandableNormal(((RaycastHit)(ref hit)).normal)) { continue; } float num6 = ((RaycastHit)(ref hit)).point.y - startPos.y; float num7 = startPos.y - ((RaycastHit)(ref hit)).point.y; if (num6 > 2.15f || num7 > 6.5f) { continue; } float num8 = HelperFunctions.FlatDistance(((RaycastHit)(ref hit)).point, goalCenter); float num9 = num - num8; float num10 = num2 - Mathf.Abs(goalCenter.y - ((RaycastHit)(ref hit)).point.y); if (!(num9 < -0.25f) || !(num10 < 0.35f) || _stuckCount > 0 || _failedClimbCount > 0) { bool flag3 = IsRoughTerrainLineBlocked(startPos, ((RaycastHit)(ref hit)).point); bool flag4 = !flag3; float num11 = 0f; num11 += num9 * 1.55f; num11 += num10 * 0.95f; num11 -= Mathf.Abs(num4) * 0.012f; num11 -= num5 * 0.035f; num11 -= Mathf.Abs(num6) * 0.07f; num11 -= Mathf.Max(0f, num7 - 1f) * 0.035f; num11 -= GetBlockedPenalty(((RaycastHit)(ref hit)).point); num11 = ((!flag4) ? (num11 - 0.45f) : (num11 + 0.65f)); if (flag && num7 > 0.35f) { num11 += Mathf.Min(num7, 4f) * 0.3f; } PathPlan pathPlan2 = new PathPlan { Action = (flag4 ? PathActionType.Direct : PathActionType.Detour), Goal = ((RaycastHit)(ref hit)).point, Anchor = ((RaycastHit)(ref hit)).point, TargetAbove = targetAbove, RequiredStamina = EstimateGroundChaseCost(Vector3.Distance(startPos, ((RaycastHit)(ref hit)).point)), ReachableWithinRecoverableBudget = true, ProjectedEndPoint = ((RaycastHit)(ref hit)).point, HasProjectedEndPoint = true }; num11 = (pathPlan2.Score = num11 - GetFailedSegmentPenalty(pathPlan2)); if (!flag2 || num11 > num3) { flag2 = true; num3 = num11; pathPlan = pathPlan2; } } } } if (!flag2) { return false; } plan = pathPlan; return true; } private bool TryCreateRoughWalkDirectPlan(Vector3 startPos, Vector3 dir, float flatDist, Vector3 goalLook, bool targetAbove, out PathPlan plan) { //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_002f: 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_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_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_008a: 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_0165: 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_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_017f: 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_01fe: Unknown result type (might be due to invalid IL or missing references) //IL_0200: Unknown result type (might be due to invalid IL or missing references) //IL_0206: Unknown result type (might be due to invalid IL or missing references) //IL_0208: 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_022b: 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_01ab: 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_00d3: 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_00e4: 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_01c4: 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) plan = new PathPlan(); if (flatDist < 0.2f) { return false; } float num = Mathf.Min(flatDist, 4.25f); Vector3 val = startPos; if (TryFindGround(startPos, out var hit)) { val = ((RaycastHit)(ref hit)).point; } int num2 = Mathf.Clamp(Mathf.CeilToInt(num / 0.55f), 1, 8); float num3 = 0f; float num4 = 0f; for (int i = 1; i <= num2; i++) { float num5 = num * ((float)i / (float)num2); Vector3 point = startPos + dir * num5; if (!TryFindGround(point, out var hit2)) { return false; } if (!IsRoughStandableNormal(((RaycastHit)(ref hit2)).normal)) { return false; } float num6 = ((RaycastHit)(ref hit2)).point.y - val.y; float num7 = val.y - ((RaycastHit)(ref hit2)).point.y; if (num6 > 0.72f || num7 > 0.9f) { return false; } if (num6 > 0f) { num4 += num6; } if (num7 > 0f) { num3 += num7; } val = ((RaycastHit)(ref hit2)).point; } RaycastHit val2 = default(RaycastHit); if (Physics.SphereCast(startPos + Vector3.up * 1.45f, 0.18f, dir, ref val2, Mathf.Min(num, 2.2f), TerrainMask, (QueryTriggerInteraction)1)) { float num8 = ((RaycastHit)(ref val2)).point.y - startPos.y; if (!(num8 <= 0.85f) && !(Vector3.Angle(((RaycastHit)(ref val2)).normal, Vector3.up) <= 68f)) { return false; } } plan = new PathPlan { Action = PathActionType.Direct, Goal = goalLook, Anchor = goalLook, TargetAbove = targetAbove, RequiredStamina = EstimateGroundChaseCost(num), ReachableWithinRecoverableBudget = true, ProjectedEndPoint = val, HasProjectedEndPoint = true, Score = 2.2f + num3 * 0.25f - num4 * 0.1f }; return true; } private void ExecuteGroundPlan(PathPlan plan) { //IL_0056: Unknown result type (might be due to invalid IL or missing references) //IL_0305: 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_0378: Unknown result type (might be due to invalid IL or missing references) //IL_0635: 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_0656: 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_07a1: Unknown result type (might be due to invalid IL or missing references) //IL_07b2: Unknown result type (might be due to invalid IL or missing references) //IL_07b8: 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_08ae: 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_015e: 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_09c1: Unknown result type (might be due to invalid IL or missing references) //IL_09ce: 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_04a6: 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_007c: 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_0324: Unknown result type (might be due to invalid IL or missing references) //IL_039f: 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_0670: Unknown result type (might be due to invalid IL or missing references) //IL_0668: Unknown result type (might be due to invalid IL or missing references) //IL_07d6: Unknown result type (might be due to invalid IL or missing references) //IL_08da: 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_09b7: Unknown result type (might be due to invalid IL or missing references) //IL_0a02: Unknown result type (might be due to invalid IL or missing references) //IL_09fa: 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_0172: 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_0187: Unknown result type (might be due to invalid IL or missing references) //IL_0509: Unknown result type (might be due to invalid IL or missing references) //IL_050e: Unknown result type (might be due to invalid IL or missing references) //IL_04c4: Unknown result type (might be due to invalid IL or missing references) //IL_04d1: Unknown result type (might be due to invalid IL or missing references) //IL_04de: 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_034a: 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_0675: Unknown result type (might be due to invalid IL or missing references) //IL_0834: Unknown result type (might be due to invalid IL or missing references) //IL_0839: Unknown result type (might be due to invalid IL or missing references) //IL_0840: 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_0a07: Unknown result type (might be due to invalid IL or missing references) //IL_0a0a: Unknown result type (might be due to invalid IL or missing references) //IL_0a13: 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_0537: 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_0520: 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) //IL_052f: 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_00a7: 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_0685: 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_03c0: Unknown result type (might be due to invalid IL or missing references) //IL_0700: Unknown result type (might be due to invalid IL or missing references) //IL_071d: Unknown result type (might be due to invalid IL or missing references) //IL_0722: Unknown result type (might be due to invalid IL or missing references) //IL_06f2: Unknown result type (might be due to invalid IL or missing references) //IL_0968: 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_0280: 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_01b4: 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_01c4: Unknown result type (might be due to invalid IL or missing references) //IL_01c9: 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_0299: 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_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_03e1: 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_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_0240: Unknown result type (might be due to invalid IL or missing references) //IL_024a: Unknown result type (might be due to invalid IL or missing references) //IL_024f: Unknown result type (might be due to invalid IL or missing references) //IL_0254: Unknown result type (might be due to invalid IL or missing references) //IL_05b1: Unknown result type (might be due to invalid IL or missing references) //IL_05b6: 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_0431: Unknown result type (might be due to invalid IL or missing references) //IL_041f: Unknown result type (might be due to invalid IL or missing references) //IL_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_06bb: Unknown result type (might be due to invalid IL or missing references) //IL_06c9: Unknown result type (might be due to invalid IL or missing references) //IL_058c: 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_0584: 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_011a: Unknown result type (might be due to invalid IL or missing references) switch (plan.Action) { case PathActionType.Direct: { LookAt(plan.Goal); float num2 = (HasActiveGoal() ? HelperFunctions.FlatDistance(_character.Center, GetGoalCenter()) : 999f); float num3 = (HasActiveGoal() ? Mathf.Abs(GetGoalCenter().y - _character.Center.y) : 999f); bool flag = num2 <= 1.65f && num3 <= 1.15f; bool sprintRequested2 = ((!flag) ? (HasStaminaForSprint() && num2 > 1.65f) : (num2 > 0.9f && GetStamina01() > 0.05f)); bool tryJump2 = !flag || ShouldHopSmallObstacleTowards(plan.Goal); WalkTowards(plan.Goal, flag ? 0.85f : 1f, tryClimb: true, tryJump2, sprintRequested2); if (!flag) { TryTravelHop(); } break; } case PathActionType.SlopeWalk: { bool flag2 = ShouldSlopeSettleAssist(plan); Vector3 val2 = plan.Goal; if (flag2) { Vector3 val3 = plan.Goal - _character.Center; val3.y = 0f; if (((Vector3)(ref val3)).sqrMagnitude < 0.01f && HasActiveGoal()) { val3 = GetGoalCenter() - _character.Center; val3.y = 0f; } if (((Vector3)(ref val3)).sqrMagnitude < 0.01f) { val3 = ((Component)_character).transform.forward; val3.y = 0f; } if (((Vector3)(ref val3)).sqrMagnitude > 0.01f) { ((Vector3)(ref val3)).Normalize(); val2 = plan.Goal + val3 * 1.25f + Vector3.up * 0.35f; } } LookAt(val2); bool flag3 = !flag2 && ShouldHopSmallObstacleTowards(val2); bool sprintRequested3 = HasStaminaForSprint() && Vector3.Distance(_character.Center, val2) > 2.25f; WalkTowards(val2, 1f, flag2, flag3, sprintRequested3); if (flag2 && GetStamina01() > 0.1f && !IsFullStaminaRetryPendingForCurrentGoal()) { _character.refs.climbing.TryClimb(0.85f); } if (flag3) { TryTravelHop(); } break; } case PathActionType.Detour: { LookAt(plan.Goal); bool sprintRequested = HasStaminaForSprint() && Vector3.Distance(_character.Center, plan.Goal) > 1.85f; bool tryJump = ShouldHopSmallObstacleTowards(plan.Goal); WalkTowards(plan.Goal, 1f, tryClimb: false, tryJump, sprintRequested); TryTravelHop(); break; } case PathActionType.Climb: case PathActionType.WallTraverse: case PathActionType.CornerClimb: case PathActionType.Mantle: case PathActionType.RopeClimb: { float num7 = Vector3.Distance(_character.Center, plan.Anchor); bool flag5 = num7 <= 1.35f; Vector3 val5 = (flag5 ? plan.Goal : plan.Anchor); if (!CanStartClimbWithRetryGate(plan)) { LookAt(flag5 ? plan.Goal : plan.Anchor); if (!flag5) { WalkTowards(plan.Anchor, 0.95f, tryClimb: false, tryJump: false, HasStaminaForSprint() && num7 > 2.25f); } else { HoldForStamina((plan.Goal != Vector3.zero) ? plan.Goal : (plan.Anchor + Vector3.up)); } } else { LookAt(val5); bool flag6 = !flag5 && num7 > 1.8f && ShouldAggressiveSprint(); WalkTowards(val5, flag5 ? 0.95f : 1f, tryClimb: true, tryJump: false, flag6 && !flag5); TryForceJumpGrab(plan, flag5); } break; } case PathActionType.AnchorAssist: { float num = Vector3.Distance(_character.Center, plan.Anchor); if (num > 1.1f) { LookAt(plan.Anchor); WalkTowards(plan.Anchor, 1f, tryClimb: false, ShouldHopSmallObstacleTowards(plan.Anchor), HasStaminaForSprint() && num > 2f); break; } LookAt((plan.Goal != Vector3.zero) ? plan.Goal : (plan.Anchor + Vector3.up * 1.5f)); SetSprint(sprinting: false); if (IsFullStaminaRetryPendingForCurrentGoal() || !HasRecoveredFullStaminaForClimbStart(plan)) { HoldForStamina((plan.Goal != Vector3.zero) ? plan.Goal : (plan.Anchor + Vector3.up)); break; } _character.input.movementInput = new Vector2(0f, 0.65f); _character.refs.climbing.TryClimb(1.25f); if (_character.data.isGrounded && Time.time - _lastAutoJumpTime >= 0.2f && HasRecoveredFullStaminaForClimbStart(plan)) { _character.input.jumpWasPressed = true; _lastAutoJumpTime = Time.time; } break; } case PathActionType.JumpGrab: { float num6 = Vector3.Distance(_character.Center, plan.Anchor); bool flag4 = num6 <= 1.15f; Vector3 val4 = ((plan.JumpGrabAimPoint != Vector3.zero) ? plan.JumpGrabAimPoint : plan.Goal); if (!flag4) { LookAt(plan.Anchor); bool sprintRequested5 = num6 > 2f && ShouldAggressiveSprint(); bool tryClimb = num6 <= 1.85f && CanStartClimbWithRetryGate(plan); WalkTowards(plan.Anchor, 1f, tryClimb, ShouldHopSmallObstacleTowards(plan.Anchor), sprintRequested5); break; } if (!CanStartClimbWithRetryGate(plan)) { HoldForStamina(val4); break; } LookAt(val4); _character.input.movementInput = new Vector2(0f, 1f); SetSprint(sprinting: false); _character.refs.climbing.TryClimb(1.6f); if (_character.data.isGrounded && Time.time - _lastAutoJumpTime >= 0.2f) { _character.input.jumpWasPressed = true; _lastAutoJumpTime = Time.time; } break; } case PathActionType.GapJump: { LookAt(plan.Goal); float num4 = Vector3.Distance(_character.Center, plan.Anchor); if (num4 > 1.15f) { WalkTowards(plan.Anchor, 1f, tryClimb: false, tryJump: false, HasStaminaForSprint()); break; } if (IsLowStaminaForHeavyAction()) { HoldForStamina(plan.Goal); break; } SetSprint(HasStaminaForSprint()); _character.input.movementInput = new Vector2(0f, 1f); LookAt(plan.Goal); if (_character.data.isGrounded && GetStamina01() >= plan.RequiredStamina) { _character.input.jumpWasPressed = true; _lastAutoJumpTime = Time.time; } break; } case PathActionType.DropDown: { LookAt(plan.Goal); float num5 = Vector3.Distance(_character.Center, plan.Anchor); if (num5 > 1.1f) { bool sprintRequested4 = ShouldAggressiveSprint(); WalkTowards(plan.Anchor, 1f, tryClimb: false, tryJump: false, sprintRequested4); } else if (plan.UsesJumpDropImmunity && !IsLowStaminaForHeavyAction() && GetStamina01() >= plan.RequiredStamina) { SetSprint(HasStaminaForSprint()); _character.input.jumpWasPressed = true; _lastAutoJumpTime = Time.time; } else { SetSprint(sprinting: false); _character.input.movementInput = new Vector2(0f, 1f); } break; } case PathActionType.WaitForStamina: ResetInput(); SetSprint(sprinting: false); if (_character.data.isClimbing) { StopClimb(); } _character.input.movementInput = Vector2.zero; break; case PathActionType.Recover: LookAt(plan.Goal); WalkTowards(plan.Goal, 0.7f, tryClimb: false, tryJump: false, sprintRequested: false); SetSprint(sprinting: false); break; default: { Vector3 val = (HasActiveGoal() ? GetGoalLookPoint() : _character.Head); LookAt(val); WalkTowards(val, 0.7f, tryClimb: false, tryJump: false, sprintRequested: false); break; } } } private bool ShouldAggressiveSprint() { //IL_002e: 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) if (!HasActiveGoal()) { return false; } if (!HasStaminaForSprint()) { return false; } float num = Vector3.Distance(_character.Center, GetGoalCenter()); if (_timeInChase > _zombie.chaseTimeBeforeSprint && num > 3f) { return true; } if (Time.time - _lastSeenTargetTime < 1f && num > 5f) { return true; } return num > 1.75f; } private void TryTravelHop() { //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_00ac: 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) if (_character.data.isGrounded && !(Time.time - _lastAutoJumpTime < 0.2f) && HasActiveGoal()) { float num = Vector3.Distance(_character.Center, GetGoalCenter()); if (!(num < 2f) && (GetStamina01() <= 0.35f || !HasStaminaForSprint()) && (!IsLowStaminaForHeavyAction() || IsFlatTravelHopAllowed(GetGoalCenter()))) { SetSprint(!IsLowStaminaForHeavyAction() && HasStaminaForSprint()); _character.input.movementInput = new Vector2(0f, 1f); _character.input.jumpWasPressed = true; _lastAutoJumpTime = Time.time; } } } private bool ShouldHopSmallObstacleTowards(Vector3 targetPos) { //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_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_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_0064: 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_0090: 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_009b: Unknown result type (might be due to invalid IL or missing references) //IL_00a0: Unknown result type (might be due to invalid IL or missing references) //IL_00a5: Unknown result type (might be due to invalid IL or missing references) //IL_00a7: 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_00d3: 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_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_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_011e: Unknown result type (might be due to invalid IL or missing references) //IL_0123: Unknown result type (might be due to invalid IL or missing references) //IL_0128: Unknown result type (might be due to invalid IL or missing references) //IL_012a: Unknown result type (might be due to invalid IL or missing references) //IL_012c: Unknown result type (might be due to invalid IL or missing references) //IL_0157: 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_01b6: 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_01df: Unknown result type (might be due to invalid IL or missing references) //IL_021c: Unknown result type (might be due to invalid IL or missing references) //IL_0221: 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_022c: Unknown result type (might be due to invalid IL or missing references) //IL_0231: Unknown result type (might be due to invalid IL or missing references) //IL_0234: 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_025e: Unknown result type (might be due to invalid IL or missing references) Vector3 val = targetPos - _character.Center; val.y = 0f; if (((Vector3)(ref val)).sqrMagnitude < 0.01f) { return false; } ((Vector3)(ref val)).Normalize(); Vector3 val2 = _character.Head + Vector3.down * 0.45f; RaycastHit obstacleHit = default(RaycastHit); if (!Physics.Raycast(val2, val, ref obstacleHit, 1f, TerrainMask, (QueryTriggerInteraction)1)) { return false; } Vector3 point = _character.Center + val * 0.35f; if (!TryFindGround(point, out var hit)) { return false; } float num = Mathf.Abs(((RaycastHit)(ref hit)).point.y - _character.Center.y); if (num > 0.45f) { return false; } Vector3 val3 = ((RaycastHit)(ref obstacleHit)).point + val * 0.18f + Vector3.up * 1.9000001f; RaycastHit val4 = default(RaycastHit); if (!Physics.Raycast(val3, Vector3.down, ref val4, 2.3000002f, TerrainMask, (QueryTriggerInteraction)1)) { return false; } float num2 = ((RaycastHit)(ref val4)).point.y - _character.Center.y; if (num2 < 0.15f || num2 > 1.1f) { return false; } if (num2 >= 1f) { return false; } if (!IsRoughClimbTopNormal(((RaycastHit)(ref val4)).normal)) { return false; } if (TryProbeClimbableFrom(_character.Center, val, obstacleHit, out var _, out var climbHeight, out var _, out var _) && (climbHeight >= 1f || num2 > 0.95f)) { return false; } Vector3 point2 = _character.Center + val * 1.15f; if (!TryFindGround(point2, out var hit2)) { return false; } float num3 = Mathf.Abs(((RaycastHit)(ref hit2)).point.y - _character.Center.y); if (num3 > 0.85f) { return false; } return true; } private PathPlan BuildPathPlanFrom(Vector3 startPos) { //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_0037: 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_003c: 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_0055: 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_0069: 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_00ac: 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_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_00af: 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) //IL_00c5: 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_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_00d0: 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_00f1: 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_0117: 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_0126: 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_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_01dd: 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_0208: 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_0217: Unknown result type (might be due to invalid IL or missing references) //IL_021c: Unknown result type (might be due to invalid IL or missing references) //IL_01f7: 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_018a: 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_01a4: 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_0250: Unknown result type (might be due to invalid IL or missing references) //IL_0251: Unknown result type (might be due to invalid IL or missing references) //IL_01c3: 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_0273: Unknown result type (might be due to invalid IL or missing references) //IL_028f: 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_02c1: 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_02f1: Unknown result type (might be due to invalid IL or missing references) //IL_02f2: 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_032b: 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_0379: 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_039d: 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_03e4: Unknown result type (might be due to invalid IL or missing references) //IL_0439: 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_045d: 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_04b1: Unknown result type (might be due to invalid IL or missing references) //IL_04b7: 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_04c7: 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_04e1: 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_0541: 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_05cc: 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_0580: Unknown result type (might be due to invalid IL or missing references) //IL_05a3: 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_051d: Unknown result type (might be due to invalid IL or missing references) //IL_051e: Unknown result type (might be due to invalid IL or missing references) //IL_05e8: Unknown result type (might be due to invalid IL or missing references) if (!HasActiveGoal()) { return new PathPlan { Action = PathActionType.None }; } Vector3 rawGoalCenter = GetRawGoalCenter(); Vector3 val = (_hasResolvedGoalPoint ? _resolvedGoalPoint : rawGoalCenter); bool flag = false; if (_hasResolvedGoalPoint) { float num = HelperFunctions.FlatDistance(rawGoalCenter, val); float num2 = Mathf.Abs(rawGoalCenter.y - val.y); float num3 = HelperFunctions.FlatDistance(startPos, rawGoalCenter); if (_resolvedGoalIsStandable || num >= 0.55f || num2 >= 0.45f || num3 <= 2.2f) { flag = true; } } Vector3 val2 = (flag ? val : rawGoalCenter); Vector3 val3 = val2 + Vector3.up * 0.15f; Vector3 val4 = val2 - startPos; Vector3 val5 = default(Vector3); ((Vector3)(ref val5))..ctor(val4.x, 0f, val4.z); float magnitude = ((Vector3)(ref val5)).magnitude; float num4 = val2.y - startPos.y; bool flag2 = num4 > 1.4f; bool flag3 = num4 < -1.25f; if (IsAlreadyStableAtGoalAccess(startPos, val2)) { return BuildHoldPlan(val3, flag2); } if (flag3 && magnitude <= 0.35f && TryBuildVerticalDropPlanFrom(startPos, num4, out PathPlan plan)) { return plan; } if (magnitude < 0.001f) { Vector3 preferredDir = (((Object)(object)_character != (Object)null) ? ((Component)_character).transform.forward : Vector3.forward); if (TryBuildTerrainFallbackPlanFrom(startPos, preferredDir, magnitude, flag2, out PathPlan plan2)) { return plan2; } return BuildHoldPlan(val3, flag2); } Vector3 normalized = ((Vector3)(ref val5)).normalized; if (!TryProbeRouteFrom(startPos, normalized, 2.2f, out var probe)) { return BuildHoldPlan(val3, flag2); } float blockedPenalty = GetBlockedPenalty(startPos + normalized * Mathf.Min(2f, magnitude)); bool flag4 = blockedPenalty >= 1.1f || (_brainState == RobotBrainState.Reposition && Time.time < _repositionUntil); if (TryBuildValidatedGroundTravelPlanFrom(startPos, val2, magnitude, flag2, out PathPlan plan3)) { return plan3; } if (TryCreateRoughWalkDirectPlan(startPos, normalized, magnitude, val3, flag2, out PathPlan plan4)) { return plan4; } if (TryBuildHeightAwareFootholdScanPlanFrom(startPos, val2, magnitude, flag2, flag3, out PathPlan plan5)) { return plan5; } if (num4 > 0.55f && magnitude <= 2.35f && TryBuildImmediateJumpGrabPlanFrom(startPos, val2, out PathPlan plan6) && IsViableClimbPlan(plan6)) { return plan6; } if (flag3) { if (TryCreateImmediateDropPlan(startPos, normalized, magnitude, probe, out PathPlan plan7)) { return plan7; } if (TryBuildVerticalDropPlanFrom(startPos, num4, out PathPlan plan8)) { return plan8; } if (TryBuildDropDownPlanFrom(startPos, normalized, magnitude, num4, out PathPlan plan9)) { return plan9; } } if (num4 > 0.45f && magnitude <= 2.6999998f && probe.ClimbableAhead) { PathPlan plan10 = new PathPlan(); FillClimbPlan(ref plan10, probe.ClimbBasePoint, Mathf.Max(probe.ClimbHeightDelta, num4), targetAbove: true, probe.NeedsJumpStart, probe.ClimbTopPoint, probe.ClimbSurfaceNormal); if (IsViableClimbPlan(plan10)) { return plan10; } } if (flag2 && (probe.UnsafeDropAhead || probe.GapJumpable) && TryBuildJumpGrabPlanFrom(startPos, normalized, targetAbove: true, out PathPlan plan11) && IsViableClimbPlan(plan11)) { return plan11; } if (flag2 && probe.ClimbableAhead && !probe.UnsafeDropAhead) { PathPlan plan12 = new PathPlan(); FillClimbPlan(ref plan12, probe.ClimbBasePoint, Mathf.Max(probe.ClimbHeightDelta, num4), targetAbove: true, probe.NeedsJumpStart, probe.ClimbTopPoint, probe.ClimbSurfaceNormal); if (IsViableClimbPlan(plan12)) { return plan12; } } if (!flag4 && !probe.ObstacleAhead && !probe.UnsafeDropAhead) { return new PathPlan { Action = PathActionType.Direct, Goal = val3, Anchor = val3, TargetAbove = flag2, ProjectedEndPoint = val3, HasProjectedEndPoint = true }; } if (flag2 && TryBuildOverheadAccessPlanFrom(startPos, normalized, num4, out PathPlan plan13) && (plan13.Action != PathActionType.Detour || !(magnitude <= 2.8f) || !(num4 > 0.55f) || (!probe.ClimbableAhead && !TryBuildImmediateJumpGrabPlanFrom(startPos, val2, out PathPlan _)))) { return plan13; } if (TryFindBestLocalPlanFrom(startPos, normalized, magnitude, flag2, out PathPlan bestPlan)) { return bestPlan; } if (!flag3 && probe.ClimbableAhead) { PathPlan plan15 = new PathPlan(); FillClimbPlan(ref plan15, probe.ClimbBasePoint, Mathf.Max(probe.ClimbHeightDelta, Mathf.Abs(num4)), flag2, probe.NeedsJumpStart, probe.ClimbTopPoint, probe.ClimbSurfaceNormal); if (IsViableClimbPlan(plan15)) { return plan15; } } if (TryBuildTerrainFallbackPlanFrom(startPos, normalized, magnitude, flag2, out PathPlan plan16)) { return plan16; } return BuildHoldPlan(val3, flag2); } private void RegisterFailedSegment(PathPlan segment, RouteFailureReason reason = RouteFailureReason.Unknown) { //IL_0032: 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_0073: 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_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_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) if (IsAdvancedRoutingDebugEnabled()) { DebugAdvancedRouting($"route segment failed: action={segment.Action}, reason={reason}, goal={segment.Goal}, anchor={segment.Anchor}"); } if (IsFailureMemoryEnabled()) { RememberRouteChoice(segment); Vector3 direction = segment.Goal - _character.Center; direction.y = 0f; if (((Vector3)(ref direction)).sqrMagnitude > 0.01f) { ((Vector3)(ref direction)).Normalize(); } _failedSegments.Add(new FailedSegmentMemory { Action = segment.Action, Reason = reason, Position = _character.Center, Direction = direction, Until = Time.time + 4f }); } } private float GetFailedSegmentPenalty(PathPlan segment) { //IL_0021: 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_00c1: Unknown result type (might be due to invalid IL or missing references) //IL_00c8: Unknown result type (might be due to invalid IL or missing references) //IL_00d4: 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_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_00f4: 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) if (!IsFailureMemoryEnabled()) { return 0f; } float num = 0f; Vector3 val = segment.Goal - _character.Center; val.y = 0f; if (((Vector3)(ref val)).sqrMagnitude > 0.01f) { ((Vector3)(ref val)).Normalize(); } for (int num2 = _failedSegments.Count - 1; num2 >= 0; num2--) { if (Time.time >= _failedSegments[num2].Until) { _failedSegments.RemoveAt(num2); } else { FailedSegmentMemory failedSegmentMemory = _failedSegments[num2]; float num3 = Vector3.Distance(_character.Center, failedSegmentMemory.Position); float num4 = ((val == Vector3.zero || failedSegmentMemory.Direction == Vector3.zero) ? 0f : Vector3.Dot(val, failedSegmentMemory.Direction)); if (failedSegmentMemory.Action == segment.Action && num3 < 4.5f && num4 > 0.7f) { num += GetFailedSegmentReasonPenalty(failedSegmentMemory.Reason); } } } return num; } private static float GetFailedSegmentReasonPenalty(RouteFailureReason reason) { switch (reason) { case RouteFailureReason.StaminaTooLow: return 1.25f; case RouteFailureReason.WallLost: case RouteFailureReason.MantleFailed: case RouteFailureReason.JumpGrabFailed: case RouteFailureReason.PathBlocked: case RouteFailureReason.RouteAssistFailed: return 4f; case RouteFailureReason.ClimbRetryFailed: return 4.5f; case RouteFailureReason.ProgressTimeout: case RouteFailureReason.NoNetProgress: case RouteFailureReason.StuckRecovery: return 3f; default: return 2.5f; } } private void ReplanRoute() { if (Time.time < _nextReplanTime) { return; } if (!TryReserveRoutePlannerBudget()) { _nextReplanTime = Time.time + GetPlannerStaggerDelay(); return; } _nextReplanTime = Time.time + 0.42f + GetPlannerStaggerDelay() * 0.35f; _segmentQueue.Clear(); ClearActiveSegment(); ClearLockedClimbPlan(); List list = BuildPathSegments(); DebugDrawRouteSegments(list, "ReplanRoute"); for (int i = 0; i < list.Count; i++) { _segmentQueue.Enqueue(list[i]); } if (_segmentQueue.Count > 0) { BeginSegment(_segmentQueue.Dequeue()); ResetRouteProgressWindow(); } else { _hasActiveSegment = false; } } private bool TryReserveRoutePlannerBudget() { int frameCount = Time.frameCount; if (SharedPlannerBudgetFrame != frameCount) { SharedPlannerBudgetFrame = frameCount; SharedPlannerBudgetUsed = 0; } if (SharedPlannerBudgetUsed >= GetConfiguredSharedPlannerPlansPerFrame()) { return false; } SharedPlannerBudgetUsed++; return true; } private float GetPlannerStaggerDelay() { int num = 0; if ((Object)(object)_view != (Object)null) { num = Mathf.Abs(_view.ViewID); } else if ((Object)(object)_character != (Object)null) { num = Mathf.Abs(((Object)_character).GetInstanceID()); } return 0.035f + (float)(num % 9) * 0.018f; } private void LogBrainStateIfChanged() { if (_brainState != _lastLoggedBrainState) { _lastLoggedBrainState = _brainState; Plugin.Log.LogDebug((object)$"BrainState => {_brainState}"); } } private void AdvanceSegmentIfNeeded() { //IL_00cd: Unknown result type (might be due to invalid IL or missing references) //IL_00dd: Unknown result type (might be due to invalid IL or missing references) //IL_0196: 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_0104: 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_0231: 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_0325: 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_02de: 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) if (!_hasActiveSegment) { if (_segmentQueue.Count > 0) { BeginSegment(_segmentQueue.Dequeue()); } return; } if (IsSegmentFinished(_activeSegment)) { if (IsClimbPlan(_activeSegment)) { ClearLockedClimbPlan(); } ClearActiveSegment(); if (_segmentQueue.Count > 0) { BeginSegment(_segmentQueue.Dequeue()); } else { ResetRouteProgressWindow(); } return; } float num = Time.time - _segmentStartTime; if (_activeSegment.Action == PathActionType.Detour) { float num2 = GetGoalCenter().y - _character.Center.y; if (num2 < -1.25f) { float num3 = Vector3.Distance(_character.Center, _activeSegment.Goal); if (num3 > 1.4f && num < 4.5f) { return; } if (num3 <= 1.4f) { ClearActiveSegment(); _segmentQueue.Clear(); _nextReplanTime = 0f; ReplanRoute(); return; } } } if (IsClimbPlan(_activeSegment)) { bool flag = Vector3.Distance(_character.Center, _activeSegment.Anchor) <= 2.25f; if (_character.data.isClimbing || _character.data.isRopeClimbing || _character.data.isVineClimbing || (flag && num < 4.15f)) { return; } } if (_activeSegment.Action == PathActionType.GapJump) { float num4 = Vector3.Distance(_character.Center, _activeSegment.Anchor); if (num4 <= 1.6f && num < 3.8f) { return; } } if (_activeSegment.Action == PathActionType.Recover && num < 0.95f) { return; } if (IsSegmentFailed(_activeSegment)) { if (IsClimbPlan(_activeSegment)) { ClearLockedClimbPlan(); } RegisterFailedSegment(_activeSegment, DetermineRouteFailureReason(_activeSegment, RouteFailureReason.ProgressTimeout)); RegisterBlockedPoint(_character.Center, 3f); _segmentQueue.Clear(); ClearActiveSegment(); ReplanRoute(); return; } bool flag2 = false; if (_activeSegment.Action == PathActionType.Detour) { float num5 = GetGoalCenter().y - _character.Center.y; if (num5 < -1.25f) { flag2 = true; } } else if (_activeSegment.Action == PathActionType.GapJump || _activeSegment.Action == PathActionType.Recover || _activeSegment.Action == PathActionType.AnchorAssist) { flag2 = true; } if (!flag2 && !IsRouteMakingNetProgress()) { RegisterFailedSegment(_activeSegment, DetermineRouteFailureReason(_activeSegment, RouteFailureReason.NoNetProgress)); RegisterBlockedPoint(_character.Center, 3.5f); if (IsClimbPlan(_activeSegment)) { ClearLockedClimbPlan(); } _segmentQueue.Clear(); ClearActiveSegment(); ReplanRoute(); } } private void ExecuteActiveSegment() { if (!_hasActiveSegment) { return; } if (_character.data.isClimbing || _character.data.isRopeClimbing || _character.data.isVineClimbing) { if (!_hasLockedClimbPlan && IsClimbPlan(_activeSegment)) { LockCurrentClimbPlan(_activeSegment); } TickActiveClimb(); } else { if (IsClimbPlan(_activeSegment) && !_hasLockedClimbPlan) { LockCurrentClimbPlan(_activeSegment); } ExecuteGroundPlan(_activeSegment); } } private List BuildThreeDimensionalPathSegments() { //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_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_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_003e: 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_0064: 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_008e: Unknown result type (might be due to invalid IL or missing references) //IL_008f: Unknown result type (might be due to invalid IL or missing references) //IL_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_00c5: 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_0116: 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_0560: 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_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) //IL_0575: 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_0587: Unknown result type (might be due to invalid IL or missing references) //IL_058d: 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_0199: 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_019e: 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_02ab: 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_02d3: 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_0352: 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_03f2: 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_03fc: 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) List result = new List(); if (!HasActiveGoal()) { return result; } Vector3 spatialStandPoint = GetSpatialStandPoint(_character.Center); Vector3 goalCenter = GetGoalCenter(); bool flag = goalCenter.y - spatialStandPoint.y > 1.4f; bool targetBelow = goalCenter.y - spatialStandPoint.y < -1.25f; RoutePathCacheKey key = MakeSpatialPathCacheKey(spatialStandPoint, goalCenter, flag, targetBelow); if (TryGetCachedSpatialPath(key, out List segments)) { return segments; } if (flag && TryBuildReverseAccessPath(spatialStandPoint, goalCenter, out List segments2)) { StoreSpatialPathCache(key, segments2); return segments2; } float num = Get3DGoalDistance(spatialStandPoint, goalCenter); SpatialRouteNode spatialRouteNode = new SpatialRouteNode { Position = spatialStandPoint, Cost = 0f, Score = 0f - num, DistanceToGoal = num, Depth = 0, RemainingStamina = GetRecoverableStaminaCeiling() }; List list = new List { spatialRouteNode }; Dictionary dictionary = new Dictionary(); dictionary[MakeSpatialStateKey(spatialStandPoint, 0, spatialRouteNode.RemainingStamina)] = 0f; SpatialRouteNode spatialRouteNode2 = null; float num2 = float.NegativeInfinity; int configuredSpatialPlannerMaxDepth = GetConfiguredSpatialPlannerMaxDepth(); int configuredSpatialPlannerBeamWidth = GetConfiguredSpatialPlannerBeamWidth(); for (int i = 0; i < configuredSpatialPlannerMaxDepth; i++) { List list2 = new List(); for (int j = 0; j < list.Count; j++) { SpatialRouteNode spatialRouteNode3 = list[j]; List list3 = BuildSpatialCandidatesFrom(spatialRouteNode3.Position, goalCenter); for (int k = 0; k < list3.Count; k++) { PathPlan pathPlan = list3[k]; Vector3 planProjectedEndPoint = GetPlanProjectedEndPoint(pathPlan); float num3 = Get3DGoalDistance(planProjectedEndPoint, goalCenter); float num4 = spatialRouteNode3.DistanceToGoal - num3; if (num4 < -1.25f && pathPlan.Action == PathActionType.Detour) { continue; } float num5 = EstimatePlanStaminaCost(pathPlan); if ((IsClimbPlan(pathPlan) || pathPlan.Action == PathActionType.GapJump || (pathPlan.Action == PathActionType.DropDown && pathPlan.UsesJumpDropImmunity)) && num5 > spatialRouteNode3.RemainingStamina + 0.03f) { continue; } float num6 = Mathf.Clamp(spatialRouteNode3.RemainingStamina - num5, 0f, GetRecoverableStaminaCeiling()); if (pathPlan.Action == PathActionType.Direct || pathPlan.Action == PathActionType.SlopeWalk || pathPlan.Action == PathActionType.Detour || pathPlan.Action == PathActionType.AnchorAssist || (pathPlan.Action == PathActionType.DropDown && !pathPlan.UsesJumpDropImmunity)) { num6 = GetRecoverableStaminaCeiling(); } float spatialTransitionCost = GetSpatialTransitionCost(pathPlan, spatialRouteNode3.Position, planProjectedEndPoint, goalCenter, k); float num7 = spatialRouteNode3.Cost + spatialTransitionCost; float num8 = 0f - num7 - num3 * 1.15f - Mathf.Abs(goalCenter.y - planProjectedEndPoint.y) * 0.9f; num8 += Mathf.Clamp(num4, -2f, 5f) * 1.85f; SpatialRouteStateKey key2 = MakeSpatialStateKey(planProjectedEndPoint, i + 1, num6); if (!dictionary.TryGetValue(key2, out var value) || !(num7 >= value - 0.05f)) { dictionary[key2] = num7; SpatialRouteNode spatialRouteNode4 = new SpatialRouteNode { Position = planProjectedEndPoint, Cost = num7, Score = num8, DistanceToGoal = num3, Depth = i + 1, RemainingStamina = num6 }; for (int l = 0; l < spatialRouteNode3.Segments.Count; l++) { spatialRouteNode4.Segments.Add(ClonePlan(spatialRouteNode3.Segments[l])); } PathPlan pathPlan2 = ClonePlan(pathPlan); pathPlan2.ProjectedRemainingStamina = num6; pathPlan2.PlanningDepth = i; spatialRouteNode4.Segments.Add(pathPlan2); float num9 = HelperFunctions.FlatDistance(planProjectedEndPoint, goalCenter); float num10 = Mathf.Abs(planProjectedEndPoint.y - goalCenter.y); bool flag2 = num9 <= 2.05f && num10 <= 1.65f; float num11 = num8; num11 = ((!flag2) ? (num11 + Mathf.Max(0f, num - num3) * 1.2f) : (num11 + 12f)); if (spatialRouteNode2 == null || num11 > num2) { spatialRouteNode2 = spatialRouteNode4; num2 = num11; } list2.Add(spatialRouteNode4); } } } if (list2.Count == 0) { break; } list2.Sort((SpatialRouteNode a, SpatialRouteNode b) => b.Score.CompareTo(a.Score)); if (list2.Count > configuredSpatialPlannerBeamWidth) { list2.RemoveRange(configuredSpatialPlannerBeamWidth, list2.Count - configuredSpatialPlannerBeamWidth); } list = list2; } if (spatialRouteNode2 == null || spatialRouteNode2.Segments.Count == 0) { return result; } Vector3 position = spatialRouteNode2.Position; float num12 = num - Get3DGoalDistance(position, goalCenter); float num13 = Mathf.Abs(goalCenter.y - spatialStandPoint.y) - Mathf.Abs(goalCenter.y - position.y); if (num12 < 0.35f && num13 < 0.45f && _stuckCount <= 0 && _failedClimbCount <= 0) { return result; } List list4 = new List(); int num14 = Mathf.Min(spatialRouteNode2.Segments.Count, 3); for (int m = 0; m < num14; m++) { list4.Add(ClonePlan(spatialRouteNode2.Segments[m])); } StoreSpatialPathCache(key, list4); return list4; } private List BuildSpatialCandidatesFrom(Vector3 nodePosition, Vector3 goal) { //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_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_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_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_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_0103: 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_0119: 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_0130: 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_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_013e: 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_0145: Unknown result type (might be due to invalid IL or missing references) //IL_0161: Unknown result type (might be due to invalid IL or missing references) //IL_0162: Unknown result type (might be due to invalid IL or missing references) //IL_0171: 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_0188: Unknown result type (might be due to invalid IL or missing references) //IL_0189: 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_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_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_01bc: 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_01d5: 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_01e5: 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_01e8: 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_01ff: 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_020f: 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_0227: Unknown result type (might be due to invalid IL or missing references) //IL_0241: Unknown result type (might be due to invalid IL or missing references) //IL_0242: Unknown result type (might be due to invalid IL or missing references) //IL_0246: Unknown result type (might be due to invalid IL or missing references) //IL_024b: Unknown result type (might be due to invalid IL or missing references) //IL_0250: 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_0254: Unknown result type (might be due to invalid IL or missing references) //IL_0256: 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_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_0291: 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) int configuredSpatialPlannerMaxCandidatesPerNode = GetConfiguredSpatialPlannerMaxCandidatesPerNode(); RouteCandidateCacheKey key = MakeSpatialCandidateCacheKey(nodePosition, goal); if (TryGetCachedSpatialCandidates(key, out List candidates)) { return candidates; } List list = new List(configuredSpatialPlannerMaxCandidatesPerNode); Vector3 val = goal - nodePosition; val.y = 0f; if (((Vector3)(ref val)).sqrMagnitude < 0.01f && (Object)(object)_character != (Object)null && (Object)(object)_character.data != (Object)null) { val = _character.data.lookDirection_Flat; val.y = 0f; } if (((Vector3)(ref val)).sqrMagnitude < 0.01f && (Object)(object)_character != (Object)null) { val = ((Component)_character).transform.forward; val.y = 0f; } if (((Vector3)(ref val)).sqrMagnitude < 0.01f) { val = Vector3.forward; } ((Vector3)(ref val)).Normalize(); bool flag = goal.y - nodePosition.y > 1.4f; bool flag2 = goal.y - nodePosition.y < -1.25f; float currentDistance = Get3DGoalDistance(nodePosition, goal); if (flag2 && TryBuildVerticalDropPlanFrom(nodePosition, goal.y - nodePosition.y, out PathPlan plan)) { AddSpatialCandidate(list, plan, nodePosition, goal, currentDistance); } if (flag && TryCreateSpatialRouteAssistCandidate(nodePosition, goal, out PathPlan plan2)) { AddSpatialCandidate(list, plan2, nodePosition, goal, currentDistance); } for (int i = 0; i < SpatialAngles.Length; i++) { Vector3 val2 = Quaternion.AngleAxis(SpatialAngles[i], Vector3.up) * val; if (flag && TryCreateSpatialClimbCandidate(nodePosition, val2, goal, out PathPlan plan3)) { AddSpatialCandidate(list, plan3, nodePosition, goal, currentDistance); } if (flag && TryCreateSpatialWallContinuationCandidate(nodePosition, val2, goal, out PathPlan plan4)) { AddSpatialCandidate(list, plan4, nodePosition, goal, currentDistance); } if (flag2 && TryFindDropLedgeInDirection(nodePosition, val2, out PathPlan plan5)) { AddSpatialCandidate(list, plan5, nodePosition, goal, currentDistance); } for (int j = 0; j < SpatialDistances.Length; j++) { float num = SpatialDistances[j]; Vector3 sampleXZ = nodePosition + val2 * num; if (TrySample3DStandableSurface(nodePosition, sampleXZ, goal, flag, flag2, out var hit) && TryCreateSpatialTransitionPlan(nodePosition, ((RaycastHit)(ref hit)).point, val2, goal, out PathPlan plan6)) { AddSpatialCandidate(list, plan6, nodePosition, goal, currentDistance); } } } list.Sort((PathPlan a, PathPlan b) => b.Score.CompareTo(a.Score)); if (list.Count > configuredSpatialPlannerMaxCandidatesPerNode) { list.RemoveRange(configuredSpatialPlannerMaxCandidatesPerNode, list.Count - configuredSpatialPlannerMaxCandidatesPerNode); } StoreSpatialCandidateCache(key, list); return list; } private RouteCandidateCacheKey MakeSpatialCandidateCacheKey(Vector3 nodePosition, Vector3 goal) { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_000d: Unknown result type (might be due to invalid IL or missing references) //IL_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_0097: 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_00b9: 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_00db: 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) int num = 500; if (goal.y - nodePosition.y > 1.4f) { num += 10; } if (goal.y - nodePosition.y < -1.25f) { num += 20; } num = num * 10 + Mathf.Clamp(_stuckCount, 0, 3); num = num * 10 + Mathf.Clamp(_failedClimbCount, 0, 3); num = num * 10 + Mathf.Clamp(_failedSegments.Count, 0, 9); num = num * 20 + QuantizeStamina(GetStamina01()); return new RouteCandidateCacheKey(QuantizePlanner(nodePosition.x, 1.65f), QuantizePlanner(nodePosition.y, 1.65f), QuantizePlanner(nodePosition.z, 1.65f), QuantizePlanner(goal.x, 1.65f), QuantizePlanner(goal.y, 1.65f), QuantizePlanner(goal.z, 1.65f), num); } private bool TryGetCachedSpatialCandidates(RouteCandidateCacheKey key, out List candidates) { candidates = new List(); if (_spatialCandidateCache.TryGetValue(key, out RouteCandidateCacheEntry value) && Time.time - value.CreatedAt <= 0.55f) { candidates = ClonePlanList(value.Candidates); return true; } return false; } private void StoreSpatialCandidateCache(RouteCandidateCacheKey key, List candidates) { RouteCandidateCacheEntry routeCandidateCacheEntry = new RouteCandidateCacheEntry { CreatedAt = Time.time }; for (int i = 0; i < candidates.Count; i++) { routeCandidateCacheEntry.Candidates.Add(ClonePlan(candidates[i])); } _spatialCandidateCache[key] = routeCandidateCacheEntry; PruneGuidePlannerCaches(); } private void AddSpatialCandidate(List candidates, PathPlan plan, Vector3 from, Vector3 goal, float currentDistance) { //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_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_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_007d: 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_0090: 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_0124: 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_013f: 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) //IL_01f2: Unknown result type (might be due to invalid IL or missing references) //IL_01f4: 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) if (plan.Action == PathActionType.None || plan.Action == PathActionType.Hold || (IsClimbPlan(plan) && !IsSpatialClimbPlanViable(plan))) { return; } Vector3 planProjectedEndPoint = GetPlanProjectedEndPoint(plan); Vector3 val = planProjectedEndPoint - from; if (((Vector3)(ref val)).sqrMagnitude < 0.20249999f) { return; } float num = Get3DGoalDistance(planProjectedEndPoint, goal); float num2 = currentDistance - num; float num3 = Mathf.Abs(goal.y - from.y) - Mathf.Abs(goal.y - planProjectedEndPoint.y); if (num2 < -1.25f && num3 < 0.25f && !IsClimbPlan(plan) && plan.Action != PathActionType.DropDown) { return; } plan.Score += num2 * 2f; plan.Score += num3 * 1.1f; plan.Score -= EstimatePlanStaminaCost(plan) * 1.3f; plan.Score -= EstimateHumanActionTimeCost(plan, from, planProjectedEndPoint) * 0.42f; plan.Score -= GetBlockedPenalty(planProjectedEndPoint); plan.Score -= GetFailedSegmentPenalty(plan); if (plan.Action == PathActionType.Direct || plan.Action == PathActionType.SlopeWalk || plan.Action == PathActionType.Detour) { plan.Score += 0.85f; } else if (IsClimbPlan(plan)) { plan.Score -= Mathf.Max(0f, plan.EstimatedClimbHeight - Mathf.Max(0.6f, num3 + 0.8f)) * 0.75f; } for (int i = 0; i < candidates.Count; i++) { Vector3 planProjectedEndPoint2 = GetPlanProjectedEndPoint(candidates[i]); if (Vector3.Distance(planProjectedEndPoint2, planProjectedEndPoint) <= 0.85f && candidates[i].Action == plan.Action) { if (plan.Score > candidates[i].Score) { candidates[i] = ClonePlan(plan); } return; } } candidates.Add(ClonePlan(plan)); } private bool TrySample3DStandableSurface(Vector3 nodePosition, Vector3 sampleXZ, Vector3 goal, bool targetAbove, bool targetBelow, out RaycastHit hit) { //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_000f: Unknown result type (might be due to invalid IL or missing references) //IL_001b: Unknown result type (might be due to invalid IL or missing references) //IL_0021: Unknown result type (might be due to invalid IL or missing references) //IL_0046: 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_005a: 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_007e: 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_00bb: 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_00de: 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_010b: 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_0131: 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_0142: 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_017d: 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) hit = default(RaycastHit); float num = Mathf.Max(nodePosition.y, goal.y); float num2 = Mathf.Min(nodePosition.y, goal.y); Vector3 val = default(Vector3); RaycastHit val2 = default(RaycastHit); for (int i = 0; i < SpatialVerticalProbeOffsets.Length; i++) { float num3 = SpatialVerticalProbeOffsets[i]; float num4 = (targetAbove ? Mathf.Max(nodePosition.y + num3, Mathf.Min(goal.y + 2.2f, nodePosition.y + 10f)) : ((!targetBelow) ? (nodePosition.y + Mathf.Min(num3, 4.4f)) : (nodePosition.y + Mathf.Max(2.2f, num3 * 0.55f)))); ((Vector3)(ref val))..ctor(sampleXZ.x, num4, sampleXZ.z); float num5 = Mathf.Max(8f, num4 - num2 + 4f); if (Physics.Raycast(val, Vector3.down, ref val2, num5, TerrainMask, (QueryTriggerInteraction)1) && IsSafeStandableRoutePoint(((RaycastHit)(ref val2)).point, ((RaycastHit)(ref val2)).normal, requireSupport: false)) { float num6 = ((RaycastHit)(ref val2)).point.y - nodePosition.y; float num7 = nodePosition.y - ((RaycastHit)(ref val2)).point.y; if (!(num6 > 5.25f) && !(num7 > 9.5f) && (!targetAbove || !(((RaycastHit)(ref val2)).point.y < nodePosition.y - 0.35f))) { hit = val2; return true; } } } return false; } private bool TryCreateSpatialTransitionPlan(Vector3 from, Vector3 to, Vector3 dir, Vector3 finalGoal, out PathPlan plan) { //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_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_0036: 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_0044: 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_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_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_00fc: 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_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_00a0: 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_00ab: 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) //IL_00b8: 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_0116: 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_0126: 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_0130: 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) plan = new PathPlan(); float num = HelperFunctions.FlatDistance(from, to); if (num < 0.35f) { return false; } float num2 = to.y - from.y; float num3 = from.y - to.y; bool targetAbove = finalGoal.y - from.y > 1.4f; if (TryCreateSpatialGroundMovePlan(from, to, targetAbove, out plan)) { return true; } if (num2 > 0.7f && TryCreateSpatialClimbCandidate(from, dir, finalGoal, out PathPlan plan2)) { Vector3 planProjectedEndPoint = GetPlanProjectedEndPoint(plan2); float num4 = Vector3.Distance(planProjectedEndPoint, to); float num5 = Get3DGoalDistance(planProjectedEndPoint, finalGoal); float num6 = Get3DGoalDistance(from, finalGoal); if (num4 <= 2.8f || num5 < num6 - 0.45f) { plan = plan2; return true; } } if (num3 > 1.05f && TryFindDropLedgeInDirection(from, dir, out PathPlan plan3)) { Vector3 planProjectedEndPoint2 = GetPlanProjectedEndPoint(plan3); if (Vector3.Distance(planProjectedEndPoint2, to) <= 3.25f || Get3DGoalDistance(planProjectedEndPoint2, finalGoal) < Get3DGoalDistance(from, finalGoal) - 0.35f) { plan = plan3; return true; } } return false; } private bool TryCreateSpatialGroundMovePlan(Vector3 from, Vector3 to, bool targetAbove, out PathPlan plan) { //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_0024: 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_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_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_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_0086: 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_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_009b: 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_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_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) plan = new PathPlan(); if (!IsSpatialGroundCorridorWalkable(from, to, targetAbove, out var projectedEnd)) { return false; } bool flag = IsRoughTerrainLineBlocked(from + Vector3.up * 0.1f, to + Vector3.up * 0.1f); plan = new PathPlan { Action = (flag ? PathActionType.Detour : ((!(Mathf.Abs(to.y - from.y) > 0.55f)) ? PathActionType.Direct : PathActionType.SlopeWalk)), Goal = to + Vector3.up * 0.15f, Anchor = to, TargetAbove = targetAbove, RequiredStamina = EstimateGroundChaseCost(Vector3.Distance(from, to)), ReachableWithinRecoverableBudget = true, ProjectedEndPoint = projectedEnd, HasProjectedEndPoint = true, WasBuiltBySpatialPlanner = true, StartNodeType = RouteNodeType.Stand, EndNodeType = RouteNodeType.Stand, Score = (flag ? 0.25f : 0.75f) }; return true; } private bool IsSpatialGroundCorridorWalkable(Vector3 from, Vector3 to, bool targetAbove, out Vector3 projectedEnd) { //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_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_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_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) //IL_0060: 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_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_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_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_00a0: 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_00ae: 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_00d9: 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_00ff: 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_0113: 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_01c2: Unknown result type (might be due to invalid IL or missing references) //IL_01c9: 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_01df: 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_020c: 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) projectedEnd = to; Vector3 val = to - from; val.y = 0f; float magnitude = ((Vector3)(ref val)).magnitude; if (magnitude < 0.25f) { return true; } Vector3 normalized = ((Vector3)(ref val)).normalized; int num = Mathf.Clamp(Mathf.CeilToInt(magnitude / 0.65f), 1, 12); Vector3 val2 = GetSpatialStandPoint(from); float num2 = 0f; float num3 = 0f; Vector3 point = default(Vector3); for (int i = 1; i <= num; i++) { float num4 = (float)i / (float)num; Vector3 val3 = Vector3.Lerp(from, to, num4); Vector3 val4 = from + normalized * (magnitude * num4); ((Vector3)(ref point))..ctor(val4.x, val3.y, val4.z); if (!TryFindGroundNearHeight(point, out var hit)) { return false; } if (!IsSafeStandableRoutePoint(((RaycastHit)(ref hit)).point, ((RaycastHit)(ref hit)).normal, requireSupport: false)) { return false; } float num5 = ((RaycastHit)(ref hit)).point.y - val2.y; float num6 = val2.y - ((RaycastHit)(ref hit)).point.y; if (num5 > 0.78f || num6 > 1.05f) { return false; } if (num5 > 0f) { num2 += num5; } if (num6 > 0f) { num3 += num6; } val2 = ((RaycastHit)(ref hit)).point; } if (num2 > 2.25f || num3 > 3.25f) { return false; } if (targetAbove && val2.y < from.y + Mathf.Min(0.45f, Mathf.Max(0.2f, (to.y - from.y) * 0.25f))) { return false; } projectedEnd = val2; return true; } private bool TryFindGroundNearHeight(Vector3 point, out RaycastHit hit) { //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_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_0016: Unknown result type (might be due to invalid IL or missing references) return Physics.Raycast(point + Vector3.up * 1.65f, Vector3.down, ref hit, 3.75f, TerrainMask, (QueryTriggerInteraction)1); } private bool TryCreateSpatialClimbCandidate(Vector3 from, Vector3 dir, Vector3 finalGoal, out PathPlan plan) { //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_0033: 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_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_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_0060: Unknown result type (might be due to invalid IL or missing references) //IL_0066: Unknown result type (might be due to invalid IL or missing references) //IL_0072: 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_00d5: 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_00e0: Unknown result type (might be due to invalid IL or missing references) //IL_00e5: Unknown result type (might be due to invalid IL or missing references) //IL_00ea: Unknown result type (might be due to invalid IL or missing references) //IL_00f0: 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_0138: 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_013f: Unknown result type (might be due to invalid IL or missing references) //IL_0141: Unknown result type (might be due to invalid IL or missing references) //IL_0147: 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_0155: 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_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_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_0171: Unknown result type (might be due to invalid IL or missing references) plan = new PathPlan(); if (!TryProbeAnyClimbableAheadFrom(from, dir, 5.25f, preferJumpGrab: true, out var climbBase, out var climbHeight, out var needsJumpStart, out var climbTopPoint, out var surfaceNormal)) { return false; } if (climbTopPoint == Vector3.zero) { return false; } float num = Get3DGoalDistance(from, finalGoal) - Get3DGoalDistance(climbTopPoint, finalGoal); float num2 = Mathf.Abs(finalGoal.y - from.y) - Mathf.Abs(finalGoal.y - climbTopPoint.y); if (num < 0.25f && num2 < 0.35f) { return false; } float num3 = EstimateRequiredClimbStamina(climbHeight, targetAbove: true, climbHeight >= 2.15f); plan = new PathPlan { Action = (needsJumpStart ? PathActionType.JumpGrab : PathActionType.Climb), Goal = climbTopPoint + Vector3.up * 0.2f, Anchor = climbBase, TargetAbove = true, EstimatedClimbHeight = climbHeight, IsTallWall = (climbHeight >= 2.15f), RequiredStamina = num3, ReachableWithinRecoverableBudget = (num3 <= GetRecoverableStaminaCeiling()), NeedsJumpStart = needsJumpStart, ClimbTopPoint = climbTopPoint, ClimbSurfaceNormal = surfaceNormal, ProjectedEndPoint = climbTopPoint, HasProjectedEndPoint = true, JumpGrabAimPoint = climbTopPoint + Vector3.up * 0.15f, JumpGrabHorizontalDistance = HelperFunctions.FlatDistance(from, climbBase), WasBuiltBySpatialPlanner = true, StartNodeType = RouteNodeType.Wall, EndNodeType = RouteNodeType.Ledge, StaminaSafetyReserve = GetConfiguredStaminaSafetyRatio(), Score = 1.25f + num * 1.1f + num2 * 0.9f }; return IsSpatialClimbPlanViable(plan); } private bool TryCreateSpatialWallContinuationCandidate(Vector3 from, Vector3 dir, Vector3 finalGoal, out PathPlan plan) { //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_0033: 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_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_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_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_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_0091: 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) //IL_0125: 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_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_0134: 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_0153: 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_015d: 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_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_0170: 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_01a2: 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_01bf: 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_01e7: 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_01f4: Unknown result type (might be due to invalid IL or missing references) //IL_01f9: Unknown result type (might be due to invalid IL or missing references) //IL_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_020a: 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_0219: 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_0220: 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_024b: 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_026f: 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_0294: 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_02c9: 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_02e0: Unknown result type (might be due to invalid IL or missing references) //IL_02e6: Unknown result type (might be due to invalid IL or missing references) //IL_02f2: 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_03dd: 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_03ec: Unknown result type (might be due to invalid IL or missing references) //IL_03f1: Unknown result type (might be due to invalid IL or missing references) //IL_03f6: Unknown result type (might be due to invalid IL or missing references) //IL_03fc: Unknown result type (might be due to invalid IL or missing references) //IL_03fd: 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_0448: 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_0452: 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_0466: Unknown result type (might be due to invalid IL or missing references) //IL_046b: 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_047a: Unknown result type (might be due to invalid IL or missing references) //IL_047f: Unknown result type (might be due to invalid IL or missing references) //IL_0485: Unknown result type (might be due to invalid IL or missing references) //IL_0486: Unknown result type (might be due to invalid IL or missing references) plan = new PathPlan(); if (!TryProbeAnyClimbableAheadFrom(from, dir, 4.6f, preferJumpGrab: true, out var climbBase, out var climbHeight, out var needsJumpStart, out var _, out var surfaceNormal)) { return false; } if (surfaceNormal == Vector3.zero) { return false; } Vector3 normalized = ((Vector3)(ref surfaceNormal)).normalized; Vector3 val = Vector3.Cross(Vector3.up, normalized); if (((Vector3)(ref val)).sqrMagnitude < 0.01f) { return false; } ((Vector3)(ref val)).Normalize(); Vector3 val2 = finalGoal - from; val2.y = 0f; float num = ((((Vector3)(ref val2)).sqrMagnitude > 0.01f) ? Mathf.Sign(Vector3.Dot(((Vector3)(ref val2)).normalized, val)) : 1f); if (Mathf.Approximately(num, 0f)) { num = 1f; } float[] wallTraverseLateralDistances = WallTraverseLateralDistances; bool flag = false; float num2 = float.NegativeInfinity; PathPlan pathPlan = new PathPlan(); RaycastHit val5 = default(RaycastHit); RaycastHit val7 = default(RaycastHit); for (int i = 0; i < 2; i++) { float num3 = ((i == 0) ? num : (0f - num)); for (int j = 0; j < wallTraverseLateralDistances.Length; j++) { float num4 = wallTraverseLateralDistances[j] * num3; Vector3 val3 = climbBase + val * num4; Vector3 val4 = val3 + Vector3.up * Mathf.Clamp(climbHeight * 0.45f, 0.95f, 2.4f) + normalized * 0.95f; if (!Physics.SphereCast(val4, 0.17f, -normalized, ref val5, 1.7f, TerrainMask, (QueryTriggerInteraction)1) || !IsClimbableWallNormal(((RaycastHit)(ref val5)).normal)) { continue; } float num5 = Vector3.Angle(normalized, ((RaycastHit)(ref val5)).normal); if (num5 > 125f) { continue; } Vector3 normal = ((RaycastHit)(ref val5)).normal; Vector3 normalized2 = ((Vector3)(ref normal)).normalized; Vector3 val6 = ((RaycastHit)(ref val5)).point - normalized2 * 0.45f + Vector3.up * 5.35f; if (!Physics.Raycast(val6, Vector3.down, ref val7, 6.5f, TerrainMask, (QueryTriggerInteraction)1) || !IsSafeStandableRoutePoint(((RaycastHit)(ref val7)).point, ((RaycastHit)(ref val7)).normal, requireSupport: false) || !HasMantleSpaceAt(((RaycastHit)(ref val7)).point)) { continue; } float num6 = ((RaycastHit)(ref val7)).point.y - from.y; if (num6 < 0.65f || num6 > EstimateMaxReachableClimbHeight(targetAbove: true, needsJumpStart) + 0.35f) { continue; } float num7 = Get3DGoalDistance(from, finalGoal) - Get3DGoalDistance(((RaycastHit)(ref val7)).point, finalGoal); float num8 = Mathf.Abs(finalGoal.y - from.y) - Mathf.Abs(finalGoal.y - ((RaycastHit)(ref val7)).point.y); if (num7 < 0.1f && num8 < 0.35f) { continue; } bool needsJumpStart2 = needsJumpStart || num6 >= 1f || Mathf.Abs(num4) > 1.65f; float num9 = EstimateRequiredClimbStamina(num6 + Mathf.Abs(num4) * 0.25f, targetAbove: true, num6 >= 2.15f); if (!(num9 > GetRecoverableStaminaCeiling() + 0.02f)) { PathActionType action = ((num5 >= 32f) ? PathActionType.CornerClimb : ((!(Mathf.Abs(num4) >= 1.2f)) ? PathActionType.Mantle : PathActionType.WallTraverse)); PathPlan pathPlan2 = new PathPlan { Action = action, Goal = ((RaycastHit)(ref val7)).point + Vector3.up * 0.2f, Anchor = climbBase, TargetAbove = true, EstimatedClimbHeight = num6, IsTallWall = (num6 >= 2.15f), RequiredStamina = num9, ReachableWithinRecoverableBudget = true, NeedsJumpStart = needsJumpStart2, ClimbTopPoint = ((RaycastHit)(ref val7)).point, ClimbSurfaceNormal = normalized2, ProjectedEndPoint = ((RaycastHit)(ref val7)).point, HasProjectedEndPoint = true, JumpGrabAimPoint = ((RaycastHit)(ref val5)).point + Vector3.up * 0.85f, JumpGrabHorizontalDistance = HelperFunctions.FlatDistance(from, climbBase), WasBuiltBySpatialPlanner = true, StartNodeType = RouteNodeType.Wall, EndNodeType = RouteNodeType.Ledge, RiskScore = num5 / 90f + Mathf.Abs(num4) * 0.12f, StaminaSafetyReserve = GetConfiguredStaminaSafetyRatio(), Score = 0.75f + num7 * 1.05f + num8 * 1.1f - Mathf.Abs(num4) * 0.18f - num5 * 0.006f }; if (IsSpatialClimbPlanViable(pathPlan2) && (!flag || pathPlan2.Score > num2)) { flag = true; num2 = pathPlan2.Score; pathPlan = pathPlan2; } } } } if (!flag) { return false; } plan = pathPlan; return true; } private bool IsSpatialClimbPlanViable(PathPlan plan) { if (!IsClimbPlan(plan)) { return true; } if (plan.RequiredStamina > GetRecoverableStaminaCeiling() + 0.02f) { return false; } float num = EstimateMaxReachableClimbHeight(plan.TargetAbove, plan.NeedsJumpStart); return plan.EstimatedClimbHeight <= num + 0.35f; } private Vector3 GetSpatialStandPoint(Vector3 point) { //IL_0002: 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_002b: 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_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_002f: Unknown result type (might be due to invalid IL or missing references) if (TryFindGround(point, out var hit) && IsRoughStandableNormal(((RaycastHit)(ref hit)).normal)) { return ((RaycastHit)(ref hit)).point; } return point; } private float Get3DGoalDistance(Vector3 a, Vector3 b) { //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_0009: 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) float num = HelperFunctions.FlatDistance(a, b); float num2 = Mathf.Abs(a.y - b.y); return num + num2 * 1.35f; } private float GetSpatialTransitionCost(PathPlan plan, Vector3 from, Vector3 end, Vector3 goal, int candidateIndex) { //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_0023: 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_0036: 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) float num = EstimateHumanActionTimeCost(plan, from, end); num += (float)candidateIndex * 0.025f; if (IsClimbPlan(plan)) { float num2 = Mathf.Abs(goal.y - from.y) - Mathf.Abs(goal.y - end.y); if (num2 < 0.75f) { num += 3f; } } return num; } private bool TryCreateSpatialRouteAssistCandidate(Vector3 from, Vector3 finalGoal, out PathPlan plan) { //IL_0020: 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_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_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_00bc: 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_00fa: 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_00f2: 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_0123: 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_0138: 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_0157: 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_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_017c: Unknown result type (might be due to invalid IL or missing references) //IL_0181: Unknown result type (might be due to invalid IL or missing references) //IL_019b: 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_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_01db: 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_01fa: Unknown result type (might be due to invalid IL or missing references) //IL_01fe: Unknown result type (might be due to invalid IL or missing references) //IL_0203: Unknown result type (might be due to invalid IL or missing references) //IL_0298: Unknown result type (might be due to invalid IL or missing references) //IL_029e: Unknown result type (might be due to invalid IL or missing references) //IL_02aa: 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_021c: 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_0225: 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_026c: 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_027e: 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_02c7: 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_02cf: Unknown result type (might be due to invalid IL or missing references) //IL_02d1: 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_0317: Unknown result type (might be due to invalid IL or missing references) //IL_0309: Unknown result type (might be due to invalid IL or missing references) //IL_031c: 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_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_0342: 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_034f: 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_03a4: 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_03b3: Unknown result type (might be due to invalid IL or missing references) //IL_03b5: 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) //IL_0419: 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) plan = new PathPlan(); if (!IsRouteAssistAwarenessEnabled()) { return false; } int num = Physics.OverlapSphereNonAlloc(from, 7.5f, SharedRouteAssistColliderBuffer, -1, (QueryTriggerInteraction)2); if (num <= 0) { return false; } bool flag = false; float num2 = float.NegativeInfinity; PathPlan pathPlan = new PathPlan(); int num3 = 0; for (int i = 0; i < num; i++) { if (num3 >= 48) { break; } Collider val = SharedRouteAssistColliderBuffer[i]; if ((Object)(object)val == (Object)null) { continue; } num3++; if (!TryClassifyRouteAssistCollider(val, out string assistKind, out bool verticalAssist)) { continue; } Bounds bounds = val.bounds; Vector3 center = ((Bounds)(ref bounds)).center; Vector3 val2 = center - from; val2.y = 0f; if (((Vector3)(ref val2)).magnitude > 7.5f) { continue; } Vector3 point = ((((Vector3)(ref val2)).sqrMagnitude > 0.01f) ? (center - ((Vector3)(ref val2)).normalized * Mathf.Min(0.65f, ((Vector3)(ref val2)).magnitude * 0.35f)) : center); if (!TryFindGround(point, out var hit) || !IsSafeStandableRoutePoint(((RaycastHit)(ref hit)).point, ((RaycastHit)(ref hit)).normal, requireSupport: false)) { continue; } float num4 = (IsRoughTerrainLineBlocked(from + Vector3.up * 0.12f, ((RaycastHit)(ref hit)).point + Vector3.up * 0.12f) ? 0.85f : 0f); float num5 = Vector3.Distance(from, ((RaycastHit)(ref hit)).point); if (num5 > 8.75f) { continue; } Vector3 val3 = ((RaycastHit)(ref hit)).point; PathActionType pathActionType = PathActionType.AnchorAssist; float num6 = EstimateGroundChaseCost(num5); float num7 = Mathf.Max(0f, finalGoal.y - ((RaycastHit)(ref hit)).point.y); float num8; if (verticalAssist && TryFindRouteAssistTopPoint(bounds, ((RaycastHit)(ref hit)).point, finalGoal, out var topPoint)) { pathActionType = PathActionType.RopeClimb; val3 = topPoint; num7 = Mathf.Max(0.65f, topPoint.y - ((RaycastHit)(ref hit)).point.y); num6 = Mathf.Clamp(EstimateRequiredClimbStamina(num7 * 0.62f, targetAbove: true, num7 >= 2.15f), 0.2f, 0.92f); num8 = Mathf.Abs(finalGoal.y - from.y) - Mathf.Abs(finalGoal.y - topPoint.y); } else { num8 = Mathf.Abs(finalGoal.y - from.y) - Mathf.Abs(finalGoal.y - ((RaycastHit)(ref hit)).point.y); } float num9 = Get3DGoalDistance(from, finalGoal) - Get3DGoalDistance(val3, finalGoal); if (num9 < -0.75f && num8 < 0.25f) { continue; } Vector3 climbSurfaceNormal = ((((Vector3)(ref val2)).sqrMagnitude > 0.01f) ? (-((Vector3)(ref val2)).normalized) : Vector3.zero); PathPlan pathPlan2 = new PathPlan { Action = pathActionType, Goal = val3 + Vector3.up * 0.18f, Anchor = ((RaycastHit)(ref hit)).point, TargetAbove = true, EstimatedClimbHeight = num7, IsTallWall = (num7 >= 2.15f), RequiredStamina = num6, ReachableWithinRecoverableBudget = (num6 <= GetRecoverableStaminaCeiling() + 0.02f), NeedsJumpStart = false, ClimbTopPoint = ((pathActionType == PathActionType.RopeClimb) ? val3 : Vector3.zero), ClimbSurfaceNormal = climbSurfaceNormal, ProjectedEndPoint = val3, HasProjectedEndPoint = true, WasBuiltBySpatialPlanner = true, StartNodeType = RouteNodeType.Stand, EndNodeType = ((pathActionType == PathActionType.RopeClimb) ? RouteNodeType.Ledge : RouteNodeType.Rest), RiskScore = (verticalAssist ? 0.35f : 0.65f), StaminaSafetyReserve = GetConfiguredStaminaSafetyRatio(), UsesRouteAssist = true, RouteAssistKind = assistKind, RouteAssistPoint = center, Score = 1.1f + num9 * 1.35f + num8 * 1.25f - num5 * 0.12f - num4 }; if (pathActionType != PathActionType.RopeClimb || IsSpatialClimbPlanViable(pathPlan2)) { pathPlan2.Score -= GetFailedSegmentPenalty(pathPlan2); if (!flag || pathPlan2.Score > num2) { flag = true; num2 = pathPlan2.Score; pathPlan = pathPlan2; } } } if (!flag) { return false; } plan = pathPlan; if (IsAdvancedRoutingDebugEnabled()) { DebugAdvancedRouting($"route assist candidate selected: kind={plan.RouteAssistKind}, action={plan.Action}, score={plan.Score:0.00}"); } return true; } private bool TryClassifyRouteAssistCollider(Collider col, out string assistKind, out bool verticalAssist) { assistKind = string.Empty; verticalAssist = false; string a = (((Object)(object)col != (Object)null) ? (((Object)col).name ?? string.Empty) : string.Empty); GameObject val = (((Object)(object)col != (Object)null) ? ((Component)col).gameObject : null); string b = (((Object)(object)val != (Object)null) ? (((Object)val).name ?? string.Empty) : string.Empty); string empty = string.Empty; try { empty = (((Object)(object)val != (Object)null) ? (val.tag ?? string.Empty) : string.Empty); } catch { empty = string.Empty; } if (ContainsRouteAssistToken(a, b, empty, "rope") || ContainsRouteAssistToken(a, b, empty, "chain")) { assistKind = "rope"; verticalAssist = true; return true; } if (ContainsRouteAssistToken(a, b, empty, "vine")) { assistKind = "vine"; verticalAssist = true; return true; } if (ContainsRouteAssistToken(a, b, empty, "ladder")) { assistKind = "ladder"; verticalAssist = true; return true; } if (ContainsRouteAssistToken(a, b, empty, "piton")) { assistKind = "piton"; verticalAssist = false; return true; } if (ContainsRouteAssistToken(a, b, empty, "anchor") || ContainsRouteAssistToken(a, b, empty, "climbingpin") || ContainsRouteAssistToken(a, b, empty, "climb_pin") || ContainsRouteAssistToken(a, b, empty, "hook")) { assistKind = "anchor"; verticalAssist = false; return true; } return false; } private static bool ContainsRouteAssistToken(string a, string b, string c, string token) { return (!string.IsNullOrEmpty(a) && a.IndexOf(token, StringComparison.OrdinalIgnoreCase) >= 0) || (!string.IsNullOrEmpty(b) && b.IndexOf(token, StringComparison.OrdinalIgnoreCase) >= 0) || (!string.IsNullOrEmpty(c) && c.IndexOf(token, StringComparison.OrdinalIgnoreCase) >= 0); } private bool TryFindRouteAssistTopPoint(Bounds bounds, Vector3 anchorPoint, Vector3 finalGoal, out Vector3 topPoint) { //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_000f: 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_002b: 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_0062: 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_008d: 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_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) //IL_00dd: Unknown result type (might be due to invalid IL or missing references) //IL_00e2: Unknown result type (might be due to invalid IL or missing references) //IL_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) topPoint = Vector3.zero; float y = Mathf.Max(((Bounds)(ref bounds)).max.y + 1f, Mathf.Min(finalGoal.y + 2.4f, anchorPoint.y + 9.5f)); bool flag = false; float num = float.NegativeInfinity; RaycastHit val = default(RaycastHit); for (int i = 0; i < 5; i++) { Vector3 routeAssistTopProbeSample = GetRouteAssistTopProbeSample(((Bounds)(ref bounds)).center, y, i); if (!Physics.Raycast(routeAssistTopProbeSample, Vector3.down, ref val, 11.5f, TerrainMask, (QueryTriggerInteraction)1) || !IsSafeStandableRoutePoint(((RaycastHit)(ref val)).point, ((RaycastHit)(ref val)).normal, requireSupport: false)) { continue; } float num2 = ((RaycastHit)(ref val)).point.y - anchorPoint.y; if (!(num2 < 0.65f)) { float num3 = num2 * 0.7f - Get3DGoalDistance(((RaycastHit)(ref val)).point, finalGoal); if (!flag || num3 > num) { flag = true; num = num3; topPoint = ((RaycastHit)(ref val)).point; } } } return flag; } private static Vector3 GetRouteAssistTopProbeSample(Vector3 center, float y, int index) { //IL_001f: 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_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_003a: Unknown result type (might be due to invalid IL or missing references) //IL_0047: Unknown result type (might be due to invalid IL or missing references) //IL_004d: Unknown result type (might be due to invalid IL or missing references) //IL_0052: 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_005c: 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_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_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_00a0: 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: 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) return (Vector3)(index switch { 1 => new Vector3(center.x + 0.45f, y, center.z), 2 => new Vector3(center.x - 0.45f, y, center.z), 3 => new Vector3(center.x, y, center.z + 0.45f), 4 => new Vector3(center.x, y, center.z - 0.45f), _ => new Vector3(center.x, y, center.z), }); } private bool HasDirectGroundVerticalProgress(Vector3 startPos, Vector3 dir, Vector3 goal) { //IL_0002: 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_0024: 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_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_0078: 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_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_0091: 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_0111: 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_00b8: 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_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) if (!TryFindGround(startPos, out var hit)) { return false; } float num = Mathf.Abs(goal.y - ((RaycastHit)(ref hit)).point.y); Vector3 point = ((RaycastHit)(ref hit)).point; float num2 = num; float num3 = Mathf.Min(5f, Mathf.Max(1.5f, HelperFunctions.FlatDistance(startPos, goal))); int num4 = Mathf.Clamp(Mathf.CeilToInt(num3 / 0.75f), 2, 8); for (int i = 1; i <= num4; i++) { Vector3 point2 = startPos + dir * (num3 * ((float)i / (float)num4)); if (TryFindGround(point2, out var hit2) && IsRoughStandableNormal(((RaycastHit)(ref hit2)).normal)) { float num5 = Mathf.Abs(goal.y - ((RaycastHit)(ref hit2)).point.y); if (num5 < num2) { num2 = num5; point = ((RaycastHit)(ref hit2)).point; } } } float num6 = num - num2; return num6 >= 0.35f || Mathf.Abs(goal.y - point.y) <= 1.2f; } private bool ShouldTryThreeDimensionalPlannerBeforeLocal() { //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_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_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_003a: Unknown result type (might be due to invalid IL or missing references) //IL_0047: Unknown result type (might be due to invalid IL or missing references) //IL_004d: Unknown result type (might be due to invalid IL or missing references) //IL_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_006e: 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) if (!HasActiveGoal()) { return false; } Vector3 center = _character.Center; Vector3 goalCenter = GetGoalCenter(); float num = HelperFunctions.FlatDistance(center, goalCenter); float num2 = Mathf.Abs(goalCenter.y - center.y); if (goalCenter.y - center.y < -1.25f) { return false; } if (TryBuildValidatedGroundTravelPlanFrom(center, goalCenter, num, goalCenter.y - center.y > 1.4f, out PathPlan _)) { return false; } if (_stuckCount > 0 || _failedClimbCount > 0 || _failedSegments.Count > 0) { return true; } if (!_rawGoalIsStandable && num2 > 1.2f) { return true; } if (num2 > 1.85f && num <= 10f) { return true; } return num2 > 3f; } private RoutePathCacheKey MakeSpatialPathCacheKey(Vector3 start, Vector3 goal, bool targetAbove, bool targetBelow) { //IL_0044: 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_0066: 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_0088: 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) int num = 700; if (targetAbove) { num += 10; } if (targetBelow) { num += 20; } num += Mathf.Clamp(_stuckCount, 0, 3); num = num * 10 + Mathf.Clamp(_failedClimbCount, 0, 3); return new RoutePathCacheKey(QuantizePlanner(start.x, 1.65f), QuantizePlanner(start.y, 1.65f), QuantizePlanner(start.z, 1.65f), QuantizePlanner(goal.x, 1.65f), QuantizePlanner(goal.y, 1.65f), QuantizePlanner(goal.z, 1.65f), QuantizeStamina(GetStamina01()), num); } private bool TryGetCachedSpatialPath(RoutePathCacheKey key, out List segments) { segments = new List(); if (SharedGuidePathCache.TryGetValue(key, out RoutePathCacheEntry value) && Time.time - value.CreatedAt <= 2.2f) { segments = ClonePlanList(value.Segments); return segments.Count > 0; } if (_guidePathCache.TryGetValue(key, out RoutePathCacheEntry value2) && Time.time - value2.CreatedAt <= 2.2f) { segments = ClonePlanList(value2.Segments); return segments.Count > 0; } return false; } private void StoreSpatialPathCache(RoutePathCacheKey key, List segments) { RoutePathCacheEntry routePathCacheEntry = new RoutePathCacheEntry { CreatedAt = Time.time }; RoutePathCacheEntry routePathCacheEntry2 = new RoutePathCacheEntry { CreatedAt = Time.time }; for (int i = 0; i < segments.Count; i++) { routePathCacheEntry.Segments.Add(ClonePlan(segments[i])); routePathCacheEntry2.Segments.Add(ClonePlan(segments[i])); } _guidePathCache[key] = routePathCacheEntry; SharedGuidePathCache[key] = routePathCacheEntry2; PruneGuidePlannerCaches(); } private SpatialRouteStateKey MakeSpatialStateKey(Vector3 position, int depth, float stamina) { //IL_0002: 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_0024: Unknown result type (might be due to invalid IL or missing references) return new SpatialRouteStateKey(QuantizePlanner(position.x, 1.65f), QuantizePlanner(position.y, 1.65f), QuantizePlanner(position.z, 1.65f), depth, QuantizeStamina(stamina)); } } internal enum RobotBrainState { Idle, Parked, Chase, PrepareTallClimb, Reposition, Lunge, LungeRecovery, Dead } internal enum PathActionType { None, Direct, Detour, Climb, JumpGrab, GapJump, DropDown, WaitForStamina, Hold, SlopeWalk, WallTraverse, CornerClimb, Mantle, Recover, RopeClimb, AnchorAssist } internal enum RouteNodeType { Stand, Wall, Ledge, Drop, Rest, Goal, Hazard } internal enum RouteFailureReason { Unknown, ProgressTimeout, NoNetProgress, WallLost, MantleFailed, JumpGrabFailed, StaminaTooLow, PathBlocked, StuckRecovery, ClimbRetryFailed, RouteAssistFailed } internal sealed class PathPlan { public PathActionType Action = PathActionType.None; public Vector3 Goal; public Vector3 Anchor; public float RequiredStamina; public bool TargetAbove; public float EstimatedClimbHeight; public bool IsTallWall; public float ExpectedDropHeight; public bool UsesJumpDropImmunity; public bool ReachableWithinRecoverableBudget; public float Score; public bool NeedsJumpStart; public RouteNodeType StartNodeType = RouteNodeType.Stand; public RouteNodeType EndNodeType = RouteNodeType.Stand; public float RiskScore; public float StaminaSafetyReserve; public bool WasBuiltBySpatialPlanner; public bool WasBuiltByReverseSearch; public Vector3 ProjectedEndPoint; public bool HasProjectedEndPoint; public float ProjectedRemainingStamina; public int PlanningDepth; public Vector3 ClimbTopPoint; public Vector3 ClimbSurfaceNormal; public Vector3 JumpGrabAimPoint; public float JumpGrabHorizontalDistance; public bool UsesRouteAssist; public string RouteAssistKind = string.Empty; public Vector3 RouteAssistPoint; } internal struct RouteProbe { public bool ObstacleAhead; public float ObstacleDistance; public Vector3 ObstaclePoint; public bool ClimbableAhead; public float ClimbHeightDelta; public Vector3 ClimbBasePoint; public bool NeedsJumpStart; public Vector3 ClimbTopPoint; public Vector3 ClimbSurfaceNormal; public bool UnsafeDropAhead; public float DropHeight; public bool SafeWalkDrop; public bool SafeJumpDrop; public Vector3 DropLandingPoint; public bool GapJumpable; public Vector3 GapLandingPoint; public float GapLandingDrop; } internal sealed class BlockedMemory { public Vector3 Point = Vector3.zero; public float Until; public float Radius = 2.75f; public float Penalty = 2.5f; } internal sealed class RouteSearchNode { public Vector3 Position = Vector3.zero; public readonly List Segments = new List(); public float Score; public float DistanceToGoal; public float RemainingStamina; public int Depth; } internal sealed class RouteNode { public Vector3 Position = Vector3.zero; public Vector3 Normal = Vector3.up; public Vector3 Tangent = Vector3.forward; public RouteNodeType Type = RouteNodeType.Stand; public float RemainingStamina; public float CostFromStart; public float EstimatedTotalCost; public float FailPenalty; public float SafeScore; public float HeightScore; public RouteNode? Parent; public PathPlan? ActionFromParent; } internal readonly struct RouteCandidateCacheKey : IEquatable { public readonly int X; public readonly int Y; public readonly int Z; public readonly int GoalX; public readonly int GoalY; public readonly int GoalZ; public readonly int DirBucket; public RouteCandidateCacheKey(int x, int y, int z, int goalX, int goalY, int goalZ, int dirBucket) { X = x; Y = y; Z = z; GoalX = goalX; GoalY = goalY; GoalZ = goalZ; DirBucket = dirBucket; } public bool Equals(RouteCandidateCacheKey other) { return X == other.X && Y == other.Y && Z == other.Z && GoalX == other.GoalX && GoalY == other.GoalY && GoalZ == other.GoalZ && DirBucket == other.DirBucket; } public override bool Equals(object? obj) { return obj is RouteCandidateCacheKey other && Equals(other); } public override int GetHashCode() { int x = X; x = (x * 397) ^ Y; x = (x * 397) ^ Z; x = (x * 397) ^ GoalX; x = (x * 397) ^ GoalY; x = (x * 397) ^ GoalZ; return (x * 397) ^ DirBucket; } } internal sealed class RouteCandidateCacheEntry { public readonly List Candidates = new List(); public float CreatedAt; } internal readonly struct RoutePlannerStateKey : IEquatable { public readonly int X; public readonly int Y; public readonly int Z; public readonly int Depth; public readonly int StaminaBucket; public RoutePlannerStateKey(int x, int y, int z, int depth, int staminaBucket) { X = x; Y = y; Z = z; Depth = depth; StaminaBucket = staminaBucket; } public bool Equals(RoutePlannerStateKey other) { return X == other.X && Y == other.Y && Z == other.Z && Depth == other.Depth && StaminaBucket == other.StaminaBucket; } public override bool Equals(object? obj) { return obj is RoutePlannerStateKey other && Equals(other); } public override int GetHashCode() { int x = X; x = (x * 397) ^ Y; x = (x * 397) ^ Z; x = (x * 397) ^ Depth; return (x * 397) ^ StaminaBucket; } } internal readonly struct RoutePathCacheKey : IEquatable { public readonly int StartX; public readonly int StartY; public readonly int StartZ; public readonly int GoalX; public readonly int GoalY; public readonly int GoalZ; public readonly int StaminaBucket; public readonly int ModeBucket; public RoutePathCacheKey(int startX, int startY, int startZ, int goalX, int goalY, int goalZ, int staminaBucket, int modeBucket) { StartX = startX; StartY = startY; StartZ = startZ; GoalX = goalX; GoalY = goalY; GoalZ = goalZ; StaminaBucket = staminaBucket; ModeBucket = modeBucket; } public bool Equals(RoutePathCacheKey other) { return StartX == other.StartX && StartY == other.StartY && StartZ == other.StartZ && GoalX == other.GoalX && GoalY == other.GoalY && GoalZ == other.GoalZ && StaminaBucket == other.StaminaBucket && ModeBucket == other.ModeBucket; } public override bool Equals(object? obj) { return obj is RoutePathCacheKey other && Equals(other); } public override int GetHashCode() { int startX = StartX; startX = (startX * 397) ^ StartY; startX = (startX * 397) ^ StartZ; startX = (startX * 397) ^ GoalX; startX = (startX * 397) ^ GoalY; startX = (startX * 397) ^ GoalZ; startX = (startX * 397) ^ StaminaBucket; return (startX * 397) ^ ModeBucket; } } internal sealed class RoutePathCacheEntry { public readonly List Segments = new List(); public float CreatedAt; } internal sealed class RouteChoiceMemory { public PathActionType Action = PathActionType.None; public Vector3 Position = Vector3.zero; public Vector3 Direction = Vector3.zero; public float Until; } internal struct PingTargetData { public Vector3 Point; public float Time; public int Sequence; public int OwnerActorNumber; public int OwnerViewId; public Character? OwnerCharacter; } internal readonly struct PhysicsProbeCacheKey : IEquatable { public readonly int Ax; public readonly int Ay; public readonly int Az; public readonly int Bx; public readonly int By; public readonly int Bz; public readonly int Kind; public PhysicsProbeCacheKey(int ax, int ay, int az, int bx, int by, int bz, int kind) { Ax = ax; Ay = ay; Az = az; Bx = bx; By = by; Bz = bz; Kind = kind; } public bool Equals(PhysicsProbeCacheKey other) { return Ax == other.Ax && Ay == other.Ay && Az == other.Az && Bx == other.Bx && By == other.By && Bz == other.Bz && Kind == other.Kind; } public override bool Equals(object? obj) { return obj is PhysicsProbeCacheKey other && Equals(other); } public override int GetHashCode() { int ax = Ax; ax = (ax * 397) ^ Ay; ax = (ax * 397) ^ Az; ax = (ax * 397) ^ Bx; ax = (ax * 397) ^ By; ax = (ax * 397) ^ Bz; return (ax * 397) ^ Kind; } } internal sealed class GroundProbeCacheEntry { public bool Found; public RaycastHit Hit; public float CreatedAt; } internal sealed class LineProbeCacheEntry { public bool Blocked; public float CreatedAt; } [HarmonyPatch(typeof(CharacterAfflictions), "AddStatus")] internal static class CharacterAfflictionsAddStatusPatch { [HarmonyPrefix] private static bool Prefix(CharacterAfflictions __instance, STATUSTYPE statusType, float amount, bool fromRPC, bool playEffects, bool notify, ref bool __result) { //IL_0051: Unknown result type (might be due to invalid IL or missing references) //IL_0053: Invalid comparison between Unknown and I4 //IL_0055: Unknown result type (might be due to invalid IL or missing references) //IL_0058: Invalid comparison between Unknown and I4 //IL_005a: Unknown result type (might be due to invalid IL or missing references) //IL_005c: Invalid comparison between Unknown and I4 //IL_005e: 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_0063: Invalid comparison between Unknown and I4 //IL_0065: Unknown result type (might be due to invalid IL or missing references) //IL_0067: Invalid comparison between Unknown and I4 //IL_0069: Unknown result type (might be due to invalid IL or missing references) //IL_006b: Invalid comparison between Unknown and I4 try { if ((Object)(object)__instance == (Object)null || (Object)(object)__instance.character == (Object)null || !__instance.character.isZombie) { return true; } NetworkRobotAgent agent = RobotInteractionUtil.GetAgent(__instance.character); if ((Object)(object)agent == (Object)null) { return true; } if ((int)statusType != 6 && (int)statusType != 11 && (int)statusType != 1 && (int)statusType != 0 && (int)statusType != 3 && (int)statusType != 2 && (int)statusType != 8) { __result = false; return false; } return true; } catch (Exception arg) { Plugin.Log.LogDebug((object)$"CharacterAfflictionsAddStatusPatch failed: {arg}"); return true; } } } [HarmonyPatch(typeof(CharacterAfflictions), "SubtractStatus")] internal static class CharacterAfflictionsSubtractStatusPatch { [HarmonyPrefix] private static bool Prefix(CharacterAfflictions __instance, STATUSTYPE statusType, float amount, bool fromRPC, bool decreasedNaturally) { //IL_0051: Unknown result type (might be due to invalid IL or missing references) //IL_0053: Invalid comparison between Unknown and I4 //IL_0055: Unknown result type (might be due to invalid IL or missing references) //IL_0058: Invalid comparison between Unknown and I4 //IL_005a: Unknown result type (might be due to invalid IL or missing references) //IL_005c: Invalid comparison between Unknown and I4 //IL_005e: 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_0063: Invalid comparison between Unknown and I4 //IL_0065: Unknown result type (might be due to invalid IL or missing references) //IL_0067: Invalid comparison between Unknown and I4 //IL_0069: Unknown result type (might be due to invalid IL or missing references) //IL_006b: Invalid comparison between Unknown and I4 try { if ((Object)(object)__instance == (Object)null || (Object)(object)__instance.character == (Object)null || !__instance.character.isZombie) { return true; } NetworkRobotAgent agent = RobotInteractionUtil.GetAgent(__instance.character); if ((Object)(object)agent == (Object)null) { return true; } return (int)statusType == 6 || (int)statusType == 11 || (int)statusType == 1 || (int)statusType == 0 || (int)statusType == 3 || (int)statusType == 2 || (int)statusType == 8; } catch (Exception arg) { Plugin.Log.LogDebug((object)$"CharacterAfflictionsSubtractStatusPatch failed: {arg}"); return true; } } } [HarmonyPatch(typeof(CharacterBackpackHandler), "LateUpdate")] internal static class CharacterBackpackHandlerRobotPatch { private static bool Prefix(CharacterBackpackHandler __instance) { try { Character val = (((Object)(object)__instance != (Object)null) ? ((Component)__instance).GetComponent() : null); if ((Object)(object)val == (Object)null || (Object)(object)RobotInteractionUtil.GetAgent(val) == (Object)null) { return true; } if ((Object)(object)__instance.backpack != (Object)null) { __instance.backpack.SetActive(false); } return false; } catch (Exception arg) { Plugin.Log.LogDebug((object)$"CharacterBackpackHandlerRobotPatch failed: {arg}"); return true; } } } [HarmonyPatch(typeof(CharacterGrabbing), "Reach")] internal static class RobotReachDragPatch { [HarmonyPostfix] private static void Postfix(CharacterGrabbing __instance) { //IL_0222: 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_0156: 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_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_0189: 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) try { if ((Object)(object)__instance == (Object)null) { return; } object? obj = PatchReflectionCache.CharacterGrabbingCharacterField?.GetValue(__instance); Character val = (Character)((obj is Character) ? obj : null); if ((Object)(object)val == (Object)null || (Object)(object)val.data == (Object)null || val.refs == null || (Object)(object)val.refs.view == (Object)null || !val.refs.view.IsMine) { return; } for (int num = NetworkRobotAgent.All.Count - 1; num >= 0; num--) { NetworkRobotAgent networkRobotAgent = NetworkRobotAgent.All[num]; if ((Object)(object)networkRobotAgent == (Object)null || (Object)(object)networkRobotAgent.Character == (Object)null) { NetworkRobotAgent.All.RemoveAt(num); } else { Character character = networkRobotAgent.Character; if (!((Object)(object)character == (Object)(object)val) && !((Object)(object)character.data == (Object)null) && character.refs != null && !((Object)(object)character.refs.afflictions == (Object)null) && !((Object)(object)((MonoBehaviourPun)character).photonView == (Object)null) && networkRobotAgent.CanBeHelpedByPlayer()) { float num2 = Vector3.Distance(val.Center, character.Center); if (!(num2 > 4f)) { Vector3 val2 = character.Center - val.Center; if (!(((Vector3)(ref val2)).sqrMagnitude < 0.001f) && !(Vector3.Angle(val.data.lookDirection, val2) > 60f)) { character.refs.afflictions.SubtractStatus((STATUSTYPE)11, 1f, false, false); try { if ((Object)(object)GUIManager.instance != (Object)null) { GUIManager.instance.Grasp(); } } catch { } ((MonoBehaviourPun)character).photonView.RPC("RPC_AssistDrag", (RpcTarget)0, new object[2] { val.Center, 70f }); networkRobotAgent.NotifyGrabbedByPlayer(val); } } } } } } catch (Exception arg) { Plugin.Log.LogDebug((object)$"RobotReachDragPatch failed: {arg}"); } } } [HarmonyPatch(typeof(CharacterGrabbing), "RPCA_GrabAttach")] internal static class CharacterGrabbingGrabAttachPatch { [HarmonyPostfix] private static void Postfix(CharacterGrabbing __instance, PhotonView view, int bodyPartID, Vector3 relativePos) { try { if ((Object)(object)view == (Object)null) { return; } Character component = ((Component)view).GetComponent(); if ((Object)(object)component == (Object)null) { return; } NetworkRobotAgent agent = RobotInteractionUtil.GetAgent(component); if (!((Object)(object)agent == (Object)null)) { object? obj = PatchReflectionCache.CharacterGrabbingCharacterField?.GetValue(__instance); Character val = (Character)((obj is Character) ? obj : null); if (!((Object)(object)val == (Object)null)) { agent.NotifyGrabbedByPlayer(val); } } } catch (Exception arg) { Plugin.Log.LogDebug((object)$"CharacterGrabbingGrabAttachPatch failed: {arg}"); } } } [HarmonyPatch(typeof(CharacterGrabbing), "RPCA_GrabUnattach")] internal static class CharacterGrabbingGrabUnattachPatch { [HarmonyPrefix] private static void Prefix(CharacterGrabbing __instance) { try { object? obj = PatchReflectionCache.CharacterGrabbingCharacterField?.GetValue(__instance); Character val = (Character)((obj is Character) ? obj : null); if ((Object)(object)val == (Object)null) { return; } Character grabbedPlayer = val.data.grabbedPlayer; if (!((Object)(object)grabbedPlayer == (Object)null)) { NetworkRobotAgent agent = RobotInteractionUtil.GetAgent(grabbedPlayer); if (!((Object)(object)agent == (Object)null)) { agent.NotifyReleasedByPlayer(val); } } } catch (Exception arg) { Plugin.Log.LogDebug((object)$"CharacterGrabbingGrabUnattachPatch failed: {arg}"); } } } [HarmonyPatch(typeof(CharacterCarrying), "Update")] internal static class CharacterCarryingUpdatePatch { [HarmonyPrefix] private static bool Prefix(CharacterCarrying __instance) { try { object? obj = PatchReflectionCache.CharacterCarryingCharacterField?.GetValue(__instance); Character val = (Character)((obj is Character) ? obj : null); if ((Object)(object)val == (Object)null || (Object)(object)val.data == (Object)null) { return true; } if (val.data.isCarried && (Object)(object)val.data.carrier != (Object)null && (Object)(object)RobotInteractionUtil.GetAgent(val.data.carrier) != (Object)null) { if (val.refs != null && (Object)(object)val.refs.view != (Object)null && val.refs.view.IsMine && (val.input.jumpWasPressed || val.input.dropWasPressed || val.input.interactWasPressed)) { ((MonoBehaviourPun)val.data.carrier).photonView.RPC("RPCA_Drop", (RpcTarget)0, new object[1] { ((MonoBehaviourPun)val).photonView }); } return true; } NetworkRobotAgent agent = RobotInteractionUtil.GetAgent(val); if ((Object)(object)agent != (Object)null) { if (val.refs == null || (Object)(object)val.refs.view == (Object)null || !val.refs.view.IsMine) { return false; } Character carriedPlayer = val.data.carriedPlayer; if ((Object)(object)carriedPlayer == (Object)null) { return false; } if ((Object)(object)carriedPlayer.data == (Object)null || carriedPlayer.data.dead || val.data.fullyPassedOut || val.data.dead || (Object)(object)carriedPlayer.data.carrier != (Object)(object)val) { ((MonoBehaviourPun)val).photonView.RPC("RPCA_Drop", (RpcTarget)0, new object[1] { ((MonoBehaviourPun)carriedPlayer).photonView }); } return false; } if (val.refs == null || (Object)(object)val.refs.view == (Object)null || !val.refs.view.IsMine) { return true; } Character carriedPlayer2 = val.data.carriedPlayer; if ((Object)(object)carriedPlayer2 == (Object)null) { return true; } NetworkRobotAgent agent2 = RobotInteractionUtil.GetAgent(carriedPlayer2); if ((Object)(object)agent2 == (Object)null) { return true; } if (carriedPlayer2.data.dead || val.data.fullyPassedOut || val.data.dead || (Object)(object)carriedPlayer2.data.currentItem != (Object)null) { val.refs.carriying.Drop(carriedPlayer2); } return false; } catch (Exception arg) { Plugin.Log.LogDebug((object)$"CharacterCarryingUpdatePatch failed: {arg}"); return true; } } } [HarmonyPatch(typeof(CharacterCarrying), "RPCA_StartCarry")] internal static class CharacterCarryingStartCarryPatch { [HarmonyPrefix] private static bool Prefix(CharacterCarrying __instance, PhotonView targetView) { try { object? obj = PatchReflectionCache.CharacterCarryingCharacterField?.GetValue(__instance); Character val = (Character)((obj is Character) ? obj : null); NetworkRobotAgent agent = RobotInteractionUtil.GetAgent(val); if ((Object)(object)val == (Object)null || (Object)(object)agent == (Object)null) { return true; } if ((Object)(object)targetView == (Object)null) { return false; } Character component = ((Component)targetView).GetComponent(); if ((Object)(object)component == (Object)null || (Object)(object)component.data == (Object)null) { return false; } if ((Object)(object)val.data.carriedPlayer != (Object)null && (Object)(object)val.data.carriedPlayer != (Object)(object)component) { val.refs.carriying.RPCA_Drop(((MonoBehaviourPun)val.data.carriedPlayer).photonView); } if ((Object)(object)component.data.carrier != (Object)null && (Object)(object)component.data.carrier != (Object)(object)val) { component.data.carrier.refs.carriying.RPCA_Drop(((MonoBehaviourPun)component).photonView); } PatchReflectionCache.CharacterCarryingToggleCarryPhysicsMethod?.Invoke(component.refs.carriying, new object[1] { true }); component.data.isCarried = true; val.data.carriedPlayer = component; component.data.carrier = val; RefreshCarryWeights(val); agent.NotifyStartedCarryingPlayer(component); return false; } catch (Exception arg) { Plugin.Log.LogDebug((object)$"CharacterCarryingStartCarryPatch Prefix failed: {arg}"); return true; } } [HarmonyPostfix] private static void Postfix(CharacterCarrying __instance, PhotonView targetView) { try { if ((Object)(object)targetView == (Object)null) { return; } Character component = ((Component)targetView).GetComponent(); if ((Object)(object)component == (Object)null) { return; } NetworkRobotAgent agent = RobotInteractionUtil.GetAgent(component); if ((Object)(object)agent != (Object)null) { object? obj = PatchReflectionCache.CharacterCarryingCharacterField?.GetValue(__instance); Character val = (Character)((obj is Character) ? obj : null); if ((Object)(object)val != (Object)null) { agent.NotifyCarriedByPlayer(val); } } object? obj2 = PatchReflectionCache.CharacterCarryingCharacterField?.GetValue(__instance); Character character = (Character)((obj2 is Character) ? obj2 : null); NetworkRobotAgent agent2 = RobotInteractionUtil.GetAgent(character); if ((Object)(object)agent2 != (Object)null && (Object)(object)component != (Object)null) { agent2.NotifyStartedCarryingPlayer(component); } } catch (Exception arg) { Plugin.Log.LogDebug((object)$"CharacterCarryingStartCarryPatch Postfix failed: {arg}"); } } internal static void RefreshCarryWeights(Character carrier) { try { List allPlayerCharacters = PlayerHandler.GetAllPlayerCharacters(); for (int i = 0; i < allPlayerCharacters.Count; i++) { allPlayerCharacters[i].refs.afflictions.UpdateWeight(); } if ((Object)(object)carrier != (Object)null && carrier.refs != null && (Object)(object)carrier.refs.afflictions != (Object)null) { carrier.refs.afflictions.UpdateWeight(); } } catch (Exception arg) { Plugin.Log.LogDebug((object)$"RefreshCarryWeights failed: {arg}"); } } } [HarmonyPatch(typeof(CharacterCarrying), "RPCA_Drop")] internal static class CharacterCarryingDropPatch { [HarmonyPrefix] private static void Prefix(CharacterCarrying __instance, PhotonView targetView) { try { if ((Object)(object)targetView == (Object)null) { return; } Character component = ((Component)targetView).GetComponent(); if ((Object)(object)component == (Object)null) { return; } NetworkRobotAgent agent = RobotInteractionUtil.GetAgent(component); if ((Object)(object)agent != (Object)null) { object? obj = PatchReflectionCache.CharacterCarryingCharacterField?.GetValue(__instance); Character val = (Character)((obj is Character) ? obj : null); if ((Object)(object)val != (Object)null) { agent.NotifyDroppedByPlayer(val); } } } catch (Exception arg) { Plugin.Log.LogDebug((object)$"CharacterCarryingDropPatch Prefix failed: {arg}"); } } [HarmonyPostfix] private static void Postfix(CharacterCarrying __instance, PhotonView targetView) { try { object? obj = PatchReflectionCache.CharacterCarryingCharacterField?.GetValue(__instance); Character val = (Character)((obj is Character) ? obj : null); NetworkRobotAgent agent = RobotInteractionUtil.GetAgent(val); if (!((Object)(object)agent == (Object)null) && !((Object)(object)targetView == (Object)null)) { Character component = ((Component)targetView).GetComponent(); if ((Object)(object)component != (Object)null) { agent.NotifyStoppedCarryingPlayer(component); } if ((Object)(object)val != (Object)null) { CharacterCarryingStartCarryPatch.RefreshCarryWeights(val); } } } catch (Exception arg) { Plugin.Log.LogDebug((object)$"CharacterCarryingDropPatch Postfix failed: {arg}"); } } } [HarmonyPatch(typeof(CharacterInteractible), "GetInteractionText")] internal static class CharacterInteractibleGetInteractionTextPatch { [HarmonyPrefix] private static bool Prefix(CharacterInteractible __instance, ref string __result) { try { if ((Object)(object)__instance == (Object)null || (Object)(object)__instance.character == (Object)null || (Object)(object)RobotInteractionUtil.GetAgent(__instance.character) == (Object)null) { return true; } Character character = __instance.character; if (RobotInteractionRules.IsCarriedByLocalPlayer(character)) { __result = LocalizedText.GetText("DROP", true).Replace("#", __instance.GetName()); return false; } if (RobotInteractionRules.CanLocalPlayerEatRobot(character)) { __result = LocalizedText.GetText("EAT", true); return false; } if (RobotInteractionRules.CanCarryRobot(character, Character.localCharacter)) { __result = LocalizedText.GetText("CARRY", true).Replace("#", __instance.GetName()); return false; } __result = string.Empty; return false; } catch (Exception arg) { Plugin.Log.LogDebug((object)$"CharacterInteractibleGetInteractionTextPatch failed: {arg}"); return true; } } } [HarmonyPatch(typeof(CharacterInteractible), "Interact")] internal static class CharacterInteractibleInteractPatch { [HarmonyPrefix] private static bool Prefix(CharacterInteractible __instance, Character interactor) { try { if ((Object)(object)__instance == (Object)null || (Object)(object)__instance.character == (Object)null || (Object)(object)RobotInteractionUtil.GetAgent(__instance.character) == (Object)null) { return true; } Character character = __instance.character; if (RobotInteractionRules.IsCarriedByLocalPlayer(character)) { interactor.refs.carriying.Drop(character); return false; } if (RobotInteractionRules.CanLocalPlayerEatRobot(character, interactor)) { return false; } if (RobotInteractionRules.CanCarryRobot(character, interactor)) { interactor.refs.carriying.StartCarry(character); return false; } return false; } catch (Exception arg) { Plugin.Log.LogDebug((object)$"CharacterInteractibleInteractPatch failed: {arg}"); return true; } } } [HarmonyPatch(typeof(CharacterInteractible), "Interact_CastFinished")] internal static class CharacterInteractibleCastFinishedPatch { [HarmonyPrefix] private static bool Prefix(CharacterInteractible __instance, Character interactor) { try { if ((Object)(object)__instance == (Object)null || (Object)(object)__instance.character == (Object)null || (Object)(object)RobotInteractionUtil.GetAgent(__instance.character) == (Object)null) { return true; } RobotInteractionRules.TryEatRobot(__instance.character, interactor); return false; } catch (Exception arg) { Plugin.Log.LogDebug((object)$"CharacterInteractibleCastFinishedPatch failed: {arg}"); return true; } } } [HarmonyPatch(typeof(CharacterInteractible), "IsConstantlyInteractable")] internal static class CharacterInteractibleIsConstantlyInteractablePatch { [HarmonyPostfix] private static void Postfix(CharacterInteractible __instance, Character interactor, ref bool __result) { try { if (!((Object)(object)__instance == (Object)null) && !((Object)(object)__instance.character == (Object)null) && !((Object)(object)RobotInteractionUtil.GetAgent(__instance.character) == (Object)null)) { __result = RobotInteractionRules.CanLocalPlayerEatRobot(__instance.character, interactor); } } catch (Exception arg) { Plugin.Log.LogDebug((object)$"CharacterInteractibleIsConstantlyInteractablePatch failed: {arg}"); } } } [HarmonyPatch(typeof(CharacterInteractible), "IsPrimaryInteractible")] internal static class CharacterInteractibleIsPrimaryInteractiblePatch { [HarmonyPostfix] private static void Postfix(CharacterInteractible __instance, Character interactor, ref bool __result) { try { if (!((Object)(object)__instance == (Object)null) && !((Object)(object)__instance.character == (Object)null)) { NetworkRobotAgent agent = RobotInteractionUtil.GetAgent(__instance.character); if (!((Object)(object)agent == (Object)null)) { Character character = __instance.character; bool flag = RobotInteractionRules.IsCarriedByLocalPlayer(character); bool flag2 = RobotInteractionRules.CanLocalPlayerEatRobot(character, interactor); bool flag3 = RobotInteractionRules.CanCarryRobot(character, interactor); __result = !character.data.dead && (flag || flag2 || flag3); } } } catch (Exception arg) { Plugin.Log.LogDebug((object)$"CharacterInteractibleIsPrimaryInteractiblePatch failed: {arg}"); } } } [HarmonyPatch(typeof(CharacterInteractible), "IsSecondaryInteractible")] internal static class CharacterInteractibleIsSecondaryInteractiblePatch { [HarmonyPostfix] private static void Postfix(CharacterInteractible __instance, Character interactor, ref bool __result) { try { if ((Object)(object)__instance == (Object)null || (Object)(object)__instance.character == (Object)null || (Object)(object)interactor == (Object)null) { return; } NetworkRobotAgent agent = RobotInteractionUtil.GetAgent(__instance.character); if ((Object)(object)agent == (Object)null) { return; } if (__instance.character.data.dead) { __result = false; return; } Item currentItem = interactor.data.currentItem; if ((Object)(object)currentItem == (Object)null || !currentItem.canUseOnFriend) { __result = false; } else { __result = (Object)(object)interactor != (Object)(object)__instance.character; } } catch (Exception arg) { Plugin.Log.LogDebug((object)$"CharacterInteractibleIsSecondaryInteractiblePatch failed: {arg}"); } } } [HarmonyPatch(typeof(CharacterInteractible), "CanBeCarried")] internal static class CharacterInteractibleCanBeCarriedPatch { [HarmonyPostfix] private static void Postfix(CharacterInteractible __instance, ref bool __result) { try { if (!((Object)(object)__instance == (Object)null) && !((Object)(object)__instance.character == (Object)null) && !((Object)(object)RobotInteractionUtil.GetAgent(__instance.character) == (Object)null)) { __result = RobotInteractionRules.CanCarryRobot(__instance.character, Character.localCharacter); } } catch (Exception arg) { Plugin.Log.LogDebug((object)$"CharacterInteractibleCanBeCarriedPatch failed: {arg}"); } } } [HarmonyPatch(typeof(CharacterInteractible), "IsInteractible")] internal static class CharacterInteractibleIsInteractiblePatch { [HarmonyPostfix] private static void Postfix(CharacterInteractible __instance, Character interactor, ref bool __result) { try { if ((Object)(object)__instance == (Object)null || (Object)(object)__instance.character == (Object)null) { return; } NetworkRobotAgent agent = RobotInteractionUtil.GetAgent(__instance.character); if (!((Object)(object)agent == (Object)null)) { Character character = __instance.character; if (character.data.dead) { __result = false; return; } bool flag = RobotInteractionRules.IsCarriedByLocalPlayer(character); bool flag2 = RobotInteractionRules.CanLocalPlayerEatRobot(character, interactor); bool flag3 = RobotInteractionRules.CanCarryRobot(character, interactor); bool flag4 = (Object)(object)interactor != (Object)null && (Object)(object)interactor != (Object)(object)character && (Object)(object)interactor.data.currentItem != (Object)null && interactor.data.currentItem.canUseOnFriend; __result = flag || flag2 || flag3 || flag4; } } catch (Exception arg) { Plugin.Log.LogDebug((object)$"CharacterInteractibleIsInteractiblePatch failed: {arg}"); } } } [HarmonyPatch(typeof(CharacterInput), "Sample")] internal static class HostPlayerPilotInputPatch { private sealed class PilotState { public int LastSequence; public bool HasGoal; public Vector3 Goal; public Vector3 ResolvedGoal; public bool HasResolvedGoal; public bool Parked; public int ParkedSequence; public float StableTimer; public PathPlan ActivePlan = new PathPlan(); public bool HasActivePlan; public float NextReplanTime; public float SegmentStartTime; public Vector3 SegmentStartPosition; public float SegmentStartGoalDistance; public Vector3 LastProgressAnchor; public float LastProgressTime; } private static readonly Dictionary StatesByView = new Dictionary(); private static readonly Dictionary LastAutoJumpByView = new Dictionary(); private static readonly Dictionary CharacterByInputId = new Dictionary(); private const float ManualMoveThreshold = 0.05f; private const float ManualLookThreshold = 0.04f; private const float JumpCooldown = 0.24f; private const float ReplanCooldown = 0.5f; private const float GoalArrivalFlat = 2.05f; private const float GoalArrivalVertical = 1.6f; private const float GoalParkStableSeconds = 1f; private const float GoalParkedHysteresisFlat = 3f; private const float GoalParkedHysteresisVertical = 2.5f; private const float SegmentArriveFlat = 1.35f; private const float SegmentProgressTimeout = 3.2f; private const float SegmentMinMove = 0.65f; private const float RoughSlopeAngle = 68f; private const float ClimbTopSlopeAngle = 72f; private const float LowerGoalThreshold = -1.25f; private const float MaxSafeWalkDrop = 8f; private const float MaxSafeJumpDrop = 16f; private const float MinClimbStamina = 0.4f; private const float ActiveClimbExhaustedStaminaThreshold = 0.018f; private const float ContinueClimbStamina = 0.018f; private const float HeavyActionLowStaminaThreshold = 0.08f; private const float SprintMinStamina = 0.12f; private const float FlatTravelHopVerticalTolerance = 0.45f; private const float GroundProbeHeight = 2.2f; private const float GroundProbeDepth = 15f; private static readonly int TerrainMask = LayerMask.GetMask(new string[2] { "Terrain", "Map" }); private static readonly float[] SearchAngles = new float[7] { 0f, 25f, -25f, 55f, -55f, 90f, -90f }; private static readonly float[] SearchDistances = new float[3] { 1.2f, 2.4f, 4.2f }; [HarmonyPostfix] private static void Postfix(CharacterInput __instance, bool playerMovementActive) { //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_0178: 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_0196: Unknown result type (might be due to invalid IL or missing references) //IL_01a3: Unknown result type (might be due to invalid IL or missing references) //IL_01a7: Unknown result type (might be due to invalid IL or missing references) try { if ((Object)(object)__instance == (Object)null || !playerMovementActive) { return; } Plugin instance = Plugin.Instance; if ((Object)(object)instance == (Object)null || !instance.ShouldHostPilotRun) { return; } Character characterForInput = GetCharacterForInput(__instance); if ((Object)(object)characterForInput == (Object)null || (Object)(object)characterForInput != (Object)(object)Character.localCharacter || (Object)(object)characterForInput.data == (Object)null || !characterForInput.IsLocal || characterForInput.isBot || characterForInput.data.dead || characterForInput.data.fullyPassedOut || characterForInput.data.isCarried) { return; } int viewId = (((Object)(object)((MonoBehaviourPun)characterForInput).photonView != (Object)null) ? ((MonoBehaviourPun)characterForInput).photonView.ViewID : ((Object)characterForInput).GetInstanceID()); PilotState state = GetState(viewId); if (instance.HostPilotManualOverride && HasMeaningfulManualInput(__instance)) { ReleaseParkedAndPlan(state); return; } if (!PingTargetTracker.TryGetBestPingDataForCharacter(characterForInput, instance.HostPilotAcceptOtherPlayersPingTargets, out var data)) { ResetState(state); return; } if (data.Sequence != state.LastSequence || !state.HasGoal || Vector3.Distance(state.Goal, data.Point) > 1f) { ResetForNewGoal(state, data.Point, data.Sequence, characterForInput); } Vector3 pingPoint = (state.HasResolvedGoal ? state.ResolvedGoal : data.Point); ApplyPilotInput(characterForInput, __instance, pingPoint, data.Sequence, instance, state, viewId); } catch (Exception arg) { Plugin.Log.LogDebug((object)$"HostPlayerPilotInputPatch failed: {arg}"); } } private static Character? GetCharacterForInput(CharacterInput input) { int instanceID = ((Object)input).GetInstanceID(); if (CharacterByInputId.TryGetValue(instanceID, out Character value)) { if ((Object)(object)value != (Object)null && (Object)(object)value.input == (Object)(object)input) { return value; } CharacterByInputId.Remove(instanceID); } try { Character component = ((Component)input).GetComponent(); if ((Object)(object)component != (Object)null) { CharacterByInputId[instanceID] = component; } return component; } catch { return null; } } private static PilotState GetState(int viewId) { if (!StatesByView.TryGetValue(viewId, out PilotState value)) { value = new PilotState(); StatesByView[viewId] = value; } return value; } private static void ResetState(PilotState state) { //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) state.HasGoal = false; state.HasResolvedGoal = false; state.ResolvedGoal = Vector3.zero; state.Parked = false; state.StableTimer = 0f; state.HasActivePlan = false; state.ActivePlan = new PathPlan(); state.LastSequence = 0; } private static void ResetForNewGoal(PilotState state, Vector3 goal, int sequence, Character character) { //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_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_0017: 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_0079: 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_0090: 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) state.HasGoal = true; state.Goal = goal; state.ResolvedGoal = ResolvePilotGoal(character, goal); state.HasResolvedGoal = true; state.LastSequence = sequence; state.Parked = false; state.ParkedSequence = 0; state.StableTimer = 0f; state.HasActivePlan = false; state.ActivePlan = new PathPlan(); state.NextReplanTime = 0f; state.SegmentStartTime = Time.time; state.SegmentStartPosition = character.Center; state.SegmentStartGoalDistance = Vector3.Distance(character.Center, state.ResolvedGoal); state.LastProgressAnchor = character.Center; state.LastProgressTime = Time.time; } private static void ReleaseParkedAndPlan(PilotState state) { state.Parked = false; state.ParkedSequence = 0; state.StableTimer = 0f; state.HasActivePlan = false; state.NextReplanTime = 0f; } private static bool HasMeaningfulManualInput(CharacterInput input) { if (((Vector2)(ref input.movementInput)).sqrMagnitude > 0.0025000002f) { return true; } if (((Vector2)(ref input.lookInput)).sqrMagnitude > 0.0016f) { return true; } return input.jumpWasPressed || input.jumpIsPressed || input.dropWasPressed || input.dropIsPressed || input.interactWasPressed || input.interactIsPressed || input.usePrimaryWasPressed || input.usePrimaryIsPressed || input.useSecondaryWasPressed || input.useSecondaryIsPressed || input.crouchWasPressed || input.crouchIsPressed; } private static void ApplyPilotInput(Character character, CharacterInput input, Vector3 pingPoint, int sequence, Plugin plugin, PilotState state, int viewId) { //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_005b: 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_0084: 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_00f7: 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_00c8: 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_00e3: 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) input.lookInput = Vector2.zero; if (character.data.isClimbing && !HasStaminaForClimb(character)) { TryStopClimb(character); HoldStillAtGoal(character, input, pingPoint); state.HasActivePlan = false; state.NextReplanTime = Time.time + 0.35f; } else { if (TickParking(character, input, pingPoint, sequence, state)) { return; } if (!state.HasActivePlan || IsPilotSegmentFinished(character, state) || IsPilotSegmentFailed(character, state, pingPoint)) { TryReplanPilot(character, state, pingPoint, viewId); } if (!state.HasActivePlan) { if (ShouldWaitForStaminaBeforePushingUp(character, pingPoint)) { HoldStillAtGoal(character, input, pingPoint); return; } LookAt(character, pingPoint); WalkTowards(character, input, pingPoint, 0.65f, sprint: false, jump: false, viewId); TryFlatTravelHop(character, input, pingPoint, viewId); } else { ExecutePilotPlan(character, input, state.ActivePlan, pingPoint, plugin, viewId); } } } private static bool TickParking(Character character, CharacterInput input, Vector3 goal, int sequence, PilotState state) { //IL_0050: 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_00b9: 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_0032: Unknown result type (might be due to invalid IL or missing references) if (state.Parked) { if (state.ParkedSequence == sequence && IsWithinGoalZone(character, goal, 3f, 2.5f)) { HoldStillAtGoal(character, input, goal); return true; } ReleaseParkedAndPlan(state); return false; } if (!IsWithinGoalZone(character, goal, 2.05f, 1.6f)) { state.StableTimer = 0f; return false; } if (!IsSafeStanding(character)) { state.StableTimer = 0f; HoldStillAtGoal(character, input, goal); return true; } state.StableTimer += Time.deltaTime; HoldStillAtGoal(character, input, goal); if (state.StableTimer >= 1f) { state.Parked = true; state.ParkedSequence = sequence; state.HasActivePlan = false; state.ActivePlan = new PathPlan(); } return true; } private static void HoldStillAtGoal(Character character, CharacterInput input, Vector3 goal) { //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) input.movementInput = Vector2.zero; input.sprintIsPressed = false; input.jumpWasPressed = false; input.jumpIsPressed = false; } private static bool IsWithinGoalZone(Character character, Vector3 goal, float flat, float vertical) { //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_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_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_002d: Unknown result type (might be due to invalid IL or missing references) //IL_0033: Unknown result type (might be due to invalid IL or missing references) Vector3 val = character.Center; if (TryFindGround(character.Center, out var hit)) { val = ((RaycastHit)(ref hit)).point; } return HelperFunctions.FlatDistance(val, goal) <= flat && Mathf.Abs(val.y - goal.y) <= vertical; } private static bool IsSafeStanding(Character character) { //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) if ((Object)(object)character.data == (Object)null) { return false; } if (character.data.isClimbing || character.data.isRopeClimbing || character.data.isVineClimbing) { return false; } if (!character.data.isGrounded || character.data.fallSeconds > 0f || character.data.passedOut || character.data.fullyPassedOut) { return false; } RaycastHit hit; return TryFindGround(character.Center, out hit) && IsStandableNormal(((RaycastHit)(ref hit)).normal); } private static void TryReplanPilot(Character character, PilotState state, Vector3 goal, int viewId) { //IL_003b: 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_008c: Unknown result type (might be due to invalid IL or missing references) if (!(Time.time < state.NextReplanTime)) { state.NextReplanTime = Time.time + 0.5f + (float)(Mathf.Abs(viewId) % 7) * 0.025f; state.ActivePlan = BuildPilotPlan(character, goal); state.HasActivePlan = state.ActivePlan.Action != 0 && state.ActivePlan.Action != PathActionType.Hold; state.SegmentStartTime = Time.time; state.SegmentStartPosition = character.Center; state.SegmentStartGoalDistance = Vector3.Distance(character.Center, state.ResolvedGoal); } } private static PathPlan BuildPilotPlan(Character character, Vector3 goal) { //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_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_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_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_0062: 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_0067: 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_009c: 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_00c5: 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_00e3: 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_024f: 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_026a: 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_011e: 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_02b4: 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_02bb: 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_0297: 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_017d: 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_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_0192: 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_019f: 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_01d3: 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_01fd: 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_021e: 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) //IL_0226: 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) Vector3 center = character.Center; Vector3 val = goal - center; Vector3 val2 = val; val2.y = 0f; float magnitude = ((Vector3)(ref val2)).magnitude; float num = goal.y - center.y; bool flag = num < -1.25f; bool flag2 = num > 1.1f; Vector3 val3 = ((magnitude > 0.05f) ? ((Vector3)(ref val2)).normalized : ((Component)character).transform.forward); val3.y = 0f; if (((Vector3)(ref val3)).sqrMagnitude < 0.01f) { val3 = Vector3.forward; } ((Vector3)(ref val3)).Normalize(); if (TryCreatePilotRoughWalkPlan(character, goal, val3, magnitude, flag2, out PathPlan plan)) { return plan; } if (flag && magnitude < 0.6f && TryFindPilotDropPlan(character, goal, val3, out PathPlan plan2)) { return plan2; } if (TryProbePilotRoute(character, val3, 2.2f, out var probe)) { if (flag2 && probe.ClimbableAhead && !HasStaminaForClimb(character)) { return BuildWaitForStaminaPlan(goal, probe.ClimbBasePoint); } if (flag && TryCreatePilotDropPlan(character, goal, val3, probe, out PathPlan plan3)) { return plan3; } if (flag2 && probe.ClimbableAhead && HasStaminaForClimb(character)) { return new PathPlan { Action = PathActionType.Climb, Goal = goal + Vector3.up * 0.25f, Anchor = probe.ClimbBasePoint, TargetAbove = true, RequiredStamina = 0.4f, NeedsJumpStart = probe.NeedsJumpStart, ClimbTopPoint = probe.ClimbTopPoint, ProjectedEndPoint = probe.ClimbTopPoint, HasProjectedEndPoint = true }; } if (!probe.ObstacleAhead && !probe.UnsafeDropAhead && !IsLineBlocked(center, goal)) { return new PathPlan { Action = PathActionType.Direct, Goal = goal, Anchor = goal, TargetAbove = flag2, ProjectedEndPoint = goal, HasProjectedEndPoint = true }; } } if (flag && TryFindPilotDropPlan(character, goal, val3, out PathPlan plan4)) { return plan4; } if (TryFindPilotTerrainPlan(character, goal, val3, out PathPlan plan5)) { return plan5; } if (flag2 && !HasStaminaForClimb(character)) { return BuildWaitForStaminaPlan(goal, character.Center); } return new PathPlan { Action = PathActionType.Hold, Goal = goal, Anchor = goal, TargetAbove = flag2 }; } private static PathPlan BuildWaitForStaminaPlan(Vector3 goal, Vector3 anchor) { //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_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) return new PathPlan { Action = PathActionType.WaitForStamina, Goal = goal, Anchor = anchor, TargetAbove = true, RequiredStamina = 0.4f, ReachableWithinRecoverableBudget = true }; } private static bool TryCreatePilotRoughWalkPlan(Character character, Vector3 goal, Vector3 dir, float flatDistance, bool targetAbove, out PathPlan plan) { //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_0033: 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_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_0076: 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_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_0086: 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_0122: Unknown result type (might be due to invalid IL or missing references) //IL_012c: Unknown result type (might be due to invalid IL or missing references) //IL_0131: Unknown result type (might be due to invalid IL or missing references) //IL_013b: 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_01ba: 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_01c2: 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_01d1: 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_0167: 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_00b4: 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_00c7: 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_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) plan = new PathPlan(); if (flatDistance < 0.2f) { return false; } float num = Mathf.Min(flatDistance, 4.25f); Vector3 center = character.Center; Vector3 val = center; if (TryFindGround(center, out var hit)) { val = ((RaycastHit)(ref hit)).point; } int num2 = Mathf.Clamp(Mathf.CeilToInt(num / 0.55f), 1, 8); for (int i = 1; i <= num2; i++) { float num3 = num * ((float)i / (float)num2); Vector3 point = center + dir * num3; if (!TryFindGround(point, out var hit2) || !IsStandableNormal(((RaycastHit)(ref hit2)).normal)) { return false; } float num4 = ((RaycastHit)(ref hit2)).point.y - val.y; float num5 = val.y - ((RaycastHit)(ref hit2)).point.y; if (num4 > 0.72f || num5 > 0.9f) { return false; } val = ((RaycastHit)(ref hit2)).point; } RaycastHit val2 = default(RaycastHit); if (Physics.SphereCast(center + Vector3.up * 1.45f, 0.18f, dir, ref val2, Mathf.Min(num, 2.2f), TerrainMask, (QueryTriggerInteraction)1)) { float num6 = ((RaycastHit)(ref val2)).point.y - center.y; if (!(num6 <= 0.85f) && !(Vector3.Angle(((RaycastHit)(ref val2)).normal, Vector3.up) <= 68f)) { return false; } } plan = new PathPlan { Action = PathActionType.Direct, Goal = goal, Anchor = goal, TargetAbove = targetAbove, ProjectedEndPoint = val, HasProjectedEndPoint = true, Score = 2f }; return true; } private static bool TryFindPilotTerrainPlan(Character character, Vector3 goal, Vector3 baseDir, out PathPlan plan) { //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_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_0017: Unknown result type (might be due to invalid IL or missing references) //IL_001d: Unknown result type (might be due to invalid IL or missing references) //IL_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_0054: 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_006a: Unknown result type (might be due to invalid IL or missing references) //IL_006e: Unknown result type (might be due to invalid IL or missing references) //IL_0073: Unknown result type (might be due to invalid IL or missing references) //IL_0078: Unknown result type (might be due to invalid IL or missing references) //IL_007a: Unknown result type (might be due to invalid IL or missing references) //IL_0094: 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_00b9: 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_00ca: 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_010a: 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_0146: 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_01da: 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_01e7: 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_01f2: 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_0216: 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) plan = new PathPlan(); Vector3 center = character.Center; float num = HelperFunctions.FlatDistance(center, goal); float num2 = Mathf.Abs(goal.y - center.y); bool flag = false; float num3 = float.NegativeInfinity; for (int i = 0; i < SearchAngles.Length; i++) { Vector3 val = Quaternion.AngleAxis(SearchAngles[i], Vector3.up) * baseDir; for (int j = 0; j < SearchDistances.Length; j++) { float num4 = SearchDistances[j]; Vector3 point = center + val * num4; if (!TryFindGround(point, out var hit) || !IsStandableNormal(((RaycastHit)(ref hit)).normal)) { continue; } float num5 = ((RaycastHit)(ref hit)).point.y - center.y; float num6 = center.y - ((RaycastHit)(ref hit)).point.y; if (num5 > 2.2f || num6 > 8f) { continue; } float num7 = num - HelperFunctions.FlatDistance(((RaycastHit)(ref hit)).point, goal); float num8 = num2 - Mathf.Abs(goal.y - ((RaycastHit)(ref hit)).point.y); if (!(num7 < -0.25f) || !(num8 < 0.35f)) { bool flag2 = IsLineBlocked(center, ((RaycastHit)(ref hit)).point); float num9 = num7 * 1.55f + num8 * 0.85f - Mathf.Abs(SearchAngles[i]) * 0.012f - num4 * 0.03f; num9 = (flag2 ? (num9 - 0.3f) : (num9 + 0.55f)); if (!flag || num9 > num3) { flag = true; num3 = num9; plan = new PathPlan { Action = ((!flag2) ? PathActionType.Direct : PathActionType.Detour), Goal = ((RaycastHit)(ref hit)).point, Anchor = ((RaycastHit)(ref hit)).point, TargetAbove = (goal.y - center.y > 1.1f), Score = num9, ProjectedEndPoint = ((RaycastHit)(ref hit)).point, HasProjectedEndPoint = true }; } } } } return flag; } private static bool TryFindPilotDropPlan(Character character, Vector3 goal, Vector3 baseDir, out PathPlan plan) { //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_001e: 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_0026: 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) plan = new PathPlan(); for (int i = 0; i < SearchAngles.Length; i++) { Vector3 dir = Quaternion.AngleAxis(SearchAngles[i], Vector3.up) * baseDir; if (TryProbePilotRoute(character, dir, 2.6f, out var probe) && TryCreatePilotDropPlan(character, goal, dir, probe, out plan)) { return true; } } return false; } private static bool TryCreatePilotDropPlan(Character character, Vector3 goal, Vector3 dir, RouteProbe probe, out PathPlan plan) { //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_0044: 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_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_004b: 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_00a5: Unknown result type (might be due to invalid IL or missing references) //IL_00aa: Unknown result type (might be due to invalid IL or missing references) //IL_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_00f4: Unknown result type (might be due to invalid IL or missing references) //IL_00f5: Unknown result type (might be due to invalid IL or missing references) //IL_0102: 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) plan = new PathPlan(); if (!probe.SafeWalkDrop && !probe.SafeJumpDrop) { return false; } Vector3 val = ((probe.DropLandingPoint != Vector3.zero) ? probe.DropLandingPoint : probe.GapLandingPoint); if (val == Vector3.zero) { return false; } float num = (probe.ObstacleAhead ? Mathf.Clamp(probe.ObstacleDistance - 0.25f, 0.75f, 1.45f) : 1.25f); plan = new PathPlan { Action = PathActionType.DropDown, Goal = val, Anchor = character.Center + dir * num, TargetAbove = false, UsesJumpDropImmunity = (probe.SafeJumpDrop && !probe.SafeWalkDrop), RequiredStamina = 0.08f, ExpectedDropHeight = probe.DropHeight, ProjectedEndPoint = val, HasProjectedEndPoint = true, Score = 0f - HelperFunctions.FlatDistance(val, goal) }; return true; } private static void ExecutePilotPlan(Character character, CharacterInput input, PathPlan plan, Vector3 finalGoal, Plugin plugin, int viewId) { //IL_00a0: 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_03a6: 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_03c1: 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_02c2: 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_00bf: 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_01c6: 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_030e: 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_0329: 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_02ee: 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_0234: 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_01e4: 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_00e3: 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_02aa: 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_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_0150: 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) switch (plan.Action) { case PathActionType.WaitForStamina: HoldStillAtGoal(character, input, finalGoal); if ((character.data.isClimbing || character.data.isRopeClimbing || character.data.isVineClimbing) && !HasStaminaForClimb(character)) { TryStopClimb(character); } break; case PathActionType.Direct: case PathActionType.Detour: case PathActionType.SlopeWalk: { float num3 = HelperFunctions.FlatDistance(character.Center, plan.Goal); bool flag = HasStaminaForJumpOrClimb(character); if (!flag && IsObstacleAhead(character, plan.Goal)) { HoldStillAtGoal(character, input, finalGoal); break; } LookAt(character, plan.Goal); bool sprint = flag && num3 > plugin.HostPilotSprintDistance && HasStaminaForSprint(character); bool jump = flag && plugin.HostPilotAutoJump && ShouldAutoJump(character, plan.Goal); WalkTowards(character, input, plan.Goal, (num3 < 1.6f) ? 0.65f : 1f, sprint, jump, viewId); TryFlatTravelHop(character, input, plan.Goal, viewId); if (plugin.HostPilotAutoClimb && flag && HasStaminaForClimb(character) && IsObstacleAhead(character, plan.Goal)) { TryClimb(character, 1.15f); } break; } case PathActionType.Climb: case PathActionType.JumpGrab: case PathActionType.WallTraverse: case PathActionType.CornerClimb: case PathActionType.Mantle: case PathActionType.RopeClimb: { if (!HasStaminaForClimb(character)) { HoldStillAtGoal(character, input, finalGoal); TryStopClimb(character); break; } float num2 = Vector3.Distance(character.Center, plan.Anchor); if (num2 > 1.25f) { LookAt(character, plan.Anchor); WalkTowards(character, input, plan.Anchor, 1f, num2 > 2f && HasStaminaForSprint(character), jump: false, viewId); break; } LookAt(character, plan.Goal); input.movementInput = new Vector2(0f, 1f); input.sprintIsPressed = false; if (HasStaminaForClimb(character)) { TryClimb(character, 1.55f); if (plan.NeedsJumpStart && character.data.isGrounded && CanAutoJump(viewId)) { input.jumpWasPressed = true; input.jumpIsPressed = true; LastAutoJumpByView[viewId] = Time.time; } } else { input.movementInput = Vector2.zero; } break; } case PathActionType.DropDown: { float num = Vector3.Distance(character.Center, plan.Anchor); if (num > 1.1f) { LookAt(character, plan.Anchor); WalkTowards(character, input, plan.Anchor, 1f, HasStaminaForSprint(character), jump: false, viewId); break; } LookAt(character, plan.Goal); input.movementInput = new Vector2(0f, 1f); input.sprintIsPressed = plan.UsesJumpDropImmunity && HasStaminaForSprint(character); if (plan.UsesJumpDropImmunity && !IsLowStaminaForHeavyAction(character) && character.GetTotalStamina() > plan.RequiredStamina && character.data.isGrounded && CanAutoJump(viewId)) { input.jumpWasPressed = true; input.jumpIsPressed = true; LastAutoJumpByView[viewId] = Time.time; } break; } default: LookAt(character, finalGoal); WalkTowards(character, input, finalGoal, 0.65f, sprint: false, jump: false, viewId); TryFlatTravelHop(character, input, finalGoal, viewId); break; } } private static bool IsPilotSegmentFinished(Character character, PilotState state) { //IL_001f: Unknown result type (might be due to invalid IL or missing references) //IL_0025: Unknown result type (might be due to invalid IL or missing references) //IL_0031: 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_0063: 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_00e4: Unknown result type (might be due to invalid IL or missing references) //IL_00ea: Unknown result type (might be due to invalid IL or missing references) if (!state.HasActivePlan) { return true; } PathPlan activePlan = state.ActivePlan; float num = HelperFunctions.FlatDistance(character.Center, activePlan.Anchor); float num2 = HelperFunctions.FlatDistance(character.Center, activePlan.Goal); if (activePlan.Action == PathActionType.DropDown) { return num2 <= 1.35f || (num <= 1.05f && character.Center.y < state.SegmentStartPosition.y - 0.9f); } if (activePlan.Action == PathActionType.Climb || activePlan.Action == PathActionType.JumpGrab || activePlan.Action == PathActionType.WallTraverse || activePlan.Action == PathActionType.CornerClimb || activePlan.Action == PathActionType.Mantle || activePlan.Action == PathActionType.RopeClimb) { return activePlan.ClimbTopPoint != Vector3.zero && Vector3.Distance(character.Center, activePlan.ClimbTopPoint) <= 1.45f; } return num2 <= 1.35f; } private static bool IsPilotSegmentFailed(Character character, PilotState state, Vector3 finalGoal) { //IL_003c: Unknown result type (might be due to invalid IL or missing references) //IL_0042: Unknown result type (might be due to invalid IL or missing references) //IL_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) if (!state.HasActivePlan) { return true; } float num = Time.time - state.SegmentStartTime; if (num < 3.2f) { return false; } float num2 = Vector3.Distance(character.Center, state.SegmentStartPosition); float num3 = state.SegmentStartGoalDistance - Vector3.Distance(character.Center, finalGoal); if (state.ActivePlan.Action == PathActionType.Climb || state.ActivePlan.Action == PathActionType.JumpGrab || state.ActivePlan.Action == PathActionType.WallTraverse || state.ActivePlan.Action == PathActionType.CornerClimb || state.ActivePlan.Action == PathActionType.Mantle || state.ActivePlan.Action == PathActionType.RopeClimb) { if ((character.data.isClimbing || character.data.isRopeClimbing || character.data.isVineClimbing) && character.GetTotalStamina() >= 0.018f) { return false; } return num2 < 0.65f && num3 < 0.55f; } return num2 < 0.65f && num3 < 0.55f; } private static void WalkTowards(Character character, CharacterInput input, Vector3 target, float intensity, bool sprint, bool jump, int viewId) { //IL_0002: 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) LookAt(character, target); input.movementInput = new Vector2(0f, Mathf.Clamp01(intensity)); input.sprintIsPressed = sprint && HasStaminaForSprint(character); if (jump && character.data.isGrounded && HasStaminaForJumpOrClimb(character) && CanAutoJump(viewId)) { input.jumpWasPressed = true; input.jumpIsPressed = true; LastAutoJumpByView[viewId] = Time.time; } } private static bool ShouldWaitForStaminaBeforePushingUp(Character character, Vector3 goal) { //IL_0019: 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_0035: 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 (HasStaminaForJumpOrClimb(character)) { return false; } if (IsLowStaminaForHeavyAction(character) && !IsFlatTravelHopAllowed(character, goal)) { return true; } float num = goal.y - character.Center.y; if (num > 0.75f) { return true; } return IsObstacleAhead(character, goal); } private static Vector3 ResolvePilotGoal(Character character, Vector3 rawGoal) { //IL_0001: 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_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_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_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_002a: Unknown result type (might be due to invalid IL or missing references) if (TryProbePilotExactStandableGoal(rawGoal, out var standPoint)) { return standPoint; } if (TryFindPilotStandableAccessNearGoal(character, rawGoal, out var standPoint2)) { return standPoint2; } return rawGoal; } private static bool TryProbePilotExactStandableGoal(Vector3 rawGoal, out Vector3 standPoint) { //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_0018: 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_0047: 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_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) standPoint = Vector3.zero; if (!TryFindGround(rawGoal, out var hit) || !IsStandableNormal(((RaycastHit)(ref hit)).normal)) { return false; } if (HelperFunctions.FlatDistance(((RaycastHit)(ref hit)).point, rawGoal) > 1.05f || Mathf.Abs(((RaycastHit)(ref hit)).point.y - rawGoal.y) > 1.2f) { return false; } standPoint = ((RaycastHit)(ref hit)).point; return true; } private static bool TryFindPilotStandableAccessNearGoal(Character character, Vector3 rawGoal, out Vector3 standPoint) { //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_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_005d: Unknown result type (might be due to invalid IL or missing references) //IL_0066: Unknown result type (might be due to invalid IL or missing references) //IL_006b: 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_006e: 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_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_008b: 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_00b5: 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_00f4: 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_012d: 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_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) standPoint = Vector3.zero; float[] array = new float[6] { 0.55f, 1.1f, 1.8f, 2.7f, 3.8f, 5.2f }; float[] array2 = new float[8] { 0f, 45f, -45f, 90f, -90f, 135f, -135f, 180f }; bool flag = false; float num = float.NegativeInfinity; RaycastHit val3 = default(RaycastHit); for (int i = 0; i < array.Length; i++) { for (int j = 0; j < array2.Length; j++) { Vector3 val = Quaternion.AngleAxis(array2[j], Vector3.up) * Vector3.forward * array[i]; Vector3 val2 = rawGoal + val + Vector3.up * 7f; if (!Physics.Raycast(val2, Vector3.down, ref val3, 13.5f, TerrainMask, (QueryTriggerInteraction)1) || !IsStandableNormal(((RaycastHit)(ref val3)).normal)) { continue; } float num2 = HelperFunctions.FlatDistance(((RaycastHit)(ref val3)).point, rawGoal); if (!(num2 > 5.85f)) { float num3 = ((RaycastHit)(ref val3)).point.y - rawGoal.y; float num4 = ((num3 < -0.45f) ? (Mathf.Abs(num3) * 1.85f + 1.4f) : 0f); float num5 = Vector3.Distance(character.Center, ((RaycastHit)(ref val3)).point); float num6 = 0f; num6 -= num2 * 1.35f; num6 -= Mathf.Abs(num3) * 0.75f; num6 -= num4; num6 -= num5 * 0.06f; if (num3 >= -0.35f) { num6 += 1.6f; } if (!flag || num6 > num) { flag = true; num = num6; standPoint = ((RaycastHit)(ref val3)).point; } } } } return flag; } private static bool CanAutoJump(int viewId) { float value; return !LastAutoJumpByView.TryGetValue(viewId, out value) || Time.time - value >= 0.24f; } private static void LookAt(Character character, Vector3 point) { //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_000a: 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_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_0029: 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_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) //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_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) Vector3 val = point; if (Mathf.Abs(point.y - character.Center.y) < 0.5f) { val.y = character.Head.y; } else { val += Vector3.up * 0.25f; } Vector3 val2 = val - character.Head; if (((Vector3)(ref val2)).sqrMagnitude > 0.001f) { character.data.lookValues = Vector2.op_Implicit(HelperFunctions.DirectionToLook(val2)); } } private static void TryClimb(Character character, float distance) { try { if (character.refs != null && (Object)(object)character.refs.climbing != (Object)null && HasStaminaForClimb(character)) { character.refs.climbing.TryClimb(distance); } } catch { } } private static void TryStopClimb(Character character) { try { if (character.refs != null && (Object)(object)character.refs.climbing != (Object)null) { character.refs.climbing.StopClimbing(); } } catch { } } private static bool IsLowStaminaForHeavyAction(Character character) { return (Object)(object)character == (Object)null || (Object)(object)character.data == (Object)null || character.OutOfStamina() || character.GetTotalStamina() <= 0.08f; } private static bool HasStaminaForSprint(Character character) { return (Object)(object)character != (Object)null && (Object)(object)character.data != (Object)null && !character.OutOfStamina() && character.GetTotalStamina() >= 0.12f && character.CheckSprint(); } private static bool HasStaminaForJumpOrClimb(Character character) { return (Object)(object)character != (Object)null && (Object)(object)character.data != (Object)null && !character.OutOfStamina() && character.GetTotalStamina() >= 0.4f; } private static bool HasStaminaForClimb(Character character) { if ((Object)(object)character == (Object)null || (Object)(object)character.data == (Object)null || character.OutOfStamina()) { return false; } if (character.data.isClimbing) { return character.GetTotalStamina() >= 0.018f; } return character.GetTotalStamina() >= 0.4f; } private static bool IsFlatTravelHopAllowed(Character character, Vector3 target) { //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_0054: 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_007d: 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_00ac: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)character == (Object)null || (Object)(object)character.data == (Object)null || !character.data.isGrounded) { return false; } if (Vector3.Distance(character.Center, target) < 2f) { return false; } if (!TryFindGround(character.Center, out var hit) || !TryFindGround(target, out var hit2)) { return false; } if (Mathf.Abs(((RaycastHit)(ref hit2)).point.y - ((RaycastHit)(ref hit)).point.y) > 0.45f) { return false; } return !IsObstacleAhead(character, target); } private static void TryFlatTravelHop(Character character, CharacterInput input, Vector3 target, int viewId) { //IL_000a: 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) if (IsLowStaminaForHeavyAction(character) && IsFlatTravelHopAllowed(character, target) && CanAutoJump(viewId)) { input.sprintIsPressed = false; input.movementInput = new Vector2(0f, 1f); input.jumpWasPressed = true; input.jumpIsPressed = true; LastAutoJumpByView[viewId] = Time.time; } } private static bool ShouldAutoJump(Character character, Vector3 target) { //IL_0029: 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_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_0074: Unknown result type (might be due to invalid IL or missing references) //IL_0079: Unknown result type (might be due to invalid IL or missing references) //IL_007e: 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_0080: Unknown result type (might be due to invalid IL or missing references) //IL_00a4: Unknown result type (might be due to invalid IL or missing references) //IL_00af: Unknown result type (might be due to invalid IL or missing references) if (!character.data.isGrounded || !HasStaminaForJumpOrClimb(character)) { return false; } Vector3 val = target - character.Center; val.y = 0f; if (((Vector3)(ref val)).sqrMagnitude < 0.01f) { return false; } ((Vector3)(ref val)).Normalize(); Vector3 val2 = character.Head + Vector3.down * 0.45f; RaycastHit val3 = default(RaycastHit); if (!Physics.Raycast(val2, val, ref val3, 1.05f, TerrainMask, (QueryTriggerInteraction)1)) { return false; } float num = ((RaycastHit)(ref val3)).point.y - character.Center.y; return num > -0.35f && num < 1.15f; } private static bool IsObstacleAhead(Character character, Vector3 target) { //IL_0001: 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_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_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) Vector3 val = target - character.Center; val.y = 0f; if (((Vector3)(ref val)).sqrMagnitude < 0.01f) { return false; } ((Vector3)(ref val)).Normalize(); RaycastHit val2 = default(RaycastHit); return Physics.SphereCast(character.Center + Vector3.up * 1f, 0.22f, val, ref val2, 1.25f, TerrainMask, (QueryTriggerInteraction)1); } private static bool TryProbePilotRoute(Character character, Vector3 dir, float distance, out RouteProbe probe) { //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_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_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_0029: 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_010e: Unknown result type (might be due to invalid IL or missing references) //IL_0114: Unknown result type (might be due to invalid IL or missing references) //IL_0119: Unknown result type (might be due to invalid IL or missing references) //IL_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_0120: 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_0130: 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_013b: Unknown result type (might be due to invalid IL or missing references) //IL_0045: Unknown result type (might be due to invalid IL or missing references) //IL_0046: Unknown result type (might be due to invalid IL or missing references) //IL_0063: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_006d: 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_0149: 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_007c: 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_009c: 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_00b1: 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_0180: 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_0101: 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_0255: 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_01be: 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_01f4: Unknown result type (might be due to invalid IL or missing references) //IL_01fc: Unknown result type (might be due to invalid IL or missing references) //IL_0201: Unknown result type (might be due to invalid IL or missing references) //IL_0223: 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) probe = default(RouteProbe); Vector3 center = character.Center; RaycastHit val = default(RaycastHit); if (Physics.SphereCast(center + Vector3.up * 1f, 0.24f, dir, ref val, distance, TerrainMask, (QueryTriggerInteraction)1)) { bool flag = false; Vector3 point = center + dir * Mathf.Clamp(((RaycastHit)(ref val)).distance + 0.55f, 0.45f, 1.65f); if (TryFindGround(point, out var hit) && IsStandableNormal(((RaycastHit)(ref hit)).normal)) { float num = ((RaycastHit)(ref hit)).point.y - center.y; float num2 = ((RaycastHit)(ref val)).point.y - center.y; flag = num >= -0.9f && num <= 0.72f && num2 <= 0.85f; } if (!flag) { probe.ObstacleAhead = true; probe.ObstacleDistance = ((RaycastHit)(ref val)).distance; probe.ObstaclePoint = ((RaycastHit)(ref val)).point; } } Vector3 point2 = center + dir * 1.45f; Vector3 point3 = center + dir * 3.6f; RaycastHit hit2; bool flag2 = TryFindGround(point2, out hit2); RaycastHit hit3; bool flag3 = TryFindGround(point3, out hit3); if (!flag2 || center.y - ((RaycastHit)(ref hit2)).point.y > 8f) { probe.UnsafeDropAhead = true; probe.DropHeight = (flag2 ? (center.y - ((RaycastHit)(ref hit2)).point.y) : 16f); } if (flag3 && IsStandableNormal(((RaycastHit)(ref hit3)).normal)) { float num3 = center.y - ((RaycastHit)(ref hit3)).point.y; if (num3 <= 16f) { probe.GapJumpable = true; probe.SafeJumpDrop = true; probe.GapLandingPoint = ((RaycastHit)(ref hit3)).point; probe.DropLandingPoint = ((RaycastHit)(ref hit3)).point; probe.GapLandingDrop = num3; probe.DropHeight = num3; if (num3 <= 8f && (!flag2 || center.y - ((RaycastHit)(ref hit2)).point.y > 1.25f)) { probe.SafeWalkDrop = true; } } } TryProbePilotClimb(character, dir, distance + 0.8f, ref probe); return true; } private static void TryProbePilotClimb(Character character, Vector3 dir, float distance, ref RouteProbe probe) { //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_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_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_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_004d: 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_0089: 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_00b0: 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_00da: 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_00ff: 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_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_0110: Unknown result type (might be due to invalid IL or missing references) Vector3 center = character.Center; float[] array = new float[6] { 0.55f, 0.85f, 1.2f, 1.65f, 2.1f, 2.65f }; RaycastHit val2 = default(RaycastHit); foreach (float num in array) { if (num > distance + 0.35f) { continue; } Vector3 val = center + dir * num; if (Physics.Raycast(val + Vector3.up * 5.2f, Vector3.down, ref val2, 6.3f, TerrainMask, (QueryTriggerInteraction)1)) { float num2 = ((RaycastHit)(ref val2)).point.y - center.y; if (!(num2 < 0.35f) && !(num2 > 4.7f) && IsClimbTopNormal(((RaycastHit)(ref val2)).normal)) { probe.ClimbableAhead = true; probe.ClimbHeightDelta = num2; probe.ClimbBasePoint = center + dir * Mathf.Clamp(num - 0.2f, 0.45f, distance); probe.ClimbTopPoint = ((RaycastHit)(ref val2)).point; probe.ClimbSurfaceNormal = -dir; probe.NeedsJumpStart = num2 >= 1f; break; } } } } private static bool TryFindGround(Vector3 point, out RaycastHit hit) { //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_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_0016: Unknown result type (might be due to invalid IL or missing references) return Physics.Raycast(point + Vector3.up * 2.2f, Vector3.down, ref hit, 15f, TerrainMask, (QueryTriggerInteraction)1); } private static bool IsLineBlocked(Vector3 from, Vector3 to) { //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_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_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_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_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_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_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_006a: Unknown result type (might be due to invalid IL or missing references) //IL_0074: Unknown result type (might be due to invalid IL or missing references) //IL_0079: Unknown result type (might be due to invalid IL or missing references) //IL_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) RaycastHit val = HelperFunctions.LineCheck(from + Vector3.up * 0.65f, to + Vector3.up * 0.65f, (LayerType)1, 0f, (QueryTriggerInteraction)1); if (!((Object)(object)((RaycastHit)(ref val)).transform != (Object)null)) { return false; } val = HelperFunctions.LineCheck(from + Vector3.up * 1.25f, to + Vector3.up * 1.25f, (LayerType)1, 0f, (QueryTriggerInteraction)1); return (Object)(object)((RaycastHit)(ref val)).transform != (Object)null; } private static bool IsStandableNormal(Vector3 normal) { //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) return ((Vector3)(ref normal)).sqrMagnitude >= 0.01f && Vector3.Angle(normal, Vector3.up) <= 68f; } private static bool IsClimbTopNormal(Vector3 normal) { //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) return ((Vector3)(ref normal)).sqrMagnitude >= 0.01f && Vector3.Angle(normal, Vector3.up) <= 72f; } } internal struct RobotFeedState { public Character? feeder; public Character? target; public Optionable feederSlot; public NetworkRobotAgent? agent; } [HarmonyPatch(typeof(Item), "FinishCastSecondary")] internal static class ItemFinishCastSecondaryPatch { [HarmonyPrefix] private static void Prefix(Item __instance, ref RobotFeedState __state) { //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) __state = default(RobotFeedState); try { if ((Object)(object)__instance == (Object)null || !__instance.canUseOnFriend || (Object)(object)Interaction.instance == (Object)null || !Interaction.instance.hasValidTargetCharacter) { return; } CharacterInteractible bestCharacter = Interaction.instance.bestCharacter; if ((Object)(object)bestCharacter == (Object)null || (Object)(object)bestCharacter.character == (Object)null) { return; } NetworkRobotAgent agent = RobotInteractionUtil.GetAgent(bestCharacter.character); if (!((Object)(object)agent == (Object)null)) { Character holderCharacter = __instance.holderCharacter; if (!((Object)(object)holderCharacter == (Object)null)) { __state = new RobotFeedState { feeder = holderCharacter, target = bestCharacter.character, feederSlot = holderCharacter.refs.items.currentSelectedSlot, agent = agent }; } } } catch (Exception arg) { Plugin.Log.LogDebug((object)$"ItemFinishCastSecondaryPatch Prefix failed: {arg}"); } } [HarmonyPostfix] private static void Postfix(Item __instance, RobotFeedState __state) { //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) try { if ((Object)(object)__state.agent == (Object)null || (Object)(object)__state.feeder == (Object)null || (Object)(object)__state.target == (Object)null) { return; } __state.agent.NotifyFedByPlayer(__state.feeder, __instance); if (!__instance.consuming) { return; } Character feeder = __state.feeder; if (feeder.IsLocal && !__state.feederSlot.IsNone) { byte value = __state.feederSlot.Value; feeder.data.lastConsumedItem = Time.time; feeder.player.EmptySlot(Optionable.Some(value)); feeder.refs.items.EquipSlot(Optionable.Some(value)); if (feeder.player.itemsChangedAction != null) { feeder.player.itemsChangedAction(feeder.player.itemSlots); } } } catch (Exception arg) { Plugin.Log.LogDebug((object)$"ItemFinishCastSecondaryPatch Postfix failed: {arg}"); } } } [HarmonyPatch(typeof(MushroomZombie), "Update")] internal static class MushroomRobotUpdatePatch { [HarmonyPrefix] private static bool Prefix(MushroomZombie __instance) { if (!NetworkRobotAgent.TryGetForZombie(__instance, out NetworkRobotAgent agent) || (Object)(object)agent == (Object)null) { return true; } if (!agent.Controls(__instance)) { return true; } if (agent.ShouldUseVanillaBiteControl(__instance)) { return true; } try { agent.Tick(); } catch (Exception arg) { Plugin.Log.LogDebug((object)$"NetworkRobotAgent.Tick failed: {arg}"); } return false; } } [HarmonyPatch] internal static class PointPingerReceivePatch { private static MethodBase? TargetMethod() { return AccessTools.Method(typeof(PointPinger), "ReceivePoint_Rpc", new Type[2] { typeof(Vector3), typeof(Vector3) }, (Type[])null); } [HarmonyPostfix] private static void Postfix(PointPinger __instance, Vector3 point) { //IL_0014: Unknown result type (might be due to invalid IL or missing references) try { PingTargetTracker.SetPing(((Object)(object)__instance != (Object)null) ? __instance.character : null, point); } catch (Exception arg) { Plugin.Log.LogDebug((object)$"PointPingerReceivePatch failed: {arg}"); } } } internal static class PingTargetTracker { private static readonly Dictionary LastPingByActor = new Dictionary(); private static readonly Dictionary LastPingByCharacterViewId = new Dictionary(); private static readonly Dictionary CharacterByActor = new Dictionary(); private static readonly Dictionary CharacterByViewId = new Dictionary(); private static readonly List RemoveBuffer = new List(); private static int _sequence; private static float _nextCharacterCacheRefreshTime; public const float PingLifetime = 30f; private const float CharacterCacheRefreshInterval = 1f; private const float DuplicatePingWindow = 0.08f; private const float DuplicatePingDistanceSq = 0.0025000002f; private static int GetActorKey(Character? character) { if ((Object)(object)character == (Object)null || (Object)(object)((MonoBehaviourPun)character).photonView == (Object)null) { return 0; } return ((MonoBehaviourPun)character).photonView.OwnerActorNr; } private static int GetViewKey(Character? character) { if ((Object)(object)character == (Object)null || (Object)(object)((MonoBehaviourPun)character).photonView == (Object)null) { return 0; } return ((MonoBehaviourPun)character).photonView.ViewID; } public static void SetPing(Character? character, Vector3 point) { //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_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_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) int actorKey = GetActorKey(character); int viewKey = GetViewKey(character); if (viewKey <= 0) { viewKey = GetViewKey(character); } if (viewKey <= 0 && actorKey <= 0) { return; } bool flag = (Object)(object)RobotInteractionUtil.GetAgent(character) != (Object)null; if (actorKey > 0 && !flag && LastPingByActor.TryGetValue(actorKey, out var value) && Time.time - value.Time <= 0.08f) { Vector3 val = value.Point - point; if (((Vector3)(ref val)).sqrMagnitude <= 0.0025000002f) { value.Time = Time.time; value.OwnerCharacter = character; value.OwnerViewId = viewKey; LastPingByActor[actorKey] = value; if (viewKey > 0) { LastPingByCharacterViewId[viewKey] = value; } return; } } PingTargetData pingTargetData = default(PingTargetData); pingTargetData.Point = point; pingTargetData.Time = Time.time; pingTargetData.Sequence = ++_sequence; pingTargetData.OwnerActorNumber = actorKey; pingTargetData.OwnerViewId = viewKey; pingTargetData.OwnerCharacter = character; PingTargetData value2 = pingTargetData; if (viewKey > 0) { LastPingByCharacterViewId[viewKey] = value2; } if (actorKey > 0 && !flag) { LastPingByActor[actorKey] = value2; } } public static bool TryGetBestPingForRobot(Character? robotCharacter, int robotOwnerActorNumber, Vector3 robotPos, out Character? owner, out Vector3 point) { //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) owner = null; point = Vector3.zero; return TryGetLatestActorPing(out owner, out point); } public static bool TryGetBestPingDataForRobot(Character? robotCharacter, int robotOwnerActorNumber, Vector3 robotPos, out PingTargetData data) { data = default(PingTargetData); return TryGetLatestActorPingData(out data); } public static bool TryGetBestPingForCharacter(Character character, bool acceptOtherPlayers, out Character? owner, out Vector3 point) { //IL_0005: 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) owner = null; point = Vector3.zero; if ((Object)(object)character == (Object)null) { return false; } return acceptOtherPlayers ? TryGetLatestActorPing(out owner, out point) : TryGetPing(character, out owner, out point); } public static bool TryGetBestPingDataForCharacter(Character character, bool acceptOtherPlayers, out PingTargetData data) { data = default(PingTargetData); if ((Object)(object)character == (Object)null) { return false; } return acceptOtherPlayers ? TryGetLatestActorPingData(out data) : TryGetPingData(character, out data); } public static bool TryGetLatestPingForRobot(Vector3 robotPos, out Character? owner, out Vector3 point) { //IL_0003: Unknown result type (might be due to invalid IL or missing references) return TryGetBestPingForRobot(null, 0, robotPos, out owner, out point); } public static bool TryGetPing(Character character, out Vector3 point) { Character owner; return TryGetPing(character, out owner, out point); } public static bool TryGetPing(Character character, out Character? owner, out Vector3 point) { //IL_0005: 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) owner = null; point = Vector3.zero; if ((Object)(object)character == (Object)null) { return false; } int viewKey = GetViewKey(character); if (viewKey > 0 && TryGetPingByViewId(viewKey, out owner, out point)) { return true; } return TryGetPingByActor(GetActorKey(character), out owner, out point); } private static bool TryGetPingData(Character character, out PingTargetData data) { data = default(PingTargetData); if ((Object)(object)character == (Object)null) { return false; } int viewKey = GetViewKey(character); if (viewKey > 0 && TryGetPingDataByViewId(viewKey, out data)) { return true; } return TryGetPingDataByActor(GetActorKey(character), out data); } private static bool TryGetLatestActorPingData(out PingTargetData data) { data = default(PingTargetData); int num = int.MinValue; bool flag = false; RemoveBuffer.Clear(); foreach (KeyValuePair item in LastPingByActor) { PingTargetData data2 = item.Value; if (!TryResolveValidPingOwnerByActor(item.Key, ref data2, out Character owner)) { RemoveBuffer.Add(item.Key); } else if (!flag || data2.Sequence > num) { flag = true; num = data2.Sequence; data2.OwnerCharacter = owner; data = data2; } } RemoveActorBuffer(); return flag; } private static bool TryGetPingDataByActor(int actorNumber, out PingTargetData data) { data = default(PingTargetData); if (actorNumber <= 0 || !LastPingByActor.TryGetValue(actorNumber, out var data2)) { return false; } if (!TryResolveValidPingOwnerByActor(actorNumber, ref data2, out Character owner)) { LastPingByActor.Remove(actorNumber); return false; } data2.OwnerCharacter = owner; LastPingByActor[actorNumber] = data2; data = data2; return true; } private static bool TryGetPingDataByViewId(int viewId, out PingTargetData data) { data = default(PingTargetData); if (viewId <= 0 || !LastPingByCharacterViewId.TryGetValue(viewId, out var data2)) { return false; } if (!TryResolveValidPingOwnerByViewId(viewId, ref data2, out Character owner)) { LastPingByCharacterViewId.Remove(viewId); return false; } data2.OwnerCharacter = owner; LastPingByCharacterViewId[viewId] = data2; data = data2; return true; } private static bool TryGetLatestActorPing(out Character? owner, out Vector3 point) { //IL_0005: 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_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) owner = null; point = Vector3.zero; int num = int.MinValue; bool flag = false; RemoveBuffer.Clear(); foreach (KeyValuePair item in LastPingByActor) { PingTargetData data = item.Value; if (!TryResolveValidPingOwnerByActor(item.Key, ref data, out Character owner2)) { RemoveBuffer.Add(item.Key); } else if (!flag || data.Sequence > num) { flag = true; num = data.Sequence; owner = owner2; point = data.Point; } } RemoveActorBuffer(); return flag; } private static bool TryGetPingByActor(int actorNumber, out Character? owner, out Vector3 point) { //IL_0005: 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_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) owner = null; point = Vector3.zero; if (actorNumber <= 0 || !LastPingByActor.TryGetValue(actorNumber, out var data)) { return false; } if (!TryResolveValidPingOwnerByActor(actorNumber, ref data, out Character owner2)) { LastPingByActor.Remove(actorNumber); return false; } data.OwnerCharacter = owner2; LastPingByActor[actorNumber] = data; owner = owner2; point = data.Point; return true; } private static bool TryGetPingByViewId(int viewId, out Character? owner, out Vector3 point) { //IL_0005: 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_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) owner = null; point = Vector3.zero; if (viewId <= 0 || !LastPingByCharacterViewId.TryGetValue(viewId, out var data)) { return false; } if (!TryResolveValidPingOwnerByViewId(viewId, ref data, out Character owner2)) { LastPingByCharacterViewId.Remove(viewId); return false; } data.OwnerCharacter = owner2; LastPingByCharacterViewId[viewId] = data; owner = owner2; point = data.Point; return true; } private static bool TryResolveValidPingOwnerByActor(int actorNumber, ref PingTargetData data, out Character? owner) { owner = null; if (Time.time - data.Time > 30f) { return false; } Character val = data.OwnerCharacter; if (!IsValidPlayerPingOwner(val) || GetActorKey(val) != actorNumber) { val = FindCharacterByActor(actorNumber); } if (!IsValidPlayerPingOwner(val)) { return false; } data.OwnerCharacter = val; data.OwnerActorNumber = actorNumber; data.OwnerViewId = GetViewKey(val); owner = val; return true; } private static bool TryResolveValidPingOwnerByViewId(int viewId, ref PingTargetData data, out Character? owner) { owner = null; if (Time.time - data.Time > 30f) { return false; } Character val = data.OwnerCharacter; if (!IsValidAnyPingOwner(val) || GetViewKey(val) != viewId) { val = FindCharacterByViewId(viewId); } if (!IsValidAnyPingOwner(val)) { return false; } data.OwnerCharacter = val; data.OwnerActorNumber = GetActorKey(val); data.OwnerViewId = viewId; owner = val; return true; } private static Character? FindCharacterByActor(int actorNumber) { if (actorNumber <= 0) { return null; } RefreshCharacterCacheIfNeeded(); Character value; return CharacterByActor.TryGetValue(actorNumber, out value) ? value : null; } private static Character? FindCharacterByViewId(int viewId) { if (viewId <= 0) { return null; } RefreshCharacterCacheIfNeeded(); Character value; return CharacterByViewId.TryGetValue(viewId, out value) ? value : null; } private static void RefreshCharacterCacheIfNeeded() { if (Time.time < _nextCharacterCacheRefreshTime) { return; } _nextCharacterCacheRefreshTime = Time.time + 1f; CharacterByActor.Clear(); CharacterByViewId.Clear(); foreach (Character allCharacter in Character.AllCharacters) { if (!((Object)(object)allCharacter == (Object)null) && !((Object)(object)((MonoBehaviourPun)allCharacter).photonView == (Object)null) && !((Object)(object)allCharacter.data == (Object)null)) { int viewID = ((MonoBehaviourPun)allCharacter).photonView.ViewID; if (viewID > 0) { CharacterByViewId[viewID] = allCharacter; } int ownerActorNr = ((MonoBehaviourPun)allCharacter).photonView.OwnerActorNr; if (ownerActorNr > 0 && (Object)(object)RobotInteractionUtil.GetAgent(allCharacter) == (Object)null && IsValidPlayerPingOwner(allCharacter)) { CharacterByActor[ownerActorNr] = allCharacter; } } } for (int num = NetworkRobotAgent.All.Count - 1; num >= 0; num--) { NetworkRobotAgent networkRobotAgent = NetworkRobotAgent.All[num]; Character val = (((Object)(object)networkRobotAgent != (Object)null) ? networkRobotAgent.Character : null); if ((Object)(object)networkRobotAgent == (Object)null || (Object)(object)val == (Object)null || (Object)(object)((MonoBehaviourPun)val).photonView == (Object)null) { if ((Object)(object)networkRobotAgent == (Object)null) { NetworkRobotAgent.All.RemoveAt(num); } } else { int viewID2 = ((MonoBehaviourPun)val).photonView.ViewID; if (viewID2 > 0) { CharacterByViewId[viewID2] = val; } } } } private static bool IsValidPlayerPingOwner(Character? character) { if ((Object)(object)character == (Object)null || (Object)(object)character.data == (Object)null) { return false; } if ((Object)(object)RobotInteractionUtil.GetAgent(character) != (Object)null) { return false; } if (character.data.dead || character.data.fullyPassedOut) { return false; } return GetActorKey(character) > 0; } private static bool IsValidAnyPingOwner(Character? character) { if ((Object)(object)character == (Object)null || (Object)(object)character.data == (Object)null) { return false; } if (character.data.dead || character.data.fullyPassedOut) { return false; } return GetActorKey(character) > 0 || GetViewKey(character) > 0; } private static void RemoveActorBuffer() { for (int i = 0; i < RemoveBuffer.Count; i++) { LastPingByActor.Remove(RemoveBuffer[i]); } RemoveBuffer.Clear(); } public static void ClearPing(Character character) { if (!((Object)(object)character == (Object)null)) { int actorKey = GetActorKey(character); if (actorKey > 0 && (Object)(object)RobotInteractionUtil.GetAgent(character) == (Object)null) { LastPingByActor.Remove(actorKey); } int viewKey = GetViewKey(character); if (viewKey > 0) { LastPingByCharacterViewId.Remove(viewKey); } } } } [BepInPlugin("com.elizabeth.peak.pingdrivenrobots", "PingDrivenRobots", "1.3.9")] public sealed class Plugin : BaseUnityPlugin { [CompilerGenerated] private sealed class d__94 : IEnumerator, IEnumerator, IDisposable { private int <>1__state; private object <>2__current; public Plugin <>4__this; private Character 5__1; private Vector3 5__2; private Quaternion 5__3; private Bodypart 5__4; private GameObject 5__5; private MushroomZombie 5__6; private NetworkRobotAgent 5__7; private Vector3 5__8; private object[] 5__9; private Exception 5__10; object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public d__94(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { 5__1 = null; 5__4 = null; 5__5 = null; 5__6 = null; 5__7 = null; 5__9 = null; 5__10 = null; <>1__state = -2; } private bool MoveNext() { //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_0079: Unknown result type (might be due to invalid IL or missing references) //IL_007e: Unknown result type (might be due to invalid IL or missing references) //IL_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_00c8: Unknown result type (might be due to invalid IL or missing references) //IL_00cd: Unknown result type (might be due to invalid IL or missing references) //IL_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) //IL_0104: 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_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_0174: 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_018f: 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_0199: 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_01ff: 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) switch (<>1__state) { default: return false; case 0: <>1__state = -1; <>4__this._isSpawning = true; 5__1 = Character.localCharacter; if ((Object)(object)5__1 == (Object)null) { <>4__this._isSpawning = false; return false; } 5__2 = 5__1.Center; 5__3 = Quaternion.identity; 5__4 = 5__1.GetBodypart((BodypartType)2); if ((Object)(object)5__4 != (Object)null) { 5__2 = ((Component)5__4).transform.position; 5__3 = ((Component)5__4).transform.rotation; } if (<>4__this._spawnNearPlayer.Value) { 5__8 = 5__1.data.lookDirection; if (5__8 == Vector3.zero) { 5__8 = ((Component)5__1).transform.forward; } 5__8.y = 0f; if (((Vector3)(ref 5__8)).sqrMagnitude < 0.001f) { 5__8 = Vector3.forward; } ((Vector3)(ref 5__8)).Normalize(); 5__2 += 5__8 * <>4__this._spawnForwardOffset.Value; } try { 5__9 = new object[2] { (PhotonNetwork.LocalPlayer != null) ? PhotonNetwork.LocalPlayer.ActorNumber : 0, (PhotonNetwork.LocalPlayer != null) ? (PhotonNetwork.LocalPlayer.UserId ?? string.Empty) : string.Empty }; 5__5 = PhotonNetwork.Instantiate(<>4__this._robotPrefabName.Value, 5__2, 5__3, (byte)0, 5__9); 5__9 = null; } catch (Exception ex) { 5__10 = ex; Log.LogError((object)$"Failed to instantiate robot prefab '{<>4__this._robotPrefabName.Value}': {5__10}"); <>4__this._isSpawning = false; return false; } <>2__current = null; <>1__state = 1; return true; case 1: <>1__state = -1; <>2__current = null; <>1__state = 2; return true; case 2: <>1__state = -1; if ((Object)(object)5__5 == (Object)null) { Log.LogError((object)"Robot instantiate returned null."); <>4__this._isSpawning = false; return false; } 5__6 = 5__5.GetComponent(); if ((Object)(object)5__6 == (Object)null) { Log.LogError((object)"Spawned object does not contain MushroomZombie component. Keep RobotPrefabName on a networked character prefab this mod knows how to drive."); <>4__this._isSpawning = false; return false; } 5__6.isNPCZombie = false; 5__6.spawner = null; 5__6.lifetime = 999999f; if ((Object)(object)ZombieManager.Instance != (Object)null) { ZombieManager.Instance.DeRegisterZombie(5__6); } if ((Object)(object)5__6.character == (Object)null || (Object)(object)5__6.character.data == (Object)null) { Log.LogError((object)"Spawned robot has no Character or CharacterData."); SafeDestroySpawnedObject(5__5); <>4__this._isSpawning = false; return false; } 5__6.character.isZombie = true; 5__6.character.isBot = true; 5__6.character.data.passedOut = false; 5__6.character.data.fullyPassedOut = false; 5__6.character.data.dead = false; 5__6.character.data.fallSeconds = 0f; 5__6.character.data.currentRagdollControll = 1f; 5__6.currentState = (State)2; if (!5__6.visible) { ((MonoBehaviour)5__6).StartCoroutine(5__6.RevealZombie()); } 5__7 = ((Component)5__6).gameObject.GetComponent(); if ((Object)(object)5__7 == (Object)null) { 5__7 = ((Component)5__6).gameObject.AddComponent(); } 5__7.Initialize(5__6); Log.LogInfo((object)"Spawned one controlled network robot. It follows the newest valid ping target from any real player."); <>4__this._isSpawning = false; return false; } } bool IEnumerator.MoveNext() { //ILSpy generated this explicit interface implementation from .override directive in MoveNext return this.MoveNext(); } [DebuggerHidden] void IEnumerator.Reset() { throw new NotSupportedException(); } } public const string ModGuid = "com.elizabeth.peak.pingdrivenrobots"; public const string ModName = "PingDrivenRobots"; public const string ModVersion = "1.3.9"; internal static ManualLogSource Log; internal static Plugin Instance; private Harmony _harmony = null; private ConfigEntry _spawnKey = null; private ConfigEntry _deleteKey = null; private ConfigEntry _robotPrefabName = null; private ConfigEntry _spawnForwardOffset = null; private ConfigEntry _spawnNearPlayer = null; private ConfigEntry _biteKey = null; private ConfigEntry _carryPlayerKey = null; private ConfigEntry _backpackToggleKey = null; private ConfigEntry _backpackSearchRadius = null; private ConfigEntry _backpackToggleCooldown = null; private ConfigEntry _toggleHostPilotKey = null; private ConfigEntry _hostPilotEnabledByDefault = null; private ConfigEntry _hostPilotManualOverride = null; private ConfigEntry _hostPilotArriveDistance = null; private ConfigEntry _hostPilotSprintDistance = null; private ConfigEntry _hostPilotAutoJump = null; private ConfigEntry _hostPilotAutoClimb = null; private ConfigEntry _hostPilotAcceptOtherPlayersPingTargets = null; private ConfigEntry _advancedRoutingEnabled = null; private ConfigEntry _spatialRoutingEnabled = null; private ConfigEntry _reverseRouteSearchEnabled = null; private ConfigEntry _explicitStaminaWaitEnabled = null; private ConfigEntry _failureMemoryEnabled = null; private ConfigEntry _debugRoutingLogs = null; private ConfigEntry _debugDrawRouting = null; private ConfigEntry _routeAssistAwarenessEnabled = null; private ConfigEntry _heightAwareFootholdScanEnabled = null; private ConfigEntry _staminaSafetyRatio = null; private ConfigEntry _spatialPlannerMaxDepth = null; private ConfigEntry _spatialPlannerBeamWidth = null; private ConfigEntry _spatialPlannerMaxCandidatesPerNode = null; private ConfigEntry _sharedPlannerPlansPerFrame = null; private const float SpawnInputDebounceSeconds = 0.2f; private bool _isSpawning; private bool _hostPilotEnabled; private float _nextSpawnAllowedTime; private float _nextBackpackToggleAllowedTime; internal bool ShouldHostPilotRun => _hostPilotEnabled; internal bool HostPilotManualOverride => _hostPilotManualOverride != null && _hostPilotManualOverride.Value; internal float HostPilotArriveDistance => (_hostPilotArriveDistance != null) ? Mathf.Max(0.25f, _hostPilotArriveDistance.Value) : 1.25f; internal float HostPilotSprintDistance => (_hostPilotSprintDistance != null) ? Mathf.Max(0.5f, _hostPilotSprintDistance.Value) : 3f; internal bool HostPilotAutoJump => _hostPilotAutoJump != null && _hostPilotAutoJump.Value; internal bool HostPilotAutoClimb => _hostPilotAutoClimb != null && _hostPilotAutoClimb.Value; internal bool HostPilotAcceptOtherPlayersPingTargets => _hostPilotAcceptOtherPlayersPingTargets != null && _hostPilotAcceptOtherPlayersPingTargets.Value; internal bool AdvancedRoutingEnabled => _advancedRoutingEnabled == null || _advancedRoutingEnabled.Value; internal bool SpatialRoutingEnabled => _spatialRoutingEnabled == null || _spatialRoutingEnabled.Value; internal bool ReverseRouteSearchEnabled => _reverseRouteSearchEnabled == null || _reverseRouteSearchEnabled.Value; internal bool ExplicitStaminaWaitEnabled => _explicitStaminaWaitEnabled == null || _explicitStaminaWaitEnabled.Value; internal bool FailureMemoryEnabled => _failureMemoryEnabled == null || _failureMemoryEnabled.Value; internal bool DebugRoutingLogs => _debugRoutingLogs != null && _debugRoutingLogs.Value; internal bool DebugDrawRouting => _debugDrawRouting != null && _debugDrawRouting.Value; internal bool RouteAssistAwarenessEnabled => _routeAssistAwarenessEnabled == null || _routeAssistAwarenessEnabled.Value; internal bool HeightAwareFootholdScanEnabled => _heightAwareFootholdScanEnabled == null || _heightAwareFootholdScanEnabled.Value; internal float StaminaSafetyRatio => (_staminaSafetyRatio != null) ? Mathf.Clamp(_staminaSafetyRatio.Value, 0.05f, 0.35f) : 0.22f; internal int SpatialPlannerMaxDepth => (_spatialPlannerMaxDepth != null) ? Mathf.Clamp(_spatialPlannerMaxDepth.Value, 2, 8) : 4; internal int SpatialPlannerBeamWidth => (_spatialPlannerBeamWidth != null) ? Mathf.Clamp(_spatialPlannerBeamWidth.Value, 4, 24) : 8; internal int SpatialPlannerMaxCandidatesPerNode => (_spatialPlannerMaxCandidatesPerNode != null) ? Mathf.Clamp(_spatialPlannerMaxCandidatesPerNode.Value, 8, 40) : 18; internal int SharedPlannerPlansPerFrame => (_sharedPlannerPlansPerFrame == null) ? 1 : Mathf.Clamp(_sharedPlannerPlansPerFrame.Value, 1, 6); private void Awake() { //IL_04b1: Unknown result type (might be due to invalid IL or missing references) //IL_04bb: Expected O, but got Unknown if ((Object)(object)Instance != (Object)null && (Object)(object)Instance != (Object)(object)this) { ((BaseUnityPlugin)this).Logger.LogWarning((object)"PingDrivenRobots: duplicate plugin instance detected; the duplicate will be disabled to prevent duplicate input processing."); ((Behaviour)this).enabled = false; Object.Destroy((Object)(object)this); return; } Instance = this; Log = ((BaseUnityPlugin)this).Logger; _spawnKey = ((BaseUnityPlugin)this).Config.Bind("Robot", "SpawnRobotKey", (KeyCode)106, "Spawn one controlled network robot near the host player."); _deleteKey = ((BaseUnityPlugin)this).Config.Bind("Robot", "DeleteRobotKey", (KeyCode)107, "Delete the nearest controlled network robot owned by you."); _robotPrefabName = ((BaseUnityPlugin)this).Config.Bind("Robot", "RobotPrefabName", "MushroomZombie", "Photon prefab name used as the controlled robot body. Default stays MushroomZombie because this is the game's networked creature prefab."); _spawnForwardOffset = ((BaseUnityPlugin)this).Config.Bind("Robot", "SpawnForwardOffset", 2.5f, "How far in front of the host player to spawn the robot."); _spawnNearPlayer = ((BaseUnityPlugin)this).Config.Bind("Robot", "SpawnNearPlayer", true, "Spawn the robot near the host player."); _biteKey = ((BaseUnityPlugin)this).Config.Bind("RobotCommands", "BiteNearestRobotKey", (KeyCode)118, "Make the nearest owned robot perform one manual bite lunge. Default changed to V because B toggles robot backpack pickup/drop."); _carryPlayerKey = ((BaseUnityPlugin)this).Config.Bind("RobotCommands", "CarryNearestPlayerKey", (KeyCode)110, "Toggle carry-assist on the nearest owned robot. It will seek and carry the nearest living player, including passed-out players."); _backpackToggleKey = ((BaseUnityPlugin)this).Config.Bind("BackpackControls", "ToggleNearestBackpackKey", (KeyCode)98, "Make the nearest owned robot pick up the nearest backpack within BackpackSearchRadius, or drop the robot's current backpack."); _backpackSearchRadius = ((BaseUnityPlugin)this).Config.Bind("BackpackControls", "BackpackSearchRadius", 15f, "Maximum distance, in meters, from the selected robot to search for a backpack when pressing ToggleNearestBackpackKey."); _backpackToggleCooldown = ((BaseUnityPlugin)this).Config.Bind("BackpackControls", "BackpackToggleCooldown", 1f, "Cooldown, in seconds, between robot backpack pickup/drop toggles."); _toggleHostPilotKey = ((BaseUnityPlugin)this).Config.Bind("HostPilot", "ToggleHostPilotKey", (KeyCode)104, "Toggle AI/code control for the host's real player body."); _hostPilotEnabledByDefault = ((BaseUnityPlugin)this).Config.Bind("HostPilot", "EnabledByDefault", false, "When true, the host player starts under ping-driven pilot control after loading in."); _hostPilotManualOverride = ((BaseUnityPlugin)this).Config.Bind("HostPilot", "ManualOverride", true, "When true, normal player movement/look/action input temporarily wins over the host pilot."); _hostPilotArriveDistance = ((BaseUnityPlugin)this).Config.Bind("HostPilot", "ArriveDistance", 1.25f, "Flat distance at which the host pilot stops at the ping point."); _hostPilotSprintDistance = ((BaseUnityPlugin)this).Config.Bind("HostPilot", "SprintDistance", 3f, "Flat distance above which the host pilot requests sprint."); _hostPilotAutoJump = ((BaseUnityPlugin)this).Config.Bind("HostPilot", "AutoJump", true, "Let the host pilot tap jump for small obstacles and upward goals."); _hostPilotAutoClimb = ((BaseUnityPlugin)this).Config.Bind("HostPilot", "AutoClimb", true, "Let the host pilot call the game's climb helper while following pings."); _hostPilotAcceptOtherPlayersPingTargets = ((BaseUnityPlugin)this).Config.Bind("HostPilot", "AcceptOtherPlayersPingTargets", false, "When true, the host pilot follows the newest valid ping from any player. When false, it follows the host player's own ping."); _advancedRoutingEnabled = ((BaseUnityPlugin)this).Config.Bind("AdvancedRouting", "EnableAdvancedRouting", true, "Enable the staged 3D action planner for ping-driven robots."); _spatialRoutingEnabled = ((BaseUnityPlugin)this).Config.Bind("AdvancedRouting", "EnableSpatialRouting", true, "Enable true 3D local beam-search routing before falling back to flat chase."); _reverseRouteSearchEnabled = ((BaseUnityPlugin)this).Config.Bind("AdvancedRouting", "EnableReverseRouteSearch", true, "For high pings, search from the target ledge back down to a reachable wall base."); _explicitStaminaWaitEnabled = ((BaseUnityPlugin)this).Config.Bind("AdvancedRouting", "EnableExplicitStaminaWait", true, "Insert explicit wait segments before high-risk climbs/jumps when stamina is below the route budget."); _failureMemoryEnabled = ((BaseUnityPlugin)this).Config.Bind("AdvancedRouting", "EnableFailureMemory", true, "Remember recently failed route segments so the planner stops repeating the same bad wall, corner or jump."); _debugRoutingLogs = ((BaseUnityPlugin)this).Config.Bind("AdvancedRouting", "DebugRoutingLogs", false, "Log advanced routing decisions. Keep off for normal play."); _debugDrawRouting = ((BaseUnityPlugin)this).Config.Bind("AdvancedRouting", "DebugDrawRouting", false, "Draw planned route segments, anchors and action colors in the Unity scene view/game debug line overlay."); _routeAssistAwarenessEnabled = ((BaseUnityPlugin)this).Config.Bind("AdvancedRouting", "EnableRouteAssistAwareness", true, "Let the 3D planner treat nearby ropes, vines, pitons, anchors or similarly named route helpers as climb-route hints. This is heuristic and safe to disable if a map object is misdetected."); _heightAwareFootholdScanEnabled = ((BaseUnityPlugin)this).Config.Bind("AdvancedRouting", "EnableHeightAwareFootholdScan", true, "Use a small cached foothold scan only for meaningful height changes after normal ground travel fails."); _staminaSafetyRatio = ((BaseUnityPlugin)this).Config.Bind("AdvancedRouting", "StaminaSafetyRatio", 0.22f, "Extra stamina reserve added to risky climb, jump and drop route budgets."); _spatialPlannerMaxDepth = ((BaseUnityPlugin)this).Config.Bind("AdvancedRouting", "SpatialPlannerMaxDepth", 4, "Maximum depth for the local 3D action planner. Higher values find more complex routes but cost more physics probes."); _spatialPlannerBeamWidth = ((BaseUnityPlugin)this).Config.Bind("AdvancedRouting", "SpatialPlannerBeamWidth", 8, "How many partial 3D routes survive each search depth. Higher values improve route quality but cost more CPU."); _spatialPlannerMaxCandidatesPerNode = ((BaseUnityPlugin)this).Config.Bind("AdvancedRouting", "SpatialPlannerMaxCandidatesPerNode", 18, "Maximum action candidates generated from each 3D planner node."); _sharedPlannerPlansPerFrame = ((BaseUnityPlugin)this).Config.Bind("AdvancedRouting", "SharedPlannerPlansPerFrame", 1, "Maximum number of owned robots allowed to start an expensive route plan in the same frame."); _hostPilotEnabled = _hostPilotEnabledByDefault.Value; _harmony = new Harmony("com.elizabeth.peak.pingdrivenrobots"); _harmony.PatchAll(); Log.LogInfo((object)string.Format("{0} loaded. HostPilot={1}.", "PingDrivenRobots", _hostPilotEnabled)); } private void OnDestroy() { if ((Object)(object)Instance == (Object)(object)this) { Instance = null; } try { Harmony harmony = _harmony; if (harmony != null) { harmony.UnpatchSelf(); } } catch (Exception arg) { if (Log != null) { Log.LogDebug((object)$"UnpatchSelf failed: {arg}"); } } } private void Update() { //IL_0008: 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_0071: 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_00b3: 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) try { if (Input.GetKeyDown(_toggleHostPilotKey.Value)) { _hostPilotEnabled = !_hostPilotEnabled; Log.LogInfo((object)(_hostPilotEnabled ? "Host player pilot enabled. The host remains a real player; only input is overridden when no manual input is active." : "Host player pilot disabled. Manual host control restored.")); } else if (Input.GetKeyDown(_deleteKey.Value)) { DeleteNearestRobot(); } else if (Input.GetKeyDown(_backpackToggleKey.Value)) { ToggleNearestRobotBackpack(); } else if (Input.GetKeyDown(_biteKey.Value)) { CommandNearestRobotBite(); } else if (Input.GetKeyDown(_carryPlayerKey.Value)) { ToggleNearestRobotCarryAssist(); } else if (Input.GetKeyDown(_spawnKey.Value) && !_isSpawning) { if (!PhotonNetwork.InRoom) { Log.LogWarning((object)"Not in a room."); } else if ((Object)(object)Character.localCharacter == (Object)null) { Log.LogWarning((object)"Local character not found."); } else if (!(Time.unscaledTime < _nextSpawnAllowedTime)) { _nextSpawnAllowedTime = Time.unscaledTime + 0.2f; ((MonoBehaviour)this).StartCoroutine(SpawnRobotRoutine()); } } } catch (Exception arg) { Log.LogDebug((object)$"Plugin.Update failed: {arg}"); } } private void ToggleNearestRobotBackpack() { try { float unscaledTime = Time.unscaledTime; if (unscaledTime < _nextBackpackToggleAllowedTime) { return; } NetworkRobotAgent networkRobotAgent = FindNearestRobotToLocal(); if (!((Object)(object)networkRobotAgent == (Object)null)) { float searchRadius = ((_backpackSearchRadius != null) ? Mathf.Max(0.1f, _backpackSearchRadius.Value) : 15f); if (networkRobotAgent.ToggleBackpackCommand(searchRadius, out string message)) { float num = ((_backpackToggleCooldown != null) ? Mathf.Max(0f, _backpackToggleCooldown.Value) : 1f); _nextBackpackToggleAllowedTime = unscaledTime + num; Log.LogInfo((object)message); } else { Log.LogWarning((object)message); } } } catch (Exception arg) { Log.LogDebug((object)$"ToggleNearestRobotBackpack failed: {arg}"); } } private static Vector3 GetBackpackDropPosition(Character character) { //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_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_00ad: 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_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_00c8: Unknown result type (might be due to invalid IL or missing references) //IL_00d2: Unknown result type (might be due to invalid IL or missing references) //IL_00d7: Unknown result type (might be due to invalid IL or missing references) //IL_00dc: Unknown result type (might be due to invalid IL or missing references) //IL_00a5: Unknown result type (might be due to invalid IL or missing references) //IL_00aa: Unknown result type (might be due to invalid IL or missing references) //IL_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_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_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_0078: 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_0041: 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) try { Bodypart bodypart = character.GetBodypart((BodypartType)0); if ((Object)(object)bodypart != (Object)null) { Vector3 val = ((Component)bodypart).transform.forward; if (Vector3.Dot(val, Vector3.up) < 0f) { val = -val; } return ((Component)bodypart).transform.position + ((Vector3)(ref val)).normalized * 0.6f + Vector3.up * 0.15f; } } catch { } Vector3 forward = ((Component)character).transform.forward; if (((Vector3)(ref forward)).sqrMagnitude < 0.001f) { forward = Vector3.forward; } return character.Center + ((Vector3)(ref forward)).normalized * 0.6f + Vector3.up * 0.15f; } private NetworkRobotAgent? FindNearestRobotToLocal() { //IL_004b: Unknown result type (might be due to invalid IL or missing references) if (!PhotonNetwork.InRoom) { Log.LogWarning((object)"Not in a room."); return null; } Character localCharacter = Character.localCharacter; if ((Object)(object)localCharacter == (Object)null) { Log.LogWarning((object)"Local character not found."); return null; } NetworkRobotAgent networkRobotAgent = NetworkRobotAgent.FindNearestOwnedByLocal(localCharacter.Center); if ((Object)(object)networkRobotAgent == (Object)null || (Object)(object)networkRobotAgent.Character == (Object)null) { Log.LogInfo((object)"No controlled robot found."); return null; } return networkRobotAgent; } private void CommandNearestRobotBite() { try { NetworkRobotAgent networkRobotAgent = FindNearestRobotToLocal(); if (!((Object)(object)networkRobotAgent == (Object)null)) { Character val = null; try { val = (((Object)(object)Interaction.instance != (Object)null && (Object)(object)Interaction.instance.bestCharacter != (Object)null) ? Interaction.instance.bestCharacter.character : null); } catch { val = null; } if (networkRobotAgent.RequestManualBite(val, out string message)) { Log.LogInfo((object)message); } else { Log.LogWarning((object)message); } } } catch (Exception arg) { Log.LogDebug((object)$"CommandNearestRobotBite failed: {arg}"); } } private void ToggleNearestRobotCarryAssist() { try { NetworkRobotAgent networkRobotAgent = FindNearestRobotToLocal(); if (!((Object)(object)networkRobotAgent == (Object)null)) { if (networkRobotAgent.ToggleCarryAssist(out string message)) { Log.LogInfo((object)message); } else { Log.LogWarning((object)message); } } } catch (Exception arg) { Log.LogDebug((object)$"ToggleNearestRobotCarryAssist failed: {arg}"); } } private void DeleteNearestRobot() { //IL_004e: Unknown result type (might be due to invalid IL or missing references) try { if (!PhotonNetwork.InRoom) { Log.LogWarning((object)"Not in a room."); return; } Character localCharacter = Character.localCharacter; if ((Object)(object)localCharacter == (Object)null) { Log.LogWarning((object)"Local character not found."); return; } NetworkRobotAgent networkRobotAgent = NetworkRobotAgent.FindNearestOwnedByLocal(localCharacter.Center); if ((Object)(object)networkRobotAgent == (Object)null || (Object)(object)networkRobotAgent.Character == (Object)null) { Log.LogInfo((object)"No controlled robot found to delete."); return; } int num = (((Object)(object)networkRobotAgent.View != (Object)null) ? networkRobotAgent.View.ViewID : (-1)); networkRobotAgent.DeleteRobotNetworked(); Log.LogInfo((object)$"Deleted controlled robot [{num}]."); } catch (Exception arg) { Log.LogDebug((object)$"DeleteNearestRobot failed: {arg}"); } } [IteratorStateMachine(typeof(d__94))] private IEnumerator SpawnRobotRoutine() { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new d__94(0) { <>4__this = this }; } private static void SafeDestroySpawnedObject(GameObject obj) { try { if (!((Object)(object)obj == (Object)null)) { PhotonView component = obj.GetComponent(); if ((Object)(object)component != (Object)null && PhotonNetwork.InRoom) { PhotonNetwork.Destroy(obj); } else { Object.Destroy((Object)(object)obj); } } } catch (Exception arg) { Log.LogDebug((object)$"SafeDestroySpawnedObject failed: {arg}"); try { Object.Destroy((Object)(object)obj); } catch { } } } } internal static class MushroomRobotProxyExtensions { private static readonly MethodInfo? UpdateMouthMethod = AccessTools.Method(typeof(MushroomZombie), "UpdateMouth", (Type[])null, (Type[])null); private static readonly FieldInfo? BiteColliderObjectField = AccessTools.Field(typeof(MushroomZombie), "biteColliderObject"); public static void UpdateMouthProxy(this MushroomZombie zombie) { try { UpdateMouthMethod?.Invoke(zombie, null); } catch (Exception arg) { Plugin.Log.LogDebug((object)$"UpdateMouth invoke failed: {arg}"); } } public static void SetBiteColliderProxy(this MushroomZombie zombie, bool enabled) { try { object? obj = BiteColliderObjectField?.GetValue(zombie); GameObject val = (GameObject)((obj is GameObject) ? obj : null); if ((Object)(object)val != (Object)null) { val.SetActive(enabled); } } catch (Exception arg) { Plugin.Log.LogDebug((object)$"SetBiteColliderProxy failed: {arg}"); } } } internal static class PatchReflectionCache { public static readonly FieldInfo? CharacterGrabbingCharacterField = AccessTools.Field(typeof(CharacterGrabbing), "character"); public static readonly FieldInfo? CharacterCarryingCharacterField = AccessTools.Field(typeof(CharacterCarrying), "character"); public static readonly MethodInfo? CharacterCarryingToggleCarryPhysicsMethod = AccessTools.Method(typeof(CharacterCarrying), "ToggleCarryPhysics", (Type[])null, (Type[])null); } [HarmonyPatch(typeof(Item), "Awake")] internal static class RobotBackpackAttachmentItemAwakePatch { private static void Postfix(Item __instance) { Backpack val = (Backpack)(object)((__instance is Backpack) ? __instance : null); if (val != null) { RobotBackpackAttachment.Ensure(val); } } } [HarmonyPatch(typeof(BackpackWheel), "Hover")] internal static class RobotBackpackWheelHoverPatch { private static bool Prefix(SliceData sliceData) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) if (!sliceData.isBackpackWear) { return true; } Backpack backpack = default(Backpack); if (((BackpackReference)(ref sliceData.backpackReference)).TryGetBackpackItem(ref backpack) && RobotBackpackAttachment.IsAttached(backpack)) { return false; } return true; } } [HarmonyPatch(typeof(BackpackWheel), "Choose")] internal static class RobotBackpackWheelChoosePatch { private static bool Prefix(BackpackWheel __instance) { //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_002e: Unknown result type (might be due to invalid IL or missing references) //IL_0063: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Unknown result type (might be due to invalid IL or missing references) try { if ((Object)(object)__instance == (Object)null || __instance.chosenSlice.IsNone) { return true; } SliceData value = __instance.chosenSlice.Value; if (!value.isBackpackWear) { return true; } Backpack backpack = default(Backpack); if (((BackpackReference)(ref value.backpackReference)).TryGetBackpackItem(ref backpack) && RobotBackpackAttachment.IsAttached(backpack)) { __instance.chosenSlice = Optionable.None; return false; } } catch (Exception arg) { Plugin.Log.LogDebug((object)$"RobotBackpackWheelChoosePatch failed: {arg}"); } return true; } } internal sealed class RobotBackpackAttachment : MonoBehaviourPun { private const float ResolveRetrySeconds = 0.25f; private const float VisualBackPoseForwardNudge = 0.14f; private const float VisualBackPoseDownNudge = 0.06f; private const float FallbackBackPoseDistance = 0.14f; private const float FallbackBackPoseDownNudge = 0.04f; private const string ProxyName = "PingDrivenRobots_RobotBackpackInteractible"; private Backpack? _backpack; private Character? _target; private int _targetViewId = -1; private bool _attached; private float _nextResolveTime; private RobotBackpackInteractible? _interactible; private Collider? _interactCollider; internal bool Attached => _attached; internal int TargetViewId => _targetViewId; internal Backpack? Backpack => _backpack; internal Character? Target => _target; private void Awake() { _backpack = ((Component)this).GetComponent(); EnsureInteractionProxy(active: false); } internal static RobotBackpackAttachment Ensure(Backpack backpack) { RobotBackpackAttachment robotBackpackAttachment = ((Component)backpack).GetComponent(); if ((Object)(object)robotBackpackAttachment == (Object)null) { robotBackpackAttachment = ((Component)backpack).gameObject.AddComponent(); } robotBackpackAttachment._backpack = backpack; robotBackpackAttachment.EnsureInteractionProxy(active: false); return robotBackpackAttachment; } internal static bool IsAttached(Backpack backpack) { RobotBackpackAttachment robotBackpackAttachment = (((Object)(object)backpack != (Object)null) ? ((Component)backpack).GetComponent() : null); return (Object)(object)robotBackpackAttachment != (Object)null && robotBackpackAttachment._attached; } internal static RobotBackpackAttachment? FindAttachedTo(Character character) { if ((Object)(object)character == (Object)null || (Object)(object)((MonoBehaviourPun)character).photonView == (Object)null) { return null; } int viewID = ((MonoBehaviourPun)character).photonView.ViewID; Backpack[] array = Object.FindObjectsByType((FindObjectsInactive)0, (FindObjectsSortMode)1); for (int i = 0; i < array.Length; i++) { RobotBackpackAttachment robotBackpackAttachment = (((Object)(object)array[i] != (Object)null) ? ((Component)array[i]).GetComponent() : null); if ((Object)(object)robotBackpackAttachment != (Object)null && robotBackpackAttachment._attached && robotBackpackAttachment._targetViewId == viewID) { return robotBackpackAttachment; } } return null; } internal void AttachNetworked(Character robot) { if (!((Object)(object)robot == (Object)null) && !((Object)(object)((MonoBehaviourPun)robot).photonView == (Object)null)) { ((MonoBehaviourPun)this).photonView.RPC("RPC_AttachToRobot", (RpcTarget)3, new object[1] { ((MonoBehaviourPun)robot).photonView.ViewID }); } } internal void DetachNetworked(Vector3 dropPosition) { //IL_0015: Unknown result type (might be due to invalid IL or missing references) ((MonoBehaviourPun)this).photonView.RPC("RPC_DetachFromRobot", (RpcTarget)3, new object[1] { dropPosition }); } [PunRPC] private void RPC_AttachToRobot(int robotViewId) { if (_backpack == null) { _backpack = ((Component)this).GetComponent(); } _targetViewId = robotViewId; _target = ResolveTarget(robotViewId); _attached = (Object)(object)_target != (Object)null; if (_attached && !((Object)(object)_backpack == (Object)null)) { PrepareBackpackForRobotBack(_backpack, _target); EnsureInteractionProxy(active: true); ApplyPose(); } } [PunRPC] private void RPC_DetachFromRobot(Vector3 dropPosition) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) DetachLocal(dropPosition); } private void LateUpdate() { //IL_00a6: Unknown result type (might be due to invalid IL or missing references) if (!_attached) { return; } if ((Object)(object)_target == (Object)null || (Object)(object)((MonoBehaviourPun)_target).photonView == (Object)null || ((MonoBehaviourPun)_target).photonView.ViewID != _targetViewId) { if (Time.unscaledTime < _nextResolveTime) { return; } _nextResolveTime = Time.unscaledTime + 0.25f; _target = ResolveTarget(_targetViewId); if ((Object)(object)_target == (Object)null) { DetachLocal(((Component)this).transform.position); return; } } ApplyPose(); ForceAttachedVisualState(); } private static Character? ResolveTarget(int viewId) { if (viewId <= 0) { return null; } try { PhotonView photonView = PhotonNetwork.GetPhotonView(viewId); return ((Object)(object)photonView != (Object)null) ? ((Component)photonView).GetComponent() : null; } catch { return null; } } private void EnsureInteractionProxy(bool active) { //IL_0063: Unknown result type (might be due to invalid IL or missing references) //IL_0069: Expected O, but got Unknown //IL_0087: 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_00a9: 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_012b: Unknown result type (might be due to invalid IL or missing references) if (_backpack == null) { _backpack = ((Component)this).GetComponent(); } if (!((Object)(object)_backpack == (Object)null)) { Transform val = null; try { val = ((Component)_backpack).transform.Find("PingDrivenRobots_RobotBackpackInteractible"); } catch { val = null; } GameObject val2; if ((Object)(object)val == (Object)null) { val2 = new GameObject("PingDrivenRobots_RobotBackpackInteractible"); val2.transform.SetParent(((Component)_backpack).transform, false); val2.transform.localPosition = Vector3.zero; val2.transform.localRotation = Quaternion.identity; val2.transform.localScale = Vector3.one; } else { val2 = ((Component)val).gameObject; } int num = LayerMask.NameToLayer("Default"); if (num >= 0) { val2.layer = num; } BoxCollider val3 = val2.GetComponent(); if ((Object)(object)val3 == (Object)null) { val3 = val2.AddComponent(); } ((Collider)val3).enabled = active; ((Collider)val3).isTrigger = true; val3.center = Vector3.zero; val3.size = new Vector3(0.85f, 0.95f, 0.45f); _interactCollider = (Collider?)(object)val3; RobotBackpackInteractible robotBackpackInteractible = val2.GetComponent(); if ((Object)(object)robotBackpackInteractible == (Object)null) { robotBackpackInteractible = val2.AddComponent(); } robotBackpackInteractible.Bind(this); _interactible = robotBackpackInteractible; val2.SetActive(active); } } private static void PrepareBackpackForRobotBack(Backpack backpack, Character robot) { //IL_005e: 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_00a3: Unknown result type (might be due to invalid IL or missing references) ((Component)backpack).gameObject.SetActive(true); ((Item)backpack).blockInteraction = true; ((Item)backpack).itemState = (ItemState)0; ((Item)backpack).holderCharacter = robot; ((Item)backpack).wearerCharacter = robot; ((Component)backpack).transform.SetParent((Transform)null, true); if ((Object)(object)((Item)backpack).rig != (Object)null) { ((Item)backpack).rig.useGravity = false; ((Item)backpack).rig.linearVelocity = Vector3.zero; ((Item)backpack).rig.angularVelocity = Vector3.zero; ((Item)backpack).SetKinematic(true); ((Item)backpack).rig.interpolation = (RigidbodyInterpolation)0; ((Item)backpack).rig.collisionDetectionMode = (CollisionDetectionMode)0; ((Item)backpack).rig.excludeLayers = LayerMask.op_Implicit(-1); } Collider[] array = ((Item)backpack).colliders ?? Array.Empty(); for (int i = 0; i < array.Length; i++) { if (!((Object)(object)array[i] == (Object)null)) { array[i].enabled = false; array[i].isTrigger = true; } } ItemBackpackVisuals component = ((Component)backpack).GetComponent(); if ((Object)(object)component != (Object)null && PhotonNetwork.IsMasterClient) { ((BackpackVisuals)component).RefreshVisuals(); } } private void DetachLocal(Vector3 dropPosition) { //IL_00c8: Unknown result type (might be due to invalid IL or missing references) //IL_00cd: Unknown result type (might be due to invalid IL or missing references) //IL_00d4: 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_0167: 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_0185: 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_01a3: Unknown result type (might be due to invalid IL or missing references) if (_backpack == null) { _backpack = ((Component)this).GetComponent(); } Backpack backpack = _backpack; _attached = false; _target = null; _targetViewId = -1; if ((Object)(object)_interactCollider != (Object)null) { _interactCollider.enabled = false; } if ((Object)(object)_interactible != (Object)null) { ((Component)_interactible).gameObject.SetActive(false); } if ((Object)(object)backpack == (Object)null) { return; } ((Component)backpack).transform.SetParent((Transform)null, true); ((Component)backpack).gameObject.SetActive(true); ((Item)backpack).blockInteraction = false; ((Item)backpack).itemState = (ItemState)0; ((Item)backpack).holderCharacter = null; ((Item)backpack).wearerCharacter = null; Quaternion rotation = ((Component)backpack).transform.rotation; ((Component)backpack).transform.SetPositionAndRotation(dropPosition, rotation); if ((Object)(object)backpack.groundMesh != (Object)null) { backpack.groundMesh.SetActive(true); } if ((Object)(object)backpack.heldMesh != (Object)null) { backpack.heldMesh.SetActive(false); } if ((Object)(object)((Item)backpack).rig != (Object)null) { ((Item)backpack).rig.useGravity = true; ((Item)backpack).SetKinematic(false); ((Item)backpack).rig.interpolation = (RigidbodyInterpolation)1; ((Item)backpack).rig.collisionDetectionMode = (CollisionDetectionMode)2; ((Item)backpack).rig.excludeLayers = LayerMask.op_Implicit(0); ((Item)backpack).rig.position = dropPosition; ((Item)backpack).rig.rotation = rotation; ((Item)backpack).rig.linearVelocity = Vector3.zero; ((Item)backpack).rig.angularVelocity = Vector3.zero; } Collider[] array = ((Item)backpack).colliders ?? Array.Empty(); for (int i = 0; i < array.Length; i++) { if (!((Object)(object)array[i] == (Object)null)) { array[i].enabled = true; array[i].isTrigger = false; } } } private void ApplyPose() { //IL_0060: 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_008b: 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_00af: 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) if (_backpack == null) { _backpack = ((Component)this).GetComponent(); } if (!((Object)(object)_backpack == (Object)null) && !((Object)(object)_target == (Object)null) && TryGetRobotBackPose(_target, out var position, out var rotation)) { ((Component)_backpack).transform.SetPositionAndRotation(position, rotation); if ((Object)(object)((Item)_backpack).rig != (Object)null) { ((Item)_backpack).rig.position = position; ((Item)_backpack).rig.rotation = rotation; ((Item)_backpack).rig.linearVelocity = Vector3.zero; ((Item)_backpack).rig.angularVelocity = Vector3.zero; } } } private void ForceAttachedVisualState() { if (_backpack == null) { _backpack = ((Component)this).GetComponent(); } if (!((Object)(object)_backpack == (Object)null)) { if ((Object)(object)_backpack.groundMesh != (Object)null && _backpack.groundMesh.activeSelf) { _backpack.groundMesh.SetActive(false); } if ((Object)(object)_backpack.heldMesh != (Object)null && !_backpack.heldMesh.activeSelf) { _backpack.heldMesh.SetActive(true); } } } private static bool TryGetRobotBackPose(Character robot, out Vector3 position, out Quaternion rotation) { //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_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_0034: 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_004f: 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_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_0129: 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_012e: 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_013d: Unknown result type (might be due to invalid IL or missing references) //IL_0142: Unknown result type (might be due to invalid IL or missing references) //IL_0147: Unknown result type (might be due to invalid IL or missing references) try { CharacterBackpackHandler component = ((Component)robot).GetComponent(); if ((Object)(object)component != (Object)null && (Object)(object)component.backpack != (Object)null) { Transform transform = component.backpack.transform; position = transform.position + transform.forward * 0.14f - transform.up * 0.06f; rotation = transform.rotation; return true; } } catch { } Transform val = null; try { Bodypart bodypart = robot.GetBodypart((BodypartType)2); val = (((Object)(object)bodypart != (Object)null) ? ((Component)bodypart).transform : null); } catch { val = null; } if ((Object)(object)val == (Object)null) { try { Bodypart bodypart2 = robot.GetBodypart((BodypartType)0); val = (((Object)(object)bodypart2 != (Object)null) ? ((Component)bodypart2).transform : null); } catch { val = null; } } if ((Object)(object)val == (Object)null) { position = robot.Center; Vector3 forward = ((Component)robot).transform.forward; Vector3 val2 = ((((Vector3)(ref forward)).sqrMagnitude > 0.001f) ? ((Component)robot).transform.forward : Vector3.forward); rotation = Quaternion.LookRotation(-((Vector3)(ref val2)).normalized, Vector3.up); return true; } return TryGetBackPoseFromTransform(val, out position, out rotation); } private static bool TryGetBackPoseFromTransform(Transform body, out Vector3 position, out Quaternion rotation) { //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_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_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_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_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_007a: 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_0086: 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_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) Vector3 forward = body.forward; Vector3 up = body.up; if (((Vector3)(ref forward)).sqrMagnitude < 0.001f) { forward = Vector3.forward; } if (((Vector3)(ref up)).sqrMagnitude < 0.001f) { up = Vector3.up; } ((Vector3)(ref forward)).Normalize(); ((Vector3)(ref up)).Normalize(); position = body.position - forward * 0.14f - up * 0.04f; rotation = Quaternion.LookRotation(-forward, up); return true; } } internal sealed class RobotBackpackInteractible : MonoBehaviour, IInteractibleConstant, IInteractible { private static readonly int Interactable = Shader.PropertyToID("_Interactable"); private RobotBackpackAttachment? _attachment; private RobotBackpackAttachment? Attachment { get { if ((Object)(object)_attachment == (Object)null) { _attachment = ((Component)this).GetComponentInParent(); } return _attachment; } } public bool holdOnFinish => false; internal void Bind(RobotBackpackAttachment attachment) { _attachment = attachment; } public bool IsInteractible(Character interactor) { RobotBackpackAttachment attachment = Attachment; return (Object)(object)interactor != (Object)null && (Object)(object)attachment != (Object)null && attachment.Attached && (Object)(object)attachment.Backpack != (Object)null; } public void Interact(Character interactor) { } public void HoverEnter() { SetInteractableMaterial(1f); } public void HoverExit() { SetInteractableMaterial(0f); } public Vector3 Center() { //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_000f: Unknown result type (might be due to invalid IL or missing references) return ((Component)this).transform.position; } public Transform GetTransform() { return ((Component)this).transform; } public string GetInteractionText() { return LocalizedText.GetText("open", true); } public string GetName() { try { Character val = Attachment?.Target; string newValue = (((Object)(object)val != (Object)null) ? val.characterName : LocalizedText.GetText("SOMEONESBACKPACK", true)); return LocalizedText.GetText("SOMEONESBACKPACK", true).Replace("#", newValue); } catch { return "Backpack"; } } public bool IsConstantlyInteractable(Character interactor) { return IsInteractible(interactor); } public float GetInteractTime(Character interactor) { RobotBackpackAttachment attachment = Attachment; return ((Object)(object)attachment != (Object)null && (Object)(object)attachment.Backpack != (Object)null) ? attachment.Backpack.openRadialMenuTime : 0.25f; } public void Interact_CastFinished(Character interactor) { //IL_003d: Unknown result type (might be due to invalid IL or missing references) RobotBackpackAttachment attachment = Attachment; Backpack val = (((Object)(object)attachment != (Object)null) ? attachment.Backpack : null); if (!((Object)(object)val == (Object)null) && attachment.Attached) { GUIManager.instance.OpenBackpackWheel(BackpackReference.GetFromBackpackItem((Item)(object)val)); } } public void CancelCast(Character interactor) { } public void ReleaseInteract(Character interactor) { } private void SetInteractableMaterial(float value) { try { Backpack val = Attachment?.Backpack; if ((Object)(object)val != (Object)null && (Object)(object)((Item)val).mainRenderer != (Object)null) { ((Item)val).mainRenderer.material.SetFloat(Interactable, value); } } catch { } } } internal static class RobotInteractionRules { public static bool CanLocalPlayerEatRobot(Character? target, Character? interactor = null) { //IL_015a: Unknown result type (might be due to invalid IL or missing references) //IL_0160: Invalid comparison between Unknown and I4 try { if ((Object)(object)target == (Object)null || (Object)(object)target.data == (Object)null || target.refs == null) { return false; } NetworkRobotAgent agent = RobotInteractionUtil.GetAgent(target); if ((Object)(object)agent == (Object)null) { return false; } Character val = interactor ?? Character.localCharacter; if ((Object)(object)val == (Object)null || (Object)(object)val.data == (Object)null || val.refs == null || (Object)(object)val.refs.afflictions == (Object)null) { return false; } if ((Object)(object)val == (Object)(object)target || target.data.dead || (Object)(object)target.data.carrier != (Object)null) { return false; } if (!val.data.fullyConscious) { return false; } float currentStatus = val.refs.afflictions.GetCurrentStatus((STATUSTYPE)1); if (currentStatus < UIPlayerNames.CANNIBAL_HUNGER_THRESHOLD) { return false; } CannibalismSetting val2 = null; try { val2 = (((Object)(object)GameHandler.Instance != (Object)null && GameHandler.Instance.SettingsHandler != null) ? GameHandler.Instance.SettingsHandler.GetSetting() : null); } catch { val2 = null; } if (val2 != null && (int)((EnumSetting)(object)val2).Value != 1) { return false; } return target.data.cannibalismPermitted; } catch (Exception arg) { Plugin.Log.LogDebug((object)$"CanLocalPlayerEatRobot failed: {arg}"); return false; } } public static bool CanCarryRobot(Character? target, Character? interactor = null) { try { if ((Object)(object)target == (Object)null || (Object)(object)target.data == (Object)null || target.data.dead || (Object)(object)target.data.carrier != (Object)null) { return false; } NetworkRobotAgent agent = RobotInteractionUtil.GetAgent(target); if ((Object)(object)agent == (Object)null || !agent.canBeCarriedAsRobot) { return false; } if (CanLocalPlayerEatRobot(target, interactor)) { return false; } return true; } catch (Exception arg) { Plugin.Log.LogDebug((object)$"CanCarryRobot failed: {arg}"); return false; } } public static bool IsCarriedByLocalPlayer(Character? target) { try { return (Object)(object)target != (Object)null && (Object)(object)target.data != (Object)null && (Object)(object)target.data.carrier != (Object)null && (Object)(object)target.data.carrier == (Object)(object)Character.localCharacter; } catch { return false; } } public static bool TryEatRobot(Character target, Character eater) { try { if (!CanLocalPlayerEatRobot(target, eater)) { return false; } NetworkRobotAgent agent = RobotInteractionUtil.GetAgent(target); if ((Object)(object)agent == (Object)null) { return false; } if (eater.IsLocal) { eater.refs.afflictions.SubtractStatus((STATUSTYPE)1, 1f, false, false); eater.refs.afflictions.AddStatus((STATUSTYPE)5, 0.1f, false, true, true); Singleton.Instance.ThrowAchievement((ACHIEVEMENTTYPE)40); } agent.DeleteRobotNetworked(); return true; } catch (Exception arg) { Plugin.Log.LogDebug((object)$"TryEatRobot failed: {arg}"); return false; } } } internal static class RobotInteractionUtil { private const float MissingAgentRetrySeconds = 0.25f; private static readonly Dictionary AgentByCharacterId = new Dictionary(); private static readonly Dictionary MissingAgentRetryByCharacterId = new Dictionary(); public static void RegisterAgent(Character? character, NetworkRobotAgent? agent) { if (!((Object)(object)character == (Object)null) && !((Object)(object)agent == (Object)null)) { int instanceID = ((Object)character).GetInstanceID(); AgentByCharacterId[instanceID] = agent; MissingAgentRetryByCharacterId.Remove(instanceID); } } public static void UnregisterAgent(Character? character, NetworkRobotAgent? agent) { if (!((Object)(object)character == (Object)null)) { int instanceID = ((Object)character).GetInstanceID(); if (AgentByCharacterId.TryGetValue(instanceID, out NetworkRobotAgent value) && ((Object)(object)agent == (Object)null || (Object)(object)value == (Object)(object)agent)) { AgentByCharacterId.Remove(instanceID); } MissingAgentRetryByCharacterId.Remove(instanceID); } } public static NetworkRobotAgent? GetAgent(Character? character) { if ((Object)(object)character == (Object)null) { return null; } int instanceID = ((Object)character).GetInstanceID(); if (AgentByCharacterId.TryGetValue(instanceID, out NetworkRobotAgent value)) { if ((Object)(object)value != (Object)null && (Object)(object)value.Character == (Object)(object)character) { return value; } AgentByCharacterId.Remove(instanceID); } float unscaledTime = Time.unscaledTime; if (MissingAgentRetryByCharacterId.TryGetValue(instanceID, out var value2) && unscaledTime < value2) { return null; } try { NetworkRobotAgent component = ((Component)character).GetComponent(); if ((Object)(object)component != (Object)null) { RegisterAgent(character, component); return component; } } catch { } MissingAgentRetryByCharacterId[instanceID] = unscaledTime + 0.25f; return null; } public static bool IsRobotCharacter(Character? character) { return (Object)(object)GetAgent(character) != (Object)null; } } } namespace System.Runtime.CompilerServices { [AttributeUsage(AttributeTargets.Assembly, AllowMultiple = true)] internal sealed class IgnoresAccessChecksToAttribute : Attribute { public IgnoresAccessChecksToAttribute(string assemblyName) { } } }