Please disclose if any significant portion of your mod was created using AI tools by adding the 'AI Generated' category. Failing to do so may result in the mod being removed from Thunderstore.
Decompiled source of CozyCats v2.1.2
CozyCats.dll
Decompiled a month ago
The result has been truncated due to the large size, download it to view full contents!
using System; using System.Collections.Generic; using System.Diagnostics; using System.Globalization; using System.IO; using System.Linq; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using System.Security; using System.Security.Permissions; using BepInEx; using BepInEx.Configuration; using BepInEx.Logging; using CozyCats.NetcodePatcher; using GameNetcodeStuff; using HarmonyLib; using LethalLib.Modules; using Microsoft.CodeAnalysis; using TMPro; using Unity.Collections; using Unity.Netcode; using UnityEngine; using UnityEngine.AI; using UnityEngine.Audio; [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("CozyCats")] [assembly: AssemblyConfiguration("Release")] [assembly: AssemblyFileVersion("2.1.2.0")] [assembly: AssemblyInformationalVersion("2.1.2+2e792e54bd8596e7c72f50c3d765632f7e812c1b")] [assembly: AssemblyProduct("CozyCats")] [assembly: AssemblyTitle("CozyCats")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("2.1.2.0")] [module: UnverifiableCode] [module: RefSafetyRules(11)] [module: NetcodePatchedAssembly] 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 CozyCats { internal static class CatAssets { public static GameObject CatModel; public static GameObject CatTree; public static AudioClip[] Meows = (AudioClip[])(object)new AudioClip[0]; public static AudioClip[] Purrs = (AudioClip[])(object)new AudioClip[0]; public static bool Load(string path) { if (!File.Exists(path)) { return false; } AssetBundle val = AssetBundle.LoadFromFile(path); if ((Object)(object)val == (Object)null) { return false; } CatModel = val.LoadAsset<GameObject>("CatModel"); CatTree = val.LoadAsset<GameObject>("CatTree"); AudioClip[] source = val.LoadAllAssets<AudioClip>(); Meows = source.Where((AudioClip c) => ((Object)c).name.StartsWith("meow")).ToArray(); Purrs = source.Where((AudioClip c) => ((Object)c).name.StartsWith("purr")).ToArray(); Plugin.Log.LogInfo((object)$"Loaded cat model: {(Object)(object)CatModel != (Object)null}, cat tree: {(Object)(object)CatTree != (Object)null}, {Meows.Length} meows, {Purrs.Length} purrs"); return (Object)(object)CatModel != (Object)null; } } internal class CatConfig { private const int MaxCats = 20; public readonly ConfigEntry<string> CatChances; public readonly ConfigEntry<float> ModelScale; public readonly ConfigEntry<bool> AmbientMeows; public readonly ConfigEntry<string> SpecialCats; public readonly ConfigEntry<float> SpecialCatChance; public readonly ConfigEntry<int> RescueBounty; public CatConfig(ConfigFile cfg) { //IL_0064: Unknown result type (might be due to invalid IL or missing references) //IL_006e: Expected O, but got Unknown //IL_00bd: Unknown result type (might be due to invalid IL or missing references) //IL_00c7: Expected O, but got Unknown //IL_00ef: Unknown result type (might be due to invalid IL or missing references) //IL_00f9: Expected O, but got Unknown CatChances = cfg.Bind<string>("Spawning", "CatChances", "1, 0.8", "Chance (0-1) for each cat hiding in the facility, separated by commas. Rolled in order, stopping at the first miss.\nExamples: '1, 0.8' = always one cat, usually two. '1, 1, 1, 1, 1' = five cats. '1, 0.8, 0.6, 0.4' = up to four, each less likely. '0.5' = at most one, half the time. Up to " + 20 + " cats."); ModelScale = cfg.Bind<float>("Visuals", "ModelScale", 1f, new ConfigDescription("Size multiplier for cats. Requires restart.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0.5f, 2f), Array.Empty<object>())); SpecialCats = cfg.Bind<string>("Cats", "SpecialCats", "Strider, Black, Yellow; Peaches, Peach, Olive", "Your own named cats, each as rare as any other name. Separate cats with ';' and fields with ','.\nFormat: Name, FurColour, EyeColour[, CoatLabel shown when scanned]\nColours: #RRGGBB or a preset: Ginger, Black, White, Grey, Cream, Chocolate, Silver, Blue, Fawn, Peach, Green, Yellow, Amber, Copper, Hazel, Olive.\nOnly the host's list matters in multiplayer. Strider and Peaches are the original two; keep them if you like."); SpecialCatChance = cfg.Bind<float>("Cats", "SpecialCatChance", 0.5f, new ConfigDescription("Chance (0-1), per landing, that each special cat not already on your ship is hiding in the facility. If you don't bring it home it tries again next landing. Lose it from the ship and it comes back into the running.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0f, 1f), Array.Empty<object>())); RescueBounty = cfg.Bind<int>("Rewards", "RescueBounty", 100, new ConfigDescription("Credits paid to the crew, once per cat, the first time it's brought into the ship. 0 turns it off.", (AcceptableValueBase)(object)new AcceptableValueRange<int>(0, 1000), Array.Empty<object>())); AmbientMeows = cfg.Bind<bool>("Sounds", "AmbientMeows", true, "Cats that are set down meow softly every few minutes. Monsters can never hear them."); MigrateOldSpawnKeys(cfg); } public float[] ParseCatChances() { List<float> list = new List<float>(); string[] array = (CatChances.Value ?? "").Split(','); for (int i = 0; i < array.Length; i++) { string text = array[i].Trim(); if (text.Length != 0) { if (float.TryParse(text, NumberStyles.Float, CultureInfo.InvariantCulture, out var result)) { list.Add(Mathf.Clamp01(result)); } else { Plugin.Log.LogWarning((object)("[Spawning] CatChances: couldn't read '" + text + "' as a number from 0 to 1; skipping it.")); } } } return list.Take(20).ToArray(); } private void MigrateOldSpawnKeys(ConfigFile cfg) { Dictionary<ConfigDefinition, string> orphans = Traverse.Create((object)cfg).Property("OrphanedEntries", (object[])null).GetValue<Dictionary<ConfigDefinition, string>>(); if (orphans == null) { return; } string text = Take("MaxCatsPerMoon"); string text2 = Take("ChanceFirstCat"); string text3 = Take("ChanceExtraCat"); if (!(((Take("FirstCatChance") != null) | (Take("ExtraCatChance") != null)) || text != null || text2 != null || text3 != null)) { return; } if (text != null && text2 != null && text3 != null && CatChances.Value == (string)((ConfigEntryBase)CatChances).DefaultValue && int.TryParse(text, out var result) && float.TryParse(text2, NumberStyles.Float, CultureInfo.InvariantCulture, out var f) && float.TryParse(text3, NumberStyles.Float, CultureInfo.InvariantCulture, out var e)) { IEnumerable<float> source = from i in Enumerable.Range(0, Math.Clamp(result, 0, 20)) select (i != 0) ? e : f; CatChances.Value = string.Join(", ", source.Select((float c) => c.ToString("0.##", CultureInfo.InvariantCulture))); if (CatChances.Value.Length == 0) { CatChances.Value = "0"; } } cfg.Save(); string Take(string key) { //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Expected O, but got Unknown ConfigDefinition key2 = new ConfigDefinition("Spawning", key); if (!orphans.TryGetValue(key2, out var value)) { return null; } orphans.Remove(key2); return value; } } } public class CatItem : GrabbableObject { private enum Mood : byte { Calm, Alarmed, Coaxed } private const byte PoseIdle = 0; private const byte PoseSit = 1; private const byte PoseLoaf = 2; private const byte PoseHeld = 3; private const byte PoseWalk = 4; private const byte PoseRun = 5; private const byte PoseDrape = 7; internal const byte PoseCurl = 6; private static readonly int PoseHash = Animator.StringToHash("Pose"); private static readonly int BlinkHash = Animator.StringToHash("Blink"); private static readonly int TwitchLHash = Animator.StringToHash("TwitchL"); private static readonly int TwitchRHash = Animator.StringToHash("TwitchR"); private static readonly int MeowHash = Animator.StringToHash("Meow"); private static readonly int MoveSpeedHash = Animator.StringToHash("MoveSpeed"); private static Shader litShader; private static Material pupilMat; private static Material pinkMat; private readonly NetworkVariable<int> netSeed = new NetworkVariable<int>(0, (NetworkVariableReadPermission)0, (NetworkVariableWritePermission)0); private readonly NetworkVariable<byte> netPose = new NetworkVariable<byte>((byte)2, (NetworkVariableReadPermission)0, (NetworkVariableWritePermission)0); private readonly NetworkVariable<FixedString128Bytes> netIdentity = new NetworkVariable<FixedString128Bytes>(default(FixedString128Bytes), (NetworkVariableReadPermission)0, (NetworkVariableWritePermission)0); private readonly NetworkVariable<bool> netRescued = new NetworkVariable<bool>(false, (NetworkVariableReadPermission)0, (NetworkVariableWritePermission)0); private Animator animator; private AudioSource audioSource; private ScanNodeProperties scanNode; private Material furMat; private Material eyeMat; private Transform model; private BoxCollider bodyCollider; private Vector3 modelBaseScale; private Vector3 colliderBaseCenter; private Vector3 colliderBaseSize; private Vector3 modelBasePos; private Quaternion modelBaseRot; private float size = 1f; private float sizeRoll = 0.5f; private AudioClip grabClip; private AudioClip dropClip; private AudioClip purrClip; private AudioSource purrSource; private const float HeldMeowVolume = 0.27f; private const float AmbientMeowVolume = 0.18f; private const float HeldPurrVolume = 0.156f; private const float EyeGlow = 0.6f; public static Quaternion HeldRot = Quaternion.Euler(312.4f, 12.8f, 321.4f); public static Vector3 HeldShift = new Vector3(-0.034f, -0.039f, -0.166f); private bool visualsReady; private bool hasMeowTrigger; private int pendingSeed; private bool loadedFromSave; private float poseTimer; private float blinkTimer; private float twitchTimer; private float ambientMeowTimer; private float meowCooldown; private const float SpotRange = 8f; private const float HearRange = 2.5f; private const float PersonalSpace = 4.5f; private const float FleeMin = 8f; private const float FleeMax = 14f; private const float CoaxRange = 12f; private const float CoaxStop = 1f; private const float CalmDownAfter = 20f; private const float WalkSpeed = 0.55f; private const float RunSpeed = 7.5f; private const float FollowWalkSpeed = 0.9f; private const float FollowRunSpeed = 6f; private const float FollowStop = 1.6f; private const float FollowStart = 2.6f; private const float FollowRunStart = 8f; private const float FollowRunStop = 4f; private const float FollowDoorRange = 12f; private const float FollowCatchUp = 30f; private const float FollowStuckTime = 4f; private const float WalkClipSpeed = 0.13f; private const float RunClipSpeed = 1f; private readonly NetworkVariable<bool> netTamed = new NetworkVariable<bool>(false, (NetworkVariableReadPermission)0, (NetworkVariableWritePermission)0); private Mood mood; private float brainTimer; private float calmTimer; private float coaxRepathTimer; private NavMeshPath navPath; private PlayerControllerB followTarget; private bool followRunning; private float followRepath; private float lastFollowDist = float.MaxValue; private Vector3 lastFollowDest; private Vector3 stuckAnchor; private float stuckTimer; private Vector3[] path; private bool pathLocal; private int pathIndex; private float moveSpeed; private byte gait; private const float TreeChance = 0.45f; private const float ShipWanderMin = 1.5f; private const float ShipWanderMax = 5f; private PerchHost.Spot treeSpot; private PerchHost.Spot headingFor; private float shipTimer; private bool shipTimerSet; public Vector3 HeldPivot => new Vector3(0f, 0.2f * modelBaseScale.y * size, 0f); public string CatName { get; private set; } = "your cat"; public int PendingBountyDisplay { get; set; } private bool IsMoving => path != null; private bool InTree => treeSpot != null; internal void SetSeed(int seed) { pendingSeed = seed; } private void Awake() { Transform[] componentsInChildren = ((Component)this).GetComponentsInChildren<Transform>(true); for (int i = 0; i < componentsInChildren.Length; i++) { ((Object)((Component)componentsInChildren[i]).gameObject).hideFlags = (HideFlags)0; } } public override void Start() { ((GrabbableObject)this).Start(); EnsureVisuals(); poseTimer = Random.Range(10f, 30f); blinkTimer = Random.Range(1f, 5f); twitchTimer = Random.Range(8f, 30f); ambientMeowTimer = Random.Range(60f, 180f); ApplyLooks(netSeed.Value); } public override void OnNetworkSpawn() { //IL_0051: Unknown result type (might be due to invalid IL or missing references) ((NetworkBehaviour)this).OnNetworkSpawn(); if (((NetworkBehaviour)this).IsServer) { if (netSeed.Value == 0) { netSeed.Value = ((pendingSeed != 0) ? pendingSeed : CatLooks.NewSeed()); } netIdentity.Value = new FixedString128Bytes(CatLooks.ResolveIdentity(netSeed.Value)); if (loadedFromSave) { netRescued.Value = true; netTamed.Value = true; } } NetworkVariable<int> obj = netSeed; obj.OnValueChanged = (OnValueChangedDelegate<int>)(object)Delegate.Combine((Delegate?)(object)obj.OnValueChanged, (Delegate?)(object)new OnValueChangedDelegate<int>(OnSeedChanged)); NetworkVariable<FixedString128Bytes> obj2 = netIdentity; obj2.OnValueChanged = (OnValueChangedDelegate<FixedString128Bytes>)(object)Delegate.Combine((Delegate?)(object)obj2.OnValueChanged, (Delegate?)(object)new OnValueChangedDelegate<FixedString128Bytes>(OnIdentityChanged)); ApplyLooks(netSeed.Value); } public override void OnNetworkDespawn() { NetworkVariable<int> obj = netSeed; obj.OnValueChanged = (OnValueChangedDelegate<int>)(object)Delegate.Remove((Delegate?)(object)obj.OnValueChanged, (Delegate?)(object)new OnValueChangedDelegate<int>(OnSeedChanged)); NetworkVariable<FixedString128Bytes> obj2 = netIdentity; obj2.OnValueChanged = (OnValueChangedDelegate<FixedString128Bytes>)(object)Delegate.Remove((Delegate?)(object)obj2.OnValueChanged, (Delegate?)(object)new OnValueChangedDelegate<FixedString128Bytes>(OnIdentityChanged)); ((NetworkBehaviour)this).OnNetworkDespawn(); } private void OnSeedChanged(int _, int seed) { ApplyLooks(seed); } private void OnIdentityChanged(FixedString128Bytes _, FixedString128Bytes __) { ApplyLooks(netSeed.Value); } private void EnsureVisuals() { //IL_0081: Unknown result type (might be due to invalid IL or missing references) //IL_0086: Unknown result type (might be due to invalid IL or missing references) //IL_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_00a3: Unknown result type (might be due to invalid IL or missing references) //IL_00a8: Unknown result type (might be due to invalid IL or missing references) //IL_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_00df: Unknown result type (might be due to invalid IL or missing references) //IL_00e4: Unknown result type (might be due to invalid IL or missing references) //IL_016d: 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_01c1: 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) if (visualsReady) { return; } visualsReady = true; animator = ((Component)this).GetComponentInChildren<Animator>(); audioSource = ((Component)this).GetComponent<AudioSource>(); Transform obj = ((Component)this).transform.Find("Purr"); purrSource = ((obj != null) ? ((Component)obj).GetComponent<AudioSource>() : null); scanNode = ((Component)this).GetComponentInChildren<ScanNodeProperties>(); model = ((Component)this).transform.Find("Model"); if ((Object)(object)model != (Object)null) { modelBaseScale = model.localScale; modelBasePos = model.localPosition; modelBaseRot = model.localRotation; } bodyCollider = ((Component)this).GetComponent<BoxCollider>(); if ((Object)(object)bodyCollider != (Object)null) { colliderBaseCenter = bodyCollider.center; colliderBaseSize = bodyCollider.size; } if ((Object)(object)animator != (Object)null) { animator.cullingMode = (AnimatorCullingMode)1; AnimatorControllerParameter[] parameters = animator.parameters; for (int i = 0; i < parameters.Length; i++) { if (parameters[i].nameHash == MeowHash) { hasMeowTrigger = true; } } } if (litShader == null) { litShader = Shader.Find("HDRP/Lit"); } if ((Object)(object)litShader == (Object)null) { return; } if (pupilMat == null) { pupilMat = MakeMat(new Color(0.02f, 0.02f, 0.02f), 0.7f); } if (pinkMat == null) { pinkMat = MakeMat(new Color(0.95f, 0.55f, 0.6f), 0.2f); } furMat = MakeMat(Color.white, 0f); eyeMat = MakeMat(Color.green, 0.75f); SkinnedMeshRenderer componentInChildren = ((Component)this).GetComponentInChildren<SkinnedMeshRenderer>(); if (!((Object)(object)componentInChildren == (Object)null)) { Material[] sharedMaterials = ((Renderer)componentInChildren).sharedMaterials; for (int j = 0; j < sharedMaterials.Length; j++) { string text = (((Object)(object)sharedMaterials[j] != (Object)null) ? ((Object)sharedMaterials[j]).name : ""); sharedMaterials[j] = (text.Contains("Eye") ? eyeMat : (text.Contains("Pupil") ? pupilMat : (text.Contains("Pink") ? pinkMat : furMat))); } ((Renderer)componentInChildren).sharedMaterials = sharedMaterials; } } private static Material MakeMat(Color c, float smoothness) { //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_0010: Unknown result type (might be due to invalid IL or missing references) //IL_0016: Unknown result type (might be due to invalid IL or missing references) //IL_0023: Expected O, but got Unknown Material val = new Material(litShader); val.SetColor("_BaseColor", c); val.SetFloat("_Smoothness", smoothness); return val; } internal void ApplySize() { //IL_0026: Unknown result type (might be due to invalid IL or missing references) //IL_0031: Unknown result type (might be due to invalid IL or missing references) //IL_0050: Unknown result type (might be due to invalid IL or missing references) //IL_005b: Unknown result type (might be due to invalid IL or missing references) //IL_006c: 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) size = CatLooks.SizeAt(sizeRoll); if ((Object)(object)model != (Object)null) { model.localScale = modelBaseScale * size; } if ((Object)(object)bodyCollider != (Object)null) { bodyCollider.center = colliderBaseCenter * size; bodyCollider.size = colliderBaseSize * size; } } private void ApplyLooks(int seed) { //IL_0013: Unknown result type (might be due to invalid IL or missing references) //IL_0018: Unknown result type (might be due to invalid IL or missing references) //IL_00c2: 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_00fc: Unknown result type (might be due to invalid IL or missing references) //IL_0106: Unknown result type (might be due to invalid IL or missing references) if (seed != 0) { EnsureVisuals(); CatLooks catLooks = new CatLooks(seed, ((object)netIdentity.Value/*cast due to .constrained prefix*/).ToString()); CatName = catLooks.Name; sizeRoll = catLooks.SizeRoll; Item[] soundSources = CatRegistry.SoundSources; Item val = ((soundSources.Length != 0) ? soundSources[catLooks.SoundRoll % soundSources.Length] : null); grabClip = val?.grabSFX; dropClip = val?.dropSFX; purrClip = ((CatAssets.Purrs.Length != 0) ? CatAssets.Purrs[catLooks.SoundRoll / 7 % CatAssets.Purrs.Length] : null); if ((Object)(object)furMat != (Object)null) { furMat.SetColor("_BaseColor", catLooks.Fur); } if ((Object)(object)eyeMat != (Object)null) { eyeMat.SetColor("_BaseColor", catLooks.Eye); eyeMat.SetColor("_EmissiveColor", catLooks.Eye * 0.6f); } ApplySize(); if ((Object)(object)scanNode != (Object)null) { scanNode.headerText = CatName; scanNode.subText = catLooks.FurName + " cat - not for sale"; } base.customGrabTooltip = "Pick up " + CatName + " : [E]"; } } public override void Update() { ((GrabbableObject)this).Update(); float deltaTime = Time.deltaTime; meowCooldown -= deltaTime; UpdateMovement(deltaTime); if (((NetworkBehaviour)this).IsServer) { UpdateBrain(deltaTime); } if (((NetworkBehaviour)this).IsServer && !base.isHeld && !base.isHeldByEnemy && base.reachedFloorTarget && !IsMoving && mood == Mood.Calm && !InTree) { poseTimer -= deltaTime; if (poseTimer <= 0f) { poseTimer = Random.Range(25f, 70f); netPose.Value = PickRestingPose(netPose.Value); } if (Plugin.Cfg.AmbientMeows.Value) { ambientMeowTimer -= deltaTime; if (ambientMeowTimer <= 0f) { ambientMeowTimer = Random.Range(60f, 180f); if (CatAssets.Meows.Length != 0) { MeowClientRpc(Random.Range(0, CatAssets.Meows.Length), 0.18f); } } } } UpdatePurr(deltaTime); if (!((Object)(object)animator == (Object)null)) { animator.SetInteger(PoseHash, (base.isHeld || base.isHeldByEnemy) ? 3 : (IsMoving ? gait : netPose.Value)); if (IsMoving) { animator.SetFloat(MoveSpeedHash, AnimSpeedFor(gait, moveSpeed)); } if (base.isHeld || IsMoving || (netPose.Value != 6 && netPose.Value != 7)) { blinkTimer -= deltaTime; } if (blinkTimer <= 0f) { blinkTimer = Random.Range(2.5f, 7f); animator.SetTrigger(BlinkHash); } twitchTimer -= deltaTime; if (twitchTimer <= 0f) { twitchTimer = Random.Range(10f, 40f); animator.SetTrigger((Random.value < 0.5f) ? TwitchLHash : TwitchRHash); } } } private void UpdatePurr(float dt) { if (!((Object)(object)purrSource == (Object)null) && !((Object)(object)purrClip == (Object)null)) { float num = (base.isHeld ? 0.156f : 0f); purrSource.volume = Mathf.MoveTowards(purrSource.volume, num, dt * 0.156f / 1.5f); if (num > 0f && !purrSource.isPlaying) { purrSource.clip = purrClip; purrSource.time = Random.Range(0f, purrClip.length * 0.5f); purrSource.Play(); } else if (num == 0f && purrSource.isPlaying && purrSource.volume <= 0f) { purrSource.Stop(); } } } private static byte PickRestingPose(byte current) { byte b; do { b = (byte)Random.Range(0, 3); } while (b == current && Random.value < 0.7f); return b; } public override void ItemActivate(bool used, bool buttonDown = true) { ((GrabbableObject)this).ItemActivate(used, buttonDown); if (buttonDown && !(meowCooldown > 0f) && CatAssets.Meows.Length != 0) { meowCooldown = 1.2f; MeowServerRpc(Random.Range(0, CatAssets.Meows.Length)); } } [ServerRpc(RequireOwnership = false)] private void MeowServerRpc(int clip) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_0099: Unknown result type (might be due to invalid IL or missing references) //IL_00a3: Invalid comparison between Unknown and I4 //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_006d: Unknown result type (might be due to invalid IL or missing references) //IL_0071: Unknown result type (might be due to invalid IL or missing references) //IL_0089: Unknown result type (might be due to invalid IL or missing references) //IL_00ce: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager; if (networkManager != null && networkManager.IsListening) { if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1 && (networkManager.IsClient || networkManager.IsHost)) { ServerRpcParams val2 = default(ServerRpcParams); FastBufferWriter val = ((NetworkBehaviour)this).__beginSendServerRpc(1054263291u, val2, (RpcDelivery)0); BytePacker.WriteValueBitPacked(val, clip); ((NetworkBehaviour)this).__endSendServerRpc(ref val, 1054263291u, val2, (RpcDelivery)0); } if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost)) { ((NetworkBehaviour)this).__rpc_exec_stage = (__RpcExecStage)0; MeowClientRpc(clip, 0.27f); } } } [ClientRpc] private void MeowClientRpc(int clip, float volume) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_00b4: Unknown result type (might be due to invalid IL or missing references) //IL_00be: Invalid comparison between Unknown and I4 //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_006d: Unknown result type (might be due to invalid IL or missing references) //IL_0071: Unknown result type (might be due to invalid IL or missing references) //IL_008a: Unknown result type (might be due to invalid IL or missing references) //IL_0090: Unknown result type (might be due to invalid IL or missing references) //IL_00a4: Unknown result type (might be due to invalid IL or missing references) //IL_00e9: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager; if (networkManager == null || !networkManager.IsListening) { return; } if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1 && (networkManager.IsServer || networkManager.IsHost)) { ClientRpcParams val2 = default(ClientRpcParams); FastBufferWriter val = ((NetworkBehaviour)this).__beginSendClientRpc(2810453604u, val2, (RpcDelivery)0); BytePacker.WriteValueBitPacked(val, clip); ((FastBufferWriter)(ref val)).WriteValueSafe<float>(ref volume, default(ForPrimitives)); ((NetworkBehaviour)this).__endSendClientRpc(ref val, 2810453604u, val2, (RpcDelivery)0); } if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1 || (!networkManager.IsClient && !networkManager.IsHost)) { return; } ((NetworkBehaviour)this).__rpc_exec_stage = (__RpcExecStage)0; if (CatAssets.Meows.Length != 0 && !((Object)(object)audioSource == (Object)null)) { audioSource.pitch = Random.Range(0.92f, 1.1f); audioSource.PlayOneShot(CatAssets.Meows[clip % CatAssets.Meows.Length], volume); if (hasMeowTrigger) { animator.SetTrigger(MeowHash); } } } public override void LateUpdate() { //IL_0078: Unknown result type (might be due to invalid IL or missing references) //IL_0089: Unknown result type (might be due to invalid IL or missing references) //IL_001e: Unknown result type (might be due to invalid IL or missing references) //IL_0023: Unknown result type (might be due to invalid IL or missing references) //IL_002a: Unknown result type (might be due to invalid IL or missing references) //IL_0030: Unknown result type (might be due to invalid IL or missing references) //IL_0035: Unknown result type (might be due to invalid IL or missing references) //IL_0045: Unknown result type (might be due to invalid IL or missing references) //IL_0046: Unknown result type (might be due to invalid IL or missing references) //IL_004c: Unknown result type (might be due to invalid IL or missing references) //IL_0051: Unknown result type (might be due to invalid IL or missing references) //IL_0052: Unknown result type (might be due to invalid IL or missing references) //IL_0057: Unknown result type (might be due to invalid IL or missing references) //IL_005c: Unknown result type (might be due to invalid IL or missing references) //IL_0061: Unknown result type (might be due to invalid IL or missing references) //IL_0066: Unknown result type (might be due to invalid IL or missing references) ((GrabbableObject)this).LateUpdate(); if (!((Object)(object)model == (Object)null)) { if (base.isHeld) { Vector3 heldPivot = HeldPivot; model.localRotation = HeldRot * modelBaseRot; model.localPosition = heldPivot + HeldRot * (modelBasePos - heldPivot) + HeldShift; } else { model.localRotation = modelBaseRot; model.localPosition = modelBasePos; } } } public override void PlayDropSFX() { if ((Object)(object)dropClip != (Object)null && (Object)(object)audioSource != (Object)null) { audioSource.PlayOneShot(dropClip); WalkieTalkie.TransmitOneShotAudio(audioSource, dropClip, 1f); } base.hasHitGround = true; } public override void OnBroughtToShip() { ((GrabbableObject)this).OnBroughtToShip(); if (!netRescued.Value) { if (((NetworkBehaviour)this).IsServer) { TryRescue(); } else { RescueServerRpc(); } } } [ServerRpc(RequireOwnership = false)] private void RescueServerRpc() { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_008c: Unknown result type (might be due to invalid IL or missing references) //IL_0096: Invalid comparison between Unknown and I4 //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_006d: Unknown result type (might be due to invalid IL or missing references) //IL_007c: 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) NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager; if (networkManager != null && networkManager.IsListening) { if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1 && (networkManager.IsClient || networkManager.IsHost)) { ServerRpcParams val2 = default(ServerRpcParams); FastBufferWriter val = ((NetworkBehaviour)this).__beginSendServerRpc(3129776640u, val2, (RpcDelivery)0); ((NetworkBehaviour)this).__endSendServerRpc(ref val, 3129776640u, val2, (RpcDelivery)0); } if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost)) { ((NetworkBehaviour)this).__rpc_exec_stage = (__RpcExecStage)0; TryRescue(); } } } private void TryRescue() { if (netRescued.Value || StartOfRound.Instance.inShipPhase || !InShip()) { return; } netRescued.Value = true; int value = Plugin.Cfg.RescueBounty.Value; if (value > 0) { Terminal val = Object.FindObjectOfType<Terminal>(); if (!((Object)(object)val == (Object)null)) { val.groupCredits += value; val.SyncGroupCreditsClientRpc(val.groupCredits, val.numberOfItemsInDropship); Plugin.Log.LogInfo((object)$"{CatName} rescued: +${value} (credits now {val.groupCredits})"); RescuedClientRpc(value); } } } private bool InShip() { //IL_002f: Unknown result type (might be due to invalid IL or missing references) //IL_0034: Unknown result type (might be due to invalid IL or missing references) //IL_003d: Unknown result type (might be due to invalid IL or missing references) if (base.isInShipRoom || ((Object)(object)base.playerHeldBy != (Object)null && base.playerHeldBy.isInHangarShipRoom)) { return true; } Bounds bounds = StartOfRound.Instance.shipInnerRoomBounds.bounds; return ((Bounds)(ref bounds)).Contains(((Component)this).transform.position); } [ClientRpc] private void RescuedClientRpc(int bounty) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_0099: Unknown result type (might be due to invalid IL or missing references) //IL_00a3: Invalid comparison between Unknown and I4 //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_006d: Unknown result type (might be due to invalid IL or missing references) //IL_0071: Unknown result type (might be due to invalid IL or missing references) //IL_0089: Unknown result type (might be due to invalid IL or missing references) //IL_00ce: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager; if (networkManager == null || !networkManager.IsListening) { return; } if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1 && (networkManager.IsServer || networkManager.IsHost)) { ClientRpcParams val2 = default(ClientRpcParams); FastBufferWriter val = ((NetworkBehaviour)this).__beginSendClientRpc(1878939114u, val2, (RpcDelivery)0); BytePacker.WriteValueBitPacked(val, bounty); ((NetworkBehaviour)this).__endSendClientRpc(ref val, 1878939114u, val2, (RpcDelivery)0); } if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsClient || networkManager.IsHost)) { ((NetworkBehaviour)this).__rpc_exec_stage = (__RpcExecStage)0; PendingBountyDisplay = bounty; HUDManager instance = HUDManager.Instance; if (instance != null) { instance.AddNewScrapFoundToDisplay((GrabbableObject)(object)this); } } } public override void GrabItem() { ((GrabbableObject)this).GrabItem(); if ((Object)(object)grabClip != (Object)null && (Object)(object)audioSource != (Object)null) { audioSource.PlayOneShot(grabClip, 0.8f); } } public override void DiscardItem() { ((GrabbableObject)this).DiscardItem(); if (((NetworkBehaviour)this).IsServer) { poseTimer = Random.Range(1.5f, 4f); shipTimer = Random.Range(20f, 45f); shipTimerSet = true; } } public override int GetItemDataToSave() { //IL_0006: Unknown result type (might be due to invalid IL or missing references) int num = Mathf.RoundToInt(Mathf.Repeat(((Component)this).transform.eulerAngles.y, 360f) / 2f) % 180; return (netSeed.Value & 0x3FFFFF) | (num << 22); } public override void LoadItemSaveData(int saveData) { ((GrabbableObject)this).LoadItemSaveData(saveData); pendingSeed = saveData & 0x3FFFFF; loadedFromSave = true; float num = (float)((saveData >> 22) & 0xFF) * 2f; base.floorYRot = Mathf.RoundToInt(Mathf.Repeat(num - 90f - (float)base.itemProperties.floorYOffset, 360f)); } private float AnimSpeedFor(byte g, float speed) { float num = ((g == 5) ? 1f : 0.13f) * size * modelBaseScale.y; return Mathf.Clamp(speed / Mathf.Max(num, 0.01f), 0.6f, (g == 5) ? 1.5f : 2.5f); } private void UpdateMovement(float dt) { //IL_0030: Unknown result type (might be due to invalid IL or missing references) //IL_0035: Unknown result type (might be due to invalid IL or missing references) //IL_00e6: Unknown result type (might be due to invalid IL or missing references) //IL_00ed: Unknown result type (might be due to invalid IL or missing references) //IL_00f2: Unknown result type (might be due to invalid IL or missing references) //IL_00f7: Unknown result type (might be due to invalid IL or missing references) //IL_00fc: Unknown result type (might be due to invalid IL or missing references) //IL_0101: 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_014b: Unknown result type (might be due to invalid IL or missing references) //IL_0150: Unknown result type (might be due to invalid IL or missing references) //IL_0128: Unknown result type (might be due to invalid IL or missing references) //IL_012d: Unknown result type (might be due to invalid IL or missing references) //IL_012e: Unknown result type (might be due to invalid IL or missing references) //IL_013a: Unknown result type (might be due to invalid IL or missing references) //IL_006c: Unknown result type (might be due to invalid IL or missing references) //IL_0071: Unknown result type (might be due to invalid IL or missing references) //IL_004f: Unknown result type (might be due to invalid IL or missing references) //IL_0076: Unknown result type (might be due to invalid IL or missing references) //IL_0077: Unknown result type (might be due to invalid IL or missing references) //IL_0078: Unknown result type (might be due to invalid IL or missing references) //IL_0080: Unknown result type (might be due to invalid IL or missing references) //IL_0081: Unknown result type (might be due to invalid IL or missing references) //IL_0082: Unknown result type (might be due to invalid IL or missing references) //IL_008e: Unknown result type (might be due to invalid IL or missing references) //IL_008f: Unknown result type (might be due to invalid IL or missing references) //IL_00bc: Unknown result type (might be due to invalid IL or missing references) //IL_00bd: Unknown result type (might be due to invalid IL or missing references) //IL_00bf: Unknown result type (might be due to invalid IL or missing references) //IL_00c4: Unknown result type (might be due to invalid IL or missing references) //IL_00a5: Unknown result type (might be due to invalid IL or missing references) //IL_00a6: Unknown result type (might be due to invalid IL or missing references) if (!IsMoving) { return; } if (base.isHeld || base.isHeldByEnemy) { path = null; return; } float num = moveSpeed * dt; Vector3 val = ((Component)this).transform.position; while (num > 0f && pathIndex < path.Length) { Vector3 val2 = (pathLocal ? StartOfRound.Instance.elevatorTransform.TransformPoint(path[pathIndex]) : path[pathIndex]); float num2 = Vector3.Distance(val, val2); if (IsSteep(val2 - val)) { val = val2; pathIndex++; } else if (num2 <= num) { val = val2; num -= num2; pathIndex++; } else { val = Vector3.MoveTowards(val, val2, num); num = 0f; } } Vector3 val3 = Vector3.ProjectOnPlane(val - ((Component)this).transform.position, Vector3.up); ((Component)this).transform.position = val; if (((Vector3)(ref val3)).sqrMagnitude > 1E-06f) { ((Component)this).transform.rotation = Quaternion.Slerp(((Component)this).transform.rotation, Quaternion.LookRotation(val3), dt * 10f); } base.targetFloorPosition = ((Component)this).transform.localPosition; if (pathIndex >= path.Length) { path = null; } } private static bool IsSteep(Vector3 seg) { //IL_0000: 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_0012: Unknown result type (might be due to invalid IL or missing references) //IL_0018: Unknown result type (might be due to invalid IL or missing references) //IL_001d: Unknown result type (might be due to invalid IL or missing references) float num = Mathf.Abs(seg.y); Vector2 val = new Vector2(seg.x, seg.z); float magnitude = ((Vector2)(ref val)).magnitude; if (num > 0.6f) { return num > magnitude * 1.2f; } return false; } [ClientRpc] private void MoveClientRpc(Vector3[] corners, float speed, byte newGait) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_00ff: Unknown result type (might be due to invalid IL or missing references) //IL_0109: Invalid comparison between Unknown and I4 //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_006d: Unknown result type (might be due to invalid IL or missing references) //IL_0088: Unknown result type (might be due to invalid IL or missing references) //IL_008e: Unknown result type (might be due to invalid IL or missing references) //IL_0134: Unknown result type (might be due to invalid IL or missing references) //IL_00ba: Unknown result type (might be due to invalid IL or missing references) //IL_00c0: Unknown result type (might be due to invalid IL or missing references) //IL_00d5: Unknown result type (might be due to invalid IL or missing references) //IL_00db: Unknown result type (might be due to invalid IL or missing references) //IL_00ef: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager; if (networkManager == null || !networkManager.IsListening) { return; } if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1 && (networkManager.IsServer || networkManager.IsHost)) { ClientRpcParams val2 = default(ClientRpcParams); FastBufferWriter val = ((NetworkBehaviour)this).__beginSendClientRpc(2172167736u, val2, (RpcDelivery)0); bool flag = corners != null; ((FastBufferWriter)(ref val)).WriteValueSafe<bool>(ref flag, default(ForPrimitives)); if (flag) { ((FastBufferWriter)(ref val)).WriteValueSafe(corners); } ((FastBufferWriter)(ref val)).WriteValueSafe<float>(ref speed, default(ForPrimitives)); ((FastBufferWriter)(ref val)).WriteValueSafe<byte>(ref newGait, default(ForPrimitives)); ((NetworkBehaviour)this).__endSendClientRpc(ref val, 2172167736u, val2, (RpcDelivery)0); } if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1 || (!networkManager.IsClient && !networkManager.IsHost)) { return; } ((NetworkBehaviour)this).__rpc_exec_stage = (__RpcExecStage)0; if (!base.isHeld && corners != null && corners.Length >= 2) { if (!base.isInShipRoom && (Object)(object)((Component)this).transform.parent == (Object)(object)StartOfRound.Instance.elevatorTransform) { ((Component)this).transform.SetParent(StartOfRound.Instance.propsContainer, true); base.isInElevator = false; } path = corners; pathLocal = false; pathIndex = 1; moveSpeed = speed; gait = newGait; } } [ClientRpc] private void StopClientRpc(Vector3 position, float yaw) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_00b4: Unknown result type (might be due to invalid IL or missing references) //IL_00be: Invalid comparison between Unknown and I4 //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_006d: Unknown result type (might be due to invalid IL or missing references) //IL_008a: Unknown result type (might be due to invalid IL or missing references) //IL_0090: Unknown result type (might be due to invalid IL or missing references) //IL_00a4: Unknown result type (might be due to invalid IL or missing references) //IL_00e9: Unknown result type (might be due to invalid IL or missing references) //IL_0104: 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_012c: Unknown result type (might be due to invalid IL or missing references) //IL_0131: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager; if (networkManager == null || !networkManager.IsListening) { return; } if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1 && (networkManager.IsServer || networkManager.IsHost)) { ClientRpcParams val2 = default(ClientRpcParams); FastBufferWriter val = ((NetworkBehaviour)this).__beginSendClientRpc(3896674073u, val2, (RpcDelivery)0); ((FastBufferWriter)(ref val)).WriteValueSafe(ref position); ((FastBufferWriter)(ref val)).WriteValueSafe<float>(ref yaw, default(ForPrimitives)); ((NetworkBehaviour)this).__endSendClientRpc(ref val, 3896674073u, val2, (RpcDelivery)0); } if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsClient || networkManager.IsHost)) { ((NetworkBehaviour)this).__rpc_exec_stage = (__RpcExecStage)0; path = null; if (!base.isHeld) { ((Component)this).transform.position = position; ((Component)this).transform.rotation = Quaternion.Euler(0f, yaw, 0f); base.targetFloorPosition = ((Component)this).transform.localPosition; } } } private void UpdateBrain(float dt) { //IL_012f: Unknown result type (might be due to invalid IL or missing references) //IL_0134: Unknown result type (might be due to invalid IL or missing references) //IL_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_0148: Unknown result type (might be due to invalid IL or missing references) //IL_019e: Unknown result type (might be due to invalid IL or missing references) //IL_01a9: 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_01cb: Unknown result type (might be due to invalid IL or missing references) //IL_030a: Unknown result type (might be due to invalid IL or missing references) //IL_0315: Unknown result type (might be due to invalid IL or missing references) //IL_031a: Unknown result type (might be due to invalid IL or missing references) //IL_031f: Unknown result type (might be due to invalid IL or missing references) //IL_0324: Unknown result type (might be due to invalid IL or missing references) //IL_0329: Unknown result type (might be due to invalid IL or missing references) //IL_032d: Unknown result type (might be due to invalid IL or missing references) //IL_0332: Unknown result type (might be due to invalid IL or missing references) //IL_033a: Unknown result type (might be due to invalid IL or missing references) //IL_033f: Unknown result type (might be due to invalid IL or missing references) //IL_0346: 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_0353: Unknown result type (might be due to invalid IL or missing references) //IL_02c3: Unknown result type (might be due to invalid IL or missing references) //IL_0376: 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) if (base.isHeld) { if (!netTamed.Value) { netTamed.Value = true; } if ((Object)(object)base.playerHeldBy != (Object)null) { followTarget = base.playerHeldBy; } mood = Mood.Calm; if (InTree || headingFor != null) { LeaveTree(); } if (netPose.Value == 6 || netPose.Value == 7) { netPose.Value = 1; } } else { if (base.isHeldByEnemy) { return; } if (netRescued.Value) { if (base.isInShipRoom) { ShipLife(dt); } } else { if ((base.isInShipRoom && !IsMoving) || (!base.reachedFloorTarget && !IsMoving)) { return; } StartOfRound instance = StartOfRound.Instance; if ((Object)(object)instance == (Object)null || instance.inShipPhase || !instance.shipHasLanded) { return; } brainTimer -= dt; if (brainTimer > 0f) { return; } brainTimer = 0.25f; if (netTamed.Value) { Follow(0.25f); return; } Vector3 val = ((Component)this).transform.position + Vector3.up * 0.3f; PlayerControllerB val2 = null; PlayerControllerB val3 = null; float num = float.MaxValue; float num2 = float.MaxValue; PlayerControllerB[] allPlayerScripts = instance.allPlayerScripts; foreach (PlayerControllerB val4 in allPlayerScripts) { if ((Object)(object)val4 == (Object)null || !val4.isPlayerControlled || val4.isPlayerDead) { continue; } float num3 = Vector3.Distance(((Component)val4).transform.position, ((Component)this).transform.position); if (num3 > 12f) { continue; } bool flag = !Physics.Linecast(val, ((Component)val4.gameplayCamera).transform.position, instance.collidersAndRoomMaskAndDefault, (QueryTriggerInteraction)1); if (!val4.isCrouching) { if (((flag && num3 < 8f) || num3 < 2.5f) && num3 < num) { val2 = val4; num = num3; } } else if (flag && num3 < num2) { val3 = val4; num2 = num3; } } if ((Object)(object)val2 != (Object)null) { calmTimer = 20f; bool num4 = mood != Mood.Alarmed; mood = Mood.Alarmed; bool flag2 = IsMoving && gait == 5; if ((num4 || num < 4.5f) && !flag2 && !Flee()) { FaceAndStop(((Component)val2).transform.position, 1); } } else if ((Object)(object)val3 != (Object)null) { mood = Mood.Coaxed; if (num2 <= 1.3f) { if (IsMoving) { FaceAndStop(((Component)val3).transform.position, 1); } return; } coaxRepathTimer -= 0.25f; if (!IsMoving || coaxRepathTimer <= 0f) { coaxRepathTimer = 1f; Vector3 val5 = Vector3.ProjectOnPlane(((Component)val3).transform.position - ((Component)this).transform.position, Vector3.up); Vector3 normalized = ((Vector3)(ref val5)).normalized; Vector3 dest = ((Component)val3).transform.position - normalized * 1f; if (!SendPath(dest, 0.55f, 4) && IsMoving) { FaceAndStop(((Component)val3).transform.position, 1); } } } else if (mood == Mood.Coaxed) { mood = Mood.Calm; if (IsMoving) { StopHere(1); } } else if (mood == Mood.Alarmed && !IsMoving) { calmTimer -= 0.25f; if (calmTimer <= 0f) { mood = Mood.Calm; } } } } } private void Follow(float tick) { //IL_000c: 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_0108: 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_0133: Unknown result type (might be due to invalid IL or missing references) //IL_0139: Unknown result type (might be due to invalid IL or missing references) //IL_00c2: Unknown result type (might be due to invalid IL or missing references) //IL_00cd: Unknown result type (might be due to invalid IL or missing references) //IL_0151: Unknown result type (might be due to invalid IL or missing references) //IL_0156: Unknown result type (might be due to invalid IL or missing references) //IL_0211: Unknown result type (might be due to invalid IL or missing references) //IL_0241: Unknown result type (might be due to invalid IL or missing references) //IL_0248: Unknown result type (might be due to invalid IL or missing references) //IL_024d: Unknown result type (might be due to invalid IL or missing references) //IL_0252: Unknown result type (might be due to invalid IL or missing references) //IL_0253: Unknown result type (might be due to invalid IL or missing references) //IL_0265: Unknown result type (might be due to invalid IL or missing references) //IL_026a: Unknown result type (might be due to invalid IL or missing references) //IL_0286: 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_02c0: Unknown result type (might be due to invalid IL or missing references) //IL_02c1: Unknown result type (might be due to invalid IL or missing references) //IL_02c7: Unknown result type (might be due to invalid IL or missing references) _ = StartOfRound.Instance; if (InShipCore(((Component)this).transform.position)) { followTarget = null; netPose.Value = 1; ArrivedInShipClientRpc(); SettleInShip(); return; } PlayerControllerB val = followTarget; if ((Object)(object)val == (Object)null || !val.isPlayerControlled || val.isPlayerDead) { followTarget = null; if (IsMoving) { StopHere(1); } return; } if (val.isInHangarShipRoom && InShipCore(((Component)val).transform.position) && !val.isInsideFactory && !base.isInFactory) { BoardShip(val); return; } if (val.isInsideFactory != base.isInFactory) { if (lastFollowDist < 12f) { if (Vector3.Distance(((Component)val).transform.position, ((Component)this).transform.position) > 40f) { HopTo(val, "entrance"); } return; } followTarget = null; if (IsMoving) { StopHere(1); } return; } float num = (lastFollowDist = Vector3.Distance(((Component)this).transform.position, ((Component)val).transform.position)); if (num > 3.6f) { if (Vector3.Distance(((Component)this).transform.position, stuckAnchor) > 0.4f) { stuckAnchor = ((Component)this).transform.position; stuckTimer = 0f; } else { stuckTimer += tick; } } else { stuckTimer = 0f; } if (num > 30f || stuckTimer > 4f) { HopTo(val, (num > 30f) ? $"{num:0}m behind" : "stuck"); stuckTimer = 0f; return; } if (!followRunning && num > 8f) { followRunning = true; } else if (followRunning && num < 4f) { followRunning = false; } if (num < 1.6f) { if (IsMoving) { FaceAndStop(((Component)val).transform.position, 1); } } else if (IsMoving || !(num < 2.6f)) { byte b = (byte)(followRunning ? 5 : 4); Vector3 val2 = ((Component)val).transform.position + FollowOffset(val); NavMeshHit val3 = default(NavMeshHit); if (NavMesh.SamplePosition(val2, ref val3, 3f, -1)) { val2 = ((NavMeshHit)(ref val3)).position; } followRepath -= tick; bool flag = followRepath <= 0f && Vector3.Distance(val2, lastFollowDest) > 0.75f; if (!IsMoving || gait != b || flag) { followRepath = 0.5f; lastFollowDest = val2; SendPath(val2, followRunning ? 6f : 0.9f, b, 80f); } } } private void BoardShip(PlayerControllerB t) { //IL_0018: Unknown result type (might be due to invalid IL or missing references) //IL_0027: Unknown result type (might be due to invalid IL or missing references) //IL_002c: Unknown result type (might be due to invalid IL or missing references) //IL_0035: 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_0051: Unknown result type (might be due to invalid IL or missing references) //IL_005b: Unknown result type (might be due to invalid IL or missing references) //IL_0060: Unknown result type (might be due to invalid IL or missing references) //IL_0065: Unknown result type (might be due to invalid IL or missing references) //IL_006e: Unknown result type (might be due to invalid IL or missing references) //IL_0083: Unknown result type (might be due to invalid IL or missing references) //IL_0084: Unknown result type (might be due to invalid IL or missing references) //IL_00c3: Unknown result type (might be due to invalid IL or missing references) //IL_009e: Unknown result type (might be due to invalid IL or missing references) //IL_00aa: Unknown result type (might be due to invalid IL or missing references) //IL_00b4: Unknown result type (might be due to invalid IL or missing references) //IL_00ba: Unknown result type (might be due to invalid IL or missing references) //IL_00c8: Unknown result type (might be due to invalid IL or missing references) //IL_00ca: Unknown result type (might be due to invalid IL or missing references) //IL_00d1: Unknown result type (might be due to invalid IL or missing references) StartOfRound instance = StartOfRound.Instance; HopTo(t, "boarding"); if (!InShipCore(((Component)this).transform.position)) { Bounds val = ShipCore(); Vector3 val2 = ((Bounds)(ref val)).ClosestPoint(new Vector3(((Component)t).transform.position.x, ((Bounds)(ref val)).center.y, ((Component)t).transform.position.z)); val2.y = ((Component)t).transform.position.y + 1f; RaycastHit val3 = default(RaycastHit); val2 = (Vector3)(Physics.Raycast(val2, Vector3.down, ref val3, 3f, instance.collidersAndRoomMaskAndDefault, (QueryTriggerInteraction)1) ? ((RaycastHit)(ref val3)).point : new Vector3(val2.x, ((Component)t).transform.position.y, val2.z)); TeleportClientRpc(val2, ((Component)t).transform.eulerAngles.y + 180f, inFactory: false); } followTarget = null; netPose.Value = 1; ArrivedInShipClientRpc(); SettleInShip(); } private static Bounds ShipCore() { //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_0021: Unknown result type (might be due to invalid IL or missing references) //IL_002b: Unknown result type (might be due to invalid IL or missing references) Bounds bounds = StartOfRound.Instance.shipInnerRoomBounds.bounds; ((Bounds)(ref bounds)).Expand(new Vector3(-1f, 0f, -1f)); return bounds; } private static bool InShipCore(Vector3 pos) { //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) //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_000e: Unknown result type (might be due to invalid IL or missing references) //IL_001a: Unknown result type (might be due to invalid IL or missing references) //IL_0022: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Unknown result type (might be due to invalid IL or missing references) //IL_0036: 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_004a: 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_005e: 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_0078: Unknown result type (might be due to invalid IL or missing references) Bounds val = ShipCore(); if (pos.x > ((Bounds)(ref val)).min.x && pos.x < ((Bounds)(ref val)).max.x && pos.z > ((Bounds)(ref val)).min.z && pos.z < ((Bounds)(ref val)).max.z && pos.y > ((Bounds)(ref val)).min.y - 0.5f) { return pos.y < ((Bounds)(ref val)).max.y; } return false; } private void SettleInShip() { //IL_000c: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Unknown result type (might be due to invalid IL or missing references) //IL_0018: Unknown result type (might be due to invalid IL or missing references) //IL_001d: Unknown result type (might be due to invalid IL or missing references) //IL_0027: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Unknown result type (might be due to invalid IL or missing references) //IL_003a: Unknown result type (might be due to invalid IL or missing references) //IL_0050: Unknown result type (might be due to invalid IL or missing references) //IL_005c: Unknown result type (might be due to invalid IL or missing references) //IL_006b: Unknown result type (might be due to invalid IL or missing references) //IL_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_007e: Unknown result type (might be due to invalid IL or missing references) //IL_008f: Unknown result type (might be due to invalid IL or missing references) //IL_0091: Unknown result type (might be due to invalid IL or missing references) //IL_00b0: Unknown result type (might be due to invalid IL or missing references) //IL_00ba: Unknown result type (might be due to invalid IL or missing references) //IL_00d2: Unknown result type (might be due to invalid IL or missing references) //IL_00d7: Unknown result type (might be due to invalid IL or missing references) //IL_00e7: Unknown result type (might be due to invalid IL or missing references) //IL_00e8: Unknown result type (might be due to invalid IL or missing references) //IL_00f2: Unknown result type (might be due to invalid IL or missing references) //IL_00f7: Unknown result type (might be due to invalid IL or missing references) //IL_00fe: Unknown result type (might be due to invalid IL or missing references) //IL_0103: Unknown result type (might be due to invalid IL or missing references) //IL_010d: Unknown result type (might be due to invalid IL or missing references) //IL_0112: Unknown result type (might be due to invalid IL or missing references) //IL_014f: 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_0159: Unknown result type (might be due to invalid IL or missing references) //IL_015e: Unknown result type (might be due to invalid IL or missing references) StartOfRound instance = StartOfRound.Instance; Bounds bounds = instance.shipInnerRoomBounds.bounds; Vector3 position = ((Component)this).transform.position; RaycastHit val2 = default(RaycastHit); for (int i = 0; i < 10; i++) { Vector3 val = Vector3.Lerp(((Bounds)(ref bounds)).center, new Vector3(Random.Range(((Bounds)(ref bounds)).min.x, ((Bounds)(ref bounds)).max.x), 0f, Random.Range(((Bounds)(ref bounds)).min.z, ((Bounds)(ref bounds)).max.z)), 0.7f); val.y = position.y + 1f; if (Physics.Raycast(val, Vector3.down, ref val2, 2f, instance.collidersAndRoomMaskAndDefault, (QueryTriggerInteraction)1) && !(Mathf.Abs(((RaycastHit)(ref val2)).point.y - position.y) > 0.3f) && !(Vector3.Distance(((RaycastHit)(ref val2)).point, position) < 1f) && !Physics.Linecast(position + Vector3.up * 0.3f, ((RaycastHit)(ref val2)).point + Vector3.up * 0.3f, instance.collidersAndRoomMaskAndDefault, (QueryTriggerInteraction)1)) { netPose.Value = 1; poseTimer = Random.Range(15f, 30f); MoveClientRpc((Vector3[])(object)new Vector3[2] { position, ((RaycastHit)(ref val2)).point }, 0.9f, 4); break; } } } private Vector3 FollowOffset(PlayerControllerB t) { //IL_0012: Unknown result type (might be due to invalid IL or missing references) //IL_0017: Unknown result type (might be due to invalid IL or missing references) //IL_001c: Unknown result type (might be due to invalid IL or missing references) //IL_0021: Unknown result type (might be due to invalid IL or missing references) //IL_0026: Unknown result type (might be due to invalid IL or missing references) //IL_002a: Unknown result type (might be due to invalid IL or missing references) //IL_002f: Unknown result type (might be due to invalid IL or missing references) //IL_0059: Unknown result type (might be due to invalid IL or missing references) //IL_005e: Unknown result type (might be due to invalid IL or missing references) //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0065: Unknown result type (might be due to invalid IL or missing references) int value = netSeed.Value; Vector3 val = Vector3.ProjectOnPlane(-((Component)t).transform.forward, Vector3.up); Vector3 normalized = ((Vector3)(ref val)).normalized; float num = (float)(value % 7 - 3) * 22f; float num2 = 1.1f + (float)(value % 3) * 0.35f; return Quaternion.Euler(0f, num, 0f) * normalized * num2; } private void HopTo(PlayerControllerB t, string reason) { //IL_000c: Unknown result type (might be due to invalid IL or missing references) //IL_0013: Unknown result type (might be due to invalid IL or missing references) //IL_0018: Unknown result type (might be due to invalid IL or missing references) //IL_001d: Unknown result type (might be due to invalid IL or missing references) //IL_0027: Unknown result type (might be due to invalid IL or missing references) //IL_002c: Unknown result type (might be due to invalid IL or missing references) //IL_0031: Unknown result type (might be due to invalid IL or missing references) //IL_0032: Unknown result type (might be due to invalid IL or missing references) //IL_0033: Unknown result type (might be due to invalid IL or missing references) //IL_005c: Unknown result type (might be due to invalid IL or missing references) //IL_0053: Unknown result type (might be due to invalid IL or missing references) //IL_0061: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_006d: Unknown result type (might be due to invalid IL or missing references) //IL_006e: Unknown result type (might be due to invalid IL or missing references) //IL_0073: Unknown result type (might be due to invalid IL or missing references) //IL_0078: Unknown result type (might be due to invalid IL or missing references) //IL_007d: Unknown result type (might be due to invalid IL or missing references) //IL_009e: Unknown result type (might be due to invalid IL or missing references) //IL_009f: Unknown result type (might be due to invalid IL or missing references) //IL_00a4: Unknown result type (might be due to invalid IL or missing references) //IL_00a8: Unknown result type (might be due to invalid IL or missing references) //IL_0092: 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) StartOfRound instance = StartOfRound.Instance; Vector3 val = ((Component)t).transform.position + FollowOffset(t) + Vector3.up * 0.5f; RaycastHit val2 = default(RaycastHit); val = (Physics.Raycast(val, Vector3.down, ref val2, 3f, instance.collidersAndRoomMaskAndDefault, (QueryTriggerInteraction)1) ? ((RaycastHit)(ref val2)).point : ((Component)t).transform.position); Vector3 val3 = Vector3.ProjectOnPlane(((Component)t).transform.position - val, Vector3.up); float y; if (!(((Vector3)(ref val3)).sqrMagnitude > 0.0001f)) { y = ((Component)this).transform.eulerAngles.y; } else { Quaternion val4 = Quaternion.LookRotation(val3); y = ((Quaternion)(ref val4)).eulerAngles.y; } float yaw = y; lastFollowDist = 0f; netPose.Value = 1; TeleportClientRpc(val, yaw, t.isInsideFactory); } [ClientRpc] private void TeleportClientRpc(Vector3 position, float yaw, bool inFactory) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_00cf: Unknown result type (might be due to invalid IL or missing references) //IL_00d9: Invalid comparison between Unknown and I4 //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_006d: Unknown result type (might be due to invalid IL or missing references) //IL_008a: Unknown result type (might be due to invalid IL or missing references) //IL_0090: Unknown result type (might be due to invalid IL or missing references) //IL_00a5: Unknown result type (might be due to invalid IL or missing references) //IL_00ab: Unknown result type (might be due to invalid IL or missing references) //IL_00bf: Unknown result type (might be due to invalid IL or missing references) //IL_0104: Unknown result type (might be due to invalid IL or missing references) //IL_0126: 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_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) NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager; if (networkManager == null || !networkManager.IsListening) { return; } if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1 && (networkManager.IsServer || networkManager.IsHost)) { ClientRpcParams val2 = default(ClientRpcParams); FastBufferWriter val = ((NetworkBehaviour)this).__beginSendClientRpc(3223185232u, val2, (RpcDelivery)0); ((FastBufferWriter)(ref val)).WriteValueSafe(ref position); ((FastBufferWriter)(ref val)).WriteValueSafe<float>(ref yaw, default(ForPrimitives)); ((FastBufferWriter)(ref val)).WriteValueSafe<bool>(ref inFactory, default(ForPrimitives)); ((NetworkBehaviour)this).__endSendClientRpc(ref val, 3223185232u, val2, (RpcDelivery)0); } if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsClient || networkManager.IsHost)) { ((NetworkBehaviour)this).__rpc_exec_stage = (__RpcExecStage)0; path = null; if (!base.isHeld) { base.isInFactory = inFactory; ((Component)this).transform.position = position; ((Component)this).transform.rotation = Quaternion.Euler(0f, yaw, 0f); base.targetFloorPosition = ((Component)this).transform.localPosition; } } } [ClientRpc] private void ArrivedInShipClientRpc() { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_008c: Unknown result type (might be due to invalid IL or missing references) //IL_0096: Invalid comparison between Unknown and I4 //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_006d: Unknown result type (might be due to invalid IL or missing references) //IL_007c: 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_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) NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager; if (networkManager == null || !networkManager.IsListening) { return; } if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1 && (networkManager.IsServer || networkManager.IsHost)) { ClientRpcParams val2 = default(ClientRpcParams); FastBufferWriter val = ((NetworkBehaviour)this).__beginSendClientRpc(38956220u, val2, (RpcDelivery)0); ((NetworkBehaviour)this).__endSendClientRpc(ref val, 38956220u, val2, (RpcDelivery)0); } if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1 || (!networkManager.IsClient && !networkManager.IsHost)) { return; } ((NetworkBehaviour)this).__rpc_exec_stage = (__RpcExecStage)0; path = null; if (!base.isHeld) { ((Component)this).transform.SetParent(StartOfRound.Instance.elevatorTransform, true); base.targetFloorPosition = ((Component)this).transform.localPosition; PlayerControllerB localPlayerController = GameNetworkManager.Instance.localPlayerController; if (localPlayerController != null) { localPlayerController.SetItemInElevator(true, true, (GrabbableObject)(object)this); } } } private bool Flee() { //IL_000c: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Unknown result type (might be due to invalid IL or missing references) //IL_0012: Unknown result type (might be due to invalid IL or missing references) //IL_0017: Unknown result type (might be due to invalid IL or missing references) //IL_0033: Unknown result type (might be due to invalid IL or missing references) //IL_003b: Unknown result type (might be due to invalid IL or missing references) //IL_0040: Unknown result type (might be due to invalid IL or missing references) //IL_0045: Unknown result type (might be due to invalid IL or missing references) //IL_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_00ad: 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_005f: 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_0078: Unknown result type (might be due to invalid IL or missing references) //IL_007d: Unknown result type (might be due to invalid IL or missing references) //IL_0082: 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_00c7: 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_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_0120: 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_013c: Unknown result type (might be due to invalid IL or missing references) //IL_00f7: Unknown result type (might be due to invalid IL or missing references) //IL_00f8: Unknown result type (might be due to invalid IL or missing references) //IL_0104: Unknown result type (might be due to invalid IL or missing references) //IL_010b: Unknown result type (might be due to invalid IL or missing references) //IL_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_0119: Unknown result type (might be due to invalid IL or missing references) //IL_01fb: Unknown result type (might be due to invalid IL or missing references) //IL_0141: 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_0155: Unknown result type (might be due to invalid IL or missing references) //IL_0166: Unknown result type (might be due to invalid IL or missing references) //IL_016b: Unknown result type (might be due to invalid IL or missing references) //IL_01a5: 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_01db: Unknown result type (might be due to invalid IL or missing references) //IL_01e0: Unknown result type (might be due to invalid IL or missing references) StartOfRound instance = StartOfRound.Instance; Vector3 position = ((Component)this).transform.position; Vector3 val = Vector3.zero; PlayerControllerB[] allPlayerScripts = instance.allPlayerScripts; foreach (PlayerControllerB val2 in allPlayerScripts) { if (IsStanding(val2)) { Vector3 val3 = Vector3.ProjectOnPlane(position - ((Component)val2).transform.position, Vector3.up); if (((Vector3)(ref val3)).magnitude < 12f) { val += ((Vector3)(ref val3)).normalized / Mathf.Max(((Vector3)(ref val3)).magnitude, 0.5f); } } } val = ((((Vector3)(ref val)).sqrMagnitude > 1E-06f) ? ((Vector3)(ref val)).normalized : ((Component)this).transform.forward); NavMeshHit val7 = default(NavMeshHit); for (int j = 0; j < 4; j++) { bool flag = j == 3; Vector3 dest = Vector3.zero; float num = float.MinValue; for (int k = 0; k < 14; k++) { Vector2 val4 = Random.insideUnitCircle * (0.9f + (float)j * 0.6f); Vector3 val5; Vector3 normalized; if (!flag) { val5 = val + new Vector3(val4.x, 0f, val4.y); normalized = ((Vector3)(ref val5)).normalized; } else { val5 = new Vector3(val4.x, 0f, val4.y); normalized = ((Vector3)(ref val5)).normalized; } Vector3 val6 = normalized; if (((Vector3)(ref val6)).sqrMagnitude < 0.0001f || !NavMesh.SamplePosition(position + val6 * Random.Range(8f, 14f), ref val7, 2f, -1)) { continue; } float num2 = float.MaxValue; allPlayerScripts = instance.allPlayerScripts; foreach (PlayerControllerB val8 in allPlayerScripts) { if (IsStanding(val8)) { num2 = Mathf.Min(num2, Vector3.Distance(((NavMeshHit)(ref val7)).position, ((Component)val8).transform.position)); } } if (num2 > num) { num = num2; dest = ((NavMeshHit)(ref val7)).position; } } if (num > 4.5f && SendPath(dest, 7.5f, 5)) { return true; } } return false; } private static bool IsStanding(PlayerControllerB p) { if ((Object)(object)p != (Object)null && p.isPlayerControlled && !p.isPlayerDead) { return !p.isCrouching; } return false; } private bool SendPath(Vector3 dest, float speed, byte newGait, float maxLength = 42f) { //IL_0019: 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_0013: Expected O, but got Unknown //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_004b: 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_00a3: Unknown result type (might be due to invalid IL or missing references) //IL_00a8: Unknown result type (might be due to invalid IL or missing references) if (navPath == null) { navPath = new NavMeshPath(); } NavMeshHit val = default(NavMeshHit); if (!NavMesh.SamplePosition(((Component)this).transform.position, ref val, 1.5f, -1)) { return false; } if (!NavMesh.CalculatePath(((NavMeshHit)(ref val)).position, dest, -1, navPath) || (int)navPath.status != 0) { return false; } Vector3[] corners = navPath.corners; if (corners.Length < 2) { return false; } float num = 0f; for (int i = 1; i < corners.Length; i++) { num += Vector3.Distance(corners[i - 1], corners[i]); } if (num > maxLength) { return false; } corners[0] = ((Component)this).transform.position; netPose.Value = 1; MoveClientRpc(corners, speed, newGait); return true; } private void FaceAndStop(Vector3 lookAt, byte restPose) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Unknown result type (might be due to invalid IL or missing references) //IL_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_003c: Unknown result type (might be due to invalid IL or missing references) //IL_003d: Unknown result type (might be due to invalid IL or missing references) //IL_0042: 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_0030: 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) Vector3 val = Vector3.ProjectOnPlane(lookAt - ((Component)this).transform.position, Vector3.up); float y; if (!(((Vector3)(ref val)).sqrMagnitude > 0.0001f)) { y = ((Component)this).transform.eulerAngles.y; } else { Quaternion val2 = Quaternion.LookRotation(val); y = ((Quaternion)(ref val2)).eulerAngles.y; } float yaw = y; netPose.Value = restPose; poseTimer = Random.Range(20f, 40f); StopClientRpc(((Component)this).transform.position, yaw); } private void StopHere(byte restPose) { //IL_0028: Unknown result type (might be due to invalid IL or missing references) //IL_0033: Unknown result type (might be due to invalid IL or missing references) netPose.Value = restPose; poseTimer = Random.Range(20f, 40f); StopClientRpc(((Component)this).transform.position, ((Component)this).transform.eulerAngles.y); } internal bool IsOnSpot(PerchHost.Spot s) { //IL_0009: Unknown result type (might be due to invalid IL or missing references) //IL_0014: Unknown result type (might be due to invalid IL or missing references) //IL_0019: Unknown result type (might be due to invalid IL or missing references) //IL_001e: Unknown result type (might be due to invalid IL or missing references) if (s != null) { Vector3 val = ((Component)this).transform.position - s.Point.position; return ((Vector3)(ref val)).sqrMagnitude < 0.040000003f; } return false; } internal bool Claims(PerchHost.Spot s) { if (treeSpot != s || !IsOnSpot(s)) { return headingFor == s; } return true; } internal static bool TryParsePose(string clip, out byte pose) { switch (clip) { case "Idle": pose = 0; return true; case "Sit": pose = 1; return true; case "Loaf": pose = 2; return true; case "Curl": pose = 6; return true; case "Drape": pose = 7; return true; default: pose = 0; return false; } } private void ShipLife(float dt) { //IL_0111: 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_0165: Unknown result type (might be due to invalid IL or missing references) //IL_016a: Unknown result type (might be due to invalid IL or missing references) //IL_017d: Unknown result type (might be due to invalid IL or missing references) //IL_018f: Unknown result type (might be due to invalid IL or missing references) //IL_01a1: 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_01b6: Unknown result type (might be due to invalid IL or missing references) if (!shipTimerSet) { shipTimerSet = true; shipTimer = Random.Range(10f, 40f); } shipTimer -= dt; brainTimer -= dt; if (brainTimer > 0f) { return; } brainTimer = 0.5f; if (treeSpot != null) { PerchHost host = treeSpot.Host; bool flag = (Object)(object)host != (Object)null && host.IsOut; if (!flag || !IsOnSpot(treeSpot)) { LeaveTree(); if (flag) { HopOffTree(host); } else { DropToFloor(); } } else if (shipTimer <= 0f) { HopOffTree(host); } } else { if (IsMoving) { return; } if (headingFor != null) { PerchHost.Spot spot = headingFor; headingFor = null; if ((Object)(object)spot.Host != (Object)null && spot.Host.IsOut && spot.Host.Spots.Contains(spot) && Vector3.Distance(((Component)this).transform.position, spot.Point.position) < 3f) { ClimbInto(spot); } } else { if (!base.reachedFloorTarget) { return; } foreach (PerchHost item in PerchHost.All) { if (!item.IsOut) { continue; } Bounds footprint = item.Footprint; ((Bounds)(ref footprint)).Expand(new Vector3(0.3f, 0.6f, 0.3f)); if (!((Bounds)(ref footprint)).Contains(((Component)this).transform.position)) { continue; } float y = ((Component)this).transform.position.y; Bounds footprint2 = item.Footprint; if (!(y < ((Bounds)(ref footprint2)).min.y + 0.35f)) { PerchHost.Spot spot2 = item.Spots.Find(delegate(PerchHost.Spot s) { //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Unknown result type (might be due to invalid IL or missing references) //IL_0016: Unknown result type (might be due to invalid IL or missing references) //IL_001b: Unknown result type (might be due to invalid IL or missing references) Vector3 val = s.Point.position - ((Component)this).transform.position; return ((Vector3)(ref val)).sqrMagnitude < 0.16000001f && ((Object)(object)s.Occupant == (Object)null || (Object)(object)s.Occupant == (Object)(object)this || !s.Occupant.Claims(s)); }); if (spot2 != null) { ClimbInto(spot2); } else { HopOffTree(item); } return; } } if (!(shipTimer > 0f)) { shipTimer = Random.Range(25f, 60f); if (!PerchHost.FreeSpots().Any() || !(Random.value < 0.45f) || !GoToSpot(PerchHost.RandomFreeSpot())) { Wander(); } } } } } private bool GoToSpot(PerchHost.Spot spot) { //IL_000f: Unknown result type (might be due to invalid IL or missing references) //IL_002d: Unknown result type (might be due to invalid IL or missing references) //IL_0034: Unknown result type (might be due to invalid IL or missing references) //IL_0048: Unknown result type (might be due to invalid IL or missing references) if (spot == null || !spot.Host.FloorBeside(((Component)this).transform.position, out var point)) { return false; } headingFor = spot; spot.Occupant = this; if (Vector3.Distance(point, ((Component)this).transform.position) < 0.5f) { return true; } if (ShipWalkTo(point)) { return true; } headingFor = null; spot.Occupant = null; return false; } private void ClimbInto(PerchHost.Spot spot) { //IL_003b: Unknown result type (might be due to invalid IL or missing references) treeSpot = spot; spot.Occupant = this; netPose.Value = spot.Pose; shipTimer = Random.Range(60f, 180f); ShipTeleport(spot.Point.position, PerchHost.SpotYaw(spot)); } private void LeaveTree() { treeSpot?.Host?.Release(this); headingFor?.Host?.Release(this); treeSpot = null; headingFor = null; } private void HopOffTree(PerchHost host) { //IL_0043: Unknown result type (might be due to invalid IL or missing references) //IL_0058: Unknown result type (might be due to invalid IL or missing references) //IL_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_0062: Unknown result type (might be due to invalid IL or missing references) //IL_0067: Unknown result type (might be due to invalid IL or missing references) //IL_006c: Unknown result type (might be due to invalid IL or missing references) //IL_0071: Unknown result type (might be due to invalid IL or missing references) //IL_0076: Unknown result type (might be due to invalid IL or missing references) //IL_0078: Unknown result type (might be due to invalid IL or missing references) //IL_0099: Unknown result type (might be due to invalid IL or missing references) //IL_009a: Unknown result type (might be due to invalid IL or missing references) //IL_009f: 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_008d: Unknown result type (might be due to invalid IL or missing references) LeaveTree(); netPose.Value = 1; poseTimer = Random.Range(15f, 30f); shipTimer = Random.Range(20f, 50f); if (!host.FloorBeside(((Component)this).transform.position, out var point)) { DropToFloor(); return; } Vector3 val = point; Bounds footprint = host.Footprint; Vector3 val2 = Vector3.ProjectOnPlane(val - ((Bounds)(ref footprint)).center, Vector3.up); Vector3 world = point; float y; if (!(((Vector3)(ref val2)).sqrMagnitude > 0.0001f)) { y = ((Component)this).transform.eulerAngles.y; } else { Quaternion val3 = Quaternion.LookRotation(val2); y = ((Quaternion)(ref val3)).eulerAngles.y; } ShipTeleport(world, y); } private void DropToFloor() { //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_001d: 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_003a: 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_0058: 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_0075: Unknown result type (might be due to invalid IL or missing references) //IL_00ef: Unknown result type (might be due to invalid IL or missing references) //IL_00c0: Unknown result type (might be due to invalid IL or missing references) //IL_009e: Unknown result type (might be due to invalid IL or missing references) //IL_00aa: Unknown result type (might be due to invalid IL or missing references) StartOfRound instance = StartOfRound.Instance; Bounds val = ShipCore(); Vector3? val2 = null; RaycastHit val3 = default(RaycastHit); for (int i = 0; i < 12; i++) { if (Physics.Raycast(new Vector3(Random.Range(((Bounds)(ref val)).min.x, ((Bounds)(ref val)).max.x), ((Bounds)(ref val)).max.y - 0.1f, Random.Range(((Bounds)(ref val)).min.z, ((Bounds)(ref val)).max.z)), Vector3.down, ref val3, ((Bounds)(ref val)).size.y + 1f, instance.collidersAndRoomMaskAndDefault, (QueryTriggerInteraction)1) && (!val2.HasValue || ((RaycastHit)(ref val3)).point.y < val2.Value.y - 0.05f)) { val2 = ((RaycastHit)(ref val3)).point; } } if (val2.HasValue) { netPose.Value = 1; ShipTeleport(val2.Value, Random.Range(0f, 360f)); } } private void Wander() { //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_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_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_0028: 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_0045: 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_0053: Unknown result type (might be due to invalid IL or missing references) //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0065: 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_007b: Unknown result type (might be due to invalid IL or missing references) //IL_008a: Unknown result type (might be due to invalid IL or missing references) //IL_0093: Unknown result type (might be due to invalid IL or missing references) //IL_009f: Unknown result type (might be due to invalid IL or missing references) //IL_00a8: Unknown result type (might be due to invalid IL or missing references) //IL_00b4: 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_00c9: 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_00e7: Unknown result type (might be due to invalid IL or missing references) //IL_00f1: Unknown result type (might be due to invalid IL or missing references) //IL_0107: Unknown result type (might be due to invalid IL or missing references) StartOfRound instance = StartOfRound.Instance; Bounds val = ShipCore(); Vector3 position = ((Component)this).transform.position; Vector3 val3 = default(Vector3); RaycastHit val4 = default(RaycastHit); for (int i = 0; i < 10; i++) { Vector2 insideUnitCircle = Random.insideUnitCircle; Vector2 val2 = ((Vector2)(ref insideUnitCircle)).normalized * Random.Range(1.5f, 5f); ((Vector3)(ref val3))..ctor(position.x + val2.x, position.y + 1f, position.z + val2.y); if (!(val3.x < ((Bounds)(ref val)).min.x) && !(val3.x > ((Bounds)(ref val)).max.x) && !(val3.z < ((Bounds)(ref val)).min.z) && !(val3.z > ((Bounds)(ref val)).max.z) && Physics.Raycast(val3, Vector3.down, ref val4, 2f, instance.collidersAndRoomMaskAndDefault, (QueryTriggerInteraction)1) && !(Mathf.Abs(((RaycastHit)(ref val4)).point.y - position.y) > 0.3f) && ShipWalkTo(((RaycastHit)(ref val4)).point)) { break; } } } private bool ShipWalkTo(Vector3 dest) { //IL_000c: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Unknown result type (might be due to invalid IL or missing references) //IL_0012: Unknown result type (might be due to invalid IL or missing references) //IL_0013: Unknown result type (might be due to invalid IL or missing references) //IL_001d: Unknown result type (might be due to invalid IL or missing references) //IL_0022: Unknown result type (might be due to invalid IL or missing references) //IL_0027: Unknown result type (might be due to invalid IL or missing references) //IL_0028: Unknown result type (might be due to invalid IL or missing references) //IL_0032: Unknown result type (might be due to invalid IL or missing references) //IL_0037: Unknown result type (might be due to invalid IL or missing references) //IL_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_0084: Unknown result type (might be due to invalid IL or missing references) //IL_008c: Unknown result type (might be due to invalid IL or missing references) //IL_008d: Unknown result type (might be due to invalid IL or missing references) //IL_0092: Unknown result type (might be due to invalid IL or missing references) StartOfRound instance = StartOfRound.Instance; Vector3 position = ((Component)this).transform.position; if (Physics.Linecast(position + Vector3.up * 0.3f, dest + Vector3.up * 0.3f, instance.collidersAndRoomMaskAndDefault, (QueryTriggerInteraction)1)) { return false; } Transform elevatorTransform = instance.elevatorTransform; netPose.Value = 1; poseTimer = Random.Range(15f, 30f); ShipMoveClientRpc((Vector3[])(object)new Vector3[2] { elevatorTransform.InverseTransformPoint(position), elevatorTransform.InverseTransformPoint(dest) }, 0.9f, 4); return true; } private void ShipTeleport(Vector3 world, float yaw) { //IL_000c: 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) Transform elevatorTransform = StartOfRound.Instance.elevatorTransform; float localYaw = Mathf.DeltaAngle(elevatorTransform.eulerAngles.y, yaw); ShipTeleportClientRpc(elevatorTransform.InverseTransformPoint(world), localYaw); } [ClientRpc] private void ShipMoveClientRpc(Vector3[] localCorners, float speed, byte newGait) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_00ff: Unknown result type (might be due to invalid IL or missing references) //IL_0109: Invalid comparison between Unknown and I4 //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_006d: Unknown result type (might be due to invalid IL or missing references) //IL_0088: Unknown result type (might be due to invalid IL or missing references) //IL_008e: Unknown result type (might be due to invalid IL or missing references) //IL_0134: Unknown result type (might be due to invalid IL or missing references) //IL_00ba: Unknown result type (might be due to invalid IL or missing references) //IL_00c0: Unknown result type (might be due to invalid IL or missing references) //IL_00d5: Unknown result type (might be due to invalid IL or missing references) //IL_00db: Unknown result type (might be due to invalid IL or missing references) //IL_00ef: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager; if (networkManager == null || !networkManager.IsListening) { return; } if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1 && (networkManager.IsServer || networkManager.IsHost)) { ClientRpcParams val2 = default(ClientRpcParams); FastBufferWriter val = ((NetworkBehaviour)this).__beginSendClientRpc(2811781274u, val2, (RpcDelivery)0); bool flag = localCorners != null; ((FastBufferWriter)(ref val)).WriteValueSafe<bool>(ref flag, default(ForPrimitives)); if (flag) { ((FastBufferWriter)(ref val)).WriteValueSafe(localCorners); } ((FastBufferWriter)(ref val)).WriteValueSafe<float>(ref speed, default(ForPrimitives)); ((FastBufferWriter)(ref val)).WriteValueSafe<byte>(ref newGait, default(ForPrimitives)); ((NetworkBehaviour)this).__endSendClientRpc(ref val, 2811781274u, val2, (RpcDeli