Please disclose if any significant portion of your mod was created using AI tools by adding the 'AI Generated' category. Failing to do so may result in the mod being removed from Thunderstore.
Decompiled source of AiChanCompanion v1.0.0
AiChanCompanion.dll
Decompiled 2 hours ago
The result has been truncated due to the large size, download it to view full contents!
using System; using System.Collections; using System.Collections.Generic; using System.Diagnostics; using System.Globalization; using System.Linq; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using System.Security; using System.Security.Permissions; using BepInEx; using BepInEx.Configuration; using BepInEx.Logging; using ExitGames.Client.Photon; using GenshinImpactOverhaulRepo; using HarmonyLib; using Microsoft.CodeAnalysis; using Photon.Pun; using RepoSteamNetworking.API; using RepoSteamNetworking.API.VersionCompat; using RepoSteamNetworking.Networking; using RepoSteamNetworking.Networking.Serialization; using UnityEngine; using UnityEngine.AI; using UnityEngine.Events; using UnityEngine.Rendering; using UnityEngine.SceneManagement; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")] [assembly: AssemblyCompany("AiChanCompanion")] [assembly: AssemblyConfiguration("Release")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0")] [assembly: AssemblyProduct("AiChanCompanion")] [assembly: AssemblyTitle("AiChanCompanion")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.0.0.0")] [module: UnverifiableCode] [module: RefSafetyRules(11)] namespace Microsoft.CodeAnalysis { [CompilerGenerated] [Embedded] internal sealed class EmbeddedAttribute : Attribute { } } namespace System.Runtime.CompilerServices { [CompilerGenerated] [Embedded] [AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)] internal sealed class RefSafetyRulesAttribute : Attribute { public readonly int Version; public RefSafetyRulesAttribute(int P_0) { Version = P_0; } } } namespace ElsaPetMod { public sealed class AiChanAudio : MonoBehaviour { public float minDistance = 1f; public float maxDistance = 25f; public float barkCooldown = 0.25f; private AudioSource source; private AudioClip[] barkClips; private float nextBarkTime; private bool initialized; private readonly string[] allowedClips = new string[3] { "barksmall1", "barksmall2", "barksmall3" }; private void Awake() { //IL_0005: Unknown result type (might be due to invalid IL or missing references) //IL_000b: Expected O, but got Unknown //IL_0023: Unknown result type (might be due to invalid IL or missing references) GameObject val = new GameObject("AiChan_Audio_Source"); val.transform.SetParent(((Component)this).transform, false); val.transform.localPosition = Vector3.zero; source = val.AddComponent<AudioSource>(); source.playOnAwake = false; source.loop = false; source.spatialBlend = 1f; source.minDistance = minDistance; source.maxDistance = maxDistance; source.rolloffMode = (AudioRolloffMode)1; source.dopplerLevel = 0f; LoadBarkClips(); } private IEnumerator Start() { for (int i = 0; i < 20; i++) { if (initialized && barkClips != null && barkClips.Length != 0) { break; } LoadBarkClips(); yield return (object)new WaitForSeconds(0.5f); } } public void LoadBarkClips() { List<AudioClip> list = new List<AudioClip>(); AudioClip[] array = Resources.FindObjectsOfTypeAll<AudioClip>(); foreach (AudioClip val in array) { if ((Object)(object)val == (Object)null) { continue; } string text = ((Object)val).name.ToLowerInvariant().Trim(); string[] array2 = allowedClips; foreach (string text2 in array2) { if (!(text != text2)) { if (!list.Contains(val)) { list.Add(val); } break; } } } if (list.Count > 0) { barkClips = list.ToArray(); initialized = true; } } public static void LogAllAvailableClips() { Plugin.Log.LogInfo((object)"=== [Ai-Chan Audio Scan] Listing AudioClips in memory ==="); int num = 0; AudioClip[] array = Resources.FindObjectsOfTypeAll<AudioClip>(); foreach (AudioClip val in array) { if ((Object)(object)val != (Object)null) { string text = ((Object)val).name.ToLowerInvariant(); if (text.Contains("aino") || text.Contains("elsa") || text.Contains("bark") || text.Contains("vo_")) { Plugin.Log.LogInfo((object)("AudioClip [" + num + "]: " + ((Object)val).name + " (Length: " + val.length + "s)")); num++; } } } Plugin.Log.LogInfo((object)("=== [Ai-Chan Audio Scan] Total clips found: " + num + " ===")); } public void PlayBark() { if (!initialized || barkClips == null || barkClips.Length == 0) { LoadBarkClips(); if (!initialized || barkClips == null || barkClips.Length == 0) { return; } } if (!(Time.time < nextBarkTime)) { nextBarkTime = Time.time + barkCooldown; float num = Mathf.Clamp01(((PetSettings.Volume != null) ? PetSettings.Volume.Value : 50f) / 100f) * 0.5f; AudioClip val = barkClips[Random.Range(0, barkClips.Length)]; source.pitch = Random.Range(0.96f, 1.04f); source.PlayOneShot(val, num); } } } public class PetCompanionController : MonoBehaviour { public enum PetState { WaitingForLevel, FollowOwner, CarryItemToCart, Petting, Grabbed, Stunned, Dead } private class DeadEndMemory { public Vector3 Position; public float Timer; } public const float NetworkMovingInterval = 0.02f; public const float NetworkStoppedInterval = 1.5f; private const float RemoteSnapDistance = 12f; private float lastNetworkSentTime; private Vector3 lastNetworkSentPosition; private Quaternion lastNetworkSentRotation; private bool hasNetworkSentTransform; private Vector3 networkTargetPosition; private Quaternion networkTargetRotation; private bool hasNetworkTarget; private float lastMoveTime; public bool isCalledByOwner; public float awayTimer; public bool isPlayingDead; public Vector3 awayTargetPos; public float currentHealth = 100f; private static readonly FieldInfo GrabbedPhysGrabObjectField = AccessTools.Field(typeof(PhysGrabber), "grabbedPhysGrabObject"); public float maxHealth = 100f; public NavMeshAgent agent; public Animator animator; public Transform visualRoot; public PlayerAvatar owner; public AiChanAudio aiAudio; public PetState state; public float noGrabUntilTime; private bool initialized; private PhysGrabObject myGrabObject; private Rigidbody myRigidbody; private CapsuleCollider myCapsule; private float grabbedReleaseTime; private float standUpTime; private bool waitingToStandUp; private bool isStandingUp; private bool isJumping; private Vector3 lastAnimPosition; private float smoothedSpeedSqr; private float debugJitterTimer; private Vector3 debugLastLogicPos; private Vector3 debugLastVisualPos; private bool debugJitterInitialized; private float debugLastSampleTime; private PetState lastLoggedState; private static readonly int IsBigHash = Animator.StringToHash("isBig"); private static readonly int MovingHash = Animator.StringToHash("moving"); private static readonly int StandingHash = Animator.StringToHash("standing"); private static readonly int ChasingHash = Animator.StringToHash("chasing"); private static readonly int FallingHash = Animator.StringToHash("falling"); private static readonly int FlyingHash = Animator.StringToHash("flying"); private static readonly int LookingUnderHash = Animator.StringToHash("lookingUnder"); private static readonly int StunnedHash = Animator.StringToHash("stunned"); private static readonly int PetTriggerHash = Animator.StringToHash("Pet"); private readonly RaycastHit[] groundedRaycastHits = (RaycastHit[])(object)new RaycastHit[8]; private readonly Collider[] groundedOverlapColliders = (Collider[])(object)new Collider[16]; private Vector3 syncCarryPos = Vector3.zero; private Quaternion syncCarryRot = Quaternion.identity; private int groundMask; private bool wasLocallyGrabbed; public Transform holdPoint; private Vector3? lastShopDeliveryPosition; private const float ShopDeliverySpreadRadius = 0.35f; private const float ShopDeliveryMinDistance = 0.25f; private const float MinItemScaleCap = 0.01f; private Vector3? lockedApproachPoint; private Vector3 lockedApproachCartCenter = Vector3.zero; private PhysGrabObject carriedItem; private Vector3 carriedOriginalScale = Vector3.one; private bool carriedInheritScale; private PhysGrabCart targetCart; private ExtractionPoint targetExtractionPoint; private Rigidbody carriedRigidbody; private Collider[] carriedColliders; private bool[] carriedOriginalTriggers; private int[] carriedOriginalLayers; private bool carriedWasKinematic; private PlayerAvatar carriedPlayerAvatar; private PlayerTumble carriedTumble; private bool isDeliveryLocked; private Vector3 lastDeliveryDestination = Vector3.zero; private bool hasLastDeliveryDestination; private const float DeliveryDestinationHysteresis = 1f; private Coroutine explodeCountdownCoroutine; private TextMesh countdownTextMesh; private GameObject countdownTagObject; private static AudioClip cachedBeepClip; private static bool searchedForBeepClip; private AudioSource countdownAudioSource; public ParticleSystem heartParticles; public float petDuration = 2.6f; private MonoBehaviour nativePetVfxComponent; private MethodInfo nativePetVfxMethod; private ParticleSystem[] fallbackHeartParticleSystems; private bool heartVfxCached; private float petEndsAt; private float stunEndsAt; private PetState stateBeforePetting; public float followDistance = 2.2f; public float followStoppingDistance = 1.65f; private float nextPlayerSwitchTime; private bool isFollowingOwner; private Vector3 lastDestination = Vector3.positiveInfinity; private float lastSetDestinationTime; private float nextProbeTime; private Vector3 cachedBestDir = Vector3.forward; private float panicTimer; private Vector3 panicDirection; private Vector3 lastWallHitNormal; private Vector3[] navMeshCorners = (Vector3[])(object)new Vector3[16]; private bool isActuallyMoving; private Vector3 lastPosCheck; private float posCheckTimer; private float nextNavMeshCheckTime; private float jumpTimer; private bool isPreparingToJump; private const float NavDestinationUpdateDistance = 0.5f; private const float NavDestinationUpdateInterval = 0.15f; private float stuckTimer; private float nextJumpTime; private float nextJumpBarkTime; private float stuckHighTimer; private float navMeshCooldown; private float offNavMeshStuckTimer; private float escapeTimer; private Vector3 escapeDirection = Vector3.zero; private Vector3 smoothedManualDir = Vector3.forward; private Vector3 lastStuckCheckPos; private float stuckPositionCheckTimer; private float lastPinDropTime; private static readonly MethodInfo DoorOpenMethod = typeof(PhysGrabHinge).GetMethod("OpenImpulse", BindingFlags.Instance | BindingFlags.NonPublic); private static readonly FieldInfo DoorClosedField = typeof(PhysGrabHinge).GetField("closed", BindingFlags.Instance | BindingFlags.NonPublic); private readonly Dictionary<int, float> doorOpenCooldowns = new Dictionary<int, float>(); private float nextDoorCheckTime; public bool hasManualMoveTarget; public Vector3 manualMoveTarget; public float manualMoveEndsAt; public float autoMovementSuspendedUntil; private const float ManualMoveDuration = 12f; private const float ManualMoveStoppingDistance = 0.3f; private readonly List<DeadEndMemory> deadEndMemories = new List<DeadEndMemory>(); private readonly List<Vector3> ownerBreadcrumbs = new List<Vector3>(); private readonly RaycastHit[] surfaceHitsBuffer = (RaycastHit[])(object)new RaycastHit[15]; private readonly Collider[] overlapCollidersBuffer = (Collider[])(object)new Collider[16]; private readonly List<PlayerAvatar> chosenOwnersThisLevel = new List<PlayerAvatar>(); private float lastDebugDrawTime; private bool IsNetworkClientOnly { get { if (PhotonNetwork.InRoom && !PhotonNetwork.OfflineMode) { return !PhotonNetwork.IsMasterClient; } return false; } } public bool IsRecovering { get { if (!waitingToStandUp) { return isStandingUp; } return true; } } public float cartApproachDistance { get { if (PetSettings.CartApproachDistance == null) { return 1.6f; } return PetSettings.CartApproachDistance.Value; } } public float cartDropDistance { get { if (PetSettings.CartDropDistance == null) { return 1.8f; } return PetSettings.CartDropDistance.Value; } } public float shopDropDistance { get { if (PetSettings.ShopDropDistance == null) { return 1.2f; } return PetSettings.ShopDropDistance.Value; } } public bool IsGrabbedByAnyPlayer() { if ((Object)(object)myGrabObject == (Object)null) { myGrabObject = ((Component)this).GetComponent<PhysGrabObject>(); } if ((Object)(object)myGrabObject != (Object)null && myGrabObject.playerGrabbing != null) { return myGrabObject.playerGrabbing.Count > 0; } return false; } private bool IsCarryingForNetwork() { if (state == PetState.CarryItemToCart) { if (!((Object)(object)carriedItem != (Object)null)) { return (Object)(object)carriedPlayerAvatar != (Object)null; } return true; } return false; } private bool IsNetworkMoving() { //IL_008f: 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_009f: 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_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) if (isJumping || state == PetState.Dead || IsGrabbedByAnyPlayer()) { return true; } Vector3 val; if ((Object)(object)agent != (Object)null && ((Behaviour)agent).enabled) { val = agent.velocity; if (((Vector3)(ref val)).sqrMagnitude > 0.001f) { return true; } } if ((Object)(object)myRigidbody != (Object)null && !myRigidbody.isKinematic) { val = myRigidbody.velocity; if (((Vector3)(ref val)).sqrMagnitude > 0.001f) { return true; } } val = ((Component)this).transform.position - lastNetworkSentPosition; return ((Vector3)(ref val)).sqrMagnitude > 0.0001f; } private void InitializeNetworkInterpolation() { //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_001d: Unknown result type (might be due to invalid IL or missing references) networkTargetPosition = ((Component)this).transform.position; networkTargetRotation = ((Component)this).transform.rotation; hasNetworkTarget = true; } public bool IsGrabbedByLocalPlayer() { if ((Object)(object)myGrabObject == (Object)null) { myGrabObject = ((Component)this).GetComponent<PhysGrabObject>(); } if ((Object)(object)myGrabObject == (Object)null) { return false; } PlayerAvatar val = SemiFunc.PlayerAvatarLocal(); if ((Object)(object)val == (Object)null || (Object)(object)val.physGrabber == (Object)null) { return false; } object? obj = GrabbedPhysGrabObjectField?.GetValue(val.physGrabber); if ((Object)((obj is PhysGrabObject) ? obj : null) == (Object)(object)myGrabObject) { return true; } if (myGrabObject.playerGrabbing != null) { return myGrabObject.playerGrabbing.Contains(val.physGrabber); } return false; } public void UpdateRemoteNetworkInterpolation() { //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_0074: 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_0090: 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_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_00dc: 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_00e8: Unknown result type (might be due to invalid IL or missing references) //IL_00ae: Unknown result type (might be due to invalid IL or missing references) if (!IsNetworkClientOnly || !hasNetworkTarget) { return; } if (Vector3.Distance(((Component)this).transform.position, networkTargetPosition) > 12f) { ((Component)this).transform.position = networkTargetPosition; ((Component)this).transform.rotation = networkTargetRotation; return; } float num = 1f - Mathf.Exp(-25f * Time.deltaTime); ((Component)this).transform.position = Vector3.Lerp(((Component)this).transform.position, networkTargetPosition, num); if (Quaternion.Angle(((Component)this).transform.rotation, networkTargetRotation) > 45f) { ((Component)this).transform.rotation = networkTargetRotation; return; } float num2 = 1f - Mathf.Exp(-30f * Time.deltaTime); ((Component)this).transform.rotation = Quaternion.Slerp(((Component)this).transform.rotation, networkTargetRotation, num2); } public bool ShouldSendNetworkTransform() { //IL_0085: 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_00ac: 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_00ee: Unknown result type (might be due to invalid IL or missing references) //IL_00f3: Unknown result type (might be due to invalid IL or missing references) //IL_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) if (!PhotonNetwork.InRoom || PhotonNetwork.OfflineMode || !PhotonNetwork.IsMasterClient) { return false; } bool flag = IsNetworkMoving() || IsCarryingForNetwork() || isJumping || IsGrabbedByAnyPlayer(); if (flag) { lastMoveTime = Time.time; } bool flag2 = Time.time - lastMoveTime <= 1.5f; float num = (flag2 ? 0.02f : 1.5f); if (Time.time - lastNetworkSentTime < num) { return false; } Vector3 val = ((Component)this).transform.position - lastNetworkSentPosition; bool flag3 = ((Vector3)(ref val)).sqrMagnitude > 0.0001f; bool flag4 = Quaternion.Angle(((Component)this).transform.rotation, lastNetworkSentRotation) > 0.5f; if (!flag && !flag2 && !flag3 && !flag4 && hasNetworkSentTransform) { return false; } lastNetworkSentTime = Time.time; lastNetworkSentPosition = ((Component)this).transform.position; lastNetworkSentRotation = ((Component)this).transform.rotation; hasNetworkSentTransform = true; return true; } public void SnapNetworkInterpolation(Vector3 newPosition, Quaternion newRotation) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_0009: 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_0027: Unknown result type (might be due to invalid IL or missing references) networkTargetPosition = newPosition; networkTargetRotation = newRotation; hasNetworkTarget = true; ((Component)this).transform.position = newPosition; ((Component)this).transform.rotation = newRotation; } public void NetworkSyncTransform(Vector3 position, Quaternion rotation) { //IL_0018: Unknown result type (might be due to invalid IL or missing references) //IL_0019: Unknown result type (might be due to invalid IL or missing references) //IL_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) if (IsNetworkClientOnly) { if (!hasNetworkTarget) { InitializeNetworkInterpolation(); } networkTargetPosition = position; networkTargetRotation = rotation; } } public void CallPetToOwner() { if (state != PetState.Dead && state != PetState.Stunned && state != PetState.Grabbed) { isCalledByOwner = true; awayTimer = 0f; if ((Object)(object)aiAudio != (Object)null) { aiAudio.PlayBark(); } } } public bool TryGetLookAheadGroundPoint(float defaultDistance, out Vector3 point) { //IL_0001: 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_0030: 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_0064: 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_007c: Unknown result type (might be due to invalid IL or missing references) //IL_0083: Unknown result type (might be due to invalid IL or missing references) //IL_0089: Unknown result type (might be due to invalid IL or missing references) //IL_008e: Unknown result type (might be due to invalid IL or missing references) //IL_0093: Unknown result type (might be due to invalid IL or missing references) //IL_0094: Unknown result type (might be due to invalid IL or missing references) //IL_00b8: Unknown result type (might be due to invalid IL or missing references) //IL_00bd: Unknown result type (might be due to invalid IL or missing references) point = default(Vector3); Camera main = Camera.main; if ((Object)(object)main == (Object)null) { return false; } int num = GetGroundMask(); RaycastHit val = default(RaycastHit); Vector3 val2; if (Physics.Raycast(((Component)main).transform.position, ((Component)main).transform.forward, ref val, 40f, num, (QueryTriggerInteraction)1)) { val2 = ((RaycastHit)(ref val)).point; } else { Vector3 val3 = Vector3.ProjectOnPlane(((Component)main).transform.forward, Vector3.up); if (((Vector3)(ref val3)).sqrMagnitude < 0.001f) { return false; } val2 = ((Component)main).transform.position + ((Vector3)(ref val3)).normalized * defaultDistance; } NavMeshHit val4 = default(NavMeshHit); if (!NavMesh.SamplePosition(val2, ref val4, 4f, -1)) { Plugin.Log.LogWarning((object)"[Ai-Chan] Comando vai: área fora do mapa ou bloqueada."); return false; } point = ((NavMeshHit)(ref val4)).position; return true; } public void CommandJump() { //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_0041: Unknown result type (might be due to invalid IL or missing references) //IL_0046: Unknown result type (might be due to invalid IL or missing references) //IL_004b: Unknown result type (might be due to invalid IL or missing references) //IL_0055: Unknown result type (might be due to invalid IL or missing references) //IL_005a: Unknown result type (might be due to invalid IL or missing references) if (state != PetState.Dead && state != PetState.Stunned && state != PetState.Grabbed && !isJumping) { ((MonoBehaviour)this).StartCoroutine(PerformAutoJump(((Component)this).transform.position + ((Component)this).transform.forward * 1.5f + Vector3.up * 0.5f)); if ((Object)(object)aiAudio != (Object)null) { aiAudio.PlayBark(); } } } public void CommandAway() { //IL_0038: 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_0052: 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_006f: 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_0093: Unknown result type (might be due to invalid IL or missing references) //IL_0099: Unknown result type (might be due to invalid IL or missing references) //IL_009e: Unknown result type (might be due to invalid IL or missing references) //IL_00a3: Unknown result type (might be due to invalid IL or missing references) //IL_00a9: Unknown result type (might be due to invalid IL or missing references) //IL_00c0: Unknown result type (might be due to invalid IL or missing references) //IL_00c5: Unknown result type (might be due to invalid IL or missing references) if (state != PetState.Dead && state != PetState.Stunned && state != PetState.Grabbed && !((Object)(object)owner == (Object)null)) { isCalledByOwner = false; Vector3 val = ((Component)this).transform.position - ((Component)owner).transform.position; val.y = 0f; Vector3 val2 = ((((Vector3)(ref val)).sqrMagnitude < 0.01f) ? (-((Component)this).transform.forward) : ((Vector3)(ref val)).normalized); awayTargetPos = ((Component)this).transform.position + val2 * 5f; NavMeshHit val3 = default(NavMeshHit); if (NavMesh.SamplePosition(awayTargetPos, ref val3, 4f, -1)) { awayTargetPos = ((NavMeshHit)(ref val3)).position; } awayTimer = 6f; if ((Object)(object)aiAudio != (Object)null) { aiAudio.PlayBark(); } } } public void CommandPlayDead() { //IL_009d: 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_00b2: Unknown result type (might be due to invalid IL or missing references) //IL_00bc: Unknown result type (might be due to invalid IL or missing references) //IL_00c1: 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) if (state != PetState.Dead && state != PetState.Grabbed) { isPlayingDead = true; stunEndsAt = Time.time + 6f; state = PetState.Stunned; if ((Object)(object)agent != (Object)null && ((Behaviour)agent).enabled) { agent.isStopped = true; ((Behaviour)agent).enabled = false; } if ((Object)(object)myRigidbody != (Object)null) { myRigidbody.isKinematic = false; myRigidbody.useGravity = true; myRigidbody.constraints = (RigidbodyConstraints)0; myRigidbody.AddForce(Vector3.down * 1.5f + ((Component)this).transform.right * 2f, (ForceMode)1); myRigidbody.AddTorque(((Component)this).transform.forward * 5f, (ForceMode)1); } if ((Object)(object)aiAudio != (Object)null) { aiAudio.PlayBark(); } } } public void ShowHelpInfo() { if ((Object)(object)aiAudio != (Object)null) { aiAudio.PlayBark(); } ((MonoBehaviour)this).StopCoroutine("DisplayHelpRoutine"); ((MonoBehaviour)this).StartCoroutine("DisplayHelpRoutine"); } private IEnumerator DisplayHelpRoutine() { float duration = 6f; float elapsed = 0f; while (elapsed < duration) { if ((Object)(object)ItemInfoExtraUI.instance != (Object)null) { ItemInfoExtraUI.instance.ItemInfoText("Aino: come, jump, away, dead, small, big, normal, switch, net, go, explode", new Color(0.2f, 0.9f, 1f)); } elapsed += Time.deltaTime; yield return null; } } private void ApplyScale(float multiplier) { //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) if ((Object)(object)visualRoot != (Object)null) { visualRoot.localScale = Vector3.one * multiplier; } } private void Awake() { //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) groundMask = ~LayerMask.GetMask(new string[3] { "Player", "PlayerOnlyCollision", "Ignore Raycast" }); agent = ((Component)this).GetComponent<NavMeshAgent>(); if ((Object)(object)agent == (Object)null) { agent = ((Component)this).gameObject.AddComponent<NavMeshAgent>(); } myGrabObject = ((Component)this).GetComponent<PhysGrabObject>(); myRigidbody = ((Component)this).GetComponent<Rigidbody>(); myCapsule = ((Component)this).GetComponent<CapsuleCollider>(); aiAudio = ((Component)this).GetComponent<AiChanAudio>(); if ((Object)(object)aiAudio == (Object)null) { aiAudio = ((Component)this).gameObject.AddComponent<AiChanAudio>(); } agent.radius = 0.15f; agent.height = 1.35f; agent.acceleration = 28f; agent.angularSpeed = 720f; agent.stoppingDistance = 1.15f; agent.obstacleAvoidanceType = (ObstacleAvoidanceType)0; agent.autoBraking = true; agent.autoRepath = true; agent.updatePosition = false; agent.updateRotation = false; if ((Object)(object)visualRoot == (Object)null) { visualRoot = ((Component)this).transform; } lastAnimPosition = ((Component)this).transform.position; } private void OnDestroy() { ((MonoBehaviour)this).StopAllCoroutines(); owner = null; chosenOwnersThisLevel.Clear(); if (state == PetState.CarryItemToCart) { ClearCarryState(); } } private void LogStateTransitions() { //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) if (PetSettings.EnableDebugLogs.Value && PetSettings.EnableStateTransitionLogs.Value && state != lastLoggedState) { int num = 0; PhotonView component = ((Component)this).GetComponent<PhotonView>(); if ((Object)(object)component != (Object)null) { num = component.ViewID; } int num2 = ((PhotonNetwork.LocalPlayer != null) ? PhotonNetwork.LocalPlayer.ActorNumber : 0); int num3 = ((PhotonNetwork.MasterClient != null) ? PhotonNetwork.MasterClient.ActorNumber : 0); Scene activeScene = SceneManager.GetActiveScene(); string name = ((Scene)(ref activeScene)).name; Plugin.Log.LogInfo((object)$"[AiNet] Transition: {lastLoggedState} -> {state} | ViewID: {num} | Actor: {num2} | Master: {num3} | Scene: {name}"); lastLoggedState = state; } } private void OnDisable() { isJumping = false; waitingToStandUp = false; isStandingUp = false; if (((Component)this).gameObject.activeInHierarchy && (Object)(object)agent != (Object)null && !((Behaviour)agent).enabled && state != PetState.Grabbed && state != PetState.Dead) { EnsureGroundedAndNavMesh(); } } private IEnumerator Start() { if (PhotonNetwork.NetworkingClient != null && PhotonNetwork.NetworkingClient.LoadBalancingPeer != null) { ((PhotonPeer)PhotonNetwork.NetworkingClient.LoadBalancingPeer).TrafficStatsEnabled = true; } yield return (object)new WaitForSeconds(0.2f); if (PhotonNetwork.InRoom && !PhotonNetwork.OfflineMode && !PhotonNetwork.IsMasterClient) { if ((Object)(object)agent != (Object)null) { ((Behaviour)agent).enabled = false; } if ((Object)(object)myRigidbody != (Object)null) { myRigidbody.isKinematic = true; myRigidbody.useGravity = false; } initialized = true; state = PetState.FollowOwner; yield break; } if (SemiFunc.RunIsLevel()) { while ((Object)(object)LevelGenerator.Instance == (Object)null || !LevelGenerator.Instance.Generated) { yield return null; } } EnsureGroundedAndNavMesh(); CreateHoldPoint(); if ((Object)(object)myRigidbody != (Object)null) { myRigidbody.isKinematic = true; myRigidbody.useGravity = false; } owner = FindNearestOwner(); if ((Object)(object)owner != (Object)null && !chosenOwnersThisLevel.Contains(owner)) { chosenOwnersThisLevel.Add(owner); } initialized = true; state = PetState.FollowOwner; float num = ((PetSettings.PlayerSwitchInterval != null) ? PetSettings.PlayerSwitchInterval.Value : 3f); if (num > 0f) { nextPlayerSwitchTime = Time.time + num * 60f; } } private void Update() { //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_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_01c2: 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_00a3: 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_00de: 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_009b: 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_0297: 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_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_013a: Unknown result type (might be due to invalid IL or missing references) //IL_013f: Unknown result type (might be due to invalid IL or missing references) //IL_0152: Unknown result type (might be due to invalid IL or missing references) //IL_02b3: Unknown result type (might be due to invalid IL or missing references) if (!initialized || state == PetState.Dead) { return; } UpdateDynamicSettings(); LogStateTransitions(); if ((Object)(object)agent != (Object)null && ((Behaviour)agent).enabled && agent.isOnNavMesh && !isJumping && !IsRecovering && state != PetState.Grabbed) { Vector3 nextPosition = agent.nextPosition; if (Vector3.Distance(((Component)this).transform.position, nextPosition) > 1.5f) { ((Component)this).transform.position = nextPosition; } else { float num = nextPosition.y + agent.baseOffset; float num2 = Mathf.Lerp(((Component)this).transform.position.y, num, Time.deltaTime * 15f); ((Component)this).transform.position = new Vector3(nextPosition.x, num2, nextPosition.z); } Vector3 desiredVelocity = agent.desiredVelocity; desiredVelocity.y = 0f; if (((Vector3)(ref desiredVelocity)).sqrMagnitude > 0.01f) { Quaternion val = Quaternion.LookRotation(((Vector3)(ref desiredVelocity)).normalized, Vector3.up); ((Component)this).transform.rotation = Quaternion.RotateTowards(((Component)this).transform.rotation, val, agent.angularSpeed * Time.deltaTime); } } if (PhotonNetwork.InRoom && !PhotonNetwork.OfflineMode && !PhotonNetwork.IsMasterClient) { if ((Object)(object)agent != (Object)null && ((Behaviour)agent).enabled) { ((Behaviour)agent).enabled = false; } if ((Object)(object)myRigidbody != (Object)null && !myRigidbody.isKinematic) { myRigidbody.velocity = Vector3.zero; myRigidbody.angularVelocity = Vector3.zero; myRigidbody.isKinematic = true; myRigidbody.useGravity = false; } UpdateAnimation(); return; } if ((Object)(object)myRigidbody != (Object)null && !myRigidbody.isKinematic && state != PetState.Grabbed && state != PetState.Stunned && !isJumping && !waitingToStandUp) { myRigidbody.isKinematic = true; myRigidbody.useGravity = false; } if ((Object)(object)agent != (Object)null && ((Behaviour)agent).enabled && !agent.isOnNavMesh && state != PetState.Grabbed && !isJumping && !IsRecovering) { NavMeshHit val2 = default(NavMeshHit); if (NavMesh.SamplePosition(((Component)this).transform.position, ref val2, 2.5f, -1)) { agent.Warp(((NavMeshHit)(ref val2)).position); } else { ((Behaviour)agent).enabled = false; } } if (state != PetState.Grabbed && !waitingToStandUp) { UpdateContinuousSurfaceOffset(); } if (IsGrabbedByAnyone(myGrabObject)) { HandleGrabbedState(); } else if (state == PetState.Grabbed) { HandleReleasedState(); } UpdateAnimation(); if (!IsRecovering && state != PetState.Grabbed && !isJumping) { TickMultiplayerOwnerSwitch(); TickAutoJump(); if (state == PetState.Stunned) { TickStun(); } else if (state == PetState.FollowOwner) { TickFollowOwner(); } else if (state == PetState.CarryItemToCart) { TickCarryItemToCart(); } else if (state == PetState.Petting) { TickPetting(); } } } private void HandleGrabbedState() { if (state != PetState.Grabbed) { if ((Object)(object)agent != (Object)null && ((Behaviour)agent).enabled) { if (agent.isOnNavMesh) { agent.isStopped = true; if (agent.hasPath) { agent.ResetPath(); } } ((Behaviour)agent).enabled = false; } if ((Object)(object)myRigidbody != (Object)null) { myRigidbody.isKinematic = false; myRigidbody.useGravity = true; myRigidbody.constraints = (RigidbodyConstraints)0; } DropItemAtFeet(); state = PetState.Grabbed; } grabbedReleaseTime = Time.time; waitingToStandUp = false; isStandingUp = false; stuckTimer = 0f; stuckHighTimer = 0f; } private void HandleReleasedState() { //IL_0139: 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_014b: 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_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_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_0199: 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_01b3: 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_01d3: 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) if (!waitingToStandUp && !isStandingUp && (Object)(object)myRigidbody != (Object)null && myRigidbody.isKinematic) { myRigidbody.isKinematic = false; myRigidbody.useGravity = true; myRigidbody.WakeUp(); } bool flag = CheckIsGrounded(); bool flag2 = Time.time - grabbedReleaseTime > 5f; if (!waitingToStandUp && !isStandingUp && (flag || flag2)) { waitingToStandUp = true; standUpTime = Time.time + ((PetSettings.StandUpDelay != null) ? PetSettings.StandUpDelay.Value : 1.5f); if ((Object)(object)myRigidbody != (Object)null && !myRigidbody.isKinematic) { myRigidbody.constraints = (RigidbodyConstraints)0; } } if (waitingToStandUp && Time.time >= standUpTime) { waitingToStandUp = false; isStandingUp = true; if ((Object)(object)myCapsule != (Object)null) { ((Collider)myCapsule).enabled = true; } Vector3 val = (((Object)(object)owner != (Object)null && ((Component)owner).gameObject.activeInHierarchy) ? (((Component)owner).transform.position - ((Component)this).transform.position) : ((Component)this).transform.forward); val.y = 0f; if (((Vector3)(ref val)).sqrMagnitude < 0.001f) { val = Vector3.forward; } Quaternion rotation = Quaternion.LookRotation(((Vector3)(ref val)).normalized, Vector3.up); ((Component)this).transform.rotation = rotation; if ((Object)(object)myRigidbody != (Object)null) { myRigidbody.velocity = Vector3.zero; myRigidbody.angularVelocity = Vector3.zero; myRigidbody.rotation = rotation; } EnsureGroundedAndNavMesh(); if ((Object)(object)agent != (Object)null && ((Behaviour)agent).enabled) { agent.nextPosition = ((Component)this).transform.position; } isStandingUp = false; state = PetState.FollowOwner; } } private bool IsGrabbedByAnyone(PhysGrabObject grabObj) { if ((Object)(object)grabObj == (Object)null) { return false; } if (Time.time < noGrabUntilTime) { return false; } if (grabObj.playerGrabbing != null && grabObj.playerGrabbing.Count > 0) { return true; } return grabObj.grabbed; } private void OnCollisionEnter(Collision collision) { //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_014d: 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_0103: 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) if ((PhotonNetwork.InRoom && !PhotonNetwork.IsMasterClient) || state == PetState.Grabbed || state == PetState.Dead || isJumping || (Object)(object)collision.rigidbody == (Object)null || collision.gameObject.layer == LayerMask.NameToLayer("Player") || collision.gameObject.layer == LayerMask.NameToLayer("PlayerOnlyCollision") || collision.rigidbody.mass < 0.2f) { return; } Vector3 velocity = collision.rigidbody.velocity; float sqrMagnitude = ((Vector3)(ref velocity)).sqrMagnitude; float num = ((PetSettings.KnockdownSpeedThreshold != null) ? PetSettings.KnockdownSpeedThreshold.Value : 2f); if (!(sqrMagnitude > 4f) || !(sqrMagnitude > num * num)) { return; } if ((Object)(object)agent != (Object)null && ((Behaviour)agent).enabled) { ((Behaviour)agent).enabled = false; } if ((Object)(object)myRigidbody != (Object)null) { if (!myRigidbody.isKinematic) { myRigidbody.velocity = Vector3.zero; myRigidbody.angularVelocity = Vector3.zero; } myRigidbody.isKinematic = false; myRigidbody.useGravity = true; myRigidbody.constraints = (RigidbodyConstraints)0; myRigidbody.AddForce(collision.rigidbody.velocity * 0.6f, (ForceMode)1); } DropItemAtFeet(); state = PetState.Grabbed; } private void UpdateDynamicSettings() { if ((Object)(object)myRigidbody != (Object)null) { float num = ((PetSettings.PetMass != null) ? PetSettings.PetMass.Value : 1.5f); if (Mathf.Abs(myRigidbody.mass - num) > 0.01f) { myRigidbody.mass = num; if ((Object)(object)myGrabObject != (Object)null) { myGrabObject.massOriginal = num; } } float num2 = ((PetSettings.AngularDrag != null) ? PetSettings.AngularDrag.Value : 0.5f); if (Mathf.Abs(myRigidbody.angularDrag - num2) > 0.01f) { myRigidbody.angularDrag = num2; } } if ((Object)(object)agent != (Object)null) { float num3 = ((state != PetState.CarryItemToCart) ? ((PetSettings.Speed != null) ? PetSettings.Speed.Value : 3.5f) : ((PetSettings.CarrySpeed != null) ? PetSettings.CarrySpeed.Value : 4f)); if (Mathf.Abs(agent.speed - num3) > 0.01f) { agent.speed = num3; } float num4 = ((state == PetState.CarryItemToCart) ? 120f : 28f); if (Mathf.Abs(agent.acceleration - num4) > 0.01f) { agent.acceleration = num4; } } } private int GetGroundMask() { return ~(LayerMask.GetMask(new string[3] { "Player", "PlayerOnlyCollision", "Ignore Raycast" }) | 0x4000 | (1 << LayerMask.NameToLayer("RoomVolume"))); } private bool CheckIsGrounded() { //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_0015: Unknown result type (might be due to invalid IL or missing references) //IL_001a: Unknown result type (might be due to invalid IL or missing references) //IL_001f: Unknown result type (might be due to invalid IL or missing references) //IL_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_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) int num = Physics.RaycastNonAlloc(((Component)this).transform.position + Vector3.up * 0.35f, Vector3.down, groundedRaycastHits, 0.75f, groundMask, (QueryTriggerInteraction)1); for (int i = 0; i < num; i++) { Collider collider = ((RaycastHit)(ref groundedRaycastHits[i])).collider; if ((Object)(object)collider != (Object)null && !((Component)collider).transform.IsChildOf(((Component)this).transform)) { return true; } } int num2 = Physics.OverlapSphereNonAlloc(((Component)this).transform.position + Vector3.up * 0.15f, 0.35f, groundedOverlapColliders, groundMask, (QueryTriggerInteraction)1); for (int j = 0; j < num2; j++) { Collider val = groundedOverlapColliders[j]; if ((Object)(object)val != (Object)null && !((Component)val).transform.IsChildOf(((Component)this).transform)) { return true; } } return false; } private void LateUpdate() { //IL_003a: 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_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_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_0118: Unknown result type (might be due to invalid IL or missing references) //IL_0122: Unknown result type (might be due to invalid IL or missing references) //IL_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_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_0144: 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_0174: 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_00c1: 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_0083: 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_01e4: 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_01ac: 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) if (state == PetState.Grabbed || (Object)(object)holdPoint == (Object)null) { return; } if ((Object)(object)carriedItem != (Object)null) { ((Component)carriedItem).transform.position = holdPoint.position; ((Component)carriedItem).transform.rotation = holdPoint.rotation; if ((Object)(object)carriedRigidbody != (Object)null) { if (!carriedRigidbody.isKinematic) { carriedRigidbody.velocity = Vector3.zero; carriedRigidbody.angularVelocity = Vector3.zero; carriedRigidbody.isKinematic = true; carriedRigidbody.useGravity = false; } carriedRigidbody.position = holdPoint.position; carriedRigidbody.rotation = holdPoint.rotation; } } else { if (!((Object)(object)carriedPlayerAvatar != (Object)null)) { return; } Vector3 position = ((Component)this).transform.position + ((Component)this).transform.forward * 0.4f + Vector3.up * 1.6f; Quaternion rotation = ((Component)this).transform.rotation; ((Component)carriedPlayerAvatar).transform.position = position; ((Component)carriedPlayerAvatar).transform.rotation = rotation; if ((Object)(object)carriedTumble != (Object)null) { ((Component)carriedTumble).transform.position = position; ((Component)carriedTumble).transform.rotation = rotation; } if ((Object)(object)carriedRigidbody != (Object)null) { if (!carriedRigidbody.isKinematic) { carriedRigidbody.velocity = Vector3.zero; carriedRigidbody.angularVelocity = Vector3.zero; carriedRigidbody.isKinematic = true; carriedRigidbody.useGravity = false; } carriedRigidbody.position = position; carriedRigidbody.rotation = rotation; } } } private void FixedUpdate() { } public void SetScaleMultiplier(float multiplier) { multiplier = Mathf.Clamp(multiplier, 0.1f, 5f); if (PhotonNetwork.InRoom) { ((Component)this).GetComponent<PhotonView>().RPC("SyncScaleRPC", (RpcTarget)3, new object[1] { multiplier }); } else { SyncScaleRPC(multiplier); } } [PunRPC] private void SyncScaleRPC(float multiplier) { //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Unknown result type (might be due to invalid IL or missing references) ((Component)this).transform.localScale = Vector3.one * multiplier; if ((Object)(object)agent != (Object)null) { agent.radius = 0.32f * multiplier; agent.height = 1.35f * multiplier; } if ((Object)(object)myGrabObject != (Object)null) { float num = 1.5f; myGrabObject.massOriginal = num * multiplier; if ((Object)(object)myRigidbody != (Object)null) { myRigidbody.mass = myGrabObject.massOriginal; } } } private void UpdateAnimation() { //IL_0054: Unknown result type (might be due to invalid IL or missing references) //IL_005a: Unknown result type (might be due to invalid IL or missing references) //IL_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_0072: 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_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_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) if (!((Object)(object)animator == (Object)null)) { Vector3 val; float sqrMagnitude; if ((Object)(object)agent != (Object)null && ((Behaviour)agent).enabled && agent.isOnNavMesh) { val = agent.velocity; sqrMagnitude = ((Vector3)(ref val)).sqrMagnitude; } else { Vector3 val2 = ((Component)this).transform.position - lastAnimPosition; val2.y = 0f; val = val2 / Mathf.Max(Time.deltaTime, 0.001f); sqrMagnitude = ((Vector3)(ref val)).sqrMagnitude; } lastAnimPosition = ((Component)this).transform.position; smoothedSpeedSqr = Mathf.Lerp(smoothedSpeedSqr, sqrMagnitude, Time.deltaTime * 8f); bool flag = state != PetState.Grabbed && state != PetState.Stunned && smoothedSpeedSqr > 0.05f; bool flag2 = state == PetState.Grabbed; bool flag3 = state == PetState.Stunned; bool flag4 = isJumping; animator.SetBool(IsBigHash, false); animator.SetBool(MovingHash, flag && !flag4); animator.SetBool(StandingHash, !flag && !flag2 && !flag3 && !flag4); animator.SetBool(ChasingHash, flag && !flag4); animator.SetBool(FallingHash, flag2); animator.SetBool(FlyingHash, flag4); animator.SetBool(LookingUnderHash, false); animator.SetBool(StunnedHash, flag3); } } private PlayerTumble GetPlayerTumble(PlayerAvatar player) { if ((Object)(object)player == (Object)null) { return null; } object? obj = AccessTools.Field(typeof(PlayerAvatar), "tumble")?.GetValue(player); return (PlayerTumble)(((obj is PlayerTumble) ? obj : null) ?? ((Component)player).GetComponentInChildren<PlayerTumble>()); } private Rigidbody GetTumbleRigidbody(PlayerTumble tumble) { if ((Object)(object)tumble == (Object)null) { return null; } object? obj = AccessTools.Field(typeof(PlayerTumble), "rb")?.GetValue(tumble); return (Rigidbody)(((obj is Rigidbody) ? obj : null) ?? ((Component)tumble).GetComponent<Rigidbody>()); } private bool IsTumbling(PlayerTumble tumble) { if ((Object)(object)tumble == (Object)null) { return false; } object obj = AccessTools.Field(typeof(PlayerTumble), "isTumbling")?.GetValue(tumble); bool flag = default(bool); int num; if (obj is bool) { flag = (bool)obj; num = 1; } else { num = 0; } return (byte)((uint)num & (flag ? 1u : 0u)) != 0; } private bool IsPlayerDisabled(PlayerAvatar player) { if ((Object)(object)player == (Object)null) { return true; } object obj = AccessTools.Field(typeof(PlayerAvatar), "isDisabled")?.GetValue(player); bool flag = default(bool); int num; if (obj is bool) { flag = (bool)obj; num = 1; } else { num = 0; } return (byte)((uint)num & (flag ? 1u : 0u)) != 0; } private void DisablePetImpactProcessing() { PhysGrabObjectImpactDetector component = ((Component)this).GetComponent<PhysGrabObjectImpactDetector>(); if ((Object)(object)component != (Object)null) { ((Behaviour)component).enabled = false; component.destroyDisable = true; component.playerHurtDisable = true; } } private void SnapToFloorSafely() { //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_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_0059: 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_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_008f: 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) if (!((Object)(object)agent != (Object)null) || (((Behaviour)agent).enabled && agent.isOnNavMesh)) { return; } RaycastHit val = default(RaycastHit); NavMeshHit val2 = default(NavMeshHit); if (Physics.Raycast(((Component)this).transform.position + Vector3.up * 0.3f, Vector3.down, ref val, 1.5f, LayerMask.op_Implicit(SemiFunc.LayerMaskGetVisionObstruct()))) { Vector3 position = ((Component)this).transform.position; position.y = ((RaycastHit)(ref val)).point.y; ((Component)this).transform.position = position; } else if (NavMesh.SamplePosition(((Component)this).transform.position, ref val2, 1.5f, -1)) { if (!IsNetworkClientOnly) { ((Behaviour)agent).enabled = true; } agent.Warp(((NavMeshHit)(ref val2)).position); } } private Vector3 GetStableDeliveryDestination(Vector3 destination) { //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_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_002f: Unknown result type (might be due to invalid IL or missing references) if (!hasLastDeliveryDestination || Vector3.SqrMagnitude(destination - lastDeliveryDestination) > 1f) { lastDeliveryDestination = destination; hasLastDeliveryDestination = true; } return lastDeliveryDestination; } private void ResetDeliveryDestination() { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0006: Unknown result type (might be due to invalid IL or missing references) lastDeliveryDestination = Vector3.zero; hasLastDeliveryDestination = false; } private static float HorizontalDistance(Vector3 a, Vector3 b) { //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) a.y = 0f; b.y = 0f; return Vector3.Distance(a, b); } public bool TryCarryPlayer(PlayerAvatar targetPlayer) { //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_01f2: Unknown result type (might be due to invalid IL or missing references) //IL_0202: Unknown result type (might be due to invalid IL or missing references) if (state == PetState.Dead || state == PetState.Grabbed || state == PetState.Stunned) { return false; } if (isDeliveryLocked || state == PetState.CarryItemToCart || (Object)(object)carriedItem != (Object)null || (Object)(object)carriedPlayerAvatar != (Object)null) { return false; } lockedApproachPoint = null; lockedApproachCartCenter = Vector3.zero; PlayerTumble playerTumble = GetPlayerTumble(targetPlayer); if ((Object)(object)targetPlayer == (Object)null || (Object)(object)playerTumble == (Object)null || !IsTumbling(playerTumble)) { return false; } if (PhotonNetwork.InRoom && !PhotonNetwork.IsMasterClient) { PhotonView photonView = targetPlayer.photonView; if ((Object)(object)photonView != (Object)null) { isDeliveryLocked = true; RepoSteamNetwork.SendPacket<PetCarryPlayerPacket>(new PetCarryPlayerPacket { PetViewID = ((Component)this).GetComponent<PhotonView>().ViewID, PlayerViewID = photonView.ViewID }, (NetworkDestination)0); ((MonoBehaviour)this).Invoke("UnlockDelivery", 1f); return true; } return false; } CreateHoldPoint(); carriedPlayerAvatar = targetPlayer; carriedTumble = playerTumble; carriedRigidbody = GetTumbleRigidbody(carriedTumble); SnapToFloorSafely(); Collider component = ((Component)this).GetComponent<Collider>(); carriedColliders = ((Component)carriedTumble).GetComponentsInChildren<Collider>(true); carriedOriginalTriggers = new bool[carriedColliders.Length]; carriedOriginalLayers = new int[carriedColliders.Length]; for (int i = 0; i < carriedColliders.Length; i++) { Collider val = carriedColliders[i]; if (!((Object)(object)val == (Object)null)) { carriedOriginalTriggers[i] = val.isTrigger; carriedOriginalLayers[i] = ((Component)val).gameObject.layer; ((Component)val).gameObject.layer = 2; MeshCollider val2 = (MeshCollider)(object)((val is MeshCollider) ? val : null); if (val2 == null || val2.convex) { val.isTrigger = true; } if ((Object)(object)component != (Object)null) { Physics.IgnoreCollision(component, val, true); } } } if ((Object)(object)carriedRigidbody != (Object)null) { carriedRigidbody.velocity = Vector3.zero; carriedRigidbody.angularVelocity = Vector3.zero; carriedRigidbody.isKinematic = true; carriedRigidbody.useGravity = false; } if (PetSpawner.IsShopContext()) { targetExtractionPoint = FindUsableExtractionPoint(isShopMode: true); } else { targetCart = FindNearestValidCart(); if ((Object)(object)targetCart == (Object)null) { targetExtractionPoint = FindUsableExtractionPoint(isShopMode: false); } } noGrabUntilTime = Time.time + 2f; state = PetState.CarryItemToCart; isDeliveryLocked = true; ResetDeliveryDestination(); if ((Object)(object)aiAudio != (Object)null) { aiAudio.PlayBark(); } if (PhotonNetwork.InRoom && PhotonNetwork.IsMasterClient) { PhotonView photonView2 = targetPlayer.photonView; if ((Object)(object)photonView2 != (Object)null) { RepoSteamNetwork.SendPacket<PetSyncCarryPacket>(new PetSyncCarryPacket { PetViewID = ((Component)this).GetComponent<PhotonView>().ViewID, TargetViewID = photonView2.ViewID, IsPlayer = true, IsPickingUp = true, InheritScale = false }, (NetworkDestination)4); } } return true; } private void ReleaseCarriedPlayer() { if (PhotonNetwork.InRoom && PhotonNetwork.IsMasterClient && (Object)(object)carriedPlayerAvatar != (Object)null && (Object)(object)carriedPlayerAvatar.photonView != (Object)null) { RepoSteamNetwork.SendPacket<PetSyncCarryPacket>(new PetSyncCarryPacket { PetViewID = ((Component)this).GetComponent<PhotonView>().ViewID, TargetViewID = carriedPlayerAvatar.photonView.ViewID, IsPlayer = true, IsPickingUp = false, InheritScale = false }, (NetworkDestination)4); } if ((Object)(object)carriedTumble != (Object)null) { Collider component = ((Component)this).GetComponent<Collider>(); if (carriedColliders != null) { for (int i = 0; i < carriedColliders.Length; i++) { if (!((Object)(object)carriedColliders[i] == (Object)null)) { carriedColliders[i].isTrigger = carriedOriginalTriggers != null && i < carriedOriginalTriggers.Length && carriedOriginalTriggers[i]; if (carriedOriginalLayers != null && i < carriedOriginalLayers.Length) { ((Component)carriedColliders[i]).gameObject.layer = carriedOriginalLayers[i]; } if ((Object)(object)component != (Object)null) { Physics.IgnoreCollision(component, carriedColliders[i], false); } } } } Rigidbody val = (((Object)(object)carriedRigidbody != (Object)null) ? carriedRigidbody : GetTumbleRigidbody(carriedTumble)); if ((Object)(object)val != (Object)null) { val.isKinematic = false; val.useGravity = true; } AccessTools.Method(typeof(PlayerTumble), "OverrideEnemyHurt", (Type[])null, (Type[])null)?.Invoke(carriedTumble, new object[1] { 1f }); } ClearCarryState(); } private Vector3 GetShopDeliveryPosition(Vector3 centerPoint, ExtractionPoint point) { //IL_018c: Unknown result type (might be due to invalid IL or missing references) //IL_018d: Unknown result type (might be due to invalid IL or missing references) //IL_0190: Unknown result type (might be due to invalid IL or missing references) //IL_01a2: Unknown result type (might be due to invalid IL or missing references) //IL_01ad: Unknown result type (might be due to invalid IL or missing references) //IL_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_0087: 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_00a2: 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_0170: 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_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_00f0: 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_0114: Unknown result type (might be due to invalid IL or missing references) //IL_0116: Unknown result type (might be due to invalid IL or missing references) //IL_0124: Unknown result type (might be due to invalid IL or missing references) //IL_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_012d: 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_013e: Unknown result type (might be due to invalid IL or missing references) //IL_0143: Unknown result type (might be due to invalid IL or missing references) //IL_014a: Unknown result type (might be due to invalid IL or missing references) //IL_014f: Unknown result type (might be due to invalid IL or missing references) //IL_0154: Unknown result type (might be due to invalid IL or missing references) //IL_015a: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)point != (Object)null) { Transform[] componentsInChildren = ((Component)point).GetComponentsInChildren<Transform>(true); Vector3 val2 = default(Vector3); Vector3 val3 = default(Vector3); Vector3 val4 = default(Vector3); foreach (Transform val in componentsInChildren) { if (((Object)val).name != "In Cart") { continue; } Collider component = ((Component)val).GetComponent<Collider>(); if ((Object)(object)component == (Object)null || !component.enabled) { continue; } Physics.SyncTransforms(); Bounds bounds = component.bounds; float num = Random.Range(-0.35f, 0.35f); float num2 = Random.Range(-0.35f, 0.35f); ((Vector3)(ref val2))..ctor(centerPoint.x + num, ((Bounds)(ref bounds)).min.y + 0.4f, centerPoint.z + num2); if (!((Bounds)(ref bounds)).Contains(val2)) { continue; } if (lastShopDeliveryPosition.HasValue) { ((Vector3)(ref val3))..ctor(val2.x, 0f, val2.z); ((Vector3)(ref val4))..ctor(lastShopDeliveryPosition.Value.x, 0f, lastShopDeliveryPosition.Value.z); if (Vector3.Distance(val3, val4) < 0.25f) { Vector3 val5 = val3 - val4; Vector3 normalized = ((Vector3)(ref val5)).normalized; val2 = lastShopDeliveryPosition.Value + normalized * 0.25f; val2.y = ((Bounds)(ref bounds)).min.y + 0.4f; } } lastShopDeliveryPosition = val2; return val2; } } Vector3 val6 = centerPoint; val6.y = centerPoint.y + 0.4f; lastShopDeliveryPosition = val6; return val6; } private void SetCartObstacleEnabled(PhysGrabCart cart, bool state) { if (!((Object)(object)cart == (Object)null)) { NavMeshObstacle val = ((Component)cart).GetComponent<NavMeshObstacle>() ?? ((Component)cart).GetComponentInChildren<NavMeshObstacle>(true); if ((Object)(object)val != (Object)null) { ((Behaviour)val).enabled = state; } } } private void SetCartCarving(PhysGrabCart cart, bool carvingState) { if (!((Object)(object)cart == (Object)null)) { NavMeshObstacle val = ((Component)cart).GetComponent<NavMeshObstacle>() ?? ((Component)cart).GetComponentInChildren<NavMeshObstacle>(true); if ((Object)(object)val != (Object)null) { val.carving = carvingState; } } } private string DebugPrivateField(string fieldName) { FieldInfo field = ((object)this).GetType().GetField(fieldName, BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic); if (field == null) { return fieldName + "=<missing>"; } object value = field.GetValue(this); if (value == null) { return fieldName + "=null"; } return fieldName + "=" + value.ToString(); } private unsafe void TickCarryItemToCart() { //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_009a: Unknown result type (might be due to invalid IL or missing references) //IL_009f: Unknown result type (might be due to invalid IL or missing references) //IL_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_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_00c7: Unknown result type (might be due to invalid IL or missing references) //IL_00c9: Unknown result type (might be due to invalid IL or missing references) //IL_00ce: Unknown result type (might be due to invalid IL or missing references) //IL_00d3: 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_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_011b: 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_0122: Unknown result type (might be due to invalid IL or missing references) //IL_0127: Unknown result type (might be due to invalid IL or missing references) //IL_0129: Unknown result type (might be due to invalid IL or missing references) //IL_012e: 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_0135: Unknown result type (might be due to invalid IL or missing references) //IL_0230: Unknown result type (might be due to invalid IL or missing references) //IL_0235: Unknown result type (might be due to invalid IL or missing references) //IL_09ef: Unknown result type (might be due to invalid IL or missing references) //IL_09f4: 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_0244: Unknown result type (might be due to invalid IL or missing references) //IL_0249: Unknown result type (might be due to invalid IL or missing references) //IL_0185: Unknown result type (might be due to invalid IL or missing references) //IL_018a: Unknown result type (might be due to invalid IL or missing references) //IL_019b: Unknown result type (might be due to invalid IL or missing references) //IL_01a0: Unknown result type (might be due to invalid IL or missing references) //IL_01b1: Unknown result type (might be due to invalid IL or missing references) //IL_01b6: Unknown result type (might be due to invalid IL or missing references) //IL_01be: 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_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_01f2: 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_09cf: Unknown result type (might be due to invalid IL or missing references) //IL_09df: Unknown result type (might be due to invalid IL or missing references) //IL_0a1e: Unknown result type (might be due to invalid IL or missing references) //IL_0a23: Unknown result type (might be due to invalid IL or missing references) //IL_02c5: Unknown result type (might be due to invalid IL or missing references) //IL_02ca: Unknown result type (might be due to invalid IL or missing references) //IL_02d7: Unknown result type (might be due to invalid IL or missing references) //IL_02dc: Unknown result type (might be due to invalid IL or missing references) //IL_02f6: Unknown result type (might be due to invalid IL or missing references) //IL_02f8: Unknown result type (might be due to invalid IL or missing references) //IL_027a: Unknown result type (might be due to invalid IL or missing references) //IL_027f: Unknown result type (might be due to invalid IL or missing references) //IL_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_02a6: 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_0adf: Unknown result type (might be due to invalid IL or missing references) //IL_0ae1: Unknown result type (might be due to invalid IL or missing references) //IL_0ae6: Unknown result type (might be due to invalid IL or missing references) //IL_0ae9: Unknown result type (might be due to invalid IL or missing references) //IL_0aeb: Unknown result type (might be due to invalid IL or missing references) //IL_0af0: Unknown result type (might be due to invalid IL or missing references) //IL_0af3: Unknown result type (might be due to invalid IL or missing references) //IL_0b05: Unknown result type (might be due to invalid IL or missing references) //IL_0b0a: Unknown result type (might be due to invalid IL or missing references) //IL_0b19: Unknown result type (might be due to invalid IL or missing references) //IL_0b1e: Unknown result type (might be due to invalid IL or missing references) //IL_0a86: Unknown result type (might be due to invalid IL or missing references) //IL_0a8b: Unknown result type (might be due to invalid IL or missing references) //IL_0a8f: Unknown result type (might be due to invalid IL or missing references) //IL_0a9b: Unknown result type (might be due to invalid IL or missing references) //IL_0aa0: Unknown result type (might be due to invalid IL or missing references) //IL_0aa4: Unknown result type (might be due to invalid IL or missing references) //IL_0ab6: Unknown result type (might be due to invalid IL or missing references) //IL_0abb: Unknown result type (might be due to invalid IL or missing references) //IL_0abf: Unknown result type (might be due to invalid IL or missing references) //IL_0b38: Unknown result type (might be due to invalid IL or missing references) //IL_0b3e: Invalid comparison between Unknown and I4 //IL_0400: Unknown result type (might be due to invalid IL or missing references) //IL_0405: Unknown result type (might be due to invalid IL or missing references) //IL_0421: Unknown result type (might be due to invalid IL or missing references) //IL_0426: Unknown result type (might be due to invalid IL or missing references) //IL_0c31: Unknown result type (might be due to invalid IL or missing references) //IL_0c36: Unknown result type (might be due to invalid IL or missing references) //IL_0c39: Unknown result type (might be due to invalid IL or missing references) //IL_0c3b: Unknown result type (might be due to invalid IL or missing references) //IL_0c40: Unknown result type (might be due to invalid IL or missing references) //IL_0c43: Unknown result type (might be due to invalid IL or missing references) //IL_0c45: Unknown result type (might be due to invalid IL or missing references) //IL_0c4a: Unknown result type (might be due to invalid IL or missing references) //IL_0c4d: Unknown result type (might be due to invalid IL or missing references) //IL_0c5f: Unknown result type (might be due to invalid IL or missing references) //IL_0c64: Unknown result type (might be due to invalid IL or missing references) //IL_0528: Unknown result type (might be due to invalid IL or missing references) //IL_0529: Unknown result type (might be due to invalid IL or missing references) //IL_057d: Unknown result type (might be due to invalid IL or missing references) //IL_057e: Unknown result type (might be due to invalid IL or missing references) //IL_05d5: Unknown result type (might be due to invalid IL or missing references) //IL_05d7: Unknown result type (might be due to invalid IL or missing references) //IL_060c: Unknown result type (might be due to invalid IL or missing references) //IL_060e: Unknown result type (might be due to invalid IL or missing references) //IL_062a: Unknown result type (might be due to invalid IL or missing references) //IL_062c: Unknown result type (might be due to invalid IL or missing references) //IL_0648: Unknown result type (might be due to invalid IL or missing references) //IL_064a: Unknown result type (might be due to invalid IL or missing references) //IL_071a: Unknown result type (might be due to invalid IL or missing references) //IL_071c: Unknown result type (might be due to invalid IL or missing references) //IL_0c7a: Unknown result type (might be due to invalid IL or missing references) //IL_0c82: Unknown result type (might be due to invalid IL or missing references) //IL_0c87: Unknown result type (might be due to invalid IL or missing references) //IL_0c8a: Unknown result type (might be due to invalid IL or missing references) //IL_091b: Unknown result type (might be due to invalid IL or missing references) //IL_091c: Unknown result type (might be due to invalid IL or missing references) //IL_0922: Unknown result type (might be due to invalid IL or missing references) //IL_0923: Unknown result type (might be due to invalid IL or missing references) //IL_049f: 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_04ac: Unknown result type (might be due to invalid IL or missing references) //IL_04b0: Unknown result type (might be due to invalid IL or missing references) //IL_04c2: Unknown result type (might be due to invalid IL or missing references) //IL_04cd: Unknown result type (might be due to invalid IL or missing references) //IL_04d2: Unknown result type (might be due to invalid IL or missing references) //IL_04d6: Unknown result type (might be due to invalid IL or missing references) //IL_0d18: Unknown result type (might be due to invalid IL or missing references) //IL_0d1d: Unknown result type (might be due to invalid IL or missing references) //IL_0d21: Unknown result type (might be due to invalid IL or missing references) //IL_0d2d: Unknown result type (might be due to invalid IL or missing references) //IL_0d32: Unknown result type (might be due to invalid IL or missing references) //IL_0d36: Unknown result type (might be due to invalid IL or missing references) //IL_0d48: Unknown result type (might be due to invalid IL or missing references) //IL_0d4d: Unknown result type (might be due to invalid IL or missing references) //IL_0d51: Unknown result type (might be due to invalid IL or missing references) //IL_0d61: Unknown result type (might be due to invalid IL or missing references) //IL_0d63: Unknown result type (might be due to invalid IL or missing references) //IL_0d68: Unknown result type (might be due to invalid IL or missing references) //IL_0d6b: Unknown result type (might be due to invalid IL or missing references) //IL_0d6d: Unknown result type (might be due to invalid IL or missing references) //IL_0d72: Unknown result type (might be due to invalid IL or missing references) //IL_0d75: Unknown result type (might be due to invalid IL or missing references) //IL_0d87: Unknown result type (might be due to invalid IL or missing references) //IL_0d8c: Unknown result type (might be due to invalid IL or missing references) //IL_0d9b: Unknown result type (might be due to invalid IL or missing references) //IL_0da0: Unknown result type (might be due to invalid IL or missing references) //IL_0dba: Unknown result type (might be due to invalid IL or missing references) //IL_0dc0: Invalid comparison between Unknown and I4 //IL_0e65: Unknown result type (might be due to invalid IL or missing references) //IL_0e6a: Unknown result type (might be due to invalid IL or missing references) //IL_0e6d: Unknown result type (might be due to invalid IL or missing references) //IL_0e6f: Unknown result type (might be due to invalid IL or missing references) //IL_0e74: Unknown result type (might be due to invalid IL or missing references) //IL_0e77: Unknown result type (might be due to invalid IL or missing references) //IL_0e79: Unknown result type (might be due to invalid IL or missing references) //IL_0e7e: Unknown result type (might be due to invalid IL or missing references) //IL_0e81: Unknown result type (might be due to invalid IL or missing references) //IL_0e93: Unknown result type (might be due to invalid IL or missing references) //IL_0e98: Unknown result type (might be due to invalid IL or missing references) //IL_0eb4: Unknown result type (might be due to invalid IL or missing references) //IL_0e05: Unknown result type (might be due to invalid IL or missing references) if (PetSettings.EnableCarryJitterLogs != null && PetSettings.EnableCarryJitterLogs.Value) { debugJitterTimer += Time.deltaTime; if (!debugJitterInitialized) { debugLastLogicPos = ((Component)this).transform.position; Transform val = (((Object)(object)animator != (Object)null) ? ((Component)animator).transform : ((Component)this).transform); debugLastVisualPos = val.position; debugLastSampleTime = Time.time; debugJitterInitialized = true; } if (debugJitterTimer >= 0.1f) { Vector3 position = ((Component)this).transform.position; Vector3 position2 = (((Object)(object)animator != (Object)null) ? ((Component)animator).transform : ((Component)this).transform).position; Vector3 val2 = position - debugLastLogicPos; Vector3 val3 = position2 - debugLastVisualPos; float num = Time.time - debugLastSampleTime; float num2 = 0f; if (num > 0.001f) { num2 = ((Vector3)(ref val2)).magnitude / num; } float num3 = 0f; float num4 = 0f; Vector3 val4 = Vector3.zero; Vector3 val5 = Vector3.zero; Vector3 val6 = Vector3.zero; Vector3 val7 = Vector3.zero; bool flag = false; bool flag2 = false; bool flag3 = false; bool flag4 = false; float num5 = 0f; float num6 = -1f; Vector3 val8; if ((Object)(object)agent != (Object)null) { flag = ((Behaviour)agent).enabled; if (((Behaviour)agent).enabled) { val8 = agent.velocity; num3 = ((Vector3)(ref val8)).magnitude; val4 = agent.desiredVelocity; num4 = ((Vector3)(ref val4)).magnitude; val5 = agent.destination; val6 = agent.nextPosition; val7 = agent.steeringTarget; flag3 = agent.isStopped; flag4 = agent.hasPath; num5 = Vector3.Distance(((Component)this).transform.position, agent.nextPosition); flag2 = agent.isOnNavMesh; if (agent.isOnNavMesh) { num6 = agent.remainingDistance; } } } Vector3 val9 = Vector3.zero; if (num > 0.001f) { val9 = val2 / num; } float num7 = -1f; float num8 = -1f; if ((Object)(object)agent != (Object)null && ((Behaviour)agent).enabled) { Vector3 position3 = ((Component)this).transform.position; Vector3 destination = agent.destination; position3.y = 0f; destination.y = 0f; num7 = Vector3.Distance(position3, destination); } if ((Object)(object)targetCart != (Object)null) { Vector3 position4 = ((Component)this).transform.position; Vector3 position5 = ((Component)targetCart).transform.position; position4.y = 0f; position5.y = 0f; num8 = Vector3.Distance(position4, position5); } Rigidbody val10 = carriedRigidbody; Collider component = ((Component)this).GetComponent<Collider>(); int num9 = 0; int num10 = 0; int num11 = 0; if (carriedColliders != null) { num9 = carriedColliders.Length; for (int i = 0; i < carriedColliders.Length; i++) { Collider val11 = carriedColliders[i]; if (!((Object)(object)val11 == (Object)null)) { if (val11.isTrigger) { num10++; } if ((Object)(object)component != (Object)null && Physics.GetIgnoreCollision(component, val11)) { num11++; } } } } string text = " CarriedRB=null CarriedColliders=" + num9 + " CarriedTriggers=" + num10 + " CarriedIgnored=" + num11; if ((Object)(object)val10 != (Object)null) { string[] obj = new string[12] { " CarriedRBKinematic=", val10.isKinematic.ToString(), " CarriedRBVelocity=", null, null, null, null, null, null, null, null, null }; val8 = val10.velocity; obj[3] = ((object)(*(Vector3*)(&val8))/*cast due to .constrained prefix*/).ToString(); obj[4] = " CarriedRBAngularVelocity="; val8 = val10.angularVelocity; obj[5] = ((object)(*(Vector3*)(&val8))/*cast due to .constrained prefix*/).ToString(); obj[6] = " CarriedColliders="; obj[7] = num9.ToString(); obj[8] = " CarriedTriggers="; obj[9] = num10.ToString(); obj[10] = " CarriedIgnored="; obj[11] = num11.ToString(); text = string.Concat(obj); } float num12 = 0f; float num13 = 0f; if ((Object)(object)agent != (Object)null && ((Behaviour)agent).enabled) { Vector3 val12 = val9; val8 = agent.desiredVelocity; num12 = Vector3.Dot(val12, ((Vector3)(ref val8)).normalized); Vector3 velocity = agent.velocity; val8 = agent.desiredVelocity; num13 = Vector3.Dot(velocity, ((Vector3)(ref val8)).normalized); } string[] array = new string[50]; array[0] = "[JitterLog] Time="; array[1] = Time.time.ToString("F3"); array[2] = " SampleDt="; array[3] = num.ToString("F3"); array[4] = " LogicPos="; val8 = position; array[5] = ((object)(*(Vector3*)(&val8))/*cast due to .constrained prefix*/).ToString(); array[6] = " LogicDelta="; array[7] = ((Vector3)(ref val2)).magnitude.ToString("F3"); array[8] = " MeasuredSpeed="; array[9] = num2.ToString("F3"); array[10] = " VisualPos="; val8 = position2; array[11] = ((object)(*(Vector3*)(&val8))/*cast due to .constrained prefix*/).ToString(); array[12] = " VisualDelta="; array[13] = ((Vector3)(ref val3)).magnitude.ToString("F3"); array[14] = " NavVel="; array[15] = num3.ToString("F3"); array[16] = " DesiredVel="; val8 = val4; array[17] = ((object)(*(Vector3*)(&val8))/*cast due to .constrained prefix*/).ToString(); array[18] = " DesiredSpeed="; array[19] = num4.ToString("F3"); array[20] = " NavDest="; val8 = val5; array[21] = ((object)(*(Vector3*)(&val8))/*cast due to .constrained prefix*/).ToString(); array[22] = " NavNext="; val8 = val6; array[23] = ((object)(*(Vector3*)(&val8))/*cast due to .constrained prefix*/).ToString(); array[24] = " SteeringTarget="; val8 = val7; array[25] = ((object)(*(Vector3*)(&val8))/*cast due to .constrained prefix*/).ToString(); array[26] = " Enabled="; array[27] = flag.ToString(); array[28] = " OnMesh="; array[29] = flag2.ToString(); array[30] = " Stopped="; array[31] = flag3.ToString(); array[32] = " HasPath="; array[33] = flag4.ToString(); array[34] = " AgentGap="; array[35] = num5.ToString("F3"); array[36] = " Remaining="; array[37] = num6.ToString("F3"); array[38] = " TargetDist="; array[39] = num7.ToString("F3"); array[40] = " CartDist="; array[41] = num8.ToString("F3"); array[42] = " MeasuredVelocity="; val8 = val9; array[43] = ((object)(*(Vector3*)(&val8))/*cast due to .constrained prefix*/).ToString(); array[44] = " MeasuredSpeed="; array[45] = ((Vector3)(ref val9)).magnitude.ToString("F3"); array[46] = " ForwardSpeed="; array[47] = num12.ToString("F3"); array[48] = " DesiredForwardSpeed="; array[49] = num13.ToString("F3"); string text2 = string.Concat(array); if ((Object)(object)agent != (Object)null) { text2 = text2 + " StopDist=" + agent.stoppingDistance.ToString("F3") + " Accel=" + agent.acceleration.ToString("F3") + " AngularSpeed=" + agent.angularSpeed.ToString("F3"); } text2 = text2 + " ApproachDist=" + cartApproachDistance.ToString("F3") + " DropDist=" + cartDropDistance.ToString("F3") + " " + DebugPrivateField("hasManualMoveTarget") + " " + DebugPrivateField("autoMovementSuspendedUntil") + " " + DebugPrivateField("lockedApproachPoint") + " " + DebugPrivateField("lockedApproachCartCenter") + " " + DebugPrivateField("lastDeliveryDestination") + " " + DebugPrivateField("hasLastDeliveryDestination") + " " + DebugPrivateField("isDeliveryLocked") + text; Plugin.Log.LogInfo((object)text2); debugLastLogicPos = position; debugLastVisualPos = position2; debugLastSampleTime = Time.time; debugJitterTimer = 0f; } } else { debugJitterInitialized = false; } if ((hasManualMoveTarget || Time.time < autoMovementSuspendedUntil) && TickManualMove()) { return; } Bounds bounds; if ((Object)(object)carriedPlayerAvatar != (Object)null) { if ((Object)(object)carriedTumble == (Object)null || !IsTumbling(carriedTumble) || IsPlayerDisabled(carriedPlayerAvatar)) { ReleaseCarriedPlayer(); state = PetState.FollowOwner; return; } if ((Object)(object)carriedRigidbody != (Object)null && !carriedRigidbody.isKinematic) { carriedRigidbody.velocity = Vector3.zero; carriedRigidbody.angularVelocity = Vector3.zero; } Vector3 val13 = ((Component)this).transform.position; if ((Object)(object)targetExtractionPoint != (Object)null && IsExtractionPointUsable(targetExtractionPoint, PetSpawner.IsShopContext())) { val13 = GetUnlockedExtractionCenter(targetExtractionPoint); } else { if (!((Object)(object)targetCart != (Object)null) || !((Component)targetCart).gameObject.activeInHierarchy) { ReleaseCarriedPlayer(); state = PetState.FollowOwner; return; } SetCartObstacleEnabled(targetCart, state: false); SetCartCarving(targetCart, carvingState: false); BoxCollider cartDepositArea = GetCartDepositArea(targetCart); if ((Object)(object)cartDepositArea != (Object)null) { bounds = ((Collider)cartDepositArea).bounds; float x = ((Bounds)(ref bounds)).center.x; bounds = ((Collider)cartDepositArea).bounds; float num14 = ((Bounds)(ref bounds)).min.y + 0.15f; bounds = ((Collider)cartDepositArea).bounds; ((Vector3)(ref val13))..ctor(x, num14, ((Bounds)(ref bounds)).center.z); } } Vector3 stableDeliveryDestination = GetStableDeliveryDestination(val13); Vector3 cartApproachPoint = GetCartApproachPoint(stableDeliveryDestination); MoveTo(cartApproachPoint, 1.2f); float num15 = HorizontalDistance(((Component)this).transform.position, val13); float num16 = HorizontalDistance(((Component)this).transform.position, cartApproachPoint); bool flag5 = ((Behaviour)agent).enabled && (int)agent.pathStatus == 1 && num15 <= cartDropDistance + 1f; if (num16 <= 1.2f || num15 <= cartDropDistance + 1f || flag5) { StopMoving(); ReleaseCarriedPlayer(); state = PetState.FollowOwner; } return; } bool flag6 = (Object)(object)carriedItem != (Object)null && carriedItem.playerGrabbing != null && carriedItem.playerGrabbing.Count > 0; if (Time.time < noGrabUntilTime) { flag6 = false; } if ((Object)(object)carriedItem == (Object)null || carriedItem.dead || flag6) { DropItemAtFeetSafe(); state = PetState.FollowOwner; return; } if (PetSpawner.IsShopContext()) { if ((Object)(object)targetExtractionPoint != (Object)null && IsExtractionPointUsable(targetExtractionPoint, isShop: true)) { Vector3 unlockedExtractionCenter = GetUnlockedExtractionCenter(targetExtractionPoint); Vector3 stableDeliveryDestination2 = GetStableDeliveryDestination(unlockedExtractionCenter); Vector3 cartApproachPoint2 = GetCartApproachPoint(stableDeliveryDestination2); MoveTo(cartApproachPoint2, 0.6f); if (HorizontalDistance(((Component)this).transform.position, cartApproachPoint2) <= shopDropDistance + 0.3f) { Vector3 shopDeliveryPosition = GetShopDeliveryPosition(unlockedExtractionCenter, targetExtractionPoint); ReleaseCarriedItem(shopDeliveryPosition, impulse: false); state = PetState.FollowOwner; } return; } } else { if ((Object)(object)targetCart == (Object)null || !((Component)targetCart).gameObject.activeInHierarchy) { targetCart = FindNearestValidCart(); } if ((Object)(object)targetCart != (Object)null && ((Component)targetCart).gameObject.activeInHierarchy) { SetCartObstacleEnabled(targetCart, state: false); BoxCollider cartDepositArea2 = GetCartDepositArea(targetCart); if ((Object)(object)cartDepositArea2 != (Object)null) { bounds = ((Collider)cartDepositArea2).bounds; float x2 = ((Bounds)(ref bounds)).center.x; bounds = ((Collider)cartDepositArea2).bounds; float num17 = ((Bounds)(ref bounds)).min.y + 0.15f; bounds = ((Collider)cartDepositArea2).bounds; Vector3 val14 = default(Vector3); ((Vector3)(ref val14))..ctor(x2, num17, ((Bounds)(ref bounds)).center.z); Vector3 stableDeliveryDestination3 = GetStableDeliveryDestination(val14); Vector3 cartApproachPoint3 = GetCartApproachPoint(stableDeliveryDestination3); MoveTo(cartApproachPoint3, 1.2f); float num18 = HorizontalDistance(((Component)this).transform.position, val14); float num19 = HorizontalDistance(((Component)this).transform.position, cartApproachPoint3); bool flag7 = ((Behaviour)agent).enabled && (int)agent.pathStatus == 1 && num18 <= cartDropDistance + 1f; if (num19 <= 1.2f || num18 <= cartDropDistance + 1f || flag7) { StopMoving(); DropItemInBounds(((Collider)cartDepositArea2).bounds); state = PetState.FollowOwner; } return; } } if ((Object)(object)targetExtractionPoint == (Object)null || !IsExtractionPointUsable(targetExtractionPoint, isShop: false)) { targetExtractionPoint = FindUsableExtractionPoint(isShopMode: false); } if ((Object)(object)targetExtractionPoint != (Object)null && IsExtractionPointUsable(targetExtractionPoint, isShop: false)) { Vector3 unlockedExtractionCenter2 = GetUnlockedExtractionCenter(targetExtractionPoint); Vector3 stableDeliveryDestination4 = GetStableDeliveryDestination(unlockedExtractionCenter2); Vector3 cartApproachPoint4 = GetCartApproachPoint(stableDeliveryDestination4); MoveTo(cartApproachPoint4, 0.6f); if (HorizontalDistance(((Component)this).transform.position, cartApproachPoint4) <= cartDropDistance + 0.5f) { StopMoving(); ReleaseCarriedItem(unlockedExtractionCenter2, impulse: false); state = PetState.FollowOwner; } return; } } DisablePetImpactProcessing(); DropItemAtFeetSafe(); state = PetState.FollowOwner; } private bool IsValidCarryableItem(PhysGrabObject item) { if ((Object)(object)item == (Object)null || (Object)(object)item == (Object)(object)myGrabObject) { return false; } if ((Object)(object)((Component)item).GetComponent<PhysGrabCart>() != (Object)null || (Object)(object)((Component)item).GetComponentInParent<PhysGrabCart>() != (Object)null) { return false; } if ((Object)(object)((Component)item).GetComponent<ValuableObject>() != (Object)null) { return true; } ItemAttributes component = ((Component)item).GetComponent<ItemAttributes>(); if ((Object)(object)component != (Object)null) { FieldInfo fieldInfo = AccessTools.Field(typeof(ItemAttributes), "shopItem"); bool flag = default(bool); int num; if (fieldInfo != null) { object value = fieldInfo.GetValue(component); if (value is bool) { flag = (bool)value; num = 1; } else { num = 0; } } else { num = 0; } _ = (uint)num & (flag ? 1u : 0u); return true; } if ((Object)(object)((Component)item).GetComponent("ItemAttributes") != (Object)null) { return true; } return false; } public bool TryGiveItem(PhysGrabObject item) { //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_008d: 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) if (state == PetState.Dead || state == PetState.Grabbed || state == PetState.Stunned) { return false; } if (isDeliveryLocked || state == PetState.CarryItemToCart || (Object)(object)carriedItem != (Object)null || (Object)(object)carriedPlayerAvatar != (Object)null)