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(); 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 list = new List(); AudioClip[] array = Resources.FindObjectsOfTypeAll(); 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(); 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 doorOpenCooldowns = new Dictionary(); 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 deadEndMemories = new List(); private readonly List ownerBreadcrumbs = new List(); private readonly RaycastHit[] surfaceHitsBuffer = (RaycastHit[])(object)new RaycastHit[15]; private readonly Collider[] overlapCollidersBuffer = (Collider[])(object)new Collider[16]; private readonly List chosenOwnersThisLevel = new List(); 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(); } 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(); } 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(); if ((Object)(object)agent == (Object)null) { agent = ((Component)this).gameObject.AddComponent(); } myGrabObject = ((Component)this).GetComponent(); myRigidbody = ((Component)this).GetComponent(); myCapsule = ((Component)this).GetComponent(); aiAudio = ((Component)this).GetComponent(); if ((Object)(object)aiAudio == (Object)null) { aiAudio = ((Component)this).gameObject.AddComponent(); } 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(); 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().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()); } 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()); } 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(); 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(new PetCarryPlayerPacket { PetViewID = ((Component)this).GetComponent().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(); carriedColliders = ((Component)carriedTumble).GetComponentsInChildren(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(new PetSyncCarryPacket { PetViewID = ((Component)this).GetComponent().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(new PetSyncCarryPacket { PetViewID = ((Component)this).GetComponent().ViewID, TargetViewID = carriedPlayerAvatar.photonView.ViewID, IsPlayer = true, IsPickingUp = false, InheritScale = false }, (NetworkDestination)4); } if ((Object)(object)carriedTumble != (Object)null) { Collider component = ((Component)this).GetComponent(); 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(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(); 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() ?? ((Component)cart).GetComponentInChildren(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() ?? ((Component)cart).GetComponentInChildren(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 + "="; } 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(); 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() != (Object)null || (Object)(object)((Component)item).GetComponentInParent() != (Object)null) { return false; } if ((Object)(object)((Component)item).GetComponent() != (Object)null) { return true; } ItemAttributes component = ((Component)item).GetComponent(); 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) { return false; } lockedApproachPoint = null; lockedApproachCartCenter = Vector3.zero; if ((Object)(object)item == (Object)null) { return false; } float num = ((PetSettings.GiveItemDistance != null) ? PetSettings.GiveItemDistance.Value : 4.5f); if (Vector3.Distance(((Component)this).transform.position, ((Component)item).transform.position) > num) { return false; } if (!IsValidCarryableItem(item)) { return false; } float num2 = ((PetSettings.MaxMass != null) ? PetSettings.MaxMass.Value : 3f); if (item.massOriginal > num2) { return false; } bool num3 = PetSpawner.IsShopContext(); PhysGrabCart val = (num3 ? null : FindNearestValidCart()); ExtractionPoint val2 = (num3 ? FindUsableExtractionPoint(isShopMode: true) : FindUsableExtractionPoint(isShopMode: false)); if ((Object)(object)val == (Object)null && (Object)(object)val2 == (Object)null) { return false; } if (PhotonNetwork.InRoom && !PhotonNetwork.IsMasterClient) { PhotonView component = ((Component)item).GetComponent(); if ((Object)(object)component != (Object)null && component.ViewID > 0) { isDeliveryLocked = true; RepoSteamNetwork.SendPacket(new PetGiveItemPacket { PetViewID = ((Component)this).GetComponent().ViewID, ItemViewID = component.ViewID }, (NetworkDestination)0); ((MonoBehaviour)this).Invoke("UnlockDelivery", 1f); return true; } return false; } if (!PickUpItem(item)) { return false; } PhotonView component2 = ((Component)item).GetComponent(); if ((Object)(object)component2 != (Object)null && !component2.IsMine) { component2.RequestOwnership(); } noGrabUntilTime = Time.time + 2f; targetCart = val; targetExtractionPoint = val2; state = PetState.CarryItemToCart; isDeliveryLocked = true; ResetDeliveryDestination(); if ((Object)(object)aiAudio != (Object)null) { aiAudio.PlayBark(); } return true; } private void UnlockDelivery() { isDeliveryLocked = false; } private static bool ReadBoolField(FieldInfo field, object source, bool fallback) { if (field == null || source == null) { return fallback; } try { return (field.GetValue(source) is bool flag) ? flag : fallback; } catch { return fallback; } } private bool IsExtractionPointUsable(ExtractionPoint point, bool isShop) { if ((Object)(object)point == (Object)null || !((Component)point).gameObject.activeInHierarchy || !((Behaviour)point).isActiveAndEnabled) { return false; } Transform[] componentsInChildren; if (isShop) { Transform val = null; componentsInChildren = ((Component)point).GetComponentsInChildren(true); foreach (Transform val2 in componentsInChildren) { if (((Object)val2).name == "In Cart") { val = val2; break; } } if ((Object)(object)val == (Object)null || !((Component)val).gameObject.activeInHierarchy) { return false; } Collider component = ((Component)val).GetComponent(); if ((Object)(object)component != (Object)null) { return component.enabled; } return false; } FieldInfo field = AccessTools.Field(typeof(ExtractionPoint), "isLocked"); FieldInfo field2 = AccessTools.Field(typeof(ExtractionPoint), "tubeHit"); FieldInfo field3 = AccessTools.Field(typeof(ExtractionPoint), "cancelExtraction"); FieldInfo field4 = AccessTools.Field(typeof(ExtractionPoint), "isCompletedRightAway"); FieldInfo field5 = AccessTools.Field(typeof(ExtractionPoint), "extractionSurplusCompleted"); if (ReadBoolField(field, point, fallback: true) || ReadBoolField(field2, point, fallback: true) || ReadBoolField(field3, point, fallback: true) || ReadBoolField(field4, point, fallback: true) || ReadBoolField(field5, point, fallback: true)) { return false; } Transform val3 = null; componentsInChildren = ((Component)point).GetComponentsInChildren(true); foreach (Transform val4 in componentsInChildren) { if (((Object)val4).name == "In Cart") { val3 = val4; break; } } if ((Object)(object)val3 == (Object)null || !((Component)val3).gameObject.activeInHierarchy) { return false; } Collider component2 = ((Component)val3).GetComponent(); if ((Object)(object)component2 != (Object)null) { return component2.enabled; } return false; } private ExtractionPoint FindUsableExtractionPoint(bool isShopMode) { //IL_0022: 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_0027: 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_0106: Unknown result type (might be due to invalid IL or missing references) //IL_010b: Unknown result type (might be due to invalid IL or missing references) //IL_010f: Unknown result type (might be due to invalid IL or missing references) //IL_0114: Unknown result type (might be due to invalid IL or missing references) PlayerAvatar val = SemiFunc.PlayerAvatarLocal(); Vector3 val2 = (((Object)(object)val != (Object)null) ? ((Component)val).transform.position : ((Component)this).transform.position); ExtractionPoint[] array = Object.FindObjectsOfType(true); FieldInfo fieldInfo = AccessTools.Field(typeof(ExtractionPoint), "isShop"); ExtractionPoint result = null; float num = float.MaxValue; ExtractionPoint[] array2 = array; foreach (ExtractionPoint val3 in array2) { if (!IsExtractionPointUsable(val3, isShopMode) || (fieldInfo != null && fieldInfo.GetValue(val3) is bool flag && flag != isShopMode)) { continue; } Transform val4 = null; Transform[] componentsInChildren = ((Component)val3).GetComponentsInChildren(true); foreach (Transform val5 in componentsInChildren) { if (((Object)val5).name == "In Cart") { val4 = val5; break; } } if ((Object)(object)val4 == (Object)null) { continue; } Collider component = ((Component)val4).GetComponent(); if (!((Object)(object)component == (Object)null) && component.enabled) { Physics.SyncTransforms(); Bounds bounds = component.bounds; float num2 = Vector3.SqrMagnitude(val2 - ((Bounds)(ref bounds)).center); if (num2 < num) { num = num2; result = val3; } } } return result; } private Vector3 GetUnlockedExtractionCenter(ExtractionPoint point) { //IL_000f: 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_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_005e: Unknown result type (might be due to invalid IL or missing references) //IL_0063: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_006d: Unknown result type (might be due to invalid IL or missing references) //IL_0071: Unknown result type (might be due to invalid IL or missing references) //IL_0086: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)point == (Object)null) { return ((Component)this).transform.position; } Transform[] componentsInChildren = ((Component)point).GetComponentsInChildren(true); foreach (Transform val in componentsInChildren) { if (!(((Object)val).name != "In Cart")) { Collider component = ((Component)val).GetComponent(); if (!((Object)(object)component == (Object)null) && component.enabled) { Physics.SyncTransforms(); Bounds bounds = component.bounds; Vector3 center = ((Bounds)(ref bounds)).center; bounds = component.bounds; center.y = ((Bounds)(ref bounds)).min.y + 0.4f; return center; } } } return ((Component)point).transform.position; } private void CreateHoldPoint() { //IL_0014: Unknown result type (might be due to invalid IL or missing references) //IL_001a: Expected O, but got Unknown //IL_004d: Unknown result type (might be due to invalid IL or missing references) //IL_005d: Unknown result type (might be due to invalid IL or missing references) //IL_006d: Unknown result type (might be due to invalid IL or missing references) if (!((Object)(object)holdPoint != (Object)null)) { GameObject val = new GameObject("AiChanHoldPoint"); holdPoint = val.transform; holdPoint.SetParent(((Component)this).transform, false); holdPoint.localPosition = new Vector3(0f, 1.45f, 0.1f); holdPoint.localRotation = Quaternion.identity; holdPoint.localScale = Vector3.one; } } private PhysGrabCart FindNearestValidCart() { //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_004f: 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) PhysGrabCart result = null; float num = float.MaxValue; PhysGrabCart[] array = Object.FindObjectsOfType(true); foreach (PhysGrabCart val in array) { if ((Object)(object)val == (Object)null || !((Component)val).gameObject.activeInHierarchy) { continue; } BoxCollider cartDepositArea = GetCartDepositArea(val); if (!((Object)(object)cartDepositArea == (Object)null)) { Bounds bounds = ((Collider)cartDepositArea).bounds; float num2 = Vector3.SqrMagnitude(((Bounds)(ref bounds)).center - ((Component)this).transform.position); if (num2 < num) { result = val; num = num2; } } } return result; } private BoxCollider GetCartDepositArea(PhysGrabCart cart) { if ((Object)(object)cart == (Object)null) { return null; } Transform val = ((Component)cart).transform.Find("In Cart"); if (!((Object)(object)val == (Object)null)) { return ((Component)val).GetComponent(); } return null; } private bool PickUpItem(PhysGrabObject item) { //IL_00ac: Unknown result type (might be due to invalid IL or missing references) //IL_00b1: Unknown result type (might be due to invalid IL or missing references) //IL_006d: Unknown result type (might be due to invalid IL or missing references) //IL_0073: Unknown result type (might be due to invalid IL or missing references) //IL_0244: Unknown result type (might be due to invalid IL or missing references) //IL_0254: Unknown result type (might be due to invalid IL or missing references) //IL_01ea: Unknown result type (might be due to invalid IL or missing references) //IL_01fa: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)carriedItem != (Object)null || (Object)(object)carriedPlayerAvatar != (Object)null) { return false; } if ((Object)(object)item == (Object)null) { return false; } if (item.playerGrabbing != null && item.playerGrabbing.Count > 0) { foreach (PhysGrabber item2 in new List(item.playerGrabbing)) { if ((Object)(object)item2 != (Object)null) { item2.ReleaseObjectRPC(false, 1f, -1, default(PhotonMessageInfo)); } } } CreateHoldPoint(); SnapToFloorSafely(); carriedItem = item; carriedOriginalScale = ((Component)item).transform.localScale; carriedInheritScale = PetSettings.InheritPetScaleOnCarry != null && PetSettings.InheritPetScaleOnCarry.Value; carriedRigidbody = ((Component)item).GetComponent(); carriedColliders = ((Component)item).GetComponentsInChildren(true); carriedOriginalTriggers = new bool[carriedColliders.Length]; carriedOriginalLayers = new int[carriedColliders.Length]; carriedWasKinematic = (Object)(object)carriedRigidbody != (Object)null && carriedRigidbody.isKinematic; Collider component = ((Component)this).GetComponent(); 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) { if (!carriedRigidbody.isKinematic) { carriedRigidbody.velocity = Vector3.zero; carriedRigidbody.angularVelocity = Vector3.zero; } carriedRigidbody.isKinematic = true; carriedRigidbody.useGravity = false; } if ((Object)(object)item != (Object)null) { ((Behaviour)item).enabled = false; } ((Component)item).transform.SetParent(holdPoint, false); ((Component)item).transform.localPosition = Vector3.zero; ((Component)item).transform.localRotation = Quaternion.identity; ApplyCarriedItemScale(item, carriedInheritScale); if (PhotonNetwork.InRoom && PhotonNetwork.IsMasterClient) { PhotonView component2 = ((Component)item).GetComponent(); if ((Object)(object)component2 != (Object)null) { RepoSteamNetwork.SendPacket(new PetSyncCarryPacket { PetViewID = ((Component)this).GetComponent().ViewID, TargetViewID = component2.ViewID, IsPlayer = false, IsPickingUp = true, InheritScale = carriedInheritScale }, (NetworkDestination)4); } } return true; } private void ApplyCarriedItemScale(PhysGrabObject item, bool inheritScale) { //IL_0104: Unknown result type (might be due to invalid IL or missing references) //IL_0109: Unknown result type (might be due to invalid IL or missing references) //IL_0110: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Unknown result type (might be due to invalid IL or missing references) //IL_001c: Unknown result type (might be due to invalid IL or missing references) //IL_0021: Unknown result type (might be due to invalid IL or missing references) //IL_0026: Unknown result type (might be due to invalid IL or missing references) //IL_0029: Unknown result type (might be due to invalid IL or missing references) //IL_0040: Unknown result type (might be due to invalid IL or missing references) //IL_0057: Unknown result type (might be due to invalid IL or missing references) //IL_0072: Unknown result type (might be due to invalid IL or missing references) //IL_0077: Unknown result type (might be due to invalid IL or missing references) //IL_007e: 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_0098: Unknown result type (might be due to invalid IL or missing references) //IL_009e: Unknown result type (might be due to invalid IL or missing references) //IL_013c: Unknown result type (might be due to invalid IL or missing references) //IL_00a5: Unknown result type (might be due to invalid IL or missing references) //IL_0161: Unknown result type (might be due to invalid IL or missing references) //IL_00bf: Unknown result type (might be due to invalid IL or missing references) //IL_00c5: Unknown result type (might be due to invalid IL or missing references) //IL_0168: Unknown result type (might be due to invalid IL or missing references) //IL_00cc: 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_00e6: Unknown result type (might be due to invalid IL or missing references) //IL_00ec: Unknown result type (might be due to invalid IL or missing references) //IL_0194: 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) if (!((Object)(object)item == (Object)null)) { if (inheritScale) { Vector3 val = Vector3.Scale(carriedOriginalScale, ((Component)this).transform.localScale); val.x = Mathf.Max(val.x, 0.01f); val.y = Mathf.Max(val.y, 0.01f); val.z = Mathf.Max(val.z, 0.01f); Vector3 lossyScale = ((Component)this).transform.lossyScale; ((Component)item).transform.localScale = new Vector3((lossyScale.x > 0.0001f) ? (val.x / lossyScale.x) : carriedOriginalScale.x, (lossyScale.y > 0.0001f) ? (val.y / lossyScale.y) : carriedOriginalScale.y, (lossyScale.z > 0.0001f) ? (val.z / lossyScale.z) : carriedOriginalScale.z); } else { Vector3 lossyScale2 = ((Component)this).transform.lossyScale; ((Component)item).transform.localScale = new Vector3((lossyScale2.x > 0.0001f) ? (carriedOriginalScale.x / lossyScale2.x) : carriedOriginalScale.x, (lossyScale2.y > 0.0001f) ? (carriedOriginalScale.y / lossyScale2.y) : carriedOriginalScale.y, (lossyScale2.z > 0.0001f) ? (carriedOriginalScale.z / lossyScale2.z) : carriedOriginalScale.z); } } } private Vector3 GetCartApproachPoint(Vector3 centerPoint) { //IL_0032: Unknown result type (might be due to invalid IL or missing references) //IL_0037: Unknown result type (might be due to invalid IL or missing references) //IL_0038: Unknown result type (might be due to invalid IL or missing references) //IL_003d: Unknown result type (might be due to invalid IL or missing references) //IL_000d: Unknown result type (might be due to invalid IL or missing references) //IL_000f: Unknown result type (might be due to invalid IL or missing references) //IL_0069: Unknown result type (might be due to invalid IL or missing references) //IL_006c: Unknown result type (might be due to invalid IL or missing references) //IL_007d: Unknown result type (might be due to invalid IL or missing references) //IL_0082: Unknown result type (might be due to invalid IL or missing references) //IL_005e: Unknown result type (might be due to invalid IL or missing references) //IL_0063: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_0026: Unknown result type (might be due to invalid IL or missing references) //IL_0101: Unknown result type (might be due to invalid IL or missing references) //IL_0098: Unknown result type (might be due to invalid IL or missing references) //IL_009f: Unknown result type (might be due to invalid IL or missing references) //IL_00a9: Unknown result type (might be due to invalid IL or missing references) //IL_00ae: Unknown result type (might be due to invalid IL or missing references) //IL_0137: 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_0144: Unknown result type (might be due to invalid IL or missing references) //IL_0149: Unknown result type (might be due to invalid IL or missing references) //IL_0118: Unknown result type (might be due to invalid IL or missing references) //IL_0128: Unknown result type (might be due to invalid IL or missing references) //IL_0129: Unknown result type (might be due to invalid IL or missing references) //IL_0130: Unknown result type (might be due to invalid IL or missing references) //IL_00d9: Unknown result type (might be due to invalid IL or missing references) //IL_00c5: Unknown result type (might be due to invalid IL or missing references) //IL_00e9: Unknown result type (might be due to invalid IL or missing references) //IL_00ea: Unknown result type (might be due to invalid IL or missing references) //IL_00f5: Unknown result type (might be due to invalid IL or missing references) if (lockedApproachPoint.HasValue && Vector3.Distance(centerPoint, lockedApproachCartCenter) < 1f) { return lockedApproachPoint.Value; } Vector3 val = ((Component)this).transform.position - centerPoint; val.y = 0f; if (((Vector3)(ref val)).sqrMagnitude < 0.01f) { val = -((Component)this).transform.forward; } NavMeshHit val2 = default(NavMeshHit); if (NavMesh.SamplePosition(centerPoint + ((Vector3)(ref val)).normalized * (cartApproachDistance + 0.5f), ref val2, 3.5f, -1)) { NavMeshHit val3 = default(NavMeshHit); if (NavMesh.SamplePosition(((NavMeshHit)(ref val2)).position + ((Vector3)(ref val)).normalized * 0.35f, ref val3, 1.5f, -1)) { lockedApproachPoint = ((NavMeshHit)(ref val3)).position; } else { lockedApproachPoint = ((NavMeshHit)(ref val2)).position; } lockedApproachCartCenter = centerPoint; return lockedApproachPoint.Value; } NavMeshHit val4 = default(NavMeshHit); if (NavMesh.SamplePosition(((Component)this).transform.position, ref val4, 3.5f, -1)) { lockedApproachPoint = ((NavMeshHit)(ref val4)).position; lockedApproachCartCenter = centerPoint; return ((NavMeshHit)(ref val4)).position; } lockedApproachPoint = centerPoint; lockedApproachCartCenter = centerPoint; return centerPoint; } private void DropItemInBounds(Bounds bounds) { //IL_0004: Unknown result type (might be due to invalid IL or missing references) //IL_0010: Unknown result type (might be due to invalid IL or missing references) //IL_0022: Unknown result type (might be due to invalid IL or missing references) //IL_0032: Unknown result type (might be due to invalid IL or missing references) Vector3 point = default(Vector3); ((Vector3)(ref point))..ctor(((Bounds)(ref bounds)).center.x, ((Bounds)(ref bounds)).max.y + 0.05f, ((Bounds)(ref bounds)).center.z); ReleaseCarriedItem(point, impulse: false); } private void DropItemAtFeetSafe() { DisablePetImpactProcessing(); if ((Object)(object)carriedItem == (Object)null && (Object)(object)carriedPlayerAvatar == (Object)null) { ClearCarryState(); return; } try { DropItemAtFeet(); } catch (Exception ex) { Plugin.Log.LogWarning((object)("[Ai-Chan] Falha ao soltar item: " + ex.Message)); ClearCarryState(); } } private void DropItemAtFeet() { //IL_002b: Unknown result type (might be due to invalid IL or missing references) //IL_0036: Unknown result type (might be due to invalid IL or missing references) //IL_0040: Unknown result type (might be due to invalid IL or missing references) //IL_0045: Unknown result type (might be due to invalid IL or missing references) //IL_004a: Unknown result type (might be due to invalid IL or missing references) //IL_0054: Unknown result type (might be due to invalid IL or missing references) //IL_0059: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)carriedPlayerAvatar != (Object)null) { ReleaseCarriedPlayer(); } else if (!((Object)(object)carriedItem == (Object)null)) { ReleaseCarriedItem(((Component)this).transform.position + ((Component)this).transform.forward * 0.5f + Vector3.up * 0.2f, impulse: false); } } private void ReleaseCarriedItem(Vector3 point, bool impulse) { //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_00f9: 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_0119: Unknown result type (might be due to invalid IL or missing references) //IL_011a: Unknown result type (might be due to invalid IL or missing references) //IL_011e: 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_014e: Unknown result type (might be due to invalid IL or missing references) //IL_016a: Unknown result type (might be due to invalid IL or missing references) //IL_017b: 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_0195: Unknown result type (might be due to invalid IL or missing references) //IL_0245: Unknown result type (might be due to invalid IL or missing references) //IL_024f: Unknown result type (might be due to invalid IL or missing references) bool flag = carriedInheritScale; if (PhotonNetwork.InRoom && PhotonNetwork.IsMasterClient && (Object)(object)carriedItem != (Object)null) { PhotonView component = ((Component)carriedItem).GetComponent(); if ((Object)(object)component != (Object)null) { RepoSteamNetwork.SendPacket(new PetSyncCarryPacket { PetViewID = ((Component)this).GetComponent().ViewID, TargetViewID = component.ViewID, IsPlayer = false, IsPickingUp = false, InheritScale = flag }, (NetworkDestination)4); } } PhysGrabObject val = carriedItem; Vector3 val2 = carriedOriginalScale; Rigidbody val3 = carriedRigidbody; Collider[] array = carriedColliders; bool[] array2 = carriedOriginalTriggers; int[] array3 = carriedOriginalLayers; bool flag2 = carriedWasKinematic; Collider component2 = ((Component)this).GetComponent(); ClearCarryState(); if ((Object)(object)val == (Object)null) { return; } ((Behaviour)val).enabled = true; PhysGrabObjectImpactDetector component3 = ((Component)val).GetComponent(); if ((Object)(object)component3 != (Object)null) { component3.playerHurtDisable = true; } ((Component)val).transform.SetParent((Transform)null, true); ((Component)val).transform.position = point; ((Component)val).transform.rotation = Quaternion.identity; ((Behaviour)val).enabled = true; if (!flag) { Vector3 val4 = val2; val4.x = Mathf.Max(val4.x, 0.01f); val4.y = Mathf.Max(val4.y, 0.01f); val4.z = Mathf.Max(val4.z, 0.01f); ((Component)val).transform.localScale = val4; } if ((Object)(object)val3 != (Object)null) { val3.position = point; if (!val3.isKinematic) { val3.velocity = Vector3.zero; val3.angularVelocity = Vector3.zero; } val3.isKinematic = flag2; val3.useGravity = !flag2; } if (array != null) { for (int i = 0; i < array.Length; i++) { if (!((Object)(object)array[i] == (Object)null)) { array[i].isTrigger = array2 != null && i < array2.Length && array2[i]; if (array3 != null && i < array3.Length) { ((Component)array[i]).gameObject.layer = array3[i]; } if ((Object)(object)component2 != (Object)null) { Physics.IgnoreCollision(component2, array[i], false); } } } } Physics.SyncTransforms(); if (impulse && (Object)(object)val3 != (Object)null && !val3.isKinematic) { val3.AddForce(Vector3.down * 1.5f, (ForceMode)1); } } private void ClearCarryState() { //IL_002a: Unknown result type (might be due to invalid IL or missing references) //IL_002f: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)targetCart != (Object)null) { SetCartObstacleEnabled(targetCart, state: true); } isDeliveryLocked = false; carriedItem = null; carriedOriginalScale = Vector3.one; carriedInheritScale = false; carriedPlayerAvatar = null; carriedTumble = null; carriedRigidbody = null; carriedColliders = null; carriedOriginalTriggers = null; carriedOriginalLayers = null; carriedWasKinematic = false; targetCart = null; targetExtractionPoint = null; lockedApproachPoint = null; } public void NetworkSyncCarry(int targetViewID, bool isPlayer, bool isPickingUp, bool inheritScale) { if (PhotonNetwork.IsMasterClient) { return; } PhotonView photonView = PhotonNetwork.GetPhotonView(targetViewID); if ((Object)(object)photonView == (Object)null) { return; } if (isPickingUp) { CreateHoldPoint(); if (isPlayer) { PlayerAvatar component = ((Component)photonView).GetComponent(); if ((Object)(object)component != (Object)null) { ClientSidePickUpPlayer(component); } } else { PhysGrabObject component2 = ((Component)photonView).GetComponent(); if ((Object)(object)component2 != (Object)null) { ClientSidePickUpItem(component2, inheritScale); } } } else { ClientSideDrop(inheritScale); } } private void ClientSidePickUpItem(PhysGrabObject item, bool inheritScale) { //IL_0014: Unknown result type (might be due to invalid IL or missing references) //IL_0019: Unknown result type (might be due to invalid IL or missing references) //IL_00a3: Unknown result type (might be due to invalid IL or missing references) //IL_00b3: Unknown result type (might be due to invalid IL or missing references) //IL_0052: Unknown result type (might be due to invalid IL or missing references) //IL_0062: Unknown result type (might be due to invalid IL or missing references) CreateHoldPoint(); carriedItem = item; carriedOriginalScale = ((Component)item).transform.localScale; carriedInheritScale = inheritScale; carriedRigidbody = ((Component)item).GetComponent(); if ((Object)(object)carriedRigidbody != (Object)null) { if (!carriedRigidbody.isKinematic) { carriedRigidbody.velocity = Vector3.zero; carriedRigidbody.angularVelocity = Vector3.zero; } carriedRigidbody.isKinematic = true; carriedRigidbody.useGravity = false; } ((Behaviour)item).enabled = false; ((Component)item).transform.SetParent(holdPoint, false); ((Component)item).transform.localPosition = Vector3.zero; ((Component)item).transform.localRotation = Quaternion.identity; ApplyCarriedItemScale(item, carriedInheritScale); Collider component = ((Component)this).GetComponent(); carriedColliders = ((Component)item).GetComponentsInChildren(true); carriedOriginalTriggers = new bool[carriedColliders.Length]; carriedOriginalLayers = new int[carriedColliders.Length]; for (int i = 0; i < carriedColliders.Length; i++) { if (!((Object)(object)carriedColliders[i] == (Object)null)) { carriedOriginalTriggers[i] = carriedColliders[i].isTrigger; carriedOriginalLayers[i] = ((Component)carriedColliders[i]).gameObject.layer; ((Component)carriedColliders[i]).gameObject.layer = 2; Collider obj = carriedColliders[i]; MeshCollider val = (MeshCollider)(object)((obj is MeshCollider) ? obj : null); if (val == null || val.convex) { carriedColliders[i].isTrigger = true; } if ((Object)(object)component != (Object)null) { Physics.IgnoreCollision(component, carriedColliders[i], true); } } } } public void ForceDropItem() { if (state == PetState.CarryItemToCart || (Object)(object)carriedItem != (Object)null || (Object)(object)carriedPlayerAvatar != (Object)null) { DropItemAtFeetSafe(); state = PetState.FollowOwner; if ((Object)(object)aiAudio != (Object)null) { aiAudio.PlayBark(); } Plugin.Log.LogInfo((object)"[Ai-Chan] Item largado à força por comando do Dono!"); } } private void ClientSidePickUpPlayer(PlayerAvatar targetPlayer) { CreateHoldPoint(); carriedPlayerAvatar = targetPlayer; carriedTumble = GetPlayerTumble(targetPlayer); carriedRigidbody = GetTumbleRigidbody(carriedTumble); if ((Object)(object)targetPlayer == (Object)(object)SemiFunc.PlayerAvatarLocal() && (Object)(object)carriedRigidbody != (Object)null) { carriedWasKinematic = carriedRigidbody.isKinematic; carriedRigidbody.isKinematic = true; carriedRigidbody.useGravity = false; } Collider component = ((Component)this).GetComponent(); if (!((Object)(object)carriedTumble != (Object)null)) { return; } carriedColliders = ((Component)carriedTumble).GetComponentsInChildren(true); carriedOriginalTriggers = new bool[carriedColliders.Length]; carriedOriginalLayers = new int[carriedColliders.Length]; for (int i = 0; i < carriedColliders.Length; i++) { if (!((Object)(object)carriedColliders[i] == (Object)null)) { carriedOriginalTriggers[i] = carriedColliders[i].isTrigger; carriedOriginalLayers[i] = ((Component)carriedColliders[i]).gameObject.layer; ((Component)carriedColliders[i]).gameObject.layer = 2; Collider obj = carriedColliders[i]; MeshCollider val = (MeshCollider)(object)((obj is MeshCollider) ? obj : null); if (val == null || val.convex) { carriedColliders[i].isTrigger = true; } if ((Object)(object)component != (Object)null) { Physics.IgnoreCollision(component, carriedColliders[i], true); } } } } private void ClientSideDrop(bool inheritScale) { //IL_0136: Unknown result type (might be due to invalid IL or missing references) //IL_013b: Unknown result type (might be due to invalid IL or missing references) //IL_013e: 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_016c: Unknown result type (might be due to invalid IL or missing references) //IL_018c: Unknown result type (might be due to invalid IL or missing references) Collider component = ((Component)this).GetComponent(); 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); } } } } if ((Object)(object)carriedPlayerAvatar == (Object)(object)SemiFunc.PlayerAvatarLocal() && (Object)(object)carriedRigidbody != (Object)null) { carriedRigidbody.isKinematic = carriedWasKinematic; carriedRigidbody.useGravity = !carriedWasKinematic; } else if ((Object)(object)carriedItem != (Object)null && (Object)(object)carriedRigidbody != (Object)null) { ((Behaviour)carriedItem).enabled = true; ((Component)carriedItem).transform.SetParent((Transform)null, true); if (!inheritScale) { Vector3 val = carriedOriginalScale; val.x = Mathf.Max(val.x, 0.01f); val.y = Mathf.Max(val.y, 0.01f); val.z = Mathf.Max(val.z, 0.01f); ((Component)carriedItem).transform.localScale = val; } } ClearCarryState(); } private void EnsureBeepAudioSource() { //IL_0016: Unknown result type (might be due to invalid IL or missing references) //IL_001c: Expected O, but got Unknown //IL_0034: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)countdownAudioSource == (Object)null) { GameObject val = new GameObject("AiChan_Countdown_Audio"); val.transform.SetParent(((Component)this).transform, false); val.transform.localPosition = Vector3.zero; countdownAudioSource = val.AddComponent(); countdownAudioSource.playOnAwake = false; countdownAudioSource.loop = false; countdownAudioSource.spatialBlend = 1f; countdownAudioSource.minDistance = 3f; countdownAudioSource.maxDistance = 40f; countdownAudioSource.rolloffMode = (AudioRolloffMode)1; countdownAudioSource.dopplerLevel = 0f; } if (!searchedForBeepClip || (Object)(object)cachedBeepClip == (Object)null) { searchedForBeepClip = true; AudioClip[] source = Resources.FindObjectsOfTypeAll(); cachedBeepClip = ((IEnumerable)source).FirstOrDefault((Func)((AudioClip c) => (Object)(object)c != (Object)null && ((Object)c).name.Equals("item explosive mine warning beeps", StringComparison.OrdinalIgnoreCase))) ?? ((IEnumerable)source).FirstOrDefault((Func)((AudioClip c) => (Object)(object)c != (Object)null && ((Object)c).name.Equals("grenade countdown", StringComparison.OrdinalIgnoreCase))) ?? ((IEnumerable)source).FirstOrDefault((Func)((AudioClip c) => (Object)(object)c != (Object)null && ((Object)c).name.Equals("item explosive mine arm beep", StringComparison.OrdinalIgnoreCase))) ?? ((IEnumerable)source).FirstOrDefault((Func)((AudioClip c) => (Object)(object)c != (Object)null && ((Object)c).name.Equals("snd_dirt_tracker_beep", StringComparison.OrdinalIgnoreCase))); } if ((Object)(object)cachedBeepClip != (Object)null) { countdownAudioSource.clip = cachedBeepClip; } } private void PlayCountdownBeep(float pitch = 1f) { EnsureBeepAudioSource(); if ((Object)(object)countdownAudioSource != (Object)null && (Object)(object)cachedBeepClip != (Object)null) { countdownAudioSource.pitch = pitch; countdownAudioSource.PlayOneShot(cachedBeepClip, 0.95f); } } public void StartExplodeCountdown(float delay, bool fromNetwork = false) { if (state == PetState.Dead) { return; } if (delay < 0f) { CancelExplodeCountdown(fromNetwork: true); return; } if (!fromNetwork && PhotonNetwork.InRoom) { PhotonView component = ((Component)this).GetComponent(); if ((Object)(object)component != (Object)null) { RepoSteamNetwork.SendPacket(new PetExplodePacket { PetViewID = component.ViewID, Delay = delay }, (NetworkDestination)4); } } if (delay == 0f) { Explode(fromNetwork); return; } if (explodeCountdownCoroutine != null) { ((MonoBehaviour)this).StopCoroutine(explodeCountdownCoroutine); } explodeCountdownCoroutine = ((MonoBehaviour)this).StartCoroutine(ExplodeCountdownRoutine(delay)); } public void CancelExplodeCountdown(bool fromNetwork = false) { if (explodeCountdownCoroutine != null) { ((MonoBehaviour)this).StopCoroutine(explodeCountdownCoroutine); explodeCountdownCoroutine = null; } HideCountdownTag(); if ((Object)(object)countdownAudioSource != (Object)null) { countdownAudioSource.Stop(); } if (!fromNetwork && PhotonNetwork.InRoom) { PhotonView component = ((Component)this).GetComponent(); if ((Object)(object)component != (Object)null) { RepoSteamNetwork.SendPacket(new PetExplodePacket { PetViewID = component.ViewID, Delay = -1f }, (NetworkDestination)4); } } Plugin.Log.LogInfo((object)"[Ai-Chan] Explosion countdown cancelled."); } private IEnumerator ExplodeCountdownRoutine(float totalSeconds) { EnsureCountdownTagCreated(); EnsureBeepAudioSource(); float remaining = totalSeconds; float nextBeepTime = 0f; while (remaining > 0f) { if (state == PetState.Dead) { HideCountdownTag(); yield break; } if ((Object)(object)countdownTextMesh != (Object)null) { countdownTextMesh.text = $"⚠\ufe0f {remaining:F1}s ⚠\ufe0f"; } if (Time.time >= nextBeepTime) { float num = 1f - remaining / Mathf.Max(totalSeconds, 0.01f); float num2 = Mathf.Lerp(0.85f, 0.18f, num); float pitch = Mathf.Lerp(1.05f, 1.45f, num); PlayCountdownBeep(pitch); nextBeepTime = Time.time + num2; } remaining -= Time.deltaTime; yield return null; } HideCountdownTag(); explodeCountdownCoroutine = null; Explode(fromNetwork: true); } private void EnsureCountdownTagCreated() { //IL_0017: Unknown result type (might be due to invalid IL or missing references) //IL_0021: Expected O, but got Unknown //IL_0052: Unknown result type (might be due to invalid IL or missing references) //IL_00a8: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)countdownTagObject == (Object)null) { countdownTagObject = new GameObject("AiChanCountdownTag"); countdownTagObject.transform.SetParent(((Component)this).transform, false); countdownTagObject.transform.localPosition = new Vector3(0f, 1.95f, 0f); countdownTextMesh = countdownTagObject.AddComponent(); countdownTextMesh.fontSize = 42; countdownTextMesh.characterSize = 0.045f; countdownTextMesh.alignment = (TextAlignment)1; countdownTextMesh.anchor = (TextAnchor)4; countdownTextMesh.color = Color.red; countdownTagObject.AddComponent(); } countdownTagObject.SetActive(true); } private void HideCountdownTag() { if ((Object)(object)countdownTagObject != (Object)null) { countdownTagObject.SetActive(false); } } public void Explode(bool fromNetwork = false) { //IL_00f4: 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_014e: Unknown result type (might be due to invalid IL or missing references) //IL_0153: Unknown result type (might be due to invalid IL or missing references) //IL_015d: Unknown result type (might be due to invalid IL or missing references) //IL_0162: Unknown result type (might be due to invalid IL or missing references) //IL_0167: Unknown result type (might be due to invalid IL or missing references) //IL_016b: Unknown result type (might be due to invalid IL or missing references) //IL_0170: Unknown result type (might be due to invalid IL or missing references) //IL_0178: 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_018d: Unknown result type (might be due to invalid IL or missing references) //IL_019a: Unknown result type (might be due to invalid IL or missing references) if (state == PetState.Dead) { return; } HideCountdownTag(); if (explodeCountdownCoroutine != null) { ((MonoBehaviour)this).StopCoroutine(explodeCountdownCoroutine); explodeCountdownCoroutine = null; } if (!fromNetwork && PhotonNetwork.InRoom) { PhotonView component = ((Component)this).GetComponent(); if ((Object)(object)component != (Object)null) { RepoSteamNetwork.SendPacket(new PetExplodePacket { PetViewID = component.ViewID, Delay = 0f }, (NetworkDestination)4); } } DropItemAtFeet(); StopMoving(); float num = ((PetSettings.ExplosionForce != null) ? PetSettings.ExplosionForce.Value : 4f); float num2 = ((PetSettings.ExplosionRadius != null) ? PetSettings.ExplosionRadius.Value : 1.2f); SpawnNativeExplosion(num2, num); if (!PhotonNetwork.InRoom || PhotonNetwork.OfflineMode || PhotonNetwork.IsMasterClient) { if ((Object)(object)agent != (Object)null && ((Behaviour)agent).enabled) { ((Behaviour)agent).enabled = false; } ApplyPhysicalExplosionImpulse(((Component)this).transform.position, num2 * 2.5f, num); if ((Object)(object)myRigidbody != (Object)null) { myRigidbody.isKinematic = false; myRigidbody.useGravity = true; myRigidbody.constraints = (RigidbodyConstraints)0; float num3 = 4f * num; Vector3 val = Vector3.up * 1.8f + Random.insideUnitSphere * 0.4f; Vector3 normalized = ((Vector3)(ref val)).normalized; myRigidbody.AddForce(normalized * num3, (ForceMode)1); myRigidbody.AddTorque(Random.insideUnitSphere * (num3 * 1.5f), (ForceMode)1); } float num4 = ((PetSettings.StandUpDelay != null) ? PetSettings.StandUpDelay.Value : 2f) + 3f; state = PetState.Stunned; stunEndsAt = Time.time + num4; Plugin.Log.LogInfo((object)$"[Ai-Chan] KABOOM! Explosion executed (Radius: {num2:F1}m, Force: {num:F1}x)."); } } private void ApplyPhysicalExplosionImpulse(Vector3 epicenter, float radius, float forceMulti) { //IL_0000: 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) Collider[] array = Physics.OverlapSphere(epicenter, radius); HashSet hashSet = new HashSet(); foreach (Collider val in array) { if (!((Object)(object)val == (Object)null) && !((Component)val).transform.IsChildOf(((Component)this).transform)) { Rigidbody val2 = ((Component)val).GetComponentInParent() ?? val.attachedRigidbody; if ((Object)(object)val2 != (Object)null && !val2.isKinematic && !hashSet.Contains(val2)) { hashSet.Add(val2); val2.AddExplosionForce(forceMulti * 60f, epicenter, radius, 1.2f, (ForceMode)1); } } } } private void SpawnNativeExplosion(float radius, float force) { //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_019a: 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_02b7: Unknown result type (might be due to invalid IL or missing references) //IL_02bd: Unknown result type (might be due to invalid IL or missing references) //IL_0345: Unknown result type (might be due to invalid IL or missing references) //IL_0385: Unknown result type (might be due to invalid IL or missing references) //IL_0167: Unknown result type (might be due to invalid IL or missing references) Vector3 position = ((Component)this).transform.position; int num = ((PetSettings.ExplosionPlayerDamage != null) ? PetSettings.ExplosionPlayerDamage.Value : 75); int num2 = ((PetSettings.ExplosionEnemyDamage != null) ? PetSettings.ExplosionEnemyDamage.Value : 160); float num3 = radius * 1.25f; ParticleScriptExplosion val = ((IEnumerable)Resources.FindObjectsOfTypeAll()).FirstOrDefault((Func)((ParticleScriptExplosion p) => (Object)(object)p != (Object)null && (Object)(object)p.explosionPreset != (Object)null)); if ((Object)(object)val == (Object)null) { ItemGrenadeExplosive val2 = Resources.FindObjectsOfTypeAll().FirstOrDefault(); if ((Object)(object)val2 != (Object)null) { val = ((Component)val2).GetComponent(); } } ParticlePrefabExplosion val3 = null; if ((Object)(object)val != (Object)null) { object? obj = AccessTools.Field(typeof(ParticleScriptExplosion), "explosionPrefab")?.GetValue(val); GameObject val4 = (GameObject)((obj is GameObject) ? obj : null); if ((Object)(object)val4 == (Object)null) { val4 = Resources.Load("Effects/Part Prefab Explosion"); AccessTools.Field(typeof(ParticleScriptExplosion), "explosionPrefab")?.SetValue(val, val4); } if ((Object)(object)owner != (Object)null) { AccessTools.Field(typeof(ParticleScriptExplosion), "playerCausingHurtOverride")?.SetValue(val, owner); } AccessTools.Field(typeof(ParticleScriptExplosion), "playerHitFullRuckusOverride")?.SetValue(val, true); val3 = val.Spawn(position, num3, num, num2, force, false, false, 1f); } else { GameObject val5 = Resources.Load("Effects/Part Prefab Explosion"); if ((Object)(object)val5 != (Object)null) { val3 = Object.Instantiate(val5, position, Quaternion.identity).GetComponent(); if ((Object)(object)val3 != (Object)null) { AccessTools.Field(typeof(ParticlePrefabExplosion), "explosionSize")?.SetValue(val3, num3); AccessTools.Field(typeof(ParticlePrefabExplosion), "explosionDamage")?.SetValue(val3, num); AccessTools.Field(typeof(ParticlePrefabExplosion), "explosionDamageEnemy")?.SetValue(val3, num2); val3.forceMultiplier = force; if ((Object)(object)owner != (Object)null) { AccessTools.Field(typeof(ParticlePrefabExplosion), "playerCausingHurt")?.SetValue(val3, owner); } AccessTools.Field(typeof(ParticlePrefabExplosion), "playerHitFullRuckus")?.SetValue(val3, true); } } } if ((Object)(object)val3 != (Object)null && (Object)(object)val3.HurtCollider != (Object)null) { ((Component)val3.HurtCollider).transform.localScale = Vector3.one * num3; val3.HurtCollider.physHitForce = (float)num * 0.5f * force; HurtCollider hurtCollider = val3.HurtCollider; hurtCollider.playerHitForce *= force; Physics.SyncTransforms(); } if ((Object)(object)GameDirector.instance != (Object)null) { float num4 = radius * 3f; CameraShake cameraImpact = GameDirector.instance.CameraImpact; if (cameraImpact != null) { cameraImpact.ShakeDistance(10f * Mathf.Clamp(force * 0.25f, 0.5f, 3f), num4 * 0.5f, num4, position, 0.2f); } CameraShake cameraShake = GameDirector.instance.CameraShake; if (cameraShake != null) { cameraShake.ShakeDistance(5f * Mathf.Clamp(force * 0.25f, 0.5f, 3f), num4 * 0.5f, num4, position, 0.5f); } } } private void TickPetting() { if (state == PetState.Petting) { StopMoving(); if (!(Time.time < petEndsAt) && state == PetState.Petting) { state = ((stateBeforePetting == PetState.Dead || stateBeforePetting == PetState.Grabbed) ? PetState.FollowOwner : stateBeforePetting); } } } private void CacheHeartVfx() { if (heartVfxCached) { return; } heartVfxCached = true; if ((Object)(object)visualRoot == (Object)null) { return; } MonoBehaviour[] componentsInChildren = ((Component)visualRoot).GetComponentsInChildren(true); foreach (MonoBehaviour val in componentsInChildren) { if (!((Object)(object)val == (Object)null) && !(((object)val).GetType().Name != "EnemyElsaAnim")) { MethodInfo method = ((object)val).GetType().GetMethod("VFXPetParticles", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic); if (!(method == null)) { nativePetVfxComponent = val; nativePetVfxMethod = method; return; } } } fallbackHeartParticleSystems = ((Component)visualRoot).GetComponentsInChildren(true); } public void Pet() { if (state != PetState.Dead && state != PetState.Grabbed && state != PetState.Stunned && state != PetState.Petting) { stateBeforePetting = state; state = PetState.Petting; petEndsAt = Time.time + petDuration; StopMoving(); if ((Object)(object)aiAudio != (Object)null) { aiAudio.PlayBark(); } if ((Object)(object)animator != (Object)null) { animator.ResetTrigger(PetTriggerHash); animator.SetTrigger(PetTriggerHash); } TriggerHeartParticles(); if (PhotonNetwork.InRoom) { RepoSteamNetwork.SendPacket(new PetSyncPettingPacket { PetViewID = ((Component)this).GetComponent().ViewID }, (NetworkDestination)4); } } } public void PetFromNetwork() { if (state != PetState.Dead && state != PetState.Grabbed && state != PetState.Stunned && state != PetState.Petting) { stateBeforePetting = state; state = PetState.Petting; petEndsAt = Time.time + petDuration; StopMoving(); if ((Object)(object)aiAudio != (Object)null) { aiAudio.PlayBark(); } if ((Object)(object)animator != (Object)null) { animator.ResetTrigger(PetTriggerHash); animator.SetTrigger(PetTriggerHash); } TriggerHeartParticles(); } } private void TriggerHeartParticles() { CacheHeartVfx(); if ((Object)(object)nativePetVfxComponent != (Object)null && nativePetVfxMethod != null) { try { nativePetVfxMethod.Invoke(nativePetVfxComponent, null); Plugin.LogDebug(Plugin.LogCategory.AiInteract, "Native VFXPetParticles executed."); return; } catch (Exception ex) { Plugin.Log.LogWarning((object)("[Ai-Chan] Fail to execute VFXPetParticles: " + ex.Message)); nativePetVfxComponent = null; nativePetVfxMethod = null; } } if (fallbackHeartParticleSystems == null) { return; } for (int i = 0; i < fallbackHeartParticleSystems.Length; i++) { ParticleSystem val = fallbackHeartParticleSystems[i]; if (!((Object)(object)val == (Object)null)) { if (!((Component)val).gameObject.activeSelf) { ((Component)val).gameObject.SetActive(true); } val.Play(true); } } } public void TakeDamage(float damage, Vector3 forceDirection, float pushForce = 5f, float stunDuration = 2f) { //IL_008a: Unknown result type (might be due to invalid IL or missing references) //IL_008c: Unknown result type (might be due to invalid IL or missing references) if (state == PetState.Dead) { return; } currentHealth -= damage; DropItemAtFeet(); Plugin.LogDebug(Plugin.LogCategory.AiInteract, $"Damage received: {damage} | Health: {currentHealth}/{maxHealth}"); if (currentHealth <= 0f) { MarkDead(); return; } if ((Object)(object)myRigidbody != (Object)null) { myRigidbody.isKinematic = false; myRigidbody.useGravity = true; myRigidbody.AddForce(forceDirection * pushForce, (ForceMode)1); } state = PetState.Stunned; stunEndsAt = Time.time + stunDuration; StopMoving(); } private void TickStun() { StopMoving(); if (!(Time.time < stunEndsAt)) { isPlayingDead = false; if ((Object)(object)myRigidbody != (Object)null) { myRigidbody.isKinematic = true; myRigidbody.useGravity = false; myRigidbody.constraints = (RigidbodyConstraints)80; } if (SnapToNavMesh()) { state = PetState.FollowOwner; } } } public void MarkDead() { DropItemAtFeet(); StopMoving(); state = PetState.Dead; if ((Object)(object)myRigidbody != (Object)null) { myRigidbody.isKinematic = false; myRigidbody.useGravity = true; } } private void LogNavMeshTransition(bool toNavMesh, string reason) { if (PetSettings.EnableDebugLogs != null && PetSettings.EnableDebugLogs.Value) { Plugin.Log.LogInfo((object)("[Ai-Chan] [NavMesh] " + (toNavMesh ? "ENTROU na NavMesh" : "SAIU da NavMesh (Controle Manual)") + " | Motivo: " + reason)); } } private bool IsDoor(Collider col) { if ((Object)(object)col == (Object)null) { return false; } if ((Object)(object)((Component)col).GetComponentInParent() != (Object)null || (Object)(object)((Component)col).GetComponentInChildren(true) != (Object)null) { return true; } if ((Object)(object)((Component)col).GetComponentInParent() != (Object)null || (Object)(object)((Component)col).GetComponentInParent() != (Object)null) { return true; } string text = ((Object)((Component)col).gameObject).name.ToLower(); if (text.Contains("door") || text.Contains("porta") || text.Contains("gate") || text.Contains("hinge")) { return true; } return false; } private bool IsColliderPlayerOrItem(Collider col) { if ((Object)(object)col == (Object)null || col.isTrigger) { return true; } if (((Component)col).transform.IsChildOf(((Component)this).transform)) { return true; } int layer = ((Component)col).gameObject.layer; if (layer == LayerMask.NameToLayer("Player") || layer == LayerMask.NameToLayer("PlayerOnlyCollision") || layer == 14) { return true; } if ((Object)(object)((Component)col).GetComponentInParent() != (Object)null) { return true; } if ((Object)(object)((Component)col).GetComponentInParent() != (Object)null) { return true; } if ((Object)(object)((Component)col).GetComponentInParent() != (Object)null) { return true; } if ((Object)(object)((Component)col).GetComponentInParent() != (Object)null) { return true; } if (IsDoor(col)) { return true; } return false; } private bool IsDoorClosed(PhysGrabHinge hinge) { if ((Object)(object)hinge == (Object)null || DoorClosedField == null) { return false; } try { return Convert.ToBoolean(DoorClosedField.GetValue(hinge)); } catch { return false; } } private void TryOpenNearbyDoors() { //IL_0061: 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) if (DoorOpenMethod == null || Time.time < nextDoorCheckTime) { return; } nextDoorCheckTime = Time.time + 0.35f; PhysGrabHinge val = null; float num = 2.2f; PhysGrabHinge[] array = Object.FindObjectsOfType(); foreach (PhysGrabHinge val2 in array) { if (!((Object)(object)val2 == (Object)null) && IsDoorClosed(val2)) { float num2 = Vector3.Distance(((Component)this).transform.position, ((Component)val2).transform.position); if (num2 < num) { num = num2; val = val2; } } } if ((Object)(object)val == (Object)null) { return; } int instanceID = ((Object)val).GetInstanceID(); if (doorOpenCooldowns.TryGetValue(instanceID, out var value) && Time.time < value) { return; } doorOpenCooldowns[instanceID] = Time.time + 2f; try { PhysGrabObject componentInParent = ((Component)val).GetComponentInParent(); if ((Object)(object)componentInParent != (Object)null) { componentInParent.EnemyInteractTimeSet(); } DoorOpenMethod.Invoke(val, null); } catch (Exception ex) { Plugin.Log.LogWarning((object)("[Ai-Chan] Erro ao abrir porta: " + ex.Message)); } } private void ResolvePenetrations() { //IL_0046: Unknown result type (might be due to invalid IL or missing references) //IL_0051: Unknown result type (might be due to invalid IL or missing references) //IL_0056: Unknown result type (might be due to invalid IL or missing references) //IL_005b: Unknown result type (might be due to invalid IL or missing references) //IL_0062: Unknown result type (might be due to invalid IL or missing references) //IL_0063: Unknown result type (might be due to invalid IL or missing references) //IL_0079: 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_00b5: Unknown result type (might be due to invalid IL or missing references) //IL_00da: Unknown result type (might be due to invalid IL or missing references) //IL_00e1: Unknown result type (might be due to invalid IL or missing references) //IL_00e7: Unknown result type (might be due to invalid IL or missing references) //IL_00ec: Unknown result type (might be due to invalid IL or missing references) //IL_00f1: Unknown result type (might be due to invalid IL or missing references) //IL_00f9: Unknown result type (might be due to invalid IL or missing references) //IL_00ff: Unknown result type (might be due to invalid IL or missing references) //IL_0104: Unknown result type (might be due to invalid IL or missing references) //IL_0109: Unknown result type (might be due to invalid IL or missing references) //IL_0113: Unknown result type (might be due to invalid IL or missing references) //IL_0115: 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_0166: 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_0180: Unknown result type (might be due to invalid IL or missing references) //IL_0197: Unknown result type (might be due to invalid IL or missing references) //IL_019c: Unknown result type (might be due to invalid IL or missing references) //IL_01a0: Unknown result type (might be due to invalid IL or missing references) //IL_01a5: Unknown result type (might be due to invalid IL or missing references) if (state == PetState.CarryItemToCart) { return; } if ((Object)(object)myCapsule == (Object)null) { myCapsule = ((Component)this).GetComponent(); } if ((Object)(object)myCapsule == (Object)null || !((Collider)myCapsule).enabled) { return; } Vector3 val = Vector3.Scale(myCapsule.center, ((Component)this).transform.lossyScale); Vector3 val2 = ((Component)this).transform.TransformPoint(val); float num = myCapsule.radius * Mathf.Max(Mathf.Abs(((Component)this).transform.lossyScale.x), Mathf.Abs(((Component)this).transform.lossyScale.z)); float num2 = myCapsule.height * Mathf.Abs(((Component)this).transform.lossyScale.y); float num3 = Mathf.Max(0f, num2 * 0.5f - num); Vector3 val3 = val2 - ((Component)this).transform.up * num3; Vector3 val4 = val2 + ((Component)this).transform.up * num3; int num4 = GetGroundMask(); int num5 = Physics.OverlapCapsuleNonAlloc(val3, val4, num, overlapCollidersBuffer, num4, (QueryTriggerInteraction)1); Vector3 val6 = default(Vector3); float num6 = default(float); for (int i = 0; i < num5; i++) { Collider val5 = overlapCollidersBuffer[i]; if (!((Object)(object)val5 == (Object)null) && !IsColliderPlayerOrItem(val5) && Physics.ComputePenetration((Collider)(object)myCapsule, ((Component)this).transform.position, ((Component)this).transform.rotation, val5, ((Component)val5).transform.position, ((Component)val5).transform.rotation, ref val6, ref num6)) { Transform transform = ((Component)this).transform; transform.position += val6 * num6; } } } public void CommandMoveTo(Vector3 worldPoint, float suspendDuration = 0f) { //IL_001c: Unknown result type (might be due to invalid IL or missing references) //IL_004a: Unknown result type (might be due to invalid IL or missing references) //IL_004f: Unknown result type (might be due to invalid IL or missing references) //IL_0036: Unknown result type (might be due to invalid IL or missing references) //IL_00aa: Unknown result type (might be due to invalid IL or missing references) if (state == PetState.Dead || state == PetState.Grabbed || state == PetState.Stunned) { return; } NavMeshHit val = default(NavMeshHit); if (!NavMesh.SamplePosition(worldPoint, ref val, 2f, -1)) { Plugin.Log.LogWarning((object)$"[Ai-Chan] Destino manual sem NavMesh: {worldPoint}"); return; } manualMoveTarget = ((NavMeshHit)(ref val)).position; hasManualMoveTarget = true; manualMoveEndsAt = Time.time + 12f; if (suspendDuration > 0f) { autoMovementSuspendedUntil = Time.time + suspendDuration; } isCalledByOwner = false; awayTimer = 0f; lockedApproachPoint = null; Plugin.Log.LogInfo((object)$"[Ai-Chan] Destino manual: {manualMoveTarget}"); if ((Object)(object)aiAudio != (Object)null) { aiAudio.PlayBark(); } } public void CancelManualMove() { hasManualMoveTarget = false; manualMoveEndsAt = 0f; StopMoving(); } private bool TickManualMove() { //IL_003a: Unknown result type (might be due to invalid IL or missing references) //IL_004a: Unknown result type (might be due to invalid IL or missing references) //IL_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) bool flag = Time.time < autoMovementSuspendedUntil; if (!hasManualMoveTarget) { if (flag) { StopMoving(); return true; } return false; } if (Time.time >= manualMoveEndsAt) { CancelManualMove(); return flag; } MoveTo(manualMoveTarget, 0.3f); Vector3 val = manualMoveTarget - ((Component)this).transform.position; val.y = 0f; if (((Vector3)(ref val)).sqrMagnitude <= 0.09f) { hasManualMoveTarget = false; StopMoving(); } return true; } private bool CheckPathClear(Vector3 p1, Vector3 p2, float radius, Vector3 dir, float dist, int mask, out RaycastHit safeHit) { //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_000b: Unknown result type (might be due to invalid IL or missing references) //IL_0034: Unknown result type (might be due to invalid IL or missing references) //IL_0039: Unknown result type (might be due to invalid IL or missing references) //IL_0063: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_006c: Unknown result type (might be due to invalid IL or missing references) //IL_007c: Unknown result type (might be due to invalid IL or missing references) //IL_0092: Unknown result type (might be due to invalid IL or missing references) //IL_00a1: Unknown result type (might be due to invalid IL or missing references) //IL_00cb: Unknown result type (might be due to invalid IL or missing references) //IL_00cd: Unknown result type (might be due to invalid IL or missing references) safeHit = default(RaycastHit); int num = Physics.CapsuleCastNonAlloc(p1, p2, radius, dir, surfaceHitsBuffer, dist, mask, (QueryTriggerInteraction)1); bool result = false; float num2 = float.MaxValue; for (int i = 0; i < num; i++) { RaycastHit val = surfaceHitsBuffer[i]; if (!((Object)(object)((RaycastHit)(ref val)).collider == (Object)null) && !IsColliderPlayerOrItem(((RaycastHit)(ref val)).collider)) { Bounds bounds = ((RaycastHit)(ref val)).collider.bounds; if (!(((Bounds)(ref bounds)).max.y - ((Component)this).transform.position.y < 0.18f * ((Component)this).transform.localScale.y) && !(Mathf.Abs(((RaycastHit)(ref val)).normal.y) > 0.55f) && ((RaycastHit)(ref val)).distance < num2) { num2 = ((RaycastHit)(ref val)).distance; safeHit = val; result = true; } } } return result; } private bool HasLineOfSightSafe(Vector3 start, Vector3 end, int mask) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_001a: 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) Vector3 val = end - start; float magnitude = ((Vector3)(ref val)).magnitude; if (magnitude < 0.01f) { return true; } int num = Physics.RaycastNonAlloc(start, ((Vector3)(ref val)).normalized, surfaceHitsBuffer, magnitude, mask, (QueryTriggerInteraction)1); for (int i = 0; i < num; i++) { if (!IsColliderPlayerOrItem(((RaycastHit)(ref surfaceHitsBuffer[i])).collider)) { return false; } } return true; } private float GetSafeRaycastHeight(Vector3 position, float desiredHeight) { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_0012: Unknown result type (might be due to invalid IL or missing references) //IL_0017: Unknown result type (might be due to invalid IL or missing references) //IL_001c: Unknown result type (might be due to invalid IL or missing references) //IL_003b: Unknown result type (might be due to invalid IL or missing references) //IL_0040: Unknown result type (might be due to invalid IL or missing references) int num = GetGroundMask(); int num2 = Physics.RaycastNonAlloc(position + Vector3.up * 0.05f, Vector3.up, surfaceHitsBuffer, desiredHeight, num, (QueryTriggerInteraction)1); for (int i = 0; i < num2; i++) { RaycastHit val = surfaceHitsBuffer[i]; if (!IsColliderPlayerOrItem(((RaycastHit)(ref val)).collider)) { return Mathf.Max(0.5f, ((RaycastHit)(ref val)).distance - 0.05f); } } return desiredHeight; } private bool FindSupportSurface(Vector3 origin, float distance, out float surfaceY) { //IL_0016: Unknown result type (might be due to invalid IL or missing references) //IL_001b: Unknown result type (might be due to invalid IL or missing references) //IL_0022: Unknown result type (might be due to invalid IL or missing references) //IL_002c: Unknown result type (might be due to invalid IL or missing references) //IL_0031: Unknown result type (might be due to invalid IL or missing references) //IL_0038: Unknown result type (might be due to invalid IL or missing references) //IL_0042: Unknown result type (might be due to invalid IL or missing references) //IL_0047: Unknown result type (might be due to invalid IL or missing references) //IL_004e: Unknown result type (might be due to invalid IL or missing references) //IL_0058: Unknown result type (might be due to invalid IL or missing references) //IL_005d: Unknown result type (might be due to invalid IL or missing references) //IL_0064: Unknown result type (might be due to invalid IL or missing references) //IL_006e: Unknown result type (might be due to invalid IL or missing references) //IL_0073: Unknown result type (might be due to invalid IL or missing references) //IL_0092: Unknown result type (might be due to invalid IL or missing references) //IL_0096: Unknown result type (might be due to invalid IL or missing references) //IL_009b: Unknown result type (might be due to invalid IL or missing references) //IL_00a0: Unknown result type (might be due to invalid IL or missing references) //IL_00b0: 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_00de: Unknown result type (might be due to invalid IL or missing references) //IL_00e3: Unknown result type (might be due to invalid IL or missing references) //IL_00f6: 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_015c: Unknown result type (might be due to invalid IL or missing references) //IL_0109: Unknown result type (might be due to invalid IL or missing references) //IL_0113: Unknown result type (might be due to invalid IL or missing references) //IL_0123: Unknown result type (might be due to invalid IL or missing references) //IL_017e: Unknown result type (might be due to invalid IL or missing references) //IL_0183: Unknown result type (might be due to invalid IL or missing references) //IL_0133: Unknown result type (might be due to invalid IL or missing references) //IL_0196: Unknown result type (might be due to invalid IL or missing references) //IL_01a9: 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) surfaceY = -9999f; int num = GetGroundMask(); Vector3[] array = (Vector3[])(object)new Vector3[5] { Vector3.zero, Vector3.forward * 0.18f, Vector3.back * 0.18f, Vector3.left * 0.18f, Vector3.right * 0.18f }; float[] array2 = new float[5]; bool[] array3 = new bool[5]; int num2 = 0; for (int i = 0; i < array.Length; i++) { Vector3 val = origin + array[i]; array3[i] = false; array2[i] = -9999f; int num3 = Physics.RaycastNonAlloc(val, Vector3.down, surfaceHitsBuffer, distance, num, (QueryTriggerInteraction)1); float num4 = -9999f; bool flag = false; for (int j = 0; j < num3; j++) { RaycastHit val2 = surfaceHitsBuffer[j]; if (!IsColliderPlayerOrItem(((RaycastHit)(ref val2)).collider) && !(((RaycastHit)(ref val2)).normal.y < 0.3f) && !(((RaycastHit)(ref val2)).point.y > origin.y + 0.1f) && ((RaycastHit)(ref val2)).point.y > num4) { num4 = ((RaycastHit)(ref val2)).point.y; flag = true; } } if (!flag) { num3 = Physics.SphereCastNonAlloc(val, 0.25f, Vector3.down, surfaceHitsBuffer, distance, num, (QueryTriggerInteraction)1); for (int k = 0; k < num3; k++) { RaycastHit val3 = surfaceHitsBuffer[k]; if (!IsColliderPlayerOrItem(((RaycastHit)(ref val3)).collider) && !(((RaycastHit)(ref val3)).normal.y < 0.3f) && !(((RaycastHit)(ref val3)).point.y > origin.y + 0.1f) && ((RaycastHit)(ref val3)).point.y > num4) { num4 = ((RaycastHit)(ref val3)).point.y; flag = true; } } } if (flag) { array2[i] = num4; array3[i] = true; num2++; } } if (num2 == 0) { return false; } if (array3[0]) { float num5 = array2[0]; int num6 = 0; float num7 = num5; for (int l = 1; l < 5; l++) { if (array3[l] && array2[l] > num5 + 0.08f) { num6++; if (array2[l] > num7) { num7 = array2[l]; } } } if (num6 >= 3) { surfaceY = num7; } else { surfaceY = num5; } return true; } float num8 = -9999f; for (int m = 1; m < 5; m++) { if (array3[m] && array2[m] > num8) { num8 = array2[m]; } } if (num8 != -9999f) { surfaceY = num8; return true; } return false; } private void UpdateContinuousSurfaceOffset() { //IL_0050: Unknown result type (might be due to invalid IL or missing references) //IL_0066: Unknown result type (might be due to invalid IL or missing references) //IL_006b: Unknown result type (might be due to invalid IL or missing references) //IL_0071: Unknown result type (might be due to invalid IL or missing references) //IL_0076: Unknown result type (might be due to invalid IL or missing references) //IL_007b: Unknown result type (might be due to invalid IL or missing references) //IL_007d: Unknown result type (might be due to invalid IL or missing references) //IL_0094: Unknown result type (might be due to invalid IL or missing references) if (state != PetState.CarryItemToCart && !((Object)(object)agent == (Object)null) && state != PetState.Grabbed && state != PetState.Stunned && !isJumping && !IsRecovering && ((Behaviour)agent).enabled) { float safeRaycastHeight = GetSafeRaycastHeight(((Component)this).transform.position, 0.65f); Vector3 origin = ((Component)this).transform.position + Vector3.up * safeRaycastHeight; if (FindSupportSurface(origin, safeRaycastHeight + 1.2f, out var surfaceY)) { float num = ((Component)this).transform.position.y - agent.baseOffset; float num2 = Mathf.Clamp(surfaceY - num, 0f, 0.65f); agent.baseOffset = Mathf.Lerp(agent.baseOffset, num2, Time.deltaTime * 10f); } else { agent.baseOffset = Mathf.Lerp(agent.baseOffset, 0f, Time.deltaTime * 5f); } } } private void TickMultiplayerOwnerSwitch() { float num = ((PetSettings.PlayerSwitchInterval != null) ? PetSettings.PlayerSwitchInterval.Value : 3f); if (!(num <= 0f) && !(Time.time < nextPlayerSwitchTime)) { nextPlayerSwitchTime = Time.time + num * 60f; SelectNextOwner(isManual: false); } } public void ManualSwitchOwner() { isCalledByOwner = false; SelectNextOwner(isManual: true); } private void SelectNextOwner(bool isManual) { List list = SemiFunc.PlayerGetList(); if (list == null || list.Count <= 1) { return; } List list2 = new List(); List list3 = new List(); foreach (PlayerAvatar item in list) { if ((Object)(object)item != (Object)null && ((Component)item).gameObject.activeInHierarchy && (Object)(object)item != (Object)(object)owner) { list3.Add(item); if (!chosenOwnersThisLevel.Contains(item)) { list2.Add(item); } } } PlayerAvatar val = null; if (list2.Count > 0) { val = list2[Random.Range(0, list2.Count)]; } else if (list3.Count > 0) { chosenOwnersThisLevel.Clear(); if ((Object)(object)owner != (Object)null) { chosenOwnersThisLevel.Add(owner); } val = list3[Random.Range(0, list3.Count)]; } if ((Object)(object)val != (Object)null) { owner = val; chosenOwnersThisLevel.Add(val); ownerBreadcrumbs.Clear(); deadEndMemories.Clear(); if ((Object)(object)aiAudio != (Object)null) { aiAudio.PlayBark(); } } } private void TeleportToOwner() { //IL_003b: Unknown result type (might be due to invalid IL or missing references) //IL_0040: Unknown result type (might be due to invalid IL or missing references) //IL_0080: Unknown result type (might be due to invalid IL or missing references) //IL_006b: Unknown result type (might be due to invalid IL or missing references) //IL_0070: Unknown result type (might be due to invalid IL or missing references) //IL_0071: Unknown result type (might be due to invalid IL or missing references) //IL_0072: Unknown result type (might be due to invalid IL or missing references) //IL_009e: Unknown result type (might be due to invalid IL or missing references) //IL_0092: Unknown result type (might be due to invalid IL or missing references) //IL_0097: Unknown result type (might be due to invalid IL or missing references) //IL_007e: Unknown result type (might be due to invalid IL or missing references) //IL_007f: Unknown result type (might be due to invalid IL or missing references) //IL_0127: Unknown result type (might be due to invalid IL or missing references) //IL_00c5: Unknown result type (might be due to invalid IL or missing references) //IL_00d5: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)owner == (Object)null) { return; } isJumping = false; if ((Object)(object)agent != (Object)null) { ((Behaviour)agent).enabled = false; } Vector3 val = ((Component)owner).transform.position; FieldInfo fieldInfo = AccessTools.Field(typeof(PlayerAvatar), "LastNavmeshPosition"); if (fieldInfo != null) { Vector3 val2 = (Vector3)fieldInfo.GetValue(owner); if (val2 != Vector3.zero) { val = val2; } } NavMeshHit val3 = default(NavMeshHit); if (NavMesh.SamplePosition(val, ref val3, 1.5f, -1)) { val = ((NavMeshHit)(ref val3)).position; } ((Component)this).transform.position = val; if ((Object)(object)myRigidbody != (Object)null) { if (!myRigidbody.isKinematic) { myRigidbody.velocity = Vector3.zero; myRigidbody.angularVelocity = Vector3.zero; } myRigidbody.isKinematic = true; myRigidbody.useGravity = false; } if ((Object)(object)agent != (Object)null) { agent.baseOffset = 0f; ((Behaviour)agent).enabled = true; agent.Warp(val); } Physics.SyncTransforms(); ResolvePenetrations(); stuckTimer = 0f; stuckHighTimer = 0f; offNavMeshStuckTimer = 0f; navMeshCooldown = 0f; escapeTimer = 0f; deadEndMemories.Clear(); ownerBreadcrumbs.Clear(); Plugin.Log.LogInfo((object)"[Ai-Chan] Anti-Stuck ativado. Teleportada em segurança."); } private void TickFollowOwner() { //IL_008e: 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_010b: Unknown result type (might be due to invalid IL or missing references) //IL_0110: Unknown result type (might be due to invalid IL or missing references) //IL_0117: Unknown result type (might be due to invalid IL or missing references) //IL_011c: Unknown result type (might be due to invalid IL or missing references) //IL_00be: 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_016d: Unknown result type (might be due to invalid IL or missing references) //IL_013d: Unknown result type (might be due to invalid IL or missing references) //IL_0142: Unknown result type (might be due to invalid IL or missing references) //IL_0153: Unknown result type (might be due to invalid IL or missing references) //IL_0198: Unknown result type (might be due to invalid IL or missing references) //IL_01a8: Unknown result type (might be due to invalid IL or missing references) //IL_021a: Unknown result type (might be due to invalid IL or missing references) //IL_0225: Unknown result type (might be due to invalid IL or missing references) //IL_022a: Unknown result type (might be due to invalid IL or missing references) //IL_022f: Unknown result type (might be due to invalid IL or missing references) //IL_0242: Unknown result type (might be due to invalid IL or missing references) //IL_0258: Unknown result type (might be due to invalid IL or missing references) //IL_02d4: Unknown result type (might be due to invalid IL or missing references) //IL_02e4: Unknown result type (might be due to invalid IL or missing references) //IL_03c4: Unknown result type (might be due to invalid IL or missing references) //IL_03c9: Unknown result type (might be due to invalid IL or missing references) //IL_03ff: Unknown result type (might be due to invalid IL or missing references) //IL_0404: Unknown result type (might be due to invalid IL or missing references) //IL_040e: Unknown result type (might be due to invalid IL or missing references) //IL_0413: Unknown result type (might be due to invalid IL or missing references) //IL_0423: Unknown result type (might be due to invalid IL or missing references) //IL_0428: Unknown result type (might be due to invalid IL or missing references) //IL_0432: Unknown result type (might be due to invalid IL or missing references) //IL_0437: Unknown result type (might be due to invalid IL or missing references) //IL_0738: Unknown result type (might be due to invalid IL or missing references) //IL_0476: Unknown result type (might be due to invalid IL or missing references) //IL_0483: Unknown result type (might be due to invalid IL or missing references) //IL_049b: Unknown result type (might be due to invalid IL or missing references) //IL_04a0: Unknown result type (might be due to invalid IL or missing references) //IL_04aa: Unknown result type (might be due to invalid IL or missing references) //IL_04af: Unknown result type (might be due to invalid IL or missing references) //IL_04bc: Unknown result type (might be due to invalid IL or missing references) //IL_04c1: Unknown result type (might be due to invalid IL or missing references) //IL_04cb: Unknown result type (might be due to invalid IL or missing references) //IL_04d0: Unknown result type (might be due to invalid IL or missing references) //IL_0598: Unknown result type (might be due to invalid IL or missing references) //IL_05a5: Unknown result type (might be due to invalid IL or missing references) //IL_0519: Unknown result type (might be due to invalid IL or missing references) //IL_051e: Unknown result type (might be due to invalid IL or missing references) //IL_04e6: Unknown result type (might be due to invalid IL or missing references) //IL_04eb: Unknown result type (might be due to invalid IL or missing references) //IL_0623: Unknown result type (might be due to invalid IL or missing references) //IL_0628: Unknown result type (might be due to invalid IL or missing references) //IL_0632: Unknown result type (might be due to invalid IL or missing references) //IL_0637: Unknown result type (might be due to invalid IL or missing references) //IL_0646: Unknown result type (might be due to invalid IL or missing references) //IL_064b: Unknown result type (might be due to invalid IL or missing references) //IL_0655: Unknown result type (might be due to invalid IL or missing references) //IL_065a: Unknown result type (might be due to invalid IL or missing references) //IL_066e: Unknown result type (might be due to invalid IL or missing references) //IL_0682: Unknown result type (might be due to invalid IL or missing references) //IL_068f: Unknown result type (might be due to invalid IL or missing references) //IL_0694: Unknown result type (might be due to invalid IL or missing references) //IL_069e: Unknown result type (might be due to invalid IL or missing references) //IL_06a3: Unknown result type (might be due to invalid IL or missing references) //IL_06b7: Unknown result type (might be due to invalid IL or missing references) //IL_06dd: Unknown result type (might be due to invalid IL or missing references) //IL_06ea: Unknown result type (might be due to invalid IL or missing references) //IL_052b: Unknown result type (might be due to invalid IL or missing references) //IL_0538: Unknown result type (might be due to invalid IL or missing references) //IL_06fc: Unknown result type (might be due to invalid IL or missing references) //IL_0701: Unknown result type (might be due to invalid IL or missing references) //IL_070b: Unknown result type (might be due to invalid IL or missing references) //IL_0710: Unknown result type (might be due to invalid IL or missing references) //IL_0715: Unknown result type (might be due to invalid IL or missing references) //IL_0717: Unknown result type (might be due to invalid IL or missing references) //IL_0721: Unknown result type (might be due to invalid IL or missing references) //IL_0726: Unknown result type (might be due to invalid IL or missing references) //IL_072b: Unknown result type (might be due to invalid IL or missing references) //IL_0594: Unknown result type (might be due to invalid IL or missing references) //IL_058d: Unknown result type (might be due to invalid IL or missing references) //IL_055f: Unknown result type (might be due to invalid IL or missing references) //IL_0564: Unknown result type (might be due to invalid IL or missing references) //IL_0596: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)owner == (Object)null) { StopMoving(); isFollowingOwner = false; } else { if (TickManualMove()) { return; } if ((Object)(object)owner == (Object)null || !((Component)owner).gameObject.activeInHierarchy) { owner = FindNearestOwner(); } if ((Object)(object)owner == (Object)null) { StopMoving(); isFollowingOwner = false; return; } if (awayTimer > 0f) { awayTimer -= Time.deltaTime; MoveTo(awayTargetPos, 0.5f); return; } if (ownerBreadcrumbs.Count == 0 || Vector3.Distance(ownerBreadcrumbs[ownerBreadcrumbs.Count - 1], ((Component)owner).transform.position) > 1f) { float safeRaycastHeight = GetSafeRaycastHeight(((Component)owner).transform.position, 1f); if (FindSupportSurface(((Component)owner).transform.position + Vector3.up * safeRaycastHeight, safeRaycastHeight + 1f, out var surfaceY)) { Vector3 position = ((Component)owner).transform.position; position.y = surfaceY; ownerBreadcrumbs.Add(position); } else { ownerBreadcrumbs.Add(((Component)owner).transform.position); } if (ownerBreadcrumbs.Count > 50) { ownerBreadcrumbs.RemoveAt(0); } } float num = Vector3.Distance(((Component)this).transform.position, ((Component)owner).transform.position); if ((Object)(object)agent != (Object)null && !((Behaviour)agent).enabled && isFollowingOwner && num > 4f) { offNavMeshStuckTimer += Time.deltaTime; if (offNavMeshStuckTimer >= 15f) { TeleportToOwner(); return; } } else { offNavMeshStuckTimer = 0f; } Vector3 val = ((Component)owner).transform.position - ((Component)this).transform.position; val.y = 0f; float y = ((Component)this).transform.position.y; float y2 = ((Component)owner).transform.position.y; bool num2 = y - y2 >= 3f && ((Vector3)(ref val)).sqrMagnitude <= 25f; bool flag = y < -40f; if (num2 || flag) { stuckHighTimer += Time.deltaTime; if (stuckHighTimer >= 15f || flag) { TeleportToOwner(); return; } } else { stuckHighTimer = 0f; } float num3 = ((Component)owner).transform.position.y - ((Component)this).transform.position.y; bool flag2 = num3 > 0.4f && num3 < 4f; float num4 = (isCalledByOwner ? 0f : ((PetSettings.FollowDistance != null) ? PetSettings.FollowDistance.Value : followDistance)); float num5 = (isCalledByOwner ? 0.5f : (flag2 ? 1.7f : ((PetSettings.FollowStoppingDistance != null) ? PetSettings.FollowStoppingDistance.Value : followStoppingDistance))); if (isCalledByOwner && num <= 0.8f) { isCalledByOwner = false; } if (!isFollowingOwner && num > num4) { isFollowingOwner = true; } else if (isFollowingOwner && num <= num5) { isFollowingOwner = false; StopMoving(); } if (isFollowingOwner) { Vector3 val2 = ((Component)owner).transform.position; float stoppingDistance = num5; if ((Object)(object)agent != (Object)null && !((Behaviour)agent).enabled) { int mask = GetGroundMask(); if (!HasLineOfSightSafe(((Component)this).transform.position + Vector3.up * 0.5f, ((Component)owner).transform.position + Vector3.up * 0.5f, mask) && ownerBreadcrumbs.Count > 0) { bool flag3 = false; for (int num6 = ownerBreadcrumbs.Count - 1; num6 >= 0; num6--) { if (Vector3.Distance(((Component)this).transform.position, ownerBreadcrumbs[num6]) > 0.6f && HasLineOfSightSafe(((Component)this).transform.position + Vector3.up * 0.5f, ownerBreadcrumbs[num6] + Vector3.up * 0.5f, mask)) { val2 = ownerBreadcrumbs[num6]; flag3 = true; break; } } if (!flag3) { float num7 = float.MaxValue; Vector3 val3 = ((Component)owner).transform.position; for (int i = 0; i < ownerBreadcrumbs.Count; i++) { float num8 = Vector3.Distance(((Component)this).transform.position, ownerBreadcrumbs[i]); if (num8 < num7 && num8 > 0.5f) { num7 = num8; val3 = ownerBreadcrumbs[i]; flag3 = true; } } val2 = (flag3 ? val3 : ((Component)owner).transform.position); } if (val2 != ((Component)owner).transform.position) { stoppingDistance = 0.2f; } } } if (PetSettings.EnableDebugRays != null && PetSettings.EnableDebugRays.Value && ownerBreadcrumbs.Count > 0) { float duration = ((PetSettings.DebugBreadcrumbsFadeTime != null) ? PetSettings.DebugBreadcrumbsFadeTime.Value : 0.15f); int num9 = 10; for (int j = Mathf.Max(0, ownerBreadcrumbs.Count - num9); j < ownerBreadcrumbs.Count - 1; j++) { PetRuntimeDrawer.DrawLine(ownerBreadcrumbs[j] + Vector3.up * 0.1f, ownerBreadcrumbs[j + 1] + Vector3.up * 0.1f, new Color(1f, 0.5f, 0f), duration); PetRuntimeDrawer.DrawLine(ownerBreadcrumbs[j], ownerBreadcrumbs[j] + Vector3.up * 0.4f, new Color(1f, 0.8f, 0f), duration); } if (val2 != ((Component)owner).transform.position) { PetRuntimeDrawer.DrawLine(((Component)this).transform.position + Vector3.up * 0.5f, val2 + Vector3.up * 0.5f, Color.magenta, duration); } } MoveTo(val2, stoppingDistance); } else { StopMoving(); } } } private void TickAutoJump() { //IL_008d: Unknown result type (might be due to invalid IL or missing references) //IL_0092: Unknown result type (might be due to invalid IL or missing references) //IL_004a: Unknown result type (might be due to invalid IL or missing references) //IL_0050: Unknown result type (might be due to invalid IL or missing references) //IL_0063: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_00c2: Unknown result type (might be due to invalid IL or missing references) //IL_00c7: Unknown result type (might be due to invalid IL or missing references) //IL_00e0: Unknown result type (might be due to invalid IL or missing references) //IL_00e5: Unknown result type (might be due to invalid IL or missing references) //IL_00f3: Unknown result type (might be due to invalid IL or missing references) //IL_00f5: Unknown result type (might be due to invalid IL or missing references) //IL_0108: 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_0164: Unknown result type (might be due to invalid IL or missing references) //IL_0169: Unknown result type (might be due to invalid IL or missing references) //IL_017d: Unknown result type (might be due to invalid IL or missing references) //IL_0182: Unknown result type (might be due to invalid IL or missing references) //IL_0190: 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_012f: Unknown result type (might be due to invalid IL or missing references) //IL_0131: Unknown result type (might be due to invalid IL or missing references) //IL_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_013c: Unknown result type (might be due to invalid IL or missing references) //IL_0141: Unknown result type (might be due to invalid IL or missing references) //IL_01a0: Unknown result type (might be due to invalid IL or missing references) //IL_01a2: Unknown result type (might be due to invalid IL or missing references) //IL_01a4: Unknown result type (might be due to invalid IL or missing references) //IL_01a9: Unknown result type (might be due to invalid IL or missing references) //IL_01ad: Unknown result type (might be due to invalid IL or missing references) //IL_01b2: Unknown result type (might be due to invalid IL or missing references) //IL_020f: Unknown result type (might be due to invalid IL or missing references) //IL_0214: Unknown result type (might be due to invalid IL or missing references) //IL_021e: Unknown result type (might be due to invalid IL or missing references) //IL_0223: Unknown result type (might be due to invalid IL or missing references) //IL_0228: 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_023f: Unknown result type (might be due to invalid IL or missing references) //IL_0244: Unknown result type (might be due to invalid IL or missing references) //IL_0249: Unknown result type (might be due to invalid IL or missing references) //IL_024c: Unknown result type (might be due to invalid IL or missing references) //IL_024e: Unknown result type (might be due to invalid IL or missing references) //IL_0255: Unknown result type (might be due to invalid IL or missing references) //IL_0274: Unknown result type (might be due to invalid IL or missing references) //IL_0279: Unknown result type (might be due to invalid IL or missing references) //IL_0283: Unknown result type (might be due to invalid IL or missing references) //IL_0288: Unknown result type (might be due to invalid IL or missing references) //IL_0293: Unknown result type (might be due to invalid IL or missing references) //IL_0298: Unknown result type (might be due to invalid IL or missing references) //IL_02a2: Unknown result type (might be due to invalid IL or missing references) //IL_02a7: Unknown result type (might be due to invalid IL or missing references) //IL_02ac: Unknown result type (might be due to invalid IL or missing references) //IL_02b2: Unknown result type (might be due to invalid IL or missing references) //IL_02b7: Unknown result type (might be due to invalid IL or missing references) //IL_02c7: Unknown result type (might be due to invalid IL or missing references) //IL_02c0: Unknown result type (might be due to invalid IL or missing references) //IL_034b: Unknown result type (might be due to invalid IL or missing references) //IL_0350: Unknown result type (might be due to invalid IL or missing references) //IL_0356: Unknown result type (might be due to invalid IL or missing references) //IL_035b: Unknown result type (might be due to invalid IL or missing references) //IL_0360: Unknown result type (might be due to invalid IL or missing references) //IL_0363: Unknown result type (might be due to invalid IL or missing references) //IL_036e: Unknown result type (might be due to invalid IL or missing references) //IL_0370: Unknown result type (might be due to invalid IL or missing references) //IL_0377: Unknown result type (might be due to invalid IL or missing references) //IL_037c: Unknown result type (might be due to invalid IL or missing references) //IL_0381: Unknown result type (might be due to invalid IL or missing references) //IL_0384: Unknown result type (might be due to invalid IL or missing references) //IL_039f: Unknown result type (might be due to invalid IL or missing references) //IL_0494: Unknown result type (might be due to invalid IL or missing references) //IL_0495: Unknown result type (might be due to invalid IL or missing references) //IL_04b6: Unknown result type (might be due to invalid IL or missing references) //IL_04bb: Unknown result type (might be due to invalid IL or missing references) //IL_04c0: Unknown result type (might be due to invalid IL or missing references) //IL_04c5: Unknown result type (might be due to invalid IL or missing references) //IL_04d3: Unknown result type (might be due to invalid IL or missing references) //IL_04d8: Unknown result type (might be due to invalid IL or missing references) //IL_04e5: Unknown result type (might be due to invalid IL or missing references) //IL_05c8: Unknown result type (might be due to invalid IL or missing references) //IL_05cd: Unknown result type (might be due to invalid IL or missing references) //IL_03d9: Unknown result type (might be due to invalid IL or missing references) //IL_03db: Unknown result type (might be due to invalid IL or missing references) //IL_03dd: Unknown result type (might be due to invalid IL or missing references) //IL_03ea: Unknown result type (might be due to invalid IL or missing references) //IL_03ef: Unknown result type (might be due to invalid IL or missing references) //IL_03f4: Unknown result type (might be due to invalid IL or missing references) //IL_0620: Unknown result type (might be due to invalid IL or missing references) //IL_0625: Unknown result type (might be due to invalid IL or missing references) //IL_0628: Unknown result type (might be due to invalid IL or missing references) //IL_062d: Unknown result type (might be due to invalid IL or missing references) //IL_0632: Unknown result type (might be due to invalid IL or missing references) //IL_0646: Unknown result type (might be due to invalid IL or missing references) //IL_0653: Unknown result type (might be due to invalid IL or missing references) //IL_0660: Unknown result type (might be due to invalid IL or missing references) //IL_066d: Unknown result type (might be due to invalid IL or missing references) //IL_068b: Unknown result type (might be due to invalid IL or missing references) //IL_0a37: Unknown result type (might be due to invalid IL or missing references) //IL_06c6: Unknown result type (might be due to invalid IL or missing references) //IL_06cf: Unknown result type (might be due to invalid IL or missing references) //IL_07af: Unknown result type (might be due to invalid IL or missing references) //IL_07b1: Unknown result type (might be due to invalid IL or missing references) //IL_07bb: Unknown result type (might be due to invalid IL or missing references) //IL_07c0: Unknown result type (might be due to invalid IL or missing references) //IL_07c5: Unknown result type (might be due to invalid IL or missing references) //IL_080f: Unknown result type (might be due to invalid IL or missing references) //IL_0838: Unknown result type (might be due to invalid IL or missing references) //IL_083a: Unknown result type (might be due to invalid IL or missing references) //IL_0844: Unknown result type (might be due to invalid IL or missing references) //IL_0849: Unknown result type (might be due to invalid IL or missing references) //IL_084e: Unknown result type (might be due to invalid IL or missing references) //IL_0850: Unknown result type (might be due to invalid IL or missing references) //IL_085a: Unknown result type (might be due to invalid IL or missing references) //IL_085f: Unknown result type (might be due to invalid IL or missing references) //IL_0864: Unknown result type (might be due to invalid IL or missing references) //IL_0869: Unknown result type (might be due to invalid IL or missing references) //IL_0717: Unknown result type (might be due to invalid IL or missing references) //IL_0725: Unknown result type (might be due to invalid IL or missing references) //IL_0730: Unknown result type (might be due to invalid IL or missing references) //IL_073e: Unknown result type (might be due to invalid IL or missing references) //IL_0753: Unknown result type (might be due to invalid IL or missing references) //IL_0761: Unknown result type (might be due to invalid IL or missing references) //IL_08b1: Unknown result type (might be due to invalid IL or missing references) //IL_08b6: Unknown result type (might be due to invalid IL or missing references) //IL_08b8: Unknown result type (might be due to invalid IL or missing references) //IL_08c2: Unknown result type (might be due to invalid IL or missing references) //IL_08c7: Unknown result type (might be due to invalid IL or missing references) //IL_08d4: Unknown result type (might be due to invalid IL or missing references) //IL_08d9: Unknown result type (might be due to invalid IL or missing references) //IL_08de: Unknown result type (might be due to invalid IL or missing references) //IL_08e9: Unknown result type (might be due to invalid IL or missing references) //IL_08ee: Unknown result type (might be due to invalid IL or missing references) //IL_08f8: Unknown result type (might be due to invalid IL or missing references) //IL_08fd: Unknown result type (might be due to invalid IL or missing references) //IL_0902: Unknown result type (might be due to invalid IL or missing references) //IL_0904: Unknown result type (might be due to invalid IL or missing references) //IL_0906: Unknown result type (might be due to invalid IL or missing references) //IL_0908: Unknown result type (might be due to invalid IL or missing references) //IL_090a: Unknown result type (might be due to invalid IL or missing references) //IL_090f: Unknown result type (might be due to invalid IL or missing references) //IL_0913: Unknown result type (might be due to invalid IL or missing references) //IL_091e: Unknown result type (might be due to invalid IL or missing references) //IL_0920: Unknown result type (might be due to invalid IL or missing references) //IL_0969: Unknown result type (might be due to invalid IL or missing references) //IL_096b: Unknown result type (might be due to invalid IL or missing references) //IL_0975: Unknown result type (might be due to invalid IL or missing references) //IL_097a: Unknown result type (might be due to invalid IL or missing references) //IL_097f: Unknown result type (might be due to invalid IL or missing references) //IL_0981: Unknown result type (might be due to invalid IL or missing references) //IL_0983: Unknown result type (might be due to invalid IL or missing references) //IL_0985: Unknown result type (might be due to invalid IL or missing references) //IL_0987: Unknown result type (might be due to invalid IL or missing references) //IL_098c: Unknown result type (might be due to invalid IL or missing references) //IL_0990: Unknown result type (might be due to invalid IL or missing references) //IL_099b: Unknown result type (might be due to invalid IL or missing references) //IL_099d: Unknown result type (might be due to invalid IL or missing references) //IL_09ea: Unknown result type (might be due to invalid IL or missing references) //IL_09ec: Unknown result type (might be due to invalid IL or missing references) //IL_09f5: Unknown result type (might be due to invalid IL or missing references) //IL_09f7: Unknown result type (might be due to invalid IL or missing references) //IL_09f9: Unknown result type (might be due to invalid IL or missing references) //IL_0a03: Unknown result type (might be due to invalid IL or missing references) //IL_0a08: Unknown result type (might be due to invalid IL or missing references) //IL_0a0d: Unknown result type (might be due to invalid IL or missing references) if (isJumping || Time.time < nextJumpTime || (Object)(object)agent == (Object)null) { return; } posCheckTimer += Time.deltaTime; if (posCheckTimer >= 0.25f) { float num = Vector3.Distance(((Component)this).transform.position, lastPosCheck); lastPosCheck = ((Component)this).transform.position; posCheckTimer = 0f; isActuallyMoving = num > 0.03f; } Vector3 val = ((Component)this).transform.forward; float num2 = 0f; float num3 = 0f; Vector3 val2; if (state == PetState.FollowOwner && (Object)(object)owner != (Object)null) { Vector3 position = ((Component)this).transform.position; position.y = 0f; Vector3 position2 = ((Component)owner).transform.position; position2.y = 0f; num2 = Vector3.Distance(position, position2); num3 = ((Component)owner).transform.position.y - ((Component)this).transform.position.y; if (num2 > 0.1f) { val2 = position2 - position; val = ((Vector3)(ref val2)).normalized; } } else if (((Behaviour)agent).enabled && agent.hasPath) { Vector3 position3 = ((Component)this).transform.position; position3.y = 0f; Vector3 steeringTarget = agent.steeringTarget; steeringTarget.y = 0f; if (Vector3.Distance(position3, steeringTarget) > 0.1f) { val2 = steeringTarget - position3; val = ((Vector3)(ref val2)).normalized; } } bool num4 = PetSettings.EnableDebugRays != null && PetSettings.EnableDebugRays.Value; float duration = ((PetSettings.DebugRaysFadeTime != null) ? PetSettings.DebugRaysFadeTime.Value : 0.25f); bool flag = num4 && Time.time > lastDebugDrawTime + 0.25f; if (flag) { lastDebugDrawTime = Time.time; } Vector3 p = ((Component)this).transform.position + Vector3.up * 0.25f; Vector3 p2 = ((Component)this).transform.position + Vector3.up * 0.85f; RaycastHit safeHit; bool flag2 = CheckPathClear(p, p2, 0.25f, val, 1.2f, GetGroundMask(), out safeHit); if (flag) { PetRuntimeDrawer.DrawLine(((Component)this).transform.position + Vector3.up * 0.5f, ((Component)this).transform.position + Vector3.up * 0.5f + val * 1.2f, flag2 ? Color.red : Color.blue, duration); } bool flag3 = false; float num5 = ((PetSettings.MaxJumpObstacleHeight != null) ? PetSettings.MaxJumpObstacleHeight.Value : 3.5f); bool flag4 = num3 > 0.4f && num3 < 4f && num2 < 5f; if (flag2 || flag4) { float[] array = ((!flag4) ? new float[1] { 1.2f } : new float[3] { 0.8f, 1.4f, 2.2f }); for (int i = 0; i < array.Length; i++) { Vector3 val3 = ((Component)this).transform.position + val * array[i]; float safeRaycastHeight = GetSafeRaycastHeight(val3, num5); Vector3 val4 = val3 + Vector3.up * safeRaycastHeight; if (!FindSupportSurface(val4, safeRaycastHeight + 1.5f, out var surfaceY)) { continue; } float num6 = surfaceY - ((Component)this).transform.position.y; float num7 = ((PetSettings.MinJumpObstacleHeight != null) ? PetSettings.MinJumpObstacleHeight.Value : 0.75f); if (num6 >= num7 && num6 <= num5) { flag3 = true; if (flag) { PetRuntimeDrawer.DrawLine(val4, val4 + Vector3.down * (safeRaycastHeight + 1.5f), Color.magenta, duration); } break; } } } bool flag5 = flag4 && num2 <= 2.2f; bool flag6 = !isActuallyMoving && stuckTimer > 0.25f && flag4; isPreparingToJump = flag3 || flag5 || flag6; if (isPreparingToJump) { if (((Behaviour)agent).enabled && agent.isOnNavMesh) { agent.isStopped = true; } jumpTimer += Time.deltaTime; Vector3 val5 = val; val5.y = 0f; if (((Vector3)(ref val5)).sqrMagnitude > 0.001f) { Quaternion val6 = Quaternion.LookRotation(((Vector3)(ref val5)).normalized, Vector3.up); ((Component)this).transform.rotation = Quaternion.RotateTowards(((Component)this).transform.rotation, val6, 500f * Time.deltaTime); } } else { jumpTimer = 0f; if (isActuallyMoving) { stuckTimer = 0f; } else if ((Object)(object)agent != (Object)null && ((Behaviour)agent).enabled && agent.isOnNavMesh && agent.hasPath && agent.remainingDistance > 0.5f) { stuckTimer += Time.deltaTime; } else { stuckTimer = Mathf.Max(0f, stuckTimer - Time.deltaTime); } } float num8 = (flag4 ? 0.35f : ((PetSettings.AutoJumpDelay != null) ? PetSettings.AutoJumpDelay.Value : 0.8f)); if (!(jumpTimer > num8)) { return; } jumpTimer = 0f; Vector3 val7 = Vector3.zero; bool flag7 = false; float num9 = Mathf.Min(6f, num2 + 1.5f); if (num9 < 2f) { num9 = 2f; } float num10 = (flag4 ? 0.9f : 0.5f); List list = SemiFunc.PlayerGetAll(); float num11 = 0.7225f; Vector3 origin = default(Vector3); Vector3 val9 = default(Vector3); for (float num12 = num10; num12 <= num9; num12 += 0.4f) { Vector3 val8 = ((Component)this).transform.position + val * num12; float num13 = Mathf.Max(num3 + 1.5f, num5); ((Vector3)(ref origin))..ctor(val8.x, ((Component)this).transform.position.y + num13, val8.z); if (!FindSupportSurface(origin, num13 + 1.5f, out var surfaceY2)) { continue; } float num14 = surfaceY2 - ((Component)this).transform.position.y; float num15 = ((PetSettings.MinJumpObstacleHeight != null) ? PetSettings.MinJumpObstacleHeight.Value : 0.75f); if (!(num14 >= num15) || !(num14 <= num5)) { continue; } ((Vector3)(ref val9))..ctor(val8.x, surfaceY2, val8.z); bool flag8 = false; if (list != null) { foreach (PlayerAvatar item in list) { if (!((Object)(object)item == (Object)null) && ((Component)item).gameObject.activeInHierarchy) { float num16 = val9.x - ((Component)item).transform.position.x; float num17 = val9.z - ((Component)item).transform.position.z; float num18 = num16 * num16 + num17 * num17; float num19 = val9.y - ((Component)item).transform.position.y; if (num18 < num11 && num19 > 0.1f && num19 < 2.5f) { flag8 = true; break; } } } } if (flag8) { continue; } bool flag9 = false; int num20 = Physics.RaycastNonAlloc(val9 + Vector3.up * 0.5f, Vector3.down, surfaceHitsBuffer, 1f, GetGroundMask(), (QueryTriggerInteraction)1); for (int j = 0; j < num20; j++) { if (!IsColliderPlayerOrItem(((RaycastHit)(ref surfaceHitsBuffer[j])).collider)) { if (((RaycastHit)(ref surfaceHitsBuffer[j])).normal.y > 0.7f) { flag9 = true; } break; } } if (!flag9) { continue; } Vector3 val10 = val9 + Vector3.up * 0.35f; Vector3 val11 = val9 + Vector3.up * 1.3f; bool flag10 = true; int num21 = Physics.OverlapCapsuleNonAlloc(val10, val11, 0.25f, overlapCollidersBuffer, GetGroundMask(), (QueryTriggerInteraction)1); for (int k = 0; k < num21; k++) { if (!IsColliderPlayerOrItem(overlapCollidersBuffer[k])) { flag10 = false; break; } } Vector3 val12 = (((Component)this).transform.position + val9) * 0.5f + Vector3.up * (num14 + 0.5f); bool flag11 = false; Vector3 val13 = ((Component)this).transform.position + Vector3.up * 0.6f; val2 = val12 - val13; int num22 = Physics.RaycastNonAlloc(val13, ((Vector3)(ref val2)).normalized, surfaceHitsBuffer, Vector3.Distance(val13, val12), GetGroundMask(), (QueryTriggerInteraction)1); for (int l = 0; l < num22; l++) { if (!IsColliderPlayerOrItem(((RaycastHit)(ref surfaceHitsBuffer[l])).collider)) { flag11 = true; break; } } if (!flag11) { Vector3 val14 = val9 + Vector3.up * 0.5f; val2 = val14 - val12; num22 = Physics.RaycastNonAlloc(val12, ((Vector3)(ref val2)).normalized, surfaceHitsBuffer, Vector3.Distance(val12, val14), GetGroundMask(), (QueryTriggerInteraction)1); for (int m = 0; m < num22; m++) { if (!IsColliderPlayerOrItem(((RaycastHit)(ref surfaceHitsBuffer[m])).collider)) { flag11 = true; break; } } } if (flag10 && !flag11) { val7 = val9; flag7 = true; if (flag) { PetRuntimeDrawer.DrawLine(val7, val7 + Vector3.up * 1.5f, Color.green, 2f); } break; } } if (flag7) { ((MonoBehaviour)this).StartCoroutine(PerformAutoJump(val7)); } else { nextJumpTime = Time.time + 1.5f; } } private IEnumerator PerformAutoJump(Vector3 targetPos) { //IL_000e: Unknown result type (might be due to invalid IL or missing references) //IL_000f: Unknown result type (might be due to invalid IL or missing references) isJumping = true; if ((Object)(object)agent != (Object)null && ((Behaviour)agent).enabled) { if (agent.isOnNavMesh) { agent.isStopped = true; } ((Behaviour)agent).enabled = false; } Vector3 startPos = ((Component)this).transform.position; float num = targetPos.y - startPos.y; float num2 = Vector2.Distance(new Vector2(startPos.x, startPos.z), new Vector2(targetPos.x, targetPos.z)); float duration = Mathf.Clamp(num2 * 0.15f + Mathf.Abs(num) * 0.18f, 0.35f, 0.8f); float elapsed = 0f; if ((Object)(object)aiAudio != (Object)null && Time.time >= nextJumpBarkTime) { aiAudio.PlayBark(); nextJumpBarkTime = Time.time + 10f; } float arcBoost = Mathf.Max(num + 0.2f, num2 * 0.2f + 0.3f); float safeRaycastHeight = GetSafeRaycastHeight(startPos, 3.5f); float num3 = Mathf.Max(0f, safeRaycastHeight - 1.2f); arcBoost = Mathf.Min(arcBoost, num3); try { Vector3 val2 = default(Vector3); RaycastHit val6 = default(RaycastHit); while (elapsed < duration && state != PetState.Grabbed) { elapsed += Time.deltaTime; float num4 = elapsed / duration; float num5 = Mathf.Sin(num4 * MathF.PI * 0.5f); float num6 = Mathf.Sin(num4 * MathF.PI) * arcBoost; Vector3 val = Vector3.Lerp(startPos, targetPos, num5); float num7 = Mathf.Lerp(startPos.y, targetPos.y, num4) + num6; ((Vector3)(ref val2))..ctor(val.x, num7, val.z); if (num4 > 0.05f && num4 < 0.95f) { Vector3 val3 = val2 - ((Component)this).transform.position; float magnitude = ((Vector3)(ref val3)).magnitude; if (magnitude > 0.001f) { Vector3 val4 = ((Component)this).transform.position + Vector3.up * 0.35f; Vector3 val5 = ((Component)this).transform.position + Vector3.up * 0.85f; if (Physics.CapsuleCast(val4, val5, 0.25f, ((Vector3)(ref val3)).normalized, ref val6, magnitude, GetGroundMask(), (QueryTriggerInteraction)1)) { if (((RaycastHit)(ref val6)).normal.y < -0.2f) { targetPos.y = ((Component)this).transform.position.y; val2.y = ((Component)this).transform.position.y; } else { targetPos.x = ((RaycastHit)(ref val6)).point.x + ((RaycastHit)(ref val6)).normal.x * 0.25f; targetPos.z = ((RaycastHit)(ref val6)).point.z + ((RaycastHit)(ref val6)).normal.z * 0.25f; val2.x = targetPos.x; val2.z = targetPos.z; } } } } ((Component)this).transform.position = val2; yield return null; } } finally { PetCompanionController petCompanionController = this; petCompanionController.isJumping = false; if (petCompanionController.state != PetState.Grabbed) { ((Component)petCompanionController).transform.position = targetPos; petCompanionController.ResolvePenetrations(); petCompanionController.EnsureGroundedAndNavMesh(); if (targetPos.y - ((Component)petCompanionController).transform.position.y > 0.4f) { petCompanionController.nextJumpTime = Time.time + 2.5f; petCompanionController.jumpTimer = 0f; petCompanionController.isPreparingToJump = false; } else { petCompanionController.nextJumpTime = Time.time + 1.2f; } } else { petCompanionController.nextJumpTime = Time.time + 1f; } } } public void EnsureGroundedAndNavMesh() { //IL_0028: 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_0110: Unknown result type (might be due to invalid IL or missing references) //IL_0115: Unknown result type (might be due to invalid IL or missing references) //IL_0209: Unknown result type (might be due to invalid IL or missing references) //IL_020e: Unknown result type (might be due to invalid IL or missing references) //IL_021e: Unknown result type (might be due to invalid IL or missing references) //IL_0142: Unknown result type (might be due to invalid IL or missing references) //IL_011d: Unknown result type (might be due to invalid IL or missing references) //IL_00ad: Unknown result type (might be due to invalid IL or missing references) //IL_00b2: Unknown result type (might be due to invalid IL or missing references) //IL_00c2: Unknown result type (might be due to invalid IL or missing references) //IL_0251: Unknown result type (might be due to invalid IL or missing references) //IL_0175: Unknown result type (might be due to invalid IL or missing references) //IL_00f5: Unknown result type (might be due to invalid IL or missing references) //IL_01c3: Unknown result type (might be due to invalid IL or missing references) //IL_01c8: Unknown result type (might be due to invalid IL or missing references) //IL_01d9: Unknown result type (might be due to invalid IL or missing references) //IL_01de: Unknown result type (might be due to invalid IL or missing references) //IL_01e4: Unknown result type (might be due to invalid IL or missing references) //IL_01e9: Unknown result type (might be due to invalid IL or missing references) //IL_01a1: Unknown result type (might be due to invalid IL or missing references) //IL_01af: Unknown result type (might be due to invalid IL or missing references) if (state == PetState.Grabbed || (PhotonNetwork.InRoom && !PhotonNetwork.IsMasterClient)) { return; } float surfaceY; bool flag = PlaceOnSupportSurface(out surfaceY); NavMeshHit val = default(NavMeshHit); bool flag2 = NavMesh.SamplePosition(((Component)this).transform.position, ref val, 4f, -1); if (flag && flag2 && surfaceY - ((NavMeshHit)(ref val)).position.y > 0.35f) { if ((Object)(object)agent != (Object)null && ((Behaviour)agent).enabled) { if (agent.isOnNavMesh && agent.hasPath) { agent.ResetPath(); } ((Behaviour)agent).enabled = false; } Vector3 position = ((Component)this).transform.position; position.y = surfaceY; ((Component)this).transform.position = position; if ((Object)(object)myRigidbody != (Object)null) { myRigidbody.isKinematic = true; myRigidbody.useGravity = false; myRigidbody.position = position; } Physics.SyncTransforms(); ResolvePenetrations(); } else if (flag2) { Vector3 position2 = ((NavMeshHit)(ref val)).position; if (flag && Mathf.Abs(surfaceY - ((NavMeshHit)(ref val)).position.y) <= 0.35f) { position2.y = surfaceY; } ((Component)this).transform.position = position2; if ((Object)(object)myRigidbody != (Object)null) { myRigidbody.isKinematic = true; myRigidbody.useGravity = false; myRigidbody.position = position2; } Physics.SyncTransforms(); if ((Object)(object)agent != (Object)null) { ((Behaviour)agent).enabled = true; agent.Warp(position2); agent.nextPosition = position2; agent.isStopped = false; } lastDestination = Vector3.positiveInfinity; lastSetDestinationTime = 0f; panicDirection = Vector3.zero; smoothedManualDir = Vector3.zero; navMeshCooldown = 0f; ResolvePenetrations(); } else if (flag) { Vector3 position3 = ((Component)this).transform.position; position3.y = surfaceY; ((Component)this).transform.position = position3; if ((Object)(object)myRigidbody != (Object)null) { myRigidbody.isKinematic = true; myRigidbody.useGravity = false; myRigidbody.position = position3; } Physics.SyncTransforms(); ResolvePenetrations(); } } public bool PlaceOnSupportSurface(out float surfaceY) { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_003b: Unknown result type (might be due to invalid IL or missing references) //IL_0051: Unknown result type (might be due to invalid IL or missing references) //IL_0056: Unknown result type (might be due to invalid IL or missing references) //IL_005c: Unknown result type (might be due to invalid IL or missing references) //IL_0061: Unknown result type (might be due to invalid IL or missing references) //IL_0066: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_007d: Unknown result type (might be due to invalid IL or missing references) //IL_009f: Unknown result type (might be due to invalid IL or missing references) //IL_00a4: Unknown result type (might be due to invalid IL or missing references) //IL_0119: Unknown result type (might be due to invalid IL or missing references) //IL_0126: Unknown result type (might be due to invalid IL or missing references) //IL_010a: Unknown result type (might be due to invalid IL or missing references) //IL_00d2: Unknown result type (might be due to invalid IL or missing references) //IL_00e2: Unknown result type (might be due to invalid IL or missing references) surfaceY = ((Component)this).transform.position.y; if (PhotonNetwork.InRoom && !PhotonNetwork.IsMasterClient) { return false; } CapsuleCollider component = ((Component)this).GetComponent(); if ((Object)(object)component == (Object)null) { return false; } float safeRaycastHeight = GetSafeRaycastHeight(((Component)this).transform.position, 1f); Vector3 origin = ((Component)this).transform.position + Vector3.up * safeRaycastHeight; if (FindSupportSurface(origin, safeRaycastHeight + 5f, out var surfaceY2)) { float num = component.center.y - component.height * 0.5f; surfaceY = surfaceY2; Vector3 position = ((Component)this).transform.position; position.y = surfaceY2 - num; if ((Object)(object)myRigidbody != (Object)null) { if (!myRigidbody.isKinematic) { myRigidbody.velocity = Vector3.zero; myRigidbody.angularVelocity = Vector3.zero; } myRigidbody.isKinematic = true; myRigidbody.useGravity = false; myRigidbody.position = position; } else { ((Component)this).transform.position = position; } ((Component)this).transform.position = position; Physics.SyncTransforms(); ResolvePenetrations(); return true; } return false; } public bool SnapToNavMesh() { NavMeshHit hit; return SnapToNavMesh(out hit); } public bool SnapToNavMesh(out NavMeshHit hit) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0038: Unknown result type (might be due to invalid IL or missing references) //IL_0054: Unknown result type (might be due to invalid IL or missing references) //IL_006b: Unknown result type (might be due to invalid IL or missing references) //IL_0070: Unknown result type (might be due to invalid IL or missing references) //IL_0076: Unknown result type (might be due to invalid IL or missing references) //IL_007b: Unknown result type (might be due to invalid IL or missing references) //IL_0097: Unknown result type (might be due to invalid IL or missing references) //IL_00ec: Unknown result type (might be due to invalid IL or missing references) //IL_0100: Unknown result type (might be due to invalid IL or missing references) //IL_0111: Unknown result type (might be due to invalid IL or missing references) hit = default(NavMeshHit); if (state == PetState.Grabbed) { return false; } if (PhotonNetwork.InRoom && !PhotonNetwork.IsMasterClient) { return false; } if ((Object)(object)agent == (Object)null) { return false; } if (!NavMesh.SamplePosition(((Component)this).transform.position, ref hit, 1.5f, -1)) { return false; } float safeRaycastHeight = GetSafeRaycastHeight(((Component)this).transform.position, 1.5f); if (FindSupportSurface(((Component)this).transform.position + Vector3.up * safeRaycastHeight, safeRaycastHeight + 1f, out var surfaceY)) { float baseOffset = Mathf.Max(0f, surfaceY - ((NavMeshHit)(ref hit)).position.y); agent.baseOffset = baseOffset; } if (!((Behaviour)agent).enabled) { ((Behaviour)agent).enabled = true; } agent.updatePosition = false; agent.updateRotation = false; bool num = agent.Warp(((NavMeshHit)(ref hit)).position); if (num) { ((Component)this).transform.position = ((NavMeshHit)(ref hit)).position; agent.nextPosition = ((NavMeshHit)(ref hit)).position; agent.isStopped = false; Physics.SyncTransforms(); ResolvePenetrations(); } if (!num) { return agent.isOnNavMesh; } return true; } private PlayerAvatar FindNearestOwner() { //IL_000b: Unknown result type (might be due to invalid IL or missing references) //IL_0024: Unknown result type (might be due to invalid IL or missing references) return SemiFunc.PlayerGetNearestPlayerAvatarWithinRange(999f, ((Component)this).transform.position, true, LayerMask.op_Implicit(LayerMask.GetMask(new string[1] { "Default" }))); } private void MoveTo(Vector3 point, float stoppingDistance) { //IL_0034: Unknown result type (might be due to invalid IL or missing references) //IL_006e: Unknown result type (might be due to invalid IL or missing references) //IL_0073: Unknown result type (might be due to invalid IL or missing references) //IL_0081: Unknown result type (might be due to invalid IL or missing references) //IL_0082: Unknown result type (might be due to invalid IL or missing references) //IL_0090: 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_00a1: Unknown result type (might be due to invalid IL or missing references) //IL_00ab: Unknown result type (might be due to invalid IL or missing references) //IL_00d8: 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_0115: Unknown result type (might be due to invalid IL or missing references) //IL_011a: Unknown result type (might be due to invalid IL or missing references) //IL_0192: Unknown result type (might be due to invalid IL or missing references) //IL_0197: Unknown result type (might be due to invalid IL or missing references) //IL_023d: Unknown result type (might be due to invalid IL or missing references) //IL_023e: Unknown result type (might be due to invalid IL or missing references) //IL_0240: Unknown result type (might be due to invalid IL or missing references) //IL_024c: Unknown result type (might be due to invalid IL or missing references) //IL_0260: Unknown result type (might be due to invalid IL or missing references) //IL_0287: Unknown result type (might be due to invalid IL or missing references) //IL_0280: Unknown result type (might be due to invalid IL or missing references) //IL_0285: Unknown result type (might be due to invalid IL or missing references) //IL_02e1: Unknown result type (might be due to invalid IL or missing references) //IL_02e6: Unknown result type (might be due to invalid IL or missing references) //IL_0295: Unknown result type (might be due to invalid IL or missing references) //IL_02a3: Unknown result type (might be due to invalid IL or missing references) //IL_02b1: Unknown result type (might be due to invalid IL or missing references) //IL_033e: Unknown result type (might be due to invalid IL or missing references) //IL_02bf: Unknown result type (might be due to invalid IL or missing references) //IL_0352: Unknown result type (might be due to invalid IL or missing references) //IL_0357: Unknown result type (might be due to invalid IL or missing references) //IL_02cd: Unknown result type (might be due to invalid IL or missing references) //IL_093e: Unknown result type (might be due to invalid IL or missing references) //IL_0943: Unknown result type (might be due to invalid IL or missing references) //IL_094b: Unknown result type (might be due to invalid IL or missing references) //IL_0950: Unknown result type (might be due to invalid IL or missing references) //IL_0955: Unknown result type (might be due to invalid IL or missing references) //IL_095d: Unknown result type (might be due to invalid IL or missing references) //IL_0962: Unknown result type (might be due to invalid IL or missing references) //IL_0976: Unknown result type (might be due to invalid IL or missing references) //IL_097b: Unknown result type (might be due to invalid IL or missing references) //IL_0980: Unknown result type (might be due to invalid IL or missing references) //IL_037a: Unknown result type (might be due to invalid IL or missing references) //IL_037f: Unknown result type (might be due to invalid IL or missing references) //IL_0383: Unknown result type (might be due to invalid IL or missing references) //IL_036d: Unknown result type (might be due to invalid IL or missing references) //IL_09a5: Unknown result type (might be due to invalid IL or missing references) //IL_09a6: Unknown result type (might be due to invalid IL or missing references) //IL_05cb: Unknown result type (might be due to invalid IL or missing references) //IL_05ce: Unknown result type (might be due to invalid IL or missing references) //IL_05d3: Unknown result type (might be due to invalid IL or missing references) //IL_0388: Unknown result type (might be due to invalid IL or missing references) //IL_0390: Unknown result type (might be due to invalid IL or missing references) //IL_0395: Unknown result type (might be due to invalid IL or missing references) //IL_03a1: Unknown result type (might be due to invalid IL or missing references) //IL_03a6: Unknown result type (might be due to invalid IL or missing references) //IL_03bf: Unknown result type (might be due to invalid IL or missing references) //IL_0a8c: Unknown result type (might be due to invalid IL or missing references) //IL_0a8e: Unknown result type (might be due to invalid IL or missing references) //IL_09d2: Unknown result type (might be due to invalid IL or missing references) //IL_074b: Unknown result type (might be due to invalid IL or missing references) //IL_0752: Unknown result type (might be due to invalid IL or missing references) //IL_0757: Unknown result type (might be due to invalid IL or missing references) //IL_075c: Unknown result type (might be due to invalid IL or missing references) //IL_0693: Unknown result type (might be due to invalid IL or missing references) //IL_0abe: Unknown result type (might be due to invalid IL or missing references) //IL_0aa9: Unknown result type (might be due to invalid IL or missing references) //IL_0aab: Unknown result type (might be due to invalid IL or missing references) //IL_0aad: Unknown result type (might be due to invalid IL or missing references) //IL_0ab2: 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_09e9: Unknown result type (might be due to invalid IL or missing references) //IL_09f0: Expected O, but got Unknown //IL_09f2: Unknown result type (might be due to invalid IL or missing references) //IL_09f7: Unknown result type (might be due to invalid IL or missing references) //IL_0787: Unknown result type (might be due to invalid IL or missing references) //IL_077e: Unknown result type (might be due to invalid IL or missing references) //IL_05fa: Unknown result type (might be due to invalid IL or missing references) //IL_0600: Invalid comparison between Unknown and I4 //IL_05aa: Unknown result type (might be due to invalid IL or missing references) //IL_05af: Unknown result type (might be due to invalid IL or missing references) //IL_051c: Unknown result type (might be due to invalid IL or missing references) //IL_0521: Unknown result type (might be due to invalid IL or missing references) //IL_0ac3: Unknown result type (might be due to invalid IL or missing references) //IL_0a07: Unknown result type (might be due to invalid IL or missing references) //IL_0a0d: Invalid comparison between Unknown and I4 //IL_078c: Unknown result type (might be due to invalid IL or missing references) //IL_07a2: Unknown result type (might be due to invalid IL or missing references) //IL_07a7: Unknown result type (might be due to invalid IL or missing references) //IL_06b3: Unknown result type (might be due to invalid IL or missing references) //IL_0533: Unknown result type (might be due to invalid IL or missing references) //IL_0538: Unknown result type (might be due to invalid IL or missing references) //IL_053d: Unknown result type (might be due to invalid IL or missing references) //IL_0542: Unknown result type (might be due to invalid IL or missing references) //IL_0546: Unknown result type (might be due to invalid IL or missing references) //IL_054b: Unknown result type (might be due to invalid IL or missing references) //IL_054d: Unknown result type (might be due to invalid IL or missing references) //IL_0555: Unknown result type (might be due to invalid IL or missing references) //IL_03f7: Unknown result type (might be due to invalid IL or missing references) //IL_03fd: Invalid comparison between Unknown and I4 //IL_0ad9: Unknown result type (might be due to invalid IL or missing references) //IL_0ade: Unknown result type (might be due to invalid IL or missing references) //IL_0a20: Unknown result type (might be due to invalid IL or missing references) //IL_0a25: Unknown result type (might be due to invalid IL or missing references) //IL_06e0: Unknown result type (might be due to invalid IL or missing references) //IL_06f8: Unknown result type (might be due to invalid IL or missing references) //IL_06fd: Unknown result type (might be due to invalid IL or missing references) //IL_070e: Unknown result type (might be due to invalid IL or missing references) //IL_0713: Unknown result type (might be due to invalid IL or missing references) //IL_0719: Unknown result type (might be due to invalid IL or missing references) //IL_071e: Unknown result type (might be due to invalid IL or missing references) //IL_056f: Unknown result type (might be due to invalid IL or missing references) //IL_0566: Unknown result type (might be due to invalid IL or missing references) //IL_0568: Unknown result type (might be due to invalid IL or missing references) //IL_041c: Unknown result type (might be due to invalid IL or missing references) //IL_0421: Unknown result type (might be due to invalid IL or missing references) //IL_0af3: Unknown result type (might be due to invalid IL or missing references) //IL_0af5: Unknown result type (might be due to invalid IL or missing references) //IL_07c6: Unknown result type (might be due to invalid IL or missing references) //IL_07cb: Unknown result type (might be due to invalid IL or missing references) //IL_07cd: Unknown result type (might be due to invalid IL or missing references) //IL_07d2: Unknown result type (might be due to invalid IL or missing references) //IL_0625: Unknown result type (might be due to invalid IL or missing references) //IL_0571: Unknown result type (might be due to invalid IL or missing references) //IL_057a: Unknown result type (might be due to invalid IL or missing references) //IL_057f: Unknown result type (might be due to invalid IL or missing references) //IL_0586: Unknown result type (might be due to invalid IL or missing references) //IL_058b: Unknown result type (might be due to invalid IL or missing references) //IL_0590: Unknown result type (might be due to invalid IL or missing references) //IL_0594: Unknown result type (might be due to invalid IL or missing references) //IL_0599: Unknown result type (might be due to invalid IL or missing references) //IL_0a5c: Unknown result type (might be due to invalid IL or missing references) //IL_0a5e: Unknown result type (might be due to invalid IL or missing references) //IL_0900: Unknown result type (might be due to invalid IL or missing references) //IL_090e: 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_0927: Unknown result type (might be due to invalid IL or missing references) //IL_062f: Unknown result type (might be due to invalid IL or missing references) //IL_0631: Unknown result type (might be due to invalid IL or missing references) //IL_0a74: Unknown result type (might be due to invalid IL or missing references) //IL_0a79: Unknown result type (might be due to invalid IL or missing references) //IL_07e6: Unknown result type (might be due to invalid IL or missing references) //IL_07eb: Unknown result type (might be due to invalid IL or missing references) //IL_07ef: Unknown result type (might be due to invalid IL or missing references) //IL_07f4: Unknown result type (might be due to invalid IL or missing references) //IL_07f9: Unknown result type (might be due to invalid IL or missing references) //IL_0803: Unknown result type (might be due to invalid IL or missing references) //IL_0808: Unknown result type (might be due to invalid IL or missing references) //IL_080d: Unknown result type (might be due to invalid IL or missing references) //IL_0830: Unknown result type (might be due to invalid IL or missing references) //IL_083c: Unknown result type (might be due to invalid IL or missing references) //IL_0850: Unknown result type (might be due to invalid IL or missing references) //IL_0866: Unknown result type (might be due to invalid IL or missing references) //IL_086b: Unknown result type (might be due to invalid IL or missing references) //IL_0875: Unknown result type (might be due to invalid IL or missing references) //IL_087a: Unknown result type (might be due to invalid IL or missing references) //IL_0881: Unknown result type (might be due to invalid IL or missing references) //IL_0886: Unknown result type (might be due to invalid IL or missing references) //IL_0890: Unknown result type (might be due to invalid IL or missing references) //IL_0895: Unknown result type (might be due to invalid IL or missing references) //IL_089a: Unknown result type (might be due to invalid IL or missing references) //IL_089c: Unknown result type (might be due to invalid IL or missing references) //IL_08b3: Unknown result type (might be due to invalid IL or missing references) //IL_08b8: Unknown result type (might be due to invalid IL or missing references) //IL_0ba1: Unknown result type (might be due to invalid IL or missing references) //IL_0ba6: Unknown result type (might be due to invalid IL or missing references) //IL_0cf2: Unknown result type (might be due to invalid IL or missing references) //IL_0d04: Unknown result type (might be due to invalid IL or missing references) //IL_0be9: Unknown result type (might be due to invalid IL or missing references) //IL_0d48: Unknown result type (might be due to invalid IL or missing references) //IL_0d5a: Unknown result type (might be due to invalid IL or missing references) //IL_0d5f: Unknown result type (might be due to invalid IL or missing references) //IL_0d69: Unknown result type (might be due to invalid IL or missing references) //IL_0d6e: Unknown result type (might be due to invalid IL or missing references) //IL_0d73: Unknown result type (might be due to invalid IL or missing references) //IL_0c49: Unknown result type (might be due to invalid IL or missing references) //IL_0c54: Unknown result type (might be due to invalid IL or missing references) //IL_0c11: Unknown result type (might be due to invalid IL or missing references) //IL_0da7: Unknown result type (might be due to invalid IL or missing references) //IL_0dac: Unknown result type (might be due to invalid IL or missing references) //IL_0db2: Unknown result type (might be due to invalid IL or missing references) //IL_0db7: Unknown result type (might be due to invalid IL or missing references) //IL_0dc2: Unknown result type (might be due to invalid IL or missing references) //IL_0dc7: Unknown result type (might be due to invalid IL or missing references) //IL_0dcd: Unknown result type (might be due to invalid IL or missing references) //IL_0dd2: Unknown result type (might be due to invalid IL or missing references) //IL_0dd8: Unknown result type (might be due to invalid IL or missing references) //IL_0de2: Unknown result type (might be due to invalid IL or missing references) //IL_0de7: Unknown result type (might be due to invalid IL or missing references) //IL_0dec: Unknown result type (might be due to invalid IL or missing references) //IL_13d4: Unknown result type (might be due to invalid IL or missing references) //IL_13d9: Unknown result type (might be due to invalid IL or missing references) //IL_13df: Unknown result type (might be due to invalid IL or missing references) //IL_13e4: Unknown result type (might be due to invalid IL or missing references) //IL_13ef: Unknown result type (might be due to invalid IL or missing references) //IL_13f4: Unknown result type (might be due to invalid IL or missing references) //IL_13fa: Unknown result type (might be due to invalid IL or missing references) //IL_13ff: Unknown result type (might be due to invalid IL or missing references) //IL_1405: Unknown result type (might be due to invalid IL or missing references) //IL_140f: Unknown result type (might be due to invalid IL or missing references) //IL_1414: Unknown result type (might be due to invalid IL or missing references) //IL_1419: Unknown result type (might be due to invalid IL or missing references) //IL_0cca: Unknown result type (might be due to invalid IL or missing references) //IL_0ccf: Unknown result type (might be due to invalid IL or missing references) //IL_144a: Unknown result type (might be due to invalid IL or missing references) //IL_1455: Unknown result type (might be due to invalid IL or missing references) //IL_1465: Unknown result type (might be due to invalid IL or missing references) //IL_146a: Unknown result type (might be due to invalid IL or missing references) //IL_143e: Unknown result type (might be due to invalid IL or missing references) //IL_1443: Unknown result type (might be due to invalid IL or missing references) //IL_1773: Unknown result type (might be due to invalid IL or missing references) //IL_178c: Unknown result type (might be due to invalid IL or missing references) //IL_1791: Unknown result type (might be due to invalid IL or missing references) //IL_1798: Unknown result type (might be due to invalid IL or missing references) //IL_179d: Unknown result type (might be due to invalid IL or missing references) //IL_17a2: Unknown result type (might be due to invalid IL or missing references) //IL_17a5: Unknown result type (might be due to invalid IL or missing references) //IL_14a4: Unknown result type (might be due to invalid IL or missing references) //IL_14a9: Unknown result type (might be due to invalid IL or missing references) //IL_14ae: Unknown result type (might be due to invalid IL or missing references) //IL_14b3: Unknown result type (might be due to invalid IL or missing references) //IL_14c1: Unknown result type (might be due to invalid IL or missing references) //IL_14c6: Unknown result type (might be due to invalid IL or missing references) //IL_14d3: Unknown result type (might be due to invalid IL or missing references) //IL_14e3: Unknown result type (might be due to invalid IL or missing references) //IL_14ee: Unknown result type (might be due to invalid IL or missing references) //IL_17d7: Unknown result type (might be due to invalid IL or missing references) //IL_17e1: Unknown result type (might be due to invalid IL or missing references) //IL_17e7: Unknown result type (might be due to invalid IL or missing references) //IL_17ca: Unknown result type (might be due to invalid IL or missing references) //IL_17ec: Unknown result type (might be due to invalid IL or missing references) //IL_17f5: Unknown result type (might be due to invalid IL or missing references) //IL_17fa: Unknown result type (might be due to invalid IL or missing references) //IL_17fc: Unknown result type (might be due to invalid IL or missing references) //IL_1815: Unknown result type (might be due to invalid IL or missing references) //IL_181a: Unknown result type (might be due to invalid IL or missing references) //IL_181c: Unknown result type (might be due to invalid IL or missing references) //IL_1821: Unknown result type (might be due to invalid IL or missing references) //IL_1828: Unknown result type (might be due to invalid IL or missing references) //IL_182d: Unknown result type (might be due to invalid IL or missing references) //IL_1832: Unknown result type (might be due to invalid IL or missing references) //IL_1835: Unknown result type (might be due to invalid IL or missing references) //IL_1538: Unknown result type (might be due to invalid IL or missing references) //IL_1543: Unknown result type (might be due to invalid IL or missing references) //IL_154a: Unknown result type (might be due to invalid IL or missing references) //IL_154f: Unknown result type (might be due to invalid IL or missing references) //IL_1554: Unknown result type (might be due to invalid IL or missing references) //IL_155a: Unknown result type (might be due to invalid IL or missing references) //IL_155f: Unknown result type (might be due to invalid IL or missing references) //IL_1564: Unknown result type (might be due to invalid IL or missing references) //IL_1566: Unknown result type (might be due to invalid IL or missing references) //IL_156f: Unknown result type (might be due to invalid IL or missing references) //IL_195d: Unknown result type (might be due to invalid IL or missing references) //IL_1962: Unknown result type (might be due to invalid IL or missing references) //IL_196c: Unknown result type (might be due to invalid IL or missing references) //IL_1971: Unknown result type (might be due to invalid IL or missing references) //IL_1976: Unknown result type (might be due to invalid IL or missing references) //IL_1858: Unknown result type (might be due to invalid IL or missing references) //IL_185d: Unknown result type (might be due to invalid IL or missing references) //IL_1595: Unknown result type (might be due to invalid IL or missing references) //IL_159a: Unknown result type (might be due to invalid IL or missing references) //IL_159f: Unknown result type (might be due to invalid IL or missing references) //IL_15db: Unknown result type (might be due to invalid IL or missing references) //IL_15dd: Unknown result type (might be due to invalid IL or missing references) //IL_15e6: Unknown result type (might be due to invalid IL or missing references) //IL_15a8: Unknown result type (might be due to invalid IL or missing references) //IL_15aa: Unknown result type (might be due to invalid IL or missing references) //IL_15ac: Unknown result type (might be due to invalid IL or missing references) //IL_15b8: Unknown result type (might be due to invalid IL or missing references) //IL_15bd: Unknown result type (might be due to invalid IL or missing references) //IL_15c2: Unknown result type (might be due to invalid IL or missing references) //IL_19ab: Unknown result type (might be due to invalid IL or missing references) //IL_19bb: Unknown result type (might be due to invalid IL or missing references) //IL_19c7: Unknown result type (might be due to invalid IL or missing references) //IL_19e7: Unknown result type (might be due to invalid IL or missing references) //IL_19f1: Unknown result type (might be due to invalid IL or missing references) //IL_1636: Unknown result type (might be due to invalid IL or missing references) //IL_1638: Unknown result type (might be due to invalid IL or missing references) //IL_1644: Unknown result type (might be due to invalid IL or missing references) //IL_1649: Unknown result type (might be due to invalid IL or missing references) //IL_164e: Unknown result type (might be due to invalid IL or missing references) //IL_1650: Unknown result type (might be due to invalid IL or missing references) //IL_1652: Unknown result type (might be due to invalid IL or missing references) //IL_165e: Unknown result type (might be due to invalid IL or missing references) //IL_1663: Unknown result type (might be due to invalid IL or missing references) //IL_1668: Unknown result type (might be due to invalid IL or missing references) //IL_166b: Unknown result type (might be due to invalid IL or missing references) //IL_166d: Unknown result type (might be due to invalid IL or missing references) //IL_1676: Unknown result type (might be due to invalid IL or missing references) //IL_1605: Unknown result type (might be due to invalid IL or missing references) //IL_1610: Unknown result type (might be due to invalid IL or missing references) //IL_1617: Unknown result type (might be due to invalid IL or missing references) //IL_161c: Unknown result type (might be due to invalid IL or missing references) //IL_1627: Unknown result type (might be due to invalid IL or missing references) //IL_162c: Unknown result type (might be due to invalid IL or missing references) //IL_16df: Unknown result type (might be due to invalid IL or missing references) //IL_16e4: Unknown result type (might be due to invalid IL or missing references) //IL_16ef: Unknown result type (might be due to invalid IL or missing references) //IL_16f6: Unknown result type (might be due to invalid IL or missing references) //IL_16fb: Unknown result type (might be due to invalid IL or missing references) //IL_1700: Unknown result type (might be due to invalid IL or missing references) //IL_1695: Unknown result type (might be due to invalid IL or missing references) //IL_169a: Unknown result type (might be due to invalid IL or missing references) //IL_16a6: Unknown result type (might be due to invalid IL or missing references) //IL_16b1: Unknown result type (might be due to invalid IL or missing references) //IL_16b8: Unknown result type (might be due to invalid IL or missing references) //IL_16bd: Unknown result type (might be due to invalid IL or missing references) //IL_16c2: Unknown result type (might be due to invalid IL or missing references) //IL_16cd: Unknown result type (might be due to invalid IL or missing references) //IL_16d2: Unknown result type (might be due to invalid IL or missing references) //IL_189a: Unknown result type (might be due to invalid IL or missing references) //IL_171d: Unknown result type (might be due to invalid IL or missing references) //IL_171f: Unknown result type (might be due to invalid IL or missing references) //IL_1724: Unknown result type (might be due to invalid IL or missing references) //IL_1a42: Unknown result type (might be due to invalid IL or missing references) //IL_18e1: Unknown result type (might be due to invalid IL or missing references) //IL_18a7: Unknown result type (might be due to invalid IL or missing references) //IL_18c7: Unknown result type (might be due to invalid IL or missing references) //IL_1749: Unknown result type (might be due to invalid IL or missing references) //IL_1750: Unknown result type (might be due to invalid IL or missing references) //IL_175d: Unknown result type (might be due to invalid IL or missing references) //IL_1762: Unknown result type (might be due to invalid IL or missing references) //IL_1a5b: Unknown result type (might be due to invalid IL or missing references) //IL_1a6b: Unknown result type (might be due to invalid IL or missing references) //IL_194b: Unknown result type (might be due to invalid IL or missing references) //IL_18f6: Unknown result type (might be due to invalid IL or missing references) //IL_1910: Unknown result type (might be due to invalid IL or missing references) //IL_192b: Unknown result type (might be due to invalid IL or missing references) //IL_0ee6: Unknown result type (might be due to invalid IL or missing references) //IL_0ee8: Unknown result type (might be due to invalid IL or missing references) //IL_1a8b: Unknown result type (might be due to invalid IL or missing references) //IL_1a90: Unknown result type (might be due to invalid IL or missing references) //IL_1a9c: Unknown result type (might be due to invalid IL or missing references) //IL_1aa1: Unknown result type (might be due to invalid IL or missing references) //IL_1ab3: Unknown result type (might be due to invalid IL or missing references) //IL_1add: Unknown result type (might be due to invalid IL or missing references) //IL_1ae4: Expected O, but got Unknown //IL_1ae6: Unknown result type (might be due to invalid IL or missing references) //IL_1aeb: Unknown result type (might be due to invalid IL or missing references) //IL_0f2a: Unknown result type (might be due to invalid IL or missing references) //IL_0f2f: Unknown result type (might be due to invalid IL or missing references) //IL_0f31: Unknown result type (might be due to invalid IL or missing references) //IL_0f36: Unknown result type (might be due to invalid IL or missing references) //IL_0f3e: Unknown result type (might be due to invalid IL or missing references) //IL_0f43: Unknown result type (might be due to invalid IL or missing references) //IL_13c3: Unknown result type (might be due to invalid IL or missing references) //IL_13c5: Unknown result type (might be due to invalid IL or missing references) //IL_1af9: Unknown result type (might be due to invalid IL or missing references) //IL_1aff: Invalid comparison between Unknown and I4 //IL_1b15: Unknown result type (might be due to invalid IL or missing references) //IL_1b2d: Unknown result type (might be due to invalid IL or missing references) //IL_1b32: Unknown result type (might be due to invalid IL or missing references) //IL_0f54: Unknown result type (might be due to invalid IL or missing references) //IL_0f56: Unknown result type (might be due to invalid IL or missing references) //IL_0f5e: Unknown result type (might be due to invalid IL or missing references) //IL_0f63: Unknown result type (might be due to invalid IL or missing references) //IL_0f68: Unknown result type (might be due to invalid IL or missing references) //IL_0f6a: Unknown result type (might be due to invalid IL or missing references) //IL_0f6c: Unknown result type (might be due to invalid IL or missing references) //IL_0f80: Unknown result type (might be due to invalid IL or missing references) //IL_0f85: Unknown result type (might be due to invalid IL or missing references) //IL_0f8a: Unknown result type (might be due to invalid IL or missing references) //IL_0f8c: Unknown result type (might be due to invalid IL or missing references) //IL_0f8f: Unknown result type (might be due to invalid IL or missing references) //IL_0fb4: Unknown result type (might be due to invalid IL or missing references) //IL_0fb7: Unknown result type (might be due to invalid IL or missing references) //IL_1179: Unknown result type (might be due to invalid IL or missing references) //IL_1184: Unknown result type (might be due to invalid IL or missing references) //IL_1189: Unknown result type (might be due to invalid IL or missing references) //IL_118e: Unknown result type (might be due to invalid IL or missing references) //IL_1204: Unknown result type (might be due to invalid IL or missing references) //IL_1206: Unknown result type (might be due to invalid IL or missing references) //IL_121b: Unknown result type (might be due to invalid IL or missing references) //IL_1223: Unknown result type (might be due to invalid IL or missing references) //IL_11b7: Unknown result type (might be due to invalid IL or missing references) //IL_11bb: Unknown result type (might be due to invalid IL or missing references) //IL_1262: Unknown result type (might be due to invalid IL or missing references) //IL_1265: Unknown result type (might be due to invalid IL or missing references) //IL_126a: Unknown result type (might be due to invalid IL or missing references) //IL_1032: Unknown result type (might be due to invalid IL or missing references) //IL_1034: Unknown result type (might be due to invalid IL or missing references) //IL_1043: Unknown result type (might be due to invalid IL or missing references) //IL_1048: Unknown result type (might be due to invalid IL or missing references) //IL_104d: Unknown result type (might be due to invalid IL or missing references) //IL_1053: Unknown result type (might be due to invalid IL or missing references) //IL_1058: Unknown result type (might be due to invalid IL or missing references) //IL_105d: Unknown result type (might be due to invalid IL or missing references) //IL_100d: Unknown result type (might be due to invalid IL or missing references) //IL_100f: Unknown result type (might be due to invalid IL or missing references) //IL_1013: Unknown result type (might be due to invalid IL or missing references) //IL_1018: Unknown result type (might be due to invalid IL or missing references) //IL_101d: Unknown result type (might be due to invalid IL or missing references) //IL_0fef: Unknown result type (might be due to invalid IL or missing references) //IL_0ff1: Unknown result type (might be due to invalid IL or missing references) //IL_0ff3: Unknown result type (might be due to invalid IL or missing references) //IL_0ff7: Unknown result type (might be due to invalid IL or missing references) //IL_0ffc: Unknown result type (might be due to invalid IL or missing references) //IL_1001: Unknown result type (might be due to invalid IL or missing references) //IL_112e: Unknown result type (might be due to invalid IL or missing references) //IL_1130: Unknown result type (might be due to invalid IL or missing references) //IL_1132: Unknown result type (might be due to invalid IL or missing references) //IL_1136: Unknown result type (might be due to invalid IL or missing references) //IL_113b: Unknown result type (might be due to invalid IL or missing references) //IL_1140: Unknown result type (might be due to invalid IL or missing references) //IL_108c: Unknown result type (might be due to invalid IL or missing references) //IL_1341: Unknown result type (might be due to invalid IL or missing references) //IL_1343: Unknown result type (might be due to invalid IL or missing references) //IL_134b: Unknown result type (might be due to invalid IL or missing references) //IL_1350: Unknown result type (might be due to invalid IL or missing references) //IL_1355: Unknown result type (might be due to invalid IL or missing references) //IL_1359: Unknown result type (might be due to invalid IL or missing references) //IL_13aa: Unknown result type (might be due to invalid IL or missing references) //IL_13ac: Unknown result type (might be due to invalid IL or missing references) //IL_12d2: Unknown result type (might be due to invalid IL or missing references) //IL_12da: Unknown result type (might be due to invalid IL or missing references) //IL_10da: Unknown result type (might be due to invalid IL or missing references) //IL_10df: Unknown result type (might be due to invalid IL or missing references) //IL_10e1: Unknown result type (might be due to invalid IL or missing references) //IL_10e3: Unknown result type (might be due to invalid IL or missing references) //IL_10ef: Unknown result type (might be due to invalid IL or missing references) //IL_10f4: Unknown result type (might be due to invalid IL or missing references) //IL_10f9: Unknown result type (might be due to invalid IL or missing references) //IL_10ab: Unknown result type (might be due to invalid IL or missing references) //IL_10ad: Unknown result type (might be due to invalid IL or missing references) //IL_10af: Unknown result type (might be due to invalid IL or missing references) //IL_10b3: Unknown result type (might be due to invalid IL or missing references) //IL_10b8: Unknown result type (might be due to invalid IL or missing references) //IL_10cc: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)agent == (Object)null || isJumping || isPreparingToJump) { return; } TryOpenNearbyDoors(); bool num = state == PetState.CarryItemToCart; float y = ((Component)this).transform.localScale.y; float num2 = 0.15f * y; float num3 = 0.55f * y; float num4 = (num ? 0.85f : 1.25f) * y; int num5 = GetGroundMask(); Vector3 position = ((Component)this).transform.position; position.y = 0f; Vector3 val = point; val.y = 0f; float num6 = Vector3.Distance(position, val); float num7 = ((Mathf.Abs(((Component)this).transform.position.y - point.y) > 0.6f) ? 0.1f : Mathf.Max(0.05f, stoppingDistance)); float num8 = Vector3.Distance(((Component)this).transform.position, lastStuckCheckPos); bool num9; Vector3 val2; if (!((Behaviour)agent).enabled || !agent.isOnNavMesh) { num9 = num8 > 0.02f; } else { val2 = agent.velocity; num9 = ((Vector3)(ref val2)).sqrMagnitude > 0.05f; } bool flag = num9; if (flag) { stuckTimer = Mathf.Max(0f, stuckTimer - Time.deltaTime * 2f); } else if (num6 <= num7) { stuckTimer = 0f; } if (panicTimer > 0f) { panicTimer -= Time.deltaTime; if (panicTimer <= 0f) { panicDirection = Vector3.zero; } } for (int num10 = deadEndMemories.Count - 1; num10 >= 0; num10--) { deadEndMemories[num10].Timer -= Time.deltaTime; if (deadEndMemories[num10].Timer <= 0f) { deadEndMemories.RemoveAt(num10); } } if (navMeshCooldown > 0f) { navMeshCooldown -= Time.deltaTime; } if (escapeTimer > 0f) { escapeTimer -= Time.deltaTime; } bool flag2 = false; Vector3 val3 = point; bool flag3 = point.y - ((Component)this).transform.position.y > 0.35f; NavMeshHit val4 = default(NavMeshHit); if (NavMesh.SamplePosition(point, ref val4, flag3 ? 8f : 4f, -1)) { flag2 = true; val3 = ((NavMeshHit)(ref val4)).position; } if (float.IsInfinity(val3.x) || float.IsNaN(val3.x) || float.IsInfinity(val3.y) || float.IsNaN(val3.y) || float.IsInfinity(val3.z) || float.IsNaN(val3.z)) { val3 = ((Component)this).transform.position; } if (((Behaviour)agent).enabled && agent.isOnNavMesh) { agent.isStopped = false; agent.autoBraking = false; agent.stoppingDistance = num7; bool num11 = PetSpawner.IsShopContext(); bool flag4 = false; string reason = ""; RaycastHit val5 = default(RaycastHit); bool flag5 = false; if (num11) { val2 = agent.velocity; Vector3 val6; if (!(((Vector3)(ref val2)).sqrMagnitude > 0.05f)) { val6 = ((Component)this).transform.forward; } else { val2 = agent.velocity; val6 = ((Vector3)(ref val2)).normalized; } Vector3 val7 = val6; Vector3 val8 = ((Component)this).transform.position + Vector3.up * (0.45f * y); float num12 = 2.4f * y; float num13 = 0.32f * y; flag5 = Physics.SphereCast(val8, num13, val7, ref val5, num12, num5, (QueryTriggerInteraction)1) && !IsColliderPlayerOrItem(((RaycastHit)(ref val5)).collider); bool flag6 = agent.hasPath && (int)agent.pathStatus == 1 && agent.remainingDistance < 0.8f; val2 = agent.velocity; bool flag7 = ((Vector3)(ref val2)).sqrMagnitude < 0.05f && num6 > num7 + 0.5f; if (flag5 && !isPreparingToJump && !flag3) { flag4 = true; reason = "Obstáculo físico (mesa/prateleira) detectado à frente"; } else if (!flag3 && !flag2) { flag4 = true; reason = "Alvo fora da NavMesh"; } else if (!flag3 && flag6) { flag4 = true; reason = "Fim da NavMesh (transição para piso não mapeado)"; } else if (flag7 && stuckTimer > 0.5f && !isPreparingToJump) { flag4 = true; reason = "Travamento físico por 0.5s"; } } if (!flag4 || !(navMeshCooldown <= 0f)) { bool num14 = float.IsInfinity(lastDestination.x) || Vector3.SqrMagnitude(val3 - lastDestination) > 0.25f; bool flag8 = !agent.hasPath || (int)agent.pathStatus == 2; if ((num14 || flag8) && Time.time >= lastSetDestinationTime + 0.15f && agent.SetDestination(val3)) { lastDestination = val3; lastSetDestinationTime = Time.time; } return; } LogNavMeshTransition(toNavMesh: false, reason); if (agent.isOnNavMesh) { if (agent.hasPath) { agent.ResetPath(); } agent.isStopped = true; } ((Behaviour)agent).enabled = false; navMeshCooldown = 0.35f; if (flag5) { val2 = ((RaycastHit)(ref val5)).normal; if (((Vector3)(ref val2)).sqrMagnitude > 0.1f) { val2 = Vector3.Cross(((RaycastHit)(ref val5)).normal, Vector3.up); Vector3 normalized = ((Vector3)(ref val2)).normalized; Vector3 val9 = ((Vector3.Dot(normalized, ((Component)this).transform.right) > 0f) ? normalized : (-normalized)); val2 = ((Component)this).transform.forward + val9 * 1.5f; smoothedManualDir = ((Vector3)(ref val2)).normalized; goto IL_0642; } } smoothedManualDir = ((Component)this).transform.forward; } goto IL_0642; IL_0642: if (((Behaviour)agent).enabled) { return; } NavMeshHit val10 = default(NavMeshHit); if (navMeshCooldown <= 0f && !isJumping && panicTimer <= 0f && escapeTimer <= 0f && NavMesh.SamplePosition(((Component)this).transform.position, ref val10, 0.6f, -1) && PlaceOnSupportSurface(out var surfaceY) && Mathf.Abs(((NavMeshHit)(ref val10)).position.y - surfaceY) <= 0.35f) { ((Behaviour)agent).enabled = true; agent.Warp(((NavMeshHit)(ref val10)).position); agent.isStopped = false; lastDestination = Vector3.positiveInfinity; lastSetDestinationTime = 0f; panicDirection = Vector3.zero; smoothedManualDir = Vector3.zero; return; } if (state == PetState.CarryItemToCart && navMeshCooldown <= 0f && !isJumping) { Vector3 val11 = point - ((Component)this).transform.position; val11.y = 0f; Vector3 val12 = ((((Vector3)(ref val11)).sqrMagnitude > 0.01f) ? ((Vector3)(ref val11)).normalized : ((Component)this).transform.forward); float[] obj = new float[8] { 0f, 45f, -45f, 90f, -90f, 135f, -135f, 180f }; bool flag9 = false; Vector3 val13 = Vector3.zero; float[] array = obj; RaycastHit val15 = default(RaycastHit); NavMeshHit val16 = default(NavMeshHit); foreach (float num15 in array) { Vector3 val14 = Quaternion.Euler(0f, num15, 0f) * val12; for (float num16 = 0.5f; num16 <= 2.5f; num16 += 0.5f) { if (Physics.Raycast(((Component)this).transform.position + val14 * num16 + Vector3.up * 0.5f, Vector3.down, ref val15, 6f, GetGroundMask(), (QueryTriggerInteraction)1) && ((Component)this).transform.position.y - ((RaycastHit)(ref val15)).point.y > 0.35f && NavMesh.SamplePosition(((RaycastHit)(ref val15)).point, ref val16, 0.5f, -1)) { Vector3 val17 = ((NavMeshHit)(ref val16)).position + Vector3.up * 0.35f; Vector3 val18 = ((NavMeshHit)(ref val16)).position + Vector3.up * 1.3f; if (!Physics.CheckCapsule(val17, val18, 0.25f, GetGroundMask(), (QueryTriggerInteraction)1)) { val13 = ((NavMeshHit)(ref val16)).position; flag9 = true; break; } } } if (flag9) { break; } } if (flag9) { ((Behaviour)agent).enabled = true; agent.Warp(val13); agent.nextPosition = val13; agent.isStopped = false; lastDestination = Vector3.positiveInfinity; navMeshCooldown = 0.5f; return; } } Vector3 val19 = ((Component)this).transform.position + Vector3.up * (num3 + num2); Vector3 val20 = ((Component)this).transform.position + Vector3.up * Mathf.Max(num4, num3 + num2 + 0.1f); if (!(num6 > num7) && !(escapeTimer > 0f) && !(panicTimer > 0f)) { return; } Vector3 val21 = point; bool flag10 = false; if (Time.time > nextNavMeshCheckTime) { nextNavMeshCheckTime = Time.time + 0.5f; NavMeshHit val22 = default(NavMeshHit); if (NavMesh.SamplePosition(((Component)this).transform.position, ref val22, 10f, -1)) { NavMeshPath val23 = new NavMeshPath(); if (NavMesh.CalculatePath(((NavMeshHit)(ref val22)).position, point, -1, val23) && (int)val23.status != 2) { int cornersNonAlloc = val23.GetCornersNonAlloc(navMeshCorners); val21 = ((NavMeshHit)(ref val22)).position; Vector3 val24 = default(Vector3); for (int j = 1; j < cornersNonAlloc; j++) { ((Vector3)(ref val24))..ctor(navMeshCorners[j].x, 0f, navMeshCorners[j].z); if (Vector3.Distance(position, val24) > 0.75f) { val21 = navMeshCorners[j]; break; } } flag10 = true; } } } Vector3 val25 = val21; val25.y = 0f; Vector3 normalized2; if (!(panicTimer > 0f)) { val2 = val25 - position; normalized2 = ((Vector3)(ref val2)).normalized; } else { normalized2 = panicDirection; } Vector3 val26 = normalized2; if (((Vector3)(ref val26)).sqrMagnitude < 0.001f) { val26 = ((Component)this).transform.forward; } if (((Vector3)(ref cachedBestDir)).sqrMagnitude < 0.001f) { cachedBestDir = val26; } float num17 = ((state != PetState.CarryItemToCart) ? ((PetSettings.Speed != null) ? PetSettings.Speed.Value : 3.5f) : ((PetSettings.CarrySpeed != null) ? PetSettings.CarrySpeed.Value : 4f)) * Time.deltaTime; bool flag11 = PetSettings.EnableDebugRays != null && PetSettings.EnableDebugRays.Value; float duration = ((PetSettings.DebugRaysFadeTime != null) ? PetSettings.DebugRaysFadeTime.Value : 0.25f); stuckPositionCheckTimer += Time.deltaTime; if (stuckPositionCheckTimer >= 0.75f) { stuckPositionCheckTimer = 0f; lastStuckCheckPos = ((Component)this).transform.position; if (num6 > num7 && !flag) { stuckTimer += 0.75f; NavMeshHit val27 = default(NavMeshHit); if (stuckTimer > 1.5f && state == PetState.CarryItemToCart && NavMesh.SamplePosition(((Component)this).transform.position, ref val27, 4f, -1)) { ((Behaviour)agent).enabled = true; agent.Warp(((NavMeshHit)(ref val27)).position); agent.isStopped = false; stuckTimer = 0f; return; } bool flag12 = false; for (int k = 0; k < deadEndMemories.Count; k++) { if (Vector3.Distance(deadEndMemories[k].Position, ((Component)this).transform.position) < 0.8f) { deadEndMemories[k].Timer = 8f; flag12 = true; break; } } if (!flag12 && Time.time >= lastPinDropTime + 0.5f) { lastPinDropTime = Time.time; deadEndMemories.Add(new DeadEndMemory { Position = ((Component)this).transform.position, Timer = 8f }); } } } bool flag13 = false; for (int l = 0; l < deadEndMemories.Count; l++) { if (Vector3.Distance(((Component)this).transform.position, deadEndMemories[l].Position) < 3f) { flag13 = true; break; } } if (flag11) { for (int m = 0; m < deadEndMemories.Count; m++) { PetRuntimeDrawer.DrawLine(deadEndMemories[m].Position, deadEndMemories[m].Position + Vector3.up * 2f, Color.red, duration); } if (panicTimer > 0f) { PetRuntimeDrawer.DrawLine(((Component)this).transform.position + Vector3.up * num3, ((Component)this).transform.position + Vector3.up * num3 + panicDirection * 2f, Color.yellow, duration); } } float num18 = ((PetSettings.GhostProbeUpdateInterval != null) ? PetSettings.GhostProbeUpdateInterval.Value : 0.1f); if (Time.time >= nextProbeTime) { nextProbeTime = Time.time + num18; bool num19 = PetSettings.EnableGhostProbing != null && PetSettings.EnableGhostProbing.Value; int num20 = ((PetSettings.GhostProbeRays != null) ? PetSettings.GhostProbeRays.Value : 9); if (!num19) { num20 = 1; } if (num20 < 1) { num20 = 1; } if (num20 > 21) { num20 = 21; } if (num20 % 2 == 0) { num20++; } List list = new List { 0f }; int num21 = (num20 - 1) / 2; float num22 = 70f; float num23 = ((num21 > 0) ? (num22 / (float)num21) : 0f); for (int n = 1; n <= num21; n++) { list.Add(num23 * (float)n); list.Add((0f - num23) * (float)n); } float num24 = float.NegativeInfinity; Vector3 val28 = val26; float num25 = ((PetSettings.GhostProbeDistance != null) ? PetSettings.GhostProbeDistance.Value : 2.5f); int num26 = 5; float num27 = num25 / (float)num26; RaycastHit val33 = default(RaycastHit); RaycastHit val34 = default(RaycastHit); RaycastHit val35 = default(RaycastHit); for (int num28 = 0; num28 < list.Count; num28++) { Vector3 val29 = Quaternion.Euler(0f, list[num28], 0f) * val26; Vector3 val30 = ((Component)this).transform.position; float num29 = 0f; for (int num30 = 0; num30 < num26; num30++) { Vector3 val31 = val30 + Vector3.up * (num3 + num2); Vector3 val32 = val30 + Vector3.up * Mathf.Max(num4, num3 + num2 + 0.1f); bool flag14 = Physics.SphereCast(val31, num2, val29, ref val33, num27, num5, (QueryTriggerInteraction)1) && !IsColliderPlayerOrItem(((RaycastHit)(ref val33)).collider); bool flag15 = Physics.SphereCast(val32, num2, val29, ref val34, num27, num5, (QueryTriggerInteraction)1) && !IsColliderPlayerOrItem(((RaycastHit)(ref val34)).collider); if (!flag14 && !flag15) { num29 += num27; if (flag11) { PetRuntimeDrawer.DrawLine(val31, val31 + val29 * num27, Color.cyan, duration); } val30 += val29 * num27; continue; } if (flag14 && !flag15) { if (!Physics.Raycast(val31 + val29 * (((RaycastHit)(ref val33)).distance + 0.1f) + Vector3.up * num3, Vector3.down, ref val35, num3 * 2.5f, num5, (QueryTriggerInteraction)1) || IsColliderPlayerOrItem(((RaycastHit)(ref val35)).collider) || !(((RaycastHit)(ref val35)).normal.y > 0.5f)) { break; } num29 += num27; if (flag11) { PetRuntimeDrawer.DrawLine(val31, val31 + val29 * num27, new Color(1f, 0.5f, 0f), duration); } val30 = ((RaycastHit)(ref val35)).point; val30 += val29 * (num27 - ((RaycastHit)(ref val33)).distance); continue; } float num31 = (flag15 ? ((RaycastHit)(ref val34)).distance : ((RaycastHit)(ref val33)).distance); num29 += Mathf.Max(0.01f, num31 - 0.05f); if (flag11) { PetRuntimeDrawer.DrawLine(val31, val31 + val29 * num31, Color.red, duration); } break; } float num32 = 0f; for (int num33 = 0; num33 < deadEndMemories.Count; num33++) { Vector3 val36 = deadEndMemories[num33].Position - ((Component)this).transform.position; val36.y = 0f; float magnitude = ((Vector3)(ref val36)).magnitude; if (magnitude < 1.5f && magnitude > 0.01f) { float num34 = Vector3.Dot(val29, ((Vector3)(ref val36)).normalized); if (num34 > 0f) { num32 += num34 * (1f - magnitude / 1.5f) * 5f; } } } float num35 = (Vector3.Dot(val29, val26) + 1f) * 0.5f; float num36 = Vector3.Dot(val29, ((Vector3)(ref smoothedManualDir)).normalized); float num37 = ((num36 > 0.5f) ? (num36 * 1.5f) : 0f); float num38 = 0f; if (((Vector3)(ref lastWallHitNormal)).sqrMagnitude > 0.1f) { float num39 = Vector3.Dot(val29, -lastWallHitNormal); if (num39 > 0f) { num38 = num39 * 15f; } } float num40 = 0f; float num41 = 0f; if (flag13 && panicTimer <= 0f) { num40 = ((num28 % 2 != 0) ? 0.4f : 0f); if (num36 > 0.1f) { num37 += num36 * 4f; } if (Vector3.Angle(val26, ((Vector3)(ref smoothedManualDir)).normalized) > 30f && num36 < 0f) { num41 = 15f; } } float num42 = num29 / num25; float num43 = 0f; if (num42 < 0.4f) { num43 = 20f; } else if (num42 < 1f) { num43 = (1f - num42) * 10f; } float num44 = 0f; if (flag10) { val2 = val21 - ((Component)this).transform.position; float num45 = Vector3.Dot(val29, ((Vector3)(ref val2)).normalized); if (num45 > 0.3f) { num44 = num45 * 3f; } } float num46 = num42 * 10f + num35 * 3f + num44 + num37 + num40 - num43 - num32 - num41 - num38; if (num46 > num24) { num24 = num46; val28 = val29; } } cachedBestDir = val28; } if (flag11) { PetRuntimeDrawer.DrawLine(((Component)this).transform.position + Vector3.up * num3, ((Component)this).transform.position + Vector3.up * num3 + cachedBestDir * 1.8f, Color.green, duration); } if (((Vector3)(ref smoothedManualDir)).sqrMagnitude < 0.001f) { smoothedManualDir = ((Component)this).transform.forward; } smoothedManualDir = Vector3.Slerp(smoothedManualDir, ((Vector3)(ref cachedBestDir)).normalized, Time.deltaTime * 12f); Vector3 val37 = default(Vector3); ((Vector3)(ref val37))..ctor(smoothedManualDir.x, 0f, smoothedManualDir.z); if (((Vector3)(ref val37)).sqrMagnitude > 0.01f) { Quaternion val38 = Quaternion.LookRotation(((Vector3)(ref val37)).normalized, Vector3.up); ((Component)this).transform.rotation = Quaternion.RotateTowards(((Component)this).transform.rotation, val38, 480f * Time.deltaTime); float num47 = Vector3.Angle(((Component)this).transform.forward, ((Vector3)(ref smoothedManualDir)).normalized); float num48 = 1f; if (num47 > 45f) { num48 = Mathf.Clamp01((120f - num47) / 75f); } if (num48 > 0.05f) { float num49 = num17 * num48; Vector3 val39 = ((Component)this).transform.position + ((Vector3)(ref smoothedManualDir)).normalized * num49 + Vector3.up * num3; RaycastHit safeHit = default(RaycastHit); if (!Physics.SphereCast(val39, 0.15f * y, Vector3.down, ref safeHit, 4f * y, num5, (QueryTriggerInteraction)1)) { num49 = 0f; lastWallHitNormal = -((Vector3)(ref smoothedManualDir)).normalized; if (flag11) { PetRuntimeDrawer.DrawLine(val39, val39 + Vector3.down * (4f * y), Color.magenta, duration); } } if (num49 > 0f) { if (!CheckPathClear(val19, val20, num2, ((Vector3)(ref smoothedManualDir)).normalized, num49 + 0.05f, num5, out var safeHit2)) { Transform transform = ((Component)this).transform; transform.position += ((Vector3)(ref smoothedManualDir)).normalized * num49; lastWallHitNormal = Vector3.zero; } else { Vector3 p = val19 + Vector3.up * (num3 * 0.5f); Vector3 p2 = val20 + Vector3.up * (num3 * 0.5f); if (!CheckPathClear(p, p2, num2, ((Vector3)(ref smoothedManualDir)).normalized, num49 + 0.05f, num5, out safeHit)) { Transform transform2 = ((Component)this).transform; transform2.position += Vector3.up * (num3 * 0.35f) + ((Vector3)(ref smoothedManualDir)).normalized * num49; lastWallHitNormal = Vector3.zero; } else { lastWallHitNormal = ((RaycastHit)(ref safeHit2)).normal; Vector3 val40 = Vector3.ProjectOnPlane(((Vector3)(ref smoothedManualDir)).normalized, ((RaycastHit)(ref safeHit2)).normal); val40.y = 0f; if (((Vector3)(ref val40)).sqrMagnitude > 0.01f && !CheckPathClear(val19, val20, num2, ((Vector3)(ref val40)).normalized, num49 * 0.7f + 0.02f, num5, out safeHit)) { Transform transform3 = ((Component)this).transform; transform3.position += ((Vector3)(ref val40)).normalized * (num49 * 0.7f); } } } } } } float safeRaycastHeight = GetSafeRaycastHeight(((Component)this).transform.position, 0.65f * y); Vector3 origin = ((Component)this).transform.position + Vector3.up * safeRaycastHeight; float surfaceY2; bool flag16 = FindSupportSurface(origin, safeRaycastHeight + 2.5f, out surfaceY2); Vector3 val41 = ((((Vector3)(ref smoothedManualDir)).sqrMagnitude > 0.01f) ? (((Vector3)(ref smoothedManualDir)).normalized * 0.3f * y) : Vector3.zero); float safeRaycastHeight2 = GetSafeRaycastHeight(((Component)this).transform.position + val41, 0.65f * y); Vector3 origin2 = ((Component)this).transform.position + val41 + Vector3.up * safeRaycastHeight2; float surfaceY3; bool flag17 = FindSupportSurface(origin2, safeRaycastHeight2 + 2.5f, out surfaceY3); RaycastHit val42 = default(RaycastHit); if (flag16 || flag17) { Vector3 position2 = ((Component)this).transform.position; float num50 = (flag16 ? surfaceY2 : surfaceY3); if (flag17 && surfaceY3 > num50 && surfaceY3 - num50 <= num3) { num50 = surfaceY3; } else if (flag17 && flag16 && surfaceY2 < surfaceY3 - 0.5f) { num50 = surfaceY3; } if (position2.y < num50) { position2.y = Mathf.Lerp(position2.y, num50, 30f * Time.deltaTime); if (num50 - position2.y < 0.02f) { position2.y = num50; } } else if (position2.y > num50) { float num51 = Mathf.Min(30f, 15f + (position2.y - num50) * 10f); position2.y = Mathf.Lerp(position2.y, num50, num51 * Time.deltaTime); if (position2.y - num50 < 0.02f) { position2.y = num50; } } ((Component)this).transform.position = position2; } else if (Physics.Raycast(((Component)this).transform.position + Vector3.up * 0.5f, Vector3.down, ref val42, 4f, GetGroundMask(), (QueryTriggerInteraction)1) && !IsColliderPlayerOrItem(((RaycastHit)(ref val42)).collider)) { ((Component)this).transform.position = new Vector3(((Component)this).transform.position.x, Mathf.Lerp(((Component)this).transform.position.y, ((RaycastHit)(ref val42)).point.y, 25f * Time.deltaTime), ((Component)this).transform.position.z); } ResolvePenetrations(); NavMeshHit val43 = default(NavMeshHit); RaycastHit val44 = default(RaycastHit); if (navMeshCooldown <= 0f && escapeTimer <= 0f && panicTimer <= 0f && !isJumping && NavMesh.SamplePosition(((Component)this).transform.position, ref val43, 0.8f, -1) && Mathf.Abs(((NavMeshHit)(ref val43)).position.y - ((Component)this).transform.position.y) <= 0.35f && (!Physics.SphereCast(((Component)this).transform.position + Vector3.up * (0.35f * y), 0.28f * y, ((Component)this).transform.forward, ref val44, 0.6f * y, num5, (QueryTriggerInteraction)1) || IsColliderPlayerOrItem(((RaycastHit)(ref val44)).collider))) { NavMeshPath val45 = new NavMeshPath(); if (NavMesh.CalculatePath(((NavMeshHit)(ref val43)).position, val3, -1, val45) && (int)val45.status != 2) { ((Behaviour)agent).enabled = true; agent.Warp(((NavMeshHit)(ref val43)).position); agent.isStopped = false; lastDestination = Vector3.positiveInfinity; lastSetDestinationTime = 0f; LogNavMeshTransition(toNavMesh: true, "Caminho desobstruído, retornando para NavMesh"); } } } private void StopMoving() { //IL_005e: Unknown result type (might be due to invalid IL or missing references) //IL_0063: Unknown result type (might be due to invalid IL or missing references) //IL_0053: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)agent == (Object)null) { return; } if (((Behaviour)agent).enabled && agent.isOnNavMesh) { agent.isStopped = true; if (agent.hasPath) { agent.ResetPath(); } agent.velocity = Vector3.zero; } lastDestination = Vector3.positiveInfinity; lastSetDestinationTime = 0f; } } [HarmonyPatch] internal static class PatchPlayerChatCommand { [HarmonyPatch(typeof(PlayerAvatar), "ChatMessageSendRPC")] [HarmonyPostfix] private static void PostfixMultiplayer(PlayerAvatar __instance, string _message) { if (PhotonNetwork.IsConnectedAndReady && PhotonNetwork.InRoom && !PhotonNetwork.OfflineMode) { HandleChatCommand(__instance, _message); } } [HarmonyPatch(typeof(PlayerAvatar), "ChatMessageSpeak")] [HarmonyPostfix] private static void PostfixSingleplayer(PlayerAvatar __instance, string _message) { if (!PhotonNetwork.IsConnectedAndReady || !PhotonNetwork.InRoom || PhotonNetwork.OfflineMode) { HandleChatCommand(__instance, _message); } } private static void HandleChatCommand(PlayerAvatar sender, string rawMessage) { //IL_051a: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)sender == (Object)null || string.IsNullOrWhiteSpace(rawMessage)) { return; } string text = rawMessage.ToLowerInvariant().Trim(); if (!text.Contains("aino") && !text.Contains("ai-chan") && !text.Contains("aichan") && !text.Contains("pet")) { return; } PetCompanionController petCompanionController = Object.FindObjectOfType(); if ((Object)(object)petCompanionController == (Object)null) { return; } bool flag = !PhotonNetwork.IsConnectedAndReady || !PhotonNetwork.InRoom || PhotonNetwork.OfflineMode; bool flag2 = flag || (Object)(object)sender == (Object)(object)SemiFunc.PlayerAvatarLocal(); bool flag3 = flag || (Object)(object)petCompanionController.owner == (Object)null || (Object)(object)petCompanionController.owner == (Object)(object)sender || ((Object)(object)petCompanionController.owner.photonView != (Object)null && (Object)(object)sender.photonView != (Object)null && petCompanionController.owner.photonView.ViewID == sender.photonView.ViewID); if (flag2) { if (text.Contains("help") || text.Contains("commands") || text.Contains("ajuda")) { Plugin.LogDebug(Plugin.LogCategory.AiInteract, "Displaying help message on local player screen."); petCompanionController.ShowHelpInfo(); return; } if (text.Contains("net") || text.Contains("rede")) { Plugin.Log.LogInfo((object)"Command (Local): Network Stats requested via chat."); PetNetworkProfiler.Instance?.PrintStats("COMANDO CHAT"); return; } } if (!flag && !PhotonNetwork.IsMasterClient) { return; } if (text.Contains("jump") || text.Contains("pula") || text.Contains("pule")) { Plugin.LogDebug(Plugin.LogCategory.AiInteract, "Command (General): Jump"); petCompanionController.CommandJump(); } else if (flag3) { if (text.Contains("switch") || text.Contains("pass") || text.Contains("leave") || text.Contains("troca")) { Plugin.LogDebug(Plugin.LogCategory.AiInteract, "Command (Owner): Switch Owner"); petCompanionController.ManualSwitchOwner(); } else if (text.Contains("come") || text.Contains("here") || text.Contains("vem") || text.Contains("aqui")) { Plugin.LogDebug(Plugin.LogCategory.AiInteract, "Command (Owner): Come Here"); petCompanionController.CallPetToOwner(); } else if (text.Contains("away") || text.Contains("sai") || text.Contains("longe")) { Plugin.LogDebug(Plugin.LogCategory.AiInteract, "Command (Owner): Away"); petCompanionController.CommandAway(); } else if (text.Contains("play dead") || text.Contains("dead") || text.Contains("morta") || text.Contains("deita")) { Plugin.LogDebug(Plugin.LogCategory.AiInteract, "Command (Owner): Play Dead"); petCompanionController.CommandPlayDead(); } else if (text.Contains("small") || text.Contains("pequena") || text.Contains("mini")) { Plugin.LogDebug(Plugin.LogCategory.AiInteract, "Command (Owner): Small"); petCompanionController.SetScaleMultiplier(0.5f); } else if (text.Contains("big") || text.Contains("grande") || text.Contains("gigante")) { Plugin.LogDebug(Plugin.LogCategory.AiInteract, "Command (Owner): Big"); petCompanionController.SetScaleMultiplier(1.8f); } else if (text.Contains("normal") || text.Contains("padrao")) { Plugin.LogDebug(Plugin.LogCategory.AiInteract, "Command (Owner): Normal"); petCompanionController.SetScaleMultiplier(1f); } else if (text.Contains("explode") || text.Contains("exploda") || text.Contains("kaboom")) { if (PetSettings.EnableExplodeCommand != null && !PetSettings.EnableExplodeCommand.Value) { Plugin.LogDebug(Plugin.LogCategory.AiInteract, "Explosion command disabled in settings."); return; } float num = 0f; string[] array = text.Split(' '); for (int i = 0; i < array.Length; i++) { if (float.TryParse(array[i].Replace(',', '.'), NumberStyles.Float, CultureInfo.InvariantCulture, out var result)) { num = Mathf.Clamp(result, 1f, 30f); break; } } Plugin.LogDebug(Plugin.LogCategory.AiInteract, $"Command (Owner): Explode (Countdown: {num}s)"); petCompanionController.StartExplodeCountdown(num); } else if (text.Contains("drop") || text.Contains("solta") || text.Contains("release") || text.Contains("larga")) { Plugin.LogDebug(Plugin.LogCategory.AiInteract, "Command (Owner): Force Drop Item"); petCompanionController.ForceDropItem(); } else if (text.Contains("vai") || text.Contains("walk") || text.Contains("go") || text.Contains("anda")) { float defaultDistance = 4f; string[] array = text.Split(' '); for (int i = 0; i < array.Length; i++) { if (float.TryParse(array[i].Replace(',', '.'), NumberStyles.Float, CultureInfo.InvariantCulture, out var result2)) { defaultDistance = Mathf.Clamp(result2, 0.5f, 20f); break; } } if (petCompanionController.TryGetLookAheadGroundPoint(defaultDistance, out var point)) { petCompanionController.CommandMoveTo(point); } } else if (text.Contains("para") || text.Contains("stop") || text.Contains("fica")) { Plugin.LogDebug(Plugin.LogCategory.AiInteract, "Command (Owner): Stop / Cancel Countdown"); petCompanionController.CancelManualMove(); petCompanionController.CancelExplodeCountdown(); } else if (text.Contains("size") || text.Contains("tamanho")) { string text2 = (text.Contains("size") ? "size" : "tamanho"); string[] array2 = text.Split(new string[1] { text2 }, StringSplitOptions.RemoveEmptyEntries); if (array2.Length > 1 && float.TryParse(array2[1].Trim().Split(' ')[0].Replace(',', '.'), NumberStyles.Any, CultureInfo.InvariantCulture, out var result3)) { Plugin.LogDebug(Plugin.LogCategory.AiInteract, $"Command (Owner): Size {result3}"); petCompanionController.SetScaleMultiplier(result3); } } } else { string text3 = (AccessTools.Field(typeof(PlayerAvatar), "playerName")?.GetValue(sender) as string) ?? "Player"; Plugin.LogDebug(Plugin.LogCategory.AiInteract, "Player " + text3 + " tried to execute an owner-restricted command."); } } } public static class PetRuntimeDrawer { private class LineEntry { public GameObject Object; public LineRenderer Renderer; public float ExpireTime; } private class DrawerRunner : MonoBehaviour { private void Update() { float time = Time.time; for (int i = 0; i < pool.Count; i++) { if ((Object)(object)pool[i].Object != (Object)null && pool[i].Object.activeSelf && pool[i].ExpireTime <= time) { pool[i].Object.SetActive(false); } } } } private static GameObject container; private static Material lineMat; private static readonly List pool = new List(); private const int MaxLines = 512; private static void EnsureInit() { //IL_0013: Unknown result type (might be due to invalid IL or missing references) //IL_001d: Expected O, but got Unknown //IL_0066: Unknown result type (might be due to invalid IL or missing references) //IL_006b: Unknown result type (might be due to invalid IL or missing references) //IL_0078: Expected O, but got Unknown if (!((Object)(object)container != (Object)null)) { container = new GameObject("AiChan_RuntimeDebugDrawer"); Object.DontDestroyOnLoad((Object)(object)container); container.AddComponent(); Shader val = Shader.Find("Sprites/Default"); if ((Object)(object)val == (Object)null) { val = Shader.Find("Hidden/Internal-Colored"); } if ((Object)(object)val == (Object)null) { val = Shader.Find("Unlit/Color"); } lineMat = new Material(val) { hideFlags = (HideFlags)61 }; } } public static void DrawLine(Vector3 start, Vector3 end, Color color, float duration = 0.05f) { //IL_0135: Unknown result type (might be due to invalid IL or missing references) //IL_0141: Unknown result type (might be due to invalid IL or missing references) //IL_014e: 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_009f: Unknown result type (might be due to invalid IL or missing references) //IL_00a5: Expected O, but got Unknown EnsureInit(); float time = Time.time; LineEntry lineEntry = null; for (int i = 0; i < pool.Count; i++) { if (!pool[i].Object.activeSelf || pool[i].ExpireTime <= time) { lineEntry = pool[i]; break; } } if (lineEntry == null) { if (pool.Count >= 512) { lineEntry = pool[0]; } else { GameObject val = new GameObject("DebugLine_" + pool.Count); val.transform.SetParent(container.transform); LineRenderer val2 = val.AddComponent(); ((Renderer)val2).material = lineMat; val2.startWidth = 0.025f; val2.endWidth = 0.025f; val2.positionCount = 2; val2.useWorldSpace = true; ((Renderer)val2).shadowCastingMode = (ShadowCastingMode)0; ((Renderer)val2).receiveShadows = false; lineEntry = new LineEntry { Object = val, Renderer = val2 }; pool.Add(lineEntry); } } lineEntry.ExpireTime = time + duration; lineEntry.Renderer.startColor = color; lineEntry.Renderer.endColor = color; lineEntry.Renderer.SetPosition(0, start); lineEntry.Renderer.SetPosition(1, end); lineEntry.Object.SetActive(true); } } public class PetInteraction : MonoBehaviour { public PetCompanionController pet; public float petDistance = 3f; public float itemDistance = 3.5f; public float petCooldown = 1f; private float nextPetTime; private static readonly FieldInfo GrabbedPhysGrabObjectField = AccessTools.Field(typeof(PhysGrabber), "grabbedPhysGrabObject"); private static readonly FieldInfo PlayerTumbleField = AccessTools.Field(typeof(PlayerAvatar), "tumble"); private static readonly FieldInfo PlayerIsTumblingField = AccessTools.Field(typeof(PlayerAvatar), "isTumbling"); private static readonly FieldInfo TumbleIsTumblingField = AccessTools.Field(typeof(PlayerTumble), "isTumbling"); private static readonly FieldInfo TumblePlayerAvatarField = AccessTools.Field(typeof(PlayerTumble), "playerAvatar"); private static readonly FieldInfo PlayerNameField = AccessTools.Field(typeof(PlayerAvatar), "playerName"); private void Start() { if ((Object)(object)pet == (Object)null) { pet = ((Component)this).GetComponent(); } } private bool IsLookingAtPet() { //IL_0039: Unknown result type (might be due to invalid IL or missing references) //IL_003f: Unknown result type (might be due to invalid IL or missing references) //IL_006e: Unknown result type (might be due to invalid IL or missing references) PlayerAvatar val = SemiFunc.PlayerAvatarLocal(); if ((Object)(object)val == (Object)null || (Object)(object)val.localCamera == (Object)null) { return false; } Transform overrideTransform = val.localCamera.GetOverrideTransform(); if ((Object)(object)overrideTransform == (Object)null) { return false; } Ray val2 = default(Ray); ((Ray)(ref val2))..ctor(overrideTransform.position, overrideTransform.forward); int num = ~LayerMask.GetMask(new string[3] { "Player", "PlayerOnlyCollision", "RoomVolume" }); RaycastHit val3 = default(RaycastHit); if (!Physics.Raycast(val2, ref val3, petDistance, num, (QueryTriggerInteraction)2)) { return false; } if ((Object)(object)((RaycastHit)(ref val3)).collider == (Object)null) { return false; } PetCompanionController componentInParent = ((Component)((RaycastHit)(ref val3)).collider).GetComponentInParent(); if ((Object)(object)componentInParent != (Object)null) { return (Object)(object)componentInParent == (Object)(object)pet; } return false; } private PhysGrabObject GetPlayerHeldItem(PlayerAvatar player) { if ((Object)(object)player == (Object)null || (Object)(object)player.physGrabber == (Object)null) { return null; } object? obj = GrabbedPhysGrabObjectField?.GetValue(player.physGrabber); return (PhysGrabObject)((obj is PhysGrabObject) ? obj : null); } private void ReleasePlayerItem(PlayerAvatar player) { //IL_0027: Unknown result type (might be due to invalid IL or missing references) //IL_002d: Unknown result type (might be due to invalid IL or missing references) if (!((Object)(object)player == (Object)null) && !((Object)(object)player.physGrabber == (Object)null)) { player.physGrabber.ReleaseObjectRPC(true, 1f, -1, default(PhotonMessageInfo)); } } private PlayerTumble GetPlayerTumble(PlayerAvatar player) { if ((Object)(object)player == (Object)null) { return null; } object? obj = PlayerTumbleField?.GetValue(player); return (PlayerTumble)(((obj is PlayerTumble) ? obj : null) ?? ((Component)player).GetComponentInChildren()); } private bool IsPlayerTumbling(PlayerAvatar player) { if ((Object)(object)player == (Object)null) { return false; } object obj = PlayerIsTumblingField?.GetValue(player); bool flag = default(bool); int num; if (obj is bool) { flag = (bool)obj; num = 1; } else { num = 0; } if (((uint)num & (flag ? 1u : 0u)) != 0) { return true; } PlayerTumble playerTumble = GetPlayerTumble(player); bool flag2 = default(bool); int num2; if ((Object)(object)playerTumble != (Object)null) { obj = TumbleIsTumblingField?.GetValue(playerTumble); if (obj is bool) { flag2 = (bool)obj; num2 = 1; } else { num2 = 0; } } else { num2 = 0; } return (byte)((uint)num2 & (flag2 ? 1u : 0u)) != 0; } private void Update() { //IL_001f: Unknown result type (might be due to invalid IL or missing references) //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_0025: Unknown result type (might be due to invalid IL or missing references) //IL_002a: Unknown result type (might be due to invalid IL or missing references) //IL_002b: Unknown result type (might be due to invalid IL or missing references) //IL_0035: Unknown result type (might be due to invalid IL or missing references) //IL_003c: Unknown result type (might be due to invalid IL or missing references) //IL_013c: Unknown result type (might be due to invalid IL or missing references) //IL_0147: Unknown result type (might be due to invalid IL or missing references) //IL_014c: Unknown result type (might be due to invalid IL or missing references) //IL_014e: Unknown result type (might be due to invalid IL or missing references) //IL_0150: Unknown result type (might be due to invalid IL or missing references) //IL_0155: Unknown result type (might be due to invalid IL or missing references) //IL_01a1: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)pet == (Object)null) { return; } PlayerAvatar val = SemiFunc.PlayerAvatarLocal(); if ((Object)(object)val == (Object)null) { return; } KeyCode petKeyCode = PetSettings.GetPetKeyCode(); KeyCode interactKeyCode = PetSettings.GetInteractKeyCode(); bool keyDown = Input.GetKeyDown(PetSettings.GetSwitchOwnerKeyCode()); bool keyDown2 = Input.GetKeyDown(petKeyCode); bool keyDown3 = Input.GetKeyDown(interactKeyCode); if (keyDown) { if ((Object)(object)pet.owner != (Object)null && (Object)(object)val.photonView != (Object)null && (Object)(object)pet.owner.photonView != (Object)null && pet.owner.photonView.ControllerActorNr == val.photonView.ControllerActorNr) { if (PhotonNetwork.InRoom && !PhotonNetwork.IsMasterClient) { RepoSteamNetwork.SendPacket(new PetSwitchOwnerPacket(), (NetworkDestination)0); } else { pet.ManualSwitchOwner(); } } else { string text = "Ninguém"; if ((Object)(object)pet.owner != (Object)null) { text = (PlayerNameField?.GetValue(pet.owner) as string) ?? "Player"; } Plugin.LogDebug(Plugin.LogCategory.AiInteract, "Denied: Only the current owner (" + text + ") can transfer the Pet using F5."); } } if (!keyDown2 && !keyDown3) { return; } Vector3 position = ((Component)val).transform.position; Vector3 position2 = ((Component)this).transform.position; Vector3 val2 = position - position2; float sqrMagnitude = ((Vector3)(ref val2)).sqrMagnitude; if (keyDown2 && sqrMagnitude <= petDistance * petDistance && Time.time >= nextPetTime && IsLookingAtPet()) { nextPetTime = Time.time + petCooldown; Plugin.LogDebug(Plugin.LogCategory.AiInteract, $"Petting triggered via key: {petKeyCode}"); pet.Pet(); } if (!keyDown3 || sqrMagnitude > itemDistance * itemDistance) { return; } PhysGrabObject playerHeldItem = GetPlayerHeldItem(val); if ((Object)(object)playerHeldItem != (Object)null) { PlayerTumble val3 = ((Component)playerHeldItem).GetComponent() ?? ((Component)playerHeldItem).GetComponentInParent(); PlayerAvatar val4 = null; if ((Object)(object)val3 != (Object)null) { object? obj = TumblePlayerAvatarField?.GetValue(val3); val4 = (PlayerAvatar)(((obj is PlayerAvatar) ? obj : null) ?? val3.playerAvatar); } if ((Object)(object)val4 != (Object)null) { if (pet.TryCarryPlayer(val4)) { ReleasePlayerItem(val); } } else if (pet.TryGiveItem(playerHeldItem)) { ReleasePlayerItem(val); } } else if (IsPlayerTumbling(val)) { pet.TryCarryPlayer(val); } } } public sealed class PetNetworkBridge : MonoBehaviourPunCallbacks { private const float RemoteMovingTimeout = 0.025f; private const float SnapDistance = 3f; private const float PositionThresholdSqr = 2.5E-05f; private bool receivedFirstState; private PetCompanionController controller; private PhotonTransformView ptv; private Rigidbody rb; private int sendSequence; private Vector3 networkPosition; private Quaternion networkRotation; private int lastReceivedSequence = -1; private Vector3 lastPos; private float remoteMoveTimer; public bool IsRemoteMoving { get; private set; } private void Awake() { //IL_002b: Unknown result type (might be due to invalid IL or missing references) //IL_0030: Unknown result type (might be due to invalid IL or missing references) //IL_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_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) controller = ((Component)this).GetComponent(); ptv = ((Component)this).GetComponent(); rb = ((Component)this).GetComponent(); lastPos = ((Component)this).transform.position; networkPosition = ((Component)this).transform.position; networkRotation = ((Component)this).transform.rotation; } public override void OnEnable() { ((MonoBehaviourPunCallbacks)this).OnEnable(); RepoSteamNetwork.AddCallback((Action)OnStatePacketReceived); RepoSteamNetwork.AddCallback((Action)OnGiveItemPacketReceived); RepoSteamNetwork.AddCallback((Action)OnCarryPlayerPacketReceived); RepoSteamNetwork.AddCallback((Action)OnSyncCarryPacketReceived); RepoSteamNetwork.AddCallback((Action)OnSyncPettingPacketReceived); RepoSteamNetwork.AddCallback((Action)OnSwitchOwnerPacketReceived); RepoSteamNetwork.AddCallback((Action)OnExplodePacketReceived); } public override void OnDisable() { RepoSteamNetwork.RemoveCallback((Action)OnStatePacketReceived); RepoSteamNetwork.RemoveCallback((Action)OnGiveItemPacketReceived); RepoSteamNetwork.RemoveCallback((Action)OnCarryPlayerPacketReceived); RepoSteamNetwork.RemoveCallback((Action)OnSyncCarryPacketReceived); RepoSteamNetwork.RemoveCallback((Action)OnSyncPettingPacketReceived); RepoSteamNetwork.RemoveCallback((Action)OnSwitchOwnerPacketReceived); RepoSteamNetwork.RemoveCallback((Action)OnExplodePacketReceived); ((MonoBehaviourPunCallbacks)this).OnDisable(); } private bool IsPacketForThisPet(int petViewId) { if ((Object)(object)((MonoBehaviourPun)this).photonView != (Object)null && ((MonoBehaviourPun)this).photonView.ViewID > 0) { return ((MonoBehaviourPun)this).photonView.ViewID == petViewId; } return false; } private void OnSwitchOwnerPacketReceived(PetSwitchOwnerPacket packet) { if (PhotonNetwork.IsMasterClient && !((Object)(object)controller == (Object)null)) { controller.ManualSwitchOwner(); } } private void OnGiveItemPacketReceived(PetGiveItemPacket packet) { if (PhotonNetwork.IsMasterClient && !((Object)(object)controller == (Object)null) && IsPacketForThisPet(packet.PetViewID)) { PhotonView val = PhotonView.Find(packet.ItemViewID); PhysGrabObject val2 = (((Object)(object)val != (Object)null) ? ((Component)val).GetComponent() : null); if ((Object)(object)val2 != (Object)null) { controller.TryGiveItem(val2); } } } private void OnCarryPlayerPacketReceived(PetCarryPlayerPacket packet) { if (PhotonNetwork.IsMasterClient && !((Object)(object)controller == (Object)null) && IsPacketForThisPet(packet.PetViewID)) { PhotonView val = PhotonView.Find(packet.PlayerViewID); PlayerAvatar val2 = (((Object)(object)val != (Object)null) ? ((Component)val).GetComponent() : null); if ((Object)(object)val2 != (Object)null) { controller.TryCarryPlayer(val2); } } } private void OnSyncCarryPacketReceived(PetSyncCarryPacket packet) { if (!((Object)(object)controller == (Object)null) && IsPacketForThisPet(packet.PetViewID)) { controller.NetworkSyncCarry(packet.TargetViewID, packet.IsPlayer, packet.IsPickingUp, packet.InheritScale); } } private void OnSyncPettingPacketReceived(PetSyncPettingPacket packet) { if (!((Object)(object)controller == (Object)null) && IsPacketForThisPet(packet.PetViewID)) { controller.PetFromNetwork(); } } private void OnExplodePacketReceived(PetExplodePacket packet) { if (!((Object)(object)controller == (Object)null) && IsPacketForThisPet(packet.PetViewID)) { controller.StartExplodeCountdown(packet.Delay, fromNetwork: true); } } private void OnStatePacketReceived(PetStatePacket packet) { //IL_0050: Unknown result type (might be due to invalid IL or missing references) //IL_0055: Unknown result type (might be due to invalid IL or missing references) //IL_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_00dd: Unknown result type (might be due to invalid IL or missing references) //IL_00e3: Unknown result type (might be due to invalid IL or missing references) //IL_00c5: Unknown result type (might be due to invalid IL or missing references) //IL_00cb: Unknown result type (might be due to invalid IL or missing references) if (!IsPacketForThisPet(packet.PetViewID)) { return; } if (!PhotonNetwork.IsMasterClient) { PetNetworkProfiler.RecordReceive(60); } if (PhotonNetwork.IsMasterClient || (lastReceivedSequence >= 0 && !IsSequenceNewer(packet.Sequence, lastReceivedSequence))) { return; } lastReceivedSequence = packet.Sequence; networkPosition = packet.Position; networkRotation = packet.Rotation; if (!((Object)(object)controller == (Object)null)) { if (Enum.IsDefined(typeof(PetCompanionController.PetState), packet.StateIndex) && !controller.IsRecovering) { controller.state = (PetCompanionController.PetState)packet.StateIndex; } if (!receivedFirstState) { receivedFirstState = true; controller.SnapNetworkInterpolation(packet.Position, packet.Rotation); } else { controller.NetworkSyncTransform(packet.Position, packet.Rotation); } } } private static bool IsSequenceNewer(int sequence, int previous) { if (sequence != previous) { return sequence - previous > 0; } return false; } private bool IsRemotePet() { if (PhotonNetwork.InRoom && !PhotonNetwork.OfflineMode) { return !PhotonNetwork.IsMasterClient; } return false; } private void Update() { //IL_00e8: Unknown result type (might be due to invalid IL or missing references) //IL_00ee: Unknown result type (might be due to invalid IL or missing references) //IL_00f3: Unknown result type (might be due to invalid IL or missing references) //IL_00f8: Unknown result type (might be due to invalid IL or missing references) //IL_0107: Unknown result type (might be due to invalid IL or missing references) //IL_010c: Unknown result type (might be due to invalid IL or missing references) //IL_0097: Unknown result type (might be due to invalid IL or missing references) //IL_00a7: Unknown result type (might be due to invalid IL or missing references) if (IsRemotePet()) { if ((Object)(object)ptv != (Object)null && ((Behaviour)ptv).enabled) { ((Behaviour)ptv).enabled = false; } if ((Object)(object)controller != (Object)null && (Object)(object)controller.agent != (Object)null && ((Behaviour)controller.agent).enabled) { ((Behaviour)controller.agent).enabled = false; } if ((Object)(object)rb != (Object)null && !rb.isKinematic) { rb.velocity = Vector3.zero; rb.angularVelocity = Vector3.zero; rb.isKinematic = true; rb.useGravity = false; } if ((Object)(object)controller != (Object)null) { controller.UpdateRemoteNetworkInterpolation(); } } Vector3 val = ((Component)this).transform.position - lastPos; float sqrMagnitude = ((Vector3)(ref val)).sqrMagnitude; lastPos = ((Component)this).transform.position; if (sqrMagnitude > 2.5E-05f) { remoteMoveTimer = 0.025f; } else { remoteMoveTimer -= Time.deltaTime; } IsRemoteMoving = remoteMoveTimer > 0f; if (PhotonNetwork.InRoom && PhotonNetwork.IsConnectedAndReady && PhotonNetwork.IsMasterClient && (Object)(object)controller != (Object)null && controller.ShouldSendNetworkTransform()) { SendStateSnapshot(); } } private void SendStateSnapshot() { //IL_00be: Unknown result type (might be due to invalid IL or missing references) //IL_00c3: Unknown result type (might be due to invalid IL or missing references) //IL_00cf: Unknown result type (might be due to invalid IL or missing references) //IL_00d4: Unknown result type (might be due to invalid IL or missing references) if (!((Object)(object)((MonoBehaviourPun)this).photonView == (Object)null) && ((MonoBehaviourPun)this).photonView.ViewID > 0 && !((Object)(object)controller == (Object)null)) { sendSequence++; int ownerViewID = (((Object)(object)controller.owner != (Object)null && (Object)(object)controller.owner.photonView != (Object)null) ? controller.owner.photonView.ViewID : 0); RepoSteamNetwork.SendPacket(new PetStatePacket { PetViewID = ((MonoBehaviourPun)this).photonView.ViewID, OwnerViewID = ownerViewID, StateIndex = (int)controller.state, Sequence = sendSequence, Position = ((Component)this).transform.position, Rotation = ((Component)this).transform.rotation }, (NetworkDestination)4); PetNetworkProfiler.RecordSend(60); } } } public class PetNetworkProfiler : MonoBehaviour { public static PetNetworkProfiler Instance; private static long totalBytesSent; private static long totalBytesReceived; private static float startTime; private static bool isInitialized; private int sentThisSecond; private int receivedThisSecond; private int lastSentBps; private int lastReceivedBps; private float timer; public const int EstimatedStatePacketSize = 60; private void Awake() { if ((Object)(object)Instance != (Object)null && (Object)(object)Instance != (Object)(object)this) { Object.Destroy((Object)(object)((Component)this).gameObject); return; } Instance = this; if (!isInitialized) { startTime = Time.unscaledTime; isInitialized = true; Plugin.Log.LogInfo((object)"[Ai-Chan Profiler] Global network tracker initialized."); } } private void Update() { timer += Time.unscaledDeltaTime; if (timer >= 1f) { lastSentBps = sentThisSecond; lastReceivedBps = receivedThisSecond; sentThisSecond = 0; receivedThisSecond = 0; timer -= 1f; } } public void PrintStats(string trigger) { TimeSpan timeSpan = TimeSpan.FromSeconds(Time.unscaledTime - startTime); string text = $"{timeSpan.Hours:D2}h:{timeSpan.Minutes:D2}m:{timeSpan.Seconds:D2}s"; Plugin.Log.LogInfo((object)("=== [Ai-Chan Network : " + trigger + "] ===")); Plugin.Log.LogInfo((object)("Total Uptime: " + text)); Plugin.Log.LogInfo((object)"-------------------------------------------------"); Plugin.Log.LogInfo((object)"[ STEAM NETWORKING (MOD DATA) ]"); Plugin.Log.LogInfo((object)$"Current Upload: {lastSentBps} B/s | Current Download: {lastReceivedBps} B/s"); Plugin.Log.LogInfo((object)$"Total Upload: {(float)totalBytesSent / 1024f:F2} KB | Total Download: {(float)totalBytesReceived / 1024f:F2} KB"); Plugin.Log.LogInfo((object)"================================================="); } public static void RecordSend(int bytes) { totalBytesSent += bytes; if ((Object)(object)Instance != (Object)null) { Instance.sentThisSecond += bytes; } } public static void RecordReceive(int bytes) { totalBytesReceived += bytes; if ((Object)(object)Instance != (Object)null) { Instance.receivedThisSecond += bytes; } } } public static class PetSettings { public static ConfigEntry EnableDebugLogs; public static ConfigEntry EnableStateTransitionLogs; public static ConfigEntry EnableNavMeshLogs; public static ConfigEntry EnableCarryJitterLogs; public static ConfigEntry CartApproachDistance; public static ConfigEntry CartDropDistance; public static ConfigEntry ShopDropDistance; public static ConfigEntry CarrySpeed; public static ConfigEntry Speed; public static ConfigEntry MaxMass; public static ConfigEntry PetMass; public static ConfigEntry StandUpDelay; public static ConfigEntry AutoJumpDelay; public static ConfigEntry AngularDrag; public static ConfigEntry Volume; public static ConfigEntry PlayerSwitchInterval; public static ConfigEntry FollowDistance; public static ConfigEntry ExplosionPlayerDamage; public static ConfigEntry ExplosionEnemyDamage; public static ConfigEntry ExplosionRadius; public static ConfigEntry ExplosionForce; public static ConfigEntry FollowStoppingDistance; public static ConfigEntry InteractKey; public static ConfigEntry PetKey; public static ConfigEntry SwitchOwnerKey; public static ConfigEntry GiveItemDistance; public static ConfigEntry InheritPetScaleOnCarry; public static ConfigEntry EnableGhostProbing; public static ConfigEntry MinJumpObstacleHeight; public static ConfigEntry EnableExplodeCommand; public static ConfigEntry GhostProbeRays; public static ConfigEntry EnableDebugRays; public static ConfigEntry DebugRaysFadeTime; public static ConfigEntry KnockdownSpeedThreshold; public static ConfigEntry MaxJumpObstacleHeight; public static ConfigEntry DebugBreadcrumbsFadeTime; public static ConfigEntry GhostProbeDistance; public static ConfigEntry GhostProbeUpdateInterval; public static void Initialize(ConfigFile config) { //IL_0029: Unknown result type (might be due to invalid IL or missing references) //IL_0033: Expected O, but got Unknown //IL_0061: Unknown result type (might be due to invalid IL or missing references) //IL_006b: Expected O, but got Unknown //IL_0099: Unknown result type (might be due to invalid IL or missing references) //IL_00a3: Expected O, but got Unknown //IL_00d1: Unknown result type (might be due to invalid IL or missing references) //IL_00db: Expected O, but got Unknown //IL_0109: Unknown result type (might be due to invalid IL or missing references) //IL_0113: Expected O, but got Unknown //IL_0141: Unknown result type (might be due to invalid IL or missing references) //IL_014b: Expected O, but got Unknown //IL_0179: Unknown result type (might be due to invalid IL or missing references) //IL_0183: Expected O, but got Unknown //IL_01b1: Unknown result type (might be due to invalid IL or missing references) //IL_01bb: Expected O, but got Unknown //IL_01e9: Unknown result type (might be due to invalid IL or missing references) //IL_01f3: Expected O, but got Unknown //IL_0221: Unknown result type (might be due to invalid IL or missing references) //IL_022b: Expected O, but got Unknown //IL_0259: Unknown result type (might be due to invalid IL or missing references) //IL_0263: Expected O, but got Unknown //IL_0291: Unknown result type (might be due to invalid IL or missing references) //IL_029b: Expected O, but got Unknown //IL_02c2: Unknown result type (might be due to invalid IL or missing references) //IL_02cc: Expected O, but got Unknown //IL_02f3: Unknown result type (might be due to invalid IL or missing references) //IL_02fd: Expected O, but got Unknown //IL_032b: Unknown result type (might be due to invalid IL or missing references) //IL_0335: Expected O, but got Unknown //IL_0363: Unknown result type (might be due to invalid IL or missing references) //IL_036d: Expected O, but got Unknown //IL_0389: Unknown result type (might be due to invalid IL or missing references) //IL_0393: Expected O, but got Unknown //IL_03af: Unknown result type (might be due to invalid IL or missing references) //IL_03b9: Expected O, but got Unknown //IL_03e7: Unknown result type (might be due to invalid IL or missing references) //IL_03f1: Expected O, but got Unknown //IL_041f: Unknown result type (might be due to invalid IL or missing references) //IL_0429: Expected O, but got Unknown //IL_0457: Unknown result type (might be due to invalid IL or missing references) //IL_0461: Expected O, but got Unknown //IL_048f: Unknown result type (might be due to invalid IL or missing references) //IL_0499: Expected O, but got Unknown //IL_04c7: Unknown result type (might be due to invalid IL or missing references) //IL_04d1: Expected O, but got Unknown //IL_04ff: Unknown result type (might be due to invalid IL or missing references) //IL_0509: Expected O, but got Unknown //IL_0529: Unknown result type (might be due to invalid IL or missing references) //IL_0533: Expected O, but got Unknown //IL_0553: Unknown result type (might be due to invalid IL or missing references) //IL_055d: Expected O, but got Unknown //IL_057d: Unknown result type (might be due to invalid IL or missing references) //IL_0587: Expected O, but got Unknown //IL_05a3: Unknown result type (might be due to invalid IL or missing references) //IL_05ad: Expected O, but got Unknown //IL_05c9: Unknown result type (might be due to invalid IL or missing references) //IL_05d3: Expected O, but got Unknown //IL_05ef: Unknown result type (might be due to invalid IL or missing references) //IL_05f9: Expected O, but got Unknown //IL_0615: Unknown result type (might be due to invalid IL or missing references) //IL_061f: Expected O, but got Unknown //IL_063b: Unknown result type (might be due to invalid IL or missing references) //IL_0645: Expected O, but got Unknown //IL_0673: Unknown result type (might be due to invalid IL or missing references) //IL_067d: Expected O, but got Unknown //IL_06ab: Unknown result type (might be due to invalid IL or missing references) //IL_06b5: Expected O, but got Unknown //IL_06d8: Unknown result type (might be due to invalid IL or missing references) //IL_06e2: Expected O, but got Unknown //IL_06fe: Unknown result type (might be due to invalid IL or missing references) //IL_0708: Expected O, but got Unknown //IL_0736: Unknown result type (might be due to invalid IL or missing references) //IL_0740: Expected O, but got Unknown //IL_076e: Unknown result type (might be due to invalid IL or missing references) //IL_0778: Expected O, but got Unknown CartApproachDistance = config.Bind("Delivery", "CartApproachDistance", 1.6f, new ConfigDescription("Distance for Ai-Chan to approach the cart before stopping.", (AcceptableValueBase)(object)new AcceptableValueRange(0.5f, 4f), Array.Empty())); CartDropDistance = config.Bind("Delivery", "CartDropDistance", 1.8f, new ConfigDescription("Maximum distance (in meters) for Ai-Chan to throw/drop the item into the cart.", (AcceptableValueBase)(object)new AcceptableValueRange(0.5f, 5f), Array.Empty())); ShopDropDistance = config.Bind("Delivery", "ShopDropDistance", 1.2f, new ConfigDescription("Maximum distance (in meters) for Ai-Chan to drop the item at the shop counter.", (AcceptableValueBase)(object)new AcceptableValueRange(0.5f, 4f), Array.Empty())); GiveItemDistance = config.Bind("Delivery", "GiveItemDistance", 4.5f, new ConfigDescription("Maximum distance (in meters) for Ai-Chan to be able to take an item from the player's hand.", (AcceptableValueBase)(object)new AcceptableValueRange(2f, 8f), Array.Empty())); Speed = config.Bind("Movement", "Speed", 3.5f, new ConfigDescription("Movement speed of Ai-Chan.", (AcceptableValueBase)(object)new AcceptableValueRange(1f, 10f), Array.Empty())); CarrySpeed = config.Bind("Movement", "Carry Speed", 3.5f, new ConfigDescription("Movement speed of Ai-Chan when carrying an item or player to the cart/extraction.", (AcceptableValueBase)(object)new AcceptableValueRange(1f, 10f), Array.Empty())); AutoJumpDelay = config.Bind("Movement", "Auto Jump Stuck Delay", 1f, new ConfigDescription("Seconds spent stuck before Ai-Chan performs an automatic obstacle jump.", (AcceptableValueBase)(object)new AcceptableValueRange(0.5f, 5f), Array.Empty())); FollowDistance = config.Bind("Movement", "Follow Range (Start)", 2f, new ConfigDescription("Distance at which Ai-Chan begins following the player.", (AcceptableValueBase)(object)new AcceptableValueRange(0.5f, 10f), Array.Empty())); FollowStoppingDistance = config.Bind("Movement", "Stopping Distance(Stop)", 2f, new ConfigDescription("Distance at which Ai-Chan stops near the player.", (AcceptableValueBase)(object)new AcceptableValueRange(0.1f, 10f), Array.Empty())); MinJumpObstacleHeight = config.Bind("Movement", "Min Jump Obstacle Height", 0.75f, new ConfigDescription("Altura mínima (em metros) de um obstáculo para a Ai-Chan parar e pular. Valores como 0.75m a 0.85m fazem ela subir escadas andando suavemente sem tentar pular os degraus.", (AcceptableValueBase)(object)new AcceptableValueRange(0.35f, 2.5f), Array.Empty())); MaxJumpObstacleHeight = config.Bind("Movement", "Max Jump Obstacle Height", 3.5f, new ConfigDescription("Maximum height (in meters) of an obstacle Ai-Chan will attempt to jump onto.", (AcceptableValueBase)(object)new AcceptableValueRange(1.5f, 8f), Array.Empty())); MaxMass = config.Bind("Interaction", "Max Carried Mass", 3f, new ConfigDescription("Maximum item weight Ai-Chan can accept and carry.", (AcceptableValueBase)(object)new AcceptableValueRange(0.5f, 20f), Array.Empty())); ExplosionPlayerDamage = config.Bind("Explosion", "Player Damage", 10, new ConfigDescription("Dano causado aos jogadores no raio da explosão.", (AcceptableValueBase)(object)new AcceptableValueRange(0, 200), Array.Empty())); ExplosionEnemyDamage = config.Bind("Explosion", "Enemy Damage", 50, new ConfigDescription("Dano causado aos monstros e inimigos.", (AcceptableValueBase)(object)new AcceptableValueRange(0, 500), Array.Empty())); ExplosionRadius = config.Bind("Explosion", "Explosion Radius", 1.2f, new ConfigDescription("Tamanho e raio da explosão (em metros).", (AcceptableValueBase)(object)new AcceptableValueRange(0.5f, 10f), Array.Empty())); ExplosionForce = config.Bind("Explosion", "Explosion Force Multp. (if too high damage is not applied far away)", 1f, new ConfigDescription("Multiplicador da força de impacto físico e arremesso de objetos.", (AcceptableValueBase)(object)new AcceptableValueRange(0.5f, 10f), Array.Empty())); InheritPetScaleOnCarry = config.Bind("Interaction", "Inherit Pet Scale On Carry", false, new ConfigDescription("When enabled, carried items scale proportionally with the pet's size while held (minimum scale cap of 0.01 to prevent disappearing). When disabled, items preserve their original world scale.", (AcceptableValueBase)null, Array.Empty())); EnableExplodeCommand = config.Bind("Commands", "Enable Explode Command", false, new ConfigDescription("Permite que o dono use o comando de chat para explodir a Ai-Chan.", (AcceptableValueBase)null, Array.Empty())); PetMass = config.Bind("Physics", "Body Mass", 1.5f, new ConfigDescription("Rigidbody and PhysGrab mass of Ai-Chan's body.", (AcceptableValueBase)(object)new AcceptableValueRange(0.2f, 10f), Array.Empty())); KnockdownSpeedThreshold = config.Bind("Physics", "Knockdown Impact Resistance", 3.5f, new ConfigDescription("Minimum impact speed (m/s) required to knock Ai-Chan down.", (AcceptableValueBase)(object)new AcceptableValueRange(0.5f, 10f), Array.Empty())); StandUpDelay = config.Bind("Physics", "Stand Up Delay", 2f, new ConfigDescription("Delay in seconds before Ai-Chan starts standing up after hitting the ground.", (AcceptableValueBase)(object)new AcceptableValueRange(0f, 10f), Array.Empty())); AngularDrag = config.Bind("Physics", "Angular Drag", 0.5f, new ConfigDescription("Free-flight rotation resistance when thrown.", (AcceptableValueBase)(object)new AcceptableValueRange(0f, 10f), Array.Empty())); Volume = config.Bind("Audio", "Volume", 50f, new ConfigDescription("Audio volume percentage (50% default = 25% actual output limit).", (AcceptableValueBase)(object)new AcceptableValueRange(0f, 100f), Array.Empty())); PlayerSwitchInterval = config.Bind("Multiplayer", "Owner Switch Interval (Minutes)", 3f, new ConfigDescription("Interval in minutes to switch target player in multiplayer (0 disables).", (AcceptableValueBase)(object)new AcceptableValueRange(2f, 10f), Array.Empty())); InteractKey = config.Bind("Controls", "Give Item Key", "R", new ConfigDescription("Key code to give the held item to Ai-Chan.", (AcceptableValueBase)null, Array.Empty())); PetKey = config.Bind("Controls", "Pet Key", "E", new ConfigDescription("Key code to pet Ai-Chan.", (AcceptableValueBase)null, Array.Empty())); SwitchOwnerKey = config.Bind("Controls", "Switch Owner Key", "F5", new ConfigDescription("Key code to manually switch Ai-Chan's owner to another player.", (AcceptableValueBase)null, Array.Empty())); EnableDebugLogs = config.Bind("Logs", "Enable Debug Logs", true, new ConfigDescription("Enable or disable Ai-Chan network and debug logs in the console.", (AcceptableValueBase)null, Array.Empty())); EnableStateTransitionLogs = config.Bind("Logs", "Enable State Transition Logs", false, new ConfigDescription("Enable or disable verbose state transition logs (useful for deep debugging).", (AcceptableValueBase)null, Array.Empty())); EnableNavMeshLogs = config.Bind("Logs", "Enable NavMesh Transition Logs", false, new ConfigDescription("Enable or disable logs when Ai-Chan enters or leaves the NavMesh.", (AcceptableValueBase)null, Array.Empty())); EnableCarryJitterLogs = config.Bind("Logs", "Enable Carry Logs(will spam console when carry)", false, new ConfigDescription("Enable or disable verbose delivery movement and jitter logs in the console.", (AcceptableValueBase)null, Array.Empty())); EnableGhostProbing = config.Bind("Performance", "Enable Ghost Probing", true, new ConfigDescription("Enables multi-ray manual pathfinding to smoothly avoid tables/walls. Disabling reduces CPU usage but lowers obstacle intelligence.", (AcceptableValueBase)null, Array.Empty())); GhostProbeDistance = config.Bind("Performance", "Ghost Probe Distance", 2.5f, new ConfigDescription("How far (in meters) the ghost probes look ahead to avoid walls. Higher = Detects earlier.", (AcceptableValueBase)(object)new AcceptableValueRange(1f, 5f), Array.Empty())); GhostProbeUpdateInterval = config.Bind("Performance", "Ghost Probe Update Interval", 0.1f, new ConfigDescription("How often (in seconds) the pathfinding is calculated. 0.1s = 10 times per second. Higher = More performance, slower reaction.", (AcceptableValueBase)(object)new AcceptableValueRange(0.02f, 0.5f), Array.Empty())); GhostProbeRays = config.Bind("Performance", "Ghost Probe Rays", 7, new ConfigDescription("Number of projection rays used when dodging obstacles.", (AcceptableValueBase)(object)new AcceptableValueRange(1, 12), Array.Empty())); EnableDebugRays = config.Bind("Performance", "Enable Debug Rays", false, new ConfigDescription("Visualizes the ghost simulation paths in-game. Cyan = Free future path, Red = Hit wall, Green = Best chosen path.", (AcceptableValueBase)null, Array.Empty())); DebugRaysFadeTime = config.Bind("Performance", "Debug Rays Fade Time", 0.25f, new ConfigDescription("How long (in seconds) the debug rays remain visible on screen.", (AcceptableValueBase)(object)new AcceptableValueRange(0.05f, 5f), Array.Empty())); DebugBreadcrumbsFadeTime = config.Bind("Performance", "Debug Breadcrumbs Fade Time", 0.15f, new ConfigDescription("How long (in seconds) the breadcrumb trail rays remain visible on screen.", (AcceptableValueBase)(object)new AcceptableValueRange(0.05f, 5f), Array.Empty())); } public static KeyCode GetInteractKeyCode() { //IL_0022: Unknown result type (might be due to invalid IL or missing references) if (Enum.TryParse((InteractKey != null) ? InteractKey.Value : "R", ignoreCase: true, out KeyCode result)) { return result; } return (KeyCode)114; } public static KeyCode GetPetKeyCode() { //IL_0022: Unknown result type (might be due to invalid IL or missing references) if (Enum.TryParse((PetKey != null) ? PetKey.Value : "E", ignoreCase: true, out KeyCode result)) { return result; } return (KeyCode)101; } public static KeyCode GetSwitchOwnerKeyCode() { //IL_0022: Unknown result type (might be due to invalid IL or missing references) if (Enum.TryParse((SwitchOwnerKey != null) ? SwitchOwnerKey.Value : "F5", ignoreCase: true, out KeyCode result)) { return result; } return (KeyCode)286; } } public class PetSpawner : MonoBehaviour { public class PetMapTracker : MonoBehaviour { private GameObject mapIconRoot; private GameObject spriteChild; private SpriteRenderer spriteRenderer; private static Sprite circleSprite; private int dirtFinderMapLayer = -1; private void Start() { dirtFinderMapLayer = LayerMask.NameToLayer("DirtFinderMap"); if (dirtFinderMapLayer == -1) { dirtFinderMapLayer = ((Component)this).gameObject.layer; } CreateCircleSprite(); } private void CreateCircleSprite() { //IL_0015: Unknown result type (might be due to invalid IL or missing references) //IL_001b: Expected O, but got Unknown //IL_00f8: Unknown result type (might be due to invalid IL or missing references) //IL_0107: Unknown result type (might be due to invalid IL or missing references) //IL_005d: Unknown result type (might be due to invalid IL or missing references) //IL_0062: Unknown result type (might be due to invalid IL or missing references) //IL_007a: Unknown result type (might be due to invalid IL or missing references) //IL_00bd: Unknown result type (might be due to invalid IL or missing references) //IL_00ac: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)circleSprite != (Object)null) { return; } int num = 64; Texture2D val = new Texture2D(num, num, (TextureFormat)4, false); Vector2 val2 = default(Vector2); ((Vector2)(ref val2))..ctor((float)num / 2f, (float)num / 2f); float num2 = (float)num / 2f; for (int i = 0; i < num; i++) { for (int j = 0; j < num; j++) { float num3 = Vector2.Distance(new Vector2((float)j + 0.5f, (float)i + 0.5f), val2); if (num3 <= num2 - 2f) { val.SetPixel(j, i, Color.white); } else if (num3 <= num2) { float num4 = Mathf.Clamp01(num2 - num3); val.SetPixel(j, i, new Color(1f, 1f, 1f, num4)); } else { val.SetPixel(j, i, Color.clear); } } } val.Apply(); circleSprite = Sprite.Create(val, new Rect(0f, 0f, (float)num, (float)num), new Vector2(0.5f, 0.5f), 100f); } private void LateUpdate() { //IL_006c: Unknown result type (might be due to invalid IL or missing references) //IL_0076: Expected O, but got Unknown //IL_00a8: Unknown result type (might be due to invalid IL or missing references) //IL_00b2: Expected O, but got Unknown //IL_00ea: 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_0132: Unknown result type (might be due to invalid IL or missing references) //IL_0177: Unknown result type (might be due to invalid IL or missing references) //IL_01c6: Unknown result type (might be due to invalid IL or missing references) //IL_01cb: Unknown result type (might be due to invalid IL or missing references) //IL_01ce: Unknown result type (might be due to invalid IL or missing references) //IL_01d9: Unknown result type (might be due to invalid IL or missing references) //IL_01ef: Unknown result type (might be due to invalid IL or missing references) //IL_01fa: Unknown result type (might be due to invalid IL or missing references) //IL_0209: Unknown result type (might be due to invalid IL or missing references) //IL_020e: Unknown result type (might be due to invalid IL or missing references) if (!SemiFunc.RunIsLevel() || IsShopContext() || (Object)(object)Map.Instance == (Object)null || (Object)(object)Map.Instance.OverLayerParent == (Object)null) { if ((Object)(object)mapIconRoot != (Object)null && mapIconRoot.activeSelf) { mapIconRoot.SetActive(false); } return; } if ((Object)(object)mapIconRoot == (Object)null) { mapIconRoot = new GameObject("AiChan_MinimapEntity"); mapIconRoot.layer = dirtFinderMapLayer; mapIconRoot.transform.SetParent(Map.Instance.OverLayerParent, false); spriteChild = new GameObject("Sprite"); spriteChild.layer = dirtFinderMapLayer; spriteChild.transform.SetParent(mapIconRoot.transform, false); spriteChild.transform.localPosition = Vector3.zero; spriteChild.transform.localRotation = Quaternion.Euler(90f, 0f, 0f); spriteChild.transform.localScale = new Vector3(0.12f, 0.12f, 0.12f); spriteRenderer = spriteChild.AddComponent(); spriteRenderer.sprite = circleSprite; spriteRenderer.color = new Color(1f, 0.2f, 0.8f, 1f); ((Renderer)spriteRenderer).sortingOrder = 100; } if (!mapIconRoot.activeSelf) { mapIconRoot.SetActive(true); } if (!spriteChild.activeSelf) { spriteChild.SetActive(true); } Vector3 position = ((Component)this).transform.position; Vector3 val = default(Vector3); ((Vector3)(ref val))..ctor(position.x, 0f, position.z); mapIconRoot.transform.position = val * Map.Instance.Scale + Map.Instance.OverLayerParent.position; } private void OnDestroy() { if ((Object)(object)mapIconRoot != (Object)null) { Object.Destroy((Object)(object)mapIconRoot); } } } public static bool isSpawning; private static PetSpawner instance; private static bool eventSpawnInProgress; public static void Initialize() { //IL_001f: Unknown result type (might be due to invalid IL or missing references) //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002a: Expected O, but got Unknown isSpawning = false; eventSpawnInProgress = false; if (!((Object)(object)instance != (Object)null)) { GameObject val = new GameObject("AiChan_PetSpawner_Net"); Object.DontDestroyOnLoad((Object)val); instance = val.AddComponent(); Plugin.Log.LogInfo((object)"[AiNet] PetSpawner inicializado via Steamworks."); } } private static bool IsOnlineMaster() { if (PhotonNetwork.IsConnectedAndReady && PhotonNetwork.InRoom && !PhotonNetwork.OfflineMode) { return PhotonNetwork.IsMasterClient; } return false; } private void OnEnable() { RepoSteamNetwork.AddCallback((Action)OnRequestSync); RepoSteamNetwork.AddCallback((Action)OnSpawnPacket); } private void OnDisable() { RepoSteamNetwork.RemoveCallback((Action)OnRequestSync); RepoSteamNetwork.RemoveCallback((Action)OnSpawnPacket); } private void OnDestroy() { eventSpawnInProgress = false; if ((Object)(object)instance == (Object)(object)this) { instance = null; } } private void OnRequestSync(PetRequestSyncPacket packet) { //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_0061: Unknown result type (might be due to invalid IL or missing references) //IL_0066: Unknown result type (might be due to invalid IL or missing references) if (!PhotonNetwork.IsMasterClient) { return; } PetCompanionController petCompanionController = Object.FindObjectOfType(true); if ((Object)(object)petCompanionController != (Object)null) { PhotonView component = ((Component)petCompanionController).GetComponent(); if ((Object)(object)component != (Object)null) { RepoSteamNetwork.SendPacket(new PetSpawnPacket { Position = ((Component)petCompanionController).transform.position, ContextName = "Sync", AllocatedViewID = component.ViewID, Header = { Target = ((NetworkPacket)packet).Header.Sender } }, (NetworkDestination)3); } } } private void OnSpawnPacket(PetSpawnPacket packet) { //IL_0059: Unknown result type (might be due to invalid IL or missing references) if (!((Object)(object)Object.FindObjectOfType(true) != (Object)null) && !((Object)(object)PhotonNetwork.GetPhotonView(packet.AllocatedViewID) != (Object)null)) { Plugin.Log.LogInfo((object)$"[AiNet] Evento de spawn recebido da rede Steam. Contexto: {packet.ContextName} | ViewID: {packet.AllocatedViewID}"); if (!eventSpawnInProgress) { eventSpawnInProgress = true; ((MonoBehaviour)this).StartCoroutine(BuildPetWhenLevelIsReady(packet.Position, packet.ContextName, packet.AllocatedViewID)); } } } private IEnumerator BuildPetWhenLevelIsReady(Vector3 position, string contextName, int allocatedViewID) { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_0008: Unknown result type (might be due to invalid IL or missing references) try { float timeout = Time.time + 15f; bool isShopSpawn = !string.IsNullOrEmpty(contextName) && contextName.IndexOf("shop", StringComparison.OrdinalIgnoreCase) >= 0; NavMeshHit val = default(NavMeshHit); while (Time.time < timeout) { if (isShopSpawn) { if (IsShopContext() && (Object)(object)SemiFunc.PlayerAvatarLocal() != (Object)null && NavMesh.SamplePosition(((Component)SemiFunc.PlayerAvatarLocal()).transform.position, ref val, 15f, -1)) { break; } } else if ((Object)(object)LevelGenerator.Instance != (Object)null && LevelGenerator.Instance.Generated && SemiFunc.RunIsLevel()) { break; } yield return (object)new WaitForSeconds(0.25f); } if ((Object)(object)Object.FindObjectOfType(true) == (Object)null) { try { BuildPetGameObject(position, contextName, allocatedViewID); yield break; } catch (Exception ex) { Plugin.Log.LogError((object)("[AiNet] Erro no spawn atrasado: " + ex)); yield break; } } } finally { eventSpawnInProgress = false; } } public static bool IsShopContext() { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0005: Unknown result type (might be due to invalid IL or missing references) Scene activeScene = SceneManager.GetActiveScene(); if (((Scene)(ref activeScene)).name.ToLowerInvariant().Contains("shop")) { return true; } ExtractionPoint[] array = Object.FindObjectsOfType(true); FieldInfo fieldInfo = AccessTools.Field(typeof(ExtractionPoint), "isShop"); if (fieldInfo == null) { return false; } ExtractionPoint[] array2 = array; bool flag = default(bool); foreach (ExtractionPoint val in array2) { int num; if ((Object)(object)val != (Object)null && ((Component)val).gameObject.activeInHierarchy) { object value = fieldInfo.GetValue(val); if (value is bool) { flag = (bool)value; num = 1; } else { num = 0; } } else { num = 0; } if (((uint)num & (flag ? 1u : 0u)) != 0) { return true; } } return false; } public static IEnumerator SpawnWhenShopIsReady(ExtractionPoint shopPoint) { try { if ((Object)(object)shopPoint == (Object)null) { yield break; } Initialize(); float timeout = Time.time + 30f; PlayerAvatar player = null; Vector3 validSpawnPoint = Vector3.zero; bool canSpawn = false; NavMeshHit val = default(NavMeshHit); while (Time.time < timeout) { player = SemiFunc.PlayerAvatarLocal(); if ((Object)(object)player != (Object)null && ((Component)player).gameObject.activeInHierarchy && NavMesh.SamplePosition(((Component)player).transform.position - ((Component)player).transform.forward * 1.5f, ref val, 2f, -1)) { validSpawnPoint = ((NavMeshHit)(ref val)).position; canSpawn = true; break; } yield return (object)new WaitForSeconds(0.5f); } if (canSpawn && (Object)(object)Object.FindObjectOfType(true) == (Object)null) { TryCreatePet(player, "Shop", validSpawnPoint); } } finally { isSpawning = false; } } public static bool TryCreatePet(PlayerAvatar player, string contextName, Vector3? forcedPosition = null) { //IL_0052: Unknown result type (might be due to invalid IL or missing references) //IL_005d: Unknown result type (might be due to invalid IL or missing references) //IL_0067: Unknown result type (might be due to invalid IL or missing references) //IL_006c: Unknown result type (might be due to invalid IL or missing references) //IL_0031: Unknown result type (might be due to invalid IL or missing references) //IL_0036: Unknown result type (might be due to invalid IL or missing references) //IL_008f: 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_0044: Unknown result type (might be due to invalid IL or missing references) //IL_0049: Unknown result type (might be due to invalid IL or missing references) //IL_0094: Unknown result type (might be due to invalid IL or missing references) //IL_0095: Unknown result type (might be due to invalid IL or missing references) //IL_0096: Unknown result type (might be due to invalid IL or missing references) //IL_00a0: Unknown result type (might be due to invalid IL or missing references) //IL_00a5: Unknown result type (might be due to invalid IL or missing references) //IL_00aa: Unknown result type (might be due to invalid IL or missing references) //IL_00e5: Unknown result type (might be due to invalid IL or missing references) //IL_010f: Unknown result type (might be due to invalid IL or missing references) //IL_012e: Unknown result type (might be due to invalid IL or missing references) //IL_0169: Unknown result type (might be due to invalid IL or missing references) //IL_016a: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)player == (Object)null || !((Component)player).gameObject.activeInHierarchy || (Object)(object)Object.FindObjectOfType(true) != (Object)null) { return false; } NavMeshHit val2 = default(NavMeshHit); Vector3 val = ((!forcedPosition.HasValue || !(forcedPosition.Value != Vector3.zero)) ? (NavMesh.SamplePosition(((Component)player).transform.position - ((Component)player).transform.forward * 1.5f, ref val2, 2f, -1) ? ((NavMeshHit)(ref val2)).position : ((Component)player).transform.position) : forcedPosition.Value); RaycastHit val3 = default(RaycastHit); if (Physics.Raycast(val + Vector3.up * 1f, Vector3.down, ref val3, 3f, ~LayerMask.GetMask(new string[3] { "Player", "PlayerOnlyCollision", "Ignore Raycast" }))) { val.y = ((RaycastHit)(ref val3)).point.y; } if (!PhotonNetwork.IsConnectedAndReady || !PhotonNetwork.InRoom || PhotonNetwork.OfflineMode) { return (Object)(object)BuildPetGameObject(val, contextName) != (Object)null; } if (!IsOnlineMaster() || eventSpawnInProgress) { return false; } GameObject val4 = BuildPetGameObject(val, contextName); if ((Object)(object)val4 == (Object)null) { return false; } PhotonView component = val4.GetComponent(); if ((Object)(object)component == (Object)null || component.ViewID <= 0) { Object.Destroy((Object)(object)val4); return false; } RepoSteamNetwork.SendPacket(new PetSpawnPacket { Position = val, ContextName = (contextName ?? "Network"), AllocatedViewID = component.ViewID }, (NetworkDestination)4); return true; } private static GameObject BuildPetGameObject(Vector3 position, string contextName, int allocatedViewID = 0) { //IL_0026: Unknown result type (might be due to invalid IL or missing references) //IL_002c: Expected O, but got Unknown //IL_004b: 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_01d7: Unknown result type (might be due to invalid IL or missing references) //IL_0212: Unknown result type (might be due to invalid IL or missing references) //IL_02ac: Unknown result type (might be due to invalid IL or missing references) //IL_02b6: Expected O, but got Unknown //IL_02b8: Unknown result type (might be due to invalid IL or missing references) //IL_02c2: Expected O, but got Unknown //IL_02c4: Unknown result type (might be due to invalid IL or missing references) //IL_02ce: Expected O, but got Unknown //IL_02d0: Unknown result type (might be due to invalid IL or missing references) //IL_02da: Expected O, but got Unknown //IL_02dc: Unknown result type (might be due to invalid IL or missing references) //IL_02e6: Expected O, but got Unknown //IL_02e8: Unknown result type (might be due to invalid IL or missing references) //IL_02f2: Expected O, but got Unknown //IL_02f4: Unknown result type (might be due to invalid IL or missing references) //IL_02fe: Expected O, but got Unknown //IL_0300: Unknown result type (might be due to invalid IL or missing references) //IL_030a: Expected O, but got Unknown //IL_030c: Unknown result type (might be due to invalid IL or missing references) //IL_0316: Expected O, but got Unknown //IL_0318: Unknown result type (might be due to invalid IL or missing references) //IL_0322: Expected O, but got Unknown //IL_03bf: Unknown result type (might be due to invalid IL or missing references) //IL_03d3: Unknown result type (might be due to invalid IL or missing references) //IL_03e6: Unknown result type (might be due to invalid IL or missing references) //IL_047a: Unknown result type (might be due to invalid IL or missing references) //IL_049d: Unknown result type (might be due to invalid IL or missing references) //IL_048e: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)Object.FindObjectOfType(true) != (Object)null) { return null; } int num = LayerMask.NameToLayer("PhysGrabObject"); if (num == -1) { return null; } GameObject val = new GameObject("Ai-Chan Companion"); val.SetActive(false); val.tag = "Phys Grab Object"; val.layer = num; val.transform.position = position; PhotonView val2 = val.AddComponent(); PhotonTransformView item = val.AddComponent(); val2.ObservedComponents = new List { (Component)(object)item }; val2.OwnershipTransfer = (OwnershipOption)1; bool flag = !PhotonNetwork.InRoom || PhotonNetwork.OfflineMode || PhotonNetwork.IsMasterClient; if (allocatedViewID > 0) { PhotonView photonView = PhotonNetwork.GetPhotonView(allocatedViewID); if ((Object)(object)photonView != (Object)null && (Object)(object)photonView != (Object)(object)val2) { Object.Destroy((Object)(object)val); return null; } val2.ViewID = allocatedViewID; if ((Object)(object)photonView == (Object)null) { PhotonNetwork.RegisterPhotonView(val2); } Plugin.Log.LogInfo((object)$"[AiNet] Ai-Chan spawnou no Client! Contexto: {contextName} | ViewID: {val2.ViewID}"); } else if (PhotonNetwork.InRoom && flag) { if (!PhotonNetwork.AllocateViewID(val2) || val2.ViewID <= 0) { Object.Destroy((Object)(object)val); return null; } Plugin.Log.LogInfo((object)$"[AiNet] Ai-Chan spawnou no Master! Contexto: {contextName} | ViewID: {val2.ViewID}"); } else { Plugin.Log.LogInfo((object)("[AiNet] Ai-Chan spawnou no Singleplayer! Contexto: " + contextName)); } float num2 = ((PetSettings.PetMass != null) ? PetSettings.PetMass.Value : 1.5f); float angularDrag = ((PetSettings.AngularDrag != null) ? PetSettings.AngularDrag.Value : 0.5f); Rigidbody obj = val.AddComponent(); obj.isKinematic = true; obj.useGravity = false; obj.mass = num2; obj.drag = 1f; obj.angularDrag = angularDrag; obj.constraints = (RigidbodyConstraints)0; obj.interpolation = (RigidbodyInterpolation)0; obj.excludeLayers = LayerMask.op_Implicit(LayerMask.GetMask(new string[2] { "Player", "PlayerOnlyCollision" })); CapsuleCollider val3 = val.AddComponent(); val3.radius = 0.3f; val3.height = 1.35f; val3.center = new Vector3(0f, 0.675f, 0f); PhysGrabObject val4 = val.AddComponent(); val4.ignoreGrabPointCentering = true; val4.massOriginal = num2; AccessTools.Field(typeof(PhysGrabObject), "physRidingDisabled")?.SetValue(val4, true); val.AddComponent(); PhysGrabObjectImpactDetector val5 = val.AddComponent(); ((Behaviour)val5).enabled = false; val5.destroyDisable = true; val5.playerHurtDisable = true; AccessTools.Field(typeof(PhysGrabObjectImpactDetector), "isIndestructible")?.SetValue(val5, true); val5.onAllImpacts = new UnityEvent(); val5.onImpactLight = new UnityEvent(); val5.onImpactMedium = new UnityEvent(); val5.onImpactHeavy = new UnityEvent(); val5.onAllBreaks = new UnityEvent(); val5.onBreakLight = new UnityEvent(); val5.onBreakMedium = new UnityEvent(); val5.onBreakHeavy = new UnityEvent(); val5.onDestroy = new UnityEvent(); val5.onHurtColliderHit = new UnityEvent(); val.AddComponent().Initialize(val3); NavMeshAgent val6 = val.AddComponent(); val6.radius = 0.15f; val6.height = 1.35f; val6.speed = ((PetSettings.Speed != null) ? PetSettings.Speed.Value : 3.5f); val6.acceleration = 28f; val6.angularSpeed = 720f; val6.stoppingDistance = 0.15f; val6.autoBraking = true; val6.autoRepath = true; val6.updateRotation = true; val6.obstacleAvoidanceType = (ObstacleAvoidanceType)0; ((Behaviour)val6).enabled = flag; NavMeshHit val7 = default(NavMeshHit); if (flag && NavMesh.SamplePosition(position, ref val7, 2f, -1)) { val6.Warp(((NavMeshHit)(ref val7)).position); val.transform.position = ((NavMeshHit)(ref val7)).position; } val.AddComponent(); PetCompanionController petCompanionController = val.AddComponent(); val.AddComponent(); val.AddComponent(); GameObject val8 = CreateAinoVisual(val.transform); if ((Object)(object)val8 == (Object)null) { Object.Destroy((Object)(object)val); return null; } petCompanionController.visualRoot = val8.transform; petCompanionController.animator = val8.GetComponentInChildren(true); CloneNativeHeartParticles(val8.transform); CreateNameTag(val.transform, "Ai-Chan"); val.SetActive(true); if (flag && ((Behaviour)val6).enabled) { NavMeshHit val9 = default(NavMeshHit); if (NavMesh.SamplePosition(position, ref val9, 2f, -1)) { val6.Warp(((NavMeshHit)(ref val9)).position); } else { val6.Warp(position); } } return val; } private static GameObject CreateAinoVisual(Transform parent) { //IL_002b: Unknown result type (might be due to invalid IL or missing references) //IL_003b: Unknown result type (might be due to invalid IL or missing references) //IL_004b: Unknown result type (might be due to invalid IL or missing references) GameObject ainoIneffaPrefab = GenshinImpactOverhaul.AinoIneffaPrefab; if ((Object)(object)ainoIneffaPrefab == (Object)null) { return null; } GameObject val = Object.Instantiate(ainoIneffaPrefab, parent, false); ((Object)val).name = "Ai-Chan Visual"; val.transform.localPosition = Vector3.zero; val.transform.localRotation = Quaternion.identity; val.transform.localScale = Vector3.one; Transform val2 = val.transform.Find("Aino"); Animator component = val.GetComponent(); if ((Object)(object)val2 != (Object)null) { ((Component)val2).gameObject.SetActive(true); } if ((Object)(object)val.transform.Find("Ineffa") != (Object)null) { ((Component)val.transform.Find("Ineffa")).gameObject.SetActive(false); } if ((Object)(object)component != (Object)null) { Animator val3 = (((Object)(object)val2 == (Object)null) ? null : ((Component)val2).GetComponent()); if ((Object)(object)val3 != (Object)null && (Object)(object)val3.avatar != (Object)null) { component.avatar = val3.avatar; } ((Behaviour)component).enabled = true; component.speed = 1f; component.cullingMode = (AnimatorCullingMode)0; component.applyRootMotion = false; } MonoBehaviour[] componentsInChildren = val.GetComponentsInChildren(true); foreach (MonoBehaviour val4 in componentsInChildren) { if (!((Object)(object)val4 == (Object)null)) { string name = ((object)val4).GetType().Name; if (name == "EnemyElsaAnim") { ((Behaviour)val4).enabled = false; } else if (name.Contains("Enemy") || name.Contains("Elsa") || name.Contains("Aggro") || name.Contains("EventHandler")) { Object.Destroy((Object)(object)val4); } } } Collider[] componentsInChildren2 = val.GetComponentsInChildren(true); for (int i = 0; i < componentsInChildren2.Length; i++) { componentsInChildren2[i].isTrigger = true; } Rigidbody[] componentsInChildren3 = val.GetComponentsInChildren(true); foreach (Rigidbody obj in componentsInChildren3) { obj.isKinematic = true; obj.useGravity = false; } return val; } private static ParticleSystem CloneNativeHeartParticles(Transform parent) { //IL_0093: Unknown result type (might be due to invalid IL or missing references) //IL_00a4: Unknown result type (might be due to invalid IL or missing references) //IL_00b5: Unknown result type (might be due to invalid IL or missing references) EnemyElsaAnim[] array = Object.FindObjectsOfType(true); foreach (EnemyElsaAnim val in array) { if ((Object)(object)val == (Object)null) { continue; } ParticleSystem[] componentsInChildren = ((Component)((Component)val).transform.root).GetComponentsInChildren(true); foreach (ParticleSystem val2 in componentsInChildren) { if ((Object)(object)val2 == (Object)null || ((Object)val2).name != "Particle Hearts") { continue; } GameObject val3 = Object.Instantiate(((Component)val2).gameObject, parent, false); ((Object)val3).name = "AiChanNativeHearts"; val3.transform.localPosition = new Vector3(0f, 1.45f, 0f); val3.transform.localRotation = Quaternion.identity; val3.transform.localScale = Vector3.one; Component[] componentsInChildren2 = val3.GetComponentsInChildren(true); foreach (Component val4 in componentsInChildren2) { if ((Object)(object)val4 != (Object)null && ((object)val4).GetType().Name == "ParentConstraint") { Object.Destroy((Object)(object)val4); } } ParticleSystem[] componentsInChildren3 = val3.GetComponentsInChildren(true); foreach (ParticleSystem obj in componentsInChildren3) { ((Component)obj).gameObject.SetActive(true); obj.Stop(true, (ParticleSystemStopBehavior)0); } return val3.GetComponentInChildren(true); } } return null; } private static void CreateNameTag(Transform parent, string text) { //IL_0005: Unknown result type (might be due to invalid IL or missing references) //IL_000a: Unknown result type (might be due to invalid IL or missing references) //IL_0017: Unknown result type (might be due to invalid IL or missing references) //IL_002c: Unknown result type (might be due to invalid IL or missing references) //IL_0036: 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) GameObject val = new GameObject("AiChanNameTag"); val.transform.SetParent(parent, false); val.transform.localPosition = new Vector3(0f, 1.6f, 0f); TextMesh obj = val.AddComponent(); obj.text = text; obj.fontSize = 36; obj.characterSize = 0.04f; obj.alignment = (TextAlignment)1; obj.anchor = (TextAnchor)4; obj.color = Color.cyan; val.AddComponent(); } } [HarmonyPatch(typeof(LevelGenerator), "Start")] internal static class PatchLevelGeneratorSpawnAiChan { private static void Postfix(LevelGenerator __instance) { //IL_0011: Unknown result type (might be due to invalid IL or missing references) //IL_0016: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)__instance == (Object)null || !Plugin.IsPetAlive) { return; } Scene activeScene = SceneManager.GetActiveScene(); string text = ((Scene)(ref activeScene)).name.ToLowerInvariant(); if (text.Contains("menu") || text.Contains("title") || text.Contains("start") || text.Contains("lobby")) { return; } if (PhotonNetwork.IsConnectedAndReady && PhotonNetwork.InRoom && !PhotonNetwork.OfflineMode && !PhotonNetwork.IsMasterClient) { PetSpawner.Initialize(); RepoSteamNetwork.SendPacket(new PetRequestSyncPacket(), (NetworkDestination)0); return; } PetSpawner.Initialize(); if (!PetSpawner.isSpawning) { PetSpawner.isSpawning = true; ((MonoBehaviour)__instance).StartCoroutine(SpawnWhenLevelIsReady()); } } private static IEnumerator SpawnWhenLevelIsReady() { try { float timeout = Time.time + 30f; NavMeshHit hit = default(NavMeshHit); while (Time.time < timeout) { if (!SemiFunc.RunIsLevel() || (Object)(object)LevelGenerator.Instance == (Object)null || !LevelGenerator.Instance.Generated) { yield return (object)new WaitForSeconds(0.25f); continue; } PlayerAvatar player = SemiFunc.PlayerAvatarLocal(); if ((Object)(object)player != (Object)null && ((Component)player).gameObject.activeInHierarchy && NavMesh.SamplePosition(((Component)player).transform.position - ((Component)player).transform.forward * 1f, ref hit, 2f, -1)) { yield return (object)new WaitForSeconds(0.5f); PetSpawner.TryCreatePet(player, "Level", ((NavMeshHit)(ref hit)).position); break; } yield return (object)new WaitForSeconds(0.5f); } } finally { PetSpawner.isSpawning = false; } } } [HarmonyPatch(typeof(ExtractionPoint), "Start")] internal static class PatchShopSpawnAiChan { private static void Postfix(ExtractionPoint __instance) { //IL_0011: Unknown result type (might be due to invalid IL or missing references) //IL_0016: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)__instance == (Object)null || !Plugin.IsPetAlive) { return; } Scene activeScene = SceneManager.GetActiveScene(); string text = ((Scene)(ref activeScene)).name.ToLowerInvariant(); if (text.Contains("menu") || text.Contains("title") || text.Contains("start") || text.Contains("lobby")) { return; } FieldInfo fieldInfo = AccessTools.Field(typeof(ExtractionPoint), "isShop"); if (!text.Contains("shop")) { bool flag = default(bool); int num; if (fieldInfo != null) { object value = fieldInfo.GetValue(__instance); if (value is bool) { flag = (bool)value; num = 1; } else { num = 0; } } else { num = 0; } if (((uint)num & (flag ? 1u : 0u)) == 0) { return; } } if (PhotonNetwork.IsConnectedAndReady && PhotonNetwork.InRoom && !PhotonNetwork.OfflineMode && !PhotonNetwork.IsMasterClient) { PetSpawner.Initialize(); RepoSteamNetwork.SendPacket(new PetRequestSyncPacket(), (NetworkDestination)0); return; } PetSpawner.Initialize(); if (!PetSpawner.isSpawning) { PetSpawner.isSpawning = true; ((MonoBehaviour)__instance).StartCoroutine(PetSpawner.SpawnWhenShopIsReady(__instance)); } } } internal sealed class PetPlayerCollisionController : MonoBehaviour { private Collider[] petColliders; public void Initialize(CapsuleCollider collider) { petColliders = ((Component)this).GetComponentsInChildren(true); } private void FixedUpdate() { if (petColliders == null || petColliders.Length == 0) { return; } List list = SemiFunc.PlayerGetAll(); if (list == null) { return; } foreach (PlayerAvatar item in list) { if ((Object)(object)item == (Object)null || (Object)(object)((Component)item).gameObject == (Object)null) { continue; } Collider[] componentsInChildren = ((Component)((Component)item).transform.root).GetComponentsInChildren(true); foreach (Collider val in componentsInChildren) { if ((Object)(object)val == (Object)null || val.isTrigger) { continue; } for (int j = 0; j < petColliders.Length; j++) { if ((Object)(object)petColliders[j] != (Object)null && (Object)(object)petColliders[j] != (Object)(object)val) { Physics.IgnoreCollision(petColliders[j], val, true); } } } } } } internal sealed class PetNameBillboard : MonoBehaviour { private void LateUpdate() { //IL_0016: Unknown result type (might be due to invalid IL or missing references) //IL_0021: Unknown result type (might be due to invalid IL or missing references) //IL_0026: Unknown result type (might be due to invalid IL or missing references) //IL_002b: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Unknown result type (might be due to invalid IL or missing references) //IL_0039: Unknown result type (might be due to invalid IL or missing references) //IL_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) Camera main = Camera.main; if (!((Object)(object)main == (Object)null)) { Vector3 val = ((Component)this).transform.position - ((Component)main).transform.position; Vector3 val2 = default(Vector3); ((Vector3)(ref val2))..ctor(val.x, 0f, val.z); if (((Vector3)(ref val2)).sqrMagnitude > 0.001f) { ((Component)this).transform.rotation = Quaternion.LookRotation(((Vector3)(ref val2)).normalized, Vector3.up); } } } } public class PetStatePacket : NetworkPacket { public int PetViewID; public int OwnerViewID; public int StateIndex; public int Sequence; public Vector3 Position; public Quaternion Rotation; protected override void WriteData(SocketMessage socketMessage) { //IL_0036: 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) socketMessage.Write(PetViewID); socketMessage.Write(OwnerViewID); socketMessage.Write(StateIndex); socketMessage.Write(Sequence); socketMessage.Write(Position); socketMessage.Write(Rotation); } protected override void ReadData(SocketMessage socketMessage) { //IL_0032: Unknown result type (might be due to invalid IL or missing references) //IL_0037: Unknown result type (might be due to invalid IL or missing references) //IL_003e: Unknown result type (might be due to invalid IL or missing references) //IL_0043: Unknown result type (might be due to invalid IL or missing references) PetViewID = socketMessage.Read(); OwnerViewID = socketMessage.Read(); StateIndex = socketMessage.Read(); Sequence = socketMessage.Read(); Position = socketMessage.Read(); Rotation = socketMessage.Read(); } } public class PetGiveItemPacket : NetworkPacket { public int PetViewID; public int ItemViewID; protected override void WriteData(SocketMessage socketMessage) { socketMessage.Write(PetViewID); socketMessage.Write(ItemViewID); } protected override void ReadData(SocketMessage socketMessage) { PetViewID = socketMessage.Read(); ItemViewID = socketMessage.Read(); } } public class PetSyncPettingPacket : NetworkPacket { public int PetViewID; protected override void WriteData(SocketMessage socketMessage) { socketMessage.Write(PetViewID); } protected override void ReadData(SocketMessage socketMessage) { PetViewID = socketMessage.Read(); } } public class PetCarryPlayerPacket : NetworkPacket { public int PetViewID; public int PlayerViewID; protected override void WriteData(SocketMessage socketMessage) { socketMessage.Write(PetViewID); socketMessage.Write(PlayerViewID); } protected override void ReadData(SocketMessage socketMessage) { PetViewID = socketMessage.Read(); PlayerViewID = socketMessage.Read(); } } public class PetSyncCarryPacket : NetworkPacket { public int PetViewID; public int TargetViewID; public bool IsPlayer; public bool IsPickingUp; public bool InheritScale; protected override void WriteData(SocketMessage socketMessage) { socketMessage.Write(PetViewID); socketMessage.Write(TargetViewID); socketMessage.Write(IsPlayer); socketMessage.Write(IsPickingUp); socketMessage.Write(InheritScale); } protected override void ReadData(SocketMessage socketMessage) { PetViewID = socketMessage.Read(); TargetViewID = socketMessage.Read(); IsPlayer = socketMessage.Read(); IsPickingUp = socketMessage.Read(); InheritScale = socketMessage.Read(); } } public class PetSwitchOwnerPacket : NetworkPacket { protected override void WriteData(SocketMessage socketMessage) { } protected override void ReadData(SocketMessage socketMessage) { } } public class PetSpawnPacket : NetworkPacket { public Vector3 Position; public string ContextName; public int AllocatedViewID; protected override void WriteData(SocketMessage socketMessage) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) socketMessage.Write(Position); socketMessage.Write(ContextName); socketMessage.Write(AllocatedViewID); } protected override void ReadData(SocketMessage socketMessage) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Unknown result type (might be due to invalid IL or missing references) Position = socketMessage.Read(); ContextName = socketMessage.Read(); AllocatedViewID = socketMessage.Read(); } } public class PetExplodePacket : NetworkPacket { public int PetViewID; public float Delay; protected override void WriteData(SocketMessage socketMessage) { socketMessage.Write(PetViewID); socketMessage.Write(Delay); } protected override void ReadData(SocketMessage socketMessage) { PetViewID = socketMessage.Read(); Delay = socketMessage.Read(); } } public class PetRequestSyncPacket : NetworkPacket { public ulong SenderSteamID; protected override void WriteData(SocketMessage socketMessage) { socketMessage.Write(SenderSteamID); } protected override void ReadData(SocketMessage socketMessage) { SenderSteamID = socketMessage.Read(); } } [RSNVersionCompatibility(/*Could not decode attribute arguments.*/)] [BepInPlugin("com.neko3004.aichancompanion", "Ai-Chan Companion", "1.0.0")] public sealed class Plugin : BaseUnityPlugin { public enum LogCategory { SteamNet, AiNet, AiInteract, AiSystem } public const string MODGUID = "com.neko3004.aichancompanion"; public const string MODNAME = "Ai-Chan Companion"; public const string MODVERSION = "1.0.0"; public static bool IsPetAlive = true; private Harmony harmony; public static Plugin Instance { get; private set; } public static ManualLogSource Log { get; private set; } public static void LogDebug(LogCategory category, string message) { if (PetSettings.EnableDebugLogs != null && PetSettings.EnableDebugLogs.Value) { Log.LogInfo((object)$"[{category}] {message}"); } } private void Awake() { //IL_005b: Unknown result type (might be due to invalid IL or missing references) //IL_0065: Expected O, but got Unknown Instance = this; Log = ((BaseUnityPlugin)this).Logger; ((Component)this).gameObject.AddComponent(); PetSettings.Initialize(((BaseUnityPlugin)this).Config); RepoSteamNetwork.RegisterPacket(); RepoSteamNetwork.RegisterPacket(); RepoSteamNetwork.RegisterPacket(); RepoSteamNetwork.RegisterPacket(); RepoSteamNetwork.RegisterPacket(); RepoSteamNetwork.RegisterPacket(); RepoSteamNetwork.RegisterPacket(); RepoSteamNetwork.RegisterPacket(); RepoSteamNetwork.RegisterPacket(); harmony = new Harmony("com.neko3004.aichancompanion"); try { harmony.PatchAll(typeof(Plugin).Assembly); Log.LogInfo((object)"Ai-Chan Companion v1.0.0 loaded successfully (Steam Network enabled)."); } catch (Exception arg) { Log.LogError((object)$"[AiSystem] Failed to apply patches: {arg}"); } } } }